diff options
444 files changed, 22595 insertions, 8628 deletions
diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx index 22157b1e0e4d..90c5e7b4cc0e 100644 --- a/basebmp/source/bitmapdevice.cxx +++ b/basebmp/source/bitmapdevice.cxx @@ -1207,6 +1207,7 @@ void BitmapDevice::drawPolygon( const basegfx::B2DPolygon& rPoly, const sal_uInt32 numVertices( rPoly.count() ); if( numVertices ) + { if( isCompatibleClipMask( rClip ) ) drawPolygon_i( rPoly, mpImpl->maLineClipRect, @@ -1214,6 +1215,7 @@ void BitmapDevice::drawPolygon( const basegfx::B2DPolygon& rPoly, else getGenericRenderer()->drawPolygon( rPoly, lineColor, drawMode, rClip ); + } } void BitmapDevice::fillPolyPolygon( const basegfx::B2DPolyPolygon& rPoly, diff --git a/basebmp/test/makefile.mk b/basebmp/test/makefile.mk index c1ae2961106e..1412a7602161 100644 --- a/basebmp/test/makefile.mk +++ b/basebmp/test/makefile.mk @@ -132,6 +132,6 @@ unittest : $(SHL1TARGETN) @echo ---------------------------------------------------------- @echo - start unit test on library $(SHL1TARGETN) @echo ---------------------------------------------------------- - testshl2 $(SHL1TARGETN) + testshl2 -sf $(mktmp ) $(SHL1TARGETN) ALLTAR : unittest diff --git a/basegfx/inc/basegfx/color/bcolor.hxx b/basegfx/inc/basegfx/color/bcolor.hxx index 0ce3321c798e..f19f7e74080f 100644 --- a/basegfx/inc/basegfx/color/bcolor.hxx +++ b/basegfx/inc/basegfx/color/bcolor.hxx @@ -208,6 +208,13 @@ namespace basegfx mfZ = basegfx::clamp(mfZ, 0.0, 1.0); } + void invert() + { + mfX = 1.0 - mfX; + mfY = 1.0 - mfY; + mfZ = 1.0 - mfZ; + } + static const BColor& getEmptyBColor() { return (const BColor&) ::basegfx::B3DTuple::getEmptyTuple(); diff --git a/basegfx/inc/basegfx/pixel/bpixel.hxx b/basegfx/inc/basegfx/pixel/bpixel.hxx index 25c6dc274ecc..df3b72e9d21f 100644 --- a/basegfx/inc/basegfx/pixel/bpixel.hxx +++ b/basegfx/inc/basegfx/pixel/bpixel.hxx @@ -55,45 +55,45 @@ namespace basegfx unsigned mnG : 8; // green intensity unsigned mnB : 8; // blue intensity unsigned mnO : 8; // opacity, 0 == full transparence - } maRGBO; + } maRGBO; struct { // bitfield unsigned mnValue : 32; // all values - } maCombinedRGBO; - }; + } maCombinedRGBO; + } maPixelUnion; public: BPixel() { - maCombinedRGBO.mnValue = 0L; + maPixelUnion.maCombinedRGBO.mnValue = 0L; } // use explicit here to make sure everyone knows what he is doing. Values range from // 0..255 integer here. explicit BPixel(sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue, sal_uInt8 nOpacity) { - maRGBO.mnR = nRed; - maRGBO.mnG = nGreen; - maRGBO.mnB = nBlue; - maRGBO.mnO = nOpacity; + maPixelUnion.maRGBO.mnR = nRed; + maPixelUnion.maRGBO.mnG = nGreen; + maPixelUnion.maRGBO.mnB = nBlue; + maPixelUnion.maRGBO.mnO = nOpacity; } // constructor from BColor which uses double precision color, so change it // to local integer format. It will also be clamped here. BPixel(const BColor& rColor, sal_uInt8 nOpacity) { - maRGBO.mnR = sal_uInt8((rColor.getRed() * 255.0) + 0.5); - maRGBO.mnG = sal_uInt8((rColor.getGreen() * 255.0) + 0.5); - maRGBO.mnB = sal_uInt8((rColor.getBlue() * 255.0) + 0.5); - maRGBO.mnO = nOpacity; + maPixelUnion.maRGBO.mnR = sal_uInt8((rColor.getRed() * 255.0) + 0.5); + maPixelUnion.maRGBO.mnG = sal_uInt8((rColor.getGreen() * 255.0) + 0.5); + maPixelUnion.maRGBO.mnB = sal_uInt8((rColor.getBlue() * 255.0) + 0.5); + maPixelUnion.maRGBO.mnO = nOpacity; } // copy constructor BPixel(const BPixel& rPixel) { - maCombinedRGBO.mnValue = rPixel.maCombinedRGBO.mnValue; + maPixelUnion.maCombinedRGBO.mnValue = rPixel.maPixelUnion.maCombinedRGBO.mnValue; } ~BPixel() @@ -102,39 +102,39 @@ namespace basegfx // assignment operator BPixel& operator=( const BPixel& rPixel ) { - maCombinedRGBO.mnValue = rPixel.maCombinedRGBO.mnValue; + maPixelUnion.maCombinedRGBO.mnValue = rPixel.maPixelUnion.maCombinedRGBO.mnValue; return *this; } // data access read - sal_uInt8 getRed() const { return maRGBO.mnR; } - sal_uInt8 getGreen() const { return maRGBO.mnG; } - sal_uInt8 getBlue() const { return maRGBO.mnB; } - sal_uInt8 getOpacity() const { return maRGBO.mnO; } - sal_uInt32 getRedGreenBlueOpacity() const { return maCombinedRGBO.mnValue; } + sal_uInt8 getRed() const { return maPixelUnion.maRGBO.mnR; } + sal_uInt8 getGreen() const { return maPixelUnion.maRGBO.mnG; } + sal_uInt8 getBlue() const { return maPixelUnion.maRGBO.mnB; } + sal_uInt8 getOpacity() const { return maPixelUnion.maRGBO.mnO; } + sal_uInt32 getRedGreenBlueOpacity() const { return maPixelUnion.maCombinedRGBO.mnValue; } // data access write - void setRed(sal_uInt8 nNew) { maRGBO.mnR = nNew; } - void setGreen(sal_uInt8 nNew) { maRGBO.mnG = nNew; } - void setBlue(sal_uInt8 nNew) { maRGBO.mnB = nNew; } - void setOpacity(sal_uInt8 nNew) { maRGBO.mnO = nNew; } - void setRedGreenBlueOpacity(sal_uInt32 nRedGreenBlueOpacity) { maCombinedRGBO.mnValue = nRedGreenBlueOpacity; } - void setRedGreenBlue(sal_uInt8 nR, sal_uInt8 nG, sal_uInt8 nB) { maRGBO.mnR = nR; maRGBO.mnG = nG; maRGBO.mnB = nB; } + void setRed(sal_uInt8 nNew) { maPixelUnion.maRGBO.mnR = nNew; } + void setGreen(sal_uInt8 nNew) { maPixelUnion.maRGBO.mnG = nNew; } + void setBlue(sal_uInt8 nNew) { maPixelUnion.maRGBO.mnB = nNew; } + void setOpacity(sal_uInt8 nNew) { maPixelUnion.maRGBO.mnO = nNew; } + void setRedGreenBlueOpacity(sal_uInt32 nRedGreenBlueOpacity) { maPixelUnion.maCombinedRGBO.mnValue = nRedGreenBlueOpacity; } + void setRedGreenBlue(sal_uInt8 nR, sal_uInt8 nG, sal_uInt8 nB) { maPixelUnion.maRGBO.mnR = nR; maPixelUnion.maRGBO.mnG = nG; maPixelUnion.maRGBO.mnB = nB; } // comparators - bool isInvisible() const { return (0 == maRGBO.mnO); } - bool isVisible() const { return (0 != maRGBO.mnO); } + bool isInvisible() const { return (0 == maPixelUnion.maRGBO.mnO); } + bool isVisible() const { return (0 != maPixelUnion.maRGBO.mnO); } bool isEmpty() const { return isInvisible(); } bool isUsed() const { return isVisible(); } bool operator==( const BPixel& rPixel ) const { - return (rPixel.maCombinedRGBO.mnValue == maCombinedRGBO.mnValue); + return (rPixel.maPixelUnion.maCombinedRGBO.mnValue == maPixelUnion.maCombinedRGBO.mnValue); } bool operator!=( const BPixel& rPixel ) const { - return (rPixel.maCombinedRGBO.mnValue != maCombinedRGBO.mnValue); + return (rPixel.maPixelUnion.maCombinedRGBO.mnValue != maPixelUnion.maCombinedRGBO.mnValue); } // empty element diff --git a/basegfx/inc/basegfx/range/basicrange.hxx b/basegfx/inc/basegfx/range/basicrange.hxx index e3ac22b7f2c1..a7c402c905c8 100644 --- a/basegfx/inc/basegfx/range/basicrange.hxx +++ b/basegfx/inc/basegfx/range/basicrange.hxx @@ -49,8 +49,8 @@ namespace basegfx typedef Traits TraitsType; BasicRange() : - mnMinimum(Traits::initMin()), - mnMaximum(Traits::initMax()) + mnMinimum(Traits::maxVal()), + mnMaximum(Traits::minVal()) { } @@ -68,13 +68,13 @@ namespace basegfx void reset() { - mnMinimum = Traits::initMin(); - mnMaximum = Traits::initMax(); + mnMinimum = Traits::maxVal(); + mnMaximum = Traits::minVal(); } bool isEmpty() const { - return Traits::initMin() == mnMinimum; + return Traits::maxVal() == mnMinimum; } T getMinimum() const { return mnMinimum; } @@ -271,8 +271,8 @@ namespace basegfx // some pre-fabricated traits struct DoubleTraits { - static double initMin() { return DBL_MAX; }; - static double initMax() { return DBL_MIN; }; + static double minVal() { return DBL_MIN; }; + static double maxVal() { return DBL_MAX; }; static double neutral() { return 0.0; }; typedef double DifferenceType; @@ -280,8 +280,8 @@ namespace basegfx struct Int32Traits { - static sal_Int32 initMin() { return 0x7FFFFFFFL; }; - static sal_Int32 initMax() { return 0x80000000UL; }; + static sal_Int32 minVal() { return SAL_MIN_INT32; }; + static sal_Int32 maxVal() { return SAL_MAX_INT32; }; static sal_Int32 neutral() { return 0L; }; typedef sal_Int64 DifferenceType; diff --git a/basegfx/inc/basegfx/tools/gradienttools.hxx b/basegfx/inc/basegfx/tools/gradienttools.hxx new file mode 100644 index 000000000000..0c7f2ab2c060 --- /dev/null +++ b/basegfx/inc/basegfx/tools/gradienttools.hxx @@ -0,0 +1,401 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: canvastools.hxx,v $ + * $Revision: 1.10 $ + * + * 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_TOOLS_GRADIENTTOOLS_HXX +#define _BGFX_TOOLS_GRADIENTTOOLS_HXX + +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/range/b2drange.hxx> +#include <basegfx/vector/b2dvector.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/numeric/ftools.hxx> + +namespace basegfx +{ + /** Gradient definition as used in ODF 1.2 + + This struct collects all data necessary for rendering ODF + 1.2-compatible gradients. Use the createXXXODFGradientInfo() + methods below for initializing from ODF attributes. + */ + struct ODFGradientInfo + { + /** transformation mapping from [0,1]^2 texture coordinate + space to [0,1]^2 shape coordinate space + */ + B2DHomMatrix maTextureTransform; + + /** transformation mapping from [0,1]^2 shape coordinate space + to [0,1]^2 texture coordinate space. This is the + transformation commonly used to create gradients from a + scanline rasterizer (put shape u/v coordinates into it, get + texture s/t coordinates out of it) + */ + B2DHomMatrix maBackTextureTransform; + + /** Aspect ratio of the gradient. Only used in drawinglayer + for generating nested gradient polygons currently. Already + catered for in the transformations above. + */ + double mfAspectRatio; + + /** Requested gradient steps to render. See the + implementations of the getXXXGradientAlpha() methods below, + the semantic differs slightly for the different gradient + types. + */ + sal_uInt32 mnSteps; + }; + + namespace tools + { + /** Create matrix for ODF's linear gradient definition + + @param o_rGradientInfo + Receives the calculated texture transformation matrix (for + use with standard [0,1]x[0,1] texture coordinates) + + @param rTargetArea + Output area, needed for aspect ratio calculations and + texture transformation + + @param nSteps + Number of gradient steps (from ODF) + + @param fBorder + Width of gradient border (from ODF) + + @param fAngle + Gradient angle (from ODF) + */ + ODFGradientInfo& createLinearODFGradientInfo(ODFGradientInfo& o_rGradientInfo, + const B2DRange& rTargetArea, + sal_uInt32 nSteps, + double fBorder, + double fAngle); + + /** Calculate linear gradient blend value + + This method generates you the lerp alpha value for + blending linearly between gradient start and end color, + according to the formula (startCol*(1.0-alpha) + endCol*alpha) + + @param rUV + Current uv coordinate. Values outside [0,1] will be + clamped. + + @param rGradInfo + Gradient info, for transformation and number of steps + */ + inline double getLinearGradientAlpha(const B2DPoint& rUV, + const ODFGradientInfo& rGradInfo ) + { + const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV); + const double t(clamp(aCoor.getY(), 0.0, 1.0)); + const sal_uInt32 nSteps(rGradInfo.mnSteps); + + if(nSteps > 2L && nSteps < 128L) + return floor(t * nSteps) / double(nSteps + 1L); + + return t; + } + + /** Create matrix for ODF's axial gradient definition + + @param o_rGradientInfo + Receives the calculated texture transformation matrix (for + use with standard [0,1]x[0,1] texture coordinates) + + @param rTargetArea + Output area, needed for aspect ratio calculations and + texture transformation + + @param nSteps + Number of gradient steps (from ODF) + + @param fBorder + Width of gradient border (from ODF) + + @param fAngle + Gradient angle (from ODF) + */ + ODFGradientInfo& createAxialODFGradientInfo(ODFGradientInfo& o_rGradientInfo, + const B2DRange& rTargetArea, + sal_uInt32 nSteps, + double fBorder, + double fAngle); + + /** Calculate axial gradient blend value + + This method generates you the lerp alpha value for + blending linearly between gradient start and end color, + according to the formula (startCol*(1.0-alpha) + endCol*alpha) + + @param rUV + Current uv coordinate. Values outside [0,1] will be + clamped. + + @param rGradInfo + Gradient info, for transformation and number of steps + */ + inline double getAxialGradientAlpha(const B2DPoint& rUV, + const ODFGradientInfo& rGradInfo ) + { + const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV); + const double t(clamp(fabs(aCoor.getY()), 0.0, 1.0)); + const sal_uInt32 nSteps(rGradInfo.mnSteps); + const double fInternalSteps((nSteps * 2L) - 1L); + + if(nSteps > 2L && nSteps < 128L) + return floor(((t * fInternalSteps) + 1.0) / 2.0) / double(nSteps - 1L); + + return t; + } + + /** Create matrix for ODF's radial gradient definition + + @param o_rGradientInfo + Receives the calculated texture transformation matrix (for + use with standard [0,1]x[0,1] texture coordinates) + + @param rTargetArea + Output area, needed for aspect ratio calculations and + texture transformation + + @param rOffset + Gradient offset value (from ODF) + + @param nSteps + Number of gradient steps (from ODF) + + @param fBorder + Width of gradient border (from ODF) + + @param fAngle + Gradient angle (from ODF) + */ + ODFGradientInfo& createRadialODFGradientInfo(ODFGradientInfo& o_rGradientInfo, + const B2DRange& rTargetArea, + const B2DVector& rOffset, + sal_uInt32 nSteps, + double fBorder); + + /** Calculate radial gradient blend value + + This method generates you the lerp alpha value for + blending linearly between gradient start and end color, + according to the formula (startCol*(1.0-alpha) + endCol*alpha) + + @param rUV + Current uv coordinate. Values outside [0,1] will be + clamped. + + @param rGradInfo + Gradient info, for transformation and number of steps + */ + inline double getRadialGradientAlpha(const B2DPoint& rUV, + const ODFGradientInfo& rGradInfo ) + { + const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV); + const double fDist( + clamp(aCoor.getX() * aCoor.getX() + aCoor.getY() * aCoor.getY(), + 0.0, + 1.0)); + + const double t(1.0 - sqrt(fDist)); + const sal_uInt32 nSteps(rGradInfo.mnSteps); + + if(nSteps > 2L && nSteps < 128L) + return floor(t * nSteps) / double(nSteps - 1L); + + return t; + } + + /** Create matrix for ODF's elliptical gradient definition + + @param o_rGradientInfo + Receives the calculated texture transformation matrix (for + use with standard [0,1]x[0,1] texture coordinates) + + @param rTargetArea + Output area, needed for aspect ratio calculations and + texture transformation + + @param rOffset + Gradient offset value (from ODF) + + @param nSteps + Number of gradient steps (from ODF) + + @param fBorder + Width of gradient border (from ODF) + + @param fAngle + Gradient angle (from ODF) + */ + ODFGradientInfo& createEllipticalODFGradientInfo(ODFGradientInfo& o_rGradientInfo, + const B2DRange& rTargetArea, + const B2DVector& rOffset, + sal_uInt32 nSteps, + double fBorder, + double fAngle); + + /** Calculate elliptical gradient blend value + + This method generates you the lerp alpha value for + blending linearly between gradient start and end color, + according to the formula (startCol*(1.0-alpha) + endCol*alpha) + + @param rUV + Current uv coordinate. Values outside [0,1] will be + clamped. + + @param rGradInfo + Gradient info, for transformation and number of steps + */ + inline double getEllipticalGradientAlpha(const B2DPoint& rUV, + const ODFGradientInfo& rGradInfo ) + { + return getRadialGradientAlpha(rUV,rGradInfo); // only matrix setup differs + } + + /** Create matrix for ODF's square gradient definition + + @param o_rGradientInfo + Receives the calculated texture transformation matrix (for + use with standard [0,1]x[0,1] texture coordinates) + + @param rTargetArea + Output area, needed for aspect ratio calculations and + texture transformation + + @param rOffset + Gradient offset value (from ODF) + + @param nSteps + Number of gradient steps (from ODF) + + @param fBorder + Width of gradient border (from ODF) + + @param fAngle + Gradient angle (from ODF) + */ + ODFGradientInfo& createSquareODFGradientInfo(ODFGradientInfo& o_rGradientInfo, + const B2DRange& rTargetArea, + const B2DVector& rOffset, + sal_uInt32 nSteps, + double fBorder, + double fAngle); + + /** Calculate square gradient blend value + + This method generates you the lerp alpha value for + blending linearly between gradient start and end color, + according to the formula (startCol*(1.0-alpha) + endCol*alpha) + + @param rUV + Current uv coordinate. Values outside [0,1] will be + clamped. + + @param rGradInfo + Gradient info, for transformation and number of steps + */ + inline double getSquareGradientAlpha(const B2DPoint& rUV, + const ODFGradientInfo& rGradInfo ) + { + const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV); + const double fAbsX(fabs(aCoor.getX())); + const double fAbsY(fabs(aCoor.getY())); + + if(fTools::moreOrEqual(fAbsX, 1.0) || fTools::moreOrEqual(fAbsY, 1.0)) + return 0.0; + + const double t(1.0 - (fAbsX > fAbsY ? fAbsX : fAbsY)); + const sal_uInt32 nSteps(rGradInfo.mnSteps); + + if(nSteps > 2L && nSteps < 128L) + return floor(t * nSteps) / double(nSteps - 1L); + + return t; + } + + /** Create matrix for ODF's rectangular gradient definition + + @param o_rGradientInfo + Receives the calculated texture transformation matrix (for + use with standard [0,1]x[0,1] texture coordinates) + + @param rTargetArea + Output area, needed for aspect ratio calculations and + texture transformation + + @param rOffset + Gradient offset value (from ODF) + + @param nSteps + Number of gradient steps (from ODF) + + @param fBorder + Width of gradient border (from ODF) + + @param fAngle + Gradient angle (from ODF) + */ + ODFGradientInfo& createRectangularODFGradientInfo(ODFGradientInfo& o_rGradientInfo, + const B2DRange& rTargetArea, + const B2DVector& rOffset, + sal_uInt32 nSteps, + double fBorder, + double fAngle); + + /** Calculate rectangular gradient blend value + + This method generates you the lerp alpha value for + blending linearly between gradient start and end color, + according to the formula (startCol*(1.0-alpha) + endCol*alpha) + + @param rUV + Current uv coordinate. Values outside [0,1] will be + clamped. + + @param rGradInfo + Gradient info, for transformation and number of steps + */ + inline double getRectangularGradientAlpha(const B2DPoint& rUV, + const ODFGradientInfo& rGradInfo ) + { + return getSquareGradientAlpha(rUV, rGradInfo); // only matrix setup differs + } + + } +} + +#endif diff --git a/basegfx/inc/basegfx/tools/rectcliptools.hxx b/basegfx/inc/basegfx/tools/rectcliptools.hxx index b4c5049b1da8..bfcd808ed19c 100644 --- a/basegfx/inc/basegfx/tools/rectcliptools.hxx +++ b/basegfx/inc/basegfx/tools/rectcliptools.hxx @@ -74,7 +74,7 @@ namespace basegfx the number of clip planes hit within the getCohenSutherlandClipFlags() method. */ - sal_uInt32 getNumberOfClipPlanes( sal_uInt32 nFlags ) + inline sal_uInt32 getNumberOfClipPlanes( sal_uInt32 nFlags ) { // classic bit count algo, see e.g. Reingold, Nievergelt, // Deo: Combinatorial Algorithms, Theory and Practice, diff --git a/basegfx/prj/d.lst b/basegfx/prj/d.lst index 7168e6b4c495..9dd6085bbc7f 100644 --- a/basegfx/prj/d.lst +++ b/basegfx/prj/d.lst @@ -92,6 +92,7 @@ mkdir: %_DEST%\inc%_EXT%\basegfx\tools ..\inc\basegfx\tools\unopolypolygon.hxx %_DEST%\inc%_EXT%\basegfx\tools\unopolypolygon.hxx ..\inc\basegfx\tools\rectcliptools.hxx %_DEST%\inc%_EXT%\basegfx\tools\rectcliptools.hxx ..\inc\basegfx\tools\tools.hxx %_DEST%\inc%_EXT%\basegfx\tools\tools.hxx +..\inc\basegfx\tools\gradienttools.hxx %_DEST%\inc%_EXT%\basegfx\tools\gradienttools.hxx mkdir: %_DEST%\inc%_EXT%\basegfx\color ..\inc\basegfx\color\bcolor.hxx %_DEST%\inc%_EXT%\basegfx\color\bcolor.hxx diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index 7a7a60ae37b5..f4d1f992ad6b 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -1975,14 +1975,16 @@ namespace basegfx { B2DPolygon aRetval; + // truncate fStart, fEnd to a range of [0.0 .. F_2PI[ where F_2PI + // falls back to 0.0 to ensure a unique definition if(fTools::less(fStart, 0.0)) { fStart = 0.0; } - if(fTools::more(fStart, F_2PI)) + if(fTools::moreOrEqual(fStart, F_2PI)) { - fStart = F_2PI; + fStart = 0.0; } if(fTools::less(fEnd, 0.0)) @@ -1990,9 +1992,9 @@ namespace basegfx fEnd = 0.0; } - if(fTools::more(fEnd, F_2PI)) + if(fTools::moreOrEqual(fEnd, F_2PI)) { - fEnd = F_2PI; + fEnd = 0.0; } const sal_uInt32 nQuadrantStart(sal_uInt32(fStart / F_PI2) % 4L); diff --git a/basegfx/source/tools/gradienttools.cxx b/basegfx/source/tools/gradienttools.cxx new file mode 100644 index 000000000000..9e78039cd590 --- /dev/null +++ b/basegfx/source/tools/gradienttools.cxx @@ -0,0 +1,366 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: canvastools.cxx,v $ + * $Revision: 1.12 $ + * + * 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 <basegfx/tools/gradienttools.hxx> + +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/range/b2drange.hxx> + +namespace basegfx +{ + /** Most of the setup for linear & axial gradient is the same, except + for the border treatment. Factored out here. + */ + static void init1DGradientInfo(ODFGradientInfo& o_rGradientInfo, + const B2DRange& rTargetRange, + sal_uInt32 nSteps, + double fBorder, + double fAngle, + bool bAxial) + { + o_rGradientInfo.maTextureTransform.identity(); + o_rGradientInfo.maBackTextureTransform.identity(); + o_rGradientInfo.mnSteps = nSteps; + + double fTargetSizeX(rTargetRange.getWidth()); + double fTargetSizeY(rTargetRange.getHeight()); + double fTargetOffsetX(rTargetRange.getMinX()); + double fTargetOffsetY(rTargetRange.getMinY()); + + // add object expansion + if(0.0 != fAngle) + { + const double fAbsCos(fabs(cos(fAngle))); + const double fAbsSin(fabs(sin(fAngle))); + const double fNewX(fTargetSizeX * fAbsCos + fTargetSizeY * fAbsSin); + const double fNewY(fTargetSizeY * fAbsCos + fTargetSizeX * fAbsSin); + fTargetOffsetX -= (fNewX - fTargetSizeX) / 2.0; + fTargetOffsetY -= (fNewY - fTargetSizeY) / 2.0; + fTargetSizeX = fNewX; + fTargetSizeY = fNewY; + } + + // add object scale before rotate + o_rGradientInfo.maTextureTransform.scale(fTargetSizeX, fTargetSizeY); + + // add texture rotate after scale to keep perpendicular angles + if(0.0 != fAngle) + { + B2DPoint aCenter(0.5, 0.5); + aCenter *= o_rGradientInfo.maTextureTransform; + + o_rGradientInfo.maTextureTransform.translate(-aCenter.getX(), -aCenter.getY()); + o_rGradientInfo.maTextureTransform.rotate(fAngle); + o_rGradientInfo.maTextureTransform.translate(aCenter.getX(), aCenter.getY()); + } + + // add object translate + o_rGradientInfo.maTextureTransform.translate(fTargetOffsetX, fTargetOffsetY); + + // prepare aspect for texture + o_rGradientInfo.mfAspectRatio = (0.0 != fTargetSizeY) ? fTargetSizeX / fTargetSizeY : 1.0; + + // build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform + o_rGradientInfo.maBackTextureTransform = o_rGradientInfo.maTextureTransform; + o_rGradientInfo.maBackTextureTransform.invert(); + + double fSizeWithoutBorder=0; + if( bAxial ) + { + fSizeWithoutBorder = (1.0 - fBorder) * 0.5; + o_rGradientInfo.maBackTextureTransform.translate(0.0, -0.5); + } + else + { + fSizeWithoutBorder = 1.0 - fBorder; + o_rGradientInfo.maBackTextureTransform.translate(0.0, -fBorder); + } + + if(!fTools::equal(fSizeWithoutBorder, 0.0)) + o_rGradientInfo.maBackTextureTransform.scale(1.0, 1.0 / fSizeWithoutBorder); + } + + /** Most of the setup for radial & ellipsoidal gradient is the same, + except for the border treatment. Factored out here. + */ + static void initEllipticalGradientInfo(ODFGradientInfo& o_rGradientInfo, + const B2DRange& rTargetRange, + const B2DVector& rOffset, + sal_uInt32 nSteps, + double fBorder, + double fAngle, + bool bCircular) + { + o_rGradientInfo.maTextureTransform.identity(); + o_rGradientInfo.maBackTextureTransform.identity(); + o_rGradientInfo.mnSteps = nSteps; + + double fTargetSizeX(rTargetRange.getWidth()); + double fTargetSizeY(rTargetRange.getHeight()); + double fTargetOffsetX(rTargetRange.getMinX()); + double fTargetOffsetY(rTargetRange.getMinY()); + + // add object expansion + if( bCircular ) + { + const double fOriginalDiag(sqrt((fTargetSizeX * fTargetSizeX) + (fTargetSizeY * fTargetSizeY))); + fTargetOffsetX -= (fOriginalDiag - fTargetSizeX) / 2.0; + fTargetOffsetY -= (fOriginalDiag - fTargetSizeY) / 2.0; + fTargetSizeX = fOriginalDiag; + fTargetSizeY = fOriginalDiag; + } + else + { + fTargetOffsetX -= (0.4142 / 2.0 ) * fTargetSizeX; + fTargetOffsetY -= (0.4142 / 2.0 ) * fTargetSizeY; + fTargetSizeX = 1.4142 * fTargetSizeX; + fTargetSizeY = 1.4142 * fTargetSizeY; + } + + // add object scale before rotate + o_rGradientInfo.maTextureTransform.scale(fTargetSizeX, fTargetSizeY); + + if( !bCircular ) + { + // add texture rotate after scale to keep perpendicular angles + if(0.0 != fAngle) + { + B2DPoint aCenter(0.5, 0.5); + aCenter *= o_rGradientInfo.maTextureTransform; + + o_rGradientInfo.maTextureTransform.translate(-aCenter.getX(), -aCenter.getY()); + o_rGradientInfo.maTextureTransform.rotate(fAngle); + o_rGradientInfo.maTextureTransform.translate(aCenter.getX(), aCenter.getY()); + } + } + + // add defined offsets after rotation + if(0.5 != rOffset.getX() || 0.5 != rOffset.getY()) + { + // use original target size + fTargetOffsetX += (rOffset.getX() - 0.5) * rTargetRange.getWidth(); + fTargetOffsetY += (rOffset.getY() - 0.5) * rTargetRange.getHeight(); + } + + // add object translate + o_rGradientInfo.maTextureTransform.translate(fTargetOffsetX, fTargetOffsetY); + + // prepare aspect for texture + o_rGradientInfo.mfAspectRatio = (0.0 != fTargetSizeY) ? fTargetSizeX / fTargetSizeY : 1.0; + + // build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform + o_rGradientInfo.maBackTextureTransform = o_rGradientInfo.maTextureTransform; + o_rGradientInfo.maBackTextureTransform.invert(); + o_rGradientInfo.maBackTextureTransform.translate(-0.5, -0.5); + const double fHalfBorder((1.0 - fBorder) * 0.5); + + if(!fTools::equal(fHalfBorder, 0.0)) + { + const double fFactor(1.0 / fHalfBorder); + o_rGradientInfo.maBackTextureTransform.scale(fFactor, fFactor); + } + } + + /** Setup for rect & square gradient is exactly the same. Factored out + here. + */ + static void initRectGradientInfo(ODFGradientInfo& o_rGradientInfo, + const B2DRange& rTargetRange, + const B2DVector& rOffset, + sal_uInt32 nSteps, + double fBorder, + double fAngle) + { + o_rGradientInfo.maTextureTransform.identity(); + o_rGradientInfo.maBackTextureTransform.identity(); + o_rGradientInfo.mnSteps = nSteps; + + double fTargetSizeX(rTargetRange.getWidth()); + double fTargetSizeY(rTargetRange.getHeight()); + double fTargetOffsetX(rTargetRange.getMinX()); + double fTargetOffsetY(rTargetRange.getMinY()); + + // add object expansion + if(0.0 != fAngle) + { + const double fAbsCos(fabs(cos(fAngle))); + const double fAbsSin(fabs(sin(fAngle))); + const double fNewX(fTargetSizeX * fAbsCos + fTargetSizeY * fAbsSin); + const double fNewY(fTargetSizeY * fAbsCos + fTargetSizeX * fAbsSin); + fTargetOffsetX -= (fNewX - fTargetSizeX) / 2.0; + fTargetOffsetY -= (fNewY - fTargetSizeY) / 2.0; + fTargetSizeX = fNewX; + fTargetSizeY = fNewY; + } + + // add object scale before rotate + o_rGradientInfo.maTextureTransform.scale(fTargetSizeX, fTargetSizeY); + + // add texture rotate after scale to keep perpendicular angles + if(0.0 != fAngle) + { + B2DPoint aCenter(0.5, 0.5); + aCenter *= o_rGradientInfo.maTextureTransform; + + o_rGradientInfo.maTextureTransform.translate(-aCenter.getX(), -aCenter.getY()); + o_rGradientInfo.maTextureTransform.rotate(fAngle); + o_rGradientInfo.maTextureTransform.translate(aCenter.getX(), aCenter.getY()); + } + + // add defined offsets after rotation + if(0.5 != rOffset.getX() || 0.5 != rOffset.getY()) + { + // use scaled target size + fTargetOffsetX += (rOffset.getX() - 0.5) * fTargetSizeX; + fTargetOffsetY += (rOffset.getY() - 0.5) * fTargetSizeY; + } + + // add object translate + o_rGradientInfo.maTextureTransform.translate(fTargetOffsetX, fTargetOffsetY); + + // prepare aspect for texture + o_rGradientInfo.mfAspectRatio = (0.0 != fTargetSizeY) ? fTargetSizeX / fTargetSizeY : 1.0; + + // build transform from u,v to [0.0 .. 1.0]. As base, use inverse texture transform + o_rGradientInfo.maBackTextureTransform = o_rGradientInfo.maTextureTransform; + o_rGradientInfo.maBackTextureTransform.invert(); + o_rGradientInfo.maBackTextureTransform.translate(-0.5, -0.5); + const double fHalfBorder((1.0 - fBorder) * 0.5); + + if(!fTools::equal(fHalfBorder, 0.0)) + { + const double fFactor(1.0 / fHalfBorder); + o_rGradientInfo.maBackTextureTransform.scale(fFactor, fFactor); + } + } + + namespace tools + { + ODFGradientInfo& createLinearODFGradientInfo(ODFGradientInfo& o_rGradientInfo, + const B2DRange& rTargetArea, + sal_uInt32 nSteps, + double fBorder, + double fAngle) + { + init1DGradientInfo(o_rGradientInfo, + rTargetArea, + nSteps, + fBorder, + fAngle, + false); + return o_rGradientInfo; + } + + ODFGradientInfo& createAxialODFGradientInfo(ODFGradientInfo& o_rGradientInfo, + const B2DRange& rTargetArea, + sal_uInt32 nSteps, + double fBorder, + double fAngle) + { + init1DGradientInfo(o_rGradientInfo, + rTargetArea, + nSteps, + fBorder, + fAngle, + true); + return o_rGradientInfo; + } + + ODFGradientInfo& createRadialODFGradientInfo(ODFGradientInfo& o_rGradientInfo, + const B2DRange& rTargetArea, + const B2DVector& rOffset, + sal_uInt32 nSteps, + double fBorder) + { + initEllipticalGradientInfo(o_rGradientInfo, + rTargetArea, + rOffset, + nSteps, + fBorder, + 0.0, + true); + return o_rGradientInfo; + } + + ODFGradientInfo& createEllipticalODFGradientInfo(ODFGradientInfo& o_rGradientInfo, + const B2DRange& rTargetArea, + const B2DVector& rOffset, + sal_uInt32 nSteps, + double fBorder, + double fAngle) + { + initEllipticalGradientInfo(o_rGradientInfo, + rTargetArea, + rOffset, + nSteps, + fBorder, + fAngle, + false); + return o_rGradientInfo; + } + + ODFGradientInfo& createSquareODFGradientInfo(ODFGradientInfo& o_rGradientInfo, + const B2DRange& rTargetArea, + const B2DVector& rOffset, + sal_uInt32 nSteps, + double fBorder, + double fAngle) + { + initRectGradientInfo(o_rGradientInfo, + rTargetArea, + rOffset, + nSteps, + fBorder, + fAngle); + return o_rGradientInfo; + } + + ODFGradientInfo& createRectangularODFGradientInfo(ODFGradientInfo& o_rGradientInfo, + const B2DRange& rTargetArea, + const B2DVector& rOffset, + sal_uInt32 nSteps, + double fBorder, + double fAngle) + { + initRectGradientInfo(o_rGradientInfo, + rTargetArea, + rOffset, + nSteps, + fBorder, + fAngle); + return o_rGradientInfo; + } + + } // namespace tools + +} // namespace basegfx diff --git a/basegfx/source/tools/makefile.mk b/basegfx/source/tools/makefile.mk index bd233ffbcfc0..1bede8b22d88 100755 --- a/basegfx/source/tools/makefile.mk +++ b/basegfx/source/tools/makefile.mk @@ -42,6 +42,7 @@ ENABLE_EXCEPTIONS=TRUE # --- Files ------------------------------------- SLOFILES= $(SLO)$/canvastools.obj \ + $(SLO)$/gradienttools.obj \ $(SLO)$/debugplotter.obj \ $(SLO)$/liangbarsky.obj \ $(SLO)$/tools.obj \ diff --git a/basegfx/source/vector/b2dvector.cxx b/basegfx/source/vector/b2dvector.cxx index b3e4e2ae4946..311372348653 100644 --- a/basegfx/source/vector/b2dvector.cxx +++ b/basegfx/source/vector/b2dvector.cxx @@ -74,6 +74,15 @@ namespace basegfx double B2DVector::getLength() const { + if(fTools::equalZero(mfX)) + { + return fabs(mfY); + } + else if(fTools::equalZero(mfY)) + { + return fabs(mfX); + } + return hypot( mfX, mfY ); } diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx index c51fc86534d6..8b732e465a51 100644 --- a/basegfx/test/basegfx2d.cxx +++ b/basegfx/test/basegfx2d.cxx @@ -1444,9 +1444,9 @@ public: }; // class b2dvector // ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dmultirange, "basegfx2d"); +//CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dmultirange, "basegfx2d"); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dsvgdimpex, "basegfx2d"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dbeziertools, "basegfx2d"); +//CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dbeziertools, "basegfx2d"); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dcubicbezier, "basegfx2d"); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dhommatrix, "basegfx2d"); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dhompoint, "basegfx2d"); diff --git a/basegfx/test/makefile.mk b/basegfx/test/makefile.mk index 62ddba48d866..5bf0d8aa0b59 100644 --- a/basegfx/test/makefile.mk +++ b/basegfx/test/makefile.mk @@ -89,7 +89,7 @@ $(MISC)$/unittest_succeeded : $(SHL1TARGETN) @echo ---------------------------------------------------------- @echo - start unit test on library $(SHL1TARGETN) @echo ---------------------------------------------------------- - testshl2 -forward $(BIN)$/ $(SHL1TARGETN) + testshl2 -sf $(mktmp ) -forward $(BIN)$/ $(SHL1TARGETN) $(TOUCH) $@ ALLTAR : $(MISC)$/unittest_succeeded diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx index d7483fbf4b20..f1c54e9b4ab7 100644 --- a/canvas/source/cairo/cairo_canvashelper.cxx +++ b/canvas/source/cairo/cairo_canvashelper.cxx @@ -36,12 +36,19 @@ #include <rtl/logfile.hxx> #include <rtl/math.hxx> +#include <rtl/instance.hxx> +#include <com/sun/star/util/Endianness.hpp> #include <com/sun/star/rendering/TexturingMode.hpp> #include <com/sun/star/rendering/CompositeOperation.hpp> #include <com/sun/star/rendering/RepaintResult.hpp> #include <com/sun/star/rendering/PathCapType.hpp> #include <com/sun/star/rendering/PathJoinType.hpp> +#include <com/sun/star/rendering/XIntegerBitmapColorSpace.hpp> +#include <com/sun/star/rendering/IntegerBitmapLayout.hpp> +#include <com/sun/star/rendering/ColorSpaceType.hpp> +#include <com/sun/star/rendering/ColorComponentTag.hpp> +#include <com/sun/star/rendering/RenderingIntent.hpp> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> @@ -51,6 +58,7 @@ #include <basegfx/tools/canvastools.hxx> #include <comphelper/sequence.hxx> +#include <cppuhelper/compbase1.hxx> #include <canvas/canvastools.hxx> #include <canvas/parametricpolypolygon.hxx> @@ -856,6 +864,10 @@ namespace cairocanvas cairo_matrix_init_identity( &aIdentityMatrix ); cairo_set_matrix( pCairo, &aIdentityMatrix ); + cairo_set_fill_rule( pCairo, + eFillrule == rendering::FillRule_EVEN_ODD ? + CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING ); + for( sal_uInt32 nPolygonIndex = 0; nPolygonIndex < aPolyPolygon.count(); nPolygonIndex++ ) { ::basegfx::B2DPolygon aPolygon( aPolyPolygon.getB2DPolygon( nPolygonIndex ) ); const sal_uInt32 nPointCount( aPolygon.count() ); @@ -1408,12 +1420,386 @@ namespace cairocanvas return uno::Reference< rendering::XBitmapPalette >(); } + namespace + { + class CairoColorSpace : public cppu::WeakImplHelper1< com::sun::star::rendering::XIntegerBitmapColorSpace > + { + private: + uno::Sequence< sal_Int8 > maComponentTags; + uno::Sequence< sal_Int32 > maBitCounts; + + virtual ::sal_Int8 SAL_CALL getType( ) throw (uno::RuntimeException) + { + return rendering::ColorSpaceType::RGB; + } + virtual uno::Sequence< ::sal_Int8 > SAL_CALL getComponentTags( ) throw (uno::RuntimeException) + { + return maComponentTags; + } + virtual ::sal_Int8 SAL_CALL getRenderingIntent( ) throw (uno::RuntimeException) + { + return rendering::RenderingIntent::PERCEPTUAL; + } + virtual uno::Sequence< beans::PropertyValue > SAL_CALL getProperties( ) throw (uno::RuntimeException) + { + return uno::Sequence< beans::PropertyValue >(); + } + virtual uno::Sequence< double > SAL_CALL convertColorSpace( const uno::Sequence< double >& deviceColor, + const uno::Reference< rendering::XColorSpace >& targetColorSpace ) throw (lang::IllegalArgumentException, + uno::RuntimeException) + { + // TODO(P3): if we know anything about target + // colorspace, this can be greatly sped up + uno::Sequence<rendering::ARGBColor> aIntermediate( + convertToARGB(deviceColor)); + return targetColorSpace->convertFromARGB(aIntermediate); + } + virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertToRGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) + { + const double* pIn( deviceColor.getConstArray() ); + const sal_Size nLen( deviceColor.getLength() ); + ENSURE_ARG_OR_THROW2(nLen%4==0, + "number of channels no multiple of 4", + static_cast<rendering::XColorSpace*>(this), 0); + + uno::Sequence< rendering::RGBColor > aRes(nLen/4); + rendering::RGBColor* pOut( aRes.getArray() ); + for( sal_Size i=0; i<nLen; i+=4 ) + { + const double fAlpha(pIn[3]); + if( fAlpha == 0.0 ) + *pOut++ = rendering::RGBColor(0.0, 0.0, 0.0); + else + *pOut++ = rendering::RGBColor(pIn[2]/fAlpha,pIn[1]/fAlpha,pIn[0]/fAlpha); + pIn += 4; + } + return aRes; + } + virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToARGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) + { + const double* pIn( deviceColor.getConstArray() ); + const sal_Size nLen( deviceColor.getLength() ); + ENSURE_ARG_OR_THROW2(nLen%4==0, + "number of channels no multiple of 4", + static_cast<rendering::XColorSpace*>(this), 0); + + uno::Sequence< rendering::ARGBColor > aRes(nLen/4); + rendering::ARGBColor* pOut( aRes.getArray() ); + for( sal_Size i=0; i<nLen; i+=4 ) + { + const double fAlpha(pIn[3]); + if( fAlpha == 0.0 ) + *pOut++ = rendering::ARGBColor(0.0, 0.0, 0.0, 0.0); + else + *pOut++ = rendering::ARGBColor(fAlpha,pIn[2]/fAlpha,pIn[1]/fAlpha,pIn[0]/fAlpha); + pIn += 4; + } + return aRes; + } + virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) + { + const double* pIn( deviceColor.getConstArray() ); + const sal_Size nLen( deviceColor.getLength() ); + ENSURE_ARG_OR_THROW2(nLen%4==0, + "number of channels no multiple of 4", + static_cast<rendering::XColorSpace*>(this), 0); + + uno::Sequence< rendering::ARGBColor > aRes(nLen/4); + rendering::ARGBColor* pOut( aRes.getArray() ); + for( sal_Size i=0; i<nLen; i+=4 ) + { + *pOut++ = rendering::ARGBColor(pIn[3],pIn[2],pIn[1],pIn[1]); + pIn += 4; + } + return aRes; + } + virtual uno::Sequence< double > SAL_CALL convertFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) + { + const rendering::RGBColor* pIn( rgbColor.getConstArray() ); + const sal_Size nLen( rgbColor.getLength() ); + + uno::Sequence< double > aRes(nLen*4); + double* pColors=aRes.getArray(); + for( sal_Size i=0; i<nLen; ++i ) + { + *pColors++ = pIn->Blue; + *pColors++ = pIn->Green; + *pColors++ = pIn->Red; + *pColors++ = 1.0; + ++pIn; + } + return aRes; + } + virtual uno::Sequence< double > SAL_CALL convertFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) + { + const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); + const sal_Size nLen( rgbColor.getLength() ); + + uno::Sequence< double > aRes(nLen*4); + double* pColors=aRes.getArray(); + for( sal_Size i=0; i<nLen; ++i ) + { + *pColors++ = pIn->Alpha*pIn->Blue; + *pColors++ = pIn->Alpha*pIn->Green; + *pColors++ = pIn->Alpha*pIn->Red; + *pColors++ = pIn->Alpha; + ++pIn; + } + return aRes; + } + virtual uno::Sequence< double > SAL_CALL convertFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) + { + const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); + const sal_Size nLen( rgbColor.getLength() ); + + uno::Sequence< double > aRes(nLen*4); + double* pColors=aRes.getArray(); + for( sal_Size i=0; i<nLen; ++i ) + { + *pColors++ = pIn->Blue; + *pColors++ = pIn->Green; + *pColors++ = pIn->Red; + *pColors++ = pIn->Alpha; + ++pIn; + } + return aRes; + } + + // XIntegerBitmapColorSpace + virtual ::sal_Int32 SAL_CALL getBitsPerPixel( ) throw (uno::RuntimeException) + { + return 32; + } + virtual uno::Sequence< ::sal_Int32 > SAL_CALL getComponentBitCounts( ) throw (uno::RuntimeException) + { + return maBitCounts; + } + virtual ::sal_Int8 SAL_CALL getEndianness( ) throw (uno::RuntimeException) + { + return util::Endianness::LITTLE; + } + virtual uno::Sequence<double> SAL_CALL convertFromIntegerColorSpace( const uno::Sequence< ::sal_Int8 >& deviceColor, + const uno::Reference< rendering::XColorSpace >& targetColorSpace ) throw (lang::IllegalArgumentException, + uno::RuntimeException) + { + if( dynamic_cast<CairoColorSpace*>(targetColorSpace.get()) ) + { + const sal_Int8* pIn( deviceColor.getConstArray() ); + const sal_Size nLen( deviceColor.getLength() ); + ENSURE_ARG_OR_THROW2(nLen%4==0, + "number of channels no multiple of 4", + static_cast<rendering::XColorSpace*>(this), 0); + + uno::Sequence<double> aRes(nLen); + double* pOut( aRes.getArray() ); + for( sal_Size i=0; i<nLen; i+=4 ) + { + *pOut++ = vcl::unotools::toDoubleColor(*pIn++); + *pOut++ = vcl::unotools::toDoubleColor(*pIn++); + *pOut++ = vcl::unotools::toDoubleColor(*pIn++); + *pOut++ = vcl::unotools::toDoubleColor(*pIn++); + } + return aRes; + } + else + { + // TODO(P3): if we know anything about target + // colorspace, this can be greatly sped up + uno::Sequence<rendering::ARGBColor> aIntermediate( + convertIntegerToARGB(deviceColor)); + return targetColorSpace->convertFromARGB(aIntermediate); + } + } + virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertToIntegerColorSpace( const uno::Sequence< ::sal_Int8 >& deviceColor, + const uno::Reference< rendering::XIntegerBitmapColorSpace >& targetColorSpace ) throw (lang::IllegalArgumentException, + uno::RuntimeException) + { + if( dynamic_cast<CairoColorSpace*>(targetColorSpace.get()) ) + { + // it's us, so simply pass-through the data + return deviceColor; + } + else + { + // TODO(P3): if we know anything about target + // colorspace, this can be greatly sped up + uno::Sequence<rendering::ARGBColor> aIntermediate( + convertIntegerToARGB(deviceColor)); + return targetColorSpace->convertIntegerFromARGB(aIntermediate); + } + } + virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertIntegerToRGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) + { + const sal_Int8* pIn( deviceColor.getConstArray() ); + const sal_Size nLen( deviceColor.getLength() ); + ENSURE_ARG_OR_THROW2(nLen%4==0, + "number of channels no multiple of 4", + static_cast<rendering::XColorSpace*>(this), 0); + + uno::Sequence< rendering::RGBColor > aRes(nLen/4); + rendering::RGBColor* pOut( aRes.getArray() ); + for( sal_Size i=0; i<nLen; i+=4 ) + { + const sal_Int8 nAlpha(pIn[3]); + if( nAlpha ) + *pOut++ = rendering::RGBColor( + vcl::unotools::toDoubleColor(pIn[2]/nAlpha), + vcl::unotools::toDoubleColor(pIn[1]/nAlpha), + vcl::unotools::toDoubleColor(pIn[0]/nAlpha)); + else + *pOut++ = rendering::RGBColor(0,0,0); + pIn += 4; + } + return aRes; + } + + virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) + { + const sal_Int8* pIn( deviceColor.getConstArray() ); + const sal_Size nLen( deviceColor.getLength() ); + ENSURE_ARG_OR_THROW2(nLen%4==0, + "number of channels no multiple of 4", + static_cast<rendering::XColorSpace*>(this), 0); + + uno::Sequence< rendering::ARGBColor > aRes(nLen/4); + rendering::ARGBColor* pOut( aRes.getArray() ); + for( sal_Size i=0; i<nLen; i+=4 ) + { + const sal_Int8 nAlpha(pIn[3]); + if( nAlpha ) + *pOut++ = rendering::ARGBColor( + vcl::unotools::toDoubleColor(nAlpha), + vcl::unotools::toDoubleColor(pIn[2]/nAlpha), + vcl::unotools::toDoubleColor(pIn[1]/nAlpha), + vcl::unotools::toDoubleColor(pIn[0]/nAlpha)); + else + *pOut++ = rendering::ARGBColor(0,0,0,0); + pIn += 4; + } + return aRes; + } + virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) + { + const sal_Int8* pIn( deviceColor.getConstArray() ); + const sal_Size nLen( deviceColor.getLength() ); + ENSURE_ARG_OR_THROW2(nLen%4==0, + "number of channels no multiple of 4", + static_cast<rendering::XColorSpace*>(this), 0); + + uno::Sequence< rendering::ARGBColor > aRes(nLen/4); + rendering::ARGBColor* pOut( aRes.getArray() ); + for( sal_Size i=0; i<nLen; i+=4 ) + { + *pOut++ = rendering::ARGBColor( + vcl::unotools::toDoubleColor(pIn[3]), + vcl::unotools::toDoubleColor(pIn[2]), + vcl::unotools::toDoubleColor(pIn[1]), + vcl::unotools::toDoubleColor(pIn[0])); + pIn += 4; + } + return aRes; + } + + virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) + { + const rendering::RGBColor* pIn( rgbColor.getConstArray() ); + const sal_Size nLen( rgbColor.getLength() ); + + uno::Sequence< sal_Int8 > aRes(nLen*4); + sal_Int8* pColors=aRes.getArray(); + for( sal_Size i=0; i<nLen; ++i ) + { + *pColors++ = vcl::unotools::toByteColor(pIn->Blue); + *pColors++ = vcl::unotools::toByteColor(pIn->Green); + *pColors++ = vcl::unotools::toByteColor(pIn->Red); + *pColors++ = 255; + ++pIn; + } + return aRes; + } + + virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) + { + const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); + const sal_Size nLen( rgbColor.getLength() ); + + uno::Sequence< sal_Int8 > aRes(nLen*4); + sal_Int8* pColors=aRes.getArray(); + for( sal_Size i=0; i<nLen; ++i ) + { + const double fAlpha(pIn->Alpha); + *pColors++ = vcl::unotools::toByteColor(fAlpha*pIn->Blue); + *pColors++ = vcl::unotools::toByteColor(fAlpha*pIn->Green); + *pColors++ = vcl::unotools::toByteColor(fAlpha*pIn->Red); + *pColors++ = vcl::unotools::toByteColor(fAlpha); + ++pIn; + } + return aRes; + } + virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) + { + const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); + const sal_Size nLen( rgbColor.getLength() ); + + uno::Sequence< sal_Int8 > aRes(nLen*4); + sal_Int8* pColors=aRes.getArray(); + for( sal_Size i=0; i<nLen; ++i ) + { + *pColors++ = vcl::unotools::toByteColor(pIn->Blue); + *pColors++ = vcl::unotools::toByteColor(pIn->Green); + *pColors++ = vcl::unotools::toByteColor(pIn->Red); + *pColors++ = vcl::unotools::toByteColor(pIn->Alpha); + ++pIn; + } + return aRes; + } + + public: + CairoColorSpace() : + maComponentTags(4), + maBitCounts(4) + { + sal_Int8* pTags = maComponentTags.getArray(); + sal_Int32* pBitCounts = maBitCounts.getArray(); + pTags[0] = rendering::ColorComponentTag::RGB_BLUE; + pTags[1] = rendering::ColorComponentTag::RGB_GREEN; + pTags[2] = rendering::ColorComponentTag::RGB_RED; + pTags[3] = rendering::ColorComponentTag::PREMULTIPLIED_ALPHA; + + pBitCounts[0] = + pBitCounts[1] = + pBitCounts[2] = + pBitCounts[3] = 8; + } + }; + + struct CairoColorSpaceHolder : public rtl::StaticWithInit<uno::Reference<rendering::XIntegerBitmapColorSpace>, + CairoColorSpaceHolder> + { + uno::Reference<rendering::XIntegerBitmapColorSpace> operator()() + { + return new CairoColorSpace(); + } + }; + } + rendering::IntegerBitmapLayout CanvasHelper::getMemoryLayout() { if( !mpCairo ) return rendering::IntegerBitmapLayout(); // we're disposed - return ::canvas::tools::getStdMemoryLayout(getSize()); + const geometry::IntegerSize2D aSize(getSize()); + rendering::IntegerBitmapLayout aLayout; + + aLayout.ScanLines = aSize.Height; + aLayout.ScanLineBytes = aSize.Width*4; + aLayout.ScanLineStride = aLayout.ScanLineBytes; + aLayout.PlaneStride = 0; + aLayout.ColorSpace = CairoColorSpaceHolder::get(); + aLayout.Palette.clear(); + aLayout.IsMsbFirst = sal_False; + + return aLayout; } void CanvasHelper::flush() const diff --git a/canvas/source/directx/dx_bitmapcanvashelper.cxx b/canvas/source/directx/dx_bitmapcanvashelper.cxx index 83a85762cf35..467b91dec1d7 100755 --- a/canvas/source/directx/dx_bitmapcanvashelper.cxx +++ b/canvas/source/directx/dx_bitmapcanvashelper.cxx @@ -180,6 +180,7 @@ namespace dxcanvas if( !mpTarget ) return uno::Sequence< sal_Int8 >(); + bitmapLayout = getMemoryLayout(); return mpTarget->getData(bitmapLayout,rect); } @@ -224,6 +225,7 @@ namespace dxcanvas if( !mpTarget ) return uno::Sequence< sal_Int8 >(); + bitmapLayout = getMemoryLayout(); return mpTarget->getPixel(bitmapLayout,pos); } diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx index 396d9f68ce6b..e192198f2cdf 100644 --- a/canvas/source/factory/cf_service.cxx +++ b/canvas/source/factory/cf_service.cxx @@ -88,11 +88,18 @@ class CanvasFactory mutable ::osl::Mutex m_mutex; Reference<XComponentContext> m_xContext; - Reference<container::XNameAccess> m_xForceFlagNameAccess; + Reference<container::XNameAccess> m_xCanvasConfigNameAccess; AvailVector m_aAvailableImplementations; + AvailVector m_aAcceleratedImplementations; + AvailVector m_aAAImplementations; mutable CacheVector m_aCachedImplementations; mutable bool m_bCacheHasForcedLastImpl; + mutable bool m_bCacheHasUseAcceleratedEntry; + mutable bool m_bCacheHasUseAAEntry; + void checkConfigFlag( bool& r_bFlag, + bool& r_CacheFlag, + const OUString& nodeName ) const; Reference<XInterface> use( OUString const & serviceName, Sequence<Any> const & args, @@ -136,10 +143,14 @@ public: CanvasFactory::CanvasFactory( Reference<XComponentContext> const & xContext ) : m_mutex(), m_xContext(xContext), - m_xForceFlagNameAccess(), + m_xCanvasConfigNameAccess(), m_aAvailableImplementations(), + m_aAcceleratedImplementations(), + m_aAAImplementations(), m_aCachedImplementations(), - m_bCacheHasForcedLastImpl() + m_bCacheHasForcedLastImpl(), + m_bCacheHasUseAcceleratedEntry(), + m_bCacheHasUseAAEntry() { try { @@ -155,7 +166,7 @@ CanvasFactory::CanvasFactory( Reference<XComponentContext> const & xContext ) : makeAny( OUSTR("/org.openoffice.Office.Canvas") ), beans::PropertyState_DIRECT_VALUE ) ) ); - m_xForceFlagNameAccess.set( + m_xCanvasConfigNameAccess.set( xConfigProvider->createInstanceWithArguments( OUSTR("com.sun.star.configuration.ConfigurationAccess"), Sequence<Any>( &propValue, 1 ) ), @@ -185,9 +196,13 @@ CanvasFactory::CanvasFactory( Reference<XComponentContext> const & xContext ) : if( xEntryNameAccess.is() ) { - Sequence<OUString> preferredImplementations; - if( (xEntryNameAccess->getByName( OUSTR("PreferredImplementations") ) >>= preferredImplementations) ) - m_aAvailableImplementations.push_back( std::make_pair(*pCurr,preferredImplementations) ); + Sequence<OUString> implementationList; + if( (xEntryNameAccess->getByName( OUSTR("PreferredImplementations") ) >>= implementationList) ) + m_aAvailableImplementations.push_back( std::make_pair(*pCurr,implementationList) ); + if( (xEntryNameAccess->getByName( OUSTR("AcceleratedImplementations") ) >>= implementationList) ) + m_aAcceleratedImplementations.push_back( std::make_pair(*pCurr,implementationList) ); + if( (xEntryNameAccess->getByName( OUSTR("AntialiasingImplementations") ) >>= implementationList) ) + m_aAAImplementations.push_back( std::make_pair(*pCurr,implementationList) ); } ++pCurr; @@ -291,26 +306,48 @@ Reference<XInterface> CanvasFactory::use( } //______________________________________________________________________________ -Reference<XInterface> CanvasFactory::lookupAndUse( - OUString const & serviceName, Sequence<Any> const & args, - Reference<XComponentContext> const & xContext ) const +void CanvasFactory::checkConfigFlag( bool& r_bFlag, + bool& r_CacheFlag, + const OUString& nodeName ) const { - ::osl::MutexGuard guard(m_mutex); - - // forcing last entry from impl list, if config flag set - bool bForceLastEntry(false); - if( m_xForceFlagNameAccess.is() ) + if( m_xCanvasConfigNameAccess.is() ) { - m_xForceFlagNameAccess->getByName( OUSTR("ForceSafeServiceImpl") ) >>= bForceLastEntry; + m_xCanvasConfigNameAccess->getByName( nodeName ) >>= r_bFlag; - if( m_bCacheHasForcedLastImpl != bForceLastEntry ) + if( r_CacheFlag != r_bFlag ) { // cache is invalid, because of different order of // elements - m_bCacheHasForcedLastImpl = bForceLastEntry; + r_CacheFlag = r_bFlag; m_aCachedImplementations.clear(); } } +} + +//______________________________________________________________________________ +Reference<XInterface> CanvasFactory::lookupAndUse( + OUString const & serviceName, Sequence<Any> const & args, + Reference<XComponentContext> const & xContext ) const +{ + ::osl::MutexGuard guard(m_mutex); + + // forcing last entry from impl list, if config flag set + bool bForceLastEntry(false); + checkConfigFlag( bForceLastEntry, + m_bCacheHasForcedLastImpl, + OUSTR("ForceSafeServiceImpl") ); + + // use anti-aliasing canvas, if config flag set (or not existing) + bool bUseAAEntry(true); + checkConfigFlag( bUseAAEntry, + m_bCacheHasUseAAEntry, + OUSTR("UseAntialiasingCanvas") ); + + // use accelerated canvas, if config flag set (or not existing) + bool bUseAcceleratedEntry(true); + checkConfigFlag( bUseAcceleratedEntry, + m_bCacheHasUseAcceleratedEntry, + OUSTR("UseAcceleratedCanvas") ); // try to reuse last working implementation for given service name const CacheVector::iterator aEnd(m_aCachedImplementations.end()); @@ -330,27 +367,97 @@ Reference<XInterface> CanvasFactory::lookupAndUse( // lookup in available service list const AvailVector::const_iterator aAvailEnd(m_aAvailableImplementations.end()); - AvailVector::const_iterator aAvailMatch; - if( (aAvailMatch=std::find_if(m_aAvailableImplementations.begin(), - aAvailEnd, - boost::bind(&OUString::equals, - boost::cref(serviceName), - boost::bind( - std::select1st<AvailPair>(), - _1)))) != aAvailEnd ) + AvailVector::const_iterator aAvailImplsMatch; + if( (aAvailImplsMatch=std::find_if(m_aAvailableImplementations.begin(), + aAvailEnd, + boost::bind(&OUString::equals, + boost::cref(serviceName), + boost::bind( + std::select1st<AvailPair>(), + _1)))) == aAvailEnd ) { - const Sequence<OUString> aPreferredImpls( aAvailMatch->second ); - const OUString* pCurrImpl = aPreferredImpls.getConstArray(); - const OUString* const pEndImpl = pCurrImpl + aPreferredImpls.getLength(); + return Reference<XInterface>(); + } - // force last entry from impl list, if config flag set - if( bForceLastEntry ) - pCurrImpl = pEndImpl-1; + const AvailVector::const_iterator aAAEnd(m_aAAImplementations.end()); + AvailVector::const_iterator aAAImplsMatch; + if( (aAAImplsMatch=std::find_if(m_aAAImplementations.begin(), + aAAEnd, + boost::bind(&OUString::equals, + boost::cref(serviceName), + boost::bind( + std::select1st<AvailPair>(), + _1)))) == aAAEnd ) + { + return Reference<XInterface>(); + } + + const AvailVector::const_iterator aAccelEnd(m_aAcceleratedImplementations.end()); + AvailVector::const_iterator aAccelImplsMatch; + if( (aAccelImplsMatch=std::find_if(m_aAcceleratedImplementations.begin(), + aAccelEnd, + boost::bind(&OUString::equals, + boost::cref(serviceName), + boost::bind( + std::select1st<AvailPair>(), + _1)))) == aAccelEnd ) + { + return Reference<XInterface>(); + } - while( pCurrImpl != pEndImpl ) + const Sequence<OUString> aPreferredImpls( aAvailImplsMatch->second ); + const OUString* pCurrImpl = aPreferredImpls.getConstArray(); + const OUString* const pEndImpl = pCurrImpl + aPreferredImpls.getLength(); + + const Sequence<OUString> aAAImpls( aAAImplsMatch->second ); + const OUString* const pFirstAAImpl = aAAImpls.getConstArray(); + const OUString* const pEndAAImpl = pFirstAAImpl + aAAImpls.getLength(); + + const Sequence<OUString> aAccelImpls( aAccelImplsMatch->second ); + const OUString* const pFirstAccelImpl = aAccelImpls.getConstArray(); + const OUString* const pEndAccelImpl = pFirstAccelImpl + aAccelImpls.getLength(); + + // force last entry from impl list, if config flag set + if( bForceLastEntry ) + pCurrImpl = pEndImpl-1; + + while( pCurrImpl != pEndImpl ) + { + const OUString aCurrName(pCurrImpl->trim()); + + // check whether given canvas service is listed in the + // sequence of "accelerated canvas implementations" + const bool bIsAcceleratedImpl( + std::find_if(pFirstAccelImpl, + pEndAccelImpl, + boost::bind(&OUString::equals, + boost::cref(aCurrName), + boost::bind( + &OUString::trim, + _1))) != pEndAccelImpl ); + + // check whether given canvas service is listed in the + // sequence of "antialiasing canvas implementations" + const bool bIsAAImpl( + std::find_if(pFirstAAImpl, + pEndAAImpl, + boost::bind(&OUString::equals, + boost::cref(aCurrName), + boost::bind( + &OUString::trim, + _1))) != pEndAAImpl ); + + // try to instantiate canvas *only* if either accel and AA + // property match preference, *or*, if there's a mismatch, only + // go for a less capable canvas (that effectively let those + // pour canvas impls still work as fallbacks, should an + // accelerated/AA one fail). Property implies configuration: + // http://en.wikipedia.org/wiki/Truth_table#Logical_implication + if( (!bIsAAImpl || bUseAAEntry) && (!bIsAcceleratedImpl || bUseAcceleratedEntry) ) { Reference<XInterface> xCanvas( use( pCurrImpl->trim(), args, xContext ) ); + if(xCanvas.is()) { if( aMatch != aEnd ) @@ -368,9 +475,9 @@ Reference<XInterface> CanvasFactory::lookupAndUse( return xCanvas; } - - ++pCurrImpl; } + + ++pCurrImpl; } return Reference<XInterface>(); diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx index 81dbd0498df6..23d6124e4cb8 100644 --- a/canvas/source/tools/canvastools.cxx +++ b/canvas/source/tools/canvastools.cxx @@ -333,6 +333,23 @@ namespace canvas } return aRes; } + virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) + { + const double* pIn( deviceColor.getConstArray() ); + const sal_Size nLen( deviceColor.getLength() ); + ENSURE_ARG_OR_THROW2(nLen%4==0, + "number of channels no multiple of 4", + static_cast<rendering::XColorSpace*>(this), 0); + + uno::Sequence< rendering::ARGBColor > aRes(nLen/4); + rendering::ARGBColor* pOut( aRes.getArray() ); + for( sal_Size i=0; i<nLen; i+=4 ) + { + *pOut++ = rendering::ARGBColor(pIn[3],pIn[3]*pIn[0],pIn[3]*pIn[1],pIn[3]*pIn[2]); + pIn += 4; + } + return aRes; + } virtual uno::Sequence< double > SAL_CALL convertFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) { const rendering::RGBColor* pIn( rgbColor.getConstArray() ); @@ -367,6 +384,23 @@ namespace canvas } return aRes; } + virtual uno::Sequence< double > SAL_CALL convertFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) + { + const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); + const sal_Size nLen( rgbColor.getLength() ); + + uno::Sequence< double > aRes(nLen*4); + double* pColors=aRes.getArray(); + for( sal_Size i=0; i<nLen; ++i ) + { + *pColors++ = pIn->Red/pIn->Alpha; + *pColors++ = pIn->Green/pIn->Alpha; + *pColors++ = pIn->Blue/pIn->Alpha; + *pColors++ = pIn->Alpha; + ++pIn; + } + return aRes; + } // XIntegerBitmapColorSpace virtual ::sal_Int32 SAL_CALL getBitsPerPixel( ) throw (uno::RuntimeException) @@ -474,6 +508,29 @@ namespace canvas return aRes; } + virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) + { + const sal_Int8* pIn( deviceColor.getConstArray() ); + const sal_Size nLen( deviceColor.getLength() ); + ENSURE_ARG_OR_THROW2(nLen%4==0, + "number of channels no multiple of 4", + static_cast<rendering::XColorSpace*>(this), 0); + + uno::Sequence< rendering::ARGBColor > aRes(nLen/4); + rendering::ARGBColor* pOut( aRes.getArray() ); + for( sal_Size i=0; i<nLen; i+=4 ) + { + const sal_Int8 nAlpha( 255-pIn[3] ); + *pOut++ = rendering::ARGBColor( + vcl::unotools::toDoubleColor(nAlpha), + vcl::unotools::toDoubleColor(nAlpha*pIn[0]), + vcl::unotools::toDoubleColor(nAlpha*pIn[1]), + vcl::unotools::toDoubleColor(nAlpha*pIn[2])); + pIn += 4; + } + return aRes; + } + virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) { const rendering::RGBColor* pIn( rgbColor.getConstArray() ); @@ -510,6 +567,24 @@ namespace canvas return aRes; } + virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) + { + const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); + const sal_Size nLen( rgbColor.getLength() ); + + uno::Sequence< sal_Int8 > aRes(nLen*4); + sal_Int8* pColors=aRes.getArray(); + for( sal_Size i=0; i<nLen; ++i ) + { + *pColors++ = vcl::unotools::toByteColor(pIn->Red/pIn->Alpha); + *pColors++ = vcl::unotools::toByteColor(pIn->Green/pIn->Alpha); + *pColors++ = vcl::unotools::toByteColor(pIn->Blue/pIn->Alpha); + *pColors++ = 255-vcl::unotools::toByteColor(pIn->Alpha); + ++pIn; + } + return aRes; + } + public: StandardColorSpace() : maComponentTags(4), diff --git a/canvas/source/vcl/backbuffer.cxx b/canvas/source/vcl/backbuffer.cxx index 29731514af65..5e08204681d3 100644 --- a/canvas/source/vcl/backbuffer.cxx +++ b/canvas/source/vcl/backbuffer.cxx @@ -42,7 +42,18 @@ namespace vclcanvas bMonochromeBuffer ) ) { if( !bMonochromeBuffer ) + { + // #i95645# +#if defined( QUARTZ ) + // use AA on VCLCanvas for Mac maVDev->SetAntialiasing( ANTIALIASING_ENABLE_B2DDRAW | maVDev->GetAntialiasing() ); +#else + // switch off AA for WIN32 and UNIX, the VCLCanvas does not look good with it and + // is not required to do AA. It would need to be adapted to use it correctly + // (especially gradient painting). This will need extra work. + maVDev->SetAntialiasing( maVDev->GetAntialiasing() & !ANTIALIASING_ENABLE_B2DDRAW); +#endif + } } OutputDevice& BackBuffer::getOutDev() diff --git a/canvas/source/vcl/bitmapbackbuffer.cxx b/canvas/source/vcl/bitmapbackbuffer.cxx index 2426a70bacca..a7895f1034dd 100644 --- a/canvas/source/vcl/bitmapbackbuffer.cxx +++ b/canvas/source/vcl/bitmapbackbuffer.cxx @@ -119,7 +119,17 @@ namespace vclcanvas "BitmapBackBuffer::createVDev(): Unable to create VirtualDevice" ); mpVDev->SetOutputSizePixel( maBitmap->GetSizePixel() ); + + // #i95645# +#if defined( QUARTZ ) + // use AA on VCLCanvas for Mac mpVDev->SetAntialiasing( ANTIALIASING_ENABLE_B2DDRAW | mpVDev->GetAntialiasing() ); +#else + // switch off AA for WIN32 and UNIX, the VCLCanvas does not look good with it and + // is not required to do AA. It would need to be adapted to use it correctly + // (especially gradient painting). This will need extra work. + mpVDev->SetAntialiasing(mpVDev->GetAntialiasing() & !ANTIALIASING_ENABLE_B2DDRAW); +#endif } } diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx index 8f634d99bf7f..20b489144d0e 100644 --- a/canvas/source/vcl/canvashelper.cxx +++ b/canvas/source/vcl/canvashelper.cxx @@ -147,6 +147,7 @@ namespace vclcanvas void CanvasHelper::setBackgroundOutDev( const OutDevProviderSharedPtr& rOutDev ) { mp2ndOutDev = rOutDev; + mp2ndOutDev->getOutDev().EnableMapMode( FALSE ); } void CanvasHelper::clear() @@ -155,6 +156,7 @@ namespace vclcanvas if( mpOutDev ) { OutputDevice& rOutDev( mpOutDev->getOutDev() ); + tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDev ); rOutDev.EnableMapMode( FALSE ); rOutDev.SetLineColor( COL_WHITE ); @@ -188,7 +190,6 @@ namespace vclcanvas { // nope, render tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDev ); - setupOutDevState( viewState, renderState, LINE_COLOR ); const Point aOutPoint( tools::mapRealPoint2D( aPoint, @@ -212,7 +213,6 @@ namespace vclcanvas { // nope, render tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDev ); - setupOutDevState( viewState, renderState, LINE_COLOR ); const Point aStartPoint( tools::mapRealPoint2D( aStartRealPoint2D, @@ -236,7 +236,6 @@ namespace vclcanvas if( mpOutDev ) { tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDev ); - setupOutDevState( viewState, renderState, LINE_COLOR ); const Point& rStartPoint( tools::mapRealPoint2D( geometry::RealPoint2D(aBezierSegment.Px, @@ -279,7 +278,6 @@ namespace vclcanvas if( mpOutDev ) { tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDev ); - setupOutDevState( viewState, renderState, LINE_COLOR ); const ::basegfx::B2DPolyPolygon& rPolyPoly( @@ -688,7 +686,6 @@ namespace vclcanvas if( mpOutDev ) { tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDev ); - setupOutDevState( viewState, renderState, IGNORE_COLOR ); ::basegfx::B2DHomMatrix aMatrix; @@ -916,11 +913,16 @@ namespace vclcanvas if( !mpOutDev.get() || !mpDevice ) return uno::Reference< rendering::XBitmap >(); // we're disposed + OutputDevice& rOutDev( mpOutDev->getOutDev() ); + + tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDev ); + rOutDev.EnableMapMode( FALSE ); + // TODO(F2): Support alpha vdev canvas here const Point aEmptyPoint(0,0); - const Size aBmpSize( mpOutDev->getOutDev().GetOutputSizePixel() ); + const Size aBmpSize( rOutDev.GetOutputSizePixel() ); - Bitmap aBitmap( mpOutDev->getOutDev().GetBitmap(aEmptyPoint, aBmpSize) ); + Bitmap aBitmap( rOutDev.GetBitmap(aEmptyPoint, aBmpSize) ); aBitmap.Scale( ::vcl::unotools::sizeFromRealSize2D(newSize), beFast ? BMP_SCALE_FAST : BMP_SCALE_INTERPOLATE ); @@ -940,8 +942,13 @@ namespace vclcanvas // TODO(F2): Support alpha canvas here const Rectangle aRect( ::vcl::unotools::rectangleFromIntegerRectangle2D(rect) ); - Bitmap aBitmap( mpOutDev->getOutDev().GetBitmap(aRect.TopLeft(), - aRect.GetSize()) ); + OutputDevice& rOutDev( mpOutDev->getOutDev() ); + + tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDev ); + rOutDev.EnableMapMode( FALSE ); + + Bitmap aBitmap( rOutDev.GetBitmap(aRect.TopLeft(), + aRect.GetSize()) ); ScopedBitmapReadAccess pReadAccess( aBitmap.AcquireReadAccess(), aBitmap ); @@ -990,6 +997,9 @@ namespace vclcanvas OutputDevice& rOutDev( mpOutDev->getOutDev() ); + tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDev ); + rOutDev.EnableMapMode( FALSE ); + const Rectangle aRect( ::vcl::unotools::rectangleFromIntegerRectangle2D(rect) ); const USHORT nBitCount( ::std::min( (USHORT)24U, (USHORT)rOutDev.GetBitCount() ) ); @@ -1099,10 +1109,7 @@ namespace vclcanvas // destroyed beforehand if( bCopyBack ) { - tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDev ); - // TODO(F2): Support alpha canvas here - rOutDev.EnableMapMode( FALSE ); rOutDev.DrawBitmap(aRect.TopLeft(), aBitmap); } } @@ -1115,6 +1122,10 @@ namespace vclcanvas return; // we're disposed OutputDevice& rOutDev( mpOutDev->getOutDev() ); + + tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDev ); + rOutDev.EnableMapMode( FALSE ); + const Size aBmpSize( rOutDev.GetOutputSizePixel() ); ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aBmpSize.Width(), @@ -1131,10 +1142,6 @@ namespace vclcanvas aRefLayout.IsMsbFirst != rLayout.IsMsbFirst, "Mismatching memory layout" ); - tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDev ); - - rOutDev.EnableMapMode( FALSE ); - // TODO(F2): Support alpha canvas here rOutDev.DrawPixel( ::vcl::unotools::pointFromIntegerPoint2D( pos ), ::canvas::tools::stdIntSequenceToColor( color )); @@ -1153,6 +1160,9 @@ namespace vclcanvas OutputDevice& rOutDev( mpOutDev->getOutDev() ); + tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDev ); + rOutDev.EnableMapMode( FALSE ); + const Size aBmpSize( rOutDev.GetOutputSizePixel() ); ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aBmpSize.Width(), @@ -1160,10 +1170,6 @@ namespace vclcanvas ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < aBmpSize.Height(), "Y coordinate out of bounds" ); - tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDev ); - - rOutDev.EnableMapMode( FALSE ); - // TODO(F2): Support alpha canvas here return ::canvas::tools::colorToStdIntSequence( rOutDev.GetPixel( @@ -1194,6 +1200,8 @@ namespace vclcanvas OutputDevice& rOutDev( mpOutDev->getOutDev() ); OutputDevice* p2ndOutDev = NULL; + rOutDev.EnableMapMode( FALSE ); + if( mp2ndOutDev ) p2ndOutDev = &mp2ndOutDev->getOutDev(); @@ -1389,6 +1397,7 @@ namespace vclcanvas return false; // disposed else { + tools::OutDevStateKeeper aStateKeeper( mpProtectedOutDev ); setupOutDevState( viewState, renderState, IGNORE_COLOR ); if( !rGrf->Draw( &mpOutDev->getOutDev(), rPt, rSz, &rAttr ) ) diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx index 768466662a94..6127aa8f401b 100644 --- a/canvas/source/vcl/canvashelper_texturefill.cxx +++ b/canvas/source/vcl/canvashelper_texturefill.cxx @@ -714,6 +714,39 @@ namespace vclcanvas } } else +#if defined(QUARTZ) // TODO: other ports should avoid the XOR-trick too (implementation vs. interface!) + { + const Region aPolyClipRegion( rPoly ); + + rOutDev.Push( PUSH_CLIPREGION ); + rOutDev.SetClipRegion( aPolyClipRegion ); + + doGradientFill( rOutDev, + rValues, + rColor1, + rColor2, + aTextureTransform, + aPolygonDeviceRectOrig, + nStepCount, + false ); + rOutDev.Pop(); + + if( p2ndOutDev ) + { + p2ndOutDev->Push( PUSH_CLIPREGION ); + p2ndOutDev->SetClipRegion( aPolyClipRegion ); + doGradientFill( *p2ndOutDev, + rValues, + rColor1, + rColor2, + aTextureTransform, + aPolygonDeviceRectOrig, + nStepCount, + false ); + p2ndOutDev->Pop(); + } + } +#else // TODO: remove once doing the XOR-trick in the canvas-layer becomes redundant { // output gradient the hard way: XORing out the polygon rOutDev.Push( PUSH_RASTEROP ); @@ -767,6 +800,7 @@ namespace vclcanvas p2ndOutDev->Pop(); } } +#endif // complex-clipping vs. XOR-trick #if defined(VERBOSE) && OSL_DEBUG_LEVEL > 0 { @@ -1203,6 +1237,43 @@ namespace vclcanvas aOutputBmpEx ); } else +#if defined(QUARTZ) // TODO: other ports should avoid the XOR-trick too (implementation vs. interface!) + { + const Region aPolyClipRegion( aPolyPoly ); + + rOutDev.Push( PUSH_CLIPREGION ); + rOutDev.SetClipRegion( aPolyClipRegion ); + + textureFill( rOutDev, + *pGrfObj, + aPt, + aIntegerNextTileX, + aIntegerNextTileY, + nTilesX, + nTilesY, + aSz, + aGrfAttr ); + rOutDev.Pop(); + + if( mp2ndOutDev ) + { + OutputDevice& r2ndOutDev( mp2ndOutDev->getOutDev() ); + r2ndOutDev.Push( PUSH_CLIPREGION ); + + r2ndOutDev.SetClipRegion( aPolyClipRegion ); + textureFill( r2ndOutDev, + *pGrfObj, + aPt, + aIntegerNextTileX, + aIntegerNextTileY, + nTilesX, + nTilesY, + aSz, + aGrfAttr ); + r2ndOutDev.Pop(); + } + } +#else // TODO: remove once doing the XOR-trick in the canvas-layer becomes redundant { // output via repeated XORing rOutDev.Push( PUSH_RASTEROP ); @@ -1261,6 +1332,7 @@ namespace vclcanvas r2ndOutDev.Pop(); } } +#endif // complex-clipping vs. XOR-trick } } } diff --git a/canvas/source/vcl/spritedevicehelper.cxx b/canvas/source/vcl/spritedevicehelper.cxx index 2446053c2d21..755f1ce9cfdc 100644 --- a/canvas/source/vcl/spritedevicehelper.cxx +++ b/canvas/source/vcl/spritedevicehelper.cxx @@ -62,8 +62,16 @@ namespace vclcanvas mpBackBuffer.reset( new BackBuffer( rOutDev )); mpBackBuffer->setSize( rOutDev.GetOutputSizePixel() ); - mpBackBuffer->getOutDev().SetAntialiasing( ANTIALIASING_ENABLE_B2DDRAW | - mpBackBuffer->getOutDev().GetAntialiasing() ); + // #i95645# +#if defined( QUARTZ ) + // use AA on VCLCanvas for Mac + mpBackBuffer->getOutDev().SetAntialiasing( ANTIALIASING_ENABLE_B2DDRAW | mpBackBuffer->getOutDev().GetAntialiasing() ); +#else + // switch off AA for WIN32 and UNIX, the VCLCanvas does not look good with it and + // is not required to do AA. It would need to be adapted to use it correctly + // (especially gradient painting). This will need extra work. + mpBackBuffer->getOutDev().SetAntialiasing(mpBackBuffer->getOutDev().GetAntialiasing() & !ANTIALIASING_ENABLE_B2DDRAW); +#endif } ::sal_Int32 SpriteDeviceHelper::createBuffers( ::sal_Int32 nBuffers ) diff --git a/comphelper/inc/comphelper/componentmodule.hxx b/comphelper/inc/comphelper/componentmodule.hxx index 25b6315ee40b..9e136072a73e 100644 --- a/comphelper/inc/comphelper/componentmodule.hxx +++ b/comphelper/inc/comphelper/componentmodule.hxx @@ -417,18 +417,19 @@ namespace comphelper //= implementing the API of a component library (component_*) #define IMPLEMENT_COMPONENT_LIBRARY_API( module_class, initializer_function ) \ - extern "C" void SAL_CALL component_getImplementationEnvironment( \ + 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( \ + extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( \ void* pServiceManager, void* pRegistryKey ) \ { \ initializer_function(); \ return module_class::getInstance().writeComponentInfos( pServiceManager, pRegistryKey ); \ } \ - extern "C" void* SAL_CALL component_getFactory( \ + extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( \ const sal_Char* pImplementationName, void* pServiceManager, void* pRegistryKey ) \ { \ initializer_function(); \ diff --git a/comphelper/inc/comphelper/mediadescriptor.hxx b/comphelper/inc/comphelper/mediadescriptor.hxx index 05d5d59bc102..5cd36d2e687b 100644 --- a/comphelper/inc/comphelper/mediadescriptor.hxx +++ b/comphelper/inc/comphelper/mediadescriptor.hxx @@ -107,6 +107,7 @@ class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap static const ::rtl::OUString& PROP_SILENT(); static const ::rtl::OUString& PROP_STATUSINDICATOR(); static const ::rtl::OUString& PROP_STREAM(); + static const ::rtl::OUString& PROP_STREAMFOROUTPUT(); static const ::rtl::OUString& PROP_TEMPLATENAME(); static const ::rtl::OUString& PROP_TEMPLATEREGIONNAME(); static const ::rtl::OUString& PROP_TITLE(); @@ -150,16 +151,31 @@ class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap A might existing InteractionHandler will be used automaticly, to solve problems! - @param bLockFile - specifies whether the file should be locked + In case of local file the system file locking is used. @return TRUE, if the stream was already part of the descriptor or could be created as new item. FALSE otherwhise. */ - // HACK: IT SHOULD BE ONLY ONE METHOD, THE TEMPORARY SOLUTION ALLOWS TO AVOID INCOMPATIBLE BUILD - sal_Bool addInputStream_Impl( sal_Bool bLockFile ); sal_Bool addInputStream(); - sal_Bool addInputStreamNoLock(); + + //--------------------------------------- + /** @short it checks if the descriptor already has a valid + InputStream item and creates a new one, if not. + + @descr This method uses the current items of this MediaDescriptor, + to open the stream (as e.g. URL, ReadOnly, PostData etcpp.). + It creates a seekable stream and put it into the descriptor. + + A might existing InteractionHandler will be used automaticly, + to solve problems! + + In case of local file the system file locking is used based on + configuration settings. + + @return TRUE, if the stream was already part of the descriptor or could + be created as new item. FALSE otherwhise. + */ + sal_Bool addInputStreamOwnLock(); //--------------------------------------- /** @short it checks if the descriptor describes a readonly stream. @@ -247,6 +263,25 @@ class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap the "normalized" URL (e.g. without jumpmark) */ COMPHELPER_DLLPRIVATE ::rtl::OUString impl_normalizeURL(const ::rtl::OUString& sURL); + + //--------------------------------------- + /** @short it checks if the descriptor already has a valid + InputStream item and creates a new one, if not. + + @descr This method uses the current items of this MediaDescriptor, + to open the stream (as e.g. URL, ReadOnly, PostData etcpp.). + It creates a seekable stream and put it into the descriptor. + + A might existing InteractionHandler will be used automaticly, + to solve problems! + + @param bLockFile + specifies whether the file should be locked + + @return TRUE, if the stream was already part of the descriptor or could + be created as new item. FALSE otherwhise. + */ + COMPHELPER_DLLPRIVATE sal_Bool impl_addInputStream( sal_Bool bLockFile ); }; } // namespace comphelper diff --git a/comphelper/inc/comphelper/property.hxx b/comphelper/inc/comphelper/property.hxx index d1315db48748..0c31f6b2cb93 100644 --- a/comphelper/inc/comphelper/property.hxx +++ b/comphelper/inc/comphelper/property.hxx @@ -231,7 +231,7 @@ inline sal_Bool tryPropertyValue(staruno::Any& /*out*/_rConvertedValue, staruno: sal_False, if the value could be converted and has not changed @exception InvalidArgumentException thrown if the value could not be converted to the requested type (which is the template argument) */ -COMPHELPER_DLLPUBLIC sal_Bool tryPropertyValue(staruno::Any& _rConvertedValue, staruno::Any& _rOldValue, const staruno::Any& _rValueToSet, staruno::Any& _rCurrentValue, const staruno::Type& _rExpectedType); +COMPHELPER_DLLPUBLIC sal_Bool tryPropertyValue(staruno::Any& _rConvertedValue, staruno::Any& _rOldValue, const staruno::Any& _rValueToSet, const staruno::Any& _rCurrentValue, const staruno::Type& _rExpectedType); //......................................................................... } diff --git a/comphelper/inc/comphelper/propertybag.hxx b/comphelper/inc/comphelper/propertybag.hxx index 50789ce045c3..3a47bd5bb4c7 100644 --- a/comphelper/inc/comphelper/propertybag.hxx +++ b/comphelper/inc/comphelper/propertybag.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: propertybag.hxx,v $ - * $Revision: 1.4 $ + * $Revision: 1.4.60.1 $ * * This file is part of OpenOffice.org. * @@ -62,12 +62,20 @@ namespace comphelper PropertyBag(); virtual ~PropertyBag(); + /** allow adding property with empty string as name + (by default, such names are rejected with IllegalActionException). + @param i_isAllowed + iff true, empty property name will be allowed + */ + void setAllowEmptyPropertyName(bool i_isAllowed = true); + /** adds a property to the bag The type of the property is determined from its initial value (<code>_rInitialValue</code>). @param _rName - the name of the new property. Must not be empty. + the name of the new property. Must not be empty unless + explicitly allowed with setAllowEmptyPropertyName. @param _nHandle the handle of the new property @param _nAttributes diff --git a/comphelper/inc/comphelper/sharedmutex.hxx b/comphelper/inc/comphelper/sharedmutex.hxx new file mode 100644 index 000000000000..50a643455e85 --- /dev/null +++ b/comphelper/inc/comphelper/sharedmutex.hxx @@ -0,0 +1,94 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2008 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile: sharedmutex.hxx,v $ +* +* $Revision: 1.1.2.3 $ +* +* 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 COMPHELPER_SHAREDMUTEX_HXX +#define COMPHELPER_SHAREDMUTEX_HXX + +#include "comphelper/comphelperdllapi.h" + +#include <osl/mutex.hxx> + +#include <boost/shared_ptr.hpp> + +//........................................................................ +namespace comphelper +{ +//........................................................................ + + //============================================================ + //= SharedMutex + //============================================================ + class COMPHELPER_DLLPUBLIC SharedMutex + { + public: + SharedMutex(); + SharedMutex( const SharedMutex& ); + SharedMutex& operator=( const SharedMutex& ); + ~SharedMutex() + { + } + + inline ::osl::Mutex& getMutex() { return *m_pMutexImpl; } + inline operator ::osl::Mutex& () { return *m_pMutexImpl; } + + private: + ::boost::shared_ptr< ::osl::Mutex > m_pMutexImpl; + }; + + //============================================================ + //= SharedMutexBase + //============================================================ + /** sometimes, it's necessary to have an initialized ::osl::Mutex to pass + to some ctor call of your base class. In this case, you can't hold the + SharedMutex as member, but you need to move it into another base class, + which is initialized before the mutex-requiring class is. + */ + class COMPHELPER_DLLPUBLIC SharedMutexBase + { + protected: + SharedMutexBase() + { + } + ~SharedMutexBase() + { + } + + protected: + ::osl::Mutex& getMutex() const { return m_aMutex; } + SharedMutex& getSharedMutex() const { return m_aMutex; } + + private: + mutable SharedMutex m_aMutex; + }; + +//........................................................................ +} // namespace comphelper +//........................................................................ + +#endif // COMPHELPER_SHAREDMUTEX_HXX diff --git a/comphelper/inc/comphelper/storagehelper.hxx b/comphelper/inc/comphelper/storagehelper.hxx index 22e992183706..fb0e955d496c 100644 --- a/comphelper/inc/comphelper/storagehelper.hxx +++ b/comphelper/inc/comphelper/storagehelper.hxx @@ -48,6 +48,9 @@ namespace comphelper { +sal_Bool COMPHELPER_DLLPUBLIC IsValidZipEntryFileName( + const sal_Unicode *pChar, sal_Int32 nLength, sal_Bool bSlashAllowed ); + class COMPHELPER_DLLPUBLIC OStorageHelper { public: diff --git a/comphelper/inc/comphelper/uieventslogger.hxx b/comphelper/inc/comphelper/uieventslogger.hxx index ad0375612d82..b7b1cc4cb9be 100644 --- a/comphelper/inc/comphelper/uieventslogger.hxx +++ b/comphelper/inc/comphelper/uieventslogger.hxx @@ -7,7 +7,7 @@ * * $RCSfile: uieventslogger.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.2.20.1 $ * * This file is part of OpenOffice.org. * @@ -30,11 +30,8 @@ #ifndef _COMPHELPER_UIEVENTSLOGGER_HXX #define _COMPHELPER_UIEVENTSLOGGER_HXX -#include <boost/shared_ptr.hpp> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/logging/XCsvLogFormatter.hpp> -#include <com/sun/star/logging/XLogger.hpp> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/util/URL.hpp> #include <comphelper/comphelperdllapi.h> @@ -49,12 +46,13 @@ namespace comphelper public: static sal_Bool isEnabled(); static sal_Int32 getSessionLogEventCount(); - static void appendDispatchOrigin( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& args, const ::rtl::OUString& origin); + static void appendDispatchOrigin( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& args, const ::rtl::OUString& originapp, const ::rtl::OUString& originwidget); static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> purgeDispatchOrigin(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& args); static void logDispatch(const ::com::sun::star::util::URL& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& args); static void logVcl(const ::rtl::OUString& parent_id, sal_Int32 window_type, const ::rtl::OUString& id, const ::rtl::OUString& method, const ::rtl::OUString& param); static void logVcl(const ::rtl::OUString& parent_id, sal_Int32 window_type, const ::rtl::OUString& id, const ::rtl::OUString& method, sal_Int32 param); static void logVcl(const ::rtl::OUString& parent_id, sal_Int32 window_type, const ::rtl::OUString& id, const ::rtl::OUString& method); + static void disposing(); virtual ~UiEventsLogger() {} }; } diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx index 60fe605d2959..518595742f65 100644 --- a/comphelper/source/container/embeddedobjectcontainer.cxx +++ b/comphelper/source/container/embeddedobjectcontainer.cxx @@ -1414,7 +1414,7 @@ sal_Bool EmbeddedObjectContainer::StoreAsChildren(sal_Bool _bOasisFormat,sal_Boo &aMediaType ); } - if ( _bOasisFormat || xLink.is() && xLink->isLink() ) + if ( _bOasisFormat || (xLink.is() && xLink->isLink()) ) { if ( xStream.is() ) { diff --git a/comphelper/source/misc/instancelocker.cxx b/comphelper/source/misc/instancelocker.cxx index d3f897c80b51..6046b7c5e6f5 100644 --- a/comphelper/source/misc/instancelocker.cxx +++ b/comphelper/source/misc/instancelocker.cxx @@ -162,13 +162,20 @@ void SAL_CALL OInstanceLocker::initialize( const uno::Sequence< uno::Any >& aArg uno::Reference< uno::XInterface >(), 0 ); - if ( !( aArguments[1] >>= nModes ) - || !( nModes & embed::Actions::PREVENT_CLOSE ) && !( nModes & embed::Actions::PREVENT_TERMINATION ) ) + if ( + !( aArguments[1] >>= nModes ) || + ( + !( nModes & embed::Actions::PREVENT_CLOSE ) && + !( nModes & embed::Actions::PREVENT_TERMINATION ) + ) + ) + { throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("The correct modes set is expected as the second argument!" ) ), uno::Reference< uno::XInterface >(), 0 ); + } if ( nLen == 3 && !( aArguments[2] >>= xApproval ) ) throw lang::IllegalArgumentException( diff --git a/comphelper/source/misc/makefile.mk b/comphelper/source/misc/makefile.mk index fd6afba00a80..78f79c806511 100644 --- a/comphelper/source/misc/makefile.mk +++ b/comphelper/source/misc/makefile.mk @@ -8,7 +8,7 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.48 $ +# $Revision: 1.48.16.3 $ # # This file is part of OpenOffice.org. # @@ -81,6 +81,7 @@ SLOFILES= \ $(SLO)$/sequenceashashmap.obj \ $(SLO)$/sequence.obj \ $(SLO)$/servicedecl.obj \ + $(SLO)$/sharedmutex.obj \ $(SLO)$/synchronousdispatch.obj \ $(SLO)$/storagehelper.obj \ $(SLO)$/string.obj \ diff --git a/comphelper/source/misc/mediadescriptor.cxx b/comphelper/source/misc/mediadescriptor.cxx index e2c8feefd95c..da0dd71a5520 100644 --- a/comphelper/source/misc/mediadescriptor.cxx +++ b/comphelper/source/misc/mediadescriptor.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: mediadescriptor.cxx,v $ - * $Revision: 1.20 $ + * $Revision: 1.20.22.1 $ * * This file is part of OpenOffice.org. * @@ -86,11 +86,14 @@ #include <com/sun/star/uri/XUriReference.hpp> #endif #include <com/sun/star/ucb/PostCommandArgument2.hpp> +#include <com/sun/star/container/XNameAccess.hpp> + #include <ucbhelper/interceptedinteraction.hxx> #include <ucbhelper/content.hxx> #include <ucbhelper/commandenvironment.hxx> #include <ucbhelper/activedatasink.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/configurationhelper.hxx> #if OSL_DEBUG_LEVEL>0 #ifndef _RTL_USTRBUF_HXX_ @@ -297,6 +300,12 @@ const ::rtl::OUString& MediaDescriptor::PROP_STREAM() return sProp; } +const ::rtl::OUString& MediaDescriptor::PROP_STREAMFOROUTPUT() +{ + static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("StreamForOutput")); + return sProp; +} + const ::rtl::OUString& MediaDescriptor::PROP_TEMPLATENAME() { static const ::rtl::OUString sProp(RTL_CONSTASCII_USTRINGPARAM("TemplateName")); @@ -495,15 +504,39 @@ sal_Bool MediaDescriptor::isStreamReadOnly() const -----------------------------------------------*/ sal_Bool MediaDescriptor::addInputStream() { - return addInputStream_Impl( sal_True ); + return impl_addInputStream( sal_True ); } -sal_Bool MediaDescriptor::addInputStreamNoLock() +/*-----------------------------------------------*/ +sal_Bool MediaDescriptor::addInputStreamOwnLock() { - return addInputStream_Impl( sal_False ); + // Own lock file implementation + + sal_Bool bUseLock = sal_True; // the system file locking is used per default + try + { + + css::uno::Reference< css::uno::XInterface > xCommonConfig = ::comphelper::ConfigurationHelper::openConfig( + ::comphelper::getProcessServiceFactory(), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ), + ::comphelper::ConfigurationHelper::E_STANDARD ); + if ( !xCommonConfig.is() ) + throw css::uno::RuntimeException(); + + ::comphelper::ConfigurationHelper::readRelativeKey( + xCommonConfig, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Misc/" ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UseDocumentSystemFileLocking" ) ) ) >>= bUseLock; + } + catch( const css::uno::Exception& ) + { + } + + return impl_addInputStream( bUseLock ); } -sal_Bool MediaDescriptor::addInputStream_Impl( sal_Bool bLockFile ) +/*-----------------------------------------------*/ +sal_Bool MediaDescriptor::impl_addInputStream( sal_Bool bLockFile ) { // check for an already existing stream item first const_iterator pIt = find(MediaDescriptor::PROP_INPUTSTREAM()); @@ -524,18 +557,15 @@ sal_Bool MediaDescriptor::addInputStream_Impl( sal_Bool bLockFile ) return impl_openStreamWithPostData( xPostData ); } - // b) is there a reference to a file which is just being salvaged? - ::rtl::OUString sFileURL = getUnpackedValueOrDefault(MediaDescriptor::PROP_SALVAGEDFILE(), ::rtl::OUString()); - // c) finally, the last resort is the URL property - if ( !sFileURL.getLength() ) - sFileURL = getUnpackedValueOrDefault(MediaDescriptor::PROP_URL(), ::rtl::OUString()); - if (!sFileURL.getLength()) + // b) ... or we must get it from the given URL + ::rtl::OUString sURL = getUnpackedValueOrDefault(MediaDescriptor::PROP_URL(), ::rtl::OUString()); + if (!sURL.getLength()) throw css::uno::Exception( ::rtl::OUString::createFromAscii("Found no URL."), css::uno::Reference< css::uno::XInterface >()); // Parse URL! Only the main part has to be used further. E.g. a jumpmark can make trouble - ::rtl::OUString sNormalizedURL = impl_normalizeURL( sFileURL ); + ::rtl::OUString sNormalizedURL = impl_normalizeURL( sURL ); return impl_openStreamWithURL( sNormalizedURL, bLockFile ); } #if OSL_DEBUG_LEVEL>0 @@ -827,7 +857,12 @@ sal_Bool MediaDescriptor::impl_openStreamWithURL( const ::rtl::OUString& sURL, s if( bLockFile && aScheme.equalsIgnoreAsciiCaseAscii( "file" ) ) bReadOnly = sal_True; else + { + sal_Bool bRequestReadOnly = bReadOnly; aContent.getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) ) ) >>= bReadOnly; + if ( bReadOnly && !bRequestReadOnly && bModeRequestedExplicitly ) + return sal_False; // the document is explicitly requested with WRITEABLE mode + } } catch(const css::uno::RuntimeException&) { throw; } diff --git a/comphelper/source/misc/sharedmutex.cxx b/comphelper/source/misc/sharedmutex.cxx new file mode 100644 index 000000000000..a3ede5b71821 --- /dev/null +++ b/comphelper/source/misc/sharedmutex.cxx @@ -0,0 +1,65 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2008 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* $RCSfile: sharedmutex.cxx,v $ +* +* $Revision: 1.1.2.4 $ +* +* 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_comphelper.hxx" + +#include "comphelper/sharedmutex.hxx" + +//........................................................................ +namespace comphelper +{ +//........................................................................ + + //======================================================================== + //= SharedMutex + //======================================================================== + //------------------------------------------------------------------------ + SharedMutex::SharedMutex() + :m_pMutexImpl( new ::osl::Mutex ) + { + } + + //------------------------------------------------------------------------ + SharedMutex::SharedMutex( const SharedMutex& _rhs ) + :m_pMutexImpl() + { + *this = _rhs; + } + + //------------------------------------------------------------------------ + SharedMutex& SharedMutex::operator=( const SharedMutex& _rhs ) + { + m_pMutexImpl = _rhs.m_pMutexImpl; + return *this; + } + +//........................................................................ +} // namespace comphelper +//........................................................................ diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index 177d974f8cb4..667d1bdaa20a 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -400,5 +400,35 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromStream( return xTempStorage; } + +// ---------------------------------------------------------------------- +sal_Bool IsValidZipEntryFileName( + const sal_Unicode *pChar, sal_Int32 nLength, sal_Bool bSlashAllowed ) +{ + for ( sal_Int32 i = 0 ; i < nLength ; i++ ) + { + switch ( pChar[i] ) + { + case '\\': + case '?': + case '<': + case '>': + case '\"': + case '|': + case ':': + return sal_False; + case '/': + if ( !bSlashAllowed ) + return sal_False; + break; + default: + if ( pChar[i] < 32 || pChar[i] > 127 ) + return sal_False; +// Note: in case this ever supports unicode, watch out for surrogate pairs! + } + } + return sal_True; +} + } diff --git a/comphelper/source/misc/uieventslogger.cxx b/comphelper/source/misc/uieventslogger.cxx index a4124cb1657b..a60ecc9058de 100644 --- a/comphelper/source/misc/uieventslogger.cxx +++ b/comphelper/source/misc/uieventslogger.cxx @@ -7,7 +7,7 @@ * * $RCSfile: uieventslogger.cxx,v $ * -* $Revision: 1.3 $ +* $Revision: 1.3.20.3 $ * * This file is part of OpenOffice.org. * @@ -31,16 +31,23 @@ #include "precompiled_comphelper.hxx" #include <comphelper/uieventslogger.hxx> +#include <boost/shared_ptr.hpp> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/XTerminateListener.hpp> +#include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/logging/LogLevel.hpp> +#include <com/sun/star/logging/XCsvLogFormatter.hpp> #include <com/sun/star/logging/XLogHandler.hpp> +#include <com/sun/star/logging/XLogger.hpp> #include <com/sun/star/logging/XLoggerPool.hpp> #include <com/sun/star/oooimprovement/XCoreController.hpp> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/util/XStringSubstitution.hpp> #include <comphelper/configurationhelper.hxx> #include <comphelper/processfactory.hxx> +#include <map> #include <osl/file.hxx> #include <osl/mutex.hxx> #include <osl/time.h> @@ -48,14 +55,50 @@ using namespace com::sun::star::beans; -using namespace com::sun::star::uno; +using namespace com::sun::star::frame; using namespace com::sun::star::lang; using namespace com::sun::star::logging; using namespace com::sun::star::oooimprovement; +using namespace com::sun::star::uno; using namespace com::sun::star::util; -using namespace rtl; using namespace cppu; using namespace osl; +using namespace rtl; +using namespace std; + + +namespace +{ + static void lcl_SetupOriginAppAbbr(map<OUString, OUString>& abbrs) + { + abbrs[OUString::createFromAscii("com.sun.star.text.TextDocument")] = OUString::createFromAscii("W"); // Writer + abbrs[OUString::createFromAscii("com.sun.star.sheet.SpreadsheetDocument")] = OUString::createFromAscii("C"); // Calc + abbrs[OUString::createFromAscii("com.sun.star.presentation.PresentationDocument")] = OUString::createFromAscii("I"); // Impress + abbrs[OUString::createFromAscii("com.sun.star.drawing.DrawingDocument")] = OUString::createFromAscii("D"); // Draw + }; + + static void lcl_SetupOriginWidgetAbbr(map<OUString,OUString>& abbrs) + { + abbrs[OUString::createFromAscii("ButtonToolbarController")] = OUString::createFromAscii("0"); + abbrs[OUString::createFromAscii("ComplexToolbarController")] = OUString::createFromAscii("1"); + abbrs[OUString::createFromAscii("ControlMenuController")] = OUString::createFromAscii("2"); + abbrs[OUString::createFromAscii("FontMenuController")] = OUString::createFromAscii("3"); + abbrs[OUString::createFromAscii("FontSizeMenuController")] = OUString::createFromAscii("4"); + abbrs[OUString::createFromAscii("FooterMenuController")] = OUString::createFromAscii("5"); + abbrs[OUString::createFromAscii("GenericToolbarController")] = OUString::createFromAscii("6"); + abbrs[OUString::createFromAscii("HeaderMenuController")] = OUString::createFromAscii("7"); + abbrs[OUString::createFromAscii("LanguageSelectionMenuController")] = OUString::createFromAscii("8"); + abbrs[OUString::createFromAscii("LangSelectionStatusbarController")] = OUString::createFromAscii("9"); + abbrs[OUString::createFromAscii("MacrosMenuController")] = OUString::createFromAscii("10"); + abbrs[OUString::createFromAscii("MenuBarManager")] = OUString::createFromAscii("11"); + abbrs[OUString::createFromAscii("NewMenuController")] = OUString::createFromAscii("12"); + abbrs[OUString::createFromAscii("ObjectMenuController")] = OUString::createFromAscii("13"); + abbrs[OUString::createFromAscii("RecentFilesMenuController")] = OUString::createFromAscii("14"); + abbrs[OUString::createFromAscii("ToolbarsMenuController")] = OUString::createFromAscii("15"); + abbrs[OUString::createFromAscii("SfxToolBoxControl")] = OUString::createFromAscii("16"); + abbrs[OUString::createFromAscii("SfxAsyncExec")] = OUString::createFromAscii("17"); + }; +} namespace comphelper { @@ -66,7 +109,7 @@ namespace comphelper private: //typedefs and friends friend class UiEventsLogger; - typedef ::boost::shared_ptr<UiEventsLogger_Impl> ptr; + typedef UiEventsLogger_Impl* ptr; // instance methods and data UiEventsLogger_Impl(); @@ -85,6 +128,7 @@ namespace comphelper void checkIdleTimeout(); OUString getCurrentPath(); OUString getRotatedPath(); + void disposing(); bool m_Active; TimeValue m_LastLogEventTime; @@ -95,6 +139,9 @@ namespace comphelper Reference<XLogger> m_Logger; Reference<XLogHandler> m_LogHandler; Reference<XCsvLogFormatter> m_Formatter; + map<OUString, OUString> m_OriginAppAbbr; + map<OUString, OUString> m_OriginWidgetAbbr; + // static methods and data static ptr getInstance(); @@ -103,7 +150,7 @@ namespace comphelper static bool getEnabledFromCfg(); static TimeValue getIdleTimeoutFromCfg(); static OUString getLogPathFromCfg(); - static sal_Int32 findDispatchOriginIdx(const Sequence<PropertyValue>& args); + static sal_Int32 findIdx(const Sequence<PropertyValue>& args, const OUString& key); static ptr instance; static Mutex * singleton_mutex; @@ -123,19 +170,21 @@ namespace comphelper static const OUString CSST_JOBEXECUTOR; static const OUString CSSU_PATHSUB; static const OUString LOGGERNAME; - static const OUString LOGORIGINNAME; + static const OUString LOGORIGINAPP; + static const OUString LOGORIGINWIDGET; static const OUString UNKNOWN_ORIGIN; static const OUString FN_CURRENTLOG; static const OUString FN_ROTATEDLOG; static const OUString LOGROTATE_EVENTNAME; static const OUString URL_UNO; + static const OUString URL_FILE; }; } namespace comphelper { // consts - const sal_Int32 UiEventsLogger_Impl::COLUMNS = 8; + const sal_Int32 UiEventsLogger_Impl::COLUMNS = 9; const OUString UiEventsLogger_Impl::CFG_ENABLED = OUString::createFromAscii("EnablingAllowed"); const OUString UiEventsLogger_Impl::CFG_IDLETIMEOUT = OUString::createFromAscii("IdleTimeout"); const OUString UiEventsLogger_Impl::CFG_LOGGING = OUString::createFromAscii("/org.openoffice.Office.Logging"); @@ -153,7 +202,8 @@ namespace comphelper const OUString UiEventsLogger_Impl::ETYPE_VCL = OUString::createFromAscii("vcl"); const OUString UiEventsLogger_Impl::LOGGERNAME = OUString::createFromAscii("org.openoffice.oooimprovement.Core.UiEventsLogger"); - const OUString UiEventsLogger_Impl::LOGORIGINNAME = OUString::createFromAscii("comphelper.UiEventsLogger.LogOrigin"); + const OUString UiEventsLogger_Impl::LOGORIGINWIDGET = OUString::createFromAscii("comphelper.UiEventsLogger.LogOriginWidget"); + const OUString UiEventsLogger_Impl::LOGORIGINAPP = OUString::createFromAscii("comphelper.UiEventsLogger.LogOriginApp"); const OUString UiEventsLogger_Impl::UNKNOWN_ORIGIN = OUString::createFromAscii("unknown origin"); const OUString UiEventsLogger_Impl::FN_CURRENTLOG = OUString::createFromAscii("Current"); @@ -161,6 +211,7 @@ namespace comphelper const OUString UiEventsLogger_Impl::LOGROTATE_EVENTNAME = OUString::createFromAscii("onOOoImprovementLogRotated"); const OUString UiEventsLogger_Impl::URL_UNO = OUString::createFromAscii(".uno:"); + const OUString UiEventsLogger_Impl::URL_FILE = OUString::createFromAscii("file:"); // public UiEventsLogger interface @@ -182,24 +233,27 @@ namespace comphelper void UiEventsLogger::appendDispatchOrigin( Sequence<PropertyValue>& args, - const OUString& origin) + const OUString& originapp, + const OUString& originwidget) { sal_Int32 old_length = args.getLength(); - args.realloc(old_length+1); - args[old_length].Name = UiEventsLogger_Impl::LOGORIGINNAME; - args[old_length].Value = static_cast<Any>(origin); + args.realloc(old_length+2); + args[old_length].Name = UiEventsLogger_Impl::LOGORIGINAPP; + args[old_length].Value = static_cast<Any>(originapp); + args[old_length+1].Name = UiEventsLogger_Impl::LOGORIGINWIDGET; + args[old_length+1].Value = static_cast<Any>(originwidget); } Sequence<PropertyValue> UiEventsLogger::purgeDispatchOrigin( const Sequence<PropertyValue>& args) { - if(args.getLength()==0) return args; - sal_Int32 idx = UiEventsLogger_Impl::findDispatchOriginIdx(args); - if(idx==-1) return args; - Sequence<PropertyValue> result(args); - if(idx!=result.getLength()-1) - result[idx] = result[result.getLength()-1]; - result.realloc(result.getLength()-1); + Sequence<PropertyValue> result(args.getLength()); + sal_Int32 target_idx=0; + for(sal_Int32 source_idx=0; source_idx<args.getLength(); source_idx++) + if(args[source_idx].Name != UiEventsLogger_Impl::LOGORIGINAPP + && args[source_idx].Name != UiEventsLogger_Impl::LOGORIGINWIDGET) + result[target_idx++] = args[source_idx]; + result.realloc(target_idx); return result; } @@ -247,6 +301,12 @@ namespace comphelper UiEventsLogger::logVcl(parent_id, window_type, id, method, empty); } + void UiEventsLogger::disposing() + { + if(UiEventsLogger_Impl::instance!=UiEventsLogger_Impl::ptr()) + UiEventsLogger_Impl::instance->disposing(); + } + // private UiEventsLogger_Impl methods UiEventsLogger_Impl::UiEventsLogger_Impl() : m_Active(UiEventsLogger_Impl::shouldActivate()) @@ -254,6 +314,8 @@ namespace comphelper , m_IdleTimeout(UiEventsLogger_Impl::getIdleTimeoutFromCfg()) , m_SessionLogEventCount(0) { + lcl_SetupOriginAppAbbr(m_OriginAppAbbr); + lcl_SetupOriginWidgetAbbr(m_OriginWidgetAbbr); m_LastLogEventTime.Seconds = m_LastLogEventTime.Nanosec = 0; if(m_Active) rotate(); if(m_Active) initializeLogger(); @@ -263,19 +325,40 @@ namespace comphelper const URL& url, const Sequence<PropertyValue>& args) { - if(!m_Active) return; - if(!url.Complete.match(URL_UNO)) return; Guard<Mutex> log_guard(m_LogMutex); + if(!m_Active) return; + if(!url.Complete.match(URL_UNO) && !url.Complete.match(URL_FILE)) return; checkIdleTimeout(); Sequence<OUString> logdata = Sequence<OUString>(COLUMNS); logdata[0] = ETYPE_DISPATCH; - sal_Int32 origin_idx = findDispatchOriginIdx(args); - if(origin_idx!=-1) - args[origin_idx].Value >>= logdata[1]; + sal_Int32 originapp_idx = findIdx(args, LOGORIGINAPP); + if(originapp_idx!=-1) + { + OUString app; + args[originapp_idx].Value >>= app; + map<OUString, OUString>::iterator abbr_it = m_OriginAppAbbr.find(app); + if(abbr_it != m_OriginAppAbbr.end()) + app = abbr_it->second; + logdata[1] = app; + } else logdata[1] = UNKNOWN_ORIGIN; - logdata[2] = url.Complete; + sal_Int32 originwidget_idx = findIdx(args, LOGORIGINWIDGET); + if(originwidget_idx!=-1) + { + OUString widget; + args[originwidget_idx].Value >>= widget; + map<OUString, OUString>::iterator widget_it = m_OriginWidgetAbbr.find(widget); + if(widget_it != m_OriginWidgetAbbr.end()) + widget = widget_it->second; + logdata[2] = widget; + } + else + logdata[2] = UNKNOWN_ORIGIN; + logdata[3] = url.Complete; + if(url.Complete.match(URL_FILE)) + logdata[3] = URL_FILE; m_Logger->log(LogLevel::INFO, m_Formatter->formatMultiColumn(logdata)); m_SessionLogEventCount++; } @@ -294,18 +377,18 @@ namespace comphelper const OUString& method, const OUString& param) { - if(!m_Active) return; Guard<Mutex> log_guard(m_LogMutex); + if(!m_Active) return; checkIdleTimeout(); OUStringBuffer buf; Sequence<OUString> logdata = Sequence<OUString>(COLUMNS); logdata[0] = ETYPE_VCL; - logdata[3] = parent_id; - logdata[4] = buf.append(window_type).makeStringAndClear(); - logdata[5] = id; - logdata[6] = method; - logdata[7] = param; + logdata[4] = parent_id; + logdata[5] = buf.append(window_type).makeStringAndClear(); + logdata[6] = id; + logdata[7] = method; + logdata[8] = param; m_Logger->log(LogLevel::INFO, m_Formatter->formatMultiColumn(logdata)); m_SessionLogEventCount++; } @@ -394,6 +477,22 @@ namespace comphelper { Reference<XMultiServiceFactory> sm = getProcessServiceFactory(); + // getting the Core Uno proxy object + // It will call disposing and make sure we clear all our references + { + Reference<XTerminateListener> xCore( + sm->createInstance(OUString::createFromAscii("com.sun.star.oooimprovement.Core")), + UNO_QUERY); + Reference<XDesktop> xDesktop( + sm->createInstance(OUString::createFromAscii("com.sun.star.frame.Desktop")), + UNO_QUERY); + if(!(xCore.is() && xDesktop.is())) + { + m_Active = false; + return; + } + xDesktop->addTerminateListener(xCore); + } // getting the LoggerPool Reference<XLoggerPool> pool; { @@ -419,13 +518,14 @@ namespace comphelper { Sequence<OUString> columns = Sequence<OUString>(COLUMNS); columns[0] = OUString::createFromAscii("eventtype"); - columns[1] = OUString::createFromAscii("origin"); - columns[2] = OUString::createFromAscii("uno url"); - columns[3] = OUString::createFromAscii("parent id"); - columns[4] = OUString::createFromAscii("window type"); - columns[5] = OUString::createFromAscii("id"); - columns[6] = OUString::createFromAscii("method"); - columns[7] = OUString::createFromAscii("parameter"); + columns[1] = OUString::createFromAscii("originapp"); + columns[2] = OUString::createFromAscii("originwidget"); + columns[3] = OUString::createFromAscii("uno url"); + columns[4] = OUString::createFromAscii("parent id"); + columns[5] = OUString::createFromAscii("window type"); + columns[6] = OUString::createFromAscii("id"); + columns[7] = OUString::createFromAscii("method"); + columns[8] = OUString::createFromAscii("parameter"); m_Formatter->setColumnnames(columns); m_LogHandler->setFormatter(Reference<XLogFormatter>(m_Formatter, UNO_QUERY)); m_Logger->setLevel(LogLevel::ALL); @@ -515,11 +615,20 @@ namespace comphelper return instance; } - sal_Int32 UiEventsLogger_Impl::findDispatchOriginIdx(const Sequence<PropertyValue>& args) + sal_Int32 UiEventsLogger_Impl::findIdx(const Sequence<PropertyValue>& args, const OUString& key) { for(sal_Int32 i=0; i<args.getLength(); i++) - if(args[i].Name == LOGORIGINNAME) + if(args[i].Name == key) return i; return -1; } + + void UiEventsLogger_Impl::disposing() + { + Guard<Mutex> log_guard(m_LogMutex); + m_Active = false; + m_Logger.clear() ; + m_LogHandler.clear(); + m_Formatter.clear(); + } } diff --git a/comphelper/source/property/ChainablePropertySet.cxx b/comphelper/source/property/ChainablePropertySet.cxx index a5c207d25018..567db83d1626 100644 --- a/comphelper/source/property/ChainablePropertySet.cxx +++ b/comphelper/source/property/ChainablePropertySet.cxx @@ -88,7 +88,7 @@ void SAL_CALL ChainablePropertySet::setPropertyValue( const ::rtl::OUString& rPr PropertyInfoHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); if( aIter == mpInfo->maMap.end()) - throw UnknownPropertyException(); + throw UnknownPropertyException( rPropertyName, static_cast< XPropertySet* >( this ) ); _preSetValues(); _setSingleValue( *((*aIter).second), rValue ); @@ -106,7 +106,7 @@ Any SAL_CALL ChainablePropertySet::getPropertyValue( const ::rtl::OUString& rPro PropertyInfoHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); if( aIter == mpInfo->maMap.end()) - throw UnknownPropertyException(); + throw UnknownPropertyException( rPropertyName, static_cast< XPropertySet* >( this ) ); Any aAny; _preGetValues (); @@ -166,7 +166,7 @@ void SAL_CALL ChainablePropertySet::setPropertyValues( const Sequence< ::rtl::OU { aIter = mpInfo->maMap.find ( *pString ); if ( aIter == aEnd ) - throw UnknownPropertyException(); + throw UnknownPropertyException( *pString, static_cast< XPropertySet* >( this ) ); _setSingleValue ( *((*aIter).second), *pAny ); } @@ -199,7 +199,7 @@ Sequence< Any > SAL_CALL ChainablePropertySet::getPropertyValues( const Sequence { aIter = mpInfo->maMap.find ( *pString ); if ( aIter == aEnd ) - throw UnknownPropertyException(); + throw UnknownPropertyException( *pString, static_cast< XPropertySet* >( this ) ); _getSingleValue ( *((*aIter).second), *pAny ); } @@ -233,7 +233,7 @@ PropertyState SAL_CALL ChainablePropertySet::getPropertyState( const ::rtl::OUSt { PropertyInfoHash::const_iterator aIter = mpInfo->maMap.find( PropertyName ); if( aIter == mpInfo->maMap.end()) - throw UnknownPropertyException(); + throw UnknownPropertyException( PropertyName, static_cast< XPropertySet* >( this ) ); PropertyState aState; @@ -261,7 +261,7 @@ Sequence< PropertyState > SAL_CALL ChainablePropertySet::getPropertyStates( cons { aIter = mpInfo->maMap.find ( *pString ); if ( aIter == aEnd ) - throw UnknownPropertyException(); + throw UnknownPropertyException( *pString, static_cast< XPropertySet* >( this ) ); _getPropertyState ( *((*aIter).second), *pState ); } @@ -276,7 +276,7 @@ void SAL_CALL ChainablePropertySet::setPropertyToDefault( const ::rtl::OUString& PropertyInfoHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); if( aIter == mpInfo->maMap.end()) - throw UnknownPropertyException(); + throw UnknownPropertyException( rPropertyName, static_cast< XPropertySet* >( this ) ); _setPropertyToDefault( *((*aIter).second) ); } @@ -286,7 +286,7 @@ Any SAL_CALL ChainablePropertySet::getPropertyDefault( const ::rtl::OUString& rP PropertyInfoHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); if( aIter == mpInfo->maMap.end()) - throw UnknownPropertyException(); + throw UnknownPropertyException( rPropertyName, static_cast< XPropertySet* >( this ) ); return _getPropertyDefault( *((*aIter).second) ); } diff --git a/comphelper/source/property/ChainablePropertySetInfo.cxx b/comphelper/source/property/ChainablePropertySetInfo.cxx index dd7c18532e85..b27cef88319c 100644 --- a/comphelper/source/property/ChainablePropertySetInfo.cxx +++ b/comphelper/source/property/ChainablePropertySetInfo.cxx @@ -125,7 +125,7 @@ Property SAL_CALL ChainablePropertySetInfo::getPropertyByName( const ::rtl::OUSt PropertyInfoHash::iterator aIter = maMap.find( rName ); if ( maMap.end() == aIter ) - throw UnknownPropertyException(); + throw UnknownPropertyException( rName, *this ); PropertyInfo *pInfo = (*aIter).second; Property aProperty; diff --git a/comphelper/source/property/MasterPropertySet.cxx b/comphelper/source/property/MasterPropertySet.cxx index b93025556d81..884f3d635628 100644 --- a/comphelper/source/property/MasterPropertySet.cxx +++ b/comphelper/source/property/MasterPropertySet.cxx @@ -141,7 +141,7 @@ void SAL_CALL MasterPropertySet::setPropertyValue( const ::rtl::OUString& rPrope PropertyDataHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); if( aIter == mpInfo->maMap.end()) - throw UnknownPropertyException(); + throw UnknownPropertyException( rPropertyName, static_cast< XPropertySet* >( this ) ); if ( (*aIter).second->mnMapId == 0 ) // 0 means it's one of ours ! { @@ -175,7 +175,7 @@ Any SAL_CALL MasterPropertySet::getPropertyValue( const ::rtl::OUString& rProper PropertyDataHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); if( aIter == mpInfo->maMap.end()) - throw UnknownPropertyException(); + throw UnknownPropertyException( rPropertyName, static_cast< XPropertySet* >( this ) ); Any aAny; if ( (*aIter).second->mnMapId == 0 ) // 0 means it's one of ours ! @@ -257,7 +257,7 @@ void SAL_CALL MasterPropertySet::setPropertyValues( const Sequence< ::rtl::OUStr { aIter = mpInfo->maMap.find ( *pString ); if ( aIter == aEnd ) - throw UnknownPropertyException(); + throw UnknownPropertyException( *pString, static_cast< XPropertySet* >( this ) ); if ( (*aIter).second->mnMapId == 0 ) // 0 means it's one of ours ! _setSingleValue( *((*aIter).second->mpInfo), *pAny ); @@ -322,7 +322,7 @@ Sequence< Any > SAL_CALL MasterPropertySet::getPropertyValues( const Sequence< : { aIter = mpInfo->maMap.find ( *pString ); if ( aIter == aEnd ) - throw UnknownPropertyException(); + throw UnknownPropertyException( *pString, static_cast< XPropertySet* >( this ) ); if ( (*aIter).second->mnMapId == 0 ) // 0 means it's one of ours ! _getSingleValue( *((*aIter).second->mpInfo), *pAny ); @@ -381,7 +381,7 @@ PropertyState SAL_CALL MasterPropertySet::getPropertyState( const ::rtl::OUStrin { PropertyDataHash::const_iterator aIter = mpInfo->maMap.find( PropertyName ); if( aIter == mpInfo->maMap.end()) - throw UnknownPropertyException(); + throw UnknownPropertyException( PropertyName, static_cast< XPropertySet* >( this ) ); PropertyState aState; @@ -425,7 +425,7 @@ Sequence< PropertyState > SAL_CALL MasterPropertySet::getPropertyStates( const S { aIter = mpInfo->maMap.find ( *pString ); if ( aIter == aEnd ) - throw UnknownPropertyException(); + throw UnknownPropertyException( *pString, static_cast< XPropertySet* >( this ) ); if ( (*aIter).second->mnMapId == 0 ) // 0 means it's one of ours ! _getPropertyState( *((*aIter).second->mpInfo), *pState ); @@ -461,7 +461,7 @@ void SAL_CALL MasterPropertySet::setPropertyToDefault( const ::rtl::OUString& rP PropertyDataHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); if( aIter == mpInfo->maMap.end()) - throw UnknownPropertyException(); + throw UnknownPropertyException( rPropertyName, static_cast< XPropertySet* >( this ) ); _setPropertyToDefault( *((*aIter).second->mpInfo) ); } @@ -471,7 +471,7 @@ Any SAL_CALL MasterPropertySet::getPropertyDefault( const ::rtl::OUString& rProp PropertyDataHash::const_iterator aIter = mpInfo->maMap.find ( rPropertyName ); if( aIter == mpInfo->maMap.end()) - throw UnknownPropertyException(); + throw UnknownPropertyException( rPropertyName, static_cast< XPropertySet* >( this ) ); return _getPropertyDefault( *((*aIter).second->mpInfo) ); } diff --git a/comphelper/source/property/MasterPropertySetInfo.cxx b/comphelper/source/property/MasterPropertySetInfo.cxx index ac9f553270f7..e74d21b2d755 100644 --- a/comphelper/source/property/MasterPropertySetInfo.cxx +++ b/comphelper/source/property/MasterPropertySetInfo.cxx @@ -152,7 +152,7 @@ Property SAL_CALL MasterPropertySetInfo::getPropertyByName( const ::rtl::OUStrin PropertyDataHash::iterator aIter = maMap.find( rName ); if ( maMap.end() == aIter ) - throw UnknownPropertyException(); + throw UnknownPropertyException( rName, *this ); PropertyInfo *pInfo = (*aIter).second->mpInfo; Property aProperty; diff --git a/comphelper/source/property/composedprops.cxx b/comphelper/source/property/composedprops.cxx index 1d7fd18e2818..fe41319ebccc 100644 --- a/comphelper/source/property/composedprops.cxx +++ b/comphelper/source/property/composedprops.cxx @@ -225,7 +225,7 @@ namespace comphelper } else { - throw UnknownPropertyException(::rtl::OUString(), static_cast< XPropertySet* >(this)); + throw UnknownPropertyException( _rPropertyName, *this ); } return eState; @@ -335,7 +335,7 @@ namespace comphelper return *pProps; } - throw UnknownPropertyException(::rtl::OUString(), static_cast< XPropertySetInfo* >(this)); + throw UnknownPropertyException( _rName, *this ); } //------------------------------------------------------------------------------ diff --git a/comphelper/source/property/genericpropertyset.cxx b/comphelper/source/property/genericpropertyset.cxx index be9b898f30b4..08dd26dcf0ec 100644 --- a/comphelper/source/property/genericpropertyset.cxx +++ b/comphelper/source/property/genericpropertyset.cxx @@ -134,7 +134,7 @@ void SAL_CALL GenericPropertySet::addPropertyChangeListener( const ::rtl::OUStri else if ( xInfo->hasPropertyByName(aPropertyName) ) m_aListener.addInterface(aPropertyName,xListener); else - throw UnknownPropertyException(); + throw UnknownPropertyException( aPropertyName, *this ); } } @@ -158,7 +158,7 @@ void SAL_CALL GenericPropertySet::removePropertyChangeListener( const ::rtl::OUS else if ( xInfo->hasPropertyByName(aPropertyName) ) m_aListener.removeInterface(aPropertyName,xListener); else - throw UnknownPropertyException(); + throw UnknownPropertyException( aPropertyName, *this ); } } diff --git a/comphelper/source/property/opropertybag.cxx b/comphelper/source/property/opropertybag.cxx index 293718398c70..e7b14795186e 100644 --- a/comphelper/source/property/opropertybag.cxx +++ b/comphelper/source/property/opropertybag.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: opropertybag.cxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.44.1 $ * * This file is part of OpenOffice.org. * @@ -126,6 +126,13 @@ namespace comphelper ); aArguments.get_ensureType( "AutomaticAddition", m_bAutoAddProperties ); + bool AllowEmptyPropertyName(false); + aArguments.get_ensureType( "AllowEmptyPropertyName", + AllowEmptyPropertyName ); + if (AllowEmptyPropertyName) { + m_aDynamicProperties.setAllowEmptyPropertyName( + AllowEmptyPropertyName); + } } //-------------------------------------------------------------------- @@ -176,8 +183,10 @@ namespace comphelper void OPropertyBag::setModifiedImpl(::sal_Bool bModified, bool bIgnoreRuntimeExceptionsWhileFiring) { - ::osl::MutexGuard aGuard( m_aMutex ); - m_isModified = bModified; + { // do not lock mutex while notifying (#i93514#) to prevent deadlock + ::osl::MutexGuard aGuard( m_aMutex ); + m_isModified = bModified; + } if (bModified) { try { Reference<XInterface> xThis(*this); diff --git a/comphelper/source/property/opropertybag.hxx b/comphelper/source/property/opropertybag.hxx index a7a401a0755a..7acc0f451c4e 100644 --- a/comphelper/source/property/opropertybag.hxx +++ b/comphelper/source/property/opropertybag.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: opropertybag.hxx,v $ - * $Revision: 1.4 $ + * $Revision: 1.4.38.1 $ * * This file is part of OpenOffice.org. * @@ -35,7 +35,7 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/util/XModifyBroadcaster.hpp> +#include <com/sun/star/util/XModifiable.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertyContainer.hpp> #include <com/sun/star/beans/XPropertyAccess.hpp> @@ -77,7 +77,7 @@ namespace comphelper //==================================================================== typedef ::cppu::WeakAggImplHelper5 < ::com::sun::star::beans::XPropertyContainer , ::com::sun::star::beans::XPropertyAccess - , ::com::sun::star::util::XModifyBroadcaster + , ::com::sun::star::util::XModifiable , ::com::sun::star::lang::XServiceInfo , ::com::sun::star::lang::XInitialization > OPropertyBag_Base; diff --git a/comphelper/source/property/propagg.cxx b/comphelper/source/property/propagg.cxx index 3102bc97c77d..bb16941c3e60 100644 --- a/comphelper/source/property/propagg.cxx +++ b/comphelper/source/property/propagg.cxx @@ -36,6 +36,11 @@ #include <osl/diagnose.h> #include <com/sun/star/beans/PropertyAttribute.hpp> +#if OSL_DEBUG_LEVEL > 0 +#include <typeinfo> +#include <rtl/strbuf.hxx> +#endif + #include <algorithm> #include <set> @@ -708,7 +713,26 @@ void SAL_CALL OPropertySetAggregationHelper::setPropertyValues( if (!m_xAggregateSet.is()) OPropertySetHelper::setPropertyValues(_rPropertyNames, _rValues); else if (_rPropertyNames.getLength() == 1) // use the more efficient way - setPropertyValue(_rPropertyNames.getConstArray()[0], _rValues.getConstArray()[0]); + { + try + { + setPropertyValue( _rPropertyNames[0], _rValues[0] ); + } + catch( const UnknownPropertyException& ) + { + // by definition of XMultiPropertySet::setPropertyValues, unknown properties are to be ignored + #if OSL_DEBUG_LEVEL > 0 + ::rtl::OStringBuffer aMessage; + aMessage.append( "OPropertySetAggregationHelper::setPropertyValues: unknown property '" ); + aMessage.append( ::rtl::OUStringToOString( _rPropertyNames[0], RTL_TEXTENCODING_ASCII_US ) ); + aMessage.append( "'" ); + aMessage.append( "\n(implementation " ); + aMessage.append( typeid( *this ).name() ); + aMessage.append( ")" ); + OSL_ENSURE( false, aMessage.getStr() ); + #endif + } + } else { OPropertyArrayAggregationHelper& rPH = static_cast< OPropertyArrayAggregationHelper& >( getInfoHelper() ); diff --git a/comphelper/source/property/property.cxx b/comphelper/source/property/property.cxx index a708a06ea86b..82e38d49c433 100644 --- a/comphelper/source/property/property.cxx +++ b/comphelper/source/property/property.cxx @@ -195,7 +195,7 @@ void ModifyPropertyAttributes(Sequence<Property>& seqProps, const ::rtl::OUStrin } //------------------------------------------------------------------ -sal_Bool tryPropertyValue(Any& _rConvertedValue, Any& _rOldValue, const Any& _rValueToSet, Any& _rCurrentValue, const Type& _rExpectedType) +sal_Bool tryPropertyValue(Any& _rConvertedValue, Any& _rOldValue, const Any& _rValueToSet, const Any& _rCurrentValue, const Type& _rExpectedType) { sal_Bool bModified(sal_False); if (_rCurrentValue.getValue() != _rValueToSet.getValue()) diff --git a/comphelper/source/property/propertybag.cxx b/comphelper/source/property/propertybag.cxx index b447e9635fb1..91c104b119f2 100644 --- a/comphelper/source/property/propertybag.cxx +++ b/comphelper/source/property/propertybag.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: propertybag.cxx,v $ - * $Revision: 1.4 $ + * $Revision: 1.4.60.1 $ * * This file is part of OpenOffice.org. * @@ -66,7 +66,9 @@ namespace comphelper typedef ::std::map< sal_Int32, Any > MapInt2Any; struct PropertyBag_Impl { + PropertyBag_Impl() : m_bAllowEmptyPropertyName(false) { } MapInt2Any aDefaults; + bool m_bAllowEmptyPropertyName; }; //==================================================================== @@ -83,18 +85,24 @@ namespace comphelper } //-------------------------------------------------------------------- + void PropertyBag::setAllowEmptyPropertyName( bool i_isAllowed ) + { + m_pImpl->m_bAllowEmptyPropertyName = i_isAllowed; + } + + //-------------------------------------------------------------------- void PropertyBag::addProperty( const ::rtl::OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, const Any& _rInitialValue ) { // check type sanity Type aPropertyType = _rInitialValue.getValueType(); if ( aPropertyType.getTypeClass() == TypeClass_VOID ) throw IllegalTypeException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The initial vallue must be non-NULL, to determine the property type." ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The initial value must be non-NULL to determine the property type." ) ), // TODO: resource NULL ); // check name/handle sanity - if ( !_rName.getLength() ) + if ( !m_pImpl->m_bAllowEmptyPropertyName && !_rName.getLength() ) throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The property name must not be empty." ) ), // TODO: resource diff --git a/comphelper/source/property/propertycontainerhelper.cxx b/comphelper/source/property/propertycontainerhelper.cxx index e0c87545e33f..9d1662d1ecf2 100644 --- a/comphelper/source/property/propertycontainerhelper.cxx +++ b/comphelper/source/property/propertycontainerhelper.cxx @@ -492,7 +492,7 @@ const Property& OPropertyContainerHelper::getProperty( const ::rtl::OUString& _r PropertyDescriptionNameMatch( _rName ) ); if ( pos == m_aProperties.end() ) - throw UnknownPropertyException(); + throw UnknownPropertyException( _rName, NULL ); return pos->aProperty; } diff --git a/comphelper/source/property/propertysethelper.cxx b/comphelper/source/property/propertysethelper.cxx index 7b186beef2fe..7996585eb915 100644 --- a/comphelper/source/property/propertysethelper.cxx +++ b/comphelper/source/property/propertysethelper.cxx @@ -118,7 +118,7 @@ void SAL_CALL PropertySetHelper::setPropertyValue( const ::rtl::OUString& aPrope aEntries[0] = mp->find( aPropertyName ); if( NULL == aEntries[0] ) - throw UnknownPropertyException(); + throw UnknownPropertyException( aPropertyName, static_cast< XPropertySet* >( this ) ); aEntries[1] = NULL; @@ -131,7 +131,7 @@ Any SAL_CALL PropertySetHelper::getPropertyValue( const ::rtl::OUString& Propert aEntries[0] = mp->find( PropertyName ); if( NULL == aEntries[0] ) - throw UnknownPropertyException(); + throw UnknownPropertyException( PropertyName, static_cast< XPropertySet* >( this ) ); aEntries[1] = NULL; @@ -189,7 +189,7 @@ void SAL_CALL PropertySetHelper::setPropertyValues( const Sequence< ::rtl::OUStr delete[] pEntries; if( bUnknown ) - throw UnknownPropertyException(); + throw UnknownPropertyException( *pNames, static_cast< XPropertySet* >( this ) ); } } @@ -221,7 +221,7 @@ Sequence< Any > SAL_CALL PropertySetHelper::getPropertyValues( const Sequence< : delete[] pEntries; if( bUnknown ) - throw UnknownPropertyException(); + throw UnknownPropertyException( *pNames, static_cast< XPropertySet* >( this ) ); } return aValues; @@ -249,7 +249,7 @@ PropertyState SAL_CALL PropertySetHelper::getPropertyState( const ::rtl::OUStrin aEntries[0] = mp->find( PropertyName ); if( aEntries[0] == NULL ) - throw UnknownPropertyException(); + throw UnknownPropertyException( PropertyName, static_cast< XPropertySet* >( this ) ); aEntries[1] = NULL; @@ -288,7 +288,7 @@ Sequence< PropertyState > SAL_CALL PropertySetHelper::getPropertyStates( const S delete[] pEntries; if( bUnknown ) - throw UnknownPropertyException(); + throw UnknownPropertyException( *pNames, static_cast< XPropertySet* >( this ) ); } return aStates; @@ -298,7 +298,7 @@ void SAL_CALL PropertySetHelper::setPropertyToDefault( const ::rtl::OUString& Pr { PropertyMapEntry *pEntry = mp->find( PropertyName ); if( NULL == pEntry ) - throw UnknownPropertyException(); + throw UnknownPropertyException( PropertyName, static_cast< XPropertySet* >( this ) ); _setPropertyToDefault( pEntry ); } @@ -307,7 +307,7 @@ Any SAL_CALL PropertySetHelper::getPropertyDefault( const ::rtl::OUString& aProp { PropertyMapEntry* pEntry = mp->find( aPropertyName ); if( NULL == pEntry ) - throw UnknownPropertyException(); + throw UnknownPropertyException( aPropertyName, static_cast< XPropertySet* >( this ) ); return _getPropertyDefault( pEntry ); } diff --git a/comphelper/source/property/propertysetinfo.cxx b/comphelper/source/property/propertysetinfo.cxx index 11900fa71190..e155d695e2c9 100644 --- a/comphelper/source/property/propertysetinfo.cxx +++ b/comphelper/source/property/propertysetinfo.cxx @@ -151,7 +151,7 @@ Property PropertyMapImpl::getPropertyByName( const OUString& aName ) throw( Unkn PropertyMap::iterator aIter = maPropertyMap.find( aName ); if( maPropertyMap.end() == aIter ) - throw UnknownPropertyException(); + throw UnknownPropertyException( aName, NULL ); PropertyMapEntry* pEntry = (*aIter).second; diff --git a/comphelper/source/xml/ofopxmlhelper.cxx b/comphelper/source/xml/ofopxmlhelper.cxx index 4b9dc3db631e..ed13fa2207f9 100644 --- a/comphelper/source/xml/ofopxmlhelper.cxx +++ b/comphelper/source/xml/ofopxmlhelper.cxx @@ -108,7 +108,7 @@ void SAL_CALL OFOPXMLHelper::WriteRelationsInfoSequence( const uno::Reference< i pRootAttrList->AddAttribute( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "xmlns" ) ), aCDATAString, - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "http://schemas.openxmlformats.org/package/2006/relationsships" ) ) ); + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "http://schemas.openxmlformats.org/package/2006/relationships" ) ) ); xWriterHandler->startDocument(); xWriterHandler->startElement( aRelListElement, xRootAttrList ); diff --git a/comphelper/util/makefile.pmk b/comphelper/util/makefile.pmk index 464db5f1f083..fa057a4986a4 100644 --- a/comphelper/util/makefile.pmk +++ b/comphelper/util/makefile.pmk @@ -36,15 +36,4 @@ STL_OS2_BUILDING=1 # define COMPHELPER_DLLIMPLEMENTATION (see @ comphelperdllapi.h) CDEFS += -DCOMPHELPER_DLLIMPLEMENTATION -# set default symbol visibility / scope to hidden -.IF "$(COMNAME)" == "gcc3" -.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE" - CFLAGS += -fvisibility=hidden -.ENDIF # HAVE_GCC_VISIBILITY_FEATURE -.ENDIF # gcc3 - -.IF "$(COMNAME)" == "sunpro5" -.IF "$(CCNUMVER)" >= "00050005" - CFLAGS += -xldscope=hidden -.ENDIF # 5.5 -.ENDIF # sunpro5 +VISIBILITY_HIDDEN=TRUE diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index 267abd002111..acf858536f9b 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: implrenderer.cxx,v $ - * $Revision: 1.26 $ + * $Revision: 1.25.4.2 $ * * This file is part of OpenOffice.org. * @@ -200,6 +200,7 @@ namespace aCalculatedNewState.xFont = rNewState.xFont; aCalculatedNewState.fontRotation = rNewState.fontRotation; aCalculatedNewState.textReliefStyle = rNewState.textReliefStyle; + aCalculatedNewState.textOverlineStyle = rNewState.textOverlineStyle; aCalculatedNewState.textUnderlineStyle = rNewState.textUnderlineStyle; aCalculatedNewState.textStrikeoutStyle = rNewState.textStrikeoutStyle; aCalculatedNewState.textEmphasisMarkStyle = rNewState.textEmphasisMarkStyle; @@ -364,72 +365,62 @@ namespace return nChar; sal_Unicode nOffset(0); - switch( eLang ) + // eLang & LANGUAGE_MASK_PRIMARY catches language independent of region. + // CAVEAT! To some like Mongolian MS assigned the same primary language + // although the script type is different! + switch( eLang & LANGUAGE_MASK_PRIMARY ) { default: break; - case LANGUAGE_ARABIC: - // FALLTHROUGS intended - case LANGUAGE_ARABIC_SAUDI_ARABIA: - case LANGUAGE_ARABIC_IRAQ: - case LANGUAGE_ARABIC_EGYPT: - case LANGUAGE_ARABIC_LIBYA: - case LANGUAGE_ARABIC_ALGERIA: - case LANGUAGE_ARABIC_MOROCCO: - case LANGUAGE_ARABIC_TUNISIA: - case LANGUAGE_ARABIC_OMAN: - case LANGUAGE_ARABIC_YEMEN: - case LANGUAGE_ARABIC_SYRIA: - case LANGUAGE_ARABIC_JORDAN: - case LANGUAGE_ARABIC_LEBANON: - case LANGUAGE_ARABIC_KUWAIT: - case LANGUAGE_ARABIC_UAE: - case LANGUAGE_ARABIC_BAHRAIN: - case LANGUAGE_ARABIC_QATAR: - case LANGUAGE_URDU: - case LANGUAGE_URDU_PAKISTAN: - case LANGUAGE_URDU_INDIA: - case LANGUAGE_PUNJABI: //??? + case LANGUAGE_ARABIC_SAUDI_ARABIA & LANGUAGE_MASK_PRIMARY: + case LANGUAGE_URDU & LANGUAGE_MASK_PRIMARY: + case LANGUAGE_PUNJABI & LANGUAGE_MASK_PRIMARY: //??? nOffset = 0x0660 - '0'; // arabic/persian/urdu break; - case LANGUAGE_BENGALI: + case LANGUAGE_BENGALI & LANGUAGE_MASK_PRIMARY: nOffset = 0x09E6 - '0'; // bengali break; - case LANGUAGE_HINDI: + case LANGUAGE_BURMESE & LANGUAGE_MASK_PRIMARY: + nOffset = 0x1040 - '0'; // burmese + break; + case LANGUAGE_HINDI & LANGUAGE_MASK_PRIMARY: nOffset = 0x0966 - '0'; // devanagari break; - case LANGUAGE_GUJARATI: + case LANGUAGE_GUJARATI & LANGUAGE_MASK_PRIMARY: nOffset = 0x0AE6 - '0'; // gujarati break; - case LANGUAGE_KANNADA: + case LANGUAGE_KANNADA & LANGUAGE_MASK_PRIMARY: nOffset = 0x0CE6 - '0'; // kannada break; - case LANGUAGE_KHMER: + case LANGUAGE_KHMER & LANGUAGE_MASK_PRIMARY: nOffset = 0x17E0 - '0'; // khmer break; - case LANGUAGE_LAO: + case LANGUAGE_LAO & LANGUAGE_MASK_PRIMARY: nOffset = 0x0ED0 - '0'; // lao break; - case LANGUAGE_MALAYALAM: + case LANGUAGE_MALAYALAM & LANGUAGE_MASK_PRIMARY: nOffset = 0x0D66 - '0'; // malayalam break; - case LANGUAGE_MONGOLIAN: - nOffset = 0x1810 - '0'; // mongolian + case LANGUAGE_MONGOLIAN & LANGUAGE_MASK_PRIMARY: + if (eLang == LANGUAGE_MONGOLIAN_MONGOLIAN) + nOffset = 0x1810 - '0'; // mongolian + else + nOffset = 0; // mongolian cyrillic break; - case LANGUAGE_ORIYA: + case LANGUAGE_ORIYA & LANGUAGE_MASK_PRIMARY: nOffset = 0x0B66 - '0'; // oriya break; - case LANGUAGE_TAMIL: + case LANGUAGE_TAMIL & LANGUAGE_MASK_PRIMARY: nOffset = 0x0BE7 - '0'; // tamil break; - case LANGUAGE_TELUGU: + case LANGUAGE_TELUGU & LANGUAGE_MASK_PRIMARY: nOffset = 0x0C66 - '0'; // telugu break; - case LANGUAGE_THAI: + case LANGUAGE_THAI & LANGUAGE_MASK_PRIMARY: nOffset = 0x0E50 - '0'; // thai break; - case LANGUAGE_TIBETAN: + case LANGUAGE_TIBETAN & LANGUAGE_MASK_PRIMARY: nOffset = 0x0F20 - '0'; // tibetan break; } @@ -700,6 +691,8 @@ namespace cppcanvas break; case GRADIENT_AXIAL: + // vcl considers center color as start color + ::std::swap(aColors[0],aColors[1]); aTexture.Gradient = xFactory->createAxialHorizontalGradient( aColors, aStops ); break; @@ -1634,6 +1627,7 @@ namespace cppcanvas // TODO(Q2): define and use appropriate enumeration types rState.textReliefStyle = (sal_Int8)rFont.GetRelief(); + rState.textOverlineStyle = (sal_Int8)rFont.GetOverline(); rState.textUnderlineStyle = rParms.maFontUnderline.isValid() ? (rParms.maFontUnderline.getValue() ? (sal_Int8)UNDERLINE_SINGLE : (sal_Int8)UNDERLINE_NONE) : (sal_Int8)rFont.GetUnderline(); diff --git a/cppcanvas/source/mtfrenderer/mtftools.cxx b/cppcanvas/source/mtfrenderer/mtftools.cxx index baf39cc0c13e..e4e227955da6 100644 --- a/cppcanvas/source/mtfrenderer/mtftools.cxx +++ b/cppcanvas/source/mtfrenderer/mtftools.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: mtftools.cxx,v $ - * $Revision: 1.14 $ + * $Revision: 1.14.6.1 $ * * This file is part of OpenOffice.org. * @@ -308,7 +308,7 @@ namespace cppcanvas return true; } - // create underline/strikeout line info struct + // create overline/underline/strikeout line info struct TextLineInfo createTextLineInfo( const ::VirtualDevice& rVDev, const ::cppcanvas::internal::OutDevState& rState ) { @@ -325,8 +325,11 @@ namespace cppcanvas TextLineInfo aTextInfo( (aMetric.GetDescent() + 2) / 4.0, + ((aMetric.GetIntLeading() + 1.5) / 3.0), + (aMetric.GetIntLeading() / 2.0) - aMetric.GetAscent(), aMetric.GetDescent() / 2.0, (aMetric.GetIntLeading() - aMetric.GetAscent()) / 3.0, + rState.textOverlineStyle, rState.textUnderlineStyle, rState.textStrikeoutStyle ); @@ -397,6 +400,111 @@ namespace cppcanvas // fill the polypolygon with all text lines ::basegfx::B2DPolyPolygon aTextLinesPolyPoly; + switch( rTextLineInfo.mnOverlineStyle ) + { + case UNDERLINE_NONE: // nothing to do + // FALLTHROUGH intended + case UNDERLINE_DONTKNOW: + break; + + case UNDERLINE_SMALLWAVE: // TODO(F3): NYI + // FALLTHROUGH intended + case UNDERLINE_WAVE: // TODO(F3): NYI + // FALLTHROUGH intended + case UNDERLINE_SINGLE: + appendRect( + aTextLinesPolyPoly, + rStartPos, + 0, + rTextLineInfo.mnOverlineOffset, + rLineWidth, + rTextLineInfo.mnOverlineOffset + rTextLineInfo.mnOverlineHeight ); + break; + + case UNDERLINE_BOLDDOTTED: // TODO(F3): NYI + // FALLTHROUGH intended + case UNDERLINE_BOLDDASH: // TODO(F3): NYI + // FALLTHROUGH intended + case UNDERLINE_BOLDLONGDASH: // TODO(F3): NYI + // FALLTHROUGH intended + case UNDERLINE_BOLDDASHDOT: // TODO(F3): NYI + // FALLTHROUGH intended + case UNDERLINE_BOLDDASHDOTDOT:// TODO(F3): NYI + // FALLTHROUGH intended + case UNDERLINE_BOLDWAVE: // TODO(F3): NYI + // FALLTHROUGH intended + case UNDERLINE_BOLD: + appendRect( + aTextLinesPolyPoly, + rStartPos, + 0, + rTextLineInfo.mnOverlineOffset - rTextLineInfo.mnOverlineHeight, + rLineWidth, + rTextLineInfo.mnOverlineOffset + rTextLineInfo.mnOverlineHeight ); + break; + + case UNDERLINE_DOUBLEWAVE: // TODO(F3): NYI + // FALLTHROUGH intended + case UNDERLINE_DOUBLE: + appendRect( + aTextLinesPolyPoly, + rStartPos, + 0, + rTextLineInfo.mnOverlineOffset - rTextLineInfo.mnOverlineHeight * 2.0 , + rLineWidth, + rTextLineInfo.mnOverlineOffset - rTextLineInfo.mnOverlineHeight ); + + appendRect( + aTextLinesPolyPoly, + rStartPos, + 0, + rTextLineInfo.mnOverlineOffset + rTextLineInfo.mnOverlineHeight, + rLineWidth, + rTextLineInfo.mnOverlineOffset + rTextLineInfo.mnOverlineHeight * 2.0 ); + break; + + case UNDERLINE_DASHDOTDOT: // TODO(F3): NYI + // FALLTHROUGH intended + case UNDERLINE_DOTTED: + appendDashes( + aTextLinesPolyPoly, + rStartPos.getX(), + rStartPos.getY() + rTextLineInfo.mnOverlineOffset, + rLineWidth, + rTextLineInfo.mnOverlineHeight, + rTextLineInfo.mnOverlineHeight, + 2*rTextLineInfo.mnOverlineHeight ); + break; + + case UNDERLINE_DASHDOT: // TODO(F3): NYI + // FALLTHROUGH intended + case UNDERLINE_DASH: + appendDashes( + aTextLinesPolyPoly, + rStartPos.getX(), + rStartPos.getY() + rTextLineInfo.mnOverlineOffset, + rLineWidth, + rTextLineInfo.mnOverlineHeight, + 3*rTextLineInfo.mnOverlineHeight, + 6*rTextLineInfo.mnOverlineHeight ); + break; + + case UNDERLINE_LONGDASH: + appendDashes( + aTextLinesPolyPoly, + rStartPos.getX(), + rStartPos.getY() + rTextLineInfo.mnOverlineOffset, + rLineWidth, + rTextLineInfo.mnOverlineHeight, + 6*rTextLineInfo.mnOverlineHeight, + 12*rTextLineInfo.mnOverlineHeight ); + break; + + default: + ENSURE_OR_THROW( false, + "::cppcanvas::internal::createTextLinesPolyPolygon(): Unexpected overline case" ); + } + switch( rTextLineInfo.mnUnderlineStyle ) { case UNDERLINE_NONE: // nothing to do diff --git a/cppcanvas/source/mtfrenderer/mtftools.hxx b/cppcanvas/source/mtfrenderer/mtftools.hxx index b9234bb178d7..d44272342ee9 100644 --- a/cppcanvas/source/mtfrenderer/mtftools.hxx +++ b/cppcanvas/source/mtfrenderer/mtftools.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: mtftools.hxx,v $ - * $Revision: 1.9 $ + * $Revision: 1.9.16.1 $ * * This file is part of OpenOffice.org. * @@ -208,21 +208,30 @@ namespace cppcanvas struct TextLineInfo { TextLineInfo( const double& rLineHeight, + const double& rOverlineHeight, + const double& rOverlineOffset, const double& rUnderlineOffset, const double& rStrikeoutOffset, + sal_Int8 nOverlineStyle, sal_Int8 nUnderlineStyle, sal_Int8 nStrikeoutStyle ) : mnLineHeight( rLineHeight ), + mnOverlineHeight( rOverlineHeight ), + mnOverlineOffset( rOverlineOffset ), mnUnderlineOffset( rUnderlineOffset ), mnStrikeoutOffset( rStrikeoutOffset ), + mnOverlineStyle( nOverlineStyle ), mnUnderlineStyle( nUnderlineStyle ), mnStrikeoutStyle( nStrikeoutStyle ) { } double mnLineHeight; + double mnOverlineHeight; + double mnOverlineOffset; double mnUnderlineOffset; double mnStrikeoutOffset; + sal_Int8 mnOverlineStyle; sal_Int8 mnUnderlineStyle; sal_Int8 mnStrikeoutStyle; }; @@ -240,16 +249,16 @@ namespace cppcanvas const ::cppcanvas::internal::OutDevState& rState ); /** Create a poly-polygon representing the given combination - of strikeout and underline. + of overline, strikeout and underline. @param rStartOffset Offset in X direction, where the underline starts @param rLineWidth - Width of the line of text to underline/strikeout + Width of the line of text to overline/strikeout/underline @param rTextLineInfo - Common info needed for strikeout/underline generation + Common info needed for overline/strikeout/underline generation */ ::basegfx::B2DPolyPolygon createTextLinesPolyPolygon( const double& rStartOffset, const double& rLineWidth, diff --git a/cppcanvas/source/mtfrenderer/outdevstate.hxx b/cppcanvas/source/mtfrenderer/outdevstate.hxx index a100db70d145..b1eee1ab6f2e 100644 --- a/cppcanvas/source/mtfrenderer/outdevstate.hxx +++ b/cppcanvas/source/mtfrenderer/outdevstate.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: outdevstate.hxx,v $ - * $Revision: 1.9 $ + * $Revision: 1.9.16.1 $ * * This file is part of OpenOffice.org. * @@ -87,6 +87,7 @@ namespace cppcanvas textAlignment(0), // TODO(Q2): Synchronize with implrenderer // and possibly new rendering::TextAlignment textReliefStyle(RELIEF_NONE), + textOverlineStyle(UNDERLINE_NONE), textUnderlineStyle(UNDERLINE_NONE), textStrikeoutStyle(STRIKEOUT_NONE), textReferencePoint(ALIGN_BASELINE), @@ -127,6 +128,7 @@ namespace cppcanvas sal_Int8 textDirection; sal_Int8 textAlignment; sal_Int8 textReliefStyle; + sal_Int8 textOverlineStyle; sal_Int8 textUnderlineStyle; sal_Int8 textStrikeoutStyle; TextAlign textReferencePoint; diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx index 66bf728418c1..f1191e6e57f3 100644 --- a/cppcanvas/source/mtfrenderer/textaction.cxx +++ b/cppcanvas/source/mtfrenderer/textaction.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: textaction.cxx,v $ - * $Revision: 1.22 $ + * $Revision: 1.22.4.1 $ * * This file is part of OpenOffice.org. * @@ -2183,7 +2183,8 @@ namespace cppcanvas if( !pDXArray && !bSubsettable ) { // effects, or not? - if( !rState.textUnderlineStyle && + if( !rState.textOverlineStyle && + !rState.textUnderlineStyle && !rState.textStrikeoutStyle && rReliefColor == aEmptyColor && rShadowColor == aEmptyColor ) @@ -2246,7 +2247,8 @@ namespace cppcanvas else { // DX array necessary - any effects? - if( !rState.textUnderlineStyle && + if( !rState.textOverlineStyle && + !rState.textUnderlineStyle && !rState.textStrikeoutStyle && rReliefColor == aEmptyColor && rShadowColor == aEmptyColor ) diff --git a/dtrans/source/X11/X11_selection.cxx b/dtrans/source/X11/X11_selection.cxx index 582dd10d041e..2a424984850a 100644 --- a/dtrans/source/X11/X11_selection.cxx +++ b/dtrans/source/X11/X11_selection.cxx @@ -2073,10 +2073,14 @@ bool SelectionManager::handleSelectionNotify( XSelectionEvent& rNotify ) #endif ::std::hash_map< Atom, Selection* >::iterator it = m_aSelections.find( rNotify.selection ); - if( ( rNotify.requestor == m_aWindow || rNotify.requestor == m_aCurrentDropWindow ) && - it != m_aSelections.end() && - ( it->second->m_eState == Selection::WaitingForResponse ) || - ( it->second->m_eState == Selection::WaitingForData ) ) + if ( + (rNotify.requestor == m_aWindow || rNotify.requestor == m_aCurrentDropWindow) && + it != m_aSelections.end() && + ( + (it->second->m_eState == Selection::WaitingForResponse) || + (it->second->m_eState == Selection::WaitingForData) + ) + ) { bHandled = true; if( it->second->m_aRequestedType == m_nMULTIPLEAtom ) diff --git a/dtrans/source/aqua/DropTarget.cxx b/dtrans/source/aqua/DropTarget.cxx index 8cec3daf7a2d..bb45742732e7 100644 --- a/dtrans/source/aqua/DropTarget.cxx +++ b/dtrans/source/aqua/DropTarget.cxx @@ -190,7 +190,9 @@ sal_Int8 DropTarget::determineDropAction(sal_Int8 dropActions, id sender) const // has been set and we map this to ACTION_MOVE or ACTION_COPY // depending on whether or not source and dest are equal, // this hopefully satisfies all parties - if (dropActions == DNDConstants::ACTION_DEFAULT) + if( (dropActions == DNDConstants::ACTION_DEFAULT) + || ((dropActions == mDragSourceSupportedActions) + && !(~mDragSourceSupportedActions & DNDConstants::ACTION_COPY_OR_MOVE ) ) ) { dropAct = srcAndDestEqual ? DNDConstants::ACTION_MOVE : DNDConstants::ACTION_COPY; diff --git a/dtrans/source/aqua/aqua_clipboard.cxx b/dtrans/source/aqua/aqua_clipboard.cxx index 166afa686478..d0b821099ea0 100644 --- a/dtrans/source/aqua/aqua_clipboard.cxx +++ b/dtrans/source/aqua/aqua_clipboard.cxx @@ -191,28 +191,30 @@ Reference<XTransferable> SAL_CALL AquaClipboard::getContents() throw(RuntimeExce void SAL_CALL AquaClipboard::setContents(const Reference<XTransferable>& xTransferable, - const Reference<XClipboardOwner>& xClipboardOwner) - throw( RuntimeException ) + const Reference<XClipboardOwner>& xClipboardOwner) + throw( RuntimeException ) { - ClearableMutexGuard aGuard(m_aMutex); + ClearableMutexGuard aGuard(m_aMutex); - Reference<XClipboardOwner> oldOwner(mXClipboardOwner); - mXClipboardOwner = xClipboardOwner; + Reference<XClipboardOwner> oldOwner(mXClipboardOwner); + mXClipboardOwner = xClipboardOwner; - Reference<XTransferable> oldContent(mXClipboardContent); - mXClipboardContent = xTransferable; + Reference<XTransferable> oldContent(mXClipboardContent); + mXClipboardContent = xTransferable; - NSArray* types = mpDataFlavorMapper->flavorSequenceToTypesArray(mXClipboardContent->getTransferDataFlavors()); - mPasteboardChangeCount = [mPasteboard declareTypes: types owner: mEventListener]; + NSArray* types = mXClipboardContent.is() ? + mpDataFlavorMapper->flavorSequenceToTypesArray(mXClipboardContent->getTransferDataFlavors()) : + [NSArray array]; + mPasteboardChangeCount = [mPasteboard declareTypes: types owner: mEventListener]; - // if we are already the owner of the clipboard - // then fire lost ownership event - if (oldOwner.is()) + // if we are already the owner of the clipboard + // then fire lost ownership event + if (oldOwner.is()) { - fireLostClipboardOwnershipEvent(oldOwner, oldContent); + fireLostClipboardOwnershipEvent(oldOwner, oldContent); } - fireClipboardChangedEvent(); + fireClipboardChangedEvent(); } diff --git a/dtrans/source/win32/dtobj/FmtFilter.cxx b/dtrans/source/win32/dtobj/FmtFilter.cxx index d452ac051f7f..a3e9357109ea 100644 --- a/dtrans/source/win32/dtobj/FmtFilter.cxx +++ b/dtrans/source/win32/dtobj/FmtFilter.cxx @@ -167,10 +167,8 @@ Sequence< sal_Int8 > SAL_CALL WinENHMFPictToOOMFPict( HENHMETAFILE hEnhMetaFile HMETAFILEPICT SAL_CALL OOMFPictToWinMFPict( Sequence< sal_Int8 >& aOOMetaFilePict ) { - OSL_ASSERT( aOOMetaFilePict.getLength() > 22 ); - HMETAFILEPICT hPict = NULL; - HMETAFILE hMtf = SetMetaFileBitsEx( aOOMetaFilePict.getLength() - 22, (sal_uChar*) aOOMetaFilePict.getConstArray() + 22 ); + HMETAFILE hMtf = SetMetaFileBitsEx( aOOMetaFilePict.getLength(), (sal_uChar*) aOOMetaFilePict.getConstArray() ); if( hMtf ) { diff --git a/goodies/inc/pch/precompiled_goodies.hxx b/goodies/inc/pch/precompiled_goodies.hxx index 5ac2273e1e17..b0d1ba09410b 100644 --- a/goodies/inc/pch/precompiled_goodies.hxx +++ b/goodies/inc/pch/precompiled_goodies.hxx @@ -100,7 +100,6 @@ #include "svtools/fltcall.hxx" #include "svtools/itemprop.hxx" #include "svtools/lstner.hxx" -#include "svtools/options3d.hxx" #include "svtools/solar.hrc" #include "svtools/stdctrl.hxx" #include "svtools/svarray.hxx" diff --git a/goodies/source/filter.vcl/idxf/dxfgrprd.cxx b/goodies/source/filter.vcl/idxf/dxfgrprd.cxx index acebc0f4c092..e1849ec3682f 100644 --- a/goodies/source/filter.vcl/idxf/dxfgrprd.cxx +++ b/goodies/source/filter.vcl/idxf/dxfgrprd.cxx @@ -57,10 +57,12 @@ BOOL DXFReadLine( SvStream& rIStm, ByteString& rStr ) { USHORT nLen = (USHORT)rIStm.Read( buf, sizeof(buf)-1 ); if( !nLen ) + { if( rStr.Len() == 0 ) return FALSE; else break; + } for( USHORT n = 0; n < nLen ; n++ ) { diff --git a/goodies/source/unographic/graphicuno.cxx b/goodies/source/unographic/graphicuno.cxx index 6f096b6d204e..b47f04034336 100755 --- a/goodies/source/unographic/graphicuno.cxx +++ b/goodies/source/unographic/graphicuno.cxx @@ -38,11 +38,13 @@ #include "renderer.hxx" #include <com/sun/star/registry/XRegistryKey.hpp> +#include "comphelper/servicedecl.hxx" using namespace com::sun::star; +namespace sdecl = comphelper::service_decl; namespace unographic { - +extern sdecl::ServiceDecl const serviceDecl; // -------------------- // - *_createInstance - // -------------------- @@ -72,7 +74,7 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char* // - component_writeInfo - // ----------------------- -extern "C" sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, void* pRegistryKey ) +extern "C" sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey ) { sal_Bool bRet = sal_False; @@ -106,6 +108,9 @@ extern "C" sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, voi for( i = 0; i < aServices.getLength(); i++ ) xNewKey->createKey( aServices.getConstArray()[ i ] ); + if ( !component_writeInfoHelper( reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ), serviceDecl ) ) + return false; + bRet = true; } catch (registry::InvalidRegistryException &) @@ -121,7 +126,7 @@ extern "C" sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, voi // - component_getFactory - // ------------------------ -extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /*pRegistryKey*/ ) +extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* pRegistryKey ) { void * pRet = 0; @@ -153,7 +158,11 @@ extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pRet = xFactory.get(); } } + else + { + pRet = component_getFactoryHelper( pImplName, reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ),reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ), serviceDecl ); + } return pRet; } diff --git a/goodies/source/unographic/graphicunofactory.cxx b/goodies/source/unographic/graphicunofactory.cxx new file mode 100644 index 000000000000..cdf9c51bf601 --- /dev/null +++ b/goodies/source/unographic/graphicunofactory.cxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: graphicunofactory.cxx,v $ + * $Revision: 1.1.2.1 $ + * + * 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_goodies.hxx" +#include <comphelper/servicedecl.hxx> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/graphic/XGraphicObject.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include "grfmgr.hxx" + +using namespace com::sun::star; + +namespace unographic { + +typedef ::cppu::WeakImplHelper1< graphic::XGraphicObject > GObjectAccess_BASE; + // Simple uno wrapper around the GraphicObject class to allow basic + // access. ( and solves a horrible cyclic link problem between + // goodies/toolkit/extensions ) +class GObjectImpl : public GObjectAccess_BASE +{ + ::osl::Mutex m_aMutex; + std::auto_ptr< GraphicObject > mpGObject; +public: + GObjectImpl( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & xComponentContext ) throw (uno::RuntimeException); + + // XGraphicObject + virtual uno::Reference< graphic::XGraphic > SAL_CALL getGraphic() throw (uno::RuntimeException); + virtual void SAL_CALL setGraphic( const uno::Reference< graphic::XGraphic >& _graphic ) throw (uno::RuntimeException); + ::rtl::OUString SAL_CALL getUniqueID() throw (uno::RuntimeException); +}; + +GObjectImpl::GObjectImpl( uno::Sequence< uno::Any > const & args, uno::Reference< uno::XComponentContext > const & /*xComponentContext*/ ) throw (uno::RuntimeException) +{ + if ( args.getLength() == 1 ) + { + rtl::OUString sId; + if ( !( args[ 0 ] >>= sId ) || sId.getLength() == 0 ) + throw lang::IllegalArgumentException(); + ByteString bsId( sId.getStr(), RTL_TEXTENCODING_UTF8 ); + mpGObject.reset( new GraphicObject( bsId ) ); + } + else + mpGObject.reset( new GraphicObject() ); +} + +uno::Reference< graphic::XGraphic > SAL_CALL GObjectImpl::getGraphic() throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !mpGObject.get() ) + throw uno::RuntimeException(); + return mpGObject->GetGraphic().GetXGraphic(); +} + +void SAL_CALL GObjectImpl::setGraphic( const uno::Reference< graphic::XGraphic >& _graphic ) throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if ( !mpGObject.get() ) + throw uno::RuntimeException(); + Graphic aGraphic( _graphic ); + mpGObject->SetGraphic( aGraphic ); +} + +::rtl::OUString SAL_CALL GObjectImpl::getUniqueID() throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + rtl::OUString sId; + if ( mpGObject.get() ) + sId = String( mpGObject->GetUniqueID().GetBuffer(), RTL_TEXTENCODING_ASCII_US ); + return sId; +} + + +namespace sdecl = comphelper::service_decl; +sdecl::class_<GObjectImpl, sdecl::with_args<true> > serviceBI; +extern sdecl::ServiceDecl const serviceDecl( serviceBI, "com.sun.star.graphic.GraphicObject", "com.sun.star.graphic.GraphicObject" ); + +} diff --git a/goodies/source/unographic/makefile.mk b/goodies/source/unographic/makefile.mk index 95e4e9025f20..59196031f089 100755 --- a/goodies/source/unographic/makefile.mk +++ b/goodies/source/unographic/makefile.mk @@ -8,7 +8,7 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.6 $ +# $Revision: 1.6.40.1 $ # # This file is part of OpenOffice.org. # @@ -47,6 +47,7 @@ CXXFILES= \ provider.cxx \ graphic.cxx \ renderer.cxx \ + graphicunofactory.cxx \ transformer.cxx SLOFILES= \ @@ -55,6 +56,7 @@ SLOFILES= \ $(SLO)$/provider.obj \ $(SLO)$/graphic.obj \ $(SLO)$/renderer.obj \ + $(SLO)$/graphicunofactory.obj \ $(SLO)$/transformer.obj # --- Target ------------------------------------------------------- diff --git a/goodies/source/unographic/provider.cxx b/goodies/source/unographic/provider.cxx index f59471628e3f..2eb0aede9bdf 100644 --- a/goodies/source/unographic/provider.cxx +++ b/goodies/source/unographic/provider.cxx @@ -54,12 +54,15 @@ #include "descriptor.hxx" #include "graphic.hxx" +#include "grfmgr.hxx" #include "provider.hxx" using namespace com::sun::star; namespace unographic { +#define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" + // ------------------- // - GraphicProvider - // ------------------- @@ -159,6 +162,24 @@ uno::Sequence< sal_Int8 > SAL_CALL GraphicProvider::getImplementationId() // ------------------------------------------------------------------------------ +uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadGraphicObject( const ::rtl::OUString& rResourceURL ) const +{ + uno::Reference< ::graphic::XGraphic > xRet; + if( rResourceURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 ) + { + // graphic manager url + String aTmpStr( rResourceURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 ) ); + ByteString aUniqueID( aTmpStr, RTL_TEXTENCODING_UTF8 ); + GraphicObject aGrafObj( aUniqueID ); + // I don't call aGrafObj.GetXGraphic because it will call us back + // into implLoadMemory ( with "private:memorygraphic" test ) + ::unographic::Graphic* pUnoGraphic = new ::unographic::Graphic; + pUnoGraphic->init( aGrafObj.GetGraphic() ); + xRet = pUnoGraphic; + } + return xRet; +} + uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadMemory( const ::rtl::OUString& rResourceURL ) const { uno::Reference< ::graphic::XGraphic > xRet; @@ -382,9 +403,10 @@ uno::Reference< beans::XPropertySet > SAL_CALL GraphicProvider::queryGraphicDesc else if( aURL.getLength() ) { uno::Reference< ::graphic::XGraphic > xGraphic( implLoadMemory( aURL ) ); - if( !xGraphic.is() ) xGraphic = implLoadResource( aURL ); + if( !xGraphic.is() ) + xGraphic = implLoadGraphicObject( aURL ); if ( !xGraphic.is() ) xGraphic = implLoadRepositoryImage( aURL ); @@ -455,6 +477,9 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co xRet = implLoadMemory( aPath ); if( !xRet.is() ) + xRet = implLoadGraphicObject( aPath ); + + if( !xRet.is() ) xRet = implLoadResource( aPath ); if ( !xRet.is() ) diff --git a/goodies/source/unographic/provider.hxx b/goodies/source/unographic/provider.hxx index 1b8ce1366b6b..d92866d1ed09 100644 --- a/goodies/source/unographic/provider.hxx +++ b/goodies/source/unographic/provider.hxx @@ -73,6 +73,7 @@ protected: private: ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadMemory( const ::rtl::OUString& rResourceURL ) const; + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadGraphicObject( const ::rtl::OUString& rResourceURL ) const; ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadResource( const ::rtl::OUString& rResourceURL ) const; ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadRepositoryImage( const ::rtl::OUString& rResourceURL ) const; ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > implLoadBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >& rBitmap ) const; diff --git a/i18npool/inc/calendar_gregorian.hxx b/i18npool/inc/calendar_gregorian.hxx index dcfc2bc74ef1..3af095cc7959 100644 --- a/i18npool/inc/calendar_gregorian.hxx +++ b/i18npool/inc/calendar_gregorian.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: calendar_gregorian.hxx,v $ - * $Revision: 1.16 $ + * $Revision: 1.16.24.1 $ * * This file is part of OpenOffice.org. * @@ -47,6 +47,8 @@ struct Era { sal_Int32 day; }; +const sal_Int16 FIELD_INDEX_COUNT = CalendarFieldIndex::FIELD_COUNT2; + class Calendar_gregorian : public CalendarImpl { public: @@ -61,7 +63,7 @@ public: */ ~Calendar_gregorian(); - // Methods + // Methods in XCalendar virtual void SAL_CALL loadCalendar(const rtl::OUString& uniqueID, const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException); virtual void SAL_CALL setDateTime(double nTimeInDays) throw(com::sun::star::uno::RuntimeException); virtual double SAL_CALL getDateTime() throw(com::sun::star::uno::RuntimeException); @@ -96,18 +98,33 @@ protected: const sal_Char* cCalendar; com::sun::star::lang::Locale aLocale; sal_uInt32 fieldSet; - sal_Int16 fieldValue[CalendarFieldIndex::FIELD_COUNT]; - sal_Int16 fieldSetValue[CalendarFieldIndex::FIELD_COUNT]; - virtual void SAL_CALL mapToGregorian() throw(com::sun::star::uno::RuntimeException); - virtual void SAL_CALL mapFromGregorian() throw(com::sun::star::uno::RuntimeException); - void SAL_CALL getValue() throw(com::sun::star::uno::RuntimeException); + sal_Int16 fieldValue[FIELD_INDEX_COUNT]; + sal_Int16 fieldSetValue[FIELD_INDEX_COUNT]; + + virtual void mapToGregorian() throw(com::sun::star::uno::RuntimeException); + virtual void mapFromGregorian() throw(com::sun::star::uno::RuntimeException); + void getValue() throw(com::sun::star::uno::RuntimeException); + private: - // submit fieldSetValue array according to fieldSet - void SAL_CALL submitFields() throw(com::sun::star::uno::RuntimeException); - // submit fieldSetValue array according to fieldSet, plus YMDhms if >=0 - void SAL_CALL submitValues( sal_Int32 nYear, sal_Int32 nMonth, sal_Int32 nDay, sal_Int32 nHour, sal_Int32 nMinute, sal_Int32 nSecond, sal_Int32 nMilliSecond) throw(com::sun::star::uno::RuntimeException); - void SAL_CALL setValue() throw(com::sun::star::uno::RuntimeException); Calendar aCalendar; + + /** Submit fieldSetValue array according to fieldSet. */ + void submitFields() throw(com::sun::star::uno::RuntimeException); + /** Submit fieldSetValue array according to fieldSet, plus YMDhms if >=0, + plus zone and DST if != 0 */ + void submitValues( sal_Int32 nYear, sal_Int32 nMonth, sal_Int32 nDay, sal_Int32 nHour, sal_Int32 nMinute, sal_Int32 nSecond, sal_Int32 nMilliSecond, sal_Int32 nZone, sal_Int32 nDST) throw(com::sun::star::uno::RuntimeException); + /** Set fields internally. */ + void setValue() throw(com::sun::star::uno::RuntimeException); + /** Obtain combined field values for timezone offset (minutes+secondmillis) + in milliseconds and whether fields were set. */ + bool getZoneOffset( sal_Int32 & o_nOffset ) const; + /** Obtain combined field values for DST offset (minutes+secondmillis) in + milliseconds and whether fields were set. */ + bool getDSTOffset( sal_Int32 & o_nOffset ) const; + /** Used by getZoneOffset() and getDSTOffset(). Parent is + CalendarFieldIndex for offset in minutes, child is CalendarFieldIndex + for offset in milliseconds. */ + bool getCombinedOffset( sal_Int32 & o_nOffset, sal_Int16 nParentFieldIndex, sal_Int16 nChildFieldIndex ) const; }; // ---------------------------------------------------- diff --git a/i18npool/inc/calendar_hijri.hxx b/i18npool/inc/calendar_hijri.hxx index 404f9955843e..bd10985aaad2 100644 --- a/i18npool/inc/calendar_hijri.hxx +++ b/i18npool/inc/calendar_hijri.hxx @@ -47,8 +47,8 @@ public: Calendar_hijri(); protected: - void SAL_CALL mapToGregorian() throw(com::sun::star::uno::RuntimeException); - void SAL_CALL mapFromGregorian() throw(com::sun::star::uno::RuntimeException); + void mapToGregorian() throw(com::sun::star::uno::RuntimeException); + void mapFromGregorian() throw(com::sun::star::uno::RuntimeException); // radians per degree (pi/180) static const double RadPerDeg; diff --git a/i18npool/inc/calendar_jewish.hxx b/i18npool/inc/calendar_jewish.hxx index c6170c8d6cac..1af374192558 100644 --- a/i18npool/inc/calendar_jewish.hxx +++ b/i18npool/inc/calendar_jewish.hxx @@ -48,8 +48,8 @@ public: virtual rtl::OUString SAL_CALL getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) throw (com::sun::star::uno::RuntimeException); protected: - void SAL_CALL mapToGregorian() throw(com::sun::star::uno::RuntimeException); - void SAL_CALL mapFromGregorian() throw(com::sun::star::uno::RuntimeException); + void mapToGregorian() throw(com::sun::star::uno::RuntimeException); + void mapFromGregorian() throw(com::sun::star::uno::RuntimeException); }; } } } } diff --git a/i18npool/inc/i18npool/lang.h b/i18npool/inc/i18npool/lang.h index b86db2453dad..68ae24bc2c21 100644 --- a/i18npool/inc/i18npool/lang.h +++ b/i18npool/inc/i18npool/lang.h @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: lang.h,v $ - * $Revision: 1.12 $ + * $Revision: 1.12.24.7 $ * * This file is part of OpenOffice.org. * @@ -117,7 +117,6 @@ typedef unsigned short LanguageType; #define LANGUAGE_ALBANIAN 0x041C #define LANGUAGE_ALSATIAN_FRANCE 0x0484 #define LANGUAGE_AMHARIC_ETHIOPIA 0x045E -#define LANGUAGE_ARABIC 0x0001 /* primary only, not a locale! */ #define LANGUAGE_ARABIC_ALGERIA 0x1401 #define LANGUAGE_ARABIC_BAHRAIN 0x3C01 #define LANGUAGE_ARABIC_EGYPT 0x0C01 @@ -134,6 +133,7 @@ typedef unsigned short LanguageType; #define LANGUAGE_ARABIC_TUNISIA 0x1C01 #define LANGUAGE_ARABIC_UAE 0x3801 #define LANGUAGE_ARABIC_YEMEN 0x2401 +#define LANGUAGE_ARABIC_PRIMARY_ONLY 0x0001 /* primary only, not a locale! */ #define LANGUAGE_ARMENIAN 0x042B #define LANGUAGE_ASSAMESE 0x044D #define LANGUAGE_AZERI 0x002C /* primary only, not a locale! */ @@ -323,7 +323,7 @@ typedef unsigned short LanguageType; #define LANGUAGE_UPPER_SORBIAN_GERMANY 0x042E /* obsoletes LANGUAGE_USER_UPPER_SORBIAN 0x0623 */ #define LANGUAGE_LOWER_SORBIAN_GERMANY 0x082E /* obsoletes LANGUAGE_USER_LOWER_SORBIAN 0x0624. NOTE: the primary ID is identical to Upper Sorbian, which is not quite correct because they're distinct languages */ #define LANGUAGE_SORBIAN LANGUAGE_USER_UPPER_SORBIAN /* a strange MS definition */ -#define LANGUAGE_SPANISH 0x040A +#define LANGUAGE_SPANISH_DATED 0x040A /* old collation, not supported, see #i94435# */ #define LANGUAGE_SPANISH_ARGENTINA 0x2C0A #define LANGUAGE_SPANISH_BOLIVIA 0x400A #define LANGUAGE_SPANISH_CHILE 0x340A @@ -345,6 +345,7 @@ typedef unsigned short LanguageType; #define LANGUAGE_SPANISH_UNITED_STATES 0x540A #define LANGUAGE_SPANISH_URUGUAY 0x380A #define LANGUAGE_SPANISH_VENEZUELA 0x200A +#define LANGUAGE_SPANISH LANGUAGE_SPANISH_MODERN /* modern collation, see #i94435# */ #define LANGUAGE_SWAHILI 0x0441 /* Kenya */ #define LANGUAGE_SWEDISH 0x041D #define LANGUAGE_SWEDISH_FINLAND 0x081D @@ -370,7 +371,6 @@ typedef unsigned short LanguageType; #define LANGUAGE_URDU 0x0020 /* primary only, not a locale! */ #define LANGUAGE_URDU_INDIA 0x0820 #define LANGUAGE_URDU_PAKISTAN 0x0420 -#define LANGUAGE_UZBEK 0x0043 /* primary only, not a locale! */ #define LANGUAGE_UZBEK_CYRILLIC 0x0843 #define LANGUAGE_UZBEK_LATIN 0x0443 #define LANGUAGE_VENDA 0x0433 @@ -490,5 +490,16 @@ typedef unsigned short LanguageType; #define LANGUAGE_USER_MAITHILI_INDIA 0x0645 #define LANGUAGE_USER_SANTALI_INDIA 0x0646 #define LANGUAGE_USER_TETUN_TIMOR_LESTE 0x0A40 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_TETUN)) */ +#define LANGUAGE_USER_TOK_PISIN 0x0647 +#define LANGUAGE_USER_SHUSWAP 0x0648 +#define LANGUAGE_USER_ARABIC_CHAD 0x8001 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ +#define LANGUAGE_USER_ARABIC_COMOROS 0x8401 /* makeLangID( 0x21, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ +#define LANGUAGE_USER_ARABIC_DJIBOUTI 0x8801 /* makeLangID( 0x22, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ +#define LANGUAGE_USER_ARABIC_ERITREA 0x8C01 /* makeLangID( 0x23, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ +#define LANGUAGE_USER_ARABIC_ISRAEL 0x9001 /* makeLangID( 0x24, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ +#define LANGUAGE_USER_ARABIC_MAURITANIA 0x9401 /* makeLangID( 0x25, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ +#define LANGUAGE_USER_ARABIC_PALESTINE 0x9801 /* makeLangID( 0x26, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ +#define LANGUAGE_USER_ARABIC_SOMALIA 0x9C01 /* makeLangID( 0x27, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ +#define LANGUAGE_USER_ARABIC_SUDAN 0xA001 /* makeLangID( 0x28, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */ #endif /* INCLUDED_I18NPOOL_LANG_H */ diff --git a/i18npool/inc/i18npool/mslangid.hxx b/i18npool/inc/i18npool/mslangid.hxx index ed7fda61f3f3..7cc5e6bd8926 100644 --- a/i18npool/inc/i18npool/mslangid.hxx +++ b/i18npool/inc/i18npool/mslangid.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: mslangid.hxx,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.24.1 $ * * This file is part of OpenOffice.org. * @@ -228,6 +228,10 @@ public: static bool hasForbiddenCharacters( LanguageType nLang ); + /** Whether locale needs input sequence checking. CTL locales. */ + static bool needsSequenceChecking( LanguageType nLang ); + + /** Get ::com::sun::star::i18n::ScriptType of locale. */ static sal_Int16 getScriptType( LanguageType nLang ); diff --git a/i18npool/inc/transliteration_caseignore.hxx b/i18npool/inc/transliteration_caseignore.hxx index 74cfd5646824..12c8f7487ce0 100644 --- a/i18npool/inc/transliteration_caseignore.hxx +++ b/i18npool/inc/transliteration_caseignore.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: transliteration_caseignore.hxx,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.24.1 $ * * This file is part of OpenOffice.org. * @@ -74,12 +74,6 @@ private: throw(com::sun::star::uno::RuntimeException); }; -class Transliteration_simplecaseignore: public Transliteration_caseignore -{ -public: - Transliteration_simplecaseignore(); -}; - } } } } #endif diff --git a/i18npool/inc/xdictionary.hxx b/i18npool/inc/xdictionary.hxx index b78ecd0a9788..32ffdbbfe377 100644 --- a/i18npool/inc/xdictionary.hxx +++ b/i18npool/inc/xdictionary.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: xdictionary.hxx,v $ - * $Revision: 1.7 $ + * $Revision: 1.7.24.1 $ * * This file is part of OpenOffice.org. * @@ -37,17 +37,20 @@ namespace com { namespace sun { namespace star { namespace i18n { +// Whether to use cell boundary code, currently unused but prepared. +#define USE_CELL_BOUNDARY_CODE 0 + #define CACHE_MAX 32 // max cache structure number #define DEFAULT_SIZE 256 // for boundary size, to avoid alloc and release memory // cache structure. -typedef struct _WrodBreakCache { - sal_Bool SAL_CALL equals(const sal_Unicode *str, Boundary& boundary); // checking cached string +struct WordBreakCache { + sal_Bool equals(const sal_Unicode *str, Boundary& boundary); // checking cached string sal_Int32 length; // contents length saved here. sal_Unicode *contents; // seperated segment contents. sal_Int32* wordboundary; // word boundaries in segments. sal_Int32 size; // size of wordboundary -} WordBreakCache; +}; class xdictionary { @@ -59,26 +62,33 @@ private: const sal_Unicode* dataArea; oslModule hModule; Boundary boundary; + sal_Bool japaneseWordBreak; + +#if USE_CELL_BOUNDARY_CODE + // For CTL breakiterator, where the word boundary should not be inside cell. sal_Bool useCellBoundary; sal_Int32* cellBoundary; - sal_Bool japaneseWordBreak; +#endif public: xdictionary(const sal_Char *lang); ~xdictionary(); - Boundary SAL_CALL nextWord( const rtl::OUString& rText, sal_Int32 nPos, sal_Int16 wordType); - Boundary SAL_CALL previousWord( const rtl::OUString& rText, sal_Int32 nPos, sal_Int16 wordType); - Boundary SAL_CALL getWordBoundary( const rtl::OUString& rText, sal_Int32 nPos, sal_Int16 wordType, sal_Bool bDirection ); - void SAL_CALL setCellBoundary(sal_Int32* cellBondary); - void SAL_CALL setJapaneseWordBreak(); + Boundary nextWord( const rtl::OUString& rText, sal_Int32 nPos, sal_Int16 wordType); + Boundary previousWord( const rtl::OUString& rText, sal_Int32 nPos, sal_Int16 wordType); + Boundary getWordBoundary( const rtl::OUString& rText, sal_Int32 nPos, sal_Int16 wordType, sal_Bool bDirection ); + void setJapaneseWordBreak(); + +#if USE_CELL_BOUNDARY_CODE + void setCellBoundary(sal_Int32* cellArray); +#endif private: WordBreakCache cache[CACHE_MAX]; - sal_Bool SAL_CALL seekSegment(const sal_Unicode *text, sal_Int32 pos, sal_Int32 len, Boundary& boundary); - WordBreakCache& SAL_CALL getCache(const sal_Unicode *text, Boundary& boundary); - sal_Bool SAL_CALL exists(const sal_Unicode u); - sal_Int32 SAL_CALL getLongestMatch(const sal_Unicode *text, sal_Int32 len); + sal_Bool seekSegment(const sal_Unicode *text, sal_Int32 pos, sal_Int32 len, Boundary& boundary); + WordBreakCache& getCache(const sal_Unicode *text, Boundary& boundary); + sal_Bool exists(const sal_Unicode u); + sal_Int32 getLongestMatch(const sal_Unicode *text, sal_Int32 len); }; } } } } diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index 9dbecd813b49..b832bb02e7e9 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -197,8 +197,8 @@ void SAL_CALL BreakIterator_Unicode::loadICUBreakIterator(const com::sun::star:: } } - if (newBreak || icuBI->aICUText.compare(UnicodeString(rText.getStr(), rText.getLength()))) { - icuBI->aICUText=UnicodeString(rText.getStr(), rText.getLength()); + if (newBreak || icuBI->aICUText.compare(UnicodeString(reinterpret_cast<const UChar *>(rText.getStr()), rText.getLength()))) { // UChar != sal_Unicode in MinGW + icuBI->aICUText=UnicodeString(reinterpret_cast<const UChar *>(rText.getStr()), rText.getLength()); icuBI->aBreakIterator->setText(icuBI->aICUText); } } diff --git a/i18npool/source/breakiterator/data/line.txt b/i18npool/source/breakiterator/data/line.txt index f71b528d5598..d7b6350e4904 100644 --- a/i18npool/source/breakiterator/data/line.txt +++ b/i18npool/source/breakiterator/data/line.txt @@ -54,7 +54,8 @@ # $AI = [:LineBreak = Ambiguous:]; -$AL = [:LineBreak = Alphabetic:]; +$DG = \u00B0; +$AL = [[:LineBreak = Alphabetic:] $DG]; $BA = [:LineBreak = Break_After:]; $BB = [:LineBreak = Break_Before:]; $BK = [:LineBreak = Mandatory_Break:]; @@ -78,7 +79,7 @@ $LF = [:LineBreak = Line_Feed:]; $NL = [:LineBreak = Next_Line:]; $NS = [:LineBreak = Nonstarter:]; $NU = [:LineBreak = Numeric:]; -$OP = [:LineBreak = Open_Punctuation:]; +$OP = [[:LineBreak = Open_Punctuation:] - $DG]; $PO = [:LineBreak = Postfix_Numeric:]; $BS = \u005C; $PR = [[:LineBreak = Prefix_Numeric:] - $BS]; diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx index 301dac5622fd..eeafc899a39f 100644 --- a/i18npool/source/breakiterator/xdictionary.cxx +++ b/i18npool/source/breakiterator/xdictionary.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: xdictionary.cxx,v $ - * $Revision: 1.18.22.1 $ + * $Revision: 1.18.24.1 $ * * This file is part of OpenOffice.org. * @@ -56,6 +56,7 @@ extern "C" { static void SAL_CALL thisModule() {} } xdictionary::xdictionary(const sal_Char *lang) { + index1 = 0; #ifdef SAL_DLLPREFIX OUStringBuffer aBuf( strlen(lang) + 7 + 6 ); // mostly "lib*.so" (with * == dict_zh) aBuf.appendAscii( SAL_DLLPREFIX ); @@ -78,12 +79,20 @@ xdictionary::xdictionary(const sal_Char *lang) dataArea = (sal_Unicode*) (*func)(); } else + { existMark = NULL; + index1 = NULL; + index2 = NULL; + lenArray = NULL; + dataArea = NULL; + } + for (sal_Int32 i = 0; i < CACHE_MAX; i++) cache[i].size = 0; - // for CTL breakiterator, which the word boundary should not inside cell. +#if USE_CELL_BOUNDARY_CODE useCellBoundary = sal_False; +#endif japaneseWordBreak = sal_False; } @@ -97,7 +106,7 @@ xdictionary::~xdictionary() { } } -void SAL_CALL xdictionary::setJapaneseWordBreak() +void xdictionary::setJapaneseWordBreak() { japaneseWordBreak = sal_True; } @@ -110,8 +119,9 @@ sal_Bool xdictionary::exists(const sal_Unicode c) { return exist; } -sal_Int32 SAL_CALL -xdictionary::getLongestMatch(const sal_Unicode* str, sal_Int32 sLen) { +sal_Int32 xdictionary::getLongestMatch(const sal_Unicode* str, sal_Int32 sLen) { + + if ( !index1 ) return 0; sal_Int16 idx = index1[str[0] >> 8]; @@ -143,7 +153,7 @@ xdictionary::getLongestMatch(const sal_Unicode* str, sal_Int32 sLen) { * Compare two unicode string, */ -sal_Bool SAL_CALL WordBreakCache::equals(const sal_Unicode* str, Boundary& boundary) { +sal_Bool WordBreakCache::equals(const sal_Unicode* str, Boundary& boundary) { // Different length, different string. if (length != boundary.endPos - boundary.startPos) return sal_False; @@ -159,7 +169,7 @@ sal_Bool SAL_CALL WordBreakCache::equals(const sal_Unicode* str, Boundary& bound * @param pos : Position of the given character. * @return true if CJK. */ -sal_Bool SAL_CALL xdictionary::seekSegment(const sal_Unicode *text, sal_Int32 pos, +sal_Bool xdictionary::seekSegment(const sal_Unicode *text, sal_Int32 pos, sal_Int32 len, Boundary& segBoundary) { for (segBoundary.startPos = pos - 1; segBoundary.startPos >= 0 && @@ -179,7 +189,7 @@ sal_Bool SAL_CALL xdictionary::seekSegment(const sal_Unicode *text, sal_Int32 po #define KATAKANA 2 #define HIRAKANA 3 -static sal_Int16 SAL_CALL JapaneseCharType(sal_Unicode c) +static sal_Int16 JapaneseCharType(sal_Unicode c) { if (0x3041 <= c && c <= 0x309e) return HIRAKANA; @@ -188,7 +198,7 @@ static sal_Int16 SAL_CALL JapaneseCharType(sal_Unicode c) return KANJA; } -WordBreakCache& SAL_CALL xdictionary::getCache(const sal_Unicode *text, Boundary& wordBoundary) +WordBreakCache& xdictionary::getCache(const sal_Unicode *text, Boundary& wordBoundary) { WordBreakCache& aCache = cache[text[0] & 0x1f]; @@ -243,11 +253,14 @@ WordBreakCache& SAL_CALL xdictionary::getCache(const sal_Unicode *text, Boundary if (count) { aCache.wordboundary[i+1] = aCache.wordboundary[i] + count; i++; + +#if USE_CELL_BOUNDARY_CODE if (useCellBoundary) { sal_Int32 cBoundary = cellBoundary[aCache.wordboundary[i] + wordBoundary.startPos - 1]; if (cBoundary > 0) aCache.wordboundary[i] = cBoundary - wordBoundary.startPos; } +#endif } } @@ -255,11 +268,13 @@ WordBreakCache& SAL_CALL xdictionary::getCache(const sal_Unicode *text, Boundary aCache.wordboundary[i+1] = aCache.wordboundary[i] + len; i++; +#if USE_CELL_BOUNDARY_CODE if (useCellBoundary) { sal_Int32 cBoundary = cellBoundary[aCache.wordboundary[i] + wordBoundary.startPos - 1]; if (cBoundary > 0) aCache.wordboundary[i] = cBoundary - wordBoundary.startPos; } +#endif } } aCache.wordboundary[i + 1] = aCache.length + 1; @@ -267,7 +282,7 @@ WordBreakCache& SAL_CALL xdictionary::getCache(const sal_Unicode *text, Boundary return aCache; } -Boundary SAL_CALL xdictionary::previousWord(const OUString& rText, sal_Int32 anyPos, sal_Int16 wordType) +Boundary xdictionary::previousWord(const OUString& rText, sal_Int32 anyPos, sal_Int16 wordType) { // looking for the first non-whitespace character from anyPos sal_uInt32 ch = rText.iterateCodePoints(&anyPos, -1); @@ -277,7 +292,7 @@ Boundary SAL_CALL xdictionary::previousWord(const OUString& rText, sal_Int32 any return getWordBoundary(rText, anyPos, wordType, true); } -Boundary SAL_CALL xdictionary::nextWord(const OUString& rText, sal_Int32 anyPos, sal_Int16 wordType) +Boundary xdictionary::nextWord(const OUString& rText, sal_Int32 anyPos, sal_Int16 wordType) { boundary = getWordBoundary(rText, anyPos, wordType, true); anyPos = boundary.endPos; @@ -291,7 +306,7 @@ Boundary SAL_CALL xdictionary::nextWord(const OUString& rText, sal_Int32 anyPos, return getWordBoundary(rText, anyPos, wordType, true); } -Boundary SAL_CALL xdictionary::getWordBoundary(const OUString& rText, sal_Int32 anyPos, sal_Int16 wordType, sal_Bool bDirection) +Boundary xdictionary::getWordBoundary(const OUString& rText, sal_Int32 anyPos, sal_Int16 wordType, sal_Bool bDirection) { const sal_Unicode *text=rText.getStr(); sal_Int32 len=rText.getLength(); @@ -324,11 +339,12 @@ Boundary SAL_CALL xdictionary::getWordBoundary(const OUString& rText, sal_Int32 return boundary; } - -void SAL_CALL xdictionary::setCellBoundary(sal_Int32* cellArray) +#if USE_CELL_BOUNDARY_CODE +void xdictionary::setCellBoundary(sal_Int32* cellArray) { useCellBoundary = sal_True; cellBoundary = cellArray; } +#endif } } } } diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx index 415e345ce82b..8a19ce5bade9 100644 --- a/i18npool/source/calendar/calendar_gregorian.cxx +++ b/i18npool/source/calendar/calendar_gregorian.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: calendar_gregorian.cxx,v $ - * $Revision: 1.34 $ + * $Revision: 1.34.24.1 $ * * This file is part of OpenOffice.org. * @@ -44,37 +44,90 @@ #include <string.h> #define erDUMP_ICU_CALENDAR 0 +#define erDUMP_I18N_CALENDAR 0 +#if erDUMP_ICU_CALENDAR || erDUMP_I18N_CALENDAR +// If both are used, DUMP_ICU_CAL_MSG() must be used before DUMP_I18N_CAL_MSG() +// to obtain internally set values from ICU, else Calendar::get() calls in +// DUMP_I18N_CAL_MSG() recalculate! + +// These pieces of macro are shamelessly borrowed from icu's olsontz.cpp, the +// double parens'ed approach to pass multiple parameters as one macro parameter +// is appealing. +static void debug_cal_loc(const char *f, int32_t l) +{ + fprintf(stderr, "%s:%d: ", f, l); +} +# include <stdarg.h> +static void debug_cal_msg(const char *pat, ...) +{ + va_list ap; + va_start(ap, pat); + vfprintf(stderr, pat, ap); +} + #if erDUMP_ICU_CALENDAR // Make icu with // DEFS = -DU_DEBUG_CALSVC -DUCAL_DEBUG_DUMP // in icu/$(INPATH)/misc/build/icu/source/icudefs.mk // May need some patches to fix unmaintained things there. extern void ucal_dump( const icu::Calendar & ); -# include <stdarg.h> -static void debug_cal_dump( const ::icu::Calendar & r ) +static void debug_icu_cal_dump( const ::icu::Calendar & r ) { ucal_dump(r); fflush(stderr); // set a breakpoint here to pause display between dumps } -// These pieces of macro are shamelessly borrowed from icu's olsontz.cpp, the -// double parens'ed approach to passing multiple parameters as one macro -// parameter is appealing. -static void debug_cal_loc(const char *f, int32_t l) +// must use double parens, i.e.: DUMP_ICU_CAL_MSG(("four is: %d",4)); +#define DUMP_ICU_CAL_MSG(x) {debug_cal_loc(__FILE__,__LINE__);debug_cal_msg x;debug_icu_cal_dump(*body);} +#else // erDUMP_ICU_CALENDAR +#define DUMP_ICU_CAL_MSG(x) +#endif // erDUMP_ICU_CALENDAR + +#if erDUMP_I18N_CALENDAR +static void debug_cal_millis_to_time( long nMillis, long & h, long & m, long & s, long & f ) { - fprintf(stderr, "%s:%d: ", f, l); + int sign = (nMillis < 0 ? -1 : 1); + nMillis = ::std::abs(nMillis); + h = sign * nMillis / (60 * 60 * 1000); + nMillis -= sign * h * (60 * 60 * 1000); + m = nMillis / (60 * 1000); + nMillis -= m * (60 * 1000); + s = nMillis / (1000); + nMillis -= s * (1000); + f = nMillis; } -static void debug_cal_msg(const char *pat, ...) +static void debug_i18n_cal_dump( const ::icu::Calendar & r ) { - va_list ap; - va_start(ap, pat); - vfprintf(stderr, pat, ap); + UErrorCode status; + long nMillis, h, m, s, f; + fprintf( stderr, " %04ld", (long)r.get( UCAL_YEAR, status = U_ZERO_ERROR)); + fprintf( stderr, "-%02ld", (long)r.get( UCAL_MONTH, status = U_ZERO_ERROR)+1); + fprintf( stderr, "-%02ld", (long)r.get( UCAL_DATE, status = U_ZERO_ERROR)); + fprintf( stderr, " %02ld", (long)r.get( UCAL_HOUR_OF_DAY, status = U_ZERO_ERROR)); + fprintf( stderr, ":%02ld", (long)r.get( UCAL_MINUTE, status = U_ZERO_ERROR)); + fprintf( stderr, ":%02ld", (long)r.get( UCAL_SECOND, status = U_ZERO_ERROR)); + fprintf( stderr, " zone: %ld", (long)(nMillis = r.get( UCAL_ZONE_OFFSET, status = U_ZERO_ERROR))); + fprintf( stderr, " (%f min)", (double)nMillis / 60000); + debug_cal_millis_to_time( nMillis, h, m, s, f); + fprintf( stderr, " (%ld:%02ld:%02ld.%ld)", h, m, s, f); + fprintf( stderr, " DST: %ld", (long)(nMillis = r.get( UCAL_DST_OFFSET, status = U_ZERO_ERROR))); + fprintf( stderr, " (%f min)", (double)nMillis / 60000); + debug_cal_millis_to_time( nMillis, h, m, s, f); + fprintf( stderr, " (%ld:%02ld:%02ld.%ld)", h, m, s, f); + fprintf( stderr, "\n"); + fflush(stderr); } -// must use double parens, i.e.: DUMP_CAL_MSG(("four is: %d",4)); -#define DUMP_CAL_MSG(x) {debug_cal_loc(__FILE__,__LINE__);debug_cal_msg x;debug_cal_dump(*body);} -#else -#define DUMP_CAL_MSG(x) -#endif +// must use double parens, i.e.: DUMP_I18N_CAL_MSG(("four is: %d",4)); +#define DUMP_I18N_CAL_MSG(x) {debug_cal_loc(__FILE__,__LINE__);debug_cal_msg x;debug_i18n_cal_dump(*body);} +#else // erDUMP_I18N_CALENDAR +#define DUMP_I18N_CAL_MSG(x) +#endif // erDUMP_I18N_CALENDAR + +#else // erDUMP_ICU_CALENDAR || erDUMP_I18N_CALENDAR +#define DUMP_ICU_CAL_MSG(x) +#define DUMP_I18N_CAL_MSG(x) +#endif // erDUMP_ICU_CALENDAR || erDUMP_I18N_CALENDAR + using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -234,8 +287,7 @@ Calendar_gregorian::getDateTime() throw(RuntimeException) // map field value from gregorian calendar to other calendar, it can be overwritten by derived class. // By using eraArray, it can take care Japanese and Taiwan ROC calendar. -void SAL_CALL -Calendar_gregorian::mapFromGregorian() throw(RuntimeException) +void Calendar_gregorian::mapFromGregorian() throw(RuntimeException) { if (eraArray) { sal_Int16 e, y, m, d; @@ -263,7 +315,7 @@ Calendar_gregorian::mapFromGregorian() throw(RuntimeException) #define FIELDS ((1 << CalendarFieldIndex::ERA) | (1 << CalendarFieldIndex::YEAR)) // map field value from other calendar to gregorian calendar, it can be overwritten by derived class. // By using eraArray, it can take care Japanese and Taiwan ROC calendar. -void SAL_CALL Calendar_gregorian::mapToGregorian() throw(RuntimeException) +void Calendar_gregorian::mapToGregorian() throw(RuntimeException) { if (eraArray && (fieldSet & FIELDS)) { sal_Int16 y, e = fieldValue[CalendarFieldIndex::ERA]; @@ -290,8 +342,8 @@ static UCalendarDateFields fieldNameConverter(sal_Int16 fieldIndex) throw(Runtim case CalendarFieldIndex::DST_OFFSET: f = UCAL_DST_OFFSET; break; case CalendarFieldIndex::ZONE_OFFSET: f = UCAL_ZONE_OFFSET; break; case CalendarFieldIndex::HOUR: f = UCAL_HOUR_OF_DAY; break; - case CalendarFieldIndex::MINUTE: f = UCAL_MINUTE; break; - case CalendarFieldIndex::SECOND: f = UCAL_SECOND; break; + case CalendarFieldIndex::MINUTE: f = UCAL_MINUTE; break; + case CalendarFieldIndex::SECOND: f = UCAL_SECOND; break; case CalendarFieldIndex::MILLISECOND: f = UCAL_MILLISECOND; break; case CalendarFieldIndex::WEEK_OF_MONTH: f = UCAL_WEEK_OF_MONTH; break; case CalendarFieldIndex::WEEK_OF_YEAR: f = UCAL_WEEK_OF_YEAR; break; @@ -306,27 +358,75 @@ static UCalendarDateFields fieldNameConverter(sal_Int16 fieldIndex) throw(Runtim void SAL_CALL Calendar_gregorian::setValue( sal_Int16 fieldIndex, sal_Int16 value ) throw(RuntimeException) { - fieldSet |= (1 << fieldIndex); - fieldValue[fieldIndex] = value; + if (fieldIndex < 0 || FIELD_INDEX_COUNT <= fieldIndex) + throw ERROR; + fieldSet |= (1 << fieldIndex); + fieldValue[fieldIndex] = value; +} + +bool Calendar_gregorian::getCombinedOffset( sal_Int32 & o_nOffset, + sal_Int16 nParentFieldIndex, sal_Int16 nChildFieldIndex ) const +{ + o_nOffset = 0; + bool bFieldsSet = false; + if (fieldSet & (1 << nParentFieldIndex)) + { + bFieldsSet = true; + o_nOffset = static_cast<sal_Int32>( fieldValue[nParentFieldIndex]) * 60000; + } + if (fieldSet & (1 << nChildFieldIndex)) + { + bFieldsSet = true; + if (o_nOffset < 0) + o_nOffset -= static_cast<sal_uInt16>( fieldValue[nChildFieldIndex]); + else + o_nOffset += static_cast<sal_uInt16>( fieldValue[nChildFieldIndex]); + } + return bFieldsSet; +} + +bool Calendar_gregorian::getZoneOffset( sal_Int32 & o_nOffset ) const +{ + return getCombinedOffset( o_nOffset, CalendarFieldIndex::ZONE_OFFSET, + CalendarFieldIndex::ZONE_OFFSET_SECOND_MILLIS); } -void SAL_CALL Calendar_gregorian::submitFields() throw(com::sun::star::uno::RuntimeException) +bool Calendar_gregorian::getDSTOffset( sal_Int32 & o_nOffset ) const { - for (sal_Int16 fieldIndex = 0; fieldIndex < CalendarFieldIndex::FIELD_COUNT; fieldIndex++) + return getCombinedOffset( o_nOffset, CalendarFieldIndex::DST_OFFSET, + CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS); +} + +void Calendar_gregorian::submitFields() throw(com::sun::star::uno::RuntimeException) +{ + for (sal_Int16 fieldIndex = 0; fieldIndex < FIELD_INDEX_COUNT; fieldIndex++) { if (fieldSet & (1 << fieldIndex)) { - if (fieldIndex == CalendarFieldIndex::ZONE_OFFSET || fieldIndex == CalendarFieldIndex::DST_OFFSET) - body->set(fieldNameConverter(fieldIndex), (sal_Int32) fieldSetValue[fieldIndex] * 60000); - else - body->set(fieldNameConverter(fieldIndex), fieldSetValue[fieldIndex]); + switch (fieldIndex) + { + default: + body->set(fieldNameConverter(fieldIndex), fieldSetValue[fieldIndex]); + break; + case CalendarFieldIndex::ZONE_OFFSET: + case CalendarFieldIndex::DST_OFFSET: + case CalendarFieldIndex::ZONE_OFFSET_SECOND_MILLIS: + case CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS: + break; // nothing, extra handling + } } } + sal_Int32 nZoneOffset, nDSTOffset; + if (getZoneOffset( nZoneOffset)) + body->set( fieldNameConverter( CalendarFieldIndex::ZONE_OFFSET), nZoneOffset); + if (getDSTOffset( nDSTOffset)) + body->set( fieldNameConverter( CalendarFieldIndex::DST_OFFSET), nDSTOffset); } -void SAL_CALL Calendar_gregorian::submitValues( sal_Int32 nYear, +void Calendar_gregorian::submitValues( sal_Int32 nYear, sal_Int32 nMonth, sal_Int32 nDay, sal_Int32 nHour, sal_Int32 nMinute, - sal_Int32 nSecond, sal_Int32 nMilliSecond ) throw(com::sun::star::uno::RuntimeException) + sal_Int32 nSecond, sal_Int32 nMilliSecond, sal_Int32 nZone, sal_Int32 nDST ) + throw(com::sun::star::uno::RuntimeException) { submitFields(); if (nYear >= 0) @@ -343,10 +443,25 @@ void SAL_CALL Calendar_gregorian::submitValues( sal_Int32 nYear, body->set( UCAL_SECOND, nSecond); if (nMilliSecond >= 0) body->set( UCAL_MILLISECOND, nMilliSecond); + if (nZone != 0) + body->set( UCAL_ZONE_OFFSET, nZone); + if (nDST != 0) + body->set( UCAL_DST_OFFSET, nDST); } -void SAL_CALL -Calendar_gregorian::setValue() throw(RuntimeException) +static void lcl_setCombinedOffsetFieldValues( sal_Int32 nValue, + sal_Int16 rFieldSetValue[], sal_Int16 rFieldValue[], + sal_Int16 nParentFieldIndex, sal_Int16 nChildFieldIndex ) +{ + sal_Int32 nTrunc = nValue / 60000; + rFieldSetValue[nParentFieldIndex] = rFieldValue[nParentFieldIndex] = + static_cast<sal_Int16>( nTrunc); + sal_uInt16 nMillis = static_cast<sal_uInt16>( abs( nValue - nTrunc * 60000)); + rFieldSetValue[nChildFieldIndex] = rFieldValue[nChildFieldIndex] = + static_cast<sal_Int16>( nMillis); +} + +void Calendar_gregorian::setValue() throw(RuntimeException) { // Correct DST glitch, see also localtime/gmtime conversion pitfalls at // http://www.erack.de/download/timetest.c @@ -364,16 +479,30 @@ Calendar_gregorian::setValue() throw(RuntimeException) // being adjusted to 24:00 in this case, switching one day further. // => submit 2004-03-28T00:00 no DST. + // This got even weirder since ICU incorporated also historical data, + // even the timezone may differ for different dates! It is necessary to + // let ICU choose the corresponding OlsonTimeZone transitions and adapt + // values. + // #i86094# gives examples where that went wrong: + // TZ=Europe/Moscow date <= 1919-07-01 + // zone +2:30:48 (!) instead of +3h, DST +2h instead of +1h + // TZ=America/St_Johns date <= 1935-03-30 + // zone -3:30:52 (!) instead of -3:30 + // Copy fields before calling submitFields() directly or indirectly below. memcpy(fieldSetValue, fieldValue, sizeof(fieldSetValue)); // Possibly setup ERA and YEAR in fieldSetValue. mapToGregorian(); - bool bNeedDST = !(fieldSet & (1 << CalendarFieldIndex::DST_OFFSET)); - sal_Int32 nDST1, nYear, nMonth, nDay, nHour, nMinute, nSecond, nMilliSecond; - nDST1 = 0; + DUMP_ICU_CAL_MSG(("%s\n","setValue() before any submission")); + DUMP_I18N_CAL_MSG(("%s\n","setValue() before any submission")); + + bool bNeedZone = !(fieldSet & (1 << CalendarFieldIndex::ZONE_OFFSET)); + bool bNeedDST = !(fieldSet & (1 << CalendarFieldIndex::DST_OFFSET)); + sal_Int32 nZone1, nDST1, nYear, nMonth, nDay, nHour, nMinute, nSecond, nMilliSecond, nZone, nDST; + nZone1 = nDST1 = nZone = nDST = 0; nYear = nMonth = nDay = nHour = nMinute = nSecond = nMilliSecond = -1; - if ( bNeedDST ) + if ( bNeedZone || bNeedDST ) { UErrorCode status; if ( !(fieldSet & (1 << CalendarFieldIndex::YEAR)) ) @@ -418,36 +547,84 @@ Calendar_gregorian::setValue() throw(RuntimeException) if ( !U_SUCCESS(status) ) nMilliSecond = -1; } - // Submit values to obtain a DST corresponding to the date/time. - submitValues( nYear, nMonth, nDay, nHour, nMinute, nSecond, nMilliSecond); + if ( !(fieldSet & (1 << CalendarFieldIndex::ZONE_OFFSET)) ) + { + nZone = body->get( UCAL_ZONE_OFFSET, status = U_ZERO_ERROR); + if ( !U_SUCCESS(status) ) + nZone = 0; + } + if ( !(fieldSet & (1 << CalendarFieldIndex::DST_OFFSET)) ) + { + nDST = body->get( UCAL_DST_OFFSET, status = U_ZERO_ERROR); + if ( !U_SUCCESS(status) ) + nDST = 0; + } + + // Submit values to obtain a time zone and DST corresponding to the date/time. + submitValues( nYear, nMonth, nDay, nHour, nMinute, nSecond, nMilliSecond, nZone, nDST); + + DUMP_ICU_CAL_MSG(("%s\n","setValue() in bNeedZone||bNeedDST after submitValues()")); + DUMP_I18N_CAL_MSG(("%s\n","setValue() in bNeedZone||bNeedDST after submitValues()")); + nZone1 = body->get( UCAL_ZONE_OFFSET, status = U_ZERO_ERROR); + if ( !U_SUCCESS(status) ) + nZone1 = 0; nDST1 = body->get( UCAL_DST_OFFSET, status = U_ZERO_ERROR); if ( !U_SUCCESS(status) ) nDST1 = 0; - DUMP_CAL_MSG(("%s\n","setValue() in bNeedDST")); } - // The original submission, may lead to a different DST than in bNeedDST. + // The original submission, may lead to a different zone/DST. submitFields(); + DUMP_ICU_CAL_MSG(("%s\n","setValue() after original submission")); + DUMP_I18N_CAL_MSG(("%s\n","setValue() after original submission")); - if ( bNeedDST ) + if ( bNeedZone || bNeedDST ) { UErrorCode status; + sal_Int32 nZone2 = body->get( UCAL_ZONE_OFFSET, status = U_ZERO_ERROR); + if ( !U_SUCCESS(status) ) + nZone2 = nZone1; sal_Int32 nDST2 = body->get( UCAL_DST_OFFSET, status = U_ZERO_ERROR); if ( !U_SUCCESS(status) ) nDST2 = nDST1; - if ( nDST2 != nDST1 ) + if ( nZone2 != nZone1 || nDST2 != nDST1 ) { - DUMP_CAL_MSG(("%s\n","setValue() submission with different DSTs")); - // Due to different DSTs, resulting date values may differ if // DST is onset at 00:00 and the very onsetRule date was // submitted with DST off => date-1 23:00, for example, which // is not what we want. // Resubmit all values, this time including DST => date 01:00 - fieldSet |= (1 << CalendarFieldIndex::DST_OFFSET); - fieldSetValue[CalendarFieldIndex::DST_OFFSET] = - fieldValue[CalendarFieldIndex::DST_OFFSET] = sal::static_int_cast<sal_Int16>( nDST2 / 60000 ); - submitValues( nYear, nMonth, nDay, nHour, nMinute, nSecond, nMilliSecond); + // Similar for zone differences. + + // Set field values accordingly in case they were used. + if (!bNeedZone) + lcl_setCombinedOffsetFieldValues( nZone2, fieldSetValue, + fieldValue, CalendarFieldIndex::ZONE_OFFSET, + CalendarFieldIndex::ZONE_OFFSET_SECOND_MILLIS); + if (!bNeedDST) + lcl_setCombinedOffsetFieldValues( nDST2, fieldSetValue, + fieldValue, CalendarFieldIndex::DST_OFFSET, + CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS); + submitValues( nYear, nMonth, nDay, nHour, nMinute, nSecond, nMilliSecond, nZone2, nDST2); + DUMP_ICU_CAL_MSG(("%s\n","setValue() after Zone/DST glitch resubmit")); + DUMP_I18N_CAL_MSG(("%s\n","setValue() after Zone/DST glitch resubmit")); + + // Time zone transition => resubmit. + // TZ=America/St_Johns date <= 1935-03-30 + // -3:30:52 (!) instead of -3:30 + // if first submission included time zone -3:30 that would be wrong. + bool bResubmit = false; + sal_Int32 nZone3 = body->get( UCAL_ZONE_OFFSET, status = U_ZERO_ERROR); + if ( !U_SUCCESS(status) ) + nZone3 = nZone2; + if (nZone3 != nZone2) + { + bResubmit = true; + if (!bNeedZone) + lcl_setCombinedOffsetFieldValues( nZone3, fieldSetValue, + fieldValue, CalendarFieldIndex::ZONE_OFFSET, + CalendarFieldIndex::ZONE_OFFSET_SECOND_MILLIS); + } // If the DST onset rule says to switch from 00:00 to 01:00 and // we tried to set onsetDay 00:00 with DST, the result was @@ -463,53 +640,89 @@ Calendar_gregorian::setValue() throw(RuntimeException) nDST3 = nDST2; if (nDST2 != nDST3 && !nDST3) { - DUMP_CAL_MSG(("%s\n","setValue() DST glitch")); - fieldSetValue[CalendarFieldIndex::DST_OFFSET] = - fieldValue[CalendarFieldIndex::DST_OFFSET] = 0; - submitValues( nYear, nMonth, nDay, nHour, nMinute, nSecond, nMilliSecond); + bResubmit = true; + if (!bNeedDST) + { + fieldSetValue[CalendarFieldIndex::DST_OFFSET] = + fieldValue[CalendarFieldIndex::DST_OFFSET] = 0; + fieldSetValue[CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS] = + fieldValue[CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS] = 0; + } + } + if (bResubmit) + { + submitValues( nYear, nMonth, nDay, nHour, nMinute, nSecond, nMilliSecond, nZone3, nDST3); + DUMP_ICU_CAL_MSG(("%s\n","setValue() after Zone/DST glitch 2nd resubmit")); + DUMP_I18N_CAL_MSG(("%s\n","setValue() after Zone/DST glitch 2nd resubmit")); } } } -#if erDUMP_ICU_CALENDAR +#if erDUMP_ICU_CALENDAR || erDUMP_I18N_CALENDAR { // force icu::Calendar to recalculate UErrorCode status; sal_Int32 nTmp = body->get( UCAL_DATE, status = U_ZERO_ERROR); - DUMP_CAL_MSG(("%s: %d\n","setValue() result day",nTmp)); + DUMP_ICU_CAL_MSG(("%s: %d\n","setValue() result day",nTmp)); + DUMP_I18N_CAL_MSG(("%s: %d\n","setValue() result day",nTmp)); } #endif } -void SAL_CALL Calendar_gregorian::getValue() throw(RuntimeException) +void Calendar_gregorian::getValue() throw(RuntimeException) { - for (sal_Int16 fieldIndex = 0; fieldIndex < CalendarFieldIndex::FIELD_COUNT; fieldIndex++) { - UErrorCode status; - sal_Int32 value = body->get(fieldNameConverter(fieldIndex), status = U_ZERO_ERROR); - if ( !U_SUCCESS(status) ) throw ERROR; + DUMP_ICU_CAL_MSG(("%s\n","getValue()")); + DUMP_I18N_CAL_MSG(("%s\n","getValue()")); + for (sal_Int16 fieldIndex = 0; fieldIndex < FIELD_INDEX_COUNT; fieldIndex++) + { + if (fieldIndex == CalendarFieldIndex::ZONE_OFFSET_SECOND_MILLIS || + fieldIndex == CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS) + continue; // not ICU fields - // convert millisecond to minute for ZONE and DST. - if (fieldIndex == CalendarFieldIndex::ZONE_OFFSET || fieldIndex == CalendarFieldIndex::DST_OFFSET) - value /= 60000; + UErrorCode status; sal_Int32 value = body->get( fieldNameConverter( + fieldIndex), status = U_ZERO_ERROR); + if ( !U_SUCCESS(status) ) throw ERROR; + // Convert millisecond to minute for ZONE and DST and set remainder in + // second field. + if (fieldIndex == CalendarFieldIndex::ZONE_OFFSET) + { + sal_Int32 nMinutes = value / 60000; + sal_Int16 nMillis = static_cast<sal_Int16>( static_cast<sal_uInt16>( + abs( value - nMinutes * 60000))); + fieldValue[CalendarFieldIndex::ZONE_OFFSET] = static_cast<sal_Int16>( nMinutes); + fieldValue[CalendarFieldIndex::ZONE_OFFSET_SECOND_MILLIS] = nMillis; + } + else if (fieldIndex == CalendarFieldIndex::DST_OFFSET) + { + sal_Int32 nMinutes = value / 60000; + sal_Int16 nMillis = static_cast<sal_Int16>( static_cast<sal_uInt16>( + abs( value - nMinutes * 60000))); + fieldValue[CalendarFieldIndex::DST_OFFSET] = static_cast<sal_Int16>( nMinutes); + fieldValue[CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS] = nMillis; + } + else fieldValue[fieldIndex] = (sal_Int16) value; - // offset 1 since the value for week start day SunDay is different between Calendar and Weekdays. - if ( fieldIndex == CalendarFieldIndex::DAY_OF_WEEK ) - fieldValue[fieldIndex]--; // UCAL_SUNDAY:/* == 1 */ ==> Weekdays::SUNDAY /* ==0 */ - } - mapFromGregorian(); - fieldSet = 0; + // offset 1 since the value for week start day SunDay is different between Calendar and Weekdays. + if ( fieldIndex == CalendarFieldIndex::DAY_OF_WEEK ) + fieldValue[fieldIndex]--; // UCAL_SUNDAY:/* == 1 */ ==> Weekdays::SUNDAY /* ==0 */ + } + mapFromGregorian(); + fieldSet = 0; } sal_Int16 SAL_CALL Calendar_gregorian::getValue( sal_Int16 fieldIndex ) throw(RuntimeException) { - if (fieldSet) { - setValue(); - getValue(); - } + if (fieldIndex < 0 || FIELD_INDEX_COUNT <= fieldIndex) + throw ERROR; + + if (fieldSet) { + setValue(); + getValue(); + } - return fieldValue[fieldIndex]; + return fieldValue[fieldIndex]; } void SAL_CALL @@ -530,7 +743,7 @@ Calendar_gregorian::isValid() throw(RuntimeException) setValue(); memcpy(fieldSetValue, fieldValue, sizeof(fieldSetValue)); getValue(); - for ( sal_Int16 fieldIndex = 0; fieldIndex < CalendarFieldIndex::FIELD_COUNT; fieldIndex++ ) { + for ( sal_Int16 fieldIndex = 0; fieldIndex < FIELD_INDEX_COUNT; fieldIndex++ ) { // compare only with fields that are set and reset fieldSet[] if (tmp & (1 << fieldIndex)) { if (fieldSetValue[fieldIndex] != fieldValue[fieldIndex]) diff --git a/i18npool/source/calendar/calendar_hijri.cxx b/i18npool/source/calendar/calendar_hijri.cxx index 74f168b82dff..903b17278a1d 100644 --- a/i18npool/source/calendar/calendar_hijri.cxx +++ b/i18npool/source/calendar/calendar_hijri.cxx @@ -79,7 +79,7 @@ Calendar_hijri::Calendar_hijri() #define FIELDS ((1 << CalendarFieldIndex::ERA) | (1 << CalendarFieldIndex::YEAR) | (1 << CalendarFieldIndex::MONTH) | (1 << CalendarFieldIndex::DAY_OF_MONTH)) // map field value from hijri calendar to gregorian calendar -void SAL_CALL Calendar_hijri::mapToGregorian() throw(RuntimeException) +void Calendar_hijri::mapToGregorian() throw(RuntimeException) { if (fieldSet & FIELDS) { sal_Int32 day = (sal_Int32)fieldSetValue[CalendarFieldIndex::DAY_OF_MONTH]; @@ -99,7 +99,7 @@ void SAL_CALL Calendar_hijri::mapToGregorian() throw(RuntimeException) } // map field value from gregorian calendar to hijri calendar -void SAL_CALL Calendar_hijri::mapFromGregorian() throw(RuntimeException) +void Calendar_hijri::mapFromGregorian() throw(RuntimeException) { sal_Int32 month, day, year; diff --git a/i18npool/source/calendar/calendar_jewish.cxx b/i18npool/source/calendar/calendar_jewish.cxx index 50d473cd55a6..927b10a34deb 100644 --- a/i18npool/source/calendar/calendar_jewish.cxx +++ b/i18npool/source/calendar/calendar_jewish.cxx @@ -260,7 +260,7 @@ public: }; // map field value from gregorian calendar to other calendar, it can be overwritten by derived class. -void SAL_CALL Calendar_jewish::mapFromGregorian() throw(RuntimeException) +void Calendar_jewish::mapFromGregorian() throw(RuntimeException) { int y = fieldValue[CalendarFieldIndex::YEAR]; if (fieldValue[CalendarFieldIndex::ERA] == 0) @@ -276,7 +276,7 @@ void SAL_CALL Calendar_jewish::mapFromGregorian() throw(RuntimeException) #define FIELDS ((1 << CalendarFieldIndex::ERA) | (1 << CalendarFieldIndex::YEAR) | (1 << CalendarFieldIndex::MONTH) | (1 << CalendarFieldIndex::DAY_OF_MONTH)) // map field value from other calendar to gregorian calendar, it should be implemented. -void SAL_CALL Calendar_jewish::mapToGregorian() throw(RuntimeException) +void Calendar_jewish::mapToGregorian() throw(RuntimeException) { if (fieldSet & FIELDS) { sal_Int16 y = fieldSetValue[CalendarFieldIndex::YEAR]; diff --git a/i18npool/source/collator/collator_unicode.cxx b/i18npool/source/collator/collator_unicode.cxx index 5fef2e34a4c0..40826c3c3184 100644 --- a/i18npool/source/collator/collator_unicode.cxx +++ b/i18npool/source/collator/collator_unicode.cxx @@ -65,13 +65,13 @@ sal_Int32 SAL_CALL Collator_Unicode::compareSubstring( const OUString& str1, sal_Int32 off1, sal_Int32 len1, const OUString& str2, sal_Int32 off2, sal_Int32 len2) throw(RuntimeException) { - return collator->compare(str1.getStr() + off1, len1, str2.getStr() + off2, len2); + return collator->compare(reinterpret_cast<const UChar *>(str1.getStr()) + off1, len1, reinterpret_cast<const UChar *>(str2.getStr()) + off2, len2); // UChar != sal_Unicode in MinGW } sal_Int32 SAL_CALL Collator_Unicode::compareString( const OUString& str1, const OUString& str2) throw(RuntimeException) { - return collator->compare(str1.getStr(), str2.getStr()); + return collator->compare(reinterpret_cast<const UChar *>(str1.getStr()), reinterpret_cast<const UChar *>(str2.getStr())); // UChar != sal_Unicode in MinGW } extern "C" { static void SAL_CALL thisModule() {} } @@ -84,7 +84,7 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang:: UErrorCode status = U_ZERO_ERROR; OUString rule = LocaleData().getCollatorRuleByAlgorithm(rLocale, rAlgorithm); if (rule.getLength() > 0) { - collator = new RuleBasedCollator(rule.getStr(), status); + collator = new RuleBasedCollator(reinterpret_cast<const UChar *>(rule.getStr()), status); // UChar != sal_Unicode in MinGW if (! U_SUCCESS(status)) throw RuntimeException(); } if (!collator && OUString::createFromAscii(LOCAL_RULE_LANGS).indexOf(rLocale.Language) >= 0) { @@ -120,7 +120,7 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang:: } if (func) { const sal_uInt8* ruleImage=func(); - uca_base = new RuleBasedCollator((sal_Unicode*)NULL, status); + uca_base = new RuleBasedCollator(static_cast<UChar*>(NULL), status); if (! U_SUCCESS(status)) throw RuntimeException(); collator = new RuleBasedCollator(reinterpret_cast<const uint8_t*>(ruleImage), -1, uca_base, status); if (! U_SUCCESS(status)) throw RuntimeException(); diff --git a/i18npool/source/collator/data/collator_data.map b/i18npool/source/collator/data/collator_data.map index 5caafac19316..09f298912ee9 100644 --- a/i18npool/source/collator/data/collator_data.map +++ b/i18npool/source/collator/data/collator_data.map @@ -18,6 +18,7 @@ global: get_ku_alphanumeric; get_hu_charset; get_ln_charset; + get_my_dictionary; local: *; diff --git a/i18npool/source/collator/data/my_dictionary.txt b/i18npool/source/collator/data/my_dictionary.txt new file mode 100644 index 000000000000..abeeae5ddf4d --- /dev/null +++ b/i18npool/source/collator/data/my_dictionary.txt @@ -0,0 +1,373 @@ +# Myanmar collation for dictionary sort order (based on CLDR submission) +[normalization on] +&ႌ<့<း<့း +&ာ<<ါ +&ဲ<ော<<ေါ<ော်<<ေါ် +&ဴ<ံ<ို<က္<<က်<ာက္<<ာက်<<ါက္<<ါက်<ိက္<<ိက်<ုက္<<ုက်<ေက္<<ေက်<ောက္<<ေ +ာက်<<ေါက္<<ေါက်<ိုက္<<ိုက်<ခ္<<ခ်<ာခ္<<ာခ်<<ါခ္<<ါခ်<ိခ္<<ိခ်<ုခ္<<ု +ခ်<ေခ္<<ေခ်<ောခ္<<ောခ်<<ေါခ္<<ေါခ်<ိုခ္<<ိုခ်<ဂ္<<ဂ်<ာဂ္<<ာဂ်<<ါဂ္<< +ါဂ်<ိဂ္<<ိဂ်<ုဂ္<<ုဂ်<ေဂ္<<ေဂ်<ောဂ္<<ောဂ်<<ေါဂ္<<ေါဂ်<ိုဂ္<<ိုဂ်<ဃ္< +<ဃ်<ာဃ္<<ာဃ်<<ါဃ္<<ါဃ်<ိဃ္<<ိဃ်<ုဃ္<<ုဃ်<ေဃ္<<ေဃ်<ောဃ္<<ောဃ်<<ေါဃ္<< +ေါဃ်<ိုဃ္<<ိုဃ်<င်္<<င်<ာင်္<<ာင်<<ါင်္<<ါင်<ိင်္<<ိင်<ုင်္<<ုင်<ေင် +္<<ေင်<ောင်္<<ောင်<<ေါင်္<<ေါင်<ိုင်္<<ိုင်<စ္<<စ်<ာစ္<<ာစ်<<ါစ္<<ါစ +်<ိစ္<<ိစ်<ုစ္<<ုစ်<ေစ္<<ေစ်<ောစ္<<ောစ်<<ေါစ္<<ေါစ်<ိုစ္<<ိုစ်<ဆ္<<ဆ +်<ာဆ္<<ာဆ်<<ါဆ္<<ါဆ်<ိဆ္<<ိဆ်<ုဆ္<<ုဆ်<ေဆ္<<ေဆ်<ောဆ္<<ောဆ်<<ေါဆ္<<ေါ +ဆ်<ိုဆ္<<ိုဆ်<ဇ္<<ဇ်<ာဇ္<<ာဇ်<<ါဇ္<<ါဇ်<ိဇ္<<ိဇ်<ုဇ္<<ုဇ်<ေဇ္<<ေဇ်<ေ +ာဇ္<<ောဇ်<<ေါဇ္<<ေါဇ်<ိုဇ္<<ိုဇ်<ဈ်<ာဈ်<<ါဈ်<ိဈ်<ုဈ်<ေဈ်<ောဈ်<<ေါဈ်< +ိုဈ်<ဉ္<<ဉ်<ာဉ္<<ာဉ်<<ါဉ္<<ါဉ်<ိဉ္<<ိဉ်<ုဉ္<<ုဉ်<ေဉ္<<ေဉ်<ောဉ္<<ောဉ် +<<ေါဉ္<<ေါဉ်<ိုဉ္<<ိုဉ်<ည္<<ည်<ာည္<<ာည်<<ါည္<<ါည်<ိည္<<ိည်<ုည္<<ုည်< +ေည္<<ေည်<ောည္<<ောည်<<ေါည္<<ေါည်<ိုည္<<ိုည်<ဋ္<<ဋ်<ာဋ္<<ာဋ်<<ါဋ္<<ါဋ် +<ိဋ္<<ိဋ်<ုဋ္<<ုဋ်<ေဋ္<<ေဋ်<ောဋ္<<ောဋ်<<ေါဋ္<<ေါဋ်<ိုဋ္<<ိုဋ်<ဌ္<<ဌ် +<ာဌ္<<ာဌ်<<ါဌ္<<ါဌ်<ိဌ္<<ိဌ်<ုဌ္<<ုဌ်<ေဌ္<<ေဌ်<ောဌ္<<ောဌ်<<ေါဌ္<<ေါဌ +်<ိုဌ္<<ိုဌ်<ဍ္<<ဍ်<ာဍ္<<ာဍ်<<ါဍ္<<ါဍ်<ိဍ္<<ိဍ်<ုဍ္<<ုဍ်<ေဍ္<<ေဍ်<ော +ဍ္<<ောဍ်<<ေါဍ္<<ေါဍ်<ိုဍ္<<ိုဍ်<ဎ္<<ဎ်<ာဎ္<<ာဎ်<<ါဎ္<<ါဎ်<ိဎ္<<ိဎ်<ု +ဎ္<<ုဎ်<ေဎ္<<ေဎ်<ောဎ္<<ောဎ်<<ေါဎ္<<ေါဎ်<ိုဎ္<<ိုဎ်<ဏ္<<ဏ်<ာဏ္<<ာဏ်<< +ါဏ္<<ါဏ်<ိဏ္<<ိဏ်<ုဏ္<<ုဏ်<ေဏ္<<ေဏ်<ောဏ္<<ောဏ်<<ေါဏ္<<ေါဏ်<ိုဏ္<<ိုဏ +်<တ္<<တ်<ာတ္<<ာတ်<<ါတ္<<ါတ်<ိတ္<<ိတ်<ုတ္<<ုတ်<ေတ္<<ေတ်<ောတ္<<ောတ်<<ေ +ါတ္<<ေါတ်<ိုတ္<<ိုတ်<ထ္<<ထ်<ာထ္<<ာထ်<<ါထ္<<ါထ်<ိထ္<<ိထ်<ုထ္<<ုထ်<ေထ္ +<<ေထ်<ောထ္<<ောထ်<<ေါထ္<<ေါထ်<ိုထ္<<ိုထ်<ဒ္<<ဒ်<ာဒ္<<ာဒ်<<ါဒ္<<ါဒ်<ိဒ +္<<ိဒ်<ုဒ္<<ုဒ်<ေဒ္<<ေဒ်<ောဒ္<<ောဒ်<<ေါဒ္<<ေါဒ်<ိုဒ္<<ိုဒ်<ဓ္<<ဓ်<ာဓ +္<<ာဓ်<<ါဓ္<<ါဓ်<ိဓ္<<ိဓ်<ုဓ္<<ုဓ်<ေဓ္<<ေဓ်<ောဓ္<<ောဓ်<<ေါဓ္<<ေါဓ်<ိ +ုဓ္<<ိုဓ်<န္<<န်<ာန္<<ာန်<<ါန္<<ါန်<ိန္<<ိန်<ုန္<<ုန်<ေန္<<ေန်<ောန္< +<ောန်<<ေါန္<<ေါန်<ိုန္<<ိုန်<ပ္<<ပ်<ာပ္<<ာပ်<<ါပ္<<ါပ်<ိပ္<<ိပ်<ုပ္< +<ုပ်<ေပ္<<ေပ်<ောပ္<<ောပ်<<ေါပ္<<ေါပ်<ိုပ္<<ိုပ်<ဖ္<<ဖ်<ာဖ္<<ာဖ်<<ါဖ္ +<<ါဖ်<ိဖ္<<ိဖ်<ုဖ္<<ုဖ်<ေဖ္<<ေဖ်<ောဖ္<<ောဖ်<<ေါဖ္<<ေါဖ်<ိုဖ္<<ိုဖ်<ဗ +္<<ဗ်<ာဗ္<<ာဗ်<<ါဗ္<<ါဗ်<ိဗ္<<ိဗ်<ုဗ္<<ုဗ်<ေဗ္<<ေဗ်<ောဗ္<<ောဗ်<<ေါဗ္ +<<ေါဗ်<ိုဗ္<<ိုဗ်<ဘ္<<ဘ်<ာဘ္<<ာဘ်<<ါဘ္<<ါဘ်<ိဘ္<<ိဘ်<ုဘ္<<ုဘ်<ေဘ္<<ေ +ဘ်<ောဘ္<<ောဘ်<<ေါဘ္<<ေါဘ်<ိုဘ္<<ိုဘ်<မ္<<မ်<ာမ္<<ာမ်<<ါမ္<<ါမ်<ိမ္<< +ိမ်<ုမ္<<ုမ်<ေမ္<<ေမ်<ောမ္<<ောမ်<<ေါမ္<<ေါမ်<ိုမ္<<ိုမ်<ယ္<<ယ်<ာယ္<< +ာယ်<<ါယ္<<ါယ်<ိယ္<<ိယ်<ုယ္<<ုယ်<ေယ္<<ေယ်<ောယ္<<ောယ်<<ေါယ္<<ေါယ်<ိုယ္ +<<ိုယ်<ရ္<<ရ်<ာရ္<<ာရ်<<ါရ္<<ါရ်<ိရ္<<ိရ်<ုရ္<<ုရ်<ေရ္<<ေရ်<ောရ္<<ော +ရ်<<ေါရ္<<ေါရ်<ိုရ္<<ိုရ်<လ္<<လ်<ာလ္<<ာလ်<<ါလ္<<ါလ်<ိလ္<<ိလ်<ုလ္<<ုလ +်<ေလ္<<ေလ်<ောလ္<<ောလ်<<ေါလ္<<ေါလ်<ိုလ္<<ိုလ်<ဝ်<ာဝ်<<ါဝ်<ိဝ်<ုဝ်<ေဝ် +<ောဝ်<<ေါဝ်<ိုဝ်<သ္<<သ်<ာသ္<<ာသ်<<ါသ္<<ါသ်<ိသ္<<ိသ်<ုသ္<<ုသ်<ေသ္<<ေသ +်<ောသ္<<ောသ်<<ေါသ္<<ေါသ်<ိုသ္<<ိုသ်<ဟ္<<ဟ်<ာဟ္<<ာဟ်<<ါဟ္<<ါဟ်<ိဟ္<<ိ +ဟ်<ုဟ္<<ုဟ်<ေဟ္<<ေဟ်<ောဟ္<<ောဟ်<<ေါဟ္<<ေါဟ်<ိုဟ္<<ိုဟ်<ဠ်<ာဠ်<<ါဠ်<ိ +ဠ်<ုဠ်<ေဠ်<ောဠ်<<ေါဠ်<ိုဠ်<အ်<ာအ်<<ါအ်<ိအ်<ုအ်<ေအ်<ောအ်<<ေါအ်<ိုအ်<ၞ +<ၟ<ျ<ြ<ၠ<ွ<ႂ<ှ<ျွ<ြွ<ျှ<ြှ<ွှ<ျွှ<ြွှ +&အိ<<<ဣ +&အီ<<<ဤ +&အု<<<ဥ +&အူ<<<ဦ +&အေ<<<ဧ<<<ဨ +&အော<<<ဩ +&အော်<<<ဪ +&ိမ်<ိံ<ိမ့်<ိံ့'\u000A'<ိမ်း<ိံး +&ုမ်<ုံ<ုမ့်<ုံ့'\u000A'<ုမ်း<ုံး +&အုံ<<<ဥုံ +&အိက္<<<ဣက္ +&အိက်<<<ဣက် +&အုက္<<<ဥက္ +&အုက်<<<ဥက် +&အေက္<<<ဧက္ +&အေက်<<<ဧက် +&အောက္<<<ဩက္ +&အောက်<<<ဩက် +&အောက္<<<ဩောက္ +&အောက်<<<ဩောက် +&အိခ္<<<ဣခ္ +&အိခ်<<<ဣခ် +&အုခ္<<<ဥခ္ +&အုခ်<<<ဥခ် +&အေခ္<<<ဧခ္ +&အေခ်<<<ဧခ် +&အောခ္<<<ဩခ္ +&အောခ်<<<ဩခ် +&အောခ္<<<ဩောခ္ +&အောခ်<<<ဩောခ် +&အိဂ္<<<ဣဂ္ +&အိဂ်<<<ဣဂ် +&အုဂ္<<<ဥဂ္ +&အုဂ်<<<ဥဂ် +&အေဂ္<<<ဧဂ္ +&အေဂ်<<<ဧဂ် +&အောဂ္<<<ဩဂ္ +&အောဂ်<<<ဩဂ် +&အောဂ္<<<ဩောဂ္ +&အောဂ်<<<ဩောဂ် +&အိဃ္<<<ဣဃ္ +&အိဃ်<<<ဣဃ် +&အုဃ္<<<ဥဃ္ +&အုဃ်<<<ဥဃ် +&အေဃ္<<<ဧဃ္ +&အေဃ်<<<ဧဃ် +&အောဃ္<<<ဩဃ္ +&အောဃ်<<<ဩဃ် +&အောဃ္<<<ဩောဃ္ +&အောဃ်<<<ဩောဃ် +&အိင္<<<ဣင္ +&အိင်<<<ဣင် +&အုင္<<<ဥင္ +&အုင်<<<ဥင် +&အေင္<<<ဧင္ +&အေင်<<<ဧင် +&အောင္<<<ဩင္ +&အောင်<<<ဩင် +&အောင္<<<ဩောင္ +&အောင်<<<ဩောင် +&အိစ္<<<ဣစ္ +&အိစ်<<<ဣစ် +&အုစ္<<<ဥစ္ +&အုစ်<<<ဥစ် +&အေစ္<<<ဧစ္ +&အေစ်<<<ဧစ် +&အောစ္<<<ဩစ္ +&အောစ်<<<ဩစ် +&အောစ္<<<ဩောစ္ +&အောစ်<<<ဩောစ် +&အိဆ္<<<ဣဆ္ +&အိဆ်<<<ဣဆ် +&အုဆ္<<<ဥဆ္ +&အုဆ်<<<ဥဆ် +&အေဆ္<<<ဧဆ္ +&အေဆ်<<<ဧဆ် +&အောဆ္<<<ဩဆ္ +&အောဆ်<<<ဩဆ် +&အောဆ္<<<ဩောဆ္ +&အောဆ်<<<ဩောဆ် +&အိဇ္<<<ဣဇ္ +&အိဇ်<<<ဣဇ် +&အုဇ္<<<ဥဇ္ +&အုဇ်<<<ဥဇ် +&အေဇ္<<<ဧဇ္ +&အေဇ်<<<ဧဇ် +&အောဇ္<<<ဩဇ္ +&အောဇ်<<<ဩဇ် +&အောဇ္<<<ဩောဇ္ +&အောဇ်<<<ဩောဇ် +&အိဉ္<<<ဣဉ္ +&အိဉ်<<<ဣဉ် +&အုဉ္<<<ဥဉ္ +&အုဉ်<<<ဥဉ် +&အေဉ္<<<ဧဉ္ +&အေဉ်<<<ဧဉ် +&အောဉ္<<<ဩဉ္ +&အောဉ်<<<ဩဉ် +&အောဉ္<<<ဩောဉ္ +&အောဉ်<<<ဩောဉ် +&အိည္<<<ဣည္ +&အိည်<<<ဣည် +&အုည္<<<ဥည္ +&အုည်<<<ဥည် +&အေည္<<<ဧည္ +&အေည်<<<ဧည် +&အောည္<<<ဩည္ +&အောည်<<<ဩည် +&အောည္<<<ဩောည္ +&အောည်<<<ဩောည် +&အိဋ္<<<ဣဋ္ +&အိဋ်<<<ဣဋ် +&အုဋ္<<<ဥဋ္ +&အုဋ်<<<ဥဋ် +&အေဋ္<<<ဧဋ္ +&အေဋ်<<<ဧဋ် +&အောဋ္<<<ဩဋ္ +&အောဋ်<<<ဩဋ် +&အောဋ္<<<ဩောဋ္ +&အောဋ်<<<ဩောဋ် +&အိဌ္<<<ဣဌ္ +&အိဌ်<<<ဣဌ် +&အုဌ္<<<ဥဌ္ +&အုဌ်<<<ဥဌ် +&အေဌ္<<<ဧဌ္ +&အေဌ်<<<ဧဌ် +&အောဌ္<<<ဩဌ္ +&အောဌ်<<<ဩဌ် +&အောဌ္<<<ဩောဌ္ +&အောဌ်<<<ဩောဌ် +&အိဍ္<<<ဣဍ္ +&အိဍ်<<<ဣဍ် +&အုဍ္<<<ဥဍ္ +&အုဍ်<<<ဥဍ် +&အေဍ္<<<ဧဍ္ +&အေဍ်<<<ဧဍ် +&အောဍ္<<<ဩဍ္ +&အောဍ်<<<ဩဍ် +&အောဍ္<<<ဩောဍ္ +&အောဍ်<<<ဩောဍ် +&အိဎ္<<<ဣဎ္ +&အိဎ်<<<ဣဎ် +&အုဎ္<<<ဥဎ္ +&အုဎ်<<<ဥဎ် +&အေဎ္<<<ဧဎ္ +&အေဎ်<<<ဧဎ် +&အောဎ္<<<ဩဎ္ +&အောဎ်<<<ဩဎ် +&အောဎ္<<<ဩောဎ္ +&အောဎ်<<<ဩောဎ် +&အိဏ္<<<ဣဏ္ +&အိဏ်<<<ဣဏ် +&အုဏ္<<<ဥဏ္ +&အုဏ်<<<ဥဏ် +&အေဏ္<<<ဧဏ္ +&အေဏ်<<<ဧဏ် +&အောဏ္<<<ဩဏ္ +&အောဏ်<<<ဩဏ် +&အောဏ္<<<ဩောဏ္ +&အောဏ်<<<ဩောဏ် +&အိတ္<<<ဣတ္ +&အိတ်<<<ဣတ် +&အုတ္<<<ဥတ္ +&အုတ်<<<ဥတ် +&အေတ္<<<ဧတ္ +&အေတ်<<<ဧတ် +&အောတ္<<<ဩတ္ +&အောတ်<<<ဩတ် +&အောတ္<<<ဩောတ္ +&အောတ်<<<ဩောတ် +&အိထ္<<<ဣထ္ +&အိထ်<<<ဣထ် +&အုထ္<<<ဥထ္ +&အုထ်<<<ဥထ် +&အေထ္<<<ဧထ္ +&အေထ်<<<ဧထ် +&အောထ္<<<ဩထ္ +&အောထ်<<<ဩထ် +&အောထ္<<<ဩောထ္ +&အောထ်<<<ဩောထ် +&အိဒ္<<<ဣဒ္ +&အိဒ်<<<ဣဒ် +&အုဒ္<<<ဥဒ္ +&အုဒ်<<<ဥဒ် +&အေဒ္<<<ဧဒ္ +&အေဒ်<<<ဧဒ် +&အောဒ္<<<ဩဒ္ +&အောဒ်<<<ဩဒ် +&အောဒ္<<<ဩောဒ္ +&အောဒ်<<<ဩောဒ် +&အိဓ္<<<ဣဓ္ +&အိဓ်<<<ဣဓ် +&အုဓ္<<<ဥဓ္ +&အုဓ်<<<ဥဓ် +&အေဓ္<<<ဧဓ္ +&အေဓ်<<<ဧဓ် +&အောဓ္<<<ဩဓ္ +&အောဓ်<<<ဩဓ် +&အောဓ္<<<ဩောဓ္ +&အောဓ်<<<ဩောဓ် +&အိန္<<<ဣန္ +&အိန်<<<ဣန် +&အုန္<<<ဥန္ +&အုန်<<<ဥန် +&အေန္<<<ဧန္ +&အေန်<<<ဧန် +&အောန္<<<ဩန္ +&အောန်<<<ဩန် +&အောန္<<<ဩောန္ +&အောန်<<<ဩောန် +&အိပ္<<<ဣပ္ +&အိပ်<<<ဣပ် +&အုပ္<<<ဥပ္ +&အုပ်<<<ဥပ် +&အေပ္<<<ဧပ္ +&အေပ်<<<ဧပ် +&အောပ္<<<ဩပ္ +&အောပ်<<<ဩပ် +&အောပ္<<<ဩောပ္ +&အောပ်<<<ဩောပ် +&အိဖ္<<<ဣဖ္ +&အိဖ်<<<ဣဖ် +&အုဖ္<<<ဥဖ္ +&အုဖ်<<<ဥဖ် +&အေဖ္<<<ဧဖ္ +&အေဖ်<<<ဧဖ် +&အောဖ္<<<ဩဖ္ +&အောဖ်<<<ဩဖ် +&အောဖ္<<<ဩောဖ္ +&အောဖ်<<<ဩောဖ် +&အိဗ္<<<ဣဗ္ +&အိဗ်<<<ဣဗ် +&အုဗ္<<<ဥဗ္ +&အုဗ်<<<ဥဗ် +&အေဗ္<<<ဧဗ္ +&အေဗ်<<<ဧဗ် +&အောဗ္<<<ဩဗ္ +&အောဗ်<<<ဩဗ် +&အောဗ္<<<ဩောဗ္ +&အောဗ်<<<ဩောဗ် +&အိဘ္<<<ဣဘ္ +&အိဘ်<<<ဣဘ် +&အုဘ္<<<ဥဘ္ +&အုဘ်<<<ဥဘ် +&အေဘ္<<<ဧဘ္ +&အေဘ်<<<ဧဘ် +&အောဘ္<<<ဩဘ္ +&အောဘ်<<<ဩဘ် +&အောဘ္<<<ဩောဘ္ +&အောဘ်<<<ဩောဘ် +&အိမ္<<<ဣမ္ +&အိမ်<<<ဣမ် +&အုမ္<<<ဥမ္ +&အုမ်<<<ဥမ် +&အေမ္<<<ဧမ္ +&အေမ်<<<ဧမ် +&အောမ္<<<ဩမ္ +&အောမ်<<<ဩမ် +&အောမ္<<<ဩောမ္ +&အောမ်<<<ဩောမ် +&အိယ္<<<ဣယ္ +&အိယ်<<<ဣယ် +&အုယ္<<<ဥယ္ +&အုယ်<<<ဥယ် +&အေယ္<<<ဧယ္ +&အေယ်<<<ဧယ် +&အောယ္<<<ဩယ္ +&အောယ်<<<ဩယ် +&အောယ္<<<ဩောယ္ +&အောယ်<<<ဩောယ် +&အိရ္<<<ဣရ္ +&အိရ်<<<ဣရ် +&အုရ္<<<ဥရ္ +&အုရ်<<<ဥရ် +&အေရ္<<<ဧရ္ +&အေရ်<<<ဧရ် +&အောရ္<<<ဩရ္ +&အောရ်<<<ဩရ် +&အောရ္<<<ဩောရ္ +&အောရ်<<<ဩောရ် +&အိလ္<<<ဣလ္ +&အိလ်<<<ဣလ် +&အုလ္<<<ဥလ္ +&အုလ်<<<ဥလ် +&အေလ္<<<ဧလ္ +&အေလ်<<<ဧလ် +&အောလ္<<<ဩလ္ +&အောလ်<<<ဩလ် +&အောလ္<<<ဩောလ္ +&အောလ်<<<ဩောလ် +&အိသ္<<<ဣသ္ +&အိသ်<<<ဣသ် +&အုသ္<<<ဥသ္ +&အုသ်<<<ဥသ် +&အေသ္<<<ဧသ္ +&အေသ်<<<ဧသ် +&အောသ္<<<ဩသ္ +&အောသ်<<<ဩသ် +&အောသ္<<<ဩောသ္ +&အောသ်<<<ဩောသ် +&အိဟ္<<<ဣဟ္ +&အိဟ်<<<ဣဟ် +&အုဟ္<<<ဥဟ္ +&အုဟ်<<<ဥဟ် +&အေဟ္<<<ဧဟ္ +&အေဟ်<<<ဧဟ် +&အောဟ္<<<ဩဟ္ +&အောဟ်<<<ဩဟ် +&အောဟ္<<<ဩောဟ္ +&အောဟ်<<<ဩောဟ် +&ောက်ကျ=ောက်ျ +&န်နုပ်=န်ုပ် +&ေသ္သ=ေဿ +&ိသ္သ=ိဿ +&ုသ္သ=ုဿ +&အိသ္သ<<<ဣဿ +&အုသ္သ<<<ဥဿ +&သ္သ=ဿ +&နှိုက်<<၌ +&ရွေ့<<၍ +&လည်းကောင်း<<၎င်း +&အိ<<၏ +&လက်ယာ=လက်ျာ +&သမီ=သ္မီ +&ထမင်း=ထ္မင်း +&လက်ဘက်=လ္ဘက် diff --git a/i18npool/source/collator/gencoll_rule.cxx b/i18npool/source/collator/gencoll_rule.cxx index 43f0a8310c30..c14b068efeca 100644 --- a/i18npool/source/collator/gencoll_rule.cxx +++ b/i18npool/source/collator/gencoll_rule.cxx @@ -118,7 +118,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) //UCollator *coll = ucol_openRules(Obuf.getStr(), Obuf.getLength(), UCOL_OFF, // UCOL_DEFAULT_STRENGTH, &parseError, &status); - RuleBasedCollator *coll = new RuleBasedCollator(Obuf.getStr(), status); + RuleBasedCollator *coll = new RuleBasedCollator(reinterpret_cast<const UChar *>(Obuf.getStr()), status); // UChar != sal_Unicode in MinGW if (U_SUCCESS(status)) { diff --git a/i18npool/source/collator/makefile.mk b/i18npool/source/collator/makefile.mk index a0151f97af3b..b1e2791f873b 100644 --- a/i18npool/source/collator/makefile.mk +++ b/i18npool/source/collator/makefile.mk @@ -61,7 +61,8 @@ DEPOBJFILES = $(APP1OBJS) APP1STDLIBS = $(SALLIB) \ $(ICUINLIB) \ - $(ICUUCLIB) + $(ICUUCLIB) \ + $(ICUDATALIB) # --- Targets ------------------------------------------------------ diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index 704562821c92..baf9ac38786b 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: defaultnumberingprovider.cxx,v $ - * $Revision: 1.30 $ + * $Revision: 1.30.24.2 $ * * This file is part of OpenOffice.org. * @@ -120,6 +120,13 @@ static sal_Unicode table_Alphabet_dz[] = { 0x0F62, 0x0F63, 0x0F64, 0x0F66, 0x0F67, 0x0F68 }; +static sal_Unicode table_Alphabet_my[] = { + 0x1000, 0x1001, 0x1002, 0x1003, 0x1004, 0x1005, 0x1006, 0x1007, + 0x1008,/*0x1009,*/0x100A, 0x100B, 0x100C, 0x100D, 0x100E, 0x100F, + 0x1010, 0x1011, 0x1012, 0x1013, 0x1014, 0x1015, 0x1016, 0x1017, + 0x1018, 0x1019, 0x101A, 0x101B, 0x101C, 0x101D, 0x101E, 0x101F, + 0x1020, 0x1021 +}; // Bulgarian Cyrillic upper case letters static sal_Unicode table_CyrillicUpperLetter_bg[] = { @@ -153,6 +160,22 @@ static sal_Unicode table_CyrillicLowerLetter_ru[] = { 0x0449, 0x044B, 0x044D, 0x044E, 0x044F }; +// Serbian Cyrillic upper letters +static sal_Unicode table_CyrillicUpperLetter_sr[] = { + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0402, 0x0415, 0x0416, + 0x0417, 0x0418, 0x0408, 0x041A, 0x041B, 0x0409, 0x041C, 0x041D, + 0x040A, 0x041E, 0x041F, 0x0420, 0x0421, 0x0422, 0x040B, 0x0423, + 0x0424, 0x0425, 0x0426, 0x0427, 0x040F, 0x0428 +}; + +// Serbian cyrillic lower letters +static sal_Unicode table_CyrillicLowerLetter_sr[] = { + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0452, 0x0435, 0x0436, + 0x0437, 0x0438, 0x0458, 0x043A, 0x043B, 0x0459, 0x043C, 0x043D, + 0x045A, 0x043E, 0x043F, 0x0440, 0x0441, 0x0442, 0x045B, 0x0443, + 0x0444, 0x0445, 0x0446, 0x0447, 0x045F, 0x0448 +}; + static sal_Unicode table_Alphabet_fa[] = { 0x0622, 0x0628, 0x067E, 0x062A, 0x062B, 0x062C, 0x0686, 0x062D, 0x062E, 0x062F, 0x0630, 0x0631, 0x0632, 0x0698, 0x0633, 0x0634, @@ -555,6 +578,9 @@ DefaultNumberingProvider::makeNumberingString( const Sequence<beans::PropertyVal case CHARS_LAO: lcl_formatChars(table_Alphabet_lo, sizeof(table_Alphabet_lo) / sizeof(sal_Unicode), number - 1, result); break; + case CHARS_MYANMAR: + lcl_formatChars(table_Alphabet_my, sizeof(table_Alphabet_my) / sizeof(sal_Unicode), number - 1, result); + break; case CHARS_TIBETAN: lcl_formatChars(table_Alphabet_dz, sizeof(table_Alphabet_dz) / sizeof(sal_Unicode), number - 1, result); break; @@ -610,6 +636,32 @@ DefaultNumberingProvider::makeNumberingString( const Sequence<beans::PropertyVal sizeof(table_CyrillicLowerLetter_ru[0]), number-1, result); // 1=>a, 2=>b, ..., 27=>z, 28=>aa, 29=>bb, ... break; + case CHARS_CYRILLIC_UPPER_LETTER_SR: + lcl_formatChars2( table_CyrillicUpperLetter_sr, + table_CyrillicLowerLetter_sr, + sizeof(table_CyrillicLowerLetter_sr) / + sizeof(table_CyrillicLowerLetter_sr[0]), number-1, + result); // 1=>a, 2=>b, ..., 27=>z, 28=>Aa, 29=>Ab, ... + break; + case CHARS_CYRILLIC_LOWER_LETTER_SR: + lcl_formatChars( table_CyrillicLowerLetter_sr, + sizeof(table_CyrillicLowerLetter_sr) / + sizeof(table_CyrillicLowerLetter_sr[0]), number-1, + result); // 1=>a, 2=>b, ..., 27=>z, 28=>aa, 29=>ab, ... + break; + case CHARS_CYRILLIC_UPPER_LETTER_N_SR: + lcl_formatChars3( table_CyrillicUpperLetter_sr, + table_CyrillicLowerLetter_sr, + sizeof(table_CyrillicLowerLetter_sr) / + sizeof(table_CyrillicLowerLetter_sr[0]), number-1, + result); // 1=>a, 2=>b, ..., 27=>z, 28=>Aa, 29=>Bb, ... + break; + case CHARS_CYRILLIC_LOWER_LETTER_N_SR: + lcl_formatChars1( table_CyrillicLowerLetter_sr, + sizeof(table_CyrillicLowerLetter_sr) / + sizeof(table_CyrillicLowerLetter_sr[0]), number-1, + result); // 1=>a, 2=>b, ..., 27=>z, 28=>aa, 29=>bb, ... + break; case CHARS_PERSIAN: lcl_formatChars(table_Alphabet_fa, sizeof(table_Alphabet_fa) / sizeof(sal_Unicode), number - 1, result); break; @@ -686,6 +738,7 @@ static const Supported_NumberingType aSupportedTypes[] = {style::NumberingType::CHARS_NEPALI, NULL, LANG_CTL}, {style::NumberingType::CHARS_KHMER, NULL, LANG_CTL}, {style::NumberingType::CHARS_LAO, NULL, LANG_CTL}, + {style::NumberingType::CHARS_MYANMAR, NULL, LANG_CTL}, {style::NumberingType::CHARS_TIBETAN, NULL, LANG_CTL}, {style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_BG, C_CYR_A ", " C_CYR_B ", .., " C_CYR_A S_CYR_A ", " C_CYR_A S_CYR_B ", ... (bg)", LANG_ALL}, {style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_BG, S_CYR_A ", " S_CYR_B ", .., " S_CYR_A S_CYR_A ", " S_CYR_A S_CYR_B ", ... (bg)", LANG_ALL}, @@ -695,6 +748,10 @@ static const Supported_NumberingType aSupportedTypes[] = {style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_RU, S_CYR_A ", " S_CYR_B ", .., " S_CYR_A S_CYR_A ", " S_CYR_A S_CYR_B ", ... (ru)", LANG_ALL}, {style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_N_RU, C_CYR_A ", " C_CYR_B ", .., " C_CYR_A S_CYR_A ", " C_CYR_B S_CYR_B ", ... (ru)", LANG_ALL}, {style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_N_RU, S_CYR_A ", " S_CYR_B ", .., " S_CYR_A S_CYR_A ", " S_CYR_B S_CYR_B ", ... (ru)", LANG_ALL}, + {style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_SR, C_CYR_A ", " C_CYR_B ", .., " C_CYR_A S_CYR_A ", " C_CYR_A S_CYR_B ", ... (sr)", LANG_ALL}, + {style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_SR, S_CYR_A ", " S_CYR_B ", .., " S_CYR_A S_CYR_A ", " S_CYR_A S_CYR_B ", ... (sr)", LANG_ALL}, + {style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_N_SR, C_CYR_A ", " C_CYR_B ", .., " C_CYR_A S_CYR_A ", " C_CYR_B S_CYR_B ", ... (sr)", LANG_ALL}, + {style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_N_SR, S_CYR_A ", " S_CYR_B ", .., " S_CYR_A S_CYR_A ", " S_CYR_B S_CYR_B ", ... (sr)", LANG_ALL}, {style::NumberingType::CHARS_PERSIAN, NULL, LANG_CTL}, }; static const sal_Int32 nSupported_NumberingTypes = sizeof(aSupportedTypes) / sizeof(Supported_NumberingType); diff --git a/i18npool/source/indexentry/makefile.mk b/i18npool/source/indexentry/makefile.mk index 4f466f5fbee0..e10f05e920ed 100644 --- a/i18npool/source/indexentry/makefile.mk +++ b/i18npool/source/indexentry/makefile.mk @@ -60,7 +60,8 @@ APP1OBJS = $(DEPOBJFILES) APP1STDLIBS = $(SALLIB) \ $(ICUINLIB) \ - $(ICUUCLIB) + $(ICUUCLIB) \ + $(ICUDATALIB) # --- Targets ------------------------------------------------------ diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx index 686478fb7651..74416df665a0 100644 --- a/i18npool/source/isolang/isolang.cxx +++ b/i18npool/source/isolang/isolang.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: isolang.cxx,v $ - * $Revision: 1.16 $ + * $Revision: 1.16.24.7 $ * * This file is part of OpenOffice.org. * @@ -97,8 +97,8 @@ struct IsoLangOtherEntry * only" usage and locale fall back should be cleaned up and made consistent. I * strongly doubt that most callers exactly expect the behavior described. * Currently these primary LangIDs are used literally in OOo code: - * LANGUAGE_ENGLISH LANGUAGE_CHINESE LANGUAGE_ARABIC LANGUAGE_MALAY - * LANGUAGE_AZERI LANGUAGE_UZBEK LANGUAGE_URDU LANGUAGE_KASHMIRI + * LANGUAGE_ENGLISH LANGUAGE_CHINESE LANGUAGE_MALAY + * LANGUAGE_AZERI LANGUAGE_URDU LANGUAGE_KASHMIRI */ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = @@ -114,9 +114,8 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_GERMAN, "de", "DE" }, { LANGUAGE_ITALIAN, "it", "IT" }, { LANGUAGE_DUTCH, "nl", "NL" }, - { LANGUAGE_SPANISH, "es", "ES" }, - { LANGUAGE_SPANISH, "es", "" }, { LANGUAGE_SPANISH_MODERN, "es", "ES" }, + { LANGUAGE_SPANISH_DATED, "es", "ES" }, { LANGUAGE_PORTUGUESE, "pt", "PT" }, { LANGUAGE_PORTUGUESE_BRAZILIAN, "pt", "BR" }, { LANGUAGE_DANISH, "da", "DK" }, @@ -147,19 +146,8 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_GERMAN_AUSTRIAN, "de", "AT" }, { LANGUAGE_ITALIAN_SWISS, "it", "CH" }, { LANGUAGE_ALBANIAN, "sq", "AL" }, - // #i93555# moved entry below { LANGUAGE_ARABIC, "ar", "" }, - { LANGUAGE_ARABIC_EGYPT, "ar", "EG" }, - // #i93555# HACK: language-only entry moved here to have a match on locale - // present in language list box to not display "Unknown" for an Arabic 'ar' - // language pack. This may have some side effect on code dealing with - // LANGUAGE_ARABIC if it converts to/from strings. On the other hand, usage - // of language-only usually is done wrong anyway.. - /* FIXME: fix all "primary language only" usage, see also comment above - * this table, and then add a few language-only entries to the language - * list box if really necessary, but do not make them available for - * language attribution and so on, only for UI language selection! */ - { LANGUAGE_ARABIC, "ar", "" }, { LANGUAGE_ARABIC_SAUDI_ARABIA, "ar", "SA" }, + { LANGUAGE_ARABIC_EGYPT, "ar", "EG" }, { LANGUAGE_ARABIC_UAE, "ar", "AE" }, { LANGUAGE_ARABIC_IRAQ, "ar", "IQ" }, { LANGUAGE_ARABIC_LIBYA, "ar", "LY" }, @@ -174,6 +162,16 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_ARABIC_KUWAIT, "ar", "KW" }, { LANGUAGE_ARABIC_BAHRAIN, "ar", "BH" }, { LANGUAGE_ARABIC_QATAR, "ar", "QA" }, + { LANGUAGE_USER_ARABIC_CHAD, "ar", "TD" }, + { LANGUAGE_USER_ARABIC_COMOROS, "ar", "KM" }, + { LANGUAGE_USER_ARABIC_DJIBOUTI, "ar", "DJ" }, + { LANGUAGE_USER_ARABIC_ERITREA, "ar", "ER" }, + { LANGUAGE_USER_ARABIC_ISRAEL, "ar", "IL" }, + { LANGUAGE_USER_ARABIC_MAURITANIA, "ar", "MR" }, + { LANGUAGE_USER_ARABIC_PALESTINE, "ar", "PS" }, + { LANGUAGE_USER_ARABIC_SOMALIA, "ar", "SO" }, + { LANGUAGE_USER_ARABIC_SUDAN, "ar", "SD" }, + { LANGUAGE_ARABIC_PRIMARY_ONLY, "ar", "" }, { LANGUAGE_BASQUE, "eu", "" }, { LANGUAGE_BULGARIAN, "bg", "BG" }, { LANGUAGE_CZECH, "cs", "CZ" }, @@ -201,7 +199,7 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_NORWEGIAN_BOKMAL, "nb", "NO" }, { LANGUAGE_NORWEGIAN_NYNORSK, "nn", "NO" }, { LANGUAGE_POLISH, "pl", "PL" }, - { LANGUAGE_RHAETO_ROMAN, "rm", "" }, + { LANGUAGE_RHAETO_ROMAN, "rm", "CH" }, { LANGUAGE_ROMANIAN, "ro", "RO" }, { LANGUAGE_ROMANIAN_MOLDOVA, "ro", "MD" }, { LANGUAGE_SLOVAK, "sk", "SK" }, @@ -258,7 +256,6 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_AZERI, "az", "" }, { LANGUAGE_AZERI_LATIN, "az", "AZ" }, // { LANGUAGE_AZERI_CYRILLIC, "az", "AZ" }, // script codes not supported yet - { LANGUAGE_UZBEK, "uz", "" }, { LANGUAGE_UZBEK_LATIN, "uz", "UZ" }, // { LANGUAGE_UZBEK_CYRILLIC, "uz", "UZ" }, // script codes not supported yet { LANGUAGE_BENGALI_BANGLADESH, "bn", "BD" }, @@ -363,7 +360,6 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_CHEROKEE_UNITED_STATES, "chr", "US" }, { LANGUAGE_INUKTITUT_LATIN_CANADA, "iu", "CA" }, // { LANGUAGE_INUKTITUT_SYLLABICS_CANADA, "iu", "CA" }, // script codes not supported yet -// { LANGUAGE_ARABIC_SUDAN, "ar", "SD" }, // unknown MS-LCID { LANGUAGE_SAMI_NORTHERN_NORWAY, "se", "NO" }, { LANGUAGE_SAMI_INARI, "smn", "FI" }, { LANGUAGE_SAMI_LULE_NORWAY, "smj", "NO" }, @@ -448,6 +444,8 @@ static MsLangId::IsoLangEntry const aImplIsoLangEntries[] = { LANGUAGE_USER_SANTALI_INDIA, "sat", "IN" }, { LANGUAGE_USER_TETUN, "tet", "ID" }, { LANGUAGE_USER_TETUN_TIMOR_LESTE, "tet", "TL" }, + { LANGUAGE_USER_TOK_PISIN, "tpi", "PG" }, + { LANGUAGE_USER_SHUSWAP, "shs", "CA" }, { LANGUAGE_NONE, "zxx", "" }, // added to ISO 639-2 on 2006-01-11: Used to declare the absence of linguistic information { LANGUAGE_DONTKNOW, "", "" } // marks end of table }; @@ -670,7 +668,6 @@ static const MsLangId::IsoLangEntry & lcl_lookupFallbackEntry( LanguageType nLan { // These are known to have no country assigned. case LANGUAGE_BASQUE: - case LANGUAGE_RHAETO_ROMAN: case LANGUAGE_USER_ESPERANTO: case LANGUAGE_USER_INTERLINGUA: return *pEntry; @@ -751,7 +748,6 @@ static const MsLangId::IsoLangEntry & lcl_lookupFallbackEntry( { // These are known to have no country assigned. case LANGUAGE_BASQUE: - case LANGUAGE_RHAETO_ROMAN: case LANGUAGE_USER_ESPERANTO: case LANGUAGE_USER_INTERLINGUA: return *pEntry; diff --git a/i18npool/source/isolang/mslangid.cxx b/i18npool/source/isolang/mslangid.cxx index 7ea7e39f57fb..070ddb9dc562 100644 --- a/i18npool/source/isolang/mslangid.cxx +++ b/i18npool/source/isolang/mslangid.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: mslangid.cxx,v $ - * $Revision: 1.10 $ + * $Revision: 1.10.24.4 $ * * This file is part of OpenOffice.org. * @@ -209,10 +209,12 @@ bool MsLangId::isRightToLeft( LanguageType nLang ) { switch( nLang & LANGUAGE_MASK_PRIMARY ) { - case LANGUAGE_ARABIC & LANGUAGE_MASK_PRIMARY : - case LANGUAGE_HEBREW & LANGUAGE_MASK_PRIMARY : - case LANGUAGE_URDU & LANGUAGE_MASK_PRIMARY : - case LANGUAGE_FARSI & LANGUAGE_MASK_PRIMARY : + case LANGUAGE_ARABIC_SAUDI_ARABIA & LANGUAGE_MASK_PRIMARY : + case LANGUAGE_HEBREW & LANGUAGE_MASK_PRIMARY : + case LANGUAGE_URDU & LANGUAGE_MASK_PRIMARY : + case LANGUAGE_FARSI & LANGUAGE_MASK_PRIMARY : + case LANGUAGE_KASHMIRI & LANGUAGE_MASK_PRIMARY : + case LANGUAGE_SINDHI & LANGUAGE_MASK_PRIMARY : return true; default: @@ -239,6 +241,23 @@ bool MsLangId::hasForbiddenCharacters( LanguageType nLang ) // static +bool MsLangId::needsSequenceChecking( LanguageType nLang ) +{ + switch (nLang & LANGUAGE_MASK_PRIMARY) + { + case LANGUAGE_BURMESE & LANGUAGE_MASK_PRIMARY: + case LANGUAGE_KHMER & LANGUAGE_MASK_PRIMARY: + case LANGUAGE_LAO & LANGUAGE_MASK_PRIMARY: + case LANGUAGE_THAI & LANGUAGE_MASK_PRIMARY: + return true; + default: + break; + } + return false; +} + + +// static sal_Int16 MsLangId::getScriptType( LanguageType nLang ) { sal_Int16 nScript; @@ -259,6 +278,7 @@ sal_Int16 MsLangId::getScriptType( LanguageType nLang ) case LANGUAGE_ASSAMESE: case LANGUAGE_BENGALI: case LANGUAGE_BENGALI_BANGLADESH: + case LANGUAGE_BURMESE: case LANGUAGE_FARSI: case LANGUAGE_HEBREW: case LANGUAGE_MARATHI: @@ -291,6 +311,10 @@ sal_Int16 MsLangId::getScriptType( LanguageType nLang ) case LANGUAGE_URDU_INDIA: case LANGUAGE_USER_KURDISH_IRAQ: case LANGUAGE_USER_KURDISH_IRAN: + case LANGUAGE_DHIVEHI: + case LANGUAGE_USER_BODO_INDIA: + case LANGUAGE_USER_DOGRI_INDIA: + case LANGUAGE_USER_MAITHILI_INDIA: nScript = ::com::sun::star::i18n::ScriptType::COMPLEX; break; @@ -312,7 +336,7 @@ sal_Int16 MsLangId::getScriptType( LanguageType nLang ) nScript = ::com::sun::star::i18n::ScriptType::ASIAN; break; // CTL catcher - case LANGUAGE_ARABIC & LANGUAGE_MASK_PRIMARY: + case LANGUAGE_ARABIC_SAUDI_ARABIA & LANGUAGE_MASK_PRIMARY: nScript = ::com::sun::star::i18n::ScriptType::COMPLEX; break; // Western (actually not necessarily Latin but also Cyrillic, for example) @@ -330,26 +354,49 @@ LanguageType MsLangId::getReplacementForObsoleteLanguage( LanguageType nLang ) { switch (nLang) { + default: + break; // nothing case LANGUAGE_OBSOLETE_USER_LATIN: nLang = LANGUAGE_LATIN; + break; case LANGUAGE_OBSOLETE_USER_MAORI: nLang = LANGUAGE_MAORI_NEW_ZEALAND; + break; case LANGUAGE_OBSOLETE_USER_KINYARWANDA: nLang = LANGUAGE_KINYARWANDA_RWANDA; + break; case LANGUAGE_OBSOLETE_USER_UPPER_SORBIAN: nLang = LANGUAGE_UPPER_SORBIAN_GERMANY; + break; case LANGUAGE_OBSOLETE_USER_LOWER_SORBIAN: nLang = LANGUAGE_LOWER_SORBIAN_GERMANY; + break; case LANGUAGE_OBSOLETE_USER_OCCITAN: nLang = LANGUAGE_OCCITAN_FRANCE; + break; case LANGUAGE_OBSOLETE_USER_BRETON: nLang = LANGUAGE_BRETON_FRANCE; + break; case LANGUAGE_OBSOLETE_USER_KALAALLISUT: nLang = LANGUAGE_KALAALLISUT_GREENLAND; + break; case LANGUAGE_OBSOLETE_USER_LUXEMBOURGISH: nLang = LANGUAGE_LUXEMBOURGISH_LUXEMBOURG; - default: - ; // nothing + break; + + // The following are not strictly obsolete but should be mapped to a + // replacement locale when encountered. + + // no_NO is an alias for nb_NO + case LANGUAGE_NORWEGIAN: + nLang = LANGUAGE_NORWEGIAN_BOKMAL; + break; + + // #i94435# A Spanish variant that differs only in collation details we + // do not support. + case LANGUAGE_SPANISH_DATED: + nLang = LANGUAGE_SPANISH_MODERN; + break; } return nLang; } diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index 0835746ba55c..7596efc1087c 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: LocaleNode.cxx,v $ - * $Revision: 1.29.16.1 $ + * $Revision: 1.29.24.3 $ * * This file is part of OpenOffice.org. * @@ -307,6 +307,11 @@ void LocaleNode::incError( const char* pStr ) const fprintf( stderr, "Error: %s\n", pStr); } +void LocaleNode::incError( const ::rtl::OUString& rStr ) const +{ + incError( OUStringToOString( rStr, RTL_TEXTENCODING_UTF8).getStr()); +} + char* LocaleNode::prepareErrorFormat( const char* pFormat, const char* pDefaultConversion ) const { static char buf[2048]; @@ -521,10 +526,15 @@ sal_Int16 LCFormatNode::mnFormats = 0; void LCFormatNode::generateCode (const OFileWriter &of) const { + OUString str; if (mnSection >= 2) incError("more than 2 LC_FORMAT sections"); of.writeParameter("replaceFrom", getAttr() -> getValueByName("replaceFrom"), mnSection); - of.writeParameter("replaceTo", getAttr() -> getValueByName("replaceTo"), mnSection); + str = getAttr() -> getValueByName("replaceTo"); + // Locale data generator inserts FFFF for LangID, we need to adapt that. + if (str.endsWithIgnoreAsciiCaseAsciiL( "-FFFF]", 6)) + incErrorStr("replaceTo=\"%s\" needs FFFF to be adapted to the real LangID value.", str); + of.writeParameter("replaceTo", str, mnSection); ::rtl::OUString useLocale = getAttr() -> getValueByName("ref"); if (useLocale.getLength() > 0) { switch (mnSection) @@ -539,32 +549,58 @@ void LCFormatNode::generateCode (const OFileWriter &of) const return; } sal_Int16 formatCount = mnFormats; - NameSet aMsgId; - ValueSet aFormatIndex; + NameSet aMsgIdSet; + ValueSet aFormatIndexSet; + NameSet aDefaultsSet; bool bCtypeIsRef = false; for (sal_Int16 i = 0; i< getNumberOfChildren() ; i++,formatCount++) { LocaleNode * currNode = getChildAt (i); - ::rtl::OUString str; + OUString aUsage; + OUString aType; + OUString aFormatIndex; // currNode -> print(); const Attr * currNodeAttr = currNode->getAttr(); //printf ("getLen() = %d\n", currNode->getAttr()->getLength()); + str = currNodeAttr -> getValueByName("msgid"); - if (!aMsgId.insert( str).second) + if (!aMsgIdSet.insert( str).second) incErrorStr( "Duplicated msgid=\"%s\" in FormatElement.", str); of.writeParameter("FormatKey", str, formatCount); + str = currNodeAttr -> getValueByName("default"); + bool bDefault = str.equalsAscii( "true"); of.writeDefaultParameter("FormatElement", str, formatCount); - str = currNodeAttr -> getValueByName("type"); - of.writeParameter("FormatType", str, formatCount); - str = currNodeAttr -> getValueByName("usage"); - of.writeParameter("FormatUsage", str, formatCount); - str = currNodeAttr -> getValueByName("formatindex"); - sal_Int16 formatindex = (sal_Int16)str.toInt32(); - if (!aFormatIndex.insert( formatindex).second) + + aType = currNodeAttr -> getValueByName("type"); + of.writeParameter("FormatType", aType, formatCount); + + aUsage = currNodeAttr -> getValueByName("usage"); + of.writeParameter("FormatUsage", aUsage, formatCount); + + aFormatIndex = currNodeAttr -> getValueByName("formatindex"); + sal_Int16 formatindex = (sal_Int16)aFormatIndex.toInt32(); + if (!aFormatIndexSet.insert( formatindex).second) incErrorInt( "Duplicated formatindex=\"%d\" in FormatElement.", formatindex); of.writeIntParameter("Formatindex", formatCount, formatindex); + // Ensure only one default per usage and type. + if (bDefault) + { + OUString aKey( aUsage + OUString( sal_Unicode(',')) + aType); + if (!aDefaultsSet.insert( aKey).second) + { + OUString aStr( RTL_CONSTASCII_USTRINGPARAM( "Duplicated default for usage=\"")); + aStr += aUsage; + aStr += OUString( RTL_CONSTASCII_USTRINGPARAM( "\" type=\"")); + aStr += aType; + aStr += OUString( RTL_CONSTASCII_USTRINGPARAM( "\": formatindex=\"")); + aStr += aFormatIndex; + aStr += OUString( RTL_CONSTASCII_USTRINGPARAM( "\".")); + incError( aStr); + } + } + const LocaleNode * n = currNode -> findNode("FormatCode"); if (n) { @@ -712,14 +748,14 @@ void LCFormatNode::generateCode (const OFileWriter &of) const if (mnSection == 0) { // 0..47 MUST be present, 48,49 MUST NOT be present - ValueSet::const_iterator aIter( aFormatIndex.begin()); + ValueSet::const_iterator aIter( aFormatIndexSet.begin()); for (sal_Int16 nNext = cssi::NumberFormatIndex::NUMBER_START; nNext < cssi::NumberFormatIndex::INDEX_TABLE_ENTRIES; ++nNext) { - sal_Int16 nHere = ::std::min( ((aIter != aFormatIndex.end() ? *aIter : + sal_Int16 nHere = ::std::min( ((aIter != aFormatIndexSet.end() ? *aIter : cssi::NumberFormatIndex::INDEX_TABLE_ENTRIES)), cssi::NumberFormatIndex::INDEX_TABLE_ENTRIES); - if (aIter != aFormatIndex.end()) ++aIter; + if (aIter != aFormatIndexSet.end()) ++aIter; for ( ; nNext < nHere; ++nNext) { switch (nNext) @@ -1415,6 +1451,8 @@ void LCMiscNode::generateCode (const OFileWriter &of) const const LocaleNode * forbidNode = findNode("ForbiddenCharacters"); const LocaleNode * breakNode = findNode("BreakIteratorRules"); + bool bEnglishLocale = (strncmp( of.getLocale(), "en_", 3) == 0); + sal_Int16 nbOfWords = 0; ::rtl::OUString str; sal_Int16 i; @@ -1433,6 +1471,14 @@ void LCMiscNode::generateCode (const OFileWriter &of) const fprintf( stderr, "Error: No content for ReservedWords %s.\n", ReserveWord[i].name); } of.writeParameter("ReservedWord", str, nbOfWords); + // "true", ..., "below" trigger untranslated warning. + if (!bEnglishLocale && curNode && (0 <= i && i <= 7) && + str.equalsIgnoreAsciiCaseAscii( ReserveWord[i].value)) + { + fprintf( stderr, + "Warning: ReservedWord %s seems to be untranslated \"%s\".\n", + ReserveWord[i].name, ReserveWord[i].value); + } } of.writeAsciiString("static const sal_Int16 nbOfReservedWords = "); of.writeInt(nbOfWords); diff --git a/i18npool/source/localedata/LocaleNode.hxx b/i18npool/source/localedata/LocaleNode.hxx index fd1806610236..30935bf7097d 100644 --- a/i18npool/source/localedata/LocaleNode.hxx +++ b/i18npool/source/localedata/LocaleNode.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: LocaleNode.hxx,v $ - * $Revision: 1.14.22.1 $ + * $Revision: 1.14.24.1 $ * * This file is part of OpenOffice.org. * @@ -148,6 +148,8 @@ public: OUString writeParameterCheckLen( const OFileWriter &of, const char* pNodeName, const char* pParameterName, sal_Int32 nMinLen, sal_Int32 nMaxLen ) const; // ++nError with output to stderr void incError( const char* pStr ) const; + // ++nError with output to stderr + void incError( const ::rtl::OUString& rStr ) const; // ++nError with output to stderr, pStr should contain "%d", otherwise appended void incErrorInt( const char* pStr, int nVal ) const; // ++nError with output to stderr, pStr should contain "%s", otherwise appended diff --git a/i18npool/source/localedata/data/it_IT.xml b/i18npool/source/localedata/data/it_IT.xml index de03f51ac423..1f5c7d6fd89d 100644 --- a/i18npool/source/localedata/data/it_IT.xml +++ b/i18npool/source/localedata/data/it_IT.xml @@ -332,16 +332,16 @@ <ReservedWords> <trueWord>vero</trueWord> <falseWord>falso</falseWord> - <quarter1Word>1. quarto</quarter1Word> - <quarter2Word>2. quarto</quarter2Word> - <quarter3Word>3. quarto</quarter3Word> - <quarter4Word>4. quarto</quarter4Word> + <quarter1Word>1o trimestre</quarter1Word> + <quarter2Word>2o trimestre</quarter2Word> + <quarter3Word>3o trimestre</quarter3Word> + <quarter4Word>4o trimestre</quarter4Word> <aboveWord>sopra</aboveWord> <belowWord>sotto</belowWord> - <quarter1Abbreviation>Q1</quarter1Abbreviation> - <quarter2Abbreviation>Q2</quarter2Abbreviation> - <quarter3Abbreviation>Q3</quarter3Abbreviation> - <quarter4Abbreviation>Q4</quarter4Abbreviation> + <quarter1Abbreviation>T1</quarter1Abbreviation> + <quarter2Abbreviation>T2</quarter2Abbreviation> + <quarter3Abbreviation>T3</quarter3Abbreviation> + <quarter4Abbreviation>T4</quarter4Abbreviation> </ReservedWords> </LC_MISC> <LC_NumberingLevel ref="en_US"/> diff --git a/i18npool/source/localedata/data/locale.dtd b/i18npool/source/localedata/data/locale.dtd index 5e9f82dc36d2..7d58023a064a 100644 --- a/i18npool/source/localedata/data/locale.dtd +++ b/i18npool/source/localedata/data/locale.dtd @@ -179,9 +179,18 @@ we received got that right, especially not in date formats! For easier comparison between locales in future please sort the - FormatElements by their formatindex="..." value. This isn't necessary - to be technically correct and isn't done in many locales yet, but will - certainly help. + FormatElements by their formatindex="..." value within a usage group. + This isn't necessary to be technically correct and isn't done in many + locales yet, but will certainly help. + + Of usage="FIXED_NUMBER": + formatindex="0" MUST be the format containing the 'General' keyword. + The keyword itself may be localized, it is good practice though to + stick with a wording known from another spreadsheet application for + better user experience. Like other format codes it may be prepended + with a [NatNum1] modifier if values are to be displayed using native + numbering if no specific format was applied. The format must have the + default="true" and type="medium" attributes. Of usage="DATE": formatindex="21" is used to edit already existing date data. In order diff --git a/i18npool/source/localedata/data/localedata_euro.map b/i18npool/source/localedata/data/localedata_euro.map index 5f8e8ac35569..9b46fd2adfa5 100644 --- a/i18npool/source/localedata/data/localedata_euro.map +++ b/i18npool/source/localedata/data/localedata_euro.map @@ -41,6 +41,7 @@ getAllCalendars_lb_LU; getAllCalendars_lt_LT; getAllCalendars_lv_LV; getAllCalendars_mk_MK; +getAllCalendars_mt_MT; getAllCalendars_nb_NO; getAllCalendars_nl_BE; getAllCalendars_nl_NL; @@ -105,6 +106,7 @@ getAllCurrencies_lb_LU; getAllCurrencies_lt_LT; getAllCurrencies_lv_LV; getAllCurrencies_mk_MK; +getAllCurrencies_mt_MT; getAllCurrencies_nb_NO; getAllCurrencies_nl_BE; getAllCurrencies_nl_NL; @@ -169,6 +171,7 @@ getAllFormats0_lb_LU; getAllFormats0_lt_LT; getAllFormats0_lv_LV; getAllFormats0_mk_MK; +getAllFormats0_mt_MT; getAllFormats0_nb_NO; getAllFormats0_nl_BE; getAllFormats0_nl_NL; @@ -233,6 +236,7 @@ getBreakIteratorRules_lb_LU; getBreakIteratorRules_lt_LT; getBreakIteratorRules_lv_LV; getBreakIteratorRules_mk_MK; +getBreakIteratorRules_mt_MT; getBreakIteratorRules_nb_NO; getBreakIteratorRules_nl_BE; getBreakIteratorRules_nl_NL; @@ -297,6 +301,7 @@ getCollationOptions_lb_LU; getCollationOptions_lt_LT; getCollationOptions_lv_LV; getCollationOptions_mk_MK; +getCollationOptions_mt_MT; getCollationOptions_nb_NO; getCollationOptions_nl_BE; getCollationOptions_nl_NL; @@ -361,6 +366,7 @@ getCollatorImplementation_lb_LU; getCollatorImplementation_lt_LT; getCollatorImplementation_lv_LV; getCollatorImplementation_mk_MK; +getCollatorImplementation_mt_MT; getCollatorImplementation_nb_NO; getCollatorImplementation_nl_BE; getCollatorImplementation_nl_NL; @@ -425,6 +431,7 @@ getContinuousNumberingLevels_lb_LU; getContinuousNumberingLevels_lt_LT; getContinuousNumberingLevels_lv_LV; getContinuousNumberingLevels_mk_MK; +getContinuousNumberingLevels_mt_MT; getContinuousNumberingLevels_nb_NO; getContinuousNumberingLevels_nl_BE; getContinuousNumberingLevels_nl_NL; @@ -489,6 +496,7 @@ getFollowPageWords_lb_LU; getFollowPageWords_lt_LT; getFollowPageWords_lv_LV; getFollowPageWords_mk_MK; +getFollowPageWords_mt_MT; getFollowPageWords_nb_NO; getFollowPageWords_nl_BE; getFollowPageWords_nl_NL; @@ -553,6 +561,7 @@ getForbiddenCharacters_lb_LU; getForbiddenCharacters_lt_LT; getForbiddenCharacters_lv_LV; getForbiddenCharacters_mk_MK; +getForbiddenCharacters_mt_MT; getForbiddenCharacters_nb_NO; getForbiddenCharacters_nl_BE; getForbiddenCharacters_nl_NL; @@ -617,6 +626,7 @@ getIndexAlgorithm_lb_LU; getIndexAlgorithm_lt_LT; getIndexAlgorithm_lv_LV; getIndexAlgorithm_mk_MK; +getIndexAlgorithm_mt_MT; getIndexAlgorithm_nb_NO; getIndexAlgorithm_nl_BE; getIndexAlgorithm_nl_NL; @@ -681,6 +691,7 @@ getLCInfo_lb_LU; getLCInfo_lt_LT; getLCInfo_lv_LV; getLCInfo_mk_MK; +getLCInfo_mt_MT; getLCInfo_nb_NO; getLCInfo_nl_BE; getLCInfo_nl_NL; @@ -745,6 +756,7 @@ getLocaleItem_lb_LU; getLocaleItem_lt_LT; getLocaleItem_lv_LV; getLocaleItem_mk_MK; +getLocaleItem_mt_MT; getLocaleItem_nb_NO; getLocaleItem_nl_BE; getLocaleItem_nl_NL; @@ -809,6 +821,7 @@ getOutlineNumberingLevels_lb_LU; getOutlineNumberingLevels_lt_LT; getOutlineNumberingLevels_lv_LV; getOutlineNumberingLevels_mk_MK; +getOutlineNumberingLevels_mt_MT; getOutlineNumberingLevels_nb_NO; getOutlineNumberingLevels_nl_BE; getOutlineNumberingLevels_nl_NL; @@ -873,6 +886,7 @@ getReservedWords_lb_LU; getReservedWords_lt_LT; getReservedWords_lv_LV; getReservedWords_mk_MK; +getReservedWords_mt_MT; getReservedWords_nb_NO; getReservedWords_nl_BE; getReservedWords_nl_NL; @@ -937,6 +951,7 @@ getSearchOptions_lb_LU; getSearchOptions_lt_LT; getSearchOptions_lv_LV; getSearchOptions_mk_MK; +getSearchOptions_mt_MT; getSearchOptions_nb_NO; getSearchOptions_nl_BE; getSearchOptions_nl_NL; @@ -1001,6 +1016,7 @@ getTransliterations_lb_LU; getTransliterations_lt_LT; getTransliterations_lv_LV; getTransliterations_mk_MK; +getTransliterations_mt_MT; getTransliterations_nb_NO; getTransliterations_nl_BE; getTransliterations_nl_NL; @@ -1065,6 +1081,7 @@ getUnicodeScripts_lb_LU; getUnicodeScripts_lt_LT; getUnicodeScripts_lv_LV; getUnicodeScripts_mk_MK; +getUnicodeScripts_mt_MT; getUnicodeScripts_nb_NO; getUnicodeScripts_nl_BE; getUnicodeScripts_nl_NL; diff --git a/i18npool/source/localedata/data/localedata_others.map b/i18npool/source/localedata/data/localedata_others.map index 5d1105bb3563..5e32d8bb4a1b 100644 --- a/i18npool/source/localedata/data/localedata_others.map +++ b/i18npool/source/localedata/data/localedata_others.map @@ -40,6 +40,7 @@ getAllCalendars_ml_IN; getAllCalendars_mn_MN; getAllCalendars_mr_IN; getAllCalendars_ms_MY; +getAllCalendars_my_MM; getAllCalendars_ne_NP; getAllCalendars_nr_ZA; getAllCalendars_nso_ZA; @@ -47,6 +48,7 @@ getAllCalendars_or_IN; getAllCalendars_pa_IN; getAllCalendars_rw_RW; getAllCalendars_sg_CF; +getAllCalendars_shs_CA; getAllCalendars_so_SO; getAllCalendars_ss_ZA; getAllCalendars_st_ZA; @@ -58,6 +60,7 @@ getAllCalendars_th_TH; getAllCalendars_ti_ER; getAllCalendars_tk_TM; getAllCalendars_tn_ZA; +getAllCalendars_tpi_PG; getAllCalendars_ts_ZA; getAllCalendars_uz_UZ; getAllCalendars_ve_ZA; @@ -109,6 +112,7 @@ getAllCurrencies_ml_IN; getAllCurrencies_mn_MN; getAllCurrencies_mr_IN; getAllCurrencies_ms_MY; +getAllCurrencies_my_MM; getAllCurrencies_ne_NP; getAllCurrencies_nr_ZA; getAllCurrencies_nso_ZA; @@ -116,6 +120,7 @@ getAllCurrencies_or_IN; getAllCurrencies_pa_IN; getAllCurrencies_rw_RW; getAllCurrencies_sg_CF; +getAllCurrencies_shs_CA; getAllCurrencies_so_SO; getAllCurrencies_ss_ZA; getAllCurrencies_st_ZA; @@ -127,6 +132,7 @@ getAllCurrencies_th_TH; getAllCurrencies_ti_ER; getAllCurrencies_tk_TM; getAllCurrencies_tn_ZA; +getAllCurrencies_tpi_PG; getAllCurrencies_ts_ZA; getAllCurrencies_uz_UZ; getAllCurrencies_ve_ZA; @@ -178,6 +184,7 @@ getAllFormats0_ml_IN; getAllFormats0_mn_MN; getAllFormats0_mr_IN; getAllFormats0_ms_MY; +getAllFormats0_my_MM; getAllFormats0_ne_NP; getAllFormats0_nr_ZA; getAllFormats0_nso_ZA; @@ -185,6 +192,7 @@ getAllFormats0_or_IN; getAllFormats0_pa_IN; getAllFormats0_rw_RW; getAllFormats0_sg_CF; +getAllFormats0_shs_CA; getAllFormats0_so_SO; getAllFormats0_ss_ZA; getAllFormats0_st_ZA; @@ -196,6 +204,7 @@ getAllFormats0_th_TH; getAllFormats0_ti_ER; getAllFormats0_tk_TM; getAllFormats0_tn_ZA; +getAllFormats0_tpi_PG; getAllFormats0_ts_ZA; getAllFormats0_uz_UZ; getAllFormats0_ve_ZA; @@ -247,6 +256,7 @@ getBreakIteratorRules_ml_IN; getBreakIteratorRules_mn_MN; getBreakIteratorRules_mr_IN; getBreakIteratorRules_ms_MY; +getBreakIteratorRules_my_MM; getBreakIteratorRules_ne_NP; getBreakIteratorRules_nr_ZA; getBreakIteratorRules_nso_ZA; @@ -254,6 +264,7 @@ getBreakIteratorRules_or_IN; getBreakIteratorRules_pa_IN; getBreakIteratorRules_rw_RW; getBreakIteratorRules_sg_CF; +getBreakIteratorRules_shs_CA; getBreakIteratorRules_so_SO; getBreakIteratorRules_ss_ZA; getBreakIteratorRules_st_ZA; @@ -265,6 +276,7 @@ getBreakIteratorRules_th_TH; getBreakIteratorRules_ti_ER; getBreakIteratorRules_tk_TM; getBreakIteratorRules_tn_ZA; +getBreakIteratorRules_tpi_PG; getBreakIteratorRules_ts_ZA; getBreakIteratorRules_uz_UZ; getBreakIteratorRules_ve_ZA; @@ -316,6 +328,7 @@ getCollationOptions_ml_IN; getCollationOptions_mn_MN; getCollationOptions_mr_IN; getCollationOptions_ms_MY; +getCollationOptions_my_MM; getCollationOptions_ne_NP; getCollationOptions_nr_ZA; getCollationOptions_nso_ZA; @@ -323,6 +336,7 @@ getCollationOptions_or_IN; getCollationOptions_pa_IN; getCollationOptions_rw_RW; getCollationOptions_sg_CF; +getCollationOptions_shs_CA; getCollationOptions_so_SO; getCollationOptions_ss_ZA; getCollationOptions_st_ZA; @@ -334,6 +348,7 @@ getCollationOptions_th_TH; getCollationOptions_ti_ER; getCollationOptions_tk_TM; getCollationOptions_tn_ZA; +getCollationOptions_tpi_PG; getCollationOptions_ts_ZA; getCollationOptions_uz_UZ; getCollationOptions_ve_ZA; @@ -385,6 +400,7 @@ getCollatorImplementation_ml_IN; getCollatorImplementation_mn_MN; getCollatorImplementation_mr_IN; getCollatorImplementation_ms_MY; +getCollatorImplementation_my_MM; getCollatorImplementation_ne_NP; getCollatorImplementation_nr_ZA; getCollatorImplementation_nso_ZA; @@ -392,6 +408,7 @@ getCollatorImplementation_or_IN; getCollatorImplementation_pa_IN; getCollatorImplementation_rw_RW; getCollatorImplementation_sg_CF; +getCollatorImplementation_shs_CA; getCollatorImplementation_so_SO; getCollatorImplementation_ss_ZA; getCollatorImplementation_st_ZA; @@ -403,6 +420,7 @@ getCollatorImplementation_th_TH; getCollatorImplementation_ti_ER; getCollatorImplementation_tk_TM; getCollatorImplementation_tn_ZA; +getCollatorImplementation_tpi_PG; getCollatorImplementation_ts_ZA; getCollatorImplementation_uz_UZ; getCollatorImplementation_ve_ZA; @@ -454,6 +472,7 @@ getContinuousNumberingLevels_ml_IN; getContinuousNumberingLevels_mn_MN; getContinuousNumberingLevels_mr_IN; getContinuousNumberingLevels_ms_MY; +getContinuousNumberingLevels_my_MM; getContinuousNumberingLevels_ne_NP; getContinuousNumberingLevels_nr_ZA; getContinuousNumberingLevels_nso_ZA; @@ -461,6 +480,7 @@ getContinuousNumberingLevels_or_IN; getContinuousNumberingLevels_pa_IN; getContinuousNumberingLevels_rw_RW; getContinuousNumberingLevels_sg_CF; +getContinuousNumberingLevels_shs_CA; getContinuousNumberingLevels_so_SO; getContinuousNumberingLevels_ss_ZA; getContinuousNumberingLevels_st_ZA; @@ -472,6 +492,7 @@ getContinuousNumberingLevels_th_TH; getContinuousNumberingLevels_ti_ER; getContinuousNumberingLevels_tk_TM; getContinuousNumberingLevels_tn_ZA; +getContinuousNumberingLevels_tpi_PG; getContinuousNumberingLevels_ts_ZA; getContinuousNumberingLevels_uz_UZ; getContinuousNumberingLevels_ve_ZA; @@ -523,6 +544,7 @@ getFollowPageWords_ml_IN; getFollowPageWords_mn_MN; getFollowPageWords_mr_IN; getFollowPageWords_ms_MY; +getFollowPageWords_my_MM; getFollowPageWords_ne_NP; getFollowPageWords_nr_ZA; getFollowPageWords_nso_ZA; @@ -530,6 +552,7 @@ getFollowPageWords_or_IN; getFollowPageWords_pa_IN; getFollowPageWords_rw_RW; getFollowPageWords_sg_CF; +getFollowPageWords_shs_CA; getFollowPageWords_so_SO; getFollowPageWords_ss_ZA; getFollowPageWords_st_ZA; @@ -541,6 +564,7 @@ getFollowPageWords_th_TH; getFollowPageWords_ti_ER; getFollowPageWords_tk_TM; getFollowPageWords_tn_ZA; +getFollowPageWords_tpi_PG; getFollowPageWords_ts_ZA; getFollowPageWords_uz_UZ; getFollowPageWords_ve_ZA; @@ -592,6 +616,7 @@ getForbiddenCharacters_ml_IN; getForbiddenCharacters_mn_MN; getForbiddenCharacters_mr_IN; getForbiddenCharacters_ms_MY; +getForbiddenCharacters_my_MM; getForbiddenCharacters_ne_NP; getForbiddenCharacters_nr_ZA; getForbiddenCharacters_nso_ZA; @@ -599,6 +624,7 @@ getForbiddenCharacters_or_IN; getForbiddenCharacters_pa_IN; getForbiddenCharacters_rw_RW; getForbiddenCharacters_sg_CF; +getForbiddenCharacters_shs_CA; getForbiddenCharacters_so_SO; getForbiddenCharacters_ss_ZA; getForbiddenCharacters_st_ZA; @@ -610,6 +636,7 @@ getForbiddenCharacters_th_TH; getForbiddenCharacters_ti_ER; getForbiddenCharacters_tk_TM; getForbiddenCharacters_tn_ZA; +getForbiddenCharacters_tpi_PG; getForbiddenCharacters_ts_ZA; getForbiddenCharacters_uz_UZ; getForbiddenCharacters_ve_ZA; @@ -661,6 +688,7 @@ getIndexAlgorithm_ml_IN; getIndexAlgorithm_mn_MN; getIndexAlgorithm_mr_IN; getIndexAlgorithm_ms_MY; +getIndexAlgorithm_my_MM; getIndexAlgorithm_ne_NP; getIndexAlgorithm_nr_ZA; getIndexAlgorithm_nso_ZA; @@ -668,6 +696,7 @@ getIndexAlgorithm_or_IN; getIndexAlgorithm_pa_IN; getIndexAlgorithm_rw_RW; getIndexAlgorithm_sg_CF; +getIndexAlgorithm_shs_CA; getIndexAlgorithm_so_SO; getIndexAlgorithm_ss_ZA; getIndexAlgorithm_st_ZA; @@ -679,6 +708,7 @@ getIndexAlgorithm_th_TH; getIndexAlgorithm_ti_ER; getIndexAlgorithm_tk_TM; getIndexAlgorithm_tn_ZA; +getIndexAlgorithm_tpi_PG; getIndexAlgorithm_ts_ZA; getIndexAlgorithm_uz_UZ; getIndexAlgorithm_ve_ZA; @@ -730,6 +760,7 @@ getLCInfo_ml_IN; getLCInfo_mn_MN; getLCInfo_mr_IN; getLCInfo_ms_MY; +getLCInfo_my_MM; getLCInfo_ne_NP; getLCInfo_nr_ZA; getLCInfo_nso_ZA; @@ -737,6 +768,7 @@ getLCInfo_or_IN; getLCInfo_pa_IN; getLCInfo_rw_RW; getLCInfo_sg_CF; +getLCInfo_shs_CA; getLCInfo_so_SO; getLCInfo_ss_ZA; getLCInfo_st_ZA; @@ -748,6 +780,7 @@ getLCInfo_th_TH; getLCInfo_ti_ER; getLCInfo_tk_TM; getLCInfo_tn_ZA; +getLCInfo_tpi_PG; getLCInfo_ts_ZA; getLCInfo_uz_UZ; getLCInfo_ve_ZA; @@ -799,6 +832,7 @@ getLocaleItem_ml_IN; getLocaleItem_mn_MN; getLocaleItem_mr_IN; getLocaleItem_ms_MY; +getLocaleItem_my_MM; getLocaleItem_ne_NP; getLocaleItem_nr_ZA; getLocaleItem_nso_ZA; @@ -806,6 +840,7 @@ getLocaleItem_or_IN; getLocaleItem_pa_IN; getLocaleItem_rw_RW; getLocaleItem_sg_CF; +getLocaleItem_shs_CA; getLocaleItem_so_SO; getLocaleItem_ss_ZA; getLocaleItem_st_ZA; @@ -817,6 +852,7 @@ getLocaleItem_th_TH; getLocaleItem_ti_ER; getLocaleItem_tk_TM; getLocaleItem_tn_ZA; +getLocaleItem_tpi_PG; getLocaleItem_ts_ZA; getLocaleItem_uz_UZ; getLocaleItem_ve_ZA; @@ -868,6 +904,7 @@ getOutlineNumberingLevels_ml_IN; getOutlineNumberingLevels_mn_MN; getOutlineNumberingLevels_mr_IN; getOutlineNumberingLevels_ms_MY; +getOutlineNumberingLevels_my_MM; getOutlineNumberingLevels_ne_NP; getOutlineNumberingLevels_nr_ZA; getOutlineNumberingLevels_nso_ZA; @@ -875,6 +912,7 @@ getOutlineNumberingLevels_or_IN; getOutlineNumberingLevels_pa_IN; getOutlineNumberingLevels_rw_RW; getOutlineNumberingLevels_sg_CF; +getOutlineNumberingLevels_shs_CA; getOutlineNumberingLevels_so_SO; getOutlineNumberingLevels_ss_ZA; getOutlineNumberingLevels_st_ZA; @@ -886,6 +924,7 @@ getOutlineNumberingLevels_th_TH; getOutlineNumberingLevels_ti_ER; getOutlineNumberingLevels_tk_TM; getOutlineNumberingLevels_tn_ZA; +getOutlineNumberingLevels_tpi_PG; getOutlineNumberingLevels_ts_ZA; getOutlineNumberingLevels_uz_UZ; getOutlineNumberingLevels_ve_ZA; @@ -937,6 +976,7 @@ getReservedWords_ml_IN; getReservedWords_mn_MN; getReservedWords_mr_IN; getReservedWords_ms_MY; +getReservedWords_my_MM; getReservedWords_ne_NP; getReservedWords_nr_ZA; getReservedWords_nso_ZA; @@ -944,6 +984,7 @@ getReservedWords_or_IN; getReservedWords_pa_IN; getReservedWords_rw_RW; getReservedWords_sg_CF; +getReservedWords_shs_CA; getReservedWords_so_SO; getReservedWords_ss_ZA; getReservedWords_st_ZA; @@ -955,6 +996,7 @@ getReservedWords_th_TH; getReservedWords_ti_ER; getReservedWords_tk_TM; getReservedWords_tn_ZA; +getReservedWords_tpi_PG; getReservedWords_ts_ZA; getReservedWords_uz_UZ; getReservedWords_ve_ZA; @@ -1006,6 +1048,7 @@ getSearchOptions_ml_IN; getSearchOptions_mn_MN; getSearchOptions_mr_IN; getSearchOptions_ms_MY; +getSearchOptions_my_MM; getSearchOptions_ne_NP; getSearchOptions_nr_ZA; getSearchOptions_nso_ZA; @@ -1013,6 +1056,7 @@ getSearchOptions_or_IN; getSearchOptions_pa_IN; getSearchOptions_rw_RW; getSearchOptions_sg_CF; +getSearchOptions_shs_CA; getSearchOptions_so_SO; getSearchOptions_ss_ZA; getSearchOptions_st_ZA; @@ -1024,6 +1068,7 @@ getSearchOptions_th_TH; getSearchOptions_ti_ER; getSearchOptions_tk_TM; getSearchOptions_tn_ZA; +getSearchOptions_tpi_PG; getSearchOptions_ts_ZA; getSearchOptions_uz_UZ; getSearchOptions_ve_ZA; @@ -1075,6 +1120,7 @@ getTransliterations_ml_IN; getTransliterations_mn_MN; getTransliterations_mr_IN; getTransliterations_ms_MY; +getTransliterations_my_MM; getTransliterations_ne_NP; getTransliterations_nr_ZA; getTransliterations_nso_ZA; @@ -1082,6 +1128,7 @@ getTransliterations_or_IN; getTransliterations_pa_IN; getTransliterations_rw_RW; getTransliterations_sg_CF; +getTransliterations_shs_CA; getTransliterations_so_SO; getTransliterations_ss_ZA; getTransliterations_st_ZA; @@ -1093,6 +1140,7 @@ getTransliterations_th_TH; getTransliterations_ti_ER; getTransliterations_tk_TM; getTransliterations_tn_ZA; +getTransliterations_tpi_PG; getTransliterations_ts_ZA; getTransliterations_uz_UZ; getTransliterations_ve_ZA; @@ -1144,6 +1192,7 @@ getUnicodeScripts_ml_IN; getUnicodeScripts_mn_MN; getUnicodeScripts_mr_IN; getUnicodeScripts_ms_MY; +getUnicodeScripts_my_MM; getUnicodeScripts_ne_NP; getUnicodeScripts_nr_ZA; getUnicodeScripts_nso_ZA; @@ -1151,6 +1200,7 @@ getUnicodeScripts_or_IN; getUnicodeScripts_pa_IN; getUnicodeScripts_rw_RW; getUnicodeScripts_sg_CF; +getUnicodeScripts_shs_CA; getUnicodeScripts_so_SO; getUnicodeScripts_ss_ZA; getUnicodeScripts_st_ZA; @@ -1162,6 +1212,7 @@ getUnicodeScripts_th_TH; getUnicodeScripts_ti_ER; getUnicodeScripts_tk_TM; getUnicodeScripts_tn_ZA; +getUnicodeScripts_tpi_PG; getUnicodeScripts_ts_ZA; getUnicodeScripts_uz_UZ; getUnicodeScripts_ve_ZA; diff --git a/i18npool/source/localedata/data/makefile.mk b/i18npool/source/localedata/data/makefile.mk index f59a16617d8f..b288275a386e 100644 --- a/i18npool/source/localedata/data/makefile.mk +++ b/i18npool/source/localedata/data/makefile.mk @@ -8,7 +8,7 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.47 $ +# $Revision: 1.47.24.4 $ # # This file is part of OpenOffice.org. # @@ -182,6 +182,8 @@ MY_MISC_CXXFILES = \ $(MISC)$/localedata_mn_MN.cxx \ $(MISC)$/localedata_mr_IN.cxx \ $(MISC)$/localedata_ms_MY.cxx \ + $(MISC)$/localedata_mt_MT.cxx \ + $(MISC)$/localedata_my_MM.cxx \ $(MISC)$/localedata_nb_NO.cxx \ $(MISC)$/localedata_ne_NP.cxx \ $(MISC)$/localedata_nl_BE.cxx \ @@ -203,6 +205,7 @@ MY_MISC_CXXFILES = \ $(MISC)$/localedata_sh_ME.cxx \ $(MISC)$/localedata_sh_RS.cxx \ $(MISC)$/localedata_sh_YU.cxx \ + $(MISC)$/localedata_shs_CA.cxx \ $(MISC)$/localedata_sk_SK.cxx \ $(MISC)$/localedata_sl_SI.cxx \ $(MISC)$/localedata_so_SO.cxx \ @@ -221,6 +224,7 @@ MY_MISC_CXXFILES = \ $(MISC)$/localedata_ti_ER.cxx \ $(MISC)$/localedata_tk_TM.cxx \ $(MISC)$/localedata_tn_ZA.cxx \ + $(MISC)$/localedata_tpi_PG.cxx \ $(MISC)$/localedata_tr_TR.cxx \ $(MISC)$/localedata_ts_ZA.cxx \ $(MISC)$/localedata_uk_UA.cxx \ @@ -359,6 +363,7 @@ SHL3OBJS= \ $(SLO)$/localedata_lt_LT.obj \ $(SLO)$/localedata_lv_LV.obj \ $(SLO)$/localedata_mk_MK.obj \ + $(SLO)$/localedata_mt_MT.obj \ $(SLO)$/localedata_nb_NO.obj \ $(SLO)$/localedata_nl_BE.obj \ $(SLO)$/localedata_nl_NL.obj \ @@ -441,6 +446,7 @@ SHL4OBJS= \ $(SLO)$/localedata_mn_MN.obj \ $(SLO)$/localedata_mr_IN.obj \ $(SLO)$/localedata_ms_MY.obj \ + $(SLO)$/localedata_my_MM.obj \ $(SLO)$/localedata_ne_NP.obj \ $(SLO)$/localedata_nr_ZA.obj \ $(SLO)$/localedata_nso_ZA.obj \ @@ -448,6 +454,7 @@ SHL4OBJS= \ $(SLO)$/localedata_pa_IN.obj \ $(SLO)$/localedata_rw_RW.obj \ $(SLO)$/localedata_sg_CF.obj \ + $(SLO)$/localedata_shs_CA.obj \ $(SLO)$/localedata_so_SO.obj \ $(SLO)$/localedata_ss_ZA.obj \ $(SLO)$/localedata_st_ZA.obj \ @@ -459,6 +466,7 @@ SHL4OBJS= \ $(SLO)$/localedata_ti_ER.obj \ $(SLO)$/localedata_tk_TM.obj \ $(SLO)$/localedata_tn_ZA.obj \ + $(SLO)$/localedata_tpi_PG.obj \ $(SLO)$/localedata_ts_ZA.obj \ $(SLO)$/localedata_uz_UZ.obj \ $(SLO)$/localedata_ve_ZA.obj \ diff --git a/i18npool/source/localedata/data/mt_MT.xml b/i18npool/source/localedata/data/mt_MT.xml new file mode 100644 index 000000000000..790bd97303e0 --- /dev/null +++ b/i18npool/source/localedata/data/mt_MT.xml @@ -0,0 +1,359 @@ +<?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>mt</LangID> + <DefaultName>Maltese</DefaultName> + </Language> + <Country> + <CountryID>MT</CountryID> + <DefaultName>Malta</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>QN</TimeAM> + <TimePM>WN</TimePM> + <MeasurementSystem>metric</MeasurementSystem> + </LC_CTYPE> + <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$€-043A]"> + <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-Z À È Ì Ò Ù Ċ Ġ Ħ Ż</IndexKey> + <UnicodeScript>0</UnicodeScript> + <UnicodeScript>1</UnicodeScript> + <UnicodeScript>2</UnicodeScript> + <FollowPageWord>sing.</FollowPageWord> + <FollowPageWord>pl.</FollowPageWord> + </LC_INDEX> + <LC_CALENDAR> + <Calendar unoid="gregorian" default="true"> + <DaysOfWeek> + <Day> + <DayID>sun</DayID> + <DefaultAbbrvName>Ħad</DefaultAbbrvName> + <DefaultFullName>Il-Ħadd</DefaultFullName> + </Day> + <Day> + <DayID>mon</DayID> + <DefaultAbbrvName>Tne</DefaultAbbrvName> + <DefaultFullName>It-Tnejn</DefaultFullName> + </Day> + <Day> + <DayID>tue</DayID> + <DefaultAbbrvName>Tli</DefaultAbbrvName> + <DefaultFullName>It-Tlieta</DefaultFullName> + </Day> + <Day> + <DayID>wed</DayID> + <DefaultAbbrvName>Erb</DefaultAbbrvName> + <DefaultFullName>L-Erbgħa</DefaultFullName> + </Day> + <Day> + <DayID>thu</DayID> + <DefaultAbbrvName>Ħam</DefaultAbbrvName> + <DefaultFullName>Il-Ħamis</DefaultFullName> + </Day> + <Day> + <DayID>fri</DayID> + <DefaultAbbrvName>Ġim</DefaultAbbrvName> + <DefaultFullName>Il-Ġimgħa</DefaultFullName> + </Day> + <Day> + <DayID>sat</DayID> + <DefaultAbbrvName>Sib</DefaultAbbrvName> + <DefaultFullName>Is-Sibt</DefaultFullName> + </Day> + </DaysOfWeek> + <MonthsOfYear> + <Month> + <MonthID>jan</MonthID> + <DefaultAbbrvName>Jan</DefaultAbbrvName> + <DefaultFullName>Jannar</DefaultFullName> + </Month> + <Month> + <MonthID>feb</MonthID> + <DefaultAbbrvName>Fra</DefaultAbbrvName> + <DefaultFullName>Frar</DefaultFullName> + </Month> + <Month> + <MonthID>mar</MonthID> + <DefaultAbbrvName>Mar</DefaultAbbrvName> + <DefaultFullName>Marzu</DefaultFullName> + </Month> + <Month> + <MonthID>apr</MonthID> + <DefaultAbbrvName>Apr</DefaultAbbrvName> + <DefaultFullName>April</DefaultFullName> + </Month> + <Month> + <MonthID>may</MonthID> + <DefaultAbbrvName>Mej</DefaultAbbrvName> + <DefaultFullName>Mejju</DefaultFullName> + </Month> + <Month> + <MonthID>jun</MonthID> + <DefaultAbbrvName>Ġun</DefaultAbbrvName> + <DefaultFullName>Ġunju</DefaultFullName> + </Month> + <Month> + <MonthID>jul</MonthID> + <DefaultAbbrvName>Lul</DefaultAbbrvName> + <DefaultFullName>Lulju</DefaultFullName> + </Month> + <Month> + <MonthID>aug</MonthID> + <DefaultAbbrvName>Aww</DefaultAbbrvName> + <DefaultFullName>Awwissu</DefaultFullName> + </Month> + <Month> + <MonthID>sep</MonthID> + <DefaultAbbrvName>Set</DefaultAbbrvName> + <DefaultFullName>Settembru</DefaultFullName> + </Month> + <Month> + <MonthID>oct</MonthID> + <DefaultAbbrvName>Ott</DefaultAbbrvName> + <DefaultFullName>Ottubru</DefaultFullName> + </Month> + <Month> + <MonthID>nov</MonthID> + <DefaultAbbrvName>Nov</DefaultAbbrvName> + <DefaultFullName>Novembru</DefaultFullName> + </Month> + <Month> + <MonthID>dec</MonthID> + <DefaultAbbrvName>Diċ</DefaultAbbrvName> + <DefaultFullName>Diċembru</DefaultFullName> + </Month> + </MonthsOfYear> + <Eras> + <Era> + <EraID>bc</EraID> + <DefaultAbbrvName>qK</DefaultAbbrvName> + <DefaultFullName>Qabel Kristu</DefaultFullName> + </Era> + <Era> + <EraID>ad</EraID> + <DefaultAbbrvName>wK</DefaultAbbrvName> + <DefaultFullName>Wara Kristu</DefaultFullName> + </Era> + </Eras> + <StartDayOfWeek> + <DayID>mon</DayID> + </StartDayOfWeek> + <MinimalDaysInFirstWeek>4</MinimalDaysInFirstWeek> + </Calendar> + </LC_CALENDAR> + <LC_CURRENCY> + <Currency default="true" usedInCompatibleFormatCodes="true"> + <CurrencyID>EUR</CurrencyID> + <CurrencySymbol>€</CurrencySymbol> + <BankSymbol>EUR</BankSymbol> + <CurrencyName>Ewro</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>Veru</trueWord> + <falseWord>Falz</falseWord> + <quarter1Word>L-ewwel kwart</quarter1Word> + <quarter2Word>It-tieni kwart</quarter2Word> + <quarter3Word>It-tielet kwart</quarter3Word> + <quarter4Word>Ir-raba' kwart</quarter4Word> + <aboveWord>fuq</aboveWord> + <belowWord>taħt</belowWord> + <quarter1Abbreviation>K1</quarter1Abbreviation> + <quarter2Abbreviation>K2</quarter2Abbreviation> + <quarter3Abbreviation>K3</quarter3Abbreviation> + <quarter4Abbreviation>K4</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> +<!--Version 1.0 --> diff --git a/i18npool/source/localedata/data/my_MM.xml b/i18npool/source/localedata/data/my_MM.xml new file mode 100644 index 000000000000..dada8a5402d9 --- /dev/null +++ b/i18npool/source/localedata/data/my_MM.xml @@ -0,0 +1,486 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE Locale SYSTEM 'locale.dtd'> +<Locale versionDTD="2.0.3" allowUpdateFromCLDR="no" version="1.2"> + <LC_INFO> + <Language> + <LangID>my</LangID> + <DefaultName>Burmese</DefaultName> + </Language> + <Country> + <CountryID>MM</CountryID> + <DefaultName>Myanmar</DefaultName> + </Country> + </LC_INFO> + <LC_CTYPE> + <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>နံနက်</TimeAM> + <TimePM>ညနေ</TimePM> + <MeasurementSystem>US</MeasurementSystem> + </LC_CTYPE> + <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$ကျပ်-455]"> + <FormatElement msgid="FixedFormatskey1" default="true" type="medium" usage="FIXED_NUMBER" formatindex="0"> + <FormatCode>[NatNum1]General</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey2" default="true" type="short" usage="FIXED_NUMBER" formatindex="1"> + <FormatCode>[NatNum1]0</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey3" default="false" type="medium" usage="FIXED_NUMBER" formatindex="2"> + <FormatCode>[NatNum1]0.00</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey4" default="false" type="short" usage="FIXED_NUMBER" formatindex="3"> + <FormatCode>[NatNum1]#,##0</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey5" default="false" type="medium" usage="FIXED_NUMBER" formatindex="4"> + <FormatCode>[NatNum1]#,##0.00</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey6" default="false" type="medium" usage="FIXED_NUMBER" formatindex="5"> + <FormatCode>[NatNum1]#,###.00</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey7" default="false" type="medium" usage="FIXED_NUMBER" formatindex="50"> + <FormatCode>General</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey8" default="false" type="short" usage="FIXED_NUMBER" formatindex="51"> + <FormatCode>0</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey9" default="false" type="medium" usage="FIXED_NUMBER" formatindex="52"> + <FormatCode>0.00</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey10" default="false" type="short" usage="FIXED_NUMBER" formatindex="53"> + <FormatCode>#,##0</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey11" default="false" type="medium" usage="FIXED_NUMBER" formatindex="54"> + <FormatCode>#,##0.00</FormatCode> + </FormatElement> + <FormatElement msgid="FixedFormatskey12" default="false" type="medium" usage="FIXED_NUMBER" formatindex="55"> + <FormatCode>#,###.00</FormatCode> + </FormatElement> + <FormatElement msgid="ScientificFormatskey1" default="true" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="6"> + <FormatCode>0.00E+000</FormatCode> + </FormatElement> + <FormatElement msgid="ScientificFormatskey2" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7"> + <FormatCode>0.00E+00</FormatCode> + </FormatElement> + <FormatElement msgid="PercentFormatskey3" default="false" type="short" usage="PERCENT_NUMBER" formatindex="58"> + <FormatCode>[NatNum1]0%</FormatCode> + </FormatElement> + <FormatElement msgid="PercentFormatskey4" default="false" type="long" usage="PERCENT_NUMBER" formatindex="59"> + <FormatCode>[NatNum1]0.00%</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="false" 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>#,##0.00 CCC</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17"> + <FormatCode>[CURRENCY]#,##0.--;[RED]-[CURRENCY]#,##0.--</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey7" default="true" type="medium" usage="CURRENCY" formatindex="80"> + <FormatCode>[NatNum1]#,##0[CURRENCY];[NatNum1]-#,##0[CURRENCY]</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey8" default="true" type="long" usage="CURRENCY" formatindex="81"> + <FormatCode>[NatNum1]#,##0 [CURRENCY];[NatNum1]-#,##0 [CURRENCY]</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey9" default="false" type="long" usage="CURRENCY" formatindex="82"> + <FormatCode>[NatNum1]#,##0 [CURRENCY];[RED][NatNum1]-#,##0 [CURRENCY]</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey1" default="false" type="short" usage="DATE" formatindex="18"> + <FormatCode>D/M/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey9" default="false" type="long" usage="DATE" formatindex="19"> + <FormatCode>NNNNMMMM DD, YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey8" default="false" type="medium" usage="DATE" formatindex="20"> + <FormatCode>MM/DD/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey7" default="false" type="medium" usage="DATE" formatindex="21"> + <FormatCode>DD/MM/YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey10" default="false" type="long" usage="DATE" formatindex="22"> + <FormatCode>MMM D, YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey11" default="false" type="long" usage="DATE" formatindex="23"> + <FormatCode>MMM D, YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey16" default="false" type="long" usage="DATE" formatindex="24"> + <FormatCode>D. MMM. YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey12" default="false" type="long" usage="DATE" formatindex="25"> + <FormatCode>MMMM D, YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey17" default="false" type="long" usage="DATE" formatindex="26"> + <FormatCode>D. MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey13" default="false" type="long" usage="DATE" formatindex="27"> + <FormatCode>NN, MMM D, YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey2" default="false" type="medium" usage="DATE" formatindex="28"> + <FormatCode>NN DD/MMM YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey14" default="false" type="long" usage="DATE" formatindex="29"> + <FormatCode>NN, MMMM D, YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="30"> + <FormatCode>NNNNMMMM D, YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey18" default="false" type="short" usage="DATE" formatindex="31"> + <FormatCode>MM-DD</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey19" default="false" type="medium" usage="DATE" formatindex="32"> + <FormatCode>YY-MM-DD</FormatCode> + <DefaultName>ISO 8601</DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey20" default="false" type="medium" usage="DATE" formatindex="33"> + <FormatCode>YYYY-MM-DD</FormatCode> + <DefaultName>ISO 8601</DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey3" default="false" type="medium" usage="DATE" formatindex="34"> + <FormatCode>MM/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey4" default="false" type="medium" usage="DATE" formatindex="35"> + <FormatCode>MMM DD</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey5" default="false" type="medium" usage="DATE" formatindex="36"> + <FormatCode>MMMM</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey6" default="false" type="medium" usage="DATE" formatindex="37"> + <FormatCode>QQ YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey21" default="false" type="medium" usage="DATE" formatindex="38"> + <FormatCode>WW</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey22" default="true" type="medium" usage="DATE" formatindex="60"> + <FormatCode>[NatNum1]DD/MM/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey23" default="true" type="short" usage="DATE" formatindex="61"> + <FormatCode>[NatNum1]D/M/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey24" default="false" type="medium" usage="DATE" formatindex="62"> + <FormatCode>[NatNum1]DD/MM/YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey25" default="false" type="medium" usage="DATE" formatindex="63"> + <FormatCode>[NatNum1]DD-MM-YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey26" default="false" type="long" usage="DATE" formatindex="64"> + <FormatCode>[NatNum1]D. MMM. YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey27" default="false" type="long" usage="DATE" formatindex="65"> + <FormatCode>[NatNum1]D. MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey28" default="true" type="long" usage="DATE" formatindex="66"> + <FormatCode>[NatNum1]NNN၊ MMMM D၊ YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey29" default="false" type="long" usage="DATE" formatindex="67"> + <FormatCode>[NatNum1]MMMM D</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey30" default="false" type="medium" usage="DATE" formatindex="68"> + <FormatCode>[NatNum1]YYYYခုနှစ်၊ MMMMလ Dရက် NNNနေ့</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="false" type="short" usage="TIME" formatindex="41"> + <FormatCode>HH:MM AM/PM</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey4" default="false" 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="TimeFormatskey8" default="true" type="short" usage="TIME" formatindex="70"> + <FormatCode>[NatNum1]HH:MM</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey9" default="true" type="medium" usage="TIME" formatindex="71"> + <FormatCode>[NatNum1]HH:MM:SS</FormatCode> + </FormatElement> + <FormatElement msgid="TimeFormatskey10" default="false" type="medium" usage="TIME" formatindex="72"> + <FormatCode>[NatNum1]HHနာရီ MMမိနစ်</FormatCode> + </FormatElement> + <FormatElement msgid="DateTimeFormatskey1" default="true" type="medium" usage="DATE_TIME" formatindex="46"> + <FormatCode>MM/DD/YY HH:MM AM/PM</FormatCode> + </FormatElement> + <FormatElement msgid="DateTimeFormatskey2" default="false" type="medium" usage="DATE_TIME" formatindex="47"> + <FormatCode>DD/MM/YYYY HH:MM:SS</FormatCode> + </FormatElement> + <FormatElement msgid="DateTimeFormatskey3" default="false" type="medium" usage="DATE_TIME" formatindex="73"> + <FormatCode>[NatNum1]DD/MM/YYYY HH:MM:SS</FormatCode> + </FormatElement> + </LC_FORMAT> + <LC_COLLATION> + <Collator default="true" unoid="dictionary" /> + <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">က-အ ဣ-ဧ ဩ-ဪ</IndexKey> + <UnicodeScript>27</UnicodeScript> + <FollowPageWord>p.</FollowPageWord> + <FollowPageWord>pp.</FollowPageWord> + </LC_INDEX> + <LC_CALENDAR> + <Calendar unoid="gregorian" default="true"> + <DaysOfWeek> + <Day> + <DayID>sun</DayID> + <DefaultAbbrvName>နွေ</DefaultAbbrvName> + <DefaultFullName>တနင်္ဂနွေ</DefaultFullName> + </Day> + <Day> + <DayID>mon</DayID> + <DefaultAbbrvName>လာ</DefaultAbbrvName> + <DefaultFullName>တနင်္လာ</DefaultFullName> + </Day> + <Day> + <DayID>tue</DayID> + <DefaultAbbrvName>ဂါ</DefaultAbbrvName> + <DefaultFullName>အင်္ဂါ</DefaultFullName> + </Day> + <Day> + <DayID>wed</DayID> + <DefaultAbbrvName>ဟူး</DefaultAbbrvName> + <DefaultFullName>ဗုဒ္ဓဟူး</DefaultFullName> + </Day> + <Day> + <DayID>thu</DayID> + <DefaultAbbrvName>တေး</DefaultAbbrvName> + <DefaultFullName>ကြာသပတေး</DefaultFullName> + </Day> + <Day> + <DayID>fri</DayID> + <DefaultAbbrvName>ကြာ</DefaultAbbrvName> + <DefaultFullName>သောကြာ</DefaultFullName> + </Day> + <Day> + <DayID>sat</DayID> + <DefaultAbbrvName>နေ</DefaultAbbrvName> + <DefaultFullName>စနေ</DefaultFullName> + </Day> + </DaysOfWeek> + <MonthsOfYear> + <Month> + <MonthID>jan</MonthID> + <DefaultAbbrvName>ဇန်</DefaultAbbrvName> + <DefaultFullName>ဇန်နဝါရီ</DefaultFullName> + </Month> + <Month> + <MonthID>feb</MonthID> + <DefaultAbbrvName>ဖေ</DefaultAbbrvName> + <DefaultFullName>ဖေဖော်ဝါရီ</DefaultFullName> + </Month> + <Month> + <MonthID>mar</MonthID> + <DefaultAbbrvName>မတ်</DefaultAbbrvName> + <DefaultFullName>မတ်</DefaultFullName> + </Month> + <Month> + <MonthID>apr</MonthID> + <DefaultAbbrvName>ဧပြီ</DefaultAbbrvName> + <DefaultFullName>ဧပြီ</DefaultFullName> + </Month> + <Month> + <MonthID>may</MonthID> + <DefaultAbbrvName>မေ</DefaultAbbrvName> + <DefaultFullName>မေ</DefaultFullName> + </Month> + <Month> + <MonthID>jun</MonthID> + <DefaultAbbrvName>ဇွန်</DefaultAbbrvName> + <DefaultFullName>ဇွန်</DefaultFullName> + </Month> + <Month> + <MonthID>jul</MonthID> + <DefaultAbbrvName>ဇူ</DefaultAbbrvName> + <DefaultFullName>ဇူလိုင်</DefaultFullName> + </Month> + <Month> + <MonthID>aug</MonthID> + <DefaultAbbrvName>ဩ</DefaultAbbrvName> + <DefaultFullName>ဩဂုတ်</DefaultFullName> + </Month> + <Month> + <MonthID>sep</MonthID> + <DefaultAbbrvName>စက်</DefaultAbbrvName> + <DefaultFullName>စက်တင်ဘာ</DefaultFullName> + </Month> + <Month> + <MonthID>oct</MonthID> + <DefaultAbbrvName>အောက်</DefaultAbbrvName> + <DefaultFullName>အောက်တိုဘာ</DefaultFullName> + </Month> + <Month> + <MonthID>nov</MonthID> + <DefaultAbbrvName>နို</DefaultAbbrvName> + <DefaultFullName>နိုဝင်ဘာ</DefaultFullName> + </Month> + <Month> + <MonthID>dec</MonthID> + <DefaultAbbrvName>ဒီ</DefaultAbbrvName> + <DefaultFullName>ဒီဇင်ဘာ</DefaultFullName> + </Month> + </MonthsOfYear> + <Eras> + <Era> + <EraID>bc</EraID> + <DefaultAbbrvName>ဘီစီ</DefaultAbbrvName> + <DefaultFullName>ခရစ်တော် မပေါ်မီကာလ</DefaultFullName> + </Era> + <Era> + <EraID>ad</EraID> + <DefaultAbbrvName>အေဒီ</DefaultAbbrvName> + <DefaultFullName>ခရစ်တော် ပေါ်ထွန်းပြီးကာလ</DefaultFullName> + </Era> + </Eras> + <StartDayOfWeek> + <DayID>mon</DayID> + </StartDayOfWeek> + <MinimalDaysInFirstWeek>1</MinimalDaysInFirstWeek> + </Calendar> + </LC_CALENDAR> + <LC_CURRENCY> + <Currency default="true" usedInCompatibleFormatCodes="true"> + <CurrencyID>MMK</CurrencyID> + <CurrencySymbol>K</CurrencySymbol> + <BankSymbol>MMK</BankSymbol> + <CurrencyName>Kyat</CurrencyName> + <DecimalPlaces>2</DecimalPlaces> + </Currency> + </LC_CURRENCY> + <LC_TRANSLITERATION> + <!-- There is often English mixed with Myanmar, so leave these in for now --> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="IGNORE_CASE"/> + </LC_TRANSLITERATION> + <LC_MISC> + <ReservedWords> + <trueWord>မှန်</trueWord> + <falseWord>မှား</falseWord> + <quarter1Word>ပထမ သုံးလပတ်</quarter1Word> + <quarter2Word>ဒုတိယ သုံးလပတ်</quarter2Word> + <quarter3Word>တတိယ သုံးလပတ်</quarter3Word> + <quarter4Word>စတုတ္ထ သုံးလပတ်</quarter4Word> + <aboveWord>အပေါ်</aboveWord> + <belowWord>အောက်</belowWord> + <quarter1Abbreviation>ပ-စိတ်</quarter1Abbreviation> + <quarter2Abbreviation>ဒု-စိတ်</quarter2Abbreviation> + <quarter3Abbreviation>တ-စိတ်</quarter3Abbreviation> + <quarter4Abbreviation>စ-စိတ်</quarter4Abbreviation> + </ReservedWords> + </LC_MISC> + <LC_NumberingLevel> + <NumberingLevel NumType="12" Prefix=" " Suffix="။"/> + <NumberingLevel NumType="12" Prefix="(" Suffix=")"/> + <NumberingLevel NumType="4" Prefix=" " Suffix="."/> + <NumberingLevel NumType="4" Prefix="(" Suffix=")"/> + <NumberingLevel NumType="47" Prefix=" " Suffix="။"/> + <NumberingLevel NumType="47" Prefix="(" Suffix=")"/> + <NumberingLevel NumType="0" Prefix=" " Suffix="."/> + <NumberingLevel NumType="1" Prefix=" " Suffix="."/> + </LC_NumberingLevel> + <LC_OutLineNumberingLevel> + <OutlineStyle> + <OutLineNumberingLevel Prefix=" " NumType="12" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="12" Suffix="။" BulletChar="0020" BulletFontName="" ParentNumbering="1" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="47" Suffix="။" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> + </OutlineStyle> + <OutlineStyle> + <OutLineNumberingLevel Prefix=" " NumType="12" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="47" Suffix="။" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> + </OutlineStyle> + <OutlineStyle> + <OutLineNumberingLevel Prefix=" " NumType="12" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix="(" NumType="47" Suffix=")" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="1" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="0" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix="." BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> + </OutlineStyle> + <OutlineStyle> + <OutLineNumberingLevel Prefix=" " NumType="12" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="12" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="12" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="12" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="12" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> + </OutlineStyle> + <OutlineStyle> + <OutLineNumberingLevel Prefix=" " NumType="47" Suffix="။" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="0" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="12" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="1" Suffix=")" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> + </OutlineStyle> + <OutlineStyle> + <OutLineNumberingLevel Prefix=" " NumType="47" Suffix="။" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="0" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="1" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="12" Suffix="။" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> + </OutlineStyle> + <OutlineStyle> + <OutLineNumberingLevel Prefix=" " NumType="12" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="12" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="1" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="12" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="2" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="12" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="3" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="12" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="4" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> + </OutlineStyle> + <OutlineStyle> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="27A2" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="E006" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=")" BulletChar="E004" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> + </OutlineStyle> + </LC_OutLineNumberingLevel> +</Locale> diff --git a/i18npool/source/localedata/data/sh_RS.xml b/i18npool/source/localedata/data/sh_RS.xml index 4d97a9b950e0..4b744bdd5913 100644 --- a/i18npool/source/localedata/data/sh_RS.xml +++ b/i18npool/source/localedata/data/sh_RS.xml @@ -231,72 +231,6 @@ <quarter4Abbreviation>K4</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> - <OutlineStyle> - <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="1" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="1" Suffix=")" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> - </OutlineStyle> - <OutlineStyle> - <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="1" Suffix=")" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> - </OutlineStyle> - <OutlineStyle> - <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix="(" NumType="1" Suffix=")" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="3" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="0" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="6" Suffix="." BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> - </OutlineStyle> - <OutlineStyle> - <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> - </OutlineStyle> - <OutlineStyle> - <OutLineNumberingLevel Prefix=" " NumType="2" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="0" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="3" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="1" Suffix=")" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> - </OutlineStyle> - <OutlineStyle> - <OutLineNumberingLevel Prefix=" " NumType="0" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="2" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="1" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="3" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> - </OutlineStyle> - <OutlineStyle> - <OutLineNumberingLevel Prefix=" " NumType="4" Suffix=" " BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="4" Suffix=" " BulletChar="0020" BulletFontName="" ParentNumbering="1" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="4" Suffix=" " BulletChar="0020" BulletFontName="" ParentNumbering="2" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="4" Suffix=" " BulletChar="0020" BulletFontName="" ParentNumbering="3" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="4" Suffix=" " BulletChar="0020" BulletFontName="" ParentNumbering="4" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> - </OutlineStyle> - <OutlineStyle> - <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="27A2" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="E006" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=")" BulletChar="E004" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> - </OutlineStyle> - </LC_OutLineNumberingLevel> + <LC_NumberingLevel ref="sr_RS"/> + <LC_OutLineNumberingLevel ref="sr_RS"/> </Locale> diff --git a/i18npool/source/localedata/data/shs_CA.xml b/i18npool/source/localedata/data/shs_CA.xml new file mode 100644 index 000000000000..4060d002bbe2 --- /dev/null +++ b/i18npool/source/localedata/data/shs_CA.xml @@ -0,0 +1,414 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE Locale SYSTEM 'locale.dtd'> +<Locale versionDTD="2.0.3" allowUpdateFromCLDR="yes" version="1.2"> + <LC_INFO> + <Language> + <LangID>shs</LangID> + <DefaultName>Shuswap</DefaultName> + </Language> + <Country> + <CountryID>CA</CountryID> + <DefaultName>Canada</DefaultName> + </Country> + </LC_INFO> + <LC_CTYPE> + <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>AM</TimeAM> + <TimePM>PM</TimePM> + <MeasurementSystem>metric</MeasurementSystem> + </LC_CTYPE> + <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$$-648]"> + <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+000</FormatCode> + </FormatElement> + <FormatElement msgid="ScientificFormatskey2" default="false" type="medium" usage="SCIENTIFIC_NUMBER" formatindex="7"> + <FormatCode>0.00E+00</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>#,##0.00 CCC</FormatCode> + </FormatElement> + <FormatElement msgid="CurrencyFormatskey6" default="false" type="medium" usage="CURRENCY" formatindex="17"> + <FormatCode>[CURRENCY]#,##0.--;[RED]-[CURRENCY]#,##0.--</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey1" default="true" type="short" usage="DATE" formatindex="18"> + <FormatCode>M/D/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey9" default="true" type="long" usage="DATE" formatindex="19"> + <FormatCode>NNNNMMMM DD, YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey8" default="true" type="medium" usage="DATE" formatindex="20"> + <FormatCode>MM/DD/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey7" default="false" type="medium" usage="DATE" formatindex="21"> + <FormatCode>MM/DD/YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey10" default="false" type="long" usage="DATE" formatindex="22"> + <FormatCode>MMM D, YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey11" default="false" type="long" usage="DATE" formatindex="23"> + <FormatCode>MMM D, YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey16" default="false" type="long" usage="DATE" formatindex="24"> + <FormatCode>D. MMM. YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey12" default="false" type="long" usage="DATE" formatindex="25"> + <FormatCode>MMMM D, YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey17" default="false" type="long" usage="DATE" formatindex="26"> + <FormatCode>D. MMMM YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey13" default="false" type="long" usage="DATE" formatindex="27"> + <FormatCode>NN, MMM D, YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey2" default="false" type="medium" usage="DATE" formatindex="28"> + <FormatCode>NN DD/MMM YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey14" default="false" type="long" usage="DATE" formatindex="29"> + <FormatCode>NN, MMMM D, YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey15" default="false" type="long" usage="DATE" formatindex="30"> + <FormatCode>NNNNMMMM D, YYYY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey18" default="false" type="short" usage="DATE" formatindex="31"> + <FormatCode>MM-DD</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey19" default="false" type="medium" usage="DATE" formatindex="32"> + <FormatCode>YY-MM-DD</FormatCode> + <DefaultName>ISO 8601</DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey20" default="false" type="medium" usage="DATE" formatindex="33"> + <FormatCode>YYYY-MM-DD</FormatCode> + <DefaultName>ISO 8601</DefaultName> + </FormatElement> + <FormatElement msgid="DateFormatskey3" default="false" type="medium" usage="DATE" formatindex="34"> + <FormatCode>MM/YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey4" default="false" type="medium" usage="DATE" formatindex="35"> + <FormatCode>MMM DD</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey5" default="false" type="medium" usage="DATE" formatindex="36"> + <FormatCode>MMMM</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey6" default="false" type="medium" usage="DATE" formatindex="37"> + <FormatCode>QQ YY</FormatCode> + </FormatElement> + <FormatElement msgid="DateFormatskey21" 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>MM/DD/YY HH:MM AM/PM</FormatCode> + </FormatElement> + <FormatElement msgid="DateTimeFormatskey2" default="false" type="medium" usage="DATE_TIME" formatindex="47"> + <FormatCode>MM/DD/YYYY HH:MM:SS</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-Z</IndexKey> + <UnicodeScript>0</UnicodeScript> + <UnicodeScript>1</UnicodeScript> + <FollowPageWord>p.</FollowPageWord> + <FollowPageWord>pp.</FollowPageWord> + </LC_INDEX> + <LC_CALENDAR> + <Calendar unoid="gregorian" default="true"> + <DaysOfWeek> + <Day> + <DayID>sun</DayID> + <DefaultAbbrvName>Sxe</DefaultAbbrvName> + <DefaultFullName>Sxetspesq't</DefaultFullName> + </Day> + <Day> + <DayID>mon</DayID> + <DefaultAbbrvName>Spe</DefaultAbbrvName> + <DefaultFullName>Spetkesq't</DefaultFullName> + </Day> + <Day> + <DayID>tue</DayID> + <DefaultAbbrvName>Sel</DefaultAbbrvName> + <DefaultFullName>Selesq't</DefaultFullName> + </Day> + <Day> + <DayID>wed</DayID> + <DefaultAbbrvName>Ske</DefaultAbbrvName> + <DefaultFullName>Skellesq't</DefaultFullName> + </Day> + <Day> + <DayID>thu</DayID> + <DefaultAbbrvName>Sme</DefaultAbbrvName> + <DefaultFullName>Smesesq't</DefaultFullName> + </Day> + <Day> + <DayID>fri</DayID> + <DefaultAbbrvName>Sts</DefaultAbbrvName> + <DefaultFullName>Stselkstesq't</DefaultFullName> + </Day> + <Day> + <DayID>sat</DayID> + <DefaultAbbrvName>Stq</DefaultAbbrvName> + <DefaultFullName>Stqmekstesq't</DefaultFullName> + </Day> + </DaysOfWeek> + <MonthsOfYear> + <Month> + <MonthID>jan</MonthID> + <DefaultAbbrvName>Kwe </DefaultAbbrvName> + <DefaultFullName>Pellkwet'min</DefaultFullName> + </Month> + <Month> + <MonthID>feb</MonthID> + <DefaultAbbrvName>Tsi</DefaultAbbrvName> + <DefaultFullName>Pelctsipwen'ten</DefaultFullName> + </Month> + <Month> + <MonthID>mar</MonthID> + <DefaultAbbrvName>Sqe</DefaultAbbrvName> + <DefaultFullName>Pellsqe'pts</DefaultFullName> + </Month> + <Month> + <MonthID>apr</MonthID> + <DefaultAbbrvName>E'w</DefaultAbbrvName> + <DefaultFullName>Peslle'wten</DefaultFullName> + </Month> + <Month> + <MonthID>may</MonthID> + <DefaultAbbrvName>Ell</DefaultAbbrvName> + <DefaultFullName>Pell7ell7e'7llqten</DefaultFullName> + </Month> + <Month> + <MonthID>jun</MonthID> + <DefaultAbbrvName>Tsp</DefaultAbbrvName> + <DefaultFullName>Pelltspe'ntsk</DefaultFullName> + </Month> + <Month> + <MonthID>jul</MonthID> + <DefaultAbbrvName>Tqw</DefaultAbbrvName> + <DefaultFullName>Pelltqwelq'we'l't</DefaultFullName> + </Month> + <Month> + <MonthID>aug</MonthID> + <DefaultAbbrvName>Ct'</DefaultAbbrvName> + <DefaultFullName>Pellct'e'xel'cten</DefaultFullName> + </Month> + <Month> + <MonthID>sep</MonthID> + <DefaultAbbrvName>Qel</DefaultAbbrvName> + <DefaultFullName>Pesqelqle'lten</DefaultFullName> + </Month> + <Month> + <MonthID>oct</MonthID> + <DefaultAbbrvName>Wel</DefaultAbbrvName> + <DefaultFullName>Pesllwe'lsten</DefaultFullName> + </Month> + <Month> + <MonthID>nov</MonthID> + <DefaultAbbrvName>U7l</DefaultAbbrvName> + <DefaultFullName>Pellc7ell7u'7llcwten'</DefaultFullName> + </Month> + <Month> + <MonthID>dec</MonthID> + <DefaultAbbrvName>Tet</DefaultAbbrvName> + <DefaultFullName>Pelltete'tq'em</DefaultFullName> + </Month> + </MonthsOfYear> + <Eras> + <Era> + <EraID>bc</EraID> + <DefaultAbbrvName>BC</DefaultAbbrvName> + <DefaultFullName>BC</DefaultFullName> + </Era> + <Era> + <EraID>ad</EraID> + <DefaultAbbrvName>AD</DefaultAbbrvName> + <DefaultFullName>AD</DefaultFullName> + </Era> + </Eras> + <StartDayOfWeek> + <DayID>sun</DayID> + </StartDayOfWeek> + <MinimalDaysInFirstWeek>1</MinimalDaysInFirstWeek> + </Calendar> + </LC_CALENDAR> + <LC_CURRENCY> + <Currency default="true" usedInCompatibleFormatCodes="true"> + <CurrencyID>CAD</CurrencyID> + <CurrencySymbol>$</CurrencySymbol> + <BankSymbol>CAD</BankSymbol> + <CurrencyName>CA Dollar</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>true</trueWord> + <falseWord>false</falseWord> + <quarter1Word>1st quarter</quarter1Word> + <quarter2Word>2nd quarter</quarter2Word> + <quarter3Word>3rd quarter</quarter3Word> + <quarter4Word>4th quarter</quarter4Word> + <aboveWord>above</aboveWord> + <belowWord>below</belowWord> + <quarter1Abbreviation>Q1</quarter1Abbreviation> + <quarter2Abbreviation>Q2</quarter2Abbreviation> + <quarter3Abbreviation>Q3</quarter3Abbreviation> + <quarter4Abbreviation>Q4</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> + <OutlineStyle> + <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="1" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="1" Suffix=")" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> + </OutlineStyle> + <OutlineStyle> + <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="1" Suffix=")" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> + </OutlineStyle> + <OutlineStyle> + <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix="(" NumType="1" Suffix=")" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="3" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="0" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix="." BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> + </OutlineStyle> + <OutlineStyle> + <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> + </OutlineStyle> + <OutlineStyle> + <OutLineNumberingLevel Prefix=" " NumType="2" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="0" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="3" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="1" Suffix=")" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> + </OutlineStyle> + <OutlineStyle> + <OutLineNumberingLevel Prefix=" " NumType="0" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="2" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="1" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="3" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> + </OutlineStyle> + <OutlineStyle> + <OutLineNumberingLevel Prefix=" " NumType="4" Suffix=" " BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="4" Suffix=" " BulletChar="0020" BulletFontName="" ParentNumbering="1" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="4" Suffix=" " BulletChar="0020" BulletFontName="" ParentNumbering="2" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="4" Suffix=" " BulletChar="0020" BulletFontName="" ParentNumbering="3" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="4" Suffix=" " BulletChar="0020" BulletFontName="" ParentNumbering="4" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> + </OutlineStyle> + <OutlineStyle> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="27A2" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="E006" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=")" BulletChar="E004" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> + </OutlineStyle> + </LC_OutLineNumberingLevel> +</Locale> diff --git a/i18npool/source/localedata/data/sr_RS.xml b/i18npool/source/localedata/data/sr_RS.xml index 0040d588fecb..4023c2d4afeb 100644 --- a/i18npool/source/localedata/data/sr_RS.xml +++ b/i18npool/source/localedata/data/sr_RS.xml @@ -371,35 +371,35 @@ </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="4" Prefix=" " Suffix=")"/> + <NumberingLevel NumType="2" Prefix=" " Suffix=""/> + <NumberingLevel NumType="3" Prefix=" " Suffix=""/> + <NumberingLevel NumType="48" Prefix=" " Suffix=")"/> + <NumberingLevel NumType="49" 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> <OutlineStyle> <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="1" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="1" Suffix=")" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="49" Suffix=")" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> </OutlineStyle> <OutlineStyle> <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="1" Suffix=")" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="49" Suffix=")" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> </OutlineStyle> <OutlineStyle> <OutLineNumberingLevel Prefix=" " NumType="4" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix="(" NumType="1" Suffix=")" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix="(" NumType="49" Suffix=")" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> <OutLineNumberingLevel Prefix=" " NumType="3" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="0" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="48" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> <OutLineNumberingLevel Prefix=" " NumType="6" Suffix="." BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> </OutlineStyle> <OutlineStyle> @@ -411,13 +411,13 @@ </OutlineStyle> <OutlineStyle> <OutLineNumberingLevel Prefix=" " NumType="2" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="0" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="48" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> <OutLineNumberingLevel Prefix=" " NumType="3" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> - <OutLineNumberingLevel Prefix=" " NumType="1" Suffix=")" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="49" Suffix=")" BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> <OutLineNumberingLevel Prefix=" " NumType="6" Suffix=" " BulletChar="2022" BulletFontName="StarSymbol" ParentNumbering="0" LeftMargin="200" SymbolTextDistance="50" FirstLineOffset="0"/> </OutlineStyle> <OutlineStyle> - <OutLineNumberingLevel Prefix=" " NumType="0" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> + <OutLineNumberingLevel Prefix=" " NumType="48" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="0" SymbolTextDistance="50" FirstLineOffset="0"/> <OutLineNumberingLevel Prefix=" " NumType="2" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="50" SymbolTextDistance="50" FirstLineOffset="0"/> <OutLineNumberingLevel Prefix=" " NumType="1" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="100" SymbolTextDistance="50" FirstLineOffset="0"/> <OutLineNumberingLevel Prefix=" " NumType="3" Suffix="." BulletChar="0020" BulletFontName="" ParentNumbering="0" LeftMargin="150" SymbolTextDistance="50" FirstLineOffset="0"/> diff --git a/i18npool/source/localedata/data/tpi_PG.xml b/i18npool/source/localedata/data/tpi_PG.xml new file mode 100644 index 000000000000..0017a1081233 --- /dev/null +++ b/i18npool/source/localedata/data/tpi_PG.xml @@ -0,0 +1,358 @@ +<?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>tpi</LangID> + <DefaultName>Tok Pisin</DefaultName> + </Language> + <Country> + <CountryID>PG</CountryID> + <DefaultName>Papua New Guinea</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>AM</TimeAM> + <TimePM>PM</TimePM> + <MeasurementSystem>metric</MeasurementSystem> + </LC_CTYPE> + <LC_FORMAT replaceFrom="[CURRENCY]" replaceTo="[$K-647]"> + <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-Z</IndexKey> + <UnicodeScript>0</UnicodeScript> + <UnicodeScript>1</UnicodeScript> + <FollowPageWord>p</FollowPageWord> + <FollowPageWord>pp</FollowPageWord> + </LC_INDEX> + <LC_CALENDAR> + <Calendar unoid="gregorian" default="true"> + <DaysOfWeek> + <Day> + <DayID>sun</DayID> + <DefaultAbbrvName>San</DefaultAbbrvName> + <DefaultFullName>Sande</DefaultFullName> + </Day> + <Day> + <DayID>mon</DayID> + <DefaultAbbrvName>Man</DefaultAbbrvName> + <DefaultFullName>Mande</DefaultFullName> + </Day> + <Day> + <DayID>tue</DayID> + <DefaultAbbrvName>Tun</DefaultAbbrvName> + <DefaultFullName>Tunde</DefaultFullName> + </Day> + <Day> + <DayID>wed</DayID> + <DefaultAbbrvName>Tri</DefaultAbbrvName> + <DefaultFullName>Trinde</DefaultFullName> + </Day> + <Day> + <DayID>thu</DayID> + <DefaultAbbrvName>Fon</DefaultAbbrvName> + <DefaultFullName>Fonde</DefaultFullName> + </Day> + <Day> + <DayID>fri</DayID> + <DefaultAbbrvName>Frai</DefaultAbbrvName> + <DefaultFullName>Fraide</DefaultFullName> + </Day> + <Day> + <DayID>sat</DayID> + <DefaultAbbrvName>Sar</DefaultAbbrvName> + <DefaultFullName>Sarere</DefaultFullName> + </Day> + </DaysOfWeek> + <MonthsOfYear> + <Month> + <MonthID>jan</MonthID> + <DefaultAbbrvName>Jan</DefaultAbbrvName> + <DefaultFullName>Janueri</DefaultFullName> + </Month> + <Month> + <MonthID>feb</MonthID> + <DefaultAbbrvName>Feb</DefaultAbbrvName> + <DefaultFullName>Februeri</DefaultFullName> + </Month> + <Month> + <MonthID>mar</MonthID> + <DefaultAbbrvName>Mas</DefaultAbbrvName> + <DefaultFullName>Mas</DefaultFullName> + </Month> + <Month> + <MonthID>apr</MonthID> + <DefaultAbbrvName>Epr</DefaultAbbrvName> + <DefaultFullName>Epril</DefaultFullName> + </Month> + <Month> + <MonthID>may</MonthID> + <DefaultAbbrvName>Me</DefaultAbbrvName> + <DefaultFullName>Me</DefaultFullName> + </Month> + <Month> + <MonthID>jun</MonthID> + <DefaultAbbrvName>Jun</DefaultAbbrvName> + <DefaultFullName>Jun</DefaultFullName> + </Month> + <Month> + <MonthID>jul</MonthID> + <DefaultAbbrvName>Jul</DefaultAbbrvName> + <DefaultFullName>Julai</DefaultFullName> + </Month> + <Month> + <MonthID>aug</MonthID> + <DefaultAbbrvName>Og</DefaultAbbrvName> + <DefaultFullName>Ogas</DefaultFullName> + </Month> + <Month> + <MonthID>sep</MonthID> + <DefaultAbbrvName>Sep</DefaultAbbrvName> + <DefaultFullName>Septemba</DefaultFullName> + </Month> + <Month> + <MonthID>oct</MonthID> + <DefaultAbbrvName>Okt</DefaultAbbrvName> + <DefaultFullName>Oktoba</DefaultFullName> + </Month> + <Month> + <MonthID>nov</MonthID> + <DefaultAbbrvName>Nov</DefaultAbbrvName> + <DefaultFullName>Novemba</DefaultFullName> + </Month> + <Month> + <MonthID>dec</MonthID> + <DefaultAbbrvName>Des</DefaultAbbrvName> + <DefaultFullName>Desemba</DefaultFullName> + </Month> + </MonthsOfYear> + <Eras> + <Era> + <EraID>bc</EraID> + <DefaultAbbrvName>BK</DefaultAbbrvName> + <DefaultFullName>bipo, taim Krais i no kam daun long graun yet</DefaultFullName> + </Era> + <Era> + <EraID>ad</EraID> + <DefaultAbbrvName>AD</DefaultAbbrvName> + <DefaultFullName>taim Krais i kirap bek i kam inap nau</DefaultFullName> + </Era> + </Eras> + <StartDayOfWeek> + <DayID>sun</DayID> + </StartDayOfWeek> + <MinimalDaysInFirstWeek>1</MinimalDaysInFirstWeek> + </Calendar> + </LC_CALENDAR> + <LC_CURRENCY> + <Currency default="true" usedInCompatibleFormatCodes="true"> + <CurrencyID>PGK</CurrencyID> + <CurrencySymbol>K</CurrencySymbol> + <BankSymbol>PGK</BankSymbol> + <CurrencyName>Kina</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>Tru</trueWord> + <falseWord>Giaman</falseWord> + <quarter1Word>Namba Wan Kota</quarter1Word> + <quarter2Word>Namba Tu Kota</quarter2Word> + <quarter3Word>Namba Tri Kota</quarter3Word> + <quarter4Word>Namba Foa Kota</quarter4Word> + <aboveWord>Antap</aboveWord> + <belowWord>Daunbilo</belowWord> + <quarter1Abbreviation>K1</quarter1Abbreviation> + <quarter2Abbreviation>K2</quarter2Abbreviation> + <quarter3Abbreviation>K3</quarter3Abbreviation> + <quarter4Abbreviation>K4</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> +<!--Version 1.0 --> diff --git a/i18npool/source/localedata/data/zh_CN.xml b/i18npool/source/localedata/data/zh_CN.xml index 3409144ae95a..0fadbf5d9075 100644 --- a/i18npool/source/localedata/data/zh_CN.xml +++ b/i18npool/source/localedata/data/zh_CN.xml @@ -125,11 +125,11 @@ <DefaultName></DefaultName> </FormatElement> <FormatElement msgid="DateFormatskey6" default="false" type="medium" usage="DATE" formatindex="23"> -<FormatCode>YYYY"年"MMMD"月"</FormatCode> +<FormatCode>YYYY"年"MMMD"日"</FormatCode> <DefaultName></DefaultName> </FormatElement> <FormatElement msgid="DateFormatskey7" default="false" type="medium" usage="DATE" formatindex="24"> -<FormatCode>YYYY "年" MMM D "月"</FormatCode> +<FormatCode>YYYY "年" MMM D "日"</FormatCode> <DefaultName></DefaultName> </FormatElement> <FormatElement msgid="DateFormatskey8" default="false" type="long" usage="DATE" formatindex="25"> @@ -428,8 +428,8 @@ </LC_TRANSLITERATION> <LC_MISC> <ForbiddenCharacters> -<ForbiddenLineBeginCharacters>:!),.:;?]}¢'"、。〉》」』】〕〗〞︰︱︳﹐、﹒﹔﹕﹖﹗﹚﹜﹞!),.:;?|}︴︶︸︺︼︾﹀﹂﹄﹏、~¢々‖•·ˇˉ―--′</ForbiddenLineBeginCharacters> -<ForbiddenLineEndCharacters>([{£¥'"‵〈《「『【〔〖([{£¥〝︵︷︹︻︽︿﹁﹃﹙﹛﹝({</ForbiddenLineEndCharacters> +<ForbiddenLineBeginCharacters>:!),.:;?]}¢'"、。〉》」』】〕〗〞︰︱︳﹐、﹒﹔﹕﹖﹗﹚﹜﹞!),.:;?|}︴︶︸︺︼︾﹀﹂﹄﹏、~¢々‖•·ˇˉ―--′’”</ForbiddenLineBeginCharacters> +<ForbiddenLineEndCharacters>([{£¥'"‵〈《「『【〔〖([{£¥〝︵︷︹︻︽︿﹁﹃﹙﹛﹝({“‘</ForbiddenLineEndCharacters> <LineBreakHangingCharacters>!,.:;?、。!,.:;?</LineBreakHangingCharacters> </ForbiddenCharacters> <ReservedWords> diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index c0ec98f646aa..456bb1761b41 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: localedata.cxx,v $ - * $Revision: 1.59.16.1 $ + * $Revision: 1.59.24.4 $ * * This file is part of OpenOffice.org. * @@ -174,6 +174,7 @@ static const struct { { "gsc_FR", lcl_DATA_EURO }, { "fy_NL", lcl_DATA_EURO }, { "oc_FR", lcl_DATA_EURO }, + { "mt_MT", lcl_DATA_EURO }, { "ja_JP", lcl_DATA_OTHERS }, { "ko_KR", lcl_DATA_OTHERS }, @@ -246,6 +247,9 @@ static const struct { { "so_SO", lcl_DATA_OTHERS }, { "gug_PY", lcl_DATA_OTHERS }, { "tk_TM", lcl_DATA_OTHERS }, + { "my_MM", lcl_DATA_OTHERS }, + { "shs_CA", lcl_DATA_OTHERS }, + { "tpi_PG", lcl_DATA_OTHERS }, }; static const sal_Unicode under = sal_Unicode('_'); diff --git a/i18npool/source/search/levdis.cxx b/i18npool/source/search/levdis.cxx index 9e4b0b091b3c..187693269041 100644 --- a/i18npool/source/search/levdis.cxx +++ b/i18npool/source/search/levdis.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: levdis.cxx,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.24.1 $ * * This file is part of OpenOffice.org. * @@ -121,7 +121,7 @@ } \ } -sal_Int32 Impl_WLD_StringLen( const sal_Unicode* pStr ) +static sal_Int32 Impl_WLD_StringLen( const sal_Unicode* pStr ) { const sal_Unicode* pTempStr = pStr; while( *pTempStr ) @@ -131,7 +131,7 @@ sal_Int32 Impl_WLD_StringLen( const sal_Unicode* pStr ) #ifdef erTESTMAT #define erTESTMATMAX 180 -static int far npMatrix[erTESTMATMAX][erTESTMATMAX]; // nearly 64K +static int npMatrix[erTESTMATMAX][erTESTMATMAX]; // nearly 64K #endif // Distanz von String zu Pattern @@ -366,19 +366,6 @@ int WLevDistance::WLD( const sal_Unicode* cString, sal_Int32 nStringLen ) } -int WLevDistance::WLD( const ::rtl::OUString& rString ) -{ - return( WLD( rString.getStr(), rString.getLength() )); -} - - - -int WLevDistance::WLD( const sal_Unicode* cString ) -{ - return( WLD( cString, Impl_WLD_StringLen(cString) )); -} - - // Berechnung von nLimit, nReplP0, nInsQ0, nDelR0, bSplitCount // aus Userwerten nOtherX, nShorterY, nLongerZ, bRelaxed @@ -511,8 +498,10 @@ void WLevDistance::InitData( const sal_Unicode* cPattern ) // CTor -WLevDistance::WLevDistance( const sal_Unicode* cPattern ) : - nPatternLen( Impl_WLD_StringLen(cPattern) ), +#ifdef erTEST + +WLevDistance::WLevDistance( const ::rtl::OUString& rPattern ) : + nPatternLen( rPattern.getLength() ), aPatMem( nPatternLen + 1 ), nArrayLen( nPatternLen + 1 ), aDisMem( nArrayLen ), @@ -522,9 +511,10 @@ WLevDistance::WLevDistance( const sal_Unicode* cPattern ) : nDelR0( LEVDISDEFAULT_R0 ), bSplitCount( false ) { - InitData( cPattern ); + InitData( rPattern.getStr() ); } +#endif // erTEST WLevDistance::WLevDistance( const sal_Unicode* cPattern, @@ -540,21 +530,6 @@ WLevDistance::WLevDistance( const sal_Unicode* cPattern, } -WLevDistance::WLevDistance( const ::rtl::OUString& rPattern ) : - nPatternLen( rPattern.getLength() ), - aPatMem( nPatternLen + 1 ), - nArrayLen( nPatternLen + 1 ), - aDisMem( nArrayLen ), - nLimit( LEVDISDEFAULTLIMIT ), - nRepP0( LEVDISDEFAULT_P0 ), - nInsQ0( LEVDISDEFAULT_Q0 ), - nDelR0( LEVDISDEFAULT_R0 ), - bSplitCount( false ) -{ - InitData( rPattern.getStr() ); -} - - // CopyCTor WLevDistance::WLevDistance( const WLevDistance& rWLD ) : nPatternLen( rWLD.nPatternLen ), @@ -597,17 +572,19 @@ typedef char MAXSTRING [LINESIZE+1]; #ifdef erTESTMAT -void WLevDistance::ShowMatrix( const char* cString ) +void WLevDistance::ShowMatrix( const sal_Unicode* cString ) { - sal_Int32 r, c, l = strlen(cString); + sal_Int32 r, c, l = Impl_WLD_StringLen(cString); printf(" | "); for ( c=0; c<nPatternLen; c++ ) +#error Error: conversion from sal_Unicode to char needed! printf( " %c ", cpPattern[c] ); printf("\n---+---"); for ( c=0; c<nPatternLen; c++ ) printf( "---" ); for ( r=0; r<=l && r < erTESTMATMAX; r++ ) { +#error Error: conversion from sal_Unicode to char needed! printf( "\n %c |", ( r==0 ? ' ' : cString[r-1] ) ); for ( c=0; c<=nPatternLen && c < erTESTMATMAX; c++ ) printf( "%2d ", npMatrix[r][c] ); @@ -623,18 +600,20 @@ MAXSTRING cDelim = "\t, ;(){}[]<>&=+-/%!|.\\'\"~"; void WLevDistance::ShowTest() { printf(" \n"); +#error Error: conversion from sal_Unicode to char needed! printf(" a *cpPattern . . . . : %s\n", cpPattern); printf(" b *bpPatIsWild . . . : "); for ( sal_Int32 i=0; i<nPatternLen; i++ ) printf("%d", bpPatIsWild[i]); printf("\n"); - printf(" c nPatternLen . . . : %d\n", nPatternLen); + printf(" c nPatternLen . . . : %d\n", (int)nPatternLen); printf(" d nStars . . . . . . : %d\n", nStars); printf(" e nLimit . . . . . . : %d\n", nLimit); printf(" f nRepP0 (Ersetzen) : %d\n", nRepP0); printf(" g nInsQ0 (Einfuegen) : %d\n", nInsQ0); printf(" h nDelR0 (Loeschen) : %d\n", nDelR0); printf(" i bSplitCount . . . : %d\n", bSplitCount); +#error Error: conversion from sal_Unicode to char needed! printf(" j cDelim . . . . . . : '%s'\n", cDelim); printf(" ~\n"); } @@ -650,7 +629,7 @@ inline bool IsDelim( char c ) MAXSTRING cString, cLine, cIgString; -main( int argc, char **argv ) +int main( int argc, char **argv ) { int nLim, nP0, nQ0, nR0, nX, nY, nZ; int args = 0; @@ -674,7 +653,7 @@ main( int argc, char **argv ) { IgnoreCase = true; char* cp = argv[args+1]; - while ( *cp = tolower( *cp ) ) + while ( (*cp = tolower( *cp )) != 0 ) cp++; break; } @@ -731,6 +710,7 @@ main( int argc, char **argv ) } if ( Direct ) { +#error Error: conversion from char to OUString needed! pTest = new WLevDistance( argv[args+1] ); #ifdef erTESTDEFAULT pTest->ShowTest(); @@ -742,6 +722,7 @@ main( int argc, char **argv ) } else { +#error Error: conversion from char to sal_Unicode needed! pTest = new WLevDistance( argv[args+1], nX, nY, nZ, !bStrict ); #ifdef erTESTCCTOR WLevDistance aTmp( *pTest ); @@ -753,7 +734,7 @@ main( int argc, char **argv ) do { char* cp1, *cp2; - static ULONG nLine = 0; + static long unsigned int nLine = 0; cp1 = cLine; cin.getline( cLine, LINESIZE ) ; nLine++; @@ -772,21 +753,24 @@ main( int argc, char **argv ) int ret; if ( IgnoreCase ) { - char* cp1 = cString; - char* cp2 = cIgString; - while ( *cp1 ) - *cp2++ = tolower( *cp1++ ); - *cp2 = '\0'; + char* cpi1 = cString; + char* cpi2 = cIgString; + while ( *cpi1 ) + *cpi2++ = tolower( *cpi1++ ); + *cpi2 = '\0'; +#error Error: conversion from char to OUString / sal_Unicode,length needed! ret = pTest->WLD( cIgString ); } else +#error Error: conversion from char to OUString / sal_Unicode,length needed! ret = pTest->WLD( cString ); #ifdef erTESTMAT printf("\n# %3d : %s\n", ret, cString); +#error Error: conversion from char to sal_Unicode needed! pTest->ShowMatrix( cString ); #else if ( ret <= nLim ) - printf("# %3d : %s\t(line %ld)\t%s\n", ret, cString, nLine, cLine); + printf("# %3d : %s\t(line %lu)\t%s\n", ret, cString, nLine, cLine); #endif } } diff --git a/i18npool/source/search/levdis.hxx b/i18npool/source/search/levdis.hxx index 64663b52bd55..92240444175b 100644 --- a/i18npool/source/search/levdis.hxx +++ b/i18npool/source/search/levdis.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: levdis.hxx,v $ - * $Revision: 1.4 $ + * $Revision: 1.4.24.1 $ * * This file is part of OpenOffice.org. * @@ -147,10 +147,12 @@ class WLevDistance int KGV( int a, int b ); // Kleinstes Gemeinsames Vielfaches public: + +#ifdef erTEST // CToren fuer direktes Setzen der Gewichtung mit Set...() // im CTor werden die Defaultwerte fuer Limit/Rep/Ins/Del gesetzt - WLevDistance( const sal_Unicode* cPattern ); - WLevDistance( const ::rtl::OUString& rPattern ); + explicit WLevDistance( const ::rtl::OUString& rPattern ); +#endif // CToren mit Userangaben, danach mit GetLimit() Limit holen // interner Aufruf von CalcLPQR() @@ -162,9 +164,7 @@ public: ~WLevDistance(); // Berechnung der Levenshtein-Distanz von String zu Pattern - int WLD( const sal_Unicode* cString, sal_Int32 nStringLen ); // prefered - int WLD( const sal_Unicode* cString ); - int WLD( const ::rtl::OUString& rString ); + int WLD( const sal_Unicode* cString, sal_Int32 nStringLen ); // Berechnung der Gewichtung aus Userangaben, return nLimit int CalcLPQR( int nOtherX, int nShorterY, int nLongerZ, @@ -187,7 +187,7 @@ public: #ifdef erTEST void ShowTest(); #ifdef erTESTMAT - void ShowMatrix( const char* cString ); + void ShowMatrix( const sal_Unicode* cString ); #endif #endif diff --git a/i18npool/source/transliteration/transliteration_caseignore.cxx b/i18npool/source/transliteration/transliteration_caseignore.cxx index ec6e0249cc46..bec324e94a4a 100644 --- a/i18npool/source/transliteration/transliteration_caseignore.cxx +++ b/i18npool/source/transliteration/transliteration_caseignore.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: transliteration_caseignore.cxx,v $ - * $Revision: 1.11 $ + * $Revision: 1.11.24.1 $ * * This file is part of OpenOffice.org. * @@ -52,6 +52,11 @@ Transliteration_caseignore::Transliteration_caseignore() implementationName = "com.sun.star.i18n.Transliteration.Transliteration_caseignore"; } +#if 0 +/* NOTE: We had this, derived from Transliteration_caseignore, but it was + * unused code. Deactivated with #i89580# but left for reference in case + * MappingTypeSimpleFolding would be needed at some time. + */ Transliteration_simplecaseignore::Transliteration_simplecaseignore() { nMappingType = MappingTypeSimpleFolding; @@ -59,6 +64,7 @@ Transliteration_simplecaseignore::Transliteration_simplecaseignore() transliterationName = "simple case ignore (generic)"; implementationName = "com.sun.star.i18n.Transliteration.Transliteration_simplecaseignore"; } +#endif void SAL_CALL Transliteration_caseignore::loadModule( TransliterationModules modName, const Locale& rLocale ) diff --git a/i18npool/util/makefile.mk b/i18npool/util/makefile.mk index 80981ce753fc..582089a309e8 100644 --- a/i18npool/util/makefile.mk +++ b/i18npool/util/makefile.mk @@ -76,7 +76,8 @@ SHL1STDLIBS= \ $(CPPULIB) \ $(SALLIB) \ $(ICUINLIB) \ - $(ICUUCLIB) + $(ICUUCLIB) \ + $(ICUDATALIB) # --- Targets ------------------------------------------------------------ diff --git a/i18npool/util/makefile.pmk b/i18npool/util/makefile.pmk index 04c8491eb172..8d4084233e1a 100644 --- a/i18npool/util/makefile.pmk +++ b/i18npool/util/makefile.pmk @@ -32,15 +32,4 @@ # define I18NPOOL_DLLIMPLEMENTATION (see @ i18npool/i18npooldllapi.h) CDEFS += -DI18NPOOL_DLLIMPLEMENTATION -# set default symbol visibility / scope to hidden -.IF "$(COMNAME)" == "gcc3" -.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE" - CFLAGS += -fvisibility=hidden -.ENDIF # HAVE_GCC_VISIBILITY_FEATURE -.ENDIF # gcc3 - -.IF "$(COMNAME)" == "sunpro5" -.IF "$(CCNUMVER)" >= "00050005" - CFLAGS += -xldscope=hidden -.ENDIF # 5.5 -.ENDIF # sunpro5 +VISIBILITY_HIDDEN=TRUE diff --git a/o3tl/qa/makefile.mk b/o3tl/qa/makefile.mk index c91ba12d3202..5a71a7821325 100644 --- a/o3tl/qa/makefile.mk +++ b/o3tl/qa/makefile.mk @@ -75,6 +75,6 @@ unittest : $(SHL1TARGETN) @echo ---------------------------------------------------------- @echo - start unit test on library $(SHL1TARGETN) @echo ---------------------------------------------------------- - testshl2 $(SHL1TARGETN) + testshl2 -sf $(mktmp ) $(SHL1TARGETN) ALLTAR : unittest diff --git a/psprint/source/fontmanager/fontmanager.cxx b/psprint/source/fontmanager/fontmanager.cxx index e794eabf42cb..8fac64dc5b49 100644 --- a/psprint/source/fontmanager/fontmanager.cxx +++ b/psprint/source/fontmanager/fontmanager.cxx @@ -2093,14 +2093,24 @@ void PrintFontManager::initFontsAlias() // TODO: use that method once psprint gets merged into vcl static bool AreFCSubstitutionsEnabled() { - bool bDisableFC = false; + // init font substitution defaults + int nDisableBits = 0; #ifdef SOLARIS - bDisableFC = true; + // TODO: check the OS version and fc-data maintenance level + nDisableBits = 1; // disable "font fallback" here on default #endif + // apply the environment variable if any const char* pEnvStr = ::getenv( "SAL_DISABLE_FC_SUBST" ); if( pEnvStr ) - bDisableFC = (*pEnvStr == '\0') || (*pEnvStr != '0'); - return bDisableFC; + { + // + if( (*pEnvStr >= '0') && (*pEnvStr <= '9') ) + nDisableBits = (*pEnvStr - '0'); + else + nDisableBits = ~0U; // no specific bits set: disable all + } + + return ((nDisableBits & 3) == 0); } void PrintFontManager::initialize( void* pInitDisplay ) diff --git a/psprint/source/fontsubset/sft.c b/psprint/source/fontsubset/sft.c index cc63a7f3a897..c3a8ce377282 100644 --- a/psprint/source/fontsubset/sft.c +++ b/psprint/source/fontsubset/sft.c @@ -323,7 +323,7 @@ _inline void PutInt16(sal_Int16 val, sal_uInt8 *ptr, size_t offset, int bigendia } -#if defined(_BIG_ENDIAN) +#if defined(OSL_BIG_ENDIAN) #define Int16FromMOTA(a) (a) #define Int32FromMOTA(a) (a) #else diff --git a/sax/source/fastparser/fastattribs.hxx b/sax/inc/sax/fastattribs.hxx index 15c8d6920f07..e7c42c55bafd 100644 --- a/sax/source/fastparser/fastattribs.hxx +++ b/sax/inc/sax/fastattribs.hxx @@ -34,8 +34,10 @@ #include <com/sun/star/xml/sax/XFastAttributeList.hpp> #include <com/sun/star/xml/sax/XFastTokenHandler.hpp> #include <com/sun/star/xml/Attribute.hpp> +#include <com/sun/star/xml/FastAttribute.hpp> #include <cppuhelper/implbase1.hxx> +#include "sax/dllapi.h" #include <map> #include <vector> @@ -43,12 +45,23 @@ namespace sax_fastparser { -struct UnknownAttribute; +struct UnknownAttribute +{ + ::rtl::OUString maNamespaceURL; + ::rtl::OString maName; + ::rtl::OString maValue; + + UnknownAttribute( const ::rtl::OUString& rNamespaceURL, const ::rtl::OString& rName, const ::rtl::OString& rValue ); + + UnknownAttribute( const ::rtl::OString& rName, const ::rtl::OString& rValue ); + + void FillAttribute( ::com::sun::star::xml::Attribute* pAttrib ) const; +}; typedef std::map< sal_Int32, ::rtl::OString > FastAttributeMap; typedef std::vector< UnknownAttribute > UnknownAttributeList; -class FastAttributeList : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastAttributeList > +class SAX_DLLPUBLIC FastAttributeList : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastAttributeList > { public: FastAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >& xTokenHandler ); @@ -66,6 +79,7 @@ public: virtual ::rtl::OUString SAL_CALL getValue( ::sal_Int32 Token ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getOptionalValue( ::sal_Int32 Token ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::com::sun::star::xml::Attribute > SAL_CALL getUnknownAttributes( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::xml::FastAttribute > SAL_CALL getFastAttributes() throw (::com::sun::star::uno::RuntimeException); private: FastAttributeMap maAttributes; diff --git a/sax/inc/sax/fshelper.hxx b/sax/inc/sax/fshelper.hxx new file mode 100644 index 000000000000..b1ce4ba39d1b --- /dev/null +++ b/sax/inc/sax/fshelper.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * 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 _SAX_FS_HELPER_HXX_ +#define _SAX_FS_HELPER_HXX_ + +#include <com/sun/star/uno/XReference.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/xml/sax/XFastTokenHandler.hpp> +#include <stdarg.h> +#include <boost/shared_ptr.hpp> +#include <sax/fastattribs.hxx> +#include "sax/dllapi.h" + +#define FSNS(namespace, element) ((namespace << 16) | element) +#define FSEND -1 // same as XML_TOKEN_INVALID + +namespace sax_fastparser { + +typedef ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList > XFastAttributeListRef; + +class FastSaxSerializer; + +class SAX_DLLPUBLIC FastSerializerHelper +{ +public: + + FastSerializerHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutputStream ); + + ~FastSerializerHelper(); + + void startElement(const char* elementName, ...); + void singleElement(const char* elementName, ...); + void endElement(const char* elementName); + + void startElementV(sal_Int32 elementTokenId, va_list args); + void singleElementV(sal_Int32 elementTokenId, va_list args); + + inline void startElement(sal_Int32 elementTokenId, ...) + { va_list args; va_start( args, elementTokenId ); startElementV( elementTokenId, args ); va_end( args ); } + inline void singleElement(sal_Int32 elementTokenId, ...) + { va_list args; va_start( args, elementTokenId ); singleElementV( elementTokenId, args ); va_end( args ); } + inline void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, ...) + { va_list args; va_start( args, elementTokenId ); startElementV( FSNS( namespaceTokenId, elementTokenId), args ); va_end( args ); } + inline void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, ...) + { va_list args; va_start( args, elementTokenId ); singleElementV( FSNS( namespaceTokenId, elementTokenId), args ); va_end( args ); } + void endElement(sal_Int32 elementTokenId); + inline void endElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId) + { endElement( FSNS( namespaceTokenId, elementTokenId ) ); } + + void singleElement(const char* elementName, XFastAttributeListRef xAttrList); + inline void singleElement(sal_Int32 elementTokenId, XFastAttributeListRef xAttrList) + { singleElementV(elementTokenId, xAttrList); } + void singleElementV(sal_Int32 elementTokenId, XFastAttributeListRef xAttrList); + inline void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, XFastAttributeListRef xAttrList) + { singleElementV(FSNS( namespaceTokenId, elementTokenId), xAttrList); } + + FastSerializerHelper* write(const char* value); + FastSerializerHelper* write(const rtl::OUString& value); + FastSerializerHelper* write(sal_Int32 value); + FastSerializerHelper* write(sal_Int64 value); + FastSerializerHelper* write(float value); + FastSerializerHelper* write(double value); + + FastSerializerHelper* writeEscaped(const char* value); + FastSerializerHelper* writeEscaped(const rtl::OUString& value); + + FastSerializerHelper* writeId(sal_Int32 tokenId); + + ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > getOutputStream(); + + FastAttributeList *createAttrList(); + + void mark(); + void mergeTopMarks( bool bPrepend = false ); + +private: + + FastSaxSerializer* mpSerializer; + com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastTokenHandler> mxTokenHandler; + +}; + +typedef boost::shared_ptr< FastSerializerHelper > FSHelperPtr; + +} + +#endif // _SAX_FS_HELPER_HXX_ diff --git a/sax/prj/build.lst b/sax/prj/build.lst index 9cc88467d011..e3f70c484610 100644 --- a/sax/prj/build.lst +++ b/sax/prj/build.lst @@ -3,4 +3,3 @@ ax sax usr1 - all ax_mkout NULL ax sax\source\expatwrap nmake - all ax_expatwrap NULL ax sax\source\tools nmake - all ax_tools NULL ax sax\source\fastparser nmake - all ax_fastparser ax_expatwrap ax_tools NULL -ax sax\util nmake - all ax_util ax_expatwrap ax_tools ax_fastparser NULL diff --git a/sax/prj/d.lst b/sax/prj/d.lst index 3cffb18fe1f6..87f01348163c 100644 --- a/sax/prj/d.lst +++ b/sax/prj/d.lst @@ -6,6 +6,8 @@ mkdir: %_DEST%\inc%_EXT%\sax mkdir: %_DEST%\inc%_EXT%\sax\tools ..\inc\sax\dllapi.h %_DEST%\inc%_EXT%\sax\dllapi.h +..\inc\sax\fshelper.hxx %_DEST%\inc%_EXT%\sax\fshelper.hxx +..\inc\sax\fastattribs.hxx %_DEST%\inc%_EXT%\sax\fastattribs.hxx ..\inc\sax\tools\converter.hxx %_DEST%\inc%_EXT%\sax\tools\converter.hxx dos: sh -c "if test %OS% = MACOSX; then macosx-create-bundle %_DEST%\lib%_EXT%\*.dylib; fi" diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx index fd9e15fb783d..9be52cdd24c3 100644 --- a/sax/source/expatwrap/saxwriter.cxx +++ b/sax/source/expatwrap/saxwriter.cxx @@ -1030,9 +1030,9 @@ sal_Int32 SAXWriter::getIndentPrefixLength( sal_Int32 nFirstLineBreakOccurence ) sal_Int32 nLength =-1; if (mp_SaxWriterHelper) { - if( m_bForceLineBreak || - m_bAllowLineBreak && - ((nFirstLineBreakOccurence + mp_SaxWriterHelper->GetLastColumnCount()) > MAXCOLUMNCOUNT) ) + if ( m_bForceLineBreak || + (m_bAllowLineBreak && + ((nFirstLineBreakOccurence + mp_SaxWriterHelper->GetLastColumnCount()) > MAXCOLUMNCOUNT)) ) nLength = m_nLevel; } m_bForceLineBreak = sal_False; diff --git a/sax/source/fastparser/facreg.cxx b/sax/source/fastparser/facreg.cxx new file mode 100644 index 000000000000..1916a9740f1a --- /dev/null +++ b/sax/source/fastparser/facreg.cxx @@ -0,0 +1,106 @@ +#include <cppuhelper/factory.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/implbase2.hxx> + +#include "../tools/fastserializer.hxx" +#include "fastparser.hxx" + +using namespace sax_fastparser; +using namespace ::cppu; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::registry; +using ::rtl::OUString; +using namespace ::com::sun::star::lang; + +namespace sax_fastparser +{ + +//-------------------------------------- +// the extern interface +//--------------------------------------- +Reference< XInterface > SAL_CALL FastSaxParser_CreateInstance( const Reference< XMultiServiceFactory > & ) throw(Exception) +{ + FastSaxParser *p = new FastSaxParser; + return Reference< XInterface > ( (OWeakObject * ) p ); +} + +Reference< XInterface > SAL_CALL FastSaxSerializer_CreateInstance( const Reference< XMultiServiceFactory > & ) throw(Exception) +{ + FastSaxSerializer *p = new FastSaxSerializer; + return Reference< XInterface > ( (OWeakObject * ) p ); +} +} + +extern "C" +{ + +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 ) +{ + if (pRegistryKey) + { + try + { + Reference< XRegistryKey > xKey( reinterpret_cast< XRegistryKey * >( pRegistryKey ) ); + + Reference< XRegistryKey > xNewKey( xKey->createKey( + OUString::createFromAscii( "/" PARSER_IMPLEMENTATION_NAME "/UNO/SERVICES" ) ) ); + xNewKey->createKey( OUString::createFromAscii( PARSER_SERVICE_NAME ) ); + + Reference< XRegistryKey > xNewKey1( xKey->createKey( + OUString::createFromAscii( "/" SERIALIZER_IMPLEMENTATION_NAME "/UNO/SERVICES" ) ) ); + xNewKey1->createKey( OUString::createFromAscii( SERIALIZER_SERVICE_NAME ) ); + + return sal_True; + } + catch (InvalidRegistryException &) + { + OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); + } + } + return sal_False; +} + +void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) +{ + void * pRet = 0; + + if (pServiceManager ) + { + Reference< XSingleServiceFactory > xRet; + Reference< XMultiServiceFactory > xSMgr( reinterpret_cast< XMultiServiceFactory * > ( pServiceManager ) ); + + OUString aImplementationName( OUString::createFromAscii( pImplName ) ); + + if (aImplementationName == OUString( RTL_CONSTASCII_USTRINGPARAM( PARSER_IMPLEMENTATION_NAME ) ) ) + { + xRet = createSingleFactory( xSMgr, aImplementationName, + FastSaxParser_CreateInstance, + FastSaxParser::getSupportedServiceNames_Static() ); + } + else if (aImplementationName == OUString( RTL_CONSTASCII_USTRINGPARAM( SERIALIZER_IMPLEMENTATION_NAME ) ) ) + { + xRet = createSingleFactory( xSMgr, aImplementationName, + FastSaxSerializer_CreateInstance, + FastSaxSerializer::getSupportedServiceNames_Static() ); + } + + if (xRet.is()) + { + xRet->acquire(); + pRet = xRet.get(); + } + } + + return pRet; +} + + +} diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 8cf48649c8e4..2b2461c1173f 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -31,35 +31,17 @@ //#include <stdlib.h> //#include <sal/alloca.h> -#include <stack> -#include <vector> -#include <hash_map> #include <boost/scoped_ptr.hpp> -#include <boost/shared_ptr.hpp> #include <osl/diagnose.h> -#include <rtl/ref.hxx> -#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/DisposedException.hpp> -#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp> -#include <com/sun/star/xml/sax/XFastParser.hpp> #include <com/sun/star/xml/sax/XFastContextHandler.hpp> #include <com/sun/star/xml/sax/SAXParseException.hpp> #include <com/sun/star/xml/sax/FastToken.hpp> -#include <cppuhelper/factory.hxx> -#include <cppuhelper/weak.hxx> -#include <cppuhelper/implbase2.hxx> +#include "fastparser.hxx" -#include "fastattribs.hxx" -#include "xml2utf.hxx" - -#ifdef SYSTEM_EXPAT -#include <expat.h> -#else -#include "expat/xmlparse.h" -#endif #include <string.h> using ::rtl::OUString; @@ -69,7 +51,6 @@ using namespace ::osl; using namespace ::cppu; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; using namespace ::com::sun::star::xml::sax; //using namespace ::com::sun::star::util; using namespace ::com::sun::star::io; @@ -78,11 +59,6 @@ namespace sax_fastparser // -------------------------------------------------------------------- -struct SaxContextImpl; -typedef boost::shared_ptr< SaxContextImpl > SaxContextImplPtr; - -// -------------------------------------------------------------------- - struct SaxContextImpl { Reference< XFastContextHandler > mxContext; @@ -97,16 +73,6 @@ struct SaxContextImpl // -------------------------------------------------------------------- -// Entity binds all information neede for a single file -struct Entity -{ - InputSource maStructSource; - XML_Parser mpParser; - sax_expatwrap::XMLFile2UTFConverter maConverter; -}; - -// -------------------------------------------------------------------- - struct NamespaceDefine { OString maPrefix; @@ -116,10 +82,6 @@ struct NamespaceDefine NamespaceDefine( const OString& rPrefix, sal_Int32 nToken, const OUString& rNamespaceURL ) : maPrefix( rPrefix ), mnToken( nToken ), maNamespaceURL( rNamespaceURL ) {} }; -typedef ::std::hash_map< ::rtl::OUString, sal_Int32, - ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > - > NamespaceMap; - // -------------------------------------------------------------------- // FastLocatorImpl // -------------------------------------------------------------------- @@ -148,107 +110,6 @@ private: // FastSaxParser // -------------------------------------------------------------------- -#define IMPLEMENTATION_NAME "com.sun.star.comp.extensions.xml.sax.FastParser" -#define SERVICE_NAME "com.sun.star.xml.sax.FastParser" - - -// This class implements the external Parser interface -class FastSaxParser : public WeakImplHelper2< XFastParser, XServiceInfo > -{ -public: - FastSaxParser(); - ~FastSaxParser(); - - // The implementation details - static Sequence< OUString > getSupportedServiceNames_Static(void); - - // XFastParser - virtual void SAL_CALL parseStream( const InputSource& aInputSource ) throw (SAXException, IOException, RuntimeException); - virtual void SAL_CALL setFastDocumentHandler( const Reference< XFastDocumentHandler >& Handler ) throw (RuntimeException); - virtual void SAL_CALL setTokenHandler( const Reference< XFastTokenHandler >& Handler ) throw (RuntimeException); - virtual void SAL_CALL registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken ) throw (IllegalArgumentException, RuntimeException); - virtual void SAL_CALL setErrorHandler( const Reference< XErrorHandler >& Handler ) throw (RuntimeException); - virtual void SAL_CALL setEntityResolver( const Reference< XEntityResolver >& Resolver ) throw (RuntimeException); - virtual void SAL_CALL setLocale( const Locale& Locale ) throw (RuntimeException); - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException); - virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); - -public: - // the C-Callbacks for the expat parser - void static callbackStartElement(void *userData, const XML_Char *name , const XML_Char **atts); - void static callbackEndElement(void *userData, const XML_Char *name); - void static callbackCharacters( void *userData , const XML_Char *s , int nLen ); - int static callbackExternalEntityRef( XML_Parser parser, const XML_Char *openEntityNames, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId); - -public: - void pushEntity( const struct Entity &entity ) { vecEntity.push_back( entity ); } - void popEntity() { vecEntity.pop_back( ); } - struct Entity &getEntity() { return vecEntity.back(); } - -private: - void parse(); - - sal_Int32 GetToken( const OString& rToken ); - sal_Int32 GetToken( const sal_Char* pToken, sal_Int32 nTokenLen = 0 ); - sal_Int32 GetTokenWithPrefix( const OString& rPrefix, const OString& rName ) throw (SAXException); - sal_Int32 GetTokenWithPrefix( const sal_Char*pPrefix, int nPrefixLen, const sal_Char* pName, int nNameLen ) throw (SAXException); - OUString GetNamespaceURL( const OString& rPrefix ) throw (SAXException); - OUString GetNamespaceURL( const sal_Char*pPrefix, int nPrefixLen ) throw (SAXException); - sal_Int32 GetNamespaceToken( const OUString& rNamespaceURL ); - sal_Int32 GetTokenWithNamespaceURL( const OUString& rNamespaceURL, const sal_Char* pName, int nNameLen ); - void DefineNamespace( const OString& rPrefix, const sal_Char* pNamespaceURL ); - sal_Int32 CreateCustomToken( const sal_Char* pToken, int len = 0 ); - - void pushContext(); - void popContext(); - - void splitName( const XML_Char *pwName, const XML_Char *&rpPrefix, sal_Int32 &rPrefixLen, const XML_Char *&rpName, sal_Int32 &rNameLen ); - -private: - Mutex maMutex; - - Reference< XFastDocumentHandler > mxDocumentHandler; - Reference< XFastTokenHandler > mxTokenHandler; - Reference< XErrorHandler > mxErrorHandler; - Reference< XEntityResolver > mxEntityResolver; - rtl::Reference < FastLocatorImpl > mxDocumentLocator; - - rtl::Reference < FastAttributeList > mxAttributes; - - // External entity stack - vector<struct Entity> vecEntity; - - // Exception cannot be thrown through the C-XmlParser (possible resource leaks), - // therefor the maSavedException must be saved somewhere. - Any maSavedException; - sal_Bool mbExceptionWasThrown; - - Locale maLocale; - - std::stack< SaxContextImplPtr > maContextStack; - std::vector< boost::shared_ptr< NamespaceDefine > > maNamespaceDefines; - NamespaceMap maNamespaceMap; -}; - -//-------------------------------------- -// the extern interface -//--------------------------------------- -Reference< XInterface > SAL_CALL FastSaxParser_CreateInstance( const Reference< XMultiServiceFactory > & ) throw(Exception) -{ - FastSaxParser *p = new FastSaxParser; - return Reference< XInterface > ( (OWeakObject * ) p ); -} - -Sequence< OUString > FastSaxParser::getSupportedServiceNames_Static(void) -{ - Sequence<OUString> aRet(1); - aRet.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(SERVICE_NAME) ); - return aRet; -} - //--------------------------------------------- // the implementation part //--------------------------------------------- @@ -670,10 +531,17 @@ void FastSaxParser::setLocale( const Locale & Locale ) throw (RuntimeException) maLocale = Locale; } +Sequence< OUString > FastSaxParser::getSupportedServiceNames_Static(void) +{ + Sequence<OUString> aRet(1); + aRet.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(PARSER_SERVICE_NAME) ); + return aRet; +} + // XServiceInfo OUString FastSaxParser::getImplementationName() throw (RuntimeException) { - return OUString::createFromAscii( IMPLEMENTATION_NAME ); + return OUString::createFromAscii( PARSER_IMPLEMENTATION_NAME ); } // XServiceInfo @@ -694,7 +562,7 @@ Sequence< OUString > FastSaxParser::getSupportedServiceNames(void) throw (Runtim { Sequence<OUString> seq(1); - seq.getArray()[0] = OUString::createFromAscii( SERVICE_NAME ); + seq.getArray()[0] = OUString::createFromAscii( PARSER_SERVICE_NAME ); return seq; } @@ -1136,69 +1004,3 @@ int FastSaxParser::callbackExternalEntityRef( XML_Parser parser, } } - -using namespace sax_fastparser; - -extern "C" -{ - -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 ) -{ - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xKey( reinterpret_cast< XRegistryKey * >( pRegistryKey ) ); - - Reference< XRegistryKey > xNewKey( xKey->createKey( - OUString::createFromAscii( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" ) ) ); - xNewKey->createKey( OUString::createFromAscii( SERVICE_NAME ) ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_False; -} - -void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) -{ - void * pRet = 0; - - if (pServiceManager ) - { - Reference< XSingleServiceFactory > xRet; - Reference< XMultiServiceFactory > xSMgr( reinterpret_cast< XMultiServiceFactory * > ( pServiceManager ) ); - - OUString aImplementationName( OUString::createFromAscii( pImplName ) ); - - if (aImplementationName == OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATION_NAME ) ) ) - { - xRet = createSingleFactory( xSMgr, aImplementationName, - FastSaxParser_CreateInstance, - FastSaxParser::getSupportedServiceNames_Static() ); - } - - if (xRet.is()) - { - xRet->acquire(); - pRet = xRet.get(); - } - } - - return pRet; -} - - -} diff --git a/sax/source/fastparser/fastparser.hxx b/sax/source/fastparser/fastparser.hxx new file mode 100644 index 000000000000..07cb6afac77d --- /dev/null +++ b/sax/source/fastparser/fastparser.hxx @@ -0,0 +1,163 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile$ + * $Revision$ + * + * 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 _SAX_FASTPARSER_HXX_ +#define _SAX_FASTPARSER_HXX_ + +#include <vector> +#include <stack> +#include <hash_map> +#include <boost/shared_ptr.hpp> +#include <rtl/ref.hxx> +#include <com/sun/star/xml/sax/XFastParser.hpp> +#include <com/sun/star/xml/sax/XFastTokenHandler.hpp> +#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase2.hxx> + +#ifdef SYSTEM_EXPAT +#include <expat.h> +#else +#include "expat/xmlparse.h" +#endif +#include "xml2utf.hxx" + +#include <sax/fastattribs.hxx> + +#define PARSER_IMPLEMENTATION_NAME "com.sun.star.comp.extensions.xml.sax.FastParser" +#define PARSER_SERVICE_NAME "com.sun.star.xml.sax.FastParser" + +namespace sax_fastparser +{ + + class FastLocatorImpl; + struct NamespaceDefine; + struct SaxContextImpl; + typedef boost::shared_ptr< SaxContextImpl > SaxContextImplPtr; + typedef ::std::hash_map< ::rtl::OUString, sal_Int32, + ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > + > NamespaceMap; + +// -------------------------------------------------------------------- + +// Entity binds all information neede for a single file +struct Entity +{ + ::com::sun::star::xml::sax::InputSource maStructSource; + XML_Parser mpParser; + sax_expatwrap::XMLFile2UTFConverter maConverter; +}; + +// -------------------------------------------------------------------- + +// This class implements the external Parser interface +class FastSaxParser : public ::cppu::WeakImplHelper2< ::com::sun::star::xml::sax::XFastParser, ::com::sun::star::lang::XServiceInfo > +{ +public: + FastSaxParser(); + ~FastSaxParser(); + + // The implementation details + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void); + + // XFastParser + virtual void SAL_CALL parseStream( const ::com::sun::star::xml::sax::InputSource& aInputSource ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFastDocumentHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastDocumentHandler >& Handler ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTokenHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >& Handler ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL registerNamespace( const ::rtl::OUString& NamespaceURL, sal_Int32 NamespaceToken ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setErrorHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XErrorHandler >& Handler ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setEntityResolver( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XEntityResolver >& Resolver ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLocale( const ::com::sun::star::lang::Locale& rLocale ) throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + +public: + // the C-Callbacks for the expat parser + void static callbackStartElement(void *userData, const XML_Char *name , const XML_Char **atts); + void static callbackEndElement(void *userData, const XML_Char *name); + void static callbackCharacters( void *userData , const XML_Char *s , int nLen ); + int static callbackExternalEntityRef( XML_Parser parser, const XML_Char *openEntityNames, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId); + +public: + void pushEntity( const struct Entity &entity ) { vecEntity.push_back( entity ); } + void popEntity() { vecEntity.pop_back( ); } + struct Entity &getEntity() { return vecEntity.back(); } + +private: + void parse(); + + sal_Int32 GetToken( const ::rtl::OString& rToken ); + sal_Int32 GetToken( const sal_Char* pToken, sal_Int32 nTokenLen = 0 ); + sal_Int32 GetTokenWithPrefix( const ::rtl::OString& rPrefix, const ::rtl::OString& rName ) throw (::com::sun::star::xml::sax::SAXException); + sal_Int32 GetTokenWithPrefix( const sal_Char*pPrefix, int nPrefixLen, const sal_Char* pName, int nNameLen ) throw (::com::sun::star::xml::sax::SAXException); + ::rtl::OUString GetNamespaceURL( const ::rtl::OString& rPrefix ) throw (::com::sun::star::xml::sax::SAXException); + ::rtl::OUString GetNamespaceURL( const sal_Char*pPrefix, int nPrefixLen ) throw (::com::sun::star::xml::sax::SAXException); + sal_Int32 GetNamespaceToken( const ::rtl::OUString& rNamespaceURL ); + sal_Int32 GetTokenWithNamespaceURL( const ::rtl::OUString& rNamespaceURL, const sal_Char* pName, int nNameLen ); + void DefineNamespace( const ::rtl::OString& rPrefix, const sal_Char* pNamespaceURL ); + sal_Int32 CreateCustomToken( const sal_Char* pToken, int len = 0 ); + + void pushContext(); + void popContext(); + + void splitName( const XML_Char *pwName, const XML_Char *&rpPrefix, sal_Int32 &rPrefixLen, const XML_Char *&rpName, sal_Int32 &rNameLen ); + +private: + ::osl::Mutex maMutex; + + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastDocumentHandler > mxDocumentHandler; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler > mxTokenHandler; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XErrorHandler > mxErrorHandler; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XEntityResolver > mxEntityResolver; + + rtl::Reference < FastLocatorImpl > mxDocumentLocator; + rtl::Reference < FastAttributeList > mxAttributes; + + // External entity stack + std::vector< struct Entity > vecEntity; + + // Exception cannot be thrown through the C-XmlParser (possible resource leaks), + // therefor the maSavedException must be saved somewhere. + ::com::sun::star::uno::Any maSavedException; + sal_Bool mbExceptionWasThrown; + + ::com::sun::star::lang::Locale maLocale; + + std::stack< SaxContextImplPtr > maContextStack; + std::vector< boost::shared_ptr< NamespaceDefine > > maNamespaceDefines; + NamespaceMap maNamespaceMap; +}; + +} + +#endif // _SAX_FASTPARSER_HXX_ diff --git a/sax/source/fastparser/makefile.mk b/sax/source/fastparser/makefile.mk index d3a6a9312978..625d7790ed1a 100644 --- a/sax/source/fastparser/makefile.mk +++ b/sax/source/fastparser/makefile.mk @@ -37,7 +37,7 @@ ENABLE_EXCEPTIONS=TRUE # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk -DLLPRE = +DLLPRE = .IF "$(SYSTEM_ZLIB)" == "YES" CFLAGS+=-DSYSTEM_ZLIB @@ -50,8 +50,8 @@ CFLAGS+=-DSYSTEM_EXPAT #----------------------------------------------------------- SLOFILES =\ + $(SLO)$/facreg.obj\ $(SLO)$/fastparser.obj\ - $(SLO)$/fastattribs.obj\ $(SLO)$/xml2utf.obj SHL1TARGET= $(TARGET) @@ -59,8 +59,10 @@ SHL1IMPLIB= i$(TARGET) SHL1STDLIBS= \ $(SALLIB) \ + $(SAXLIB) \ $(CPPULIB) \ $(CPPUHELPERLIB)\ + $(COMPHELPERLIB)\ $(EXPATASCII3RDLIB) SHL1DEPN= diff --git a/sax/source/fastparser/fastattribs.cxx b/sax/source/tools/fastattribs.cxx index a414071bdb49..43e5f75d2907 100644 --- a/sax/source/fastparser/fastattribs.cxx +++ b/sax/source/tools/fastattribs.cxx @@ -31,7 +31,7 @@ #include <algorithm> #include <boost/bind.hpp> -#include "fastattribs.hxx" +#include <sax/fastattribs.hxx> using ::rtl::OUString; using ::rtl::OString; @@ -41,40 +41,25 @@ using namespace ::com::sun::star::xml::sax; namespace sax_fastparser { -struct UnknownAttribute +UnknownAttribute::UnknownAttribute( const OUString& rNamespaceURL, const OString& rName, const OString& rValue ) + : maNamespaceURL( rNamespaceURL ), maName( rName ), maValue( rValue ) { - OUString maNamespaceURL; - OString maName; - OString maValue; - - UnknownAttribute( const OUString& rNamespaceURL, const OString& rName, const OString& rValue ) - : maNamespaceURL( rNamespaceURL ), maName( rName ), maValue( rValue ) {} - - UnknownAttribute( const OString& rName, const OString& rValue ) - : maName( rName ), maValue( rValue ) {} +} -/* - UnknownAttribute( const UnknownAttribute& r ) - : maNamespaceURL( r.maNamespaceURL ), maName( r.maName ), maValue( r.maValue ) {} +UnknownAttribute::UnknownAttribute( const OString& rName, const OString& rValue ) + : maName( rName ), maValue( rValue ) +{ +} - const UnknownAttribute& operator=( const UnknownAttribute& r ) - { - maNamespaceURL = r.maNamespaceURL; - maName = r.maName; - maValue = r.maValue; - return *this; - } -*/ - void FillAttribute( Attribute* pAttrib ) const +void UnknownAttribute::FillAttribute( Attribute* pAttrib ) const +{ + if( pAttrib ) { - if( pAttrib ) - { - pAttrib->Name = OStringToOUString( maName, RTL_TEXTENCODING_UTF8 ); - pAttrib->NamespaceURL = maNamespaceURL; - pAttrib->Value = OStringToOUString( maValue, RTL_TEXTENCODING_UTF8 ); - } + pAttrib->Name = OStringToOUString( maName, RTL_TEXTENCODING_UTF8 ); + pAttrib->NamespaceURL = maNamespaceURL; + pAttrib->Value = OStringToOUString( maValue, RTL_TEXTENCODING_UTF8 ); } -}; +} FastAttributeList::FastAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >& xTokenHandler ) : mxTokenHandler( xTokenHandler ) @@ -165,7 +150,21 @@ Sequence< Attribute > FastAttributeList::getUnknownAttributes( ) throw (Runtime { Sequence< Attribute > aSeq( maUnknownAttributes.size() ); Attribute* pAttr = aSeq.getArray(); - std::for_each( maUnknownAttributes.begin(), maUnknownAttributes.end(), bind(&UnknownAttribute::FillAttribute, _1, pAttr++ ) ); + for( UnknownAttributeList::iterator attrIter = maUnknownAttributes.begin(); attrIter != maUnknownAttributes.end(); attrIter++ ) + (*attrIter).FillAttribute( pAttr++ ); + return aSeq; +} +Sequence< FastAttribute > FastAttributeList::getFastAttributes( ) throw (RuntimeException) +{ + Sequence< FastAttribute > aSeq( maAttributes.size() ); + FastAttribute* pAttr = aSeq.getArray(); + FastAttributeMap::iterator fastAttrIter = maAttributes.begin(); + for(; fastAttrIter != maAttributes.end(); fastAttrIter++ ) + { + pAttr->Token = fastAttrIter->first; + pAttr->Value = OStringToOUString( fastAttrIter->second, RTL_TEXTENCODING_UTF8 ); + pAttr++; + } return aSeq; } diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx new file mode 100644 index 000000000000..4603ceed3343 --- /dev/null +++ b/sax/source/tools/fastserializer.cxx @@ -0,0 +1,388 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: contexthandler2.cxx,v $ + * + * $Revision: 1.1.2.2 $ + * + * last change: $Author: dr $ $Date: 2008/02/11 10:43:07 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include "fastserializer.hxx" +#include <rtl/ustrbuf.hxx> + +#include <com/sun/star/xml/Attribute.hpp> +#include <com/sun/star/xml/FastAttribute.hpp> +#include <com/sun/star/xml/sax/XFastAttributeList.hpp> + +#include <string.h> + +using ::rtl::OString; +using ::rtl::OUString; +using ::rtl::OUStringBuffer; +using ::rtl::OUStringToOString; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::RuntimeException; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::xml::FastAttribute; +using ::com::sun::star::xml::Attribute; +using ::com::sun::star::xml::sax::SAXException; +using ::com::sun::star::xml::sax::XFastAttributeList; +using ::com::sun::star::xml::sax::XFastTokenHandler; +using ::com::sun::star::xml::sax::XFastSerializer; +using ::com::sun::star::io::XOutputStream; +using ::com::sun::star::io::NotConnectedException; +using ::com::sun::star::io::IOException; +using ::com::sun::star::io::BufferSizeExceededException; + +static Sequence< sal_Int8 > aClosingBracket((sal_Int8 *)">", 1); +static Sequence< sal_Int8 > aSlashAndClosingBracket((sal_Int8 *)"/>", 2); +static Sequence< sal_Int8 > aColon((sal_Int8 *)":", 1); +static Sequence< sal_Int8 > aOpeningBracket((sal_Int8 *)"<", 1); +static Sequence< sal_Int8 > aOpeningBracketAndSlash((sal_Int8 *)"</", 2); +static Sequence< sal_Int8 > aQuote((sal_Int8 *)"\"", 1); +static Sequence< sal_Int8 > aEqualSignAndQuote((sal_Int8 *)"=\"", 2); +static Sequence< sal_Int8 > aSpace((sal_Int8 *)" ", 1); +static Sequence< sal_Int8 > aXmlHeader((sal_Int8*) "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n", 56); + +#define HAS_NAMESPACE(x) ((x & 0xffff0000) != 0) +#define NAMESPACE(x) (x >> 16) +#define TOKEN(x) (x & 0xffff) + +namespace sax_fastparser { + FastSaxSerializer::FastSaxSerializer( ) : mxOutputStream(), mxFastTokenHandler(), maMarkStack() {} + FastSaxSerializer::~FastSaxSerializer() {} + + void SAL_CALL FastSaxSerializer::startDocument( ) throw (SAXException, RuntimeException) + { + if (!mxOutputStream.is()) + return; + writeBytes(aXmlHeader); + } + + OUString FastSaxSerializer::escapeXml( const OUString& s ) + { + ::rtl::OUStringBuffer sBuf( s.getLength() ); + const sal_Unicode* pStr = s; + sal_Int32 nLen = s.getLength(); + for( sal_Int32 i = 0; i < nLen; ++i) + { + sal_Unicode c = pStr[ i ]; + switch( c ) + { + case '<': sBuf.appendAscii( "<" ); break; + case '>': sBuf.appendAscii( ">" ); break; + case '&': sBuf.appendAscii( "&" ); break; + case '\'': sBuf.appendAscii( "'" ); break; + case '"': sBuf.appendAscii( """ ); break; + default: sBuf.append( c ); break; + } + } + return sBuf.makeStringAndClear(); + } + + void FastSaxSerializer::write( const OUString& s ) + { + OString sOutput( OUStringToOString( s, RTL_TEXTENCODING_UTF8 ) ); + writeBytes( Sequence< sal_Int8 >( + reinterpret_cast< const sal_Int8*>( sOutput.getStr() ), + sOutput.getLength() ) ); + } + + void SAL_CALL FastSaxSerializer::endDocument( ) throw (SAXException, RuntimeException) + { + if (!mxOutputStream.is()) + return; + } + + void SAL_CALL FastSaxSerializer::writeId( ::sal_Int32 nElement ) + { + if( HAS_NAMESPACE( nElement ) ) { + writeBytes(mxFastTokenHandler->getUTF8Identifier(NAMESPACE(nElement))); + writeBytes(aColon); + writeBytes(mxFastTokenHandler->getUTF8Identifier(TOKEN(nElement))); + } else + writeBytes(mxFastTokenHandler->getUTF8Identifier(nElement)); + } + + void SAL_CALL FastSaxSerializer::startFastElement( ::sal_Int32 Element, const Reference< XFastAttributeList >& Attribs ) + throw (SAXException, RuntimeException) + { + if (!mxOutputStream.is()) + return; + + writeBytes(aOpeningBracket); + + writeId(Element); + writeFastAttributeList(Attribs); + + writeBytes(aClosingBracket); + } + + void SAL_CALL FastSaxSerializer::startUnknownElement( const OUString& Namespace, const OUString& Name, const Reference< XFastAttributeList >& Attribs ) + throw (SAXException, RuntimeException) + { + if (!mxOutputStream.is()) + return; + + writeBytes(aOpeningBracket); + + if (Namespace.getLength()) + { + write(Namespace); + writeBytes(aColon); + } + + write(Name); + + writeFastAttributeList(Attribs); + + writeBytes(aClosingBracket); + } + + void SAL_CALL FastSaxSerializer::endFastElement( ::sal_Int32 Element ) + throw (SAXException, RuntimeException) + { + if (!mxOutputStream.is()) + return; + + writeBytes(aOpeningBracketAndSlash); + + writeId(Element); + + writeBytes(aClosingBracket); + } + + void SAL_CALL FastSaxSerializer::endUnknownElement( const OUString& Namespace, const OUString& Name ) + throw (SAXException, RuntimeException) + { + if (!mxOutputStream.is()) + return; + + writeBytes(aOpeningBracketAndSlash); + + if (Namespace.getLength()) + { + write(Namespace); + writeBytes(aColon); + } + + write(Name); + + writeBytes(aClosingBracket); + } + + void SAL_CALL FastSaxSerializer::singleFastElement( ::sal_Int32 Element, const Reference< XFastAttributeList >& Attribs ) + throw (SAXException, RuntimeException) + { + if (!mxOutputStream.is()) + return; + + writeBytes(aOpeningBracket); + + writeId(Element); + writeFastAttributeList(Attribs); + + writeBytes(aSlashAndClosingBracket); + } + + void SAL_CALL FastSaxSerializer::singleUnknownElement( const OUString& Namespace, const OUString& Name, const Reference< XFastAttributeList >& Attribs ) + throw (SAXException, RuntimeException) + { + if (!mxOutputStream.is()) + return; + + writeBytes(aOpeningBracket); + + if (Namespace.getLength()) + { + write(Namespace); + writeBytes(aColon); + } + + write(Name); + + writeFastAttributeList(Attribs); + + writeBytes(aSlashAndClosingBracket); + } + + void SAL_CALL FastSaxSerializer::characters( const OUString& aChars ) + throw (SAXException, RuntimeException) + { + if (!mxOutputStream.is()) + return; + + write( aChars ); + } + + void SAL_CALL FastSaxSerializer::setOutputStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutputStream ) + throw (::com::sun::star::uno::RuntimeException) + { + mxOutputStream = xOutputStream; + } + + void SAL_CALL FastSaxSerializer::setFastTokenHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >& xFastTokenHandler ) + throw (::com::sun::star::uno::RuntimeException) + { + mxFastTokenHandler = xFastTokenHandler; + } + void FastSaxSerializer::writeFastAttributeList( const Reference< XFastAttributeList >& Attribs ) + { + Sequence< Attribute > aAttrSeq = Attribs->getUnknownAttributes(); + const Attribute *pAttr = aAttrSeq.getConstArray(); + sal_Int32 nAttrLength = aAttrSeq.getLength(); + for (sal_Int32 i = 0; i < nAttrLength; i++) + { + writeBytes(aSpace); + + write(pAttr[i].Name); + writeBytes(aEqualSignAndQuote); + write(escapeXml(pAttr[i].Value)); + writeBytes(aQuote); + } + + Sequence< FastAttribute > aFastAttrSeq = Attribs->getFastAttributes(); + const FastAttribute *pFastAttr = aFastAttrSeq.getConstArray(); + sal_Int32 nFastAttrLength = aFastAttrSeq.getLength(); + for (sal_Int32 j = 0; j < nFastAttrLength; j++) + { + writeBytes(aSpace); + + sal_Int32 nToken = pFastAttr[j].Token; + writeId(nToken); + + writeBytes(aEqualSignAndQuote); + + write(escapeXml(Attribs->getValue(pFastAttr[j].Token))); + + writeBytes(aQuote); + } + } + + // XServiceInfo + OUString FastSaxSerializer::getImplementationName() throw (RuntimeException) + { + return OUString::createFromAscii( SERIALIZER_IMPLEMENTATION_NAME ); + } + + // XServiceInfo + sal_Bool FastSaxSerializer::supportsService(const OUString& ServiceName) throw (RuntimeException) + { + Sequence< OUString > aSNL = getSupportedServiceNames(); + const OUString * pArray = aSNL.getConstArray(); + + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return sal_True; + + return sal_False; + } + + // XServiceInfo + Sequence< OUString > FastSaxSerializer::getSupportedServiceNames(void) throw (RuntimeException) + { + Sequence<OUString> seq(1); + seq.getArray()[0] = OUString::createFromAscii( SERIALIZER_SERVICE_NAME ); + return seq; + } + + OUString FastSaxSerializer::getImplementationName_Static() + { + return OUString::createFromAscii( SERIALIZER_IMPLEMENTATION_NAME ); + } + + Sequence< OUString > FastSaxSerializer::getSupportedServiceNames_Static(void) + { + Sequence<OUString> aRet(1); + aRet.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(SERIALIZER_SERVICE_NAME) ); + return aRet; + } + + void FastSaxSerializer::mark() + { + maMarkStack.push( Int8Sequence() ); + } + + void FastSaxSerializer::mergeTopMarks( bool bPrepend ) + { + if ( maMarkStack.empty() ) + return; + + if ( maMarkStack.size() == 1 ) + { + mxOutputStream->writeBytes( maMarkStack.top() ); + maMarkStack.pop(); + } + else + { + const Int8Sequence aMerge( maMarkStack.top() ); + maMarkStack.pop(); + + sal_Int32 nMergeLen = aMerge.getLength(); + if ( nMergeLen > 0 ) + { + Int8Sequence &rTop = maMarkStack.top(); + sal_Int32 nTopLen = rTop.getLength(); + + rTop.realloc( nTopLen + nMergeLen ); + if ( bPrepend ) + { + // prepend the aMerge to the rTop + memmove( rTop.getArray() + nMergeLen, rTop.getConstArray(), nTopLen ); + memcpy( rTop.getArray(), aMerge.getConstArray(), nMergeLen ); + } + else + { + // append the aMerge to the rTop + memcpy( rTop.getArray() + nTopLen, aMerge.getConstArray(), nMergeLen ); + } + } + } + } + + void FastSaxSerializer::writeBytes( const Sequence< ::sal_Int8 >& aData ) throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException ) + { + if ( maMarkStack.empty() ) + mxOutputStream->writeBytes( aData ); + else + { + sal_Int32 nDataLen = aData.getLength(); + if ( nDataLen > 0 ) + { + Int8Sequence &rTop = maMarkStack.top(); + sal_Int32 nTopLen = rTop.getLength(); + + rTop.realloc( nTopLen + nDataLen ); + memcpy( rTop.getArray() + nTopLen, aData.getConstArray(), nDataLen ); + } + } + } + +} // namespace sax_fastparser + diff --git a/sax/source/tools/fastserializer.hxx b/sax/source/tools/fastserializer.hxx new file mode 100644 index 000000000000..132b495c0a8b --- /dev/null +++ b/sax/source/tools/fastserializer.hxx @@ -0,0 +1,147 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: serializer.hxx,v $ + * + * $Revision: 1.2.4.1 $ + * + * last change: $Author: dr $ $Date: 2008/02/15 12:56:11 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef SAX_FASTSERIALIZER_HXX +#define SAX_FASTSERIALIZER_HXX + +#include <com/sun/star/xml/sax/XFastSerializer.hpp> +#include <com/sun/star/xml/sax/XFastTokenHandler.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <cppuhelper/implbase2.hxx> + +#include <stack> + +#include "sax/dllapi.h" + +#define SERIALIZER_IMPLEMENTATION_NAME "com.sun.star.comp.extensions.xml.sax.FastSerializer" +#define SERIALIZER_SERVICE_NAME "com.sun.star.xml.sax.FastSerializer" + +namespace sax_fastparser { + +class SAX_DLLPUBLIC FastSaxSerializer : public ::cppu::WeakImplHelper2< ::com::sun::star::xml::sax::XFastSerializer, ::com::sun::star::lang::XServiceInfo > +{ +public: + explicit FastSaxSerializer( ); + virtual ~FastSaxSerializer(); + + ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > getOutputStream() {return mxOutputStream;} + + // The implementation details + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void); + static ::rtl::OUString getImplementationName_Static(); + + // XFastSerializer + virtual void SAL_CALL startDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL endDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL startFastElement( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) + throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL startUnknownElement( const ::rtl::OUString& Namespace, const ::rtl::OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) + throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) + throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL endUnknownElement( const ::rtl::OUString& Namespace, const ::rtl::OUString& Name ) + throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL singleFastElement( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) + throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL singleUnknownElement( const ::rtl::OUString& Namespace, const ::rtl::OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) + throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL characters( const ::rtl::OUString& aChars ) + throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setOutputStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutputStream ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFastTokenHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >& xFastTokenHandler ) + throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw ( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw ( ::com::sun::star::uno::RuntimeException ); + + // C++ helpers + virtual void SAL_CALL writeId( ::sal_Int32 Element ); + + static ::rtl::OUString escapeXml( const ::rtl::OUString& s ); + +public: + /** From now on, don't write directly to the stream, but to top of a stack. + + This is to be able to change the order of the data being written. + If you need to write eg. + p, r, rPr, [something], /rPr, t, [text], /r, /p, + but get it in order + p, r, t, [text], /t, rPr, [something], /rPr, /r, /p, + simply do + p, r, mark(), t, [text], /t, mark(), rPr, [something], /rPr, + mergeTopMarks( true ), mergeTopMarks(), /r, /p + and you are done. + */ + void mark(); + + /** Merge 2 topmost marks. + + There are 2 possibilities - prepend the top before the second top-most + mark, or append it; prepending brings the possibility to switch parts + of the output. + + Writes the result to the output stream if the mark stack becomes empty + by the operation. + + @see mark() + */ + void mergeTopMarks( bool bPrepend = false ); + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > mxOutputStream; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler > mxFastTokenHandler; + + typedef ::com::sun::star::uno::Sequence< ::sal_Int8 > Int8Sequence; + ::std::stack< Int8Sequence > maMarkStack; + + void writeFastAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ); + void write( const ::rtl::OUString& s ); + +protected: + /** Forward the call to the output stream, or write to the stack. + + The latter in the case that we are inside a mark(). + */ + void writeBytes( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); +}; + +} // namespace sax_fastparser + +#endif + diff --git a/sax/source/tools/fshelper.cxx b/sax/source/tools/fshelper.cxx new file mode 100644 index 000000000000..594a60ba1d76 --- /dev/null +++ b/sax/source/tools/fshelper.cxx @@ -0,0 +1,195 @@ +#include <sax/fshelper.hxx> +#include "fastserializer.hxx" +#include <com/sun/star/xml/sax/XFastTokenHandler.hpp> +#include <comphelper/processfactory.hxx> +#include <rtl/ustrbuf.hxx> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + +namespace sax_fastparser { + +FastSerializerHelper::FastSerializerHelper(const Reference< io::XOutputStream >& xOutputStream ) : + mpSerializer(new FastSaxSerializer()) +{ + Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); + mxTokenHandler = Reference<xml::sax::XFastTokenHandler> ( xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.FastTokenHandler") ) ), UNO_QUERY_THROW ); + + mpSerializer->setFastTokenHandler( mxTokenHandler ); + mpSerializer->setOutputStream( xOutputStream ); + mpSerializer->startDocument(); +} + +FastSerializerHelper::~FastSerializerHelper() +{ + mpSerializer->endDocument(); + + if (mpSerializer) { + delete mpSerializer; + mpSerializer = NULL; + } +} + +void FastSerializerHelper::startElement(const char* elementName, ...) +{ + FastAttributeList* pAttrList = new FastAttributeList( mxTokenHandler ); + va_list args; + va_start(args, elementName); + while (true) + { + const char* pName = va_arg(args, const char*); + if (!pName) + break; + const char* pValue = va_arg(args, const char*); + if (pValue) + pAttrList->addUnknown(pName, pValue); + } + va_end(args); + const com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> xAttrList(pAttrList); + mpSerializer->startUnknownElement(::rtl::OUString(), ::rtl::OUString::createFromAscii(elementName), xAttrList); +} + +void FastSerializerHelper::singleElement(const char* elementName, ...) +{ + FastAttributeList* pAttrList = new FastAttributeList( mxTokenHandler ); + va_list args; + va_start(args, elementName); + while (true) + { + const char* pName = va_arg(args, const char*); + if (!pName) + break; + const char* pValue = va_arg(args, const char*); + if (pValue) + pAttrList->addUnknown(pName, pValue); + } + va_end(args); + const com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> xAttrList(pAttrList); + mpSerializer->singleUnknownElement(::rtl::OUString(), ::rtl::OUString::createFromAscii(elementName), xAttrList); +} + +void FastSerializerHelper::endElement(const char* elementName) +{ + mpSerializer->endUnknownElement(::rtl::OUString(), ::rtl::OUString::createFromAscii(elementName)); +} + +void FastSerializerHelper::startElementV(sal_Int32 elementTokenId, va_list args) +{ + FastAttributeList* pAttrList = new FastAttributeList( mxTokenHandler ); + + while (true) + { + sal_Int32 nName = va_arg(args, sal_Int32); + if (nName == FSEND) + break; + const char* pValue = va_arg(args, const char*); + if (pValue) + pAttrList->add(nName, pValue); + } + + const com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> xAttrList(pAttrList); + mpSerializer->startFastElement(elementTokenId, xAttrList); +} + +void FastSerializerHelper::singleElementV(sal_Int32 elementTokenId, va_list args) +{ + FastAttributeList* pAttrList = new FastAttributeList( mxTokenHandler ); + + while (true) + { + sal_Int32 nName = va_arg(args, sal_Int32); + if (nName == FSEND) + break; + const char* pValue = va_arg(args, const char*); + if (pValue) + pAttrList->add(nName, pValue); + } + + const com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> xAttrList(pAttrList); + mpSerializer->singleFastElement(elementTokenId, xAttrList); +} + +void FastSerializerHelper::endElement(sal_Int32 elementTokenId) +{ + mpSerializer->endFastElement(elementTokenId); +} + +void FastSerializerHelper::singleElement(const char* elementName, XFastAttributeListRef xAttrList) +{ + mpSerializer->singleUnknownElement(::rtl::OUString(), ::rtl::OUString::createFromAscii(elementName), xAttrList); +} + +void FastSerializerHelper::singleElementV(sal_Int32 elementTokenId, XFastAttributeListRef xAttrList) +{ + mpSerializer->singleFastElement(elementTokenId, xAttrList); +} + +FastSerializerHelper* FastSerializerHelper::write(const char* value) +{ + return write(rtl::OUString::createFromAscii(value)); +} + +FastSerializerHelper* FastSerializerHelper::write(const rtl::OUString& value) +{ + mpSerializer->characters(value); + return this; +} + +FastSerializerHelper* FastSerializerHelper::write(sal_Int32 value) +{ + return write(::rtl::OUString::valueOf(value)); +} + +FastSerializerHelper* FastSerializerHelper::write(sal_Int64 value) +{ + return write(::rtl::OUString::valueOf(value)); +} + +FastSerializerHelper* FastSerializerHelper::write(float value) +{ + return write(::rtl::OUString::valueOf(value)); +} + +FastSerializerHelper* FastSerializerHelper::write(double value) +{ + return write(::rtl::OUString::valueOf(value)); +} + +FastSerializerHelper* FastSerializerHelper::writeEscaped(const char* value) +{ + return writeEscaped(::rtl::OUString::createFromAscii(value)); +} + +FastSerializerHelper* FastSerializerHelper::writeEscaped(const ::rtl::OUString& value) +{ + return write(FastSaxSerializer::escapeXml(value)); +} + +FastSerializerHelper* FastSerializerHelper::writeId(sal_Int32 tokenId) +{ + mpSerializer->writeId(tokenId); + return this; +} + +::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > FastSerializerHelper::getOutputStream() +{ + return mpSerializer->getOutputStream(); +} + +void FastSerializerHelper::mark() +{ + mpSerializer->mark(); +} + +void FastSerializerHelper::mergeTopMarks( bool bPrepend ) +{ + mpSerializer->mergeTopMarks( bPrepend ); +} + +FastAttributeList * FastSerializerHelper::createAttrList() +{ + return new FastAttributeList( mxTokenHandler ); +} + + +} diff --git a/sax/source/tools/makefile.mk b/sax/source/tools/makefile.mk index 2812218fd440..1f806aef74b4 100644 --- a/sax/source/tools/makefile.mk +++ b/sax/source/tools/makefile.mk @@ -32,7 +32,7 @@ PRJ=..$/.. PRJNAME=sax -TARGET=saxtools +TARGET=sax ENABLE_EXCEPTIONS=TRUE # --- Settings ----------------------------------------------------- @@ -43,7 +43,30 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- SLOFILES = \ - $(SLO)$/converter.obj + $(SLO)$/converter.obj \ + $(SLO)$/fastattribs.obj \ + $(SLO)$/fastserializer.obj \ + $(SLO)$/fshelper.obj + +SHL1TARGET= $(TARGET)$(DLLPOSTFIX) +SHL1IMPLIB= i$(TARGET) + +SHL1STDLIBS= \ + $(VOSLIB) \ + $(CPPULIB) \ + $(CPPUHELPERLIB)\ + $(COMPHELPERLIB)\ + $(RTLLIB) \ + $(SALLIB) \ + $(ONELIB) \ + $(SALHELPERLIB) + +SHL1DEPN= +SHL1OBJS= $(SLOFILES) +SHL1USE_EXPORTS=name +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +DEF1NAME= $(SHL1TARGET) +DEFLIB1NAME= $(TARGET) # --- Targets ------------------------------------------------------- diff --git a/sax/util/makefile.pmk b/sax/util/makefile.pmk index 4130b4071428..cfb446dde5d4 100644 --- a/sax/util/makefile.pmk +++ b/sax/util/makefile.pmk @@ -31,8 +31,4 @@ # Reduction of exported symbols: CDEFS += -DSAX_DLLIMPLEMENTATION -.IF "$(COMNAME)" == "gcc3" && "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE" -CFLAGS += -fvisibility=hidden -.ELIF "$(COMNAME)" == "sunpro5" && "$(CCNUMVER)" >= "00050005" -CFLAGS += -xldscope=hidden -.ENDIF +VISIBILITY_HIDDEN=TRUE diff --git a/sot/source/base/factory.cxx b/sot/source/base/factory.cxx index 1f71e5bed1da..31afe62efd09 100644 --- a/sot/source/base/factory.cxx +++ b/sot/source/base/factory.cxx @@ -84,7 +84,7 @@ void SotFactory::DeInit() #ifdef DBG_UTIL ByteString aStr( "Objects alive: " ); aStr.Append( ByteString::CreateFromInt32( pSotData->nSvObjCount ) ); - DBG_WARNING( aStr.GetBuffer() ) + DBG_WARNING( aStr.GetBuffer() ); /* SotObjectList *pObjList = pSotData->pObjectList; @@ -163,7 +163,7 @@ SotFactory::SotFactory( const SvGlobalName & rName, SvGlobalName aEmptyName; if( aEmptyName != *this ) { // wegen Sfx-BasicFactories - DBG_ASSERT( aEmptyName != *this, "create factory without SvGlobalName" ) + DBG_ASSERT( aEmptyName != *this, "create factory without SvGlobalName" ); if( Find( *this ) ) { /* diff --git a/sot/source/base/object.cxx b/sot/source/base/object.cxx index 768a6076742f..0062b7a7fb1c 100644 --- a/sot/source/base/object.cxx +++ b/sot/source/base/object.cxx @@ -172,7 +172,7 @@ BOOL SotObject::ShouldDelete() for( i = pAggList->Count() -1; i > 0; i-- ) { // Referenzen aufloesen - DBG_ASSERT( !pAggList->GetObject( i ).bMainObj, "main object reference is opened" ) + DBG_ASSERT( !pAggList->GetObject( i ).bMainObj, "main object reference is opened" ); RemoveInterface( i ); } delete pAggList; @@ -220,9 +220,9 @@ void SotObject::RemoveInterface( ULONG nPos ) SvAggregate & rAgg = pAggList->GetObject( nPos ); if( !rAgg.bFactory ) { - DBG_ASSERT( rAgg.pObj->pAggList, "no aggregation list" ) + DBG_ASSERT( rAgg.pObj->pAggList, "no aggregation list" ); DBG_ASSERT( rAgg.pObj->pAggList->GetObject( 0 ).pObj == this, - "not owner of aggregated object" ) + "not owner of aggregated object" ); // sich selbst als Cast-Verwalter austragen rAgg.pObj->pAggList->GetObject( 0 ) = SvAggregate(); // Referenz aufloesen @@ -239,8 +239,8 @@ void SotObject::RemoveInterface( ULONG nPos ) *************************************************************************/ void SotObject::RemoveInterface( SotObject * pObjP ) { - DBG_ASSERT( pObjP, "null pointer" ) - DBG_ASSERT( pAggList, "no aggregation list" ) + DBG_ASSERT( pObjP, "null pointer" ); + DBG_ASSERT( pAggList, "no aggregation list" ); ULONG i; for( i = 0; i < pAggList->Count(); i++ ) { @@ -248,7 +248,7 @@ void SotObject::RemoveInterface( SotObject * pObjP ) if( !rAgg.bFactory && pObjP == rAgg.pObj ) RemoveInterface( i ); } - DBG_ASSERT( i < pAggList->Count(), "object not found" ) + DBG_ASSERT( i < pAggList->Count(), "object not found" ); } /************************************************************************* @@ -264,7 +264,7 @@ void SotObject::AddInterface( SotObject * pObjP ) // sich selbst als Typecast-Verwalter eintragen SvAggregateMemberList & rAList = pObjP->GetAggList(); - DBG_ASSERT( !rAList.GetObject( 0 ).bMainObj, "try to aggregate twice" ) + DBG_ASSERT( !rAList.GetObject( 0 ).bMainObj, "try to aggregate twice" ); rAList[ 0 ] = SvAggregate( this, TRUE ); } @@ -316,7 +316,7 @@ void * SotObject::DownAggCast( const SotFactory * pFact ) // sich selbst als Typecast-Verwalter eintragen SvAggregateMemberList & rAList = rAgg.pObj->GetAggList(); - DBG_ASSERT( !rAList.GetObject( 0 ).bMainObj, "try to aggregate twice" ) + DBG_ASSERT( !rAList.GetObject( 0 ).bMainObj, "try to aggregate twice" ); rAList[ 0 ] = SvAggregate( this, TRUE ); } } diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx index 4d7068374435..4daa409f7a3a 100644 --- a/sot/source/sdstor/stgdir.cxx +++ b/sot/source/sdstor/stgdir.cxx @@ -309,9 +309,13 @@ INT32 StgDirEntry::GetSize() BOOL StgDirEntry::SetSize( INT32 nNewSize ) { - if ( !( nMode & STREAM_WRITE ) - || !bDirect && !pTmpStrm && !Strm2Tmp() ) + if ( + !( nMode & STREAM_WRITE ) || + (!bDirect && !pTmpStrm && !Strm2Tmp()) + ) + { return FALSE; + } if( nNewSize < nPos ) nPos = nNewSize; diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx index 5c0a7a009e94..ed29ca8305a8 100644 --- a/sot/source/sdstor/stgelem.cxx +++ b/sot/source/sdstor/stgelem.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: stgelem.cxx,v $ - * $Revision: 1.12 $ + * $Revision: 1.12.6.1 $ * * This file is part of OpenOffice.org. * @@ -158,12 +158,18 @@ BOOL StgHeader::Store( StgIo& rIo ) return BOOL( !bDirty ); } -// Perform thorough checks also on unknown variables +static bool lcl_wontoverflow(short shift) +{ + return shift >= 0 && shift < (short)sizeof(short) * 8 - 1; +} +// Perform thorough checks also on unknown variables BOOL StgHeader::Check() { return BOOL( memcmp( cSignature, cStgSignature, 8 ) == 0 - && (short) ( nVersion >> 16 ) == 3 ); + && (short) ( nVersion >> 16 ) == 3 ) + && lcl_wontoverflow(nPageSize) + && lcl_wontoverflow(nDataPageSize); } INT32 StgHeader::GetFATPage( short n ) const @@ -383,7 +389,7 @@ BOOL StgEntry::Load( const void* pFrom ) UINT16 n = nNameLen; if( n ) n = ( n >> 1 ) - 1; - if( n > 31 || nSize < 0 && cType != STG_STORAGE ) + if( n > 31 || (nSize < 0 && cType != STG_STORAGE) ) { // the size makes no sence for the substorage // TODO/LATER: actually the size should be an unsigned value, but in this case it would mean a stream of more than 2Gb diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx index 1d5a1191d888..526f0f357f32 100644 --- a/sot/source/sdstor/stgio.cxx +++ b/sot/source/sdstor/stgio.cxx @@ -67,10 +67,12 @@ BOOL StgIo::Load() if( pStrm ) { if( aHdr.Load( *this ) ) + { if( aHdr.Check() ) SetupStreams(); else return FALSE; + } } return Good(); } diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx index e3aa0ca7122d..46ae3529439c 100644 --- a/sot/source/sdstor/stgstrms.cxx +++ b/sot/source/sdstor/stgstrms.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: stgstrms.cxx,v $ - * $Revision: 1.11 $ + * $Revision: 1.11.8.1 $ * * This file is part of OpenOffice.org. * @@ -823,6 +823,9 @@ void* StgDataStrm::GetPtr( INT32 Pos, BOOL bForce, BOOL bDirty ) INT32 StgDataStrm::Read( void* pBuf, INT32 n ) { + if ( n < 0 ) + return 0; + if( ( nPos + n ) > nSize ) n = nSize - nPos; INT32 nDone = 0; diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx index f4adbbba8fc4..26ad41285251 100644 --- a/sot/source/sdstor/storage.cxx +++ b/sot/source/sdstor/storage.cxx @@ -123,7 +123,7 @@ SotStorageStream::SotStorageStream( const String & rName, StreamMode nMode, else bIsWritable = FALSE; - DBG_ASSERT( !nStorageMode,"StorageModes ignored" ) + DBG_ASSERT( !nStorageMode,"StorageModes ignored" ); } SotStorageStream::SotStorageStream( BaseStorageStream * pStm ) @@ -395,7 +395,7 @@ BOOL SotStorageStream::SetProperty( const String& rName, const ::com::sun::star: } else { - DBG_ERROR("Not implemented!") + DBG_ERROR("Not implemented!"); return FALSE; } } @@ -409,7 +409,7 @@ BOOL SotStorageStream::GetProperty( const String& rName, ::com::sun::star::uno:: } else { - DBG_ERROR("Not implemented!") + DBG_ERROR("Not implemented!"); return FALSE; } } @@ -423,7 +423,7 @@ BOOL SotStorageStream::GetProperty( const String& rName, ::com::sun::star::uno:: } else { - DBG_ERROR("Not implemented!") + DBG_ERROR("Not implemented!"); return ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >(); } } @@ -746,7 +746,7 @@ void SotStorage::RemoveUNOStorageHolder( UNOStorageHolder* pHolder ) } else { - DBG_ERROR("Not implemented!") + DBG_ERROR("Not implemented!"); } } @@ -941,7 +941,7 @@ const String & SotStorage::GetName() const { if( !m_aName.Len() ) { - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) ((SotStorage *)this)->m_aName = m_pOwnStg->GetName(); } @@ -979,7 +979,7 @@ void SotStorage::SetClass( const SvGlobalName & rName, ULONG nOriginalClipFormat, const String & rUserTypeName ) { - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) m_pOwnStg->SetClass( rName, nOriginalClipFormat, rUserTypeName ); else @@ -990,7 +990,7 @@ void SotStorage::SetConvertClass( const SvGlobalName & rName, ULONG nOriginalClipFormat, const String & rUserTypeName ) { - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) m_pOwnStg->SetConvertClass( rName, nOriginalClipFormat, rUserTypeName ); else @@ -1008,7 +1008,7 @@ void SotStorage::SetConvertClass( const SvGlobalName & rName, SvGlobalName SotStorage::GetClassName() { SvGlobalName aGN; - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) aGN = m_pOwnStg->GetClassName(); else @@ -1019,7 +1019,7 @@ SvGlobalName SotStorage::GetClassName() ULONG SotStorage::GetFormat() { ULONG nFormat = 0; - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) nFormat = m_pOwnStg->GetFormat(); else @@ -1030,7 +1030,7 @@ ULONG SotStorage::GetFormat() String SotStorage::GetUserName() { String aName; - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) aName = m_pOwnStg->GetUserName(); else @@ -1040,7 +1040,7 @@ String SotStorage::GetUserName() BOOL SotStorage::ShouldConvert() { - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) return m_pOwnStg->ShouldConvert(); else @@ -1055,7 +1055,7 @@ BOOL SotStorage::ShouldConvert() *************************************************************************/ void SotStorage::FillInfoList( SvStorageInfoList * pFillList ) const { - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) m_pOwnStg->FillInfoList( pFillList ); } @@ -1067,8 +1067,8 @@ void SotStorage::FillInfoList( SvStorageInfoList * pFillList ) const *************************************************************************/ BOOL SotStorage::CopyTo( SotStorage * pDestStg ) { - DBG_ASSERT( Owner(), "must be owner" ) - DBG_ASSERT( pDestStg->Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); + DBG_ASSERT( pDestStg->Owner(), "must be owner" ); if( m_pOwnStg && pDestStg->m_pOwnStg ) { m_pOwnStg->CopyTo( pDestStg->m_pOwnStg ); @@ -1088,7 +1088,7 @@ BOOL SotStorage::CopyTo( SotStorage * pDestStg ) *************************************************************************/ BOOL SotStorage::Commit() { - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) { if( !m_pOwnStg->Commit() ) @@ -1106,7 +1106,7 @@ BOOL SotStorage::Commit() *************************************************************************/ BOOL SotStorage::Revert() { - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) { if( !m_pOwnStg->Revert() ) @@ -1126,9 +1126,9 @@ SotStorageStream * SotStorage::OpenEncryptedSotStream( const String & rEleName, StreamMode nMode, StorageMode nStorageMode ) { - DBG_ASSERT( !nStorageMode, "StorageModes ignored" ) + DBG_ASSERT( !nStorageMode, "StorageModes ignored" ); SotStorageStream * pStm = NULL; - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) { // volle Ole-Patches einschalten @@ -1153,9 +1153,9 @@ SotStorageStream * SotStorage::OpenSotStream( const String & rEleName, StreamMode nMode, StorageMode nStorageMode ) { - DBG_ASSERT( !nStorageMode, "StorageModes ignored" ) + DBG_ASSERT( !nStorageMode, "StorageModes ignored" ); SotStorageStream * pStm = NULL; - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) { // volle Ole-Patches einschalten @@ -1186,7 +1186,7 @@ SotStorage * SotStorage::OpenSotStorage( const String & rEleName, StorageMode nStorageMode ) { SotStorage * pStor = NULL; - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) { nMode |= STREAM_SHARE_DENYALL; @@ -1213,7 +1213,7 @@ SotStorage * SotStorage::OpenUCBStorage( const String & rEleName, StorageMode nStorageMode ) { SotStorage * pStor = NULL; - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) { nMode |= STREAM_SHARE_DENYALL; @@ -1234,7 +1234,7 @@ SotStorage * SotStorage::OpenOLEStorage( const String & rEleName, StorageMode nStorageMode ) { SotStorage * pStor = NULL; - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) { nMode |= STREAM_SHARE_DENYALL; @@ -1259,7 +1259,7 @@ SotStorage * SotStorage::OpenOLEStorage( const String & rEleName, *************************************************************************/ BOOL SotStorage::IsStorage( const String & rEleName ) const { - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); // ein bisschen schneller if( m_pOwnStg ) return m_pOwnStg->IsStorage( rEleName ); @@ -1268,7 +1268,7 @@ BOOL SotStorage::IsStorage( const String & rEleName ) const BOOL SotStorage::IsStream( const String & rEleName ) const { - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); // ein bisschen schneller if( m_pOwnStg ) return m_pOwnStg->IsStream( rEleName ); @@ -1277,7 +1277,7 @@ BOOL SotStorage::IsStream( const String & rEleName ) const BOOL SotStorage::IsContained( const String & rEleName ) const { - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); // ein bisschen schneller if( m_pOwnStg ) return m_pOwnStg->IsContained( rEleName ); @@ -1291,7 +1291,7 @@ BOOL SotStorage::IsContained( const String & rEleName ) const *************************************************************************/ BOOL SotStorage::Remove( const String & rEleName ) { - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) { m_pOwnStg->Remove( rEleName ); @@ -1309,7 +1309,7 @@ BOOL SotStorage::Remove( const String & rEleName ) *************************************************************************/ BOOL SotStorage::Rename( const String & rEleName, const String & rNewName ) { - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) { m_pOwnStg->Rename( rEleName, rNewName ); @@ -1328,8 +1328,8 @@ BOOL SotStorage::Rename( const String & rEleName, const String & rNewName ) BOOL SotStorage::CopyTo( const String & rEleName, SotStorage * pNewSt, const String & rNewName ) { - DBG_ASSERT( Owner(), "must be owner" ) - DBG_ASSERT( pNewSt->Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); + DBG_ASSERT( pNewSt->Owner(), "must be owner" ); if( m_pOwnStg ) { m_pOwnStg->CopyTo( rEleName, pNewSt->m_pOwnStg, rNewName ); @@ -1349,8 +1349,8 @@ BOOL SotStorage::CopyTo( const String & rEleName, BOOL SotStorage::MoveTo( const String & rEleName, SotStorage * pNewSt, const String & rNewName ) { - DBG_ASSERT( Owner(), "must be owner" ) - DBG_ASSERT( pNewSt->Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); + DBG_ASSERT( pNewSt->Owner(), "must be owner" ); if( m_pOwnStg ) { m_pOwnStg->MoveTo( rEleName, pNewSt->m_pOwnStg, rNewName ); @@ -1365,7 +1365,7 @@ BOOL SotStorage::MoveTo( const String & rEleName, const SvStream* SotStorage::GetSvStream() { const SvStream* pResult = 0; - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) pResult = m_pOwnStg->GetSvStream(); return pResult; @@ -1374,7 +1374,7 @@ const SvStream* SotStorage::GetSvStream() SvStream* SotStorage::GetTargetSvStream() const { SvStream* pResult = 0; - DBG_ASSERT( Owner(), "must be owner" ) + DBG_ASSERT( Owner(), "must be owner" ); if( m_pOwnStg ) pResult = (SvStream*)(m_pOwnStg->GetSvStream()); return pResult; @@ -1399,7 +1399,7 @@ BOOL SotStorage::SetProperty( const String& rName, const ::com::sun::star::uno:: } else { - DBG_WARNING("W1:Not implemented!") + DBG_WARNING("W1:Not implemented!"); return FALSE; } } @@ -1422,7 +1422,7 @@ BOOL SotStorage::GetProperty( const String& rName, ::com::sun::star::uno::Any& r } else { - DBG_WARNING("W1:Not implemented!") + DBG_WARNING("W1:Not implemented!"); return FALSE; } } @@ -1436,7 +1436,7 @@ BOOL SotStorage::GetProperty( const String& rEleName, const String& rName, ::com } else { - DBG_WARNING("W1:Not implemented!") + DBG_WARNING("W1:Not implemented!"); return FALSE; } } diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index 4af0d2b24350..d7e797c681f3 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -1294,7 +1294,7 @@ BOOL UCBStorageStream_Impl::Revert() // if an OLEStorage is created on this stream, no "revert" is neccessary because OLEStorages do nothing on "Revert" ! if ( m_bCommited ) { - DBG_ERROR("Revert while commit is in progress!" ) + DBG_ERROR("Revert while commit is in progress!" ); return FALSE; // ??? } @@ -1442,7 +1442,7 @@ ULONG UCBStorageStream::Write( const void* pData, ULONG nSize ) // mba: does occur in writer ! if ( pImp->m_bCommited ) { - DBG_ERROR("Writing while commit is in progress!" ) + DBG_ERROR("Writing while commit is in progress!" ); return 0; } */ @@ -1475,7 +1475,7 @@ BOOL UCBStorageStream::SetSize( ULONG nNewSize ) /* if ( pImp->m_bCommited ) { - DBG_ERROR("Changing stream size while commit is in progress!" ) + DBG_ERROR("Changing stream size while commit is in progress!" ); return FALSE; } */ diff --git a/sot/util/makefile.pmk b/sot/util/makefile.pmk index 5653efa692e4..939d66818cd0 100644 --- a/sot/util/makefile.pmk +++ b/sot/util/makefile.pmk @@ -31,17 +31,5 @@ # define SOT_DLLIMPLEMENTATION (see @ = sotdllapi.h) CDEFS += -DSOT_DLLIMPLEMENTATION - -# set default symbol visibility / scope to hidden -.IF "$(COMNAME)" == "gcc3" -.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE" - CFLAGS += -fvisibility=hidden -.ENDIF # HAVE_GCC_VISIBILITY_FEATURE -.ENDIF # gcc3 - -.IF "$(COMNAME)" == "sunpro5" -.IF "$(CCNUMVER)" >= "00050005" - CFLAGS += -xldscope=hidden -.ENDIF # 5.5 -.ENDIF # sunpro5 +VISIBILITY_HIDDEN=TRUE diff --git a/svtools/inc/cacheoptions.hxx b/svtools/inc/cacheoptions.hxx index fad248c53991..0dd1d2eaaf6d 100644 --- a/svtools/inc/cacheoptions.hxx +++ b/svtools/inc/cacheoptions.hxx @@ -171,6 +171,6 @@ class SVL_DLLPUBLIC SvtCacheOptions static SvtCacheOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! static sal_Int32 m_nRefCount ; /// internal ref count mechanism -}; // class SvtOptions3D +}; #endif // #ifndef INCLUDED_SVTOOLS_CACHEOPTIONS_HXX diff --git a/svtools/inc/cntwids.hrc b/svtools/inc/cntwids.hrc index 7b85dba9c5a7..fcb9f855453b 100644 --- a/svtools/inc/cntwids.hrc +++ b/svtools/inc/cntwids.hrc @@ -27,15 +27,6 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -//========================================================================= -// -// WID-definitions for CHAOS -// -// (C) 1997 StarDivision GmbH, Hamburg, Germany -// $Author: rt $ $Date: 2008-04-10 18:16:37 $ $Revision: 1.3 $ -// $Logfile: T:/svtools/inc/cntwids.hrv $ $Workfile: CNTWIDS.HRC $ -// -//========================================================================= #ifndef _CNTWIDS_HRC #define _CNTWIDS_HRC diff --git a/svtools/inc/imageresourceaccess.hxx b/svtools/inc/imageresourceaccess.hxx index 80c34599c7a3..5b6767c5f7c9 100644 --- a/svtools/inc/imageresourceaccess.hxx +++ b/svtools/inc/imageresourceaccess.hxx @@ -45,22 +45,23 @@ namespace svt //........................................................................ //==================================================================== - //= ImageResourceAccess + //= GraphicAccess //==================================================================== /** helper class for obtaining streams (which also can be used with the ImageProducer) from a resource */ - class ImageResourceAccess + class GraphicAccess { private: - ImageResourceAccess(); // never implemented + GraphicAccess(); // never implemented public: /** determines whether the given URL denotes an image within a resource + ( or an image specified by a vnd.sun.star.GraphicObject scheme URL ) */ - SVT_DLLPUBLIC static bool isImageResourceURL( const ::rtl::OUString& _rURL ); + SVT_DLLPUBLIC static bool isSupportedURL( const ::rtl::OUString& _rURL ); - /** for a given URL of an image within a resource, this method retrieves + /** for a given URL of an image within a resource ( or an image specified by a vnd.sun.star.GraphicObject scheme URL ), this method retrieves an SvStream for this image. This method works for arbitrary URLs denoting an image, since the @@ -74,7 +75,7 @@ namespace svt const ::rtl::OUString& _rImageResourceURL ); - /** for a given URL of an image within a resource, this method retrieves + /** for a given URL of an image within a resource ( or an image specified by a vnd.sun.star.GraphicObject scheme URL ), this method retrieves an <type scope="com::sun::star::io">XInputStream</type> for this image. */ SVT_DLLPUBLIC static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > diff --git a/svtools/inc/linguprops.hxx b/svtools/inc/linguprops.hxx index ace076dbc26a..883d5069f7a8 100644 --- a/svtools/inc/linguprops.hxx +++ b/svtools/inc/linguprops.hxx @@ -33,7 +33,7 @@ // UNO property names for general options -#define UPN_IS_GERMAN_PRE_REFORM "IsGermanPreReform" +#define UPN_IS_GERMAN_PRE_REFORM "IsGermanPreReform" /*! deprecated #i91949 !*/ #define UPN_IS_USE_DICTIONARY_LIST "IsUseDictionaryList" #define UPN_IS_IGNORE_CONTROL_CHARACTERS "IsIgnoreControlCharacters" #define UPN_ACTIVE_DICTIONARIES "ActiveDictionaries" @@ -58,8 +58,8 @@ #define UPN_IS_HYPH_AUTO "IsHyphAuto" #define UPN_IS_HYPH_SPECIAL "IsHyphSpecial" #define UPN_IS_SPELL_AUTO "IsSpellAuto" -#define UPN_IS_SPELL_HIDE "IsSpellHide" -#define UPN_IS_SPELL_IN_ALL_LANGUAGES "IsSpellInAllLanguages" +#define UPN_IS_SPELL_HIDE "IsSpellHide" /*! deprecated #i91949 !*/ +#define UPN_IS_SPELL_IN_ALL_LANGUAGES "IsSpellInAllLanguages" /*! deprecated #i91949 !*/ #define UPN_IS_SPELL_SPECIAL "IsSpellSpecial" #define UPN_IS_WRAP_REVERSE "IsWrapReverse" #define UPN_DATA_FILES_CHANGED_CHECK_VALUE "DataFilesChangedCheckValue" diff --git a/svtools/inc/numuno.hxx b/svtools/inc/numuno.hxx index 060e4bbc67d8..c31829dec020 100644 --- a/svtools/inc/numuno.hxx +++ b/svtools/inc/numuno.hxx @@ -38,6 +38,11 @@ class SvNumberFormatter; class SvNumFmtSuppl_Impl; +namespace comphelper +{ + class SharedMutex; +} + //------------------------------------------------------------------ // SvNumberFormatterServiceObj must be registered as service somewhere @@ -88,6 +93,8 @@ public: static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); static SvNumberFormatsSupplierObj* getImplementation( const com::sun::star::uno::Reference< com::sun::star::util::XNumberFormatsSupplier> xObj ); + + ::comphelper::SharedMutex& getSharedMutex() const; }; #endif // #ifndef _NUMUNO_HXX diff --git a/svtools/inc/searchopt.hxx b/svtools/inc/searchopt.hxx index a9aa72ee1735..4475f406805d 100644 --- a/svtools/inc/searchopt.hxx +++ b/svtools/inc/searchopt.hxx @@ -63,6 +63,7 @@ public: BOOL IsSimilaritySearch() const; BOOL IsUseAsianOptions() const; BOOL IsMatchCase() const; // also Japanese search option + BOOL IsNotes() const; void SetWholeWordsOnly( BOOL bVal ); void SetBackwards( BOOL bVal ); @@ -71,6 +72,7 @@ public: void SetSimilaritySearch( BOOL bVal ); void SetUseAsianOptions( BOOL bVal ); void SetMatchCase( BOOL bVal ); // also Japanese search option + void SetNotes( BOOL bVal); // // Japanese search options diff --git a/svtools/inc/svtools/colorcfg.hxx b/svtools/inc/svtools/colorcfg.hxx index b1f19ae8469e..9a0d570e7cc0 100644 --- a/svtools/inc/svtools/colorcfg.hxx +++ b/svtools/inc/svtools/colorcfg.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: colorcfg.hxx,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.108.1 $ * * This file is part of OpenOffice.org. * @@ -82,6 +82,13 @@ enum ColorConfigEntry BASICOPERATOR , BASICKEYWORD , BASICERROR , + SQLIDENTIFIER, + SQLNUMBER, + SQLSTRING, + SQLOPERATOR, + SQLKEYWORD, + SQLPARAMETER, + SQLCOMMENT, ColorConfigEntryCount }; /* -----------------------------22.03.2002 15:36------------------------------ diff --git a/svtools/inc/svtools/ctloptions.hxx b/svtools/inc/svtools/ctloptions.hxx index df1ae548d5d6..6c09ad98a45e 100644 --- a/svtools/inc/svtools/ctloptions.hxx +++ b/svtools/inc/svtools/ctloptions.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ctloptions.hxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.164.1 $ * * This file is part of OpenOffice.org. * @@ -78,7 +78,8 @@ public: { NUMERALS_ARABIC = 0, NUMERALS_HINDI, - NUMERALS_SYSTEM + NUMERALS_SYSTEM, + NUMERALS_CONTEXT }; void SetCTLTextNumerals( TextNumerals _eNumerals ); TextNumerals GetCTLTextNumerals() const; diff --git a/svtools/inc/svtools/documentlockfile.hxx b/svtools/inc/svtools/documentlockfile.hxx index 5fdda51acb5b..73e64f4f04a5 100644 --- a/svtools/inc/svtools/documentlockfile.hxx +++ b/svtools/inc/svtools/documentlockfile.hxx @@ -79,6 +79,7 @@ public: sal_Bool CreateOwnLockFile(); ::com::sun::star::uno::Sequence< ::rtl::OUString > GetLockData(); ::com::sun::star::uno::Sequence< ::rtl::OUString > GenerateOwnEntry(); + sal_Bool OverwriteOwnLockFile(); void RemoveFile(); // the methods allow to control whether UI interaction regarding the locked document file is allowed diff --git a/svtools/inc/svtools/editsyntaxhighlighter.hxx b/svtools/inc/svtools/editsyntaxhighlighter.hxx new file mode 100644 index 000000000000..1af993a3ea8f --- /dev/null +++ b/svtools/inc/svtools/editsyntaxhighlighter.hxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: svmedit.hxx,v $ + * $Revision: 1.3.108.4 $ + * + * 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 _EDITSYNTAXHIGHLIGHTER_HXX +#define _EDITSYNTAXHIGHLIGHTER_HXX + +#include <svtools/svmedit.hxx> +#include <svtools/syntaxhighlight.hxx> +#include <svtools/svtdllapi.h> +#include <svtools/colorcfg.hxx> + +class SVT_DLLPUBLIC MultiLineEditSyntaxHighlight : public MultiLineEdit +{ + private: + bool mbDoBracketHilight; + SyntaxHighlighter aHighlighter; + svtools::ColorConfig m_aColorConfig; + + private: + virtual void DoBracketHilight(USHORT aKey); + + protected: + virtual long PreNotify( NotifyEvent& rNEvt ); + + public: + MultiLineEditSyntaxHighlight( Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER , HighlighterLanguage aLanguage = HIGHLIGHT_SQL); + MultiLineEditSyntaxHighlight( Window* pParent, const ResId& rResId , HighlighterLanguage aLanguage = HIGHLIGHT_SQL); + ~MultiLineEditSyntaxHighlight(); + + void EnableBracketHilight(bool aHilight = true); + bool IsBracketHilight(); + virtual void UpdateData(); + virtual void SetText(const String& rNewText); + virtual void SetText( const XubString& rStr, const Selection& rNewSelection ) + { SetText( rStr ); SetSelection( rNewSelection ); } + + Color GetColorValue(TokenTypes aToken); +}; + +#endif diff --git a/svtools/inc/svtools/filerec.hxx b/svtools/inc/svtools/filerec.hxx index 242f49bba855..77ba6c1b5c52 100644 --- a/svtools/inc/svtools/filerec.hxx +++ b/svtools/inc/svtools/filerec.hxx @@ -978,7 +978,7 @@ inline void SfxMultiFixRecordWriter::NewContent() #ifdef DBG_UTIL ULONG nOldStartPos; // Startposition des aktuellen Contents merken - Achtung Subklassen! - DBG(nOldStartPos = _nContentStartPos;) + nOldStartPos = _nContentStartPos; #endif _nContentStartPos = _pStream->Tell(); diff --git a/svtools/inc/svtools/inettbc.hxx b/svtools/inc/svtools/inettbc.hxx index 821c102d046a..338e3adb5a1a 100644 --- a/svtools/inc/svtools/inettbc.hxx +++ b/svtools/inc/svtools/inettbc.hxx @@ -50,6 +50,7 @@ friend class SvtMatchContext_Impl; friend class SvtURLBox_Impl; Link aOpenHdl; String aBaseURL; + String aPlaceHolder; SvtMatchContext_Impl* pCtx; SvtURLBox_Impl* pImp; INetProtocol eSmartProtocol; @@ -104,6 +105,9 @@ public: inline void EnableAutocompletion( BOOL _bEnable = TRUE ) { bIsAutoCompleteEnabled = _bEnable; } + void SetPlaceHolder( const String& sPlaceHolder ) { aPlaceHolder = sPlaceHolder; } + String GetPlaceHolder() { return aPlaceHolder; } + bool MatchesPlaceHolder( const String& sToMatch ) { return ( ( aPlaceHolder.Len() > 0 ) && ( aPlaceHolder == sToMatch ) ); } }; #endif diff --git a/svtools/inc/svtools/lingucfg.hxx b/svtools/inc/svtools/lingucfg.hxx index 7bafab0215e5..dd3dbdef811f 100644 --- a/svtools/inc/svtools/lingucfg.hxx +++ b/svtools/inc/svtools/lingucfg.hxx @@ -78,15 +78,11 @@ struct SVL_DLLPUBLIC SvtLinguOptions // spelling options (non-service specific) BOOL bIsSpellSpecial; - BOOL bIsSpellInAllLanguages; BOOL bIsSpellAuto; - BOOL bIsSpellHideMarkings; BOOL bIsSpellReverse; BOOL bROIsSpellSpecial; - BOOL bROIsSpellInAllLanguages; BOOL bROIsSpellAuto; - BOOL bROIsSpellHideMarkings; BOOL bROIsSpellReverse; // hyphenation options (non-service specific) @@ -97,11 +93,9 @@ struct SVL_DLLPUBLIC SvtLinguOptions BOOL bROIsHyphAuto; // common to SpellChecker, Hyphenator and Thesaurus service - BOOL bIsGermanPreReform; BOOL bIsUseDictionaryList; BOOL bIsIgnoreControlCharacters; - BOOL bROIsGermanPreReform; BOOL bROIsUseDictionaryList; BOOL bROIsIgnoreControlCharacters; @@ -164,11 +158,6 @@ struct SVL_DLLPUBLIC SvtLinguConfigDictionaryEntry class SVL_DLLPUBLIC SvtLinguConfig: public svt::detail::Options { - - // disallow copy-constructor and assignment-operator for now - SvtLinguConfig( const SvtLinguConfig & ); - SvtLinguConfig & operator = ( const SvtLinguConfig & ); - // returns static object SVL_DLLPRIVATE SvtLinguConfigItem & GetConfigItem(); @@ -182,6 +171,12 @@ class SVL_DLLPUBLIC SvtLinguConfig: public svt::detail::Options com::sun::star::uno::Sequence< rtl::OUString > GetCurrentOrLastActiveDicts_Impl( const rtl::OUString &rPropName ) const; void SetCurrentOrLastActiveDicts_Impl( const rtl::OUString &rPropName, const com::sun::star::uno::Sequence< rtl::OUString > &rDictionaries ) const; + rtl::OUString GetVendorImageUrl_Impl( const rtl::OUString &rServiceImplName, const rtl::OUString &rImageName ) const; + + // disallow copy-constructor and assignment-operator for now + SvtLinguConfig( const SvtLinguConfig & ); + SvtLinguConfig & operator = ( const SvtLinguConfig & ); + public: SvtLinguConfig(); virtual ~SvtLinguConfig(); @@ -234,10 +229,12 @@ public: // std::vector< SvtLinguConfigDictionaryEntry > GetActiveDictionariesByFormat( const rtl::OUString &rFormatName ); - ::rtl::OUString GetSpellAndGrammarDialogImage( LanguageType nLang ) const; - ::rtl::OUString GetSpellAndGrammarContextImage( LanguageType nLang ) const; - bool HasAnySpellAndGrammarDialogImage() const; - bool HasAnySpellAndGrammarContextImage() const; + // functions returning file URLs to the respective images (if found) and empty string otherwise + ::rtl::OUString GetSpellAndGrammarDialogImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; + ::rtl::OUString GetSpellAndGrammarContextSuggestionImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; + ::rtl::OUString GetSpellAndGrammarContextDictionaryImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; + + bool HasAnyVendorImages() const; bool HasGrammarChecker() const; }; diff --git a/svtools/inc/svtools/options3d.hxx b/svtools/inc/svtools/options3d.hxx deleted file mode 100644 index dff3a6e2a3f0..000000000000 --- a/svtools/inc/svtools/options3d.hxx +++ /dev/null @@ -1,174 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: options3d.hxx,v $ - * $Revision: 1.3 $ - * - * 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 INCLUDED_SVTOOLS_OPTIONS3D_HXX -#define INCLUDED_SVTOOLS_OPTIONS3D_HXX - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include "svtools/svldllapi.h" -#include <sal/types.h> -#include <osl/mutex.hxx> -#include <rtl/ustring.hxx> -#include <svtools/options.hxx> - -//_________________________________________________________________________________________________________________ -// forward declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short forward declaration to our private date container implementation - @descr We use these class as internal member to support small memory requirements. - You can create the container if it is neccessary. The class which use these mechanism - is faster and smaller then a complete implementation! -*//*-*************************************************************************************************************/ - -class SvtOptions3D_Impl; - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short collect informations about startup features - @descr - - - @implements - - @base - - - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SVL_DLLPUBLIC SvtOptions3D: public svt::detail::Options -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short standard constructor and destructor - @descr This will initialize an instance with default values. - We implement these class with a refcount mechanism! Every instance of this class increase it - at create and decrease it at delete time - but all instances use the same data container! - He is implemented as a static member ... - - @seealso member m_nRefCount - @seealso member m_pDataContainer - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - SvtOptions3D(); - virtual ~SvtOptions3D(); - - //--------------------------------------------------------------------------------------------------------- - // interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short interface methods to get and set value of config key "org.openoffice.Office.Common/_3D-Engine/..." - @descr These options describe internal states to enable/disable features of installed office. - - IsDithering() - SetDithering() => Activate this field for dithering of 3D objects - - IsOpenGL() - SetOpenGL() => Activate this field for using OpenGL library - - IsOpenGL_Faster() - SetOpenGL_Faster() => Activate this field for optimized OpenGL calls - - IsShowFull() - SetShowFull() => Activate this field for fully shown 3D objects while construction - - @seealso configuration package "org.openoffice.Office.Common/_3D-Engine" - *//*-*****************************************************************************************************/ - - sal_Bool IsDithering() const; - sal_Bool IsOpenGL() const; - sal_Bool IsOpenGL_Faster() const; - sal_Bool IsShowFull() const; - - void SetDithering( sal_Bool bState ); - void SetOpenGL( sal_Bool bState ); - void SetOpenGL_Faster( sal_Bool bState ); - void SetShowFull( sal_Bool bState ); - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return a reference to a static mutex - @descr These class use his own static mutex to be threadsafe. - We create a static mutex only for one ime and use at different times. - - @seealso - - - @param - - @return A reference to a static mutex member. - - @onerror - - *//*-*****************************************************************************************************/ - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - /*Attention - - Don't initialize these static member in these header! - a) Double dfined symbols will be detected ... - b) and unresolved externals exist at linking time. - Do it in your source only. - */ - - static SvtOptions3D_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! - static sal_Int32 m_nRefCount ; /// internal ref count mechanism - -}; // class SvtOptions3D - -#endif // #ifndef INCLUDED_SVTOOLS_OPTIONS3D_HXX diff --git a/svtools/inc/svtools/optionsdrawinglayer.hxx b/svtools/inc/svtools/optionsdrawinglayer.hxx index bc88072d404b..4e97de7d6792 100644 --- a/svtools/inc/svtools/optionsdrawinglayer.hxx +++ b/svtools/inc/svtools/optionsdrawinglayer.hxx @@ -168,12 +168,19 @@ class SVL_DLLPUBLIC SvtOptionsDrawinglayer void SetMaximumPaperTopMargin(sal_uInt32 nNew); void SetMaximumPaperBottomMargin(sal_uInt32 nNew); + // #i95644# helper to check if AA is allowed on this system. Currently, for WIN its disabled + // and OutDevSupport_TransparentRect is checked (this hits XRenderExtension, e.g. + // currently for SunRay as long as not supported there) + sal_Bool IsAAPossibleOnThisSystem() const; + // primitives sal_Bool IsAntiAliasing() const; + sal_Bool IsSolidDragCreate() const; sal_uInt32 GetQuadratic3DRenderLimit() const; sal_uInt32 GetQuadraticFormControlRenderLimit() const; void SetAntiAliasing( sal_Bool bState ); + void SetSolidDragCreate( sal_Bool bState ); void SetQuadratic3DRenderLimit(sal_uInt32 nNew); void SetQuadraticFormControlRenderLimit(sal_uInt32 nNew); diff --git a/svtools/inc/svtools/solar.hrc b/svtools/inc/svtools/solar.hrc index 71e02a169008..348422ef6477 100644 --- a/svtools/inc/svtools/solar.hrc +++ b/svtools/inc/svtools/solar.hrc @@ -164,6 +164,9 @@ #define RID_RPT_START (RID_OBJ_START+768) #define RID_RPT_END (RID_OBJ_START+1000) + +#define RID_FORMULA_START (RID_OBJ_START+1001) +#define RID_FORMULA_END (RID_OBJ_START+1200) // Help-Ids -------------------------------------------------------------- #define HID_OK_BUTTON 0 @@ -302,5 +305,8 @@ #define HID_RPT_START (HID_OBJ_START+1681) #define HID_RPT_END (HID_OBJ_START+2080) +#define HID_FORMULA_START (HID_OBJ_START+2081) +#define HID_FORMULA_END (HID_OBJ_START+2280) + #endif diff --git a/svtools/inc/svtools/svlbox.hxx b/svtools/inc/svtools/svlbox.hxx index 455a25dd14c7..ba119263eff8 100644 --- a/svtools/inc/svtools/svlbox.hxx +++ b/svtools/inc/svtools/svlbox.hxx @@ -655,8 +655,8 @@ inline SvViewDataItem* SvLBox::GetViewDataItem( SvListEntry* pEntry, { SvViewDataEntry* pEntryData = (SvViewDataEntry*)SvListView::GetViewData(pEntry); - DBG_ASSERT(pEntryData,"Entry not in View") - DBG_ASSERT(pEntryData->pItemData,"No ItemData") + DBG_ASSERT(pEntryData,"Entry not in View"); + DBG_ASSERT(pEntryData->pItemData,"No ItemData"); USHORT nItemPos = ((SvLBoxEntry*)pEntry)->GetPos( pItem ); return (pEntryData->pItemData+nItemPos); } diff --git a/svtools/inc/svtools/svmedit.hxx b/svtools/inc/svtools/svmedit.hxx index 39dcb2cfe05a..b1e0d368c9ba 100644 --- a/svtools/inc/svtools/svmedit.hxx +++ b/svtools/inc/svtools/svmedit.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: svmedit.hxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.108.4 $ * * This file is part of OpenOffice.org. * @@ -31,11 +31,12 @@ #ifndef _SVEDIT_HXX #define _SVEDIT_HXX -#include "svtools/svtdllapi.h" #include <vcl/wintypes.hxx> -#ifndef _EDIT_HXX //autogen #include <vcl/edit.hxx> -#endif + +#include <svtools/syntaxhighlight.hxx> +#include <svtools/svtdllapi.h> +#include <svtools/colorcfg.hxx> class ImpSvMEdit; class Timer; @@ -58,7 +59,7 @@ protected: DECL_LINK( ImpUpdateDataHdl, Timer* ); void StateChanged( StateChangedType nType ); void DataChanged( const DataChangedEvent& rDCEvt ); - long PreNotify( NotifyEvent& rNEvt ); + virtual long PreNotify( NotifyEvent& rNEvt ); long Notify( NotifyEvent& rNEvt ); void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); WinBits ImplInitStyle( WinBits nStyle ); @@ -152,5 +153,4 @@ inline ULONG MultiLineEdit::IsUpdateDataEnabled() const return pUpdateDataTimer ? pUpdateDataTimer->GetTimeout() : 0; } - #endif diff --git a/svtools/inc/svtools/syntaxhighlight.hxx b/svtools/inc/svtools/syntaxhighlight.hxx new file mode 100644 index 000000000000..e2b575c7e085 --- /dev/null +++ b/svtools/inc/svtools/syntaxhighlight.hxx @@ -0,0 +1,194 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: syntaxhighlight.hxx,v $ + * $Revision: 1.1.2.3 $ + * + * 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 _SVTOOLS_SYNTAXHIGHLIGHT_HXX +#define _SVTOOLS_SYNTAXHIGHLIGHT_HXX + +#include <list> + +#include <vos/macros.hxx> +#include <vos/mutex.hxx> + +#include <vcl/svapp.hxx> + +#include <tools/stream.hxx> +#include <tools/shl.hxx> + +#include <svtools/brdcst.hxx> +#include <svtools/svtdllapi.h> + + +// for the bsearch +#ifdef WNT +#define CDECL _cdecl +#endif +#if defined(UNX) || defined(OS2) +#define CDECL +#endif +#ifdef UNX +#include <sys/resource.h> +#endif + +#include <stdio.h> + +#include <tools/string.hxx> +#include <tools/gen.hxx> + +#include <svtools/svarray.hxx> + + +// Token-Typen TT_... +enum TokenTypes +{ + TT_UNKNOWN, + TT_IDENTIFIER, + TT_WHITESPACE, + TT_NUMBER, + TT_STRING, + TT_EOL, + TT_COMMENT, + TT_ERROR, + TT_OPERATOR, + TT_KEYWORDS, + TT_PARAMETER +}; + +struct HighlightPortion { UINT16 nBegin; UINT16 nEnd; TokenTypes tokenType; }; + + + +SV_DECL_VARARR(HighlightPortions, HighlightPortion, 0, 16) + +///////////////////////////////////////////////////////////////////////// +// Hilfsklasse zur Untersuchung von JavaScript-Modulen, zunaechst zum +// Heraussuchen der Funktionen, spaeter auch zum Syntax-Highlighting verwenden + +// Flags fuer Zeichen-Eigenschaften +#define CHAR_START_IDENTIFIER 0x0001 +#define CHAR_IN_IDENTIFIER 0x0002 +#define CHAR_START_NUMBER 0x0004 +#define CHAR_IN_NUMBER 0x0008 +#define CHAR_IN_HEX_NUMBER 0x0010 +#define CHAR_IN_OCT_NUMBER 0x0020 +#define CHAR_START_STRING 0x0040 +#define CHAR_OPERATOR 0x0080 +#define CHAR_SPACE 0x0100 +#define CHAR_EOL 0x0200 + +#define CHAR_EOF 0x00 + + +// Sprachmodus des HighLighters (spaeter eventuell feiner +// differenzieren mit Keyword-Liste, C-Kommentar-Flag) +enum HighlighterLanguage +{ + HIGHLIGHT_BASIC, + HIGHLIGHT_SQL +}; + +class SimpleTokenizer_Impl +{ + HighlighterLanguage aLanguage; + // Zeichen-Info-Tabelle + USHORT aCharTypeTab[256]; + + const sal_Unicode* mpStringBegin; + const sal_Unicode* mpActualPos; + + // Zeile und Spalte + UINT32 nLine; + UINT32 nCol; + + sal_Unicode peekChar( void ) { return *mpActualPos; } + sal_Unicode getChar( void ) { nCol++; return *mpActualPos++; } + + // Hilfsfunktion: Zeichen-Flag Testen + BOOL testCharFlags( sal_Unicode c, USHORT nTestFlags ); + + // Neues Token holen, Leerstring == nix mehr da + 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 ); + +#ifndef PRODUCT + // TEST: Token ausgeben + String getFullTokenStr( /*out*/TokenTypes eType, + /*out*/const sal_Unicode* pStartPos, /*out*/const sal_Unicode* pEndPos ); +#endif + + const char** ppListKeyWords; + UINT16 nKeyWordCount; + +public: + SimpleTokenizer_Impl( HighlighterLanguage aLang = HIGHLIGHT_BASIC ); + ~SimpleTokenizer_Impl( void ); + + UINT16 parseLine( UINT32 nLine, const String* aSource ); + void getHighlightPortions( UINT32 nParseLine, const String& rLine, + /*out*/HighlightPortions& portions ); + void setKeyWords( const char** ppKeyWords, UINT16 nCount ); +}; + + +//*** SyntaxHighlighter-Klasse *** +// Konzept: Der Highlighter wird ueber alle Aenderungen im Source +// informiert (notifyChange) und liefert dem Aufrufer jeweils die +// Information zurueck, welcher Zeilen-Bereich des Source-Codes +// aufgrund dieser Aenderung neu gehighlighted werden muss. +// Dazu merkt sich Highlighter intern fuer jede Zeile, ob dort +// C-Kommentare beginnen oder enden. +class SVT_DLLPUBLIC SyntaxHighlighter +{ + HighlighterLanguage eLanguage; + SimpleTokenizer_Impl* m_pSimpleTokenizer; + char* m_pKeyWords; + UINT16 m_nKeyWordCount; + +// void initializeKeyWords( HighlighterLanguage eLanguage ); + +public: + SyntaxHighlighter( void ); + ~SyntaxHighlighter( void ); + + // HighLighter (neu) initialisieren, die Zeilen-Tabelle wird + // dabei komplett geloescht, d.h. im Abschluss wird von einem + // leeren Source ausgegangen. In notifyChange() kann dann + // nur Zeile 0 angegeben werden. + void initialize( HighlighterLanguage eLanguage_ ); + + const Range notifyChange( UINT32 nLine, INT32 nLineCountDifference, + const String* pChangedLines, UINT32 nArrayLength); + + void getHighlightPortions( UINT32 nLine, const String& rLine, + HighlightPortions& pPortions ); + + HighlighterLanguage GetLanguage() { return eLanguage;} +}; +#endif diff --git a/svtools/inc/svtools/textview.hxx b/svtools/inc/svtools/textview.hxx index d479d3c638fc..b7bdd2a606db 100644 --- a/svtools/inc/svtools/textview.hxx +++ b/svtools/inc/svtools/textview.hxx @@ -136,6 +136,8 @@ public: String GetSelected( LineEnd aSeparator ); void DeleteSelected(); + void InsertNewText( const rtl::OUString& rNew, BOOL bSelect = FALSE ); + // deprecated: use InsertNewText instead void InsertText( const String& rNew, BOOL bSelect = FALSE ); BOOL KeyInput( const KeyEvent& rKeyEvent ); diff --git a/svtools/inc/svtools/treelist.hxx b/svtools/inc/svtools/treelist.hxx index 9c0b6ff0e7da..f1cfb7289bbd 100644 --- a/svtools/inc/svtools/treelist.hxx +++ b/svtools/inc/svtools/treelist.hxx @@ -398,30 +398,30 @@ public: inline BOOL SvListView::IsExpanded( SvListEntry* pEntry ) const { - DBG_ASSERT(pEntry,"IsExpanded:No Entry") + DBG_ASSERT(pEntry,"IsExpanded:No Entry"); SvViewData* pData = (SvViewData*)aDataTable.Get( (ULONG)pEntry ); - DBG_ASSERT(pData,"Entry not in Table") + DBG_ASSERT(pData,"Entry not in Table"); return pData->IsExpanded(); } inline BOOL SvListView::IsSelected( SvListEntry* pEntry ) const { - DBG_ASSERT(pEntry,"IsExpanded:No Entry") + DBG_ASSERT(pEntry,"IsExpanded:No Entry"); SvViewData* pData = (SvViewData*)aDataTable.Get( (ULONG)pEntry ); - DBG_ASSERT(pData,"Entry not in Table") + DBG_ASSERT(pData,"Entry not in Table"); return pData->IsSelected(); } inline BOOL SvListView::HasEntryFocus( SvListEntry* pEntry ) const { - DBG_ASSERT(pEntry,"IsExpanded:No Entry") + DBG_ASSERT(pEntry,"IsExpanded:No Entry"); SvViewData* pData = (SvViewData*)aDataTable.Get( (ULONG)pEntry ); - DBG_ASSERT(pData,"Entry not in Table") + DBG_ASSERT(pData,"Entry not in Table"); return pData->HasFocus(); } inline void SvListView::SetEntryFocus( SvListEntry* pEntry, BOOL bFocus ) const { - DBG_ASSERT(pEntry,"SetEntryFocus:No Entry") + DBG_ASSERT(pEntry,"SetEntryFocus:No Entry"); SvViewData* pData = (SvViewData*)aDataTable.Get( (ULONG)pEntry ); - DBG_ASSERT(pData,"Entry not in Table") + DBG_ASSERT(pData,"Entry not in Table"); pData->SetFocus(bFocus); } @@ -431,7 +431,7 @@ inline SvViewData* SvListView::GetViewData( SvListEntry* pEntry ) const return (SvViewData*)aDataTable.Get( (ULONG)pEntry ); #else SvViewData* pResult = (SvViewData*)aDataTable.Get( (ULONG)pEntry ); - DBG_ASSERT(pResult,"Entry not in model or wrong view") + DBG_ASSERT(pResult,"Entry not in model or wrong view"); return pResult; #endif } diff --git a/svtools/inc/svtools/useroptions.hxx b/svtools/inc/svtools/useroptions.hxx index df5379e649a0..f5a07a2e4e79 100644 --- a/svtools/inc/svtools/useroptions.hxx +++ b/svtools/inc/svtools/useroptions.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: useroptions.hxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.2.312.2 $ * * This file is part of OpenOffice.org. * @@ -77,51 +77,50 @@ public: virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); // get the address token - const String& GetCompany() const; - const String& GetFirstName() const; - const String& GetLastName() const; - const String& GetID() const; - const String& GetStreet() const; - const String& GetCity() const; - const String& GetState() const; - const String& GetZip() const; - const String& GetCountry() const; - const String& GetPosition() const; - const String& GetTitle() const; - const String& GetTelephoneHome() const; - const String& GetTelephoneWork() const; - const String& GetFax() const; - const String& GetEmail() const; - const String& GetCustomerNumber() const; - const String& GetFathersName() const; - const String& GetApartment() const; + ::rtl::OUString GetCompany() const; + ::rtl::OUString GetFirstName() const; + ::rtl::OUString GetLastName() const; + ::rtl::OUString GetID() const; + ::rtl::OUString GetStreet() const; + ::rtl::OUString GetCity() const; + ::rtl::OUString GetState() const; + ::rtl::OUString GetZip() const; + ::rtl::OUString GetCountry() const; + ::rtl::OUString GetPosition() const; + ::rtl::OUString GetTitle() const; + ::rtl::OUString GetTelephoneHome() const; + ::rtl::OUString GetTelephoneWork() const; + ::rtl::OUString GetFax() const; + ::rtl::OUString GetEmail() const; + ::rtl::OUString GetCustomerNumber() const; + ::rtl::OUString GetFathersName() const; + ::rtl::OUString GetApartment() const; - const String& GetFullName() const; - const String& GetLocale() const; + ::rtl::OUString GetFullName() const; + ::rtl::OUString GetLocale() const; // set the address token - void SetCompany( const String& rNewToken ); - void SetFirstName( const String& rNewToken ); - void SetLastName( const String& rNewToken ); - void SetID( const String& rNewToken ); - void SetStreet( const String& rNewToken ); - void SetCity( const String& rNewToken ); - void SetState( const String& rNewToken ); - void SetZip( const String& rNewToken ); - void SetCountry( const String& rNewToken ); - void SetPosition( const String& rNewToken ); - void SetTitle( const String& rNewToken ); - void SetTelephoneHome( const String& rNewToken ); - void SetTelephoneWork( const String& rNewToken ); - void SetFax( const String& rNewToken ); - void SetEmail( const String& rNewToken ); - void SetCustomerNumber( const String& rNewToken ); - void SetFathersName( const String& rNewToken ); - void SetApartment( const String& rNewToken ); + void SetCompany( const ::rtl::OUString& rNewToken ); + void SetFirstName( const ::rtl::OUString& rNewToken ); + void SetLastName( const ::rtl::OUString& rNewToken ); + void SetID( const ::rtl::OUString& rNewToken ); + void SetStreet( const ::rtl::OUString& rNewToken ); + void SetCity( const ::rtl::OUString& rNewToken ); + void SetState( const ::rtl::OUString& rNewToken ); + void SetZip( const ::rtl::OUString& rNewToken ); + void SetCountry( const ::rtl::OUString& rNewToken ); + void SetPosition( const ::rtl::OUString& rNewToken ); + void SetTitle( const ::rtl::OUString& rNewToken ); + void SetTelephoneHome( const ::rtl::OUString& rNewToken ); + void SetTelephoneWork( const ::rtl::OUString& rNewToken ); + void SetFax( const ::rtl::OUString& rNewToken ); + void SetEmail( const ::rtl::OUString& rNewToken ); + void SetCustomerNumber( const ::rtl::OUString& rNewToken ); + void SetFathersName( const ::rtl::OUString& rNewToken ); + void SetApartment( const ::rtl::OUString& rNewToken ); sal_Bool IsTokenReadonly( USHORT nToken ) const; - const String& GetToken(USHORT nToken) const; + ::rtl::OUString GetToken(USHORT nToken) const; }; #endif // #ifndef INCLUDED_SVTOOLS_USEROPTIONS_HXX - diff --git a/svtools/inc/svtools/zforlist.hxx b/svtools/inc/svtools/zforlist.hxx index 174e4f181d3b..814ca385d61a 100644 --- a/svtools/inc/svtools/zforlist.hxx +++ b/svtools/inc/svtools/zforlist.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: zforlist.hxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.148.1 $ * * This file is part of OpenOffice.org. * @@ -45,6 +45,8 @@ #include <tools/link.hxx> #include <svtools/nfkeytab.hxx> +#include <map> + class Date; class SvStream; class Color; @@ -224,6 +226,8 @@ typedef Table SvNumberFormatTable; typedef Table SvNumberFormatterIndexTable; #endif +typedef ::std::map< sal_uInt32, sal_uInt32 > SvNumberFormatterMergeMap; + /** Language/country dependent currency entries */ @@ -599,6 +603,11 @@ public: /// Return the new format index for an old format index, if a merge table exists inline sal_uInt32 GetMergeFmtIndex( sal_uInt32 nOldFmt ) const; + /** Convert the ugly old tools' Table type bloated with new'ed sal_uInt32 + entries merge table to ::std::map with old index key and new index key. + @ATTENTION! Also clears the old table using ClearMergeTable() */ + SvNumberFormatterMergeMap ConvertMergeTableToMap(); + /// Return the last used position ever of a language/country combination USHORT GetLastInsertKey(sal_uInt32 CLOffset); diff --git a/svtools/prj/build.lst b/svtools/prj/build.lst index d1dce07c9870..ee2414e0da59 100644 --- a/svtools/prj/build.lst +++ b/svtools/prj/build.lst @@ -1,4 +1,4 @@ -st svtools : offuh toolkit ucbhelper unotools JPEG:jpeg cppu cppuhelper comphelper sal jvmfwk NULL +st svtools : offuh toolkit ucbhelper unotools JPEG:jpeg cppu cppuhelper comphelper sal sot jvmfwk NULL st svtools usr1 - all st_mkout NULL st svtools\inc nmake - all st_inc NULL st svtools\inc\sane get - all st_incsa NULL diff --git a/svtools/prj/d.lst b/svtools/prj/d.lst index 26bd5653f304..bd3f87f0e2b3 100644 --- a/svtools/prj/d.lst +++ b/svtools/prj/d.lst @@ -154,6 +154,8 @@ mkdir: %_DEST%\inc%_EXT%\svtools ..\inc\urlbmk.hxx %_DEST%\inc%_EXT%\svtools\urlbmk.hxx ..\inc\inetimg.hxx %_DEST%\inc%_EXT%\svtools\inetimg.hxx ..\inc\svtools\svmedit.hxx %_DEST%\inc%_EXT%\svtools\svmedit.hxx +..\inc\svtools\editsyntaxhighlighter.hxx %_DEST%\inc%_EXT%\svtools\editsyntaxhighlighter.hxx +..\inc\svtools\syntaxhighlight.hxx %_DEST%\inc%_EXT%\svtools\syntaxhighlight.hxx ..\inc\svtools\svmedit2.hxx %_DEST%\inc%_EXT%\svtools\svmedit2.hxx ..\inc\svtools\svstdarr.hxx %_DEST%\inc%_EXT%\svtools\svstdarr.hxx ..\inc\svtools\metitem.hxx %_DEST%\inc%_EXT%\svtools\metitem.hxx diff --git a/svtools/qa/complex/ConfigItems/CheckConfigItems.java b/svtools/qa/complex/ConfigItems/CheckConfigItems.java new file mode 100644 index 000000000000..97cc21fdec9f --- /dev/null +++ b/svtools/qa/complex/ConfigItems/CheckConfigItems.java @@ -0,0 +1,186 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: CheckConfigItems.java,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:09:22 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +package complex.ConfigItems; + +import com.sun.star.beans.*; +import com.sun.star.lang.*; +import com.sun.star.uno.*; +import com.sun.star.task.*; + +import complexlib.*; + +import java.lang.*; +import java.util.*; + +//----------------------------------------------- +/** @short todo document me + */ +public class CheckConfigItems extends ComplexTestCase +{ + //------------------------------------------- + // some const + + //------------------------------------------- + // member + + /** points to the global uno service manager. */ + private XMultiServiceFactory m_xSmgr = null; + + /** implements real config item tests in C++. */ + private XJob m_xTest = null; + + //------------------------------------------- + // test environment + + //------------------------------------------- + /** @short A function to tell the framework, + which test functions are available. + + @return All test methods. + @todo Think about selection of tests from outside ... + */ + public String[] getTestMethodNames() + { + return new String[] + { + "checkPicklist", + "checkURLHistory", + "checkHelpBookmarks", + "checkPrintOptions", + "checkAccessibilityOptions", + "checkUserOptions" + }; + } + + //------------------------------------------- + /** @short Create the environment for following tests. + + @descr Use either a component loader from desktop or + from frame + */ + public void before() + throws java.lang.Exception + { + // get uno service manager from global test environment + m_xSmgr = (XMultiServiceFactory)param.getMSF(); + + // TODO register helper service + + // create module manager + m_xTest = (XJob)UnoRuntime.queryInterface( + XJob.class, + m_xSmgr.createInstance("com.sun.star.comp.svtools.ConfigItemTest")); + } + + //------------------------------------------- + /** @short close the environment. + */ + public void after() + throws java.lang.Exception + { + // TODO deregister helper service + + m_xTest = null; + m_xSmgr = null; + } + + //------------------------------------------- + /** @todo document me + */ + public void checkPicklist() + throws java.lang.Exception + { + impl_triggerTest("checkPicklist"); + } + + //------------------------------------------- + /** @todo document me + */ + public void checkURLHistory() + throws java.lang.Exception + { + impl_triggerTest("checkURLHistory"); + } + + //------------------------------------------- + /** @todo document me + */ + public void checkHelpBookmarks() + throws java.lang.Exception + { + impl_triggerTest("checkHelpBookmarks"); + } + + //------------------------------------------- + /** @todo document me + */ + public void checkPrintOptions() + throws java.lang.Exception + { + impl_triggerTest("checkPrintOptions"); + } + + //------------------------------------------- + /** @todo document me + */ + public void checkAccessibilityOptions() + throws java.lang.Exception + { + impl_triggerTest("checkAccessibilityOptions"); + } + + //------------------------------------------- + /** @todo document me + */ + public void checkUserOptions() + throws java.lang.Exception + { + impl_triggerTest("checkUserOptions"); + } + + //------------------------------------------- + /** @todo document me + */ + private void impl_triggerTest(String sTest) + throws java.lang.Exception + { + NamedValue[] lArgs = new NamedValue[1]; + lArgs[0] = new NamedValue(); + lArgs[0].Name = "Test"; + lArgs[0].Value = sTest; + m_xTest.execute(lArgs); + } +} diff --git a/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx b/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx new file mode 100644 index 000000000000..d853bf926467 --- /dev/null +++ b/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx @@ -0,0 +1,400 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibilityOptTest.cxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:09:23 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include "AccessibilityOptTest.hxx" +#include "configitems/accessibilityoptions_const.hxx" + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XNameAccess.hpp> + +#include <comphelper/configurationhelper.hxx> +#include <unotools/processfactory.hxx> + +namespace css = ::com::sun::star; + +AccessibilityOptTest::AccessibilityOptTest() +{ + m_xCfg = css::uno::Reference< css::container::XNameAccess >( + ::comphelper::ConfigurationHelper::openConfig( + ::utl::getProcessServiceFactory(), + s_sAccessibility, + ::comphelper::ConfigurationHelper::E_STANDARD), + css::uno::UNO_QUERY); +} + +AccessibilityOptTest::~AccessibilityOptTest() +{ + if (m_xCfg.is()) + m_xCfg.clear(); +} + +//============================================================================= +//test GetAutoDetectSystemHC() +void AccessibilityOptTest::impl_checkGetAutoDetectSystemHC() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bAutoDetectSystemHC; + sal_Bool bAutoDetectSystemHC_; + + bAutoDetectSystemHC = aAccessibilityOpt.GetAutoDetectSystemHC(); + xSet->setPropertyValue( s_sAutoDetectSystemHC, css::uno::makeAny(bAutoDetectSystemHC ? sal_False:sal_True) ); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + bAutoDetectSystemHC_ = aAccessibilityOpt.GetAutoDetectSystemHC(); + + if ( bAutoDetectSystemHC_ == bAutoDetectSystemHC )//old config item will not throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetAutoDetectSystemHC() error!")), 0); +} + +//============================================================================= +//test GetIsForPagePreviews() +void AccessibilityOptTest::impl_checkGetIsForPagePreviews() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsForPagePreviews ; + sal_Bool bIsForPagePreviews_; + + bIsForPagePreviews = aAccessibilityOpt.GetIsForPagePreviews(); + xSet->setPropertyValue( s_sIsForPagePreviews, css::uno::makeAny(bIsForPagePreviews ? sal_False:sal_True) ); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + bIsForPagePreviews_ = aAccessibilityOpt.GetIsForPagePreviews(); + + if ( bIsForPagePreviews_ == bIsForPagePreviews )//old config item will not throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsForPagePreviews() error!")), 0); +} + +//============================================================================= +//test impl_checkGetIsHelpTipsDisappear() +void AccessibilityOptTest::impl_checkGetIsHelpTipsDisappear() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsHelpTipsDisappear ; + sal_Bool bIsHelpTipsDisappear_; + + bIsHelpTipsDisappear = aAccessibilityOpt.GetIsHelpTipsDisappear(); + xSet->setPropertyValue( s_sIsHelpTipsDisappear, css::uno::makeAny(bIsHelpTipsDisappear ? sal_False:sal_True) ); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + bIsHelpTipsDisappear_ = aAccessibilityOpt.GetIsHelpTipsDisappear(); + + if ( bIsHelpTipsDisappear_ == bIsHelpTipsDisappear )//old config item will not throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsHelpTipsDisappear() error!")), 0); +} + +//============================================================================= +//test impl_checkGetIsAllowAnimatedGraphics() +void AccessibilityOptTest::impl_checkGetIsAllowAnimatedGraphics() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsAllowAnimatedGraphics ; + sal_Bool bIsAllowAnimatedGraphics_; + + bIsAllowAnimatedGraphics = aAccessibilityOpt.GetIsAllowAnimatedGraphics(); + xSet->setPropertyValue( s_sIsAllowAnimatedGraphics, css::uno::makeAny(bIsAllowAnimatedGraphics ? sal_False:sal_True) ); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + bIsAllowAnimatedGraphics_ = aAccessibilityOpt.GetIsAllowAnimatedGraphics(); + + if ( bIsAllowAnimatedGraphics_ == bIsAllowAnimatedGraphics )//old config item will not throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsAllowAnimatedGraphics() error!")), 0); +} + +//============================================================================= +//test impl_checkGetIsAllowAnimatedText() +void AccessibilityOptTest::impl_checkGetIsAllowAnimatedText() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsAllowAnimatedText ; + sal_Bool bIsAllowAnimatedText_; + + bIsAllowAnimatedText = aAccessibilityOpt.GetIsAllowAnimatedText(); + xSet->setPropertyValue( s_sIsAllowAnimatedText, css::uno::makeAny(bIsAllowAnimatedText ? sal_False:sal_True) ); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + bIsAllowAnimatedText_ = aAccessibilityOpt.GetIsAllowAnimatedText(); + + if ( bIsAllowAnimatedText_ == bIsAllowAnimatedText )//old config item will not throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsAllowAnimatedText() error!")), 0); +} + +//============================================================================= +//test impl_checkGetIsAutomaticFontColor() +void AccessibilityOptTest::impl_checkGetIsAutomaticFontColor() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsAutomaticFontColor ; + sal_Bool bIsAutomaticFontColor_; + + bIsAutomaticFontColor = aAccessibilityOpt.GetIsAutomaticFontColor(); + xSet->setPropertyValue( s_sIsAutomaticFontColor, css::uno::makeAny(bIsAutomaticFontColor ? sal_False:sal_True) ); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + bIsAutomaticFontColor_ = aAccessibilityOpt.GetIsAutomaticFontColor(); + + if ( bIsAutomaticFontColor_ == bIsAutomaticFontColor )//old config item will not throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsAutomaticFontColor() error!")), 0); +} + +//============================================================================= +//test impl_checkGetIsSystemFont() +void AccessibilityOptTest::impl_checkGetIsSystemFont() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsSystemFont ; + sal_Bool bIsSystemFont_; + + bIsSystemFont = aAccessibilityOpt.GetIsSystemFont(); + xSet->setPropertyValue( s_sIsSystemFont, css::uno::makeAny(bIsSystemFont ? sal_False:sal_True) ); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + bIsSystemFont_ = aAccessibilityOpt.GetIsSystemFont(); + + if ( bIsSystemFont_ == bIsSystemFont )//old config item will not throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsSystemFont() error!")), 0); +} + +//============================================================================= +//test impl_checkGetHelpTipSeconds() +void AccessibilityOptTest::impl_checkGetHelpTipSeconds() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Int16 nHelpTipSeconds ; + sal_Int16 nHelpTipSeconds_; + + nHelpTipSeconds = aAccessibilityOpt.GetHelpTipSeconds(); + xSet->setPropertyValue( s_sHelpTipSeconds, css::uno::makeAny(sal_Int16(nHelpTipSeconds+1)) ); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + nHelpTipSeconds_ = aAccessibilityOpt.GetHelpTipSeconds(); + + if ( nHelpTipSeconds_ == nHelpTipSeconds )//old config item will not throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetHelpTipSeconds() error!")), 0); +} + +//============================================================================= +//test impl_checkIsSelectionInReadonly() +void AccessibilityOptTest::impl_checkIsSelectionInReadonly() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsSelectionInReadonly ; + sal_Bool bIsSelectionInReadonly_; + + bIsSelectionInReadonly = aAccessibilityOpt.IsSelectionInReadonly(); + xSet->setPropertyValue( s_sIsSelectionInReadonly, css::uno::makeAny(bIsSelectionInReadonly ? sal_False:sal_True) ); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + bIsSelectionInReadonly_ = aAccessibilityOpt.IsSelectionInReadonly(); + + if ( bIsSelectionInReadonly_ == bIsSelectionInReadonly )//old config item will not throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsSelectionInReadonly() error!")), 0); +} + +//============================================================================= +//test SetAutoDetectSystemHC() +void AccessibilityOptTest::impl_checkSetAutoDetectSystemHC() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bAutoDetectSystemHC; + sal_Bool bAutoDetectSystemHC_; + + xSet->getPropertyValue(s_sAutoDetectSystemHC) >>= bAutoDetectSystemHC; + aAccessibilityOpt.SetAutoDetectSystemHC( bAutoDetectSystemHC ? sal_False:sal_True ); + xSet->getPropertyValue(s_sAutoDetectSystemHC) >>= bAutoDetectSystemHC_; + + if ( bAutoDetectSystemHC_ == bAutoDetectSystemHC )//old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetAutoDetectSystemHC() error!")), 0); +} + +//============================================================================= +//test SetIsForPagePreviews() +void AccessibilityOptTest::impl_checkSetIsForPagePreviews() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsForPagePreviews ; + sal_Bool bIsForPagePreviews_; + + xSet->getPropertyValue(s_sIsForPagePreviews) >>= bIsForPagePreviews; + aAccessibilityOpt.SetIsForPagePreviews( bIsForPagePreviews ? sal_False:sal_True ); + xSet->getPropertyValue(s_sIsForPagePreviews) >>= bIsForPagePreviews_; + + if ( bIsForPagePreviews_ == bIsForPagePreviews )//old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsForPagePreviews() error!")), 0); +} + +//============================================================================= +//test impl_checkSetIsHelpTipsDisappear() +void AccessibilityOptTest::impl_checkSetIsHelpTipsDisappear() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsHelpTipsDisappear ; + sal_Bool bIsHelpTipsDisappear_; + + xSet->getPropertyValue(s_sIsHelpTipsDisappear) >>= bIsHelpTipsDisappear; + aAccessibilityOpt.SetIsHelpTipsDisappear( bIsHelpTipsDisappear ? sal_False:sal_True ); + xSet->getPropertyValue(s_sIsHelpTipsDisappear) >>= bIsHelpTipsDisappear_; + + if ( bIsHelpTipsDisappear_ == bIsHelpTipsDisappear )//old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsHelpTipsDisappear() error!")), 0); +} + +//============================================================================= +//test impl_checkSetIsAllowAnimatedGraphics() +void AccessibilityOptTest::impl_checkSetIsAllowAnimatedGraphics() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsAllowAnimatedGraphics ; + sal_Bool bIsAllowAnimatedGraphics_; + + xSet->getPropertyValue(s_sIsAllowAnimatedGraphics) >>= bIsAllowAnimatedGraphics; + aAccessibilityOpt.SetIsAllowAnimatedGraphics( bIsAllowAnimatedGraphics ? sal_False:sal_True ); + xSet->getPropertyValue(s_sIsAllowAnimatedGraphics) >>= bIsAllowAnimatedGraphics_; + + if ( bIsAllowAnimatedGraphics_ == bIsAllowAnimatedGraphics )//old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsAllowAnimatedGraphics() error!")), 0); +} + +//============================================================================= +//test impl_checkSetIsAllowAnimatedText() +void AccessibilityOptTest::impl_checkSetIsAllowAnimatedText() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsAllowAnimatedText ; + sal_Bool bIsAllowAnimatedText_; + + xSet->getPropertyValue(s_sIsAllowAnimatedText) >>= bIsAllowAnimatedText; + aAccessibilityOpt.SetIsAllowAnimatedText( bIsAllowAnimatedText ? sal_False:sal_True ); + xSet->getPropertyValue(s_sIsAllowAnimatedText) >>= bIsAllowAnimatedText_; + + if ( bIsAllowAnimatedText_ == bIsAllowAnimatedText )//old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsAllowAnimatedText() error!")), 0); +} + +//============================================================================= +//test impl_checkSetIsAutomaticFontColor() +void AccessibilityOptTest::impl_checkSetIsAutomaticFontColor() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsAutomaticFontColor ; + sal_Bool bIsAutomaticFontColor_; + + xSet->getPropertyValue(s_sIsAutomaticFontColor) >>= bIsAutomaticFontColor; + aAccessibilityOpt.SetIsAutomaticFontColor( bIsAutomaticFontColor ? sal_False:sal_True ); + xSet->getPropertyValue(s_sIsAutomaticFontColor) >>= bIsAutomaticFontColor_; + + if ( bIsAutomaticFontColor_ == bIsAutomaticFontColor )//old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsAutomaticFontColor() error!")), 0); +} + +//============================================================================= +//test impl_checkSetIsSystemFont() +void AccessibilityOptTest::impl_checkSetIsSystemFont() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsSystemFont ; + sal_Bool bIsSystemFont_; + + xSet->getPropertyValue(s_sIsSystemFont) >>= bIsSystemFont; + aAccessibilityOpt.SetIsSystemFont( bIsSystemFont ? sal_False:sal_True ); + xSet->getPropertyValue(s_sIsSystemFont) >>= bIsSystemFont_; + + if ( bIsSystemFont_ == bIsSystemFont )//old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsSystemFont() error!")), 0); +} + +//============================================================================= +//test impl_checkSetHelpTipSeconds() +void AccessibilityOptTest::impl_checkSetHelpTipSeconds() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Int16 nHelpTipSeconds ; + sal_Int16 nHelpTipSeconds_; + + xSet->getPropertyValue(s_sHelpTipSeconds) >>= nHelpTipSeconds; + aAccessibilityOpt.SetHelpTipSeconds( sal_Int16(nHelpTipSeconds+1) ); + xSet->getPropertyValue(s_sHelpTipSeconds) >>= nHelpTipSeconds_; + + if ( nHelpTipSeconds_ == nHelpTipSeconds )//old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetHelpTipSeconds() error!")), 0); +} + +//============================================================================= +//test impl_checkSetSelectionInReadonly() +void AccessibilityOptTest::impl_checkSetSelectionInReadonly() +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bIsSelectionInReadonly ; + sal_Bool bIsSelectionInReadonly_; + + xSet->getPropertyValue(s_sIsSelectionInReadonly) >>= bIsSelectionInReadonly; + aAccessibilityOpt.SetSelectionInReadonly( bIsSelectionInReadonly ? sal_False:sal_True ); + xSet->getPropertyValue(s_sIsSelectionInReadonly) >>= bIsSelectionInReadonly_; + + if ( bIsSelectionInReadonly_ == bIsSelectionInReadonly )//old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSelectionInReadonly() error!")), 0); +} + +//============================================================================= +void AccessibilityOptTest::impl_checkAccessibilityOptions() +{ + impl_checkGetAutoDetectSystemHC(); + impl_checkGetIsForPagePreviews(); + impl_checkGetIsHelpTipsDisappear(); + impl_checkGetIsAllowAnimatedGraphics(); + impl_checkGetIsAllowAnimatedText(); + impl_checkGetIsAutomaticFontColor(); + impl_checkGetIsSystemFont(); + impl_checkGetHelpTipSeconds(); + impl_checkIsSelectionInReadonly(); + + impl_checkSetAutoDetectSystemHC(); + impl_checkSetIsForPagePreviews(); + impl_checkSetIsHelpTipsDisappear(); + impl_checkSetIsAllowAnimatedGraphics(); + impl_checkSetIsAllowAnimatedText(); + impl_checkSetIsAutomaticFontColor(); + impl_checkSetIsSystemFont(); + impl_checkSetHelpTipSeconds(); + impl_checkSetSelectionInReadonly(); +} diff --git a/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx b/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx new file mode 100644 index 000000000000..fc2f4681e4fe --- /dev/null +++ b/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibilityOptTest.hxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:09:23 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef SVTOOLS_ACCESSIBILITYOPTTEST_HXX +#define SVTOOLS_ACCESSIBILITYOPTTEST_HXX + +#include <com/sun/star/container/XNameAccess.hpp> +#include <svtools/accessibilityoptions.hxx> + +namespace css = ::com::sun::star; + +class AccessibilityOptTest +{ +public: + AccessibilityOptTest(); + ~AccessibilityOptTest(); + + void impl_checkAccessibilityOptions(); + +private: + void impl_checkGetAutoDetectSystemHC(); + void impl_checkGetIsForPagePreviews(); + void impl_checkGetIsHelpTipsDisappear(); + void impl_checkGetIsAllowAnimatedGraphics(); + void impl_checkGetIsAllowAnimatedText(); + void impl_checkGetIsAutomaticFontColor(); + void impl_checkGetIsSystemFont(); + void impl_checkGetHelpTipSeconds(); + void impl_checkIsSelectionInReadonly(); + + void impl_checkSetAutoDetectSystemHC(); + void impl_checkSetIsForPagePreviews(); + void impl_checkSetIsHelpTipsDisappear(); + void impl_checkSetIsAllowAnimatedGraphics(); + void impl_checkSetIsAllowAnimatedText(); + void impl_checkSetIsAutomaticFontColor(); + void impl_checkSetIsSystemFont(); + void impl_checkSetHelpTipSeconds(); + void impl_checkSetSelectionInReadonly(); + +private: + css::uno::Reference< css::container::XNameAccess > m_xCfg; + SvtAccessibilityOptions aAccessibilityOpt; +}; + +#endif // #ifndef SVTOOLS_ACCESSIBILITYOPTTEST_HXX diff --git a/svtools/qa/complex/ConfigItems/helper/ConfigItemTest.cxx b/svtools/qa/complex/ConfigItems/helper/ConfigItemTest.cxx new file mode 100644 index 000000000000..b21d9d76755e --- /dev/null +++ b/svtools/qa/complex/ConfigItems/helper/ConfigItemTest.cxx @@ -0,0 +1,253 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ConfigItemTest.cxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:09:23 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include "HistoryOptTest.hxx" +#include "AccessibilityOptTest.hxx" +#include "PrintOptTest.hxx" +#include "UserOptTest.hxx" + +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/task/XJob.hpp> +#include <com/sun/star/beans/NamedValue.hpp> + +#include <sal/config.h> +#include <rtl/ustring.hxx> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implementationentry.hxx> + +//============================================================================= +namespace css = ::com::sun::star; + +namespace svtools{ + +//============================================================================= +static const ::rtl::OUString PROP_TEST = ::rtl::OUString::createFromAscii("Test"); +static const ::rtl::OUString TEST_PICKLIST = ::rtl::OUString::createFromAscii("checkPicklist"); +static const ::rtl::OUString TEST_URLHISTORY = ::rtl::OUString::createFromAscii("checkURLHistory"); +static const ::rtl::OUString TEST_HELPBOOKMARKS = ::rtl::OUString::createFromAscii("checkHelpBookmarks"); +static const ::rtl::OUString TEST_ACCESSIBILITYOPTIONS = ::rtl::OUString::createFromAscii("checkAccessibilityOptions"); +static const ::rtl::OUString TEST_PRINTOPTIONS = ::rtl::OUString::createFromAscii("checkPrintOptions"); +static const ::rtl::OUString TEST_USEROPTIONS = ::rtl::OUString::createFromAscii("checkUserOptions"); + +//============================================================================= +class ConfigItemTest : public ::cppu::WeakImplHelper2< css::task::XJob , + css::lang::XServiceInfo > +{ + //------------------------------------------------------------------------- + // interface + public: + explicit ConfigItemTest(const css::uno::Reference< css::uno::XComponentContext >& xContext); + + // css::task::XJob + virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments) + throw (css::uno::RuntimeException , + css::lang::IllegalArgumentException, + css::uno::Exception ); + + // css::lang::XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException); + + virtual ::sal_Bool SAL_CALL supportsService(const ::rtl::OUString& sServiceName) + throw (css::uno::RuntimeException); + + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw (css::uno::RuntimeException); + + //------------------------------------------------------------------------- + // internal + private: + ConfigItemTest(ConfigItemTest &); // not defined + virtual ~ConfigItemTest() {} + void operator=(ConfigItemTest &); // not defined + + //------------------------------------------------------------------------- + // helper for registration ! + public: + static ::rtl::OUString SAL_CALL st_getImplementationName(); + static css::uno::Sequence< ::rtl::OUString > SAL_CALL st_getSupportedServiceNames(); + static css::uno::Reference< css::uno::XInterface > SAL_CALL st_create(const css::uno::Reference< css::uno::XComponentContext >& XContext); + + //------------------------------------------------------------------------- + // member + private: + css::uno::Reference< css::uno::XComponentContext > m_xContext; +}; + +//============================================================================= +ConfigItemTest::ConfigItemTest(const css::uno::Reference< css::uno::XComponentContext >& xContext) + : m_xContext(xContext) +{} + +//============================================================================= +// css::task::XJob +css::uno::Any SAL_CALL ConfigItemTest::execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments) + throw (css::uno::RuntimeException , + css::lang::IllegalArgumentException, + css::uno::Exception ) +{ + ::rtl::OUString sTest; + ::sal_Int32 i = 0; + ::sal_Int32 c = lArguments.getLength(); + for (i=0; i<c; ++i) + { + const css::beans::NamedValue& rArg = lArguments[0]; + if (rArg.Name.equals(PROP_TEST)) + rArg.Value >>= sTest; + } + + if (sTest.equals(TEST_PICKLIST)) + { + HistoryOptTest aOptTest; + aOptTest.checkPicklist(); + } + else if (sTest.equals(TEST_URLHISTORY)) + { + HistoryOptTest aOptTest; + aOptTest.checkURLHistory(); + } + else if (sTest.equals(TEST_HELPBOOKMARKS)) + { + HistoryOptTest aOptTest; + aOptTest.checkHelpBookmarks(); + } + else if (sTest.equals(TEST_ACCESSIBILITYOPTIONS)) + { + AccessibilityOptTest aOptTest; + aOptTest.impl_checkAccessibilityOptions(); + } + else if (sTest.equals(TEST_PRINTOPTIONS)) + { + PrintOptTest aOptTest; + aOptTest.impl_checkPrint(); + } + else if (sTest.equals(TEST_USEROPTIONS)) + { + UserOptTest aOptTest; + aOptTest.impl_checkUserData(); + } + + return css::uno::Any(); +} + +//============================================================================= +// com::sun::star::uno::XServiceInfo +::rtl::OUString SAL_CALL ConfigItemTest::getImplementationName() + throw (css::uno::RuntimeException) +{ + return ConfigItemTest::st_getImplementationName(); +} + +//============================================================================= +// com::sun::star::uno::XServiceInfo +::sal_Bool SAL_CALL ConfigItemTest::supportsService(const ::rtl::OUString& sServiceName) + throw (css::uno::RuntimeException) +{ + css::uno::Sequence< ::rtl::OUString > lServiceNames = ConfigItemTest::st_getSupportedServiceNames(); + for (::sal_Int32 i = 0; i < lServiceNames.getLength(); ++i) + { + if (lServiceNames[i].equals(sServiceName)) + return sal_True; + } + return sal_False; +} + +//============================================================================= +// com::sun::star::uno::XServiceInfo +css::uno::Sequence< ::rtl::OUString > SAL_CALL ConfigItemTest::getSupportedServiceNames() + throw (css::uno::RuntimeException) +{ + return ConfigItemTest::st_getSupportedServiceNames(); +} + +//============================================================================= +::rtl::OUString SAL_CALL ConfigItemTest::st_getImplementationName() +{ + return ::rtl::OUString::createFromAscii("com.sun.star.comp.svtools.ConfigItemTest"); +} + +//============================================================================= +css::uno::Sequence< ::rtl::OUString > SAL_CALL ConfigItemTest::st_getSupportedServiceNames() +{ + css::uno::Sequence< ::rtl::OUString > lServices(1); + lServices[0] = ::rtl::OUString::createFromAscii("com.sun.star.test.ConfigItems"); + return lServices; +} + +//============================================================================= +css::uno::Reference< css::uno::XInterface > SAL_CALL ConfigItemTest::st_create(const css::uno::Reference< css::uno::XComponentContext >& xContext) +{ + ConfigItemTest* pObject = new ConfigItemTest(xContext); + css::uno::Reference< css::uno::XInterface > xObject (static_cast< ::cppu::OWeakObject* >(pObject)); + return xObject; +} + +} // namespace svtools + +//============================================================================= +static ::cppu::ImplementationEntry const lRegEntries[] = +{ + { + &::svtools::ConfigItemTest::st_create, + &::svtools::ConfigItemTest::st_getImplementationName, + &::svtools::ConfigItemTest::st_getSupportedServiceNames, + &::cppu::createSingleComponentFactory, 0, 0 + }, + + { 0, 0, 0, 0, 0, 0 } +}; + +//============================================================================= +extern "C" void SAL_CALL component_getImplementationEnvironment(const char** pEnvTypeName, + uno_Environment** ) +{ + *pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +//============================================================================= +extern "C" void * SAL_CALL component_getFactory(const char* sImplName , + void* pServiceManager, + void* pRegistryKey ) +{ + return ::cppu::component_getFactoryHelper(sImplName, pServiceManager, pRegistryKey, lRegEntries); +} + +//============================================================================= +extern "C" sal_Bool SAL_CALL component_writeInfo(void* pServiceManager, + void* pRegistryKey ) +{ + return ::cppu::component_writeInfoHelper(pServiceManager, pRegistryKey, lRegEntries); +} diff --git a/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.cxx b/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.cxx new file mode 100644 index 000000000000..8f191abf61ca --- /dev/null +++ b/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.cxx @@ -0,0 +1,806 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: HistoryOptTest.cxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:09:23 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include "HistoryOptTest.hxx" +#include "configitems/historyoptions_const.hxx" + +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XNameContainer.hpp> + +#include <comphelper/configurationhelper.hxx> +#include <comphelper/sequenceashashmap.hxx> +#include <unotools/processfactory.hxx> + +namespace css = ::com::sun::star; + +//============================================================================= +static const ::rtl::OUString MESSAGE_CLEAR_FAILED = ::rtl::OUString::createFromAscii("Clearing the list failed."); +static const ::rtl::OUString MESSAGE_SETSIZE_FAILED = ::rtl::OUString::createFromAscii("Setting a new size for a list failed."); +static const ::rtl::OUString MESSAGE_MISS_HISTORY = ::rtl::OUString::createFromAscii("Could not get config access to history list inside config."); +static const ::rtl::OUString MESSAGE_MISS_ITEMLIST = ::rtl::OUString::createFromAscii("Could not get config access to item list inside config."); +static const ::rtl::OUString MESSAGE_MISS_ORDERLIST = ::rtl::OUString::createFromAscii("Could not get config access to order list inside config."); +static const ::rtl::OUString MESSAGE_MISS_ITEM = ::rtl::OUString::createFromAscii("Could not locate item."); +static const ::rtl::OUString MESSAGE_UNEXPECTED_ITEM = ::rtl::OUString::createFromAscii("Found an unexpected item."); +static const ::rtl::OUString MESSAGE_WRONG_ORDER = ::rtl::OUString::createFromAscii("Wrong order in history list."); + +//============================================================================= +HistoryOptTest::HistoryOptTest() + : m_aConfigItem ( ) + , m_eList (ePICKLIST) + , m_xHistoriesXCU( ) + , m_xCommonXCU ( ) +{ +} + +//============================================================================= +HistoryOptTest::~HistoryOptTest() +{ + m_xHistoriesXCU.clear(); + m_xCommonXCU.clear(); +} + +//============================================================================= +void HistoryOptTest::checkPicklist() +{ + impl_testHistory(ePICKLIST, 4); +} + +//============================================================================= +void HistoryOptTest::checkURLHistory() +{ + impl_testHistory(eHISTORY, 10); +} + +//============================================================================= +void HistoryOptTest::checkHelpBookmarks() +{ + impl_testHistory(eHELPBOOKMARKS, 100); +} + +//============================================================================= +void HistoryOptTest::impl_testHistory(EHistoryType eHistory , + ::sal_Int32 nMaxItems) +{ + try + { + m_eList = eHistory; + ::sal_Int32 c = nMaxItems; + ::sal_Int32 i = 0; + + impl_clearList( ); + impl_setSize (c); + + // a) fill list completely and check if all items could be realy created. + // But dont check its order here! Because every new item will change that order. + for (i=0; i<c; ++i) + { + impl_appendItem(i); + if ( ! impl_existsItem(i)) + throw css::uno::Exception(MESSAGE_MISS_ITEM, 0); + } + + // b) Check order of all items in list now. + // It must be reverse to the item number ... + // item max = index 0 + // item max-1 = index 1 + // ... + for (i=0; i<c; ++i) + { + ::sal_Int32 nExpectedIndex = (c-1)-i; + if ( ! impl_existsItemAtIndex(i, nExpectedIndex)) + throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0); + } + + // c) increase prio of "first" item so it will switch + // to "second" and "second" will switch to "first" :-) + // Check also if all other items was not touched. + ::sal_Int32 nFirstItem = (c-1); + ::sal_Int32 nSecondItem = (c-2); + impl_appendItem(nSecondItem); + + if ( + ( ! impl_existsItemAtIndex(nSecondItem, 0)) || + ( ! impl_existsItemAtIndex(nFirstItem , 1)) + ) + throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0); + + for (i=0; i<nSecondItem; ++i) + { + ::sal_Int32 nExpectedIndex = (c-1)-i; + if ( ! impl_existsItemAtIndex(i, nExpectedIndex)) + throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0); + } + + // d) Check if appending new items will destroy the oldest one. + ::sal_Int32 nNewestItem = c; + ::sal_Int32 nOldestItem = 0; + + impl_appendItem(nNewestItem); + + if ( ! impl_existsItemAtIndex(nNewestItem, 0)) + throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0); + + if (impl_existsItem(nOldestItem)) + throw css::uno::Exception(MESSAGE_UNEXPECTED_ITEM, 0); + + // e) Check if decreasing list size will remove oldest items. + // Note: impl_setSize() will make sure that 3 items exists only. + // Otherwhise it throws an exception. If we further check + // positions of three items no further items must be checked. + // They cant exists :-) + ::sal_Int32 nNewSize = 3; + impl_setSize(nNewSize); + if ( + ( ! impl_existsItemAtIndex(nNewestItem, 0)) || + ( ! impl_existsItemAtIndex(nSecondItem, 1)) || + ( ! impl_existsItemAtIndex(nFirstItem , 2)) + ) + throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0); + + // finaly we should try to clean up all used structures so the same office can be used + // without problems :-) + impl_clearList(); + } + catch (const css::uno::Exception& ex) + { + impl_clearList(); + throw ex; + } + +} + +//============================================================================= +void HistoryOptTest::impl_clearList() +{ + m_aConfigItem.Clear(m_eList); + ::sal_Int32 nCount = m_aConfigItem.GetList(m_eList).getLength(); + + if (nCount != 0) + throw css::uno::Exception(MESSAGE_CLEAR_FAILED, 0); + + css::uno::Reference< css::container::XNameAccess > xList; + xList = impl_getItemList(); + nCount = xList->getElementNames().getLength(); + + if (nCount != 0) + throw css::uno::Exception(MESSAGE_CLEAR_FAILED, 0); + + xList = impl_getOrderList(); + nCount = xList->getElementNames().getLength(); + + if (nCount != 0) + throw css::uno::Exception(MESSAGE_CLEAR_FAILED, 0); +} + +//============================================================================= +void HistoryOptTest::impl_setSize(::sal_Int32 nSize) +{ + m_aConfigItem.SetSize (m_eList, nSize); + + // a) size info returned by GetSize() means "MaxSize" + // so it must match exactly ! + ::sal_Int32 nCheck = m_aConfigItem.GetSize(m_eList); + if (nCheck != nSize) + throw css::uno::Exception(MESSAGE_SETSIZE_FAILED, 0); + + // b) current size of used XCU lists reflects the current state of + // history list and not max size. So it can be less then size ! + css::uno::Reference< css::container::XNameAccess > xList; + xList = impl_getItemList(); + nCheck = xList->getElementNames().getLength(); + if (nCheck > nSize) + throw css::uno::Exception(MESSAGE_SETSIZE_FAILED, 0); + + xList = impl_getOrderList(); + nCheck = xList->getElementNames().getLength(); + if (nCheck > nSize) + throw css::uno::Exception(MESSAGE_SETSIZE_FAILED, 0); +} + +//============================================================================= +void HistoryOptTest::impl_appendItem(::sal_Int32 nItem) +{ + const ::rtl::OUString sURL = impl_createItemURL (nItem); + const ::rtl::OUString sTitle = impl_createItemTitle (nItem); + const ::rtl::OUString sPassword = impl_createItemPassword(nItem); + + m_aConfigItem.AppendItem(m_eList, sURL, ::rtl::OUString(), sTitle, sPassword); +} + +//============================================================================= +::rtl::OUString HistoryOptTest::impl_createItemURL(::sal_Int32 nItem) +{ + ::rtl::OUStringBuffer sURL(256); + sURL.appendAscii("file:///ooo_api_test/non_existing_test_url_"); + sURL.append ((::sal_Int32)nItem ); + sURL.appendAscii(".odt" ); + + return sURL.makeStringAndClear(); +} + +//============================================================================= +::rtl::OUString HistoryOptTest::impl_createItemTitle(::sal_Int32 nItem) +{ + ::rtl::OUStringBuffer sTitle(256); + sTitle.appendAscii("Non Existing Test Item Nr "); + sTitle.append ((::sal_Int32)nItem ); + + return sTitle.makeStringAndClear(); +} + +//============================================================================= +::rtl::OUString HistoryOptTest::impl_createItemPassword(::sal_Int32 nItem) +{ + ::rtl::OUStringBuffer sPassword(256); + sPassword.appendAscii("Password_" ); + sPassword.append ((::sal_Int32)nItem); + + return sPassword.makeStringAndClear(); +} + +//============================================================================= +::sal_Bool HistoryOptTest::impl_existsItem(::sal_Int32 nItem) +{ + const ::rtl::OUString sURL = impl_createItemURL(nItem); + const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > lItems = m_aConfigItem.GetList(m_eList); + const ::sal_Int32 c = lItems.getLength (); + ::sal_Int32 i = 0; + ::sal_Bool bFound = sal_False; + + for (i=0; i<c; ++i) + { + const ::comphelper::SequenceAsHashMap aItem(lItems[i]); + const ::rtl::OUString& sCheck = aItem.getUnpackedValueOrDefault(s_sURL, ::rtl::OUString()); + + bFound = sCheck.equals(sURL); + if (bFound) + break; + } + + if ( ! bFound) + return sal_False; + bFound = sal_False; + + try + { + css::uno::Reference< css::container::XNameAccess > xItemList = impl_getItemList(); + css::uno::Reference< css::container::XNameAccess > xItem ; + xItemList->getByName(sURL) >>= xItem; + + bFound = xItem.is(); + } + catch(const css::container::NoSuchElementException&) + {} + + return bFound; +} + +//============================================================================= +::sal_Bool HistoryOptTest::impl_existsItemAtIndex(::sal_Int32 nItem , + ::sal_Int32 nIndex) +{ + const ::rtl::OUString sURL = impl_createItemURL(nItem); + const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > lItems = m_aConfigItem.GetList(m_eList); + const ::sal_Int32 c = lItems.getLength (); + ::sal_Bool bFound = sal_False; + + if (nIndex >= c) + return sal_False; + + const ::comphelper::SequenceAsHashMap aItem(lItems[nIndex]); + ::rtl::OUString sCheck = aItem.getUnpackedValueOrDefault(s_sURL, ::rtl::OUString()); + + bFound = sCheck.equals(sURL); + if ( ! bFound) + return sal_False; + bFound = sal_False; + + try + { + css::uno::Reference< css::container::XNameAccess > xItemList = impl_getItemList(); + css::uno::Reference< css::container::XNameAccess > xItem ; + xItemList->getByName(sURL) >>= xItem; + + bFound = xItem.is(); + } + catch(const css::container::NoSuchElementException&) + {} + + if ( ! bFound) + return sal_False; + bFound = sal_False; + + try + { + const ::rtl::OUString sOrder = ::rtl::OUString::valueOf(nIndex); + css::uno::Reference< css::container::XNameAccess > xOrderList = impl_getOrderList(); + css::uno::Reference< css::container::XNameAccess > xOrder ; + xOrderList->getByName(sOrder) >>= xOrder; + + if (xOrder.is()) + { + xOrder->getByName(s_sHistoryItemRef) >>= sCheck; + bFound = sCheck.equals(sURL); + } + } + catch(const css::container::NoSuchElementException&) + {} + + return bFound; +} + +//============================================================================= +css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getItemList() +{ + css::uno::Reference< css::container::XNameAccess > xHistory = impl_getNewHistory(); + css::uno::Reference< css::container::XNameAccess > xList ; + xHistory->getByName (s_sItemList) >>= xList; + + if ( ! xList.is()) + throw css::uno::Exception(MESSAGE_MISS_ITEMLIST, 0); + + return xList; +} + +//============================================================================= +css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getOrderList() +{ + css::uno::Reference< css::container::XNameAccess > xHistory = impl_getNewHistory(); + css::uno::Reference< css::container::XNameAccess > xList ; + xHistory->getByName (s_sOrderList) >>= xList; + + if ( ! xList.is()) + throw css::uno::Exception(MESSAGE_MISS_ORDERLIST, 0); + + return xList; +} + +//============================================================================= +css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getNewHistory() +{ + if ( ! m_xHistoriesXCU.is()) + { + m_xHistoriesXCU = css::uno::Reference< css::container::XNameAccess >( + ::comphelper::ConfigurationHelper::openConfig( + ::utl::getProcessServiceFactory(), + s_sHistories, + ::comphelper::ConfigurationHelper::E_STANDARD), + css::uno::UNO_QUERY_THROW); + } + + css::uno::Reference< css::container::XNameAccess > xHistory; + + switch (m_eList) + { + case ePICKLIST : + m_xHistoriesXCU->getByName(s_sPickList) >>= xHistory; + break; + + case eHISTORY : + m_xHistoriesXCU->getByName(s_sURLHistory) >>= xHistory; + break; + + case eHELPBOOKMARKS : + m_xHistoriesXCU->getByName(s_sHelpBookmarks) >>= xHistory; + break; + } + + if ( ! xHistory.is()) + throw css::uno::Exception(MESSAGE_MISS_HISTORY, 0); + + return xHistory; +} + +//============================================================================= +css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getOldHistory() +{ + if ( ! m_xCommonXCU.is()) + { + m_xCommonXCU = css::uno::Reference< css::container::XNameAccess >( + ::comphelper::ConfigurationHelper::openConfig( + ::utl::getProcessServiceFactory(), + s_sCommonHistory, + ::comphelper::ConfigurationHelper::E_STANDARD), + css::uno::UNO_QUERY_THROW); + } + + css::uno::Reference< css::container::XNameAccess > xHistory; + + switch (m_eList) + { + case ePICKLIST : + m_xCommonXCU->getByName(s_sPickList) >>= xHistory; + break; + + case eHISTORY : + m_xCommonXCU->getByName(s_sURLHistory) >>= xHistory; + break; + + case eHELPBOOKMARKS : + m_xCommonXCU->getByName(s_sHelpBookmarks) >>= xHistory; + break; + } + + if ( ! xHistory.is()) + throw css::uno::Exception(MESSAGE_MISS_HISTORY, 0); + + return xHistory; +} + +/* +//============================================================================= +// clear the list in XML directly when using the new Histories.xcs +void HistoryOptTest::impl_clearList(const ::rtl::OUString& sList) +{ + css::uno::Reference< css::container::XNameAccess > xListAccess; + css::uno::Reference< css::container::XNameContainer > xItemOrder; + css::uno::Reference< css::beans::XPropertySet > xFirstItem; + css::uno::Sequence< ::rtl::OUString > sFileList; + + if (sList.equalsAscii("PickList")) + m_xCfg->getByName(s_sPickList) >>= xListAccess; + + else if (sList.equalsAscii("URLHistory")) + m_xCfg->getByName(s_sURLHistory) >>= xListAccess; + + else if (sList.equalsAscii("HelpBookmarks")) + m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess; + + if (xListAccess.is()) + { + xListAccess->getByName(s_sItemList) >>= xItemOrder ; + sFileList = xItemOrder->getElementNames(); + for(sal_Int32 i=0; i<sFileList.getLength(); ++i) + xItemOrder->removeByName(sFileList[i]); + + xListAccess->getByName(s_sOrderList) >>= xItemOrder ; + sFileList = xItemOrder->getElementNames(); + for(sal_Int32 j=0; j<sFileList.getLength(); ++j) + xItemOrder->removeByName(sFileList[j]); + + xFirstItem = css::uno::Reference< css::beans::XPropertySet >(xListAccess, css::uno::UNO_QUERY); + xFirstItem->setPropertyValue( s_sFirstItem, css::uno::makeAny((sal_Int32)0) ); + + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } +} + +//============================================================================= +// use configuration API (not ConfigItem!) to verify the results within XML ! +sal_Bool HistoryOptTest::impl_isListEmpty(const ::rtl::OUString& sList) +{ + css::uno::Reference< css::container::XNameAccess > xListAccess; + css::uno::Reference< css::container::XNameAccess > xItemList; + css::uno::Reference< css::container::XNameAccess > xOrderList; + sal_Bool bRet = sal_True; + + if (sList.equalsAscii("PickList")) + m_xCfg->getByName(s_sPickList) >>= xListAccess; + + else if (sList.equalsAscii("URLHistory")) + m_xCfg->getByName(s_sURLHistory) >>= xListAccess; + + else if (sList.equalsAscii("HelpBookmarks")) + m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess; + + if (xListAccess.is()) + { + xListAccess->getByName(s_sItemList) >>= xItemList; + xListAccess->getByName(s_sOrderList) >>= xOrderList; + + css::uno::Sequence< ::rtl::OUString > sItemList = xItemList->getElementNames(); + css::uno::Sequence< ::rtl::OUString > sOrderList = xOrderList->getElementNames(); + if (sItemList.getLength()!=0 || sOrderList.getLength()!=0) + bRet = sal_False; + } + + return bRet; +} + +//============================================================================= +// append a item: use configuration API (not ConfigItem!) to verify the results within XML ! +void HistoryOptTest::impl_appendItem(const ::rtl::OUString& sList) +{//to do... +} + +//============================================================================= +// test SvtHistoryOptions::GetSize() +void HistoryOptTest::impl_checkGetSize(const ::rtl::OUString& sList) +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCommonXCU, css::uno::UNO_QUERY); + + sal_uInt32 nSize = 0; + sal_uInt32 nSize_ = 0; + + if (sList.equalsAscii("PickList")) + { + nSize = aHistoryOpt.GetSize(ePICKLIST); + + xSet->setPropertyValue(s_sPickListSize, css::uno::makeAny(nSize+1)); + ::comphelper::ConfigurationHelper::flush(m_xCommonXCU); + + nSize_ = aHistoryOpt.GetSize(ePICKLIST); + if (nSize_ == nSize) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetSize(ePICKLIST) error!")), 0); + } + + else if (sList.equalsAscii("URLHistory")) + { + nSize = aHistoryOpt.GetSize(eHISTORY); + + xSet->setPropertyValue(s_sURLHistorySize, css::uno::makeAny(nSize+1)); + ::comphelper::ConfigurationHelper::flush(m_xCommonXCU); + + nSize_ = aHistoryOpt.GetSize(eHISTORY); + + if (nSize_ == nSize) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetSize(eHISTORY) error!")), 0); + } + + else if (sList.equalsAscii("HelpBookmarks")) + { + nSize = aHistoryOpt.GetSize(eHELPBOOKMARKS); + + xSet->setPropertyValue(s_sHelpBookmarksSize, css::uno::makeAny(nSize+1)); + ::comphelper::ConfigurationHelper::flush(m_xCommonXCU); + + nSize_ = aHistoryOpt.GetSize(eHELPBOOKMARKS); + + if (nSize_ == nSize) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetSize(eHELPBOOKMARKS) error!")), 0); + } +} + +//============================================================================= +// test SvtHistoryOptions::SetSize() +void HistoryOptTest::impl_checkSetSize(const ::rtl::OUString& sList) +{ + css::uno::Reference< css::beans::XPropertySet > xSet(m_xCommonXCU, css::uno::UNO_QUERY); + + sal_uInt32 nSize = 0; + sal_uInt32 nSize_ = 0; + + if (sList.equalsAscii("PickList")) + { + xSet->getPropertyValue(s_sPickListSize) >>= nSize; + aHistoryOpt.SetSize(ePICKLIST, (nSize+1)); + xSet->getPropertyValue(s_sPickListSize) >>= nSize_; + + if (nSize_ == nSize) //old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSize(ePICKLIST) error!")), 0); + } + + else if (sList.equalsAscii("URLHistory")) + { + xSet->getPropertyValue(s_sURLHistorySize) >>= nSize; + aHistoryOpt.SetSize(eHISTORY, (nSize+1)); + xSet->getPropertyValue(s_sURLHistorySize) >>= nSize_; + + if (nSize_ == nSize) //old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSize(eHISTORY) error!")), 0); + } + + else if (sList.equalsAscii("HelpBookmarks")) + { + xSet->getPropertyValue(s_sHelpBookmarksSize) >>= nSize; + aHistoryOpt.SetSize(eHELPBOOKMARKS, (nSize+1)); + xSet->getPropertyValue(s_sHelpBookmarksSize) >>= nSize_; + + if (nSize_ == nSize) //old config item will throw error + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSize(eHELPBOOKMARKS) error!")), 0); + } +} + +//============================================================================= +// test SvtHistoryOptions::Clear() +void HistoryOptTest::impl_checkClear(const ::rtl::OUString& sList) +{ + if (sList.equalsAscii("PickList")) + { + aHistoryOpt.Clear(ePICKLIST); + if ( !impl_isListEmpty(s_sPickList) ) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Clear(ePICKLIST) error!")), 0); + } + + else if (sList.equalsAscii("URLHistory")) + { + aHistoryOpt.Clear(eHISTORY); + if ( !impl_isListEmpty(s_sURLHistory) ) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Clear(eHISTORY) error!")), 0); + } + + else if (sList.equalsAscii("HelpBookmarks")) + { + aHistoryOpt.Clear(eHELPBOOKMARKS); + if ( !impl_isListEmpty(s_sHelpBookmarks) ) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Clear(eHELPBOOKMARKS) error!")), 0); + } +} + +//============================================================================= +// test SvtHistoryOptions::GetList() +void HistoryOptTest::impl_checkGetList(const ::rtl::OUString& sList) +{ + if (sList.equalsAscii("PickList")) + { + impl_clearList(s_sPickList); + aHistoryOpt.AppendItem( ePICKLIST , + ::rtl::OUString::createFromAscii("file:///c/test1"), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii("") ); + css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aHistoryList = aHistoryOpt.GetList( ePICKLIST ); + + if ( aHistoryList.getLength()==0 ) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetList(ePICKLIST) error!")), 0); + } + + else if (sList.equalsAscii("URLHistory")) + { + impl_clearList(s_sURLHistory); + aHistoryOpt.AppendItem( eHISTORY , + ::rtl::OUString::createFromAscii("file:///c/test1"), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii("") ); + css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aHistoryList = aHistoryOpt.GetList( eHISTORY ); + + if ( aHistoryList.getLength()==0 ) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetList(eHISTORY) error!")), 0); + } + + else if (sList.equalsAscii("HelpBookmarks")) + { + impl_clearList(s_sHelpBookmarks); + aHistoryOpt.AppendItem( eHELPBOOKMARKS , + ::rtl::OUString::createFromAscii("file:///c/test1"), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii("") ); + css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aHistoryList = aHistoryOpt.GetList( eHELPBOOKMARKS ); + + if ( aHistoryList.getLength()==0 ) + throw css::uno::RuntimeException( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetList(eHELPBOOKMARKS) error!")), 0); + } +} + +void HistoryOptTest::impl_checkAppendItem(const ::rtl::OUString& sList) +{ + if (sList.equalsAscii("PickList")) + { + impl_clearList(s_sPickList); + sal_Int32 nListSize = aHistoryOpt.GetSize(ePICKLIST); + + for (sal_Int32 i=0; i<nListSize; ++i) + aHistoryOpt.AppendItem( ePICKLIST , + ::rtl::OUString::valueOf(i), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii("") ); + + aHistoryOpt.AppendItem( ePICKLIST , + ::rtl::OUString::valueOf(nListSize), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii("") ); + } + + else if (sList.equalsAscii("URLHistory")) + { + impl_clearList(s_sURLHistory); + sal_Int32 nListSize = aHistoryOpt.GetSize(eHISTORY); + + for (sal_Int32 i=0; i<nListSize; ++i) + aHistoryOpt.AppendItem( eHISTORY , + ::rtl::OUString::valueOf(i), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii("") ); + + aHistoryOpt.AppendItem( eHISTORY , + ::rtl::OUString::valueOf(nListSize), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii(""), + ::rtl::OUString::createFromAscii("") ); + } + + else if (sList.equalsAscii("HelpBookmarks")) + { + //impl_clearList(s_sHelpBookmarks); + //sal_Int32 nListSize = aHistoryOpt.GetSize(eHELPBOOKMARKS); + + //for (sal_Int32 i=0; i<nListSize; ++i) + // aHistoryOpt.AppendItem( eHELPBOOKMARKS , + // ::rtl::OUString::valueOf(i), + // ::rtl::OUString::createFromAscii(""), + // ::rtl::OUString::createFromAscii(""), + // ::rtl::OUString::createFromAscii("") ); + + //aHistoryOpt.AppendItem( eHELPBOOKMARKS , + // ::rtl::OUString::valueOf(nListSize), + // ::rtl::OUString::createFromAscii(""), + // ::rtl::OUString::createFromAscii(""), + // ::rtl::OUString::createFromAscii("") ); + } +} + +//============================================================================= +void HistoryOptTest::impl_checkPicklist() +{ + impl_checkGetSize(s_sPickList); + impl_checkSetSize(s_sPickList); + + impl_checkClear(s_sPickList); + impl_checkGetList(s_sPickList); + impl_checkAppendItem(s_sPickList); +} + +//============================================================================= +void HistoryOptTest::impl_checkURLHistory() +{ + impl_checkGetSize(s_sURLHistory); + impl_checkSetSize(s_sURLHistory); + + impl_checkClear(s_sURLHistory); + impl_checkGetList(s_sURLHistory); + impl_checkAppendItem(s_sURLHistory); +} + +//============================================================================= +void HistoryOptTest::impl_checkHelpBookmarks() +{ + impl_checkGetSize(s_sHelpBookmarks); + impl_checkSetSize(s_sHelpBookmarks); + + impl_checkClear(s_sHelpBookmarks); + impl_checkGetList(s_sHelpBookmarks); + impl_checkAppendItem(s_sHelpBookmarks); +} +*/
diff --git a/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.hxx b/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.hxx new file mode 100644 index 000000000000..fca9802d2781 --- /dev/null +++ b/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.hxx @@ -0,0 +1,211 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: HistoryOptTest.hxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:09:24 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef SVTOOLS_HISTORYOPTTEST_HXX +#define SVTOOLS_HISTORYOPTTEST_HXX + +#include <com/sun/star/container/XNameAccess.hpp> +#include <svtools/historyoptions.hxx> + +namespace css = ::com::sun::star; + +class HistoryOptTest +{ + public: + + HistoryOptTest(); + virtual ~HistoryOptTest(); + + //--------------------------------------------------------------------- + /** unit test of picklist */ + void checkPicklist(); + + //--------------------------------------------------------------------- + /** unit test of URL list */ + void checkURLHistory(); + + //--------------------------------------------------------------------- + /** unit test of Help bookmarks */ + void checkHelpBookmarks(); + + private: + + //--------------------------------------------------------------------- + /** test every well known history list in the same way. + * Only the count of created and tested items can be defined from outside + * e.g. usefull for stress tests. + * + * @param eHistory + * specify the history list for testing. + * + * @param nMaxItems + * max count of new created and tested history items. + */ + void impl_testHistory(EHistoryType eHistory , + ::sal_Int32 nMaxItems); + + //--------------------------------------------------------------------- + /** try to clear the whole list and check the results. + * If list could not be cleared successfully an exception is thrown. + */ + void impl_clearList(); + + //--------------------------------------------------------------------- + /** define a new size for the current list and check the results. + * Note: The given size must match against the defined constraints. + * That must be checked before this method is called. + * + * @param nSize + * the new size. + */ + void impl_setSize(::sal_Int32 nSize); + + //--------------------------------------------------------------------- + /** create a new item (means it's properties using a special schema using the + * item id). + * + * Note: This method does not check if creation was successfully. + * Therefore exists more specialized method impl_existsItem() + * and impl_existsItemAtPosition(). + * + * @param nItem + * id of the item + */ + void impl_appendItem(::sal_Int32 nItem); + + //--------------------------------------------------------------------- + /** check if an entry for given item id realy exists (in memory and xcu file). + * + * @param nItem + * id of the item + * + * @return true if item exists - false otherwise. + */ + ::sal_Bool impl_existsItem(::sal_Int32 nItem); + + //--------------------------------------------------------------------- + /** check if an entry for given item id realy exists (in memory and xcu file). + * Further it checks if the requested item is placed at the also specified + * position inside history list. + * + * @param nItem + * id of the item + * + * @param nIndex + * expected position of item inside history list. + * + * @return true if item exists at right position - false otherwise. + */ + ::sal_Bool impl_existsItemAtIndex(::sal_Int32 nItem , + ::sal_Int32 nIndex); + + //--------------------------------------------------------------------- + /** create an URL suitable for the given item id. + * + * @param nItem + * id of the item + * + * @return the new created URL. + */ + ::rtl::OUString impl_createItemURL(::sal_Int32 nItem); + + //--------------------------------------------------------------------- + /** create a title suitable for the given item id. + * + * @param nItem + * id of the item + * + * @return the new created title. + */ + ::rtl::OUString impl_createItemTitle(::sal_Int32 nItem); + + //--------------------------------------------------------------------- + /** create a password suitable for the given item id. + * + * @param nItem + * id of the item + * + * @return the new created password. + */ + ::rtl::OUString impl_createItemPassword(::sal_Int32 nItem); + + //--------------------------------------------------------------------- + /** returns direct access to the item list inside histories.xcu + * suitable for the current defined list type (m_eList). + * + * @return reference to the item list configuration + */ + css::uno::Reference< css::container::XNameAccess > impl_getItemList(); + + //--------------------------------------------------------------------- + /** returns direct access to the order list inside histories.xcu + * suitable for the current defined list type (m_eList). + * + * @return reference to the order list configuration + */ + css::uno::Reference< css::container::XNameAccess > impl_getOrderList(); + + //--------------------------------------------------------------------- + /** returns direct access to the history list inside histories.xcu + * suitable for the current defined list type (m_eList). + * + * @return reference to the history list configuration + */ + css::uno::Reference< css::container::XNameAccess > impl_getNewHistory(); + + //--------------------------------------------------------------------- + /** returns direct access to the history config inside common.xcu + * suitable for the current defined list type (m_eList). + * + * @return reference to the history configuration + */ + css::uno::Reference< css::container::XNameAccess > impl_getOldHistory(); + + private: + + // the config item which should be tested here + SvtHistoryOptions m_aConfigItem; + + // defines the special list for testing (picklist, history or url list) + EHistoryType m_eList; + + // underlying configuration of the tested config items for cross over checks + css::uno::Reference< css::container::XNameAccess > m_xHistoriesXCU; + + // underlying configuration of the tested config items for cross over checks + css::uno::Reference< css::container::XNameAccess > m_xCommonXCU; +}; + +#endif // #ifndef SVTOOLS_HISTORYOPTTEST_HXX diff --git a/svtools/qa/complex/ConfigItems/helper/PrintOptTest.cxx b/svtools/qa/complex/ConfigItems/helper/PrintOptTest.cxx new file mode 100644 index 000000000000..69504e4d5d7e --- /dev/null +++ b/svtools/qa/complex/ConfigItems/helper/PrintOptTest.cxx @@ -0,0 +1,743 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: PrintOptTest.cxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:09:24 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include "PrintOptTest.hxx" + +#include <com/sun/star/beans/XPropertySet.hpp> + +#include <unotools/processfactory.hxx> +#include <comphelper/configurationhelper.hxx> + +namespace css = ::com::sun::star; + +// using test only +#define ROOTNODE_PRINTOPTION rtl::OUString::createFromAscii("org.openoffice.Office.Common/Print/Option") +#define PROPERTYNAME_REDUCETRANSPARENCY rtl::OUString::createFromAscii("ReduceTransparency") +#define PROPERTYNAME_REDUCEDTRANSPARENCYMODE rtl::OUString::createFromAscii("ReducedTransparencyMode") +#define PROPERTYNAME_REDUCEGRADIENTS rtl::OUString::createFromAscii("ReduceGradients") +#define PROPERTYNAME_REDUCEDGRADIENTMODE rtl::OUString::createFromAscii("ReducedGradientMode") +#define PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT rtl::OUString::createFromAscii("ReducedGradientStepCount") +#define PROPERTYNAME_REDUCEBITMAPS rtl::OUString::createFromAscii("ReduceBitmaps") +#define PROPERTYNAME_REDUCEDBITMAPMODE rtl::OUString::createFromAscii("ReducedBitmapMode") +#define PROPERTYNAME_REDUCEDBITMAPRESOLUTION rtl::OUString::createFromAscii("ReducedBitmapResolution") +#define PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY rtl::OUString::createFromAscii("ReducedBitmapIncludesTransparency") +#define PROPERTYNAME_CONVERTTOGREYSCALES rtl::OUString::createFromAscii("ConvertToGreyscales") + +PrintOptTest::PrintOptTest() +{ + m_xCfg = css::uno::Reference< css::container::XNameAccess >( + ::comphelper::ConfigurationHelper::openConfig( + ::utl::getProcessServiceFactory(), + rtl::OUString::createFromAscii("org.openoffice.Office.Common/Print/Option"), + ::comphelper::ConfigurationHelper::E_STANDARD), + css::uno::UNO_QUERY); + + if (m_xCfg.is()) + { + //UniString sTmp = UniString("printer"); + //xub_StrLen nTokenCount = sTmp.GetTokenCount('/'); + //sTmp = sTmp.GetToken(nTokenCount - 1, '/'); + m_xCfg->getByName(rtl::OUString::createFromAscii("Printer")) >>= m_xNode; + } +} + +sal_Int16 PrintOptTest::impl_GetReducedTransparencyMode() const +{ + sal_Int16 nRet = 0; + if (m_xNode.is()) + { + css::uno::Reference< css::beans::XPropertySet > xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nRet; + } + return nRet; +} +void PrintOptTest::impl_SetReducedTransparencyMode(sal_Int16 nMode ) +{ + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Int16 nUpdate; + xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nUpdate; + if (nUpdate != nMode) + { + xSet->setPropertyValue( PROPERTYNAME_REDUCEDTRANSPARENCYMODE, css::uno::makeAny(nMode)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + +sal_Bool PrintOptTest::impl_IsReduceTransparency() const +{ + sal_Bool bRet = sal_False; + if (m_xNode.is()) + { + css::uno::Reference< css::beans::XPropertySet > xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bRet; + } + return bRet; +} +void PrintOptTest::impl_SetReduceTransparency(sal_Bool bState ) +{ + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Bool bUpdate; + xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bUpdate; + if (bUpdate != bState) + { + xSet->setPropertyValue( PROPERTYNAME_REDUCETRANSPARENCY, css::uno::makeAny(bState)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + +sal_Bool PrintOptTest::impl_IsReduceGradients() const +{ + sal_Bool bRet = sal_False; + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bRet; + } + } + return bRet; +} + +void PrintOptTest::impl_SetReduceGradients(sal_Bool bState ) +{ + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Bool bUpdate; + xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bUpdate; + if (bUpdate != bState) + { + xSet->setPropertyValue( PROPERTYNAME_REDUCEGRADIENTS, css::uno::makeAny(bState)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + +sal_Int16 PrintOptTest::impl_GetReducedGradientMode() const +{ + sal_Int16 nRet = 0; + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nRet; + } + } + return nRet; +} + +void PrintOptTest::impl_SetReducedGradientMode(sal_Int16 nMode ) +{ + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Int16 nUpdate; + xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nUpdate; + if (nUpdate != nMode) + { + xSet->setPropertyValue( PROPERTYNAME_REDUCEDGRADIENTMODE, css::uno::makeAny(nMode)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + +sal_Int16 PrintOptTest::impl_GetReducedGradientStepCount() const +{ + sal_Int16 nRet = 64; + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nRet; + } + } + return nRet; +} +void PrintOptTest::impl_SetReducedGradientStepCount(sal_Int16 nStepCount ) +{ + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Int16 nUpdate; + xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nUpdate; + if (nUpdate != nStepCount) + { + xSet->setPropertyValue( PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT, css::uno::makeAny(nStepCount)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + +sal_Bool PrintOptTest::impl_IsReduceBitmaps() const +{ + sal_Bool bRet = sal_False; + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bRet; + } + } + return bRet; +} + +void PrintOptTest::impl_SetReduceBitmaps(sal_Bool bState ) +{ + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Bool bUpdate; + xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bUpdate; + if (bUpdate != bState) + { + xSet->setPropertyValue( PROPERTYNAME_REDUCEBITMAPS, css::uno::makeAny(bState)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + +sal_Int16 PrintOptTest::impl_GetReducedBitmapMode() const +{ + sal_Int16 nRet = 1; + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nRet; + } + } + return nRet; +} + +void PrintOptTest::impl_SetReducedBitmapMode(sal_Int16 nMode ) +{ + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Int16 nUpdate; + xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nUpdate; + if (nUpdate != nMode) + { + xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPMODE, css::uno::makeAny(nMode)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + +sal_Int16 PrintOptTest::impl_GetReducedBitmapResolution() const +{ + sal_Int16 nRet = 3; + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nRet; + } + } + return nRet; +} + +void PrintOptTest::impl_SetReducedBitmapResolution(sal_Int16 nResolution ) +{ + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Int16 nUpdate; + xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nUpdate; + if (nUpdate != nResolution) + { + xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPRESOLUTION, css::uno::makeAny(nResolution)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + +sal_Bool PrintOptTest::impl_IsReducedBitmapIncludesTransparency() const +{ + sal_Bool bRet = sal_True; + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bRet; + } + } + return bRet; +} + +void PrintOptTest::impl_SetReducedBitmapIncludesTransparency(sal_Bool bState ) +{ + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Bool bUpdate; + xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bUpdate; + if (bUpdate != bState) + { + xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY, css::uno::makeAny(bState)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + +sal_Bool PrintOptTest::impl_IsConvertToGreyscales() const +{ + sal_Bool bRet = sal_False; + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bRet; + } + } + return bRet; +} + +void PrintOptTest::impl_SetConvertToGreyscales(sal_Bool bState ) +{ + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + { + sal_Bool bUpdate; + xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bUpdate; + if (bUpdate != bState) + { + xSet->setPropertyValue( PROPERTYNAME_CONVERTTOGREYSCALES, css::uno::makeAny(bState)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + } +} + + +PrintOptTest::~PrintOptTest() +{ +} + +void PrintOptTest::impl_checkPrint() +{ + //test SetReduceTransparency() + sal_Bool bNewValue = sal_False; + sal_Bool bOldValue = sal_False; + bOldValue = PrintOptTest::impl_IsReduceTransparency(); + bNewValue = !bOldValue; + aPrintOpt.SetReduceTransparency(bNewValue) ; + bNewValue = impl_IsReduceTransparency(); + // if(bNewValue != bOldValue) // test the old source + if ( bNewValue == bOldValue ) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetReduceTransparency() error!"), + 0); + } + + //test IsReduceTransparemcy() + bNewValue = bOldValue = sal_False; + bOldValue = impl_IsReduceTransparency(); + bNewValue = !bOldValue; + impl_SetReduceTransparency(bNewValue); + bNewValue = aPrintOpt.IsReduceTransparency(); + //if(bNewValue != bOldValue) // test the old source + if(bNewValue == bOldValue) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the IsReduceTransparency() error!"), + 0); + } + + // test SetReducedTransparencyMode() + sal_Int16 nOldMode, nNewMode; + nOldMode = nNewMode = 0; + nOldMode = impl_GetReducedTransparencyMode(); + nNewMode = nOldMode + 1; + aPrintOpt.SetReducedTransparencyMode( nNewMode ); + nNewMode = impl_GetReducedTransparencyMode(); + //if(nNewMode != nOldMode) // test the old source + if ( nNewMode == nOldMode ) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetReducedTransparencyMode() error!"), + 0); + } + + //test IsReducedTransparencyMode() + nOldMode = nNewMode = 0; + nOldMode = impl_GetReducedTransparencyMode(); + nNewMode = nOldMode + 1; + impl_SetReducedTransparencyMode(nNewMode); + nNewMode = aPrintOpt.GetReducedTransparencyMode(); + //if(nNewMode != nOldMode) // test the old source + if(nNewMode == nOldMode) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the IsReducedTransparencyMode() error!" + "nOldMode's value is :"), + 0); + } + + // test the SetReduceGradients() + bNewValue = bOldValue = sal_False; + bOldValue = impl_IsReduceGradients(); + bNewValue = !bOldValue; + aPrintOpt.SetReduceGradients(bNewValue); + bNewValue = impl_IsReduceGradients(); + //if (bNewValue != bOldValue) //test the old source + if (bNewValue == bOldValue) //test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetReduceGradients() error!"), + 0); + + } + + // test the IsReduceGradients() + bNewValue = bOldValue = sal_False; + bOldValue = impl_IsReduceGradients(); + bNewValue = !bOldValue; + this->impl_SetReduceGradients(bNewValue); + bNewValue = aPrintOpt.IsReduceGradients(); + // if (bNewValue != bOldValue) // test the old source + if (bNewValue == bOldValue) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the IsReduceGradients() error!"), + 0); + + } + + //test SetRedecedGradientMode() + nOldMode = nNewMode = 0; + nOldMode = this->impl_GetReducedGradientMode(); + nNewMode = nOldMode + 1; + aPrintOpt.SetReducedGradientMode(nNewMode); + nNewMode = this->impl_GetReducedGradientMode(); + //if (nNewMode != nOldMode) // test the old source + if (nNewMode == nOldMode)// test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetRedecedGradientMode() error!"), + 0); + } + + // test GetReducedGradientMode() + nOldMode = nNewMode = 0; + nOldMode = this->impl_GetReducedGradientMode(); + nNewMode = nOldMode + 1; + this->impl_SetReducedGradientMode(nNewMode); + nNewMode = aPrintOpt.GetReducedGradientMode(); + //if (nNewMode != nOldMode) // test the old source + if (nNewMode == nOldMode) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the GetReducedGradientMode() error!"), + 0); + + } + + //test the SetReducedGradientStepCount() + sal_Int16 nNewStepCount; + sal_Int16 nOldStepCount; + nNewStepCount = nOldStepCount = 0; + nOldStepCount = this->impl_GetReducedGradientStepCount(); + nNewStepCount = nOldStepCount + 1; + aPrintOpt.SetReducedGradientStepCount(nNewStepCount); + nNewStepCount = this->impl_GetReducedGradientStepCount(); + // if (nNewStepCount != nOldStepCount) // test the old source + if (nNewStepCount == nOldStepCount) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetReducedGradientStepCount() error!"), + 0); + + } + + // test the GetReduceGradientStepCount() + nNewStepCount = nOldStepCount = 0; + nOldStepCount = this->impl_GetReducedGradientStepCount(); + nNewStepCount = nOldStepCount + 1; + this->impl_SetReducedGradientStepCount(nNewStepCount); + nNewStepCount = aPrintOpt.GetReducedGradientStepCount(); + // if (nNewStepCount != nOldStepCount) //test the old source + if (nNewStepCount == nOldStepCount) //test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the GetReduceGradientStepCount() error!"), + 0); + } + + // test the SetReduceBitmaps() + bNewValue = bOldValue = sal_False; + bOldValue = this->impl_IsReduceBitmaps(); + bNewValue = !bOldValue; + aPrintOpt.SetReduceBitmaps(bNewValue); + bNewValue = this->impl_IsReduceBitmaps(); + //if (bNewValue != bOldValue) // test the old source + if (bNewValue == bOldValue) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetReduceBitmaps() error!"), + 0); + } + + // test the IsReduceBitmaps() + bNewValue = bOldValue = sal_False; + bOldValue = this->impl_IsReduceBitmaps(); + bNewValue = !bOldValue; + this->impl_SetReduceBitmaps(bNewValue); + bNewValue = aPrintOpt.IsReduceBitmaps(); + //if (bNewValue != bOldValue) // test the old source + if (bNewValue == bOldValue) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the IsReduceBitmaps() error!"), + 0); + } + + // test the SetReduceBitmap() + nNewMode = nOldMode = 0; + nOldMode = impl_GetReducedBitmapMode(); + nNewMode = nOldMode + 1; + aPrintOpt.SetReducedBitmapMode(nNewMode); + nNewMode = impl_GetReducedBitmapMode(); + //if (nNewMode != nOldMode) // test the old source + if (nNewMode == nOldMode)// test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetReduceBitmap() error!"), + 0); + } + + // test the SetReduceBitmapMode() + nNewMode = nOldMode = 0; + nOldMode = this->impl_GetReducedBitmapMode(); + nNewMode = nOldMode + 1; + aPrintOpt.SetReducedBitmapMode(nNewMode); + nNewMode = this->impl_GetReducedBitmapMode(); + //if (nNewMode != nOldMode) // test the old source + if (nNewMode == nOldMode) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetReduceBitmapMode() error!"), + 0); + } + + // test the GetReduceBitmapMode() + nNewMode = nOldMode = 0; + nOldMode = this->impl_GetReducedBitmapMode(); + nNewMode = nOldMode + 1; + this->impl_SetReducedBitmapMode(nNewMode); + nNewMode = aPrintOpt.GetReducedBitmapMode(); + //if (nNewMode != nOldMode) // test the old source + if (nNewMode == nOldMode)// test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the GetReduceBitmapMode() error!"), + 0); + + } + + // test the SetReducedBitmapResolution() + sal_Int16 nOldResolution ; + sal_Int16 nNewResolution ; + nNewResolution = nOldResolution = 0; + nOldResolution = impl_GetReducedBitmapResolution(); + nNewResolution = nOldResolution + 1; + aPrintOpt.SetReducedBitmapResolution(nNewResolution); + nNewResolution = impl_GetReducedBitmapResolution(); + //if (nNewResolution != nOldResolution) // test the old source + if (nNewResolution == nOldResolution)// test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetReducedBitmapResolution() error!"), + 0); + } + + // test the GetReduceBitmapResolution() + nNewResolution = nOldResolution = 0; + nOldResolution = impl_GetReducedBitmapResolution(); + nNewResolution = nOldResolution + 1; + impl_SetReducedBitmapResolution(nNewResolution); + nNewResolution = impl_GetReducedBitmapResolution(); + //if (nNewResolution != nOldResolution) // test the old source + if (nNewResolution == nOldResolution) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the GetReduceBitmapResolution() error!"), + 0); + } + + // test SetReducedBitmapIncludesTransparency() + bNewValue = bOldValue = sal_False; + bOldValue = impl_IsReducedBitmapIncludesTransparency(); + bNewValue = !bOldValue; + aPrintOpt.SetReducedBitmapIncludesTransparency(bNewValue); + bNewValue = impl_IsReducedBitmapIncludesTransparency(); + //if (bNewValue != bOldValue) // test the new source + if (bNewValue == bOldValue) // test the old source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetReducedBitmapIncludesTransparency() error!"), + 0); + } + + // test the IsReducedBitmapIncludesTransparency() + bNewValue = bOldValue = sal_False; + bOldValue = impl_IsReducedBitmapIncludesTransparency(); + bNewValue = !bOldValue; + impl_SetReducedBitmapIncludesTransparency(bNewValue); + bNewValue = aPrintOpt.IsReducedBitmapIncludesTransparency(); + //if (bNewValue != bOldValue) // test the old source + if (bNewValue == bOldValue) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the IsReducedBitmapIncludesTransparency() error!"), + 0); + } + + // test the SetConvertToGreyscales() + bNewValue = bOldValue = sal_False; + bOldValue = this->impl_IsConvertToGreyscales(); + bNewValue = !bOldValue; + aPrintOpt.SetConvertToGreyscales(bNewValue); + bNewValue = this->impl_IsConvertToGreyscales(); + //if (bNewValue != bOldValue) // test the old source + if (bNewValue == bOldValue) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the SetConvertToGreyscales() error!"), + 0); + } + + // test the IsConvertToGreyscales() + bNewValue = bOldValue = sal_False; + bOldValue = this->impl_IsConvertToGreyscales(); + bNewValue = !bOldValue; + impl_SetConvertToGreyscales(bNewValue); + bNewValue = aPrintOpt.IsConvertToGreyscales(); + //if (bNewValue != bOldValue) // test the old source + if (bNewValue == bOldValue) // test the new source + { + throw css::uno::RuntimeException( + rtl::OUString::createFromAscii( + "null com.sun.star.configuration." + "the IsConvertToGreyscales() error!"), + 0); + } +} diff --git a/svtools/qa/complex/ConfigItems/helper/PrintOptTest.hxx b/svtools/qa/complex/ConfigItems/helper/PrintOptTest.hxx new file mode 100644 index 000000000000..14d4267b8878 --- /dev/null +++ b/svtools/qa/complex/ConfigItems/helper/PrintOptTest.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: PrintOptTest.hxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:09:24 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef SVTOOLS_PRINTOPTTEST_HXX +#define SVTOOLS_PRINTOPTTEST_HXX + +#include <com/sun/star/container/XNameAccess.hpp> +#include <svtools/printoptions.hxx> + +namespace css = ::com::sun::star; + +class PrintOptTest +{ +public: + + PrintOptTest(); + ~PrintOptTest(); + + void impl_checkPrint(); + +private: //members + + SvtPrinterOptions aPrintOpt; + css::uno::Reference< css::container::XNameAccess > m_xCfg; + css::uno::Reference< css::container::XNameAccess > m_xNode; + +private: // methods + sal_Bool impl_IsReduceTransparency() const ; + void impl_SetReduceTransparency( sal_Bool bState ) ; + + sal_Int16 impl_GetReducedTransparencyMode() const ; + void impl_SetReducedTransparencyMode( sal_Int16 nMode ) ; + + sal_Bool impl_IsReduceGradients() const ; + void impl_SetReduceGradients( sal_Bool bState ) ; + + sal_Int16 impl_GetReducedGradientMode() const ; + void impl_SetReducedGradientMode( sal_Int16 nMode ) ; + + sal_Int16 impl_GetReducedGradientStepCount() const ; + void impl_SetReducedGradientStepCount( sal_Int16 nStepCount ); + + sal_Bool impl_IsReduceBitmaps() const ; + void impl_SetReduceBitmaps( sal_Bool bState ) ; + + sal_Int16 impl_GetReducedBitmapMode() const ; + void impl_SetReducedBitmapMode( sal_Int16 nMode ) ; + + sal_Int16 impl_GetReducedBitmapResolution() const ; + void impl_SetReducedBitmapResolution( sal_Int16 nResolution ) ; + + sal_Bool impl_IsReducedBitmapIncludesTransparency() const ; + void impl_SetReducedBitmapIncludesTransparency( sal_Bool bState ) ; + + sal_Bool impl_IsConvertToGreyscales() const; + void impl_SetConvertToGreyscales( sal_Bool bState ) ; + +}; + +#endif // #ifndef SVTOOLS_PRINTOPTTEST_HXX diff --git a/svtools/qa/complex/ConfigItems/helper/UserOptTest.cxx b/svtools/qa/complex/ConfigItems/helper/UserOptTest.cxx new file mode 100644 index 000000000000..3780eff3f741 --- /dev/null +++ b/svtools/qa/complex/ConfigItems/helper/UserOptTest.cxx @@ -0,0 +1,274 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: UserOptTest.cxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:09:24 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/
+
+#include "UserOptTest.hxx"
+
+namespace css = ::com::sun::star;
+
+//============================================================================= +static const ::rtl::OUString MESSAGE_SETCOMPANY_FAILED = ::rtl::OUString::createFromAscii("set company failed") ; +static const ::rtl::OUString MESSAGE_SETFIRSTNAME_FAILED = ::rtl::OUString::createFromAscii("set firstname failed") ; +static const ::rtl::OUString MESSAGE_SETLASTNAME_FAILED = ::rtl::OUString::createFromAscii("set lastname failed") ; +static const ::rtl::OUString MESSAGE_SETID_FAILED = ::rtl::OUString::createFromAscii("set ID failed") ; +static const ::rtl::OUString MESSAGE_SETSTREET_FAILED = ::rtl::OUString::createFromAscii("set street failed") ; +static const ::rtl::OUString MESSAGE_SETCITY_FAILED = ::rtl::OUString::createFromAscii("set city failed") ; +static const ::rtl::OUString MESSAGE_SETSTATE_FAILED = ::rtl::OUString::createFromAscii("set state failed") ; +static const ::rtl::OUString MESSAGE_SETZIP_FAILED = ::rtl::OUString::createFromAscii("set zip failed") ; +static const ::rtl::OUString MESSAGE_SETCOUNTRY_FAILED = ::rtl::OUString::createFromAscii("set country failed") ; +static const ::rtl::OUString MESSAGE_SETPOSITION_FAILED = ::rtl::OUString::createFromAscii("set position failed") ; +static const ::rtl::OUString MESSAGE_SETTITLE_FAILED = ::rtl::OUString::createFromAscii("set title failed") ; +static const ::rtl::OUString MESSAGE_SETTELEPHONEHOME_FAILED = ::rtl::OUString::createFromAscii("set telephonehome failed") ; +static const ::rtl::OUString MESSAGE_SETTELEPHONEWORK_FAILED = ::rtl::OUString::createFromAscii("set telephonework failed") ; +static const ::rtl::OUString MESSAGE_SETFAX_FAILED = ::rtl::OUString::createFromAscii("set fax failed") ; +static const ::rtl::OUString MESSAGE_SETEMAIL_FAILED = ::rtl::OUString::createFromAscii("set email failed") ; +static const ::rtl::OUString MESSAGE_SETCUSTOMERNUMBER_FAILED = ::rtl::OUString::createFromAscii("set customernumber failed"); +static const ::rtl::OUString MESSAGE_SETFATHERSNAME_FAILED = ::rtl::OUString::createFromAscii("set fathersname failed") ; +static const ::rtl::OUString MESSAGE_SETAPARTMENT_FAILED = ::rtl::OUString::createFromAscii("set apartment failed") ; + +//=============================================================================
+
+
+UserOptTest::UserOptTest()
+ :m_aConfigItem()
+ ,m_xCfg()
+{
+}
+
+UserOptTest::~UserOptTest()
+{
+}
+
+void UserOptTest::impl_checkUserData()
+{
+ impl_checkSetCompany( ::rtl::OUString() );
+ impl_checkSetFirstName( ::rtl::OUString() );
+ impl_checkSetLastName( ::rtl::OUString() );
+ impl_checkSetID( ::rtl::OUString() );
+ impl_checkSetStreet( ::rtl::OUString() );
+ impl_checkSetCity( ::rtl::OUString() );
+ impl_checkSetState( ::rtl::OUString() );
+ impl_checkSetZip( ::rtl::OUString() );
+ impl_checkSetCountry( ::rtl::OUString() );
+ impl_checkSetPosition( ::rtl::OUString() );
+ impl_checkSetTitle( ::rtl::OUString() );
+ impl_checkSetTelephoneHome( ::rtl::OUString() );
+ impl_checkSetTelephoneWork( ::rtl::OUString() );
+ impl_checkSetFax( ::rtl::OUString() );
+ impl_checkSetEmail( ::rtl::OUString() );
+ //impl_checkSetCustomerNumber( ::rtl::OUString() );
+ impl_checkSetFathersName( ::rtl::OUString() );
+ impl_checkSetApartment( ::rtl::OUString() );
+
+ impl_checkSetCompany( ::rtl::OUString::createFromAscii("RedFlag2000") );
+ impl_checkSetFirstName( ::rtl::OUString::createFromAscii("Yan") );
+ impl_checkSetLastName( ::rtl::OUString::createFromAscii("Wu") );
+ impl_checkSetID( ::rtl::OUString::createFromAscii("wuy") );
+ impl_checkSetStreet( ::rtl::OUString::createFromAscii("SouthFifthRing") );
+ impl_checkSetCity( ::rtl::OUString::createFromAscii("Beijing") );
+ impl_checkSetState( ::rtl::OUString::createFromAscii("Beijing") );
+ impl_checkSetZip( ::rtl::OUString::createFromAscii("100176") );
+ impl_checkSetCountry( ::rtl::OUString::createFromAscii("China") );
+ impl_checkSetPosition( ::rtl::OUString::createFromAscii("Engineer") );
+ impl_checkSetTitle( ::rtl::OUString::createFromAscii("Software Engineer") );
+ impl_checkSetTelephoneHome( ::rtl::OUString::createFromAscii("010-51570010") );
+ impl_checkSetTelephoneWork( ::rtl::OUString::createFromAscii("010-51570010") );
+ impl_checkSetFax( ::rtl::OUString::createFromAscii("010-51570010") );
+ impl_checkSetEmail( ::rtl::OUString::createFromAscii("wuy@redflag2000.cn") );
+ //impl_checkSetCustomerNumber( ::rtl::OUString::createFromAscii("87654321") );
+ impl_checkSetFathersName( ::rtl::OUString::createFromAscii("father") );
+ impl_checkSetApartment( ::rtl::OUString::createFromAscii("apartment") );
+}
+ +void UserOptTest::impl_checkSetCompany( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetCompany( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetCompany(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETCOMPANY_FAILED, 0); +} + +void UserOptTest::impl_checkSetFirstName( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetFirstName( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetFirstName(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETFIRSTNAME_FAILED, 0); +} + +void UserOptTest::impl_checkSetLastName( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetLastName( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetLastName(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETLASTNAME_FAILED, 0); +} + +void UserOptTest::impl_checkSetID( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetID( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetID(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETID_FAILED, 0); +} + +void UserOptTest::impl_checkSetStreet( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetStreet( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetStreet(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETSTREET_FAILED, 0); +} + +void UserOptTest::impl_checkSetCity( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetCity( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetCity(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETCITY_FAILED, 0); +} + +void UserOptTest::impl_checkSetState( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetState( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetState(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETSTATE_FAILED, 0); +} + +void UserOptTest::impl_checkSetZip( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetZip( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetZip(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETZIP_FAILED, 0); +} + +void UserOptTest::impl_checkSetCountry( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetCountry( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetCountry(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETCOUNTRY_FAILED, 0); +} + +void UserOptTest::impl_checkSetPosition( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetPosition( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetPosition(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETPOSITION_FAILED, 0); +} + +void UserOptTest::impl_checkSetTitle( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetTitle( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetTitle(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETTITLE_FAILED, 0); +} + +void UserOptTest::impl_checkSetTelephoneHome( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetTelephoneHome( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetTelephoneHome(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETTELEPHONEHOME_FAILED, 0); +} + +void UserOptTest::impl_checkSetTelephoneWork( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetTelephoneWork( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetTelephoneWork(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETTELEPHONEWORK_FAILED, 0); +} + +void UserOptTest::impl_checkSetFax( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetFax( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetFax(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETFAX_FAILED, 0); +} + +void UserOptTest::impl_checkSetEmail( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetEmail( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetEmail(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETEMAIL_FAILED, 0); +} + +void UserOptTest::impl_checkSetCustomerNumber( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetCustomerNumber( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetCustomerNumber(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETCUSTOMERNUMBER_FAILED, 0); +} + +void UserOptTest::impl_checkSetFathersName( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetFathersName( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetFathersName(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETFATHERSNAME_FAILED, 0); +} + +void UserOptTest::impl_checkSetApartment( const ::rtl::OUString& sUserData ) +{ + m_aConfigItem.SetApartment( sUserData ); + + ::rtl::OUString sCheck = m_aConfigItem.GetApartment(); + if ( sCheck != sUserData ) + throw css::uno::Exception(MESSAGE_SETAPARTMENT_FAILED, 0); +} diff --git a/svtools/qa/complex/ConfigItems/helper/UserOptTest.hxx b/svtools/qa/complex/ConfigItems/helper/UserOptTest.hxx new file mode 100644 index 000000000000..203a4cbc7cbd --- /dev/null +++ b/svtools/qa/complex/ConfigItems/helper/UserOptTest.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: UserOptTest.hxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:09:25 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/
+
+#ifndef SVTOOLS_USEROPTTEST_HXX
+#define SVTOOLS_USEROPTTEST_HXX
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <svtools/useroptions.hxx>
+
+namespace css = ::com::sun::star;
+
+class UserOptTest
+{
+public:
+ UserOptTest();
+ ~UserOptTest();
+
+ void impl_checkUserData();
+
+private:
+ void impl_checkSetCompany( const ::rtl::OUString& sUserData );
+ void impl_checkSetFirstName( const ::rtl::OUString& sUserData );
+ void impl_checkSetLastName( const ::rtl::OUString& sUserData );
+ void impl_checkSetID( const ::rtl::OUString& sUserData );
+ void impl_checkSetStreet( const ::rtl::OUString& sUserData );
+ void impl_checkSetCity( const ::rtl::OUString& sUserData );
+ void impl_checkSetState( const ::rtl::OUString& sUserData );
+ void impl_checkSetZip( const ::rtl::OUString& sUserData );
+ void impl_checkSetCountry( const ::rtl::OUString& sUserData );
+ void impl_checkSetPosition( const ::rtl::OUString& sUserData );
+ void impl_checkSetTitle( const ::rtl::OUString& sUserData );
+ void impl_checkSetTelephoneHome( const ::rtl::OUString& sUserData );
+ void impl_checkSetTelephoneWork( const ::rtl::OUString& sUserData );
+ void impl_checkSetFax( const ::rtl::OUString& sUserData );
+ void impl_checkSetEmail( const ::rtl::OUString& sUserData );
+ void impl_checkSetCustomerNumber( const ::rtl::OUString& sUserData );
+ void impl_checkSetFathersName( const ::rtl::OUString& sUserData );
+ void impl_checkSetApartment( const ::rtl::OUString& sUserData );
+
+private:
+ SvtUserOptions m_aConfigItem;
+
+ css::uno::Reference< css::container::XNameAccess > m_xCfg;
+};
+
+#endif // #ifndef SVTOOLS_USEROPTTEST_HXX
diff --git a/svtools/qa/complex/ConfigItems/helper/exports.map b/svtools/qa/complex/ConfigItems/helper/exports.map new file mode 100644 index 000000000000..85610ad80888 --- /dev/null +++ b/svtools/qa/complex/ConfigItems/helper/exports.map @@ -0,0 +1,10 @@ +UDK_3_0_0 { + global: + GetVersionInfo; + component_getImplementationEnvironment; + component_getFactory; + component_writeInfo; + + local: + *; +}; diff --git a/svtools/qa/complex/ConfigItems/helper/makefile.mk b/svtools/qa/complex/ConfigItems/helper/makefile.mk new file mode 100644 index 000000000000..6070d25b7bd4 --- /dev/null +++ b/svtools/qa/complex/ConfigItems/helper/makefile.mk @@ -0,0 +1,81 @@ +#************************************************************************* +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.4.2 $ +# +# last change: $Author: as $ $Date: 2008/03/19 11:09:25 $ +# +# The Contents of this file are made available subject to +# the terms of GNU Lesser General Public License Version 2.1. +# +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2005 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +#************************************************************************* +PRJ=..$/..$/..$/.. + +PRJNAME= svtools +TARGET= ConfigItemTest +USE_DEFFILE= TRUE +ENABLE_EXCEPTIONS= TRUE +NO_BSYMBOLIC= TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# --- Generate ----------------------------------------------------- + +INCPOST += $(PRJ)$/source$/inc + +# --- light services library ---------------------------------------------------- + +SHL1TARGET= svt_$(TARGET) + +SHL1OBJS= \ + $(SLO)$/UserOptTest.obj \ + $(SLO)$/PrintOptTest.obj \ + $(SLO)$/AccessibilityOptTest.obj \ + $(SLO)$/HistoryOptTest.obj \ + $(SLO)$/ConfigItemTest.obj + +SHL1STDLIBS= \ + $(SVTOOLLIB) \ + $(SVLLIB) \ + $(UNOTOOLSLIB) \ + $(COMPHELPERLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(SALLIB) + +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +#SHL1DEPN= $(SHL1IMPLIBN) $(SHL1TARGETN) + +DEF1NAME= $(SHL1TARGET) + +SHL1VERSIONMAP= exports.map + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + diff --git a/svtools/qa/complex/ConfigItems/makefile.mk b/svtools/qa/complex/ConfigItems/makefile.mk new file mode 100644 index 000000000000..f85c5b0a8e65 --- /dev/null +++ b/svtools/qa/complex/ConfigItems/makefile.mk @@ -0,0 +1,91 @@ +#************************************************************************* +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.4.2 $ +# +# last change: $Author: as $ $Date: 2008/03/19 11:09:22 $ +# +# The Contents of this file are made available subject to +# the terms of GNU Lesser General Public License Version 2.1. +# +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2005 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +#************************************************************************* +PRJ = ..$/..$/.. +TARGET = CheckConfigItems +PRJNAME = svtools +PACKAGE = complex$/ConfigItems + +# --- Settings ----------------------------------------------------- +.INCLUDE: settings.mk + + +#----- compile .java files ----------------------------------------- + +JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar jut.jar java_uno.jar \ + OOoRunner.jar + +JAVAFILES = CheckConfigItems.java + +JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) + +SUBDIRS = helper + +#----- make a jar from compiled files ------------------------------ + +MAXLINELENGTH = 100000 + +JARCLASSDIRS = $(PACKAGE) +JARTARGET = $(TARGET).jar +JARCOMPRESS = TRUE + +# --- Parameters for the test -------------------------------------- + +# start an office if the parameter is set for the makefile +.IF "$(OFFICE)" == "" +CT_APPEXECCOMMAND = +.ELSE +CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;" +.ENDIF + +# test base is java complex +CT_TESTBASE = -TestBase java_complex + +# test looks something like the.full.package.TestName +CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b) + +# start the runner application +CT_APP = org.openoffice.Runner + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + +RUN: run + +run: + java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_APPEXECCOMMAND) $(CT_TEST) + + + diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index 2a8fdf54290e..526af00e5b5f 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -291,11 +291,10 @@ void BrowseBox::InsertHandleColumn( ULONG nWidth ) // Headerbar anpassen if ( getDataWindow()->pHeaderBar ) { - getDataWindow()->pHeaderBar->SetPosPixel( - Point(nWidth, 0)); - - getDataWindow()->pHeaderBar->SetSizePixel( - Size( GetOutputSizePixel().Width() - nWidth, GetTitleHeight() ) ); + getDataWindow()->pHeaderBar->SetPosSizePixel( + Point(nWidth, 0), + Size( GetOutputSizePixel().Width() - nWidth, GetTitleHeight() ) + ); } /*if ( getDataWindow()->pHeaderBar ) @@ -837,11 +836,10 @@ void BrowseBox::RemoveColumn( USHORT nItemId ) // Headerbar anpassen if ( getDataWindow()->pHeaderBar ) { - getDataWindow()->pHeaderBar->SetPosPixel( - Point(0, 0)); - - getDataWindow()->pHeaderBar->SetSizePixel( - Size( GetOutputSizePixel().Width(), GetTitleHeight() ) ); + getDataWindow()->pHeaderBar->SetPosSizePixel( + Point(0, 0), + Size( GetOutputSizePixel().Width(), GetTitleHeight() ) + ); } } @@ -1028,93 +1026,83 @@ long BrowseBox::ScrollColumns( long nCols ) BOOL bScrollable = pDataWin->GetBackground().IsScrollable(); BOOL bInvalidateView = FALSE; - // eine Spalte nach links scrollen? + // scrolling one column to the right? if ( nCols == 1 ) { // update internal value and scrollbar ++nFirstCol; aHScroll.SetThumbPos( nFirstCol - FrozenColCount() ); - long nDelta = pCols->GetObject(nFirstCol-1)->Width(); - long nFrozenWidth = GetFrozenWidth(); - - // scroll the title-line - Rectangle aScrollRect( - Point( nFrozenWidth + nDelta, 0 ), - Size( GetOutputSizePixel().Width() - nFrozenWidth - nDelta, - GetTitleHeight() - 1 ) ); - - // ggf. Headerbar mitscrollen - if ( !getDataWindow()->pHeaderBar && nTitleLines ) + if ( !bScrollable ) { - if( bScrollable ) - Scroll( -nDelta, 0, aScrollRect, SCROLL_FLAGS ); - else - bInvalidateView = TRUE; + bInvalidateView = TRUE; } + else + { + long nDelta = pCols->GetObject(nFirstCol-1)->Width(); + long nFrozenWidth = GetFrozenWidth(); + Rectangle aScrollRect( Point( nFrozenWidth + nDelta, 0 ), + Size ( GetOutputSizePixel().Width() - nFrozenWidth - nDelta, + GetTitleHeight() - 1 + ) ); - long nSkippedWidth = GetOutputSizePixel().Width() - - 2 * aScrollRect.GetWidth() - nFrozenWidth; - if ( nSkippedWidth > 0 ) - { - aScrollRect.Right() = aScrollRect.Left()-1; - aScrollRect.Left() -= nSkippedWidth; - Invalidate( aScrollRect ); - } + // scroll the header bar area (if there is no dedicated HeaderBar control) + if ( !getDataWindow()->pHeaderBar && nTitleLines ) + { + // actually scroll + Scroll( -nDelta, 0, aScrollRect, SCROLL_FLAGS ); - // scroll the data-area - aScrollRect = Rectangle( - Point( nFrozenWidth + nDelta, 0 ), - Size( pDataWin->GetOutputSizePixel().Width() - nFrozenWidth - - nDelta, pDataWin->GetOutputSizePixel().Height() ) ); + // invalidate the area of the column which was scrolled out to the left hand side + Rectangle aInvalidateRect( aScrollRect ); + aInvalidateRect.Left() = nFrozenWidth; + aInvalidateRect.Right() = nFrozenWidth + nDelta - 1; + Invalidate( aInvalidateRect ); + } + + // scroll the data-area + aScrollRect.Bottom() = pDataWin->GetOutputSizePixel().Height(); - if( bScrollable ) + // actually scroll pDataWin->Scroll( -nDelta, 0, aScrollRect, SCROLL_FLAGS ); - else - bInvalidateView = TRUE; - nSkippedWidth = pDataWin->GetOutputSizePixel().Width() - - 2 * aScrollRect.GetWidth() - nFrozenWidth; - if ( nSkippedWidth > 0 ) - { - aScrollRect.Right() = aScrollRect.Left()-1; - aScrollRect.Left() -= nSkippedWidth; + + // invalidate the area of the column which was scrolled out to the left hand side + aScrollRect.Left() = nFrozenWidth; + aScrollRect.Right() = nFrozenWidth + nDelta - 1; getDataWindow()->Invalidate( aScrollRect ); } } - // eine Spalte nach rechts scrollen? + // scrolling one column to the left? else if ( nCols == -1 ) { --nFirstCol; aHScroll.SetThumbPos( nFirstCol - FrozenColCount() ); - long nDelta = pCols->GetObject(nFirstCol)->Width(); - long nFrozenWidth = GetFrozenWidth(); - - // ggf. Headerbar mitscrollen - if ( !getDataWindow()->pHeaderBar && nTitleLines ) - { - if( bScrollable ) - { - Scroll( nDelta, 0, Rectangle( - Point( nFrozenWidth, 0 ), - Size( GetOutputSizePixel().Width() - nFrozenWidth, - GetTitleHeight() - 1 ) ), SCROLL_FLAGS ); - } - else - bInvalidateView = TRUE; - } - if( bScrollable ) + if ( !bScrollable ) { - pDataWin->Scroll( nDelta, 0, Rectangle( - Point( nFrozenWidth, 0 ), - Size( pDataWin->GetSizePixel().Width() - nFrozenWidth, - pDataWin->GetSizePixel().Height() ) ), SCROLL_FLAGS ); + bInvalidateView = TRUE; } else - bInvalidateView = TRUE; + { + long nDelta = pCols->GetObject(nFirstCol)->Width(); + long nFrozenWidth = GetFrozenWidth(); + + Rectangle aScrollRect( Point( nFrozenWidth, 0 ), + Size ( GetOutputSizePixel().Width() - nFrozenWidth, + GetTitleHeight() - 1 + ) ); + // scroll the header bar area (if there is no dedicated HeaderBar control) + if ( !getDataWindow()->pHeaderBar && nTitleLines ) + { + Scroll( nDelta, 0, aScrollRect, SCROLL_FLAGS ); + } + + // scroll the data-area + aScrollRect.Bottom() = pDataWin->GetOutputSizePixel().Height(); + pDataWin->Scroll( nDelta, 0, aScrollRect, SCROLL_FLAGS ); + } } else { diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index 69eadb01f0a9..daf8d080dac2 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -164,7 +164,21 @@ bool BrowseBox::IsInCommandEvent() const void BrowseBox::StateChanged( StateChangedType nStateChange ) { - if ( STATE_CHANGE_INITSHOW == nStateChange ) + Control::StateChanged( nStateChange ); + + if ( STATE_CHANGE_MIRRORING == nStateChange ) + { + getDataWindow()->EnableRTL( IsRTLEnabled() ); + + HeaderBar* pHeaderBar = getDataWindow()->pHeaderBar; + if ( pHeaderBar ) + pHeaderBar->EnableRTL( IsRTLEnabled() ); + aHScroll.EnableRTL( IsRTLEnabled() ); + if( pVScroll ) + pVScroll->EnableRTL( IsRTLEnabled() ); + Resize(); + } + else if ( STATE_CHANGE_INITSHOW == nStateChange ) { bBootstrapped = TRUE; // muss zuerst gesetzt werden! @@ -661,8 +675,7 @@ void BrowseBox::Resize() // Handle-Column beruecksichtigen BrowserColumn *pFirstCol = pCols->GetObject(0); long nOfsX = pFirstCol->GetId() ? 0 : pFirstCol->Width(); - pHeaderBar->SetPosPixel( Point( nOfsX, 0 ) ); - pHeaderBar->SetSizePixel( Size( GetOutputSizePixel().Width() - nOfsX, GetTitleHeight() ) ); + pHeaderBar->SetPosSizePixel( Point( nOfsX, 0 ), Size( GetOutputSizePixel().Width() - nOfsX, GetTitleHeight() ) ); } AutoSizeLastColumn(); // adjust last column width @@ -1306,7 +1319,9 @@ void BrowseBox::UpdateScrollbars() if ( bNeedsVScroll && !pVScroll->IsVisible() ) pVScroll->Show(); - pDataWin->SetSizePixel( aDataWinSize ); + pDataWin->SetPosSizePixel( + Point( 0, GetTitleHeight() ), + aDataWinSize ); // needs corner-window? // (do that AFTER positioning BOTH scrollbars) diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index 3e16e10866f3..086e00674a8e 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -330,6 +330,7 @@ namespace svt } Image aImage; + bool bNeedMirror = IsRTLEnabled(); switch (eStatus) { case CURRENT: @@ -340,6 +341,7 @@ namespace svt break; case MODIFIED: aImage = m_aStatusImages.GetImage(IMG_EBB_MODIFIED); + bNeedMirror = false; // the pen is not mirrored break; case NEW: aImage = m_aStatusImages.GetImage(IMG_EBB_NEW); @@ -362,6 +364,12 @@ namespace svt case CLEAN: break; } + if ( bNeedMirror ) + { + BitmapEx aBitmap( aImage.GetBitmapEx() ); + aBitmap.Mirror( BMP_MIRROR_HORZ ); + aImage = Image( aBitmap ); + } return aImage; } @@ -788,14 +796,15 @@ namespace svt { BrowseBox::StateChanged( nType ); - if ( nType == STATE_CHANGE_ZOOM ) + bool bNeedCellReActivation = false; + if ( nType == STATE_CHANGE_MIRRORING ) + { + bNeedCellReActivation = true; + } + else if ( nType == STATE_CHANGE_ZOOM ) { ImplInitSettings( sal_True, sal_False, sal_False ); - if (IsEditing()) - { - DeactivateCell(); - ActivateCell(); - } + bNeedCellReActivation = true; } else if ( nType == STATE_CHANGE_CONTROLFONT ) { @@ -820,6 +829,14 @@ namespace svt SetStyle(nStyle); } + if ( bNeedCellReActivation ) + { + if ( IsEditing() ) + { + DeactivateCell(); + ActivateCell(); + } + } } //------------------------------------------------------------------------------ diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx index 6bf1a648e94b..6f1e3882d705 100644 --- a/svtools/source/config/accessibilityoptions.cxx +++ b/svtools/source/config/accessibilityoptions.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: accessibilityoptions.cxx,v $ - * $Revision: 1.16 $ + * $Revision: 1.15.74.2 $ * * This file is part of OpenOffice.org. * @@ -37,10 +37,29 @@ #define SVT_DLLIMPLEMENTATION #include <svtools/accessibilityoptions.hxx> +#include "configitems/accessibilityoptions_const.hxx" + #include <unotools/configmgr.hxx> #include <tools/debug.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> + +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif +#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_ +#include <comphelper/configurationhelper.hxx> +#endif +#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_ +#include <unotools/processfactory.hxx> +#endif +#ifndef _SVT_LOGHELPER_HXX_ +#include <loghelper.hxx> +#endif + #include <svtools/smplhint.hxx> #include <vcl/settings.hxx> @@ -52,95 +71,45 @@ using namespace utl; using namespace rtl; using namespace com::sun::star::uno; +namespace css = com::sun::star; #define HELP_TIP_TIMEOUT 0xffff // max. timeout setting to pretend a non-timeout + // class SvtAccessibilityOptions_Impl --------------------------------------------- -class SvtAccessibilityOptions_Impl : public utl::ConfigItem, public SfxBroadcaster +class SvtAccessibilityOptions_Impl { private: - sal_Int16 m_nHelpTipSeconds; - - sal_Bool m_bForPagePreviews; - sal_Bool m_bHelpTipsDisappear; - sal_Bool m_bAllowAnimatedGraphics; - sal_Bool m_bAllowAnimatedText; - sal_Bool m_bAutomaticFontColor; - sal_Bool m_bSystemFont; - sal_Bool m_bTextSelectionInReadonly; - sal_Bool m_bAutoDetectSystemHC; - - typedef sal_Bool SvtAccessibilityOptions_Impl:: *BoolPtr; - - sal_Bool GetToken( BoolPtr pPtr ) const; - void SetToken( BoolPtr pPtr, sal_Bool bSet ); - void Load(); - - //this list needs exactly to mach the listet properties in GetPropertyNames - enum PropertyNameIndex { PAGEPREVIEWS - , HELPTIPSDISAPPEAR - , HELPTIPSECONDS - , ALLOWANIMATEDGRAPHICS - , ALLOWANIMATEDTEXT - , AUTOMATICFONTCOLOR - , SYSTEMFONT - , TEXTSELECTION - , AUTODETECTSYSTEMHC - }; - - static Sequence< OUString > GetPropertyNames(); + css::uno::Reference< css::container::XNameAccess > m_xCfg; + sal_Bool bIsModified; public: SvtAccessibilityOptions_Impl(); - - virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); - virtual void Commit(); + ~SvtAccessibilityOptions_Impl(); void SetVCLSettings(); - sal_Bool GetAutoDetectSystemHC( ) - {return GetToken( &SvtAccessibilityOptions_Impl::m_bAutoDetectSystemHC ); } - sal_Bool GetIsForPagePreviews() const - {return GetToken( &SvtAccessibilityOptions_Impl::m_bForPagePreviews );} - sal_Bool GetIsHelpTipsDisappear() const - {return GetToken( &SvtAccessibilityOptions_Impl::m_bHelpTipsDisappear );} - sal_Bool GetIsAllowAnimatedGraphics() const - {return GetToken( &SvtAccessibilityOptions_Impl::m_bAllowAnimatedGraphics );} - sal_Bool GetIsAllowAnimatedText() const - {return GetToken( &SvtAccessibilityOptions_Impl::m_bAllowAnimatedText );} - sal_Bool GetIsAutomaticFontColor() const - {return GetToken( &SvtAccessibilityOptions_Impl::m_bAutomaticFontColor );} - sal_Bool GetIsSystemFont() const - {return GetToken( &SvtAccessibilityOptions_Impl::m_bSystemFont );} - sal_Int16 GetHelpTipSeconds() const - {return m_nHelpTipSeconds;} - sal_Bool IsSelectionInReadonly() const - {return m_bTextSelectionInReadonly;} - - void SetAutoDetectSystemHC( sal_Bool bSet ) - { SetToken( &SvtAccessibilityOptions_Impl::m_bAutoDetectSystemHC, bSet ); } - void SetIsForPagePreviews(sal_Bool bSet) - { SetToken( &SvtAccessibilityOptions_Impl::m_bForPagePreviews, bSet ); } - void SetIsHelpTipsDisappear(sal_Bool bSet) - { SetToken( &SvtAccessibilityOptions_Impl::m_bHelpTipsDisappear, bSet ); } - void SetIsAllowAnimatedGraphics(sal_Bool bSet) - { SetToken( &SvtAccessibilityOptions_Impl::m_bAllowAnimatedGraphics, bSet ); } - void SetIsAllowAnimatedText(sal_Bool bSet) - { SetToken( &SvtAccessibilityOptions_Impl::m_bAllowAnimatedText, bSet ); } - void SetIsAutomaticFontColor(sal_Bool bSet) - { SetToken( &SvtAccessibilityOptions_Impl::m_bAutomaticFontColor, bSet ); } - void SetIsSystemFont(sal_Bool bSet) - { SetToken( &SvtAccessibilityOptions_Impl::m_bSystemFont, bSet ); } - void SetHelpTipSeconds(sal_Int16 nSet) - { - if(m_nHelpTipSeconds!=nSet) - { - m_nHelpTipSeconds=nSet; - SetModified(); - } - } - void SetSelectionInReadonly(sal_Bool bSet) - {SetToken( &SvtAccessibilityOptions_Impl::m_bTextSelectionInReadonly, bSet);} + sal_Bool GetAutoDetectSystemHC(); + sal_Bool GetIsForPagePreviews() const; + sal_Bool GetIsHelpTipsDisappear() const; + sal_Bool GetIsAllowAnimatedGraphics() const; + sal_Bool GetIsAllowAnimatedText() const; + sal_Bool GetIsAutomaticFontColor() const; + sal_Bool GetIsSystemFont() const; + sal_Int16 GetHelpTipSeconds() const; + sal_Bool IsSelectionInReadonly() const; + + void SetAutoDetectSystemHC(sal_Bool bSet); + void SetIsForPagePreviews(sal_Bool bSet); + void SetIsHelpTipsDisappear(sal_Bool bSet); + void SetIsAllowAnimatedGraphics(sal_Bool bSet); + void SetIsAllowAnimatedText(sal_Bool bSet); + void SetIsAutomaticFontColor(sal_Bool bSet); + void SetIsSystemFont(sal_Bool bSet); + void SetHelpTipSeconds(sal_Int16 nSet); + void SetSelectionInReadonly(sal_Bool bSet); + + sal_Bool IsModified() const { return bIsModified; }; }; // initialization of static members -------------------------------------- @@ -154,168 +123,390 @@ namespace : public rtl::Static< ::osl::Mutex, SingletonMutex > {}; } -// functions ------------------------------------------------------------- +// ----------------------------------------------------------------------- +// class SvtAccessibilityOptions_Impl --------------------------------------------- -Sequence< OUString > SvtAccessibilityOptions_Impl::GetPropertyNames() +SvtAccessibilityOptions_Impl::SvtAccessibilityOptions_Impl() { - //this list needs exactly to mach the enum PropertyNameIndex - static const char* aPropNames[] = + try { - "IsForPagePreviews" // PAGEPREVIEWS - ,"IsHelpTipsDisappear" // HELPTIPSDISAPPEAR - ,"HelpTipSeconds" // HELPTIPSECONDS - ,"IsAllowAnimatedGraphics" // ALLOWANIMATEDGRAPHICS - ,"IsAllowAnimatedText" // ALLOWANIMATEDTEXT - ,"IsAutomaticFontColor" // AUTOMATICFONTCOLOR - ,"IsSystemFont" // SYSTEMFONT - ,"IsSelectionInReadonly" // TEXTSELECTION - ,"AutoDetectSystemHC" // AUTODETECTSYSTEMHC - }; - const int nCount = sizeof( aPropNames ) / sizeof( const char* ); - Sequence< OUString > aNames( nCount ); - OUString* pNames = aNames.getArray(); - for ( int i = 0; i < nCount; i++ ) - pNames[i] = OUString::createFromAscii( aPropNames[i] ); + m_xCfg = css::uno::Reference< css::container::XNameAccess >( + ::comphelper::ConfigurationHelper::openConfig( + utl::getProcessServiceFactory(), + s_sAccessibility, + ::comphelper::ConfigurationHelper::E_STANDARD), + css::uno::UNO_QUERY); + + bIsModified = sal_False; + } + catch(const css::uno::Exception& ex) + { + m_xCfg.clear(); + LogHelper::logIt(ex); + } +} - return aNames; +SvtAccessibilityOptions_Impl::~SvtAccessibilityOptions_Impl() +{ } // ----------------------------------------------------------------------- -// class SvtAccessibilityOptions_Impl --------------------------------------------- +sal_Bool SvtAccessibilityOptions_Impl::GetAutoDetectSystemHC() +{ + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bRet = sal_True; + + try + { + if(xNode.is()) + xNode->getPropertyValue(s_sAutoDetectSystemHC) >>= bRet; + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } -SvtAccessibilityOptions_Impl::SvtAccessibilityOptions_Impl() : - ConfigItem( OUString::createFromAscii("Office.Common/Accessibility") ) + return bRet; +} + +sal_Bool SvtAccessibilityOptions_Impl::GetIsForPagePreviews() const { - Load(); + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bRet = sal_True; + + try + { + if(xNode.is()) + xNode->getPropertyValue(s_sIsForPagePreviews) >>= bRet; + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } + return bRet; } -// ----------------------------------------------------------------------- -void SvtAccessibilityOptions_Impl::Load() + +sal_Bool SvtAccessibilityOptions_Impl::GetIsHelpTipsDisappear() const +{ + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bRet = sal_True; + + try + { + if(xNode.is()) + xNode->getPropertyValue(s_sIsHelpTipsDisappear) >>= bRet; + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } + + return bRet; +} + +sal_Bool SvtAccessibilityOptions_Impl::GetIsAllowAnimatedGraphics() const { - Sequence< OUString > aNames = GetPropertyNames(); - Sequence< Any > aValues = GetProperties( aNames ); - EnableNotification( aNames ); - const Any* pValues = aValues.getConstArray(); - DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" ); - if ( aValues.getLength() == aNames.getLength() ) + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bRet = sal_True; + + try + { + if(xNode.is()) + xNode->getPropertyValue(s_sIsAllowAnimatedGraphics) >>= bRet; + } + catch(const css::uno::Exception& ex) { - sal_Bool bTemp = sal_Bool(); + LogHelper::logIt(ex); + } + + return bRet; +} + +sal_Bool SvtAccessibilityOptions_Impl::GetIsAllowAnimatedText() const +{ + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bRet = sal_True; + + try + { + if(xNode.is()) + xNode->getPropertyValue(s_sIsAllowAnimatedText) >>= bRet; + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } + + return bRet; +} + +sal_Bool SvtAccessibilityOptions_Impl::GetIsAutomaticFontColor() const +{ + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bRet = sal_False; + + try + { + if(xNode.is()) + xNode->getPropertyValue(s_sIsAutomaticFontColor) >>= bRet; + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } + + return bRet; +} + +sal_Bool SvtAccessibilityOptions_Impl::GetIsSystemFont() const +{ + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bRet = sal_True; + + try + { + if(xNode.is()) + xNode->getPropertyValue(s_sIsSystemFont) >>= bRet; + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } + + return bRet; +} + +sal_Int16 SvtAccessibilityOptions_Impl::GetHelpTipSeconds() const +{ + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + sal_Int16 nRet = 4; + + try + { + if(xNode.is()) + xNode->getPropertyValue(s_sHelpTipSeconds) >>= nRet; + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } + + return nRet; +} + +sal_Bool SvtAccessibilityOptions_Impl::IsSelectionInReadonly() const +{ + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + sal_Bool bRet = sal_False; + + try + { + if(xNode.is()) + xNode->getPropertyValue(s_sIsSelectionInReadonly) >>= bRet; + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } + + return bRet; +} + +void SvtAccessibilityOptions_Impl::SetAutoDetectSystemHC(sal_Bool bSet) +{ + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); - for ( int nProp = 0; nProp < aNames.getLength(); nProp++ ) + try + { + if(xNode.is() && xNode->getPropertyValue(s_sAutoDetectSystemHC)!=bSet) { - if ( pValues[nProp].hasValue() ) - { - if ( pValues[nProp] >>= bTemp ) - { - switch ( PropertyNameIndex(nProp) ) - { - case PAGEPREVIEWS: m_bForPagePreviews = bTemp; break; - case HELPTIPSDISAPPEAR: m_bHelpTipsDisappear = bTemp; break; - case ALLOWANIMATEDGRAPHICS: m_bAllowAnimatedGraphics = bTemp; break; - case ALLOWANIMATEDTEXT: m_bAllowAnimatedText = bTemp; break; - case AUTOMATICFONTCOLOR: m_bAutomaticFontColor = bTemp; break; - case SYSTEMFONT: m_bSystemFont = bTemp; break; - case TEXTSELECTION: m_bTextSelectionInReadonly = bTemp; break; - case AUTODETECTSYSTEMHC: m_bAutoDetectSystemHC = bTemp; break; - default: - DBG_ERRORFILE( "invalid index to load a user token" ); - } - } - else - { - sal_Int16 nTemp = sal_Int16(); - if( pValues[nProp] >>= nTemp ) - { - if(PropertyNameIndex(nProp)==HELPTIPSECONDS)//this is an integer and not a bool - m_nHelpTipSeconds=nTemp; - else - { - DBG_ERRORFILE( "sal_Int16 any type not matched with property name" ); - } - } - else - { - DBG_ERRORFILE( "Wrong any type" ); - } - } - } + xNode->setPropertyValue(s_sAutoDetectSystemHC, css::uno::makeAny(bSet)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + + bIsModified = sal_True; } } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } } -// ----------------------------------------------------------------------- -void SvtAccessibilityOptions_Impl::SetVCLSettings() +void SvtAccessibilityOptions_Impl::SetIsForPagePreviews(sal_Bool bSet) { - AllSettings aAllSettings = Application::GetSettings(); - HelpSettings aHelpSettings = aAllSettings.GetHelpSettings(); - aHelpSettings.SetTipTimeout( GetIsHelpTipsDisappear() ? GetHelpTipSeconds() * 1000 : HELP_TIP_TIMEOUT); - aAllSettings.SetHelpSettings(aHelpSettings); - if(aAllSettings.GetStyleSettings().GetUseSystemUIFonts() != GetIsSystemFont() ) + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + + try { - StyleSettings aStyleSettings = aAllSettings.GetStyleSettings(); - aStyleSettings.SetUseSystemUIFonts( GetIsSystemFont() ); - aAllSettings.SetStyleSettings(aStyleSettings); - Application::MergeSystemSettings( aAllSettings ); + if(xNode.is() && xNode->getPropertyValue(s_sIsForPagePreviews)!=bSet) + { + xNode->setPropertyValue(s_sIsForPagePreviews, css::uno::makeAny(bSet)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + + bIsModified = sal_True; + } + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); } +} - Application::SetSettings(aAllSettings); +void SvtAccessibilityOptions_Impl::SetIsHelpTipsDisappear(sal_Bool bSet) +{ + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + + try + { + if(xNode.is() && xNode->getPropertyValue(s_sIsHelpTipsDisappear)!=bSet) + { + xNode->setPropertyValue(s_sIsHelpTipsDisappear, css::uno::makeAny(bSet)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + + bIsModified = sal_True; + } + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } } -void SvtAccessibilityOptions_Impl::Commit() +void SvtAccessibilityOptions_Impl::SetIsAllowAnimatedGraphics(sal_Bool bSet) { - ClearModified(); - Sequence< OUString > aNames = GetPropertyNames(); - Sequence< Any > aValues( aNames.getLength() ); - Any* pValues = aValues.getArray(); - sal_Bool bTemp=false; - for ( int nProp = 0; nProp < aNames.getLength(); nProp++ ) + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + + try { - switch ( PropertyNameIndex(nProp) ) + if(xNode.is() && xNode->getPropertyValue(s_sIsAllowAnimatedGraphics)!=bSet) { - case PAGEPREVIEWS: bTemp = m_bForPagePreviews; break; - case HELPTIPSDISAPPEAR: bTemp = m_bHelpTipsDisappear; break; - case HELPTIPSECONDS: pValues[nProp] <<= m_nHelpTipSeconds; continue;//this is an integer and not a bool - case ALLOWANIMATEDGRAPHICS: bTemp = m_bAllowAnimatedGraphics; break; - case ALLOWANIMATEDTEXT: bTemp = m_bAllowAnimatedText; break; - case AUTOMATICFONTCOLOR: bTemp = m_bAutomaticFontColor; break; - case SYSTEMFONT: bTemp = m_bSystemFont; break; - case TEXTSELECTION: bTemp = m_bTextSelectionInReadonly; break; - case AUTODETECTSYSTEMHC: bTemp = m_bAutoDetectSystemHC; break; - default: - DBG_ERRORFILE( "invalid index to save a user token" ); + xNode->setPropertyValue(s_sIsAllowAnimatedGraphics, css::uno::makeAny(bSet)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + + bIsModified = sal_True; } - pValues[nProp] <<= bTemp; } - PutProperties( aNames, aValues ); + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtAccessibilityOptions_Impl::SetIsAllowAnimatedText(sal_Bool bSet) +{ + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + + try + { + if(xNode.is() && xNode->getPropertyValue(s_sIsAllowAnimatedText)!=bSet) + { + xNode->setPropertyValue(s_sIsAllowAnimatedText, css::uno::makeAny(bSet)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); - //notify SfxListener + bIsModified = sal_True; + } + } + catch(const css::uno::Exception& ex) { - SfxSimpleHint aHint = SfxSimpleHint( SFX_HINT_ACCESSIBILITY_CHANGED ); - Broadcast(aHint); - SetVCLSettings(); + LogHelper::logIt(ex); } } -// ----------------------------------------------------------------------- +void SvtAccessibilityOptions_Impl::SetIsAutomaticFontColor(sal_Bool bSet) +{ + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); -void SvtAccessibilityOptions_Impl::Notify( const Sequence<rtl::OUString>& ) + try + { + if(xNode.is() && xNode->getPropertyValue(s_sIsAutomaticFontColor)!=bSet) + { + xNode->setPropertyValue(s_sIsAutomaticFontColor, css::uno::makeAny(bSet)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + + bIsModified = sal_True; + } + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtAccessibilityOptions_Impl::SetIsSystemFont(sal_Bool bSet) { - Load(); + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + + try + { + if(xNode.is() && xNode->getPropertyValue(s_sIsSystemFont)!=bSet) + { + xNode->setPropertyValue(s_sIsSystemFont, css::uno::makeAny(bSet)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + + bIsModified = sal_True; + } + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } } -// ----------------------------------------------------------------------- +void SvtAccessibilityOptions_Impl::SetHelpTipSeconds(sal_Int16 nSet) +{ + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + + try + { + if(xNode.is() && xNode->getPropertyValue(s_sHelpTipSeconds)!=nSet) + { + xNode->setPropertyValue(s_sHelpTipSeconds, css::uno::makeAny(nSet)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); -sal_Bool SvtAccessibilityOptions_Impl::GetToken( BoolPtr pPtr ) const + bIsModified = sal_True; + } + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtAccessibilityOptions_Impl::SetSelectionInReadonly(sal_Bool bSet) { - return this->*pPtr; + css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY); + + try + { + if(xNode.is() && xNode->getPropertyValue(s_sIsSelectionInReadonly)!=bSet) + { + xNode->setPropertyValue(s_sIsSelectionInReadonly, css::uno::makeAny(bSet)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + + bIsModified = sal_True; + } + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } } -void SvtAccessibilityOptions_Impl::SetToken( BoolPtr pPtr, sal_Bool bSet ) +void SvtAccessibilityOptions_Impl::SetVCLSettings() { - if(this->*pPtr != bSet) + AllSettings aAllSettings = Application::GetSettings(); + HelpSettings aHelpSettings = aAllSettings.GetHelpSettings(); + aHelpSettings.SetTipTimeout( GetIsHelpTipsDisappear() ? GetHelpTipSeconds() * 1000 : HELP_TIP_TIMEOUT); + aAllSettings.SetHelpSettings(aHelpSettings); + if(aAllSettings.GetStyleSettings().GetUseSystemUIFonts() != GetIsSystemFont() ) { - this->*pPtr = bSet; - SetModified(); + StyleSettings aStyleSettings = aAllSettings.GetStyleSettings(); + aStyleSettings.SetUseSystemUIFonts( GetIsSystemFont() ); + aAllSettings.SetStyleSettings(aStyleSettings); + Application::MergeSystemSettings( aAllSettings ); } + + Application::SetSettings(aAllSettings); } // ----------------------------------------------------------------------- @@ -330,21 +521,21 @@ SvtAccessibilityOptions::SvtAccessibilityOptions() sm_pSingleImplConfig = new SvtAccessibilityOptions_Impl; ItemHolder2::holdConfigItem(E_ACCESSIBILITYOPTIONS); } - ++sm_nAccessibilityRefCount; + ++sm_nAccessibilityRefCount; } - StartListening( *sm_pSingleImplConfig, TRUE ); + //StartListening( *sm_pSingleImplConfig, TRUE ); } // ----------------------------------------------------------------------- SvtAccessibilityOptions::~SvtAccessibilityOptions() { - EndListening( *sm_pSingleImplConfig, TRUE ); + //EndListening( *sm_pSingleImplConfig, TRUE ); ::osl::MutexGuard aGuard( SingletonMutex::get() ); if( !--sm_nAccessibilityRefCount ) { - if( sm_pSingleImplConfig->IsModified() ) - sm_pSingleImplConfig->Commit(); + //if( sm_pSingleImplConfig->IsModified() ) + // sm_pSingleImplConfig->Commit(); DELETEZ( sm_pSingleImplConfig ); } } @@ -369,7 +560,7 @@ sal_Bool SvtAccessibilityOptions::IsModified() const } void SvtAccessibilityOptions::Commit() { - sm_pSingleImplConfig->Commit(); + //sm_pSingleImplConfig->Commit(); } // ----------------------------------------------------------------------- @@ -464,4 +655,3 @@ void SvtAccessibilityOptions::SetVCLSettings() sm_pSingleImplConfig->SetVCLSettings(); } // ----------------------------------------------------------------------- - diff --git a/svtools/source/config/apearcfg.cxx b/svtools/source/config/apearcfg.cxx index 390e240e9fa7..35a07a715dd5 100644 --- a/svtools/source/config/apearcfg.cxx +++ b/svtools/source/config/apearcfg.cxx @@ -80,7 +80,7 @@ SvtTabAppearanceCfg::SvtTabAppearanceCfg() const Sequence<OUString>& rNames = GetPropertyNames(); Sequence<Any> aValues = GetProperties(rNames); const Any* pValues = aValues.getConstArray(); - DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed") + DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed"); if(aValues.getLength() == rNames.getLength()) { diff --git a/svtools/source/config/cjkoptions.cxx b/svtools/source/config/cjkoptions.cxx index a7849ec1e206..66d70cd1e2a3 100644 --- a/svtools/source/config/cjkoptions.cxx +++ b/svtools/source/config/cjkoptions.cxx @@ -432,55 +432,55 @@ SvtCJKOptions::~SvtCJKOptions() // ----------------------------------------------------------------------- sal_Bool SvtCJKOptions::IsCJKFontEnabled() const { - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded") + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); return pCJKOptions->IsCJKFontEnabled(); } // ----------------------------------------------------------------------- sal_Bool SvtCJKOptions::IsVerticalTextEnabled() const { - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded") + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); return pCJKOptions->IsVerticalTextEnabled(); } // ----------------------------------------------------------------------- sal_Bool SvtCJKOptions::IsAsianTypographyEnabled() const { - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded") + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); return pCJKOptions->IsAsianTypographyEnabled(); } // ----------------------------------------------------------------------- sal_Bool SvtCJKOptions::IsJapaneseFindEnabled() const { - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded") + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); return pCJKOptions->IsJapaneseFindEnabled(); } // ----------------------------------------------------------------------- sal_Bool SvtCJKOptions::IsRubyEnabled() const { - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded") + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); return pCJKOptions->IsRubyEnabled(); } // ----------------------------------------------------------------------- sal_Bool SvtCJKOptions::IsChangeCaseMapEnabled() const { - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded") + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); return pCJKOptions->IsChangeCaseMapEnabled(); } // ----------------------------------------------------------------------- sal_Bool SvtCJKOptions::IsDoubleLinesEnabled() const { - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded") + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); return pCJKOptions->IsDoubleLinesEnabled(); } // ----------------------------------------------------------------------- sal_Bool SvtCJKOptions::IsEmphasisMarksEnabled() const { - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded") + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); return pCJKOptions->IsEmphasisMarksEnabled(); } // ----------------------------------------------------------------------- sal_Bool SvtCJKOptions::IsVerticalCallOutEnabled() const { - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded") + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); return pCJKOptions->IsVerticalCallOutEnabled(); } /*-- 20.04.01 14:32:04--------------------------------------------------- @@ -488,7 +488,7 @@ sal_Bool SvtCJKOptions::IsVerticalCallOutEnabled() const -----------------------------------------------------------------------*/ void SvtCJKOptions::SetAll(sal_Bool bSet) { - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded") + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); pCJKOptions->SetAll(bSet); } /*-- 20.04.01 14:32:06--------------------------------------------------- @@ -496,7 +496,7 @@ void SvtCJKOptions::SetAll(sal_Bool bSet) -----------------------------------------------------------------------*/ sal_Bool SvtCJKOptions::IsAnyEnabled() const { - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded") + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); return pCJKOptions->IsAnyEnabled(); } /*-- 13.02.2003 12:11--------------------------------------------------- @@ -504,7 +504,7 @@ sal_Bool SvtCJKOptions::IsAnyEnabled() const -----------------------------------------------------------------------*/ sal_Bool SvtCJKOptions::IsReadOnly(EOption eOption) const { - DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded") + DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded"); return pCJKOptions->IsReadOnly(eOption); } diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index 008526b43128..ca418de8cba9 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: colorcfg.cxx,v $ - * $Revision: 1.20 $ + * $Revision: 1.20.82.1 $ * * This file is part of OpenOffice.org. * @@ -186,7 +186,14 @@ uno::Sequence< OUString> ColorConfig_Impl::GetPropertyNames(const rtl::OUString& { RTL_CONSTASCII_USTRINGPARAM("/BASICString") , sal_False }, { RTL_CONSTASCII_USTRINGPARAM("/BASICOperator") , sal_False }, { RTL_CONSTASCII_USTRINGPARAM("/BASICKeyword") , sal_False }, - { RTL_CONSTASCII_USTRINGPARAM("/BASICError"), sal_False } + { RTL_CONSTASCII_USTRINGPARAM("/BASICError"), sal_False }, + { RTL_CONSTASCII_USTRINGPARAM("/SQLIdentifier"), sal_False }, + { RTL_CONSTASCII_USTRINGPARAM("/SQLNumber"), sal_False }, + { RTL_CONSTASCII_USTRINGPARAM("/SQLString"), sal_False }, + { RTL_CONSTASCII_USTRINGPARAM("/SQLOperator"), sal_False }, + { RTL_CONSTASCII_USTRINGPARAM("/SQLKeyword"), sal_False }, + { RTL_CONSTASCII_USTRINGPARAM("/SQLParameter"), sal_False }, + { RTL_CONSTASCII_USTRINGPARAM("/SQLComment"), sal_False } }; int nIndex = 0; OUString sColor = C2U(cColor); @@ -530,7 +537,7 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry) 0xc0c0c0, // WRITERFIELDSHADIN 0xc0c0c0, // WRITERIDXSHADINGS 0, // WRITERDIRECTCURSOR - COL_GREEN, //WRITERSCRIPTINDICATOR + COL_GREEN, //WRITERSCRIPTINDICATOR 0xc0c0c0, //WRITERSECTIONBOUNDARIES COL_BLUE, //WRITERPAGEBREAKS, COL_LIGHTBLUE, // HTMLSGML @@ -555,6 +562,13 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry) COL_BLUE, // BASICOPERATOR , COL_BLUE, // BASICKEYWORD , COL_RED, //BASICERROR + 0xF84E4E, // SQLIDENTIFIER + 0xCC66CC, // SQLNUMBER + 0x7CDB8C, // SQLSTRING + COL_BLACK, // SQLOPERATOR + 0x0000FF, // SQLKEYWORD + 0x259D9D, // SQLPARAMTER + COL_GRAY,// SQLCOMMENT }; Color aRet; switch(eEntry) diff --git a/svtools/source/config/ctloptions.cxx b/svtools/source/config/ctloptions.cxx index c636373bfddf..5d2bf131add1 100644 --- a/svtools/source/config/ctloptions.cxx +++ b/svtools/source/config/ctloptions.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ctloptions.cxx,v $ - * $Revision: 1.18 $ + * $Revision: 1.18.140.1 $ * * This file is part of OpenOffice.org. * @@ -39,7 +39,7 @@ #include <svtools/ctloptions.hxx> #include <svtools/languageoptions.hxx> -#include <i18npool/lang.h> +#include <i18npool/mslangid.hxx> #include <unotools/configitem.hxx> #include <tools/debug.hxx> #include <com/sun/star/uno/Any.h> @@ -317,10 +317,8 @@ void SvtCTLOptions_Impl::Load() sal_uInt16 nLanguage = Application::GetSettings().GetLanguage(); //enable sequence checking for the appropriate languages m_bCTLSequenceChecking = m_bCTLRestricted = m_bCTLTypeAndReplace = - ( LANGUAGE_KHMER == nLanguage || LANGUAGE_KHMER == eSystemLanguage || - LANGUAGE_THAI == nLanguage || LANGUAGE_THAI == eSystemLanguage || - LANGUAGE_VIETNAMESE == nLanguage || LANGUAGE_VIETNAMESE == eSystemLanguage || - LANGUAGE_LAO == nLanguage || LANGUAGE_LAO == eSystemLanguage ); + (MsLangId::needsSequenceChecking( nLanguage) || + MsLangId::needsSequenceChecking( eSystemLanguage)); Commit(); } m_bIsLoaded = sal_True; diff --git a/svtools/source/config/extcolorcfg.cxx b/svtools/source/config/extcolorcfg.cxx index bc37a06a59b4..61ae3d1d0ca0 100644 --- a/svtools/source/config/extcolorcfg.cxx +++ b/svtools/source/config/extcolorcfg.cxx @@ -343,9 +343,13 @@ void ExtendedColorConfig_Impl::Load(const rtl::OUString& rScheme) if ( !sScheme.equalsAscii("default") ) { - ::rtl::OUString sBaseDefault(RTL_CONSTASCII_USTRINGPARAM("ExtendedColorScheme/ColorSchemes/default")); - aComponentNames = GetPropertyNames(sBaseDefault); - FillComponentColors(aComponentNames,aDisplayNameMap); + ::rtl::OUString sDefault(RTL_CONSTASCII_USTRINGPARAM("default")); + if ( ExistsScheme(sDefault) ) + { + ::rtl::OUString sBaseDefault(RTL_CONSTASCII_USTRINGPARAM("ExtendedColorScheme/ColorSchemes/default")); + aComponentNames = GetPropertyNames(sBaseDefault); + FillComponentColors(aComponentNames,aDisplayNameMap); + } } // if ( !sScheme.equalsAscii("default") ) if ( !bFound && sScheme.getLength() ) { diff --git a/svtools/source/config/fltrcfg.cxx b/svtools/source/config/fltrcfg.cxx index 0958e9b01dad..056826bf62ba 100644 --- a/svtools/source/config/fltrcfg.cxx +++ b/svtools/source/config/fltrcfg.cxx @@ -378,7 +378,7 @@ void SvtFilterOptions::Load() const Sequence<OUString>& rNames = GetPropertyNames(); Sequence<Any> aValues = GetProperties(rNames); const Any* pValues = aValues.getConstArray(); - DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed") + DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed"); if(aValues.getLength() == rNames.getLength()) { for(int nProp = 0; nProp < rNames.getLength(); nProp++) diff --git a/svtools/source/config/historyoptions.cxx b/svtools/source/config/historyoptions.cxx index 11216e8cf1a5..d658f25d1a73 100644 --- a/svtools/source/config/historyoptions.cxx +++ b/svtools/source/config/historyoptions.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: historyoptions.cxx,v $ - * $Revision: 1.22 $ + * $Revision: 1.21.234.2 $ * * This file is part of OpenOffice.org. * @@ -34,10 +34,11 @@ #endif //_________________________________________________________________________________________________________________ -// includes +// includes //_________________________________________________________________________________________________________________ #include <svtools/historyoptions.hxx> +#include "configitems/historyoptions_const.hxx" #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> #include <tools/debug.hxx> @@ -55,59 +56,60 @@ #include <rtl/logfile.hxx> #include "itemholder1.hxx" -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::std ; -using namespace ::utl ; -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::beans ; +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif -#define ROOTNODE_HISTORY OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/History/" )) +#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ +#include <com/sun/star/container/XNameContainer.hpp> +#endif -#define DEFAULT_PICKLISTSIZE 4 -#define DEFAULT_HISTORYSIZE 10 -#define DEFAULT_HELPBOOKMARKSIZE 100 +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#endif -#define PATHDELIMITER OUString(RTL_CONSTASCII_USTRINGPARAM("/" )) +#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_ +#include <comphelper/configurationhelper.hxx> +#endif -#define PROPERTYNAME_PICKLISTSIZE OUString(RTL_CONSTASCII_USTRINGPARAM("PickListSize" )) -#define PROPERTYNAME_HISTORYSIZE OUString(RTL_CONSTASCII_USTRINGPARAM("Size" )) -#define PROPERTYNAME_HELPBOOKMARKSIZE OUString(RTL_CONSTASCII_USTRINGPARAM("HelpBookmarkSize" )) +#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_ +#include <unotools/processfactory.hxx> +#endif -#define PROPERTYNAME_PICKLIST OUString(RTL_CONSTASCII_USTRINGPARAM("PickList" )) -#define PROPERTYNAME_HISTORY OUString(RTL_CONSTASCII_USTRINGPARAM("List" )) -#define PROPERTYNAME_HELPBOOKMARKS OUString(RTL_CONSTASCII_USTRINGPARAM("HelpBookmarks" )) +#ifndef _SVT_LOGHELPER_HXX +#include "loghelper.hxx" +#endif -#define PROPERTYNAME_HISTORYITEM_URL HISTORY_PROPERTYNAME_URL -#define PROPERTYNAME_HISTORYITEM_FILTER HISTORY_PROPERTYNAME_FILTER -#define PROPERTYNAME_HISTORYITEM_TITLE HISTORY_PROPERTYNAME_TITLE -#define PROPERTYNAME_HISTORYITEM_PASSWORD HISTORY_PROPERTYNAME_PASSWORD +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ -#define OFFSET_URL 0 -#define OFFSET_FILTER 1 -#define OFFSET_TITLE 2 -#define OFFSET_PASSWORD 3 +using namespace ::std ; +using namespace ::utl ; +using namespace ::rtl ; +using namespace ::osl ; +using namespace ::com::sun::star::uno ; +using namespace ::com::sun::star::beans ; -#define PROPERTYHANDLE_PICKLISTSIZE 0 -#define PROPERTYHANDLE_HISTORYSIZE 1 -#define PROPERTYHANDLE_HELPBOOKMARKSIZE 2 +namespace css = ::com::sun::star; -#define FIXPROPERTYCOUNT 3 // counts PROPERYHANDLE_PICKLISTSIZE ... PROPERTYHANDLE_HELPBOOKMARKSIZE! +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ -#define FIXP OUString(RTL_CONSTASCII_USTRINGPARAM("p" )) -#define FIXH OUString(RTL_CONSTASCII_USTRINGPARAM("h" )) -#define FIXB OUString(RTL_CONSTASCII_USTRINGPARAM("b" )) +namespace { + static const ::sal_Int32 s_nOffsetURL = 0; + static const ::sal_Int32 s_nOffsetFilter = 1; + static const ::sal_Int32 s_nOffsetTitle = 2; + static const ::sal_Int32 s_nOffsetPassword = 3; +} //_________________________________________________________________________________________________________________ -// private declarations! +// private declarations! //_________________________________________________________________________________________________________________ struct IMPL_THistoryItem @@ -116,15 +118,15 @@ struct IMPL_THistoryItem { } - IMPL_THistoryItem( const OUString& sNewURL , - const OUString& sNewFilter , - const OUString& sNewTitle , - const OUString& sNewPassword ) + IMPL_THistoryItem( const OUString& sNewURL , + const OUString& sNewFilter , + const OUString& sNewTitle , + const OUString& sNewPassword ) { - sURL = sNewURL ; - sFilter = sNewFilter ; - sTitle = sNewTitle ; - sPassword = sNewPassword ; + sURL = sNewURL ; + sFilter = sNewFilter ; + sTitle = sNewTitle ; + sPassword = sNewPassword ; } sal_Bool operator==( const OUString& sSearchedURL ) @@ -132,294 +134,68 @@ struct IMPL_THistoryItem return( sURL == sSearchedURL ); } - OUString sURL ; - OUString sFilter ; - OUString sTitle ; - OUString sPassword ; + OUString sURL ; + OUString sFilter ; + OUString sTitle ; + OUString sPassword ; }; -class SvtHistoryOptions_Impl : public ConfigItem +//***************************************************************************************************************** +// class SvtHistoryOptions_Impl +// redesigned +//***************************************************************************************************************** +class SvtHistoryOptions_Impl { - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - SvtHistoryOptions_Impl(); - ~SvtHistoryOptions_Impl(); - - //--------------------------------------------------------------------------------------------------------- - // overloaded methods of baseclass - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short called for notify of configmanager - @descr These method is called from the ConfigManager before application ends or from the - PropertyChangeListener if the sub tree broadcasts changes. You must update your - internal values. - - @seealso baseclass ConfigItem - - @param "seqPropertyNames" is the list of properties which should be updated. - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Notify( const Sequence< OUString >& seqPropertyNames ); - - /*-****************************************************************************************************//** - @short write changes to configuration - @descr These method writes the changed values into the sub tree - and should always called in our destructor to guarantee consistency of config data. - - @seealso baseclass ConfigItem - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - virtual void Commit(); - - //--------------------------------------------------------------------------------------------------------- - // public interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short base implementation of public interface for "SvtHistoryOptions"! - @descr These class is used as static member of "SvtHistoryOptions" ... - => The code exist only for one time and isn't duplicated for every instance! - - @seealso - - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - sal_uInt32 GetSize ( EHistoryType eHistory ); - void SetSize ( EHistoryType eHistory , - sal_uInt32 nSize ); - void Clear ( EHistoryType eHistory ); - Sequence< Sequence< PropertyValue > > GetList ( EHistoryType eHistory ); - void AppendItem ( EHistoryType eHistory , - const OUString& sURL , - const OUString& sFilter , - const OUString& sTitle , - const OUString& sPassword ); - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return list of key names of ouer configuration management which represent oue module tree - @descr These methods return the current list of key names! We need it to get needed values from our - configuration management and support dynamical history lists! - - @seealso - - - @param - - @return A list of configuration key names is returned. - - @onerror - - *//*-*****************************************************************************************************/ - - Sequence< OUString > impl_GetPropertyNames( sal_uInt32& nPicklistCount , - sal_uInt32& nHistoryCount , - sal_uInt32& nHelpBookmarkCount ); - - /*-****************************************************************************************************//** - @short convert routine - @descr Intern we hold ouer values in a deque. Sometimes we need his content as a return sequence. - Then we must convert ouer internal format to extern. - That is the reason for these method! - - @seealso - - - @param "aList" list in deque format. - @return A list which right format is returned. - - @onerror - - *//*-*****************************************************************************************************/ - - Sequence< Sequence< PropertyValue > > impl_GetSequenceFromList( const deque< IMPL_THistoryItem >& aList ); - - /*-****************************************************************************************************//** - @short helper - @descr Some code is the same for different internal history list. So we can get a pointer as an access to - right internal member list by calling this method with right enum value. - Returned pointer can be used to implement some functionality on this list then. - By the way - we return max size of these list too ... - - @seealso using! - - @param "eType" describe, which list should be returned as pointer - @return A pointer to one of our internal member lists. - - @onerror We return NULL. - *//*-*****************************************************************************************************/ - - void impl_GetListInfo( EHistoryType eType , - deque< IMPL_THistoryItem >** ppList , - sal_uInt32** ppMaxSize ); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - deque< IMPL_THistoryItem > m_aPicklist ; - sal_uInt32 m_nPicklistSize ; - deque< IMPL_THistoryItem > m_aHistory ; - sal_uInt32 m_nHistorySize ; - deque< IMPL_THistoryItem > m_aHelpBookmarks ; - sal_uInt32 m_nHelpBookmarkSize ; +public: + SvtHistoryOptions_Impl(); + ~SvtHistoryOptions_Impl(); + + sal_uInt32 GetSize( EHistoryType eHistory ); + void SetSize( EHistoryType eHistory, sal_uInt32 nSize ); + void Clear( EHistoryType eHistory ); + Sequence< Sequence< PropertyValue > > GetList( EHistoryType eHistory ); + void AppendItem( EHistoryType eHistory , + const OUString& sURL , + const OUString& sFilter , + const OUString& sTitle , + const OUString& sPassword ); + +private:
+ void impl_truncateList (EHistoryType eHistory, sal_uInt32 nSize);
+ +private: + css::uno::Reference< css::container::XNameAccess > m_xCfg; + css::uno::Reference< css::container::XNameAccess > m_xCommonXCU; }; -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - //***************************************************************************************************************** // constructor //***************************************************************************************************************** SvtHistoryOptions_Impl::SvtHistoryOptions_Impl() - // Init baseclasses first - : ConfigItem ( ROOTNODE_HISTORY ) - // Init member then... { - // Use our list snapshot of configuration keys to get his values. - // See impl_GetPropertyNames() for further informations. - sal_uInt32 nPicklistCount = 0; - sal_uInt32 nHistoryCount = 0; - sal_uInt32 nHelpBookmarkCount = 0; - Sequence< OUString > seqNames = impl_GetPropertyNames ( nPicklistCount , - nHistoryCount , - nHelpBookmarkCount ); - Sequence< Any > seqValues = GetProperties ( seqNames ); - - // Safe impossible cases. - // We need values from ALL configuration keys. - // Follow assignment use order of values in relation to our list of key names! - DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtHistoryOptions_Impl::SvtHistoryOptions_Impl()\nI miss some values of configuration keys!\n" ); - - // Copy values from list in right order to ouer internal member. - // Attention: List for names and values have an internal construction pattern! - // zB: - // Name Value - // /Picklist/Size 2 - // /History/Size 3 - // /Picklist/List/1/URL "file://a" - // /Picklist/List/1/Filter "writer-..." - // /Picklist/List/1/Title "Test1" - // /Picklist/List/1/Password "lysemyf1" - // /Picklist/List/2/URL "file://b" - // /Picklist/List/2/Filter "calc-..." - // /Picklist/List/2/Title "Test2" - // /Picklist/List/2/Password "lysemyf2" - // /History/List/2/URL "http://blub" - // /History/List/2/Filter "html-..." - // /History/List/2/Title "blub" - // /History/List/2/Password "xxx" - // ... and so on ... - - // First we must read sizes of ouer history lists => the first to values. - // We need these informations to work correctly with follow keys! - seqValues[PROPERTYHANDLE_PICKLISTSIZE ] >>= m_nPicklistSize ; - seqValues[PROPERTYHANDLE_HISTORYSIZE ] >>= m_nHistorySize ; - seqValues[PROPERTYHANDLE_HELPBOOKMARKSIZE] >>= m_nHelpBookmarkSize ; - - // Safe impossible cases. - // I think a size of 0 isn't relay meaningful. - if( m_nPicklistSize < 1 ) + try { - m_nPicklistSize = DEFAULT_PICKLISTSIZE; - DBG_ASSERT( sal_False, "SvtHistoryOptions_Impl::SvtHistoryOptions_Impl()\nI think a picklist size of 0 isn't relay meaningful! Set new value to 4 entries.\n" ); + m_xCfg = Reference< css::container::XNameAccess > ( + ::comphelper::ConfigurationHelper::openConfig( + utl::getProcessServiceFactory(), + s_sHistories, + ::comphelper::ConfigurationHelper::E_STANDARD), + css::uno::UNO_QUERY ); + + m_xCommonXCU = Reference< css::container::XNameAccess > ( + ::comphelper::ConfigurationHelper::openConfig( + utl::getProcessServiceFactory(), + s_sCommonHistory, + ::comphelper::ConfigurationHelper::E_STANDARD), + css::uno::UNO_QUERY ); } - if( m_nHistorySize < 1 ) + catch(const css::uno::Exception& ex) { - m_nHistorySize = DEFAULT_HISTORYSIZE; - DBG_ASSERT( sal_False, "SvtHistoryOptions_Impl::SvtHistoryOptions_Impl()\nI think a history size of 0 isn't relay meaningful! Set new value to 10 entries.\n" ); - } - if( m_nHelpBookmarkSize < 1 ) - { - m_nHelpBookmarkSize = DEFAULT_HELPBOOKMARKSIZE; - DBG_ASSERT( sal_False, "SvtHistoryOptions_Impl::SvtHistoryOptions_Impl()\nI think a help bookmark size of 0 isn't relay meaningful! Set new value to 100 entries.\n" ); - } - - IMPL_THistoryItem aItem; - sal_uInt32 nPosition = FIXPROPERTYCOUNT; // step over first three readed size values! but count begins at 0! - // Get names/values for picklist. - // 4 subkeys for every item! - OUString sName; - sal_uInt32 nItem; - for( nItem=0; nItem<nPicklistCount; ++nItem ) - { - seqValues[nPosition] >>= aItem.sURL ; - ++nPosition; - seqValues[nPosition] >>= aItem.sFilter ; - ++nPosition; - seqValues[nPosition] >>= aItem.sTitle ; - ++nPosition; - seqValues[nPosition] >>= aItem.sPassword ; - ++nPosition; - m_aPicklist.push_back( aItem ); - } + m_xCfg.clear(); + m_xCommonXCU.clear(); - // Attention: Don't reset nPosition here! - - // Get names/values for picklist. - // 4 subkeys for every item! - for( nItem=0; nItem<nHistoryCount; ++nItem ) - { - seqValues[nPosition] >>= aItem.sURL ; - ++nPosition; - seqValues[nPosition] >>= aItem.sFilter ; - ++nPosition; - seqValues[nPosition] >>= aItem.sTitle ; - ++nPosition; - seqValues[nPosition] >>= aItem.sPassword ; - ++nPosition; - m_aHistory.push_back( aItem ); - } - - // Get names/values for help bookmarks. - // 4 subkeys for every item! - for( nItem=0; nItem<nHelpBookmarkCount; ++nItem ) - { - seqValues[nPosition] >>= aItem.sURL ; - ++nPosition; - seqValues[nPosition] >>= aItem.sFilter ; - ++nPosition; - seqValues[nPosition] >>= aItem.sTitle ; - ++nPosition; - seqValues[nPosition] >>= aItem.sPassword ; - ++nPosition; - m_aHelpBookmarks.push_back( aItem ); + LogHelper::logIt(ex); } - -/*TODO: Not used in the moment! see Notify() ... - // Enable notification mechanism of ouer baseclass. - // We need it to get information about changes outside these class on ouer used configuration keys! - Sequence< OUString > seqNotifications( seqNames ); - sal_Int32 nNotifyCount = seqNames.getLength(); - seqNotifications.realloc( nNotifyCount+PROPERTYCOUNT_LISTNODES ); - seqNotification[nNotifyCount ] = PROPERTYNAME_PICKLIST; - seqNotification[nNotifyCount+1] = PROPERTYNAME_HISTORY ; - EnableNotification( seqNotification ); -*/ } //***************************************************************************************************************** @@ -427,379 +203,441 @@ SvtHistoryOptions_Impl::SvtHistoryOptions_Impl() //***************************************************************************************************************** SvtHistoryOptions_Impl::~SvtHistoryOptions_Impl() { - // We must save our current values .. if user forget it! - if( IsModified() == sal_True ) - { - Commit(); - } } //***************************************************************************************************************** // public method +// Attention: We return the max. size of our internal lists - That is the capacity not the size! //***************************************************************************************************************** -void SvtHistoryOptions_Impl::Notify( const Sequence< OUString >& ) +sal_uInt32 SvtHistoryOptions_Impl::GetSize( EHistoryType eHistory ) { - DBG_ASSERT( sal_False, "SvtHistoryOptions_Impl::Notify()\nNot implemented yet! I don't know how I can handle a dynamical list of unknown properties ...\n" ); -} + sal_uInt32 nSize = 0 ; + css::uno::Reference< css::beans::XPropertySet > xListAccess(m_xCommonXCU, css::uno::UNO_QUERY); -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtHistoryOptions_Impl::Commit() -{ - // First write fix properties. - Sequence< OUString > seqFixPropertyNames ( FIXPROPERTYCOUNT ); - Sequence< Any > seqFixPropertyValues( FIXPROPERTYCOUNT ); - seqFixPropertyNames [PROPERTYHANDLE_PICKLISTSIZE ] = PROPERTYNAME_PICKLISTSIZE ; - seqFixPropertyNames [PROPERTYHANDLE_HISTORYSIZE ] = PROPERTYNAME_HISTORYSIZE ; - seqFixPropertyNames [PROPERTYHANDLE_HELPBOOKMARKSIZE] = PROPERTYNAME_HELPBOOKMARKSIZE ; - seqFixPropertyValues[PROPERTYHANDLE_PICKLISTSIZE ] <<= m_nPicklistSize ; - seqFixPropertyValues[PROPERTYHANDLE_HISTORYSIZE ] <<= m_nHistorySize ; - seqFixPropertyValues[PROPERTYHANDLE_HELPBOOKMARKSIZE] <<= m_nHelpBookmarkSize ; - PutProperties( seqFixPropertyNames, seqFixPropertyValues ); - - // Write set of dynamic properties then. - ClearNodeSet( PROPERTYNAME_PICKLIST ); - ClearNodeSet( PROPERTYNAME_HISTORY ); - ClearNodeSet( PROPERTYNAME_HELPBOOKMARKS ); - - IMPL_THistoryItem aItem ; - OUString sNode ; - Sequence< PropertyValue > seqPropertyValues( 4 ) ; - - // Copy picklist entries to save-list! - sal_uInt32 nPicklistCount = m_aPicklist.size(); - sal_uInt32 nItem; - for( nItem=0; nItem<nPicklistCount; ++nItem ) + try { - aItem = m_aPicklist[nItem]; - sNode = PROPERTYNAME_PICKLIST + PATHDELIMITER + FIXP + OUString::valueOf( (sal_Int32)nItem ) + PATHDELIMITER; - seqPropertyValues[OFFSET_URL ].Name = sNode + PROPERTYNAME_HISTORYITEM_URL ; - seqPropertyValues[OFFSET_FILTER ].Name = sNode + PROPERTYNAME_HISTORYITEM_FILTER ; - seqPropertyValues[OFFSET_TITLE ].Name = sNode + PROPERTYNAME_HISTORYITEM_TITLE ; - seqPropertyValues[OFFSET_PASSWORD ].Name = sNode + PROPERTYNAME_HISTORYITEM_PASSWORD ; - seqPropertyValues[OFFSET_URL ].Value <<= aItem.sURL ; - seqPropertyValues[OFFSET_FILTER ].Value <<= aItem.sFilter ; - seqPropertyValues[OFFSET_TITLE ].Value <<= aItem.sTitle ; - seqPropertyValues[OFFSET_PASSWORD ].Value <<= aItem.sPassword ; - - SetSetProperties( PROPERTYNAME_PICKLIST, seqPropertyValues ); - } + switch( eHistory ) + { + case ePICKLIST: + xListAccess->getPropertyValue(s_sPickListSize) >>= nSize; + break; - // Copy URL-list entries to save-list! - sal_uInt32 nHistoryCount = m_aHistory.size(); - for( nItem=0; nItem<nHistoryCount; ++nItem ) - { - aItem = m_aHistory[nItem]; - sNode = PROPERTYNAME_HISTORY + PATHDELIMITER + FIXH + OUString::valueOf( (sal_Int32)nItem ) + PATHDELIMITER; - seqPropertyValues[OFFSET_URL ].Name = sNode + PROPERTYNAME_HISTORYITEM_URL ; - seqPropertyValues[OFFSET_FILTER ].Name = sNode + PROPERTYNAME_HISTORYITEM_FILTER ; - seqPropertyValues[OFFSET_TITLE ].Name = sNode + PROPERTYNAME_HISTORYITEM_TITLE ; - seqPropertyValues[OFFSET_PASSWORD ].Name = sNode + PROPERTYNAME_HISTORYITEM_PASSWORD ; - seqPropertyValues[OFFSET_URL ].Value <<= aItem.sURL ; - seqPropertyValues[OFFSET_FILTER ].Value <<= aItem.sFilter ; - seqPropertyValues[OFFSET_TITLE ].Value <<= aItem.sTitle ; - seqPropertyValues[OFFSET_PASSWORD ].Value <<= aItem.sPassword ; - - SetSetProperties( PROPERTYNAME_HISTORY, seqPropertyValues ); - } + case eHISTORY: + xListAccess->getPropertyValue(s_sURLHistorySize) >>= nSize; + break; + + case eHELPBOOKMARKS: + xListAccess->getPropertyValue(s_sHelpBookmarksSize) >>= nSize; + break; - // Copy HelpBookmark-list entries to save-list! - sal_uInt32 nHelpBookmarkCount = m_aHelpBookmarks.size(); - for( nItem=0; nItem<nHelpBookmarkCount; ++nItem ) + default: + break; + } + } + catch(const css::uno::Exception& ex) { - aItem = m_aHelpBookmarks[nItem]; - sNode = PROPERTYNAME_HELPBOOKMARKS + PATHDELIMITER + FIXB + OUString::valueOf( (sal_Int32)nItem ) + PATHDELIMITER; - seqPropertyValues[OFFSET_URL ].Name = sNode + PROPERTYNAME_HISTORYITEM_URL ; - seqPropertyValues[OFFSET_FILTER ].Name = sNode + PROPERTYNAME_HISTORYITEM_FILTER ; - seqPropertyValues[OFFSET_TITLE ].Name = sNode + PROPERTYNAME_HISTORYITEM_TITLE ; - seqPropertyValues[OFFSET_PASSWORD ].Name = sNode + PROPERTYNAME_HISTORYITEM_PASSWORD ; - seqPropertyValues[OFFSET_URL ].Value <<= aItem.sURL ; - seqPropertyValues[OFFSET_FILTER ].Value <<= aItem.sFilter ; - seqPropertyValues[OFFSET_TITLE ].Value <<= aItem.sTitle ; - seqPropertyValues[OFFSET_PASSWORD ].Value <<= aItem.sPassword ; - - SetSetProperties( PROPERTYNAME_HELPBOOKMARKS, seqPropertyValues ); + LogHelper::logIt(ex); } + + return nSize; } //***************************************************************************************************************** // public method +// Attention: We return the max. size of our internal lists - That is the capacity not the size! //***************************************************************************************************************** -sal_uInt32 SvtHistoryOptions_Impl::GetSize( EHistoryType eHistory ) +void SvtHistoryOptions_Impl::SetSize( EHistoryType eHistory, sal_uInt32 nSize ) { - // Attention: We return the max. size of our internal lists - That is the capacity not the size! + css::uno::Reference< css::beans::XPropertySet > xListAccess(m_xCommonXCU, css::uno::UNO_QUERY);
+ if (! xListAccess.is ())
+ return; + + try + {
+ switch( eHistory ) + { + case ePICKLIST: + if(nSize!=GetSize(ePICKLIST)) + { + xListAccess->setPropertyValue(s_sPickListSize, css::uno::makeAny(nSize)); + ::comphelper::ConfigurationHelper::flush(m_xCommonXCU); + } + break; + + case eHISTORY: + if(nSize!=GetSize(eHISTORY)) + { + xListAccess->setPropertyValue(s_sURLHistorySize, css::uno::makeAny(nSize)); + ::comphelper::ConfigurationHelper::flush(m_xCommonXCU); + } + break; + + case eHELPBOOKMARKS: + if(nSize!=GetSize(eHELPBOOKMARKS)) + { + xListAccess->setPropertyValue(s_sHelpBookmarksSize, css::uno::makeAny(nSize)); + ::comphelper::ConfigurationHelper::flush(m_xCommonXCU); + } + break; - // Set default return value if method failed! - sal_uInt32 nSize = 0; - // Get size of searched history list. - switch( eHistory ) + default: + break; + } + + impl_truncateList (eHistory, nSize); + } + catch(const css::uno::Exception& ex) { - case ePICKLIST : nSize = m_nPicklistSize; - break; - case eHISTORY : nSize = m_nHistorySize; - break; - case eHELPBOOKMARKS : nSize = m_nHistorySize; - break; + LogHelper::logIt(ex); } - // Return result of operation. - return nSize; } - -//***************************************************************************************************************** -// public method +
//***************************************************************************************************************** -void SvtHistoryOptions_Impl::SetSize( EHistoryType eHistory, sal_uInt32 nSize ) +void SvtHistoryOptions_Impl::impl_truncateList ( EHistoryType eHistory, sal_uInt32 nSize )
{ - // Attention: We set the max. size of our internal lists - That is the capacity not the size! - // Set size of searched history list. - deque< IMPL_THistoryItem >* pList = NULL; - sal_uInt32* pMaxSize = NULL; - impl_GetListInfo( eHistory, &pList, &pMaxSize ); - - if( pList!=NULL && pMaxSize!=NULL ) + css::uno::Reference< css::container::XNameAccess > xList; + css::uno::Reference< css::container::XNameContainer > xItemList; + css::uno::Reference< css::container::XNameContainer > xOrderList; + css::uno::Reference< css::beans::XPropertySet > xSet; +
+ try { - // If to much items in current list ... + switch( eHistory ) + { + case ePICKLIST: + m_xCfg->getByName(s_sPickList) >>= xList; + break; + + case eHISTORY: + m_xCfg->getByName(s_sURLHistory) >>= xList; + break; + + case eHELPBOOKMARKS: + m_xCfg->getByName(s_sHelpBookmarks) >>= xList; + break; + + default: + break; + } + + // If too much items in current list ... // truncate the oldest items BEFORE you set the new one. - if( nSize<pList->size() ) + if ( ! xList.is())
+ return;
+ + xList->getByName(s_sOrderList) >>= xOrderList; + xList->getByName(s_sItemList) >>= xItemList;
+ + const sal_uInt32 nLength = xOrderList->getElementNames().getLength(); + if (nSize < nLength) { - sal_uInt32 nOldItemCount = pList->size()-nSize; - while( nOldItemCount>0 ) + for (sal_uInt32 i=nLength-1; i>=nSize; --i) { - pList->pop_back(); - --nOldItemCount; + ::rtl::OUString sTmp; + const ::rtl::OUString sRemove = ::rtl::OUString::valueOf((sal_Int32)i); + xOrderList->getByName(sRemove) >>= xSet; + xSet->getPropertyValue(s_sHistoryItemRef) >>= sTmp; + xItemList->removeByName(sTmp); + xOrderList->removeByName(sRemove); } + + ::comphelper::ConfigurationHelper::flush(m_xCfg); } - *pMaxSize = nSize; - Commit(); } -} + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +}
//***************************************************************************************************************** // public method +// Clear specified history list //***************************************************************************************************************** void SvtHistoryOptions_Impl::Clear( EHistoryType eHistory ) { - // Clear specified history list. - deque< IMPL_THistoryItem >* pList = NULL; - sal_uInt32* pMaxSize = NULL; - impl_GetListInfo( eHistory, &pList, &pMaxSize ); + css::uno::Reference< css::container::XNameAccess > xListAccess; + css::uno::Reference< css::container::XNameContainer > xNode; + Sequence< ::rtl::OUString > lOrders; - if( pList!=NULL && pMaxSize!=NULL ) + try { - pList->clear(); - Commit(); + switch( eHistory ) + { + case ePICKLIST: + { + m_xCfg->getByName(s_sPickList) >>= xListAccess; + break; + } + + case eHISTORY: + { + m_xCfg->getByName(s_sURLHistory) >>= xListAccess; + break; + } + + case eHELPBOOKMARKS: + { + m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess; + break; + } + + default: + break; + } + + if (xListAccess.is()) + { + // clear ItemList + xListAccess->getByName(s_sItemList) >>= xNode ; + lOrders = xNode->getElementNames(); + const sal_Int32 nLength = lOrders.getLength(); + for(sal_Int32 i=0; i<nLength; ++i) + xNode->removeByName(lOrders[i]); + + // clear OrderList + xListAccess->getByName(s_sOrderList) >>= xNode ; + lOrders = xNode->getElementNames(); + for(sal_Int32 j=0; j<nLength; ++j) + xNode->removeByName(lOrders[j]); + + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); } } //***************************************************************************************************************** // public method +// get a sequence list from the items //***************************************************************************************************************** Sequence< Sequence< PropertyValue > > SvtHistoryOptions_Impl::GetList( EHistoryType eHistory ) { - // Set default return value. - Sequence< Sequence< PropertyValue > > seqReturn; + impl_truncateList (eHistory, GetSize (eHistory));
+
+ Sequence< Sequence< PropertyValue > > seqReturn; // Set default return value. + Sequence< PropertyValue > seqProperties( 4 ); + Sequence< ::rtl::OUString > lOrders; + + css::uno::Reference< css::container::XNameAccess > xListAccess; + css::uno::Reference< css::container::XNameAccess > xItemList; + css::uno::Reference< css::container::XNameAccess > xOrderList; + css::uno::Reference< css::beans::XPropertySet > xSet; + + seqProperties[s_nOffsetURL ].Name = HISTORY_PROPERTYNAME_URL; + seqProperties[s_nOffsetFilter ].Name = HISTORY_PROPERTYNAME_FILTER; + seqProperties[s_nOffsetTitle ].Name = HISTORY_PROPERTYNAME_TITLE; + seqProperties[s_nOffsetPassword ].Name = HISTORY_PROPERTYNAME_PASSWORD; + + try + {
+ switch( eHistory ) + { + case ePICKLIST: + { + m_xCfg->getByName(s_sPickList) >>= xListAccess;
+ break; + } + + case eHISTORY: + { + m_xCfg->getByName(s_sURLHistory) >>= xListAccess; + break; + } - deque< IMPL_THistoryItem >* pList = NULL; - sal_uInt32* pMaxSize = NULL; - impl_GetListInfo( eHistory, &pList, &pMaxSize ); + case eHELPBOOKMARKS: + { + m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess; + break; + } - if( pList!=NULL && pMaxSize!=NULL ) - seqReturn = impl_GetSequenceFromList( *pList ); + default: + break; + } +
+ if (xListAccess.is()) + { + xListAccess->getByName(s_sItemList) >>= xItemList; + xListAccess->getByName(s_sOrderList) >>= xOrderList; + + const sal_Int32 nLength = xOrderList->getElementNames().getLength(); + Sequence< Sequence< PropertyValue > > aRet(nLength); + + for(sal_Int32 nItem=0; nItem<nLength; ++nItem) + { + ::rtl::OUString sUrl; + xOrderList->getByName(::rtl::OUString::valueOf(nItem)) >>= xSet; + xSet->getPropertyValue(s_sHistoryItemRef) >>= sUrl; + + xItemList->getByName(sUrl) >>= xSet; + seqProperties[s_nOffsetURL ].Value <<= sUrl; + xSet->getPropertyValue(s_sFilter) >>= seqProperties[s_nOffsetFilter ].Value; + xSet->getPropertyValue(s_sTitle) >>= seqProperties[s_nOffsetTitle ].Value; + xSet->getPropertyValue(s_sPassword) >>= seqProperties[s_nOffsetPassword ].Value; + aRet[nItem] = seqProperties; + } + seqReturn = aRet; + } + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } return seqReturn; } //***************************************************************************************************************** // public method +// implements a deque in XML //***************************************************************************************************************** -void SvtHistoryOptions_Impl::AppendItem( EHistoryType eHistory , - const OUString& sURL , - const OUString& sFilter , - const OUString& sTitle , - const OUString& sPassword ) +void SvtHistoryOptions_Impl::AppendItem( EHistoryType eHistory , + const OUString& sURL , + const OUString& sFilter , + const OUString& sTitle , + const OUString& sPassword ) { - // create new list item with given values - IMPL_THistoryItem aItem( sURL, sFilter, sTitle, sPassword ); - - // search for right internal list by given enum - deque< IMPL_THistoryItem >* pList = NULL; - sal_uInt32* pMaxSize = NULL; - impl_GetListInfo( eHistory, &pList, &pMaxSize ); + impl_truncateList (eHistory, GetSize (eHistory));
+
+ css::uno::Reference< css::container::XNameAccess > xListAccess; + sal_Int32 nMaxSize = 0; - // work on these list - if( pList!=NULL && pMaxSize!=NULL ) + switch(eHistory) { - deque< IMPL_THistoryItem >::iterator pItem = ::std::find( pList->begin(), pList->end(), sURL ); - if( pItem == pList->end() ) + case ePICKLIST: + { + m_xCfg->getByName(s_sPickList) >>= xListAccess; + nMaxSize = GetSize(ePICKLIST); + } + break; + case eHISTORY: { - // If current list full ... delete the oldest item. - if( pList->size() >= *pMaxSize ) - pList->pop_back(); - // Append new item to list. - pList->push_front( aItem ); - Commit(); + m_xCfg->getByName(s_sURLHistory) >>= xListAccess; + nMaxSize = GetSize(eHISTORY); } - else if (pItem != pList->begin()) + break; + case eHELPBOOKMARKS: { - IMPL_THistoryItem aTempItem = *pItem; - pList->erase(pItem); - pList->push_front(aTempItem); - Commit(); + m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess; + nMaxSize = GetSize(eHELPBOOKMARKS); } + break; + default: + break; } -} -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Sequence< OUString > SvtHistoryOptions_Impl::impl_GetPropertyNames( sal_uInt32& nPicklistCount , - sal_uInt32& nHistoryCount , - sal_uInt32& nHelpBookmarkCount ) -{ - /* TODO - Index basiert einf�gen !!! => p0 => 0 p1 => 1 ... - */ - - // First get ALL names of current existing list items in configuration! - Sequence< OUString > seqPicklistItems = GetNodeNames( PROPERTYNAME_PICKLIST ); - Sequence< OUString > seqHistoryItems = GetNodeNames( PROPERTYNAME_HISTORY ); - Sequence< OUString > seqHelpBookmarkItems = GetNodeNames( PROPERTYNAME_HELPBOOKMARKS ); - - // Get information about list counts ... - nPicklistCount = seqPicklistItems.getLength (); - nHistoryCount = seqHistoryItems.getLength (); - nHelpBookmarkCount = seqHelpBookmarkItems.getLength(); - // ... and create a property list with right size! (+2...see fix properties below!) - Sequence< OUString > seqProperties( FIXPROPERTYCOUNT + - (nPicklistCount *4) + - (nHistoryCount *4) + - (nHelpBookmarkCount*4) ); - - // Add names of fix properties to list. - seqProperties[PROPERTYHANDLE_PICKLISTSIZE ] = PROPERTYNAME_PICKLISTSIZE ; - seqProperties[PROPERTYHANDLE_HISTORYSIZE ] = PROPERTYNAME_HISTORYSIZE ; - seqProperties[PROPERTYHANDLE_HELPBOOKMARKSIZE] = PROPERTYNAME_HELPBOOKMARKSIZE ; - - sal_uInt32 nPosition = FIXPROPERTYCOUNT; // step over three fix properties for sizes! but count begins at 0! - // Add names for picklist to list. - // 4 subkeys for every item! - // nPosition is the start point of an history item, nItem an index into right list of node names! - sal_uInt32 nItem; - for( nItem=0; nItem<nPicklistCount; ++nItem ) - { - seqProperties[nPosition] = PROPERTYNAME_PICKLIST + PATHDELIMITER + seqPicklistItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_URL ; - ++nPosition; - seqProperties[nPosition] = PROPERTYNAME_PICKLIST + PATHDELIMITER + seqPicklistItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_FILTER ; - ++nPosition; - seqProperties[nPosition] = PROPERTYNAME_PICKLIST + PATHDELIMITER + seqPicklistItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_TITLE ; - ++nPosition; - seqProperties[nPosition] = PROPERTYNAME_PICKLIST + PATHDELIMITER + seqPicklistItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_PASSWORD ; - ++nPosition; - } + if (nMaxSize==0) + return; - // Attention: Don't reset nPosition here! + css::uno::Reference< css::container::XNameContainer > xItemList; + css::uno::Reference< css::container::XNameContainer > xOrderList; + css::uno::Reference< css::beans::XPropertySet > xSet; - // Add names for URL-list to list. - // 4 subkeys for every item! - // nPosition is the start point of an history item, nItem an index into right list of node names! - for( nItem=0; nItem<nHistoryCount; ++nItem ) + try { - seqProperties[nPosition] = PROPERTYNAME_HISTORY + PATHDELIMITER + seqHistoryItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_URL ; - ++nPosition; - seqProperties[nPosition] = PROPERTYNAME_HISTORY + PATHDELIMITER + seqHistoryItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_FILTER ; - ++nPosition; - seqProperties[nPosition] = PROPERTYNAME_HISTORY + PATHDELIMITER + seqHistoryItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_TITLE ; - ++nPosition; - seqProperties[nPosition] = PROPERTYNAME_HISTORY + PATHDELIMITER + seqHistoryItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_PASSWORD ; - ++nPosition; - } - - // Attention: Don't reset nPosition here! + xListAccess->getByName(s_sItemList) >>= xItemList; + xListAccess->getByName(s_sOrderList) >>= xOrderList; + sal_Int32 nLength = xOrderList->getElementNames().getLength(); - // Add names for HelpBookmark-list to list. - // 4 subkeys for every item! - // nPosition is the start point of an bokmark item, nItem an index into right list of node names! - for( nItem=0; nItem<nHelpBookmarkCount; ++nItem ) - { - seqProperties[nPosition] = PROPERTYNAME_HELPBOOKMARKS + PATHDELIMITER + seqHelpBookmarkItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_URL ; - ++nPosition; - seqProperties[nPosition] = PROPERTYNAME_HELPBOOKMARKS + PATHDELIMITER + seqHelpBookmarkItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_FILTER ; - ++nPosition; - seqProperties[nPosition] = PROPERTYNAME_HELPBOOKMARKS + PATHDELIMITER + seqHelpBookmarkItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_TITLE ; - ++nPosition; - seqProperties[nPosition] = PROPERTYNAME_HELPBOOKMARKS + PATHDELIMITER + seqHelpBookmarkItems[nItem] + PATHDELIMITER + PROPERTYNAME_HISTORYITEM_PASSWORD ; - ++nPosition; - } + // The item to be appended is already existing! + if (xItemList->hasByName(sURL)) + { + for (sal_Int32 i=0; i<nLength; ++i) + { + ::rtl::OUString sTmp; + xOrderList->getByName(::rtl::OUString::valueOf(i)) >>= xSet; + xSet->getPropertyValue(s_sHistoryItemRef) >>= sTmp; + + if(sURL == sTmp) + { + ::rtl::OUString sFind; + xOrderList->getByName( ::rtl::OUString::valueOf(i) ) >>= xSet; + xSet->getPropertyValue(s_sHistoryItemRef) >>= sFind; + for (sal_Int32 j=i-1; j>=0; --j) + { + css::uno::Reference< css::beans::XPropertySet > xPrevSet; + css::uno::Reference< css::beans::XPropertySet > xNextSet; + xOrderList->getByName( ::rtl::OUString::valueOf(j+1) ) >>= xPrevSet; + xOrderList->getByName( ::rtl::OUString::valueOf(j) ) >>= xNextSet; + + ::rtl::OUString sTemp; + xNextSet->getPropertyValue(s_sHistoryItemRef) >>= sTemp; + xPrevSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sTemp)); + } + xOrderList->getByName( ::rtl::OUString::valueOf((sal_Int32)0) ) >>= xSet; + xSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sFind)); + + ::comphelper::ConfigurationHelper::flush(m_xCfg); + break; + } + } + } - // Return result. - return seqProperties; -} + // The item to be appended is not existing! + else + { + css::uno::Reference< css::lang::XSingleServiceFactory > xFac; + css::uno::Reference< css::uno::XInterface > xInst; + css::uno::Reference< css::beans::XPropertySet > xPrevSet; + css::uno::Reference< css::beans::XPropertySet > xNextSet; -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Sequence< Sequence< PropertyValue > > SvtHistoryOptions_Impl::impl_GetSequenceFromList( const deque< IMPL_THistoryItem >& aList ) -{ - // Initialize return sequence with right size. - sal_uInt32 nCount = aList.size(); - Sequence< Sequence< PropertyValue > > seqResult( nCount ); - Sequence< PropertyValue > seqProperties( 4 ); - // Copy items from given to return list. - for( sal_uInt32 nItem=0; nItem<nCount; ++nItem ) - { - seqProperties[OFFSET_URL ].Name = HISTORY_PROPERTYNAME_URL ; - seqProperties[OFFSET_FILTER ].Name = HISTORY_PROPERTYNAME_FILTER ; - seqProperties[OFFSET_TITLE ].Name = HISTORY_PROPERTYNAME_TITLE ; - seqProperties[OFFSET_PASSWORD ].Name = HISTORY_PROPERTYNAME_PASSWORD ; - seqProperties[OFFSET_URL ].Value <<= aList[nItem].sURL ; - seqProperties[OFFSET_FILTER ].Value <<= aList[nItem].sFilter ; - seqProperties[OFFSET_TITLE ].Value <<= aList[nItem].sTitle ; - seqProperties[OFFSET_PASSWORD ].Value <<= aList[nItem].sPassword ; - seqResult[nItem] = seqProperties; + // Append new item to OrderList. + if ( nLength == nMaxSize ) + { + ::rtl::OUString sRemove; + xOrderList->getByName(::rtl::OUString::valueOf(nLength-1)) >>= xSet; + xSet->getPropertyValue(s_sHistoryItemRef) >>= sRemove; + xItemList->removeByName(sRemove); + } + if ( nLength != nMaxSize ) + { + xFac = css::uno::Reference< css::lang::XSingleServiceFactory >(xOrderList, css::uno::UNO_QUERY); + xInst = xFac->createInstance(); + ::rtl::OUString sPush = ::rtl::OUString::valueOf(nLength++); + xOrderList->insertByName(sPush, css::uno::makeAny(xInst)); + } + for (sal_Int32 j=nLength-1; j>0; --j) + { + xOrderList->getByName( ::rtl::OUString::valueOf(j) ) >>= xPrevSet; + xOrderList->getByName( ::rtl::OUString::valueOf(j-1) ) >>= xNextSet; + ::rtl::OUString sTemp; + xNextSet->getPropertyValue(s_sHistoryItemRef) >>= sTemp; + xPrevSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sTemp)); + } + xOrderList->getByName( ::rtl::OUString::valueOf((sal_Int32)0) ) >>= xSet; + xSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sURL)); + + // Append the item to ItemList. + xFac = css::uno::Reference< css::lang::XSingleServiceFactory >(xItemList, css::uno::UNO_QUERY); + xInst = xFac->createInstance(); + xItemList->insertByName(sURL, css::uno::makeAny(xInst)); + xSet = css::uno::Reference< css::beans::XPropertySet >(xInst, css::uno::UNO_QUERY); + xSet->setPropertyValue(s_sFilter, css::uno::makeAny(sFilter)); + xSet->setPropertyValue(s_sTitle, css::uno::makeAny(sTitle)); + xSet->setPropertyValue(s_sPassword, css::uno::makeAny(sPassword)); + + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } } - return seqResult; -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -void SvtHistoryOptions_Impl::impl_GetListInfo( EHistoryType eType , - deque< IMPL_THistoryItem >** ppList , - sal_uInt32** ppMaxSize ) -{ - *ppList = NULL ; - *ppMaxSize = NULL ; - switch( eType ) + catch(const css::uno::Exception& ex) { - case ePICKLIST : { - *ppList = &m_aPicklist ; - *ppMaxSize = &m_nPicklistSize; - } - break; - case eHISTORY : { - *ppList = &m_aHistory ; - *ppMaxSize = &m_nHistorySize; - } - break; - case eHELPBOOKMARKS : { - *ppList = &m_aHelpBookmarks ; - *ppMaxSize = &m_nHelpBookmarkSize; - } - break; + LogHelper::logIt(ex); } } //***************************************************************************************************************** -// initialize static member -// DON'T DO IT IN YOUR HEADER! -// see definition for further informations +// initialize static member +// DON'T DO IT IN YOUR HEADER! +// see definition for further informations //***************************************************************************************************************** -SvtHistoryOptions_Impl* SvtHistoryOptions::m_pDataContainer = NULL ; -sal_Int32 SvtHistoryOptions::m_nRefCount = 0 ; +SvtHistoryOptions_Impl* SvtHistoryOptions::m_pDataContainer = NULL ; +sal_Int32 SvtHistoryOptions::m_nRefCount = 0 ; //***************************************************************************************************************** -// constructor +// constructor //***************************************************************************************************************** SvtHistoryOptions::SvtHistoryOptions() { @@ -818,7 +656,7 @@ SvtHistoryOptions::SvtHistoryOptions() } //***************************************************************************************************************** -// destructor +// destructor //***************************************************************************************************************** SvtHistoryOptions::~SvtHistoryOptions() { @@ -836,7 +674,7 @@ SvtHistoryOptions::~SvtHistoryOptions() } //***************************************************************************************************************** -// public method +// public method //***************************************************************************************************************** sal_uInt32 SvtHistoryOptions::GetSize( EHistoryType eHistory ) const { @@ -845,7 +683,7 @@ sal_uInt32 SvtHistoryOptions::GetSize( EHistoryType eHistory ) const } //***************************************************************************************************************** -// public method +// public method //***************************************************************************************************************** void SvtHistoryOptions::SetSize( EHistoryType eHistory, sal_uInt32 nSize ) { @@ -854,7 +692,7 @@ void SvtHistoryOptions::SetSize( EHistoryType eHistory, sal_uInt32 nSize ) } //***************************************************************************************************************** -// public method +// public method //***************************************************************************************************************** void SvtHistoryOptions::Clear( EHistoryType eHistory ) { @@ -863,7 +701,7 @@ void SvtHistoryOptions::Clear( EHistoryType eHistory ) } //***************************************************************************************************************** -// public method +// public method //***************************************************************************************************************** Sequence< Sequence< PropertyValue > > SvtHistoryOptions::GetList( EHistoryType eHistory ) const { @@ -872,20 +710,20 @@ Sequence< Sequence< PropertyValue > > SvtHistoryOptions::GetList( EHistoryType e } //***************************************************************************************************************** -// public method +// public method //***************************************************************************************************************** -void SvtHistoryOptions::AppendItem( EHistoryType eHistory , - const OUString& sURL , - const OUString& sFilter , - const OUString& sTitle , - const OUString& sPassword ) +void SvtHistoryOptions::AppendItem( EHistoryType eHistory , + const OUString& sURL , + const OUString& sFilter , + const OUString& sTitle , + const OUString& sPassword ) { MutexGuard aGuard( GetOwnStaticMutex() ); m_pDataContainer->AppendItem( eHistory, sURL, sFilter, sTitle, sPassword ); } //***************************************************************************************************************** -// private method +// private method //***************************************************************************************************************** Mutex& SvtHistoryOptions::GetOwnStaticMutex() { diff --git a/svtools/source/config/itemholder1.cxx b/svtools/source/config/itemholder1.cxx index 8ff0c908f358..37a57259c807 100644 --- a/svtools/source/config/itemholder1.cxx +++ b/svtools/source/config/itemholder1.cxx @@ -57,7 +57,6 @@ #include <svtools/localisationoptions.hxx> #include <svtools/menuoptions.hxx> #include <svtools/moduleoptions.hxx> -#include <svtools/options3d.hxx> #include <svtools/pathoptions.hxx> #include <svtools/printwarningoptions.hxx> #include <regoptions.hxx> @@ -253,10 +252,6 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem) rItem.pItem = new SvtOptionsDialogOptions(); break; - case E_OPTIONS3D : - rItem.pItem = new SvtOptions3D(); - break; - case E_PATHOPTIONS : rItem.pItem = new SvtPathOptions(); break; diff --git a/svtools/source/config/itemholderbase.hxx b/svtools/source/config/itemholderbase.hxx index 0fe261be680a..b5c1dd5d57d0 100644 --- a/svtools/source/config/itemholderbase.hxx +++ b/svtools/source/config/itemholderbase.hxx @@ -88,7 +88,6 @@ enum EItem E_MODULEOPTIONS , // E_OPTIONSDLGOPTIONS , // - E_OPTIONS3D , // E_PATHOPTIONS , // E_PRINTOPTIONS , // 2 diff --git a/svtools/source/config/lingucfg.cxx b/svtools/source/config/lingucfg.cxx index b09331af1348..263ced16cd50 100644 --- a/svtools/source/config/lingucfg.cxx +++ b/svtools/source/config/lingucfg.cxx @@ -148,7 +148,6 @@ SvtLinguOptions::SvtLinguOptions() nDefaultLanguage_CTL = LANGUAGE_NONE; // general options - bIsGermanPreReform = FALSE; bIsUseDictionaryList = bIsIgnoreControlCharacters = TRUE; @@ -156,8 +155,6 @@ SvtLinguOptions::SvtLinguOptions() bIsSpellCapitalization = bIsSpellSpecial = TRUE; bIsSpellAuto = - bIsSpellInAllLanguages = - bIsSpellHideMarkings = bIsSpellReverse = bIsSpellWithDigits = bIsSpellUpperCase = FALSE; @@ -284,7 +281,6 @@ static struct NamesToHdl {/* 1 */ "General/DictionaryList/ActiveDictionaries", UPN_ACTIVE_DICTIONARIES, UPH_ACTIVE_DICTIONARIES}, {/* 2 */ "General/DictionaryList/IsUseDictionaryList", UPN_IS_USE_DICTIONARY_LIST, UPH_IS_USE_DICTIONARY_LIST}, {/* 3 */ "General/IsIgnoreControlCharacters", UPN_IS_IGNORE_CONTROL_CHARACTERS, UPH_IS_IGNORE_CONTROL_CHARACTERS}, -{/* 4 */ "General/IsGermanPreReform", UPN_IS_GERMAN_PRE_REFORM, UPH_IS_GERMAN_PRE_REFORM}, {/* 5 */ "General/DefaultLocale_CJK", UPN_DEFAULT_LOCALE_CJK, UPH_DEFAULT_LOCALE_CJK}, {/* 6 */ "General/DefaultLocale_CTL", UPN_DEFAULT_LOCALE_CTL, UPH_DEFAULT_LOCALE_CTL}, @@ -293,8 +289,6 @@ static struct NamesToHdl {/* 9 */ "SpellChecking/IsSpellCapitalization", UPN_IS_SPELL_CAPITALIZATION, UPH_IS_SPELL_CAPITALIZATION}, {/* 10 */ "SpellChecking/IsSpellAuto", UPN_IS_SPELL_AUTO, UPH_IS_SPELL_AUTO}, {/* 11 */ "SpellChecking/IsSpellSpecial", UPN_IS_SPELL_SPECIAL, UPH_IS_SPELL_SPECIAL}, -{/* 12 */ "SpellChecking/IsSpellInAllLocales", UPN_IS_SPELL_IN_ALL_LANGUAGES, UPH_IS_SPELL_IN_ALL_LANGUAGES}, -{/* 13 */ "SpellChecking/IsHideMarkings", UPN_IS_SPELL_HIDE, UPH_IS_SPELL_HIDE}, {/* 14 */ "SpellChecking/IsReverseDirection", UPN_IS_WRAP_REVERSE, UPH_IS_WRAP_REVERSE}, {/* 15 */ "Hyphenation/MinLeading", UPN_HYPH_MIN_LEADING, UPH_HYPH_MIN_LEADING}, @@ -408,14 +402,11 @@ uno::Any SvtLinguConfigItem::GetProperty( INT32 nPropertyHandle ) const const SvtLinguOptions &rOpt = const_cast< SvtLinguConfigItem * >(this)->aOpt; switch (nPropertyHandle) { - case UPH_IS_GERMAN_PRE_REFORM : pbVal = &rOpt.bIsGermanPreReform; break; case UPH_IS_USE_DICTIONARY_LIST : pbVal = &rOpt.bIsUseDictionaryList; break; case UPH_IS_IGNORE_CONTROL_CHARACTERS : pbVal = &rOpt.bIsIgnoreControlCharacters; break; case UPH_IS_HYPH_AUTO : pbVal = &rOpt.bIsHyphAuto; break; case UPH_IS_HYPH_SPECIAL : pbVal = &rOpt.bIsHyphSpecial; break; case UPH_IS_SPELL_AUTO : pbVal = &rOpt.bIsSpellAuto; break; - case UPH_IS_SPELL_HIDE : pbVal = &rOpt.bIsSpellHideMarkings; break; - case UPH_IS_SPELL_IN_ALL_LANGUAGES :pbVal = &rOpt.bIsSpellInAllLanguages; break; case UPH_IS_SPELL_SPECIAL : pbVal = &rOpt.bIsSpellSpecial; break; case UPH_IS_WRAP_REVERSE : pbVal = &rOpt.bIsSpellReverse; break; case UPH_DEFAULT_LANGUAGE : pnVal = &rOpt.nDefaultLanguage; break; @@ -467,7 +458,7 @@ uno::Any SvtLinguConfigItem::GetProperty( INT32 nPropertyHandle ) const case UPH_IS_GRAMMAR_AUTO: pbVal = &rOpt.bIsGrammarAuto; break; case UPH_IS_GRAMMAR_INTERACTIVE: pbVal = &rOpt.bIsGrammarInteractive; break; default : - DBG_ERROR( "unexpected property handle" ); + DBG_ASSERT( 0, "unexpected property handle" ); } if (pbVal) @@ -510,14 +501,11 @@ BOOL SvtLinguConfigItem::SetProperty( INT32 nPropertyHandle, const uno::Any &rVa SvtLinguOptions &rOpt = aOpt; switch (nPropertyHandle) { - case UPH_IS_GERMAN_PRE_REFORM : pbVal = &rOpt.bIsGermanPreReform; break; case UPH_IS_USE_DICTIONARY_LIST : pbVal = &rOpt.bIsUseDictionaryList; break; case UPH_IS_IGNORE_CONTROL_CHARACTERS : pbVal = &rOpt.bIsIgnoreControlCharacters; break; case UPH_IS_HYPH_AUTO : pbVal = &rOpt.bIsHyphAuto; break; case UPH_IS_HYPH_SPECIAL : pbVal = &rOpt.bIsHyphSpecial; break; case UPH_IS_SPELL_AUTO : pbVal = &rOpt.bIsSpellAuto; break; - case UPH_IS_SPELL_HIDE : pbVal = &rOpt.bIsSpellHideMarkings; break; - case UPH_IS_SPELL_IN_ALL_LANGUAGES :pbVal = &rOpt.bIsSpellInAllLanguages; break; case UPH_IS_SPELL_SPECIAL : pbVal = &rOpt.bIsSpellSpecial; break; case UPH_IS_WRAP_REVERSE : pbVal = &rOpt.bIsSpellReverse; break; case UPH_DEFAULT_LANGUAGE : pnVal = &rOpt.nDefaultLanguage; break; @@ -571,7 +559,7 @@ BOOL SvtLinguConfigItem::SetProperty( INT32 nPropertyHandle, const uno::Any &rVa case UPH_IS_GRAMMAR_AUTO: pbVal = &rOpt.bIsGrammarAuto; break; case UPH_IS_GRAMMAR_INTERACTIVE: pbVal = &rOpt.bIsGrammarInteractive; break; default : - DBG_ERROR( "unexpected property handle" ); + DBG_ASSERT( 0, "unexpected property handle" ); } if (pbVal) @@ -673,8 +661,6 @@ BOOL SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProperyN { rOpt.bROIsUseDictionaryList = pROStates[i]; rVal >>= rOpt.bIsUseDictionaryList; } break; case UPH_IS_IGNORE_CONTROL_CHARACTERS : { rOpt.bROIsIgnoreControlCharacters = pROStates[i]; rVal >>= rOpt.bIsIgnoreControlCharacters; } break; - case UPH_IS_GERMAN_PRE_REFORM : - { rOpt.bROIsGermanPreReform = pROStates[i]; rVal >>= rOpt.bIsGermanPreReform; } break; case UPH_DEFAULT_LOCALE_CJK : { rOpt.bRODefaultLanguage_CJK = pROStates[i]; lcl_CfgAnyToLanguage( rVal, rOpt.nDefaultLanguage_CJK ); } break; case UPH_DEFAULT_LOCALE_CTL : @@ -690,10 +676,6 @@ BOOL SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProperyN { rOpt.bROIsSpellAuto = pROStates[i]; rVal >>= rOpt.bIsSpellAuto; } break; case UPH_IS_SPELL_SPECIAL : { rOpt.bROIsSpellSpecial = pROStates[i]; rVal >>= rOpt.bIsSpellSpecial; } break; - case UPH_IS_SPELL_IN_ALL_LANGUAGES : - { rOpt.bROIsSpellInAllLanguages = pROStates[i]; rVal >>= rOpt.bIsSpellInAllLanguages; } break; - case UPH_IS_SPELL_HIDE : - { rOpt.bROIsSpellHideMarkings = pROStates[i]; rVal >>= rOpt.bIsSpellHideMarkings; } break; case UPH_IS_WRAP_REVERSE : { rOpt.bROIsSpellReverse = pROStates[i]; rVal >>= rOpt.bIsSpellReverse; } break; @@ -754,7 +736,7 @@ BOOL SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProperyN break; default: - DBG_ERROR( "unexpected case" ); + DBG_ASSERT( 0, "unexpected case" ); } } @@ -791,7 +773,6 @@ BOOL SvtLinguConfigItem::SaveOptions( const uno::Sequence< OUString > &rProperyN *pValue++ = uno::makeAny( rOpt.aActiveDics ); // 1 pValue++->setValue( &rOpt.bIsUseDictionaryList, rBOOL ); // 2 pValue++->setValue( &rOpt.bIsIgnoreControlCharacters, rBOOL ); // 3 - pValue++->setValue( &rOpt.bIsGermanPreReform, rBOOL ); // 4 aTmp = lcl_LanguageToCfgLocaleStr( rOpt.nDefaultLanguage_CJK ); *pValue++ = uno::makeAny( aTmp ); // 5 aTmp = lcl_LanguageToCfgLocaleStr( rOpt.nDefaultLanguage_CTL ); @@ -802,8 +783,6 @@ BOOL SvtLinguConfigItem::SaveOptions( const uno::Sequence< OUString > &rProperyN pValue++->setValue( &rOpt.bIsSpellCapitalization, rBOOL ); // 9 pValue++->setValue( &rOpt.bIsSpellAuto, rBOOL ); // 10 pValue++->setValue( &rOpt.bIsSpellSpecial, rBOOL ); // 11 - pValue++->setValue( &rOpt.bIsSpellInAllLanguages, rBOOL ); // 12 - pValue++->setValue( &rOpt.bIsSpellHideMarkings, rBOOL ); // 13 pValue++->setValue( &rOpt.bIsSpellReverse, rBOOL ); // 14 pValue++->setValue( &rOpt.nHyphMinLeading, rINT16 ); // 15 @@ -857,14 +836,11 @@ BOOL SvtLinguConfigItem::IsReadOnly( INT32 nPropertyHandle ) const const SvtLinguOptions &rOpt = const_cast< SvtLinguConfigItem * >(this)->aOpt; switch(nPropertyHandle) { - case UPH_IS_GERMAN_PRE_REFORM : bReadOnly = rOpt.bROIsGermanPreReform ; break; case UPH_IS_USE_DICTIONARY_LIST : bReadOnly = rOpt.bROIsUseDictionaryList ; break; case UPH_IS_IGNORE_CONTROL_CHARACTERS : bReadOnly = rOpt.bROIsIgnoreControlCharacters; break; case UPH_IS_HYPH_AUTO : bReadOnly = rOpt.bROIsHyphAuto ; break; case UPH_IS_HYPH_SPECIAL : bReadOnly = rOpt.bROIsHyphSpecial ; break; case UPH_IS_SPELL_AUTO : bReadOnly = rOpt.bROIsSpellAuto ; break; - case UPH_IS_SPELL_HIDE : bReadOnly = rOpt.bROIsSpellHideMarkings ; break; - case UPH_IS_SPELL_IN_ALL_LANGUAGES : bReadOnly = rOpt.bROIsSpellInAllLanguages ; break; case UPH_IS_SPELL_SPECIAL : bReadOnly = rOpt.bROIsSpellSpecial ; break; case UPH_IS_WRAP_REVERSE : bReadOnly = rOpt.bROIsSpellReverse ; break; case UPH_DEFAULT_LANGUAGE : bReadOnly = rOpt.bRODefaultLanguage ; break; @@ -891,7 +867,7 @@ BOOL SvtLinguConfigItem::IsReadOnly( INT32 nPropertyHandle ) const case UPH_IS_GRAMMAR_AUTO: bReadOnly = rOpt.bROIsGrammarAuto; break; case UPH_IS_GRAMMAR_INTERACTIVE: bReadOnly = rOpt.bROIsGrammarInteractive; break; default : - DBG_ERROR( "unexpected property handle" ); + DBG_ASSERT( 0, "unexpected property handle" ); } return bReadOnly; } @@ -1106,7 +1082,7 @@ void SvtLinguConfig::SetOrCreateSupportedDictionaryFormatsFor( static uno::WeakReference< util::XMacroExpander > aG_xMacroExpander; -static uno::Reference< util::XMacroExpander > GetMacroExpander() +static uno::Reference< util::XMacroExpander > lcl_GetMacroExpander() { uno::Reference< util::XMacroExpander > xMacroExpander( aG_xMacroExpander ); if ( !xMacroExpander.is() ) @@ -1132,6 +1108,45 @@ static uno::Reference< util::XMacroExpander > GetMacroExpander() } +static bool lcl_GetFileUrlFromOrigin( + OUString /*out*/ &rFileUrl, + const OUString &rOrigin, + uno::Reference< util::XMacroExpander > &rxMacroExpander ) +{ + bool bSuccess = false; + if (rOrigin.getLength() > 0 && rxMacroExpander.is()) + { + rtl::OUString aURL( rOrigin ); + if (( aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( EXPAND_PROTOCOL )) == 0 ) && + rxMacroExpander.is() ) + { + // cut protocol + OUString aMacro( aURL.copy( sizeof ( EXPAND_PROTOCOL ) -1 ) ); + // decode uric class chars + aMacro = Uri::decode( aMacro, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); + // expand macro string + aURL = rxMacroExpander->expandMacros( aMacro ); + + bool bIsFileUrl = aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( FILE_PROTOCOL )) == 0; + if (bIsFileUrl) + { + rFileUrl = aURL; + bSuccess = true; + } + else + { + DBG_ASSERT( bIsFileUrl, "not a file URL"); + } + } + else + { + DBG_ASSERT( 0, "failed to get file URL" ); + } + } + return bSuccess; +} + + BOOL SvtLinguConfig::GetDictionaryEntry( const rtl::OUString &rNodeName, SvtLinguConfigDictionaryEntry &rDicEntry ) const @@ -1161,34 +1176,12 @@ BOOL SvtLinguConfig::GetDictionaryEntry( if (bSuccess) { // get file URL's for the locations - uno::Reference< util::XMacroExpander > xMacroExpander( GetMacroExpander() ); + uno::Reference< util::XMacroExpander > xMacroExpander( lcl_GetMacroExpander() ); for (sal_Int32 i = 0; i < aLocations.getLength(); ++i) { - rtl::OUString aURL( aLocations[i] ); - if (( aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( EXPAND_PROTOCOL )) == 0 ) && - xMacroExpander.is() ) - { - // cut protocol - OUString aMacro( aURL.copy( sizeof ( EXPAND_PROTOCOL ) -1 ) ); - // decode uric class chars - aMacro = Uri::decode( aMacro, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); - // expand macro string - aURL = xMacroExpander->expandMacros( aMacro ); - - bool bIsFileUrl = aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( FILE_PROTOCOL )) == 0; - if (!bIsFileUrl) - { - bSuccess = false; - DBG_ASSERT( bIsFileUrl, "not a file URL"); - } - - aLocations[i] = aURL; - } - else - { + rtl::OUString &rLocation = aLocations[i]; + if (!lcl_GetFileUrlFromOrigin( rLocation, rLocation, xMacroExpander )) bSuccess = false; - DBG_ERROR( "failed to get file URL" ); - } } // if everything was fine return the result @@ -1324,16 +1317,6 @@ std::vector< SvtLinguConfigDictionaryEntry > SvtLinguConfig::GetActiveDictionari { } -#if OSL_DEBUG_LEVEL > 1 - { - // just for testing... - LanguageType nLang = LANGUAGE_GERMAN; - HasAnySpellAndGrammarDialogImage(); - HasAnySpellAndGrammarContextImage(); - GetSpellAndGrammarDialogImage( nLang ); - GetSpellAndGrammarContextImage( nLang ); - } -#endif return aRes; } @@ -1374,121 +1357,127 @@ uno::Reference< util::XChangesBatch > SvtLinguConfig::GetMainUpdateAccess() cons return m_xMainUpdateAccess; } -rtl::OUString SvtLinguConfig::GetSpellAndGrammarDialogImage( LanguageType nLang ) const -{ - rtl::OUString aRes; - rtl::OUString aLangIsoName( lcl_LanguageToCfgLocaleStr( nLang ) ); +rtl::OUString SvtLinguConfig::GetVendorImageUrl_Impl( + const rtl::OUString &rServiceImplName, + const rtl::OUString &rImageName ) const +{ + rtl::OUString aRes; try { - uno::Reference< container::XNameAccess > xBitmapsNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xBitmapsNA.set( xBitmapsNA->getByName( A2OU("Bitmaps") ), uno::UNO_QUERY_THROW ); - - uno::Reference< container::XNameAccess > xNA( xBitmapsNA->getByName( A2OU("SpellAndGrammarDialog") ), uno::UNO_QUERY_THROW ); - uno::Any aAny( xNA->getByName( aLangIsoName ) ); - rtl::OUString aVendorImplName; - if (aAny >>= aVendorImplName) + uno::Reference< container::XNameAccess > xImagesNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); + xImagesNA.set( xImagesNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW ); + + uno::Reference< container::XNameAccess > xNA( xImagesNA->getByName( A2OU("ServiceNameEntries") ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( rServiceImplName ), uno::UNO_QUERY_THROW ); + uno::Any aAny( xNA->getByName( A2OU("VendorImagesNode") ) ); + rtl::OUString aVendorImagesNode; + if (aAny >>= aVendorImagesNode) { - xNA = xBitmapsNA; + xNA = xImagesNA; xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( aVendorImplName ), uno::UNO_QUERY_THROW ); - aAny = xNA->getByName( A2OU("SpellAndGrammarDialogImage") ); + xNA.set( xNA->getByName( aVendorImagesNode ), uno::UNO_QUERY_THROW ); + aAny = xNA->getByName( rImageName ); rtl::OUString aTmp; if (aAny >>= aTmp) { - aRes = aTmp; + uno::Reference< util::XMacroExpander > xMacroExpander( lcl_GetMacroExpander() ); + if (lcl_GetFileUrlFromOrigin( aTmp, aTmp, xMacroExpander )) + aRes = aTmp; } } } catch (uno::Exception &) { - DBG_ASSERT( 0, "exception caught. GetSpellAndGrammarDialogImage failed" ); + DBG_ASSERT( 0, "exception caught. GetVendorImageUrl_Impl failed" ); } - return aRes; } -rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextImage( LanguageType nLang ) const +rtl::OUString SvtLinguConfig::GetSpellAndGrammarDialogImage( + const rtl::OUString &rServiceImplName, + bool bHighContrast ) const { rtl::OUString aRes; + if (rServiceImplName.getLength() > 0) + { + rtl::OUString aImageName( A2OU( bHighContrast ? "SpellAndGrammarDialogImage_HC" : "SpellAndGrammarDialogImage" )); + rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); + aRes = aPath; + } + return aRes; +} - rtl::OUString aLangIsoName( lcl_LanguageToCfgLocaleStr( nLang ) ); - try + +rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextSuggestionImage( + const rtl::OUString &rServiceImplName, + bool bHighContrast ) const +{ + rtl::OUString aRes; + if (rServiceImplName.getLength() > 0) { - (void) aLangIsoName; + rtl::OUString aImageName( A2OU( bHighContrast ? "SpellAndGrammarContextMenuSuggestionImage_HC" : "SpellAndGrammarContextMenuSuggestionImage" )); + rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); + aRes = aPath; } - catch (uno::Exception &) + return aRes; +} + + +rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextDictionaryImage( + const rtl::OUString &rServiceImplName, + bool bHighContrast ) const +{ + rtl::OUString aRes; + if (rServiceImplName.getLength() > 0) { - DBG_ASSERT( 0, "exception caught. GetSpellAndGrammarContextImage failed" ); + rtl::OUString aImageName( A2OU( bHighContrast ? "SpellAndGrammarContextMenuDictionaryImage_HC" : "SpellAndGrammarContextMenuDictionaryImage" )); + rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); + aRes = aPath; } return aRes; } -bool SvtLinguConfig::HasAnySpellAndGrammarDialogImage() const +bool SvtLinguConfig::HasAnyVendorImages() const { bool bRes = false; try { uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("Bitmaps") ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("SpellAndGrammarDialog") ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW ); uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() ); bRes = aElementNames.getLength() > 0; } catch (uno::Exception &) { - DBG_ASSERT( 0, "exception caught. HasAnySpellAndGrammarDialogImage failed" ); + DBG_ASSERT( 0, "exception caught. HasAnyVendorImages failed" ); } return bRes; } -bool SvtLinguConfig::HasAnySpellAndGrammarContextImage() const +bool SvtLinguConfig::HasGrammarChecker() const { bool bRes = false; + try { uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("Bitmaps") ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("SpellAndGrammarContextMenu") ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("GrammarCheckerList") ), uno::UNO_QUERY_THROW ); uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() ); bRes = aElementNames.getLength() > 0; } catch (uno::Exception &) { - DBG_ASSERT( 0, "exception caught. HasAnySpellAndGrammarContextImage failed" ); } - return bRes; -} - -bool SvtLinguConfig::HasGrammarChecker() const -{ - static bool bGrammarCheckerChecked = false; - static bool bFound = false; - - if (!bGrammarCheckerChecked) - { - try - { - uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("GrammarCheckerList") ), uno::UNO_QUERY_THROW ); - - uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() ); - bFound = aElementNames.getLength() > 0; - } - catch (uno::Exception &) - { - } - bGrammarCheckerChecked = true; - } - - return bFound; + return bRes; } ////////////////////////////////////////////////////////////////////// diff --git a/svtools/source/config/loghelper.hxx b/svtools/source/config/loghelper.hxx new file mode 100644 index 000000000000..22efd5cff46d --- /dev/null +++ b/svtools/source/config/loghelper.hxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: loghelper.hxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:20:29 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ +#ifndef _SVT_LOGHELPER_HXX +#define _SVT_LOGHELPER_HXX + +namespace css = ::com::sun::star; + +class LogHelper +{ +public: + LogHelper(); + ~LogHelper(); + + static void logIt(const css::uno::Exception&){} +}; + +inline void logIt(const css::uno::Exception& ex) +{ + ::rtl::OUStringBuffer sMsg(256); + sMsg.appendAscii("Unexpected exception catched. Original message was:\n\"" ); + sMsg.append(ex.Message); + sMsg.appendAscii("\""); + OSL_ENSURE(sal_False, ::rtl::OUStringToOString(sMsg.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr()); +} + +#endif + diff --git a/svtools/source/config/makefile.mk b/svtools/source/config/makefile.mk index d73c1625b9da..9c0985329eb3 100644 --- a/svtools/source/config/makefile.mk +++ b/svtools/source/config/makefile.mk @@ -68,7 +68,6 @@ LIB1OBJFILES= \ $(SLO)$/inetoptions.obj \ $(SLO)$/menuoptions.obj \ $(SLO)$/dynamicmenuoptions.obj \ - $(SLO)$/options3d.obj \ $(SLO)$/optionsdrawinglayer.obj \ $(SLO)$/fontoptions.obj \ $(SLO)$/addxmltostorageoptions.obj \ diff --git a/svtools/source/config/misccfg.cxx b/svtools/source/config/misccfg.cxx index 332583ebb4db..06cc9b7446c0 100644 --- a/svtools/source/config/misccfg.cxx +++ b/svtools/source/config/misccfg.cxx @@ -145,7 +145,7 @@ void SfxMiscCfg::Load() Sequence<Any> aValues = GetProperties(aNames); EnableNotification(aNames); const Any* pValues = aValues.getConstArray(); - DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed") + DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed"); if(aValues.getLength() == aNames.getLength()) { for(int nProp = 0; nProp < aNames.getLength(); nProp++) diff --git a/svtools/source/config/options3d.cxx b/svtools/source/config/options3d.cxx deleted file mode 100644 index 50f524f16180..000000000000 --- a/svtools/source/config/options3d.cxx +++ /dev/null @@ -1,459 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: options3d.cxx,v $ - * $Revision: 1.8 $ - * - * 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" -#ifndef GCC -#endif - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include <svtools/options3d.hxx> -#include <unotools/configmgr.hxx> -#include <unotools/configitem.hxx> -#include <tools/debug.hxx> -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/uno/Sequence.hxx> - -#include <itemholder1.hxx> - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::utl ; -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::com::sun::star::uno ; - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define ROOTNODE_START OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/_3D_Engine" )) -#define DEFAULT_DITHERING sal_True -#define DEFAULT_OPENGL sal_True -#define DEFAULT_OPENGL_FASTER sal_True -#define DEFAULT_OPENGL_FASTER sal_True -#define DEFAULT_SHOWFULL sal_False - -#define PROPERTYNAME_DITHERING OUString(RTL_CONSTASCII_USTRINGPARAM("Dithering" )) -#define PROPERTYNAME_OPENGL OUString(RTL_CONSTASCII_USTRINGPARAM("OpenGL" )) -#define PROPERTYNAME_OPENGL_FASTER OUString(RTL_CONSTASCII_USTRINGPARAM("OpenGL_Faster" )) -#define PROPERTYNAME_SHOWFULL OUString(RTL_CONSTASCII_USTRINGPARAM("ShowFull" )) - -#define PROPERTYHANDLE_DITHERING 0 -#define PROPERTYHANDLE_OPENGL 1 -#define PROPERTYHANDLE_OPENGL_FASTER 2 -#define PROPERTYHANDLE_SHOWFULL 3 - -#define PROPERTYCOUNT 4 - -class SvtOptions3D_Impl : public ConfigItem -{ -public: - -//--------------------------------------------------------------------------------------------------------- -// constructor / destructor -//--------------------------------------------------------------------------------------------------------- - - SvtOptions3D_Impl(); - ~SvtOptions3D_Impl(); - -//--------------------------------------------------------------------------------------------------------- -// overloaded methods of baseclass -//--------------------------------------------------------------------------------------------------------- - - virtual void Commit(); - -//--------------------------------------------------------------------------------------------------------- -// public interface -//--------------------------------------------------------------------------------------------------------- - - sal_Bool IsDithering() const; - sal_Bool IsOpenGL() const; - sal_Bool IsOpenGL_Faster() const; - sal_Bool IsShowFull() const; - - void SetDithering( sal_Bool bState ); - void SetOpenGL( sal_Bool bState ); - void SetOpenGL_Faster( sal_Bool bState ); - void SetShowFull( sal_Bool bState ); - -//------------------------------------------------------------------------------------------------------------- -// private methods -//------------------------------------------------------------------------------------------------------------- - -private: - - static Sequence< OUString > impl_GetPropertyNames(); - -//------------------------------------------------------------------------------------------------------------- -// private member -//------------------------------------------------------------------------------------------------------------- - -private: - - sal_Bool m_bDithering; - sal_Bool m_bOpenGL; - sal_Bool m_bOpenGL_Faster; - sal_Bool m_bShowFull; -}; - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtOptions3D_Impl::SvtOptions3D_Impl() : - ConfigItem( ROOTNODE_START ), - m_bDithering( DEFAULT_DITHERING ), - m_bOpenGL( DEFAULT_OPENGL ), - m_bOpenGL_Faster( DEFAULT_OPENGL_FASTER ), - m_bShowFull( DEFAULT_SHOWFULL ) -{ - Sequence< OUString > seqNames( impl_GetPropertyNames() ); - Sequence< Any > seqValues = GetProperties( seqNames ) ; - - DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtOptions3D_Impl::SvtOptions3D_Impl()\nI miss some values of configuration keys!\n" ); - - // Copy values from list in right order to ouer internal member. - sal_Int32 nPropertyCount = seqValues.getLength(); - sal_Int32 nProperty = 0; - - for( nProperty=0; nProperty<nPropertyCount; ++nProperty ) - { - DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtOptions3D_Impl::SvtOptions3D_Impl()\nInvalid property value for property detected!\n" ); - - switch( nProperty ) - { - case PROPERTYHANDLE_DITHERING: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptions3D_Impl::SvtOptions3D_Impl()\nWho has changed the value type of \"Office.Common\\_3D_Engine\\Dithering\"?" ); - seqValues[nProperty] >>= m_bDithering; - } - break; - - case PROPERTYHANDLE_OPENGL: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptions3D_Impl::SvtOptions3D_Impl()\nWho has changed the value type of \"Office.Common\\_3D_Engine\\OpenGL\"?" ); - seqValues[nProperty] >>= m_bOpenGL; - } - break; - - case PROPERTYHANDLE_OPENGL_FASTER: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptions3D_Impl::SvtOptions3D_Impl()\nWho has changed the value type of \"Office.Common\\_3D_Engine\\OpenGL_Faster\"?" ); - seqValues[nProperty] >>= m_bOpenGL_Faster; - } - break; - - case PROPERTYHANDLE_SHOWFULL: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptions3D_Impl::SvtOptions3D_Impl()\nWho has changed the value type of \"Office.Common\\_3D_Engine\\ShowFull\"?" ); - seqValues[nProperty] >>= m_bShowFull; - } - break; - } - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtOptions3D_Impl::~SvtOptions3D_Impl() -{ - if( IsModified() ) - Commit(); -} - -//***************************************************************************************************************** -// Commit -//***************************************************************************************************************** -void SvtOptions3D_Impl::Commit() -{ - Sequence< OUString > aSeqNames( impl_GetPropertyNames() ); - Sequence< Any > aSeqValues( aSeqNames.getLength() ); - - for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty ) - { - switch( nProperty ) - { - case PROPERTYHANDLE_DITHERING: - aSeqValues[nProperty] <<= m_bDithering; - break; - - case PROPERTYHANDLE_OPENGL: - aSeqValues[nProperty] <<= m_bOpenGL; - break; - - case PROPERTYHANDLE_OPENGL_FASTER: - aSeqValues[nProperty] <<= m_bOpenGL_Faster; - break; - - case PROPERTYHANDLE_SHOWFULL: - aSeqValues[nProperty] <<= m_bShowFull; - break; - } - } - - PutProperties( aSeqNames, aSeqValues ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptions3D_Impl::IsDithering() const -{ - return m_bDithering; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptions3D_Impl::IsOpenGL() const -{ - return m_bOpenGL; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptions3D_Impl::IsOpenGL_Faster() const -{ - return m_bOpenGL_Faster; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptions3D_Impl::IsShowFull() const -{ - return m_bShowFull; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptions3D_Impl::SetDithering( sal_Bool bState ) -{ - m_bDithering = bState; - SetModified(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptions3D_Impl::SetOpenGL( sal_Bool bState ) -{ - m_bOpenGL = bState; - SetModified(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptions3D_Impl::SetOpenGL_Faster( sal_Bool bState ) -{ - m_bOpenGL_Faster = bState; - SetModified(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptions3D_Impl::SetShowFull( sal_Bool bState ) -{ - m_bShowFull = bState; - SetModified(); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Sequence< OUString > SvtOptions3D_Impl::impl_GetPropertyNames() -{ - // Build static list of configuration key names. - static const OUString pProperties[] = - { - PROPERTYNAME_DITHERING , - PROPERTYNAME_OPENGL , - PROPERTYNAME_OPENGL_FASTER , - PROPERTYNAME_SHOWFULL - }; - // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); - // ... and return it. - return seqPropertyNames; -} - -//***************************************************************************************************************** -// initialize static member -// DON'T DO IT IN YOUR HEADER! -// see definition for further informations -//***************************************************************************************************************** -SvtOptions3D_Impl* SvtOptions3D::m_pDataContainer = NULL ; -sal_Int32 SvtOptions3D::m_nRefCount = 0 ; - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtOptions3D::SvtOptions3D() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( GetOwnStaticMutex() ); - // Increase ouer refcount ... - ++m_nRefCount; - // ... and initialize ouer data container only if it not already! - if( m_pDataContainer == NULL ) - { - m_pDataContainer = new SvtOptions3D_Impl(); - ItemHolder1::holdConfigItem(E_OPTIONS3D); - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtOptions3D::~SvtOptions3D() -{ - // Global access, must be guarded (multithreading!) - MutexGuard aGuard( GetOwnStaticMutex() ); - // Decrease ouer refcount. - --m_nRefCount; - // If last instance was deleted ... - // we must destroy ouer static data container! - if( m_nRefCount <= 0 ) - { - delete m_pDataContainer; - m_pDataContainer = NULL; - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptions3D::IsDithering() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsDithering(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptions3D::IsOpenGL() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsOpenGL(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptions3D::IsOpenGL_Faster() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsOpenGL_Faster(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptions3D::IsShowFull() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsShowFull(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptions3D::SetDithering( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetDithering( bState ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptions3D::SetOpenGL( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetOpenGL( bState ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptions3D::SetOpenGL_Faster( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetOpenGL_Faster( bState ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptions3D::SetShowFull( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetShowFull( bState ); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Mutex& SvtOptions3D::GetOwnStaticMutex() -{ - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx index 5f12b32feaa9..c63dc2154c55 100644 --- a/svtools/source/config/optionsdrawinglayer.cxx +++ b/svtools/source/config/optionsdrawinglayer.cxx @@ -41,6 +41,8 @@ #include <tools/debug.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> +#include <vcl/svapp.hxx> +#include <vcl/outdev.hxx> //_________________________________________________________________________________________________________________ // namespaces @@ -82,7 +84,8 @@ using namespace ::com::sun::star::uno ; #define DEFAULT_MAXIMUMPAPERBOTTOMMARGIN 9999 // primitives -#define DEFAULT_ANTIALIASING sal_False +#define DEFAULT_ANTIALIASING sal_True +#define DEFAULT_SOLIDDRAGCREATE sal_True #define DEFAULT_QUADRATIC3DRENDERLIMIT 1000000 #define DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT 45000 @@ -112,6 +115,7 @@ using namespace ::com::sun::star::uno ; // primitives #define PROPERTYNAME_ANTIALIASING OUString(RTL_CONSTASCII_USTRINGPARAM("AntiAliasing")) +#define PROPERTYNAME_SOLIDDRAGCREATE OUString(RTL_CONSTASCII_USTRINGPARAM("SolidDragCreate")) #define PROPERTYNAME_QUADRATIC3DRENDERLIMIT OUString(RTL_CONSTASCII_USTRINGPARAM("Quadratic3DRenderLimit")) #define PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT OUString(RTL_CONSTASCII_USTRINGPARAM("QuadraticFormControlRenderLimit")) @@ -141,10 +145,11 @@ using namespace ::com::sun::star::uno ; // primitives #define PROPERTYHANDLE_ANTIALIASING 17 -#define PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT 18 -#define PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT 19 +#define PROPERTYHANDLE_SOLIDDRAGCREATE 18 +#define PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT 19 +#define PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT 20 -#define PROPERTYCOUNT 20 +#define PROPERTYCOUNT 21 class SvtOptionsDrawinglayer_Impl : public ConfigItem { @@ -214,12 +219,17 @@ public: void SetMaximumPaperTopMargin(sal_uInt32 nNew); void SetMaximumPaperBottomMargin(sal_uInt32 nNew); + // helper + sal_Bool IsAAPossibleOnThisSystem() const; + // primitives sal_Bool IsAntiAliasing() const; + sal_Bool IsSolidDragCreate() const; sal_uInt32 GetQuadratic3DRenderLimit() const; sal_uInt32 GetQuadraticFormControlRenderLimit() const; void SetAntiAliasing( sal_Bool bState ); + void SetSolidDragCreate( sal_Bool bState ); void SetQuadratic3DRenderLimit(sal_uInt32 nNew); void SetQuadraticFormControlRenderLimit(sal_uInt32 nNew); @@ -263,8 +273,13 @@ private: // primitives sal_Bool m_bAntiAliasing; + sal_Bool m_bSolidDragCreate; sal_uInt32 m_nQuadratic3DRenderLimit; sal_uInt32 m_nQuadraticFormControlRenderLimit; + + // local values + bool m_bAllowAA : 1; + bool m_bAllowAAChecked : 1; }; //_________________________________________________________________________________________________________________ @@ -302,8 +317,13 @@ SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() : // primitives m_bAntiAliasing(DEFAULT_ANTIALIASING), + m_bSolidDragCreate(DEFAULT_SOLIDDRAGCREATE), m_nQuadratic3DRenderLimit(DEFAULT_QUADRATIC3DRENDERLIMIT), - m_nQuadraticFormControlRenderLimit(DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT) + m_nQuadraticFormControlRenderLimit(DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT), + + // local values + m_bAllowAA(true), + m_bAllowAAChecked(false) { Sequence< OUString > seqNames( impl_GetPropertyNames() ); Sequence< Any > seqValues = GetProperties( seqNames ) ; @@ -454,6 +474,13 @@ SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() : } break; + case PROPERTYHANDLE_SOLIDDRAGCREATE: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SolidDragCreate\"?" ); + seqValues[nProperty] >>= m_bSolidDragCreate; + } + break; + case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT: { DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\Quadratic3DRenderLimit\"?" ); @@ -568,6 +595,10 @@ void SvtOptionsDrawinglayer_Impl::Commit() aSeqValues[nProperty] <<= m_bAntiAliasing; break; + case PROPERTYHANDLE_SOLIDDRAGCREATE: + aSeqValues[nProperty] <<= m_bSolidDragCreate; + break; + case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT: aSeqValues[nProperty] <<= m_nQuadratic3DRenderLimit; break; @@ -855,12 +886,42 @@ void SvtOptionsDrawinglayer_Impl::SetMaximumPaperBottomMargin( sal_uInt32 nNew ) } } +// helper +sal_Bool SvtOptionsDrawinglayer_Impl::IsAAPossibleOnThisSystem() const +{ + if(!m_bAllowAAChecked) + { + SvtOptionsDrawinglayer_Impl* pThat = const_cast< SvtOptionsDrawinglayer_Impl* >(this); + pThat->m_bAllowAAChecked = true; + +#ifdef WIN32 + // WIN32 uses GDIPlus with VCL forthe first incarnation; this will be enhanced + // in the future to use canvases and the canvas renderer, thus a AA-abled + // canvas needs to be checked here in the future. + // Currently, just allow AA for WIN32 +#endif + + // check XRenderExtension + if(m_bAllowAA && !Application::GetDefaultDevice()->supportsOperation( OutDevSupport_TransparentRect )) + { + pThat->m_bAllowAA = false; + } + } + + return m_bAllowAA; +} + // primitives sal_Bool SvtOptionsDrawinglayer_Impl::IsAntiAliasing() const { return m_bAntiAliasing; } +sal_Bool SvtOptionsDrawinglayer_Impl::IsSolidDragCreate() const +{ + return m_bSolidDragCreate; +} + sal_uInt32 SvtOptionsDrawinglayer_Impl::GetQuadratic3DRenderLimit() const { return m_nQuadratic3DRenderLimit; @@ -880,6 +941,15 @@ void SvtOptionsDrawinglayer_Impl::SetAntiAliasing( sal_Bool bState ) } } +void SvtOptionsDrawinglayer_Impl::SetSolidDragCreate( sal_Bool bState ) +{ + if(m_bSolidDragCreate != bState) + { + m_bSolidDragCreate = bState; + SetModified(); + } +} + void SvtOptionsDrawinglayer_Impl::SetQuadratic3DRenderLimit(sal_uInt32 nNew) { if(m_nQuadratic3DRenderLimit != nNew) @@ -932,6 +1002,7 @@ Sequence< OUString > SvtOptionsDrawinglayer_Impl::impl_GetPropertyNames() // primitives PROPERTYNAME_ANTIALIASING, + PROPERTYNAME_SOLIDDRAGCREATE, PROPERTYNAME_QUADRATIC3DRENDERLIMIT, PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT }; @@ -1224,11 +1295,23 @@ void SvtOptionsDrawinglayer::SetMaximumPaperBottomMargin( sal_uInt32 nNew ) m_pDataContainer->SetMaximumPaperBottomMargin( nNew ); } +// helper +sal_Bool SvtOptionsDrawinglayer::IsAAPossibleOnThisSystem() const +{ + return m_pDataContainer->IsAAPossibleOnThisSystem(); +} + // primitives sal_Bool SvtOptionsDrawinglayer::IsAntiAliasing() const { MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsAntiAliasing(); + return m_pDataContainer->IsAntiAliasing() && IsAAPossibleOnThisSystem(); +} + +sal_Bool SvtOptionsDrawinglayer::IsSolidDragCreate() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsSolidDragCreate(); } sal_uInt32 SvtOptionsDrawinglayer::GetQuadratic3DRenderLimit() const @@ -1249,6 +1332,12 @@ void SvtOptionsDrawinglayer::SetAntiAliasing( sal_Bool bState ) m_pDataContainer->SetAntiAliasing( bState ); } +void SvtOptionsDrawinglayer::SetSolidDragCreate( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetSolidDragCreate( bState ); +} + void SvtOptionsDrawinglayer::SetQuadratic3DRenderLimit(sal_uInt32 nNew) { MutexGuard aGuard( GetOwnStaticMutex() ); diff --git a/svtools/source/config/printoptions.cxx b/svtools/source/config/printoptions.cxx index 04dd03fa7273..657d82ddb44e 100644 --- a/svtools/source/config/printoptions.cxx +++ b/svtools/source/config/printoptions.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: printoptions.cxx,v $ - * $Revision: 1.15 $ + * $Revision: 1.14.236.3 $ * * This file is part of OpenOffice.org. * @@ -48,8 +48,37 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ +#include <com/sun/star/container/XNameContainer.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#endif + +#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_ +#include <comphelper/configurationhelper.hxx> +#endif + +#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_ +#include <unotools/processfactory.hxx> +#endif + +#ifndef _SVT_LOGHELPER_HXX +#include <loghelper.hxx> +#endif + #include <itemholder2.hxx> + // ----------- // - statics - // ----------- @@ -63,6 +92,7 @@ static USHORT aDPIArray[] = { 72, 96, 150, 200, 300, 600 }; // ----------- #define ROOTNODE_START OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Print/Option")) +#define ROOTNODE_PRINTOPTION OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/Print/Option")) #define PROPERTYNAME_REDUCETRANSPARENCY OUString(RTL_CONSTASCII_USTRINGPARAM("ReduceTransparency")) #define PROPERTYNAME_REDUCEDTRANSPARENCYMODE OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedTransparencyMode")) @@ -75,19 +105,6 @@ static USHORT aDPIArray[] = { 72, 96, 150, 200, 300, 600 }; #define PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY OUString(RTL_CONSTASCII_USTRINGPARAM("ReducedBitmapIncludesTransparency")) #define PROPERTYNAME_CONVERTTOGREYSCALES OUString(RTL_CONSTASCII_USTRINGPARAM("ConvertToGreyscales")) -#define PROPERTYHDL_REDUCETRANSPARENCY 0 -#define PROPERTYHDL_REDUCEDTRANSPARENCYMODE 1 -#define PROPERTYHDL_REDUCEGRADIENTS 2 -#define PROPERTYHDL_REDUCEDGRADIENTMODE 3 -#define PROPERTYHDL_REDUCEDGRADIENTSTEPCOUNT 4 -#define PROPERTYHDL_REDUCEBITMAPS 5 -#define PROPERTYHDL_REDUCEDBITMAPMODE 6 -#define PROPERTYHDL_REDUCEDBITMAPRESOLUTION 7 -#define PROPERTYHDL_REDUCEDBITMAPINCLUDESTRANSPARENCY 8 -#define PROPERTYHDL_CONVERTTOGREYSCALES 9 - -#define PROPERTYCOUNT 10 - // -------------- // - Namespaces - // -------------- @@ -96,6 +113,7 @@ using namespace ::utl; using namespace ::rtl; using namespace ::osl; using namespace ::com::sun::star::uno; +namespace css = com::sun::star; // ----------- // - statics - @@ -114,7 +132,7 @@ sal_Int32 SvtPrintFileOptions::m_nRefCount = 0; // - SvtPrintOptions_Impl - // ------------------------ -class SvtPrintOptions_Impl : public ConfigItem +class SvtPrintOptions_Impl { public: @@ -126,255 +144,408 @@ public: ~SvtPrintOptions_Impl(); //--------------------------------------------------------------------------------------------------------- -// overloaded methods of baseclass -//--------------------------------------------------------------------------------------------------------- - - virtual void Commit(); - -//--------------------------------------------------------------------------------------------------------- // public interface //--------------------------------------------------------------------------------------------------------- - sal_Bool IsReduceTransparency() const { return m_bReduceTransparency; } - sal_Int16 GetReducedTransparencyMode() const { return m_nReducedTransparencyMode; } - sal_Bool IsReduceGradients() const { return m_bReduceGradients; } - sal_Int16 GetReducedGradientMode() const { return m_nReducedGradientMode; } - sal_Int16 GetReducedGradientStepCount() const { return m_nReducedGradientStepCount; } - sal_Bool IsReduceBitmaps() const { return m_bReduceBitmaps; } - sal_Int16 GetReducedBitmapMode() const { return m_nReducedBitmapMode; } - sal_Int16 GetReducedBitmapResolution() const { return m_nReducedBitmapResolution; } - sal_Bool IsReducedBitmapIncludesTransparency() const { return m_bReducedBitmapIncludesTransparency; } - sal_Bool IsConvertToGreyscales() const { return m_bConvertToGreyscales; } - - void SetReduceTransparency( sal_Bool bState ) { m_bReduceTransparency = bState; SetModified(); } - void SetReducedTransparencyMode( sal_Int16 nMode ) { m_nReducedTransparencyMode = nMode; SetModified(); } - void SetReduceGradients( sal_Bool bState ) { m_bReduceGradients = bState; SetModified(); } - void SetReducedGradientMode( sal_Int16 nMode ) { m_nReducedGradientMode = nMode; SetModified(); } - void SetReducedGradientStepCount( sal_Int16 nStepCount ) { m_nReducedGradientStepCount = nStepCount; SetModified(); } - void SetReduceBitmaps( sal_Bool bState ) { m_bReduceBitmaps = bState; SetModified(); } - void SetReducedBitmapMode( sal_Int16 nMode ) { m_nReducedBitmapMode = nMode; SetModified(); } - void SetReducedBitmapResolution( sal_Int16 nResolution ) { m_nReducedBitmapResolution = nResolution; SetModified(); } - void SetReducedBitmapIncludesTransparency( sal_Bool bState ) { m_bReducedBitmapIncludesTransparency = bState; SetModified(); } - void SetConvertToGreyscales( sal_Bool bState ) { m_bConvertToGreyscales = bState; SetModified(); } - -//------------------------------------------------------------------------------------------------------------- -// private methods + sal_Bool IsReduceTransparency() const ; + sal_Int16 GetReducedTransparencyMode() const ; + sal_Bool IsReduceGradients() const ; + sal_Int16 GetReducedGradientMode() const ; + sal_Int16 GetReducedGradientStepCount() const ; + sal_Bool IsReduceBitmaps() const ; + sal_Int16 GetReducedBitmapMode() const ; + sal_Int16 GetReducedBitmapResolution() const ; + sal_Bool IsReducedBitmapIncludesTransparency() const ; + sal_Bool IsConvertToGreyscales() const; + + void SetReduceTransparency( sal_Bool bState ) ; + void SetReducedTransparencyMode( sal_Int16 nMode ) ; + void SetReduceGradients( sal_Bool bState ) ; + void SetReducedGradientMode( sal_Int16 nMode ) ; + void SetReducedGradientStepCount( sal_Int16 nStepCount ) ; + void SetReduceBitmaps( sal_Bool bState ) ; + void SetReducedBitmapMode( sal_Int16 nMode ) ; + void SetReducedBitmapResolution( sal_Int16 nResolution ) ; + void SetReducedBitmapIncludesTransparency( sal_Bool bState ) ; + void SetConvertToGreyscales( sal_Bool bState ) ; +
//------------------------------------------------------------------------------------------------------------- - -private: - - static Sequence< OUString > impl_GetPropertyNames(); - +// private API +//-------------------------------------------------------------------------------------------------------------
+ +private:
+ void impl_setValue (const ::rtl::OUString& sProp,
+ ::sal_Bool bNew );
+ void impl_setValue (const ::rtl::OUString& sProp,
+ ::sal_Int16 nNew );
+
//------------------------------------------------------------------------------------------------------------- // private member //------------------------------------------------------------------------------------------------------------- private: - - sal_Bool m_bReduceTransparency; - sal_Int16 m_nReducedTransparencyMode; - sal_Bool m_bReduceGradients; - sal_Int16 m_nReducedGradientMode; - sal_Int16 m_nReducedGradientStepCount; - sal_Bool m_bReduceBitmaps; - sal_Int16 m_nReducedBitmapMode; - sal_Int16 m_nReducedBitmapResolution; - sal_Bool m_bReducedBitmapIncludesTransparency; - sal_Bool m_bConvertToGreyscales; + css::uno::Reference< css::container::XNameAccess > m_xCfg; + css::uno::Reference< css::container::XNameAccess > m_xNode; }; -// ----------------------------------------------------------------------------- - -SvtPrintOptions_Impl::SvtPrintOptions_Impl( const OUString& rConfigRoot ) : - ConfigItem( rConfigRoot ), - m_bReduceTransparency( sal_False ), - m_nReducedTransparencyMode( 0 ), - m_bReduceGradients( sal_False ), - m_nReducedGradientMode( 0 ), - m_nReducedGradientStepCount( 64 ), - m_bReduceBitmaps( sal_False ), - m_nReducedBitmapMode( 1 ), - m_nReducedBitmapResolution( 3 ), - m_bReducedBitmapIncludesTransparency( sal_True ), - m_bConvertToGreyscales( sal_False ) +SvtPrintOptions_Impl::SvtPrintOptions_Impl(const OUString& rConfigRoot) { - Sequence< OUString > seqNames( impl_GetPropertyNames() ); - Sequence< Any > seqValues( GetProperties( seqNames ) ); + try + { + m_xCfg = css::uno::Reference< css::container::XNameAccess >( + ::comphelper::ConfigurationHelper::openConfig( + utl::getProcessServiceFactory(), + ROOTNODE_PRINTOPTION, + ::comphelper::ConfigurationHelper::E_STANDARD), + css::uno::UNO_QUERY); + + if (m_xCfg.is()) + { + UniString sTmp = UniString(rConfigRoot); + xub_StrLen nTokenCount = sTmp.GetTokenCount('/'); + sTmp = sTmp.GetToken(nTokenCount - 1, '/'); + m_xCfg->getByName(OUString(sTmp.GetBuffer())) >>= m_xNode; + } + } + catch (const css::uno::Exception& ex) + { + m_xNode.clear(); + m_xCfg.clear(); + LogHelper::logIt(ex); + } +} - DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtPrintOptions_Impl::SvtPrintOptions_Impl()\nI miss some values of configuration keys!\n" ); +sal_Bool SvtPrintOptions_Impl::IsReduceTransparency() const +{ + sal_Bool bRet = sal_False; + try + { + if (m_xNode.is()) + { + css::uno::Reference< css::beans::XPropertySet > xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bRet; + } + } + catch (const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } - // Copy values from list in right order to our internal member. - sal_Int32 nPropertyCount = seqValues.getLength(); - sal_Int32 nProperty = 0; + return bRet; +} - for( nProperty=0; nProperty<nPropertyCount; ++nProperty ) +sal_Int16 SvtPrintOptions_Impl::GetReducedTransparencyMode() const +{ + sal_Int16 nRet = 0; + try { - DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtPrintOptions_Impl::SvtPrintOptions_Impl()\nInvalid property value for property detected!\n" ); + if (m_xNode.is()) + { + css::uno::Reference< css::beans::XPropertySet > xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) + xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nRet; + } + } + catch (const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } - switch( nProperty ) + return nRet; +} + +sal_Bool SvtPrintOptions_Impl::IsReduceGradients() const +{ + sal_Bool bRet = sal_False; + try + { + if (m_xNode.is()) { - case PROPERTYHDL_REDUCETRANSPARENCY: + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" ); - seqValues[nProperty] >>= m_bReduceTransparency; + xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bRet; } - break; + } + } + catch (const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } + return bRet; +} - case PROPERTYHDL_REDUCEDTRANSPARENCYMODE: +sal_Int16 SvtPrintOptions_Impl::GetReducedGradientMode() const +{ + sal_Int16 nRet = 0; + try + { + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "Invalid type" ); - seqValues[nProperty] >>= m_nReducedTransparencyMode; + xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nRet; } - break; + } + } + catch (const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } - case PROPERTYHDL_REDUCEGRADIENTS: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" ); - seqValues[nProperty] >>= m_bReduceGradients; - } - break; + return nRet; +} - case PROPERTYHDL_REDUCEDGRADIENTMODE: +sal_Int16 SvtPrintOptions_Impl::GetReducedGradientStepCount() const +{ + sal_Int16 nRet = 64; + try + { + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "Invalid type" ); - seqValues[nProperty] >>= m_nReducedGradientMode; + xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nRet; } - break; + } + } + catch (const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } - case PROPERTYHDL_REDUCEDGRADIENTSTEPCOUNT: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "Invalid type" ); - seqValues[nProperty] >>= m_nReducedGradientStepCount; - } - break; + return nRet; +} - case PROPERTYHDL_REDUCEBITMAPS: +sal_Bool SvtPrintOptions_Impl::IsReduceBitmaps() const +{ + sal_Bool bRet = sal_False; + try + { + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" ); - seqValues[nProperty] >>= m_bReduceBitmaps; + xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bRet; } - break; + } + } + catch (const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } - case PROPERTYHDL_REDUCEDBITMAPMODE: + return bRet; +} + +sal_Int16 SvtPrintOptions_Impl::GetReducedBitmapMode() const +{ + sal_Int16 nRet = 1; + try + { + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "Invalid type" ); - seqValues[nProperty] >>= m_nReducedBitmapMode; + xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nRet; } - break; + } + } + catch (const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } + + return nRet; +} - case PROPERTYHDL_REDUCEDBITMAPRESOLUTION: +sal_Int16 SvtPrintOptions_Impl::GetReducedBitmapResolution() const +{ + sal_Int16 nRet = 3; + try + { + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "Invalid type" ); - seqValues[nProperty] >>= m_nReducedBitmapResolution; + xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nRet; } - break; + } + } + catch (const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } - case PROPERTYHDL_REDUCEDBITMAPINCLUDESTRANSPARENCY: + return nRet; +} + +sal_Bool SvtPrintOptions_Impl::IsReducedBitmapIncludesTransparency() const +{ + sal_Bool bRet = sal_True; + try + { + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" ); - seqValues[nProperty] >>= m_bReducedBitmapIncludesTransparency; + xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bRet; } - break; + } + } + catch (const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } + + return bRet; +} - case PROPERTYHDL_CONVERTTOGREYSCALES: +sal_Bool SvtPrintOptions_Impl::IsConvertToGreyscales() const +{ + sal_Bool bRet = sal_False; + try + { + if (m_xNode.is()) + { + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if (xSet.is()) { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" ); - seqValues[nProperty] >>= m_bConvertToGreyscales; + xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bRet; } - break; } } + catch (const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } + + return bRet; + +} +
+void SvtPrintOptions_Impl::SetReduceTransparency(sal_Bool bState) +{ + impl_setValue(PROPERTYNAME_REDUCETRANSPARENCY, bState); } -// ----------------------------------------------------------------------------- +void SvtPrintOptions_Impl::SetReducedTransparencyMode(sal_Int16 nMode) +{ + impl_setValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE, nMode); +} -SvtPrintOptions_Impl::~SvtPrintOptions_Impl() +void SvtPrintOptions_Impl::SetReduceGradients(sal_Bool bState) { - if( IsModified() ) - Commit(); + impl_setValue(PROPERTYNAME_REDUCEGRADIENTS, bState); } -// ----------------------------------------------------------------------------- +void SvtPrintOptions_Impl::SetReducedGradientMode(sal_Int16 nMode) +{ + impl_setValue(PROPERTYNAME_REDUCEDGRADIENTMODE, nMode); +} -void SvtPrintOptions_Impl::Commit() +void SvtPrintOptions_Impl::SetReducedGradientStepCount(sal_Int16 nStepCount ) { - Sequence< OUString > aSeqNames( impl_GetPropertyNames() ); - Sequence< Any > aSeqValues( aSeqNames.getLength() ); + impl_setValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT, nStepCount); +} - for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty ) - { - switch( nProperty ) - { - case PROPERTYHDL_REDUCETRANSPARENCY: - aSeqValues[nProperty] <<= m_bReduceTransparency; - break; +void SvtPrintOptions_Impl::SetReduceBitmaps(sal_Bool bState ) +{ + impl_setValue(PROPERTYNAME_REDUCEBITMAPS, bState); +} - case PROPERTYHDL_REDUCEDTRANSPARENCYMODE: - aSeqValues[nProperty] <<= m_nReducedTransparencyMode; - break; +void SvtPrintOptions_Impl::SetReducedBitmapMode(sal_Int16 nMode ) +{ + impl_setValue(PROPERTYNAME_REDUCEDBITMAPMODE, nMode); +} - case PROPERTYHDL_REDUCEGRADIENTS: - aSeqValues[nProperty] <<= m_bReduceGradients; - break; +void SvtPrintOptions_Impl::SetReducedBitmapResolution(sal_Int16 nResolution ) +{ + impl_setValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION, nResolution); +} - case PROPERTYHDL_REDUCEDGRADIENTMODE: - aSeqValues[nProperty] <<= m_nReducedGradientMode; - break; +void SvtPrintOptions_Impl::SetReducedBitmapIncludesTransparency(sal_Bool bState ) +{ + impl_setValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY, bState); +} - case PROPERTYHDL_REDUCEDGRADIENTSTEPCOUNT: - aSeqValues[nProperty] <<= m_nReducedGradientStepCount; - break; +void SvtPrintOptions_Impl::SetConvertToGreyscales(sal_Bool bState) +{ + impl_setValue(PROPERTYNAME_CONVERTTOGREYSCALES, bState); +} - case PROPERTYHDL_REDUCEBITMAPS: - aSeqValues[nProperty] <<= m_bReduceBitmaps; - break; +SvtPrintOptions_Impl::~SvtPrintOptions_Impl() +{ + m_xNode.clear(); + m_xCfg.clear(); +} - case PROPERTYHDL_REDUCEDBITMAPMODE: - aSeqValues[nProperty] <<= m_nReducedBitmapMode; - break; +void SvtPrintOptions_Impl::impl_setValue (const ::rtl::OUString& sProp,
+ ::sal_Bool bNew )
+{
+ try + { + if ( ! m_xNode.is())
+ return;
- case PROPERTYHDL_REDUCEDBITMAPRESOLUTION: - aSeqValues[nProperty] <<= m_nReducedBitmapResolution; - break; + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if ( ! xSet.is())
+ return;
- case PROPERTYHDL_REDUCEDBITMAPINCLUDESTRANSPARENCY: - aSeqValues[nProperty] <<= m_bReducedBitmapIncludesTransparency; - break; + ::sal_Bool bOld = ! bNew; + if ( ! (xSet->getPropertyValue(sProp) >>= bOld))
+ return;
- case PROPERTYHDL_CONVERTTOGREYSCALES: - aSeqValues[nProperty] <<= m_bConvertToGreyscales; - break; + if (bOld != bNew) + { + xSet->setPropertyValue(sProp, css::uno::makeAny(bNew)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); } } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +}
- PutProperties( aSeqNames, aSeqValues ); -} +void SvtPrintOptions_Impl::impl_setValue (const ::rtl::OUString& sProp,
+ ::sal_Int16 nNew )
+{
+ try + { + if ( ! m_xNode.is())
+ return;
-// ----------------------------------------------------------------------------- + css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY); + if ( ! xSet.is())
+ return;
-Sequence< OUString > SvtPrintOptions_Impl::impl_GetPropertyNames() -{ - // Build static list of configuration key names. - static const OUString pProperties[] = - { - PROPERTYNAME_REDUCETRANSPARENCY, - PROPERTYNAME_REDUCEDTRANSPARENCYMODE, - PROPERTYNAME_REDUCEGRADIENTS, - PROPERTYNAME_REDUCEDGRADIENTMODE, - PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT, - PROPERTYNAME_REDUCEBITMAPS, - PROPERTYNAME_REDUCEDBITMAPMODE, - PROPERTYNAME_REDUCEDBITMAPRESOLUTION, - PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY, - PROPERTYNAME_CONVERTTOGREYSCALES - }; + ::sal_Int16 nOld = nNew+1; + if ( ! (xSet->getPropertyValue(sProp) >>= nOld))
+ return;
- // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + if (nOld != nNew) + { + xSet->setPropertyValue(sProp, css::uno::makeAny(nNew)); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + } + catch(const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +}
+
+// ----------------------------------------------------------------------------- - return seqPropertyNames; -} // ----------------------- // - SvtBasePrintOptions - diff --git a/svtools/source/config/searchopt.cxx b/svtools/source/config/searchopt.cxx index 5fad9d060976..261edf4d0f1e 100644 --- a/svtools/source/config/searchopt.cxx +++ b/svtools/source/config/searchopt.cxx @@ -46,7 +46,7 @@ using namespace utl; using namespace com::sun::star::uno; using namespace com::sun::star::i18n; -#define MAX_FLAGS_OFFSET 24 +#define MAX_FLAGS_OFFSET 25 ////////////////////////////////////////////////////////////////////// @@ -164,8 +164,9 @@ Sequence< OUString > SvtSearchOptions_Impl::GetPropertyNames() const "Japanese/IsMatch_KiKu", // 20 "Japanese/IsIgnorePunctuation", // 21 "Japanese/IsIgnoreWhitespace", // 22 - "Japanese/IsIgnoreProlongedSoundMark", // 23 - "Japanese/IsIgnoreMiddleDot" // 24 + "Japanese/IsIgnoreProlongedSoundMark", // 23 + "Japanese/IsIgnoreMiddleDot", // 24 + "IsNotes" // 25 }; const int nCount = sizeof( aPropNames ) / sizeof( aPropNames[0] ); @@ -618,7 +619,16 @@ void SvtSearchOptions::SetIgnoreMiddleDot( BOOL bVal ) pImpl->SetFlag( 24, bVal ); } +BOOL SvtSearchOptions::IsNotes() const +{ + return pImpl->GetFlag( 25 ); +} + +void SvtSearchOptions::SetNotes( BOOL bVal ) +{ + pImpl->SetFlag( 25, bVal ); +} ////////////////////////////////////////////////////////////////////// diff --git a/svtools/source/config/securityoptions.cxx b/svtools/source/config/securityoptions.cxx index ebd9898b43cd..6fdb314f9c74 100644 --- a/svtools/source/config/securityoptions.cxx +++ b/svtools/source/config/securityoptions.cxx @@ -881,7 +881,7 @@ Sequence< OUString > SvtSecurityOptions_Impl::GetSecureURLs() const void SvtSecurityOptions_Impl::SetSecureURLs( const Sequence< OUString >& seqURLList ) { - DBG_ASSERT(!m_bROSecureURLs, "SvtSecurityOptions_Impl::SetSecureURLs()\nYou tried to write on a readonly value!\n") + DBG_ASSERT(!m_bROSecureURLs, "SvtSecurityOptions_Impl::SetSecureURLs()\nYou tried to write on a readonly value!\n"); if (!m_bROSecureURLs && m_seqSecureURLs!=seqURLList) { m_seqSecureURLs = seqURLList; @@ -970,7 +970,7 @@ Sequence< SvtSecurityOptions::Certificate > SvtSecurityOptions_Impl::GetTrustedA void SvtSecurityOptions_Impl::SetTrustedAuthors( const Sequence< SvtSecurityOptions::Certificate >& rAuthors ) { - DBG_ASSERT(!m_bROTrustedAuthors, "SvtSecurityOptions_Impl::SetTrustedAuthors()\nYou tried to write on a readonly value!\n") + DBG_ASSERT(!m_bROTrustedAuthors, "SvtSecurityOptions_Impl::SetTrustedAuthors()\nYou tried to write on a readonly value!\n"); if( !m_bROTrustedAuthors && rAuthors != m_seqTrustedAuthors ) { m_seqTrustedAuthors = rAuthors; @@ -1208,7 +1208,7 @@ EBasicSecurityMode SvtSecurityOptions_Impl::GetBasicMode() const void SvtSecurityOptions_Impl::SetBasicMode( EBasicSecurityMode eMode ) { - DBG_ASSERT(!m_bROBasicMode, "SvtSecurityOptions_Impl::SetBasicMode()\nYou tried to write on a readonly value!\n") + DBG_ASSERT(!m_bROBasicMode, "SvtSecurityOptions_Impl::SetBasicMode()\nYou tried to write on a readonly value!\n"); if (!m_bROBasicMode && m_eBasicMode!=eMode) { m_eBasicMode = eMode; @@ -1223,7 +1223,7 @@ sal_Bool SvtSecurityOptions_Impl::IsExecutePlugins() const void SvtSecurityOptions_Impl::SetExecutePlugins( sal_Bool bSet ) { - DBG_ASSERT(!m_bROExecutePlugins, "SvtSecurityOptions_Impl::SetExecutePlugins()\nYou tried to write on a readonly value!\n") + DBG_ASSERT(!m_bROExecutePlugins, "SvtSecurityOptions_Impl::SetExecutePlugins()\nYou tried to write on a readonly value!\n"); if (!m_bROExecutePlugins && m_bExecutePlugins!=bSet) { m_bExecutePlugins = bSet; @@ -1238,7 +1238,7 @@ sal_Bool SvtSecurityOptions_Impl::IsWarningEnabled() const void SvtSecurityOptions_Impl::SetWarningEnabled( sal_Bool bSet ) { - DBG_ASSERT(!m_bROWarning, "SvtSecurityOptions_Impl::SetWarningEnabled()\nYou tried to write on a readonly value!\n") + DBG_ASSERT(!m_bROWarning, "SvtSecurityOptions_Impl::SetWarningEnabled()\nYou tried to write on a readonly value!\n"); if (!m_bROWarning && m_bWarning!=bSet) { m_bWarning = bSet; @@ -1253,7 +1253,7 @@ sal_Bool SvtSecurityOptions_Impl::IsConfirmationEnabled() const void SvtSecurityOptions_Impl::SetConfirmationEnabled( sal_Bool bSet ) { - DBG_ASSERT(!m_bROConfirmation, "SvtSecurityOptions_Impl::SetConfirmationEnabled()\nYou tried to write on a readonly value!\n") + DBG_ASSERT(!m_bROConfirmation, "SvtSecurityOptions_Impl::SetConfirmationEnabled()\nYou tried to write on a readonly value!\n"); if (!m_bROConfirmation && m_bConfirmation!=bSet) { m_bConfirmation = bSet; diff --git a/svtools/source/config/useroptions.cxx b/svtools/source/config/useroptions.cxx index 19b6f459290f..aad000a235f1 100644 --- a/svtools/source/config/useroptions.cxx +++ b/svtools/source/config/useroptions.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: useroptions.cxx,v $ - * $Revision: 1.25 $ + * $Revision: 1.24.238.2 $ * * This file is part of OpenOffice.org. * @@ -36,6 +36,8 @@ #define SVT_DLLIMPLEMENTATION #include <svtools/useroptions.hxx> +#include "configitems/useroptions_const.hxx" + #include <unotools/configmgr.hxx> #include <tools/debug.hxx> #include <com/sun/star/uno/Any.hxx> @@ -47,135 +49,106 @@ #include <rtl/logfile.hxx> #include "itemholder2.hxx" +#ifndef _COM_SUN_STAR_BEANS_PROPERTY_HPP_ +#include <com/sun/star/beans/Property.hpp> +#endif + +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif + +#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ +#include <com/sun/star/beans/PropertyAttribute.hpp> +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif + +#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ +#include <com/sun/star/container/XNameContainer.hpp> +#endif + +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#endif + +#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_ +#include <comphelper/configurationhelper.hxx> +#endif + +#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_ +#include <unotools/processfactory.hxx> +#endif + +#ifndef _SVT_LOGHELPER_HXX +#include "loghelper.hxx" +#endif + using namespace utl; using namespace rtl; using namespace com::sun::star::uno; +namespace css = ::com::sun::star; + // class SvtUserOptions_Impl --------------------------------------------- -class SvtUserOptions_Impl : public utl::ConfigItem, public SfxBroadcaster +class SvtUserOptions_Impl { -private: - String m_aCompany; - String m_aFirstName; - String m_aLastName; - String m_aID; - String m_aStreet; - String m_aCity; - String m_aState; - String m_aZip; - String m_aCountry; - String m_aPosition; - String m_aTitle; - String m_aTelephoneHome; - String m_aTelephoneWork; - String m_aFax; - String m_aEmail; - String m_aCustomerNumber; - String m_aFathersName; - String m_aApartment; - - String m_aEmptyString; - String m_aFullName; - String m_aLocale; - - sal_Bool m_bIsROCompany; - sal_Bool m_bIsROFirstName; - sal_Bool m_bIsROLastName; - sal_Bool m_bIsROID; - sal_Bool m_bIsROStreet; - sal_Bool m_bIsROCity; - sal_Bool m_bIsROState; - sal_Bool m_bIsROZip; - sal_Bool m_bIsROCountry; - sal_Bool m_bIsROPosition; - sal_Bool m_bIsROTitle; - sal_Bool m_bIsROTelephoneHome; - sal_Bool m_bIsROTelephoneWork; - sal_Bool m_bIsROFax; - sal_Bool m_bIsROEmail; - sal_Bool m_bIsROCustomerNumber; - sal_Bool m_bIsROFathersName; - sal_Bool m_bIsROApartment; - - typedef String SvtUserOptions_Impl:: *StrPtr; - - void SetToken( StrPtr pPtr, const String& rNewToken ); - void InitFullName(); - void Load(); - - static void InitUserPropertyNames(); public: SvtUserOptions_Impl(); ~SvtUserOptions_Impl(); - virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); - virtual void Commit(); - // get the user token - const String& GetCompany() const { return m_aCompany; } - const String& GetFirstName() const { return m_aFirstName; } - const String& GetLastName() const { return m_aLastName; } - const String& GetID() const { return m_aID; } - const String& GetStreet() const { return m_aStreet; } - const String& GetCity() const { return m_aCity; } - const String& GetState() const { return m_aState; } - const String& GetZip() const { return m_aZip; } - const String& GetCountry() const { return m_aCountry; } - const String& GetPosition() const { return m_aPosition; } - const String& GetTitle() const { return m_aTitle; } - const String& GetTelephoneHome() const { return m_aTelephoneHome; } - const String& GetTelephoneWork() const { return m_aTelephoneWork; } - const String& GetFax() const { return m_aFax; } - const String& GetEmail() const { return m_aEmail; } - const String& GetCustomerNumber() const { return m_aCustomerNumber; } - const String& GetFathersName() const { return m_aFathersName; } - const String& GetApartment() const { return m_aApartment; } - - const String& GetFullName(); - const String& GetLocale() const { return m_aLocale; } + ::rtl::OUString GetCompany() const; + ::rtl::OUString GetFirstName() const; + ::rtl::OUString GetLastName() const; + ::rtl::OUString GetID() const; + ::rtl::OUString GetStreet() const; + ::rtl::OUString GetCity() const; + ::rtl::OUString GetState() const; + ::rtl::OUString GetZip() const; + ::rtl::OUString GetCountry() const; + ::rtl::OUString GetPosition() const; + ::rtl::OUString GetTitle() const; + ::rtl::OUString GetTelephoneHome() const; + ::rtl::OUString GetTelephoneWork() const; + ::rtl::OUString GetFax() const; + ::rtl::OUString GetEmail() const; + ::rtl::OUString GetCustomerNumber() const; + ::rtl::OUString GetFathersName() const; + ::rtl::OUString GetApartment() const; + + ::rtl::OUString GetFullName() const; + ::rtl::OUString GetLocale() const { return m_aLocale; } // set the address token - void SetCompany( const String& rNewToken ) - { SetToken( &SvtUserOptions_Impl::m_aCompany, rNewToken ); } - void SetFirstName( const String& rNewToken ) - { SetToken( &SvtUserOptions_Impl::m_aFirstName, rNewToken ); InitFullName();} - void SetLastName( const String& rNewToken ) - { SetToken( &SvtUserOptions_Impl::m_aLastName, rNewToken ); InitFullName();} - void SetID( const String& rNewToken ) - { SetToken( &SvtUserOptions_Impl::m_aID, rNewToken ); } - void SetStreet( const String& rNewToken ) - { SetToken( &SvtUserOptions_Impl::m_aStreet, rNewToken ); } - void SetCity( const String& rNewToken ) - { SetToken( &SvtUserOptions_Impl::m_aCity, rNewToken ); } - void SetState( const String& rNewToken ) - { SetToken( &SvtUserOptions_Impl::m_aState, rNewToken ); } - void SetZip( const String& rNewToken ) - { SetToken( &SvtUserOptions_Impl::m_aZip, rNewToken ); } - void SetCountry( const String& rNewToken ) - { SetToken( &SvtUserOptions_Impl::m_aCountry, rNewToken ); } - void SetPosition( const String& rNewToken ) - { SetToken( &SvtUserOptions_Impl::m_aPosition, rNewToken ); } - void SetTitle( const String& rNewToken ) - { SetToken( &SvtUserOptions_Impl::m_aTitle, rNewToken ); } - void SetTelephoneHome( const String& rNewToken ) - { SetToken( &SvtUserOptions_Impl::m_aTelephoneHome, rNewToken ); } - void SetTelephoneWork( const String& rNewToken ) - { SetToken( &SvtUserOptions_Impl::m_aTelephoneWork, rNewToken ); } - void SetFax( const String& rNewToken ) - { SetToken( &SvtUserOptions_Impl::m_aFax, rNewToken ); } - void SetEmail( const String& rNewToken ) - { SetToken( &SvtUserOptions_Impl::m_aEmail, rNewToken ); } - void SetCustomerNumber( const String& rNewToken ) - { SetToken( &SvtUserOptions_Impl::m_aCustomerNumber, rNewToken ); } - void SetFathersName( const String& rNewToken ) - { SetToken( &SvtUserOptions_Impl::m_aFathersName, rNewToken ); } - void SetApartment( const String& rNewToken ) - { SetToken( &SvtUserOptions_Impl::m_aApartment, rNewToken ); } - - - sal_Bool IsTokenReadonly( USHORT nToken ) const; - const String& GetToken(USHORT nToken) const; + void SetCompany( const ::rtl::OUString& rNewToken ); + void SetFirstName( const ::rtl::OUString& rNewToken ); + void SetLastName( const ::rtl::OUString& rNewToken ); + void SetID( const ::rtl::OUString& rNewToken ); + void SetStreet( const ::rtl::OUString& rNewToken ); + void SetCity( const ::rtl::OUString& rNewToken ); + void SetState( const ::rtl::OUString& rNewToken ); + void SetZip( const ::rtl::OUString& rNewToken ); + void SetCountry( const ::rtl::OUString& rNewToken ); + void SetPosition( const ::rtl::OUString& rNewToken ); + void SetTitle( const ::rtl::OUString& rNewToken ); + void SetTelephoneHome( const ::rtl::OUString& rNewToken ); + void SetTelephoneWork( const ::rtl::OUString& rNewToken ); + void SetFax( const ::rtl::OUString& rNewToken ); + void SetEmail( const ::rtl::OUString& rNewToken ); + void SetCustomerNumber( const ::rtl::OUString& rNewToken ); + void SetFathersName( const ::rtl::OUString& rNewToken ); + void SetApartment( const ::rtl::OUString& rNewToken ); + + sal_Bool IsTokenReadonly( USHORT nToken ) const; + ::rtl::OUString GetToken(USHORT nToken) const; + +private: + css::uno::Reference< css::container::XNameAccess > m_xCfg; + css::uno::Reference< css::beans::XPropertySet > m_xData; + ::rtl::OUString m_aLocale; }; // global ---------------------------------------------------------------- @@ -193,288 +166,694 @@ namespace : public rtl::Static< Sequence< rtl::OUString >, PropertyNames> {}; } +// class SvtUserOptions_Impl --------------------------------------------- + +// ----------------------------------------------------------------------- +SvtUserOptions_Impl::SvtUserOptions_Impl() +{ + try + { + m_xCfg = Reference< css::container::XNameAccess > ( + ::comphelper::ConfigurationHelper::openConfig( + utl::getProcessServiceFactory(), + s_sData, + ::comphelper::ConfigurationHelper::E_STANDARD), + css::uno::UNO_QUERY ); + + m_xData = css::uno::Reference< css::beans::XPropertySet >(m_xCfg, css::uno::UNO_QUERY); + } + catch(const css::uno::Exception& ex) + { + m_xCfg.clear(); + LogHelper::logIt(ex); + } + + Any aAny = ConfigManager::GetConfigManager()->GetDirectConfigProperty( ConfigManager::LOCALE ); + ::rtl::OUString aLocale; + if ( aAny >>= aLocale ) + m_aLocale = aLocale; + else + { + DBG_ERRORFILE( "SvtUserOptions_Impl::SvtUserOptions_Impl(): no locale found" ); + } +} + // ----------------------------------------------------------------------- -void SvtUserOptions_Impl::InitUserPropertyNames() +SvtUserOptions_Impl::~SvtUserOptions_Impl() { - static const char* aPropNames[] = +} + +::rtl::OUString SvtUserOptions_Impl::GetCompany() const +{ + ::rtl::OUString sCompany; + + try + { + m_xData->getPropertyValue(s_so) >>= sCompany; + } + catch ( const css::uno::Exception& ex ) { - "Data/l", // USER_OPT_CITY - "Data/o", // USER_OPT_COMPANY - "Data/c", // USER_OPT_COUNTRY - "Data/mail", // USER_OPT_EMAIL - "Data/facsimiletelephonenumber",// USER_OPT_FAX - "Data/givenname", // USER_OPT_FIRSTNAME - "Data/sn", // USER_OPT_LASTNAME - "Data/position", // USER_OPT_POSITION - "Data/st", // USER_OPT_STATE - "Data/street", // USER_OPT_STREET - "Data/homephone", // USER_OPT_TELEPHONEHOME - "Data/telephonenumber", // USER_OPT_TELEPHONEWORK - "Data/title", // USER_OPT_TITLE - "Data/initials", // USER_OPT_ID - "Data/postalcode", // USER_OPT_ZIP - "Data/fathersname", // USER_OPT_FATHERSNAME - "Data/apartment" // USER_OPT_APARTMENT - }; - const int nCount = sizeof( aPropNames ) / sizeof( const char* ); - Sequence< rtl::OUString > &rPropertyNames = PropertyNames::get(); - rPropertyNames.realloc(nCount); - OUString* pNames = rPropertyNames.getArray(); - for ( int i = 0; i < nCount; i++ ) - pNames[i] = OUString::createFromAscii( aPropNames[i] ); + LogHelper::logIt(ex); + } + + return sCompany; } -// class SvtUserOptions_Impl --------------------------------------------- +::rtl::OUString SvtUserOptions_Impl::GetFirstName() const +{ + ::rtl::OUString sFirstName; + + try + { + m_xData->getPropertyValue(s_sgivenname) >>= sFirstName; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sFirstName; +} -void SvtUserOptions_Impl::SetToken( StrPtr pPtr, const String& rNewToken ) +::rtl::OUString SvtUserOptions_Impl::GetLastName() const { - this->*pPtr = rNewToken; - SetModified(); + ::rtl::OUString sLastName; + + try + { + m_xData->getPropertyValue(s_ssn) >>= sLastName; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sLastName; } -// ----------------------------------------------------------------------- +::rtl::OUString SvtUserOptions_Impl::GetID() const +{ + ::rtl::OUString sID; + + try + { + m_xData->getPropertyValue(s_sinitials) >>= sID; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } -void SvtUserOptions_Impl::InitFullName() + return sID; +} + +::rtl::OUString SvtUserOptions_Impl::GetStreet() const { - m_aFullName = GetFirstName(); - m_aFullName.EraseLeadingAndTrailingChars(); - if ( m_aFullName.Len() ) - m_aFullName += ' '; - m_aFullName += GetLastName(); - m_aFullName.EraseTrailingChars(); + ::rtl::OUString sStreet; + + try + { + m_xData->getPropertyValue(s_sstreet) >>= sStreet; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sStreet; } -// ----------------------------------------------------------------------- -SvtUserOptions_Impl::SvtUserOptions_Impl() : +::rtl::OUString SvtUserOptions_Impl::GetCity() const +{ + ::rtl::OUString sCity; - ConfigItem( OUString::createFromAscii("UserProfile") ), + try + { + m_xData->getPropertyValue(s_sl) >>= sCity; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } - m_bIsROCompany( READONLY_DEFAULT ), - m_bIsROFirstName( READONLY_DEFAULT ), - m_bIsROLastName( READONLY_DEFAULT ), - m_bIsROID( READONLY_DEFAULT ), - m_bIsROStreet( READONLY_DEFAULT ), - m_bIsROCity( READONLY_DEFAULT ), - m_bIsROState( READONLY_DEFAULT ), - m_bIsROZip( READONLY_DEFAULT ), - m_bIsROCountry( READONLY_DEFAULT ), - m_bIsROPosition( READONLY_DEFAULT ), - m_bIsROTitle( READONLY_DEFAULT ), - m_bIsROTelephoneHome( READONLY_DEFAULT ), - m_bIsROTelephoneWork( READONLY_DEFAULT ), - m_bIsROFax( READONLY_DEFAULT ), - m_bIsROEmail( READONLY_DEFAULT ), - m_bIsROCustomerNumber( READONLY_DEFAULT ), - m_bIsROFathersName( READONLY_DEFAULT ), - m_bIsROApartment( READONLY_DEFAULT ) + return sCity; +} + +::rtl::OUString SvtUserOptions_Impl::GetState() const { - InitUserPropertyNames(); - EnableNotification( PropertyNames::get() ); - Load(); - Any aAny = ConfigManager::GetConfigManager()->GetDirectConfigProperty( ConfigManager::LOCALE ); - OUString aLocale; - if ( aAny >>= aLocale ) - m_aLocale = String( aLocale ); - else + ::rtl::OUString sState; + + try { - DBG_ERRORFILE( "SvtUserOptions_Impl::SvtUserOptions_Impl(): no locale found" ); + m_xData->getPropertyValue(s_sst) >>= sState; } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sState; } -// ----------------------------------------------------------------------- -SvtUserOptions_Impl::~SvtUserOptions_Impl() +::rtl::OUString SvtUserOptions_Impl::GetZip() const { + ::rtl::OUString sZip; + + try + { + m_xData->getPropertyValue(s_spostalcode) >>= sZip; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sZip; } -// ----------------------------------------------------------------------- -void SvtUserOptions_Impl::Load() +::rtl::OUString SvtUserOptions_Impl::GetCountry() const { - Sequence< rtl::OUString > &rPropertyNames = PropertyNames::get(); - Sequence< Any > seqValues = GetProperties( rPropertyNames ); - Sequence< sal_Bool > seqRO = GetReadOnlyStates( rPropertyNames ); - const Any* pValues = seqValues.getConstArray(); - DBG_ASSERT( seqValues.getLength() == rPropertyNames.getLength(), "GetProperties failed" ); - if ( seqValues.getLength() == rPropertyNames.getLength() ) + ::rtl::OUString sCountry; + + try { - OUString aTempStr; + m_xData->getPropertyValue(s_sc) >>= sCountry; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } - for ( int nProp = 0; nProp < rPropertyNames.getLength(); nProp++ ) - { - if ( pValues[nProp].hasValue() ) - { - if ( pValues[nProp] >>= aTempStr ) - { - String* pToken = NULL; - sal_Bool* pBool = NULL; - - switch ( nProp ) - { - case USER_OPT_COMPANY: - pToken = &m_aCompany; pBool = &m_bIsROCompany; break; - case USER_OPT_FIRSTNAME: - pToken = &m_aFirstName; pBool = &m_bIsROFirstName; break; - case USER_OPT_LASTNAME: - pToken = &m_aLastName; pBool = &m_bIsROLastName; break; - case USER_OPT_ID: - pToken = &m_aID; pBool = &m_bIsROID; break; - case USER_OPT_STREET: - pToken = &m_aStreet; pBool = &m_bIsROStreet; break; - case USER_OPT_CITY: - pToken = &m_aCity; pBool = &m_bIsROCity; break; - case USER_OPT_STATE: - pToken = &m_aState; pBool = &m_bIsROState; break; - case USER_OPT_ZIP: - pToken = &m_aZip; pBool = &m_bIsROZip; break; - case USER_OPT_COUNTRY: - pToken = &m_aCountry; pBool = &m_bIsROCountry; break; - case USER_OPT_POSITION: - pToken = &m_aPosition; pBool = &m_bIsROPosition; break; - case USER_OPT_TITLE: - pToken = &m_aTitle; pBool = &m_bIsROTitle; break; - case USER_OPT_TELEPHONEHOME: - pToken = &m_aTelephoneHome; pBool = &m_bIsROTelephoneHome; break; - case USER_OPT_TELEPHONEWORK: - pToken = &m_aTelephoneWork; pBool = &m_bIsROTelephoneWork; break; - case USER_OPT_FAX: - pToken = &m_aFax; pBool = &m_bIsROFax; break; - case USER_OPT_EMAIL: - pToken = &m_aEmail; pBool = &m_bIsROEmail; break; - case USER_OPT_FATHERSNAME: - pToken = &m_aFathersName; pBool = &m_bIsROFathersName; break; - case USER_OPT_APARTMENT: - pToken = &m_aApartment; pBool = &m_bIsROApartment; break; - default: - DBG_ERRORFILE( "invalid index to load a user token" ); - } - - if ( pToken ) - *pToken = String( aTempStr ); - if ( pBool ) - *pBool = seqRO[nProp]; - } - else - { - DBG_ERRORFILE( "Wrong any type" ); - } - } - } + return sCountry; +} + +::rtl::OUString SvtUserOptions_Impl::GetPosition() const +{ + ::rtl::OUString sPosition; + + try + { + m_xData->getPropertyValue(s_sposition) >>= sPosition; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); } - InitFullName(); + + return sPosition; +} + +::rtl::OUString SvtUserOptions_Impl::GetTitle() const +{ + ::rtl::OUString sTitle; + + try + { + m_xData->getPropertyValue(s_stitle) >>= sTitle; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sTitle; } -// ----------------------------------------------------------------------- -void SvtUserOptions_Impl::Commit() +::rtl::OUString SvtUserOptions_Impl::GetTelephoneHome() const { - Sequence< rtl::OUString > &rPropertyNames = PropertyNames::get(); - sal_Int32 nOrgCount = rPropertyNames.getLength(); + ::rtl::OUString sTelephoneHome; - Sequence< OUString > seqNames( nOrgCount ); - Sequence< Any > seqValues( nOrgCount ); - sal_Int32 nRealCount = 0; + try + { + m_xData->getPropertyValue(s_shomephone) >>= sTelephoneHome; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } - OUString aTempStr; + return sTelephoneHome; +} - for ( int nProp = 0; nProp < nOrgCount; nProp++ ) +::rtl::OUString SvtUserOptions_Impl::GetTelephoneWork() const +{ + ::rtl::OUString sTelephoneWork; + + try { - sal_Bool* pbReadonly = NULL; + m_xData->getPropertyValue(s_stelephonenumber) >>= sTelephoneWork; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } - switch ( nProp ) - { - case USER_OPT_COMPANY: - aTempStr = OUString( m_aCompany ); pbReadonly = &m_bIsROCompany; break; - case USER_OPT_FIRSTNAME: - aTempStr = OUString( m_aFirstName ); pbReadonly = &m_bIsROFirstName; break; - case USER_OPT_LASTNAME: - aTempStr = OUString( m_aLastName ); pbReadonly = &m_bIsROLastName; break; - case USER_OPT_ID: - aTempStr = OUString( m_aID ); pbReadonly = &m_bIsROID; break; - case USER_OPT_STREET: - aTempStr = OUString( m_aStreet ); pbReadonly = &m_bIsROStreet; break; - case USER_OPT_CITY: - aTempStr = OUString( m_aCity ); pbReadonly = &m_bIsROCity; break; - case USER_OPT_STATE: - aTempStr = OUString( m_aState ); pbReadonly = &m_bIsROState; break; - case USER_OPT_ZIP: - aTempStr = OUString( m_aZip ); pbReadonly = &m_bIsROZip; break; - case USER_OPT_COUNTRY: - aTempStr = OUString( m_aCountry ); pbReadonly = &m_bIsROCountry; break; - case USER_OPT_POSITION: - aTempStr = OUString( m_aPosition ); pbReadonly = &m_bIsROPosition; break; - case USER_OPT_TITLE: - aTempStr = OUString( m_aTitle ); pbReadonly = &m_bIsROTitle; break; - case USER_OPT_TELEPHONEHOME: - aTempStr = OUString( m_aTelephoneHome ); pbReadonly = &m_bIsROTelephoneHome; break; - case USER_OPT_TELEPHONEWORK: - aTempStr = OUString( m_aTelephoneWork ); pbReadonly = &m_bIsROTelephoneWork; break; - case USER_OPT_FAX: - aTempStr = OUString( m_aFax ); pbReadonly = &m_bIsROFax; break; - case USER_OPT_EMAIL: - aTempStr = OUString( m_aEmail ); pbReadonly = &m_bIsROEmail; break; - case USER_OPT_FATHERSNAME: - aTempStr = OUString( m_aFathersName ); pbReadonly = &m_bIsROFathersName; break; - case USER_OPT_APARTMENT: - aTempStr = OUString( m_aApartment ); pbReadonly = &m_bIsROApartment; break; - default: - DBG_ERRORFILE( "invalid index to save a user token" ); - } + return sTelephoneWork; +} - if ( pbReadonly && !(*pbReadonly) ) - { - seqValues[nRealCount] <<= aTempStr; - seqNames[nRealCount] = rPropertyNames[nProp]; - ++nRealCount; - } +::rtl::OUString SvtUserOptions_Impl::GetFax() const +{ + ::rtl::OUString sFax; + + try + { + m_xData->getPropertyValue(s_sfacsimiletelephonenumber) >>= sFax; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); } - // Set properties in configuration. - seqNames.realloc( nRealCount ); - seqValues.realloc( nRealCount ); - PutProperties( seqNames, seqValues ); - //broadcast changes - Broadcast(SfxSimpleHint(SFX_HINT_USER_OPTIONS_CHANGED)); + return sFax; } -// ----------------------------------------------------------------------- +::rtl::OUString SvtUserOptions_Impl::GetEmail() const +{ + ::rtl::OUString sEmail; + + try + { + m_xData->getPropertyValue(s_smail) >>= sEmail; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sEmail; +} + +::rtl::OUString SvtUserOptions_Impl::GetCustomerNumber() const +{ + ::rtl::OUString sCustomerNumber; + + try + { + m_xData->getPropertyValue(s_scustomernumber) >>= sCustomerNumber; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sCustomerNumber; +} + +::rtl::OUString SvtUserOptions_Impl::GetFathersName() const +{ + ::rtl::OUString sFathersName; + + try + { + m_xData->getPropertyValue(s_sfathersname) >>= sFathersName; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sFathersName; +} + +::rtl::OUString SvtUserOptions_Impl::GetApartment() const +{ + ::rtl::OUString sApartment; + + try + { + m_xData->getPropertyValue(s_sapartment) >>= sApartment; + } + catch ( const css::uno::Exception& ex ) + { + LogHelper::logIt(ex); + } + + return sApartment; +} + +void SvtUserOptions_Impl::SetCompany( const ::rtl::OUString& sCompany ) +{ + try + { + m_xData->setPropertyValue(s_so, css::uno::makeAny(::rtl::OUString(sCompany))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetFirstName( const ::rtl::OUString& sFirstName ) +{ + try + { + m_xData->setPropertyValue(s_sgivenname, css::uno::makeAny(::rtl::OUString(sFirstName))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetLastName( const ::rtl::OUString& sLastName ) +{ + try + { + m_xData->setPropertyValue(s_ssn, css::uno::makeAny(::rtl::OUString(sLastName))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} +void SvtUserOptions_Impl::SetID( const ::rtl::OUString& sID ) +{ + try + { + m_xData->setPropertyValue(s_sinitials, css::uno::makeAny(::rtl::OUString(sID))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} -const String& SvtUserOptions_Impl::GetFullName() +void SvtUserOptions_Impl::SetStreet( const ::rtl::OUString& sStreet ) { - if ( IsModified() ) - InitFullName(); - return m_aFullName; + try + { + m_xData->setPropertyValue(s_sstreet, css::uno::makeAny(::rtl::OUString(sStreet))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetCity( const ::rtl::OUString& sCity ) +{ + try + { + m_xData->setPropertyValue(s_sl, css::uno::makeAny(::rtl::OUString(sCity))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetState( const ::rtl::OUString& sState ) +{ + try + { + m_xData->setPropertyValue(s_sst, css::uno::makeAny(::rtl::OUString(sState))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetZip( const ::rtl::OUString& sZip ) +{ + try + { + m_xData->setPropertyValue(s_spostalcode, css::uno::makeAny(::rtl::OUString(sZip))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetCountry( const ::rtl::OUString& sCountry ) +{ + try + { + m_xData->setPropertyValue(s_sc, css::uno::makeAny(::rtl::OUString(sCountry))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetPosition( const ::rtl::OUString& sPosition ) +{ + try + { + m_xData->setPropertyValue(s_sposition, css::uno::makeAny(::rtl::OUString(sPosition))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetTitle( const ::rtl::OUString& sTitle ) +{ + try + { + m_xData->setPropertyValue(s_stitle, css::uno::makeAny(::rtl::OUString(sTitle))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetTelephoneHome( const ::rtl::OUString& sTelephoneHome ) +{ + try + { + m_xData->setPropertyValue(s_shomephone, css::uno::makeAny(::rtl::OUString(sTelephoneHome))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetTelephoneWork( const ::rtl::OUString& sTelephoneWork ) +{ + try + { + m_xData->setPropertyValue(s_stelephonenumber, css::uno::makeAny(::rtl::OUString(sTelephoneWork))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetFax( const ::rtl::OUString& sFax ) +{ + try + { + m_xData->setPropertyValue(s_sfacsimiletelephonenumber, css::uno::makeAny(::rtl::OUString(sFax))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetEmail( const ::rtl::OUString& sEmail ) +{ + try + { + m_xData->setPropertyValue(s_smail, css::uno::makeAny(::rtl::OUString(sEmail))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetCustomerNumber( const ::rtl::OUString& sCustomerNumber ) +{ + try + { + m_xData->setPropertyValue(s_scustomernumber, css::uno::makeAny(::rtl::OUString(sCustomerNumber))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetFathersName( const ::rtl::OUString& sFathersName ) +{ + try + { + m_xData->setPropertyValue(s_sfathersname, css::uno::makeAny(::rtl::OUString(sFathersName))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } +} + +void SvtUserOptions_Impl::SetApartment( const ::rtl::OUString& sApartment ) +{ + try + { + m_xData->setPropertyValue(s_sapartment, css::uno::makeAny(::rtl::OUString(sApartment))); + ::comphelper::ConfigurationHelper::flush(m_xCfg); + } + catch ( const css::uno::Exception& ex) + { + LogHelper::logIt(ex); + } } // ----------------------------------------------------------------------- -void SvtUserOptions_Impl::Notify( const Sequence<rtl::OUString>& ) +::rtl::OUString SvtUserOptions_Impl::GetFullName() const { - Load(); - Broadcast(SfxSimpleHint(SFX_HINT_USER_OPTIONS_CHANGED)); + ::rtl::OUString sFullName; + + sFullName = GetFirstName(); + sFullName.trim(); + if ( sFullName.getLength() ) + sFullName += ::rtl::OUString::createFromAscii(" "); + sFullName += GetLastName(); + sFullName.trim(); + + return sFullName; } // ----------------------------------------------------------------------- sal_Bool SvtUserOptions_Impl::IsTokenReadonly( USHORT nToken ) const { - sal_Bool bRet = sal_False; + css::uno::Reference< css::beans::XPropertySet > xData(m_xCfg, css::uno::UNO_QUERY); + css::uno::Reference< css::beans::XPropertySetInfo > xInfo = xData->getPropertySetInfo(); + css::beans::Property aProp; + sal_Bool bRet = sal_False; switch ( nToken ) { - case USER_OPT_COMPANY: bRet = m_bIsROCompany; break; - case USER_OPT_FIRSTNAME: bRet = m_bIsROFirstName; break; - case USER_OPT_LASTNAME: bRet = m_bIsROLastName; break; - case USER_OPT_ID: bRet = m_bIsROID; break; - case USER_OPT_STREET: bRet = m_bIsROStreet; break; - case USER_OPT_CITY: bRet = m_bIsROCity; break; - case USER_OPT_STATE: bRet = m_bIsROState; break; - case USER_OPT_ZIP: bRet = m_bIsROZip; break; - case USER_OPT_COUNTRY: bRet = m_bIsROCountry; break; - case USER_OPT_POSITION: bRet = m_bIsROPosition; break; - case USER_OPT_TITLE: bRet = m_bIsROTitle; break; - case USER_OPT_TELEPHONEHOME: bRet = m_bIsROTelephoneHome; break; - case USER_OPT_TELEPHONEWORK: bRet = m_bIsROTelephoneWork; break; - case USER_OPT_FAX: bRet = m_bIsROFax; break; - case USER_OPT_EMAIL: bRet = m_bIsROEmail; break; + case USER_OPT_COMPANY: + { + aProp = xInfo->getPropertyByName(s_so); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_FIRSTNAME: + { + aProp = xInfo->getPropertyByName(s_sgivenname); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_LASTNAME: + { + aProp = xInfo->getPropertyByName(s_ssn); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_ID: + { + aProp = xInfo->getPropertyByName(s_sinitials); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_STREET: + { + aProp = xInfo->getPropertyByName(s_sstreet); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_CITY: + { + aProp = xInfo->getPropertyByName(s_sl); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_STATE: + { + aProp = xInfo->getPropertyByName(s_sst); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_ZIP: + { + aProp = xInfo->getPropertyByName(s_spostalcode); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_COUNTRY: + { + aProp = xInfo->getPropertyByName(s_sc); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_POSITION: + { + aProp = xInfo->getPropertyByName(s_sposition); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_TITLE: + { + aProp = xInfo->getPropertyByName(s_stitle); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_TELEPHONEHOME: + { + aProp = xInfo->getPropertyByName(s_shomephone); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_TELEPHONEWORK: + { + aProp = xInfo->getPropertyByName(s_stelephonenumber); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_FAX: + { + aProp = xInfo->getPropertyByName(s_sfacsimiletelephonenumber); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_EMAIL: + { + aProp = xInfo->getPropertyByName(s_smail); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_FATHERSNAME: + { + aProp = xInfo->getPropertyByName(s_sfathersname); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } + case USER_OPT_APARTMENT: + { + aProp = xInfo->getPropertyByName(s_sapartment); + bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY); + break; + } default: DBG_ERRORFILE( "SvtUserOptions_Impl::IsTokenReadonly(): invalid token" ); } @@ -483,32 +862,32 @@ sal_Bool SvtUserOptions_Impl::IsTokenReadonly( USHORT nToken ) const } //------------------------------------------------------------------------ -const String& SvtUserOptions_Impl::GetToken(USHORT nToken) const +::rtl::OUString SvtUserOptions_Impl::GetToken(USHORT nToken) const { - const String* pRet = 0; + ::rtl::OUString pRet; switch(nToken) { - case USER_OPT_COMPANY: pRet = &m_aCompany; break; - case USER_OPT_FIRSTNAME: pRet = &m_aFirstName; break; - case USER_OPT_LASTNAME: pRet = &m_aLastName; break; - case USER_OPT_ID: pRet = &m_aID; break; - case USER_OPT_STREET: pRet = &m_aStreet; break; - case USER_OPT_CITY: pRet = &m_aCity; break; - case USER_OPT_STATE: pRet = &m_aState; break; - case USER_OPT_ZIP: pRet = &m_aZip; break; - case USER_OPT_COUNTRY: pRet = &m_aCountry; break; - case USER_OPT_POSITION: pRet = &m_aPosition; break; - case USER_OPT_TITLE: pRet = &m_aTitle; break; - case USER_OPT_TELEPHONEHOME: pRet = &m_aTelephoneHome; break; - case USER_OPT_TELEPHONEWORK: pRet = &m_aTelephoneWork; break; - case USER_OPT_FAX: pRet = &m_aFax; break; - case USER_OPT_EMAIL: pRet = &m_aEmail; break; - case USER_OPT_FATHERSNAME: pRet = &m_aFathersName; break; - case USER_OPT_APARTMENT: pRet = &m_aApartment; break; + case USER_OPT_COMPANY: pRet = GetCompany(); break; + case USER_OPT_FIRSTNAME: pRet = GetFirstName(); break; + case USER_OPT_LASTNAME: pRet = GetLastName(); break; + case USER_OPT_ID: pRet = GetID(); break; + case USER_OPT_STREET: pRet = GetStreet(); break; + case USER_OPT_CITY: pRet = GetCity(); break; + case USER_OPT_STATE: pRet = GetState(); break; + case USER_OPT_ZIP: pRet = GetZip(); break; + case USER_OPT_COUNTRY: pRet = GetCountry(); break; + case USER_OPT_POSITION: pRet = GetPosition(); break; + case USER_OPT_TITLE: pRet = GetTitle(); break; + case USER_OPT_TELEPHONEHOME: pRet = GetTelephoneHome(); break; + case USER_OPT_TELEPHONEWORK: pRet = GetTelephoneWork(); break; + case USER_OPT_FAX: pRet = GetFax(); break; + case USER_OPT_EMAIL: pRet = GetEmail(); break; + case USER_OPT_FATHERSNAME: pRet = GetFathersName(); break; + case USER_OPT_APARTMENT: pRet = GetApartment(); break; default: DBG_ERRORFILE( "SvtUserOptions_Impl::GetToken(): invalid token" ); } - return *pRet; + return pRet; } // class SvtUserOptions -------------------------------------------------- @@ -527,7 +906,7 @@ SvtUserOptions::SvtUserOptions() } ++nRefCount; pImp = pOptions; - StartListening( *pImp); + //StartListening( *pImp); } // ----------------------------------------------------------------------- @@ -539,8 +918,8 @@ SvtUserOptions::~SvtUserOptions() if ( !--nRefCount ) { - if ( pOptions->IsModified() ) - pOptions->Commit(); + //if ( pOptions->IsModified() ) + // pOptions->Commit(); DELETEZ( pOptions ); } } @@ -572,7 +951,7 @@ SvtUserOptions::~SvtUserOptions() // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetCompany() const +::rtl::OUString SvtUserOptions::GetCompany() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetCompany(); @@ -580,7 +959,7 @@ const String& SvtUserOptions::GetCompany() const // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetFirstName() const +::rtl::OUString SvtUserOptions::GetFirstName() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetFirstName(); @@ -588,7 +967,7 @@ const String& SvtUserOptions::GetFirstName() const // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetLastName() const +::rtl::OUString SvtUserOptions::GetLastName() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetLastName(); @@ -596,7 +975,7 @@ const String& SvtUserOptions::GetLastName() const // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetID() const +::rtl::OUString SvtUserOptions::GetID() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetID(); @@ -604,7 +983,7 @@ const String& SvtUserOptions::GetID() const // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetStreet() const +::rtl::OUString SvtUserOptions::GetStreet() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetStreet(); @@ -612,7 +991,7 @@ const String& SvtUserOptions::GetStreet() const // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetCity() const +::rtl::OUString SvtUserOptions::GetCity() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetCity(); @@ -620,7 +999,7 @@ const String& SvtUserOptions::GetCity() const // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetState() const +::rtl::OUString SvtUserOptions::GetState() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetState(); @@ -628,7 +1007,7 @@ const String& SvtUserOptions::GetState() const // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetZip() const +::rtl::OUString SvtUserOptions::GetZip() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetZip(); @@ -636,7 +1015,7 @@ const String& SvtUserOptions::GetZip() const // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetCountry() const +::rtl::OUString SvtUserOptions::GetCountry() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetCountry(); @@ -644,7 +1023,7 @@ const String& SvtUserOptions::GetCountry() const // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetPosition() const +::rtl::OUString SvtUserOptions::GetPosition() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetPosition(); @@ -652,7 +1031,7 @@ const String& SvtUserOptions::GetPosition() const // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetTitle() const +::rtl::OUString SvtUserOptions::GetTitle() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetTitle(); @@ -660,7 +1039,7 @@ const String& SvtUserOptions::GetTitle() const // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetTelephoneHome() const +::rtl::OUString SvtUserOptions::GetTelephoneHome() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetTelephoneHome(); @@ -668,7 +1047,7 @@ const String& SvtUserOptions::GetTelephoneHome() const // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetTelephoneWork() const +::rtl::OUString SvtUserOptions::GetTelephoneWork() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetTelephoneWork(); @@ -676,7 +1055,7 @@ const String& SvtUserOptions::GetTelephoneWork() const // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetFax() const +::rtl::OUString SvtUserOptions::GetFax() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetFax(); @@ -684,7 +1063,7 @@ const String& SvtUserOptions::GetFax() const // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetEmail() const +::rtl::OUString SvtUserOptions::GetEmail() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetEmail(); @@ -692,14 +1071,14 @@ const String& SvtUserOptions::GetEmail() const // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetCustomerNumber() const +::rtl::OUString SvtUserOptions::GetCustomerNumber() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetCustomerNumber(); } // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetFathersName() const +::rtl::OUString SvtUserOptions::GetFathersName() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetFathersName() ; @@ -707,7 +1086,7 @@ const String& SvtUserOptions::GetFathersName() const // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetApartment() const +::rtl::OUString SvtUserOptions::GetApartment() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetApartment(); @@ -715,7 +1094,7 @@ const String& SvtUserOptions::GetApartment() const // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetFullName() const +::rtl::OUString SvtUserOptions::GetFullName() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetFullName(); @@ -723,7 +1102,7 @@ const String& SvtUserOptions::GetFullName() const // ----------------------------------------------------------------------- -const String& SvtUserOptions::GetLocale() const +::rtl::OUString SvtUserOptions::GetLocale() const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetLocale(); @@ -731,7 +1110,7 @@ const String& SvtUserOptions::GetLocale() const // ----------------------------------------------------------------------- -void SvtUserOptions::SetCompany( const String& rNewToken ) +void SvtUserOptions::SetCompany( const ::rtl::OUString& rNewToken ) { ::osl::MutexGuard aGuard( GetInitMutex() ); pImp->SetCompany( rNewToken ); @@ -739,7 +1118,7 @@ void SvtUserOptions::SetCompany( const String& rNewToken ) // ----------------------------------------------------------------------- -void SvtUserOptions::SetFirstName( const String& rNewToken ) +void SvtUserOptions::SetFirstName( const ::rtl::OUString& rNewToken ) { ::osl::MutexGuard aGuard( GetInitMutex() ); pImp->SetFirstName( rNewToken ); @@ -747,7 +1126,7 @@ void SvtUserOptions::SetFirstName( const String& rNewToken ) // ----------------------------------------------------------------------- -void SvtUserOptions::SetLastName( const String& rNewToken ) +void SvtUserOptions::SetLastName( const ::rtl::OUString& rNewToken ) { ::osl::MutexGuard aGuard( GetInitMutex() ); pImp->SetLastName( rNewToken ); @@ -755,7 +1134,7 @@ void SvtUserOptions::SetLastName( const String& rNewToken ) // ----------------------------------------------------------------------- -void SvtUserOptions::SetID( const String& rNewToken ) +void SvtUserOptions::SetID( const ::rtl::OUString& rNewToken ) { ::osl::MutexGuard aGuard( GetInitMutex() ); pImp->SetID( rNewToken ); @@ -763,7 +1142,7 @@ void SvtUserOptions::SetID( const String& rNewToken ) // ----------------------------------------------------------------------- -void SvtUserOptions::SetStreet( const String& rNewToken ) +void SvtUserOptions::SetStreet( const ::rtl::OUString& rNewToken ) { ::osl::MutexGuard aGuard( GetInitMutex() ); pImp->SetStreet( rNewToken ); @@ -771,7 +1150,7 @@ void SvtUserOptions::SetStreet( const String& rNewToken ) // ----------------------------------------------------------------------- -void SvtUserOptions::SetCity( const String& rNewToken ) +void SvtUserOptions::SetCity( const ::rtl::OUString& rNewToken ) { ::osl::MutexGuard aGuard( GetInitMutex() ); pImp->SetCity( rNewToken ); @@ -779,7 +1158,7 @@ void SvtUserOptions::SetCity( const String& rNewToken ) // ----------------------------------------------------------------------- -void SvtUserOptions::SetState( const String& rNewToken ) +void SvtUserOptions::SetState( const ::rtl::OUString& rNewToken ) { ::osl::MutexGuard aGuard( GetInitMutex() ); pImp->SetState( rNewToken ); @@ -787,7 +1166,7 @@ void SvtUserOptions::SetState( const String& rNewToken ) // ----------------------------------------------------------------------- -void SvtUserOptions::SetZip( const String& rNewToken ) +void SvtUserOptions::SetZip( const ::rtl::OUString& rNewToken ) { ::osl::MutexGuard aGuard( GetInitMutex() ); pImp->SetZip( rNewToken ); @@ -795,7 +1174,7 @@ void SvtUserOptions::SetZip( const String& rNewToken ) // ----------------------------------------------------------------------- -void SvtUserOptions::SetCountry( const String& rNewToken ) +void SvtUserOptions::SetCountry( const ::rtl::OUString& rNewToken ) { ::osl::MutexGuard aGuard( GetInitMutex() ); pImp->SetCountry( rNewToken ); @@ -803,7 +1182,7 @@ void SvtUserOptions::SetCountry( const String& rNewToken ) // ----------------------------------------------------------------------- -void SvtUserOptions::SetPosition( const String& rNewToken ) +void SvtUserOptions::SetPosition( const ::rtl::OUString& rNewToken ) { ::osl::MutexGuard aGuard( GetInitMutex() ); pImp->SetPosition( rNewToken ); @@ -811,7 +1190,7 @@ void SvtUserOptions::SetPosition( const String& rNewToken ) // ----------------------------------------------------------------------- -void SvtUserOptions::SetTitle( const String& rNewToken ) +void SvtUserOptions::SetTitle( const ::rtl::OUString& rNewToken ) { ::osl::MutexGuard aGuard( GetInitMutex() ); pImp->SetTitle( rNewToken ); @@ -819,7 +1198,7 @@ void SvtUserOptions::SetTitle( const String& rNewToken ) // ----------------------------------------------------------------------- -void SvtUserOptions::SetTelephoneHome( const String& rNewToken ) +void SvtUserOptions::SetTelephoneHome( const ::rtl::OUString& rNewToken ) { ::osl::MutexGuard aGuard( GetInitMutex() ); pImp->SetTelephoneHome( rNewToken ); @@ -827,7 +1206,7 @@ void SvtUserOptions::SetTelephoneHome( const String& rNewToken ) // ----------------------------------------------------------------------- -void SvtUserOptions::SetTelephoneWork( const String& rNewToken ) +void SvtUserOptions::SetTelephoneWork( const ::rtl::OUString& rNewToken ) { ::osl::MutexGuard aGuard( GetInitMutex() ); pImp->SetTelephoneWork( rNewToken ); @@ -835,7 +1214,7 @@ void SvtUserOptions::SetTelephoneWork( const String& rNewToken ) // ----------------------------------------------------------------------- -void SvtUserOptions::SetFax( const String& rNewToken ) +void SvtUserOptions::SetFax( const ::rtl::OUString& rNewToken ) { ::osl::MutexGuard aGuard( GetInitMutex() ); pImp->SetFax( rNewToken ); @@ -843,7 +1222,7 @@ void SvtUserOptions::SetFax( const String& rNewToken ) // ----------------------------------------------------------------------- -void SvtUserOptions::SetEmail( const String& rNewToken ) +void SvtUserOptions::SetEmail( const ::rtl::OUString& rNewToken ) { ::osl::MutexGuard aGuard( GetInitMutex() ); pImp->SetEmail( rNewToken ); @@ -851,14 +1230,14 @@ void SvtUserOptions::SetEmail( const String& rNewToken ) // ----------------------------------------------------------------------- -void SvtUserOptions::SetCustomerNumber( const String& rNewToken ) +void SvtUserOptions::SetCustomerNumber( const ::rtl::OUString& rNewToken ) { ::osl::MutexGuard aGuard( GetInitMutex() ); pImp->SetCustomerNumber( rNewToken ); } // ----------------------------------------------------------------------- -void SvtUserOptions::SetFathersName( const String& rNewToken ) +void SvtUserOptions::SetFathersName( const ::rtl::OUString& rNewToken ) { ::osl::MutexGuard aGuard( GetInitMutex() ); pImp->SetFathersName( rNewToken ); @@ -866,7 +1245,7 @@ void SvtUserOptions::SetFathersName( const String& rNewToken ) // ----------------------------------------------------------------------- -void SvtUserOptions::SetApartment( const String& rNewToken ) +void SvtUserOptions::SetApartment( const ::rtl::OUString& rNewToken ) { ::osl::MutexGuard aGuard( GetInitMutex() ); pImp->SetApartment( rNewToken ); @@ -880,7 +1259,7 @@ sal_Bool SvtUserOptions::IsTokenReadonly( USHORT nToken ) const return pImp->IsTokenReadonly( nToken ); } //------------------------------------------------------------------------ -const String& SvtUserOptions::GetToken(USHORT nToken) const +::rtl::OUString SvtUserOptions::GetToken(USHORT nToken) const { ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetToken( nToken ); @@ -893,4 +1272,3 @@ void SvtUserOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) vos::OGuard aVclGuard( Application::GetSolarMutex() ); Broadcast( rHint ); } - diff --git a/svtools/source/config/viewoptions.cxx b/svtools/source/config/viewoptions.cxx index 8ef5e95c203d..d4c8d65dbe04 100644 --- a/svtools/source/config/viewoptions.cxx +++ b/svtools/source/config/viewoptions.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: viewoptions.cxx,v $ - * $Revision: 1.30 $ + * $Revision: 1.29.236.2 $ * * This file is part of OpenOffice.org. * @@ -382,9 +382,7 @@ SvtViewOptionsBase_Impl::SvtViewOptionsBase_Impl( const ::rtl::OUString& sList ) /*-************************************************************************************************************//** @short dtor - @descr If something was changed on our internal cached values - baselcass can tell us that by return value - of method "IsModified()". So we should flush these changes by calling "Commit()" of our own instance. - It's an auto-save. Normaly user of these object should do that explicitly! + @descr clean up something @attention We implement a write through cache! So we mustn't do it realy. All changes was written to cfg directly. Commit isn't neccessary then. @@ -401,15 +399,10 @@ SvtViewOptionsBase_Impl::SvtViewOptionsBase_Impl( const ::rtl::OUString& sList ) *//*-*************************************************************************************************************/ SvtViewOptionsBase_Impl::~SvtViewOptionsBase_Impl() { - try - { - if (m_xRoot.is()) - ::comphelper::ConfigurationHelper::flush(m_xRoot); - } - catch(const css::uno::Exception& ex) - { - SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) - } + // dont flush configuration changes here to m_xRoot. + // That must be done inside every SetXXX() method already ! + // Here its to late - DisposedExceptions from used configuration access can occure otherwise. + m_xRoot.clear(); m_xSet.clear(); diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index ff223553c6fc..ade5841a1f7a 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -684,8 +684,8 @@ OUString CreateExactSizeText_Impl( sal_Int64 nSize ) double fSize( ( double ) nSize ); int nDec; - ULONG nMega = 1024 * 1024; - ULONG nGiga = nMega * 1024; + long nMega = 1024 * 1024; + long nGiga = nMega * 1024; String aUnitStr = ' '; diff --git a/svtools/source/contnr/svicnvw.cxx b/svtools/source/contnr/svicnvw.cxx index c00af7312e1d..978a50395e8e 100644 --- a/svtools/source/contnr/svicnvw.cxx +++ b/svtools/source/contnr/svicnvw.cxx @@ -538,7 +538,7 @@ void SvIconView::EditingRequest( SvLBoxEntry* pEntry, SvLBoxItem* pItem, void SvIconView::EditItemText( SvLBoxEntry* pEntry, SvLBoxItem* pItem, const Selection& rSel ) { - DBG_ASSERT(pEntry&&pItem,"EditItemText:Params?") + DBG_ASSERT(pEntry&&pItem,"EditItemText:Params?"); pCurEdEntry = pEntry; pCurEdItem = pItem; Rectangle aRect( pImp->CalcTextRect( pEntry, (SvLBoxString*)pItem,0,TRUE )); diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index 796a154d0585..32b37d3fdf7f 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -681,7 +681,7 @@ void SvImpLBox::SetCursor( SvLBoxEntry* pEntry, BOOL bForceNoSelect ) if( pAnchor ) { - DBG_ASSERT(aSelEng.GetSelectionMode() != SINGLE_SELECTION,"Mode?") + DBG_ASSERT(aSelEng.GetSelectionMode() != SINGLE_SELECTION,"Mode?"); SetAnchorSelection( pOldCursor, pCursor ); } } @@ -1097,7 +1097,7 @@ void SvImpLBox::DrawNet() long nY = 0; nY -= ( nOffs * nEntryHeight ); - DBG_ASSERT(pFirstDynamicTab,"No Tree!") + DBG_ASSERT(pFirstDynamicTab,"No Tree!"); Color aOldLineColor = pView->GetLineColor(); const StyleSettings& rStyleSettings = pView->GetSettings().GetStyleSettings(); @@ -1126,7 +1126,7 @@ void SvImpLBox::DrawNet() aPos1.Y() += nEntryHeightDIV2; pChild = pView->FirstChild( pEntry ); - DBG_ASSERT(pChild,"Child?") + DBG_ASSERT(pChild,"Child?"); pChild = pTree->LastSibling( pChild ); nDistance = (USHORT)(pView->GetVisiblePos(pChild) - pView->GetVisiblePos(pEntry)); @@ -1697,7 +1697,7 @@ void SvImpLBox::EntrySelected( SvLBoxEntry* pEntry, BOOL bSelect ) pEntry != pCursor ) { SetCursor( pEntry ); - DBG_ASSERT(pView->GetSelectionCount()==1,"selection count?") + DBG_ASSERT(pView->GetSelectionCount()==1,"selection count?"); } if( GetUpdateMode() && pView->IsEntryVisible(pEntry) ) @@ -2430,7 +2430,7 @@ BOOL SvImpLBox::KeyInput( const KeyEvent& rKEvt) if( nDelta ) { - DBG_ASSERT(pNewCursor&&(ULONG)pNewCursor!=(ULONG)pCursor,"Cursor?") + DBG_ASSERT(pNewCursor&&(ULONG)pNewCursor!=(ULONG)pCursor,"Cursor?"); aSelEng.CursorPosChanging( bShift, bMod1 ); if( IsEntryInView( pNewCursor ) ) SetCursor( pNewCursor ); @@ -2458,7 +2458,7 @@ BOOL SvImpLBox::KeyInput( const KeyEvent& rKEvt) if( nDelta ) { - DBG_ASSERT(pNewCursor&&(ULONG)pNewCursor!=(ULONG)pCursor,"Cursor?") + DBG_ASSERT(pNewCursor&&(ULONG)pNewCursor!=(ULONG)pCursor,"Cursor?"); aSelEng.CursorPosChanging( bShift, bMod1 ); if( IsEntryInView( pNewCursor ) ) SetCursor( pNewCursor ); diff --git a/svtools/source/contnr/svimpicn.cxx b/svtools/source/contnr/svimpicn.cxx index e2d7bf551b82..37ee096dc6d9 100644 --- a/svtools/source/contnr/svimpicn.cxx +++ b/svtools/source/contnr/svimpicn.cxx @@ -1029,7 +1029,7 @@ void SvImpIconView::EntrySelected( SvLBoxEntry* pEntry, BOOL bSelect ) pEntry != pCursor ) { SetCursor( pEntry ); - DBG_ASSERT(pView->GetSelectionCount()==1,"selection count?") + DBG_ASSERT(pView->GetSelectionCount()==1,"selection count?"); } // bei Gummibandselektion ist uns das zu teuer if( !(nFlags & F_RUBBERING )) @@ -2301,7 +2301,7 @@ SvLBoxEntry* SvImpIconView::GetPrevEntry( const Point& rDocPos, SvLBoxEntry* pCu Point SvImpIconView::GetEntryPosition( SvLBoxEntry* pEntry ) { SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - DBG_ASSERT(pViewData,"Entry not in model") + DBG_ASSERT(pViewData,"Entry not in model"); return pViewData->aRect.TopLeft(); } @@ -2309,7 +2309,7 @@ const Rectangle& SvImpIconView::GetBoundingRect( SvLBoxEntry* pEntry, SvIcnVwDat { if( !pViewData ) pViewData = ICNVIEWDATA(pEntry); - DBG_ASSERT(pViewData,"Entry not in model") + DBG_ASSERT(pViewData,"Entry not in model"); if( !IsBoundingRectValid( pViewData->aRect )) FindBoundingRect( pEntry, pViewData ); return pViewData->aRect; @@ -2430,8 +2430,8 @@ Rectangle SvImpIconView::CalcTextRect( SvLBoxEntry* pEntry, 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") + 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(); @@ -2460,8 +2460,8 @@ long SvImpIconView::CalcBoundingWidth( SvLBoxEntry* pEntry, 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") + 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; @@ -3785,7 +3785,7 @@ void SvImpIconView::SelectRect( const Rectangle& rRect, BOOL bAdd, SvLBoxEntry* pEntry = (SvLBoxEntry*)(pZOrderList->GetObject(nPos )); SvIcnVwDataEntry* pViewData = ICNVIEWDATA(pEntry); - DBG_ASSERT(pViewData,"Entry not in model") + DBG_ASSERT(pViewData,"Entry not in model"); if( !IsBoundingRectValid( pViewData->aRect )) FindBoundingRect( pEntry, pViewData ); const Rectangle& rBoundRect = pViewData->aRect; diff --git a/svtools/source/contnr/svlbox.cxx b/svtools/source/contnr/svlbox.cxx index 6056a200e598..1c81343cd84f 100644 --- a/svtools/source/contnr/svlbox.cxx +++ b/svtools/source/contnr/svlbox.cxx @@ -636,7 +636,7 @@ void SvLBoxEntry::EnableChildsOnDemand( BOOL bEnable ) void SvLBoxEntry::ReplaceItem( SvLBoxItem* pNewItem, USHORT nPos ) { DBG_CHKTHIS(SvLBoxEntry,0); - DBG_ASSERT(pNewItem,"ReplaceItem:No Item") + DBG_ASSERT(pNewItem,"ReplaceItem:No Item"); SvLBoxItem* pOld = GetItem( nPos ); if ( pOld ) { @@ -939,7 +939,7 @@ BOOL SvLBox::NotifyMoving( #endif { DBG_CHKTHIS(SvLBox,0); - DBG_ASSERT(pEntry,"NotifyMoving:SoureEntry?") + DBG_ASSERT(pEntry,"NotifyMoving:SoureEntry?"); if( !pTarget ) { rpNewParent = 0; @@ -976,7 +976,7 @@ BOOL SvLBox::NotifyCopying( DBG_CHKTHIS(SvLBox,0); return NotifyMoving(pTarget,pEntry,rpNewParent,rNewChildPos); /* - DBG_ASSERT(pEntry,"NotifyCopying:SourceEntry?") + DBG_ASSERT(pEntry,"NotifyCopying:SourceEntry?"); if( !pTarget ) { rpNewParent = 0; @@ -1176,7 +1176,7 @@ SvLBox* SvLBox::GetTargetView() const void SvLBox::RequestingChilds( SvLBoxEntry* ) { DBG_CHKTHIS(SvLBox,0); - DBG_ERROR("Child-Request-Hdl not implemented!") + DBG_ERROR("Child-Request-Hdl not implemented!"); } void SvLBox::RecalcViewData() diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index d281c5fbb026..200dd30eda1a 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -344,16 +344,16 @@ void SvTreeListBox::InitEntry( SvLBoxEntry* pEntry, String SvTreeListBox::GetEntryText(SvLBoxEntry* pEntry) const { DBG_CHKTHIS(SvTreeListBox,0); - DBG_ASSERT( pEntry, "SvTreeListBox::GetEntryText(): no entry" ) + DBG_ASSERT( pEntry, "SvTreeListBox::GetEntryText(): no entry" ); SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - DBG_ASSERT( pEntry, "SvTreeListBox::GetEntryText(): item not found" ) + DBG_ASSERT( pEntry, "SvTreeListBox::GetEntryText(): item not found" ); return pItem->GetText(); } String SvTreeListBox::SearchEntryText( SvLBoxEntry* pEntry ) const { DBG_CHKTHIS(SvTreeListBox,0); - DBG_ASSERT( pEntry, "SvTreeListBox::SearchEntryText(): no entry" ) + DBG_ASSERT( pEntry, "SvTreeListBox::SearchEntryText(): no entry" ); String sRet; USHORT nCount = pEntry->ItemCount(); USHORT nCur = 0; @@ -375,18 +375,18 @@ String SvTreeListBox::SearchEntryText( SvLBoxEntry* pEntry ) const const Image& SvTreeListBox::GetExpandedEntryBmp(SvLBoxEntry* pEntry, BmpColorMode _eMode) const { DBG_CHKTHIS(SvTreeListBox,0); - DBG_ASSERT(pEntry,"Entry?") + DBG_ASSERT(pEntry,"Entry?"); SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); - DBG_ASSERT(pItem,"GetContextBmp:Item not found") + DBG_ASSERT(pItem,"GetContextBmp:Item not found"); return pItem->GetBitmap2( _eMode ); } const Image& SvTreeListBox::GetCollapsedEntryBmp( SvLBoxEntry* pEntry, BmpColorMode _eMode ) const { DBG_CHKTHIS(SvTreeListBox,0); - DBG_ASSERT(pEntry,"Entry?") + DBG_ASSERT(pEntry,"Entry?"); SvLBoxContextBmp* pItem = (SvLBoxContextBmp*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXCONTEXTBMP)); - DBG_ASSERT(pItem,"GetContextBmp:Item not found") + DBG_ASSERT(pItem,"GetContextBmp:Item not found"); return pItem->GetBitmap1( _eMode ); } @@ -494,7 +494,7 @@ void SvTreeListBox::SetEntryText( SvLBoxEntry* pEntry, const XubString& aStr) { DBG_CHKTHIS(SvTreeListBox,0); SvLBoxString* pItem = (SvLBoxString*)(pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING)); - DBG_ASSERT(pItem,"SetText:Item not found") + DBG_ASSERT(pItem,"SetText:Item not found"); pItem->SetText( pEntry, aStr ); pItem->InitViewData( this, pEntry, 0 ); GetModel()->InvalidateEntry( pEntry ); @@ -1065,7 +1065,7 @@ BOOL SvTreeListBox::Collapse( SvLBoxEntry* pParent ) BOOL SvTreeListBox::Select( SvLBoxEntry* pEntry, BOOL bSelect ) { DBG_CHKTHIS(SvTreeListBox,0); - DBG_ASSERT(pEntry,"Select: Null-Ptr") + DBG_ASSERT(pEntry,"Select: Null-Ptr"); BOOL bRetVal = SvListView::Select( pEntry, bSelect ); DBG_ASSERT(IsSelected(pEntry)==bSelect,"Select failed"); if( bRetVal ) @@ -1526,7 +1526,7 @@ void SvTreeListBox::SetWindowBits( WinBits nWinStyle ) void SvTreeListBox::PaintEntry( SvLBoxEntry* pEntry ) { DBG_CHKTHIS(SvTreeListBox,0); - DBG_ASSERT(pEntry,"PaintEntry:No Entry") + DBG_ASSERT(pEntry,"PaintEntry:No Entry"); if( pEntry ) pImp->PaintEntry( pEntry ); } @@ -1534,7 +1534,7 @@ void SvTreeListBox::PaintEntry( SvLBoxEntry* pEntry ) void SvTreeListBox::InvalidateEntry( SvLBoxEntry* pEntry ) { DBG_CHKTHIS(SvTreeListBox,0); - DBG_ASSERT(pEntry,"InvalidateEntry:No Entry") + DBG_ASSERT(pEntry,"InvalidateEntry:No Entry"); if( pEntry ) { GetModel()->InvalidateEntry( pEntry ); @@ -1959,7 +1959,7 @@ Rectangle SvTreeListBox::GetFocusRect( SvLBoxEntry* pEntry, long nLine ) long SvTreeListBox::GetTabPos( SvLBoxEntry* pEntry, SvLBoxTab* pTab) { DBG_CHKTHIS(SvTreeListBox,0); - DBG_ASSERT(pTab,"No Tab") + DBG_ASSERT(pTab,"No Tab"); long nPos = pTab->GetPos(); if( pTab->IsDynamic() ) { diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx index 88a83ac389a6..eb4e533b628c 100644 --- a/svtools/source/contnr/treelist.cxx +++ b/svtools/source/contnr/treelist.cxx @@ -237,7 +237,7 @@ void SvTreeList::RemoveView( SvListView* pView ) // Ein Entry ist sichtbar, wenn alle Parents expandiert sind BOOL SvTreeList::IsEntryVisible( const SvListView* pView, SvListEntry* pEntry ) const { - DBG_ASSERT(pView&&pEntry,"IsVisible:Invalid Params") + DBG_ASSERT(pView&&pEntry,"IsVisible:Invalid Params"); BOOL bRetVal=FALSE; do { @@ -253,7 +253,7 @@ BOOL SvTreeList::IsEntryVisible( const SvListView* pView, SvListEntry* pEntry ) USHORT SvTreeList::GetDepth( SvListEntry* pEntry ) const { - DBG_ASSERT(pEntry&&pEntry!=pRootItem,"GetDepth:Bad Entry") + DBG_ASSERT(pEntry&&pEntry!=pRootItem,"GetDepth:Bad Entry"); USHORT nDepth = 0; while( pEntry->pParent != pRootItem ) { @@ -330,10 +330,10 @@ BOOL SvTreeList::IsChild( SvListEntry* pParent, SvListEntry* pChild ) const ULONG SvTreeList::Move(SvListEntry* pSrcEntry,SvListEntry* pTargetParent,ULONG nListPos) { // pDest darf Null sein! - DBG_ASSERT(pSrcEntry,"Entry?") + DBG_ASSERT(pSrcEntry,"Entry?"); if ( !pTargetParent ) pTargetParent = pRootItem; - DBG_ASSERT(pSrcEntry!=pTargetParent,"Move:Source=Target") + DBG_ASSERT(pSrcEntry!=pTargetParent,"Move:Source=Target"); Broadcast( LISTACTION_MOVING, pSrcEntry, pTargetParent, nListPos ); @@ -379,7 +379,7 @@ CheckIntegrity(); #endif ULONG nRetVal = pDstList->GetPos( pSrcEntry ); - DBG_ASSERT(nRetVal==pSrcEntry->GetChildListPos(),"ListPos not valid") + DBG_ASSERT(nRetVal==pSrcEntry->GetChildListPos(),"ListPos not valid"); Broadcast( LISTACTION_MOVED,pSrcEntry,pTargetParent,nRetVal); return nRetVal; } @@ -387,7 +387,7 @@ CheckIntegrity(); ULONG SvTreeList::Copy(SvListEntry* pSrcEntry,SvListEntry* pTargetParent,ULONG nListPos) { // pDest darf Null sein! - DBG_ASSERT(pSrcEntry,"Entry?") + DBG_ASSERT(pSrcEntry,"Entry?"); if ( !pTargetParent ) pTargetParent = pRootItem; if ( !pTargetParent->pChilds ) @@ -502,7 +502,7 @@ void SvTreeList::InsertTree( SvListEntry* pSrcEntry, SvListEntry* pDstEntry) void SvTreeList::InsertTree(SvListEntry* pSrcEntry, SvListEntry* pTargetParent,ULONG nListPos) { - DBG_ASSERT(pSrcEntry,"InsertTree:Entry?") + DBG_ASSERT(pSrcEntry,"InsertTree:Entry?"); if ( !pSrcEntry ) return; @@ -577,7 +577,7 @@ SvTreeEntryList* SvTreeList::CloneChilds( SvTreeEntryList* pChilds, SvListEntry* pNewParent, ULONG& nCloneCount ) const { - DBG_ASSERT(pChilds->Count(),"Childs?") + DBG_ASSERT(pChilds->Count(),"Childs?"); SvTreeEntryList* pClonedChilds = new SvTreeEntryList; SvListEntry* pChild = (SvListEntry*)pChilds->First(); while ( pChild ) @@ -640,7 +640,7 @@ ULONG SvTreeList::GetChildCount( SvListEntry* pParent ) const ULONG SvTreeList::GetVisibleChildCount(const SvListView* pView, SvListEntry* pParent) const { - DBG_ASSERT(pView,"GetVisChildCount:No View") + DBG_ASSERT(pView,"GetVisChildCount:No View"); if ( !pParent ) pParent = pRootItem; if ( !pParent || !pView->IsExpanded(pParent) || !pParent->pChilds ) @@ -659,7 +659,7 @@ ULONG SvTreeList::GetVisibleChildCount(const SvListView* pView, SvListEntry* pPa ULONG SvTreeList::GetChildSelectionCount(const SvListView* pView,SvListEntry* pParent) const { - DBG_ASSERT(pView,"GetChildSelCount:No View") + DBG_ASSERT(pView,"GetChildSelCount:No View"); if ( !pParent ) pParent = pRootItem; if ( !pParent || !pParent->pChilds) @@ -745,7 +745,7 @@ SvListEntry* SvTreeList::Next( SvListEntry* pActEntry, USHORT* pDepth ) const { DBG_ASSERT(pParent!=0,"TreeData corrupt!"); pActualList = pParent->pParent->pChilds; - DBG_ASSERT(pActualList,"TreeData corrupt!") + DBG_ASSERT(pActualList,"TreeData corrupt!"); nActualPos = pParent->GetChildListPos(); if ( pActualList->Count() > ( nActualPos + 1 ) ) { @@ -771,7 +771,7 @@ SvListEntry* SvTreeList::Next( SvListEntry* pActEntry, USHORT* pDepth ) const *************************************************************************/ SvListEntry* SvTreeList::Prev( SvListEntry* pActEntry, USHORT* pDepth ) const { - DBG_ASSERT(pActEntry!=0,"Entry?") + DBG_ASSERT(pActEntry!=0,"Entry?"); USHORT nDepth = 0; int bWithDepth = FALSE; @@ -850,7 +850,7 @@ SvListEntry* SvTreeList::Last( USHORT* /* nDepth */ ) const ULONG SvTreeList::GetVisiblePos( const SvListView* pView, SvListEntry* pEntry ) const { - DBG_ASSERT(pView&&pEntry,"View/Entry?") + DBG_ASSERT(pView&&pEntry,"View/Entry?"); if ( !pView->bVisPositionsValid ) { @@ -874,7 +874,7 @@ ULONG SvTreeList::GetVisiblePos( const SvListView* pView, SvListEntry* pEntry ) ULONG SvTreeList::GetVisibleCount( const SvListView* pView ) const { - DBG_ASSERT(pView,"GetVisCount:No View") + DBG_ASSERT(pView,"GetVisCount:No View"); if( !pView->HasViewData() ) return 0; if ( pView->nVisibleCount ) @@ -916,7 +916,7 @@ ULONG SvTreeList::GetVisibleCount( const SvListView* pView ) const SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pActEntry,USHORT* pActDepth) const { - DBG_ASSERT(pView,"NextVisible:No View") + DBG_ASSERT(pView,"NextVisible:No View"); if ( !pActEntry ) return 0; @@ -933,7 +933,7 @@ SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pActEn if ( pView->IsExpanded(pActEntry) ) { - DBG_ASSERT(pActEntry->pChilds,"Childs?") + DBG_ASSERT(pActEntry->pChilds,"Childs?"); nDepth++; pActEntry = (SvListEntry*)(pActEntry->pChilds->GetObject(0)); if ( bWithDepth ) @@ -986,7 +986,7 @@ SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pActEn SvListEntry* SvTreeList::PrevVisible(const SvListView* pView, SvListEntry* pActEntry, USHORT* pActDepth) const { - DBG_ASSERT(pView&&pActEntry,"PrevVis:View/Entry?") + DBG_ASSERT(pView&&pActEntry,"PrevVis:View/Entry?"); USHORT nDepth = 0; int bWithDepth = FALSE; @@ -1039,7 +1039,7 @@ SvListEntry* SvTreeList::PrevVisible(const SvListView* pView, SvListEntry* pActE SvListEntry* SvTreeList::LastVisible( const SvListView* pView, USHORT* pDepth) const { - DBG_ASSERT(pView,"LastVis:No View") + DBG_ASSERT(pView,"LastVis:No View"); SvListEntry* pEntry = Last(); while( pEntry && !IsEntryVisible( pView, pEntry ) ) pEntry = PrevVisible( pView, pEntry ); @@ -1060,7 +1060,7 @@ SvListEntry* SvTreeList::LastVisible( const SvListView* pView, USHORT* pDepth) c SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pEntry,USHORT& nDelta) const { - DBG_ASSERT(pView&&pEntry&&IsEntryVisible(pView,pEntry),"NextVis:Wrong Prms/!Vis") + DBG_ASSERT(pView&&pEntry&&IsEntryVisible(pView,pEntry),"NextVis:Wrong Prms/!Vis"); ULONG nVisPos = GetVisiblePos( pView, pEntry ); // nDelta Eintraege vorhanden ? @@ -1076,7 +1076,7 @@ SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pEntry { pEntry = NextVisible( pView, pEntry ); nDeltaTmp--; - DBG_ASSERT(pEntry,"Entry?") + DBG_ASSERT(pEntry,"Entry?"); } return pEntry; } @@ -1093,7 +1093,7 @@ SvListEntry* SvTreeList::NextVisible(const SvListView* pView,SvListEntry* pEntry SvListEntry* SvTreeList::PrevVisible( const SvListView* pView, SvListEntry* pEntry, USHORT& nDelta ) const { - DBG_ASSERT(pView&&pEntry&&IsEntryVisible(pView,pEntry),"PrevVis:Parms/!Vis") + DBG_ASSERT(pView&&pEntry&&IsEntryVisible(pView,pEntry),"PrevVis:Parms/!Vis"); ULONG nVisPos = GetVisiblePos( pView, pEntry ); // nDelta Eintraege vorhanden ? @@ -1106,7 +1106,7 @@ SvListEntry* SvTreeList::PrevVisible( const SvListView* pView, SvListEntry* pEnt { pEntry = PrevVisible( pView, pEntry ); nDeltaTmp--; - DBG_ASSERT(pEntry,"Entry?") + DBG_ASSERT(pEntry,"Entry?"); } return pEntry; } @@ -1123,7 +1123,7 @@ SvListEntry* SvTreeList::PrevVisible( const SvListView* pView, SvListEntry* pEnt SvListEntry* SvTreeList::FirstSelected( const SvListView* pView) const { - DBG_ASSERT(pView,"FirstSel:No View") + DBG_ASSERT(pView,"FirstSel:No View"); if( !pView ) return 0; SvListEntry* pActSelEntry = First(); @@ -1147,7 +1147,7 @@ SvListEntry* SvTreeList::FirstChild( SvListEntry* pParent ) const SvListEntry* SvTreeList::NextSibling( SvListEntry* pEntry ) const { - DBG_ASSERT(pEntry,"Entry?") + DBG_ASSERT(pEntry,"Entry?"); if( !pEntry ) return 0; SvTreeEntryList* pList = pEntry->pParent->pChilds; @@ -1160,7 +1160,7 @@ SvListEntry* SvTreeList::NextSibling( SvListEntry* pEntry ) const SvListEntry* SvTreeList::PrevSibling( SvListEntry* pEntry ) const { - DBG_ASSERT(pEntry,"Entry?") + DBG_ASSERT(pEntry,"Entry?"); if( !pEntry ) return 0; @@ -1201,7 +1201,7 @@ SvListEntry* SvTreeList::LastSibling( SvListEntry* pEntry ) const SvListEntry* SvTreeList::NextSelected( const SvListView* pView, SvListEntry* pEntry ) const { - DBG_ASSERT(pView&&pEntry,"NextSel:View/Entry?") + DBG_ASSERT(pView&&pEntry,"NextSel:View/Entry?"); pEntry = Next( pEntry ); while( pEntry && !pView->IsSelected(pEntry) ) pEntry = Next( pEntry ); @@ -1220,7 +1220,7 @@ SvListEntry* SvTreeList::NextSelected( const SvListView* pView, SvListEntry* pEn SvListEntry* SvTreeList::PrevSelected( const SvListView* pView, SvListEntry* pEntry) const { - DBG_ASSERT(pView&&pEntry,"PrevSel:View/Entry?") + DBG_ASSERT(pView&&pEntry,"PrevSel:View/Entry?"); pEntry = Prev( pEntry ); while( pEntry && !pView->IsSelected(pEntry) ) pEntry = Prev( pEntry ); @@ -1240,7 +1240,7 @@ SvListEntry* SvTreeList::PrevSelected( const SvListView* pView, SvListEntry* pEn SvListEntry* SvTreeList::LastSelected( const SvListView* pView ) const { - DBG_ASSERT(pView,"LastSel:No View") + DBG_ASSERT(pView,"LastSel:No View"); SvListEntry* pEntry = Last(); while( pEntry && !pView->IsSelected(pEntry) ) pEntry = Prev( pEntry ); @@ -1258,7 +1258,7 @@ SvListEntry* SvTreeList::LastSelected( const SvListView* pView ) const *************************************************************************/ ULONG SvTreeList::Insert( SvListEntry* pEntry,SvListEntry* pParent,ULONG nPos ) { - DBG_ASSERT( pEntry,"Entry?") + DBG_ASSERT( pEntry,"Entry?"); if ( !pParent ) pParent = pRootItem; @@ -1348,11 +1348,11 @@ CheckIntegrity(); void SvTreeList::Expand( SvListView* pView, SvListEntry* pEntry ) { - DBG_ASSERT(pEntry&&pView,"Expand:View/Entry?") + DBG_ASSERT(pEntry&&pView,"Expand:View/Entry?"); if ( pView->IsExpanded(pEntry) ) return; - DBG_ASSERT(pEntry->pChilds,"Expand:No Childs!") + DBG_ASSERT(pEntry->pChilds,"Expand:No Childs!"); SvViewData* pViewData = pView->GetViewData(pEntry); pViewData->nFlags |= SVLISTENTRYFLAG_EXPANDED; @@ -1380,11 +1380,11 @@ CheckIntegrity(); void SvTreeList::Collapse( SvListView* pView, SvListEntry* pEntry ) { - DBG_ASSERT(pView&&pEntry,"Collapse:View/Entry?") + DBG_ASSERT(pView&&pEntry,"Collapse:View/Entry?"); if ( !pView->IsExpanded(pEntry) ) return; - DBG_ASSERT(pEntry->pChilds,"Collapse:No Childs!") + DBG_ASSERT(pEntry->pChilds,"Collapse:No Childs!"); SvViewData* pViewData = pView->GetViewData( pEntry ); pViewData->nFlags &=(~SVLISTENTRYFLAG_EXPANDED); @@ -1413,7 +1413,7 @@ CheckIntegrity(); BOOL SvTreeList::Select( SvListView* pView, SvListEntry* pEntry, BOOL bSelect ) { - DBG_ASSERT(pView&&pEntry,"Select:View/Entry?") + DBG_ASSERT(pView&&pEntry,"Select:View/Entry?"); SvViewData* pViewData = pView->GetViewData( pEntry ); if ( bSelect ) { @@ -1452,7 +1452,7 @@ CheckIntegrity(); *************************************************************************/ BOOL SvTreeList::Remove( SvListEntry* pEntry ) { - DBG_ASSERT(pEntry,"Cannot remove root, use clear") + DBG_ASSERT(pEntry,"Cannot remove root, use clear"); if( !pEntry->pParent ) { @@ -1470,7 +1470,7 @@ BOOL SvTreeList::Remove( SvListEntry* pEntry ) SvListEntry* pParent = pEntry->pParent; SvTreeEntryList* pList = pParent->pChilds; - DBG_ASSERT(pList,"Remove:No Childlist") + DBG_ASSERT(pList,"Remove:No Childlist"); BOOL bLastEntry = FALSE; if ( pEntry->HasChildListPos() ) @@ -1521,7 +1521,7 @@ CheckIntegrity(); ULONG SvTreeList::SelectChilds(SvListView* pView, SvListEntry* pParent,BOOL bSelect ) { - DBG_ASSERT(pView&&pParent,"SelChilds:View/Parent?") + DBG_ASSERT(pView&&pParent,"SelChilds:View/Parent?"); if ( !pParent->pChilds ) return 0; if ( pParent->pChilds->Count() == 0 ) @@ -1546,7 +1546,7 @@ CheckIntegrity(); void SvTreeList::SelectAll( SvListView* pView, BOOL bSelect ) { - DBG_ASSERT(pView,"SelectAll:NoView") + DBG_ASSERT(pView,"SelectAll:NoView"); SvListEntry* pEntry = First(); while ( pEntry ) { @@ -1581,7 +1581,7 @@ SvListEntry* SvTreeList::GetEntryAtAbsPos( ULONG nAbsPos ) const SvListEntry* SvTreeList::GetEntryAtVisPos( const SvListView* pView, ULONG nVisPos ) const { - DBG_ASSERT(pView,"GetEntryAtVisPos:No View") + DBG_ASSERT(pView,"GetEntryAtVisPos:No View"); SvListEntry* pEntry = First(); while ( nVisPos && pEntry ) { @@ -1634,7 +1634,7 @@ void lcl_CheckList( SvTreeEntryList* pList ) ULONG nPos = 0; while ( pEntry ) { - DBG_ASSERT(pEntry->GetChildListPos()==nPos,"Wrong ListPos") + DBG_ASSERT(pEntry->GetChildListPos()==nPos,"Wrong ListPos"); pEntry = (SvListEntry*)(pList->Next()); nPos++; } @@ -1655,12 +1655,12 @@ void SvTreeList::CheckIntegrity() const pEntry = Next( pEntry ); } } - DBG_ASSERT(nMyEntryCount==GetEntryCount(),"Entry count invalid") + DBG_ASSERT(nMyEntryCount==GetEntryCount(),"Entry count invalid"); } SvListEntry* SvTreeList::GetRootLevelParent( SvListEntry* pEntry ) const { - DBG_ASSERT(pEntry,"GetRootLevelParent:No Entry") + DBG_ASSERT(pEntry,"GetRootLevelParent:No Entry"); SvListEntry* pCurParent = 0; if ( pEntry ) { @@ -1716,7 +1716,7 @@ SvListView::~SvListView() void SvListView::InitTable() { DBG_CHKTHIS(SvListView,0); - DBG_ASSERT(pModel,"InitTable:No Model") + DBG_ASSERT(pModel,"InitTable:No Model"); DBG_ASSERT(!nSelectionCount&&!nVisibleCount&&!bVisPositionsValid,"InitTable: Not cleared!"); if( aDataTable.Count() ) @@ -1743,7 +1743,7 @@ void SvListView::InitTable() while( pEntry ) { pViewData = CreateViewData( pEntry ); - DBG_ASSERT(pViewData,"InitTable:No ViewData") + DBG_ASSERT(pViewData,"InitTable:No ViewData"); InitViewData( pViewData, pEntry ); aDataTable.Insert( (ULONG)pEntry, pViewData ); pEntry = pModel->Next( pEntry ); @@ -1850,7 +1850,7 @@ void SvListView::ActionMoving( SvListEntry* pEntry,SvListEntry*,ULONG) { DBG_CHKTHIS(SvListView,0); SvListEntry* pParent = pEntry->pParent; - DBG_ASSERT(pParent,"Model not consistent") + DBG_ASSERT(pParent,"Model not consistent"); if( pParent != pModel->pRootItem && pParent->pChilds->Count() == 1 ) { SvViewData* pViewData = (SvViewData*)aDataTable.Get( (ULONG)pParent ); @@ -1873,14 +1873,14 @@ void SvListView::ActionMoved( SvListEntry* /* pEntry */ , void SvListView::ActionInserted( SvListEntry* pEntry ) { DBG_CHKTHIS(SvListView,0); - DBG_ASSERT(pEntry,"Insert:No Entry") + DBG_ASSERT(pEntry,"Insert:No Entry"); SvViewData* pData = CreateViewData( pEntry ); InitViewData( pData, pEntry ); #ifdef DBG_UTIL BOOL bSuccess = #endif aDataTable.Insert( (ULONG)pEntry, pData ); - DBG_ASSERT(bSuccess,"Entry already in View") + DBG_ASSERT(bSuccess,"Entry already in View"); if ( nVisibleCount && pModel->IsEntryVisible( this, pEntry )) { nVisibleCount = 0; @@ -1901,9 +1901,9 @@ void SvListView::ActionInsertedTree( SvListEntry* pEntry ) USHORT nRefDepth = pModel->GetDepth( pCurEntry ); while( pCurEntry ) { - DBG_ASSERT(aDataTable.Get((ULONG)pCurEntry)==0,"Entry already in Table") + DBG_ASSERT(aDataTable.Get((ULONG)pCurEntry)==0,"Entry already in Table"); SvViewData* pViewData = CreateViewData( pCurEntry ); - DBG_ASSERT(pViewData,"No ViewData") + DBG_ASSERT(pViewData,"No ViewData"); InitViewData( pViewData, pEntry ); aDataTable.Insert( (ULONG)pCurEntry, pViewData ); pCurEntry = pModel->Next( pCurEntry ); @@ -1935,7 +1935,7 @@ void SvListView::RemoveViewData( SvListEntry* pParent ) void SvListView::ActionRemoving( SvListEntry* pEntry ) { DBG_CHKTHIS(SvListView,0); - DBG_ASSERT(pEntry,"Remove:No Entry") + DBG_ASSERT(pEntry,"Remove:No Entry"); SvViewData* pViewData = (SvViewData*)aDataTable.Get( (ULONG)pEntry ); ULONG nSelRemoved = 0; @@ -2081,7 +2081,7 @@ void SvTreeList::ResortChilds( SvListEntry* pParent ) void SvTreeList::GetInsertionPos( SvListEntry* pEntry, SvListEntry* pParent, ULONG& rPos ) { - DBG_ASSERT(pEntry,"No Entry") + DBG_ASSERT(pEntry,"No Entry"); if( eSortMode == SortNone ) return; diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx index 774b09fafbd1..387c1db34fc1 100644 --- a/svtools/source/control/fmtfield.cxx +++ b/svtools/source/control/fmtfield.cxx @@ -842,6 +842,7 @@ void FormattedField::Commit() void FormattedField::ReFormat() { if (!IsEmptyFieldEnabled() || GetText().Len()) + { if (TreatingAsNumber()) { double dValue = GetValue(); @@ -851,6 +852,7 @@ void FormattedField::ReFormat() } else SetTextFormatted(GetTextValue()); + } } //------------------------------------------------------------------------------ @@ -1073,10 +1075,12 @@ double FormattedField::GetValue() DBG_CHKTHIS(FormattedField, NULL); if ( !ImplGetValue( m_dCurrentValue ) ) + { if ( m_bEnableNaN ) ::rtl::math::setNan( &m_dCurrentValue ); else m_dCurrentValue = m_dDefaultValue; + } m_bValueDirty = FALSE; return m_dCurrentValue; diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index c5f1d9ce7189..2f9e881e39c9 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -472,8 +472,11 @@ void SvtMatchContext_Impl::ReadFolder( const String& rURL, // matching is always done case insensitive, but completion will be case sensitive and case preserving aTitle.ToLowerAscii(); - if( !nMatchLen || bExectMatch && aMatchName.Equals( aTitle ) - || !bExectMatch && aMatchName.CompareTo( aTitle, nMatchLen ) == COMPARE_EQUAL ) + if ( + !nMatchLen || + (bExectMatch && aMatchName.Equals(aTitle)) || + (!bExectMatch && aMatchName.CompareTo(aTitle, nMatchLen) == COMPARE_EQUAL) + ) { // all names fit if matchstring is empty INetURLObject aObj( aURL ); @@ -490,8 +493,7 @@ void SvtMatchContext_Impl::ReadFolder( const String& rURL, String aInput( aText ); if ( nMatchLen ) { - if ( aText.Len() && aText.GetChar( aText.Len() - 1 ) == '.' - || bPureHomePath ) + if ((aText.Len() && aText.GetChar(aText.Len() - 1) == '.') || bPureHomePath) { // if a "special folder" URL was typed, don't touch the user input aMatch.Erase( 0, nMatchLen ); @@ -1079,6 +1081,13 @@ long SvtURLBox::PreNotify( NotifyEvent& rNEvt ) SetSelection( Selection( nLen, GetText().Len() ) ); return TRUE; } + + if ( MatchesPlaceHolder( GetText() ) ) + { + // set the selection so a key stroke will overwrite + // the placeholder rather than edit it + SetSelection( Selection( 0, GetText().Len() ) ); + } } return ComboBox::PreNotify( rNEvt ); @@ -1148,6 +1157,8 @@ String SvtURLBox::GetURL() ::vos::OGuard aGuard( SvtMatchContext_Impl::GetMutex() ); String aText( GetText() ); + if ( MatchesPlaceHolder( aText ) ) + return aPlaceHolder; // try to get the right case preserving URL from the list of URLs if ( pImp->pCompletions && pImp->pURLs ) { @@ -1216,8 +1227,8 @@ String SvtURLBox::GetURL() if( success && ( aTitle.Len() > 1 || - aTitle.CompareToAscii("/") != 0 && - aTitle.CompareToAscii(".") != 0 ) ) + (aTitle.CompareToAscii("/") != 0 && + aTitle.CompareToAscii(".") != 0) ) ) { aObj.SetName( aTitle ); if ( bSlash ) diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx index e474845be24b..7485efec7c7c 100644 --- a/svtools/source/control/roadmap.cxx +++ b/svtools/source/control/roadmap.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: roadmap.cxx,v $ - * $Revision: 1.16 $ + * $Revision: 1.16.56.1 $ * * This file is part of OpenOffice.org. * @@ -665,7 +665,7 @@ namespace svt // draw it DrawText( Rectangle( aTextPos, aOutputSize ), GetText(), TEXT_DRAW_LEFT | TEXT_DRAW_TOP | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); - DrawTextLine( aTextPos, aOutputSize.Width(), STRIKEOUT_NONE, UNDERLINE_SINGLE, sal_False ); + DrawTextLine( aTextPos, aOutputSize.Width(), STRIKEOUT_NONE, UNDERLINE_SINGLE, UNDERLINE_NONE, sal_False ); const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); SetLineColor( rStyleSettings.GetFieldTextColor()); SetTextColor(rStyleSettings.GetFieldTextColor()); diff --git a/svtools/source/control/stdmenu.cxx b/svtools/source/control/stdmenu.cxx index 7f32c757526c..35250753de1e 100644 --- a/svtools/source/control/stdmenu.cxx +++ b/svtools/source/control/stdmenu.cxx @@ -77,20 +77,19 @@ void FontNameMenu::Highlight() void FontNameMenu::Fill( const FontList* pList ) { - // Menu loeschen + // clear menu Clear(); - // Fonts eintragen - + // add fonts const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper(); - - USHORT nFontCount = pList->GetFontNameCount(); + // more than 100 fonts reduces the speed of opening the menu. + // So only the first 100 fonts will be displayed. + USHORT nFontCount = ::std::min( pList->GetFontNameCount(), static_cast< USHORT >(100) ); for ( USHORT i = 0; i < nFontCount; i++ ) { const XubString& rName = pList->GetFontName( i ).GetName(); - // Sortieren, nach der in der Applikation eingestellten - // International-Klasse + // sort with the I18nHelper USHORT j = GetItemCount(); while ( j ) { @@ -99,7 +98,6 @@ void FontNameMenu::Fill( const FontList* pList ) break; j--; } - InsertItem( i+1, rName, MIB_RADIOCHECK | MIB_AUTOCHECK, j ); } diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index 5451d8ac5572..afdb728f450e 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -719,12 +719,14 @@ ValueSetItem* ValueSetAcc::getItem (USHORT nIndex) const ValueSetItem* pItem = NULL; if (HasNoneField()) + { if (nIndex == 0) // When present the first item is the then allways visible none field. pItem = mpParent->ImplGetItem (VALUESET_ITEM_NONEITEM); else // Shift down the index to compensate for the none field. nIndex -= 1; + } if (pItem == NULL) pItem = mpParent->ImplGetVisibleItem (static_cast<USHORT>(nIndex)); diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx index a3654832814b..b0fff49e5e8d 100644 --- a/svtools/source/dialogs/roadmapwizard.cxx +++ b/svtools/source/dialogs/roadmapwizard.cxx @@ -337,7 +337,7 @@ namespace svt if ( aActivePathPos != m_pImpl->aPaths.end() ) { DBG_ASSERT( m_pImpl->getFirstDifferentIndex( aActivePathPos->second, aNewPathPos->second ) > nCurrentStatePathIndex, - "RoadmapWizard::activate: you cannot activate a path which conflicts with the current one *before* the current state!" ) + "RoadmapWizard::activate: you cannot activate a path which conflicts with the current one *before* the current state!" ); } #endif diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx new file mode 100644 index 000000000000..334b19ccd98d --- /dev/null +++ b/svtools/source/edit/editsyntaxhighlighter.cxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: editsyntaxhighlighter.cxx,v $ + * $Revision: 1.44.108.7 $ + * + * 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/svmedit.hxx> +#include <svtools/xtextedt.hxx>
+#include <svtools/editsyntaxhighlighter.hxx>
+#include "../../inc/txtattr.hxx"
+
+
+MultiLineEditSyntaxHighlight::MultiLineEditSyntaxHighlight( Window* pParent, WinBits nWinStyle, + HighlighterLanguage aLanguage): MultiLineEdit(pParent,nWinStyle), mbDoBracketHilight(true) +{ + EnableUpdateData(300); + aHighlighter.initialize( aLanguage ); +} + +MultiLineEditSyntaxHighlight::MultiLineEditSyntaxHighlight( Window* pParent, const ResId& rResId , + HighlighterLanguage aLanguage): MultiLineEdit(pParent,rResId), mbDoBracketHilight(true) +{ + EnableUpdateData(300); + aHighlighter.initialize( aLanguage ); +} + +MultiLineEditSyntaxHighlight::~MultiLineEditSyntaxHighlight() +{ +} + +void MultiLineEditSyntaxHighlight::EnableBracketHilight(bool aHilight) +{ + mbDoBracketHilight = aHilight; +} + +bool MultiLineEditSyntaxHighlight::IsBracketHilight() +{ + return mbDoBracketHilight; +} + +void MultiLineEditSyntaxHighlight::SetText(const String& rNewText) +{ + MultiLineEdit::SetText(rNewText); + UpdateData(); +} + +void MultiLineEditSyntaxHighlight::DoBracketHilight(USHORT aKey) +{ + TextSelection aCurrentPos = GetTextView()->GetSelection(); + xub_StrLen aStartPos = aCurrentPos.GetStart().GetIndex(); + ULONG nStartPara = aCurrentPos.GetStart().GetPara(); + USHORT aCount = 0; + int aChar = -1; + + switch (aKey) + { + case '\'': // no break + case '"': + { + aChar = aKey; + break; + } + case '}' : + { + aChar = '{'; + break; + } + case ')': + { + aChar = '('; + break; + } + case ']': + { + aChar = '['; + break; + } + } + + if (aChar != -1) + { + for (long aPara =nStartPara; aPara>=0;--aPara) + { + String aLine( GetTextEngine()->GetText( aPara ) ); + for (USHORT i = ((unsigned long)aPara==nStartPara) ? aStartPos-1 : (USHORT)(GetTextEngine()->GetTextLen()-1); i>0; --i) + { + if (aLine.GetChar(i)==aChar) + { + if (!aCount) + { + GetTextEngine()->SetAttrib( TextAttribFontWeight( WEIGHT_ULTRABOLD ), aPara, i, i+1, TRUE ); + GetTextEngine()->SetAttrib( TextAttribFontColor( Color(0,0,0) ), aPara, i, i+1, TRUE ); + GetTextEngine()->SetAttrib( TextAttribFontWeight( WEIGHT_ULTRABOLD ), nStartPara, aStartPos, aStartPos, TRUE ); + GetTextEngine()->SetAttrib( TextAttribFontColor( Color(0,0,0) ), nStartPara, aStartPos, aStartPos, TRUE ); + return; + } + else + aCount--; + } + if (aLine.GetChar(i)==aKey) + aCount++; + } + } + } +} + +long MultiLineEditSyntaxHighlight::PreNotify( NotifyEvent& rNEvt ) +{ + if ( mbDoBracketHilight && (rNEvt.GetType() == EVENT_KEYINPUT) ) + DoBracketHilight(rNEvt.GetKeyEvent()->GetCharCode()); + + return MultiLineEdit::PreNotify(rNEvt); +} + +Color MultiLineEditSyntaxHighlight::GetColorValue(TokenTypes aToken) +{ + Color aColor; + switch (aHighlighter.GetLanguage()) + { + case HIGHLIGHT_SQL: + { + switch (aToken) + { + case TT_IDENTIFIER: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLIDENTIFIER).nColor; break; + case TT_NUMBER: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLNUMBER).nColor; break; + case TT_STRING: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLSTRING).nColor; break; + case TT_OPERATOR: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLOPERATOR).nColor; break; + case TT_KEYWORDS: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLKEYWORD).nColor; break; + case TT_PARAMETER: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLPARAMETER).nColor; break; + case TT_COMMENT: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLCOMMENT).nColor; break; + default: aColor = Color(0,0,0); + } + break; + } + case HIGHLIGHT_BASIC: + { + switch (aToken) + { + case TT_IDENTIFIER: aColor = Color(255,0,0); break; + case TT_COMMENT: aColor = Color(0,0,45); break; + case TT_NUMBER: aColor = Color(204,102,204); break; + case TT_STRING: aColor = Color(0,255,45); break; + case TT_OPERATOR: aColor = Color(0,0,100); break; + case TT_KEYWORDS: aColor = Color(0,0,255); break; + case TT_ERROR : aColor = Color(0,255,255); break; + default: aColor = Color(0,0,0); + } + break; + } + default: aColor = Color(0,0,0); + + } + return aColor; +} + +void MultiLineEditSyntaxHighlight::UpdateData() +{ + // syntax highlighting + // this must be possible improved by using notifychange correctly + BOOL bTempModified = GetTextEngine()->IsModified(); + for (unsigned int nLine=0; nLine < GetTextEngine()->GetParagraphCount(); nLine++) + { + String aLine( GetTextEngine()->GetText( nLine ) ); + Range aChanges = aHighlighter.notifyChange( nLine, 0, &aLine, 1 ); + + GetTextEngine()->RemoveAttribs( nLine, TRUE ); + HighlightPortions aPortions; + aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); + for ( USHORT i = 0; i < aPortions.Count(); i++ ) + { + HighlightPortion& r = aPortions[i]; + GetTextEngine()->SetAttrib( TextAttribFontColor( GetColorValue(r.tokenType) ), nLine, r.nBegin, r.nEnd, TRUE ); + } + } + GetTextView()->ShowCursor( false, true ); + GetTextEngine()->SetModified(bTempModified); +} diff --git a/svtools/source/edit/makefile.mk b/svtools/source/edit/makefile.mk index 13a1e1f6e9af..0cb429a9b5b1 100644 --- a/svtools/source/edit/makefile.mk +++ b/svtools/source/edit/makefile.mk @@ -8,7 +8,7 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.15 $ +# $Revision: 1.15.108.1 $ # # This file is part of OpenOffice.org. # @@ -52,7 +52,9 @@ SLOFILES= \ $(SLO)$/sychconv.obj \ $(SLO)$/svmedit.obj \ $(SLO)$/svmedit2.obj \ - $(SLO)$/textwindowpeer.obj + $(SLO)$/textwindowpeer.obj \ + $(SLO)$/syntaxhighlight.obj \ + $(SLO)$/editsyntaxhighlighter.obj EXCEPTIONSFILES= \ $(SLO)$/textview.obj \ diff --git a/svtools/source/edit/svmedit.cxx b/svtools/source/edit/svmedit.cxx index a9a6297c9ffe..42026382385f 100644 --- a/svtools/source/edit/svmedit.cxx +++ b/svtools/source/edit/svmedit.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: svmedit.cxx,v $ - * $Revision: 1.44 $ + * $Revision: 1.44.108.7 $ * * This file is part of OpenOffice.org. * @@ -31,20 +31,24 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" + #include <memory> +#include "unoiface.hxx" + #include <tools/rc.h> + #include <vcl/decoview.hxx> #include <vcl/svapp.hxx> #include <svtools/svmedit.hxx> #include <svtools/xtextedt.hxx> #include <svtools/brdcst.hxx> -#include <svtools/lstner.hxx> -#include "unoiface.hxx" #include <svtools/undo.hxx> - #include <svtools/textwindowpeer.hxx> +#include <svtools/lstner.hxx> +#include <svtools/smplhint.hxx> + // IDs erstmal aus VCL geklaut, muss mal richtig delivert werden... #define SV_MENU_EDIT_UNDO 1 @@ -181,22 +185,16 @@ public: void SetTextWindowOffset( const Point& rOffset ); }; - ImpSvMEdit::ImpSvMEdit( MultiLineEdit* pEdt, WinBits nWinStyle ) :mpHScrollBar(NULL) ,mpVScrollBar(NULL) ,mpScrollBox(NULL) { pSvMultiLineEdit = pEdt; - mnTextWidth = 0; - mpTextWindow = new TextWindow( pEdt ); - mpTextWindow->Show(); - InitFromStyle( nWinStyle ); - StartListening( *mpTextWindow->GetTextEngine() ); } @@ -796,7 +794,9 @@ void TextWindow::KeyInput( const KeyEvent& rKEvent ) { BOOL bDone = FALSE; USHORT nCode = rKEvent.GetKeyCode().GetCode(); - if ( (nCode == KEY_A) && rKEvent.GetKeyCode().IsMod1() && !rKEvent.GetKeyCode().IsMod2() ) + if ( nCode == com::sun::star::awt::Key::SELECT_ALL || + ( (nCode == KEY_A) && rKEvent.GetKeyCode().IsMod1() && !rKEvent.GetKeyCode().IsMod2() ) + ) { mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFF, 0xFFFF ) ) ); bDone = TRUE; @@ -1641,4 +1641,3 @@ void MultiLineEdit::DisableSelectionOnFocus() { pImpSvMEdit->GetTextWindow()->DisableSelectionOnFocus(); } - diff --git a/svtools/source/edit/syntaxhighlight.cxx b/svtools/source/edit/syntaxhighlight.cxx new file mode 100644 index 000000000000..c1553f5ab35e --- /dev/null +++ b/svtools/source/edit/syntaxhighlight.cxx @@ -0,0 +1,900 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: syntaxhighlight.cxx,v $ + * $Revision: 1.1.2.4 $ + * + * 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/syntaxhighlight.hxx> + +#include <unotools/charclass.hxx> +#include <tools/debug.hxx> + + +SV_IMPL_VARARR(HighlightPortions, HighlightPortion) + + +// ########################################################################## +// ATTENTION: all these words needs to be in small caps +// ########################################################################## +static const char* strListBasicKeyWords[] = { + "access", + "alias", + "and", + "any", + "append", + "as", + "base", + "binary", + "boolean", + "byref", + "byte", + "byval", + "call", + "case", + "cdecl", + "classmodule", + "close", + "compare", + "compatible", + "const", + "currency", + "date", + "declare", + "defbool", + "defcur", + "defdate", + "defdbl", + "deferr", + "defint", + "deflng", + "defobj", + "defsng", + "defstr", + "defvar", + "dim", + "do", + "double", + "each", + "else", + "elseif", + "end", + "end enum", + "end function", + "end if", + "end select", + "end sub", + "end type", + "endif", + "enum", + "eqv", + "erase", + "error", + "exit", + "explicit", + "for", + "function", + "get", + "global", + "gosub", + "goto", + "if", + "imp", + "implements", + "in", + "input", + "integer", + "is", + "let", + "lib", + "like", + "line", + "line input", + "local", + "lock", + "long", + "loop", + "lprint", + "lset", + "mod", + "name", + "new", + "next", + "not", + "object", + "on", + "open", + "option", + "optional", + "or", + "output", + "preserve", + "print", + "private", + "property", + "public", + "random", + "read", + "redim", + "rem", + "resume", + "return", + "rset", + "select", + "set", + "shared", + "single", + "static", + "step", + "stop", + "string", + "sub", + "system", + "text", + "then", + "to", + "type", + "typeof", + "until", + "variant", + "wend", + "while", + "with", + "write", + "xor" +}; + + +static const char* strListSqlKeyWords[] = { + "all", + "and", + "any", + "as", + "asc", + "avg", + "between", + "by", + "cast", + "corresponding", + "count", + "create", + "cross", + "delete", + "desc", + "distinct", + "drop", + "escape", + "except", + "exists", + "false", + "from", + "full", + "global", + "group", + "having", + "in", + "inner", + "insert", + "intersect", + "into", + "is", + "join", + "left", + "like", + "local", + "match", + "max", + "min", + "natural", + "not", + "null", + "on", + "or", + "order", + "outer", + "right", + "select", + "set", + "some", + "sum", + "table", + "temporary", + "true", + "union", + "unique", + "unknown", + "update", + "using", + "values", + "where" +}; + + +extern "C" int CDECL compare_strings( const void *arg1, const void *arg2 ) +{ + return strcmp( (char *)arg1, *(char **)arg2 ); +} + + +class LetterTable +{ + bool IsLetterTab[256]; + +public: + LetterTable( void ); + + inline bool isLetter( sal_Unicode c ) + { + bool bRet = (c < 256) ? IsLetterTab[c] : isLetterUnicode( c ); + return bRet; + } + bool isLetterUnicode( sal_Unicode c ); +}; + +class BasicSimpleCharClass +{ + static LetterTable aLetterTable; + +public: + static BOOL isAlpha( sal_Unicode c, bool bCompatible ) + { + BOOL bRet = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') + || (bCompatible && aLetterTable.isLetter( c )); + return bRet; + } + + static BOOL isDigit( sal_Unicode c ) + { + BOOL bRet = (c >= '0' && c <= '9'); + return bRet; + } + + static BOOL isAlphaNumeric( sal_Unicode c, bool bCompatible ) + { + BOOL bRet = isDigit( c ) || isAlpha( c, bCompatible ); + return bRet; + } +}; + +LetterTable BasicSimpleCharClass::aLetterTable; + +LetterTable::LetterTable( void ) +{ + for( int i = 0 ; i < 256 ; ++i ) + IsLetterTab[i] = false; + + IsLetterTab[0xC0] = true; // , CAPITAL LETTER A WITH GRAVE ACCENT + IsLetterTab[0xC1] = true; // , CAPITAL LETTER A WITH ACUTE ACCENT + IsLetterTab[0xC2] = true; // , CAPITAL LETTER A WITH CIRCUMFLEX ACCENT + IsLetterTab[0xC3] = true; // , CAPITAL LETTER A WITH TILDE + IsLetterTab[0xC4] = true; // , CAPITAL LETTER A WITH DIAERESIS + IsLetterTab[0xC5] = true; // , CAPITAL LETTER A WITH RING ABOVE + IsLetterTab[0xC6] = true; // , CAPITAL LIGATURE AE + IsLetterTab[0xC7] = true; // , CAPITAL LETTER C WITH CEDILLA + IsLetterTab[0xC8] = true; // , CAPITAL LETTER E WITH GRAVE ACCENT + IsLetterTab[0xC9] = true; // , CAPITAL LETTER E WITH ACUTE ACCENT + IsLetterTab[0xCA] = true; // , CAPITAL LETTER E WITH CIRCUMFLEX ACCENT + IsLetterTab[0xCB] = true; // , CAPITAL LETTER E WITH DIAERESIS + IsLetterTab[0xCC] = true; // , CAPITAL LETTER I WITH GRAVE ACCENT + IsLetterTab[0xCD] = true; // , CAPITAL LETTER I WITH ACUTE ACCENT + IsLetterTab[0xCE] = true; // , CAPITAL LETTER I WITH CIRCUMFLEX ACCENT + IsLetterTab[0xCF] = true; // , CAPITAL LETTER I WITH DIAERESIS + IsLetterTab[0xD0] = true; // , CAPITAL LETTER ETH + IsLetterTab[0xD1] = true; // , CAPITAL LETTER N WITH TILDE + IsLetterTab[0xD2] = true; // , CAPITAL LETTER O WITH GRAVE ACCENT + IsLetterTab[0xD3] = true; // , CAPITAL LETTER O WITH ACUTE ACCENT + IsLetterTab[0xD4] = true; // , CAPITAL LETTER O WITH CIRCUMFLEX ACCENT + IsLetterTab[0xD5] = true; // , CAPITAL LETTER O WITH TILDE + IsLetterTab[0xD6] = true; // , CAPITAL LETTER O WITH DIAERESIS + IsLetterTab[0xD8] = true; // , CAPITAL LETTER O WITH STROKE + IsLetterTab[0xD9] = true; // , CAPITAL LETTER U WITH GRAVE ACCENT + IsLetterTab[0xDA] = true; // , CAPITAL LETTER U WITH ACUTE ACCENT + IsLetterTab[0xDB] = true; // , CAPITAL LETTER U WITH CIRCUMFLEX ACCENT + IsLetterTab[0xDC] = true; // , CAPITAL LETTER U WITH DIAERESIS + IsLetterTab[0xDD] = true; // , CAPITAL LETTER Y WITH ACUTE ACCENT + IsLetterTab[0xDE] = true; // , CAPITAL LETTER THORN + IsLetterTab[0xDF] = true; // , SMALL LETTER SHARP S + IsLetterTab[0xE0] = true; // , SMALL LETTER A WITH GRAVE ACCENT + IsLetterTab[0xE1] = true; // , SMALL LETTER A WITH ACUTE ACCENT + IsLetterTab[0xE2] = true; // , SMALL LETTER A WITH CIRCUMFLEX ACCENT + IsLetterTab[0xE3] = true; // , SMALL LETTER A WITH TILDE + IsLetterTab[0xE4] = true; // , SMALL LETTER A WITH DIAERESIS + IsLetterTab[0xE5] = true; // , SMALL LETTER A WITH RING ABOVE + IsLetterTab[0xE6] = true; // , SMALL LIGATURE AE + IsLetterTab[0xE7] = true; // , SMALL LETTER C WITH CEDILLA + IsLetterTab[0xE8] = true; // , SMALL LETTER E WITH GRAVE ACCENT + IsLetterTab[0xE9] = true; // , SMALL LETTER E WITH ACUTE ACCENT + IsLetterTab[0xEA] = true; // , SMALL LETTER E WITH CIRCUMFLEX ACCENT + IsLetterTab[0xEB] = true; // , SMALL LETTER E WITH DIAERESIS + IsLetterTab[0xEC] = true; // , SMALL LETTER I WITH GRAVE ACCENT + IsLetterTab[0xED] = true; // , SMALL LETTER I WITH ACUTE ACCENT + IsLetterTab[0xEE] = true; // , SMALL LETTER I WITH CIRCUMFLEX ACCENT + IsLetterTab[0xEF] = true; // , SMALL LETTER I WITH DIAERESIS + IsLetterTab[0xF0] = true; // , SMALL LETTER ETH + IsLetterTab[0xF1] = true; // , SMALL LETTER N WITH TILDE + IsLetterTab[0xF2] = true; // , SMALL LETTER O WITH GRAVE ACCENT + IsLetterTab[0xF3] = true; // , SMALL LETTER O WITH ACUTE ACCENT + IsLetterTab[0xF4] = true; // , SMALL LETTER O WITH CIRCUMFLEX ACCENT + IsLetterTab[0xF5] = true; // , SMALL LETTER O WITH TILDE + IsLetterTab[0xF6] = true; // , SMALL LETTER O WITH DIAERESIS + IsLetterTab[0xF8] = true; // , SMALL LETTER O WITH OBLIQUE BAR + IsLetterTab[0xF9] = true; // , SMALL LETTER U WITH GRAVE ACCENT + IsLetterTab[0xFA] = true; // , SMALL LETTER U WITH ACUTE ACCENT + IsLetterTab[0xFB] = true; // , SMALL LETTER U WITH CIRCUMFLEX ACCENT + IsLetterTab[0xFC] = true; // , SMALL LETTER U WITH DIAERESIS + IsLetterTab[0xFD] = true; // , SMALL LETTER Y WITH ACUTE ACCENT + IsLetterTab[0xFE] = true; // , SMALL LETTER THORN + IsLetterTab[0xFF] = true; // , SMALL LETTER Y WITH DIAERESIS +} + +bool LetterTable::isLetterUnicode( sal_Unicode c ) +{ + static CharClass* pCharClass = NULL; + if( pCharClass == NULL ) + pCharClass = new CharClass( Application::GetSettings().GetLocale() ); + String aStr( c ); + bool bRet = pCharClass->isLetter( aStr, 0 ); + return bRet; +} + +// Hilfsfunktion: Zeichen-Flag Testen +BOOL SimpleTokenizer_Impl::testCharFlags( sal_Unicode c, USHORT nTestFlags ) +{ + bool bRet = false; + if( c != 0 && c <= 255 ) + { + bRet = ( (aCharTypeTab[c] & nTestFlags) != 0 ); + } + else if( c > 255 ) + { + bRet = (( CHAR_START_IDENTIFIER | CHAR_IN_IDENTIFIER ) & nTestFlags) != 0 + ? BasicSimpleCharClass::isAlpha( c, true ) : false; + } + return bRet; +} + +void SimpleTokenizer_Impl::setKeyWords( const char** ppKeyWords, UINT16 nCount ) +{ + ppListKeyWords = ppKeyWords; + nKeyWordCount = nCount; +} + +// Neues Token holen +BOOL SimpleTokenizer_Impl::getNextToken( /*out*/TokenTypes& reType, + /*out*/const sal_Unicode*& rpStartPos, /*out*/const sal_Unicode*& rpEndPos ) +{ + reType = TT_UNKNOWN; + + // Position merken + rpStartPos = mpActualPos; + + // Zeichen untersuchen + sal_Unicode c = peekChar(); + if( c == CHAR_EOF ) + return FALSE; + + // Zeichen lesen + getChar(); + + //*** Alle Moeglichkeiten durchgehen *** + // Space? + if ( (testCharFlags( c, CHAR_SPACE ) == TRUE) ) + { + while( testCharFlags( peekChar(), CHAR_SPACE ) == TRUE ) + getChar(); + + reType = TT_WHITESPACE; + } + + // Identifier? + else if ( (testCharFlags( c, CHAR_START_IDENTIFIER ) == TRUE) ) + { + BOOL bIdentifierChar; + do + { + // Naechstes Zeichen holen + c = peekChar(); + bIdentifierChar = testCharFlags( c, CHAR_IN_IDENTIFIER ); + if( bIdentifierChar ) + getChar(); + } + while( bIdentifierChar ); + + reType = TT_IDENTIFIER; + + // Schluesselwort-Tabelle + if (ppListKeyWords != NULL) + { + int nCount = mpActualPos - rpStartPos; + + // No keyword if string contains char > 255 + bool bCanBeKeyword = true; + for( int i = 0 ; i < nCount ; i++ ) + { + if( rpStartPos[i] > 255 ) + { + bCanBeKeyword = false; + break; + } + } + + if( bCanBeKeyword ) + { + String aKWString(rpStartPos, sal::static_int_cast< xub_StrLen >(nCount) ); + ByteString aByteStr( aKWString, RTL_TEXTENCODING_ASCII_US ); + aByteStr.ToLowerAscii(); + if ( bsearch( aByteStr.GetBuffer(), ppListKeyWords, nKeyWordCount, sizeof( char* ), + compare_strings ) ) + { + reType = TT_KEYWORDS; + + if ( aByteStr.Equals( "rem" ) ) + { + // Alle Zeichen bis Zeilen-Ende oder EOF entfernen + sal_Unicode cPeek = peekChar(); + while( cPeek != CHAR_EOF && testCharFlags( cPeek, CHAR_EOL ) == FALSE ) + { + c = getChar(); + cPeek = peekChar(); + } + + reType = TT_COMMENT; + } + } + } + } + } + + // Operator? + // only for BASIC '\'' should be a comment, otherwise it is a normal string and handled there + else if ( ( testCharFlags( c, CHAR_OPERATOR ) == TRUE ) || ( (c == '\'') && (aLanguage==HIGHLIGHT_BASIC)) ) + { + // paramters for SQL view + if ( (c==':') || (c=='?')) + { + if (c!='?') + { + BOOL bIdentifierChar; + do + { + // Naechstes Zeichen holen + c = peekChar(); + bIdentifierChar = testCharFlags( c, CHAR_IN_IDENTIFIER ); + if( bIdentifierChar ) + getChar(); + } + while( bIdentifierChar ); + } + reType = TT_PARAMETER; + } + else if ((c=='-')) + { + sal_Unicode cPeekNext = peekChar(); + if (cPeekNext=='-') + { + // Alle Zeichen bis Zeilen-Ende oder EOF entfernen + sal_Unicode cPeek = peekChar(); + while( cPeek != CHAR_EOF && testCharFlags( cPeek, CHAR_EOL ) == FALSE ) + { + getChar(); + cPeek = peekChar(); + } + + reType = TT_COMMENT; + } + } + else + { + // Kommentar ? + if ( c == '\'' ) + { + c = getChar(); // '/' entfernen + + // Alle Zeichen bis Zeilen-Ende oder EOF entfernen + sal_Unicode cPeek = peekChar(); + while( cPeek != CHAR_EOF && testCharFlags( cPeek, CHAR_EOL ) == FALSE ) + { + getChar(); + cPeek = peekChar(); + } + + reType = TT_COMMENT; + } + + // Echter Operator, kann hier einfach behandelt werden, + // da nicht der wirkliche Operator, wie z.B. += interessiert, + // sondern nur die Tatsache, dass es sich um einen handelt. + if( reType != TT_COMMENT ) + { + reType = TT_OPERATOR; + } + + } + } + + // Objekt-Trenner? Muss vor Number abgehandelt werden + else if( c == '.' && ( peekChar() < '0' || peekChar() > '9' ) ) + { + reType = TT_OPERATOR; + } + + // Zahl? + else if( testCharFlags( c, CHAR_START_NUMBER ) == TRUE ) + { + reType = TT_NUMBER; + + // Zahlensystem, 10 = normal, wird bei Oct/Hex geaendert + int nRadix = 10; + + // Ist es eine Hex- oder Oct-Zahl? + if( c == '&' ) + { + // Octal? + if( peekChar() == 'o' || peekChar() == 'O' ) + { + // o entfernen + getChar(); + nRadix = 8; // Octal-Basis + + // Alle Ziffern einlesen + while( testCharFlags( peekChar(), CHAR_IN_OCT_NUMBER ) ) + c = getChar(); + } + // Hex? + else if( peekChar() == 'h' || peekChar() == 'H' ) + { + // x entfernen + getChar(); + nRadix = 16; // Hex-Basis + + // Alle Ziffern einlesen und puffern + while( testCharFlags( peekChar(), CHAR_IN_HEX_NUMBER ) ) + c = getChar(); + } + else + { + reType = TT_OPERATOR; + } + } + + // Wenn nicht Oct oder Hex als double ansehen + if( reType == TT_NUMBER && nRadix == 10 ) + { + // Flag, ob das letzte Zeichen ein Exponent war + BOOL bAfterExpChar = FALSE; + + // Alle Ziffern einlesen + while( testCharFlags( peekChar(), CHAR_IN_NUMBER ) || + (bAfterExpChar && peekChar() == '+' ) || + (bAfterExpChar && peekChar() == '-' ) ) + // Nach Exponent auch +/- OK + { + c = getChar(); // Zeichen lesen + bAfterExpChar = ( c == 'e' || c == 'E' ); + } + } + + // reType = TT_NUMBER; + } + + // String? + else if( testCharFlags( c, CHAR_START_STRING ) == TRUE ) + { + // Merken, welches Zeichen den String eroeffnet hat + sal_Unicode cEndString = c; + if( c == '[' ) + cEndString = ']'; + + // Alle Ziffern einlesen und puffern + while( peekChar() != cEndString ) + { + // #58846 EOF vor getChar() abfangen, damit EOF micht verloren geht + if( peekChar() == CHAR_EOF ) + { + // ERROR: unterminated string literal + reType = TT_ERROR; + break; + } + c = getChar(); + if( testCharFlags( c, CHAR_EOL ) == TRUE ) + { + // ERROR: unterminated string literal + reType = TT_ERROR; + break; + } + } + + // Zeichen lesen + if( reType != TT_ERROR ) + { + getChar(); + if( cEndString == ']' ) + reType = TT_IDENTIFIER; + else + reType = TT_STRING; + } + } + + // Zeilenende? + else if( testCharFlags( c, CHAR_EOL ) == TRUE ) + { + // Falls ein weiteres anderes EOL-Char folgt, weg damit + sal_Unicode cNext = peekChar(); + if( cNext != c && testCharFlags( cNext, CHAR_EOL ) == TRUE ) + getChar(); + + // Positions-Daten auf Zeilen-Beginn setzen + nCol = 0; + nLine++; + + reType = TT_EOL; + } + + // Alles andere bleibt TT_UNKNOWN + + + // End-Position eintragen + rpEndPos = mpActualPos; + return TRUE; +} + +String SimpleTokenizer_Impl::getTokStr + ( /*out*/const sal_Unicode* pStartPos, /*out*/const sal_Unicode* pEndPos ) +{ + return String( pStartPos, (USHORT)( pEndPos - pStartPos ) ); +} + +#ifndef PRODUCT +// 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, (USHORT)( pEndPos - pStartPos ) ); + } + aOut += String( RTL_CONSTASCII_USTRINGPARAM("\n") ); + return aOut; +} +#endif + +SimpleTokenizer_Impl::SimpleTokenizer_Impl( HighlighterLanguage aLang ): aLanguage(aLang) +{ + memset( aCharTypeTab, 0, sizeof( aCharTypeTab ) ); + + // Zeichen-Tabelle fuellen + USHORT i; + + // Zulaessige Zeichen fuer Identifier + USHORT nHelpMask = (USHORT)( CHAR_START_IDENTIFIER | CHAR_IN_IDENTIFIER ); + for( i = 'a' ; i <= 'z' ; i++ ) + aCharTypeTab[i] |= nHelpMask; + for( i = 'A' ; i <= 'Z' ; i++ ) + aCharTypeTab[i] |= nHelpMask; + // '_' extra eintragen + aCharTypeTab[(int)'_'] |= nHelpMask; + // AB 23.6.97: '$' ist auch erlaubt + aCharTypeTab[(int)'$'] |= nHelpMask; + + // Ziffern (Identifier und Number ist moeglich) + nHelpMask = (USHORT)( CHAR_IN_IDENTIFIER | CHAR_START_NUMBER | + CHAR_IN_NUMBER | CHAR_IN_HEX_NUMBER ); + for( i = '0' ; i <= '9' ; i++ ) + aCharTypeTab[i] |= nHelpMask; + + // e und E sowie . von Hand ergaenzen + aCharTypeTab[(int)'e'] |= CHAR_IN_NUMBER; + aCharTypeTab[(int)'E'] |= CHAR_IN_NUMBER; + aCharTypeTab[(int)'.'] |= (USHORT)( CHAR_IN_NUMBER | CHAR_START_NUMBER ); + aCharTypeTab[(int)'&'] |= CHAR_START_NUMBER; + + // Hex-Ziffern + for( i = 'a' ; i <= 'f' ; i++ ) + aCharTypeTab[i] |= CHAR_IN_HEX_NUMBER; + for( i = 'A' ; i <= 'F' ; i++ ) + aCharTypeTab[i] |= CHAR_IN_HEX_NUMBER; + + // Oct-Ziffern + for( i = '0' ; i <= '7' ; i++ ) + aCharTypeTab[i] |= CHAR_IN_OCT_NUMBER; + + // String-Beginn/End-Zeichen + aCharTypeTab[(int)'\''] |= CHAR_START_STRING; + aCharTypeTab[(int)'\"'] |= CHAR_START_STRING; + aCharTypeTab[(int)'['] |= CHAR_START_STRING; + aCharTypeTab[(int)'`'] |= CHAR_START_STRING; + + // Operator-Zeichen + aCharTypeTab[(int)'!'] |= CHAR_OPERATOR; + aCharTypeTab[(int)'%'] |= CHAR_OPERATOR; + // aCharTypeTab[(int)'&'] |= CHAR_OPERATOR; Removed because of #i14140 + aCharTypeTab[(int)'('] |= CHAR_OPERATOR; + aCharTypeTab[(int)')'] |= CHAR_OPERATOR; + aCharTypeTab[(int)'*'] |= CHAR_OPERATOR; + aCharTypeTab[(int)'+'] |= CHAR_OPERATOR; + aCharTypeTab[(int)','] |= CHAR_OPERATOR; + aCharTypeTab[(int)'-'] |= CHAR_OPERATOR; + aCharTypeTab[(int)'/'] |= CHAR_OPERATOR; + aCharTypeTab[(int)':'] |= CHAR_OPERATOR; + aCharTypeTab[(int)'<'] |= CHAR_OPERATOR; + aCharTypeTab[(int)'='] |= CHAR_OPERATOR; + aCharTypeTab[(int)'>'] |= CHAR_OPERATOR; + aCharTypeTab[(int)'?'] |= CHAR_OPERATOR; + aCharTypeTab[(int)'^'] |= CHAR_OPERATOR; + aCharTypeTab[(int)'|'] |= CHAR_OPERATOR; + aCharTypeTab[(int)'~'] |= CHAR_OPERATOR; + aCharTypeTab[(int)'{'] |= CHAR_OPERATOR; + aCharTypeTab[(int)'}'] |= CHAR_OPERATOR; + // aCharTypeTab[(int)'['] |= CHAR_OPERATOR; Removed because of #i17826 + aCharTypeTab[(int)']'] |= CHAR_OPERATOR; + aCharTypeTab[(int)';'] |= CHAR_OPERATOR; + + // Space + aCharTypeTab[(int)' ' ] |= CHAR_SPACE; + aCharTypeTab[(int)'\t'] |= CHAR_SPACE; + + // Zeilen-Ende-Zeichen + aCharTypeTab[(int)'\r'] |= CHAR_EOL; + aCharTypeTab[(int)'\n'] |= CHAR_EOL; + + ppListKeyWords = NULL; +} + +SimpleTokenizer_Impl::~SimpleTokenizer_Impl( void ) +{ +} + +SimpleTokenizer_Impl* getSimpleTokenizer( void ) +{ + static SimpleTokenizer_Impl* pSimpleTokenizer = NULL; + if( !pSimpleTokenizer ) + pSimpleTokenizer = new SimpleTokenizer_Impl(); + return pSimpleTokenizer; +} + +// Heraussuchen der jeweils naechsten Funktion aus einem JavaScript-Modul +UINT16 SimpleTokenizer_Impl::parseLine( UINT32 nParseLine, const String* aSource ) +{ + // Position auf den Anfang des Source-Strings setzen + mpStringBegin = mpActualPos = aSource->GetBuffer(); + + // Zeile und Spalte initialisieren + nLine = nParseLine; + nCol = 0L; + + // Variablen fuer die Out-Parameter + TokenTypes eType; + const sal_Unicode* pStartPos; + const sal_Unicode* pEndPos; + + // Schleife ueber alle Tokens + UINT16 nTokenCount = 0; + while( getNextToken( eType, pStartPos, pEndPos ) ) + nTokenCount++; + + return nTokenCount; +} + +void SimpleTokenizer_Impl::getHighlightPortions( UINT32 nParseLine, const String& rLine, + /*out*/HighlightPortions& portions ) +{ + // Position auf den Anfang des Source-Strings setzen + mpStringBegin = mpActualPos = rLine.GetBuffer(); + + // Zeile und Spalte initialisieren + nLine = nParseLine; + nCol = 0L; + + // Variablen fuer die Out-Parameter + TokenTypes eType; + const sal_Unicode* pStartPos; + const sal_Unicode* pEndPos; + + // Schleife ueber alle Tokens + while( getNextToken( eType, pStartPos, pEndPos ) ) + { + HighlightPortion portion; + + portion.nBegin = (UINT16)(pStartPos - mpStringBegin); + portion.nEnd = (UINT16)(pEndPos - mpStringBegin); + portion.tokenType = eType; + + portions.Insert(portion, portions.Count()); + } +} + + +////////////////////////////////////////////////////////////////////////// +// Implementierung des SyntaxHighlighter + +SyntaxHighlighter::SyntaxHighlighter() +{ + m_pSimpleTokenizer = 0; + m_pKeyWords = NULL; + m_nKeyWordCount = 0; +} + +SyntaxHighlighter::~SyntaxHighlighter() +{ + delete m_pSimpleTokenizer; + delete m_pKeyWords; +} + +void SyntaxHighlighter::initialize( HighlighterLanguage eLanguage_ ) +{ + eLanguage = eLanguage_; + delete m_pSimpleTokenizer; + m_pSimpleTokenizer = new SimpleTokenizer_Impl(eLanguage); + + switch (eLanguage) + { + case HIGHLIGHT_BASIC: + m_pSimpleTokenizer->setKeyWords( strListBasicKeyWords, + sizeof( strListBasicKeyWords ) / sizeof( char* )); + break; + case HIGHLIGHT_SQL: + m_pSimpleTokenizer->setKeyWords( strListSqlKeyWords, + sizeof( strListSqlKeyWords ) / sizeof( char* )); + break; + default: + m_pSimpleTokenizer->setKeyWords( NULL, 0 ); + } +} + +const Range SyntaxHighlighter::notifyChange( UINT32 nLine, INT32 nLineCountDifference, + const String* pChangedLines, UINT32 nArrayLength) +{ + (void)nLineCountDifference; + + for( UINT32 i=0 ; i < nArrayLength ; i++ ) + m_pSimpleTokenizer->parseLine(nLine+i, &pChangedLines[i]); + + return Range( nLine, nLine + nArrayLength-1 ); +} + +void SyntaxHighlighter::getHighlightPortions( UINT32 nLine, const String& rLine, + /*out*/HighlightPortions& portions ) +{ + m_pSimpleTokenizer->getHighlightPortions( nLine, rLine, portions ); +} diff --git a/svtools/source/edit/texteng.cxx b/svtools/source/edit/texteng.cxx index 4f0ff7974372..e7eff8385206 100644 --- a/svtools/source/edit/texteng.cxx +++ b/svtools/source/edit/texteng.cxx @@ -634,8 +634,8 @@ TextPaM TextEngine::ImpDeleteText( const TextSelection& rSel ) CursorMoved( aStartPaM.GetPara() ); // nur damit neu eingestellte Attribute verschwinden... CursorMoved( aEndPaM.GetPara() ); // nur damit neu eingestellte Attribute verschwinden... - DBG_ASSERT( mpDoc->IsValidPaM( aStartPaM ), "Index im Wald in ImpDeleteText" ) - DBG_ASSERT( mpDoc->IsValidPaM( aEndPaM ), "Index im Wald in ImpDeleteText" ) + DBG_ASSERT( mpDoc->IsValidPaM( aStartPaM ), "Index im Wald in ImpDeleteText" ); + DBG_ASSERT( mpDoc->IsValidPaM( aEndPaM ), "Index im Wald in ImpDeleteText" ); ULONG nStartNode = aStartPaM.GetPara(); ULONG nEndNode = aEndPaM.GetPara(); @@ -3106,7 +3106,7 @@ void TextEngine::ImpInitWritingDirections( ULONG nPara ) UBiDi* pBidi = ubidi_openSized( aText.Len(), 0, &nError ); nError = U_ZERO_ERROR; - ubidi_setPara( pBidi, aText.GetBuffer(), aText.Len(), nBidiLevel, NULL, &nError ); + ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(aText.GetBuffer()), aText.Len(), nBidiLevel, NULL, &nError ); // UChar != sal_Unicode in MinGW nError = U_ZERO_ERROR; long nCount = ubidi_countRuns( pBidi, &nError ); diff --git a/svtools/source/edit/textview.cxx b/svtools/source/edit/textview.cxx index bcbe2b1b6386..e0697a488287 100644 --- a/svtools/source/edit/textview.cxx +++ b/svtools/source/edit/textview.cxx @@ -630,6 +630,22 @@ BOOL TextView::KeyInput( const KeyEvent& rKeyEvent ) case KEY_END: case KEY_PAGEUP: case KEY_PAGEDOWN: + case com::sun::star::awt::Key::MOVE_WORD_FORWARD: + case com::sun::star::awt::Key::SELECT_WORD_FORWARD: + case com::sun::star::awt::Key::MOVE_WORD_BACKWARD: + case com::sun::star::awt::Key::SELECT_WORD_BACKWARD: + case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_LINE: + case com::sun::star::awt::Key::MOVE_TO_END_OF_LINE: + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE: + case com::sun::star::awt::Key::SELECT_TO_END_OF_LINE: + case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH: + case com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH: + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH: + case com::sun::star::awt::Key::SELECT_TO_END_OF_PARAGRAPH: + case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT: + case com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT: + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT: + case com::sun::star::awt::Key::SELECT_TO_END_OF_DOCUMENT: { if ( ( !rKeyEvent.GetKeyCode().IsMod2() || ( nCode == KEY_LEFT ) || ( nCode == KEY_RIGHT ) ) && !( rKeyEvent.GetKeyCode().IsMod1() && ( nCode == KEY_PAGEUP || nCode == KEY_PAGEDOWN ) ) ) @@ -649,6 +665,10 @@ BOOL TextView::KeyInput( const KeyEvent& rKeyEvent ) break; case KEY_BACKSPACE: case KEY_DELETE: + case com::sun::star::awt::Key::DELETE_WORD_BACKWARD: + case com::sun::star::awt::Key::DELETE_WORD_FORWARD: + case com::sun::star::awt::Key::DELETE_TO_BEGIN_OF_LINE: + case com::sun::star::awt::Key::DELETE_TO_END_OF_LINE: { if ( !mpImpl->mbReadOnly && !rKeyEvent.GetKeyCode().IsMod2() ) { @@ -657,6 +677,27 @@ BOOL TextView::KeyInput( const KeyEvent& rKeyEvent ) if ( ( nMode == DELMODE_RESTOFWORD ) && rKeyEvent.GetKeyCode().IsShift() ) nMode = DELMODE_RESTOFCONTENT; + switch( nCode ) + { + case com::sun::star::awt::Key::DELETE_WORD_BACKWARD: + nDel = DEL_LEFT; + nMode = DELMODE_RESTOFWORD; + break; + case com::sun::star::awt::Key::DELETE_WORD_FORWARD: + nDel = DEL_RIGHT; + nMode = DELMODE_RESTOFWORD; + break; + case com::sun::star::awt::Key::DELETE_TO_BEGIN_OF_LINE: + nDel = DEL_LEFT; + nMode = DELMODE_RESTOFCONTENT; + break; + case com::sun::star::awt::Key::DELETE_TO_END_OF_LINE: + nDel = DEL_RIGHT; + nMode = DELMODE_RESTOFCONTENT; + break; + default: break; + } + mpImpl->mpTextEngine->UndoActionStart( TEXTUNDO_DELETE ); if(mpImpl->mbSupportProtectAttribute) { @@ -1163,13 +1204,10 @@ void TextView::Paste( uno::Reference< datatransfer::clipboard::XClipboard >& rxC uno::Any aData = xDataObj->getTransferData( aFlavor ); ::rtl::OUString aText; aData >>= aText; - - bool bWasTruncated = ImplTruncateNewText( aText ); - - String aStr( aText ); - aStr.ConvertLineEnd( LINEEND_LF ); - - InsertText( aText, FALSE ); + bool bWasTruncated = false; + if( mpImpl->mpTextEngine->GetMaxTextLen() != 0 ) + bWasTruncated = ImplTruncateNewText( aText ); + InsertNewText( aText, FALSE ); mpImpl->mpTextEngine->Broadcast( TextHint( TEXT_HINT_MODIFIED ) ); if( bWasTruncated ) @@ -1239,6 +1277,7 @@ TextSelection TextView::ImpMoveCursor( const KeyEvent& rKeyEvent ) BOOL bCtrl = aTranslatedKeyEvent.GetKeyCode().IsMod1() ? TRUE : FALSE; USHORT nCode = aTranslatedKeyEvent.GetKeyCode().GetCode(); + bool bSelect = aTranslatedKeyEvent.GetKeyCode().IsShift(); switch ( nCode ) { case KEY_UP: aPaM = CursorUp( aPaM ); @@ -1257,10 +1296,50 @@ TextSelection TextView::ImpMoveCursor( const KeyEvent& rKeyEvent ) break; case KEY_RIGHT: aPaM = bCtrl ? CursorWordRight( aPaM ) : CursorRight( aPaM, aTranslatedKeyEvent.GetKeyCode().IsMod2() ? (USHORT)i18n::CharacterIteratorMode::SKIPCHARACTER : (USHORT)i18n::CharacterIteratorMode::SKIPCELL ); break; + case com::sun::star::awt::Key::SELECT_WORD_FORWARD: + bSelect = true; // fallthrough intentional + case com::sun::star::awt::Key::MOVE_WORD_FORWARD: + aPaM = CursorWordRight( aPaM ); + break; + case com::sun::star::awt::Key::SELECT_WORD_BACKWARD: + bSelect = true; // fallthrough intentional + case com::sun::star::awt::Key::MOVE_WORD_BACKWARD: + aPaM = CursorWordLeft( aPaM ); + break; + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE: + bSelect = true; // fallthrough intentional + case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_LINE: + aPaM = CursorStartOfLine( aPaM ); + break; + case com::sun::star::awt::Key::SELECT_TO_END_OF_LINE: + bSelect = true; // fallthrough intentional + case com::sun::star::awt::Key::MOVE_TO_END_OF_LINE: + aPaM = CursorEndOfLine( aPaM ); + break; + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH: + bSelect = true; // falltthrough intentional + case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH: + aPaM = CursorStartOfParagraph( aPaM ); + break; + case com::sun::star::awt::Key::SELECT_TO_END_OF_PARAGRAPH: + bSelect = true; // falltthrough intentional + case com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH: + aPaM = CursorEndOfParagraph( aPaM ); + break; + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT: + bSelect = true; // falltthrough intentional + case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT: + aPaM = CursorStartOfDoc(); + break; + case com::sun::star::awt::Key::SELECT_TO_END_OF_DOCUMENT: + bSelect = true; // falltthrough intentional + case com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT: + aPaM = CursorEndOfDoc(); + break; } // Bewirkt evtl. ein CreateAnchor oder Deselection all - mpImpl->mpSelEngine->CursorPosChanging( aTranslatedKeyEvent.GetKeyCode().IsShift(), aTranslatedKeyEvent.GetKeyCode().IsMod1() ); + mpImpl->mpSelEngine->CursorPosChanging( bSelect, aTranslatedKeyEvent.GetKeyCode().IsMod1() ); if ( aOldEnd != aPaM ) { @@ -1270,7 +1349,7 @@ TextSelection TextView::ImpMoveCursor( const KeyEvent& rKeyEvent ) TextSelection aOldSelection( mpImpl->maSelection ); TextSelection aNewSelection( mpImpl->maSelection ); aNewSelection.GetEnd() = aPaM; - if ( aTranslatedKeyEvent.GetKeyCode().IsShift() ) + if ( bSelect ) { // Dann wird die Selektion erweitert... ImpSetSelection( aNewSelection ); @@ -1288,6 +1367,55 @@ TextSelection TextView::ImpMoveCursor( const KeyEvent& rKeyEvent ) void TextView::InsertText( const XubString& rStr, BOOL bSelect ) { + InsertNewText( rStr, bSelect ); +} + +void TextView::InsertNewText( const rtl::OUString& rStr, BOOL bSelect ) +{ +// HideSelection(); + mpImpl->mpTextEngine->UndoActionStart( TEXTUNDO_INSERT ); + + /* #i87633# + break inserted text into chunks that fit into the underlying String + based API (which has a maximum length of 65534 elements + + note: this will of course still cause problems for lines longer than those + 65534 elements, but those cases will hopefully be few. + In the long run someone should switch the TextEngine to OUString instead of String + */ + sal_Int32 nLen = rStr.getLength(); + sal_Int32 nPos = 0; + while( nLen ) + { + sal_Int32 nChunkLen = nLen > 65534 ? 65534 : nLen; + String aChunk( rStr.copy( nPos, nChunkLen ) ); + + TextSelection aNewSel( mpImpl->maSelection ); + + TextPaM aPaM = mpImpl->mpTextEngine->ImpInsertText( mpImpl->maSelection, aChunk ); + + if ( bSelect ) + { + aNewSel.Justify(); + aNewSel.GetEnd() = aPaM; + } + else + { + aNewSel = aPaM; + } + + ImpSetSelection( aNewSel ); + nLen -= nChunkLen; + nPos += nChunkLen; + } + mpImpl->mpTextEngine->UndoActionEnd( TEXTUNDO_INSERT ); + + mpImpl->mpTextEngine->FormatAndUpdate( this ); +} + +/* +void TextView::InsertText( const XubString& rStr, BOOL bSelect ) +{ // HideSelection(); TextSelection aNewSel( mpImpl->maSelection ); @@ -1310,6 +1438,7 @@ void TextView::InsertText( const XubString& rStr, BOOL bSelect ) mpImpl->mpTextEngine->FormatAndUpdate( this ); } +*/ // OLD TextPaM TextView::CursorLeft( const TextPaM& rPaM, BOOL bWordMode ) @@ -1922,20 +2051,22 @@ bool TextView::ImplTruncateNewText( rtl::OUString& rNewText ) const } ULONG nMaxLen = mpImpl->mpTextEngine->GetMaxTextLen(); - if( nMaxLen == 0 ) // 0 means unlimited - nMaxLen = 65534; // limit to string api - ULONG nCurLen = mpImpl->mpTextEngine->GetTextLen(); - - sal_uInt32 nNewLen = rNewText.getLength(); - if ( nCurLen + nNewLen > nMaxLen ) + // 0 means unlimited, there is just the String API limit handled above + if( nMaxLen != 0 ) { - // see how much text will be replaced - ULONG nSelLen = mpImpl->mpTextEngine->GetTextLen( mpImpl->maSelection ); - if ( nCurLen + nNewLen - nSelLen > nMaxLen ) + ULONG nCurLen = mpImpl->mpTextEngine->GetTextLen(); + + sal_uInt32 nNewLen = rNewText.getLength(); + if ( nCurLen + nNewLen > nMaxLen ) { - sal_uInt32 nTruncatedLen = static_cast<sal_uInt32>(nMaxLen - (nCurLen - nSelLen)); - rNewText = rNewText.copy( 0, nTruncatedLen ); - bTruncated = true; + // see how much text will be replaced + ULONG nSelLen = mpImpl->mpTextEngine->GetTextLen( mpImpl->maSelection ); + if ( nCurLen + nNewLen - nSelLen > nMaxLen ) + { + sal_uInt32 nTruncatedLen = static_cast<sal_uInt32>(nMaxLen - (nCurLen - nSelLen)); + rNewText = rNewText.copy( 0, nTruncatedLen ); + bTruncated = true; + } } } return bTruncated; diff --git a/svtools/source/inc/configitems/accessibilityoptions_const.hxx b/svtools/source/inc/configitems/accessibilityoptions_const.hxx new file mode 100644 index 000000000000..07dff55591a6 --- /dev/null +++ b/svtools/source/inc/configitems/accessibilityoptions_const.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: accessibilityoptions_const.hxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:17:49 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#ifndef INCLUDE_CONFIGITEMS_ACCESSIBILITYOPTIONS_CONST_HXX +#define INCLUDE_CONFIGITEMS_ACCESSIBILITYOPTIONS_CONST_HXX + +#include <rtl/ustring.hxx> + +namespace +{ + static const ::rtl::OUString s_sAccessibility = ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/Accessibility"); + static const ::rtl::OUString s_sAutoDetectSystemHC = ::rtl::OUString::createFromAscii("AutoDetectSystemHC"); + static const ::rtl::OUString s_sIsForPagePreviews = ::rtl::OUString::createFromAscii("IsForPagePreviews"); + static const ::rtl::OUString s_sIsHelpTipsDisappear = ::rtl::OUString::createFromAscii("IsHelpTipsDisappear"); + static const ::rtl::OUString s_sHelpTipSeconds = ::rtl::OUString::createFromAscii("HelpTipSeconds"); + static const ::rtl::OUString s_sIsAllowAnimatedGraphics = ::rtl::OUString::createFromAscii("IsAllowAnimatedGraphics"); + static const ::rtl::OUString s_sIsAllowAnimatedText = ::rtl::OUString::createFromAscii("IsAllowAnimatedText"); + static const ::rtl::OUString s_sIsAutomaticFontColor = ::rtl::OUString::createFromAscii("IsAutomaticFontColor"); + static const ::rtl::OUString s_sIsSystemFont = ::rtl::OUString::createFromAscii("IsSystemFont"); + static const ::rtl::OUString s_sIsSelectionInReadonly = ::rtl::OUString::createFromAscii("IsSelectionInReadonly"); +} + +#endif // INCLUDE_CONFIGITEMS_ACCESSIBILITYOPTIONS_CONST_HXX diff --git a/svtools/source/inc/configitems/historyoptions_const.hxx b/svtools/source/inc/configitems/historyoptions_const.hxx new file mode 100644 index 000000000000..c9148aeb26f8 --- /dev/null +++ b/svtools/source/inc/configitems/historyoptions_const.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: historyoptions_const.hxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:17:49 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + +#ifndef INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX +#define INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX + +#include <rtl/ustring.hxx> + +namespace +{ + static const ::rtl::OUString s_sCommonHistory = ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/History"); + static const ::rtl::OUString s_sHistories = ::rtl::OUString::createFromAscii("org.openoffice.Office.Histories/Histories"); + static const ::rtl::OUString s_sPickListSize = ::rtl::OUString::createFromAscii("PickListSize"); + static const ::rtl::OUString s_sURLHistorySize = ::rtl::OUString::createFromAscii("Size"); + static const ::rtl::OUString s_sHelpBookmarksSize = ::rtl::OUString::createFromAscii("HelpBookmarkSize"); + static const ::rtl::OUString s_sPickList = ::rtl::OUString::createFromAscii("PickList"); + static const ::rtl::OUString s_sURLHistory = ::rtl::OUString::createFromAscii("URLHistory"); + static const ::rtl::OUString s_sHelpBookmarks = ::rtl::OUString::createFromAscii("HelpBookmarks"); + static const ::rtl::OUString s_sItemList = ::rtl::OUString::createFromAscii("ItemList"); + static const ::rtl::OUString s_sOrderList = ::rtl::OUString::createFromAscii("OrderList"); + static const ::rtl::OUString s_sHistoryItemRef = ::rtl::OUString::createFromAscii("HistoryItemRef"); + static const ::rtl::OUString s_sURL = ::rtl::OUString::createFromAscii("URL"); + static const ::rtl::OUString s_sFilter = ::rtl::OUString::createFromAscii("Filter"); + static const ::rtl::OUString s_sTitle = ::rtl::OUString::createFromAscii("Title"); + static const ::rtl::OUString s_sPassword = ::rtl::OUString::createFromAscii("Password"); +} + +#endif // INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX diff --git a/svtools/source/inc/configitems/useroptions_const.hxx b/svtools/source/inc/configitems/useroptions_const.hxx new file mode 100644 index 000000000000..bd3c6535b00c --- /dev/null +++ b/svtools/source/inc/configitems/useroptions_const.hxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: useroptions_const.hxx,v $ + * + * $Revision: 1.1.4.2 $ + * + * last change: $Author: as $ $Date: 2008/03/19 11:17:50 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/
+
+#ifndef INCLUDE_CONFIGITEMS_USEROPTIONS_CONST_HXX
+#define INCLUDE_CONFIGITEMS_USEROPTIONS_CONST_HXX
+
+#include <rtl/ustring.hxx>
+
+namespace
+{
+ static const ::rtl::OUString s_sData = ::rtl::OUString::createFromAscii("org.openoffice.UserProfile/Data");
+ static const ::rtl::OUString s_so = ::rtl::OUString::createFromAscii("o"); // USER_OPT_COMPANY
+ static const ::rtl::OUString s_sgivenname = ::rtl::OUString::createFromAscii("givenname"); // USER_OPT_FIRSTNAME
+ static const ::rtl::OUString s_ssn = ::rtl::OUString::createFromAscii("sn"); // USER_OPT_LASTNAME
+ static const ::rtl::OUString s_sinitials = ::rtl::OUString::createFromAscii("initials"); // USER_OPT_ID
+ static const ::rtl::OUString s_sstreet = ::rtl::OUString::createFromAscii("street"); // USER_OPT_STREET
+ static const ::rtl::OUString s_sl = ::rtl::OUString::createFromAscii("l"); // USER_OPT_CITY
+ static const ::rtl::OUString s_sst = ::rtl::OUString::createFromAscii("st"); // USER_OPT_STATE
+ static const ::rtl::OUString s_spostalcode = ::rtl::OUString::createFromAscii("postalcode"); // USER_OPT_ZIP
+ static const ::rtl::OUString s_sc = ::rtl::OUString::createFromAscii("c"); // USER_OPT_COUNTRY
+ static const ::rtl::OUString s_stitle = ::rtl::OUString::createFromAscii("title"); // USER_OPT_TITLE
+ static const ::rtl::OUString s_sposition = ::rtl::OUString::createFromAscii("position"); // USER_OPT_POSITION
+ static const ::rtl::OUString s_shomephone = ::rtl::OUString::createFromAscii("homephone"); // USER_OPT_TELEPHONEHOME
+ static const ::rtl::OUString s_stelephonenumber = ::rtl::OUString::createFromAscii("telephonenumber"); // USER_OPT_TELEPHONEWORK
+ static const ::rtl::OUString s_sfacsimiletelephonenumber = ::rtl::OUString::createFromAscii("facsimiletelephonenumber"); // USER_OPT_FAX
+ static const ::rtl::OUString s_smail = ::rtl::OUString::createFromAscii("mail"); // USER_OPT_EMAIL
+ static const ::rtl::OUString s_scustomernumber = ::rtl::OUString::createFromAscii("customernumber"); // USER_OPT_CUSTOMERNUMBER
+ static const ::rtl::OUString s_sfathersname = ::rtl::OUString::createFromAscii("fathersname"); // USER_OPT_FATHERSNAME
+ static const ::rtl::OUString s_sapartment = ::rtl::OUString::createFromAscii("apartment"); // USER_OPT_APARTMENT
+}
+
+#endif // INCLUDE_CONFIGITEMS_USEROPTIONS_CONST_HXX
diff --git a/svtools/source/inc/passwordcontainer.hxx b/svtools/source/inc/passwordcontainer.hxx index 85b960a546b9..a6edea49f699 100644 --- a/svtools/source/inc/passwordcontainer.hxx +++ b/svtools/source/inc/passwordcontainer.hxx @@ -39,7 +39,7 @@ #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/task/XMasterPasswordHandling.hpp> +#include <com/sun/star/task/XMasterPasswordHandling2.hpp> #include <cppuhelper/implbase4.hxx> #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/queryinterface.hxx> @@ -225,7 +225,7 @@ public: void clear(); sal_Bool getEncodedMP( ::rtl::OUString& aResult ); - void setEncodedMP( const ::rtl::OUString& aResult ); + void setEncodedMP( const ::rtl::OUString& aResult, sal_Bool bAcceptEnmpty = sal_False ); void setUseStorage( sal_Bool bUse ); sal_Bool useStorage(); @@ -243,7 +243,7 @@ enum PasswordState { class PasswordContainer : public ::cppu::WeakImplHelper4< ::com::sun::star::task::XPasswordContainer, - ::com::sun::star::task::XMasterPasswordHandling, + ::com::sun::star::task::XMasterPasswordHandling2, ::com::sun::star::lang::XServiceInfo, ::com::sun::star::lang::XEventListener > { @@ -270,6 +270,8 @@ private: const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString GetDefaultMasterPassword(); + ::rtl::OUString RequestPasswordFromUser( ::com::sun::star::task::PasswordRequestMode aRMode, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ); @@ -363,6 +365,10 @@ public: virtual ::sal_Bool SAL_CALL allowPersistentStoring( ::sal_Bool bAllow ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL isPersistentStoringAllowed( ) throw (::com::sun::star::uno::RuntimeException); + // XMasterPasswordHandling2 + virtual ::sal_Bool SAL_CALL useDefaultMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isDefaultMasterPasswordUsed( ) throw (::com::sun::star::uno::RuntimeException); + void Notify(); }; diff --git a/svtools/source/items1/itempool.cxx b/svtools/source/items1/itempool.cxx index 71eaefcf12cb..f6a48b51019f 100644 --- a/svtools/source/items1/itempool.cxx +++ b/svtools/source/items1/itempool.cxx @@ -1128,7 +1128,7 @@ void SfxItemPool::SetFileFormatVersion( USHORT nFileFormatVersion ) { DBG_ASSERT( this == pMaster, - "SfxItemPool::SetFileFormatVersion() but not a master pool" ) + "SfxItemPool::SetFileFormatVersion() but not a master pool" ); for ( SfxItemPool *pPool = this; pPool; pPool = pPool->pSecondary ) pPool->_nFileFormatVersion = nFileFormatVersion; } diff --git a/svtools/source/items1/poolio.cxx b/svtools/source/items1/poolio.cxx index 47193f9daf56..f2eb94ef7f67 100644 --- a/svtools/source/items1/poolio.cxx +++ b/svtools/source/items1/poolio.cxx @@ -715,10 +715,12 @@ SvStream &SfxItemPool::Load(SvStream &rStream) // ggf. Secondary-Pool laden aPoolRec.Skip(); if ( pSecondary ) + { if ( !bSecondaryLoaded ) pSecondary->Load( rStream ); else rStream.Seek( nSecondaryEnd ); + } // wenn nicht own-Pool, dann kein Name if ( aExternName != aName ) @@ -1011,10 +1013,12 @@ SvStream &SfxItemPool::Load1_Impl(SvStream &rStream) CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_ENDPOOL ); if ( pSecondary ) + { if ( !bSecondaryLoaded ) pSecondary->Load1_Impl( rStream ); else rStream.Seek( nSecondaryEnd ); + } if ( aExternName != aName ) aName.Erase(); diff --git a/svtools/source/items1/sfontitm.cxx b/svtools/source/items1/sfontitm.cxx index d0f3781a249d..ee7119c95e1c 100644 --- a/svtools/source/items1/sfontitm.cxx +++ b/svtools/source/items1/sfontitm.cxx @@ -52,7 +52,7 @@ int SfxFontItem::operator ==(const SfxPoolItem & rItem) const && m_bHasFillColor == pFontItem->m_bHasFillColor && (!m_bHasColor || m_aColor == pFontItem->m_aColor) && (!m_bHasFillColor || m_aFillColor == pFontItem->m_aFillColor) - && (!m_bHasFont || m_bKerning == pFontItem->m_bKerning + && (!m_bHasFont || (m_bKerning == pFontItem->m_bKerning && m_bShadow == pFontItem->m_bShadow && m_bOutline == pFontItem->m_bOutline && m_bWordLine == pFontItem->m_bWordLine @@ -70,7 +70,7 @@ int SfxFontItem::operator ==(const SfxPoolItem & rItem) const && m_aColor == pFontItem->m_aColor && m_aSize == pFontItem->m_aSize && m_aStyleName == pFontItem->m_aStyleName - && m_aName == pFontItem->m_aName); + && m_aName == pFontItem->m_aName)); } //============================================================================ diff --git a/svtools/source/items1/slstitm.cxx b/svtools/source/items1/slstitm.cxx index ad0931540ec5..87163d41e033 100644 --- a/svtools/source/items1/slstitm.cxx +++ b/svtools/source/items1/slstitm.cxx @@ -60,7 +60,7 @@ public: SfxImpStringList::~SfxImpStringList() { - DBG_ASSERT(nRefCount!=0xffff,"ImpList already deleted") + DBG_ASSERT(nRefCount!=0xffff,"ImpList already deleted"); String* pStr = (String*)aList.First(); while( pStr ) { @@ -179,7 +179,7 @@ SfxStringListItem::SfxStringListItem( const SfxStringListItem& rItem ) : if( pImp ) { - DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid") + DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); pImp->nRefCount++; } } @@ -190,7 +190,7 @@ SfxStringListItem::~SfxStringListItem() { if( pImp ) { - DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid") + DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); if( pImp->nRefCount > 1 ) pImp->nRefCount--; else @@ -204,7 +204,7 @@ List* SfxStringListItem::GetList() { if( !pImp ) pImp = new SfxImpStringList; - DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid") + DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); return &(pImp->aList); } @@ -268,7 +268,7 @@ SvStream& SfxStringListItem::Store( SvStream & rStream, USHORT ) const return rStream; } - DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid") + DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); long nCount = pImp->aList.Count(); rStream << nCount; @@ -288,7 +288,7 @@ SvStream& SfxStringListItem::Store( SvStream & rStream, USHORT ) const void SfxStringListItem::SetString( const XubString& rStr ) { - DBG_ASSERT(GetRefCount()==0,"SetString:RefCount!=0") + DBG_ASSERT(GetRefCount()==0,"SetString:RefCount!=0"); if ( pImp && (pImp->nRefCount == 1) ) delete pImp; @@ -330,7 +330,7 @@ XubString SfxStringListItem::GetString() XubString aStr; if ( pImp ) { - DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid") + DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid"); XubString* pStr = (XubString*)(pImp->aList.First()); while( pStr ) { @@ -359,7 +359,7 @@ int SfxStringListItem::IsPoolable() const void SfxStringListItem::Sort( BOOL bAscending, List* pParallelList ) { - DBG_ASSERT(GetRefCount()==0,"Sort:RefCount!=0") + DBG_ASSERT(GetRefCount()==0,"Sort:RefCount!=0"); if( pImp ) pImp->Sort( bAscending, pParallelList ); } @@ -367,7 +367,7 @@ void SfxStringListItem::Sort( BOOL bAscending, List* pParallelList ) //---------------------------------------------------------------------------- void SfxStringListItem::SetStringList( const com::sun::star::uno::Sequence< rtl::OUString >& rList ) { - DBG_ASSERT(GetRefCount()==0,"SetString:RefCount!=0") + DBG_ASSERT(GetRefCount()==0,"SetString:RefCount!=0"); if ( pImp && (pImp->nRefCount == 1) ) delete pImp; diff --git a/svtools/source/java/javainteractionhandler.cxx b/svtools/source/java/javainteractionhandler.cxx index 165c2d3662f8..30f8775a6d5f 100644 --- a/svtools/source/java/javainteractionhandler.cxx +++ b/svtools/source/java/javainteractionhandler.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: javainteractionhandler.cxx,v $ - * $Revision: 1.7 $ + * $Revision: 1.7.152.1 $ * * This file is part of OpenOffice.org. * @@ -60,9 +60,16 @@ using namespace com::sun::star::task; namespace svt { -JavaInteractionHandler::JavaInteractionHandler() +JavaInteractionHandler::JavaInteractionHandler(): + m_aRefCount(0), + m_bShowErrorsOnce(false), + m_bJavaDisabled_Handled(false), + m_bInvalidSettings_Handled(false), + m_bJavaNotFound_Handled(false), + m_bVMCreationFailure_Handled(false), + m_bRestartRequired_Handled(false), + m_nResult_JavaDisabled(RET_NO) { - JavaInteractionHandler(false); } JavaInteractionHandler::JavaInteractionHandler(bool bReportErrorOnce) : diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx index 75d7aa840e1c..6b66c6dbb8b7 100644 --- a/svtools/source/misc/acceleratorexecute.cxx +++ b/svtools/source/misc/acceleratorexecute.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: acceleratorexecute.cxx,v $ - * $Revision: 1.14 $ + * $Revision: 1.14.90.1 $ * * This file is part of OpenOffice.org. * @@ -388,6 +388,12 @@ KeyCode AcceleratorExecute::st_AWTKey2VCLKey(const css::awt::KeyEvent& aAWTKey) case com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfPara" ) ); + case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT: + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfDoc" ) ); + + case com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT: + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfDoc" ) ); + case com::sun::star::awt::Key::SELECT_BACKWARD: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharLeftSel" ) ); @@ -409,6 +415,24 @@ KeyCode AcceleratorExecute::st_AWTKey2VCLKey(const css::awt::KeyEvent& aAWTKey) case com::sun::star::awt::Key::SELECT_PARAGRAPH: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SelectText" ) ); + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE: + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StartOfLineSel" ) ); + + case com::sun::star::awt::Key::SELECT_TO_END_OF_LINE: + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:EndOfLineSel" ) ); + + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH: + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StartOfParaSel" ) ); + + case com::sun::star::awt::Key::SELECT_TO_END_OF_PARAGRAPH: + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:EndOfParaSel" ) ); + + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT: + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:StartOfDocumentSel" ) ); + + case com::sun::star::awt::Key::SELECT_TO_END_OF_DOCUMENT: + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:EndOfDocumentSel" ) ); + case com::sun::star::awt::Key::SELECT_ALL: return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SelectAll" ) ); default: @@ -442,7 +466,7 @@ css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st sModule = xModuleDetection->identify(xFrame); } catch(const css::uno::RuntimeException& exRuntime) - { throw exRuntime; } + { throw; } catch(const css::uno::Exception&) { return css::uno::Reference< css::ui::XAcceleratorConfiguration >(); } @@ -537,7 +561,7 @@ IMPL_LINK(AsyncAccelExec, impl_ts_asyncCallback, void*,) catch(const css::lang::DisposedException&) {} catch(const css::uno::RuntimeException& exRuntime) - { throw exRuntime; } + { throw; } catch(const css::uno::Exception&) {} diff --git a/svtools/source/misc/documentlockfile.cxx b/svtools/source/misc/documentlockfile.cxx index 48a3966a4d76..c8904ef010a4 100644 --- a/svtools/source/misc/documentlockfile.cxx +++ b/svtools/source/misc/documentlockfile.cxx @@ -8,7 +8,7 @@ * * $RCSfile: documentlockfile.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.3.82.1 $ * * This file is part of OpenOffice.org. * @@ -184,26 +184,24 @@ uno::Sequence< ::rtl::OUString > DocumentLockFile::ParseEntry( const uno::Sequen if ( o_nCurPos >= aBuffer.getLength() ) throw io::WrongFormatException(); - if ( aBuffer[o_nCurPos] == ',' || aBuffer[o_nCurPos] == ';' ) + if ( bEscape ) + { + if ( aBuffer[o_nCurPos] == ',' || aBuffer[o_nCurPos] == ';' || aBuffer[o_nCurPos] == '\\' ) + aResult.append( (sal_Char)aBuffer[o_nCurPos] ); + else + throw io::WrongFormatException(); + + bEscape = sal_False; + o_nCurPos++; + } + else if ( aBuffer[o_nCurPos] == ',' || aBuffer[o_nCurPos] == ';' ) bHaveName = sal_True; else { - if ( bEscape ) - { - if ( aBuffer[o_nCurPos] == ',' || aBuffer[o_nCurPos] == ';' || aBuffer[o_nCurPos] == '\\' ) - aResult.append( (sal_Char)aBuffer[o_nCurPos] ); - else - throw io::WrongFormatException(); - - bEscape = sal_False; - } + if ( aBuffer[o_nCurPos] == '\\' ) + bEscape = sal_True; else - { - if ( aBuffer[o_nCurPos] == '\\' ) - bEscape = sal_True; - else - aResult.append( (sal_Char)aBuffer[o_nCurPos] ); - } + aResult.append( (sal_Char)aBuffer[o_nCurPos] ); o_nCurPos++; } @@ -317,6 +315,33 @@ uno::Reference< io::XInputStream > DocumentLockFile::OpenStream() } // ---------------------------------------------------------------------- +sal_Bool DocumentLockFile::OverwriteOwnLockFile() +{ + // allows to overwrite the lock file with the current data + try + { + uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv; + ::ucbhelper::Content aTargetContent( m_aURL, xEnv ); + + uno::Sequence< ::rtl::OUString > aNewEntry = GenerateOwnEntry(); + + uno::Reference< io::XStream > xStream = aTargetContent.openWriteableStreamNoLock(); + uno::Reference< io::XOutputStream > xOutput = xStream->getOutputStream(); + uno::Reference< io::XTruncate > xTruncate( xOutput, uno::UNO_QUERY_THROW ); + + xTruncate->truncate(); + WriteEntryToStream( aNewEntry, xOutput ); + xOutput->closeOutput(); + } + catch( ucb::NameClashException& ) + { + return sal_False; + } + + return sal_True; +} + +// ---------------------------------------------------------------------- void DocumentLockFile::RemoveFile() { // TODO/LATER: the removing is not atomar, is it possible in general to make it atomar? diff --git a/svtools/source/misc/imageresourceaccess.cxx b/svtools/source/misc/imageresourceaccess.cxx index 62bb73890a72..b27bf6fa0174 100644 --- a/svtools/source/misc/imageresourceaccess.cxx +++ b/svtools/source/misc/imageresourceaccess.cxx @@ -51,6 +51,8 @@ namespace svt { //........................................................................ +#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" + using namespace ::utl; using namespace ::comphelper; using namespace ::com::sun::star::io; @@ -137,17 +139,17 @@ namespace svt } //==================================================================== - //= ImageResourceAccess + //= GraphicAccess //==================================================================== //-------------------------------------------------------------------- - bool ImageResourceAccess::isImageResourceURL( const ::rtl::OUString& _rURL ) + bool GraphicAccess::isSupportedURL( const ::rtl::OUString& _rURL ) { ::rtl::OUString sIndicator( RTL_CONSTASCII_USTRINGPARAM( "private:resource/" ) ); - return _rURL.indexOf( sIndicator ) == 0; + return ( ( _rURL.indexOf( sIndicator ) == 0 ) || ( _rURL.compareToAscii( GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( GRAPHOBJ_URLPREFIX ) ) == 0 ) ); } //-------------------------------------------------------------------- - SvStream* ImageResourceAccess::getImageStream( const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rImageResourceURL ) + SvStream* GraphicAccess::getImageStream( const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rImageResourceURL ) { SvStream* pReturn = NULL; @@ -157,7 +159,7 @@ namespace svt Reference< XGraphicProvider > xProvider; if ( _rxORB.is() ) xProvider = xProvider.query( _rxORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ) ) ); - OSL_ENSURE( xProvider.is(), "ImageResourceAccess::getImageStream: could not create a graphic provider!" ); + OSL_ENSURE( xProvider.is(), "GraphicAccess::getImageStream: could not create a graphic provider!" ); if ( !xProvider.is() ) return pReturn; @@ -167,7 +169,7 @@ namespace svt aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ); aMediaProperties[0].Value <<= _rImageResourceURL; Reference< XGraphic > xGraphic( xProvider->queryGraphic( aMediaProperties ) ); - OSL_ENSURE( xGraphic.is(), "ImageResourceAccess::getImageStream: the provider did not give us a graphic object!" ); + OSL_ENSURE( xGraphic.is(), "GraphicAccess::getImageStream: the provider did not give us a graphic object!" ); if ( !xGraphic.is() ) return pReturn; @@ -190,14 +192,14 @@ namespace svt } catch( const Exception& ) { - OSL_ENSURE( sal_False, "ImageResourceAccess::getImageStream: caught an exception!" ); + OSL_ENSURE( sal_False, "GraphicAccess::getImageStream: caught an exception!" ); } return pReturn; } //-------------------------------------------------------------------- - Reference< XInputStream > ImageResourceAccess::getImageXStream( const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rImageResourceURL ) + Reference< XInputStream > GraphicAccess::getImageXStream( const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rImageResourceURL ) { return new OSeekableInputStreamWrapper( getImageStream( _rxORB, _rImageResourceURL ), sal_True ); // take ownership } diff --git a/svtools/source/misc/imap2.cxx b/svtools/source/misc/imap2.cxx index e9dce5cc06a0..b1e03a574188 100644 --- a/svtools/source/misc/imap2.cxx +++ b/svtools/source/misc/imap2.cxx @@ -35,7 +35,7 @@ #include <sysdep.hxx> #endif #include <string.h> -#include <math.h> +// #include <math.h> #include <vcl/svapp.hxx> #include <tools/urlobj.hxx> #ifndef _WRKWIN_HXX //autogen diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx index 2e14a71d6d07..6226992136c8 100644 --- a/svtools/source/misc/langtab.cxx +++ b/svtools/source/misc/langtab.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: langtab.cxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.140.1 $ * * This file is part of OpenOffice.org. * @@ -37,6 +37,7 @@ #include <tools/debug.hxx> #include <i18npool/lang.h> +#include <i18npool/mslangid.hxx> #include <svtools/svtools.hrc> #include <svtools/svtdata.hxx> @@ -59,9 +60,7 @@ SvtLanguageTable::~SvtLanguageTable() const String& SvtLanguageTable::GetString( const LanguageType eType ) const { - // no_NO is an alias for nb_NO - LanguageType eLang = (eType == LANGUAGE_NORWEGIAN ? - LANGUAGE_NORWEGIAN_BOKMAL : eType); + LanguageType eLang = MsLangId::getReplacementForObsoleteLanguage( eType); sal_uInt32 nPos = FindIndex( eLang ); if ( RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count() ) diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index c1d0f5d362d7..21953d25d92a 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: langtab.src,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.126.1 $ * * This file is part of OpenOffice.org. * @@ -46,22 +46,32 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Default" ; LANGUAGE_SYSTEM ; > ; < "Afrikaans (South Africa)" ; LANGUAGE_AFRIKAANS ; > ; < "Albanian" ; LANGUAGE_ALBANIAN ; > ; - < "Arabic (Iraq)" ; LANGUAGE_ARABIC_IRAQ ; > ; + < "Arabic" ; LANGUAGE_ARABIC_PRIMARY_ONLY ; > ; + < "Arabic (Algeria)" ; LANGUAGE_ARABIC_ALGERIA ; > ; + < "Arabic (Bahrain)" ; LANGUAGE_ARABIC_BAHRAIN ; > ; + < "Arabic (Chad)" ; LANGUAGE_USER_ARABIC_CHAD ; > ; + < "Arabic (Comoros)" ; LANGUAGE_USER_ARABIC_COMOROS ; > ; + < "Arabic (Djibouti)" ; LANGUAGE_USER_ARABIC_DJIBOUTI ; > ; < "Arabic (Egypt)" ; LANGUAGE_ARABIC_EGYPT ; > ; + < "Arabic (Eritrea)" ; LANGUAGE_USER_ARABIC_ERITREA ; > ; + < "Arabic (Iraq)" ; LANGUAGE_ARABIC_IRAQ ; > ; + < "Arabic (Israel)" ; LANGUAGE_USER_ARABIC_ISRAEL ; > ; + < "Arabic (Jordan)" ; LANGUAGE_ARABIC_JORDAN ; > ; + < "Arabic (Kuwait)" ; LANGUAGE_ARABIC_KUWAIT ; > ; + < "Arabic (Lebanon)" ; LANGUAGE_ARABIC_LEBANON ; > ; < "Arabic (Libya)" ; LANGUAGE_ARABIC_LIBYA ; > ; - < "Arabic (Algerian)" ; LANGUAGE_ARABIC_ALGERIA ; > ; + < "Arabic (Mauritania)" ; LANGUAGE_USER_ARABIC_MAURITANIA ; > ; < "Arabic (Morocco)" ; LANGUAGE_ARABIC_MOROCCO ; > ; - < "Arabic (Tunisia)" ; LANGUAGE_ARABIC_TUNISIA ; > ; < "Arabic (Oman)" ; LANGUAGE_ARABIC_OMAN ; > ; - < "Arabic (Yemen)" ; LANGUAGE_ARABIC_YEMEN ; > ; - < "Arabic (Syria)" ; LANGUAGE_ARABIC_SYRIA ; > ; - < "Arabic (Jordan)" ; LANGUAGE_ARABIC_JORDAN ; > ; - < "Arabic (Lebanon)" ; LANGUAGE_ARABIC_LEBANON ; > ; - < "Arabic (Kuwait)" ; LANGUAGE_ARABIC_KUWAIT ; > ; - < "Arabic (UAE)" ; LANGUAGE_ARABIC_UAE ; > ; - < "Arabic (Bahrain)" ; LANGUAGE_ARABIC_BAHRAIN ; > ; + < "Arabic (Palestine)" ; LANGUAGE_USER_ARABIC_PALESTINE ; > ; < "Arabic (Qatar)" ; LANGUAGE_ARABIC_QATAR ; > ; < "Arabic (Saudi Arabia)" ; LANGUAGE_ARABIC_SAUDI_ARABIA ; > ; + < "Arabic (Somalia)" ; LANGUAGE_USER_ARABIC_SOMALIA ; > ; + < "Arabic (Sudan)" ; LANGUAGE_USER_ARABIC_SUDAN ; > ; + < "Arabic (Syria)" ; LANGUAGE_ARABIC_SYRIA ; > ; + < "Arabic (Tunisia)" ; LANGUAGE_ARABIC_TUNISIA ; > ; + < "Arabic (UAE)" ; LANGUAGE_ARABIC_UAE ; > ; + < "Arabic (Yemen)" ; LANGUAGE_ARABIC_YEMEN ; > ; < "Armenian" ; LANGUAGE_ARMENIAN ; > ; < "Assami" ; LANGUAGE_ASSAMESE ; > ; < "Azerbaijani Latin" ; LANGUAGE_AZERI_LATIN ; > ; @@ -69,7 +79,7 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Basque" ; LANGUAGE_BASQUE ; > ; < "Bengali (India)" ; LANGUAGE_BENGALI ; > ; < "Bulgarian" ; LANGUAGE_BULGARIAN ; > ; - < "Byelorussian" ; LANGUAGE_BELARUSIAN ; > ; + < "Belarusian" ; LANGUAGE_BELARUSIAN ; > ; < "Catalan" ; LANGUAGE_CATALAN ; > ; < "Chinese (traditional)" ; LANGUAGE_CHINESE_TRADITIONAL ; > ; < "Chinese (simplified)" ; LANGUAGE_CHINESE_SIMPLIFIED ; > ; @@ -159,7 +169,6 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Slovenian" ; LANGUAGE_SLOVENIAN ; > ; < "Spanish (Spain)" ; LANGUAGE_SPANISH ; > ; < "Spanish (Mexico)" ; LANGUAGE_SPANISH_MEXICAN ; > ; - < "Spanish, Modern (Spain)" ; LANGUAGE_SPANISH_MODERN ; > ; < "Spanish (Guatemala)" ; LANGUAGE_SPANISH_GUATEMALA ; > ; < "Spanish (Costa Rica)" ; LANGUAGE_SPANISH_COSTARICA ; > ; < "Spanish (Panama)" ; LANGUAGE_SPANISH_PANAMA ; > ; @@ -290,6 +299,9 @@ StringArray STR_ARR_SVT_LANGUAGE_TABLE < "Santali" ; LANGUAGE_USER_SANTALI_INDIA ; > ; < "Tetun (Timor-Leste)" ; LANGUAGE_USER_TETUN_TIMOR_LESTE ; > ; < "Turkmen" ; LANGUAGE_TURKMEN ; > ; + < "Maltese" ; LANGUAGE_MALTESE ; > ; + < "Tok Pisin" ; LANGUAGE_USER_TOK_PISIN ; > ; + < "Shuswap" ; LANGUAGE_USER_SHUSWAP ; > ; }; }; diff --git a/svtools/source/misc/sharecontrolfile.cxx b/svtools/source/misc/sharecontrolfile.cxx index de3ddb535a6e..0fd661f85135 100644 --- a/svtools/source/misc/sharecontrolfile.cxx +++ b/svtools/source/misc/sharecontrolfile.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: sharecontrolfile.cxx,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.82.1 $ * * This file is part of OpenOffice.org. * @@ -229,26 +229,24 @@ uno::Sequence< ::rtl::OUString > ShareControlFile::ParseEntry( const uno::Sequen if ( o_nCurPos >= aBuffer.getLength() ) throw io::WrongFormatException(); - if ( aBuffer[o_nCurPos] == ',' || aBuffer[o_nCurPos] == ';' ) + if ( bEscape ) + { + if ( aBuffer[o_nCurPos] == ',' || aBuffer[o_nCurPos] == ';' || aBuffer[o_nCurPos] == '\\' ) + aResult.append( (sal_Char)aBuffer[o_nCurPos] ); + else + throw io::WrongFormatException(); + + bEscape = sal_False; + o_nCurPos++; + } + else if ( aBuffer[o_nCurPos] == ',' || aBuffer[o_nCurPos] == ';' ) bHaveName = sal_True; else { - if ( bEscape ) - { - if ( aBuffer[o_nCurPos] == ',' || aBuffer[o_nCurPos] == ';' || aBuffer[o_nCurPos] == '\\' ) - aResult.append( (sal_Char)aBuffer[o_nCurPos] ); - else - throw io::WrongFormatException(); - - bEscape = sal_False; - } + if ( aBuffer[o_nCurPos] == '\\' ) + bEscape = sal_True; else - { - if ( aBuffer[o_nCurPos] == '\\' ) - bEscape = sal_True; - else - aResult.append( (sal_Char)aBuffer[o_nCurPos] ); - } + aResult.append( (sal_Char)aBuffer[o_nCurPos] ); o_nCurPos++; } diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 9de8a0e4f33f..7e882dac35ff 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -78,6 +78,7 @@ #include "urlbmk.hxx" #include "inetimg.hxx" +#include <svtools/wmf.hxx> #include <svtools/imap.hxx> #include <svtools/transfer.hxx> @@ -286,10 +287,10 @@ Any SAL_CALL TransferableHelper::getTransferData( const DataFlavor& rFlavor ) th *pSrcStm >> aMtf; delete pSrcStm; - Graphic aGraphic( aMtf ); SvMemoryStream aDstStm( 65535, 65535 ); - if( GraphicConverter::Export( aDstStm, aGraphic, CVT_WMF ) == ERRCODE_NONE ) + // taking wmf without file header + if ( ConvertGDIMetaFileToWMF( aMtf, aDstStm, NULL, FALSE ) ) { maAny <<= ( aSeq = Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( aDstStm.GetData() ), aDstStm.Seek( STREAM_SEEK_TO_END ) ) ); @@ -1790,11 +1791,11 @@ sal_Bool TransferableDataHelper::GetINetBookmark( const ::com::sun::star::datatr if( !nLen && aString.GetChar( 0 ) != '0' ) { - DBG_WARNING( "SOLK: 1. len=0" ) + DBG_WARNING( "SOLK: 1. len=0" ); } if( nStart == STRING_NOTFOUND || nLen > aString.Len() - nStart - 3 ) { - DBG_WARNING( "SOLK: 1. illegal start or wrong len" ) + DBG_WARNING( "SOLK: 1. illegal start or wrong len" ); } aURL = aString.Copy( nStart + 1, nLen ); @@ -1804,11 +1805,11 @@ sal_Bool TransferableDataHelper::GetINetBookmark( const ::com::sun::star::datatr if( !nLen && aString.GetChar( 0 ) != '0' ) { - DBG_WARNING( "SOLK: 2. len=0" ) + DBG_WARNING( "SOLK: 2. len=0" ); } if( nStart == STRING_NOTFOUND || nLen > aString.Len() - nStart - 1 ) { - DBG_WARNING( "SOLK: 2. illegal start or wrong len" ) + DBG_WARNING( "SOLK: 2. illegal start or wrong len" ); } aDesc = aString.Copy( nStart+1, nLen ); diff --git a/svtools/source/misc1/adrparse.cxx b/svtools/source/misc1/adrparse.cxx index 93d69dde0f9a..d9b389513f80 100644 --- a/svtools/source/misc1/adrparse.cxx +++ b/svtools/source/misc1/adrparse.cxx @@ -495,6 +495,7 @@ SvAddressParser_Impl::SvAddressParser_Impl(SvAddressParser * pParser, addTokenToAddrSpec(ELEMENT_ITEM); } if (!m_bRealNameFinished && m_eState != AFTER_LESS) + { if (m_bCurTokenReparse) { if (!m_pRealNameBegin) @@ -516,16 +517,19 @@ SvAddressParser_Impl::SvAddressParser_Impl(SvAddressParser * pParser, m_pRealNameEnd = m_pCurTokenEnd; m_bRealNameReparse = true; } + } m_eType = TOKEN_ATOM; break; case TOKEN_DOMAIN: if (m_pAddrSpec->m_eLastElem != ELEMENT_END) + { if (m_pAddrSpec->m_bAtFound && m_pAddrSpec->m_eLastElem == ELEMENT_DELIM) addTokenToAddrSpec(ELEMENT_ITEM); else m_pAddrSpec->reset(); + } addTokenToRealName(); m_eType = TOKEN_ATOM; break; @@ -603,6 +607,7 @@ SvAddressParser_Impl::SvAddressParser_Impl(SvAddressParser * pParser, case '@': if (m_pAddrSpec->m_eLastElem != ELEMENT_END) + { if (!m_pAddrSpec->m_bAtFound && m_pAddrSpec->m_eLastElem == ELEMENT_ITEM) { @@ -611,6 +616,7 @@ SvAddressParser_Impl::SvAddressParser_Impl(SvAddressParser * pParser, } else m_pAddrSpec->reset(); + } addTokenToRealName(); break; @@ -741,10 +747,12 @@ SvAddressParser_Impl::SvAddressParser_Impl(SvAddressParser * pParser, case '.': if (m_pAddrSpec->m_eLastElem != ELEMENT_END) + { if (m_pAddrSpec->m_eLastElem != ELEMENT_DELIM) addTokenToAddrSpec(ELEMENT_DELIM); else m_pAddrSpec->reset(); + } addTokenToRealName(); break; @@ -832,10 +840,12 @@ bool SvAddressParser::createRFC822Mailbox(String const & rPhrase, { p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd); if (p == pEnd) + { if (bSegment) break; else return false; + } if (bSegment) { if (*p++ != '.') diff --git a/svtools/source/misc1/inettype.cxx b/svtools/source/misc1/inettype.cxx index 5c7a2e809c37..ce62d7f3b2fc 100644 --- a/svtools/source/misc1/inettype.cxx +++ b/svtools/source/misc1/inettype.cxx @@ -1008,6 +1008,7 @@ INetContentType INetContentTypes::GetContentTypeFromURL(UniString const & INetContentType eTypeID = CONTENT_TYPE_UNKNOWN; UniString aToken = rURL.GetToken(0, ':'); if (aToken.Len() != 0) + { if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_FILE)) if (rURL.GetChar(rURL.Len() - 1) == '/') // folder if (rURL.Len() > RTL_CONSTASCII_LENGTH("file:///")) @@ -1094,6 +1095,7 @@ INetContentType INetContentTypes::GetContentTypeFromURL(UniString const & aToken = aSecondPart.GetToken(0, ','); eTypeID = GetContentType(aToken); } + } if (eTypeID == CONTENT_TYPE_UNKNOWN) { UniString aExtension; diff --git a/svtools/source/misc1/strmadpt.cxx b/svtools/source/misc1/strmadpt.cxx index 8686f1ab24c2..4c4835609b7b 100644 --- a/svtools/source/misc1/strmadpt.cxx +++ b/svtools/source/misc1/strmadpt.cxx @@ -301,18 +301,26 @@ SvLockBytesInputStream::readBytes(uno::Sequence< sal_Int8 > & rData, sal_Int32 nBytesToRead) throw (io::IOException, uno::RuntimeException) { + OSL_ASSERT(m_nPosition >= 0); if (!m_xLockBytes.Is()) throw io::NotConnectedException(); - if (nBytesToRead < 0 - || m_nPosition > std::numeric_limits< ULONG >::max() - && nBytesToRead > 0) + if ( + nBytesToRead < 0 || + ( + static_cast<sal_uInt64>(m_nPosition) > SAL_MAX_SIZE && + nBytesToRead > 0 + ) + ) + { throw io::IOException(); + } rData.realloc(nBytesToRead); sal_Int32 nSize = 0; while (nSize < nBytesToRead) { - ULONG nCount; - ErrCode nError = m_xLockBytes->ReadAt(ULONG(m_nPosition), + sal_Size nCount; + ErrCode nError = m_xLockBytes->ReadAt(static_cast<sal_Size>( + m_nPosition), rData.getArray() + nSize, nBytesToRead - nSize, &nCount); if (nError != ERRCODE_NONE && nError != ERRCODE_IO_PENDING) @@ -333,19 +341,20 @@ SvLockBytesInputStream::readSomeBytes(uno::Sequence< sal_Int8 > & rData, sal_Int32 nMaxBytesToRead) throw (io::IOException, uno::RuntimeException) { + OSL_ASSERT(m_nPosition >= 0); if (!m_xLockBytes.Is()) throw io::NotConnectedException(); - if (m_nPosition > std::numeric_limits< ULONG >::max() + if (static_cast<sal_uInt64>(m_nPosition) > SAL_MAX_SIZE && nMaxBytesToRead > 0) throw io::IOException(); rData.realloc(nMaxBytesToRead); - ULONG nCount = 0; + sal_Size nCount = 0; if (nMaxBytesToRead > 0) { ErrCode nError; do { - nError = m_xLockBytes->ReadAt(ULONG(m_nPosition), + nError = m_xLockBytes->ReadAt(static_cast<sal_Size>(m_nPosition), rData.getArray(), nMaxBytesToRead < 0 ? 0 : nMaxBytesToRead, @@ -369,7 +378,7 @@ void SAL_CALL SvLockBytesInputStream::skipBytes(sal_Int32 nBytesToSkip) throw io::NotConnectedException(); if (nBytesToSkip < 0) throw io::IOException(); - if (m_nPosition + nBytesToSkip < 0) + if (nBytesToSkip > SAL_MAX_INT64 - m_nPosition) throw io::BufferSizeExceededException(); m_nPosition += nBytesToSkip; } @@ -379,16 +388,18 @@ void SAL_CALL SvLockBytesInputStream::skipBytes(sal_Int32 nBytesToSkip) sal_Int32 SAL_CALL SvLockBytesInputStream::available() throw (io::IOException, uno::RuntimeException) { + OSL_ASSERT(m_nPosition >= 0); if (!m_xLockBytes.Is()) throw io::NotConnectedException(); SvLockBytesStat aStat; if (m_xLockBytes->Stat(&aStat, SVSTATFLAG_DEFAULT) != ERRCODE_NONE) throw io::IOException(); - return aStat.nSize <= m_nPosition ? + return aStat.nSize <= static_cast<sal_uInt64>(m_nPosition) ? 0 : - std::min< sal_uInt32 >( - sal_uInt32(aStat.nSize - m_nPosition), - sal_uInt32(std::numeric_limits< sal_Int32 >::max())); + static_cast<sal_Size>(aStat.nSize - m_nPosition) <= + static_cast<sal_uInt32>(SAL_MAX_INT32) ? + static_cast<sal_Int32>(aStat.nSize - m_nPosition) : + SAL_MAX_INT32; } //============================================================================ @@ -434,6 +445,10 @@ sal_Int64 SAL_CALL SvLockBytesInputStream::getLength() SvLockBytesStat aStat; if (m_xLockBytes->Stat(&aStat, SVSTATFLAG_DEFAULT) != ERRCODE_NONE) throw io::IOException(); +#if SAL_TYPES_SIZEOFPOINTER > 4 // avoid warnings if sal_Size < sal_Int64 + if (aStat.nSize > static_cast<sal_uInt64>(SAL_MAX_INT64)) + throw io::IOException(); +#endif return aStat.nSize; } @@ -575,14 +590,18 @@ void SvInputStream::FlushData() ULONG SvInputStream::SeekPos(ULONG nPos) { if (open()) + { if (nPos == STREAM_SEEK_TO_END) + { if (m_nSeekedFrom == STREAM_SEEK_TO_END) { if (m_xSeekable.is()) try { sal_Int64 nLength = m_xSeekable->getLength(); - if (nLength < STREAM_SEEK_TO_END) + OSL_ASSERT(nLength >= 0); + if (static_cast<sal_uInt64>(nLength) + < STREAM_SEEK_TO_END) { m_nSeekedFrom = Tell(); return ULONG(nLength); @@ -594,6 +613,7 @@ ULONG SvInputStream::SeekPos(ULONG nPos) } else return Tell(); + } else if (nPos == m_nSeekedFrom) { m_nSeekedFrom = STREAM_SEEK_TO_END; @@ -612,6 +632,7 @@ ULONG SvInputStream::SeekPos(ULONG nPos) m_nSeekedFrom = STREAM_SEEK_TO_END; return nPos; } + } SetError(ERRCODE_IO_CANTSEEK); return Tell(); } @@ -785,10 +806,17 @@ USHORT SvOutputStream::IsA() const bool SvDataPipe_Impl::remove(Page * pPage) { - if (pPage != m_pFirstPage || m_pReadPage == m_pFirstPage - || !m_aMarks.empty() - && *m_aMarks.begin() < m_pFirstPage->m_nOffset + m_nPageSize) + if ( + pPage != m_pFirstPage || + m_pReadPage == m_pFirstPage || + ( + !m_aMarks.empty() && + *m_aMarks.begin() < m_pFirstPage->m_nOffset + m_nPageSize + ) + ) + { return false; + } m_pFirstPage = m_pFirstPage->m_pNext; diff --git a/svtools/source/numbers/makefile.mk b/svtools/source/numbers/makefile.mk index 6709b825b00a..46cd3985df1a 100644 --- a/svtools/source/numbers/makefile.mk +++ b/svtools/source/numbers/makefile.mk @@ -8,7 +8,7 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.12 $ +# $Revision: 1.12.148.1 $ # # This file is part of OpenOffice.org. # @@ -48,12 +48,12 @@ PROJECTPCHSOURCE= EXCEPTIONSFILES= \ $(SLO)$/numuno.obj \ $(SLO)$/numfmuno.obj \ - $(SLO)$/supservs.obj + $(SLO)$/supservs.obj \ + $(SLO)$/zforlist.obj SLOFILES = \ $(EXCEPTIONSFILES) \ $(SLO)$/zforfind.obj \ - $(SLO)$/zforlist.obj \ $(SLO)$/zformat.obj \ $(SLO)$/zforscan.obj \ $(SLO)$/numhead.obj diff --git a/svtools/source/numbers/numfmuno.cxx b/svtools/source/numbers/numfmuno.cxx index eba3cdf07540..5d9c88ec8760 100644 --- a/svtools/source/numbers/numfmuno.cxx +++ b/svtools/source/numbers/numfmuno.cxx @@ -135,15 +135,13 @@ LanguageType lcl_GetLanguage( const lang::Locale& rLocale ) //---------------------------------------------------------------------------------------- -SvNumberFormatterServiceObj::SvNumberFormatterServiceObj() : - pSupplier(NULL) +SvNumberFormatterServiceObj::SvNumberFormatterServiceObj() + :m_aMutex() { } SvNumberFormatterServiceObj::~SvNumberFormatterServiceObj() { - if (pSupplier) - pSupplier->release(); } com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvNumberFormatterServiceObj_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ) @@ -154,38 +152,43 @@ com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvN // XNumberFormatter void SAL_CALL SvNumberFormatterServiceObj::attachNumberFormatsSupplier( - const uno::Reference<util::XNumberFormatsSupplier>& xSupplier ) + const uno::Reference<util::XNumberFormatsSupplier>& _xSupplier ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::rtl::Reference< SvNumberFormatsSupplierObj > xAutoReleaseOld; - SvNumberFormatsSupplierObj* pNew = SvNumberFormatsSupplierObj::getImplementation( xSupplier ); - if (!pNew) - throw uno::RuntimeException(); // wrong object + // SYNCHRONIZED -> + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + + SvNumberFormatsSupplierObj* pNew = SvNumberFormatsSupplierObj::getImplementation( _xSupplier ); + if (!pNew) + throw uno::RuntimeException(); // wrong object - if (pNew) - pNew->acquire(); - if (pSupplier) - pSupplier->release(); - pSupplier = pNew; + xAutoReleaseOld = xSupplier; + + xSupplier = pNew; + m_aMutex = xSupplier->getSharedMutex(); + } + // <- SYNCHRONIZED } uno::Reference<util::XNumberFormatsSupplier> SAL_CALL SvNumberFormatterServiceObj::getNumberFormatsSupplier() throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); - return pSupplier; + ::osl::MutexGuard aGuard( m_aMutex ); + return xSupplier.get(); } sal_Int32 SAL_CALL SvNumberFormatterServiceObj::detectNumberFormat( sal_Int32 nKey, const rtl::OUString& aString ) throw(util::NotNumericException, uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); INT32 nRet = 0; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; if (pFormatter) { String aTemp = aString; @@ -206,10 +209,10 @@ double SAL_CALL SvNumberFormatterServiceObj::convertStringToNumber( sal_Int32 nKey, const rtl::OUString& aString ) throw(util::NotNumericException, uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); double fRet = 0.0; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; if (pFormatter) { String aTemp = aString; @@ -229,10 +232,10 @@ double SAL_CALL SvNumberFormatterServiceObj::convertStringToNumber( rtl::OUString SAL_CALL SvNumberFormatterServiceObj::convertNumberToString( sal_Int32 nKey, double fValue ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); String aRet; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; if (pFormatter) { Color* pColor = NULL; @@ -248,10 +251,10 @@ util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForNumber( sal_Int32 double fValue, util::Color aDefaultColor ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); util::Color nRet = aDefaultColor; // color = INT32 - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; if (pFormatter) { String aStr; @@ -270,10 +273,10 @@ util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForNumber( sal_Int32 rtl::OUString SAL_CALL SvNumberFormatterServiceObj::formatString( sal_Int32 nKey, const rtl::OUString& aString ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); String aRet; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; if (pFormatter) { String aTemp = aString; @@ -290,10 +293,10 @@ util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForString( sal_Int32 const rtl::OUString& aString,util::Color aDefaultColor ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); util::Color nRet = aDefaultColor; // color = INT32 - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; if (pFormatter) { String aTemp = aString; @@ -313,10 +316,10 @@ util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForString( sal_Int32 rtl::OUString SAL_CALL SvNumberFormatterServiceObj::getInputString( sal_Int32 nKey, double fValue ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); String aRet; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; if (pFormatter) pFormatter->GetInputLineString(fValue, nKey, aRet); else @@ -332,10 +335,10 @@ rtl::OUString SAL_CALL SvNumberFormatterServiceObj::convertNumberToPreviewString const lang::Locale& nLocale, sal_Bool bAllowEnglish ) throw(util::MalformedNumberFormatException, uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); String aRet; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; if (pFormatter) { String aOutString; @@ -368,10 +371,10 @@ util::Color SAL_CALL SvNumberFormatterServiceObj::queryPreviewColorForNumber( util::Color aDefaultColor ) throw(util::MalformedNumberFormatException, uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); util::Color nRet = aDefaultColor; // color = INT32 - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL; if (pFormatter) { String aOutString; @@ -427,17 +430,16 @@ uno::Sequence<rtl::OUString> SAL_CALL SvNumberFormatterServiceObj::getSupportedS //------------------------------------------------------------------------ -SvNumberFormatsObj::SvNumberFormatsObj(SvNumberFormatsSupplierObj* pParent) : - pSupplier(pParent) +SvNumberFormatsObj::SvNumberFormatsObj( SvNumberFormatsSupplierObj& _rParent, ::comphelper::SharedMutex& _rMutex ) + :rSupplier( _rParent ) + ,m_aMutex( _rMutex ) { - if (pSupplier) - pSupplier->acquire(); + rSupplier.acquire(); } SvNumberFormatsObj::~SvNumberFormatsObj() { - if (pSupplier) - pSupplier->release(); + rSupplier.release(); } // XNumberFormats @@ -445,12 +447,12 @@ SvNumberFormatsObj::~SvNumberFormatsObj() uno::Reference<beans::XPropertySet> SAL_CALL SvNumberFormatsObj::getByKey( sal_Int32 nKey ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL; if (pFormat) - return new SvNumberFormatObj( pSupplier, nKey ); + return new SvNumberFormatObj( rSupplier, nKey, m_aMutex ); else throw uno::RuntimeException(); } @@ -459,9 +461,9 @@ uno::Sequence<sal_Int32> SAL_CALL SvNumberFormatsObj::queryKeys( sal_Int16 nType const lang::Locale& nLocale, sal_Bool bCreate ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if ( pFormatter ) { sal_uInt32 nIndex = 0; @@ -485,10 +487,10 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::queryKey( const rtl::OUString& aFormat, const lang::Locale& nLocale, sal_Bool bScan ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); INT32 nRet = 0; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { String aFormStr = aFormat; @@ -509,10 +511,10 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::addNew( const rtl::OUString& aFormat, const lang::Locale& nLocale ) throw(util::MalformedNumberFormatException, uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); INT32 nRet = 0; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { String aFormStr = aFormat; @@ -540,10 +542,10 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::addNewConverted( const rtl::OUString& aFo const lang::Locale& nLocale, const lang::Locale& nNewLocale ) throw(util::MalformedNumberFormatException, uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); INT32 nRet = 0; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { String aFormStr = aFormat; @@ -570,13 +572,13 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::addNewConverted( const rtl::OUString& aFo void SAL_CALL SvNumberFormatsObj::removeByKey( sal_Int32 nKey ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + ::osl::MutexGuard aGuard( m_aMutex ); + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { pFormatter->DeleteEntry(nKey); - pSupplier->NumberFormatDeleted(nKey); // Benachrichtigung fuers Dokument + rSupplier.NumberFormatDeleted(nKey); // Benachrichtigung fuers Dokument } } @@ -585,10 +587,10 @@ rtl::OUString SAL_CALL SvNumberFormatsObj::generateFormat( sal_Int32 nBaseKey, sal_Bool bRed, sal_Int16 nDecimals, sal_Int16 nLeading ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); String aRet; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { LanguageType eLang = lcl_GetLanguage( nLocale ); @@ -605,10 +607,10 @@ rtl::OUString SAL_CALL SvNumberFormatsObj::generateFormat( sal_Int32 nBaseKey, sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardIndex( const lang::Locale& nLocale ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); INT32 nRet = 0; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { LanguageType eLang = lcl_GetLanguage( nLocale ); @@ -623,10 +625,10 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardIndex( const lang::Locale& nLo sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardFormat( sal_Int16 nType, const lang::Locale& nLocale ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); INT32 nRet = 0; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { LanguageType eLang = lcl_GetLanguage( nLocale ); @@ -644,10 +646,10 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardFormat( sal_Int16 nType, const sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatIndex( sal_Int16 nIndex, const lang::Locale& nLocale ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); INT32 nRet = 0; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { LanguageType eLang = lcl_GetLanguage( nLocale ); @@ -662,10 +664,10 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatIndex( sal_Int16 nIndex, const l sal_Bool SAL_CALL SvNumberFormatsObj::isTypeCompatible( sal_Int16 nOldType, sal_Int16 nNewType ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); BOOL bRet = FALSE; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) bRet = pFormatter->IsCompatible( nOldType, nNewType ); else @@ -677,10 +679,10 @@ sal_Bool SAL_CALL SvNumberFormatsObj::isTypeCompatible( sal_Int16 nOldType, sal_ sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatForLocale( sal_Int32 nKey, const lang::Locale& nLocale ) throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); INT32 nRet = 0; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { LanguageType eLang = lcl_GetLanguage( nLocale ); @@ -717,18 +719,17 @@ uno::Sequence<rtl::OUString> SAL_CALL SvNumberFormatsObj::getSupportedServiceNam //------------------------------------------------------------------------ -SvNumberFormatObj::SvNumberFormatObj(SvNumberFormatsSupplierObj* pParent, ULONG nK) : - pSupplier(pParent), - nKey(nK) +SvNumberFormatObj::SvNumberFormatObj( SvNumberFormatsSupplierObj& rParent, ULONG nK, const ::comphelper::SharedMutex& _rMutex ) + :rSupplier( rParent ) + ,nKey( nK ) + ,m_aMutex( _rMutex ) { - if (pSupplier) - pSupplier->acquire(); + rSupplier.acquire(); } SvNumberFormatObj::~SvNumberFormatObj() { - if (pSupplier) - pSupplier->release(); + rSupplier.release(); } // XPropertySet @@ -736,7 +737,7 @@ SvNumberFormatObj::~SvNumberFormatObj() uno::Reference<beans::XPropertySetInfo> SAL_CALL SvNumberFormatObj::getPropertySetInfo() throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); static uno::Reference<beans::XPropertySetInfo> aRef = new SfxItemPropertySetInfo( lcl_GetNumberFormatPropertyMap() ); return aRef; @@ -755,10 +756,10 @@ uno::Any SAL_CALL SvNumberFormatObj::getPropertyValue( const rtl::OUString& aPro throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); uno::Any aRet; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL; if (pFormat) { @@ -885,9 +886,9 @@ void SAL_CALL SvNumberFormatObj::removeVetoableChangeListener( const rtl::OUStri uno::Sequence<beans::PropertyValue> SAL_CALL SvNumberFormatObj::getPropertyValues() throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL; if (pFormat) { @@ -979,17 +980,16 @@ uno::Sequence<rtl::OUString> SAL_CALL SvNumberFormatObj::getSupportedServiceName //------------------------------------------------------------------------ -SvNumberFormatSettingsObj::SvNumberFormatSettingsObj(SvNumberFormatsSupplierObj* pParent) : - pSupplier(pParent) +SvNumberFormatSettingsObj::SvNumberFormatSettingsObj( SvNumberFormatsSupplierObj& rParent, const ::comphelper::SharedMutex& _rMutex ) + :rSupplier( rParent ) + ,m_aMutex( _rMutex ) { - if (pSupplier) - pSupplier->acquire(); + rSupplier.acquire(); } SvNumberFormatSettingsObj::~SvNumberFormatSettingsObj() { - if (pSupplier) - pSupplier->release(); + rSupplier.release(); } // XPropertySet @@ -997,7 +997,7 @@ SvNumberFormatSettingsObj::~SvNumberFormatSettingsObj() uno::Reference<beans::XPropertySetInfo> SAL_CALL SvNumberFormatSettingsObj::getPropertySetInfo() throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); static uno::Reference<beans::XPropertySetInfo> aRef = new SfxItemPropertySetInfo( lcl_GetNumberSettingsPropertyMap() ); return aRef; @@ -1009,9 +1009,9 @@ void SAL_CALL SvNumberFormatSettingsObj::setPropertyValue( const rtl::OUString& lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { String aString = aPropertyName; @@ -1042,7 +1042,7 @@ void SAL_CALL SvNumberFormatSettingsObj::setPropertyValue( const rtl::OUString& else throw beans::UnknownPropertyException(); - pSupplier->SettingsChanged(); + rSupplier.SettingsChanged(); } else throw uno::RuntimeException(); @@ -1052,10 +1052,10 @@ uno::Any SAL_CALL SvNumberFormatSettingsObj::getPropertyValue( const rtl::OUStri throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( m_aMutex ); uno::Any aRet; - SvNumberFormatter* pFormatter = pSupplier ? pSupplier->GetNumberFormatter() : NULL; + SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter(); if (pFormatter) { String aString = aPropertyName; diff --git a/svtools/source/numbers/numfmuno.hxx b/svtools/source/numbers/numfmuno.hxx index d7ec25bf09b9..4148069fb37e 100644 --- a/svtools/source/numbers/numfmuno.hxx +++ b/svtools/source/numbers/numfmuno.hxx @@ -39,6 +39,8 @@ #include <com/sun/star/beans/XPropertyAccess.hpp> #include <cppuhelper/implbase2.hxx> #include <cppuhelper/implbase3.hxx> +#include <comphelper/sharedmutex.hxx> +#include <rtl/ref.hxx> class SvNumberformat; class SvNumberFormatter; @@ -53,7 +55,8 @@ class SvNumberFormatterServiceObj : public cppu::WeakImplHelper3< com::sun::star::lang::XServiceInfo> { private: - SvNumberFormatsSupplierObj* pSupplier; + ::rtl::Reference< SvNumberFormatsSupplierObj > xSupplier; + mutable ::comphelper::SharedMutex m_aMutex; public: SvNumberFormatterServiceObj(); @@ -116,11 +119,11 @@ class SvNumberFormatsObj : public cppu::WeakImplHelper3< com::sun::star::lang::XServiceInfo> { private: - SvNumberFormatsSupplierObj* pSupplier; + SvNumberFormatsSupplierObj& rSupplier; + mutable ::comphelper::SharedMutex m_aMutex; public: - SvNumberFormatsObj(); - SvNumberFormatsObj(SvNumberFormatsSupplierObj* pParent); + SvNumberFormatsObj(SvNumberFormatsSupplierObj& pParent, ::comphelper::SharedMutex& _rMutex); virtual ~SvNumberFormatsObj(); @@ -170,6 +173,9 @@ public: throw(::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + +private: + SvNumberFormatsObj(); // never implemented }; @@ -179,11 +185,12 @@ class SvNumberFormatObj : public cppu::WeakImplHelper3< com::sun::star::lang::XServiceInfo> { private: - SvNumberFormatsSupplierObj* pSupplier; - ULONG nKey; + SvNumberFormatsSupplierObj& rSupplier; + ULONG nKey; + mutable ::comphelper::SharedMutex m_aMutex; public: - SvNumberFormatObj(SvNumberFormatsSupplierObj* pParent, ULONG nK); + SvNumberFormatObj( SvNumberFormatsSupplierObj& rParent, ULONG nK, const ::comphelper::SharedMutex& _rMutex ); virtual ~SvNumberFormatObj(); // XPropertySet @@ -253,10 +260,11 @@ class SvNumberFormatSettingsObj : public cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo> { private: - SvNumberFormatsSupplierObj* pSupplier; + SvNumberFormatsSupplierObj& rSupplier; + mutable ::comphelper::SharedMutex m_aMutex; public: - SvNumberFormatSettingsObj(SvNumberFormatsSupplierObj* pParent); + SvNumberFormatSettingsObj( SvNumberFormatsSupplierObj& rParent, const ::comphelper::SharedMutex& _rMutex); virtual ~SvNumberFormatSettingsObj(); diff --git a/svtools/source/numbers/numuno.cxx b/svtools/source/numbers/numuno.cxx index f7746a000a17..f91bf82b4e60 100644 --- a/svtools/source/numbers/numuno.cxx +++ b/svtools/source/numbers/numuno.cxx @@ -53,7 +53,8 @@ using namespace com::sun::star; class SvNumFmtSuppl_Impl { public: - SvNumberFormatter* pFormatter; + SvNumberFormatter* pFormatter; + mutable ::comphelper::SharedMutex aMutex; SvNumFmtSuppl_Impl(SvNumberFormatter* p) : pFormatter(p) {} @@ -77,6 +78,11 @@ SvNumberFormatsSupplierObj::~SvNumberFormatsSupplierObj() delete pImpl; } +::comphelper::SharedMutex& SvNumberFormatsSupplierObj::getSharedMutex() const +{ + return pImpl->aMutex; +} + SvNumberFormatter* SvNumberFormatsSupplierObj::GetNumberFormatter() const { return pImpl->pFormatter; @@ -103,17 +109,17 @@ void SvNumberFormatsSupplierObj::SettingsChanged() uno::Reference<beans::XPropertySet> SAL_CALL SvNumberFormatsSupplierObj::getNumberFormatSettings() throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( pImpl->aMutex ); - return new SvNumberFormatSettingsObj( this ); + return new SvNumberFormatSettingsObj( *this, pImpl->aMutex ); } uno::Reference<util::XNumberFormats> SAL_CALL SvNumberFormatsSupplierObj::getNumberFormats() throw(uno::RuntimeException) { - NAMESPACE_VOS(OGuard) aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( pImpl->aMutex ); - return new SvNumberFormatsObj( this ); + return new SvNumberFormatsObj( *this, pImpl->aMutex ); } // XUnoTunnel diff --git a/svtools/source/numbers/supservs.cxx b/svtools/source/numbers/supservs.cxx index bcdbf86d7754..1035cd056406 100644 --- a/svtools/source/numbers/supservs.cxx +++ b/svtools/source/numbers/supservs.cxx @@ -32,6 +32,7 @@ #include "precompiled_svtools.hxx" #include "supservs.hxx" #include <com/sun/star/lang/Locale.hpp> +#include <comphelper/sharedmutex.hxx> #include <i18npool/mslangid.hxx> #include <tools/debug.hxx> #include <vos/mutex.hxx> @@ -91,8 +92,7 @@ Any SAL_CALL SvNumberFormatsSupplierServiceObject::queryAggregation( const Type& //------------------------------------------------------------------------- void SAL_CALL SvNumberFormatsSupplierServiceObject::initialize( const Sequence< Any >& _rArguments ) throw(Exception, RuntimeException) { - OGuard aGuard(Application::GetSolarMutex()); - // the mutex of the base class .... hope we have a real (i.e. own) mutex sometimes + ::osl::MutexGuard aGuard( getSharedMutex() ); DBG_ASSERT(m_pOwnFormatter == NULL, "SvNumberFormatsSupplierServiceObject::initialize : already initialized !"); @@ -166,7 +166,7 @@ Sequence< ::rtl::OUString > SAL_CALL SvNumberFormatsSupplierServiceObject::getSu //------------------------------------------------------------------------- void SAL_CALL SvNumberFormatsSupplierServiceObject::write( const Reference< XObjectOutputStream >& _rxOutStream ) throw(IOException, RuntimeException) { - OGuard aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( getSharedMutex() ); implEnsureFormatter(); Reference< XOutputStream > xStream(_rxOutStream.get()); @@ -179,7 +179,7 @@ void SAL_CALL SvNumberFormatsSupplierServiceObject::write( const Reference< XObj //------------------------------------------------------------------------- void SAL_CALL SvNumberFormatsSupplierServiceObject::read( const Reference< XObjectInputStream >& _rxInStream ) throw(IOException, RuntimeException) { - OGuard aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( getSharedMutex() ); implEnsureFormatter(); Reference< XInputStream > xStream(_rxInStream.get()); @@ -191,7 +191,7 @@ void SAL_CALL SvNumberFormatsSupplierServiceObject::read( const Reference< XObje //------------------------------------------------------------------------- Reference< XPropertySet > SAL_CALL SvNumberFormatsSupplierServiceObject::getNumberFormatSettings() throw(RuntimeException) { - OGuard aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( getSharedMutex() ); implEnsureFormatter(); return SvNumberFormatsSupplierObj::getNumberFormatSettings(); } @@ -199,7 +199,7 @@ Reference< XPropertySet > SAL_CALL SvNumberFormatsSupplierServiceObject::getNumb //------------------------------------------------------------------------- Reference< XNumberFormats > SAL_CALL SvNumberFormatsSupplierServiceObject::getNumberFormats() throw(RuntimeException) { - OGuard aGuard(Application::GetSolarMutex()); + ::osl::MutexGuard aGuard( getSharedMutex() ); implEnsureFormatter(); return SvNumberFormatsSupplierObj::getNumberFormats(); } diff --git a/svtools/source/numbers/zforfind.cxx b/svtools/source/numbers/zforfind.cxx index b143ad4d8f79..7aac440e8b58 100644 --- a/svtools/source/numbers/zforfind.cxx +++ b/svtools/source/numbers/zforfind.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: zforfind.cxx,v $ - * $Revision: 1.51 $ + * $Revision: 1.51.96.1 $ * * This file is part of OpenOffice.org. * @@ -1385,13 +1385,14 @@ input for the following reasons: { "ko", "KR", "hanja_yoil" }, { "th", "TH", "buddhist" }, { "zh", "TW", "ROC" }, - 0 + {0,0,0} }; lang::Locale aLocale; sal_Bool bValid; - sal_Int16 nDay, nMonth, nYear, nHour, nMinute, nSecond; + sal_Int16 nDay, nMyMonth, nYear, nHour, nMinute, nSecond; sal_Int16 nDaySet, nMonthSet, nYearSet, nHourSet, nMinuteSet, nSecondSet; - sal_Int16 nZO, nDST1, nDST2, nDST; + sal_Int16 nZO, nDST1, nDST2, nDST, nZOmillis, nDST1millis, nDST2millis, nDSTmillis; + sal_Int32 nZoneInMillis, nDST1InMillis, nDST2InMillis; uno::Reference< lang::XMultiServiceFactory > xSMgr = ::comphelper::getProcessServiceFactory(); uno::Reference< ::com::sun::star::i18n::XExtendedCalendar > xCal( @@ -1402,18 +1403,27 @@ input for the following reasons: for ( const entry* p = cals; p->lan; ++p ) { aLocale.Language = ::rtl::OUString::createFromAscii( p->lan ); - aLocale.Country = ::rtl::OUString::createFromAscii( p->cou ); + aLocale.Country = ::rtl::OUString::createFromAscii( p->cou ); xCal->loadCalendar( ::rtl::OUString::createFromAscii( p->cal ), aLocale ); double nDateTime = 0.0; // 1-Jan-1970 00:00:00 - nZO = xCal->getValue( i18n::CalendarFieldIndex::ZONE_OFFSET ); - nDST1 = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET ); - nDateTime -= (double)(nZO + nDST1) / 60.0 / 24.0; + nZO = xCal->getValue( i18n::CalendarFieldIndex::ZONE_OFFSET ); + nZOmillis = xCal->getValue( i18n::CalendarFieldIndex::ZONE_OFFSET_SECOND_MILLIS ); + nZoneInMillis = static_cast<sal_Int32>(nZO) * 60000 + + (nZO < 0 ? -1 : 1) * static_cast<sal_uInt16>(nZOmillis); + nDST1 = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET ); + nDST1millis = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS ); + nDST1InMillis = static_cast<sal_Int32>(nDST1) * 60000 + + (nDST1 < 0 ? -1 : 1) * static_cast<sal_uInt16>(nDST1millis); + nDateTime -= (double)(nZoneInMillis + nDST1InMillis) / 1000.0 / 60.0 / 60.0 / 24.0; xCal->setDateTime( nDateTime ); - nDST2 = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET ); - if ( nDST1 != nDST2 ) + nDST2 = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET ); + nDST2millis = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS ); + nDST2InMillis = static_cast<sal_Int32>(nDST2) * 60000 + + (nDST2 < 0 ? -1 : 1) * static_cast<sal_uInt16>(nDST2millis); + if ( nDST1InMillis != nDST2InMillis ) { - nDateTime = 0.0 - (double)(nZO + nDST2) / 60.0 / 24.0; + nDateTime = 0.0 - (double)(nZoneInMillis + nDST2InMillis) / 1000.0 / 60.0 / 60.0 / 24.0; xCal->setDateTime( nDateTime ); } nDaySet = xCal->getValue( i18n::CalendarFieldIndex::DAY_OF_MONTH ); @@ -1423,7 +1433,9 @@ input for the following reasons: nMinuteSet = xCal->getValue( i18n::CalendarFieldIndex::MINUTE ); nSecondSet = xCal->getValue( i18n::CalendarFieldIndex::SECOND ); nZO = xCal->getValue( i18n::CalendarFieldIndex::ZONE_OFFSET ); + nZOmillis = xCal->getValue( i18n::CalendarFieldIndex::ZONE_OFFSET_SECOND_MILLIS ); nDST = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET ); + nDSTmillis = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS ); xCal->setValue( i18n::CalendarFieldIndex::DAY_OF_MONTH, nDaySet ); xCal->setValue( i18n::CalendarFieldIndex::MONTH, nMonthSet ); xCal->setValue( i18n::CalendarFieldIndex::YEAR, nYearSet ); @@ -1432,12 +1444,12 @@ input for the following reasons: xCal->setValue( i18n::CalendarFieldIndex::SECOND, nSecondSet ); bValid = xCal->isValid(); nDay = xCal->getValue( i18n::CalendarFieldIndex::DAY_OF_MONTH ); - nMonth = xCal->getValue( i18n::CalendarFieldIndex::MONTH ); + nMyMonth= xCal->getValue( i18n::CalendarFieldIndex::MONTH ); nYear = xCal->getValue( i18n::CalendarFieldIndex::YEAR ); nHour = xCal->getValue( i18n::CalendarFieldIndex::HOUR ); nMinute = xCal->getValue( i18n::CalendarFieldIndex::MINUTE ); nSecond = xCal->getValue( i18n::CalendarFieldIndex::SECOND ); - bValid = bValid && nDay == nDaySet && nMonth == nMonthSet && nYear == + bValid = bValid && nDay == nDaySet && nMyMonth == nMonthSet && nYear == nYearSet && nHour == nHourSet && nMinute == nMinuteSet && nSecond == nSecondSet; } diff --git a/svtools/source/numbers/zforlist.cxx b/svtools/source/numbers/zforlist.cxx index efd50cc245ba..b76bf3226b50 100644 --- a/svtools/source/numbers/zforlist.cxx +++ b/svtools/source/numbers/zforlist.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: zforlist.cxx,v $ - * $Revision: 1.73 $ + * $Revision: 1.72.60.2 $ * * This file is part of OpenOffice.org. * @@ -33,7 +33,7 @@ #ifndef GCC #endif -#include <math.h> +// #include <math.h> #include <tools/debug.hxx> #ifndef _SOUND_HXX //autogen #include <vcl/sound.hxx> @@ -2163,15 +2163,31 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, BOOL bLoadingSO // must be appended, not inserted! USHORT nNewExtended = ZF_STANDARD_NEWEXTENDED; + // Number + uno::Sequence< i18n::NumberFormatCode > aFormatSeq + = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::FIXED_NUMBER ); + ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() ); + // General - aFormatCode = pFormatScanner->GetStandardName(); - SvNumberformat* pStdFormat = new SvNumberformat( aFormatCode, - pFormatScanner, pStringScanner, nCheckPos, ActLnge ); - pStdFormat->SetType( NUMBERFORMAT_NUMBER ); - pStdFormat->SetStandard(); - if ( !aFTable.Insert( - CLOffset + SetIndexTable( NF_NUMBER_STANDARD, ZF_STANDARD ), - pStdFormat ) ) + nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_STANDARD ); + SvNumberformat* pStdFormat = ImpInsertFormat( aFormatSeq[nIdx], + CLOffset + SetIndexTable( NF_NUMBER_STANDARD, ZF_STANDARD )); + if (pStdFormat) + { + // This is _the_ standard format. + if (LocaleDataWrapper::areChecksEnabled() && + pStdFormat->GetType() != NUMBERFORMAT_NUMBER) + { + String aMsg( RTL_CONSTASCII_USTRINGPARAM( + "SvNumberFormatter::ImpGenerateFormats: General format not NUMBER")); + LocaleDataWrapper::outputCheckMessage( + xLocaleData->appendLocaleInfo( aMsg)); + } + pStdFormat->SetType( NUMBERFORMAT_NUMBER ); + pStdFormat->SetStandard(); + pStdFormat->SetLastInsertKey( SV_MAX_ANZ_STANDARD_FORMATE ); + } + else { if (LocaleDataWrapper::areChecksEnabled()) { @@ -2180,11 +2196,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, BOOL bLoadingSO LocaleDataWrapper::outputCheckMessage( xLocaleData->appendLocaleInfo( aMsg)); } - delete pStdFormat; - pStdFormat = NULL; } - else - pStdFormat->SetLastInsertKey( SV_MAX_ANZ_STANDARD_FORMATE ); // Boolean aFormatCode = pFormatScanner->GetBooleanString(); @@ -2210,11 +2222,6 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, BOOL bLoadingSO - // Number - uno::Sequence< i18n::NumberFormatCode > aFormatSeq - = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::FIXED_NUMBER ); - ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() ); - // 0 nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_INT ); ImpInsertFormat( aFormatSeq[nIdx], @@ -2916,6 +2923,22 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter } +SvNumberFormatterMergeMap SvNumberFormatter::ConvertMergeTableToMap() +{ + if (!HasMergeFmtTbl()) + return SvNumberFormatterMergeMap(); + + SvNumberFormatterMergeMap aMap; + for (sal_uInt32* pIndex = pMergeTable->First(); pIndex; pIndex = pMergeTable->Next()) + { + sal_uInt32 nOldKey = pMergeTable->GetCurKey(); + aMap.insert( SvNumberFormatterMergeMap::value_type( nOldKey, *pIndex)); + } + ClearMergeTable(); + return aMap; +} + + sal_uInt32 SvNumberFormatter::GetFormatForLanguageIfBuiltIn( sal_uInt32 nFormat, LanguageType eLnge ) { diff --git a/svtools/source/numbers/zformat.cxx b/svtools/source/numbers/zformat.cxx index 80b3def0cdf9..0afbf3b4a3f5 100644 --- a/svtools/source/numbers/zformat.cxx +++ b/svtools/source/numbers/zformat.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: zformat.cxx,v $ - * $Revision: 1.78 $ + * $Revision: 1.78.138.1 $ * * This file is part of OpenOffice.org. * @@ -33,7 +33,7 @@ #include <stdio.h> #include <ctype.h> #include <float.h> -#include <math.h> +// #include <math.h> #include <errno.h> #include <stdlib.h> #include <tools/debug.hxx> @@ -1816,6 +1816,7 @@ void SvNumberformat::ImpGetOutputStandard(double& fNumber, String& OutString) OutString.GetTokenCount('0') == OutString.Len()) OutString.EraseLeadingChars('-'); // nicht -0 } + ImpTransliterate( OutString, NumFor[0].GetNatNum() ); return; } @@ -2391,16 +2392,16 @@ BOOL SvNumberformat::GetOutputString(double fNumber, ExpStr = String::CreateFromInt32( nExp ); } } - USHORT j = nAnz-1; // last symbol - xub_StrLen k; + USHORT j = nAnz-1; // last symbol + xub_StrLen k; // position in ExpStr bRes |= ImpNumberFill(ExpStr, fNumber, k, j, nIx, NF_SYMBOLTYPE_EXP); - while (k > 0) // erase leading zeros - { - k--; - if (ExpStr.GetChar(k) == '0') - ExpStr.Erase(0,1); - } + xub_StrLen nZeros = 0; // erase leading zeros + while (nZeros < k && ExpStr.GetChar(nZeros) == '0') + ++nZeros; + if (nZeros) + ExpStr.Erase( 0, nZeros); + BOOL bCont = TRUE; if (rInfo.nTypeArray[j] == NF_SYMBOLTYPE_EXP) { diff --git a/svtools/source/numbers/zforscan.cxx b/svtools/source/numbers/zforscan.cxx index d9a65a9b5fc6..d6ce04c4da2a 100644 --- a/svtools/source/numbers/zforscan.cxx +++ b/svtools/source/numbers/zforscan.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: zforscan.cxx,v $ - * $Revision: 1.49 $ + * $Revision: 1.49.140.2 $ * * This file is part of OpenOffice.org. * @@ -188,6 +188,50 @@ void ImpSvNumberformatScan::InitKeywords() const } +/** Extract the name of General, Standard, Whatever, ignoring leading modifiers + such as [NatNum1]. */ +static String lcl_extractStandardGeneralName( const ::rtl::OUString & rCode ) +{ + String aStr; + const sal_Unicode* p = rCode.getStr(); + const sal_Unicode* const pStop = p + rCode.getLength(); + const sal_Unicode* pBeg = p; // name begins here + bool bMod = false; + bool bDone = false; + while (p < pStop && !bDone) + { + switch (*p) + { + case '[': + bMod = true; + break; + case ']': + if (bMod) + { + bMod = false; + pBeg = p+1; + } + // else: would be a locale data error, easily to be spotted in + // UI dialog + break; + case ';': + if (!bMod) + { + bDone = true; + --p; // put back, increment by one follows + } + break; + } + ++p; + if (bMod) + pBeg = p; + } + if (pBeg < p) + aStr = rCode.copy( pBeg - rCode.getStr(), p - pBeg); + return aStr; +} + + void ImpSvNumberformatScan::SetDependentKeywords() { using namespace ::com::sun::star; @@ -202,7 +246,7 @@ void ImpSvNumberformatScan::SetDependentKeywords() NumberFormatCodeWrapper aNumberFormatCode( pFormatter->GetServiceManager(), aLoadedLocale ); i18n::NumberFormatCode aFormat = aNumberFormatCode.getFormatCode( NF_NUMBER_STANDARD ); - sNameStandardFormat = aFormat.Code; + sNameStandardFormat = lcl_extractStandardGeneralName( aFormat.Code); sKeyword[NF_KEY_GENERAL] = pCharClass->upper( sNameStandardFormat ); // preset new calendar keywords @@ -328,9 +372,9 @@ void ImpSvNumberformatScan::SetDependentKeywords() case LANGUAGE_FRENCH_MONACO : case LANGUAGE_PORTUGUESE : case LANGUAGE_PORTUGUESE_BRAZILIAN : - case LANGUAGE_SPANISH : - case LANGUAGE_SPANISH_MEXICAN : case LANGUAGE_SPANISH_MODERN : + case LANGUAGE_SPANISH_DATED : + case LANGUAGE_SPANISH_MEXICAN : case LANGUAGE_SPANISH_GUATEMALA : case LANGUAGE_SPANISH_COSTARICA : case LANGUAGE_SPANISH_PANAMA : @@ -1070,6 +1114,7 @@ xub_StrLen ImpSvNumberformatScan::ScanType(const String&) USHORT i = 0; short eNewType; BOOL bMatchBracket = FALSE; + bool bHaveGeneral = false; // if General/Standard encountered SkipStrings(i, nPos); while (i < nAnzStrings) @@ -1139,6 +1184,7 @@ xub_StrLen ImpSvNumberformatScan::ScanType(const String&) break; case NF_KEY_GENERAL: // Standard eNewType = NUMBERFORMAT_NUMBER; + bHaveGeneral = true; break; default: eNewType = NUMBERFORMAT_UNDEFINED; @@ -1361,7 +1407,7 @@ xub_StrLen ImpSvNumberformatScan::ScanType(const String&) } if ((eScannedType == NUMBERFORMAT_NUMBER || eScannedType == NUMBERFORMAT_UNDEFINED) - && nCurrPos != STRING_NOTFOUND) + && nCurrPos != STRING_NOTFOUND && !bHaveGeneral) eScannedType = NUMBERFORMAT_CURRENCY; // old "automatic" currency if (eScannedType == NUMBERFORMAT_UNDEFINED) eScannedType = NUMBERFORMAT_DEFINED; diff --git a/svtools/source/passwordcontainer/passwordcontainer.cxx b/svtools/source/passwordcontainer/passwordcontainer.cxx index 4683ea7041f8..9855e7e3c487 100644 --- a/svtools/source/passwordcontainer/passwordcontainer.cxx +++ b/svtools/source/passwordcontainer/passwordcontainer.cxx @@ -342,7 +342,7 @@ sal_Bool StorageItem::getEncodedMP( ::rtl::OUString& aResult ) //------------------------------------------------------------------------- -void StorageItem::setEncodedMP( const ::rtl::OUString& aEncoded ) +void StorageItem::setEncodedMP( const ::rtl::OUString& aEncoded, sal_Bool bAcceptEmpty ) { Sequence< ::rtl::OUString > sendNames(2); Sequence< uno::Any > sendVals(2); @@ -350,7 +350,7 @@ void StorageItem::setEncodedMP( const ::rtl::OUString& aEncoded ) sendNames[0] = ::rtl::OUString::createFromAscii( "HasMaster" ); sendNames[1] = ::rtl::OUString::createFromAscii( "Master" ); - sal_Bool bHasMaster = ( aEncoded.getLength() > 0 ); + sal_Bool bHasMaster = ( aEncoded.getLength() > 0 || bAcceptEmpty ); sendVals[0] <<= bHasMaster; sendVals[1] <<= aEncoded; @@ -858,6 +858,16 @@ UrlRecord SAL_CALL PasswordContainer::findForName( const ::rtl::OUString& aURL, } //------------------------------------------------------------------------- +::rtl::OUString PasswordContainer::GetDefaultMasterPassword() +{ + ::rtl::OUString aResult; + for ( sal_Int32 nInd = 0; nInd < RTL_DIGEST_LENGTH_MD5; nInd++ ) + aResult += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "aa" ) ); + + return aResult; +} + +//------------------------------------------------------------------------- ::rtl::OUString PasswordContainer::RequestPasswordFromUser( PasswordRequestMode aRMode, const uno::Reference< task::XInteractionHandler >& xHandler ) { // empty string means that the call was cancelled or just failed @@ -898,38 +908,47 @@ UrlRecord SAL_CALL PasswordContainer::findForName( const ::rtl::OUString& aURL, if( !m_aMasterPasswd.getLength() && aHandler.is() ) { ::rtl::OUString aEncodedMP; - sal_Bool bAskAgain; + sal_Bool bAskAgain = sal_False; + sal_Bool bDefaultPassword = sal_False; if( !m_pStorageFile->getEncodedMP( aEncodedMP ) ) aRMode = PasswordRequestMode_PASSWORD_CREATE; + else if ( !aEncodedMP.getLength() ) + { + m_aMasterPasswd = GetDefaultMasterPassword(); + bDefaultPassword = sal_True; + } - do { - bAskAgain = sal_False; - - ::rtl::OUString aPass = RequestPasswordFromUser( aRMode, aHandler ); - if ( aPass.getLength() ) - { - if( aRMode == PasswordRequestMode_PASSWORD_CREATE ) - { - m_aMasterPasswd = aPass; - vector< ::rtl::OUString > aMaster( 1, m_aMasterPasswd ); + if ( !bDefaultPassword ) + { + do { + bAskAgain = sal_False; - m_pStorageFile->setEncodedMP( EncodePasswords( aMaster, m_aMasterPasswd ) ); - } - else + ::rtl::OUString aPass = RequestPasswordFromUser( aRMode, aHandler ); + if ( aPass.getLength() ) { - vector< ::rtl::OUString > aRM( DecodePasswords( aEncodedMP, aPass ) ); - if( !aRM.size() || !aPass.equals( aRM[0] ) ) + if( aRMode == PasswordRequestMode_PASSWORD_CREATE ) { - bAskAgain = sal_True; - aRMode = PasswordRequestMode_PASSWORD_REENTER; + m_aMasterPasswd = aPass; + vector< ::rtl::OUString > aMaster( 1, m_aMasterPasswd ); + + m_pStorageFile->setEncodedMP( EncodePasswords( aMaster, m_aMasterPasswd ) ); } else - m_aMasterPasswd = aPass; + { + vector< ::rtl::OUString > aRM( DecodePasswords( aEncodedMP, aPass ) ); + if( !aRM.size() || !aPass.equals( aRM[0] ) ) + { + bAskAgain = sal_True; + aRMode = PasswordRequestMode_PASSWORD_REENTER; + } + else + m_aMasterPasswd = aPass; + } } - } - } while( bAskAgain ); + } while( bAskAgain ); + } } if ( !m_aMasterPasswd.getLength() ) @@ -1110,33 +1129,42 @@ sal_Bool SAL_CALL PasswordContainer::authorizateWithMasterPassword( const uno::R // the method should fail if there is no master password if( m_pStorageFile && m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP ) ) { - if ( !xTmpHandler.is() ) + if ( !aEncodedMP.getLength() ) { - uno::Reference< lang::XMultiServiceFactory > xFactory( mComponent, uno::UNO_QUERY_THROW ); - xTmpHandler.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), uno::UNO_QUERY_THROW ); - } - - if ( m_aMasterPasswd.getLength() ) - { - // there is a password, it should be just rechecked - PasswordRequestMode aRMode = PasswordRequestMode_PASSWORD_ENTER; - ::rtl::OUString aPass; - - do { - aPass = RequestPasswordFromUser( aRMode, xTmpHandler ); - bResult = ( aPass.getLength() && aPass.equals( m_aMasterPasswd ) ); - aRMode = PasswordRequestMode_PASSWORD_REENTER; // further questions with error notification - } while( !bResult && aPass.getLength() ); + // this is a default master password + // no UI is necessary + bResult = sal_True; } else { - try + if ( !xTmpHandler.is() ) + { + uno::Reference< lang::XMultiServiceFactory > xFactory( mComponent, uno::UNO_QUERY_THROW ); + xTmpHandler.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), uno::UNO_QUERY_THROW ); + } + + if ( m_aMasterPasswd.getLength() ) + { + // there is a password, it should be just rechecked + PasswordRequestMode aRMode = PasswordRequestMode_PASSWORD_ENTER; + ::rtl::OUString aPass; + + do { + aPass = RequestPasswordFromUser( aRMode, xTmpHandler ); + bResult = ( aPass.getLength() && aPass.equals( m_aMasterPasswd ) ); + aRMode = PasswordRequestMode_PASSWORD_REENTER; // further questions with error notification + } while( !bResult && aPass.getLength() ); + } + else { - // ask for the password, if user provide no correct password an exception will be thrown - bResult = ( GetMasterPassword( xTmpHandler ).getLength() > 0 ); + try + { + // ask for the password, if user provide no correct password an exception will be thrown + bResult = ( GetMasterPassword( xTmpHandler ).getLength() > 0 ); + } + catch( uno::Exception& ) + {} } - catch( uno::Exception& ) - {} } } @@ -1260,6 +1288,74 @@ void SAL_CALL PasswordContainer::removeMasterPassword() } //------------------------------------------------------------------------- +::sal_Bool SAL_CALL PasswordContainer::useDefaultMasterPassword( const uno::Reference< task::XInteractionHandler >& xHandler ) + throw ( uno::RuntimeException ) +{ + sal_Bool bResult = sal_False; + uno::Reference< task::XInteractionHandler > xTmpHandler = xHandler; + ::osl::MutexGuard aGuard( mMutex ); + + if ( m_pStorageFile && m_pStorageFile->useStorage() ) + { + if ( !xTmpHandler.is() ) + { + uno::Reference< lang::XMultiServiceFactory > xFactory( mComponent, uno::UNO_QUERY_THROW ); + xTmpHandler.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), uno::UNO_QUERY_THROW ); + } + + sal_Bool bCanChangePassword = sal_True; + // if there is already a stored nondefault master password it should be entered by the user before the change happen + ::rtl::OUString aEncodedMP; + if( m_pStorageFile->getEncodedMP( aEncodedMP ) && aEncodedMP.getLength() ) + bCanChangePassword = authorizateWithMasterPassword( xTmpHandler ); + + if ( bCanChangePassword ) + { + // generate the default password + ::rtl::OUString aPass = GetDefaultMasterPassword(); + if ( aPass.getLength() ) + { + // get all the persistent entries if it is possible + Sequence< UrlRecord > aPersistent = getAllPersistent( uno::Reference< task::XInteractionHandler >() ); + + // remove the master password and the entries persistence + removeMasterPassword(); + + // store the empty string to flag the default master password + m_aMasterPasswd = aPass; + m_pStorageFile->setEncodedMP( ::rtl::OUString(), sal_True ); + + // store all the entries with the new password + for ( int nURLInd = 0; nURLInd < aPersistent.getLength(); nURLInd++ ) + for ( int nNameInd = 0; nNameInd< aPersistent[nURLInd].UserList.getLength(); nNameInd++ ) + addPersistent( aPersistent[nURLInd].Url, + aPersistent[nURLInd].UserList[nNameInd].UserName, + aPersistent[nURLInd].UserList[nNameInd].Passwords, + uno::Reference< task::XInteractionHandler >() ); + + bResult = sal_True; + } + } + } + + return bResult; + +} + +//------------------------------------------------------------------------- +::sal_Bool SAL_CALL PasswordContainer::isDefaultMasterPasswordUsed() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( mMutex ); + + if ( !m_pStorageFile ) + throw uno::RuntimeException(); + + ::rtl::OUString aEncodedMP; + return ( m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP ) && !aEncodedMP.getLength() ); +} + +//------------------------------------------------------------------------- void PasswordContainer::Notify() { diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index 4982beaf3e08..6b6e0b34a975 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -629,7 +629,7 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, eDestEnc = gsl_getSystemTextEncoding(); const String& rOutName = rName.Len() ? rName : rIMap.GetName(); - DBG_ASSERT( rOutName.Len(), "Kein ImageMap-Name" ) + DBG_ASSERT( rOutName.Len(), "Kein ImageMap-Name" ); if( !rOutName.Len() ) return rStream; diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index d1291fda346c..53151514e4d5 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -1928,9 +1928,14 @@ FASTBOOL HTMLParser::IsHTMLFormat( const sal_Char* pHeader, eEnc = RTL_TEXTENCODING_UCS2; } } - if( RTL_TEXTENCODING_UCS2 == eEnc && - (0xfe == (sal_uChar)pHeader[0] && 0xff == (sal_uChar)pHeader[1]) || - (0xff == (sal_uChar)pHeader[0] && 0xfe == (sal_uChar)pHeader[1]) ) + if + ( + RTL_TEXTENCODING_UCS2 == eEnc && + ( + (0xfe == (sal_uChar)pHeader[0] && 0xff == (sal_uChar)pHeader[1]) || + (0xff == (sal_uChar)pHeader[0] && 0xfe == (sal_uChar)pHeader[1]) + ) + ) { if( 0xfe == (sal_uChar)pHeader[0] ) bUCS2B = TRUE; diff --git a/svtools/source/svrtf/rtfkey2.cxx b/svtools/source/svrtf/rtfkey2.cxx index d29e8e5693eb..5c4e1039d92c 100644 --- a/svtools/source/svrtf/rtfkey2.cxx +++ b/svtools/source/svrtf/rtfkey2.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: rtfkey2.cxx,v $ - * $Revision: 1.14 $ + * $Revision: 1.14.134.1 $ * * This file is part of OpenOffice.org. * @@ -1138,4 +1138,25 @@ sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPBOTTOM, "\\shpbottom" ); sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPRIGHT, "\\shpright" ); */ +// Support for overline attributes +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OL, "\\ol" ); +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLD, "\\old" ); +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLDB, "\\oldb" ); +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLNONE, "\\olnone" ); +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLW, "\\olw" ); +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLDASH, "\\oldash" ); +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLDASHD, "\\oldashd" ); +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLDASHDD, "\\oldashdd" ); +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLTH, "\\olth" ); +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLWAVE, "\\olwave" ); +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLC, "\\olc" ); +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLTHD, "\\olthd" ); +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLTHDASH, "\\olthdash" ); +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLLDASH, "\\olldash" ); +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLTHLDASH, "\\olthldash" ); +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLTHDASHD, "\\olthdashd" ); +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLTHDASHDD, "\\olthdashdd" ); +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLHWAVE, "\\olhwave" ); +sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLOLDBWAVE, "\\ololdbwave" ); + /* vi:set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/svtools/source/svrtf/rtfkeywd.cxx b/svtools/source/svrtf/rtfkeywd.cxx index 81637a47d6fd..0762ea1b9c81 100644 --- a/svtools/source/svrtf/rtfkeywd.cxx +++ b/svtools/source/svrtf/rtfkeywd.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: rtfkeywd.cxx,v $ - * $Revision: 1.18 $ + * $Revision: 1.18.134.1 $ * * This file is part of OpenOffice.org. * @@ -1162,7 +1162,28 @@ static RTF_TokenEntry __FAR_DATA aRTFTokenTab[] = { {{sRTF_SHPRIGHT}, RTF_SHPRIGHT} */ {{sRTF_SN}, RTF_SN}, - {{sRTF_SV}, RTF_SV} + {{sRTF_SV}, RTF_SV}, + +// Support for overline attributes + {{sRTF_OL}, RTF_OL}, + {{sRTF_OLW}, RTF_OLW}, + {{sRTF_OLD}, RTF_OLD}, + {{sRTF_OLDB}, RTF_OLDB}, + {{sRTF_OLNONE}, RTF_OLNONE}, + {{sRTF_OLDASH}, RTF_OLDASH}, + {{sRTF_OLDASHD}, RTF_OLDASHD}, + {{sRTF_OLDASHDD}, RTF_OLDASHDD}, + {{sRTF_OLTH}, RTF_OLTH}, + {{sRTF_OLWAVE}, RTF_OLWAVE}, + {{sRTF_OLC}, RTF_OLC}, + {{sRTF_OLTHD}, RTF_OLTHD}, + {{sRTF_OLTHDASH}, RTF_OLTHDASH}, + {{sRTF_OLLDASH}, RTF_OLLDASH}, + {{sRTF_OLTHLDASH}, RTF_OLTHLDASH}, + {{sRTF_OLTHDASHD}, RTF_OLTHDASHD}, + {{sRTF_OLTHDASHDD}, RTF_OLTHDASHDD}, + {{sRTF_OLHWAVE}, RTF_OLHWAVE}, + {{sRTF_OLOLDBWAVE}, RTF_OLOLDBWAVE} }; diff --git a/svtools/source/svrtf/rtfkeywd.hxx b/svtools/source/svrtf/rtfkeywd.hxx index 5b8f077335d9..e7aa2b9a645b 100644 --- a/svtools/source/svrtf/rtfkeywd.hxx +++ b/svtools/source/svrtf/rtfkeywd.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: rtfkeywd.hxx,v $ - * $Revision: 1.13 $ + * $Revision: 1.13.134.1 $ * * This file is part of OpenOffice.org. * @@ -1150,5 +1150,25 @@ extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_SHPBOTTOM, "\\ extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_SHPRIGHT, "\\shpright" ); */ +// Support for overline attributes +extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_OL, "\\ol" ); +extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_OLD, "\\old" ); +extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_OLDB, "\\oldb" ); +extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_OLNONE, "\\olnone" ); +extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_OLW, "\\olw" ); +extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_OLDASH, "\\oldash" ); +extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_OLDASHD, "\\oldashd" ); +extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_OLDASHDD, "\\oldashdd" ); +extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_OLTH, "\\olth" ); +extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_OLWAVE, "\\olwave" ); +extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_OLC, "\\olc" ); +extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_OLTHD, "\\olthd" ); +extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_OLTHDASH, "\\olthdash" ); +extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_OLLDASH, "\\olldash" ); +extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_OLTHLDASH, "\\olthldash" ); +extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_OLTHDASHD, "\\olthdashd" ); +extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_OLTHDASHDD, "\\olthdashdd" ); +extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_OLHWAVE, "\\olhwave" ); +extern SVT_DLLPUBLIC sal_Char const SVTOOLS_CONSTASCII_DECL( sRTF_OLOLDBWAVE, "\\ololdbwave" ); #endif // _RTFKEYWD_HXX diff --git a/svtools/source/svrtf/rtftoken.h b/svtools/source/svrtf/rtftoken.h index e505c5ec0df1..c7981361ffc9 100644 --- a/svtools/source/svrtf/rtftoken.h +++ b/svtools/source/svrtf/rtftoken.h @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: rtftoken.h,v $ - * $Revision: 1.13 $ + * $Revision: 1.13.134.1 $ * * This file is part of OpenOffice.org. * @@ -694,6 +694,11 @@ enum RTF_TOKEN_IDS { RTF_ULDB, RTF_ULNONE, RTF_ULW, + RTF_OL, + RTF_OLD, + RTF_OLDB, + RTF_OLNONE, + RTF_OLW, RTF_UP, RTF_SUPER, RTF_V, @@ -726,6 +731,12 @@ enum RTF_TOKEN_IDS { RTF_ULWAVE, RTF_ULC, RTF_ULTH, + RTF_OLDASHD, + RTF_OLDASH, + RTF_OLDASHDD, + RTF_OLWAVE, + RTF_OLC, + RTF_OLTH, RTF_EMBO, RTF_IMPR, RTF_STRIKED, @@ -751,6 +762,14 @@ enum RTF_TOKEN_IDS { RTF_ULTHDASHDD, RTF_ULHWAVE, RTF_ULULDBWAVE, + RTF_OLTHD, + RTF_OLTHDASH, + RTF_OLLDASH, + RTF_OLTHLDASH, + RTF_OLTHDASHD, + RTF_OLTHDASHDD, + RTF_OLHWAVE, + RTF_OLOLDBWAVE, // association control words RTF_AB, diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx index fd3130b6e3cb..f58a5d11a3c6 100644 --- a/svtools/source/svrtf/svparser.cxx +++ b/svtools/source/svrtf/svparser.cxx @@ -281,7 +281,7 @@ sal_Unicode SvParser::GetNextChar() else { DBG_ASSERT( pImplData && pImplData->hConv, - "no text converter!" ) + "no text converter!" ); sal_Unicode cUC; sal_uInt32 nInfo = 0; diff --git a/svtools/source/undo/undo.cxx b/svtools/source/undo/undo.cxx index 18c5ea15f084..76ed0a0a8e09 100644 --- a/svtools/source/undo/undo.cxx +++ b/svtools/source/undo/undo.cxx @@ -72,7 +72,7 @@ void SfxUndoAction::SetLinked( BOOL bIsLinked ) SfxUndoAction::~SfxUndoAction() { DBG_DTOR(SfxUndoAction, 0); - DBG_ASSERT( !IsLinked(), "Gelinkte Action geloescht" ) + DBG_ASSERT( !IsLinked(), "Gelinkte Action geloescht" ); } diff --git a/svtools/source/uno/contextmenuhelper.cxx b/svtools/source/uno/contextmenuhelper.cxx index 4e79ea1019cb..3c6e8f23e710 100644 --- a/svtools/source/uno/contextmenuhelper.cxx +++ b/svtools/source/uno/contextmenuhelper.cxx @@ -298,10 +298,14 @@ ContextMenuHelper::completeAndExecute( if ( pXMenu ) { PopupMenu* pPopupMenu = dynamic_cast< PopupMenu* >( pXMenu->GetMenu() ); - associateUIConfigurationManagers(); - completeMenuProperties( pPopupMenu ); - executePopupMenu( aPos, pPopupMenu ); - resetAssociations(); + // as dynamic_cast can return zero check pointer + if ( pPopupMenu ) + { + associateUIConfigurationManagers(); + completeMenuProperties( pPopupMenu ); + executePopupMenu( aPos, pPopupMenu ); + resetAssociations(); + } } } diff --git a/svtools/uno/makefile.mk b/svtools/uno/makefile.mk index 346ecf9886bb..8f61c7100508 100644 --- a/svtools/uno/makefile.mk +++ b/svtools/uno/makefile.mk @@ -34,6 +34,7 @@ PRJNAME=svtools TARGET=svtmisc.uno LIBTARGET=NO ENABLE_EXCEPTIONS=TRUE +VISIBILITY_HIDDEN=TRUE # --- Settings ---------------------------------- diff --git a/svtools/util/svl.pmk b/svtools/util/svl.pmk index ce70138b375e..aec76257e743 100644 --- a/svtools/util/svl.pmk +++ b/svtools/util/svl.pmk @@ -32,15 +32,4 @@ # define SVL_DLLIMPLEMENTATION (see @ svldllapi.h) CDEFS += -DSVL_DLLIMPLEMENTATION -# set default symbol visibility / scope to hidden -.IF "$(COMNAME)" == "gcc3" -.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE" - CFLAGS += -fvisibility=hidden -.ENDIF # HAVE_GCC_VISIBILITY_FEATURE -.ENDIF # gcc3 - -.IF "$(COMNAME)" == "sunpro5" -.IF "$(CCNUMVER)" >= "00050005" - CFLAGS += -xldscope=hidden -.ENDIF # 5.5 -.ENDIF # sunpro5 +VISIBILITY_HIDDEN=TRUE diff --git a/svtools/util/svt.pmk b/svtools/util/svt.pmk index 9060e29f91d9..5f36197ce089 100644 --- a/svtools/util/svt.pmk +++ b/svtools/util/svt.pmk @@ -32,15 +32,4 @@ # define SVT_DLLIMPLEMENTATION (see @ svtdllapi.h) CDEFS += -DSVT_DLLIMPLEMENTATION -# set default symbol visibility / scope to hidden -.IF "$(COMNAME)" == "gcc3" -.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE" - CFLAGS += -fvisibility=hidden -.ENDIF # HAVE_GCC_VISIBILITY_FEATURE -.ENDIF # gcc3 - -.IF "$(COMNAME)" == "sunpro5" -.IF "$(CCNUMVER)" >= "00050005" - CFLAGS += -xldscope=hidden -.ENDIF # 5.5 -.ENDIF # sunpro5 +VISIBILITY_HIDDEN=TRUE diff --git a/svtools/workben/unodialog/makefile.mk b/svtools/workben/unodialog/makefile.mk index 098acfd979a0..c6cd6e5d8491 100644 --- a/svtools/workben/unodialog/makefile.mk +++ b/svtools/workben/unodialog/makefile.mk @@ -36,6 +36,7 @@ TARGET=udlg USE_DEFFILE=TRUE ENABLE_EXCEPTIONS=TRUE +VISIBILITY_HIDDEN=TRUE # --- Settings ---------------------------------- diff --git a/toolkit/inc/toolkit/awt/vclxmenu.hxx b/toolkit/inc/toolkit/awt/vclxmenu.hxx index 0a0de4c60741..74db73207250 100644 --- a/toolkit/inc/toolkit/awt/vclxmenu.hxx +++ b/toolkit/inc/toolkit/awt/vclxmenu.hxx @@ -32,9 +32,9 @@ #define _TOOLKIT_AWT_VCLXMENU_HXX_ #include <toolkit/dllapi.h> -#include <com/sun/star/awt/XMenuBar.hpp> -#include <com/sun/star/awt/XPopupMenu.hpp> -#include <com/sun/star/awt/XMenuExtended.hpp> +#include <com/sun/star/awt/XMenuBarExtended.hpp> +#include <com/sun/star/awt/XPopupMenuExtended.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> #include <cppuhelper/weak.hxx> @@ -55,12 +55,12 @@ DECLARE_LIST( PopupMenuRefList, ::com::sun::star::uno::Reference< ::com::sun::st // class VCLXMenu // ---------------------------------------------------- -class TOOLKIT_DLLPUBLIC VCLXMenu : public ::com::sun::star::awt::XMenuBar, - public ::com::sun::star::awt::XPopupMenu, - public ::com::sun::star::awt::XMenuExtended, - public ::com::sun::star::lang::XTypeProvider, - public ::com::sun::star::lang::XUnoTunnel, - public ::cppu::OWeakObject +class TOOLKIT_DLLPUBLIC VCLXMenu : public ::com::sun::star::awt::XMenuBarExtended, + public ::com::sun::star::awt::XPopupMenuExtended, + public ::com::sun::star::lang::XServiceInfo, + public ::com::sun::star::lang::XTypeProvider, + public ::com::sun::star::lang::XUnoTunnel, + public ::cppu::OWeakObject { private: ::osl::Mutex maMutex; @@ -128,6 +128,43 @@ public: virtual ::rtl::OUString SAL_CALL getCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setHelpCommand( sal_Int16 nItemId, const ::rtl::OUString& aHelp ) throw (::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getHelpCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException); + + // ======================================================================== + // ======================================================================== + // ======================================================================== + + // XMenuExtended2 Methods + virtual ::sal_Bool SAL_CALL isPopupMenu( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clear( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::MenuItemType SAL_CALL getItemType( ::sal_Int16 nItemPos ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL hideDisabledEntries( ::sal_Bool bHide ) throw (::com::sun::star::uno::RuntimeException); + + // XMenuBarExtended Methods + + // XPopupMenuExtended Methods + virtual ::sal_Bool SAL_CALL isInExecute( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL endExecute( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLogo( const ::com::sun::star::awt::MenuLogo& aMenuLogo ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::MenuLogo SAL_CALL getLogo( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL enableAutoMnemonics( ::sal_Bool bEnable ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setAcceleratorKeyEvent( ::sal_Int16 nItemId, const ::com::sun::star::awt::KeyEvent& aKeyEvent ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::KeyEvent SAL_CALL getAcceleratorKeyEvent( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sHelpText ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getHelpText( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTipHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sTipHelpText ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTipHelpText( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setItemImage( ::sal_Int16 nItemId, const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& xGraphic, ::sal_Bool bScale ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL getItemImage( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setItemImageAngle( ::sal_Int16 nItemId, ::sal_Int32 nAngle ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getItemImageAngle( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setItemImageMirrorMode( ::sal_Int16 nItemId, ::sal_Bool bMirror ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isItemImageInMirrorMode( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + }; // ---------------------------------------------------- diff --git a/toolkit/inc/toolkit/awt/vclxtopwindow.hxx b/toolkit/inc/toolkit/awt/vclxtopwindow.hxx index f41ac0601b7f..7b4f1922b99e 100644 --- a/toolkit/inc/toolkit/awt/vclxtopwindow.hxx +++ b/toolkit/inc/toolkit/awt/vclxtopwindow.hxx @@ -52,7 +52,7 @@ protected: virtual ::vos::IMutex& GetMutexImpl() = 0; virtual Window* GetWindowImpl() = 0; - virtual TopWindowListenerMultiplexer& GetTopWindowListenersImpl() = 0; + virtual ::cppu::OInterfaceContainerHelper& GetTopWindowListenersImpl() = 0; public: virtual ~VCLXTopWindow_Base(); @@ -81,7 +81,7 @@ private: protected: virtual vos::IMutex& GetMutexImpl(); virtual Window* GetWindowImpl(); - virtual TopWindowListenerMultiplexer& GetTopWindowListenersImpl(); + virtual ::cppu::OInterfaceContainerHelper& GetTopWindowListenersImpl(); public: VCLXTopWindow(bool bWHWND = false); diff --git a/toolkit/inc/toolkit/awt/vclxwindow.hxx b/toolkit/inc/toolkit/awt/vclxwindow.hxx index da601f77a865..8aab5a769df1 100644 --- a/toolkit/inc/toolkit/awt/vclxwindow.hxx +++ b/toolkit/inc/toolkit/awt/vclxwindow.hxx @@ -32,24 +32,23 @@ #define _TOOLKIT_AWT_VCLXWINDOW_HXX_ #include <toolkit/dllapi.h> -#include <com/sun/star/awt/XWindow.hpp> +#include <toolkit/awt/vclxdevice.hxx> +#include <toolkit/helper/listenermultiplexer.hxx> + #include <com/sun/star/awt/XWindow2.hpp> #include <com/sun/star/awt/XVclWindowPeer.hpp> #include <com/sun/star/awt/XLayoutConstrains.hpp> #include <com/sun/star/awt/XView.hpp> -#include <com/sun/star/awt/XPointer.hpp> -#include <com/sun/star/awt/XGraphics.hpp> #include <com/sun/star/beans/XPropertyChangeListener.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/XAccessibleContext.hpp> #include <com/sun/star/awt/XDockableWindow.hpp> + #include <cppuhelper/weak.hxx> +#include <cppuhelper/implbase8.hxx> #include <osl/mutex.hxx> -#include <toolkit/awt/vclxdevice.hxx> -#include <toolkit/helper/listenermultiplexer.hxx> - #include <tools/gen.hxx> // Size #include <tools/link.hxx> @@ -74,44 +73,21 @@ namespace toolkit class UnoPropertyArrayHelper; class VCLXWindowImpl; -class TOOLKIT_DLLPUBLIC VCLXWindow : public ::com::sun::star::awt::XWindow2, - public ::com::sun::star::awt::XVclWindowPeer, - public ::com::sun::star::awt::XLayoutConstrains, - public ::com::sun::star::awt::XView, - public ::com::sun::star::awt::XDockableWindow, - public ::com::sun::star::accessibility::XAccessible, - public ::com::sun::star::lang::XEventListener, - public ::com::sun::star::beans::XPropertySetInfo, - public VCLXDevice +typedef ::cppu::ImplInheritanceHelper8 < VCLXDevice + , ::com::sun::star::awt::XWindow2 + , ::com::sun::star::awt::XVclWindowPeer + , ::com::sun::star::awt::XLayoutConstrains + , ::com::sun::star::awt::XView + , ::com::sun::star::awt::XDockableWindow + , ::com::sun::star::accessibility::XAccessible + , ::com::sun::star::lang::XEventListener + , ::com::sun::star::beans::XPropertySetInfo + > VCLXWindow_Base; + +class TOOLKIT_DLLPUBLIC VCLXWindow : public VCLXWindow_Base { private: - EventListenerMultiplexer maEventListeners; - FocusListenerMultiplexer maFocusListeners; - WindowListenerMultiplexer maWindowListeners; - KeyListenerMultiplexer maKeyListeners; - MouseListenerMultiplexer maMouseListeners; - MouseMotionListenerMultiplexer maMouseMotionListeners; - PaintListenerMultiplexer maPaintListeners; - VclContainerListenerMultiplexer maContainerListeners; - TopWindowListenerMultiplexer maTopWindowListeners; - - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer> mxPointer; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> mxViewGraphics; - - ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > mxAccessibleContext; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindowListener> mxDockableWindowListener; - - ULONG mnListenerLockLevel; - ULONG nDummy2; VCLXWindowImpl* mpImpl; - UnoPropertyArrayHelper *mpPropHelper; - - - sal_Bool mbDisposing : 1; - sal_Bool mbDesignMode : 1; - sal_Bool mbSynthesizingVCLEvent : 1; - sal_Bool mbWithDefaultProps : 1; - sal_Bool mbDrawingOntoParent; UnoPropertyArrayHelper *GetPropHelper(); @@ -123,8 +99,9 @@ protected: virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext(); - void SetSynthesizingVCLEvent( sal_Bool b ) { mbSynthesizingVCLEvent = b; } - BOOL IsSynthesizingVCLEvent() const { return mbSynthesizingVCLEvent; } + void SetSynthesizingVCLEvent( sal_Bool b ); + BOOL IsSynthesizingVCLEvent() const; + void SetSystemParent_Impl( const com::sun::star::uno::Any& rHandle ); ::toolkit::IAccessibleFactory& getAccessibleFactory(); @@ -134,8 +111,10 @@ protected: // for use in controls/ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds, bool bWithDefaults = false ); - virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) - { return ImplGetPropertyIds( aIds, mbWithDefaultProps ); } + virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ); + + ::cppu::OInterfaceContainerHelper& GetContainerListeners(); + ::cppu::OInterfaceContainerHelper& GetTopWindowListeners(); public: VCLXWindow( bool bWithDefaultProps = false ); @@ -143,36 +122,17 @@ public: virtual void SetWindow( Window* pWindow ); Window* GetWindow() const { return (Window*)GetOutputDevice(); } - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> GetViewGraphics() const { return mxViewGraphics; } void suspendVclEventListening( ); void resumeVclEventListening( ); - EventListenerMultiplexer& GetEventListeners() { return maEventListeners; } - FocusListenerMultiplexer& GetFocusListeners() { return maFocusListeners; } - WindowListenerMultiplexer& GetWindowListeners() { return maWindowListeners; } - KeyListenerMultiplexer& GetKeyListeners() { return maKeyListeners; } - MouseListenerMultiplexer& GetMouseListeners() { return maMouseListeners; } - MouseMotionListenerMultiplexer& GetMouseMotionListeners() { return maMouseMotionListeners; } - PaintListenerMultiplexer& GetPaintListeners() { return maPaintListeners; } - VclContainerListenerMultiplexer& GetContainerListeners() { return maContainerListeners; } - TopWindowListenerMultiplexer& GetTopWindowListeners() { return maTopWindowListeners; } - - // ::com::sun::star::uno::XInterface - ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL acquire() throw() { OWeakObject::acquire(); } - void SAL_CALL release() throw() { OWeakObject::release(); } + void notifyWindowRemoved( Window& _rWindow ); // ::com::sun::star::lang::XUnoTunnel static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw(); static VCLXWindow* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw(); sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException); - // ::com::sun::star::lang::XTypeProvider - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::lang::XEventListener virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); diff --git a/toolkit/inc/toolkit/controls/unocontrols.hxx b/toolkit/inc/toolkit/controls/unocontrols.hxx index 0c4f2e6962a6..97ba5fb045b6 100644 --- a/toolkit/inc/toolkit/controls/unocontrols.hxx +++ b/toolkit/inc/toolkit/controls/unocontrols.hxx @@ -54,6 +54,7 @@ #include <com/sun/star/awt/XCurrencyField.hpp> #include <com/sun/star/awt/XPatternField.hpp> #include <com/sun/star/awt/XProgressBar.hpp> +#include <com/sun/star/graphic/XGraphicObject.hpp> #include <toolkit/controls/unocontrolmodel.hxx> #include <toolkit/controls/unocontrolbase.hxx> #include <toolkit/helper/macros.hxx> @@ -67,6 +68,9 @@ #include <list> +#define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" +#define UNO_NAME_GRAPHOBJ_URLPKGPREFIX "vnd.sun.star.Package:" + // ---------------------------------------------------- // class UnoControlEditModel @@ -220,6 +224,8 @@ private: bool mbAdjustingImagePosition; bool mbAdjustingGraphic; + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj; + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL ); protected: ImageProducerControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { } ImageProducerControlModel( const ImageProducerControlModel& _rSource ) : com::sun::star::awt::XImageProducer(), UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { } @@ -346,6 +352,8 @@ public: // ---------------------------------------------------- class UnoControlImageControlModel : public ImageProducerControlModel { +private: + bool mbAdjustingImageScaleMode; protected: ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; @@ -353,7 +361,7 @@ protected: public: UnoControlImageControlModel(); - UnoControlImageControlModel( const UnoControlImageControlModel& rModel ) : ImageProducerControlModel( rModel ) {;} + UnoControlImageControlModel( const UnoControlImageControlModel& rModel ) : ImageProducerControlModel( rModel ), mbAdjustingImageScaleMode( false ) { } UnoControlModel* Clone() const { return new UnoControlImageControlModel( *this ); } @@ -365,6 +373,9 @@ public: // ::com::sun::star::lang::XServiceInfo DECLIMPL_SERVICEINFO_DERIVED( UnoControlImageControlModel, ImageProducerControlModel, szServiceName2_UnoControlImageControlModel ) + + // ::cppu::OPropertySetHelper + void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception); }; // ---------------------------------------------------- diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx index 5e30558a3ee6..da2de08c9544 100644 --- a/toolkit/inc/toolkit/helper/property.hxx +++ b/toolkit/inc/toolkit/helper/property.hxx @@ -188,6 +188,9 @@ namespace rtl { #define BASEPROPERTY_URL 134 // ::rtl::OUString #define BASEPROPERTY_UNIT 135 // ::awt::FieldUnit #define BASEPROPERTY_CUSTOMUNITTEXT 136 // ::rtl::OUString +#define BASEPROPERTY_IMAGE_SCALE_MODE 137 +#define BASEPROPERTY_WRITING_MODE 138 +#define BASEPROPERTY_CONTEXT_WRITING_MODE 139 // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen. #define BASEPROPERTY_FONTDESCRIPTORPART_START 1000 diff --git a/toolkit/qa/unoapi/knownissues.xcl b/toolkit/qa/unoapi/knownissues.xcl index ebc2ccc188bb..ef954f00eeeb 100644 --- a/toolkit/qa/unoapi/knownissues.xcl +++ b/toolkit/qa/unoapi/knownissues.xcl @@ -236,4 +236,7 @@ toolkit.AccessibleWindow::com::sun::star::accessibility::XAccessibleEventBroadca toolkit.AccessibleScrollBar::com::sun::star::accessibility::XAccessibleComponent ### i90356 ### -toolkit.UnoScrollBarControl::com::sun::star::awt::XScrollBar
\ No newline at end of file +toolkit.UnoScrollBarControl::com::sun::star::awt::XScrollBar + +### i94344 ### +toolkit.AccessibleTabPage::com::sun::star::accessibility::XAccessibleText
\ No newline at end of file diff --git a/toolkit/source/awt/vclxdialog.cxx b/toolkit/source/awt/vclxdialog.cxx index 76a266d1e609..26cff37e8e2b 100644 --- a/toolkit/source/awt/vclxdialog.cxx +++ b/toolkit/source/awt/vclxdialog.cxx @@ -94,9 +94,9 @@ Window* VCLXDialog::GetWindowImpl() return VCLXWindow::GetWindow(); } -TopWindowListenerMultiplexer& VCLXDialog::GetTopWindowListenersImpl() +::cppu::OInterfaceContainerHelper& VCLXDialog::GetTopWindowListenersImpl() { - return VCLXWindow::GetTopWindowListeners(); + return GetTopWindowListeners(); } IMPLEMENT_2_FORWARD_XINTERFACE2( VCLXDialog, VCLXWindow, Bin, VCLXDialog_Base ); diff --git a/toolkit/source/awt/vclxdialog.hxx b/toolkit/source/awt/vclxdialog.hxx index 5c5f85177ce3..b4245a7b6e65 100644 --- a/toolkit/source/awt/vclxdialog.hxx +++ b/toolkit/source/awt/vclxdialog.hxx @@ -59,7 +59,7 @@ private: protected: vos::IMutex& GetMutexImpl(); Window* GetWindowImpl(); - TopWindowListenerMultiplexer& GetTopWindowListenersImpl(); + ::cppu::OInterfaceContainerHelper& GetTopWindowListenersImpl(); ~VCLXDialog(); diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx index 3c6228f61689..febb6523e2cc 100644 --- a/toolkit/source/awt/vclxmenu.cxx +++ b/toolkit/source/awt/vclxmenu.cxx @@ -34,6 +34,7 @@ #include <toolkit/awt/vclxmenu.hxx> #include <toolkit/helper/macros.hxx> +#include <toolkit/helper/servicenames.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <toolkit/helper/convert.hxx> #include <cppuhelper/typeprovider.hxx> @@ -41,22 +42,62 @@ #include <rtl/uuid.h> #include <vcl/menu.hxx> +#include <vcl/keycod.hxx> +#include <vcl/image.hxx> +#include <vcl/mnemonic.hxx> + +#include <com/sun/star/awt/KeyModifier.hpp> + + +#ifdef DBG_UTIL + #define THROW_MENUITEM_NOT_FOUND( Func, nItemId ) \ + if ( MENU_ITEM_NOTFOUND == mpMenu->GetItemPos( nItemId ) ) \ + throw ::com::sun::star::container::NoSuchElementException( \ + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( Func ) ) \ + += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": There is no menu item with " ) ) \ + += ::rtl::OUString::valueOf( sal_Int32( nItemId ) ) \ + += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " as identifier" ) ), \ + *this \ + ); + #define THROW_MENUPOS_NOT_FOUND( Func, nPos ) \ + if ( MENU_ITEM_NOTFOUND == sal_uInt16( nPos ) ) \ + throw ::com::sun::star::container::NoSuchElementException( \ + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( Func ) ) \ + += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": There is no menu item at position " ) ) \ + += ::rtl::OUString::valueOf( sal_Int32( nPos ) ), \ + *this \ + ); +#else + #define THROW_MENUITEM_NOT_FOUND( Func, nItemId ) \ + if ( MENU_ITEM_NOTFOUND == mpMenu->GetItemPos( nItemId ) ) \ + throw ::com::sun::star::container::NoSuchElementException(); + #define THROW_MENUPOS_NOT_FOUND( Func, nPos ) \ + if ( MENU_ITEM_NOTFOUND == sal_uInt16( nPos ) ) \ + throw ::com::sun::star::container::NoSuchElementException(); +#endif + // ---------------------------------------------------- // class VCLXMenu // ---------------------------------------------------- + +DBG_NAME(VCLXMenu) + VCLXMenu::VCLXMenu() : maMenuListeners( *this ) { + DBG_CTOR( VCLXMenu, 0 ); mpMenu = NULL; } VCLXMenu::VCLXMenu( Menu* pMenu ) : maMenuListeners( *this ) { + DBG_CTOR( VCLXMenu, 0 ); mpMenu = pMenu; } VCLXMenu::~VCLXMenu() { + DBG_DTOR( VCLXMenu, 0 ); for ( sal_uInt32 n = maPopupMenueRefs.Count(); n; ) { ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pRef = maPopupMenueRefs.GetObject( --n ); @@ -172,16 +213,89 @@ IMPL_LINK( VCLXMenu, MenuEventListener, VclSimpleEvent*, pEvent ) } +//============================================================================= +//============================================================================= +//============================================================================= + + +// ::com::sun::star::lang::XServiceInfo +::rtl::OUString SAL_CALL VCLXMenu::getImplementationName( ) +throw (::com::sun::star::uno::RuntimeException) +{ + ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); + const sal_Bool bIsPopupMenu = IsPopupMenu(); + aGuard.clear(); + + ::rtl::OUString implName( RTL_CONSTASCII_USTRINGPARAM( "stardiv.Toolkit." ) ); + if ( bIsPopupMenu ) + implName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VCLXPopupMenu" ) ); + else + implName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VCLXMenuBar" ) ); + + return implName; +} + + +::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL VCLXMenu::getSupportedServiceNames( ) +throw (::com::sun::star::uno::RuntimeException) +{ + ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); + const sal_Bool bIsPopupMenu = IsPopupMenu(); + aGuard.clear(); + + ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames( 1 ); + if ( bIsPopupMenu ) + aNames[ 0 ] = ::rtl::OUString::createFromAscii( szServiceName2_PopupMenu ); + else + aNames[ 0 ] = ::rtl::OUString::createFromAscii( szServiceName2_MenuBar ); + + return aNames; +} + + +::sal_Bool SAL_CALL VCLXMenu::supportsService( const ::rtl::OUString& rServiceName ) +throw (::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() ); + + if ( aServiceNames[ 0 ] == rServiceName ) + return sal_True; + + return sal_False; +} + + // ::com::sun::star::uno::XInterface -::com::sun::star::uno::Any VCLXMenu::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) +::com::sun::star::uno::Any VCLXMenu::queryInterface( const ::com::sun::star::uno::Type & rType ) +throw(::com::sun::star::uno::RuntimeException) { - ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, + ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); + const sal_Bool bIsPopupMenu = IsPopupMenu(); + aGuard.clear(); + + ::com::sun::star::uno::Any aRet; + + if ( bIsPopupMenu ) + aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( ::com::sun::star::awt::XMenu*, (::com::sun::star::awt::XMenuBar*) this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XMenuBar*, this ), SAL_STATIC_CAST( ::com::sun::star::awt::XPopupMenu*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XMenuExtended*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XPopupMenuExtended*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XMenuExtended*, (::com::sun::star::awt::XPopupMenuExtended*) this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XMenuExtended2*, (::com::sun::star::awt::XPopupMenuExtended*) this ), SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XServiceInfo*, this ), SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ) ); + else + aRet = ::cppu::queryInterface( rType, + SAL_STATIC_CAST( ::com::sun::star::awt::XMenu*, (::com::sun::star::awt::XMenuBar*) this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XMenuBar*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XMenuBarExtended*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XMenuExtended*, (::com::sun::star::awt::XMenuBarExtended*) this ), + SAL_STATIC_CAST( ::com::sun::star::awt::XMenuExtended2*, (::com::sun::star::awt::XMenuBarExtended*) this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XServiceInfo*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ) ); + return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); } @@ -189,12 +303,104 @@ IMPL_LINK( VCLXMenu, MenuEventListener, VclSimpleEvent*, pEvent ) IMPL_XUNOTUNNEL( VCLXMenu ) // ::com::sun::star::lang::XTypeProvider -IMPL_XTYPEPROVIDER_START( VCLXMenu ) - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenu>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended>* ) NULL ) -IMPL_XTYPEPROVIDER_END +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > VCLXMenu::getTypes() +throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); + const sal_Bool bIsPopupMenu = IsPopupMenu(); + aGuard.clear(); + + static ::cppu::OTypeCollection* pCollectionMenuBar = NULL; + static ::cppu::OTypeCollection* pCollectionPopupMenu = NULL; + + if ( bIsPopupMenu ) + { + if( !pCollectionPopupMenu ) + { + ::osl::Guard< ::osl::Mutex > aGlobalGuard( ::osl::Mutex::getGlobalMutex() ); + if( !pCollectionPopupMenu ) + { + static ::cppu::OTypeCollection collectionPopupMenu( + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenu>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenuExtended>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended2>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL ) ); + pCollectionPopupMenu = &collectionPopupMenu; + } + } + + return (*pCollectionPopupMenu).getTypes(); + } + else + { + if( !pCollectionMenuBar ) + { + ::osl::Guard< ::osl::Mutex > aGlobalGuard( ::osl::Mutex::getGlobalMutex() ); + if( !pCollectionMenuBar ) + { + static ::cppu::OTypeCollection collectionMenuBar( + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenu>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBarExtended>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended2>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL ) ); + pCollectionMenuBar = &collectionMenuBar; + } + } + return (*pCollectionMenuBar).getTypes(); + } +} + + +::com::sun::star::uno::Sequence< sal_Int8 > VCLXMenu::getImplementationId() +throw(::com::sun::star::uno::RuntimeException) +{ + ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() ); + const sal_Bool bIsPopupMenu = IsPopupMenu(); + aGuard.clear(); + + static ::cppu::OImplementationId* pIdMenuBar = NULL; + static ::cppu::OImplementationId* pIdPopupMenu = NULL; + + if ( bIsPopupMenu ) + { + if( !pIdPopupMenu ) + { + ::osl::Guard< ::osl::Mutex > aGlobalGuard( ::osl::Mutex::getGlobalMutex() ); + if( !pIdPopupMenu ) + { + static ::cppu::OImplementationId idPopupMenu( sal_False ); + pIdPopupMenu = &idPopupMenu; + } + } + + return (*pIdPopupMenu).getImplementationId(); + } + else + { + if( !pIdMenuBar ) + { + ::osl::Guard< ::osl::Mutex > aGlobalGuard( ::osl::Mutex::getGlobalMutex() ); + if( !pIdMenuBar ) + { + static ::cppu::OImplementationId idMenuBar( sal_False ); + pIdMenuBar = &idMenuBar; + } + } + + return (*pIdMenuBar).getImplementationId(); + } +} + + +//============================================================================= +//============================================================================= +//============================================================================= void VCLXMenu::addMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) @@ -413,24 +619,441 @@ void SAL_CALL VCLXMenu::setHelpCommand( sal_Int16 nItemId, const ::rtl::OUString return aHelpCommand; } + +// ============================================================================ +// ============================================================================ +// ============================================================================ + + +// BEGIN ANONYMOUS NAMESPACE +namespace +{ + namespace css = ::com::sun::star; + + Image lcl_XGraphic2VCLImage( + const css::uno::Reference< css::graphic::XGraphic >& xGraphic, + sal_Bool bResize ) + { + Image aImage; + if ( !xGraphic.is() ) + return aImage; + + aImage = Image( xGraphic ); + const ::Size aCurSize = aImage.GetSizePixel(); + const sal_Int32 nCurWidth = aCurSize.Width(); + const sal_Int32 nCurHeight = aCurSize.Height(); + const sal_Int32 nIdeal( 16 ); + + if ( nCurWidth > 0 && nCurHeight > 0 ) + { + if ( bResize && ( nCurWidth > nIdeal || nCurHeight > nIdeal ) ) + { + sal_Int32 nIdealWidth = nCurWidth > nIdeal ? nIdeal : nCurWidth; + sal_Int32 nIdealHeight = nCurHeight > nIdeal ? nIdeal : nCurHeight; + + ::Size aNewSize( nIdealWidth, nIdealHeight ); + + sal_Bool bModified( sal_False ); + BitmapEx aBitmapEx = aImage.GetBitmapEx(); + bModified = aBitmapEx.Scale( aNewSize, BMP_SCALE_INTERPOLATE ); + + if ( bModified ) + aImage = Image( aBitmapEx ); + } + } + return aImage; + } + + /** + As svtools builds after toolkit, we can not include/use + svtools/inc/acceleratorexecute.hxx + So I just copy here svt::AcceleratorExecute::st_AWTKey2VCLKey + and svt::AcceleratorExecute::st_VCLKey2AWTKey + */ + css::awt::KeyEvent lcl_VCLKey2AWTKey(const KeyCode& aVCLKey) + { + css::awt::KeyEvent aAWTKey; + aAWTKey.Modifiers = 0; + aAWTKey.KeyCode = (sal_Int16)aVCLKey.GetCode(); + + if (aVCLKey.IsShift()) + aAWTKey.Modifiers |= css::awt::KeyModifier::SHIFT; + if (aVCLKey.IsMod1()) + aAWTKey.Modifiers |= css::awt::KeyModifier::MOD1; + if (aVCLKey.IsMod2()) + aAWTKey.Modifiers |= css::awt::KeyModifier::MOD2; + + return aAWTKey; + } + + KeyCode lcl_AWTKey2VCLKey(const css::awt::KeyEvent& aAWTKey) + { + sal_Bool bShift = ((aAWTKey.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT ); + sal_Bool bMod1 = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD1 ) == css::awt::KeyModifier::MOD1 ); + sal_Bool bMod2 = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD2 ) == css::awt::KeyModifier::MOD2 ); + USHORT nKey = (USHORT)aAWTKey.KeyCode; + + return KeyCode(nKey, bShift, bMod1, bMod2); + } + +} // END ANONYMOUS NAMESPACE + + +// ============================================================================ +// ============================================================================ +// ============================================================================ + + +// XMenuExtended2 Methods + +::sal_Bool SAL_CALL VCLXMenu::isPopupMenu( ) throw (::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + return IsPopupMenu(); +} + +void SAL_CALL VCLXMenu::clear( ) throw (::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + if ( mpMenu ) + mpMenu->Clear(); +} + + +::com::sun::star::awt::MenuItemType SAL_CALL VCLXMenu::getItemType( ::sal_Int16 nItemPos ) +throw ( ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::awt::MenuItemType aMenuItemType = + ::com::sun::star::awt::MenuItemType_DONTKNOW; + if ( mpMenu ) + { + THROW_MENUPOS_NOT_FOUND( "VCLXMenu::getItemType()", nItemPos ) + aMenuItemType = ( (::com::sun::star::awt::MenuItemType) mpMenu->GetItemType( nItemPos ) ); + } + + return aMenuItemType; +} + +void SAL_CALL VCLXMenu::hideDisabledEntries( ::sal_Bool bHide ) +throw (::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + if ( mpMenu ) + { + if ( bHide ) + mpMenu->SetMenuFlags( mpMenu->GetMenuFlags() | MENU_FLAG_HIDEDISABLEDENTRIES ); + else + mpMenu->SetMenuFlags( mpMenu->GetMenuFlags() & ~MENU_FLAG_HIDEDISABLEDENTRIES ); + } +} + + +// ============================================================================ +// ============================================================================ +// ============================================================================ + + +// XPopupMenuExtended Methods + +::sal_Bool SAL_CALL VCLXMenu::isInExecute( ) +throw (::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if ( mpMenu && IsPopupMenu() ) + return ( (PopupMenu*) mpMenu )->IsInExecute(); + else + return sal_False; +} + + +void SAL_CALL VCLXMenu::endExecute() +throw (::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if ( mpMenu && IsPopupMenu() ) + ( (PopupMenu*) mpMenu )->EndExecute(); +} + + +void SAL_CALL VCLXMenu::setLogo( const ::com::sun::star::awt::MenuLogo& aMenuLogo ) +throw (::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if ( mpMenu ) + { + if ( aMenuLogo.Graphic.is() ) + { + Image aImage = lcl_XGraphic2VCLImage( aMenuLogo.Graphic, sal_False ); + MenuLogo aVCLMenuLogo; + + aVCLMenuLogo.aBitmap = aImage.GetBitmapEx(); + aVCLMenuLogo.aStartColor = Color( (sal_uInt32)(aMenuLogo.StartColor) ); + aVCLMenuLogo.aEndColor = Color( (sal_uInt32)(aMenuLogo.EndColor) ); + + mpMenu->SetLogo( aVCLMenuLogo ); + } + else + mpMenu->SetLogo(); + } +} + + +::com::sun::star::awt::MenuLogo SAL_CALL VCLXMenu::getLogo( ) +throw (::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::awt::MenuLogo aAWTMenuLogo; + if ( mpMenu ) + { + if ( mpMenu->HasLogo() ) + { + MenuLogo aVCLMenuLogo = mpMenu->GetLogo(); + aAWTMenuLogo.Graphic = Image(aVCLMenuLogo.aBitmap).GetXGraphic(); + aAWTMenuLogo.StartColor = aVCLMenuLogo.aStartColor.GetColor(); + aAWTMenuLogo.EndColor = aVCLMenuLogo.aEndColor.GetColor(); + } + } + return aAWTMenuLogo; +} + + +void SAL_CALL VCLXMenu::enableAutoMnemonics( ::sal_Bool bEnable ) +throw (::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + if ( mpMenu ) + { + if ( !bEnable ) + mpMenu->SetMenuFlags( mpMenu->GetMenuFlags() | MENU_FLAG_NOAUTOMNEMONICS ); + else + mpMenu->SetMenuFlags( mpMenu->GetMenuFlags() & ~MENU_FLAG_NOAUTOMNEMONICS ); + } +} + + +void SAL_CALL VCLXMenu::setAcceleratorKeyEvent( ::sal_Int16 nItemId, + const ::com::sun::star::awt::KeyEvent& aKeyEvent ) +throw ( ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if ( mpMenu && IsPopupMenu() ) + { + THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setAcceleratorKeyEvent()", nItemId ) + KeyCode aVCLKeyCode = lcl_AWTKey2VCLKey( aKeyEvent ); + mpMenu->SetAccelKey( nItemId, aVCLKeyCode ); + } +} + + +::com::sun::star::awt::KeyEvent SAL_CALL VCLXMenu::getAcceleratorKeyEvent( ::sal_Int16 nItemId ) +throw ( ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::awt::KeyEvent aKeyEvent; + if ( mpMenu && IsPopupMenu() ) + { + THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getAcceleratorKeyEvent()", nItemId ) + KeyCode nKeyCode = mpMenu->GetAccelKey( nItemId ); + aKeyEvent = lcl_VCLKey2AWTKey( nKeyCode ); + } + + return aKeyEvent; +} + + +void SAL_CALL VCLXMenu::setHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sHelpText ) +throw ( ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if ( mpMenu && IsPopupMenu() ) + { + THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setHelpText()", nItemId ) + mpMenu->SetHelpText( nItemId, sHelpText ); + } +} + + +::rtl::OUString SAL_CALL VCLXMenu::getHelpText( ::sal_Int16 nItemId ) +throw ( ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + rtl::OUString sHelpText; + if ( mpMenu && IsPopupMenu() ) + { + THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getHelpText()", nItemId ) + sHelpText = mpMenu->GetHelpText( nItemId ); + } + + return sHelpText; +} + + +void SAL_CALL VCLXMenu::setTipHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sTipHelpText ) +throw ( ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if ( mpMenu && IsPopupMenu() ) + { + THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setTipHelpText()", nItemId ) + mpMenu->SetTipHelpText( nItemId, sTipHelpText ); + } +} + + +::rtl::OUString SAL_CALL VCLXMenu::getTipHelpText( ::sal_Int16 nItemId ) +throw ( ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + rtl::OUString sTipHelpText; + if ( mpMenu && IsPopupMenu() ) + { + THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getTipHelpText()", nItemId ) + sTipHelpText = mpMenu->GetTipHelpText( nItemId ); + } + return sTipHelpText; +} + + +void SAL_CALL VCLXMenu::setItemImage( + ::sal_Int16 nItemId, + const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& xGraphic, ::sal_Bool bScale ) +throw ( ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if ( mpMenu && IsPopupMenu() ) + { + THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setItemImage()", nItemId ) + Image aImage = lcl_XGraphic2VCLImage( xGraphic, bScale ); + mpMenu->SetItemImage( nItemId, aImage ); + } +} + + +::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL VCLXMenu::getItemImage( ::sal_Int16 nItemId ) +throw ( ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > rxGraphic; + + if ( mpMenu && IsPopupMenu() ) + { + THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getItemImage()", nItemId ) + Image aImage = mpMenu->GetItemImage( nItemId ); + if ( !!aImage ) + rxGraphic = aImage.GetXGraphic(); + } + return rxGraphic; +} + + +void SAL_CALL VCLXMenu::setItemImageAngle( ::sal_Int16 nItemId, ::sal_Int32 nAngle ) +throw ( ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if ( mpMenu && IsPopupMenu() ) + { + THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setItemImageAngle()", nItemId ) + mpMenu->SetItemImageAngle( nItemId, nAngle ); + } +} + + +::sal_Int32 SAL_CALL VCLXMenu::getItemImageAngle( ::sal_Int16 nItemId ) +throw ( ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::sal_Int32 nItemImageAngle( 0 ); + if ( mpMenu && IsPopupMenu() ) + { + THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getItemImageAngle()", nItemId ) + nItemImageAngle = mpMenu->GetItemImageAngle( nItemId ); + } + return nItemImageAngle; +} + + +void SAL_CALL VCLXMenu::setItemImageMirrorMode( ::sal_Int16 nItemId, ::sal_Bool bMirror ) +throw ( ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + if ( mpMenu && IsPopupMenu() ) + { + THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setItemImageMirrorMode()", nItemId ) + mpMenu->SetItemImageMirrorMode( nItemId, bMirror ); + } +} + + +::sal_Bool SAL_CALL VCLXMenu::isItemImageInMirrorMode( ::sal_Int16 nItemId ) +throw ( ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + sal_Bool bMirrorMode( sal_False ); + if ( mpMenu && IsPopupMenu() ) + { + THROW_MENUITEM_NOT_FOUND( "VCLXMenu::isItemImageInMirrorMode()", nItemId ) + bMirrorMode = mpMenu->GetItemImageMirrorMode( nItemId ); + } + return bMirrorMode; +} + + // ---------------------------------------------------- // class VCLXMenuBar // ---------------------------------------------------- +DBG_NAME(VCLXMenuBar); + VCLXMenuBar::VCLXMenuBar() { + DBG_CTOR( VCLXMenuBar, 0 ); ImplCreateMenu( FALSE ); } VCLXMenuBar::VCLXMenuBar( MenuBar* pMenuBar ) : VCLXMenu( (Menu *)pMenuBar ) { + DBG_CTOR( VCLXMenuBar, 0 ); } // ---------------------------------------------------- // class VCLXPopupMenu // ---------------------------------------------------- +DBG_NAME(VCLXPopupMenu); + VCLXPopupMenu::VCLXPopupMenu() { + DBG_CTOR( VCLXPopupMenu, 0 ); ImplCreateMenu( TRUE ); } diff --git a/toolkit/source/awt/vclxtabcontrol.cxx b/toolkit/source/awt/vclxtabcontrol.cxx index a0f064f6de8b..0097c6a0a73a 100644 --- a/toolkit/source/awt/vclxtabcontrol.cxx +++ b/toolkit/source/awt/vclxtabcontrol.cxx @@ -239,7 +239,7 @@ void SAL_CALL VCLXTabControl::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::su ::Point aPos( nX, nY ); ::Size aSize = pTabPage->GetSizePixel(); - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( GetViewGraphics() ); + OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); aPos = pDev->PixelToLogic( aPos ); aSize = pDev->PixelToLogic( aSize ); diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 80937076a5ea..8cb7ed60f2a4 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -146,6 +146,27 @@ TOOLKIT_DLLPUBLIC WinBits ImplGetWinBits( sal_uInt32 nComponentAttribs, sal_uInt bMessBox = sal_True; } + bool bDecoratedWindow = false; + if ( bMessBox + || ( nCompType == WINDOW_DIALOG ) + || ( nCompType == WINDOW_MODELESSDIALOG ) + || ( nCompType == WINDOW_MODALDIALOG ) + || ( nCompType == WINDOW_SYSTEMDIALOG ) + || ( nCompType == WINDOW_PATHDIALOG ) + || ( nCompType == WINDOW_FILEDIALOG ) + || ( nCompType == WINDOW_PRINTERSETUPDIALOG ) + || ( nCompType == WINDOW_PRINTDIALOG ) + || ( nCompType == WINDOW_COLORDIALOG ) + || ( nCompType == WINDOW_FONTDIALOG ) + || ( nCompType == WINDOW_DOCKINGWINDOW ) + || ( nCompType == WINDOW_TABDIALOG ) + || ( nCompType == WINDOW_BUTTONDIALOG ) + || ( nCompType == WINDOW_SYSTEMCHILDWINDOW ) + ) + { + bDecoratedWindow = true; + } + if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::BORDER ) nWinBits |= WB_BORDER; if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::NOBORDER ) @@ -216,15 +237,18 @@ TOOLKIT_DLLPUBLIC WinBits ImplGetWinBits( sal_uInt32 nComponentAttribs, sal_uInt } - if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::NODECORATION ) + if ( bDecoratedWindow ) { - // No decoration removes several window attributes and must - // set WB_NOBODER! - nWinBits &= ~WB_BORDER; - nWinBits &= ~WB_SIZEABLE; - nWinBits &= ~WB_MOVEABLE; - nWinBits &= ~WB_CLOSEABLE; - nWinBits |= WB_NOBORDER; + if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::NODECORATION ) + { + // No decoration removes several window attributes and must + // set WB_NOBORDER! + nWinBits &= ~WB_BORDER; + nWinBits &= ~WB_SIZEABLE; + nWinBits &= ~WB_MOVEABLE; + nWinBits &= ~WB_CLOSEABLE; + nWinBits |= WB_NOBORDER; + } } return nWinBits; diff --git a/toolkit/source/awt/vclxtopwindow.cxx b/toolkit/source/awt/vclxtopwindow.cxx index 2495e046b3aa..907ccb797fd2 100644 --- a/toolkit/source/awt/vclxtopwindow.cxx +++ b/toolkit/source/awt/vclxtopwindow.cxx @@ -187,9 +187,9 @@ Window* VCLXTopWindow::GetWindowImpl() return VCLXContainer::GetWindow(); } -TopWindowListenerMultiplexer& VCLXTopWindow::GetTopWindowListenersImpl() +::cppu::OInterfaceContainerHelper& VCLXTopWindow::GetTopWindowListenersImpl() { - return VCLXContainer::GetTopWindowListeners(); + return GetTopWindowListeners(); } // ::com::sun::star::uno::XInterface diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index 89ac9799a64f..c767458f03ae 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/awt/EndPopupModeEvent.hpp> #include <com/sun/star/awt/XWindowListener2.hpp> #include <com/sun/star/style/VerticalAlignment.hpp> +#include <com/sun/star/text/WritingMode2.hpp> #include <toolkit/awt/vclxwindow.hxx> #include <toolkit/awt/vclxpointer.hxx> #include <toolkit/awt/vclxwindows.hxx> @@ -73,55 +74,66 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::lang::EventObject; using ::com::sun::star::awt::XWindowListener2; +using ::com::sun::star::awt::XDockableWindowListener; using ::com::sun::star::style::VerticalAlignment; using ::com::sun::star::style::VerticalAlignment_TOP; using ::com::sun::star::style::VerticalAlignment_MIDDLE; using ::com::sun::star::style::VerticalAlignment_BOTTOM; using ::com::sun::star::style::VerticalAlignment_MAKE_FIXED_SIZE; +namespace WritingMode2 = ::com::sun::star::text::WritingMode2; -//#define SYNCHRON_NOTIFICATION - // define this for notifying mouse events synchronously when they happen - // disadvantage: potential of deadlocks, since this means that the - // SolarMutex is locked when the listener is called - // See http://www.openoffice.org/issues/show_bug.cgi?id=40583 for an example - // deadlock -//#define THREADED_NOTIFICATION - // define this for notifying mouse events asynchronously, in a dedicated thread - // This is what I'd like to use. However, there's some Windows API code - // which doesn't like being called in the non-main thread, and we didn't - // find out which one :( - // See http://www.openoffice.org/issues/show_bug.cgi?id=47502 for an example - // of a bug triggered by asynchronous notification in a foreign thread - -// If none of the above is defined, then mouse events are notified asynchronously -// in the main thread, using PostUserEvent. -// disadvantage: The event we're posting is delayed until the next event -// reschedule. Normally, this is virtually immediately, but there's no guarantee -// .... //==================================================================== -//= VCLXWindowImpl +//= misc helpers //==================================================================== namespace { + //................................................................ + //. FlagGuard + //................................................................ + class FlagGuard + { + private: + bool& m_rFlag; + + public: + FlagGuard( bool& _rFlag ) + :m_rFlag( _rFlag ) + { + m_rFlag = true; + } + ~FlagGuard() + { + m_rFlag = false; + } + }; + + //................................................................ + //. MouseEventType + //................................................................ enum MouseEventType { + META_FIRST_MOUSE_EVENT = 0, + EVENT_MOUSE_PRESSED = 0, EVENT_MOUSE_RELEASED = 1, EVENT_MOUSE_ENTERED = 2, EVENT_MOUSE_EXITED = 3, - META_FIRST_MOUSE_EVENT = 0, META_LAST_MOUSE_EVENT = 3 }; + //................................................................ + //. PlainEventType + //................................................................ enum PlainEventType { + META_FIRST_PLAIN_EVENT = 4, + EVENT_WINDOW_ENABLED = 4, EVENT_WINDOW_DISABLED = 5, - META_FIRST_PLAIN_EVENT = 4, META_LAST_PLAIN_EVENT = 5 }; @@ -135,6 +147,9 @@ namespace #define DBG_CHECK_EVENTS() #endif + //................................................................ + //. AnyWindowEvent + //................................................................ struct AnyWindowEvent : public ::comphelper::AnyEvent { private: @@ -196,6 +211,9 @@ namespace }; } +//==================================================================== +//= VCLXWindowImpl +//==================================================================== class SAL_DLLPRIVATE VCLXWindowImpl : public ::comphelper::IEventProcessor { private: @@ -203,23 +221,49 @@ private: EventArray; private: - oslInterlockedCount m_refCount; VCLXWindow& mrAntiImpl; ::vos::IMutex& mrMutex; ::toolkit::AccessibilityClient maAccFactory; bool mbDisposed; + bool mbDrawingOntoParent; // no bit mask, is passed around by reference + ::osl::Mutex maListenerContainerMutex; ::cppu::OInterfaceContainerHelper maWindow2Listeners; + ::cppu::OInterfaceContainerHelper maDockableWindowListeners; + EventListenerMultiplexer maEventListeners; + FocusListenerMultiplexer maFocusListeners; + WindowListenerMultiplexer maWindowListeners; + KeyListenerMultiplexer maKeyListeners; + MouseListenerMultiplexer maMouseListeners; + MouseMotionListenerMultiplexer maMouseMotionListeners; + PaintListenerMultiplexer maPaintListeners; + VclContainerListenerMultiplexer maContainerListeners; + TopWindowListenerMultiplexer maTopWindowListeners; -#ifdef THREADED_NOTIFICATION - ::rtl::Reference< ::comphelper::AsyncEventNotifier > - mpAsyncNotifier; -#else -#if !defined( SYNCHRON_NOTIFICATION ) EventArray maEvents; ULONG mnEventId; -#endif -#endif + +public: + bool mbDisposing : 1; + bool mbDesignMode : 1; + bool mbSynthesizingVCLEvent : 1; + bool mbWithDefaultProps : 1; + + ULONG mnListenerLockLevel; + sal_Int16 mnWritingMode; + sal_Int16 mnContextWritingMode; + + UnoPropertyArrayHelper* mpPropHelper; + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer > + mxPointer; + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + mxAccessibleContext; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > + mxViewGraphics; + +public: + bool& getDrawingOntoParent_ref() { return mbDrawingOntoParent; } public: /** ctor @@ -227,7 +271,7 @@ public: the <type>VCLXWindow</type> instance which the object belongs to. Must live longer then the object just being constructed. */ - VCLXWindowImpl( VCLXWindow& _rAntiImpl, ::vos::IMutex& _rMutex ); + VCLXWindowImpl( VCLXWindow& _rAntiImpl, ::vos::IMutex& _rMutex, bool _bWithDefaultProps ); /** asynchronously notifies a mouse event to the VCLXWindow's XMouseListeners */ @@ -248,33 +292,37 @@ public: /** returns the container of registered XWindowListener2 listeners */ - inline ::cppu::OInterfaceContainerHelper& - getWindow2Listeners() { return maWindow2Listeners; } + inline ::cppu::OInterfaceContainerHelper& getWindow2Listeners() { return maWindow2Listeners; } + inline ::cppu::OInterfaceContainerHelper& getDockableWindowListeners(){ return maDockableWindowListeners; } + inline EventListenerMultiplexer& getEventListeners() { return maEventListeners; } + inline FocusListenerMultiplexer& getFocusListeners() { return maFocusListeners; } + inline WindowListenerMultiplexer& getWindowListeners() { return maWindowListeners; } + inline KeyListenerMultiplexer& getKeyListeners() { return maKeyListeners; } + inline MouseListenerMultiplexer& getMouseListeners() { return maMouseListeners; } + inline MouseMotionListenerMultiplexer& getMouseMotionListeners() { return maMouseMotionListeners; } + inline PaintListenerMultiplexer& getPaintListeners() { return maPaintListeners; } + inline VclContainerListenerMultiplexer& getContainerListeners() { return maContainerListeners; } + inline TopWindowListenerMultiplexer& getTopWindowListeners() { return maTopWindowListeners; } - virtual void SAL_CALL acquire(); - virtual void SAL_CALL release(); + virtual ~VCLXWindowImpl(); protected: - virtual ~VCLXWindowImpl(); + virtual void SAL_CALL acquire(); + virtual void SAL_CALL release(); // IEventProcessor virtual void processEvent( const ::comphelper::AnyEvent& _rEvent ); -#if !defined( SYNCHRON_NOTIFICATION ) && !defined( THREADED_NOTIFICATION ) private: DECL_LINK( OnProcessEvent, void* ); -#endif private: /** notifies an arbitrary event @param _rEvent the event to notify - @param _rGuard - a guard currentl guarding our mutex, which is released for the actual notification */ void impl_notifyAnyEvent( - const ::rtl::Reference< ::comphelper::AnyEvent >& _rEvent, - ::vos::OClearableGuard& _rGuard + const ::rtl::Reference< ::comphelper::AnyEvent >& _rEvent ); private: @@ -294,81 +342,78 @@ private: }; //-------------------------------------------------------------------- -VCLXWindowImpl::VCLXWindowImpl( VCLXWindow& _rAntiImpl, ::vos::IMutex& _rMutex ) - :m_refCount( 0 ) - ,mrAntiImpl( _rAntiImpl ) +VCLXWindowImpl::VCLXWindowImpl( VCLXWindow& _rAntiImpl, ::vos::IMutex& _rMutex, bool _bWithDefaultProps ) + :mrAntiImpl( _rAntiImpl ) ,mrMutex( _rMutex ) ,mbDisposed( false ) + ,mbDrawingOntoParent( false ) ,maListenerContainerMutex( ) ,maWindow2Listeners( maListenerContainerMutex ) -#ifdef THREADED_NOTIFICATION - ,mpAsyncNotifier( NULL ) -#else -#ifndef SYNCHRON_NOTIFICATION + ,maDockableWindowListeners( maListenerContainerMutex ) + ,maEventListeners( _rAntiImpl ) + ,maFocusListeners( _rAntiImpl ) + ,maWindowListeners( _rAntiImpl ) + ,maKeyListeners( _rAntiImpl ) + ,maMouseListeners( _rAntiImpl ) + ,maMouseMotionListeners( _rAntiImpl ) + ,maPaintListeners( _rAntiImpl ) + ,maContainerListeners( _rAntiImpl ) + ,maTopWindowListeners( _rAntiImpl ) ,mnEventId( 0 ) -#endif -#endif + ,mbDisposing( false ) + ,mbDesignMode( false ) + ,mbSynthesizingVCLEvent( false ) + ,mbWithDefaultProps( _bWithDefaultProps ) + ,mnListenerLockLevel( 0 ) + ,mnWritingMode( WritingMode2::CONTEXT ) + ,mnContextWritingMode( WritingMode2::CONTEXT ) + ,mpPropHelper( NULL ) { } VCLXWindowImpl::~VCLXWindowImpl() { + delete mpPropHelper; } //-------------------------------------------------------------------- void VCLXWindowImpl::disposing() { ::vos::OGuard aGuard( mrMutex ); -#ifdef THREADED_NOTIFICATION - if ( mpAsyncNotifier.is() ) - { - mpAsyncNotifier->removeEventsForProcessor( this ); - mpAsyncNotifier->dispose(); - mpAsyncNotifier = NULL; - } -#else -#ifndef SYNCHRON_NOTIFICATION if ( mnEventId ) Application::RemoveUserEvent( mnEventId ); mnEventId = 0; -#endif -#endif mbDisposed= true; + + ::com::sun::star::lang::EventObject aEvent; + aEvent.Source = mrAntiImpl; + + maEventListeners.disposeAndClear( aEvent ); + maFocusListeners.disposeAndClear( aEvent ); + maWindowListeners.disposeAndClear( aEvent ); + maKeyListeners.disposeAndClear( aEvent ); + maMouseListeners.disposeAndClear( aEvent ); + maMouseMotionListeners.disposeAndClear( aEvent ); + maPaintListeners.disposeAndClear( aEvent ); + maContainerListeners.disposeAndClear( aEvent ); + maTopWindowListeners.disposeAndClear( aEvent ); + } //-------------------------------------------------------------------- -void VCLXWindowImpl::impl_notifyAnyEvent( const ::rtl::Reference< ::comphelper::AnyEvent >& _rEvent, ::vos::OClearableGuard& _rGuard ) +void VCLXWindowImpl::impl_notifyAnyEvent( const ::rtl::Reference< ::comphelper::AnyEvent >& _rEvent ) { -#ifdef THREADED_NOTIFICATION - (void)_rGuard; - if ( !mpAsyncNotifier.is() ) - { - mpAsyncNotifier = new ::comphelper::AsyncEventNotifier; - mpAsyncNotifier->create(); - } - mpAsyncNotifier->addEvent( _rEvent, this ); - -#else // #ifdef THREADED_NOTIFICATION - -#ifdef SYNCHRON_NOTIFICATION - _rGuard.clear(); - processEvent( *_rEvent ); -#else // #ifdef SYNCHRON_NOTIFICATION - (void)_rGuard; maEvents.push_back( _rEvent ); if ( !mnEventId ) mnEventId = Application::PostUserEvent( LINK( this, VCLXWindowImpl, OnProcessEvent ) ); -#endif // #ifdef SYNCHRON_NOTIFICATION - -#endif // // #ifdef THREADED_NOTIFICATION } //-------------------------------------------------------------------- void VCLXWindowImpl::notifyMouseEvent( const awt::MouseEvent& _rMouseEvent, MouseEventType _nType ) { ::vos::OClearableGuard aGuard( mrMutex ); - if ( mrAntiImpl.GetMouseListeners().getLength() ) - impl_notifyAnyEvent( new AnyWindowEvent( _rMouseEvent, _nType ), aGuard ); + if ( maMouseListeners.getLength() ) + impl_notifyAnyEvent( new AnyWindowEvent( _rMouseEvent, _nType ) ); } //-------------------------------------------------------------------- @@ -376,10 +421,9 @@ void VCLXWindowImpl::notifyPlainEvent( const lang::EventObject& _rPlainEvent, Pl { ::vos::OClearableGuard aGuard( mrMutex ); if ( maWindow2Listeners.getLength() ) - impl_notifyAnyEvent( new AnyWindowEvent( _rPlainEvent, _nType ), aGuard ); + impl_notifyAnyEvent( new AnyWindowEvent( _rPlainEvent, _nType ) ); } -#if !defined( SYNCHRON_NOTIFICATION ) && !defined( THREADED_NOTIFICATION ) //-------------------------------------------------------------------- IMPL_LINK( VCLXWindowImpl, OnProcessEvent, void*, EMPTYARG ) { @@ -410,7 +454,6 @@ IMPL_LINK( VCLXWindowImpl, OnProcessEvent, void*, EMPTYARG ) return 0L; } -#endif //-------------------------------------------------------------------- void VCLXWindowImpl::processEvent( const ::comphelper::AnyEvent& _rEvent ) @@ -427,16 +470,16 @@ void VCLXWindowImpl::processEvent( const ::comphelper::AnyEvent& _rEvent ) switch ( rEventDescriptor.getMouseEventType() ) { case EVENT_MOUSE_PRESSED: - mrAntiImpl.GetMouseListeners().mousePressed( rEvent ); + maMouseListeners.mousePressed( rEvent ); break; case EVENT_MOUSE_RELEASED: - mrAntiImpl.GetMouseListeners().mouseReleased( rEvent ); + maMouseListeners.mouseReleased( rEvent ); break; case EVENT_MOUSE_ENTERED: - mrAntiImpl.GetMouseListeners().mouseEntered( rEvent ); + maMouseListeners.mouseEntered( rEvent ); break; case EVENT_MOUSE_EXITED: - mrAntiImpl.GetMouseListeners().mouseExited( rEvent ); + maMouseListeners.mouseExited( rEvent ); break; default: DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (1)?" ); @@ -468,14 +511,13 @@ void VCLXWindowImpl::processEvent( const ::comphelper::AnyEvent& _rEvent ) //-------------------------------------------------------------------- void SAL_CALL VCLXWindowImpl::acquire() { - osl_incrementInterlockedCount( &m_refCount ); + mrAntiImpl.acquire(); } //-------------------------------------------------------------------- void SAL_CALL VCLXWindowImpl::release() { - if ( 0 == osl_decrementInterlockedCount( &m_refCount ) ) - delete this; + mrAntiImpl.release(); } //==================================================================== @@ -543,40 +585,19 @@ void ImplInitMouseEvent( awt::MouseEvent& rEvent, const MouseEvent& rEvt ) DBG_NAME(VCLXWindow); -VCLXWindow::VCLXWindow( bool bWithDefaultProps ) - : maEventListeners( *this ), - maFocusListeners( *this ), - maWindowListeners( *this ), - maKeyListeners( *this ), - maMouseListeners( *this ), - maMouseMotionListeners( *this ), - maPaintListeners( *this ), - maContainerListeners( *this ), - maTopWindowListeners( *this ), - mnListenerLockLevel( 0 ), - mpImpl( NULL ), - mpPropHelper( NULL ), - mbDisposing( false ), - mbDesignMode( false ), - mbSynthesizingVCLEvent( false ), - mbWithDefaultProps( !!bWithDefaultProps ), - mbDrawingOntoParent( false ) +VCLXWindow::VCLXWindow( bool _bWithDefaultProps ) + :mpImpl( NULL ) { DBG_CTOR( VCLXWindow, 0 ); - mpImpl = new VCLXWindowImpl( *this, GetMutex() ); - mpImpl->acquire(); - - mbDisposing = sal_False; - mbDesignMode = sal_False; - mbSynthesizingVCLEvent = sal_False; + mpImpl = new VCLXWindowImpl( *this, GetMutex(), _bWithDefaultProps ); } VCLXWindow::~VCLXWindow() { DBG_DTOR( VCLXWindow, 0 ); - delete mpPropHelper; + delete mpImpl; if ( GetWindow() ) { @@ -607,18 +628,29 @@ void VCLXWindow::SetWindow( Window* pWindow ) void VCLXWindow::suspendVclEventListening( ) { - ++mnListenerLockLevel; + ++mpImpl->mnListenerLockLevel; } void VCLXWindow::resumeVclEventListening( ) { - DBG_ASSERT( mnListenerLockLevel, "VCLXWindow::resumeVclEventListening: not suspended!" ); - --mnListenerLockLevel; + DBG_ASSERT( mpImpl->mnListenerLockLevel, "VCLXWindow::resumeVclEventListening: not suspended!" ); + --mpImpl->mnListenerLockLevel; +} + +void VCLXWindow::notifyWindowRemoved( Window& _rWindow ) +{ + if ( mpImpl->getContainerListeners().getLength() ) + { + awt::VclContainerEvent aEvent; + aEvent.Source = *this; + aEvent.Child = static_cast< XWindow* >( _rWindow.GetWindowPeer() ); + mpImpl->getContainerListeners().windowRemoved( aEvent ); + } } IMPL_LINK( VCLXWindow, WindowEventListener, VclSimpleEvent*, pEvent ) { - if ( mnListenerLockLevel ) + if ( mpImpl->mnListenerLockLevel ) return 0L; DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" ); @@ -648,109 +680,109 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) case VCLEVENT_WINDOW_PAINT: { - if ( GetPaintListeners().getLength() ) + if ( mpImpl->getPaintListeners().getLength() ) { ::com::sun::star::awt::PaintEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; aEvent.UpdateRect = AWTRectangle( *(Rectangle*)rVclWindowEvent.GetData() ); aEvent.Count = 0; - GetPaintListeners().windowPaint( aEvent ); + mpImpl->getPaintListeners().windowPaint( aEvent ); } } break; case VCLEVENT_WINDOW_MOVE: { - if ( GetWindowListeners().getLength() ) + if ( mpImpl->getWindowListeners().getLength() ) { ::com::sun::star::awt::WindowEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() ); - GetWindowListeners().windowMoved( aEvent ); + mpImpl->getWindowListeners().windowMoved( aEvent ); } } break; case VCLEVENT_WINDOW_RESIZE: { - if ( GetWindowListeners().getLength() ) + if ( mpImpl->getWindowListeners().getLength() ) { ::com::sun::star::awt::WindowEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() ); - GetWindowListeners().windowResized( aEvent ); + mpImpl->getWindowListeners().windowResized( aEvent ); } } break; case VCLEVENT_WINDOW_SHOW: { - if ( GetWindowListeners().getLength() ) + if ( mpImpl->getWindowListeners().getLength() ) { ::com::sun::star::awt::WindowEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() ); - GetWindowListeners().windowShown( aEvent ); + mpImpl->getWindowListeners().windowShown( aEvent ); } // For TopWindows this means opened... - if ( GetTopWindowListeners().getLength() ) + if ( mpImpl->getTopWindowListeners().getLength() ) { ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - GetTopWindowListeners().windowOpened( aEvent ); + mpImpl->getTopWindowListeners().windowOpened( aEvent ); } } break; case VCLEVENT_WINDOW_HIDE: { - if ( GetWindowListeners().getLength() ) + if ( mpImpl->getWindowListeners().getLength() ) { ::com::sun::star::awt::WindowEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() ); - GetWindowListeners().windowHidden( aEvent ); + mpImpl->getWindowListeners().windowHidden( aEvent ); } // For TopWindows this means closed... - if ( GetTopWindowListeners().getLength() ) + if ( mpImpl->getTopWindowListeners().getLength() ) { ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - GetTopWindowListeners().windowClosed( aEvent ); + mpImpl->getTopWindowListeners().windowClosed( aEvent ); } } break; case VCLEVENT_WINDOW_ACTIVATE: { - if ( GetTopWindowListeners().getLength() ) + if ( mpImpl->getTopWindowListeners().getLength() ) { ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - GetTopWindowListeners().windowActivated( aEvent ); + mpImpl->getTopWindowListeners().windowActivated( aEvent ); } } break; case VCLEVENT_WINDOW_DEACTIVATE: { - if ( GetTopWindowListeners().getLength() ) + if ( mpImpl->getTopWindowListeners().getLength() ) { ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - GetTopWindowListeners().windowDeactivated( aEvent ); + mpImpl->getTopWindowListeners().windowDeactivated( aEvent ); } } break; case VCLEVENT_WINDOW_CLOSE: { - if ( mxDockableWindowListener.is() ) + if ( mpImpl->getDockableWindowListeners().getLength() ) { ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - mxDockableWindowListener->closed( aEvent ); + mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::closed, aEvent ); } - if ( GetTopWindowListeners().getLength() ) + if ( mpImpl->getTopWindowListeners().getLength() ) { ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - GetTopWindowListeners().windowClosing( aEvent ); + mpImpl->getTopWindowListeners().windowClosing( aEvent ); } } break; @@ -765,13 +797,13 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) ) ) { - if ( GetFocusListeners().getLength() ) + if ( mpImpl->getFocusListeners().getLength() ) { ::com::sun::star::awt::FocusEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; aEvent.FocusFlags = rVclWindowEvent.GetWindow()->GetGetFocusFlags(); aEvent.Temporary = sal_False; - GetFocusListeners().focusGained( aEvent ); + mpImpl->getFocusListeners().focusGained( aEvent ); } } } @@ -787,7 +819,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) ) ) { - if ( GetFocusListeners().getLength() ) + if ( mpImpl->getFocusListeners().getLength() ) { ::com::sun::star::awt::FocusEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; @@ -807,57 +839,57 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) pNext->GetComponentInterface( sal_True ); aEvent.NextFocus = (::cppu::OWeakObject*)pNext->GetWindowPeer(); } - GetFocusListeners().focusLost( aEvent ); + mpImpl->getFocusListeners().focusLost( aEvent ); } } } break; case VCLEVENT_WINDOW_MINIMIZE: { - if ( GetTopWindowListeners().getLength() ) + if ( mpImpl->getTopWindowListeners().getLength() ) { ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - GetTopWindowListeners().windowMinimized( aEvent ); + mpImpl->getTopWindowListeners().windowMinimized( aEvent ); } } break; case VCLEVENT_WINDOW_NORMALIZE: { - if ( GetTopWindowListeners().getLength() ) + if ( mpImpl->getTopWindowListeners().getLength() ) { ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - GetTopWindowListeners().windowNormalized( aEvent ); + mpImpl->getTopWindowListeners().windowNormalized( aEvent ); } } break; case VCLEVENT_WINDOW_KEYINPUT: { - if ( GetKeyListeners().getLength() ) + if ( mpImpl->getKeyListeners().getLength() ) { ::com::sun::star::awt::KeyEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; ImplInitKeyEvent( aEvent, *(KeyEvent*)rVclWindowEvent.GetData() ); - GetKeyListeners().keyPressed( aEvent ); + mpImpl->getKeyListeners().keyPressed( aEvent ); } } break; case VCLEVENT_WINDOW_KEYUP: { - if ( GetKeyListeners().getLength() ) + if ( mpImpl->getKeyListeners().getLength() ) { ::com::sun::star::awt::KeyEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; ImplInitKeyEvent( aEvent, *(KeyEvent*)rVclWindowEvent.GetData() ); - GetKeyListeners().keyReleased( aEvent ); + mpImpl->getKeyListeners().keyReleased( aEvent ); } } break; case VCLEVENT_WINDOW_COMMAND: { CommandEvent* pCmdEvt = (CommandEvent*)rVclWindowEvent.GetData(); - if ( GetMouseListeners().getLength() && ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU ) ) + if ( mpImpl->getMouseListeners().getLength() && ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU ) ) { // COMMAND_CONTEXTMENU als mousePressed mit PopupTrigger = sal_True versenden... Point aWhere = static_cast< CommandEvent* >( rVclWindowEvent.GetData() )->GetMousePosPixel(); @@ -882,7 +914,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) case VCLEVENT_WINDOW_MOUSEMOVE: { MouseEvent* pMouseEvt = (MouseEvent*)rVclWindowEvent.GetData(); - if ( GetMouseListeners().getLength() && ( pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow() ) ) + if ( mpImpl->getMouseListeners().getLength() && ( pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow() ) ) { awt::MouseEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; @@ -894,7 +926,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) ); } - if ( GetMouseMotionListeners().getLength() && !pMouseEvt->IsEnterWindow() && !pMouseEvt->IsLeaveWindow() ) + if ( mpImpl->getMouseMotionListeners().getLength() && !pMouseEvt->IsEnterWindow() && !pMouseEvt->IsLeaveWindow() ) { awt::MouseEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; @@ -902,15 +934,15 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) aEvent.ClickCount = 0; // #92138# if ( pMouseEvt->GetMode() & MOUSE_SIMPLEMOVE ) - GetMouseMotionListeners().mouseMoved( aEvent ); + mpImpl->getMouseMotionListeners().mouseMoved( aEvent ); else - GetMouseMotionListeners().mouseDragged( aEvent ); + mpImpl->getMouseMotionListeners().mouseDragged( aEvent ); } } break; case VCLEVENT_WINDOW_MOUSEBUTTONDOWN: { - if ( GetMouseListeners().getLength() ) + if ( mpImpl->getMouseListeners().getLength() ) { awt::MouseEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; @@ -921,7 +953,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) break; case VCLEVENT_WINDOW_MOUSEBUTTONUP: { - if ( GetMouseListeners().getLength() ) + if ( mpImpl->getMouseListeners().getLength() ) { awt::MouseEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; @@ -932,7 +964,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) break; case VCLEVENT_WINDOW_STARTDOCKING: { - if ( mxDockableWindowListener.is() ) + if ( mpImpl->getDockableWindowListeners().getLength() ) { DockingData *pData = (DockingData*)rVclWindowEvent.GetData(); @@ -946,14 +978,14 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) aEvent.bLiveMode = pData->mbLivemode; aEvent.bInteractive = pData->mbInteractive; - mxDockableWindowListener->startDocking( aEvent ); + mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::startDocking, aEvent ); } } } break; case VCLEVENT_WINDOW_DOCKING: { - if ( mxDockableWindowListener.is() ) + if ( mpImpl->getDockableWindowListeners().getLength() ) { DockingData *pData = (DockingData*)rVclWindowEvent.GetData(); @@ -966,8 +998,16 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) aEvent.MousePos.Y = pData->maMousePos.Y(); aEvent.bLiveMode = pData->mbLivemode; aEvent.bInteractive = pData->mbInteractive; + + Reference< XDockableWindowListener > xFirstListener; + ::cppu::OInterfaceIteratorHelper aIter( mpImpl->getDockableWindowListeners() ); + while ( aIter.hasMoreElements() && !xFirstListener.is() ) + { + xFirstListener.set( aIter.next(), UNO_QUERY ); + } + ::com::sun::star::awt::DockingData aDockingData = - mxDockableWindowListener->docking( aEvent ); + xFirstListener->docking( aEvent ); pData->maTrackRect = VCLRectangle( aDockingData.TrackingRectangle ); pData->mbFloating = aDockingData.bFloating; } @@ -976,7 +1016,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) break; case VCLEVENT_WINDOW_ENDDOCKING: { - if ( mxDockableWindowListener.is() ) + if ( mpImpl->getDockableWindowListeners().getLength() ) { EndDockingData *pData = (EndDockingData*)rVclWindowEvent.GetData(); @@ -987,36 +1027,44 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) aEvent.WindowRectangle = AWTRectangle( pData->maWindowRect ); aEvent.bFloating = pData->mbFloating; aEvent.bCancelled = pData->mbCancelled; - mxDockableWindowListener->endDocking( aEvent ); + mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endDocking, aEvent ); } } } break; case VCLEVENT_WINDOW_PREPARETOGGLEFLOATING: { - if ( mxDockableWindowListener.is() ) + if ( mpImpl->getDockableWindowListeners().getLength() ) { BOOL *p_bFloating = (BOOL*)rVclWindowEvent.GetData(); ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - *p_bFloating = mxDockableWindowListener->prepareToggleFloatingMode( aEvent ); + + Reference< XDockableWindowListener > xFirstListener; + ::cppu::OInterfaceIteratorHelper aIter( mpImpl->getDockableWindowListeners() ); + while ( aIter.hasMoreElements() && !xFirstListener.is() ) + { + xFirstListener.set( aIter.next(), UNO_QUERY ); + } + + *p_bFloating = xFirstListener->prepareToggleFloatingMode( aEvent ); } } break; case VCLEVENT_WINDOW_TOGGLEFLOATING: { - if ( mxDockableWindowListener.is() ) + if ( mpImpl->getDockableWindowListeners().getLength() ) { ::com::sun::star::lang::EventObject aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - mxDockableWindowListener->toggleFloatingMode( aEvent ); + mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::toggleFloatingMode, aEvent ); } - } + } break; case VCLEVENT_WINDOW_ENDPOPUPMODE: { - if ( mxDockableWindowListener.is() ) + if ( mpImpl->getDockableWindowListeners().getLength() ) { EndPopupModeData *pData = (EndPopupModeData*)rVclWindowEvent.GetData(); @@ -1027,7 +1075,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) aEvent.FloatingPosition.X = pData->maFloatingPos.X(); aEvent.FloatingPosition.Y = pData->maFloatingPos.Y(); aEvent.bTearoff = pData->mbTearoff; - mxDockableWindowListener->endPopupMode( aEvent ); + mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endPopupMode, aEvent ); } } } @@ -1042,11 +1090,15 @@ uno::Reference< accessibility::XAccessibleContext > VCLXWindow::CreateAccessible return getAccessibleFactory().createAccessibleContext( this ); } -/* -void VCLXWindow::FillAccessibleStateSet( AccessibleStateSetHelper& rStateSet ) +void VCLXWindow::SetSynthesizingVCLEvent( sal_Bool _b ) { + mpImpl->mbSynthesizingVCLEvent = _b; +} + +BOOL VCLXWindow::IsSynthesizingVCLEvent() const +{ + return mpImpl->mbSynthesizingVCLEvent; } -*/ Size VCLXWindow::ImplCalcWindowSize( const Size& rOutSz ) const { @@ -1064,74 +1116,21 @@ Size VCLXWindow::ImplCalcWindowSize( const Size& rOutSz ) const } -// ::com::sun::star::uno::XInterface -::com::sun::star::uno::Any VCLXWindow::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) -{ - ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, - SAL_STATIC_CAST( ::com::sun::star::lang::XComponent*, (::com::sun::star::awt::XWindow*)this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XWindow*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XWindowPeer*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XVclWindowPeer*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XLayoutConstrains*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XView*, this ), - SAL_STATIC_CAST( ::com::sun::star::accessibility::XAccessible*, this ), - SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, this ), - SAL_STATIC_CAST( ::com::sun::star::beans::XPropertySetInfo*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XWindow2*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XDockableWindow*, this ) ); - return (aRet.hasValue() ? aRet : VCLXDevice::queryInterface( rType )); -} - // ::com::sun::star::lang::XUnoTunnel IMPL_XUNOTUNNEL2( VCLXWindow, VCLXDevice ) -// ::com::sun::star::lang::XTypeProvider -IMPL_XTYPEPROVIDER_START( VCLXWindow ) - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindow>* ) NULL ), - VCLXDevice::getTypes() -IMPL_XTYPEPROVIDER_END - - // ::com::sun::star::lang::Component void VCLXWindow::dispose( ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); - mxViewGraphics = NULL; + mpImpl->mxViewGraphics = NULL; - if ( !mbDisposing ) + if ( !mpImpl->mbDisposing ) { - mbDisposing = sal_True; + mpImpl->mbDisposing = true; - ::com::sun::star::lang::EventObject aObj; - aObj.Source = static_cast< ::cppu::OWeakObject* >( this ); - - maEventListeners.disposeAndClear( aObj ); - maFocusListeners.disposeAndClear( aObj ); - maWindowListeners.disposeAndClear( aObj ); - maKeyListeners.disposeAndClear( aObj ); - maMouseListeners.disposeAndClear( aObj ); - maMouseMotionListeners.disposeAndClear( aObj ); - maPaintListeners.disposeAndClear( aObj ); - maContainerListeners.disposeAndClear( aObj ); - maTopWindowListeners.disposeAndClear( aObj ); - - if ( mpImpl ) - { - mpImpl->disposing(); - mpImpl->release(); - mpImpl = NULL; - } + mpImpl->disposing(); if ( GetWindow() ) { @@ -1146,7 +1145,7 @@ void VCLXWindow::dispose( ) throw(::com::sun::star::uno::RuntimeException) // for VCLEVENT_WINDOW_CHILDDESTROYED contains a reference to an already disposed accessible object try { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComponent( mxAccessibleContext, ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComponent( mpImpl->mxAccessibleContext, ::com::sun::star::uno::UNO_QUERY ); if ( xComponent.is() ) xComponent->dispose(); } @@ -1154,9 +1153,9 @@ void VCLXWindow::dispose( ) throw(::com::sun::star::uno::RuntimeException) { DBG_ERROR( "VCLXWindow::dispose: could not dispose the accessible context!" ); } - mxAccessibleContext.clear(); + mpImpl->mxAccessibleContext.clear(); - mbDisposing = sal_False; + mpImpl->mbDisposing = false; } } @@ -1164,14 +1163,14 @@ void VCLXWindow::addEventListener( const ::com::sun::star::uno::Reference< ::com { ::vos::OGuard aGuard( GetMutex() ); - GetEventListeners().addInterface( rxListener ); + mpImpl->getEventListeners().addInterface( rxListener ); } void VCLXWindow::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); - GetEventListeners().removeInterface( rxListener ); + mpImpl->getEventListeners().removeInterface( rxListener ); } @@ -1253,7 +1252,7 @@ void VCLXWindow::addWindowListener( const ::com::sun::star::uno::Reference< ::co { ::vos::OGuard aGuard( GetMutex() ); - GetWindowListeners().addInterface( rxListener ); + mpImpl->getWindowListeners().addInterface( rxListener ); Reference< XWindowListener2 > xListener2( rxListener, UNO_QUERY ); if ( xListener2.is() ) @@ -1272,77 +1271,67 @@ void VCLXWindow::removeWindowListener( const ::com::sun::star::uno::Reference< : if ( xListener2.is() ) mpImpl->getWindow2Listeners().removeInterface( xListener2 ); - GetWindowListeners().removeInterface( rxListener ); + mpImpl->getWindowListeners().removeInterface( rxListener ); } void VCLXWindow::addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); - - GetFocusListeners().addInterface( rxListener ); + mpImpl->getFocusListeners().addInterface( rxListener ); } void VCLXWindow::removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); - - GetFocusListeners().removeInterface( rxListener ); + mpImpl->getFocusListeners().removeInterface( rxListener ); } void VCLXWindow::addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); - - GetKeyListeners().addInterface( rxListener ); + mpImpl->getKeyListeners().addInterface( rxListener ); } void VCLXWindow::removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); - - GetKeyListeners().removeInterface( rxListener ); + mpImpl->getKeyListeners().removeInterface( rxListener ); } void VCLXWindow::addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); - - GetMouseListeners().addInterface( rxListener ); + mpImpl->getMouseListeners().addInterface( rxListener ); } void VCLXWindow::removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); - - GetMouseListeners().removeInterface( rxListener ); + mpImpl->getMouseListeners().removeInterface( rxListener ); } void VCLXWindow::addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); - - GetMouseMotionListeners().addInterface( rxListener ); + mpImpl->getMouseMotionListeners().addInterface( rxListener ); } void VCLXWindow::removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); - - GetMouseMotionListeners().removeInterface( rxListener ); + mpImpl->getMouseMotionListeners().removeInterface( rxListener ); } void VCLXWindow::addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); - - GetPaintListeners().addInterface( rxListener ); + mpImpl->getPaintListeners().addInterface( rxListener ); } void VCLXWindow::removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); - - GetPaintListeners().removeInterface( rxListener ); + mpImpl->getPaintListeners().removeInterface( rxListener ); } // ::com::sun::star::awt::XWindowPeer @@ -1360,7 +1349,7 @@ void VCLXWindow::setPointer( const ::com::sun::star::uno::Reference< ::com::sun: VCLXPointer* pPointer = VCLXPointer::GetImplementation( rxPointer ); if ( pPointer ) { - mxPointer = rxPointer; + mpImpl->mxPointer = rxPointer; if ( GetWindow() ) GetWindow()->SetPointer( pPointer->GetPointer() ); } @@ -1423,14 +1412,13 @@ void VCLXWindow::setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::Runt { ::vos::OGuard aGuard( GetMutex() ); - mbDesignMode = bOn; + mpImpl->mbDesignMode = bOn; } sal_Bool VCLXWindow::isDesignMode( ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); - - return mbDesignMode; + return mpImpl->mbDesignMode; } void VCLXWindow::enableClipSiblings( sal_Bool bClip ) throw(::com::sun::star::uno::RuntimeException) @@ -1561,485 +1549,554 @@ void VCLXWindow::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds, bool bWithDe } } +void VCLXWindow::GetPropertyIds( std::list< sal_uInt16 >& _out_rIds ) +{ + return ImplGetPropertyIds( _out_rIds, mpImpl->mbWithDefaultProps ); +} + +::cppu::OInterfaceContainerHelper& VCLXWindow::GetContainerListeners() +{ + return mpImpl->getContainerListeners(); +} + +::cppu::OInterfaceContainerHelper& VCLXWindow::GetTopWindowListeners() +{ + return mpImpl->getTopWindowListeners(); +} + +namespace +{ + void lcl_updateWritingMode( Window& _rWindow, const sal_Int16 _nWritingMode, const sal_Int16 _nContextWritingMode ) + { + BOOL bEnableRTL = FALSE; + switch ( _nWritingMode ) + { + case WritingMode2::LR_TB: bEnableRTL = FALSE; break; + case WritingMode2::RL_TB: bEnableRTL = TRUE; break; + case WritingMode2::CONTEXT: + { + // consult our ContextWritingMode. If it has an explicit RTL/LTR value, then use + // it. If it doesn't (but is CONTEXT itself), then just ask the parent window of our + // own window for its RTL mode + switch ( _nContextWritingMode ) + { + case WritingMode2::LR_TB: bEnableRTL = FALSE; break; + case WritingMode2::RL_TB: bEnableRTL = TRUE; break; + case WritingMode2::CONTEXT: + { + const Window* pParent = _rWindow.GetParent(); + OSL_ENSURE( pParent, "lcl_updateWritingMode: cannot determine context's writing mode!" ); + if ( pParent ) + bEnableRTL = pParent->IsRTLEnabled(); + } + break; + } + } + break; + default: + OSL_ENSURE( false, "lcl_updateWritingMode: unsupported WritingMode!" ); + } // switch ( nWritingMode ) + + _rWindow.EnableRTL( bEnableRTL ); + } +} + void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); Window* pWindow = GetWindow(); - if ( pWindow ) + if ( !pWindow ) + return; + + sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; + + WindowType eWinType = pWindow->GetType(); + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) { - sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; + case BASEPROPERTY_CONTEXT_WRITING_MODE: + { + OSL_VERIFY( Value >>= mpImpl->mnContextWritingMode ); + if ( mpImpl->mnWritingMode == WritingMode2::CONTEXT ) + lcl_updateWritingMode( *pWindow, mpImpl->mnWritingMode, mpImpl->mnContextWritingMode ); + } + break; - WindowType eWinType = pWindow->GetType(); - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) + case BASEPROPERTY_WRITING_MODE: { - case BASEPROPERTY_WHEELWITHOUTFOCUS: + sal_Bool bProperType = ( Value >>= mpImpl->mnWritingMode ); + OSL_ENSURE( bProperType, "VCLXWindow::setProperty( 'WritingMode' ): illegal value type!" ); + if ( bProperType ) + lcl_updateWritingMode( *pWindow, mpImpl->mnWritingMode, mpImpl->mnContextWritingMode ); + } + break; + + case BASEPROPERTY_WHEELWITHOUTFOCUS: + { + sal_Bool bWheelOnHover( sal_True ); + if ( Value >>= bWheelOnHover ) { - sal_Bool bWheelOnHover( sal_True ); - if ( Value >>= bWheelOnHover ) - { - AllSettings aSettings = pWindow->GetSettings(); - MouseSettings aMouseSettings = aSettings.GetMouseSettings(); + AllSettings aSettings = pWindow->GetSettings(); + MouseSettings aMouseSettings = aSettings.GetMouseSettings(); - aMouseSettings.SetNoWheelActionWithoutFocus( !bWheelOnHover ); - aSettings.SetMouseSettings( aMouseSettings ); + aMouseSettings.SetNoWheelActionWithoutFocus( !bWheelOnHover ); + aSettings.SetMouseSettings( aMouseSettings ); - pWindow->SetSettings( aSettings, TRUE ); - } + pWindow->SetSettings( aSettings, TRUE ); } - break; + } + break; - case BASEPROPERTY_NATIVE_WIDGET_LOOK: - { - sal_Bool bEnable( sal_True ); - OSL_VERIFY( Value >>= bEnable ); - pWindow->EnableNativeWidget( bEnable ); - } - break; + case BASEPROPERTY_NATIVE_WIDGET_LOOK: + { + sal_Bool bEnable( sal_True ); + OSL_VERIFY( Value >>= bEnable ); + pWindow->EnableNativeWidget( bEnable ); + } + break; - case BASEPROPERTY_PLUGINPARENT: - { - // set parent handle - SetSystemParent_Impl( Value ); - } - break; + case BASEPROPERTY_PLUGINPARENT: + { + // set parent handle + SetSystemParent_Impl( Value ); + } + break; - case BASEPROPERTY_ENABLED: - { - sal_Bool b = sal_Bool(); - if ( Value >>= b ) - setEnable( b ); - } - break; - case BASEPROPERTY_TEXT: - case BASEPROPERTY_LABEL: - case BASEPROPERTY_TITLE: + case BASEPROPERTY_ENABLED: + { + sal_Bool b = sal_Bool(); + if ( Value >>= b ) + setEnable( b ); + } + break; + case BASEPROPERTY_TEXT: + case BASEPROPERTY_LABEL: + case BASEPROPERTY_TITLE: + { + ::rtl::OUString aText; + if ( Value >>= aText ) { - ::rtl::OUString aText; - if ( Value >>= aText ) + switch (eWinType) { - switch (eWinType) - { - case WINDOW_OKBUTTON: - case WINDOW_CANCELBUTTON: - case WINDOW_HELPBUTTON: - // Standard Button: overwrite only if not empty. - if (aText.getLength()) - pWindow->SetText( aText ); - break; - - default: + case WINDOW_OKBUTTON: + case WINDOW_CANCELBUTTON: + case WINDOW_HELPBUTTON: + // Standard Button: overwrite only if not empty. + if (aText.getLength()) pWindow->SetText( aText ); - break; - } + break; + + default: + pWindow->SetText( aText ); + break; } } - break; - case BASEPROPERTY_ACCESSIBLENAME: - { - ::rtl::OUString aText; - if ( Value >>= aText ) - pWindow->SetAccessibleName( aText ); - } - break; - case BASEPROPERTY_HELPURL: + } + break; + case BASEPROPERTY_ACCESSIBLENAME: + { + ::rtl::OUString aText; + if ( Value >>= aText ) + pWindow->SetAccessibleName( aText ); + } + break; + case BASEPROPERTY_HELPURL: + { + ::rtl::OUString aURL; + if ( Value >>= aURL ) { - ::rtl::OUString aURL; - if ( Value >>= aURL ) + String aHelpURL( aURL ); + String aPattern( RTL_CONSTASCII_USTRINGPARAM( "HID:" ) ); + if ( aHelpURL.CompareIgnoreCaseToAscii( aPattern, aPattern.Len() ) == COMPARE_EQUAL ) { - String aHelpURL( aURL ); - String aPattern( RTL_CONSTASCII_USTRINGPARAM( "HID:" ) ); - if ( aHelpURL.CompareIgnoreCaseToAscii( aPattern, aPattern.Len() ) == COMPARE_EQUAL ) - { - String aID = aHelpURL.Copy( aPattern.Len() ); - pWindow->SetHelpId( aID.ToInt32() ); - } - else - { - pWindow->SetSmartHelpId( SmartId( aHelpURL ) ); - } + String aID = aHelpURL.Copy( aPattern.Len() ); + pWindow->SetHelpId( aID.ToInt32() ); } - } - break; - case BASEPROPERTY_HELPTEXT: - { - ::rtl::OUString aHelpText; - if ( Value >>= aHelpText ) + else { - pWindow->SetQuickHelpText( aHelpText ); + pWindow->SetSmartHelpId( SmartId( aHelpURL ) ); } } - break; - case BASEPROPERTY_FONTDESCRIPTOR: + } + break; + case BASEPROPERTY_HELPTEXT: + { + ::rtl::OUString aHelpText; + if ( Value >>= aHelpText ) { - if ( bVoid ) - pWindow->SetControlFont( Font() ); - else - { - ::com::sun::star::awt::FontDescriptor aFont; - if ( Value >>= aFont ) - pWindow->SetControlFont( VCLUnoHelper::CreateFont( aFont, pWindow->GetControlFont() ) ); - } + pWindow->SetQuickHelpText( aHelpText ); } - break; - case BASEPROPERTY_FONTRELIEF: + } + break; + case BASEPROPERTY_FONTDESCRIPTOR: + { + if ( bVoid ) + pWindow->SetControlFont( Font() ); + else { - sal_Int16 n = sal_Int16(); - if ( Value >>= n ) - { - Font aFont = pWindow->GetControlFont(); - aFont.SetRelief( (FontRelief)n ); - pWindow->SetControlFont( aFont ); - } + ::com::sun::star::awt::FontDescriptor aFont; + if ( Value >>= aFont ) + pWindow->SetControlFont( VCLUnoHelper::CreateFont( aFont, pWindow->GetControlFont() ) ); } - break; - case BASEPROPERTY_FONTEMPHASISMARK: + } + break; + case BASEPROPERTY_FONTRELIEF: + { + sal_Int16 n = sal_Int16(); + if ( Value >>= n ) { - sal_Int16 n = sal_Int16(); - if ( Value >>= n ) - { - Font aFont = pWindow->GetControlFont(); - aFont.SetEmphasisMark( n ); - pWindow->SetControlFont( aFont ); - } + Font aFont = pWindow->GetControlFont(); + aFont.SetRelief( (FontRelief)n ); + pWindow->SetControlFont( aFont ); } - break; - case BASEPROPERTY_BACKGROUNDCOLOR: - if ( bVoid ) - { - switch ( eWinType ) - { - // set dialog color for default - case WINDOW_DIALOG: - case WINDOW_MESSBOX: - case WINDOW_INFOBOX: - case WINDOW_WARNINGBOX: - case WINDOW_ERRORBOX: - case WINDOW_QUERYBOX: - case WINDOW_TABPAGE: - { - Color aColor = pWindow->GetSettings().GetStyleSettings().GetDialogColor(); - pWindow->SetBackground( aColor ); - pWindow->SetControlBackground( aColor ); - break; - } - - case WINDOW_FIXEDTEXT: - case WINDOW_CHECKBOX: - case WINDOW_RADIOBUTTON: - case WINDOW_GROUPBOX: - case WINDOW_FIXEDLINE: - { - // support transparency only for special controls - pWindow->SetBackground(); - pWindow->SetControlBackground(); - pWindow->SetPaintTransparent( TRUE ); - break; - } - - default: - { - // default code which enables transparency for - // compound controls. It's not real transparency - // as most of these controls repaint their client - // area completely new. - if ( pWindow->IsCompoundControl() ) - pWindow->SetBackground(); - pWindow->SetControlBackground(); - break; - } - } - } - else + } + break; + case BASEPROPERTY_FONTEMPHASISMARK: + { + sal_Int16 n = sal_Int16(); + if ( Value >>= n ) + { + Font aFont = pWindow->GetControlFont(); + aFont.SetEmphasisMark( n ); + pWindow->SetControlFont( aFont ); + } + } + break; + case BASEPROPERTY_BACKGROUNDCOLOR: + if ( bVoid ) + { + switch ( eWinType ) { - sal_Int32 nColor = 0; - if ( Value >>= nColor ) + // set dialog color for default + case WINDOW_DIALOG: + case WINDOW_MESSBOX: + case WINDOW_INFOBOX: + case WINDOW_WARNINGBOX: + case WINDOW_ERRORBOX: + case WINDOW_QUERYBOX: + case WINDOW_TABPAGE: { - Color aColor( nColor ); - pWindow->SetControlBackground( aColor ); + Color aColor = pWindow->GetSettings().GetStyleSettings().GetDialogColor(); pWindow->SetBackground( aColor ); - switch ( eWinType ) - { - // reset paint transparent mode - case WINDOW_FIXEDTEXT: - case WINDOW_CHECKBOX: - case WINDOW_RADIOBUTTON: - case WINDOW_GROUPBOX: - case WINDOW_FIXEDLINE: - pWindow->SetPaintTransparent( FALSE ); - default: ; - } - pWindow->Invalidate(); // Falls das Control nicht drauf reagiert - } - } - break; - case BASEPROPERTY_TEXTCOLOR: - if ( bVoid ) - { - pWindow->SetControlForeground(); - } - else - { - sal_Int32 nColor = 0; - if ( Value >>= nColor ) - { - Color aColor( nColor ); - pWindow->SetTextColor( aColor ); - pWindow->SetControlForeground( aColor ); + pWindow->SetControlBackground( aColor ); + break; } - } - break; - case BASEPROPERTY_TEXTLINECOLOR: - if ( bVoid ) - { - pWindow->SetTextLineColor(); - } - else - { - sal_Int32 nColor = 0; - if ( Value >>= nColor ) + + case WINDOW_FIXEDTEXT: + case WINDOW_CHECKBOX: + case WINDOW_RADIOBUTTON: + case WINDOW_GROUPBOX: + case WINDOW_FIXEDLINE: { - Color aColor( nColor ); - pWindow->SetTextLineColor( aColor ); + // support transparency only for special controls + pWindow->SetBackground(); + pWindow->SetControlBackground(); + pWindow->SetPaintTransparent( TRUE ); + break; } - } - break; - case BASEPROPERTY_FILLCOLOR: - if ( bVoid ) - pWindow->SetFillColor(); - else - { - sal_Int32 nColor = 0; - if ( Value >>= nColor ) + + default: { - Color aColor( nColor ); - pWindow->SetFillColor( aColor ); + // default code which enables transparency for + // compound controls. It's not real transparency + // as most of these controls repaint their client + // area completely new. + if ( pWindow->IsCompoundControl() ) + pWindow->SetBackground(); + pWindow->SetControlBackground(); + break; } } - break; - case BASEPROPERTY_LINECOLOR: - if ( bVoid ) - pWindow->SetLineColor(); - else + } + else + { + sal_Int32 nColor = 0; + if ( Value >>= nColor ) { - sal_Int32 nColor = 0; - if ( Value >>= nColor ) + Color aColor( nColor ); + pWindow->SetControlBackground( aColor ); + pWindow->SetBackground( aColor ); + switch ( eWinType ) { - Color aColor( nColor ); - pWindow->SetLineColor( aColor ); + // reset paint transparent mode + case WINDOW_FIXEDTEXT: + case WINDOW_CHECKBOX: + case WINDOW_RADIOBUTTON: + case WINDOW_GROUPBOX: + case WINDOW_FIXEDLINE: + pWindow->SetPaintTransparent( FALSE ); + default: ; } + pWindow->Invalidate(); // Falls das Control nicht drauf reagiert } - break; - case BASEPROPERTY_BORDER: + } + break; + case BASEPROPERTY_TEXTCOLOR: + if ( bVoid ) { - WinBits nStyle = pWindow->GetStyle(); - sal_uInt16 nBorder = 0; - Value >>= nBorder; - if ( !nBorder ) - { - pWindow->SetStyle( nStyle & ~WB_BORDER ); - } - else + pWindow->SetControlForeground(); + } + else + { + sal_Int32 nColor = 0; + if ( Value >>= nColor ) { - pWindow->SetStyle( nStyle | WB_BORDER ); - pWindow->SetBorderStyle( nBorder ); + Color aColor( nColor ); + pWindow->SetTextColor( aColor ); + pWindow->SetControlForeground( aColor ); } } - break; - case BASEPROPERTY_TABSTOP: + break; + case BASEPROPERTY_TEXTLINECOLOR: + if ( bVoid ) { - WinBits nStyle = pWindow->GetStyle() & ~WB_TABSTOP; - if ( !bVoid ) + pWindow->SetTextLineColor(); + } + else + { + sal_Int32 nColor = 0; + if ( Value >>= nColor ) { - sal_Bool bTab = false; - Value >>= bTab; - if ( bTab ) - nStyle |= WB_TABSTOP; - else - nStyle |= WB_NOTABSTOP; + Color aColor( nColor ); + pWindow->SetTextLineColor( aColor ); } - pWindow->SetStyle( nStyle ); } - break; - case BASEPROPERTY_VERTICALALIGN: + break; + case BASEPROPERTY_FILLCOLOR: + if ( bVoid ) + pWindow->SetFillColor(); + else { - VerticalAlignment eAlign = VerticalAlignment_MAKE_FIXED_SIZE; - WinBits nStyle = pWindow->GetStyle(); - nStyle &= ~(WB_TOP|WB_VCENTER|WB_BOTTOM); - if ( !bVoid ) - Value >>= eAlign; - switch ( eAlign ) + sal_Int32 nColor = 0; + if ( Value >>= nColor ) { - case VerticalAlignment_TOP: - nStyle |= WB_TOP; - break; - case VerticalAlignment_MIDDLE: - nStyle |= WB_VCENTER; - break; - case VerticalAlignment_BOTTOM: - nStyle |= WB_BOTTOM; - break; - default: ; // for warning free code, MAKE_FIXED_SIZE + Color aColor( nColor ); + pWindow->SetFillColor( aColor ); } - pWindow->SetStyle( nStyle ); } - break; - case BASEPROPERTY_ALIGN: + break; + case BASEPROPERTY_LINECOLOR: + if ( bVoid ) + pWindow->SetLineColor(); + else { - sal_Int16 nAlign = PROPERTY_ALIGN_LEFT; - switch ( eWinType ) + sal_Int32 nColor = 0; + if ( Value >>= nColor ) { - case WINDOW_COMBOBOX: - case WINDOW_BUTTON: - case WINDOW_PUSHBUTTON: - case WINDOW_OKBUTTON: - case WINDOW_CANCELBUTTON: - case WINDOW_HELPBUTTON: - nAlign = PROPERTY_ALIGN_CENTER; - // no break here! - case WINDOW_FIXEDTEXT: - case WINDOW_EDIT: - case WINDOW_MULTILINEEDIT: - case WINDOW_CHECKBOX: - case WINDOW_RADIOBUTTON: - case WINDOW_LISTBOX: - { - WinBits nStyle = pWindow->GetStyle(); - nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT); - if ( !bVoid ) - Value >>= nAlign; - if ( nAlign == PROPERTY_ALIGN_LEFT ) - nStyle |= WB_LEFT; - else if ( nAlign == PROPERTY_ALIGN_CENTER ) - nStyle |= WB_CENTER; - else - nStyle |= WB_RIGHT; - pWindow->SetStyle( nStyle ); - } - break; + Color aColor( nColor ); + pWindow->SetLineColor( aColor ); } } - break; - case BASEPROPERTY_MULTILINE: + break; + case BASEPROPERTY_BORDER: + { + WinBits nStyle = pWindow->GetStyle(); + sal_uInt16 nBorder = 0; + Value >>= nBorder; + if ( !nBorder ) { - if ( ( eWinType == WINDOW_FIXEDTEXT ) - || ( eWinType == WINDOW_CHECKBOX ) - || ( eWinType == WINDOW_RADIOBUTTON ) - || ( eWinType == WINDOW_BUTTON ) - || ( eWinType == WINDOW_PUSHBUTTON ) - || ( eWinType == WINDOW_OKBUTTON ) - || ( eWinType == WINDOW_CANCELBUTTON ) - || ( eWinType == WINDOW_HELPBUTTON ) - ) + pWindow->SetStyle( nStyle & ~WB_BORDER ); + } + else + { + pWindow->SetStyle( nStyle | WB_BORDER ); + pWindow->SetBorderStyle( nBorder ); + } + } + break; + case BASEPROPERTY_TABSTOP: + { + WinBits nStyle = pWindow->GetStyle() & ~WB_TABSTOP; + if ( !bVoid ) + { + sal_Bool bTab = false; + Value >>= bTab; + if ( bTab ) + nStyle |= WB_TABSTOP; + else + nStyle |= WB_NOTABSTOP; + } + pWindow->SetStyle( nStyle ); + } + break; + case BASEPROPERTY_VERTICALALIGN: + { + VerticalAlignment eAlign = VerticalAlignment_MAKE_FIXED_SIZE; + WinBits nStyle = pWindow->GetStyle(); + nStyle &= ~(WB_TOP|WB_VCENTER|WB_BOTTOM); + if ( !bVoid ) + Value >>= eAlign; + switch ( eAlign ) + { + case VerticalAlignment_TOP: + nStyle |= WB_TOP; + break; + case VerticalAlignment_MIDDLE: + nStyle |= WB_VCENTER; + break; + case VerticalAlignment_BOTTOM: + nStyle |= WB_BOTTOM; + break; + default: ; // for warning free code, MAKE_FIXED_SIZE + } + pWindow->SetStyle( nStyle ); + } + break; + case BASEPROPERTY_ALIGN: + { + sal_Int16 nAlign = PROPERTY_ALIGN_LEFT; + switch ( eWinType ) + { + case WINDOW_COMBOBOX: + case WINDOW_BUTTON: + case WINDOW_PUSHBUTTON: + case WINDOW_OKBUTTON: + case WINDOW_CANCELBUTTON: + case WINDOW_HELPBUTTON: + nAlign = PROPERTY_ALIGN_CENTER; + // no break here! + case WINDOW_FIXEDTEXT: + case WINDOW_EDIT: + case WINDOW_MULTILINEEDIT: + case WINDOW_CHECKBOX: + case WINDOW_RADIOBUTTON: + case WINDOW_LISTBOX: { WinBits nStyle = pWindow->GetStyle(); - sal_Bool bMulti = false; - Value >>= bMulti; - if ( bMulti ) - nStyle |= WB_WORDBREAK; + nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT); + if ( !bVoid ) + Value >>= nAlign; + if ( nAlign == PROPERTY_ALIGN_LEFT ) + nStyle |= WB_LEFT; + else if ( nAlign == PROPERTY_ALIGN_CENTER ) + nStyle |= WB_CENTER; else - nStyle &= ~WB_WORDBREAK; + nStyle |= WB_RIGHT; pWindow->SetStyle( nStyle ); } + break; } - break; - case BASEPROPERTY_ORIENTATION: + } + break; + case BASEPROPERTY_MULTILINE: + { + if ( ( eWinType == WINDOW_FIXEDTEXT ) + || ( eWinType == WINDOW_CHECKBOX ) + || ( eWinType == WINDOW_RADIOBUTTON ) + || ( eWinType == WINDOW_BUTTON ) + || ( eWinType == WINDOW_PUSHBUTTON ) + || ( eWinType == WINDOW_OKBUTTON ) + || ( eWinType == WINDOW_CANCELBUTTON ) + || ( eWinType == WINDOW_HELPBUTTON ) + ) { - switch ( eWinType ) - { - case WINDOW_FIXEDLINE: - { - sal_Int32 nOrientation = 0; - if ( Value >>= nOrientation ) - { - WinBits nStyle = pWindow->GetStyle(); - nStyle &= ~(WB_HORZ|WB_VERT); - if ( nOrientation == 0 ) - nStyle |= WB_HORZ; - else - nStyle |= WB_VERT; - - pWindow->SetStyle( nStyle ); - } - } - break; - } + WinBits nStyle = pWindow->GetStyle(); + sal_Bool bMulti = false; + Value >>= bMulti; + if ( bMulti ) + nStyle |= WB_WORDBREAK; + else + nStyle &= ~WB_WORDBREAK; + pWindow->SetStyle( nStyle ); } - break; - case BASEPROPERTY_AUTOMNEMONICS: + } + break; + case BASEPROPERTY_ORIENTATION: + { + switch ( eWinType ) { - sal_Bool bAutoMnemonics = false; - Value >>= bAutoMnemonics; - AllSettings aSettings = pWindow->GetSettings(); - StyleSettings aStyleSettings = aSettings.GetStyleSettings(); - if ( aStyleSettings.GetAutoMnemonic() != bAutoMnemonics ) + case WINDOW_FIXEDLINE: { - aStyleSettings.SetAutoMnemonic( bAutoMnemonics ); - aSettings.SetStyleSettings( aStyleSettings ); - pWindow->SetSettings( aSettings ); + sal_Int32 nOrientation = 0; + if ( Value >>= nOrientation ) + { + WinBits nStyle = pWindow->GetStyle(); + nStyle &= ~(WB_HORZ|WB_VERT); + if ( nOrientation == 0 ) + nStyle |= WB_HORZ; + else + nStyle |= WB_VERT; + + pWindow->SetStyle( nStyle ); + } } + break; } - break; - case BASEPROPERTY_MOUSETRANSPARENT: + } + break; + case BASEPROPERTY_AUTOMNEMONICS: + { + sal_Bool bAutoMnemonics = false; + Value >>= bAutoMnemonics; + AllSettings aSettings = pWindow->GetSettings(); + StyleSettings aStyleSettings = aSettings.GetStyleSettings(); + if ( aStyleSettings.GetAutoMnemonic() != bAutoMnemonics ) { - sal_Bool bMouseTransparent = false; - Value >>= bMouseTransparent; - pWindow->SetMouseTransparent( bMouseTransparent ); + aStyleSettings.SetAutoMnemonic( bAutoMnemonics ); + aSettings.SetStyleSettings( aStyleSettings ); + pWindow->SetSettings( aSettings ); } - break; - case BASEPROPERTY_PAINTTRANSPARENT: - { - sal_Bool bPaintTransparent = false; - Value >>= bPaintTransparent; - pWindow->SetPaintTransparent( bPaintTransparent ); + } + break; + case BASEPROPERTY_MOUSETRANSPARENT: + { + sal_Bool bMouseTransparent = false; + Value >>= bMouseTransparent; + pWindow->SetMouseTransparent( bMouseTransparent ); + } + break; + case BASEPROPERTY_PAINTTRANSPARENT: + { + sal_Bool bPaintTransparent = false; + Value >>= bPaintTransparent; + pWindow->SetPaintTransparent( bPaintTransparent ); // pWindow->SetBackground(); - } - break; + } + break; - case BASEPROPERTY_REPEAT: - { - sal_Bool bRepeat( FALSE ); - Value >>= bRepeat; + case BASEPROPERTY_REPEAT: + { + sal_Bool bRepeat( FALSE ); + Value >>= bRepeat; - WinBits nStyle = pWindow->GetStyle(); - if ( bRepeat ) - nStyle |= WB_REPEAT; - else - nStyle &= ~WB_REPEAT; - pWindow->SetStyle( nStyle ); - } - break; + WinBits nStyle = pWindow->GetStyle(); + if ( bRepeat ) + nStyle |= WB_REPEAT; + else + nStyle &= ~WB_REPEAT; + pWindow->SetStyle( nStyle ); + } + break; - case BASEPROPERTY_REPEAT_DELAY: + case BASEPROPERTY_REPEAT_DELAY: + { + sal_Int32 nRepeatDelay = 0; + if ( Value >>= nRepeatDelay ) { - sal_Int32 nRepeatDelay = 0; - if ( Value >>= nRepeatDelay ) - { - AllSettings aSettings = pWindow->GetSettings(); - MouseSettings aMouseSettings = aSettings.GetMouseSettings(); + AllSettings aSettings = pWindow->GetSettings(); + MouseSettings aMouseSettings = aSettings.GetMouseSettings(); - aMouseSettings.SetButtonRepeat( nRepeatDelay ); - aSettings.SetMouseSettings( aMouseSettings ); + aMouseSettings.SetButtonRepeat( nRepeatDelay ); + aSettings.SetMouseSettings( aMouseSettings ); - pWindow->SetSettings( aSettings, TRUE ); - } + pWindow->SetSettings( aSettings, TRUE ); } - break; + } + break; - case BASEPROPERTY_SYMBOL_COLOR: - ::toolkit::setColorSettings( pWindow, Value, &StyleSettings::SetButtonTextColor, &StyleSettings::GetButtonTextColor ); - break; + case BASEPROPERTY_SYMBOL_COLOR: + ::toolkit::setColorSettings( pWindow, Value, &StyleSettings::SetButtonTextColor, &StyleSettings::GetButtonTextColor ); + break; - case BASEPROPERTY_BORDERCOLOR: - ::toolkit::setColorSettings( pWindow, Value, &StyleSettings::SetMonoColor, &StyleSettings::GetMonoColor); - break; - case BASEPROPERTY_DEFAULTCONTROL: - { - rtl::OUString aName; - Value >>= aName; - break; - } + case BASEPROPERTY_BORDERCOLOR: + ::toolkit::setColorSettings( pWindow, Value, &StyleSettings::SetMonoColor, &StyleSettings::GetMonoColor); + break; + case BASEPROPERTY_DEFAULTCONTROL: + { + rtl::OUString aName; + Value >>= aName; + break; } } } @@ -2055,6 +2112,14 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: sal_uInt16 nPropType = GetPropertyId( PropertyName ); switch ( nPropType ) { + case BASEPROPERTY_CONTEXT_WRITING_MODE: + aProp <<= mpImpl->mnContextWritingMode; + break; + + case BASEPROPERTY_WRITING_MODE: + aProp <<= mpImpl->mnWritingMode; + break; + case BASEPROPERTY_WHEELWITHOUTFOCUS: { sal_Bool bWheelOnHover = !GetWindow()->GetSettings().GetMouseSettings().GetNoWheelActionWithoutFocus(); @@ -2312,18 +2377,18 @@ sal_Bool VCLXWindow::setGraphics( const ::com::sun::star::uno::Reference< ::com: ::vos::OGuard aGuard( GetMutex() ); if ( VCLUnoHelper::GetOutputDevice( rxDevice ) ) - mxViewGraphics = rxDevice; + mpImpl->mxViewGraphics = rxDevice; else - mxViewGraphics = NULL; + mpImpl->mxViewGraphics = NULL; - return mxViewGraphics.is(); + return mpImpl->mxViewGraphics.is(); } ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > VCLXWindow::getGraphics( ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); - return mxViewGraphics; + return mpImpl->mxViewGraphics; } ::com::sun::star::awt::Size VCLXWindow::getSize( ) throw(::com::sun::star::uno::RuntimeException) @@ -2336,26 +2401,6 @@ sal_Bool VCLXWindow::setGraphics( const ::com::sun::star::uno::Reference< ::com: return ::com::sun::star::awt::Size( aSz.Width(), aSz.Height() ); } -namespace -{ - class FlagGuard - { - private: - sal_Bool& m_rFlag; - - public: - FlagGuard( sal_Bool& _rFlag ) - :m_rFlag( _rFlag ) - { - m_rFlag = sal_True; - } - ~FlagGuard() - { - m_rFlag = sal_False; - } - }; -} - void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); @@ -2372,7 +2417,7 @@ void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno: Point aPos( nX, nY ); Size aSize = pWindow->GetSizePixel(); - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mxViewGraphics ); + OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mpImpl->mxViewGraphics ); aPos = pDev->PixelToLogic( aPos ); aSize = pDev->PixelToLogic( aSize ); @@ -2380,7 +2425,7 @@ void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno: return; } - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mxViewGraphics ); + OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mpImpl->mxViewGraphics ); Point aPos( nX, nY ); if ( !pDev ) @@ -2393,9 +2438,9 @@ void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno: // (strangely) triggers another paint. Prevent a stack overflow here // Yes, this is only fixing symptoms for the moment .... // #i40647# / 2005-01-18 / frank.schoenheit@sun.com - if ( !mbDrawingOntoParent ) + if ( !mpImpl->getDrawingOntoParent_ref() ) { - FlagGuard aDrawingflagGuard( mbDrawingOntoParent ); + FlagGuard aDrawingflagGuard( mpImpl->getDrawingOntoParent_ref() ); BOOL bWasVisible = pWindow->IsVisible(); Point aOldPos( pWindow->GetPosPixel() ); @@ -2466,12 +2511,12 @@ void SAL_CALL VCLXWindow::disposing( const ::com::sun::star::lang::EventObject& ::vos::OGuard aGuard( GetMutex() ); // check if it comes from our AccessibleContext - uno::Reference< uno::XInterface > aAC( mxAccessibleContext, uno::UNO_QUERY ); + uno::Reference< uno::XInterface > aAC( mpImpl->mxAccessibleContext, uno::UNO_QUERY ); uno::Reference< uno::XInterface > xSource( _rSource.Source, uno::UNO_QUERY ); if ( aAC.get() == xSource.get() ) { // yep, it does - mxAccessibleContext = uno::Reference< accessibility::XAccessibleContext >(); + mpImpl->mxAccessibleContext = uno::Reference< accessibility::XAccessibleContext >(); } } @@ -2486,19 +2531,19 @@ void SAL_CALL VCLXWindow::disposing( const ::com::sun::star::lang::EventObject& if( ! mpImpl ) return uno::Reference< accessibility::XAccessibleContext >(); - if ( !mxAccessibleContext.is() && GetWindow() ) + if ( !mpImpl->mxAccessibleContext.is() && GetWindow() ) { - mxAccessibleContext = CreateAccessibleContext(); + mpImpl->mxAccessibleContext = CreateAccessibleContext(); // add as event listener to this component // in case somebody disposes it, we do not want to have a (though weak) reference to a dead // object - uno::Reference< lang::XComponent > xComp( mxAccessibleContext, uno::UNO_QUERY ); + uno::Reference< lang::XComponent > xComp( mpImpl->mxAccessibleContext, uno::UNO_QUERY ); if ( xComp.is() ) xComp->addEventListener( this ); } - return mxAccessibleContext; + return mpImpl->mxAccessibleContext; } // ::com::sun::star::awt::XDockable @@ -2506,10 +2551,8 @@ void SAL_CALL VCLXWindow::addDockableWindowListener( const ::com::sun::star::uno { ::vos::OGuard aGuard( GetMutex() ); - if( !mxDockableWindowListener.is() ) - mxDockableWindowListener = xListener; - //else - // throw too_many_listeners_exception + if ( xListener.is() ) + mpImpl->getDockableWindowListeners().addInterface( xListener ); } @@ -2517,8 +2560,7 @@ void SAL_CALL VCLXWindow::removeDockableWindowListener( const ::com::sun::star:: { ::vos::OGuard aGuard( GetMutex() ); - if( mxDockableWindowListener == xListener ) - mxDockableWindowListener.clear(); + mpImpl->getDockableWindowListeners().removeInterface( xListener ); } void SAL_CALL VCLXWindow::enableDocking( sal_Bool bEnable ) throw (::com::sun::star::uno::RuntimeException) @@ -2668,13 +2710,13 @@ UnoPropertyArrayHelper * VCLXWindow::GetPropHelper() { ::vos::OGuard aGuard( GetMutex() ); - if (mpPropHelper == NULL) + if ( mpImpl->mpPropHelper == NULL ) { std::list< sal_uInt16 > aIDs; GetPropertyIds( aIDs ); - mpPropHelper = new UnoPropertyArrayHelper( aIDs ); + mpImpl->mpPropHelper = new UnoPropertyArrayHelper( aIDs ); } - return mpPropHelper; + return mpImpl->mpPropHelper; } ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 06e41611f793..dadb1300675a 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -45,6 +45,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/system/XSystemShellExecute.hpp> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> +#include <com/sun/star/awt/ImageScaleMode.hpp> #include <comphelper/processfactory.hxx> #ifndef _SV_BUTTON_HXX @@ -69,6 +70,7 @@ using ::com::sun::star::graphic::XGraphic; using namespace ::com::sun::star; using namespace ::com::sun::star::awt::VisualEffect; +namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode; static double ImplCalcLongValue( double nValue, sal_uInt16 nDigits ) { @@ -403,6 +405,8 @@ void VCLXButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_MULTILINE, BASEPROPERTY_ALIGN, BASEPROPERTY_VERTICALALIGN, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXImageConsumer::ImplGetPropertyIds( rIds ); } @@ -663,7 +667,10 @@ void VCLXImageControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_IMAGEURL, BASEPROPERTY_PRINTABLE, BASEPROPERTY_SCALEIMAGE, + BASEPROPERTY_IMAGE_SCALE_MODE, BASEPROPERTY_TABSTOP, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXImageConsumer::ImplGetPropertyIds( rIds ); } @@ -716,22 +723,34 @@ void VCLXImageControl::setProperty( const ::rtl::OUString& PropertyName, const : ::vos::OGuard aGuard( GetMutex() ); ImageControl* pImageControl = (ImageControl*)GetWindow(); - if ( pImageControl ) + + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + switch ( nPropType ) { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) + case BASEPROPERTY_IMAGE_SCALE_MODE: { - case BASEPROPERTY_SCALEIMAGE: + sal_Int16 nScaleMode( ImageScaleMode::Anisotropic ); + if ( pImageControl && ( Value >>= nScaleMode ) ) { - sal_Bool b = sal_Bool(); - if ( Value >>= b ) - pImageControl->SetScaleImage( b ); + pImageControl->SetScaleMode( nScaleMode ); } - break; - default: - VCLXImageConsumer::setProperty( PropertyName, Value ); - break; } + break; + + case BASEPROPERTY_SCALEIMAGE: + { + // this is for compatibility only, nowadays, the ImageScaleMode property should be used + sal_Bool bScaleImage = sal_False; + if ( pImageControl && ( Value >>= bScaleImage ) ) + { + pImageControl->SetScaleMode( bScaleImage ? ImageScaleMode::Anisotropic : ImageScaleMode::None ); + } + } + break; + + default: + VCLXImageConsumer::setProperty( PropertyName, Value ); + break; } } @@ -741,18 +760,21 @@ void VCLXImageControl::setProperty( const ::rtl::OUString& PropertyName, const : ::com::sun::star::uno::Any aProp; ImageControl* pImageControl = (ImageControl*)GetWindow(); - if ( pImageControl ) + sal_uInt16 nPropType = GetPropertyId( PropertyName ); + + switch ( nPropType ) { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch ( nPropType ) - { - case BASEPROPERTY_SCALEIMAGE: - aProp <<= (sal_Bool)pImageControl->IsScaleImage(); - break; - default: - aProp = VCLXImageConsumer::getProperty( PropertyName ); - break; - } + case BASEPROPERTY_IMAGE_SCALE_MODE: + aProp <<= ( pImageControl ? pImageControl->GetScaleMode() : ImageScaleMode::Anisotropic ); + break; + + case BASEPROPERTY_SCALEIMAGE: + aProp <<= ( pImageControl && pImageControl->GetScaleMode() != ImageScaleMode::None ) ? sal_True : sal_False; + break; + + default: + aProp = VCLXImageConsumer::getProperty( PropertyName ); + break; } return aProp; } @@ -783,6 +805,8 @@ void VCLXCheckBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_BACKGROUNDCOLOR, BASEPROPERTY_ALIGN, BASEPROPERTY_VERTICALALIGN, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXImageConsumer::ImplGetPropertyIds( rIds ); } @@ -1079,6 +1103,8 @@ void VCLXRadioButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_BACKGROUNDCOLOR, BASEPROPERTY_ALIGN, BASEPROPERTY_VERTICALALIGN, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXImageConsumer::ImplGetPropertyIds( rIds ); } @@ -1490,6 +1516,8 @@ void VCLXListBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_TABSTOP, BASEPROPERTY_READONLY, BASEPROPERTY_ALIGN, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXWindow::ImplGetPropertyIds( rIds ); } @@ -2223,7 +2251,7 @@ void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::s if ( pWindow ) { - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( GetViewGraphics() ); + OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); if ( !pDev ) pDev = pWindow->GetParent(); @@ -2324,7 +2352,7 @@ throw(::com::sun::star::uno::RuntimeException) if ( pWindow ) { - OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( GetViewGraphics() ); + OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); if ( !pDev ) pDev = pWindow->GetParent(); @@ -2674,6 +2702,8 @@ void VCLXFixedHyperlink::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_TABSTOP, BASEPROPERTY_VERTICALALIGN, BASEPROPERTY_URL, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXWindow::ImplGetPropertyIds( rIds ); } @@ -2699,6 +2729,8 @@ void VCLXFixedText::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_PRINTABLE, BASEPROPERTY_TABSTOP, BASEPROPERTY_VERTICALALIGN, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXWindow::ImplGetPropertyIds( rIds ); } @@ -2843,6 +2875,8 @@ void VCLXScrollBar::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_SYMBOL_COLOR, BASEPROPERTY_TABSTOP, BASEPROPERTY_VISIBLESIZE, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXWindow::ImplGetPropertyIds( rIds ); } @@ -3324,6 +3358,8 @@ void VCLXEdit::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_PAINTTRANSPARENT, BASEPROPERTY_AUTOHSCROLL, BASEPROPERTY_AUTOVSCROLL, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXWindow::ImplGetPropertyIds( rIds ); } @@ -3693,6 +3729,8 @@ void VCLXComboBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_TEXT, BASEPROPERTY_HIDEINACTIVESELECTION, BASEPROPERTY_ALIGN, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); // no, don't call VCLXEdit here - it has properties which we do *not* want to have at at combo box // #i92690# / 2008-08-12 / frank.schoenheit@sun.com @@ -4177,6 +4215,7 @@ void VCLXFormattedSpinField::setProperty( const ::rtl::OUString& PropertyName, c void VCLXDateField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) { PushPropertyIds( rIds, + BASEPROPERTY_ALIGN, BASEPROPERTY_BACKGROUNDCOLOR, BASEPROPERTY_BORDER, BASEPROPERTY_BORDERCOLOR, @@ -4201,6 +4240,8 @@ void VCLXDateField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_ENFORCE_FORMAT, BASEPROPERTY_TEXT, BASEPROPERTY_HIDEINACTIVESELECTION, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); } @@ -4515,6 +4556,7 @@ sal_Bool VCLXDateField::isStrictFormat() throw(::com::sun::star::uno::RuntimeExc void VCLXTimeField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) { PushPropertyIds( rIds, + BASEPROPERTY_ALIGN, BASEPROPERTY_BACKGROUNDCOLOR, BASEPROPERTY_BORDER, BASEPROPERTY_BORDERCOLOR, @@ -4537,6 +4579,8 @@ void VCLXTimeField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_ENFORCE_FORMAT, BASEPROPERTY_TEXT, BASEPROPERTY_HIDEINACTIVESELECTION, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); } @@ -4812,6 +4856,7 @@ void VCLXTimeField::setProperty( const ::rtl::OUString& PropertyName, const ::co void VCLXNumericField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) { PushPropertyIds( rIds, + BASEPROPERTY_ALIGN, BASEPROPERTY_BACKGROUNDCOLOR, BASEPROPERTY_BORDER, BASEPROPERTY_BORDERCOLOR, @@ -4835,6 +4880,8 @@ void VCLXNumericField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_VALUE_DOUBLE, BASEPROPERTY_ENFORCE_FORMAT, BASEPROPERTY_HIDEINACTIVESELECTION, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); } @@ -5149,6 +5196,7 @@ void VCLXNumericField::setProperty( const ::rtl::OUString& PropertyName, const : void VCLXMetricField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) { PushPropertyIds( rIds, + BASEPROPERTY_ALIGN, BASEPROPERTY_BACKGROUNDCOLOR, BASEPROPERTY_BORDER, BASEPROPERTY_BORDERCOLOR, @@ -5170,6 +5218,8 @@ void VCLXMetricField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_HIDEINACTIVESELECTION, BASEPROPERTY_UNIT, BASEPROPERTY_CUSTOMUNITTEXT, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); } @@ -5394,6 +5444,7 @@ void VCLXMetricField::setProperty( const ::rtl::OUString& PropertyName, const :: void VCLXCurrencyField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) { PushPropertyIds( rIds, + BASEPROPERTY_ALIGN, BASEPROPERTY_BACKGROUNDCOLOR, BASEPROPERTY_BORDER, BASEPROPERTY_BORDERCOLOR, @@ -5419,6 +5470,8 @@ void VCLXCurrencyField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_VALUE_DOUBLE, BASEPROPERTY_ENFORCE_FORMAT, BASEPROPERTY_HIDEINACTIVESELECTION, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); } @@ -5744,6 +5797,7 @@ void VCLXCurrencyField::setProperty( const ::rtl::OUString& PropertyName, const void VCLXPatternField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) { PushPropertyIds( rIds, + BASEPROPERTY_ALIGN, BASEPROPERTY_BACKGROUNDCOLOR, BASEPROPERTY_BORDER, BASEPROPERTY_BORDERCOLOR, @@ -5761,6 +5815,8 @@ void VCLXPatternField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_TABSTOP, BASEPROPERTY_TEXT, BASEPROPERTY_HIDEINACTIVESELECTION, + BASEPROPERTY_WRITING_MODE, + BASEPROPERTY_CONTEXT_WRITING_MODE, 0); VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); } diff --git a/toolkit/source/controls/formattedcontrol.cxx b/toolkit/source/controls/formattedcontrol.cxx index 0b99064413d7..c80c3b14e63e 100644 --- a/toolkit/source/controls/formattedcontrol.cxx +++ b/toolkit/source/controls/formattedcontrol.cxx @@ -159,6 +159,8 @@ namespace toolkit ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR ); ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION ); ImplRegisterProperty( BASEPROPERTY_ENFORCE_FORMAT ); + ImplRegisterProperty( BASEPROPERTY_WRITING_MODE ); + ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE ); Any aTreatAsNumber; aTreatAsNumber <<= (sal_Bool) sal_True; diff --git a/toolkit/source/controls/tkspinbutton.cxx b/toolkit/source/controls/tkspinbutton.cxx index c0493a28ab95..5c4e47e240dc 100644 --- a/toolkit/source/controls/tkspinbutton.cxx +++ b/toolkit/source/controls/tkspinbutton.cxx @@ -72,6 +72,8 @@ namespace toolkit ImplRegisterProperty( BASEPROPERTY_SPINVALUE_MAX ); ImplRegisterProperty( BASEPROPERTY_SPININCREMENT ); ImplRegisterProperty( BASEPROPERTY_TABSTOP ); + ImplRegisterProperty( BASEPROPERTY_WRITING_MODE ); + ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE ); } //-------------------------------------------------------------------- diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index e9327d82a7b0..0f54a204a010 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -37,6 +37,7 @@ #include <com/sun/star/awt/FontWeight.hpp> #include <com/sun/star/awt/FontSlant.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> +#include <com/sun/star/text/WritingMode2.hpp> #include <com/sun/star/io/XMarkableStream.hpp> #include <toolkit/controls/unocontrolmodel.hxx> #include <toolkit/helper/macros.hxx> @@ -224,8 +225,13 @@ void UnoControlModel::ImplPropertyChanged( sal_uInt16 ) { ::com::sun::star::uno::Any aDefault; - if ( ( nPropId == BASEPROPERTY_FONTDESCRIPTOR ) || - ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) ) + if ( + (nPropId == BASEPROPERTY_FONTDESCRIPTOR) || + ( + (nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START) && + (nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END) + ) + ) { EmptyFontDescriptor aFD; switch ( nPropId ) @@ -254,8 +260,10 @@ void UnoControlModel::ImplPropertyChanged( sal_uInt16 ) { switch ( nPropId ) { - case BASEPROPERTY_GRAPHIC: aDefault <<= ::com::sun::star::uno::makeAny( - ::com::sun::star::uno::Reference< graphic::XGraphic >() ); break; + case BASEPROPERTY_GRAPHIC: + aDefault <<= makeAny( Reference< graphic::XGraphic >() ); + break; + case BASEPROPERTY_VERTICALALIGN: case BASEPROPERTY_BORDERCOLOR: case BASEPROPERTY_SYMBOL_COLOR: @@ -308,7 +316,6 @@ void UnoControlModel::ImplPropertyChanged( sal_uInt16 ) case BASEPROPERTY_REPEAT_DELAY: aDefault <<= (sal_Int32) 50; break; // 50 milliseconds case BASEPROPERTY_DEFAULTCONTROL: aDefault <<= ((UnoControlModel*)this)->getServiceName(); break; - case BASEPROPERTY_AUTOHSCROLL: case BASEPROPERTY_AUTOVSCROLL: case BASEPROPERTY_MOVEABLE: @@ -350,6 +357,11 @@ void UnoControlModel::ImplPropertyChanged( sal_uInt16 ) case BASEPROPERTY_TITLE: case BASEPROPERTY_TEXT: aDefault <<= ::rtl::OUString(); break; + case BASEPROPERTY_WRITING_MODE: + case BASEPROPERTY_CONTEXT_WRITING_MODE: + aDefault <<= text::WritingMode2::CONTEXT; + break; + case BASEPROPERTY_STRINGITEMLIST: { ::com::sun::star::uno::Sequence< ::rtl::OUString> aStringSeq; diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index a269b6183ea1..53b28cb7f2ac 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -37,7 +37,9 @@ #include <com/sun/star/awt/VisualEffect.hpp> #include <com/sun/star/awt/LineEndFormat.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> +#include <com/sun/star/graphic/GraphicObject.hpp> #include <com/sun/star/util/Date.hpp> +#include <com/sun/star/awt/ImageScaleMode.hpp> #include <toolkit/controls/formattedcontrol.hxx> @@ -496,6 +498,8 @@ UnoControlFileControlModel::UnoControlFileControlModel() ImplRegisterProperty( BASEPROPERTY_READONLY ); ImplRegisterProperty( BASEPROPERTY_TABSTOP ); ImplRegisterProperty( BASEPROPERTY_TEXT ); + ImplRegisterProperty( BASEPROPERTY_WRITING_MODE ); + ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE ); ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION ); } @@ -576,11 +580,21 @@ uno::Any ImageProducerControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) co return UnoControlModel::ImplGetDefaultValue( nPropId ); } -namespace -{ - uno::Reference< graphic::XGraphic > lcl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL ) + uno::Reference< graphic::XGraphic > ImageProducerControlModel::getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL ) { uno::Reference< graphic::XGraphic > xGraphic; + + if( ( _rURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 ) ) + { + // graphic manager uniqueid + rtl::OUString sID = _rURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 ); + // get the DefaultContext + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + mxGrfObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID ); + } + else // linked + mxGrfObj = NULL; // release the GraphicObject + if ( !_rURL.getLength() ) return xGraphic; @@ -603,7 +617,6 @@ namespace return xGraphic; } -} void SAL_CALL ImageProducerControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception) { @@ -621,7 +634,7 @@ void SAL_CALL ImageProducerControlModel::setFastPropertyValue_NoBroadcast( sal_I mbAdjustingGraphic = true; ::rtl::OUString sImageURL; OSL_VERIFY( rValue >>= sImageURL ); - setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( lcl_getGraphicFromURL_nothrow( sImageURL ) ) ); + setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( sImageURL ) ) ); mbAdjustingGraphic = false; } break; @@ -942,6 +955,7 @@ awt::Size UnoButtonControl::calcAdjustedSize( const awt::Size& rNewSize ) throw( // class UnoControlImageControlModel // ---------------------------------------------------- UnoControlImageControlModel::UnoControlImageControlModel() + :mbAdjustingImageScaleMode( false ) { UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXImageControl ); } @@ -956,6 +970,9 @@ uno::Any UnoControlImageControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageControl ) ); + if ( nPropId == BASEPROPERTY_IMAGE_SCALE_MODE ) + return makeAny( awt::ImageScaleMode::Anisotropic ); + return ImageProducerControlModel::ImplGetDefaultValue( nPropId ); } @@ -977,6 +994,44 @@ uno::Reference< beans::XPropertySetInfo > UnoControlImageControlModel::getProper return xInfo; } +void SAL_CALL UnoControlImageControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::uno::Exception) +{ + ImageProducerControlModel::setFastPropertyValue_NoBroadcast( _nHandle, _rValue ); + + // ScaleImage is an older (and less powerful) version of ScaleMode, but keep both in sync as far as possible + try + { + switch ( _nHandle ) + { + case BASEPROPERTY_IMAGE_SCALE_MODE: + if ( !mbAdjustingImageScaleMode && ImplHasProperty( BASEPROPERTY_SCALEIMAGE ) ) + { + mbAdjustingImageScaleMode = true; + sal_Int16 nScaleMode( awt::ImageScaleMode::Anisotropic ); + OSL_VERIFY( _rValue >>= nScaleMode ); + setPropertyValue( GetPropertyName( BASEPROPERTY_SCALEIMAGE ), uno::makeAny( sal_Bool( nScaleMode != awt::ImageScaleMode::None ) ) ); + mbAdjustingImageScaleMode = false; + } + break; + case BASEPROPERTY_SCALEIMAGE: + if ( !mbAdjustingImageScaleMode && ImplHasProperty( BASEPROPERTY_IMAGE_SCALE_MODE ) ) + { + mbAdjustingImageScaleMode = true; + sal_Bool bScale = sal_True; + OSL_VERIFY( _rValue >>= bScale ); + setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGE_SCALE_MODE ), uno::makeAny( bScale ? awt::ImageScaleMode::Anisotropic : awt::ImageScaleMode::None ) ); + mbAdjustingImageScaleMode = false; + } + break; + } + } + catch( const Exception& ) + { + mbAdjustingImageScaleMode = false; + throw; + } +} + // ---------------------------------------------------- // class UnoImageControlControl // ---------------------------------------------------- @@ -1601,21 +1656,7 @@ void UnoFixedHyperlinkControl::removeActionListener(const uno::Reference< awt::X // ---------------------------------------------------- UnoControlFixedTextModel::UnoControlFixedTextModel() { - ImplRegisterProperty( BASEPROPERTY_ALIGN ); - ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); - ImplRegisterProperty( BASEPROPERTY_BORDER ); - ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR ); - ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); - ImplRegisterProperty( BASEPROPERTY_ENABLED ); - ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); - ImplRegisterProperty( BASEPROPERTY_HELPTEXT ); - ImplRegisterProperty( BASEPROPERTY_HELPURL ); - ImplRegisterProperty( BASEPROPERTY_LABEL ); - ImplRegisterProperty( BASEPROPERTY_MULTILINE ); - ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); - ImplRegisterProperty( BASEPROPERTY_TABSTOP ); - ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN ); - ImplRegisterProperty( BASEPROPERTY_NOLABEL ); + UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXFixedText ); } ::rtl::OUString UnoControlFixedTextModel::getServiceName() throw(::com::sun::star::uno::RuntimeException) @@ -1752,6 +1793,8 @@ UnoControlGroupBoxModel::UnoControlGroupBoxModel() ImplRegisterProperty( BASEPROPERTY_HELPURL ); ImplRegisterProperty( BASEPROPERTY_LABEL ); ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_WRITING_MODE ); + ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE ); } ::rtl::OUString UnoControlGroupBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException) diff --git a/toolkit/source/helper/formpdfexport.cxx b/toolkit/source/helper/formpdfexport.cxx index e57d238b8982..2b5fe908bedf 100644 --- a/toolkit/source/helper/formpdfexport.cxx +++ b/toolkit/source/helper/formpdfexport.cxx @@ -8,7 +8,7 @@ * * $RCSfile: formpdfexport.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.2.6.1 $ * * This file is part of OpenOffice.org. * @@ -374,8 +374,10 @@ namespace toolkitform if ( xPSI->hasPropertyByName( sBorderColorPropertyName ) ) { sal_Int32 nBoderColor = COL_TRANSPARENT; - xModelProps->getPropertyValue( sBorderColorPropertyName ) >>= nBoderColor; - _rpDescriptor->BorderColor = Color( nBoderColor ); + if ( xModelProps->getPropertyValue( sBorderColorPropertyName ) >>= nBoderColor ) + _rpDescriptor->BorderColor = Color( nBoderColor ); + else + _rpDescriptor->BorderColor = Color( COL_BLACK ); } } } diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx index 17122badfe1d..bace3ff94771 100644 --- a/toolkit/source/helper/property.cxx +++ b/toolkit/source/helper/property.cxx @@ -98,6 +98,8 @@ struct ImplPropertyInfo ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 ) #define DECL_PROP_3( asciiname, id, type, attrib1, attrib2, attrib3 ) \ ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 | ::com::sun::star::beans::PropertyAttribute::attrib3 ) +#define DECL_PROP_4( asciiname, id, type, attrib1, attrib2, attrib3, attrib4 ) \ + ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 | ::com::sun::star::beans::PropertyAttribute::attrib3 | ::com::sun::star::beans::PropertyAttribute::attrib4 ) #define DECL_DEP_PROP_1( asciiname, id, type, attrib1 ) \ ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1, sal_True ) @@ -152,7 +154,6 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_2 ( "EnforceFormat", ENFORCE_FORMAT, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_3 ( "FillColor", FILLCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_2 ( "FocusOnClick", FOCUSONCLICK, bool, BOUND, MAYBEDEFAULT ), -// DECL_PROP_2 ( "FocusSelectionHide", FOCUSSELECTIONHIDE, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "FontRelief", FONTRELIEF, sal_Int16, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "FontEmphasisMark", FONTEMPHASISMARK, sal_Int16, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "FontDescriptor", FONTDESCRIPTOR, FontDescriptor, BOUND, MAYBEDEFAULT ), @@ -200,7 +201,7 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_2 ( "MultiLine", MULTILINE, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "MultiSelection", MULTISELECTION, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "NativeWidgetLook", NATIVE_WIDGET_LOOK, bool, BOUND, MAYBEDEFAULT ), - DECL_PROP_2 ( "NoLabel", NOLABEL, bool, BOUND, MAYBEDEFAULT ), //added for issue79712 + DECL_PROP_2 ( "NoLabel", NOLABEL, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "Orientation", ORIENTATION, sal_Int32, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "PaintTransparent", PAINTTRANSPARENT, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "PluginParent", PLUGINPARENT, sal_Int64, BOUND, MAYBEDEFAULT ), @@ -213,8 +214,8 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_2 ( "ReadOnly", READONLY, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "Repeat", REPEAT, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "RepeatDelay", REPEAT_DELAY, sal_Int32, BOUND, MAYBEDEFAULT ), -// DECL_PROP_3 ( "ResourceResolver", RESOURCERESOLVER, Reference< ::com::sun::star::resource::XStringResourceResolver >, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_2 ( "ScaleImage", SCALEIMAGE, bool, BOUND, MAYBEDEFAULT ), + DECL_PROP_2 ( "ScaleMode", IMAGE_SCALE_MODE, sal_Int16, BOUND, MAYBEDEFAULT ), DECL_DEP_PROP_3 ( "ScrollValue", SCROLLVALUE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_2 ( "ScrollValueMax", SCROLLVALUE_MAX, sal_Int32, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "ScrollValueMin", SCROLLVALUE_MIN, sal_Int32, BOUND, MAYBEDEFAULT ), @@ -269,7 +270,9 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_3 ( "RowHeight", TREE_ROWHEIGHT, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_2 ( "InvokesStopNodeEditing", TREE_INVOKESSTOPNODEEDITING, sal_Bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "DialogSourceURL", DIALOGSOURCEURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ), - DECL_PROP_2 ( "URL", URL, ::rtl::OUString, BOUND, MAYBEDEFAULT ) + DECL_PROP_2 ( "URL", URL, ::rtl::OUString, BOUND, MAYBEDEFAULT ), + DECL_PROP_2 ( "WritingMode", WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT ), + DECL_PROP_3 ( "ContextWritingMode", CONTEXT_WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT, TRANSIENT ) }; pPropertyInfos = aImplPropertyInfos; nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo ); diff --git a/toolkit/source/helper/throbberimpl.cxx b/toolkit/source/helper/throbberimpl.cxx index 570fc16320c5..902792918de0 100644 --- a/toolkit/source/helper/throbberimpl.cxx +++ b/toolkit/source/helper/throbberimpl.cxx @@ -87,10 +87,12 @@ namespace toolkit mnStepCount = maImageList.getLength(); FixedImage* pImage = static_cast< FixedImage* >( mxParent->GetWindow() ); if ( pImage ) + { if ( mnStepCount ) pImage->SetImage( maImageList[ 0 ] ); else pImage->SetImage( Image() ); + } } //-------------------------------------------------------------------- diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index 96964018ff6b..fe41ad9a52ef 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -289,13 +289,8 @@ void UnoWrapper::WindowDestroyed( Window* pWindow ) } Window* pParent = pWindow->GetParent(); - if ( pParent && pParent->GetWindowPeer() && pParent->GetWindowPeer()->GetContainerListeners().getLength() ) - { - ::com::sun::star::awt::VclContainerEvent aEvent; - aEvent.Source = (::cppu::OWeakObject*)pParent->GetWindowPeer(); - aEvent.Child = (::cppu::OWeakObject*)pWindow->GetWindowPeer(); - pParent->GetWindowPeer()->GetContainerListeners().windowRemoved( aEvent ); - } + if ( pParent && pParent->GetWindowPeer() ) + pParent->GetWindowPeer()->notifyWindowRemoved( *pWindow ); if ( pWindow && pWindow->GetWindowPeer() ) { diff --git a/toolkit/util/makefile.pmk b/toolkit/util/makefile.pmk index 49da9b4fc2c0..8bb9f5d4bc28 100644 --- a/toolkit/util/makefile.pmk +++ b/toolkit/util/makefile.pmk @@ -31,11 +31,7 @@ # Reduction of exported symbols: CDEFS += -DTOOLKIT_DLLIMPLEMENTATION -.IF "$(COMNAME)" == "gcc3" && "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE" -CFLAGS += -fvisibility=hidden -.ELIF "$(COMNAME)" == "sunpro5" && "$(CCNUMVER)" >= "00050005" -CFLAGS += -xldscope=hidden -.ENDIF +VISIBILITY_HIDDEN=TRUE # FIXME: sprinkle some TOOLKIT_DLLPUBLIC diff --git a/tools/bootstrp/prj.cxx b/tools/bootstrp/prj.cxx index dfe86daac73e..7e3ebe207964 100644 --- a/tools/bootstrp/prj.cxx +++ b/tools/bootstrp/prj.cxx @@ -131,6 +131,7 @@ ByteString SimpleConfig::GetCleanedNextLine( BOOL bReadComments ) aFileStream.ReadLine ( aTmpStr ); if ( aTmpStr.Search( "#" ) == 0 ) + { if (bReadComments ) return aTmpStr; else @@ -138,6 +139,7 @@ ByteString SimpleConfig::GetCleanedNextLine( BOOL bReadComments ) { aFileStream.ReadLine ( aTmpStr ); } + } aTmpStr = aTmpStr.EraseLeadingChars(); aTmpStr = aTmpStr.EraseTrailingChars(); diff --git a/tools/inc/tools/StringListResource.hxx b/tools/inc/tools/StringListResource.hxx new file mode 100644 index 000000000000..6bddcbfa2139 --- /dev/null +++ b/tools/inc/tools/StringListResource.hxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: formcomponenthandler.cxx,v $ + * $Revision: 1.18 $ + * + * 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 TOOLS_STRINGLISTRESOURCE_HXX +#define TOOLS_STRINGLISTRESOURCE_HXX + +#include <vector> +#include <tools/resid.hxx> +#include <tools/rcid.h> +#include <tools/rc.hxx> + +namespace tools +{ + class StringListResource : public Resource + { + public: + StringListResource(const ResId& _aResId,::std::vector< ::rtl::OUString>& _rToFill ) : Resource(_aResId) + { + USHORT i = 1; + while( IsAvailableRes(ResId(i,*m_pResMgr).SetRT(RSC_STRING)) ) + { + String sStr = String(ResId(i,*m_pResMgr)); + _rToFill.push_back(sStr); + ++i; + } + } + ~StringListResource() + { + FreeResource(); + } + }; +} // namespace tools +#endif // TOOLS_STRINGLISTRESOURCE_HXX diff --git a/tools/inc/tools/debug.hxx b/tools/inc/tools/debug.hxx index 775ec73d3286..843f620649a2 100644 --- a/tools/inc/tools/debug.hxx +++ b/tools/inc/tools/debug.hxx @@ -38,16 +38,6 @@ #endif #include <tools/solar.h> -#ifdef HPUX -// Workaround aCC-Compiler (v1.04, v1.06) dtor bug: -// A single ";" as first statement in a dtor -// results in wrong code (check for delete with a -// NULL-pointer missing or unreliable) -#define HPUX_DTOR_BUG (1==1) -#else -#define HPUX_DTOR_BUG -#endif - // ------------ // - DBG_UITL - // ------------ @@ -448,8 +438,6 @@ public: #define DBG_MEMTEST() DbgMemTest() #define DBG_MEMTEST_PTR( p ) DbgMemTest( (void*)p ) -#define DBG_COREDUMP() DbgCoreDump() - #define DBG_PROFSTART( aName ) \ DbgProf( DBG_PROF_START, DBG_FUNC( aName ) ) @@ -485,6 +473,8 @@ public: (const void*)pObj, (DbgUsr)fTest ) #define DBG_ASSERTWARNING( sCon, aWarning ) \ +do \ +{ \ if ( DbgIsAssertWarning() ) \ { \ if ( !( sCon ) ) \ @@ -492,9 +482,12 @@ public: DbgWarning( aWarning, __FILE__, \ __LINE__ ); \ } \ - } + } \ +} while(0) #define DBG_ASSERT( sCon, aError ) \ +do \ +{ \ if ( DbgIsAssert() ) \ { \ if ( !( sCon ) ) \ @@ -502,190 +495,222 @@ public: DbgError( aError, \ __FILE__, __LINE__ ); \ } \ - } + } \ +} while(0) #ifdef DBG_BINFILTER -#define DBG_BF_ASSERT( sCon, aError ) \ +#define DBG_BF_ASSERT( sCon, aError ) \ +do \ +{ \ if ( !( sCon ) ) \ { \ DbgError( aError, \ __FILE__, __LINE__ ); \ - } + } \ +} while(0) #else -#define DBG_BF_ASSERT( sCon, aError ) +#define DBG_BF_ASSERT( sCon, aError ) ((void)0) #endif #define DBG_TRACE( aTrace ) \ +do \ { \ if ( DbgIsTraceOut() ) \ DbgTrace( aTrace ); \ -} +} while(0) #define DBG_TRACE1( aTrace, x1 ) \ +do \ { \ if ( DbgIsTraceOut() ) \ { \ DbgOutTypef( DBG_OUT_TRACE, aTrace, \ x1 ); \ } \ -} +} while(0) #define DBG_TRACE2( aTrace, x1, x2 ) \ +do \ { \ if ( DbgIsTraceOut() ) \ { \ DbgOutTypef( DBG_OUT_TRACE, aTrace, \ x1, x2 ); \ } \ -} +} while(0) #define DBG_TRACE3( aTrace, x1, x2, x3 ) \ +do \ { \ if ( DbgIsTraceOut() ) \ { \ DbgOutTypef( DBG_OUT_TRACE, aTrace, \ x1, x2, x3 ); \ } \ -} +} while(0) #define DBG_TRACE4( aTrace, x1, x2, x3, x4 ) \ +do \ { \ if ( DbgIsTraceOut() ) \ { \ DbgOutTypef( DBG_OUT_TRACE, aTrace, \ x1, x2, x3, x4 ); \ } \ -} +} while(0) #define DBG_TRACE5( aTrace, x1, x2, x3, x4, x5 ) \ +do \ { \ if ( DbgIsTraceOut() ) \ { \ DbgOutTypef( DBG_OUT_TRACE, aTrace, \ x1, x2, x3, x4, x5 ); \ } \ -} +} while(0) #define DBG_TRACEFILE( aTrace ) \ +do \ { \ if ( DbgIsTraceOut() ) \ DbgTrace( aTrace, __FILE__, __LINE__ ); \ -} +} while(0) #define DBG_WARNING( aWarning ) \ +do \ { \ if ( DbgIsWarningOut() ) \ DbgWarning( aWarning ); \ -} +} while(0) #define DBG_WARNING1( aWarning, x1 ) \ +do \ { \ if ( DbgIsWarningOut() ) \ { \ DbgOutTypef( DBG_OUT_WARNING, aWarning, \ x1 ); \ } \ -} +} while(0) #define DBG_WARNING2( aWarning, x1, x2 ) \ +do \ { \ if ( DbgIsWarningOut() ) \ { \ DbgOutTypef( DBG_OUT_WARNING, aWarning, \ x1, x2 ); \ } \ -} +} while(0) #define DBG_WARNING3( aWarning, x1, x2, x3 ) \ +do \ { \ if ( DbgIsWarningOut() ) \ { \ DbgOutTypef( DBG_OUT_WARNING, aWarning, \ x1, x2, x3 ); \ } \ -} +} while(0) #define DBG_WARNING4( aWarning, x1, x2, x3, x4 ) \ +do \ { \ if ( DbgIsWarningOut() ) \ { \ DbgOutTypef( DBG_OUT_WARNING, aWarning, \ x1, x2, x3, x4 ); \ } \ -} +} while(0) #define DBG_WARNING5( aWarning, x1, x2, x3, x4, x5 )\ +do \ { \ if ( DbgIsWarningOut() ) \ { \ DbgOutTypef( DBG_OUT_WARNING, aWarning, \ x1, x2, x3, x4, x5 ); \ } \ -} +} while(0) #define DBG_WARNINGFILE( aWarning ) \ +do \ { \ if ( DbgIsWarningOut() ) \ DbgWarning( aWarning, __FILE__, __LINE__ ); \ -} +} while(0) #define DBG_ERROR( aError ) \ +do \ { \ if ( DbgIsErrorOut() ) \ DbgError( aError ); \ -} +} while(0) #define DBG_ERROR1( aError, x1 ) \ +do \ { \ if ( DbgIsErrorOut() ) \ { \ DbgOutTypef( DBG_OUT_ERROR, aError, \ x1 ); \ } \ -} +} while(0) #define DBG_ERROR2( aError, x1, x2 ) \ +do \ { \ if ( DbgIsErrorOut() ) \ { \ DbgOutTypef( DBG_OUT_ERROR, aError, \ x1, x2 ); \ } \ -} +} while(0) #define DBG_ERROR3( aError, x1, x2, x3 ) \ +do \ { \ if ( DbgIsErrorOut() ) \ { \ DbgOutTypef( DBG_OUT_ERROR, aError, \ x1, x2, x3 ); \ } \ -} +} while(0) #define DBG_ERROR4( aError, x1, x2, x3, x4 ) \ +do \ { \ if ( DbgIsErrorOut() ) \ { \ DbgOutTypef( DBG_OUT_ERROR, aError, \ x1, x2, x3, x4 ); \ } \ -} +} while(0) #define DBG_ERROR5( aError, x1, x2, x3, x4, x5 ) \ +do \ { \ if ( DbgIsErrorOut() ) \ { \ DbgOutTypef( DBG_OUT_ERROR, aError, \ x1, x2, x3, x4, x5 ); \ } \ -} +} while(0) #define DBG_ERRORFILE( aError ) \ +do \ { \ if ( DbgIsErrorOut() ) \ DbgError( aError, __FILE__, __LINE__ ); \ -} +} while(0) -#define DBG_TESTSOLARMUTEX() { DbgTestSolarMutex(); } +#define DBG_TESTSOLARMUTEX() \ +do \ +{ \ + DbgTestSolarMutex(); \ +} while(0) // --- Dbg-Defines (An/Ausschlaten) --- #define DBG_INSTOUTTRACE( nOut ) \ +do \ { \ DbgGetData()->nTraceOut = nOut; \ -} +} while(0) #define DBG_INSTOUTWARNING( nOut ) \ +do \ { \ DbgGetData()->nWarningOut = nOut; \ -} +} while(0) #define DBG_INSTOUTERROR( nOut ) \ +do \ { \ DbgGetData()->nErrorOut = nOut; \ -} +} while(0) #else @@ -700,62 +725,60 @@ struct DbgDataType; typedef void (*DbgPrintLine)( const sal_Char* pLine ); typedef const sal_Char* (*DbgUsr)(const void* pThis ); -#define DBG_DEBUGSTART() -#define DBG_DEBUGEND() -#define DBG_GLOBALDEBUGEND() - -#define DBG_STARTAPPEXECUTE() -#define DBG_ENDAPPEXECUTE() +#define DBG_DEBUGSTART() ((void)0) +#define DBG_DEBUGEND() ((void)0) +#define DBG_GLOBALDEBUGEND() ((void)0) -#define DBG_MEMTEST() HPUX_DTOR_BUG -#define DBG_MEMTEST_PTR( p ) HPUX_DTOR_BUG +#define DBG_STARTAPPEXECUTE() ((void)0) +#define DBG_ENDAPPEXECUTE() ((void)0) -#define DBG_COREDUMP() +#define DBG_MEMTEST() ((void)0) +#define DBG_MEMTEST_PTR( p ) ((void)0) #define DBG_NAME( aName ) #define DBG_NAMEEX( aName ) #define DBG_NAMEEX_VISIBILITY( aName, vis ) -#define DBG_PROFSTART( aName ) -#define DBG_PROFSTOP( aName ) -#define DBG_PROFCONTINUE( aName ) -#define DBG_PROFPAUSE( aName ) - -#define DBG_CTOR( aName, fTest ) -#define DBG_DTOR( aName, fTest ) HPUX_DTOR_BUG -#define DBG_CHKTHIS( aName, fTest ) HPUX_DTOR_BUG -#define DBG_CHKOBJ( pObj, aName, fTest ) HPUX_DTOR_BUG - -#define DBG_ASSERTWARNING( sCon, aWarning ) -#define DBG_ASSERT( sCon, aError ) -#define DBG_BF_ASSERT( sCon, aError ) -#define DBG_TRACE( aTrace ) -#define DBG_TRACE1( aTrace, x1 ) -#define DBG_TRACE2( aTrace, x1, x2 ) -#define DBG_TRACE3( aTrace, x1, x2, x3 ) -#define DBG_TRACE4( aTrace, x1, x2, x3, x4 ) -#define DBG_TRACE5( aTrace, x1, x2, x3, x4, x5 ) -#define DBG_TRACEFILE( aTrace ) -#define DBG_WARNING( aWarning ) -#define DBG_WARNING1( aWarning, x1 ) -#define DBG_WARNING2( aWarning, x1, x2 ) -#define DBG_WARNING3( aWarning, x1, x2, x3 ) -#define DBG_WARNING4( aWarning, x1, x2, x3, x4 ) -#define DBG_WARNING5( aWarning, x1, x2, x3, x4, x5 ) -#define DBG_WARNINGFILE( aWarning ) -#define DBG_ERROR( aError ) -#define DBG_ERROR1( aError, x1 ) -#define DBG_ERROR2( aError, x1, x2 ) -#define DBG_ERROR3( aError, x1, x2, x3 ) -#define DBG_ERROR4( aError, x1, x2, x3, x4 ) -#define DBG_ERROR5( aError, x1, x2, x3, x4, x5 ) -#define DBG_ERRORFILE( aError ) - -#define DBG_TESTSOLARMUTEX() - -#define DBG_INSTOUTTRACE( nOut ) -#define DBG_INSTOUTWARNING( nOut ) -#define DBG_INSTOUTERROR( nOut ) +#define DBG_PROFSTART( aName ) ((void)0) +#define DBG_PROFSTOP( aName ) ((void)0) +#define DBG_PROFCONTINUE( aName ) ((void)0) +#define DBG_PROFPAUSE( aName ) ((void)0) + +#define DBG_CTOR( aName, fTest ) ((void)0) +#define DBG_DTOR( aName, fTest ) ((void)0) +#define DBG_CHKTHIS( aName, fTest ) ((void)0) +#define DBG_CHKOBJ( pObj, aName, fTest ) ((void)0) + +#define DBG_ASSERTWARNING( sCon, aWarning ) ((void)0) +#define DBG_ASSERT( sCon, aError ) ((void)0) +#define DBG_BF_ASSERT( sCon, aError ) ((void)0) +#define DBG_TRACE( aTrace ) ((void)0) +#define DBG_TRACE1( aTrace, x1 ) ((void)0) +#define DBG_TRACE2( aTrace, x1, x2 ) ((void)0) +#define DBG_TRACE3( aTrace, x1, x2, x3 ) ((void)0) +#define DBG_TRACE4( aTrace, x1, x2, x3, x4 ) ((void)0) +#define DBG_TRACE5( aTrace, x1, x2, x3, x4, x5 ) ((void)0) +#define DBG_TRACEFILE( aTrace ) ((void)0) +#define DBG_WARNING( aWarning ) ((void)0) +#define DBG_WARNING1( aWarning, x1 ) ((void)0) +#define DBG_WARNING2( aWarning, x1, x2 ) ((void)0) +#define DBG_WARNING3( aWarning, x1, x2, x3 ) ((void)0) +#define DBG_WARNING4( aWarning, x1, x2, x3, x4 ) ((void)0) +#define DBG_WARNING5( aWarning, x1, x2, x3, x4, x5 ) ((void)0) +#define DBG_WARNINGFILE( aWarning ) ((void)0) +#define DBG_ERROR( aError ) ((void)0) +#define DBG_ERROR1( aError, x1 ) ((void)0) +#define DBG_ERROR2( aError, x1, x2 ) ((void)0) +#define DBG_ERROR3( aError, x1, x2, x3 ) ((void)0) +#define DBG_ERROR4( aError, x1, x2, x3, x4 ) ((void)0) +#define DBG_ERROR5( aError, x1, x2, x3, x4, x5 ) ((void)0) +#define DBG_ERRORFILE( aError ) ((void)0) + +#define DBG_TESTSOLARMUTEX() ((void)0) + +#define DBG_INSTOUTTRACE( nOut ) ((void)0) +#define DBG_INSTOUTWARNING( nOut ) ((void)0) +#define DBG_INSTOUTERROR( nOut ) ((void)0) #endif diff --git a/tools/inc/tools/inetmime.hxx b/tools/inc/tools/inetmime.hxx index 2b1cfc3cd567..16bbd348a28b 100644 --- a/tools/inc/tools/inetmime.hxx +++ b/tools/inc/tools/inetmime.hxx @@ -694,13 +694,13 @@ inline bool INetMIME::isDigit(sal_uInt32 nChar) // static inline bool INetMIME::isCanonicHexDigit(sal_uInt32 nChar) { - return isDigit(nChar) || nChar >= 'A' && nChar <= 'F'; + return isDigit(nChar) || (nChar >= 'A' && nChar <= 'F'); } // static inline bool INetMIME::isHexDigit(sal_uInt32 nChar) { - return isCanonicHexDigit(nChar) || nChar >= 'a' && nChar <= 'f'; + return isCanonicHexDigit(nChar) || (nChar >= 'a' && nChar <= 'f'); } // static @@ -790,8 +790,8 @@ inline sal_uInt32 INetMIME::toUTF32(sal_Unicode cHighSurrogate, DBG_ASSERT(isHighSurrogate(cHighSurrogate) && isLowSurrogate(cLowSurrogate), "INetMIME::toUTF32(): Bad chars"); - return (sal_uInt32(cHighSurrogate) & 0x3FF) << 10 - | sal_uInt32(cLowSurrogate) & 0x3FF; + return ((sal_uInt32(cHighSurrogate) & 0x3FF) << 10) + | (sal_uInt32(cLowSurrogate) & 0x3FF); } // static @@ -930,8 +930,8 @@ inline sal_Unicode * INetMIME::putUTF32Character(sal_Unicode * pBuffer, else { nUTF32 -= 0x10000; - *pBuffer++ = sal_Unicode(0xD800 | nUTF32 >> 10); - *pBuffer++ = sal_Unicode(0xDC00 | nUTF32 & 0x3FF); + *pBuffer++ = sal_Unicode(0xD800 | (nUTF32 >> 10)); + *pBuffer++ = sal_Unicode(0xDC00 | (nUTF32 & 0x3FF)); } return pBuffer; } diff --git a/tools/inc/tools/rtti.hxx b/tools/inc/tools/rtti.hxx index e19724ab8c48..e1d69e020157 100644 --- a/tools/inc/tools/rtti.hxx +++ b/tools/inc/tools/rtti.hxx @@ -45,6 +45,13 @@ typedef void* (*TypeId)(); virtual TypeId Type() const; \ virtual BOOL IsA( TypeId aSameOrSuperType ) const +#define TYPEINFO_VISIBILITY(visibility) \ + visibility static void* CreateType(); \ + visibility static TypeId StaticType(); \ + visibility static BOOL IsOf( TypeId aSameOrSuperType ); \ + visibility virtual TypeId Type() const; \ + visibility virtual BOOL IsA( TypeId aSameOrSuperType ) const + #define TYPEINIT_FACTORY(sType, Factory ) \ void* sType::CreateType() { return Factory; } \ TypeId sType::StaticType() { return &CreateType; } \ diff --git a/tools/prj/d.lst b/tools/prj/d.lst index 83caeb822203..660afffc37e9 100644 --- a/tools/prj/d.lst +++ b/tools/prj/d.lst @@ -73,6 +73,7 @@ mkdir: %_DEST%\inc%_EXT%\bootstrp ..\inc\tools\ref.hxx %_DEST%\inc%_EXT%\tools\ref.hxx ..\inc\tools\resid.hxx %_DEST%\inc%_EXT%\tools\resid.hxx ..\inc\tools\resmgr.hxx %_DEST%\inc%_EXT%\tools\resmgr.hxx +..\inc\tools\StringListResource.hxx %_DEST%\inc%_EXT%\tools\StringListResource.hxx ..\inc\tools\isofallback.hxx %_DEST%\inc%_EXT%\tools\isofallback.hxx ..\inc\tools\rtti.hxx %_DEST%\inc%_EXT%\tools\rtti.hxx ..\inc\tools\shl.hxx %_DEST%\inc%_EXT%\tools\shl.hxx diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx index 9820918cfdf6..7f204d5e46da 100644 --- a/tools/source/datetime/tdate.cxx +++ b/tools/source/datetime/tdate.cxx @@ -65,7 +65,10 @@ static USHORT aDaysInMonth[12] = { 31, 28, 31, 30, 31, 30, inline BOOL ImpIsLeapYear( USHORT nYear ) { - return (((nYear % 4) == 0) && ((nYear % 100) != 0) || ((nYear % 400) == 0)); + return ( + ( ((nYear % 4) == 0) && ((nYear % 100) != 0) ) || + ( (nYear % 400) == 0 ) + ); } // ----------------------------------------------------------------------- @@ -76,8 +79,7 @@ inline USHORT DaysInMonth( USHORT nMonth, USHORT nYear ) return aDaysInMonth[nMonth-1]; else { - if ( ((nYear % 4) == 0) && ((nYear % 100) != 0) || - ((nYear % 400) == 0) ) + if (ImpIsLeapYear(nYear)) return aDaysInMonth[nMonth-1] + 1; else return aDaysInMonth[nMonth-1]; diff --git a/tools/source/fsys/dirent.cxx b/tools/source/fsys/dirent.cxx index 935ab4db9ecc..cb08d2df6c1e 100644 --- a/tools/source/fsys/dirent.cxx +++ b/tools/source/fsys/dirent.cxx @@ -2462,9 +2462,13 @@ BOOL IsValidEntry_Impl( const DirEntry &rPath, // 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 ) + if ( + rLongName.Search(DirEntry::GetAccessDelimiter()) != STRING_NOTFOUND || + (!bIsShortened && rLongName.Search(cDelim) != STRING_NOTFOUND) + ) + { return FALSE; + } // MI: Abfrage nach 'CON:' etc. wird jetzt in Exists() mitgemacht if ( aPath.Exists() ) diff --git a/tools/source/fsys/os2.cxx b/tools/source/fsys/os2.cxx index 6357c9746306..fd5ffa9291a3 100644 --- a/tools/source/fsys/os2.cxx +++ b/tools/source/fsys/os2.cxx @@ -38,9 +38,9 @@ #include <malloc.h> #endif #include <tools/debug.hxx> -#include <list.hxx> +#include <tools/list.hxx> #include <tools/bigint.hxx> -#include <fsys.hxx> +#include <tools/fsys.hxx> #include "comdep.hxx" #ifdef OS2 diff --git a/tools/source/fsys/tdir.cxx b/tools/source/fsys/tdir.cxx index dc487c561919..30b1db33904d 100644 --- a/tools/source/fsys/tdir.cxx +++ b/tools/source/fsys/tdir.cxx @@ -736,14 +736,15 @@ Dir& Dir::operator+=( const Dir& rDir ) } while ( !bStat && pSortLst->Next() ); } FileStat * stat = NULL; - for ( USHORT nNr = 0; nNr < rDir.Count(); nNr++ ) { + for ( USHORT nNr = 0; nNr < rDir.Count(); nNr++ ) + { if ( bStat ) + { if ( rDir.pStatLst ) - { stat = new FileStat( *rDir.pStatLst->GetObject(nNr) ); - } else stat = new FileStat( rDir[nNr] ); + } ImpSortedInsert( new DirEntry( rDir[nNr] ), stat ); } return *this; diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index f8c30ec21aa3..e3484aee4e2d 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -808,10 +808,12 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, sal_Int32 n = rtl_ustr_indexOfChar_WithLength( p1, pEnd - p1, '\\'); sal_Unicode const * pe = n == -1 ? pEnd : p1 + n; - if (parseHostOrNetBiosName( + if ( + parseHostOrNetBiosName( p1, pe, bOctets, ENCODE_ALL, RTL_TEXTENCODING_DONTKNOW, true, NULL) || - scanDomain(p1, pe) > 0 && p1 == pe) + (scanDomain(p1, pe) > 0 && p1 == pe) + ) { m_eScheme = INET_PROT_FILE; // 7th eMechanism = ENCODE_ALL; @@ -1020,12 +1022,16 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, if (pEnd - pPos >= 2 && pPos[0] == '/' && pPos[1] == '/') { sal_Unicode const * p1 = pPos + 2; - if (p1 == pEnd || *p1 == nFragmentDelimiter - || *p1 == '/' - || (scanDomain(p1, pEnd) > 0 - || scanIPv6reference(p1, pEnd)) - && (p1 == pEnd || *p1 == nFragmentDelimiter - || *p1 == '/')) + if ( + p1 == pEnd || *p1 == nFragmentDelimiter || *p1 == '/' || + ( + ( + scanDomain(p1, pEnd) > 0 || + scanIPv6reference(p1, pEnd) + ) && + (p1 == pEnd || *p1 == nFragmentDelimiter || *p1 == '/') + ) + ) { aSynAbsURIRef. appendAscii(RTL_CONSTASCII_STRINGPARAM("//")); @@ -1096,10 +1102,12 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, { ++pe; } - if (parseHostOrNetBiosName( + if ( + parseHostOrNetBiosName( p1, pe, bOctets, ENCODE_ALL, RTL_TEXTENCODING_DONTKNOW, true, NULL) || - scanDomain(p1, pe) > 0 && p1 == pe) + (scanDomain(p1, pe) > 0 && p1 == pe) + ) { aSynAbsURIRef. appendAscii(RTL_CONSTASCII_STRINGPARAM("//")); @@ -1261,6 +1269,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, cEscapePrefix, eMechanism, eCharset, eEscapeType); if (eEscapeType == ESCAPE_NO) + { if (nUTF32 == ':' && bSupportsPassword) { bHasAuth = true; @@ -1278,12 +1287,14 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, bHasAuth = true; break; } + } appendUCS4(aSynUser, nUTF32, eEscapeType, bOctets, ePart, cEscapePrefix, eCharset, false); } m_aUser.set(aSynAbsURIRef, aSynUser.makeStringAndClear(), aSynAbsURIRef.getLength()); if (bHasAuth) + { if (bSupportsPassword) { aSynAbsURIRef.append(sal_Unicode(':')); @@ -1324,6 +1335,7 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef, m_aAuth.set(aSynAbsURIRef, aSynAuth.makeStringAndClear(), aSynAbsURIRef.getLength()); } + } if (pHostPortBegin) aSynAbsURIRef.append(sal_Unicode('@')); } @@ -1604,6 +1616,7 @@ bool INetURLObject::convertRelToAbs(rtl::OUString const & rTheRelURIRef, bool bSameDoc = true; if (getSchemeInfo().m_bAuthority) + { if (pEnd - p >= 2 && p[0] == '/' && p[1] == '/') { aSynAbsURIRef.appendAscii(RTL_CONSTASCII_STRINGPARAM("//")); @@ -1617,6 +1630,7 @@ bool INetURLObject::convertRelToAbs(rtl::OUString const & rTheRelURIRef, = getUTF32(p, pEnd, bOctets, cEscapePrefix, eMechanism, eCharset, eEscapeType); if (eEscapeType == ESCAPE_NO) + { if (nUTF32 == nSegmentDelimiter) break; else if (nUTF32 == nFragmentDelimiter) @@ -1624,6 +1638,7 @@ bool INetURLObject::convertRelToAbs(rtl::OUString const & rTheRelURIRef, eState = STATE_FRAGMENT; break; } + } appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, bOctets, PART_VISIBLE, cEscapePrefix, eCharset, true); } @@ -1635,8 +1650,10 @@ bool INetURLObject::convertRelToAbs(rtl::OUString const & rTheRelURIRef, + aAuthority.getBegin(), aAuthority.getLength()); } + } if (eState == STATE_AUTH) + { if (p == pEnd) eState = STATE_DONE; else if (*p == nFragmentDelimiter) @@ -1655,6 +1672,7 @@ bool INetURLObject::convertRelToAbs(rtl::OUString const & rTheRelURIRef, eState = STATE_REL_PATH; bSameDoc = false; } + } if (eState == STATE_ABS_PATH) { @@ -1667,6 +1685,7 @@ bool INetURLObject::convertRelToAbs(rtl::OUString const & rTheRelURIRef, = getUTF32(p, pEnd, bOctets, cEscapePrefix, eMechanism, eCharset, eEscapeType); if (eEscapeType == ESCAPE_NO) + { if (nUTF32 == nFragmentDelimiter) { eState = STATE_FRAGMENT; @@ -1674,6 +1693,7 @@ bool INetURLObject::convertRelToAbs(rtl::OUString const & rTheRelURIRef, } else if (nUTF32 == nSegmentDelimiter) nUTF32 = '/'; + } appendUCS4(aSynAbsURIRef, nUTF32, eEscapeType, bOctets, ePart, cEscapePrefix, eCharset, true); } @@ -1710,6 +1730,7 @@ bool INetURLObject::convertRelToAbs(rtl::OUString const & rTheRelURIRef, while (p != pEnd && *p != nQueryDelimiter && *p != nFragmentDelimiter) { if (*p == '.') + { if (pEnd - p == 1 || p[1] == nSegmentDelimiter || p[1] == nQueryDelimiter @@ -1743,6 +1764,7 @@ bool INetURLObject::convertRelToAbs(rtl::OUString const & rTheRelURIRef, "INetURLObject::convertRelToAbs(): Bad base path"); continue; } + } while (p != pEnd && *p != nSegmentDelimiter @@ -1942,19 +1964,27 @@ bool INetURLObject::convertAbsToRel(rtl::OUString const & rTheAbsURIRef, // with <1*rseg> (i.e., it could be mistaken for an absolute URL starting // with a scheme part), then the new relative URL is prefixed with "./": if (aSynRelURIRef.getLength() == 0) + { if (pSubjectPathEnd - pSubjectPathBegin >= nMatch + 2 && pSubjectPathBegin[nMatch] == '/' && pSubjectPathBegin[nMatch + 1] == '/') + { aSynRelURIRef.appendAscii(RTL_CONSTASCII_STRINGPARAM("./")); + } else + { for (sal_Unicode const * p = pSubjectPathBegin + nMatch; p != pSubjectPathEnd && *p != '/'; ++p) + { if (mustEncode(*p, PART_REL_SEGMENT_EXTRA)) { aSynRelURIRef. appendAscii(RTL_CONSTASCII_STRINGPARAM("./")); break; } + } + } + } // The remainder of the subject path, starting at nMatch, is appended to // the new relative URL: @@ -2211,9 +2241,14 @@ bool INetURLObject::setUser(rtl::OUString const & rTheUser, bool bOctets, EncodeMechanism eMechanism, rtl_TextEncoding eCharset) { - if (!getSchemeInfo().m_bUser - || m_eScheme == INET_PROT_IMAP && rTheUser.getLength() == 0) + if ( + !getSchemeInfo().m_bUser || + (m_eScheme == INET_PROT_IMAP && rTheUser.getLength() == 0) + ) + { return false; + } + rtl::OUString aNewUser(encodeText(rTheUser, bOctets, m_eScheme == INET_PROT_IMAP ? PART_IMAP_ACHAR : @@ -2766,6 +2801,7 @@ bool INetURLObject::parseHostOrNetBiosName( { sal_Unicode const * p = pBegin; if (!parseHost(p, pEnd, aTheCanonic) || p != pEnd) + { if (bNetBiosName) { rtl::OUStringBuffer buf; @@ -2808,6 +2844,7 @@ bool INetURLObject::parseHostOrNetBiosName( } else return false; + } } if (pCanonic != NULL) { *pCanonic = aTheCanonic; @@ -2961,6 +2998,7 @@ bool INetURLObject::parsePath(INetProtocol eScheme, '%', eMechanism, eCharset, eEscapeType); if (eEscapeType == ESCAPE_NO) + { if (nUTF32 == nSegmentDelimiter || nUTF32 == nAltSegmentDelimiter) { @@ -2980,6 +3018,7 @@ bool INetURLObject::parsePath(INetProtocol eScheme, aTheSynPath.append(sal_Unicode(':')); continue; } + } appendUCS4(aTheSynPath, nUTF32, eEscapeType, bOctets, PART_PCHAR, '%', eCharset, true); } @@ -3299,10 +3338,12 @@ bool INetURLObject::parsePath(INetProtocol eScheme, case INET_PROT_VND_SUN_STAR_ODMA: if (pPos < pEnd) + { if (*pPos == '/') ++pPos; else return false; + } aTheSynPath.append(sal_Unicode('/')); while (pPos < pEnd && *pPos != nFragmentDelimiter) { @@ -3484,8 +3525,9 @@ bool INetURLObject::insertName(rtl::OUString const & rTheName, bool bOctets, else if (nIndex == 0) { pPrefixEnd = pPathBegin; - bInsertSlash = pPathBegin < pPathEnd && *pPathBegin != '/' || - pPathBegin == pPathEnd && bAppendFinalSlash; + bInsertSlash = + (pPathBegin < pPathEnd && *pPathBegin != '/') || + (pPathBegin == pPathEnd && bAppendFinalSlash); pSuffixBegin = (pPathEnd - pPathBegin == 1 && *pPathBegin == '/' && !bAppendFinalSlash && bIgnoreFinalSlash) @@ -3503,11 +3545,11 @@ bool INetURLObject::insertName(rtl::OUString const & rTheName, bool bOctets, while (nIndex-- > 0) for (;;) { - if (bSkip) { + if (bSkip) ++pPrefixEnd; - } bSkip = true; if (pPrefixEnd >= pEnd) + { if (nIndex == 0) { bInsertSlash = bAppendFinalSlash; @@ -3515,6 +3557,7 @@ bool INetURLObject::insertName(rtl::OUString const & rTheName, bool bOctets, } else return false; + } if (*pPrefixEnd == '/') { pSuffixBegin = pPrefixEnd; @@ -3729,11 +3772,19 @@ rtl::OUString INetURLObject::decode(sal_Unicode const * pBegin, break; case ESCAPE_UTF32: - if (INetMIME::isUSASCII(nUTF32) - && (eMechanism == DECODE_TO_IURI - || eMechanism == DECODE_UNAMBIGUOUS - && mustEncode(nUTF32, PART_UNAMBIGUOUS))) + if ( + INetMIME::isUSASCII(nUTF32) && + ( + eMechanism == DECODE_TO_IURI || + ( + eMechanism == DECODE_UNAMBIGUOUS && + mustEncode(nUTF32, PART_UNAMBIGUOUS) + ) + ) + ) + { appendEscape(aResult, cEscapePrefix, nUTF32); + } else aResult.append(sal_Unicode(nUTF32)); break; @@ -4081,6 +4132,7 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme, return false; } if (rThePassword.getLength() != 0) + { if (getSchemeInfo().m_bPassword) { m_aAbsURIRef.append(sal_Unicode(':')); @@ -4098,6 +4150,7 @@ bool INetURLObject::ConcatData(INetProtocol eTheScheme, setInvalid(); return false; } + } if (bUserInfo && getSchemeInfo().m_bHost) m_aAbsURIRef.append(sal_Unicode('@')); if (getSchemeInfo().m_bHost) @@ -4903,9 +4956,9 @@ rtl::OUString INetURLObject::getFSysPath(FSysStyle eStyle, && m_aHost.getLength() > 0 ? FSYS_VOS : hasDosVolume(eStyle) - || (eStyle & FSYS_DOS) != 0 + || ((eStyle & FSYS_DOS) != 0 && m_aHost.isPresent() - && m_aHost.getLength() > 0 ? + && m_aHost.getLength() > 0) ? FSYS_DOS : eStyle & FSYS_UNX && (!m_aHost.isPresent() || m_aHost.getLength() == 0) ? @@ -5050,37 +5103,37 @@ void INetURLObject::appendUCS4Escape(rtl::OUStringBuffer & rTheText, else if (nUCS4 < 0x800) { appendEscape(rTheText, cEscapePrefix, nUCS4 >> 6 | 0xC0); - appendEscape(rTheText, cEscapePrefix, nUCS4 & 0x3F | 0x80); + appendEscape(rTheText, cEscapePrefix, (nUCS4 & 0x3F) | 0x80); } else if (nUCS4 < 0x10000) { appendEscape(rTheText, cEscapePrefix, nUCS4 >> 12 | 0xE0); - appendEscape(rTheText, cEscapePrefix, nUCS4 >> 6 & 0x3F | 0x80); - appendEscape(rTheText, cEscapePrefix, nUCS4 & 0x3F | 0x80); + appendEscape(rTheText, cEscapePrefix, (nUCS4 >> 6 & 0x3F) | 0x80); + appendEscape(rTheText, cEscapePrefix, (nUCS4 & 0x3F) | 0x80); } else if (nUCS4 < 0x200000) { appendEscape(rTheText, cEscapePrefix, nUCS4 >> 18 | 0xF0); - appendEscape(rTheText, cEscapePrefix, nUCS4 >> 12 & 0x3F | 0x80); - appendEscape(rTheText, cEscapePrefix, nUCS4 >> 6 & 0x3F | 0x80); - appendEscape(rTheText, cEscapePrefix, nUCS4 & 0x3F | 0x80); + appendEscape(rTheText, cEscapePrefix, (nUCS4 >> 12 & 0x3F) | 0x80); + appendEscape(rTheText, cEscapePrefix, (nUCS4 >> 6 & 0x3F) | 0x80); + appendEscape(rTheText, cEscapePrefix, (nUCS4 & 0x3F) | 0x80); } else if (nUCS4 < 0x4000000) { appendEscape(rTheText, cEscapePrefix, nUCS4 >> 24 | 0xF8); - appendEscape(rTheText, cEscapePrefix, nUCS4 >> 18 & 0x3F | 0x80); - appendEscape(rTheText, cEscapePrefix, nUCS4 >> 12 & 0x3F | 0x80); - appendEscape(rTheText, cEscapePrefix, nUCS4 >> 6 & 0x3F | 0x80); - appendEscape(rTheText, cEscapePrefix, nUCS4 & 0x3F | 0x80); + appendEscape(rTheText, cEscapePrefix, (nUCS4 >> 18 & 0x3F) | 0x80); + appendEscape(rTheText, cEscapePrefix, (nUCS4 >> 12 & 0x3F) | 0x80); + appendEscape(rTheText, cEscapePrefix, (nUCS4 >> 6 & 0x3F) | 0x80); + appendEscape(rTheText, cEscapePrefix, (nUCS4 & 0x3F) | 0x80); } else { appendEscape(rTheText, cEscapePrefix, nUCS4 >> 30 | 0xFC); - appendEscape(rTheText, cEscapePrefix, nUCS4 >> 24 & 0x3F | 0x80); - appendEscape(rTheText, cEscapePrefix, nUCS4 >> 18 & 0x3F | 0x80); - appendEscape(rTheText, cEscapePrefix, nUCS4 >> 12 & 0x3F | 0x80); - appendEscape(rTheText, cEscapePrefix, nUCS4 >> 6 & 0x3F | 0x80); - appendEscape(rTheText, cEscapePrefix, nUCS4 & 0x3F | 0x80); + appendEscape(rTheText, cEscapePrefix, (nUCS4 >> 24 & 0x3F) | 0x80); + appendEscape(rTheText, cEscapePrefix, (nUCS4 >> 18 & 0x3F) | 0x80); + appendEscape(rTheText, cEscapePrefix, (nUCS4 >> 12 & 0x3F) | 0x80); + appendEscape(rTheText, cEscapePrefix, (nUCS4 >> 6 & 0x3F) | 0x80); + appendEscape(rTheText, cEscapePrefix, (nUCS4 & 0x3F) | 0x80); } } @@ -5313,6 +5366,7 @@ sal_uInt32 INetURLObject::scanDomain(sal_Unicode const *& rBegin, case STATE_LABEL: if (p != pEnd) + { if (INetMIME::isAlphanumeric(*p)) break; else if (*p == '.') @@ -5326,11 +5380,13 @@ sal_uInt32 INetURLObject::scanDomain(sal_Unicode const *& rBegin, eState = STATE_HYPHEN; break; } + } rBegin = p; return nLabels; case STATE_HYPHEN: if (p != pEnd) + { if (INetMIME::isAlphanumeric(*p)) { eState = STATE_LABEL; @@ -5338,6 +5394,7 @@ sal_uInt32 INetURLObject::scanDomain(sal_Unicode const *& rBegin, } else if (*p == '-') break; + } if (bEager) return 0; rBegin = pLastAlphanumeric; @@ -5353,7 +5410,7 @@ bool INetURLObject::scanIPv6reference(sal_Unicode const *& rBegin, if (rBegin != pEnd && *rBegin == '[') { sal_Unicode const * p = rBegin + 1; //TODO: check for valid IPv6address (RFC 2373): - while (p != pEnd && INetMIME::isHexDigit(*p) || *p == ':' || *p == '.') + while (p != pEnd && (INetMIME::isHexDigit(*p) || *p == ':' || *p == '.')) { ++p; } diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx index 02a2e810d676..9b94464d7949 100644 --- a/tools/source/inet/inetmime.cxx +++ b/tools/source/inet/inetmime.cxx @@ -272,6 +272,7 @@ Parameter ** ParameterList::find(ByteString const & rAttribute, if (eCompare == COMPARE_GREATER) break; else if (eCompare == COMPARE_EQUAL) + { if (nSection > (*p)->m_nSection) break; else if (nSection == (*p)->m_nSection) @@ -279,6 +280,7 @@ Parameter ** ParameterList::find(ByteString const & rAttribute, rPresent = true; return p; } + } } rPresent = false; return p; @@ -877,7 +879,7 @@ bool INetMIME::scanUnsigned(const sal_Char *& rBegin, const sal_Char * pEnd, if (nTheValue > std::numeric_limits< sal_uInt32 >::max()) return false; } - if (nTheValue == 0 && (p == rBegin || !bLeadingZeroes && p - rBegin != 1)) + if (nTheValue == 0 && (p == rBegin || (!bLeadingZeroes && p - rBegin != 1))) return false; rBegin = p; rValue = sal_uInt32(nTheValue); @@ -901,7 +903,7 @@ bool INetMIME::scanUnsigned(const sal_Unicode *& rBegin, if (nTheValue > std::numeric_limits< sal_uInt32 >::max()) return false; } - if (nTheValue == 0 && (p == rBegin || !bLeadingZeroes && p - rBegin != 1)) + if (nTheValue == 0 && (p == rBegin || (!bLeadingZeroes && p - rBegin != 1))) return false; rBegin = p; rValue = sal_uInt32(nTheValue); @@ -925,7 +927,7 @@ bool INetMIME::scanUnsignedHex(const sal_Char *& rBegin, if (nTheValue > std::numeric_limits< sal_uInt32 >::max()) return false; } - if (nTheValue == 0 && (p == rBegin || !bLeadingZeroes && p - rBegin != 1)) + if (nTheValue == 0 && (p == rBegin || (!bLeadingZeroes && p - rBegin != 1))) return false; rBegin = p; rValue = sal_uInt32(nTheValue); @@ -949,7 +951,7 @@ bool INetMIME::scanUnsignedHex(const sal_Unicode *& rBegin, if (nTheValue > std::numeric_limits< sal_uInt32 >::max()) return false; } - if (nTheValue == 0 && (p == rBegin || !bLeadingZeroes && p - rBegin != 1)) + if (nTheValue == 0 && (p == rBegin || (!bLeadingZeroes && p - rBegin != 1))) return false; rBegin = p; rValue = sal_uInt32(nTheValue); @@ -1004,6 +1006,7 @@ const sal_Char * INetMIME::scanQuotedBlock(const sal_Char * pBegin, case '\\': ++rLength; if (pBegin != pEnd) + { if (startsWithLineBreak(pBegin, pEnd) && (pEnd - pBegin < 3 || !isWhiteSpace(pBegin[2]))) @@ -1014,6 +1017,7 @@ const sal_Char * INetMIME::scanQuotedBlock(const sal_Char * pBegin, } else ++pBegin; + } break; default: @@ -1075,6 +1079,7 @@ const sal_Unicode * INetMIME::scanQuotedBlock(const sal_Unicode * pBegin, case '\\': ++rLength; if (pBegin != pEnd) + { if (startsWithLineBreak(pBegin, pEnd) && (pEnd - pBegin < 3 || !isWhiteSpace(pBegin[2]))) @@ -1085,6 +1090,7 @@ const sal_Unicode * INetMIME::scanQuotedBlock(const sal_Unicode * pBegin, } else ++pBegin; + } break; default: @@ -2141,29 +2147,29 @@ void INetMIME::writeUTF8(INetMIMEOutputSink & rSink, sal_uInt32 nChar) rSink << sal_Char(nChar); else if (nChar < 0x800) rSink << sal_Char(nChar >> 6 | 0xC0) - << sal_Char(nChar & 0x3F | 0x80); + << sal_Char((nChar & 0x3F) | 0x80); else if (nChar < 0x10000) rSink << sal_Char(nChar >> 12 | 0xE0) - << sal_Char(nChar >> 6 & 0x3F | 0x80) - << sal_Char(nChar & 0x3F | 0x80); + << sal_Char((nChar >> 6 & 0x3F) | 0x80) + << sal_Char((nChar & 0x3F) | 0x80); else if (nChar < 0x200000) rSink << sal_Char(nChar >> 18 | 0xF0) - << sal_Char(nChar >> 12 & 0x3F | 0x80) - << sal_Char(nChar >> 6 & 0x3F | 0x80) - << sal_Char(nChar & 0x3F | 0x80); + << sal_Char((nChar >> 12 & 0x3F) | 0x80) + << sal_Char((nChar >> 6 & 0x3F) | 0x80) + << sal_Char((nChar & 0x3F) | 0x80); else if (nChar < 0x4000000) rSink << sal_Char(nChar >> 24 | 0xF8) - << sal_Char(nChar >> 18 & 0x3F | 0x80) - << sal_Char(nChar >> 12 & 0x3F | 0x80) - << sal_Char(nChar >> 6 & 0x3F | 0x80) - << sal_Char(nChar & 0x3F | 0x80); + << sal_Char((nChar >> 18 & 0x3F) | 0x80) + << sal_Char((nChar >> 12 & 0x3F) | 0x80) + << sal_Char((nChar >> 6 & 0x3F) | 0x80) + << sal_Char((nChar & 0x3F) | 0x80); else rSink << sal_Char(nChar >> 30 | 0xFC) - << sal_Char(nChar >> 24 & 0x3F | 0x80) - << sal_Char(nChar >> 18 & 0x3F | 0x80) - << sal_Char(nChar >> 12 & 0x3F | 0x80) - << sal_Char(nChar >> 6 & 0x3F | 0x80) - << sal_Char(nChar & 0x3F | 0x80); + << sal_Char((nChar >> 24 & 0x3F) | 0x80) + << sal_Char((nChar >> 18 & 0x3F) | 0x80) + << sal_Char((nChar >> 12 & 0x3F) | 0x80) + << sal_Char((nChar >> 6 & 0x3F) | 0x80) + << sal_Char((nChar & 0x3F) | 0x80); } //============================================================================ @@ -2673,11 +2679,11 @@ void INetMIME::writeHeaderFieldBody(INetMIMEOutputSink & rSink, || *pLookAhead == '[' : *pLookAhead == '.' || *pLookAhead == '@' - || *pLookAhead == '>' + || (*pLookAhead == '>' && eType >= HEADER_FIELD_MESSAGE_ID && eBrackets - == BRACKETS_OPENING)) + == BRACKETS_OPENING))) { bModify = true; pBodyPtr = pLookAhead; @@ -3025,7 +3031,7 @@ bool INetMIME::translateUTF8Char(const sal_Char *& rBegin, for (; nCount-- > 0; ++p) if ((static_cast< unsigned char >(*p) & 0xC0) == 0x80) - nUCS4 = nUCS4 << 6 | static_cast< unsigned char >(*p) & 0x3F; + nUCS4 = (nUCS4 << 6) | (static_cast< unsigned char >(*p) & 0x3F); else return false; @@ -3177,9 +3183,11 @@ UniString INetMIME::decodeHeaderFieldBody(HeaderFieldType eType, bool bEncodingB = false; if (bEncodedWord) + { if (q == pEnd) bEncodedWord = false; else + { switch (*q++) { case 'B': @@ -3196,12 +3204,16 @@ UniString INetMIME::decodeHeaderFieldBody(HeaderFieldType eType, bEncodedWord = false; break; } + } + } bEncodedWord = bEncodedWord && q != pEnd && *q++ == '?'; ByteString sText; if (bEncodedWord) + { if (bEncodingB) + { for (bool bDone = false; !bDone;) { if (pEnd - q < 4) @@ -3259,6 +3271,7 @@ UniString INetMIME::decodeHeaderFieldBody(HeaderFieldType eType, } } } + } else { const sal_Char * pEncodedTextBegin = q; @@ -3333,6 +3346,7 @@ UniString INetMIME::decodeHeaderFieldBody(HeaderFieldType eType, } } } + } bEncodedWord = bEncodedWord && q != pEnd && *q++ == '='; @@ -4180,40 +4194,40 @@ void INetMIMEEncodedWordOutputSink::finish(bool bWriteTrailer) else if (nUTF32 < 0x800) { INetMIME::writeEscapeSequence(m_rSink, - nUTF32 >> 6 + (nUTF32 >> 6) | 0xC0); INetMIME::writeEscapeSequence(m_rSink, - nUTF32 & 0x3F + (nUTF32 & 0x3F) | 0x80); } else if (nUTF32 < 0x10000) { INetMIME::writeEscapeSequence(m_rSink, - nUTF32 >> 12 + (nUTF32 >> 12) | 0xE0); INetMIME::writeEscapeSequence(m_rSink, - nUTF32 >> 6 - & 0x3F + ((nUTF32 >> 6) + & 0x3F) | 0x80); INetMIME::writeEscapeSequence(m_rSink, - nUTF32 & 0x3F + (nUTF32 & 0x3F) | 0x80); } else { INetMIME::writeEscapeSequence(m_rSink, - nUTF32 >> 18 + (nUTF32 >> 18) | 0xF0); INetMIME::writeEscapeSequence(m_rSink, - nUTF32 >> 12 - & 0x3F + ((nUTF32 >> 12) + & 0x3F) | 0x80); INetMIME::writeEscapeSequence(m_rSink, - nUTF32 >> 6 - & 0x3F + ((nUTF32 >> 6) + & 0x3F) | 0x80); INetMIME::writeEscapeSequence(m_rSink, - nUTF32 & 0x3F + (nUTF32 & 0x3F) | 0x80); } } diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx index f3eef50fbc4b..8c9293e334c1 100644 --- a/tools/source/rc/resmgr.cxx +++ b/tools/source/rc/resmgr.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: resmgr.cxx,v $ - * $Revision: 1.53 $ + * $Revision: 1.52.30.2 $ * * This file is part of OpenOffice.org. * @@ -275,6 +275,10 @@ void ResMgrContainer::init() OUStringToOString( it->second.aFileURL, osl_getThreadTextEncoding() ).getStr() ); } #endif + + // set default language + LanguageType nLang = MsLangId::getSystemUILanguage(); + MsLangId::convertLanguageToLocale(nLang, m_aDefLocale); } InternalResMgr* ResMgrContainer::getResMgr( const OUString& rPrefix, @@ -1567,7 +1571,7 @@ const char* ResMgr::GetLang( LanguageType& nType, USHORT nPrio ) case LANGUAGE_PORTUGUESE_BRAZILIAN: return "55"; - case LANGUAGE_SPANISH: + case LANGUAGE_SPANISH_DATED: case LANGUAGE_SPANISH_MEXICAN: case LANGUAGE_SPANISH_MODERN: case LANGUAGE_SPANISH_GUATEMALA: @@ -1619,7 +1623,7 @@ const char* ResMgr::GetLang( LanguageType& nType, USHORT nPrio ) case LANGUAGE_HINDI: return "91"; - case LANGUAGE_ARABIC: + case LANGUAGE_ARABIC_PRIMARY_ONLY: case LANGUAGE_ARABIC_IRAQ: case LANGUAGE_ARABIC_EGYPT: case LANGUAGE_ARABIC_LIBYA: @@ -2026,6 +2030,7 @@ sal_uInt32 SimpleResMgr::ReadBlob( sal_uInt32 nId, void** pBuffer ) if( pOldFallback != m_pResImpl ) ResMgrContainer::get().freeResMgr( pOldFallback ); if( pFallback ) + { // handle possible recursion if( pFallback->aLocale.Language != m_pResImpl->aLocale.Language || pFallback->aLocale.Country != m_pResImpl->aLocale.Country || @@ -2038,6 +2043,7 @@ sal_uInt32 SimpleResMgr::ReadBlob( sal_uInt32 nId, void** pBuffer ) ResMgrContainer::get().freeResMgr( pFallback ); pFallback = NULL; } + } } if( ! pResHandle ) // no exception handling, this would require the locking of the solar mutex which isn't allowed within this class diff --git a/tools/source/ref/pstm.cxx b/tools/source/ref/pstm.cxx index 3694ac38dc5c..a336bbaab360 100644 --- a/tools/source/ref/pstm.cxx +++ b/tools/source/ref/pstm.cxx @@ -45,7 +45,7 @@ void SvClassManager::Register( USHORT nClassId, SvCreateInstancePersist pFunc ) #ifdef DBG_UTIL SvCreateInstancePersist p; p = Get( nClassId ); - DBG_ASSERT( !p || p == pFunc, "register class with same id" ) + DBG_ASSERT( !p || p == pFunc, "register class with same id" ); #endif aAssocTable.insert(Map::value_type(nClassId, pFunc)); } @@ -135,7 +135,7 @@ SvPersistStream& operator >> ( SvPersistStream & rStm, if( (nVer & ~PERSIST_LIST_DBGUTIL) != PERSIST_LIST_VER ) { rStm.SetError( SVSTREAM_GENERALERROR ); - DBG_ERROR( "persist list, false version" ) + DBG_ERROR( "persist list, false version" ); } UINT32 nObjLen(0), nObjPos(0); @@ -158,7 +158,7 @@ SvPersistStream& operator >> ( SvPersistStream & rStm, aStr += ByteString::CreateFromInt32( (long)(rStm.Tell() - nObjPos) ); aStr += ", should = "; aStr += ByteString::CreateFromInt64(nObjLen); - DBG_ERROR( aStr.GetBuffer() ) + DBG_ERROR( aStr.GetBuffer() ); } #endif return rStm; @@ -189,7 +189,7 @@ SvPersistStream::SvPersistStream pStream (siehe <SvPersistStream::SetStream>). */ { - DBG_ASSERT( nStartIdx != 0, "zero index not allowed" ) + DBG_ASSERT( nStartIdx != 0, "zero index not allowed" ); bIsWritable = TRUE; if( pStm ) { @@ -307,7 +307,7 @@ USHORT SvPersistStream::IsA() const void SvPersistStream::ResetError() { SvStream::ResetError(); - DBG_ASSERT( pStm, "stream not set" ) + DBG_ASSERT( pStm, "stream not set" ); pStm->ResetError(); } @@ -316,7 +316,7 @@ void SvPersistStream::ResetError() *************************************************************************/ ULONG SvPersistStream::GetData( void* pData, ULONG nSize ) { - DBG_ASSERT( pStm, "stream not set" ) + DBG_ASSERT( pStm, "stream not set" ); ULONG nRet = pStm->Read( pData, nSize ); SetError( pStm->GetError() ); return nRet; @@ -327,7 +327,7 @@ ULONG SvPersistStream::GetData( void* pData, ULONG nSize ) *************************************************************************/ ULONG SvPersistStream::PutData( const void* pData, ULONG nSize ) { - DBG_ASSERT( pStm, "stream not set" ) + DBG_ASSERT( pStm, "stream not set" ); ULONG nRet = pStm->Write( pData, nSize ); SetError( pStm->GetError() ); return nRet; @@ -338,7 +338,7 @@ ULONG SvPersistStream::PutData( const void* pData, ULONG nSize ) *************************************************************************/ ULONG SvPersistStream::SeekPos( ULONG nPos ) { - DBG_ASSERT( pStm, "stream not set" ) + DBG_ASSERT( pStm, "stream not set" ); ULONG nRet = pStm->Seek( nPos ); SetError( pStm->GetError() ); return nRet; @@ -442,14 +442,14 @@ UINT32 SvPersistStream::ReadCompressed if( nMask & 0x0F ) { rStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); - DBG_ERROR( "format error" ) + DBG_ERROR( "format error" ); } rStm >> nRet; } else { rStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); - DBG_ERROR( "format error" ) + DBG_ERROR( "format error" ); } return nRet; } @@ -743,7 +743,7 @@ UINT32 SvPersistStream::ReadObj if( P_VER < (nHdr & P_VER_MASK) ) { SetError( SVSTREAM_FILEFORMAT_ERROR ); - DBG_ERROR( "false version" ) + DBG_ERROR( "false version" ); } if( !(nHdr & P_ID_0) && GetError() == SVSTREAM_OK ) @@ -751,7 +751,7 @@ UINT32 SvPersistStream::ReadObj if( P_OBJ & nHdr ) { // read object, nId nur bei P_DBGUTIL gesetzt DBG_ASSERT( !(nHdr & P_DBGUTIL) || NULL == aPUIdx.Get( nId ), - "object already exist" ) + "object already exist" ); SvCreateInstancePersist pFunc = rClassMgr.Get( nClassId ); UINT32 nObjLen(0), nObjPos(0); @@ -779,7 +779,7 @@ UINT32 SvPersistStream::ReadObj // um den gleichen Zustand, wie nach dem Speichern herzustellen aPTable.Insert( (ULONG)rpObj, (void *)nNewId ); DBG_ASSERT( !(nHdr & P_DBGUTIL) || nId == nNewId, - "read write id conflict: not the same" ) + "read write id conflict: not the same" ); } // und dann Laden rpObj->Load( *this ); @@ -790,7 +790,7 @@ UINT32 SvPersistStream::ReadObj aStr += ByteString::CreateFromInt32( (long)(Tell() - nObjPos) ); aStr += ", should = "; aStr += ByteString::CreateFromInt32( nObjLen ); - DBG_ERROR( aStr.GetBuffer() ) + DBG_ERROR( aStr.GetBuffer() ); } #endif rpObj->RestoreNoDelete(); @@ -799,8 +799,8 @@ UINT32 SvPersistStream::ReadObj else { rpObj = GetObject( nId ); - DBG_ASSERT( rpObj != NULL, "object does not exist" ) - DBG_ASSERT( rpObj->GetClassId() == nClassId, "class mismatch" ) + DBG_ASSERT( rpObj != NULL, "object does not exist" ); + DBG_ASSERT( rpObj->GetClassId() == nClassId, "class mismatch" ); } } return nId; diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index cf22a4f933dc..de802ece9f05 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -1781,7 +1781,7 @@ sal_Size SvStream::Seek( sal_Size nFilePos ) if( !pRWBuf ) { nBufFilePos = SeekPos( nFilePos ); - DBG_ASSERT(Tell()==nBufFilePos,"Out Of Sync!") + DBG_ASSERT(Tell()==nBufFilePos,"Out Of Sync!"); return nBufFilePos; } @@ -1813,7 +1813,7 @@ sal_Size SvStream::Seek( sal_Size nFilePos ) #ifdef OV_DEBUG { sal_Size nDebugTemp = nBufFilePos + nBufActualPos; - DBG_ASSERT(Tell()==nDebugTemp,"Sync?") + DBG_ASSERT(Tell()==nDebugTemp,"Sync?"); } #endif return nBufFilePos + nBufActualPos; @@ -2359,7 +2359,7 @@ sal_Bool SvStream::SetStreamSize( sal_Size nSize ) SetBufferSize( 0 ); SetSize( nSize ); SetBufferSize( nBuf ); - DBG_ASSERT(Tell()==nFPos,"SetStreamSize failed") + DBG_ASSERT(Tell()==nFPos,"SetStreamSize failed"); return (sal_Bool)(nError == 0); } diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx index a5518fd7fe2c..538c02e78fde 100644 --- a/tools/source/stream/strmunx.cxx +++ b/tools/source/stream/strmunx.cxx @@ -485,12 +485,15 @@ sal_Bool SvFileStream::LockRange( sal_Size nByteOffset, sal_Size nBytes ) return sal_False; if ( eStreamMode & STREAM_SHARE_DENYALL ) + { if (bIsWritable) nLockMode = F_WRLCK; else nLockMode = F_RDLCK; + } if ( eStreamMode & STREAM_SHARE_DENYREAD ) + { if (bIsWritable) nLockMode = F_WRLCK; else @@ -498,12 +501,15 @@ sal_Bool SvFileStream::LockRange( sal_Size nByteOffset, sal_Size nBytes ) SetError(SVSTREAM_LOCKING_VIOLATION); return sal_False; } + } if ( eStreamMode & STREAM_SHARE_DENYWRITE ) + { if (bIsWritable) nLockMode = F_WRLCK; else nLockMode = F_RDLCK; + } if (!nLockMode) return sal_True; diff --git a/tools/util/makefile.pmk b/tools/util/makefile.pmk index e00a3ba5df87..09d9908a5049 100644 --- a/tools/util/makefile.pmk +++ b/tools/util/makefile.pmk @@ -32,15 +32,4 @@ # define TOOLS_DLLIMPLEMENTATION (see @ toolsdllapi.h) CDEFS += -DTOOLS_DLLIMPLEMENTATION -# set default symbol visibility / scope to hidden -.IF "$(COMNAME)" == "gcc3" -.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE" - CFLAGS += -fvisibility=hidden -.ENDIF # HAVE_GCC_VISIBILITY_FEATURE -.ENDIF # gcc3 - -.IF "$(COMNAME)" == "sunpro5" -.IF "$(CCNUMVER)" >= "00050005" - CFLAGS += -xldscope=hidden -.ENDIF # 5.5 -.ENDIF # sunpro5 +VISIBILITY_HIDDEN=TRUE diff --git a/tools/workben/hashtbl.cxx b/tools/workben/hashtbl.cxx index 6a4b606b8459..888821719e19 100644 --- a/tools/workben/hashtbl.cxx +++ b/tools/workben/hashtbl.cxx @@ -140,7 +140,7 @@ void* HashTable::GetObjectAt(ULONG lPos) const void HashTable::OnDeleteObject(void*) { - DBG_ERROR("HashTable::OnDeleteObject(void*) nicht berladen") + DBG_ERROR("HashTable::OnDeleteObject(void*) nicht berladen"); } ULONG HashTable::Hash(String const& Key) const diff --git a/transex3/source/gsicheck.cxx b/transex3/source/gsicheck.cxx index cb8ded314d8a..99183602f951 100644 --- a/transex3/source/gsicheck.cxx +++ b/transex3/source/gsicheck.cxx @@ -444,7 +444,7 @@ BOOL GSIBlock::IsUTF8( const ByteString &aTestee, BOOL bFixTags, USHORT &nErrorP } } - ByteString aDelimiter( String( sal_Unicode(0x2016) ), RTL_TEXTENCODING_UTF8 ); + ByteString aDelimiter( (String)String( sal_Unicode(0x2016) ), RTL_TEXTENCODING_UTF8 ); if ( aID.Equals( aDelimiter, 6, aDelimiter.Len() ) ) { // New KeyId 6 Letters, digits and spechial chars followed by delimiter @@ -780,7 +780,7 @@ void Help() } /*****************************************************************************/ -#if defined( UNX ) +#if defined(UNX) || defined(OS2) int main( int argc, char *argv[] ) #else int _cdecl main( int argc, char *argv[] ) diff --git a/transex3/source/gsiconv.cxx b/transex3/source/gsiconv.cxx index 67eb6215335c..f6dea76ebb51 100644 --- a/transex3/source/gsiconv.cxx +++ b/transex3/source/gsiconv.cxx @@ -201,7 +201,7 @@ void Help() } /*****************************************************************************/ -#if defined( UNX ) +#if defined(UNX) || defined(OS2) int main( int argc, char *argv[] ) #else int _cdecl main( int argc, char *argv[] ) diff --git a/transex3/source/helpex.cxx b/transex3/source/helpex.cxx index bb7362914b72..f4a1589b530e 100644 --- a/transex3/source/helpex.cxx +++ b/transex3/source/helpex.cxx @@ -210,7 +210,7 @@ void Help() /*****************************************************************************/ #ifndef TESTDRIVER -#if defined( UNX ) +#if defined(UNX) || defined(OS2) int main( int argc, char *argv[] ) #else int _cdecl main( int argc, char *argv[] ) diff --git a/transex3/source/helpmerge.cxx b/transex3/source/helpmerge.cxx index 27ee6b2d047a..8aafc692f14c 100644 --- a/transex3/source/helpmerge.cxx +++ b/transex3/source/helpmerge.cxx @@ -493,7 +493,7 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile if( !Export::CopyFile( sTempFile , sTempFileCopy ) ) { -#ifdef UNX +#if defined(UNX) || defined(OS2) sleep( 3 ); #else Sleep( 3 ); @@ -512,7 +512,7 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile remove( sTargetFile.GetBuffer() ); } int rc; -#ifdef UNX +#if defined(UNX) || defined(OS2) rc = rename( sTempFile.GetBuffer() , sTargetFile.GetBuffer() ); #else rc = MoveFileEx( sTempFile.GetBuffer() , sTargetFile.GetBuffer(), MOVEFILE_REPLACE_EXISTING ); @@ -528,7 +528,7 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile // if( aFS.GetSize() < 1 ) //#endif { -#ifdef UNX +#if defined(UNX) || defined(OS2) sleep( 3 ); #else Sleep( 3 ); @@ -538,7 +538,7 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile { remove( sTargetFile.GetBuffer() ); } -#ifdef UNX +#if defined(UNX) || defined(OS2) rc = rename( sTempFileCopy.GetBuffer() , sTargetFile.GetBuffer() ); #else rc = MoveFileEx( sTempFileCopy.GetBuffer() , sTargetFile.GetBuffer() , MOVEFILE_REPLACE_EXISTING ); diff --git a/transex3/source/lngex.cxx b/transex3/source/lngex.cxx index a73afb09d59c..53c97de6e045 100644 --- a/transex3/source/lngex.cxx +++ b/transex3/source/lngex.cxx @@ -191,7 +191,7 @@ void Help() } /*****************************************************************************/ -#if defined( UNX ) +#if defined(UNX) || defined(OS2) int main( int argc, char *argv[] ) #else int _cdecl main( int argc, char *argv[] ) diff --git a/transex3/source/localize.cxx b/transex3/source/localize.cxx index c03c885b0c51..d5e0541e6a24 100644 --- a/transex3/source/localize.cxx +++ b/transex3/source/localize.cxx @@ -70,6 +70,7 @@ const char *NegativeList[] = { "officecfg/data/org.openoffice.Office.Labels.xcd", "officecfg/data/org/openoffice/Office/Labels.xcd", "officecfg/data/org/openoffice/Office/SFX.xcd", + "officecfg/data/org/openoffice/Office/Accelerators.xcu", "hidother.src", "NULL" }; @@ -835,7 +836,7 @@ BOOL CheckLanguages( ByteString &rLanguages ) } /*****************************************************************************/ -#if defined( UNX ) +#if defined(UNX) || defined(OS2) int main( int argc, char *argv[] ) #else int _cdecl main( int argc, char *argv[] ) diff --git a/transex3/source/txtconv.cxx b/transex3/source/txtconv.cxx index a497a925b56e..2f442b80a83d 100644 --- a/transex3/source/txtconv.cxx +++ b/transex3/source/txtconv.cxx @@ -70,7 +70,7 @@ void Help() } /*****************************************************************************/ -#if defined( UNX ) +#if defined(UNX) || defined(OS2) int main( int argc, char *argv[] ) #else int _cdecl main( int argc, char *argv[] ) diff --git a/transex3/source/xgfconv.cxx b/transex3/source/xgfconv.cxx index 21b2ae484e17..76ea1a2906a8 100644 --- a/transex3/source/xgfconv.cxx +++ b/transex3/source/xgfconv.cxx @@ -7,7 +7,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_transex3.hxx" -#if defined( UNX ) +#if defined(UNX) || defined(OS2) int main( int argc, char *argv[] ) #else int _cdecl main( int argc, char *argv[] ) diff --git a/transex3/source/xmlparse.cxx b/transex3/source/xmlparse.cxx index 61fada5b0d3e..a2212783ad56 100644 --- a/transex3/source/xmlparse.cxx +++ b/transex3/source/xmlparse.cxx @@ -40,7 +40,10 @@ #include <fstream> #include <iostream> #include "osl/mutex.hxx" - +#ifdef __MINGW32__ +#include <tools/prewin.h> +#include <tools/postwin.h> +#endif using namespace std; using namespace osl; @@ -278,7 +281,7 @@ BOOL XMLFile::Write( ByteString &aFilename ) if( !aFStream ) // From time to time the stream can not be opened the first time on NFS volumes, { // I wasn't able to track this down. I think this is an NFS issue ..... //cerr << "ERROR: - helpex - Can't write to tempfile " << aFilename.GetBuffer() << " No#" << x << "\n"; -#ifdef UNX +#if defined(UNX) || defined(OS2) sleep( 3 ); #else Sleep( 3 ); diff --git a/ucbhelper/util/makefile.pmk b/ucbhelper/util/makefile.pmk index 836165aa7f8d..23f38aa614e5 100644 --- a/ucbhelper/util/makefile.pmk +++ b/ucbhelper/util/makefile.pmk @@ -32,15 +32,4 @@ # define UCBHELPER_DLLIMPLEMENTATION (see @ ucbhelperdllapi.h) CDEFS += -DUCBHELPER_DLLIMPLEMENTATION -# set default symbol visibility / scope to hidden -.IF "$(COMNAME)" == "gcc3" -.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE" - CFLAGS += -fvisibility=hidden -.ENDIF # HAVE_GCC_VISIBILITY_FEATURE -.ENDIF # gcc3 - -.IF "$(COMNAME)" == "sunpro5" -.IF "$(CCNUMVER)" >= "00050005" - CFLAGS += -xldscope=hidden -.ENDIF # 5.5 -.ENDIF # sunpro5 +VISIBILITY_HIDDEN=TRUE diff --git a/unotools/inc/unotools/bootstrap.hxx b/unotools/inc/unotools/bootstrap.hxx index 545a6b23abfb..d2c8a5f1875b 100644 --- a/unotools/inc/unotools/bootstrap.hxx +++ b/unotools/inc/unotools/bootstrap.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: bootstrap.hxx,v $ - * $Revision: 1.15 $ + * $Revision: 1.15.16.1 $ * * This file is part of OpenOffice.org. * @@ -63,9 +63,6 @@ namespace utl /// retrieve the BUILDID information item; uses the given default, if not found static rtl::OUString getBuildIdData(rtl::OUString const& _sDefault); - /// retrieve the product patch level; uses the given default, if not found - static rtl::OUString getProductPatchLevel(rtl::OUString const& _sDefault); - /// retrieve the ALLUSERS information item from setup.ini file; uses the given default, if not found static rtl::OUString getAllUsersValue(rtl::OUString const& _sDefault); diff --git a/unotools/inc/unotools/calendarwrapper.hxx b/unotools/inc/unotools/calendarwrapper.hxx index ad5a898143e4..c98e0867e8fa 100644 --- a/unotools/inc/unotools/calendarwrapper.hxx +++ b/unotools/inc/unotools/calendarwrapper.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: calendarwrapper.hxx,v $ - * $Revision: 1.10 $ + * $Revision: 1.10.24.1 $ * * This file is part of OpenOffice.org. * @@ -81,6 +81,9 @@ public: void setLocalDateTime( double nTimeInDays ); /// convenience method to get local date/time double getLocalDateTime() const; + + // wrapper implementations of XCalendar + void setValue( sal_Int16 nFieldIndex, sal_Int16 nValue ); sal_Bool isValid() const; sal_Int16 getValue( sal_Int16 nFieldIndex ) const; @@ -95,6 +98,13 @@ public: ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > getDays() const; String getDisplayName( sal_Int16 nCalendarDisplayIndex, sal_Int16 nIdx, sal_Int16 nNameType ) const; + /** Convenience method to get timezone offset in milliseconds, taking both + fields ZONE_OFFSET and ZONE_OFFSET_SECOND_MILLIS into account. */ + sal_Int32 getZoneOffsetInMillis() const; + /** Convenience method to get DST offset in milliseconds, taking both + fields DST_OFFSET and DST_OFFSET_SECOND_MILLIS into account. */ + sal_Int32 getDSTOffsetInMillis() const; + // wrapper implementations of XExtendedCalendar String getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) const; @@ -114,6 +124,13 @@ public: inline DateTime getGregorianDateTime() const { return aEpochStart + getLocalDateTime(); } +private: + + /** get timezone or DST offset in milliseconds, fields are + CalendarFieldIndex ZONE_OFFSET and ZONE_OFFSET_SECOND_MILLIS + respectively DST_OFFSET and DST_OFFSET_SECOND_MILLIS. + */ + sal_Int32 getCombinedOffsetInMillis( sal_Int16 nParentFieldIndex, sal_Int16 nChildFieldIndex ) const; }; #endif diff --git a/unotools/inc/unotools/configmgr.hxx b/unotools/inc/unotools/configmgr.hxx index d9e89b655112..679e90b17249 100644 --- a/unotools/inc/unotools/configmgr.hxx +++ b/unotools/inc/unotools/configmgr.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: configmgr.hxx,v $ - * $Revision: 1.22 $ + * $Revision: 1.22.26.1 $ * * This file is part of OpenOffice.org. * @@ -58,6 +58,8 @@ namespace utl ConfigMgr_Impl* pMgrImpl; static ConfigManager* pConfigManager; + static void getBasisAboutBoxProductVersion( rtl::OUString& rVersion ); + public: ConfigManager(); ConfigManager(com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xConfigProvider); diff --git a/unotools/inc/unotools/configpathes.hxx b/unotools/inc/unotools/configpathes.hxx index faa71a5c7a23..081021145055 100644 --- a/unotools/inc/unotools/configpathes.hxx +++ b/unotools/inc/unotools/configpathes.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: configpathes.hxx,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.22.1 $ * * This file is part of OpenOffice.org. * @@ -134,7 +134,7 @@ namespace utl <var>_sNestedPath</var> is returned unaltered. */ - ::rtl::OUString dropPrefixFromConfigurationPath(::rtl::OUString const& _sNestedPath, + UNOTOOLS_DLLPUBLIC ::rtl::OUString dropPrefixFromConfigurationPath(::rtl::OUString const& _sNestedPath, ::rtl::OUString const& _sPrefixPath); //---------------------------------------------------------------------------- diff --git a/unotools/inc/unotools/sharedunocomponent.hxx b/unotools/inc/unotools/sharedunocomponent.hxx index cdb4687e1e50..0ca5f6fcf77f 100644 --- a/unotools/inc/unotools/sharedunocomponent.hxx +++ b/unotools/inc/unotools/sharedunocomponent.hxx @@ -1,358 +1,373 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sharedunocomponent.hxx,v $ - * $Revision: 1.7 $ - * - * 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 UNOTOOLS_INC_SHAREDUNOCOMPONENT_HXX -#define UNOTOOLS_INC_SHAREDUNOCOMPONENT_HXX - -#include "unotoolsdllapi.h" - -#include <boost/shared_ptr.hpp> -#include <com/sun/star/uno/Reference.hxx> -#include <rtl/ref.hxx> - -namespace com { namespace sun { namespace star { - namespace lang { - class XComponent; - } -} } } -//............................................................................ -namespace utl -{ -//............................................................................ - - //======================================================================== - //= DisposableComponent - //======================================================================== - /** is a class which controls lifetime of an UNO component via ->XComponent::dispose - - You'll usually never use this class directly, but only as parameter for a - ->SharedUNOComponent class. - */ - class UNOTOOLS_DLLPUBLIC DisposableComponent - { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > - m_xComponent; - - public: - /** constructs a ->DisposableComponent instance - - @param _rxComponent - the component whose life time should be controlled by the instance. Must not be <NULL/>. - */ - DisposableComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent ); - - /** disposes the component represented by the instance - - The component is queried for ->XComponent(which <em>must</em> be supported), - and ->XComponent::dispose is invoked. A failure of this invocation (e.g. a thrown - exception) is silenced in release builds, and reported in debug builds. - */ - ~DisposableComponent(); - - private: - DisposableComponent(); // never implemented - DisposableComponent( const DisposableComponent& ); // never implemented - DisposableComponent& operator=( const DisposableComponent& ); // never implemented - }; - - //======================================================================== - //= CloseableComponent - //======================================================================== - class CloseableComponentImpl; - /** is a class which controls lifetime of an UNO component via ->XCloseable::close - - You'll usually never use this class directly, but only as parameter for a - ->SharedUNOComponent class. - */ - class UNOTOOLS_DLLPUBLIC CloseableComponent - { - private: - /** Our IMPL class. - */ - ::rtl::Reference< CloseableComponentImpl > m_pImpl; - - public: - /** constructs a ->CloseableComponent instance - - @param _rxComponent - the component whose life time should be controlled by the instance. Must not be <NULL/>. - */ - CloseableComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent ); - - /** destroys resources associated with this instance, and disposes the component - - The component is queried for ->XCloseable (which <em>must</em> be supported), - and ->XCloseable::close is invoked, with delivering the ownership. - If the invocation fails with a ->CloseVetoException, this is ignored, since in - this case the vetoing instance took the ownership. - - Any other failure will be reported in a debug version via assertion mechanisms, - and silenced in release builds. - */ - ~CloseableComponent(); - - private: - CloseableComponent(); // never implemented - CloseableComponent( const CloseableComponent& ); // never implemented - CloseableComponent& operator=( const CloseableComponent& ); // never implemented - }; - - //======================================================================== - //= SharedUNOComponent - //======================================================================== - /** is a helper class for sharing ownership of a UNO component - - If you need to share an UNO component, which normally needs a dedicated owner, - and is lifetime controlled by an explicit disposal action (not necessarily ->XComponent::dispose, - but <em>any</em> explicit method call, after which the object is considered - to be disposed), between different classes, ->SharedUNOComponent is what you need. - - Instead of passing around a <code>Reference< XFoo ></code>, and bothering - with ownership and disposal, you just use a <code>SharedUNOComponent< XFoo ></code>. - This instance can be passed around, including copying, and in nearly all respects behaves - like the original <code>Reference< XFoo ></code>. However, when the last - ->SharedUNOComponent referencing a certain <code>Reference< XFoo ></code> dies, it - will automatically get rid of the object held by this reference. - - @param INTERFACE - the UNO interface type as which the component should be held - - @param COMPONENT_HOLDER - a class which can be used to represent and dispose a UNO component. - The class must support (maybe explicit only) construction from a - <code>Reference< INTERFACE ></code>, and destruction. Upon destruction, - the class must dispose (by any suitable means) the component instance it was - constructed with. - */ - template < class INTERFACE, class COMPONENT = DisposableComponent > - class SharedUNOComponent - { - private: - typedef COMPONENT Component; - typedef ::boost::shared_ptr< Component > ComponentPointer; - - private: - ComponentPointer m_pComponent; - ::com::sun::star::uno::Reference< INTERFACE > m_xTypedComponent; - - public: - enum AssignmentMode - { - TakeOwnership, - NoTakeOwnership - }; - - public: - inline SharedUNOComponent() - { - } - - explicit inline SharedUNOComponent( const ::com::sun::star::uno::Reference< INTERFACE >& _rxComponent, AssignmentMode eMode = TakeOwnership ) - { - reset( _rxComponent, eMode ); - } - -#ifndef EXCEPTIONS_OFF - inline SharedUNOComponent( const SharedUNOComponent& _rxComponent, ::com::sun::star::uno::UnoReference_SetThrow _setThrow ) - { - set( _rxComponent, _setThrow ); - } -#endif - -// SharedUNOComponent& operator=( const ::com::sun::star::uno::Reference< INTERFACE >& _rxComponent ); - // this operator is not implemented by intention. There is no canonic ownership after this operatoer - // would hvae been applied: Should the SharedUNOComponent have the ownership of the component, - // or shouldn't it? Hard to guess, and probably wrong in 50 percent of all cases, anyway. So, - // instead of tempting clients of this class to use such a dangerous operator, we do - // not offer it at all. If you need to assign a Reference< INTERFACE > to your SharedUNOComponent, - // use the ->reset method. - - /** assigns a new component, and releases the old one - */ - void reset( const ::com::sun::star::uno::Reference< INTERFACE >& _rxComponent, AssignmentMode _eMode = TakeOwnership ); - - inline bool set( ::com::sun::star::uno::XInterface* _pInterface, ::com::sun::star::uno::UnoReference_Query _query ); - inline bool set( const ::com::sun::star::uno::BaseReference& _rRef, ::com::sun::star::uno::UnoReference_Query _query ); - inline bool set( const ::com::sun::star::uno::Any& _rAny, ::com::sun::star::uno::UnoReference_Query _query ); - -#ifndef EXCEPTIONS_OFF - inline void set( const ::com::sun::star::uno::XInterface* _pInterface, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow ); - inline void set( const ::com::sun::star::uno::BaseReference & _rRef, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow ); - inline void set( const ::com::sun::star::uno::Any& _rAny, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow ); - - inline void set( const INTERFACE* _pInterface, ::com::sun::star::uno::UnoReference_SetThrow _setThrow ); - inline void set( const ::com::sun::star::uno::Reference< INTERFACE >& _rRef, ::com::sun::star::uno::UnoReference_SetThrow _setThrow ); - inline void set( const SharedUNOComponent& _rComp, ::com::sun::star::uno::UnoReference_SetThrow _setThrow ); -#endif - - INTERFACE* SAL_CALL operator->() const; - - inline operator const ::com::sun::star::uno::Reference< INTERFACE >&() const - { - return m_xTypedComponent; - } - - inline const ::com::sun::star::uno::Reference< INTERFACE >& getTyped() const - { - return m_xTypedComponent; - } - - inline bool is() const - { - return m_xTypedComponent.is(); - } - - inline void clear() - { - m_pComponent.reset(); - m_xTypedComponent.clear(); - } - }; - - //------------------------------------------------------------------------- - template < class INTERFACE, class COMPONENT > - INTERFACE* SAL_CALL SharedUNOComponent< INTERFACE, COMPONENT >::operator->() const - { - return m_xTypedComponent.operator->(); - } - - //------------------------------------------------------------------------- - // assignments - template < class INTERFACE, class COMPONENT > - void SharedUNOComponent< INTERFACE, COMPONENT >::reset( const ::com::sun::star::uno::Reference< INTERFACE >& _rxComponent, AssignmentMode _eMode ) - { - m_pComponent.reset( _eMode == TakeOwnership ? new COMPONENT( _rxComponent ) : NULL ); - m_xTypedComponent = _rxComponent; - } - - //------------------------------------------------------------------------- - // comparison operators - template < class INTERFACE, class COMPONENT > - bool operator==( const ::com::sun::star::uno::Reference< INTERFACE >& _rLHS, const SharedUNOComponent< INTERFACE, COMPONENT >& _rRHS ) - { - return _rLHS == _rRHS.getTyped(); - } - - template < class INTERFACE, class COMPONENT > - bool operator==( const SharedUNOComponent< INTERFACE, COMPONENT >& _rLHS, const ::com::sun::star::uno::Reference< INTERFACE >& _rRHS ) - { - return _rLHS.getTyped() == _rRHS; - } - - //------------------------------------------------------------------------- - // conversion to Any - template < class INTERFACE, class COMPONENT > - inline void SAL_CALL operator <<= ( ::com::sun::star::uno::Any & rAny, const SharedUNOComponent< INTERFACE, COMPONENT >& value ) SAL_THROW( () ) - { - rAny <<= value.getTyped(); - } - - //------------------------------------------------------------------------- - template < class INTERFACE, class COMPONENT > - inline ::com::sun::star::uno::Any SAL_CALL makeAny( const SharedUNOComponent< INTERFACE, COMPONENT >& value ) SAL_THROW( () ) - { - return makeAny( value.getTyped() ); - } - -#ifndef EXCEPTIONS_OFF - //------------------------------------------------------------------------- - template < class INTERFACE, class COMPONENT > - void SharedUNOComponent< INTERFACE, COMPONENT >::set( const ::com::sun::star::uno::XInterface* _pInterface, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow ) - { - reset( ::com::sun::star::uno::Reference< INTERFACE >( _pInterface, _queryThrow ), TakeOwnership ); - } - - //------------------------------------------------------------------------- - template < class INTERFACE, class COMPONENT > - void SharedUNOComponent< INTERFACE, COMPONENT >::set( const ::com::sun::star::uno::BaseReference & _rRef, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow ) - { - reset( ::com::sun::star::uno::Reference< INTERFACE >( _rRef, _queryThrow ), TakeOwnership ); - } - - //------------------------------------------------------------------------- - template < class INTERFACE, class COMPONENT > - void SharedUNOComponent< INTERFACE, COMPONENT >::set( const ::com::sun::star::uno::Any& _rAny, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow ) - { - reset( ::com::sun::star::uno::Reference< INTERFACE >( _rAny, _queryThrow ), TakeOwnership ); - } - - //------------------------------------------------------------------------- - template < class INTERFACE, class COMPONENT > - void SharedUNOComponent< INTERFACE, COMPONENT >::set( const INTERFACE* _pInterface, ::com::sun::star::uno::UnoReference_SetThrow _setThrow ) - { - reset( ::com::sun::star::uno::Reference< INTERFACE >( _pInterface, _setThrow ), TakeOwnership ); - } - - //------------------------------------------------------------------------- - template < class INTERFACE, class COMPONENT > - void SharedUNOComponent< INTERFACE, COMPONENT >::set( const ::com::sun::star::uno::Reference< INTERFACE >& _rRef, ::com::sun::star::uno::UnoReference_SetThrow _setThrow ) - { - reset( ::com::sun::star::uno::Reference< INTERFACE >( _rRef, _setThrow ), TakeOwnership ); - } - - //------------------------------------------------------------------------- - template < class INTERFACE, class COMPONENT > - void SharedUNOComponent< INTERFACE, COMPONENT >::set( const SharedUNOComponent& _rComp, ::com::sun::star::uno::UnoReference_SetThrow _setThrow ) - { - *this = _rComp; - // provoke an exception in case the component is NULL - m_xTypedComponent.set( m_xTypedComponent, _setThrow ); - } -#endif - - //------------------------------------------------------------------------- - template < class INTERFACE, class COMPONENT > - bool SharedUNOComponent< INTERFACE, COMPONENT >::set( ::com::sun::star::uno::XInterface* _pInterface, ::com::sun::star::uno::UnoReference_Query _query ) - { - reset( ::com::sun::star::uno::Reference< INTERFACE >( _pInterface, _query ) ); - return is(); - } - - //------------------------------------------------------------------------- - template < class INTERFACE, class COMPONENT > - bool SharedUNOComponent< INTERFACE, COMPONENT >::set( const ::com::sun::star::uno::BaseReference& _rRef, ::com::sun::star::uno::UnoReference_Query _query ) - { - reset( ::com::sun::star::uno::Reference< INTERFACE >( _rRef, _query ) ); - return is(); - } - - //------------------------------------------------------------------------- - template < class INTERFACE, class COMPONENT > - bool SharedUNOComponent< INTERFACE, COMPONENT >::set( const ::com::sun::star::uno::Any& _rAny, ::com::sun::star::uno::UnoReference_Query _query ) - { - reset( ::com::sun::star::uno::Reference< INTERFACE >( _rAny, _query ) ); - return is(); - } - -//............................................................................ -} // namespace utl -//............................................................................ - -#endif // UNOTOOLS_INC_SHAREDUNOCOMPONENT_HXX +/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sharedunocomponent.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * 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 UNOTOOLS_INC_SHAREDUNOCOMPONENT_HXX
+#define UNOTOOLS_INC_SHAREDUNOCOMPONENT_HXX
+
+#include "unotoolsdllapi.h"
+
+#include <boost/shared_ptr.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <rtl/ref.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace lang {
+ class XComponent;
+ }
+} } }
+//............................................................................
+namespace utl
+{
+//............................................................................
+
+ //========================================================================
+ //= DisposableComponent
+ //========================================================================
+ /** is a class which controls lifetime of an UNO component via ->XComponent::dispose
+
+ You'll usually never use this class directly, but only as parameter for a
+ ->SharedUNOComponent class.
+ */
+ class UNOTOOLS_DLLPUBLIC DisposableComponent
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
+ m_xComponent;
+
+ public:
+ /** constructs a ->DisposableComponent instance
+
+ @param _rxComponent
+ the component whose life time should be controlled by the instance. Must not be <NULL/>.
+ */
+ DisposableComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent );
+
+ /** disposes the component represented by the instance
+
+ The component is queried for ->XComponent(which <em>must</em> be supported),
+ and ->XComponent::dispose is invoked. A failure of this invocation (e.g. a thrown
+ exception) is silenced in release builds, and reported in debug builds.
+ */
+ ~DisposableComponent();
+
+ private:
+ DisposableComponent(); // never implemented
+ DisposableComponent( const DisposableComponent& ); // never implemented
+ DisposableComponent& operator=( const DisposableComponent& ); // never implemented
+ };
+
+ //========================================================================
+ //= CloseableComponent
+ //========================================================================
+ class CloseableComponentImpl;
+ /** is a class which controls lifetime of an UNO component via ->XCloseable::close
+
+ You'll usually never use this class directly, but only as parameter for a
+ ->SharedUNOComponent class.
+ */
+ class UNOTOOLS_DLLPUBLIC CloseableComponent
+ {
+ private:
+ /** Our IMPL class.
+ */
+ ::rtl::Reference< CloseableComponentImpl > m_pImpl;
+
+ public:
+ /** constructs a ->CloseableComponent instance
+
+ @param _rxComponent
+ the component whose life time should be controlled by the instance. Must not be <NULL/>.
+ */
+ CloseableComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent );
+
+ /** destroys resources associated with this instance, and disposes the component
+
+ The component is queried for ->XCloseable (which <em>must</em> be supported),
+ and ->XCloseable::close is invoked, with delivering the ownership.
+ If the invocation fails with a ->CloseVetoException, this is ignored, since in
+ this case the vetoing instance took the ownership.
+
+ Any other failure will be reported in a debug version via assertion mechanisms,
+ and silenced in release builds.
+ */
+ ~CloseableComponent();
+
+ private:
+ CloseableComponent(); // never implemented
+ CloseableComponent( const CloseableComponent& ); // never implemented
+ CloseableComponent& operator=( const CloseableComponent& ); // never implemented
+ };
+
+ //========================================================================
+ //= SharedUNOComponent
+ //========================================================================
+ /** is a helper class for sharing ownership of a UNO component
+
+ If you need to share an UNO component, which normally needs a dedicated owner,
+ and is lifetime controlled by an explicit disposal action (not necessarily ->XComponent::dispose,
+ but <em>any</em> explicit method call, after which the object is considered
+ to be disposed), between different classes, ->SharedUNOComponent is what you need.
+
+ Instead of passing around a <code>Reference< XFoo ></code>, and bothering
+ with ownership and disposal, you just use a <code>SharedUNOComponent< XFoo ></code>.
+ This instance can be passed around, including copying, and in nearly all respects behaves
+ like the original <code>Reference< XFoo ></code>. However, when the last
+ ->SharedUNOComponent referencing a certain <code>Reference< XFoo ></code> dies, it
+ will automatically get rid of the object held by this reference.
+
+ @param INTERFACE
+ the UNO interface type as which the component should be held
+
+ @param COMPONENT_HOLDER
+ a class which can be used to represent and dispose a UNO component.
+ The class must support (maybe explicit only) construction from a
+ <code>Reference< INTERFACE ></code>, and destruction. Upon destruction,
+ the class must dispose (by any suitable means) the component instance it was
+ constructed with.
+ */
+ template < class INTERFACE, class COMPONENT = DisposableComponent >
+ class SharedUNOComponent
+ {
+ private:
+ typedef COMPONENT Component;
+ typedef ::boost::shared_ptr< Component > ComponentPointer;
+
+ private:
+ ComponentPointer m_pComponent;
+ ::com::sun::star::uno::Reference< INTERFACE > m_xTypedComponent;
+
+ public:
+ enum AssignmentMode
+ {
+ TakeOwnership,
+ NoTakeOwnership
+ };
+
+ public:
+ inline SharedUNOComponent()
+ {
+ }
+
+ explicit inline SharedUNOComponent( const ::com::sun::star::uno::Reference< INTERFACE >& _rxComponent, AssignmentMode eMode = TakeOwnership )
+ {
+ reset( _rxComponent, eMode );
+ }
+
+#ifndef EXCEPTIONS_OFF
+ inline SharedUNOComponent( const ::com::sun::star::uno::XInterface* _pInterface, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow )
+ {
+ set( _pInterface, _queryThrow );
+ }
+
+ inline SharedUNOComponent( const ::com::sun::star::uno::BaseReference & _rRef, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow )
+ {
+ set( _rRef, _queryThrow );
+ }
+
+ inline SharedUNOComponent( const ::com::sun::star::uno::Any& _rAny, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow )
+ {
+ set( _rAny, _queryThrow );
+ }
+
+ inline SharedUNOComponent( const SharedUNOComponent& _rxComponent, ::com::sun::star::uno::UnoReference_SetThrow _setThrow )
+ {
+ set( _rxComponent, _setThrow );
+ }
+#endif
+
+// SharedUNOComponent& operator=( const ::com::sun::star::uno::Reference< INTERFACE >& _rxComponent );
+ // this operator is not implemented by intention. There is no canonic ownership after this operatoer
+ // would hvae been applied: Should the SharedUNOComponent have the ownership of the component,
+ // or shouldn't it? Hard to guess, and probably wrong in 50 percent of all cases, anyway. So,
+ // instead of tempting clients of this class to use such a dangerous operator, we do
+ // not offer it at all. If you need to assign a Reference< INTERFACE > to your SharedUNOComponent,
+ // use the ->reset method.
+
+ /** assigns a new component, and releases the old one
+ */
+ void reset( const ::com::sun::star::uno::Reference< INTERFACE >& _rxComponent, AssignmentMode _eMode = TakeOwnership );
+
+ inline bool set( ::com::sun::star::uno::XInterface* _pInterface, ::com::sun::star::uno::UnoReference_Query _query );
+ inline bool set( const ::com::sun::star::uno::BaseReference& _rRef, ::com::sun::star::uno::UnoReference_Query _query );
+ inline bool set( const ::com::sun::star::uno::Any& _rAny, ::com::sun::star::uno::UnoReference_Query _query );
+
+#ifndef EXCEPTIONS_OFF
+ inline void set( const ::com::sun::star::uno::XInterface* _pInterface, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow );
+ inline void set( const ::com::sun::star::uno::BaseReference & _rRef, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow );
+ inline void set( const ::com::sun::star::uno::Any& _rAny, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow );
+
+ inline void set( const INTERFACE* _pInterface, ::com::sun::star::uno::UnoReference_SetThrow _setThrow );
+ inline void set( const ::com::sun::star::uno::Reference< INTERFACE >& _rRef, ::com::sun::star::uno::UnoReference_SetThrow _setThrow );
+ inline void set( const SharedUNOComponent& _rComp, ::com::sun::star::uno::UnoReference_SetThrow _setThrow );
+#endif
+
+ INTERFACE* SAL_CALL operator->() const;
+
+ inline operator const ::com::sun::star::uno::Reference< INTERFACE >&() const
+ {
+ return m_xTypedComponent;
+ }
+
+ inline const ::com::sun::star::uno::Reference< INTERFACE >& getTyped() const
+ {
+ return m_xTypedComponent;
+ }
+
+ inline bool is() const
+ {
+ return m_xTypedComponent.is();
+ }
+
+ inline void clear()
+ {
+ m_pComponent.reset();
+ m_xTypedComponent.clear();
+ }
+ };
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ INTERFACE* SAL_CALL SharedUNOComponent< INTERFACE, COMPONENT >::operator->() const
+ {
+ return m_xTypedComponent.operator->();
+ }
+
+ //-------------------------------------------------------------------------
+ // assignments
+ template < class INTERFACE, class COMPONENT >
+ void SharedUNOComponent< INTERFACE, COMPONENT >::reset( const ::com::sun::star::uno::Reference< INTERFACE >& _rxComponent, AssignmentMode _eMode )
+ {
+ m_pComponent.reset( _eMode == TakeOwnership ? new COMPONENT( _rxComponent ) : NULL );
+ m_xTypedComponent = _rxComponent;
+ }
+
+ //-------------------------------------------------------------------------
+ // comparison operators
+ template < class INTERFACE, class COMPONENT >
+ bool operator==( const ::com::sun::star::uno::Reference< INTERFACE >& _rLHS, const SharedUNOComponent< INTERFACE, COMPONENT >& _rRHS )
+ {
+ return _rLHS == _rRHS.getTyped();
+ }
+
+ template < class INTERFACE, class COMPONENT >
+ bool operator==( const SharedUNOComponent< INTERFACE, COMPONENT >& _rLHS, const ::com::sun::star::uno::Reference< INTERFACE >& _rRHS )
+ {
+ return _rLHS.getTyped() == _rRHS;
+ }
+
+ //-------------------------------------------------------------------------
+ // conversion to Any
+ template < class INTERFACE, class COMPONENT >
+ inline void SAL_CALL operator <<= ( ::com::sun::star::uno::Any & rAny, const SharedUNOComponent< INTERFACE, COMPONENT >& value ) SAL_THROW( () )
+ {
+ rAny <<= value.getTyped();
+ }
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ inline ::com::sun::star::uno::Any SAL_CALL makeAny( const SharedUNOComponent< INTERFACE, COMPONENT >& value ) SAL_THROW( () )
+ {
+ return makeAny( value.getTyped() );
+ }
+
+#ifndef EXCEPTIONS_OFF
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ void SharedUNOComponent< INTERFACE, COMPONENT >::set( const ::com::sun::star::uno::XInterface* _pInterface, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow )
+ {
+ reset( ::com::sun::star::uno::Reference< INTERFACE >( _pInterface, _queryThrow ), TakeOwnership );
+ }
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ void SharedUNOComponent< INTERFACE, COMPONENT >::set( const ::com::sun::star::uno::BaseReference & _rRef, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow )
+ {
+ reset( ::com::sun::star::uno::Reference< INTERFACE >( _rRef, _queryThrow ), TakeOwnership );
+ }
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ void SharedUNOComponent< INTERFACE, COMPONENT >::set( const ::com::sun::star::uno::Any& _rAny, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow )
+ {
+ reset( ::com::sun::star::uno::Reference< INTERFACE >( _rAny, _queryThrow ), TakeOwnership );
+ }
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ void SharedUNOComponent< INTERFACE, COMPONENT >::set( const INTERFACE* _pInterface, ::com::sun::star::uno::UnoReference_SetThrow _setThrow )
+ {
+ reset( ::com::sun::star::uno::Reference< INTERFACE >( _pInterface, _setThrow ), TakeOwnership );
+ }
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ void SharedUNOComponent< INTERFACE, COMPONENT >::set( const ::com::sun::star::uno::Reference< INTERFACE >& _rRef, ::com::sun::star::uno::UnoReference_SetThrow _setThrow )
+ {
+ reset( ::com::sun::star::uno::Reference< INTERFACE >( _rRef, _setThrow ), TakeOwnership );
+ }
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ void SharedUNOComponent< INTERFACE, COMPONENT >::set( const SharedUNOComponent& _rComp, ::com::sun::star::uno::UnoReference_SetThrow _setThrow )
+ {
+ *this = _rComp;
+ // provoke an exception in case the component is NULL
+ m_xTypedComponent.set( m_xTypedComponent, _setThrow );
+ }
+#endif
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ bool SharedUNOComponent< INTERFACE, COMPONENT >::set( ::com::sun::star::uno::XInterface* _pInterface, ::com::sun::star::uno::UnoReference_Query _query )
+ {
+ reset( ::com::sun::star::uno::Reference< INTERFACE >( _pInterface, _query ) );
+ return is();
+ }
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ bool SharedUNOComponent< INTERFACE, COMPONENT >::set( const ::com::sun::star::uno::BaseReference& _rRef, ::com::sun::star::uno::UnoReference_Query _query )
+ {
+ reset( ::com::sun::star::uno::Reference< INTERFACE >( _rRef, _query ) );
+ return is();
+ }
+
+ //-------------------------------------------------------------------------
+ template < class INTERFACE, class COMPONENT >
+ bool SharedUNOComponent< INTERFACE, COMPONENT >::set( const ::com::sun::star::uno::Any& _rAny, ::com::sun::star::uno::UnoReference_Query _query )
+ {
+ reset( ::com::sun::star::uno::Reference< INTERFACE >( _rAny, _query ) );
+ return is();
+ }
+
+//............................................................................
+} // namespace utl
+//............................................................................
+
+#endif // UNOTOOLS_INC_SHAREDUNOCOMPONENT_HXX
diff --git a/unotools/source/accessibility/accessiblestatesethelper.cxx b/unotools/source/accessibility/accessiblestatesethelper.cxx index 2838640a128e..71882d66278b 100644 --- a/unotools/source/accessibility/accessiblestatesethelper.cxx +++ b/unotools/source/accessibility/accessiblestatesethelper.cxx @@ -106,7 +106,7 @@ inline sal_Bool AccessibleStateSetHelperImpl::IsEmpty () inline sal_Bool AccessibleStateSetHelperImpl::Contains (sal_Int16 aState) throw (uno::RuntimeException) { - DBG_ASSERT(aState < BITFIELDSIZE, "the statesset is to small") + DBG_ASSERT(aState < BITFIELDSIZE, "the statesset is too small"); #if 0 return maStates.test(aState); #endif @@ -140,7 +140,7 @@ inline void AccessibleStateSetHelperImpl::AddStates( const sal_Int64 _nStates ) inline void AccessibleStateSetHelperImpl::AddState(sal_Int16 aState) throw (uno::RuntimeException) { - DBG_ASSERT(aState < BITFIELDSIZE, "the statesset is to small") + DBG_ASSERT(aState < BITFIELDSIZE, "the statesset is too small"); #if 0 maStates.set(aState); #endif @@ -152,7 +152,7 @@ inline void AccessibleStateSetHelperImpl::AddState(sal_Int16 aState) inline void AccessibleStateSetHelperImpl::RemoveState(sal_Int16 aState) throw (uno::RuntimeException) { - DBG_ASSERT(aState < BITFIELDSIZE, "the statesset is to small") + DBG_ASSERT(aState < BITFIELDSIZE, "the statesset is too small"); #if 0 maStates.set(aState, 0); #endif diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx index 237629cc1af3..d2a08a766e20 100644 --- a/unotools/source/config/bootstrap.cxx +++ b/unotools/source/config/bootstrap.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: bootstrap.cxx,v $ - * $Revision: 1.28 $ + * $Revision: 1.28.16.1 $ * * This file is part of OpenOffice.org. * @@ -64,8 +64,6 @@ #define BOOTSTRAP_ITEM_SHAREDIR "SharedDataDir" #define BOOTSTRAP_ITEM_USERDIR "UserDataDir" -#define BOOTSTRAP_ITEM_PRODUCT_PATCH_LEVEL "ProductPatch" - #define BOOTSTRAP_DEFAULT_BASEINSTALL "$SYSBINDIR/.." #define BOOTSTRAP_DIRNAME_SHAREDIR "share" @@ -681,21 +679,6 @@ OUString Bootstrap::getBuildIdData(OUString const& _sDefault) } // --------------------------------------------------------------------------------------- -OUString Bootstrap::getProductPatchLevel(OUString const& _sDefault) -{ - OUString const csBuildIdItem(RTL_CONSTASCII_USTRINGPARAM(BOOTSTRAP_ITEM_PRODUCT_PATCH_LEVEL)); - - // pb: #127910# ProductPatch key has moved from bootstrap[rc|.ini] to version[rc|.ini] - OUString sPPLevel; - // read ProductPatchLevel from version[rc|.ini], if it doesn't exist or ProductPatchLevel is empty - if ( data().getVersionValue( csBuildIdItem, sPPLevel, _sDefault ) != sal_True || - sPPLevel.getLength() == 0 ) - // read ProductPatchLevel from bootstrap[rc|.ini] - sPPLevel = data().getBootstrapValue( csBuildIdItem, _sDefault ); - return sPPLevel; -} -// --------------------------------------------------------------------------------------- - OUString Bootstrap::getAllUsersValue(OUString const& _sDefault) { OUString const csAllUsersItem(RTL_CONSTASCII_USTRINGPARAM(SETUP_ITEM_ALLUSERS)); diff --git a/unotools/source/config/configmgr.cxx b/unotools/source/config/configmgr.cxx index a2965b91a6ef..6a5d163871cd 100644 --- a/unotools/source/config/configmgr.cxx +++ b/unotools/source/config/configmgr.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: configmgr.cxx,v $ - * $Revision: 1.47 $ + * $Revision: 1.47.14.1 $ * * This file is part of OpenOffice.org. * @@ -58,6 +58,8 @@ using namespace com::sun::star::beans; using namespace com::sun::star::container; #define C2U(cChar) OUString::createFromAscii(cChar) +#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) + //----------------------------------------------------------------------------- const char* cConfigBaseURL = "/org.openoffice."; //const char* cConfigBaseURL = "/com.sun.star."; @@ -567,7 +569,11 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp) aRet >>= rProductVersion; if ( eProp == ABOUTBOXPRODUCTVERSION ) + { aRet >>= rAboutBoxProductVersion; + getBasisAboutBoxProductVersion( rAboutBoxProductVersion ); + aRet <<= rAboutBoxProductVersion; + } if ( eProp == PRODUCTEXTENSION ) aRet >>= rProductExtension; @@ -580,6 +586,49 @@ Any ConfigManager::GetDirectConfigProperty(ConfigProperty eProp) return aRet; } + +/*---------------------------------------------------------------------------*/ +void ConfigManager::getBasisAboutBoxProductVersion( OUString& rVersion ) +{ + rtl::OUString aPackageVersion = UNISTRING( "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":OOOPackageVersion}" ); + rtl::Bootstrap::expandMacros( aPackageVersion ); + + if ( aPackageVersion.getLength() ) + { + sal_Int32 nTokIndex = 0; + rtl::OUString aVersionMinor = aPackageVersion.getToken( 1, '.', nTokIndex ); + rtl::OUString aVersionMicro; + + if ( nTokIndex > 0 ) + aVersionMicro = aPackageVersion.getToken( 0, '.', nTokIndex ); + + if ( aVersionMinor.getLength() == 0 ) + aVersionMinor = UNISTRING( "0" ); + if ( aVersionMicro.getLength() == 0 ) + aVersionMicro = UNISTRING( "0" ); + + sal_Int32 nIndex = rVersion.indexOf( '.' ); + if ( nIndex == -1 ) + { + rVersion += UNISTRING( "." ); + rVersion += aVersionMinor; + } + else + { + nIndex = rVersion.indexOf( '.', nIndex+1 ); + } + if ( nIndex == -1 ) + { + rVersion += UNISTRING( "." ); + rVersion += aVersionMicro; + } + else + { + rVersion = rVersion.replaceAt( nIndex+1, rVersion.getLength()-nIndex-1, aVersionMicro ); + } + } +} + /* -----------------------------12.12.00 17:22-------------------------------- ---------------------------------------------------------------------------*/ diff --git a/unotools/source/i18n/calendarwrapper.cxx b/unotools/source/i18n/calendarwrapper.cxx index 2c003dc0d620..1d83761b5cea 100644 --- a/unotools/source/i18n/calendarwrapper.cxx +++ b/unotools/source/i18n/calendarwrapper.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: calendarwrapper.cxx,v $ - * $Revision: 1.15 $ + * $Revision: 1.15.24.1 $ * * This file is part of OpenOffice.org. * @@ -51,6 +51,9 @@ using namespace ::com::sun::star::i18n; using namespace ::com::sun::star::uno; +const double MILLISECONDS_PER_DAY = 1000.0 * 60.0 * 60.0 * 24.0; + + CalendarWrapper::CalendarWrapper( const Reference< lang::XMultiServiceFactory > & xSF ) @@ -259,6 +262,50 @@ double CalendarWrapper::getDateTime() const } +sal_Int32 CalendarWrapper::getCombinedOffsetInMillis( + sal_Int16 nParentFieldIndex, sal_Int16 nChildFieldIndex ) const +{ + sal_Int32 nOffset = 0; + try + { + if ( xC.is() ) + { + nOffset = static_cast<sal_Int32>( xC->getValue( nParentFieldIndex )) * 60000; + sal_Int16 nSecondMillis = xC->getValue( nChildFieldIndex ); + if (nOffset < 0) + nOffset -= static_cast<sal_uInt16>( nSecondMillis); + else + nOffset += static_cast<sal_uInt16>( nSecondMillis); + } + } + catch ( Exception& e ) + { +#ifndef PRODUCT + ByteString aMsg( "setLocalDateTime: Exception caught\n" ); + aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); + DBG_ERRORFILE( aMsg.GetBuffer() ); +#else + (void)e; +#endif + } + return nOffset; +} + + +sal_Int32 CalendarWrapper::getZoneOffsetInMillis() const +{ + return getCombinedOffsetInMillis( CalendarFieldIndex::ZONE_OFFSET, + CalendarFieldIndex::ZONE_OFFSET_SECOND_MILLIS); +} + + +sal_Int32 CalendarWrapper::getDSTOffsetInMillis() const +{ + return getCombinedOffsetInMillis( CalendarFieldIndex::DST_OFFSET, + CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS); +} + + void CalendarWrapper::setLocalDateTime( double nTimeInDays ) { try @@ -270,22 +317,23 @@ void CalendarWrapper::setLocalDateTime( double nTimeInDays ) // OlsonTimeZone transitions. Since ICU incorporates also // historical data even the timezone may differ for different // dates! (Which was the cause for #i76623# when the timezone of a - // previously set date was used.) + // previously set date was used.) Timezone may also include + // seconds, so use milliseconds field as well. xC->setDateTime( nTimeInDays ); - sal_Int16 nZone1 = xC->getValue( CalendarFieldIndex::ZONE_OFFSET ); - sal_Int16 nDST1 = xC->getValue( CalendarFieldIndex::DST_OFFSET ); - double nLoc = nTimeInDays - (double)(nZone1 + nDST1) / 60.0 / 24.0; + sal_Int32 nZone1 = getZoneOffsetInMillis(); + sal_Int32 nDST1 = getDSTOffsetInMillis(); + double nLoc = nTimeInDays - (double)(nZone1 + nDST1) / MILLISECONDS_PER_DAY; xC->setDateTime( nLoc ); - sal_Int16 nZone2 = xC->getValue( CalendarFieldIndex::ZONE_OFFSET ); - sal_Int16 nDST2 = xC->getValue( CalendarFieldIndex::DST_OFFSET ); + sal_Int32 nZone2 = getZoneOffsetInMillis(); + sal_Int32 nDST2 = getDSTOffsetInMillis(); // If DSTs differ after calculation, we crossed boundaries. Do it // again, this time using the DST corrected initial value for the // real local time. // See also localtime/gmtime conversion pitfalls at // http://www.erack.de/download/timetest.c - if ( nZone1 != nZone2 || nDST1 != nDST2 ) + if ( nDST1 != nDST2 ) { - nLoc = nTimeInDays - (double)(nZone2 + nDST2) / 60.0 / 24.0; + nLoc = nTimeInDays - (double)(nZone2 + nDST2) / MILLISECONDS_PER_DAY; xC->setDateTime( nLoc ); // #i17222# If the DST onset rule says to switch from 00:00 to // 01:00 and we tried to set onsetDay 00:00 with DST, the @@ -293,10 +341,10 @@ void CalendarWrapper::setLocalDateTime( double nTimeInDays ) // want. So once again without DST, resulting in onsetDay // 01:00 and DST. Yes, this seems to be weird, but logically // correct. - sal_Int16 nDST3 = xC->getValue( CalendarFieldIndex::DST_OFFSET ); + sal_Int32 nDST3 = getDSTOffsetInMillis(); if ( nDST2 != nDST3 && !nDST3 ) { - nLoc = nTimeInDays - (double)(nZone2 + nDST3) / 60.0 / 24.0; + nLoc = nTimeInDays - (double)(nZone2 + nDST3) / MILLISECONDS_PER_DAY; xC->setDateTime( nLoc ); } } @@ -322,11 +370,9 @@ double CalendarWrapper::getLocalDateTime() const if ( xC.is() ) { double nTimeInDays = xC->getDateTime(); - sal_Int16 nZone = xC->getValue( - com::sun::star::i18n::CalendarFieldIndex::ZONE_OFFSET ); - sal_Int16 nDST = xC->getValue( - com::sun::star::i18n::CalendarFieldIndex::DST_OFFSET ); - nTimeInDays += (double)(nZone + nDST) / 60.0 / 24.0; + sal_Int32 nZone = getZoneOffsetInMillis(); + sal_Int32 nDST = getDSTOffsetInMillis(); + nTimeInDays += (double)(nZone + nDST) / MILLISECONDS_PER_DAY; return nTimeInDays; } } diff --git a/unotools/util/makefile.pmk b/unotools/util/makefile.pmk index d24326884699..a59b857ac7b2 100644 --- a/unotools/util/makefile.pmk +++ b/unotools/util/makefile.pmk @@ -32,15 +32,4 @@ # define UNOTOOLS_DLLIMPLEMENTATION (see @ unotoolsdllapi.h) CDEFS += -DUNOTOOLS_DLLIMPLEMENTATION -# set default symbol visibility / scope to hidden -.IF "$(COMNAME)" == "gcc3" -.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE" - CFLAGS += -fvisibility=hidden -.ENDIF # HAVE_GCC_VISIBILITY_FEATURE -.ENDIF # gcc3 - -.IF "$(COMNAME)" == "sunpro5" -.IF "$(CCNUMVER)" >= "00050005" - CFLAGS += -xldscope=hidden -.ENDIF # 5.5 -.ENDIF # sunpro5 +VISIBILITY_HIDDEN=TRUE diff --git a/vcl/aqua/inc/saldata.hxx b/vcl/aqua/inc/saldata.hxx index 108ed857350a..931369982f03 100644 --- a/vcl/aqua/inc/saldata.hxx +++ b/vcl/aqua/inc/saldata.hxx @@ -42,6 +42,7 @@ #include <list> #include <vector> +#include <map> #include <hash_set> #include <cstdio> @@ -99,6 +100,7 @@ struct SalData std::vector< NSCursor* > maCursors; std::vector< NSMenuItem* > maFallbackMenu; + std::map< NSEvent*, bool > maKeyEventAnswer; static oslThreadKey s_aAutoReleaseKey; @@ -107,6 +109,8 @@ struct SalData MainController* mpMainController; // Apple Remote bool mbIsTestTool; + NSObject* mpDockIconClickHandler; + SalData(); ~SalData(); diff --git a/vcl/aqua/inc/salframeview.h b/vcl/aqua/inc/salframeview.h index cd24910eb628..0b44d742d776 100755 --- a/vcl/aqua/inc/salframeview.h +++ b/vcl/aqua/inc/salframeview.h @@ -123,12 +123,26 @@ -(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)moveToEndOfLineAndModifySelection: (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)moveToEndOfDocumentAndModifySelection: (id)aSender; +-(void)moveToBeginningOfDocument: (id)aSender; +-(void)moveToBeginningOfDocumentAndModifySelection: (id)aSender; -(void)insertNewline: (id)aSender; -(void)deleteBackward: (id)aSender; -(void)deleteForward: (id)aSender; diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h index d32ef0789f93..476400f1564b 100644 --- a/vcl/aqua/inc/salgdi.h +++ b/vcl/aqua/inc/salgdi.h @@ -102,6 +102,7 @@ protected: 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 @@ -167,9 +168,9 @@ public: void ImplDrawPixel( long nX, long nY, const RGBAColor& ); // helper to draw single pixels bool CheckContext(); - void UpdateWindow( NSRect& rRect ); // delivered in NSView coordinates + void UpdateWindow( NSRect& ); // delivered in NSView coordinates void RefreshRect( const CGRect& ); - void RefreshRect( const NSRect& rRect ); + void RefreshRect( const NSRect& ); void RefreshRect(float lX, float lY, float lWidth, float lHeight); void SetState(); @@ -264,7 +265,7 @@ public: // filled accordingly virtual void SetFillColor( SalColor nSalColor ); // enable/disable XOR drawing - virtual void SetXORMode( BOOL bSet ); + virtual void SetXORMode( bool bSet, bool bInvertOnly ); // set line color for raster operations virtual void SetROPLineColor( SalROPColor nROPColor ); // set fill color for raster operations diff --git a/vcl/aqua/inc/salinst.h b/vcl/aqua/inc/salinst.h index 703c3339ba37..b2cbc83d9f79 100644 --- a/vcl/aqua/inc/salinst.h +++ b/vcl/aqua/inc/salinst.h @@ -169,6 +169,7 @@ public: 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; static NSMenu* GetDynamicDockMenu(); diff --git a/vcl/aqua/inc/vclnsapp.h b/vcl/aqua/inc/vclnsapp.h index de6c00617d2d..a5c339c238bd 100755 --- a/vcl/aqua/inc/vclnsapp.h +++ b/vcl/aqua/inc/vclnsapp.h @@ -61,8 +61,10 @@ -(void)removeFallbackMenuItem: (NSMenuItem*)pOldItem; -(void)getSystemVersionMajor:(unsigned *)major minor:(unsigned *)minor bugFix:(unsigned *)bugFix; -(void)addDockMenuItem: (NSMenuItem*)pNewItem; --(void)applicationWillBecomeActive:(NSNotification *)aNotification; --(void)applicationWillResignActive:(NSNotification *)aNotification; +-(void)applicationWillBecomeActive: (NSNotification *)pNotification; +-(void)applicationWillResignActive: (NSNotification *)pNotification; +-(MacOSBOOL)applicationShouldHandleReopen: (NSApplication*)pApp hasVisibleWindows: (MacOSBOOL)bWinVisible; +-(void)setDockIconClickHandler: (NSObject*)pHandler; @end #endif diff --git a/vcl/aqua/source/app/saldata.cxx b/vcl/aqua/source/app/saldata.cxx index b5092126790b..b110141fb224 100644 --- a/vcl/aqua/source/app/saldata.cxx +++ b/vcl/aqua/source/app/saldata.cxx @@ -61,7 +61,8 @@ SalData::SalData() mbIsScrollbarDoubleMax( false ), mnSystemVersion( VER_TIGER ), mpMainController( NULL ), - mbIsTestTool( false ) + mbIsTestTool( false ), + mpDockIconClickHandler( nil ) { if( s_aAutoReleaseKey == 0 ) s_aAutoReleaseKey = osl_createThreadKey( releasePool ); diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index 2d6648063088..0523381b9223 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -59,6 +59,7 @@ #include <Foundation/Foundation.h> #include <ApplicationServices/ApplicationServices.h> #import "apple_remote/RemoteMainController.h" +#include "apple_remote/RemoteControl.h" #include "postmac.h" @@ -585,9 +586,73 @@ void AquaSalInstance::handleAppDefinedEvent( NSEvent* pEvent ) } } break; + case AppleRemoteEvent: + { + sal_Int16 nCommand = 0; + SalData* pSalData = GetSalData(); + bool bIsFullScreenMode = false; + + std::list<AquaSalFrame*>::iterator it = pSalData->maFrames.begin(); + while( (*it) && ( (it != pSalData->maFrames.end() ) || ( (*it)->mbFullScreen == false ) ) ) + { + if ( ((*it)->mbFullScreen == true) ) + bIsFullScreenMode = true; + it++; + } + + switch ([pEvent data1]) + { + case kRemoteButtonPlay: + nCommand = ( bIsFullScreenMode == true ) ? MEDIA_COMMAND_PLAY_PAUSE : MEDIA_COMMAND_PLAY; + break; + + // kept for experimentation purpose (scheduled for future implementation) + // case kRemoteButtonMenu: nCommand = MEDIA_COMMAND_MENU; break; + + case kRemoteButtonPlus: nCommand = MEDIA_COMMAND_VOLUME_UP; break; + + case kRemoteButtonMinus: nCommand = MEDIA_COMMAND_VOLUME_DOWN; break; + + case kRemoteButtonRight: nCommand = MEDIA_COMMAND_NEXTTRACK; break; + + case kRemoteButtonRight_Hold: nCommand = MEDIA_COMMAND_NEXTTRACK_HOLD; break; + + case kRemoteButtonLeft: nCommand = MEDIA_COMMAND_PREVIOUSTRACK; break; + + case kRemoteButtonLeft_Hold: nCommand = MEDIA_COMMAND_REWIND; break; + + case kRemoteButtonPlay_Hold: nCommand = MEDIA_COMMAND_PLAY_HOLD; break; + + case kRemoteButtonMenu_Hold: nCommand = MEDIA_COMMAND_STOP; break; + + // FIXME : not detected + case kRemoteButtonPlus_Hold: + case kRemoteButtonMinus_Hold: + break; + + default: + break; + } + AquaSalFrame* pFrame = pSalData->maFrames.front(); + Window * pWindow = pFrame->GetWindow() ? pSalData->maFrames.front()->GetWindow() : NULL; + + if( pWindow ) + { + const Point aPoint; + CommandEvent aCEvt( aPoint, COMMAND_MEDIA, FALSE, &nCommand ); + NotifyEvent aNCmdEvt( EVENT_COMMAND, pWindow, &aCEvt ); + + if ( !ImplCallPreNotify( aNCmdEvt ) ) + pWindow->Command( aCEvt ); + } + + } + break; + case YieldWakeupEvent: // do nothing, fall out of Yield break; + default: DBG_ERROR( "unhandled NSApplicationDefined event" ); break; diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm index 4e7678e17a8d..9e933c7410b6 100755 --- a/vcl/aqua/source/app/vclnsapp.mm +++ b/vcl/aqua/source/app/vclnsapp.mm @@ -96,6 +96,10 @@ since they tend to clash with system shortcuts on all platforms so we can skip this case here. */ + // get information whether the event was handled; keyDown returns nothing + GetSalData()->maKeyEventAnswer[ pEvent ] = false; + bool bHandled = false; + if( nModMask != (NSCommandKeyMask | NSAlternateKeyMask) ) { // dispatch to view directly to avoid the key event being consumed by the menubar @@ -105,7 +109,7 @@ if( pFrame->mpParent && (pFrame->mnStyle & SAL_FRAME_STYLE_FLOAT) == 0 ) { [[pKeyWin contentView] keyDown: pEvent]; - return; + bHandled = GetSalData()->maKeyEventAnswer[ pEvent ]; } // see whether the main menu consumes this event @@ -113,13 +117,46 @@ // the main menu just beeps for an unknown or disabled key equivalent // and swallows the event wholesale NSMenu* pMainMenu = [NSApp mainMenu]; - if( pMainMenu == 0 || ! [pMainMenu performKeyEquivalent: pEvent] ) + if( ! bHandled && (pMainMenu == 0 || ! [pMainMenu performKeyEquivalent: pEvent]) ) + { [[pKeyWin contentView] keyDown: pEvent]; - - // at this point either the menu has executed the accelerator - // or we have dispatched the event - // so no need to dispatch further + bHandled = GetSalData()->maKeyEventAnswer[ pEvent ]; + } + else + bHandled = true; // event handled already or main menu just handled it + } + GetSalData()->maKeyEventAnswer.erase( pEvent ); + if( bHandled ) return; + } + else if( pKeyWin ) + { + // #i94601# a window not of vcl's making has the focus. + // Since our menus do not invoke the usual commands + // try to play nice with native windows like the file dialog + // and emulate them + // precondition: this ONLY works because CMD-V (paste), CMD-C (copy) and CMD-X (cut) are + // NOT localized, that is the same in all locales. Should this be + // different in any locale, this hack will fail. + unsigned int nModMask = ([pEvent modifierFlags] & (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask|NSCommandKeyMask)); + if( nModMask == NSCommandKeyMask ) + { + + if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"v"] ) + { + if( [NSApp sendAction: @selector(paste:) to: nil from: nil] ) + return; + } + else if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"c"] ) + { + if( [NSApp sendAction: @selector(copy:) to: nil from: nil] ) + return; + } + else if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"x"] ) + { + if( [NSApp sendAction: @selector(cut:) to: nil from: nil] ) + return; + } } } } @@ -381,5 +418,21 @@ } } +- (MacOSBOOL)applicationShouldHandleReopen: (NSApplication*)pApp hasVisibleWindows: (MacOSBOOL) bWinVisible +{ + NSObject* pHdl = GetSalData()->mpDockIconClickHandler; + if( pHdl && [pHdl respondsToSelector: @selector(dockIconClicked:)] ) + { + [pHdl performSelector:@selector(dockIconClicked:) withObject: self]; + } + return YES; +} + +-(void)setDockIconClickHandler: (NSObject*)pHandler +{ + GetSalData()->mpDockIconClickHandler = pHandler; +} + + @end diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx index 66d117eb22cb..a4827870efa9 100755 --- a/vcl/aqua/source/gdi/salatslayout.cxx +++ b/vcl/aqua/source/gdi/salatslayout.cxx @@ -74,7 +74,7 @@ private: float mfFontScale; private: - bool InitGIA() const; + bool InitGIA( ImplLayoutArgs* pArgs = NULL ) const; bool GetIdealX() const; bool GetDeltaY() const; @@ -96,6 +96,10 @@ private: mutable Fixed* mpGlyphOrigAdvs; // contains glyph widths for the unjustified layout mutable Fixed* mpDeltaY; // vertical offset from the baseline + struct SubPortion { int mnMinCharPos, mnEndCharPos; Fixed mnXOffset; }; + typedef std::vector<SubPortion> SubPortionVector; + mutable SubPortionVector maSubPortions; // Writer&ATSUI layouts can differ quite a bit... + // storing details about fonts used in glyph-fallback for this layout mutable class FallbackInfo* mpFallbackInfo; @@ -313,6 +317,10 @@ void ATSLayout::AdjustLayout( ImplLayoutArgs& rArgs ) OSStatus eStatus = ATSUSetLayoutControls( maATSULayout, 3, nTags, nBytes, nVals ); if( eStatus != noErr ) return; + + // check result of the justied layout + if( rArgs.mpDXArray ) + InitGIA( &rArgs ); } // ----------------------------------------------------------------------- @@ -367,12 +375,23 @@ void ATSLayout::DrawText( SalGraphics& rGraphics ) const DBG_ASSERT( (theErr==noErr), "ATSLayout::DrawText ATSUSetLayoutControls failed!\n" ); // Draw the text - DBG_ASSERT( mnBaseAdv==0, "ATSLayout::DrawText() not yet implemented for glyph fallback layouts" ); const Point aPos = GetDrawPosition( Point(mnBaseAdv,0) ); const Fixed nFixedX = Vcl2Fixed( +aPos.X() ); const Fixed nFixedY = Vcl2Fixed( -aPos.Y() ); // adjusted for y-mirroring - theErr = ATSUDrawText( maATSULayout, mnMinCharPos, mnCharCount, nFixedX, nFixedY ); - DBG_ASSERT( (theErr==noErr), "ATSLayout::DrawText ATSUDrawText failed!\n" ); + if( maSubPortions.empty() ) + ATSUDrawText( maATSULayout, mnMinCharPos, mnCharCount, nFixedX, nFixedY ); + else + { + // draw the sub-portions and apply individual adjustments + SubPortionVector::const_iterator it = maSubPortions.begin(); + for(; it != maSubPortions.end(); ++it ) + { + const SubPortion& rSubPortion = *it; + ATSUDrawText( maATSULayout, + rSubPortion.mnMinCharPos, rSubPortion.mnEndCharPos - rSubPortion.mnMinCharPos, + nFixedX + rSubPortion.mnXOffset, nFixedY ); + } + } // request an update of the changed window area if( rAquaGraphics.IsWindowGraphics() ) @@ -437,6 +456,28 @@ int ATSLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos, int Fixed nXOffset = mnBaseAdv; for( int i = 0; i < nStart; ++i ) nXOffset += mpGlyphAdvances[ i ]; + // if sub-portion offsets are involved there is an additional x-offset + if( !maSubPortions.empty() ) + { + // prepare to find the sub-portion + int nCharPos = nStart + mnMinCharPos; + if( mpGlyphs2Chars ) + nCharPos = mpGlyphs2Chars[nStart]; + + // find the matching subportion + // TODO: is a non-linear search worth it? + SubPortionVector::const_iterator it = maSubPortions.begin(); + for(; it != maSubPortions.end(); ++it) { + const SubPortion& r = *it; + if( nCharPos < r.mnMinCharPos ) + continue; + if( nCharPos >= r.mnEndCharPos ) + continue; + // apply the sub-portion xoffset + nXOffset += r.mnXOffset; + break; + } + } Fixed nYOffset = 0; if( mpDeltaY ) @@ -455,7 +496,7 @@ int ATSLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos, int // check if glyph fallback is needed for this glyph // TODO: use ATSUDirectGetLayoutDataArrayPtrFromTextLayout(kATSUDirectDataStyleIndex) API instead? - const int nCharPos = mpGlyphs2Chars ? mpGlyphs2Chars[nStart] : nStart + mnMinCharPos; + const int nCharPos = mpGlyphs2Chars ? mpGlyphs2Chars[nStart] : nStart + mnMinCharPos; ATSUFontID nFallbackFontID = kATSUInvalidFontID; UniCharArrayOffset nChangedOffset = 0; UniCharCount nChangedLength = 0; @@ -495,6 +536,8 @@ int ATSLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos, int break; // stop when next the x-position is unexpected + if( !maSubPortions.empty() ) + break; // TODO: finish the complete sub-portion if( !pGlyphAdvances && mpGlyphOrigAdvs ) if( mpGlyphAdvances[nStart-1] != mpGlyphOrigAdvs[nStart-1] ) break; @@ -616,6 +659,7 @@ long ATSLayout::FillDXArray( long* pDXArray ) const **/ int ATSLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const { + // get a quick overview on what could fit const long nPixelWidth = (nMaxWidth - (nCharExtra * mnCharCount)) / nFactor; UniCharArrayOffset nBreakPos = mnMinCharPos; @@ -634,6 +678,26 @@ int ATSLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) cons if( nBreakPos >= static_cast<UniCharArrayOffset>(mnEndCharPos) ) return STRING_LEN; + // for the nCharExtra!=0 case the resulting nBreakPos needs be involved + if( nCharExtra != 0 ) + { + // age-old nCharExtra!=0 semantic is quite incompatible with ATSUBreakLine() + // TODO: use a better way than by testing each the char position + InitGIA(); + ATSUTextMeasurement nATSUSumWidth = 0; + const ATSUTextMeasurement nATSUMaxWidth = Vcl2Fixed( nMaxWidth / nFactor ); + const ATSUTextMeasurement nATSUExtraWidth = Vcl2Fixed( nCharExtra ) / nFactor; + for( int i = 0; i < mnCharCount; ++i) + { + nATSUSumWidth += mpCharWidths[i]; + if( nATSUSumWidth >= nATSUMaxWidth ) + return (mnMinCharPos + i); + nATSUSumWidth += nATSUExtraWidth; + } + + return STRING_LEN; + } + // GetTextBreak()'s callers expect it to return the "stupid visual line break". // Returning anything else result.s in subtle problems in the application layers. static const bool bInWord = true; // TODO: add as argument to GetTextBreak() method @@ -730,7 +794,7 @@ bool ATSLayout::GetBoundRect( SalGraphics&, Rectangle& rVCLRect ) const // ----------------------------------------------------------------------- /** - * ATSLayout::InitGIA() : Get many informations about layouted text + * ATSLayout::InitGIA() : get many informations about layouted text * * Fills arrays of information about the gylph layout previously done * in ASTLayout::LayoutText() : glyph advance (width), glyph delta Y (from baseline), @@ -738,7 +802,7 @@ bool ATSLayout::GetBoundRect( SalGraphics&, Rectangle& rVCLRect ) const * * @return : true if everything could be computed, otherwise false **/ -bool ATSLayout::InitGIA() const +bool ATSLayout::InitGIA( ImplLayoutArgs* pArgs ) const { // no need to run InitGIA more than once on the same ATSLayout object if( mnGlyphCount >= 0 ) @@ -795,7 +859,7 @@ bool ATSLayout::InitGIA() const continue; DBG_ASSERT( !(rALR.flags & kATSGlyphInfoTerminatorGlyph), - "ATSLayout::InitGIA(): terminator glyph not marked as deleted!" ) + "ATSLayout::InitGIA(): terminator glyph not marked as deleted!" ); // store details of the visible glyphs nLeftPos = rALR.realPos; @@ -820,7 +884,53 @@ bool ATSLayout::InitGIA() const "ATSLayout::InitGIA(): measured widths do not match!\n" ); #endif - // Release data array ptr + // #i91183# we need to split up the portion into sub-portions + // if the ATSU-layout differs too much from the requested layout + if( pArgs && pArgs->mpDXArray ) + { + // TODO: non-strong-LTR case cases should be handled too + if( 0 == (~pArgs->mnFlags & (TEXT_LAYOUT_BIDI_STRONG|TEXT_LAYOUT_BIDI_LTR)) ) + { + Fixed nSumCharWidths = 0; + SubPortion aSubPortion = { mnMinCharPos, 0, 0 }; + for( int i = 0; i < mnCharCount; ++i ) + { + // calculate related logical position + nSumCharWidths += mpCharWidths[i]; + + // start new sub-portion if needed + const Fixed nNextXPos = Vcl2Fixed(pArgs->mpDXArray[i]); + const Fixed nNextXOffset = nNextXPos - nSumCharWidths; + const Fixed nFixedDiff = aSubPortion.mnXOffset - nNextXOffset; + if( (nFixedDiff < -0xC000) || (nFixedDiff > +0xC000) ) { + // get to the end of the current sub-portion + // prevent splitting up at diacritics etc. + int j = i; + while( (++j < mnCharCount) && !mpCharWidths[j] ); + aSubPortion.mnEndCharPos = mnMinCharPos + j; + // emit current sub-portion + maSubPortions.push_back( aSubPortion ); + // prepare next sub-portion + aSubPortion.mnMinCharPos = aSubPortion.mnEndCharPos; + aSubPortion.mnXOffset = nNextXOffset; + } + } + + // emit the remaining sub-portion + if( !maSubPortions.empty() ) + { + aSubPortion.mnEndCharPos = mnEndCharPos; + if( aSubPortion.mnEndCharPos != aSubPortion.mnMinCharPos ) + maSubPortions.push_back( aSubPortion ); + } + } + + // override layouted charwidths with requested charwidths + for( int n = 0; n < mnCharCount; ++n ) + mpCharWidths[ n ] = pArgs->mpDXArray[ n ]; + } + + // release the ATSU layout records ATSUDirectReleaseLayoutDataArrayPtr(NULL, kATSUDirectDataLayoutRecordATSLayoutRecordCurrent, (void**)&pALR ); @@ -998,84 +1108,10 @@ void PolyArgs::ClosePolygon() } #endif // ======================================================================= -#if 0 -// helper functions for ATSLayout::GetGlyphOutlines() -OSStatus MyATSCubicMoveToCallback( const Float32Point *pt1, - void* pData ) -{ - PolyArgs& rA = *reinterpret_cast<PolyArgs*>(pData); - // MoveTo implies a new polygon => finish old polygon first - rA.ClosePolygon(); - rA.AddPoint( *pt1, POLY_NORMAL ); -} - -OSStatus MyATSCubicLineToCallback( const Float32Point* pt1, - void* pData ) -{ - PolyArgs& rA = *reinterpret_cast<PolyArgs*>(pData); - rA.AddPoint( *pt1, POLY_NORMAL ); -} - -OSStatus MyATSCubicCurveToCallback( const Float32Point* pt1, - const Float32Point* pt2, const Float32Point* pt3, void* pData ) -{ - PolyArgs& rA = *reinterpret_cast<PolyArgs*>(pData); - rA.AddPoint( *pt1, POLY_CONTROL ); - rA.AddPoint( *pt2, POLY_CONTROL ); - rA.AddPoint( *pt3, POLY_NORMAL ); -} - -OSStatus MyATSCubicClosePathCallback ( - void *pData ) -{ - PolyArgs& rA = *reinterpret_cast<PolyArgs*>(pData); - rA.ClosePolygon(); -} -#endif -// ----------------------------------------------------------------------- - -bool ATSLayout::GetGlyphOutlines( SalGraphics&, PolyPolyVector& rPPV ) const -{ - return false; - - /* - rPPV.clear(); - - if( !InitGIA() ) - return false; - - rPPV.resize( mpGIA->numGlyphs ); - PolyArgs aPolyArgs; - const ATSUGlyphInfo* pG = mpGIA->glyphs; - for( int i = 0; i < mpGIA->numGlyphs; ++i, ++pG ) - { - // convert glyphid at glyphpos to outline - GlyphID nGlyphId = pG->glyphID; - long nDeltaY = Float32ToInt( pG->deltaY ); - aPolyArgs.Init( &rPPV[i], pG->screenX, nDeltaY ); - OSStatus nStatus, nCBStatus; - nStatus = ATSUGlyphGetCubicPaths( - mrATSUStyle, nGlyphId, - MyATSCubicMoveToCallback, MyATSCubicLineToCallback, - MyATSCubicCurveToCallback, MyATSCubicClosePathCallback, - &aPolyArgs, &nCBStatus ); - - if( (nStatus != noErr) && (nCBStatus != noErr) ) - { - fprintf(stderr,"ATSUCallback = %d,%d\n", nStatus, nCBStatus ); - rPPV.resize( i ); - break; - } - } - - return true; - */ -} - -// ----------------------------------------------------------------------- // glyph fallback is supported directly by Aqua -// so MultiSalLayout-only methods can be dummy implementated +// so methods used only by MultiSalLayout can be dummy implementated +bool ATSLayout::GetGlyphOutlines( SalGraphics&, PolyPolyVector& rPPV ) const { return false; } void ATSLayout::InitFont() {} void ATSLayout::MoveGlyph( int /*nStart*/, long /*nNewXPos*/ ) {} void ATSLayout::DropGlyph( int /*nStart*/ ) {} diff --git a/vcl/aqua/source/gdi/salbmp.cxx b/vcl/aqua/source/gdi/salbmp.cxx index dece56641533..42f29d677b52 100644 --- a/vcl/aqua/source/gdi/salbmp.cxx +++ b/vcl/aqua/source/gdi/salbmp.cxx @@ -254,8 +254,17 @@ bool AquaSalBitmap::AllocateUserData() } } - if( mnBytesPerRow ) - maUserBuffer.reset( new sal_uInt8[mnBytesPerRow * mnHeight] ); + try + { + if( mnBytesPerRow ) + maUserBuffer.reset( new sal_uInt8[mnBytesPerRow * mnHeight] ); + } + catch( const std::bad_alloc& ) + { + DBG_ERROR( "vcl::AquaSalBitmap::AllocateUserData: bad alloc" ); + maUserBuffer.reset( NULL ); + mnBytesPerRow = 0; + } return maUserBuffer.get() != 0; } diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index 3a47cdc22f13..bc7082c33d1c 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -267,6 +267,7 @@ AquaSalGraphics::AquaSalGraphics() , mxLayer( NULL ) , mrContext( NULL ) , mpXorEmulation( NULL ) + , mnXorMode( 0 ) , mnWidth( 0 ) , mnHeight( 0 ) , mnBitmapDepth( 0 ) @@ -403,6 +404,14 @@ void AquaSalGraphics::initResolution( NSWindow* pWin ) { mnRealDPIX = mnRealDPIY = (mnRealDPIX + mnRealDPIY + 1) / 2; } + else // #i89650# workaround bogus device resolutions + { + if( mnRealDPIY < 72 ) + mnRealDPIY = 72; + if( mnRealDPIX < mnRealDPIY ) // e.g. for TripleHead2Go only mnRealDPIX is off + mnRealDPIX = mnRealDPIY; + } + mfFakeDPIScale = 1.0; } @@ -453,6 +462,14 @@ static void AddPolygonToPath( CGMutablePathRef xPath, } ::basegfx::B2DPoint aPoint = rPolygon.getB2DPoint( nClosedIdx ); + + if(bPixelSnap) + { + // snap device coordinates to full pixels + aPoint.setX( basegfx::fround( aPoint.getX() ) ); + aPoint.setY( basegfx::fround( aPoint.getY() ) ); + } + if( bLineDraw ) aPoint += aHalfPointOfs; @@ -545,7 +562,7 @@ bool AquaSalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& rPolyPol if( !mxClipPath ) mxClipPath = CGPathCreateMutable(); - AddPolyPolygonToPath( mxClipPath, rPolyPolygon, false, false ); + AddPolyPolygonToPath( mxClipPath, rPolyPolygon, !getAntiAliasB2DDraw(), false ); return true; } @@ -897,7 +914,7 @@ bool AquaSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPol for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx ) { const ::basegfx::B2DPolygon rPolygon = rPolyPoly.getB2DPolygon( nPolyIdx ); - AddPolygonToPath( xPath, rPolygon, true, false, IsPenVisible() ); + AddPolygonToPath( xPath, rPolygon, true, !getAntiAliasB2DDraw(), IsPenVisible() ); } CGContextSaveGState( mrContext ); CGContextBeginPath( mrContext ); @@ -943,7 +960,7 @@ bool AquaSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon& rPolyLine, // setup poly-polygon path CGMutablePathRef xPath = CGPathCreateMutable(); - AddPolygonToPath( xPath, rPolyLine, rPolyLine.isClosed(), false, true ); + AddPolygonToPath( xPath, rPolyLine, rPolyLine.isClosed(), !getAntiAliasB2DDraw(), true ); CGContextSaveGState( mrContext ); CGContextAddPath( mrContext, xPath ); const CGRect aRefreshRect = CGPathGetBoundingBox( xPath ); @@ -1020,43 +1037,45 @@ void AquaSalGraphics::copyBits( const SalTwoRect *pPosAry, SalGraphics *pSrcGrap ApplyXorContext(); pSrc->ApplyXorContext(); -#if 0 // TODO: make AquaSalBitmap as fast as the alternative implementation below - SalBitmap* pBitmap = pSrc->getBitmap( pPosAry->mnSrcX, pPosAry->mnSrcY, pPosAry->mnSrcWidth, pPosAry->mnSrcHeight ); + DBG_ASSERT( pSrc->mxLayer!=NULL, "AquaSalGraphics::copyBits() from non-layered graphics" ); - if( pBitmap ) + const CGPoint aDstPoint = { +pPosAry->mnDestX - pPosAry->mnSrcX, pPosAry->mnDestY - pPosAry->mnSrcY }; + if( !mnBitmapDepth || (aDstPoint.x + pSrc->mnWidth) <= mnWidth ) // workaround a Quartz crasher { - SalTwoRect aPosAry( *pPosAry ); - aPosAry.mnSrcX = 0; - aPosAry.mnSrcY = 0; - drawBitmap( &aPosAry, *pBitmap ); - delete pBitmap; + // in XOR mode the drawing context is redirected to the XOR mask + // if source and target are identical then copyBits() paints onto the target context though + CGContextRef xCopyContext = mrContext; + if( mpXorEmulation && mpXorEmulation->IsEnabled() ) + if( pSrcGraphics == this ) + xCopyContext = mpXorEmulation->GetTargetContext(); + + CGContextSaveGState( xCopyContext ); + const CGRect aDstRect = { {pPosAry->mnDestX, pPosAry->mnDestY}, {pPosAry->mnDestWidth, pPosAry->mnDestHeight} }; + CGContextClipToRect( xCopyContext, aDstRect ); + + // draw at new destination + // NOTE: flipped drawing gets disabled for this, else the subimage would be drawn upside down + if( pSrc->IsFlipped() ) + { CGContextTranslateCTM( xCopyContext, 0, +mnHeight ); CGContextScaleCTM( xCopyContext, +1, -1 ); } + // TODO: pSrc->size() != this->size() + ::CGContextDrawLayerAtPoint( xCopyContext, aDstPoint, pSrc->mxLayer ); + CGContextRestoreGState( xCopyContext ); + // mark the destination rectangle as updated + RefreshRect( aDstRect ); } -#else - DBG_ASSERT( pSrc->mxLayer!=NULL, "AquaSalGraphics::copyBits() from non-layered graphics" ) - - // in XOR mode the drawing context is redirected to the XOR mask - // if source and target are identical then copyBits() paints onto the target context though - CGContextRef xCopyContext = mrContext; - if( mpXorEmulation && mpXorEmulation->IsEnabled() ) - if( pSrcGraphics == this ) - xCopyContext = mpXorEmulation->GetTargetContext(); - - CGContextSaveGState( xCopyContext ); - const CGRect aDstRect = { {pPosAry->mnDestX, pPosAry->mnDestY}, {pPosAry->mnDestWidth, pPosAry->mnDestHeight} }; - CGContextClipToRect( xCopyContext, aDstRect ); + else + { + SalBitmap* pBitmap = pSrc->getBitmap( pPosAry->mnSrcX, pPosAry->mnSrcY, pPosAry->mnSrcWidth, pPosAry->mnSrcHeight ); - // draw at new destination - // NOTE: flipped drawing gets disabled for this, else the subimage would be drawn upside down - if( pSrc->IsFlipped() ) - { CGContextTranslateCTM( xCopyContext, 0, +mnHeight ); CGContextScaleCTM( xCopyContext, +1, -1 ); } - // TODO: pSrc->size() != this->size() - const CGPoint aDstPoint = { +pPosAry->mnDestX - pPosAry->mnSrcX, pPosAry->mnDestY - pPosAry->mnSrcY }; - if( !mnBitmapDepth || (aDstPoint.x + pSrc->mnWidth) <= mnWidth ) // workaround a Quartz crasher - ::CGContextDrawLayerAtPoint( xCopyContext, aDstPoint, pSrc->mxLayer ); - CGContextRestoreGState( xCopyContext ); - // mark the destination rectangle as updated - RefreshRect( aDstRect ); -#endif + if( pBitmap ) + { + SalTwoRect aPosAry( *pPosAry ); + aPosAry.mnSrcX = 0; + aPosAry.mnSrcY = 0; + drawBitmap( &aPosAry, *pBitmap ); + delete pBitmap; + } + } } // ----------------------------------------------------------------------- @@ -1082,7 +1101,7 @@ void AquaSalGraphics::copyArea( long nDstX, long nDstY,long nSrcX, long nSrcY, l delete pBitmap; } #else - DBG_ASSERT( mxLayer!=NULL, "AquaSalGraphics::copyArea() for non-layered graphics" ) + DBG_ASSERT( mxLayer!=NULL, "AquaSalGraphics::copyArea() for non-layered graphics" ); // in XOR mode the drawing context is redirected to the XOR mask // copyArea() always works on the target context though @@ -1190,7 +1209,7 @@ void AquaSalGraphics::drawMask( const SalTwoRect* pPosAry, const SalBitmap& rSal SalBitmap* AquaSalGraphics::getBitmap( long nX, long nY, long nDX, long nDY ) { - DBG_ASSERT( mxLayer, "AquaSalGraphics::getBitmap() with no layer" ) + DBG_ASSERT( mxLayer, "AquaSalGraphics::getBitmap() with no layer" ); ApplyXorContext(); @@ -1484,29 +1503,36 @@ static bool AddTempFontDir( const char* pDir ) FSRef aPathFSRef; Boolean bIsDirectory = true; OSStatus eStatus = FSPathMakeRef( reinterpret_cast<const UInt8*>(pDir), &aPathFSRef, &bIsDirectory ); + DBG_ASSERTWARNING( (eStatus==noErr) && bIsDirectory, "vcl AddTempFontDir() with invalid directory name!" ); if( eStatus != noErr ) return false; + // TODO: deactivate ATSFontContainerRef when closing app + ATSFontContainerRef aATSFontContainer; + + const ATSFontContext eContext = kATSFontContextLocal; // TODO: *Global??? +#if defined(MAC_OS_X_VERSION_10_5) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) + eStatus = ::ATSFontActivateFromFileReference( &aPathFSRef, + eContext, kATSFontFormatUnspecified, NULL, kATSOptionFlagsDefault, + &aATSFontContainer ); +#else FSSpec aPathFSSpec; eStatus = ::FSGetCatalogInfo( &aPathFSRef, kFSCatInfoNone, NULL, NULL, &aPathFSSpec, NULL ); if( eStatus != noErr ) return false; - // TODO: deactivate ATSFontContainerRef when closing app - ATSFontContainerRef aATSFontContainer; - - const ATSFontContext eContext = kATSFontContextLocal; // TODO: *Global??? eStatus = ::ATSFontActivateFromFileSpecification( &aPathFSSpec, eContext, kATSFontFormatUnspecified, NULL, kATSOptionFlagsDefault, &aATSFontContainer ); +#endif if( eStatus != noErr ) return false; return true; } -static bool AddTempFontDir( void ) +static bool AddLocalTempFontDirs( void ) { static bool bFirst = true; if( !bFirst ) @@ -1542,7 +1568,7 @@ void AquaSalGraphics::GetDevFontList( ImplDevFontList* pFontList ) { DBG_ASSERT( pFontList, "AquaSalGraphics::GetDevFontList(NULL) !"); - AddTempFontDir(); + AddLocalTempFontDirs(); // The idea is to cache the list of system fonts once it has been generated. // SalData seems to be a good place for this caching. However we have to @@ -1572,21 +1598,28 @@ bool AquaSalGraphics::AddTempDevFont( ImplDevFontList* pFontList, Boolean bIsDirectory = true; ::rtl::OString aCFileName = rtl::OUStringToOString( aUSytemPath, RTL_TEXTENCODING_UTF8 ); OSStatus eStatus = FSPathMakeRef( (UInt8*)aCFileName.getStr(), &aNewRef, &bIsDirectory ); + DBG_ASSERT( (eStatus==noErr) && !bIsDirectory, "vcl AddTempDevFont() with invalid fontfile name!" ); if( eStatus != noErr ) return false; + ATSFontContainerRef oContainer; + + const ATSFontContext eContext = kATSFontContextLocal; // TODO: *Global??? +#if defined(MAC_OS_X_VERSION_10_5) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5) + eStatus = ::ATSFontActivateFromFileReference( &aNewRef, + eContext, kATSFontFormatUnspecified, NULL, kATSOptionFlagsDefault, + &oContainer ); +#else FSSpec aFontFSSpec; eStatus = ::FSGetCatalogInfo( &aNewRef, kFSCatInfoNone, NULL, NULL, &aFontFSSpec, NULL ); if( eStatus != noErr ) return false; - ATSFontContainerRef oContainer; - - const ATSFontContext eContext = kATSFontContextLocal; // TODO: *Global??? eStatus = ::ATSFontActivateFromFileSpecification( &aFontFSSpec, eContext, kATSFontFormatUnspecified, NULL, kATSOptionFlagsDefault, &oContainer ); +#endif if( eStatus != noErr ) return false; @@ -2210,11 +2243,25 @@ SystemGraphicsData AquaSalGraphics::GetGraphicsData() const // ----------------------------------------------------------------------- -void AquaSalGraphics::SetXORMode( BOOL bSet ) +void AquaSalGraphics::SetXORMode( bool bSet, bool bInvertOnly ) { // return early if XOR mode remains unchanged if( mbPrinter ) return; + + if( ! bSet && mnXorMode == 2 ) + { + CGContextSetBlendMode( mrContext, kCGBlendModeNormal ); + mnXorMode = 0; + return; + } + else if( bSet && bInvertOnly && mnXorMode == 0) + { + CGContextSetBlendMode( mrContext, kCGBlendModeDifference ); + mnXorMode = 2; + return; + } + if( (mpXorEmulation == NULL) && !bSet ) return; if( (mpXorEmulation != NULL) && (bSet == mpXorEmulation->IsEnabled()) ) @@ -2234,12 +2281,14 @@ void AquaSalGraphics::SetXORMode( BOOL bSet ) { mpXorEmulation->Enable(); mrContext = mpXorEmulation->GetMaskContext(); + mnXorMode = 1; } else { mpXorEmulation->UpdateTarget(); mpXorEmulation->Disable(); mrContext = mpXorEmulation->GetTargetContext(); + mnXorMode = 0; } } diff --git a/vcl/aqua/source/gdi/salgdiutils.cxx b/vcl/aqua/source/gdi/salgdiutils.cxx index 938f25209287..066268791b11 100755 --- a/vcl/aqua/source/gdi/salgdiutils.cxx +++ b/vcl/aqua/source/gdi/salgdiutils.cxx @@ -143,6 +143,8 @@ void AquaSalGraphics::SetState() CGContextSetFillColor( mrContext, maFillColor.AsArray() ); CGContextSetStrokeColor( mrContext, maLineColor.AsArray() ); CGContextSetShouldAntialias( mrContext, false ); + if( mnXorMode == 2 ) + CGContextSetBlendMode( mrContext, kCGBlendModeDifference ); } // ---------------------------------------------------------------------- diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx index 620fc2647482..7c24e5098f2d 100644 --- a/vcl/aqua/source/gdi/salprn.cxx +++ b/vcl/aqua/source/gdi/salprn.cxx @@ -48,6 +48,8 @@ #include "com/sun/star/container/XNameAccess.hpp" #include "com/sun/star/beans/PropertyValue.hpp" +#include <algorithm> + using namespace rtl; using namespace vcl; using namespace com::sun::star::uno; @@ -122,11 +124,12 @@ void AquaSalInfoPrinter::SetupPrinterGraphics( CGContextRef i_rContext ) const long nDPIX = 720, nDPIY = 720; NSSize aPaperSize = [mpPrintInfo paperSize]; + NSRect aImageRect = [mpPrintInfo imageablePageBounds]; if( mePageOrientation == ORIENTATION_PORTRAIT ) { double dX = 0, dY = aPaperSize.height; - // dX += [mpPrintInfo leftMargin]; - // dY -= [mpPrintInfo topMargin]; + // dX += aImageRect.origin.x; + // dY -= aPaperSize.height - aImageRect.size.height - aImageRect.origin.y; CGContextTranslateCTM( i_rContext, dX + mnStartPageOffsetX, dY - mnStartPageOffsetY ); CGContextScaleCTM( i_rContext, 0.1, -0.1 ); } @@ -134,8 +137,8 @@ void AquaSalInfoPrinter::SetupPrinterGraphics( CGContextRef i_rContext ) const { CGContextRotateCTM( i_rContext, M_PI/2 ); double dX = aPaperSize.height, dY = -aPaperSize.width; - // dY += [mpPrintInfo topMargin]; - // dX -= [mpPrintInfo rightMargin]; + // dY += aPaperSize.height - aImageRect.size.height - aImageRect.origin.y; + // dX -= aImageRect.origin.x; CGContextTranslateCTM( i_rContext, dX + mnStartPageOffsetY, dY - mnStartPageOffsetX ); CGContextScaleCTM( i_rContext, -0.1, 0.1 ); @@ -440,10 +443,19 @@ void AquaSalInfoPrinter::GetPageInfo( const ImplJobSetup*, NSSize aPaperSize = [mpPrintInfo paperSize]; o_rPageWidth = static_cast<long>( double(aPaperSize.width) * fXScaling ); o_rPageHeight = static_cast<long>( double(aPaperSize.height) * fYScaling ); - o_rPageOffX = static_cast<long>( [mpPrintInfo leftMargin] * fXScaling ); - o_rPageOffY = static_cast<long>( [mpPrintInfo topMargin] * fYScaling ); - o_rOutWidth = static_cast<long>( o_rPageWidth - double([mpPrintInfo leftMargin] + [mpPrintInfo rightMargin]) * fXScaling ); - o_rOutHeight = static_cast<long>( o_rPageHeight - double([mpPrintInfo topMargin] + [mpPrintInfo bottomMargin]) * fYScaling ); + + NSRect aImageRect = [mpPrintInfo imageablePageBounds]; + o_rPageOffX = static_cast<long>( aImageRect.origin.x * fXScaling ); + o_rPageOffY = static_cast<long>( (aPaperSize.height - aImageRect.size.height - aImageRect.origin.y) * fYScaling ); + o_rOutWidth = static_cast<long>( aImageRect.size.width * fXScaling ); + o_rOutHeight = static_cast<long>( aImageRect.size.height * fYScaling ); + + if( mePageOrientation == ORIENTATION_LANDSCAPE ) + { + std::swap( o_rOutWidth, o_rOutHeight ); + std::swap( o_rPageWidth, o_rPageHeight ); + std::swap( o_rPageOffX, o_rPageOffY ); + } } } diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index 65bca3ea6862..5db3ea68ab14 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -406,8 +406,20 @@ void AquaSalFrame::Show(BOOL bVisible, BOOL bNoActivate) else [mpWindow makeKeyAndOrderFront: NSApp]; - if( mpParent && mpParent->mbShown ) - [mpParent->mpWindow addChildWindow: mpWindow ordered: NSWindowAbove]; + if( mpParent ) + { + /* #i92674# #i96433# we do not want an invisible parent to show up (which adding a visible + child implicitly does). However we also do not want a parentless toolbar. + + HACK: try to decide when we should not insert a child to its parent + floaters and ownerdraw windows have not yet shown up in cases where + we don't want the parent to become visible + */ + if( mpParent->mbShown || (mnStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION | SAL_FRAME_STYLE_FLOAT) ) ) + { + [mpParent->mpWindow addChildWindow: mpWindow ordered: NSWindowAbove]; + } + } if( mbPresentation ) [mpWindow makeMainWindow]; @@ -421,9 +433,9 @@ void AquaSalFrame::Show(BOOL bVisible, BOOL bNoActivate) //YieldMutexReleaser aRel; - // #i90440# work around the focus going back to some other window - // if a child gets hidden for a fullscreen window - if( mpParent && mpParent->mbFullScreen && mpParent->mbShown ) + // #i90440# #i94443# work around the focus going back to some other window + // if a child gets hidden for a parent window + if( mpParent && mpParent->mbShown && [mpWindow isKeyWindow] ) [mpParent->mpWindow makeKeyAndOrderFront: NSApp]; [SalFrameView unsetMouseFrame: this]; @@ -1091,9 +1103,10 @@ void AquaSalFrame::UpdateSettings( AllSettings& rSettings ) Color aBackgroundColor = Color( 0xEC, 0xEC, 0xEC ); aStyleSettings.Set3DColors( aBackgroundColor ); aStyleSettings.SetFaceColor( aBackgroundColor ); - aStyleSettings.SetInactiveTabColor( aBackgroundColor ); + Color aInactiveTabColor( aBackgroundColor ); + aInactiveTabColor.DecreaseLuminance( 32 ); + aStyleSettings.SetInactiveTabColor( aInactiveTabColor ); - // [FIXME] Dialog Color is the one to modify to complete Aqua Theme on windows aStyleSettings.SetDialogColor( aBackgroundColor ); aStyleSettings.SetLightBorderColor( aBackgroundColor ); Color aShadowColor( aStyleSettings.GetShadowColor() ); diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index 77e7222bdec1..aee1bd351839 100755 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -36,6 +36,7 @@ #include "salframe.h" #include "salframeview.h" #include "aqua11yfactory.h" +#include <sal/alloca.h> #include "vcl/window.hxx" #include "vcl/svapp.hxx" @@ -129,6 +130,23 @@ static const struct ExceptionalKey { KEY_D, NSCommandKeyMask | NSShiftKeyMask | NSAlternateKeyMask } }; +static AquaSalFrame* getMouseContainerFrame() +{ + int nWindows = 0; + NSCountWindows( &nWindows ); + int* pWindows = (int*)alloca( nWindows * sizeof(int) ); + // note: NSWindowList is supposed to be in z-order front to back + NSWindowList( nWindows, pWindows ); + AquaSalFrame* pDispatchFrame = NULL; + for(int i = 0; i < nWindows && ! pDispatchFrame; i++ ) + { + NSWindow* pWin = [NSApp windowWithWindowNumber: pWindows[i]]; + if( pWin && [pWin isMemberOfClass: [SalFrameWindow class]] && [(SalFrameWindow*)pWin containsMouse] ) + pDispatchFrame = [(SalFrameWindow*)pWin getSalFrame]; + } + return pDispatchFrame; +} + @implementation SalFrameWindow -(id)initWithSalFrame: (AquaSalFrame*)pFrame { @@ -460,10 +478,23 @@ private: { // no, it is not // now we need to find the one it may be in - // use NSApp to check windows in ZOrder whether they contain the mouse pointer - NSWindow* pWindow = [NSApp makeWindowsPerform: @selector(containsMouse) inOrder: YES]; - if( pWindow && [pWindow isMemberOfClass: [SalFrameWindow class]] ) - pDispatchFrame = [(SalFrameWindow*)pWindow getSalFrame]; + /* #i93756# we ant to get enumerate the application windows in z-order + to check if any contains the mouse. This could be elegantly done with this + code: + + // use NSApp to check windows in ZOrder whether they contain the mouse pointer + NSWindow* pWindow = [NSApp makeWindowsPerform: @selector(containsMouse) inOrder: YES]; + if( pWindow && [pWindow isMemberOfClass: [SalFrameWindow class]] ) + pDispatchFrame = [(SalFrameWindow*)pWindow getSalFrame]; + + However if a non SalFrameWindow is on screen (like e.g. the file dialog) + it can be hit with the containsMouse selector, which it doesn't support. + Sadly NSApplication:makeWindowsPerform does not check (for performance reasons + I assume) whether a window supports a selector before sending it. + */ + AquaSalFrame* pMouseFrame = getMouseContainerFrame(); + if( pMouseFrame ) + pDispatchFrame = pMouseFrame; } } @@ -845,6 +876,11 @@ private: [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_WORD_BACKWARD character: 0 modifiers: 0]; } +-(void)moveWordLeftAndModifySelection: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_WORD_BACKWARD character: 0 modifiers: 0]; +} + -(void)moveWordRight: (id)aSender { [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_WORD_FORWARD character: 0 modifiers: 0]; @@ -860,26 +896,91 @@ private: [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_WORD_FORWARD character: 0 modifiers: 0]; } +-(void)moveWordRightAndModifySelection: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_WORD_FORWARD character: 0 modifiers: 0]; +} + -(void)moveToEndOfLine: (id)aSender { [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_END_OF_LINE character: 0 modifiers: 0]; } +-(void)moveToEndOfLineAndModifySelection: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_END_OF_LINE character: 0 modifiers: 0]; +} + -(void)moveToBeginningOfLine: (id)aSender { [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_LINE character: 0 modifiers: 0]; } +-(void)moveToBeginningOfLineAndModifySelection: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE character: 0 modifiers: 0]; +} + -(void)moveToEndOfParagraph: (id)aSender { [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH character: 0 modifiers: 0]; } +-(void)moveToEndOfParagraphAndModifySelection: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_END_OF_PARAGRAPH character: 0 modifiers: 0]; +} + +-(void)moveParagraphForward: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH character: 0 modifiers: 0]; +} + +-(void)moveParagraphForwardAndModifySelection: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_END_OF_PARAGRAPH character: 0 modifiers: 0]; +} + -(void)moveToBeginningOfParagraph: (id)aSender { [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH character: 0 modifiers: 0]; } +-(void)moveParagraphBackward: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH character: 0 modifiers: 0]; +} + +-(void)moveToBeginningOfParagraphAndModifySelection: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH character: 0 modifiers: 0]; +} + +-(void)moveParagraphBackwardAndModifySelection: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH character: 0 modifiers: 0]; +} + +-(void)moveToEndOfDocument: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT character: 0 modifiers: 0]; +} + +-(void)moveToEndOfDocumentAndModifySelection: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_END_OF_DOCUMENT character: 0 modifiers: 0]; +} + +-(void)moveToBeginningOfDocument: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT character: 0 modifiers: 0]; +} + +-(void)moveToBeginningOfDocumentAndModifySelection: (id)aSender +{ + [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT character: 0 modifiers: 0]; +} + -(void)moveUp: (id)aSender { [self sendKeyInputAndReleaseToFrame: KEY_UP character: 0 modifiers: 0]; @@ -1012,6 +1113,9 @@ private: aEvent.mnCharCode = aChar; aEvent.mnRepeat = FALSE; nRet = mpFrame->CallCallback( SALEVENT_KEYINPUT, &aEvent ); + std::map< NSEvent*, bool >::iterator it = GetSalData()->maKeyEventAnswer.find( mpLastEvent ); + if( it != GetSalData()->maKeyEventAnswer.end() ) + it->second = nRet ? true : false; if( AquaSalFrame::isAlive( mpFrame ) ) mpFrame->CallCallback( SALEVENT_KEYUP, &aEvent ); } @@ -1153,7 +1257,13 @@ private: return 0; } +#ifdef MAC_OS_X_VERSION_10_5 +/* build target 10.5 or greater */ +- (NSInteger)conversationIdentifier +#else +/* build target 10.4 */ - (long)conversationIdentifier +#endif { return (long)self; } diff --git a/vcl/aqua/source/window/salmenu.cxx b/vcl/aqua/source/window/salmenu.cxx index e8d4b6ad40a2..8128f9171ce1 100644 --- a/vcl/aqua/source/window/salmenu.cxx +++ b/vcl/aqua/source/window/salmenu.cxx @@ -369,10 +369,10 @@ bool AquaSalMenu::ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rR // adjust frame rect when necessary USHORT nArrangeIndex; Point position = pWin->ImplCalcPos( pWin, rRect, nFlags, nArrangeIndex ); - if( position.nB < rRect.nTop ) { + if( position.Y() < rRect.nTop ) { displayPopupFrame.origin.y += ( lineHeight*drawnItems ); } - if( position.nA < rRect.nLeft ) { + if( position.X() < rRect.nLeft ) { displayPopupFrame.origin.x -= popupFrame.size.width; } @@ -661,18 +661,32 @@ void AquaSalMenu::SetItemImage( unsigned nPos, SalMenuItem* pSMI, const Image& r } } -void AquaSalMenu::SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const XubString& rText ) +void AquaSalMenu::SetItemText( unsigned i_nPos, SalMenuItem* i_pSalMenuItem, const XubString& i_rText ) { - if (!pSalMenuItem) + if (!i_pSalMenuItem) return; - AquaSalMenuItem *pAquaSalMenuItem = (AquaSalMenuItem *) pSalMenuItem; + AquaSalMenuItem *pAquaSalMenuItem = (AquaSalMenuItem *) i_pSalMenuItem; - String aText( rText ); + String aText( i_rText ); // Delete mnemonics aText.EraseAllChars( '~' ); + /* #i90015# until there is a correct solution + strip out any appended (.*) in menubar entries + */ + if( mbMenuBar ) + { + xub_StrLen nPos = aText.SearchBackward( sal_Unicode( '(' ) ); + if( nPos != STRING_NOTFOUND ) + { + xub_StrLen nPos2 = aText.Search( sal_Unicode( ')' ) ); + if( nPos2 != STRING_NOTFOUND ) + aText.Erase( nPos, nPos2-nPos+1 ); + } + } + NSString* pString = CreateNSString( aText ); if (pString) { diff --git a/vcl/inc/vcl/canvasbitmap.hxx b/vcl/inc/vcl/canvasbitmap.hxx index 0d3512874a5c..b96afd9084c0 100644 --- a/vcl/inc/vcl/canvasbitmap.hxx +++ b/vcl/inc/vcl/canvasbitmap.hxx @@ -99,8 +99,10 @@ namespace unotools virtual ::com::sun::star::uno::Sequence< double > SAL_CALL convertColorSpace( const ::com::sun::star::uno::Sequence< double >& deviceColor, const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XColorSpace >& targetColorSpace ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::RGBColor > SAL_CALL convertToRGB( const ::com::sun::star::uno::Sequence< double >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor > SAL_CALL convertToARGB( const ::com::sun::star::uno::Sequence< double >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor > SAL_CALL convertToPARGB( const ::com::sun::star::uno::Sequence< double >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< double > SAL_CALL convertFromRGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::RGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< double > SAL_CALL convertFromARGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< double > SAL_CALL convertFromPARGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); virtual ::sal_Int32 SAL_CALL getBitsPerPixel( ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getComponentBitCounts( ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Int8 SAL_CALL getEndianness( ) throw (::com::sun::star::uno::RuntimeException); @@ -108,8 +110,10 @@ namespace unotools virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertToIntegerColorSpace( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& deviceColor, const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XIntegerBitmapColorSpace >& targetColorSpace ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::RGBColor > SAL_CALL convertIntegerToRGB( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor > SAL_CALL convertIntegerToARGB( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& deviceColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::RGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromARGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::ARGBColor >& rgbColor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); /** Create API wrapper for given BitmapEx diff --git a/vcl/inc/vcl/edit.hxx b/vcl/inc/vcl/edit.hxx index 968acd1ae6bb..534d63b3427c 100644 --- a/vcl/inc/vcl/edit.hxx +++ b/vcl/inc/vcl/edit.hxx @@ -97,7 +97,7 @@ private: DECL_DLLPRIVATE_LINK( ImplUpdateDataHdl, Timer* ); - SAL_DLLPRIVATE void ImplTruncateToMaxLen( rtl::OUString&, sal_uInt32 nSelectionLen ) const; + SAL_DLLPRIVATE bool ImplTruncateToMaxLen( rtl::OUString&, sal_uInt32 nSelectionLen ) const; SAL_DLLPRIVATE void ImplInitEditData(); SAL_DLLPRIVATE void ImplModified(); SAL_DLLPRIVATE XubString ImplGetText() const; diff --git a/vcl/inc/vcl/font.hxx b/vcl/inc/vcl/font.hxx index ad737c19ee01..2dfdef148a1d 100644 --- a/vcl/inc/vcl/font.hxx +++ b/vcl/inc/vcl/font.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: font.hxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.134.1 $ * * This file is part of OpenOffice.org. * @@ -116,6 +116,8 @@ public: FontRelief GetRelief() const; void SetUnderline( FontUnderline ); FontUnderline GetUnderline() const; + void SetOverline( FontUnderline ); + FontUnderline GetOverline() const; void SetStrikeout( FontStrikeout ); FontStrikeout GetStrikeout() const; void SetEmphasisMark( FontEmphasisMark ); diff --git a/vcl/inc/vcl/ilstbox.hxx b/vcl/inc/vcl/ilstbox.hxx index be36d3a7dcc7..e5f6696005fa 100644 --- a/vcl/inc/vcl/ilstbox.hxx +++ b/vcl/inc/vcl/ilstbox.hxx @@ -70,11 +70,13 @@ struct ImplEntryType void* mpUserData; BOOL mbIsSelected; long mnFlags; + long mnHeight; ImplEntryType( const XubString& rStr, const Image& rImage ) : maStr( rStr ), maImage( rImage ), - mnFlags(0) + mnFlags( 0 ), + mnHeight( 0 ) { mbIsSelected = FALSE; mpUserData = NULL; @@ -82,7 +84,8 @@ struct ImplEntryType ImplEntryType( const XubString& rStr ) : maStr( rStr ), - mnFlags(0) + mnFlags( 0 ), + mnHeight( 0 ) { mbIsSelected = FALSE; mpUserData = NULL; @@ -90,7 +93,8 @@ struct ImplEntryType ImplEntryType( const Image& rImage ) : maImage( rImage ), - mnFlags( 0 ) + mnFlags( 0 ), + mnHeight( 0 ) { mbIsSelected = FALSE; mpUserData = NULL; @@ -124,12 +128,20 @@ public: USHORT InsertEntry( USHORT nPos, ImplEntryType* pNewEntry, BOOL bSort ); void RemoveEntry( USHORT nPos ); const ImplEntryType* GetEntryPtr( USHORT nPos ) const { return (const ImplEntryType*) GetObject( nPos ); } + ImplEntryType* GetMutableEntryPtr( USHORT nPos ) const { return (ImplEntryType*) GetObject( nPos ); } void Clear(); USHORT FindMatchingEntry( const XubString& rStr, USHORT nStart = 0, BOOL bForward = TRUE, BOOL bLazy = TRUE ) const; USHORT FindEntry( const XubString& rStr, BOOL bSearchMRUArea = FALSE ) const; USHORT FindEntry( const void* pData ) const; + // helper: add up heights up to index nEndIndex. + // GetAddedHeight( 0 ) returns 0 + // GetAddedHeight( LISTBOX_ENTRY_NOTFOUND ) returns 0 + // GetAddedHeight( i, k ) with k > i is equivalent -GetAddedHeight( k, i ) + long GetAddedHeight( USHORT nEndIndex, USHORT nBeginIndex = 0, long nBeginHeight = 0 ) const; + long GetEntryHeight( USHORT nPos ) const; + USHORT GetEntryCount() const { return (USHORT)List::Count(); } BOOL HasImages() const { return mnImages ? TRUE : FALSE; } @@ -194,17 +206,16 @@ private: Size maUserItemSize; - USHORT mnMaxTxtHeight; // Maximale Hoehe eines Text-Items - USHORT mnMaxTxtWidth; // Maximale Breite eines Text-Items + long mnMaxTxtHeight; // Maximale Hoehe eines Text-Items + long mnMaxTxtWidth; // Maximale Breite eines Text-Items // Entry ohne Image - USHORT mnMaxImgTxtWidth;// Maximale Breite eines Text-Items + long mnMaxImgTxtWidth;// Maximale Breite eines Text-Items // Entry UND Image - USHORT mnMaxImgWidth; // Maximale Breite eines Image-Items - USHORT mnMaxImgHeight; // Maximale Hoehe eines Image-Items - USHORT mnMaxWidth; // Maximale Breite eines Eintrags - USHORT mnMaxHeight; // Maximale Hoehe eines Eintrags + long mnMaxImgWidth; // Maximale Breite eines Image-Items + long mnMaxImgHeight; // Maximale Hoehe eines Image-Items + long mnMaxWidth; // Maximale Breite eines Eintrags + long mnMaxHeight; // Maximale Hoehe eines Eintrags - USHORT mnMaxVisibleEntries; // Anzahl der sichtbaren Eintraege USHORT mnCurrentPos; // Position (Focus) USHORT mnTrackingSaveSelection; // Selektion vor Tracking(); @@ -213,9 +224,9 @@ private: USHORT mnUserDrawEntry; USHORT mnTop; // Ausgabe ab Zeile - USHORT mnLeft; // Ausgabe ab Spalte - USHORT mnBorder; // Abstand Rahmen - Text - USHORT mnTextHeight; // Texthoehe + long mnLeft; // Ausgabe ab Spalte + long mnBorder; // Abstand Rahmen - Text + long mnTextHeight; // Texthoehe USHORT mnSelectModifier; // Modifiers @@ -261,7 +272,7 @@ protected: void ImplPaint( USHORT nPos, BOOL bErase = FALSE, bool bLayout = false ); void ImplDoPaint( const Rectangle& rRect, bool bLayout = false ); void ImplCalcMetrics(); - void ImplCalcEntryMetrics( const ImplEntryType& rEntry, BOOL bUpdateMetrics ); + void ImplUpdateEntryMetrics( ImplEntryType& rEntry ); void ImplCallSelect(); void ImplShowFocusRect(); @@ -285,23 +296,25 @@ public: void ResetCurrentPos() { mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; } USHORT GetCurrentPos() const { return mnCurrentPos; } USHORT GetDisplayLineCount() const; + void SetEntryFlags( USHORT nPos, long nFlags ); void DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImagePos = FALSE, bool bLayout = false ); void SelectEntry( USHORT nPos, BOOL bSelect ); void DeselectAll(); USHORT GetEntryPosForPoint( const Point& rPoint ) const; + USHORT GetLastVisibleEntry() const; BOOL ProcessKeyInput( const KeyEvent& rKEvt ); void SetTopEntry( USHORT nTop ); USHORT GetTopEntry() const { return mnTop; } using Window::IsVisible; - BOOL IsVisible( USHORT nEntry ) const { return ( ( nEntry >= mnTop ) && ( nEntry < (mnTop+mnMaxVisibleEntries) ) ); } + BOOL IsVisible( USHORT nEntry ) const; - USHORT GetLeftIndent() const { return mnLeft; } - void SetLeftIndent( USHORT n ); - void ScrollHorz( short nDiff ); + long GetLeftIndent() const { return mnLeft; } + void SetLeftIndent( long n ); + void ScrollHorz( long nDiff ); void AllowGrabFocus( BOOL b ) { mbGrabFocus = b; } BOOL IsGrabFocusAllowed() const { return mbGrabFocus; } @@ -330,7 +343,6 @@ public: BOOL IsMouseMoveSelect() const { return mbMouseMoveSelect||mbStackMode; } Size CalcSize( USHORT nMaxLines ) const; - void CalcMaxVisibleEntries( const Size& rFloatSize); Rectangle GetBoundingRectangle( USHORT nItem ) const; long GetEntryHeight() const { return mnMaxHeight; } @@ -433,7 +445,7 @@ public: using Window::IsVisible; BOOL IsVisible( USHORT nEntry ) const { return maLBWindow.IsVisible( nEntry ); } - USHORT GetLeftIndent() const { return maLBWindow.GetLeftIndent(); } + long GetLeftIndent() const { return maLBWindow.GetLeftIndent(); } void SetLeftIndent( USHORT n ) { maLBWindow.SetLeftIndent( n ); } void ScrollHorz( short nDiff ) { maLBWindow.ScrollHorz( nDiff ); } diff --git a/vcl/inc/vcl/imgctrl.hxx b/vcl/inc/vcl/imgctrl.hxx index 2a9486f3e3cb..04d74799bdda 100644 --- a/vcl/inc/vcl/imgctrl.hxx +++ b/vcl/inc/vcl/imgctrl.hxx @@ -45,13 +45,14 @@ class VCL_DLLPUBLIC ImageControl : public FixedImage private: BitmapEx maBmp; BitmapEx maBmpHC; - BOOL mbScaleImage; + ::sal_Int16 mnScaleMode; public: ImageControl( Window* pParent, WinBits nStyle = 0 ); - void SetScaleImage( BOOL bScale ); - BOOL IsScaleImage() const; + // set/get the scale mode. This is one of the css.awt.ImageScaleMode constants + void SetScaleMode( const ::sal_Int16 _nMode ); + ::sal_Int16 GetScaleMode() const { return mnScaleMode; } virtual void Resize(); virtual void UserDraw( const UserDrawEvent& rUDEvt ); diff --git a/vcl/inc/vcl/impfont.hxx b/vcl/inc/vcl/impfont.hxx index 6607bf2a70d0..90d8793f513f 100644 --- a/vcl/inc/vcl/impfont.hxx +++ b/vcl/inc/vcl/impfont.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: impfont.hxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.134.1 $ * * This file is part of OpenOffice.org. * @@ -77,6 +77,7 @@ private: FontWidth meWidthType; FontItalic meItalic; FontUnderline meUnderline; + FontUnderline meOverline; FontStrikeout meStrikeout; FontRelief meRelief; FontEmphasisMark meEmphasisMark; diff --git a/vcl/inc/vcl/lstbox.h b/vcl/inc/vcl/lstbox.h index 1c58f7f7700b..6097422b556b 100644 --- a/vcl/inc/vcl/lstbox.h +++ b/vcl/inc/vcl/lstbox.h @@ -49,8 +49,15 @@ /** this flag disables a selection of an entry completly. It is not possible to select such entries either from the user interface nor from the ListBox methods. Cursor traveling is handled correctly. - This flag can be used to at titles to a ListBox. + This flag can be used to add titles to a ListBox. */ #define LISTBOX_ENTRY_FLAG_DISABLE_SELECTION 0x0000001 +/** this flag can be used to make an entry multine capable + A normal entry is single line and will therefore be clipped + at the right listbox border. Setting this flag enables + word breaks for the entry text. +*/ +#define LISTBOX_ENTRY_FLAG_MULTILINE 0x0000002 + #endif // _SV_LSTBOX_H diff --git a/vcl/inc/vcl/metaact.hxx b/vcl/inc/vcl/metaact.hxx index a3e75b1c4d32..5c502399d24b 100644 --- a/vcl/inc/vcl/metaact.hxx +++ b/vcl/inc/vcl/metaact.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: metaact.hxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.134.1 $ * * This file is part of OpenOffice.org. * @@ -104,6 +104,7 @@ class SvStream; #define META_GRADIENTEX_ACTION (148) #define META_LAYOUTMODE_ACTION (149) #define META_TEXTLANGUAGE_ACTION (150) +#define META_OVERLINECOLOR_ACTION (151) #define META_COMMENT_ACTION (512) @@ -631,6 +632,7 @@ private: long mnWidth; FontStrikeout meStrikeout; FontUnderline meUnderline; + FontUnderline meOverline; virtual sal_Bool Compare( const MetaAction& ) const; @@ -639,7 +641,8 @@ public: MetaTextLineAction( const Point& rPos, long nWidth, FontStrikeout eStrikeout, - FontUnderline eUnderline ); + FontUnderline eUnderline, + FontUnderline eOverline ); virtual void Move( long nHorzMove, long nVertMove ); virtual void Scale( double fScaleX, double fScaleY ); @@ -647,6 +650,7 @@ public: long GetWidth() const { return mnWidth; } FontStrikeout GetStrikeout() const { return meStrikeout; } FontUnderline GetUnderline() const { return meUnderline; } + FontUnderline GetOverline() const { return meOverline; } }; // ----------------- @@ -1221,6 +1225,28 @@ public: BOOL IsSetting() const { return mbSet; } }; +// --------------------------- +// - MetaOverlineColorAction - +// --------------------------- + +class VCL_DLLPUBLIC MetaOverlineColorAction : public MetaAction +{ +private: + + Color maColor; + BOOL mbSet; + + virtual sal_Bool Compare( const MetaAction& ) const; + +public: + DECL_META_ACTION( OverlineColor, META_OVERLINECOLOR_ACTION ) + + MetaOverlineColorAction( const Color& rColor, BOOL bSet ); + + const Color& GetColor() const { return maColor; } + BOOL IsSetting() const { return mbSet; } +}; + // ----------------------- // - MetaTextAlignAction - // ----------------------- diff --git a/vcl/inc/vcl/msgbox.hxx b/vcl/inc/vcl/msgbox.hxx index c80a71b42cb9..1d31ab722f29 100644 --- a/vcl/inc/vcl/msgbox.hxx +++ b/vcl/inc/vcl/msgbox.hxx @@ -129,6 +129,7 @@ public: InfoBox( Window* pParent, const ResId & rResId ); static Image GetStandardImage(); + static Image GetStandardImageHC(); }; // -------------- @@ -148,6 +149,7 @@ public: void SetDefaultCheckBoxText(); static Image GetStandardImage(); + static Image GetStandardImageHC(); }; // ------------ @@ -165,6 +167,7 @@ public: ErrorBox( Window* pParent, const ResId& rResId ); static Image GetStandardImage(); + static Image GetStandardImageHC(); }; // ------------ @@ -184,6 +187,7 @@ public: void SetDefaultCheckBoxText(); static Image GetStandardImage(); + static Image GetStandardImageHC(); }; #endif // _SV_MSGBOX_HXX diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index 7c33e21204c6..0736a83d2c72 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: outdev.hxx,v $ - * $Revision: 1.11.28.1 $ + * $Revision: 1.7.20.4 $ * * This file is part of OpenOffice.org. * @@ -158,7 +158,8 @@ struct KerningPair #define PUSH_TEXTLINECOLOR ((USHORT)0x0400) #define PUSH_TEXTLAYOUTMODE ((USHORT)0x0800) #define PUSH_TEXTLANGUAGE ((USHORT)0x1000) -#define PUSH_ALLTEXT (PUSH_TEXTCOLOR | PUSH_TEXTFILLCOLOR | PUSH_TEXTLINECOLOR | PUSH_TEXTALIGN | PUSH_TEXTLAYOUTMODE | PUSH_TEXTLANGUAGE) +#define PUSH_OVERLINECOLOR ((USHORT)0x2000) +#define PUSH_ALLTEXT (PUSH_TEXTCOLOR | PUSH_TEXTFILLCOLOR | PUSH_TEXTLINECOLOR | PUSH_OVERLINECOLOR | PUSH_TEXTALIGN | PUSH_TEXTLAYOUTMODE | PUSH_TEXTLANGUAGE) #define PUSH_ALLFONT (PUSH_ALLTEXT | PUSH_FONT) #define PUSH_ALL ((USHORT)0xFFFF) @@ -364,6 +365,7 @@ private: Font maFont; Color maTextColor; Color maTextLineColor; + Color maOverlineColor; TextAlign meTextAlign; RasterOp meRasterOp; Wallpaper maBackground; @@ -394,7 +396,6 @@ private: mbRefPoint:1, mbEnableRTL:1; -//#if 0 // _SOLAR__PRIVATE public: SAL_DLLPRIVATE sal_Int32 ImplGetDPIX() const { return mnDPIX; } SAL_DLLPRIVATE sal_Int32 ImplGetDPIY() const { return mnDPIY; } @@ -431,7 +432,7 @@ public: const String& rOrigStr, USHORT nStyle, MetricVector* pVector, String* pDisplayText ); SAL_DLLPRIVATE void ImplDrawTextBackground( const SalLayout& ); - SAL_DLLPRIVATE void ImplDrawTextLines( SalLayout&, FontStrikeout eStrikeout, FontUnderline eUnderline, BOOL bWordLine, BOOL bUnderlineAbove ); + SAL_DLLPRIVATE void ImplDrawTextLines( SalLayout&, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, BOOL bWordLine, BOOL bUnderlineAbove ); SAL_DLLPRIVATE bool ImplDrawRotateText( SalLayout& ); SAL_DLLPRIVATE void ImplDrawTextDirect( SalLayout&, BOOL bTextLines ); SAL_DLLPRIVATE void ImplDrawSpecialText( SalLayout& ); @@ -444,7 +445,11 @@ public: SAL_DLLPRIVATE void ImplInitTextLineSize(); SAL_DLLPRIVATE void ImplInitAboveTextLineSize(); SAL_DLLPRIVATE void ImplDrawWaveLine( long nBaseX, long nBaseY, long nStartX, long nStartY, long nWidth, long nHeight, long nLineWidth, short nOrientation, const Color& rColor ); - SAL_DLLPRIVATE void ImplDrawTextLine( long nBaseX, long nX, long nY, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, BOOL bUnderlineAbove ); + SAL_DLLPRIVATE void ImplDrawWaveTextLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontUnderline eTextLine, Color aColor, BOOL bIsAbove ); + SAL_DLLPRIVATE void ImplDrawStraightTextLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontUnderline eTextLine, Color aColor, BOOL bIsAbove ); + SAL_DLLPRIVATE void ImplDrawStrikeoutLine( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontStrikeout eStrikeout, Color aColor ); + SAL_DLLPRIVATE void ImplDrawStrikeoutChar( long nBaseX, long nBaseY, long nX, long nY, long nWidth, FontStrikeout eStrikeout, Color aColor ); + SAL_DLLPRIVATE void ImplDrawTextLine( long nBaseX, long nX, long nY, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, BOOL bUnderlineAbove ); SAL_DLLPRIVATE void ImplDrawMnemonicLine( long nX, long nY, long nWidth ); SAL_DLLPRIVATE void ImplGetEmphasisMark( PolyPolygon& rPolyPoly, BOOL& rPolyLine, Rectangle& rRect1, Rectangle& rRect2, long& rYOff, long& rWidth, FontEmphasisMark eEmphasis, long nHeight, short nOrient ); SAL_DLLPRIVATE void ImplDrawEmphasisMark( long nBaseX, long nX, long nY, const PolyPolygon& rPolyPoly, BOOL bPolyLine, const Rectangle& rRect1, const Rectangle& rRect2 ); @@ -550,7 +555,10 @@ public: SAL_DLLPRIVATE static FontEmphasisMark ImplGetEmphasisMarkStyle( const Font& rFont ); SAL_DLLPRIVATE static BOOL ImplIsUnderlineAbove( const Font& ); -//#endif + + + // tells whether this output device is RTL in an LTR UI or LTR in a RTL UI + SAL_DLLPRIVATE bool ImplIsAntiparallel() const ; protected: OutputDevice(); @@ -579,6 +587,7 @@ public: void DrawTextLine( const Point& rPos, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, + FontUnderline eOverline, BOOL bUnderlineAbove = FALSE ); static BOOL IsTextUnderlineAbove( const Font& rFont ); @@ -884,6 +893,10 @@ public: void SetTextLineColor( const Color& rColor ); const Color& GetTextLineColor() const { return maTextLineColor; } BOOL IsTextLineColor() const { return (maTextLineColor.GetTransparency() == 0); } + void SetOverlineColor(); + void SetOverlineColor( const Color& rColor ); + const Color& GetOverlineColor() const { return maOverlineColor; } + BOOL IsOverlineColor() const { return (maOverlineColor.GetTransparency() == 0); } void SetTextAlign( TextAlign eAlign ); TextAlign GetTextAlign() const { return maFont.GetAlign(); } @@ -1030,6 +1043,19 @@ public: xub_StrLen HasGlyphs( const Font& rFont, const String& rStr, xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN ) const; + long GetMinKashida() const; + long GetMinKashida( const Font& rFont ) const; + + // i60594 + // validate kashida positions against the current font + // returns count of invalid kashida positions + xub_StrLen ValidateKashidas ( const String& rTxt, + xub_StrLen nIdx, xub_StrLen nLen, + xub_StrLen nKashCount, // number of suggested kashida positions (in) + const xub_StrLen* pKashidaPos, // suggested kashida positions (in) + xub_StrLen* pKashidaPosDropped // invalid kashida positions (out) + ) const; + USHORT GetBitCount() const; BOOL GetTextIsRTL( const String&, xub_StrLen nIndex, diff --git a/vcl/inc/vcl/outfont.hxx b/vcl/inc/vcl/outfont.hxx index 44c0975cd8f2..86a5e59f6345 100644 --- a/vcl/inc/vcl/outfont.hxx +++ b/vcl/inc/vcl/outfont.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: outfont.hxx,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.14.2 $ * * This file is part of OpenOffice.org. * @@ -279,17 +279,25 @@ public: void ImplInitAboveTextLineSize(); public: // TODO: hide members behind accessor methods + // font instance attributes from the font request long mnWidth; // Reference Width + short mnOrientation; // Rotation in 1/10 degrees + + // font metrics measured for the font instance long mnAscent; // Ascent long mnDescent; // Descent long mnIntLeading; // Internal Leading long mnExtLeading; // External Leading int mnSlant; // Slant (Italic/Oblique) + long mnMinKashida; // Minimal width of kashida (Arabic) + + // font attributes queried from the font instance int meFamilyType; // Font Family Type - short mnOrientation; // Rotation in 1/10 degrees bool mbDevice; // Flag for Device Fonts bool mbScalableFont; bool mbKernableFont; + + // font metrics that are usually derived from the measurements long mnUnderlineSize; // Lineheight of Underline long mnUnderlineOffset; // Offset from Underline to Baseline long mnBUnderlineSize; // Hoehe von fetter Unterstreichung diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx index c69553b8f3de..bdf636754c77 100644 --- a/vcl/inc/vcl/pdfwriter.hxx +++ b/vcl/inc/vcl/pdfwriter.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: pdfwriter.hxx,v $ - * $Revision: 1.8.86.1 $ + * $Revision: 1.8.134.1 $ * * This file is part of OpenOffice.org. * @@ -693,6 +693,8 @@ The following structure describes the permissions used in PDF security void SetTextLineColor(); void SetTextLineColor( const Color& rColor ); + void SetOverlineColor(); + void SetOverlineColor( const Color& rColor ); void SetTextAlign( ::TextAlign eAlign ); void SetMapMode(); @@ -705,6 +707,7 @@ The following structure describes the permissions used in PDF security void DrawTextLine( const Point& rPos, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, + FontUnderline eOverline, BOOL bUnderlineAbove = FALSE ); void DrawTextArray( const Point& rStartPt, const XubString& rStr, const sal_Int32* pDXAry = NULL, diff --git a/vcl/inc/vcl/salgdi.hxx b/vcl/inc/vcl/salgdi.hxx index b651a8d02ade..2bbb44d67b42 100644 --- a/vcl/inc/vcl/salgdi.hxx +++ b/vcl/inc/vcl/salgdi.hxx @@ -102,7 +102,16 @@ typedef std::vector< sal_Int32 > Int32Vector; class VCL_DLLPUBLIC SalGraphics { int m_nLayout; // 0: mirroring off, 1: mirror x-axis + +protected: + // flags which hold the SetAntialiasing() value from OutputDevice + bool m_bAntiAliasB2DDraw; + public: + // get/set AA + void setAntiAliasB2DDraw(bool bNew) { m_bAntiAliasB2DDraw = bNew; } + bool getAntiAliasB2DDraw() const { return m_bAntiAliasB2DDraw; } + SalGraphics(); virtual ~SalGraphics(); @@ -214,7 +223,7 @@ public: // filled accordingly virtual void SetFillColor( SalColor nSalColor ) = 0; // enable/disable XOR drawing - virtual void SetXORMode( BOOL bSet ) = 0; + virtual void SetXORMode( bool bSet, bool bInvertOnly ) = 0; // set line color for raster operations virtual void SetROPLineColor( SalROPColor nROPColor ) = 0; // set fill color for raster operations @@ -343,7 +352,10 @@ public: BOOL mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint *pPtAry2, const OutputDevice *pOutDev, bool bBack = false ) const; void mirror( Rectangle& rRect, const OutputDevice*, bool bBack = false ) const; void mirror( Region& rRgn, const OutputDevice *pOutDev, bool bBack = false ) const; - void mirror(ControlType,const ImplControlValue&,const OutputDevice*,bool bBack = false) const; + void mirror( ControlType,const ImplControlValue&,const OutputDevice*,bool bBack = false) const; + basegfx::B2DPoint mirror( const basegfx::B2DPoint& i_rPoint, const OutputDevice *pOutDev, bool bBack = false ) const; + basegfx::B2DPolygon mirror( const basegfx::B2DPolygon& i_rPoly, const OutputDevice *pOutDev, bool bBack = false ) const; + basegfx::B2DPolyPolygon mirror( const basegfx::B2DPolyPolygon& i_rPoly, const OutputDevice *pOutDev, bool bBack = false ) const; // non virtual methods; these do eventual coordinate mirroring and // then delegate to protected virtual methods diff --git a/vcl/inc/vcl/sallayout.hxx b/vcl/inc/vcl/sallayout.hxx index 6e736de87526..d40dde9014bc 100755 --- a/vcl/inc/vcl/sallayout.hxx +++ b/vcl/inc/vcl/sallayout.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: sallayout.hxx,v $ - * $Revision: 1.8 $ + * $Revision: 1.8.54.1 $ * * This file is part of OpenOffice.org. * @@ -206,6 +206,7 @@ public: virtual long FillDXArray( sal_Int32* pDXArray ) const = 0; virtual long GetTextWidth() const { return FillDXArray( NULL ); } virtual void GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const = 0; + virtual bool IsKashidaPosValid ( int /*nCharPos*/ ) const { return true; } // i60594 // methods using glyph indexing virtual int GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIdAry, Point& rPos, int&, @@ -223,6 +224,7 @@ public: virtual void MoveGlyph( int nStart, long nNewXPos ) = 0; virtual void DropGlyph( int nStart ) = 0; virtual void Simplify( bool bIsBase ) = 0; + virtual void DisableGlyphInjection( bool /*bDisable*/ ) {} protected: // used by layout engines diff --git a/vcl/inc/vcl/svdata.hxx b/vcl/inc/vcl/svdata.hxx index e252cb5793f1..455c68b90ab0 100644 --- a/vcl/inc/vcl/svdata.hxx +++ b/vcl/inc/vcl/svdata.hxx @@ -223,7 +223,8 @@ struct ImplSVWinData Window* mpExtTextInputWin; // Window, which is in ExtTextInput Window* mpTrackWin; // window, that is in tracking mode AutoTimer* mpTrackTimer; // tracking timer - ImageList* mpMsgBoxImgList; // ImageList for MessageBoxen + ImageList* mpMsgBoxImgList; // ImageList for MessageBox + ImageList* mpMsgBoxHCImgList; // ImageList for MessageBox (high contrast mode) Window* mpAutoScrollWin; // window, that is in AutoScrollMode mode USHORT mnTrackFlags; // tracking flags USHORT mnAutoScrollFlags; // auto scroll flags diff --git a/vcl/inc/vcl/svids.hrc b/vcl/inc/vcl/svids.hrc index 93a8b5cf3d46..da34f04abd2c 100644 --- a/vcl/inc/vcl/svids.hrc +++ b/vcl/inc/vcl/svids.hrc @@ -44,6 +44,7 @@ #define SV_RESID_BITMAP_RADIO 1010 #define SV_RESID_BITMAP_MSGBOX 1020 +#define SV_RESID_BITMAP_MSGBOX_HC 1021 #define SV_RESID_BITMAP_PIN 1030 diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx index 94d380a80b32..b12d33d579a3 100644 --- a/vcl/inc/vcl/tabctrl.hxx +++ b/vcl/inc/vcl/tabctrl.hxx @@ -55,7 +55,7 @@ class PushButton; class VCL_DLLPUBLIC TabControl : public Control { private: - ImplTabItemList* mpItemList; + void* mpDummyPtr; // FIXME: remove before integration ImplTabCtrlData* mpTabCtrlData; long mnLastWidth; long mnLastHeight; @@ -136,6 +136,7 @@ public: USHORT nPos = TAB_APPEND ); void RemovePage( USHORT nPageId ); void Clear(); + void EnablePage( USHORT nPageId, bool bEnable = true ); USHORT GetPageCount() const; USHORT GetPageId( USHORT nPos ) const; @@ -168,6 +169,9 @@ public: void SetHelpId( USHORT nPageId, ULONG nHelpId ); ULONG GetHelpId( USHORT nPageId ) const; + void SetPageImage( USHORT nPageId, const Image& rImage ); + const Image* GetPageImage( USHORT nPageId ) const; + void SetHelpText( const XubString& rText ) { Control::SetHelpText( rText ); } const XubString& GetHelpText() const diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index d51a794441b0..6f7c18ac2730 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -258,6 +258,7 @@ typedef USHORT StateChangedType; #define STATE_CHANGE_READONLY ((StateChangedType)16) #define STATE_CHANGE_FORMAT ((StateChangedType)17) #define STATE_CHANGE_EXTENDEDSTYLE ((StateChangedType)18) +#define STATE_CHANGE_MIRRORING ((StateChangedType)19) #define STATE_CHANGE_USER ((StateChangedType)10000) // GetFocusFlags @@ -557,7 +558,7 @@ public: SAL_DLLPRIVATE static void ImplInitAppFontData( Window* pWindow ); SAL_DLLPRIVATE void ImplInitSalControlHandle(); - SAL_DLLPRIVATE void ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev, const Region* pOuterClip = NULL ); + SAL_DLLPRIVATE void ImplPaintToDevice( OutputDevice* pTargetOutDev, const Point& rPos ); SAL_DLLPRIVATE BOOL ImplIsInTaskPaneList(); SAL_DLLPRIVATE void ImplIsInTaskPaneList( BOOL mbIsInTaskList ); diff --git a/vcl/os2/inc/salframe.h b/vcl/os2/inc/salframe.h index d3c0ec8ca233..dd8c441ca255 100644 --- a/vcl/os2/inc/salframe.h +++ b/vcl/os2/inc/salframe.h @@ -158,6 +158,7 @@ public: virtual void SetParent( SalFrame* pNewParent ); virtual bool SetPluginParent( SystemParentData* pNewParent ); virtual void SetBackgroundBitmap( SalBitmap* ); + virtual void SetScreenNumber( unsigned int ); virtual void ResetClipRegion(); virtual void BeginSetClipRegion( ULONG nRects ); virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ); diff --git a/vcl/os2/inc/salgdi.h b/vcl/os2/inc/salgdi.h index 1a82e068b434..5e70f50ada79 100644 --- a/vcl/os2/inc/salgdi.h +++ b/vcl/os2/inc/salgdi.h @@ -64,7 +64,7 @@ public: virtual ImplFontEntry* CreateFontInstance( ImplFontSelectData& ) const; virtual sal_IntPtr GetFontId() const; void SetFontId( sal_IntPtr nId ) { mnId = nId; } - void UpdateFromHPS( HPS ); + void UpdateFromHPS( HPS ) const; bool HasChar( sal_uInt32 cChar ) const; @@ -77,15 +77,15 @@ public: bool AliasSymbolsHigh() const { return mbAliasSymbolsHigh; } bool AliasSymbolsLow() const { return mbAliasSymbolsLow; } - ImplFontCharMap* GetImplFontCharMap(); + ImplFontCharMap* GetImplFontCharMap() const; private: sal_IntPtr mnId; - bool mbDisableGlyphApi; - bool mbHasKoreanRange; - bool mbHasCJKSupport; + mutable bool mbDisableGlyphApi; + mutable bool mbHasKoreanRange; + mutable bool mbHasCJKSupport; - ImplFontCharMap* mpUnicodeMap; + mutable ImplFontCharMap* mpUnicodeMap; // TODO: get rid of the members below needed to work with the Win9x non-unicode API BYTE* mpFontCharSets; // all Charsets for the current font (used on W98 for kerning) @@ -97,8 +97,8 @@ private: PFONTMETRICS pFontMetric; private: - void ReadCmapTable( HDC ); - void ReadOs2Table( HDC ); + void ReadCmapTable( HDC ) const; + void ReadOs2Table( HDC ) const; #ifdef GNG_VERT_HACK void ReadGsubTable( HDC ) const; @@ -137,9 +137,9 @@ public: BOOL mbVirDev; // is VirDev BOOL mbWindow; // is Window BOOL mbScreen; // is Screen compatible - BOOL mbXORMode; // _every_ output with RasterOp XOR + bool mbXORMode; // _every_ output with RasterOp XOR ULONG mhFonts[ MAX_FALLBACK ]; // Font + Fallbacks - ImplOs2FontData* mpOs2FontData[ MAX_FALLBACK ]; // pointer to the most recent font face + const ImplOs2FontData* mpOs2FontData[ MAX_FALLBACK ]; // pointer to the most recent font face ImplOs2FontEntry* mpOs2FontEntry[ MAX_FALLBACK ]; // pointer to the most recent font instance ULONG mhDefFont; // DefaultFont float mfFontScale; // allows metrics emulation of huge font sizes @@ -155,6 +155,7 @@ public: protected: virtual BOOL unionClipRegion( long nX, long nY, long nWidth, long nHeight ); + virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& ); // draw --> LineColor and FillColor and RasterOp and ClipRegion virtual void drawPixel( long nX, long nY ); virtual void drawPixel( long nX, long nY, SalColor nSalColor ); @@ -163,6 +164,8 @@ protected: virtual void drawPolyLine( ULONG nPoints, const SalPoint* pPtAry ); virtual void drawPolygon( ULONG nPoints, const SalPoint* pPtAry ); virtual void drawPolyPolygon( ULONG nPoly, const ULONG* pPoints, PCONSTSALPOINT* pPtAry ); + virtual bool drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double fTransparency ); + virtual bool drawPolyLine( const ::basegfx::B2DPolygon&, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin); virtual sal_Bool drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); virtual sal_Bool drawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ); virtual sal_Bool drawPolyPolygonBezier( ULONG nPoly, const ULONG* pPoints, const SalPoint* const* pPtAry, const BYTE* const* pFlgAry ); @@ -242,7 +245,7 @@ public: // filled accordingly virtual void SetFillColor( SalColor nSalColor ); // enable/disable XOR drawing - virtual void SetXORMode( BOOL bSet ); + virtual void SetXORMode( bool bSet, bool ); // set line color for raster operations virtual void SetROPLineColor( SalROPColor nROPColor ); // set fill color for raster operations @@ -277,7 +280,7 @@ public: // implementation note: encoding 0 with glyph id 0 should be added implicitly // as "undefined character" virtual BOOL CreateFontSubset( const rtl::OUString& rToFile, - ImplFontData* pFont, + const ImplFontData* pFont, long* pGlyphIDs, sal_uInt8* pEncoding, sal_Int32* pWidths, @@ -309,7 +312,7 @@ public: // frees the font data again virtual void FreeEmbedFontData( const void* pData, long nDataLen ); - virtual void GetGlyphWidths( ImplFontData* pFont, + virtual void GetGlyphWidths( const ImplFontData* pFont, bool bVertical, Int32Vector& rWidths, Ucs2UIntMap& rUnicodeEnc ); diff --git a/vcl/os2/inc/salinst.h b/vcl/os2/inc/salinst.h index 83d736592a93..119324c1acd6 100644 --- a/vcl/os2/inc/salinst.h +++ b/vcl/os2/inc/salinst.h @@ -41,9 +41,6 @@ namespace vos { class OMutex; } // ------------------- class SalYieldMutex; -//class SalInstance; -//class SalFrame; -//class SalObject; #define SAL_COMMANDLINENOINIT ((USHORT)0xFFFF) #define SAL_MAXPARAM 40 @@ -57,8 +54,6 @@ public: int mnArgc; // commandline param count char** mpArgv; // commandline HWND mhComWnd; // window, for communication (between threads and the main thread) - //void* mpFilterInst; // hack for clipboard - //void* mpFilterCallback; // hack for clipboard SalYieldMutex* mpSalYieldMutex; // Sal-Yield-Mutex vos::OMutex* mpSalWaitMutex; // Sal-Wait-Mutex USHORT mnYieldWaitCount; // Wait-Count @@ -86,7 +81,6 @@ public: virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ); virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ); virtual String GetDefaultPrinter(); - virtual SalSound* CreateSalSound(); virtual SalTimer* CreateSalTimer(); virtual SalI18NImeStatus* CreateI18NImeStatus(); virtual SalSystem* CreateSalSystem(); diff --git a/vcl/os2/inc/salobj.h b/vcl/os2/inc/salobj.h index 9fefa2ddc54a..aa566808a41f 100644 --- a/vcl/os2/inc/salobj.h +++ b/vcl/os2/inc/salobj.h @@ -32,7 +32,6 @@ #define _SV_SALOBJ_H #include <vcl/sv.h> -#include <sysdata.hxx> #include <vcl/salobj.hxx> // ----------------- diff --git a/vcl/os2/source/app/makefile.mk b/vcl/os2/source/app/makefile.mk index b3349d9f32ee..e2c14fb1744a 100644 --- a/vcl/os2/source/app/makefile.mk +++ b/vcl/os2/source/app/makefile.mk @@ -49,7 +49,6 @@ YD00_CXXFILES=\ salinst.cxx \ sallang.cxx \ saltimer.cxx \ - salsound.cxx \ salsys.cxx SLOFILES= $(SLO)$/salshl.obj \ @@ -57,10 +56,7 @@ SLOFILES= $(SLO)$/salshl.obj \ $(SLO)$/salinfo.obj \ $(SLO)$/salinst.obj \ $(SLO)$/sallang.obj \ - $(SLO)$/saltimer.obj \ - $(SLO)$/salsound.obj - -# $(SLO)$/salsys.obj + $(SLO)$/saltimer.obj # --- Targets ------------------------------------------------------ diff --git a/vcl/os2/source/app/salinst.cxx b/vcl/os2/source/app/salinst.cxx index 6632daff90ef..a14881c253ee 100644 --- a/vcl/os2/source/app/salinst.cxx +++ b/vcl/os2/source/app/salinst.cxx @@ -52,7 +52,6 @@ #include <salframe.h> #include <salobj.h> #include <saltimer.h> -#include <salsound.h> #include <salbmp.h> #include <vcl/salimestatus.hxx> #include <vcl/timer.hxx> @@ -821,13 +820,6 @@ SalTimer* Os2SalInstance::CreateSalTimer() // ----------------------------------------------------------------------- -SalSound* Os2SalInstance::CreateSalSound() -{ - return new Os2SalSound(); -} - -// ----------------------------------------------------------------------- - SalBitmap* Os2SalInstance::CreateSalBitmap() { return new Os2SalBitmap(); diff --git a/vcl/os2/source/app/sallang.cxx b/vcl/os2/source/app/sallang.cxx index f27398b3c463..c15a61332aa4 100644 --- a/vcl/os2/source/app/sallang.cxx +++ b/vcl/os2/source/app/sallang.cxx @@ -1,370 +1,120 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: sallang.cxx,v $ - * $Revision: 1.5 $ - * - * 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. - * - ************************************************************************/ - -#include <sallang.hxx> - -// ======================================================================= - -// ----------------------------------------------------------------------- -// Danish - -static const wchar_t* aImplLangDanishTab[LSTR_COUNT] = -{ - L"Skift", // LSTR_KEY_SHIFT - L"Ctrl", // LSTR_KEY_CTRL - L"Alt", // LSTR_KEY_ALT - L"Op", // LSTR_KEY_UP - L"Ned", // LSTR_KEY_DOWN - L"Venstre", // LSTR_KEY_LEFT - L"Hjre", // LSTR_KEY_RIGHT - L"Home", // LSTR_KEY_HOME - L"End", // LSTR_KEY_END - L"PageUp", // LSTR_KEY_PAGEUP - L"PageDown", // LSTR_KEY_PAGEDOWN - L"Enter", // LSTR_KEY_RETURN - L"Esc", // LSTR_KEY_ESC - L"Tab", // LSTR_KEY_TAB - L"Tilbage", // LSTR_KEY_BACKSPACE - L"Mellemrum", // LSTR_KEY_SPACE - L"Insert", // LSTR_KEY_INSERT - L"Delete", // LSTR_KEY_DELETE -}; - -// ----------------------------------------------------------------------- -// Dutch (Netherland/Belgian) - -static const wchar_t* aImplLangDutchTab[LSTR_COUNT] = -{ - L"Shift", // LSTR_KEY_SHIFT - L"Ctrl", // LSTR_KEY_CTRL - L"Alt", // LSTR_KEY_ALT - L"Boven", // LSTR_KEY_UP - L"Onder", // LSTR_KEY_DOWN - L"Links", // LSTR_KEY_LEFT - L"Links", // LSTR_KEY_RIGHT - L"Pos1", // LSTR_KEY_HOME - L"Einde", // LSTR_KEY_END - L"PageUp", // LSTR_KEY_PAGEUP - L"PageDown", // LSTR_KEY_PAGEDOWN - L"Return", // LSTR_KEY_RETURN - L"Esc", // LSTR_KEY_ESC - L"Tab", // LSTR_KEY_TAB - L"Backspace", // LSTR_KEY_BACKSPACE - L"Spatiebalk", // LSTR_KEY_SPACE - L"Ins", // LSTR_KEY_INSERT - L"Verwijderen", // LSTR_KEY_DELETE -}; - -// ----------------------------------------------------------------------- -// English (US/UK/AUS/CAN/NZ/EIRE/SAFRICA/JAMAICA/CARRIBEAN) - -static const wchar_t* aImplLangEnglishTab[LSTR_COUNT] = -{ - L"Shift", // LSTR_KEY_SHIFT - L"Ctrl", // LSTR_KEY_CTRL - L"Alt", // LSTR_KEY_ALT - L"Up", // LSTR_KEY_UP - L"Down", // LSTR_KEY_DOWN - L"Left", // LSTR_KEY_LEFT - L"Right", // LSTR_KEY_RIGHT - L"Home", // LSTR_KEY_HOME - L"End", // LSTR_KEY_END - L"PageUp", // LSTR_KEY_PAGEUP - L"PageDown", // LSTR_KEY_PAGEDOWN - L"Enter", // LSTR_KEY_RETURN - L"Esc", // LSTR_KEY_ESC - L"Tab", // LSTR_KEY_TAB - L"Backspace", // LSTR_KEY_BACKSPACE - L"Space", // LSTR_KEY_SPACE - L"Insert", // LSTR_KEY_INSERT - L"Del", // LSTR_KEY_DELETE -}; - -// ----------------------------------------------------------------------- -// Finnish - -static const wchar_t* aImplLangFinnishTab[LSTR_COUNT] = -{ - L"Vaihtonppain", // LSTR_KEY_SHIFT - L"Ctrl", // LSTR_KEY_CTRL - L"Alt", // LSTR_KEY_ALT - L"Yl", // LSTR_KEY_UP - L"Ala", // LSTR_KEY_DOWN - L"Vasen", // LSTR_KEY_LEFT - L"Oikea", // LSTR_KEY_RIGHT - L"Home", // LSTR_KEY_HOME - L"End", // LSTR_KEY_END - L"PageUp", // LSTR_KEY_PAGEUP - L"PageDown", // LSTR_KEY_PAGEDOWN - L"Enter", // LSTR_KEY_RETURN - L"Esc", // LSTR_KEY_ESC - L"Sarkain", // LSTR_KEY_TAB - L"Askelpalautin", // LSTR_KEY_BACKSPACE - L"Vlinppin", // LSTR_KEY_SPACE - L"Insert", // LSTR_KEY_INSERT - L"Delete", // LSTR_KEY_DELETE -}; - -// ----------------------------------------------------------------------- -// French (French/Belgian/Canadian/Swiss/Luxenbourg) - -static const wchar_t* aImplLangFrenchTab[LSTR_COUNT] = -{ - L"Maj", // LSTR_KEY_SHIFT - L"Ctrl", // LSTR_KEY_CTRL - L"Alt", // LSTR_KEY_ALT - L"Haut", // LSTR_KEY_UP - L"Bas", // LSTR_KEY_DOWN - L"Gauche", // LSTR_KEY_LEFT - L"Droite", // LSTR_KEY_RIGHT - L"Origine", // LSTR_KEY_HOME - L"Fin", // LSTR_KEY_END - L"Pg. Prc", // LSTR_KEY_PAGEUP - L"Pg. Suiv", // LSTR_KEY_PAGEDOWN - L"Entre", // LSTR_KEY_RETURN - L"Esc", // LSTR_KEY_ESC - L"Tab", // LSTR_KEY_TAB - L"Ret. Arr", // LSTR_KEY_BACKSPACE - L"Espace", // LSTR_KEY_SPACE - L"Insrer", // LSTR_KEY_INSERT - L"Suppr", // LSTR_KEY_DELETE -}; - -// ----------------------------------------------------------------------- -// German (German/Swiss/Austrian/Luxembourg/Liechtenstein) - -static const wchar_t* aImplLangGermanTab[LSTR_COUNT] = -{ - L"Umschalt", // LSTR_KEY_SHIFT - L"Strg", // LSTR_KEY_CTRL - L"Alt", // LSTR_KEY_ALT - L"Nach-Oben", // LSTR_KEY_UP - L"Nach-Unten", // LSTR_KEY_DOWN - L"Nach-Links", // LSTR_KEY_LEFT - L"Nach-Rechts", // LSTR_KEY_RIGHT - L"Pos1", // LSTR_KEY_HOME - L"Ende", // LSTR_KEY_END - L"Bild-Nach-Oben", // LSTR_KEY_PAGEUP - L"Bild-Nach-Unten", // LSTR_KEY_PAGEDOWN - L"Eingabe", // LSTR_KEY_RETURN - L"Esc", // LSTR_KEY_ESC - L"Tab", // LSTR_KEY_TAB - L"Rck", // LSTR_KEY_BACKSPACE - L"Leer", // LSTR_KEY_SPACE - L"Einfg", // LSTR_KEY_INSERT - L"Entf", // LSTR_KEY_DELETE -}; - -// ----------------------------------------------------------------------- -// Italian (Italian/Swiss) - -static const wchar_t* aImplLangItalianTab[LSTR_COUNT] = -{ - L"Maiusc", // LSTR_KEY_SHIFT - L"Ctrl", // LSTR_KEY_CTRL - L"Alt", // LSTR_KEY_ALT - L"Sposta verso l'alto", // LSTR_KEY_UP - L"Sposta verso il basso", // LSTR_KEY_DOWN - L"A sinistra", // LSTR_KEY_LEFT - L"A destra", // LSTR_KEY_RIGHT - L"Home", // LSTR_KEY_HOME - L"Fine", // LSTR_KEY_END - L"PgSu", // LSTR_KEY_PAGEUP - L"PgGi", // LSTR_KEY_PAGEDOWN - L"Invio", // LSTR_KEY_RETURN - L"Esc", // LSTR_KEY_ESC - L"Tab", // LSTR_KEY_TAB - L"Backspace", // LSTR_KEY_BACKSPACE - L"Spaziatrice", // LSTR_KEY_SPACE - L"Ins", // LSTR_KEY_INSERT - L"Canc", // LSTR_KEY_DELETE -}; - -// ----------------------------------------------------------------------- -// Norwegian (Bokmal) - -static const wchar_t* aImplLangNorwegianTab[LSTR_COUNT] = -{ - L"Skift", // LSTR_KEY_SHIFT - L"Ctrl", // LSTR_KEY_CTRL - L"Alt", // LSTR_KEY_ALT - L"Opp", // LSTR_KEY_UP - L"Ned", // LSTR_KEY_DOWN - L"Venstre", // LSTR_KEY_LEFT - L"Hyre", // LSTR_KEY_RIGHT - L"Home", // LSTR_KEY_HOME - L"End", // LSTR_KEY_END - L"PageUp", // LSTR_KEY_PAGEUP - L"PageDown", // LSTR_KEY_PAGEDOWN - L"Enter", // LSTR_KEY_RETURN - L"Esc", // LSTR_KEY_ESC - L"Tab", // LSTR_KEY_TAB - L"Tilbake", // LSTR_KEY_BACKSPACE - L"Mellomrom", // LSTR_KEY_SPACE - L"Insert", // LSTR_KEY_INSERT - L"Delete", // LSTR_KEY_DELETE -}; - -// ----------------------------------------------------------------------- -// Portuguse (Portuguse/Brazilian) - -static const wchar_t* aImplLangPortugueseTab[LSTR_COUNT] = -{ - L"Shift", // LSTR_KEY_SHIFT - L"Ctrl", // LSTR_KEY_CTRL - L"Alt", // LSTR_KEY_ALT - L"Acima", // LSTR_KEY_UP - L"Abaixo", // LSTR_KEY_DOWN - L"Esquerda", // LSTR_KEY_LEFT - L"Direita", // LSTR_KEY_RIGHT - L"Home", // LSTR_KEY_HOME - L"End", // LSTR_KEY_END - L"PageUp", // LSTR_KEY_PAGEUP - L"PageDown", // LSTR_KEY_PAGEDOWN - L"Enter", // LSTR_KEY_RETURN - L"Esc", // LSTR_KEY_ESC - L"Tab", // LSTR_KEY_TAB - L"Backspace", // LSTR_KEY_BACKSPACE - L"Space", // LSTR_KEY_SPACE - L"Insert", // LSTR_KEY_INSERT - L"Delete", // LSTR_KEY_DELETE -}; - -// ----------------------------------------------------------------------- -// Spanish (Spanish/Mexican/Modern/Guatemala/Costarica/Panama/Dominican/ -// Venezuela/Colombia/Peru/Argentina/Ecuador/Chile/Uruguay/ -// Paraguay/Bolivia) - -static const wchar_t* aImplLangSpanishTab[LSTR_COUNT] = -{ - L"Mays", // LSTR_KEY_SHIFT - L"Control", // LSTR_KEY_CTRL - L"Alt", // LSTR_KEY_ALT - L"Hacia arriba", // LSTR_KEY_UP - L"Hacia abajo", // LSTR_KEY_DOWN - L"Hacia la izquierda", // LSTR_KEY_LEFT - L"Hacia la derecha", // LSTR_KEY_RIGHT - L"Home", // LSTR_KEY_HOME - L"Fin", // LSTR_KEY_END - L"RePg", // LSTR_KEY_PAGEUP - L"AvPg", // LSTR_KEY_PAGEDOWN - L"Entrada", // LSTR_KEY_RETURN - L"Esc", // LSTR_KEY_ESC - L"Tab", // LSTR_KEY_TAB - L"Ret", // LSTR_KEY_BACKSPACE - L"Espacio", // LSTR_KEY_SPACE - L"Insert", // LSTR_KEY_INSERT - L"Supr", // LSTR_KEY_DELETE -}; - -// ----------------------------------------------------------------------- -// Swedish - -static const wchar_t* aImplLangSwedishTab[LSTR_COUNT] = -{ - L"Skift", // LSTR_KEY_SHIFT - L"Ctrl", // LSTR_KEY_CTRL - L"Alt", // LSTR_KEY_ALT - L"Up", // LSTR_KEY_UP - L"Ned", // LSTR_KEY_DOWN - L"Vnster", // LSTR_KEY_LEFT - L"Hger", // LSTR_KEY_RIGHT - L"Home", // LSTR_KEY_HOME - L"End", // LSTR_KEY_END - L"PageUp", // LSTR_KEY_PAGEUP - L"PageDown", // LSTR_KEY_PAGEDOWN - L"Retur", // LSTR_KEY_RETURN - L"Esc", // LSTR_KEY_ESC - L"Tab", // LSTR_KEY_TAB - L"Backsteg", // LSTR_KEY_BACKSPACE - L"Blank", // LSTR_KEY_SPACE - L"Insert", // LSTR_KEY_INSERT - L"Delete", // LSTR_KEY_DELETE -}; - -// ======================================================================= - -const sal_Unicode** ImplGetLangTab( LanguageType eLang ) -{ - // Sprachtabelle ermitteln - const wchar_t** pLangTab; - //switch ( International::GetNeutralLanguage( eLang ) ) - switch ( eLang ) - { - case LANGUAGE_DANISH: - pLangTab = aImplLangDanishTab; - break; - - case LANGUAGE_DUTCH: - case LANGUAGE_DUTCH_BELGIAN: - pLangTab = aImplLangDutchTab; - break; - - case LANGUAGE_FINNISH: - pLangTab = aImplLangFinnishTab; - break; - - case LANGUAGE_FRENCH: - pLangTab = aImplLangFrenchTab; - break; - - case LANGUAGE_GERMAN: - pLangTab = aImplLangGermanTab; - break; - - case LANGUAGE_ITALIAN: - pLangTab = aImplLangItalianTab; - break; - - case LANGUAGE_NORWEGIAN: - case LANGUAGE_NORWEGIAN_BOKMAL: - pLangTab = aImplLangNorwegianTab; - break; - - case LANGUAGE_PORTUGUESE: - case LANGUAGE_PORTUGUESE_BRAZILIAN: - pLangTab = aImplLangPortugueseTab; - break; - - case LANGUAGE_SPANISH: - pLangTab = aImplLangSpanishTab; - break; - - case LANGUAGE_SWEDISH: - pLangTab = aImplLangSwedishTab; - break; - - default: - pLangTab = aImplLangEnglishTab; - break; - } - - return (const sal_Unicode**)pLangTab; -} +/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sallang.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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 _SALLANG_HXX
+#include <sallang.hxx>
+#endif
+
+// =======================================================================
+
+// -----------------------------------------------------------------------
+// English (US/UK/AUS/CAN/NZ/EIRE/SAFRICA/JAMAICA/CARRIBEAN)
+static const wchar_t* aImplLangEnglishTab[LSTR_COUNT] =
+{
+ L"Shift", // LSTR_KEY_SHIFT
+ L"Ctrl", // LSTR_KEY_CTRL
+ L"Alt", // LSTR_KEY_ALT
+ L"Up", // LSTR_KEY_UP
+ L"Down", // LSTR_KEY_DOWN
+ L"Left", // LSTR_KEY_LEFT
+ L"Right", // LSTR_KEY_RIGHT
+ L"Home", // LSTR_KEY_HOME
+ L"End", // LSTR_KEY_END
+ L"PageUp", // LSTR_KEY_PAGEUP
+ L"PageDown", // LSTR_KEY_PAGEDOWN
+ L"Enter", // LSTR_KEY_RETURN
+ L"Esc", // LSTR_KEY_ESC
+ L"Tab", // LSTR_KEY_TAB
+ L"Backspace", // LSTR_KEY_BACKSPACE
+ L"Space", // LSTR_KEY_SPACE
+ L"Insert", // LSTR_KEY_INSERT
+ L"Del", // LSTR_KEY_DELETE
+};
+
+// =======================================================================
+
+const sal_Unicode** ImplGetLangTab( LanguageType eLang )
+{
+ // Sprachtabelle ermitteln
+ const wchar_t** pLangTab;
+ //switch ( International::GetNeutralLanguage( eLang ) )
+ switch ( eLang )
+ {
+#if 0
+ case LANGUAGE_DANISH:
+ pLangTab = aImplLangDanishTab;
+ break;
+
+ case LANGUAGE_DUTCH:
+ case LANGUAGE_DUTCH_BELGIAN:
+ pLangTab = aImplLangDutchTab;
+ break;
+
+ case LANGUAGE_FINNISH:
+ pLangTab = aImplLangFinnishTab;
+ break;
+
+ case LANGUAGE_FRENCH:
+ pLangTab = aImplLangFrenchTab;
+ break;
+
+ case LANGUAGE_GERMAN:
+ pLangTab = aImplLangGermanTab;
+ break;
+
+ case LANGUAGE_ITALIAN:
+ pLangTab = aImplLangItalianTab;
+ break;
+
+ case LANGUAGE_NORWEGIAN:
+ case LANGUAGE_NORWEGIAN_BOKMAL:
+ pLangTab = aImplLangNorwegianTab;
+ break;
+
+ case LANGUAGE_PORTUGUESE:
+ case LANGUAGE_PORTUGUESE_BRAZILIAN:
+ pLangTab = aImplLangPortugueseTab;
+ break;
+
+ case LANGUAGE_SPANISH:
+ pLangTab = aImplLangSpanishTab;
+ break;
+
+ case LANGUAGE_SWEDISH:
+ pLangTab = aImplLangSwedishTab;
+ break;
+#endif
+ default:
+ pLangTab = aImplLangEnglishTab;
+ break;
+ }
+
+ return (const sal_Unicode**)pLangTab;
+}
diff --git a/vcl/os2/source/app/salsound.cxx b/vcl/os2/source/app/salsound.cxx deleted file mode 100644 index ff3c7f1be8c3..000000000000 --- a/vcl/os2/source/app/salsound.cxx +++ /dev/null @@ -1,422 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: salsound.cxx,v $ - * $Revision: 1.5 $ - * - * 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. - * - ************************************************************************/ - -#define _SV_SALSOUND_CXX - -// ------------ -// - Includes - -// ------------ - -#include <string.h> - -#define INCL_DOSMODULEMGR -#include <svpm.h> -#include <saldata.hxx> -#include <salinst.h> -#include <salsound.h> - -#define INCL_MCIOS2 -#include <os2me.h> - -// --------- -// - Names - -// --------- - -#define SOUND_LIBNAME "MDM" -#define SOUND_PROCNAME "mciSendCommand" - -// ------------ -// - Fnc cast - -// ------------ - -typedef ULONG (_cdecl *SALMCIPROC)( USHORT nDeviceId, USHORT nMessage, ULONG nFlags, void* pParam, USHORT ); -#define MCIFNC ( (SALMCIPROC) Os2SalSound::mpMCIFnc ) - -// ----------------- -// - Statics init. - -// ----------------- - -HMODULE Os2SalSound::mhMCILib = 0; -ULONG Os2SalSound::mnSoundState = SOUND_STATE_UNLOADED; -void* Os2SalSound::mpMCIFnc = NULL; - -// ------------------- -// - Window-Callback - -// ------------------- - -MRESULT EXPENTRY SoundWndProc( HWND hWnd, ULONG nMsg, MPARAM nPar1, MPARAM nPar2 ) -{ - if( MM_MCINOTIFY == nMsg ) - { - USHORT nNotify = (USHORT)(ULONG) nPar1; - SoundNotification eNotification; - BOOL bNotify = TRUE; - - switch( nNotify ) - { - case( MCI_NOTIFY_SUCCESSFUL ): - eNotification = SOUND_NOTIFY_SUCCESS; - break; - - case( MCI_NOTIFY_ABORTED ): - eNotification = SOUND_NOTIFY_ABORTED; - break; - - case( MCI_NOTIFY_SUPERSEDED ): - bNotify = FALSE; - break; - - default: - eNotification = SOUND_NOTIFY_ERROR; - break; - } - - if( bNotify ) - ( (Os2SalSound*) WinQueryWindowULong( hWnd, 0 ) )->ImplNotify( eNotification, 0 ); - } - - return WinDefWindowProc( hWnd, nMsg, nPar1, nPar2 ); -} - -// ------------ -// - Os2SalSound - -// ------------ - -Os2SalSound::Os2SalSound() : - mpProc ( NULL ), - mhSoundWnd ( 0 ), - mnDeviceId ( 0 ), - mbLoop ( FALSE ), - mbPaused ( FALSE ) -{ -} - -// ------------------------------------------------------------------------ - -Os2SalSound::~Os2SalSound() -{ - Stop(); - - if( mnDeviceId ) - { - MCI_GENERIC_PARMS aGenericParams; - memset( &aGenericParams, 0, sizeof( aGenericParams ) ); - aGenericParams.hwndCallback = mhSoundWnd; - MCIFNC( mnDeviceId, MCI_CLOSE, MCI_WAIT, &aGenericParams, 0 ); - } - - if( mhSoundWnd ) - WinDestroyWindow( mhSoundWnd ); -} - -// ------------------------------------------------------------------------ - -void Os2SalSound::ImplSetError( ULONG nMciErr ) -{ - struct aMapper { DWORD nMci; ULONG nSv; }; - - ULONG nError = SOUNDERR_GENERAL_ERROR; - static aMapper aErrArr[] = - { - { 0, SOUNDERR_SUCCESS }, - { MCIERR_CANNOT_LOAD_DRIVER, SOUNDERR_CANNOT_LOAD_DRIVER }, - { MCIERR_DEVICE_LOCKED, SOUNDERR_DEVICE_LOCKED }, - { MCIERR_DEVICE_NOT_READY, SOUNDERR_DEVICE_NOT_READY }, - { MCIERR_DEVICE_TYPE_REQUIRED, SOUNDERR_DEVICE_NOT_FOUND }, - { MCIERR_DRIVER, SOUNDERR_CANNOT_LOAD_DRIVER }, - { MCIERR_DRIVER_INTERNAL, SOUNDERR_CANNOT_LOAD_DRIVER }, - { MCIERR_EXTENSION_NOT_FOUND, SOUNDERR_SOUND_NOT_FOUND }, - { MCIERR_FILE_NOT_FOUND, SOUNDERR_SOUND_NOT_FOUND }, - { MCIERR_HARDWARE, SOUNDERR_HARDWARE_ERROR }, - { MCIERR_INVALID_DEVICE_NAME, SOUNDERR_DEVICE_NOT_FOUND }, - { MCIERR_OUT_OF_MEMORY, SOUNDERR_OUT_OF_MEMORY }, - { MCIERR_UNSUPPORTED_FUNCTION, SOUNDERR_UNSUPPORTED_FUNCTION } - }; - - for( USHORT n=0; n < (sizeof( aErrArr ) / sizeof( aMapper ) ); n++ ) - { - if( aErrArr[ n ].nMci == nMciErr ) - { - nError = aErrArr[ n ].nSv; - break; - } - } - - if( nError ) - ImplNotify( SOUND_NOTIFY_ERROR, nError ); -} - -// ------------------------------------------------------------------------ - -void Os2SalSound::ImplNotify( SoundNotification eNotification, ULONG nError ) -{ - if( mbLoop && ( SOUND_NOTIFY_SUCCESS == eNotification ) && !nError ) - Play( mnStartTime, mnPlayLen, TRUE ); - - if( mpProc && mpInst ) - mpProc( mpInst, eNotification, nError ); -} - -// ------------------------------------------------------------------------ - -BOOL Os2SalSound::Create() -{ - SalData* pData = GetSalData(); - BOOL bRet = FALSE; - - if( SOUND_STATE_UNLOADED == Os2SalSound::mnSoundState ) - { - if( DosLoadModule( 0, 0, (PCSZ)SOUND_LIBNAME, &Os2SalSound::mhMCILib ) == 0 && - DosQueryProcAddr( Os2SalSound::mhMCILib, 0, (PCSZ)SOUND_PROCNAME, (PFN*) &Os2SalSound::mpMCIFnc ) == 0 ) - { - char* pszClassName = "SoundWin"; - PFNWP pWindowProc = SoundWndProc; - - WinRegisterClass( pData->mhAB, (PCSZ)pszClassName, pWindowProc, 0L, 4 ); - Os2SalSound::mnSoundState = SOUND_STATE_VALID; - bRet = TRUE; - } - else - { - if( Os2SalSound::mhMCILib ) - DosFreeModule( Os2SalSound::mhMCILib ); - - Os2SalSound::mnSoundState = SOUND_STATE_INVALID; - ImplNotify( SOUND_NOTIFY_ERROR, SOUNDERR_CANNOT_LOAD_DRIVER ); - } - } - else if( SOUND_STATE_VALID == Os2SalSound::mnSoundState ) - bRet = TRUE; - - if( bRet ) - { - mhSoundWnd = WinCreateWindow( HWND_OBJECT, (PCSZ)"SoundWin", (PCSZ)"Sound", 0, 0, 0, 0, 0, HWND_DESKTOP, HWND_BOTTOM, 0, 0, 0 ); - WinSetWindowULong( mhSoundWnd, 0, (ULONG) this ); - } - else - mhSoundWnd = 0; - - return bRet; -} - -// ------------------------------------------------------------------------ - -void Os2SalSound::Release() -{ - if( Os2SalSound::mhMCILib ) - DosFreeModule( Os2SalSound::mhMCILib ); - - Os2SalSound::mnSoundState = SOUND_STATE_UNLOADED; -} - -// ------------------------------------------------------------------------ - -bool Os2SalSound::IsValid() -{ - return (Os2SalSound::mnSoundState == SOUND_STATE_VALID); -} - -// ------------------------------------------------------------------------ - -bool Os2SalSound::Init( const XubString& rSoundName, ULONG& rSoundLen ) -{ - MCI_OPEN_PARMS aOpenParams; - ULONG nMciErr = 0; - - rSoundLen = 0; - - // clear old device - if( mnDeviceId ) - { - Stop(); - - MCI_GENERIC_PARMS aGenericParams; - memset( &aGenericParams, 0, sizeof( aGenericParams ) ); - aGenericParams.hwndCallback = mhSoundWnd; - nMciErr = MCIFNC( mnDeviceId, MCI_CLOSE, MCI_WAIT, &aGenericParams, 0 ); - mnDeviceId = 0; - } - - if( rSoundName.Len() ) - { - // init new device with sound name - memset( &aOpenParams, 0, sizeof( aOpenParams ) ); - aOpenParams.pszElementName = (PSZ) rSoundName.GetBuffer(); - aOpenParams.hwndCallback = mhSoundWnd; - nMciErr = MCIFNC( 0, MCI_OPEN, MCI_WAIT | MCI_OPEN_ELEMENT, &aOpenParams, 0 ); - - if( !nMciErr ) - { - // set time format - MCI_SET_PARMS aSetParams; - memset( &aSetParams, 0, sizeof( aSetParams ) ); - mnDeviceId = aOpenParams.usDeviceID; - aSetParams.ulTimeFormat = MCI_FORMAT_MILLISECONDS; - nMciErr = MCIFNC( mnDeviceId, MCI_SET, MCI_WAIT | MCI_SET_TIME_FORMAT, &aSetParams, 0 ); - - if( !nMciErr ) - { - // get length of sound - MCI_STATUS_PARMS aStatus; - memset( &aStatus, 0, sizeof( aStatus ) ); - aStatus.ulItem = MCI_STATUS_LENGTH; - MCIFNC( mnDeviceId, MCI_STATUS, MCI_WAIT | MCI_STATUS_ITEM, &aStatus, 0 ); - rSoundLen = (ULONG) aStatus.ulReturn; - } - } - } - - if( nMciErr ) - ImplSetError( nMciErr ); - - return( nMciErr ? FALSE : TRUE ); -} - -// ------------------------------------------------------------------------ -#if 0 -BOOL Os2SalSound::Init( SalFrame* pFrame, const BYTE* pSound, ULONG nDataLen, ULONG& rSoundLen ) -{ - rSoundLen = 0UL; - ImplSetError( MCIERR_FILE_NOT_FOUND ); - - return FALSE; -} -#endif - -// ------------------------------------------------------------------------ - -void Os2SalSound::Play( ULONG nStartTime, ULONG nPlayLen, bool bLoop ) -{ - if( mnDeviceId ) - { - ULONG nMciErr = 0; - - if( !mbPaused ) - { - MCI_SEEK_PARMS aSeekParams; - memset( &aSeekParams, 0, sizeof( aSeekParams ) ); - aSeekParams.hwndCallback = mhSoundWnd; - aSeekParams.ulTo = 0; - nMciErr = MCIFNC( mnDeviceId, MCI_SEEK,MCI_WAIT | MCI_TO, &aSeekParams, 0 ); - } - - mnStartTime = nStartTime; - mnPlayLen = nPlayLen; - mbLoop = bLoop; - mbPaused = FALSE; - - if( !nMciErr ) - { - MCI_PLAY_PARMS aPlayParams; - DWORD nFlags = MCI_NOTIFY; - - memset( &aPlayParams, 0, sizeof( aPlayParams ) ); - aPlayParams.hwndCallback = mhSoundWnd; - - if( nStartTime ) - { - aPlayParams.ulFrom = nStartTime; - nFlags |= MCI_FROM; - } - - if( nPlayLen != SOUND_PLAYALL ) - { - aPlayParams.ulTo = nStartTime + nPlayLen; - nFlags |= MCI_TO; - } - - nMciErr = MCIFNC( mnDeviceId, MCI_PLAY, nFlags, &aPlayParams, 0 ); - - if( !nMciErr ) - mbPaused = FALSE; - } - - if( nMciErr ) - ImplSetError( nMciErr ); - } - else - ImplSetError( MCIERR_EXTENSION_NOT_FOUND ); -} - -// ------------------------------------------------------------------------ - -void Os2SalSound::Stop() -{ - if( mnDeviceId ) - { - MCI_GENERIC_PARMS aGenericParams; - memset( &aGenericParams, 0, sizeof( aGenericParams ) ); - aGenericParams.hwndCallback = mhSoundWnd; - mbLoop = mbPaused = FALSE; - MCIFNC( mnDeviceId, MCI_STOP, MCI_WAIT, &aGenericParams, 0 ); - } -} - -// ------------------------------------------------------------------------ - -void Os2SalSound::Pause() -{ - if( mnDeviceId ) - { - MCI_GENERIC_PARMS aGenericParams; - memset( &aGenericParams, 0, sizeof( aGenericParams ) ); - aGenericParams.hwndCallback = mhSoundWnd; - mbPaused = TRUE; - MCIFNC( mnDeviceId, MCI_PAUSE, MCI_WAIT, &aGenericParams, 0 ); - } -} - -// ------------------------------------------------------------------------ - -void Os2SalSound::Continue() -{ - Play( 0, 0, mbLoop ); -} - -// ------------------------------------------------------------------------ - -bool Os2SalSound::IsLoopMode() const -{ - return mbLoop; -} - -// ------------------------------------------------------------------------ - -bool Os2SalSound::IsPlaying() const -{ - return !mbPaused; -} - -// ------------------------------------------------------------------------ - -bool Os2SalSound::IsPaused() const -{ - return mbPaused; -} diff --git a/vcl/os2/source/app/salsys.cxx b/vcl/os2/source/app/salsys.cxx deleted file mode 100644 index 35319c1d3cfc..000000000000 --- a/vcl/os2/source/app/salsys.cxx +++ /dev/null @@ -1,246 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: salsys.cxx,v $ - * $Revision: 1.5 $ - * - * 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. - * - ************************************************************************/ - -#define _SV_SALSYS_CXX - -#include <string.h> - -#define INCL_DOS -#define INCL_DOSERRORS -#ifndef _SVPM_H -#include <svpm.h> -#endif -#include <saldata.hxx> -#include <salinst.hxx> -#include <salframe.hxx> -#include <salbmp.hxx> -#include <salsys.hxx> -#ifndef _VOS_PROCESS_HXX -#include <vos/process.hxx> -#endif -#ifndef _TOOLS_FASTFSYS_HXX -#include <tools/fastfsys.hxx> -#endif - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <ctype.h> - -// ======================================================================= - -SalSystem* SalInstance::CreateSystem() -{ - return new SalSystem(); -} - -// ----------------------------------------------------------------------- - -void SalInstance::DestroySystem( SalSystem* pSystem ) -{ - delete pSystem; -} - -// ----------------------------------------------------------------------- - -SalSystem::SalSystem() -{ -} - -// ----------------------------------------------------------------------- - -SalSystem::~SalSystem() -{ -} - -// ----------------------------------------------------------------------- - -BOOL SalSystem::StartProcess( SalFrame* pFrame, const XubString& rFileName, - const XubString& rParam, - const XubString& rWorkingDirectory ) -{ - ItemIDPath aFile(rFileName); - - // - // first check if item has a context menu with open command - // - - ItemIDPath aParent, aChild; - - if(aFile.Split(aParent, aChild)) - { - IfcContextMenu *pConMenu = Folder(aParent).GetContextMenu(1, &aChild); - - if(pConMenu) - { - UINT32 nCount = pConMenu->GetItemCount(); - - for(UINT32 n = 0; n < nCount; n++) - { - MenuItem aMenuItem; - - if(pConMenu->GetMenuItem(n, aMenuItem) && - aMenuItem.aVerb.Compare("open") == COMPARE_EQUAL) - { - return pConMenu->ExecuteCommand(aMenuItem.aCommand); - } - } - } - } - - // Dateinamen mit Wildcards lehnen wir ab - if ( (rFileName.Search( '*' ) != STRING_NOTFOUND) || - (rFileName.Search( '?' ) != STRING_NOTFOUND) ) - return FALSE; - - XubString aFileName = aFile.GetHostNotationPath(); - char* aStdExtAry[] = { "exe", "com", "cmd", "bat" }; - const char* pStdExt; - const xub_Unicode* pFileName = aFileName.GetStr(); - const xub_Unicode* pParam = rParam.GetStr(); - XubString aSearchFileName; - XubString aExt; - BOOL bExe = FALSE; - BOOL bProcess = FALSE; - BOOL bRet = FALSE; - BOOL bExtension; - int i; - - // Parameter und Extension ermitteln - if ( !rParam.Len() ) - pParam = NULL; - // Wenn keine Extension, dann versuchen wir eine zu ermitteln, - // indem wir nach EXE-, COM-, CMD- oder BAT-Dateien suchen. - bExtension = ImplSalGetExtension( aFileName, aExt ); - if ( !bExtension ) - { - i = 0; - do - { - pStdExt = aStdExtAry[i]; - aSearchFileName = aFileName; - aSearchFileName += '.'; - aSearchFileName += pStdExt; - if ( ImplSalFindFile( aSearchFileName.GetStr(), aSearchFileName ) ) - { - pFileName = aSearchFileName.GetStr(); - bExtension = ImplSalGetExtension( aSearchFileName, aExt ); - break; - } - i++; - } - while ( i < 4 ); - } - else - { - // Ansonsten Filename im Pfad suchen - if ( ImplSalFindFile( pFileName, aSearchFileName ) ) - { - pFileName = aSearchFileName.GetStr(); - bExtension = ImplSalGetExtension( aSearchFileName, aExt ); - } - } - // Wenn wir eine Extension haben, testen wir, ob es eine - // Standard-Extension ist, womit wir einen Process starten koennen - if ( bExtension ) - { - aExt.ToLower(); - i = 0; - do - { - if ( aExt == aStdExtAry[i] ) - { - bExe = TRUE; - break; - } - i++; - } - while ( i < 4 ); - } - - // change to path of executable if no working dir set - XubString aWorkingDir(rWorkingDirectory); - - if(aWorkingDir.Len() == 0) - { - USHORT nIndex; - - aWorkingDir = pFileName; - nIndex = aWorkingDir.SearchCharBackward("\\/:"); - - if(nIndex == STRING_NOTFOUND) - nIndex = 0; - else if(aWorkingDir.GetChar(nIndex) == ':') - aWorkingDir[nIndex++] = '\\'; - - aWorkingDir.Erase(nIndex); - } - - // start executables with process execute - if ( bExe ) - { - NAMESPACE_VOS( OProcess )::TProcessError nProcessError; - NAMESPACE_VOS( OProcess ) aProcess( pFileName, pParam ); - - aProcess.setDirectory(aWorkingDir.GetStr()); - - nProcessError = aProcess.execute( (NAMESPACE_VOS(OProcess)::TProcessOption) - (NAMESPACE_VOS(OProcess)::TOption_Detached) ); - bRet = nProcessError == NAMESPACE_VOS( OProcess )::E_None; - } - - // when not startet, start programm with WPS - if ( !bRet ) - { - HOBJECT hObject = WinQueryObject( pFileName ); - if ( hObject ) - { - if ( WinOpenObject( hObject, 0, FALSE ) ) - bRet = TRUE; - } - } - - return bRet; -} - -// ----------------------------------------------------------------------- - -BOOL SalSystem::AddRecentDoc( SalFrame* pFrame, const XubString& rFileName ) -{ - return FALSE; -} - -// ----------------------------------------------------------------------- - -String SalSystem::GetSummarySystemInfos( ULONG nFlags ) -{ - return String(); -} - diff --git a/vcl/os2/source/gdi/os2layout.cxx b/vcl/os2/source/gdi/os2layout.cxx index 07fdb6c38927..dffb6a412f9b 100644 --- a/vcl/os2/source/gdi/os2layout.cxx +++ b/vcl/os2/source/gdi/os2layout.cxx @@ -107,7 +107,7 @@ inline int ImplOs2FontEntry::GetCachedGlyphWidth( int nCharCode ) const class Os2Layout : public SalLayout { public: - Os2Layout( HDC, ImplOs2FontData&, ImplOs2FontEntry& ); + Os2Layout( HDC, const ImplOs2FontData&, ImplOs2FontEntry& ); virtual void InitFont() const; void SetFontScale( float f ) { mfFontScale = f; } float GetFontScale() const { return mfFontScale; } @@ -118,7 +118,7 @@ protected: int mnBaseAdv; // x-offset relative to Layout origin float mfFontScale; // allows metrics emulation of huge font sizes - ImplOs2FontData& mrOs2FontData; + const ImplOs2FontData& mrOs2FontData; ImplOs2FontEntry& mrOs2FontEntry; }; @@ -127,7 +127,7 @@ protected: class Os2SalLayout : public Os2Layout { public: - Os2SalLayout( HPS, BYTE nCharSet, ImplOs2FontData&, ImplOs2FontEntry& ); + Os2SalLayout( HPS, BYTE nCharSet, const ImplOs2FontData&, ImplOs2FontEntry& ); virtual ~Os2SalLayout(); virtual bool LayoutText( ImplLayoutArgs& ); @@ -172,7 +172,7 @@ private: // ======================================================================= -Os2Layout::Os2Layout( HPS hPS, ImplOs2FontData& rWFD, ImplOs2FontEntry& rWFE ) +Os2Layout::Os2Layout( HPS hPS, const ImplOs2FontData& rWFD, ImplOs2FontEntry& rWFE ) : mhPS( hPS ), mnBaseAdv( 0 ), mfFontScale( 1.0 ), @@ -194,7 +194,7 @@ void Os2Layout::InitFont() const // ======================================================================= Os2SalLayout::Os2SalLayout( HPS hPS, BYTE nCharSet, - ImplOs2FontData& rOs2FontData, ImplOs2FontEntry& rOs2FontEntry ) + const ImplOs2FontData& rOs2FontData, ImplOs2FontEntry& rOs2FontEntry ) : Os2Layout( hPS, rOs2FontData, rOs2FontEntry ), mnGlyphCount( 0 ), mnCharCount( 0 ), @@ -950,7 +950,7 @@ SalLayout* Os2SalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe Os2SalLayout* pLayout = NULL; DBG_ASSERT( mpOs2FontEntry[nFallbackLevel], "WinSalGraphics mpWinFontEntry==NULL"); - ImplOs2FontData& rFontFace = *mpOs2FontData[ nFallbackLevel ]; + const ImplOs2FontData& rFontFace = *mpOs2FontData[ nFallbackLevel ]; ImplOs2FontEntry& rFontInstance = *mpOs2FontEntry[ nFallbackLevel ]; { diff --git a/vcl/os2/source/gdi/salgdi.cxx b/vcl/os2/source/gdi/salgdi.cxx index ad764f850500..b6616eb3a24b 100644 --- a/vcl/os2/source/gdi/salgdi.cxx +++ b/vcl/os2/source/gdi/salgdi.cxx @@ -242,6 +242,14 @@ BOOL Os2SalGraphics::unionClipRegion( long nX, long nY, long nWidth, long nHeigh // ----------------------------------------------------------------------- +bool Os2SalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& ) +{ + // TODO: implement and advertise OutDevSupport_B2DClip support + return false; +} + +// ----------------------------------------------------------------------- + void Os2SalGraphics::EndSetClipRegion() { #ifdef SAL_PRINTER_CLIPPATH @@ -344,7 +352,7 @@ void Os2SalGraphics::SetFillColor( SalColor nSalColor ) // ----------------------------------------------------------------------- -void Os2SalGraphics::SetXORMode( BOOL bSet ) +void Os2SalGraphics::SetXORMode( bool bSet, bool ) { mbXORMode = bSet; LONG nMixMode = bSet ? FM_XOR : FM_OVERPAINT; @@ -655,6 +663,25 @@ void Os2SalGraphics::drawPolyPolygon( ULONG nPoly, const ULONG* pPoints, // ----------------------------------------------------------------------- +bool Os2SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double /*fTransparency*/ ) +{ + // TODO: implement and advertise OutDevSupport_B2DDraw support + return false; +} + +// ----------------------------------------------------------------------- + +bool Os2SalGraphics::drawPolyLine( + const basegfx::B2DPolygon& /*rPolygon*/, + const basegfx::B2DVector& /*rLineWidths*/, + basegfx::B2DLineJoin /*eLineJoin*/) +{ + // TODO: implement + return false; +} + +// ----------------------------------------------------------------------- + sal_Bool Os2SalGraphics::drawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry ) { return sal_False; @@ -1010,7 +1037,9 @@ SystemGraphicsData Os2SalGraphics::GetGraphicsData() const { SystemGraphicsData aRes; aRes.nSize = sizeof(aRes); +#if 0 aRes.hDC = mhDC; +#endif return aRes; } diff --git a/vcl/os2/source/gdi/salgdi3.cxx b/vcl/os2/source/gdi/salgdi3.cxx index e72ad9a0ad29..e6a5788b401c 100644 --- a/vcl/os2/source/gdi/salgdi3.cxx +++ b/vcl/os2/source/gdi/salgdi3.cxx @@ -52,7 +52,6 @@ #include <vcl/svapp.hxx> #include <saldata.hxx> #include <salgdi.h> -#include <vcl/outfont.hxx> #include <vcl/font.hxx> #include <vcl/sallayout.hxx> #include <tools/poly.hxx> @@ -61,7 +60,9 @@ #include <tools/debug.hxx> #include <saldata.hxx> #include <salgdi.h> -#include <outfont.hxx> +#ifndef _SV_OUTFONT_HXX +#include <vcl/outfont.hxx> +#endif #include <sallayout.h> #include <tools/poly.hxx> #include <basegfx/polygon/b2dpolygon.hxx> @@ -400,7 +401,7 @@ sal_IntPtr ImplOs2FontData::GetFontId() const // ----------------------------------------------------------------------- -void ImplOs2FontData::UpdateFromHPS( HPS hPS ) +void ImplOs2FontData::UpdateFromHPS( HPS hPS ) const { // short circuit if already initialized if( mpUnicodeMap != NULL ) @@ -437,7 +438,7 @@ bool ImplOs2FontData::IsGSUBstituted( sal_Ucs cChar ) const // ----------------------------------------------------------------------- -ImplFontCharMap* ImplOs2FontData::GetImplFontCharMap() +ImplFontCharMap* ImplOs2FontData::GetImplFontCharMap() const { mpUnicodeMap->AddReference(); return mpUnicodeMap; @@ -450,7 +451,7 @@ static unsigned GetUShort( const unsigned char* p ){ return((p[0]<<8)+p[1]);} static signed GetSShort( const unsigned char* p ){ return((short)((p[0]<<8)+p[1]));} static inline DWORD CalcTag( const char p[4]) { return (p[0]+(p[1]<<8)+(p[2]<<16)+(p[3]<<24)); } -void ImplOs2FontData::ReadOs2Table( HPS hPS ) +void ImplOs2FontData::ReadOs2Table( HPS hPS ) const { const DWORD Os2Tag = CalcTag( "OS/2" ); DWORD nLength = Ft2GetFontData( hPS, Os2Tag, 0, NULL, 0 ); @@ -556,7 +557,7 @@ void ImplOs2FontData::ReadGsubTable( HPS hPS ) const // ----------------------------------------------------------------------- -void ImplOs2FontData::ReadCmapTable( HPS hPS ) +void ImplOs2FontData::ReadCmapTable( HPS hPS ) const { CmapResult aResult; aResult.mnPairCount = 0; @@ -804,7 +805,7 @@ USHORT Os2SalGraphics::SetFont( ImplFontSelectData* pFont, int nFallbackLevel ) DBG_ASSERT( pFont->mpFontData, "WinSalGraphics mpFontData==NULL"); mpOs2FontEntry[ nFallbackLevel ] = reinterpret_cast<ImplOs2FontEntry*>( pFont->mpFontEntry ); - mpOs2FontData[ nFallbackLevel ] = reinterpret_cast<ImplOs2FontData*>( pFont->mpFontData ); + mpOs2FontData[ nFallbackLevel ] = static_cast<const ImplOs2FontData*>( pFont->mpFontData ); ImplDoSetFont( pFont, mfFontScale, nFallbackLevel); @@ -1010,13 +1011,6 @@ ImplFontCharMap* Os2SalGraphics::GetImplFontCharMap() const if( !mpOs2FontData[0] ) return ImplFontCharMap::GetDefaultMap(); return mpOs2FontData[0]->GetImplFontCharMap(); -#if 0 -//if( !mpWinFontData[0] ) - // return ImplFontCharMap::GetDefaultMap(); - if (!pOs2DefaultImplFontCharMap) - pOs2DefaultImplFontCharMap = new ImplFontCharMap( 1, pOs2DefaultRangeCodes, NULL ); - return pOs2DefaultImplFontCharMap; -#endif } // ----------------------------------------------------------------------- @@ -1462,7 +1456,7 @@ BOOL Os2SalGraphics::CreateFontSubset( const rtl::OUString& rToFile, // create matching ImplFontSelectData // we need just enough to get to the font file data // use height=1000 for easier debugging (to match psprint's font units) - ImplFontSelectData aIFSD( *pFont, Size(0,1000), 0, false ); + ImplFontSelectData aIFSD( *pFont, Size(0,1000), 1000.0, 0, false ); // TODO: much better solution: move SetFont and restoration of old font to caller ScopedFont aOldFont(*this); @@ -1581,7 +1575,7 @@ const void* Os2SalGraphics::GetEmbedFontData( const ImplFontData* pFont, { // create matching ImplFontSelectData // we need just enough to get to the font file data - ImplFontSelectData aIFSD( *pFont, Size(0,1000), 0, false ); + ImplFontSelectData aIFSD( *pFont, Size(0,1000), 1000.0, 0, false ); // TODO: much better solution: move SetFont and restoration of old font to caller ScopedFont aOldFont(*this); @@ -1665,11 +1659,11 @@ const Ucs2SIntMap* Os2SalGraphics::GetFontEncodingVector( const ImplFontData* pF void Os2SalGraphics::GetGlyphWidths( const ImplFontData* pFont, bool bVertical, Int32Vector& rWidths, - Ucs2UInt& rUnicodeEnc ) + Ucs2UIntMap& rUnicodeEnc ) { // create matching ImplFontSelectData // we need just enough to get to the font file data - ImplFontSelectData aIFSD( *pFont, Size(0,1000), 0, false ); + ImplFontSelectData aIFSD( *pFont, Size(0,1000), 1000.0, 0, false ); // TODO: much better solution: move SetFont and restoration of old font to caller ScopedFont aOldFont(*this); @@ -1680,11 +1674,11 @@ void Os2SalGraphics::GetGlyphWidths( const ImplFontData* pFont, if( pFont->IsSubsettable() ) { // get raw font file data - DWORD nFontSize1 = ::Ft2GetFontData( mhDC, 0, 0, NULL, 0 ); + DWORD nFontSize1 = ::Ft2GetFontData( mhPS, 0, 0, NULL, 0 ); if( nFontSize1 == FT2_ERROR ) return; ScopedCharArray xRawFontData(new char[ nFontSize1 ]); - DWORD nFontSize2 = ::Ft2GetFontData( mhDC, 0, 0, (void*)xRawFontData.get(), nFontSize1 ); + DWORD nFontSize2 = ::Ft2GetFontData( mhPS, 0, 0, (void*)xRawFontData.get(), nFontSize1 ); if( nFontSize1 != nFontSize2 ) return; @@ -1716,7 +1710,7 @@ void Os2SalGraphics::GetGlyphWidths( const ImplFontData* pFont, free( pMetrics ); rUnicodeEnc.clear(); } - ImplOs2FontData* pWinFont = static_cast<ImplOs2FontData*>(pFont); + const ImplOs2FontData* pWinFont = static_cast<const ImplOs2FontData*>(pFont); ImplFontCharMap* pMap = pWinFont->GetImplFontCharMap(); DBG_ASSERT( pMap && pMap->GetCharCount(), "no map" ); diff --git a/vcl/os2/source/window/salframe.cxx b/vcl/os2/source/window/salframe.cxx index e90c7f9bf4af..8860d68d683e 100644 --- a/vcl/os2/source/window/salframe.cxx +++ b/vcl/os2/source/window/salframe.cxx @@ -56,7 +56,7 @@ #include <salgdi.h> #include <salframe.h> #include <vcl/timer.hxx> -#include <settings.hxx> +#include <vcl/settings.hxx> #ifndef _SV_KEYCOES_HXX #include <vcl/keycodes.hxx> #endif @@ -962,7 +962,7 @@ SalFrame* Os2SalFrame::GetParent() const // ----------------------------------------------------------------------- -static void ImplSalShow( HWND hWnd, BOOL bVisible, BOOL bNoActivate ) +static void ImplSalShow( HWND hWnd, ULONG bVisible, ULONG bNoActivate ) { Os2SalFrame* pFrame = GetWindowPtr( hWnd ); if ( !pFrame ) @@ -1392,6 +1392,40 @@ BOOL Os2SalFrame::GetWindowState( SalFrameState* pState ) // ----------------------------------------------------------------------- +void Os2SalFrame::SetScreenNumber( unsigned int nNewScreen ) +{ +#if 0 + WinSalSystem* pSys = static_cast<WinSalSystem*>(ImplGetSalSystem()); + if( pSys ) + { + const std::vector<WinSalSystem::DisplayMonitor>& rMonitors = + pSys->getMonitors(); + size_t nMon = rMonitors.size(); + if( nNewScreen < nMon ) + { + Point aOldMonPos, aNewMonPos( rMonitors[nNewScreen].m_aArea.TopLeft() ); + Point aCurPos( maGeometry.nX, maGeometry.nY ); + for( size_t i = 0; i < nMon; i++ ) + { + if( rMonitors[i].m_aArea.IsInside( aCurPos ) ) + { + aOldMonPos = rMonitors[i].m_aArea.TopLeft(); + break; + } + } + mnDisplay = nNewScreen; + maGeometry.nScreenNumber = nNewScreen; + SetPosSize( aNewMonPos.X() + (maGeometry.nX - aOldMonPos.X()), + aNewMonPos.Y() + (maGeometry.nY - aOldMonPos.Y()), + 0, 0, + SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y ); + } + } +#endif +} + +// ----------------------------------------------------------------------- + // native menu implementation - currently empty void Os2SalFrame::DrawMenuBar() { @@ -1453,7 +1487,7 @@ void Os2SalFrame::SetAlwaysOnTop( BOOL bOnTop ) // ----------------------------------------------------------------------- -static void ImplSalToTop( HWND hWnd, USHORT nFlags ) +static void ImplSalToTop( HWND hWnd, ULONG nFlags ) { Os2SalFrame* pFrame = GetWindowPtr( hWnd ); #if OSL_DEBUG_LEVEL>0 @@ -3591,11 +3625,11 @@ MRESULT EXPENTRY SalFrameWndProc( HWND hWnd, ULONG nMsg, bDef = FALSE; break; case SAL_MSG_TOTOP: - ImplSalToTop( hWnd, (USHORT)nMP1 ); + ImplSalToTop( hWnd, (ULONG)nMP1 ); bDef = FALSE; break; case SAL_MSG_SHOW: - ImplSalShow( hWnd, (BOOL)nMP1, (BOOL)nMP2 ); + ImplSalShow( hWnd, (ULONG)nMP1, (ULONG)nMP2 ); bDef = FALSE; break; diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index f6d1e98850ff..262910d18c82 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1253,10 +1253,12 @@ Window* Application::GetTopWindow( long nIndex ) while( pWin ) { if( pWin->ImplGetWindow()->IsTopWindow() ) + { if( nIdx == nIndex ) return pWin->ImplGetWindow(); else nIdx++; + } pWin = pWin->mpWindowImpl->mpFrameData->mpNextFrame; } return NULL; diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index bc06fcb535d6..e9dbe16f1fcf 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -300,7 +300,7 @@ BOOL InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XM // SV bei den Tools anmelden InitTools(); - DBG_ASSERT( !pSVData->maAppData.mxMSF.is(), "VCL service factory already set" ) + DBG_ASSERT( !pSVData->maAppData.mxMSF.is(), "VCL service factory already set" ); pSVData->maAppData.mxMSF = rSMgr; // Main-Thread-Id merken @@ -410,6 +410,11 @@ void DeInitVCL() delete pSVData->maWinData.mpMsgBoxImgList; pSVData->maWinData.mpMsgBoxImgList = NULL; } + if ( pSVData->maWinData.mpMsgBoxHCImgList ) + { + delete pSVData->maWinData.mpMsgBoxHCImgList; + pSVData->maWinData.mpMsgBoxHCImgList = NULL; + } if ( pSVData->maCtrlData.mpCheckImgList ) { delete pSVData->maCtrlData.mpCheckImgList; diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 0d9523fa357b..42abe3fd248a 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -130,8 +130,6 @@ void ComboBox::ImplInitComboBoxData() mbSyntheticModify = FALSE; mbMatchCase = FALSE; mcMultiSep = ';'; - - EnableRTL( TRUE ); } // ----------------------------------------------------------------------- @@ -671,7 +669,7 @@ void ComboBox::Resize() else { nSBWidth = CalcZoom( nSBWidth ); - mpSubEdit->SetSizePixel( Size( aOutSz.Width() - nSBWidth, aOutSz.Height() ) ); + mpSubEdit->SetPosSizePixel( Point( 0, 0 ), Size( aOutSz.Width() - nSBWidth, aOutSz.Height() ) ); mpBtn->SetPosSizePixel( aOutSz.Width() - nSBWidth, nTop, nSBWidth, (nBottom-nTop) ); } } @@ -766,6 +764,17 @@ void ComboBox::StateChanged( StateChangedType nType ) SetStyle( ImplInitStyle( GetStyle() ) ); mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) ? TRUE : FALSE ); } + else if( nType == STATE_CHANGE_MIRRORING ) + { + if( mpBtn ) + { + mpBtn->EnableRTL( IsRTLEnabled() ); + ImplInitDropDownButton( mpBtn ); + } + mpSubEdit->StateChanged( STATE_CHANGE_MIRRORING ); + mpImplLB->EnableRTL( IsRTLEnabled() ); + Resize(); + } } // ----------------------------------------------------------------------- @@ -840,8 +849,6 @@ long ComboBox::Notify( NotifyEvent& rNEvt ) } else { - if( mpFloatWin ) - mpImplLB->GetMainWindow()->CalcMaxVisibleEntries( mpFloatWin->CalcFloatSize() ); nDone = mpImplLB->ProcessKeyInput( aKeyEvt ); } } diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 8754aaabf3a9..3834e4de8677 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -340,7 +340,7 @@ void Edit::ImplInit( Window* pParent, WinBits nStyle ) mnAlign = EDIT_ALIGN_LEFT; // --- RTL --- hack: right align until keyinput and cursor travelling works - if( Application::GetSettings().GetLayoutRTL() ) + if( IsRTLEnabled() ) mnAlign = EDIT_ALIGN_RIGHT; if ( nStyle & WB_RIGHT ) @@ -840,16 +840,18 @@ void Edit::ShowTruncationWarning( Window* pParent ) // ----------------------------------------------------------------------- -void Edit::ImplTruncateToMaxLen( rtl::OUString& rStr, sal_uInt32 nSelectionLen ) const +bool Edit::ImplTruncateToMaxLen( rtl::OUString& rStr, sal_uInt32 nSelectionLen ) const { + bool bWasTruncated = false; const sal_uInt32 nMaxLen = mnMaxTextLen < 65534 ? mnMaxTextLen : 65534; sal_uInt32 nLenAfter = static_cast<sal_uInt32>(maText.Len()) + rStr.getLength() - nSelectionLen; if ( nLenAfter > nMaxLen ) { sal_uInt32 nErasePos = nMaxLen - static_cast<sal_uInt32>(maText.Len()) + nSelectionLen; rStr = rStr.copy( 0, nErasePos ); - ShowTruncationWarning( const_cast<Edit*>(this) ); + bWasTruncated = true; } + return bWasTruncated; } // ----------------------------------------------------------------------- @@ -1251,7 +1253,10 @@ void Edit::ImplAlign() else if ( mnAlign == EDIT_ALIGN_RIGHT ) { long nMinXOffset = nOutWidth - nTextWidth - 1 - ImplGetExtraOffset(); - if( Application::GetSettings().GetLayoutRTL() ) + bool bRTL = IsRTLEnabled(); + if( mbIsSubEdit && GetParent() ) + bRTL = GetParent()->IsRTLEnabled(); + if( bRTL ) { if( nTextWidth < nOutWidth ) mnXOffset = nMinXOffset; @@ -1410,7 +1415,8 @@ void Edit::ImplPaste( uno::Reference< datatransfer::clipboard::XClipboard >& rxC uno::Any aData = xDataObj->getTransferData( aFlavor ); ::rtl::OUString aText; aData >>= aText; - ImplTruncateToMaxLen( aText, maSelection.Len() ); + if( ImplTruncateToMaxLen( aText, maSelection.Len() ) ) + ShowTruncationWarning( const_cast<Edit*>(this) ); ReplaceSelected( aText ); } catch( const ::com::sun::star::uno::Exception& ) @@ -1601,10 +1607,33 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) { switch ( nCode ) { + case com::sun::star::awt::Key::SELECT_ALL: + { + ImplSetSelection( Selection( 0, maText.Len() ) ); + bDone = TRUE; + } + break; + case KEY_LEFT: case KEY_RIGHT: case KEY_HOME: case KEY_END: + case com::sun::star::awt::Key::MOVE_WORD_FORWARD: + case com::sun::star::awt::Key::SELECT_WORD_FORWARD: + case com::sun::star::awt::Key::MOVE_WORD_BACKWARD: + case com::sun::star::awt::Key::SELECT_WORD_BACKWARD: + case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_LINE: + case com::sun::star::awt::Key::MOVE_TO_END_OF_LINE: + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE: + case com::sun::star::awt::Key::SELECT_TO_END_OF_LINE: + case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH: + case com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH: + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH: + case com::sun::star::awt::Key::SELECT_TO_END_OF_PARAGRAPH: + case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT: + case com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT: + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT: + case com::sun::star::awt::Key::SELECT_TO_END_OF_DOCUMENT: { if ( !rKEvt.GetKeyCode().IsMod2() ) { @@ -1612,9 +1641,47 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) uno::Reference < i18n::XBreakIterator > xBI = ImplGetBreakIterator(); Selection aSel( maSelection ); - BOOL bWord = rKEvt.GetKeyCode().IsMod1(); + bool bWord = rKEvt.GetKeyCode().IsMod1(); + bool bSelect = rKEvt.GetKeyCode().IsShift(); + bool bGoLeft = (nCode == KEY_LEFT); + bool bGoRight = (nCode == KEY_RIGHT); + bool bGoHome = (nCode == KEY_HOME); + bool bGoEnd = (nCode == KEY_END); + + switch( nCode ) + { + case com::sun::star::awt::Key::MOVE_WORD_FORWARD: + bGoRight = bWord = true;break; + case com::sun::star::awt::Key::SELECT_WORD_FORWARD: + bGoRight = bSelect = bWord = true;break; + case com::sun::star::awt::Key::MOVE_WORD_BACKWARD: + bGoLeft = bWord = true;break; + case com::sun::star::awt::Key::SELECT_WORD_BACKWARD: + bGoLeft = bSelect = bWord = true;break; + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE: + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH: + case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT: + bSelect = true; + // fallthrough intended + case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_LINE: + case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH: + case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT: + bGoHome = true;break; + case com::sun::star::awt::Key::SELECT_TO_END_OF_LINE: + case com::sun::star::awt::Key::SELECT_TO_END_OF_PARAGRAPH: + case com::sun::star::awt::Key::SELECT_TO_END_OF_DOCUMENT: + bSelect = true; + // fallthrough intended + case com::sun::star::awt::Key::MOVE_TO_END_OF_LINE: + case com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH: + case com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT: + bGoEnd = true;break; + default: + break; + }; + // Range wird in ImplSetSelection geprueft... - if ( ( nCode == KEY_LEFT ) && aSel.Max() ) + if ( bGoLeft && aSel.Max() ) { if ( bWord ) { @@ -1629,7 +1696,7 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) aSel.Max() = xBI->previousCharacters( maText, aSel.Max(), GetSettings().GetLocale(), i18n::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount ); } } - else if ( ( nCode == KEY_RIGHT ) && ( aSel.Max() < maText.Len() ) ) + else if ( bGoRight && ( aSel.Max() < maText.Len() ) ) { if ( bWord ) { @@ -1642,12 +1709,16 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) aSel.Max() = xBI->nextCharacters( maText, aSel.Max(), GetSettings().GetLocale(), i18n::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount ); } } - else if ( nCode == KEY_HOME ) + else if ( bGoHome ) + { aSel.Max() = 0; - else if ( nCode == KEY_END ) + } + else if ( bGoEnd ) + { aSel.Max() = 0xFFFF; + } - if ( !rKEvt.GetKeyCode().IsShift() ) + if ( !bSelect ) aSel.Min() = aSel.Max(); if ( aSel != GetSelection() ) @@ -1656,7 +1727,7 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) ImplCopyToSelectionClipboard(); } - if ( (nCode == KEY_END) && maAutocompleteHdl.IsSet() && !rKEvt.GetKeyCode().GetModifier() ) + if ( bGoEnd && maAutocompleteHdl.IsSet() && !rKEvt.GetKeyCode().GetModifier() ) { if ( (maSelection.Min() == maSelection.Max()) && (maSelection.Min() == maText.Len()) ) { @@ -1670,6 +1741,10 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) } break; + case com::sun::star::awt::Key::DELETE_WORD_BACKWARD: + case com::sun::star::awt::Key::DELETE_WORD_FORWARD: + case com::sun::star::awt::Key::DELETE_TO_BEGIN_OF_LINE: + case com::sun::star::awt::Key::DELETE_TO_END_OF_LINE: case KEY_BACKSPACE: case KEY_DELETE: { @@ -1679,6 +1754,26 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) BYTE nMode = rKEvt.GetKeyCode().IsMod1() ? EDIT_DELMODE_RESTOFWORD : EDIT_DELMODE_SIMPLE; if ( (nMode == EDIT_DELMODE_RESTOFWORD) && rKEvt.GetKeyCode().IsShift() ) nMode = EDIT_DELMODE_RESTOFCONTENT; + switch( nCode ) + { + case com::sun::star::awt::Key::DELETE_WORD_BACKWARD: + nDel = EDIT_DEL_LEFT; + nMode = EDIT_DELMODE_RESTOFWORD; + break; + case com::sun::star::awt::Key::DELETE_WORD_FORWARD: + nDel = EDIT_DEL_RIGHT; + nMode = EDIT_DELMODE_RESTOFWORD; + break; + case com::sun::star::awt::Key::DELETE_TO_BEGIN_OF_LINE: + nDel = EDIT_DEL_LEFT; + nMode = EDIT_DELMODE_RESTOFCONTENT; + break; + case com::sun::star::awt::Key::DELETE_TO_END_OF_LINE: + nDel = EDIT_DEL_RIGHT; + nMode = EDIT_DELMODE_RESTOFCONTENT; + break; + default: break; + } xub_StrLen nOldLen = maText.Len(); ImplDelete( maSelection, nDel, nMode ); if ( maText.Len() != nOldLen ) @@ -2255,17 +2350,33 @@ void Edit::StateChanged( StateChangedType nType ) ImplInvalidateOrRepaint( 0, 0xFFFF ); } } - else if ( nType == STATE_CHANGE_STYLE ) + else if ( nType == STATE_CHANGE_STYLE || nType == STATE_CHANGE_MIRRORING ) { - WinBits nStyle = ImplInitStyle( GetStyle() ); - SetStyle( nStyle ); + WinBits nStyle = GetStyle(); + if( nType == STATE_CHANGE_STYLE ) + { + nStyle = ImplInitStyle( GetStyle() ); + SetStyle( nStyle ); + } USHORT nOldAlign = mnAlign; mnAlign = EDIT_ALIGN_LEFT; // --- RTL --- hack: right align until keyinput and cursor travelling works - if( Application::GetSettings().GetLayoutRTL() ) - mnAlign = EDIT_ALIGN_RIGHT; + // edits are always RTL disabled + // however the parent edits contain the correct setting + if( mbIsSubEdit && GetParent()->IsRTLEnabled() ) + { + if( GetParent()->GetStyle() & WB_LEFT ) + mnAlign = EDIT_ALIGN_RIGHT; + if ( nType == STATE_CHANGE_MIRRORING ) + SetLayoutMode( TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT ); + } + else if( mbIsSubEdit && !GetParent()->IsRTLEnabled() ) + { + if ( nType == STATE_CHANGE_MIRRORING ) + SetLayoutMode( TEXT_LAYOUT_BIDI_LTR | TEXT_LAYOUT_TEXTORIGIN_LEFT ); + } if ( nStyle & WB_RIGHT ) mnAlign = EDIT_ALIGN_RIGHT; diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index a3b26de8314d..530e928532e1 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -230,7 +230,7 @@ USHORT FixedText::ImplGetTextStyle( WinBits nWinStyle ) if ( nWinStyle & WB_WORDBREAK ) { nTextStyle |= TEXT_DRAW_WORDBREAK; - if ( nWinStyle & WB_HYPHENATION ) + if ( (nWinStyle & WB_HYPHENATION ) == WB_HYPHENATION ) nTextStyle |= TEXT_DRAW_WORDBREAK_HYPHENATION; } if ( nWinStyle & WB_NOLABEL ) diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index 50816de2aaf7..57d67de19c76 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -54,6 +54,8 @@ #include <com/sun/star/accessibility/AccessibleRole.hpp> #endif +#define MULTILINE_ENTRY_DRAW_FLAGS ( TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE | TEXT_DRAW_VCENTER ) + using namespace ::com::sun::star; // ======================================================================= @@ -328,6 +330,42 @@ USHORT ImplEntryList::FindEntry( const void* pData ) const // ----------------------------------------------------------------------- +long ImplEntryList::GetAddedHeight( USHORT i_nEndIndex, USHORT i_nBeginIndex, long i_nBeginHeight ) const +{ + long nHeight = i_nBeginHeight; + USHORT nStart = i_nEndIndex > i_nBeginIndex ? i_nBeginIndex : i_nEndIndex; + USHORT nStop = i_nEndIndex > i_nBeginIndex ? i_nEndIndex : i_nBeginIndex; + USHORT nEntryCount = GetEntryCount(); + if( nStop != LISTBOX_ENTRY_NOTFOUND && nEntryCount != 0 ) + { + // sanity check + if( nStop > nEntryCount-1 ) + nStop = nEntryCount-1; + if( nStart > nEntryCount-1 ) + nStart = nEntryCount-1; + + USHORT nIndex = nStart; + while( nIndex != LISTBOX_ENTRY_NOTFOUND && nIndex < nStop ) + { + nHeight += GetEntryPtr( nIndex )-> mnHeight; + nIndex++; + } + } + else + nHeight = 0; + return i_nEndIndex > i_nBeginIndex ? nHeight : -nHeight; +} + +// ----------------------------------------------------------------------- + +long ImplEntryList::GetEntryHeight( USHORT nPos ) const +{ + ImplEntryType* pImplEntry = GetEntry( nPos ); + return pImplEntry ? pImplEntry->mnHeight : 0; +} + +// ----------------------------------------------------------------------- + XubString ImplEntryList::GetEntryText( USHORT nPos ) const { XubString aEntryText; @@ -574,12 +612,15 @@ void ImplListBoxWindow::ImplCalcMetrics() for ( USHORT n = mpEntryList->GetEntryCount(); n; ) { - const ImplEntryType* pEntry = mpEntryList->GetEntryPtr( --n ); - ImplCalcEntryMetrics( *pEntry, TRUE ); + ImplEntryType* pEntry = mpEntryList->GetMutableEntryPtr( --n ); + ImplUpdateEntryMetrics( *pEntry ); } - Size aSz( GetOutputSizePixel().Width(), mnMaxHeight ); - maFocusRect.SetSize( aSz ); + if( mnCurrentPos != LISTBOX_ENTRY_NOTFOUND ) + { + Size aSz( GetOutputSizePixel().Width(), mpEntryList->GetEntryPtr( mnCurrentPos )->mnHeight ); + maFocusRect.SetSize( aSz ); + } } // ----------------------------------------------------------------------- @@ -625,24 +666,17 @@ struct ImplEntryMetrics { BOOL bText; BOOL bImage; - USHORT nEntryWidth; - USHORT nEntryHeight; - USHORT nTextWidth; - USHORT nImgWidth; - USHORT nImgHeight; + long nEntryWidth; + long nEntryHeight; + long nTextWidth; + long nImgWidth; + long nImgHeight; }; // ----------------------------------------------------------------------- -void ImplListBoxWindow::ImplCalcEntryMetrics( const ImplEntryType& rEntry, BOOL bUpdateMetrics ) +void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry ) { - // bUpdateMetrics: Wenn Entry groesser als Max-Wert, dann uebernehmen - - // Diese Methode war mal auch fuer RemoveRentry gedacht, deshalb die - // ImplEntryMetrics-Struktur, damit die Werte zurueckgegeben werden. - // Jetzt werden die aktuellen Metriken aber doch immer angepasst, weil - // bei RemoveEntry einmal komplett durchgegangen wird. - ImplEntryMetrics aMetrics; aMetrics.bText = rEntry.maStr.Len() ? TRUE : FALSE; aMetrics.bImage = !!rEntry.maImage; @@ -654,10 +688,30 @@ void ImplListBoxWindow::ImplCalcEntryMetrics( const ImplEntryType& rEntry, BOOL if ( aMetrics.bText ) { - aMetrics.nTextWidth = (USHORT)GetTextWidth( rEntry.maStr ); - if( bUpdateMetrics && ( aMetrics.nTextWidth > mnMaxTxtWidth ) ) - mnMaxTxtWidth = aMetrics.nTextWidth; - aMetrics.nEntryWidth = mnMaxTxtWidth; + if( (rEntry.mnFlags & LISTBOX_ENTRY_FLAG_MULTILINE) ) + { + // multiline case + Size aCurSize( PixelToLogic( GetSizePixel() ) ); + // set the current size to a large number + // GetTextRect should shrink it to the actual size + aCurSize.Height() = 0x7fffff; + Rectangle aTextRect( Point( 0, 0 ), aCurSize ); + aTextRect = GetTextRect( aTextRect, rEntry.maStr, TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE ); + aMetrics.nTextWidth = aTextRect.GetWidth(); + if( aMetrics.nTextWidth > mnMaxTxtWidth ) + mnMaxTxtWidth = aMetrics.nTextWidth; + aMetrics.nEntryWidth = mnMaxTxtWidth; + aMetrics.nEntryHeight = aTextRect.GetHeight() + mnBorder; + } + else + { + // normal single line case + aMetrics.nTextWidth = (USHORT)GetTextWidth( rEntry.maStr ); + if( aMetrics.nTextWidth > mnMaxTxtWidth ) + mnMaxTxtWidth = aMetrics.nTextWidth; + aMetrics.nEntryWidth = mnMaxTxtWidth; + aMetrics.nEntryHeight = mnTextHeight + mnBorder; + } } if ( aMetrics.bImage ) { @@ -665,36 +719,35 @@ void ImplListBoxWindow::ImplCalcEntryMetrics( const ImplEntryType& rEntry, BOOL aMetrics.nImgWidth = (USHORT) CalcZoom( aImgSz.Width() ); aMetrics.nImgHeight = (USHORT) CalcZoom( aImgSz.Height() ); - if ( bUpdateMetrics ) - { - if( mnMaxImgWidth && ( aMetrics.nImgWidth != mnMaxImgWidth ) ) - mbImgsDiffSz = TRUE; - else if ( mnMaxImgHeight && ( aMetrics.nImgHeight != mnMaxImgHeight ) ) - mbImgsDiffSz = TRUE; + if( mnMaxImgWidth && ( aMetrics.nImgWidth != mnMaxImgWidth ) ) + mbImgsDiffSz = TRUE; + else if ( mnMaxImgHeight && ( aMetrics.nImgHeight != mnMaxImgHeight ) ) + mbImgsDiffSz = TRUE; - if( aMetrics.nImgWidth > mnMaxImgWidth ) - mnMaxImgWidth = aMetrics.nImgWidth; - if( aMetrics.nImgHeight > mnMaxImgHeight ) - mnMaxImgHeight = aMetrics.nImgHeight; + if( aMetrics.nImgWidth > mnMaxImgWidth ) + mnMaxImgWidth = aMetrics.nImgWidth; + if( aMetrics.nImgHeight > mnMaxImgHeight ) + mnMaxImgHeight = aMetrics.nImgHeight; + + mnMaxImgTxtWidth = Max( mnMaxImgTxtWidth, aMetrics.nTextWidth ); + aMetrics.nEntryHeight = Max( aMetrics.nImgHeight, aMetrics.nEntryHeight ); - mnMaxImgTxtWidth = Max( mnMaxImgTxtWidth, aMetrics.nTextWidth ); - } } if ( IsUserDrawEnabled() || aMetrics.bImage ) { - aMetrics.nEntryWidth = Max( aMetrics.nImgWidth, (USHORT)maUserItemSize.Width() ); + aMetrics.nEntryWidth = Max( aMetrics.nImgWidth, maUserItemSize.Width() ); if ( aMetrics.bText ) aMetrics.nEntryWidth += aMetrics.nTextWidth + IMG_TXT_DISTANCE; - aMetrics.nEntryHeight = Max( mnMaxImgHeight, (USHORT)maUserItemSize.Height() ) + 2; + aMetrics.nEntryHeight = Max( Max( mnMaxImgHeight, maUserItemSize.Height() ) + 2, + aMetrics.nEntryHeight ); } - if ( bUpdateMetrics ) - { - if ( aMetrics.nEntryWidth > mnMaxWidth ) - mnMaxWidth = aMetrics.nEntryWidth; - if ( aMetrics.nEntryHeight > mnMaxHeight ) - mnMaxHeight = aMetrics.nEntryHeight; - } + if ( aMetrics.nEntryWidth > mnMaxWidth ) + mnMaxWidth = aMetrics.nEntryWidth; + if ( aMetrics.nEntryHeight > mnMaxHeight ) + mnMaxHeight = aMetrics.nEntryHeight; + + rEntry.mnHeight = aMetrics.nEntryHeight; } // ----------------------------------------------------------------------- @@ -746,7 +799,10 @@ USHORT ImplListBoxWindow::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry ) delete mpLayoutData, mpLayoutData = NULL; USHORT nNewPos = mpEntryList->InsertEntry( nPos, pNewEntry, mbSort ); - ImplCalcEntryMetrics( *pNewEntry, TRUE ); + if( (GetStyle() & WB_WORDBREAK) ) + pNewEntry->mnFlags |= LISTBOX_ENTRY_FLAG_MULTILINE; + + ImplUpdateEntryMetrics( *pNewEntry ); return nNewPos; } @@ -756,11 +812,23 @@ void ImplListBoxWindow::RemoveEntry( USHORT nPos ) { delete mpLayoutData, mpLayoutData = NULL; mpEntryList->RemoveEntry( nPos ); + if( mnCurrentPos >= mpEntryList->GetEntryCount() ) + mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; ImplCalcMetrics(); } // ----------------------------------------------------------------------- +void ImplListBoxWindow::SetEntryFlags( USHORT nPos, long nFlags ) +{ + mpEntryList->SetEntryFlags( nPos, nFlags ); + ImplEntryType* pEntry = mpEntryList->GetMutableEntryPtr( nPos ); + if( pEntry ) + ImplUpdateEntryMetrics( *pEntry ); +} + +// ----------------------------------------------------------------------- + void ImplListBoxWindow::ImplShowFocusRect() { if ( mbHasFocusRect ) @@ -785,14 +853,57 @@ void ImplListBoxWindow::ImplHideFocusRect() USHORT ImplListBoxWindow::GetEntryPosForPoint( const Point& rPoint ) const { - USHORT nSelect = (USHORT) ( ( rPoint.Y() + mnBorder ) / mnMaxHeight ) + (USHORT) mnTop; - if( nSelect < mnTop || nSelect >= mpEntryList->GetEntryCount() ) + long nY = mnBorder; + + USHORT nSelect = mnTop; + const ImplEntryType* pEntry = mpEntryList->GetEntryPtr( nSelect ); + while( pEntry && rPoint.Y() > pEntry->mnHeight + nY ) + { + nY += pEntry->mnHeight; + pEntry = mpEntryList->GetEntryPtr( ++nSelect ); + } + if( pEntry == NULL ) nSelect = LISTBOX_ENTRY_NOTFOUND; + return nSelect; } // ----------------------------------------------------------------------- +BOOL ImplListBoxWindow::IsVisible( USHORT i_nEntry ) const +{ + BOOL bRet = FALSE; + + if( i_nEntry >= mnTop ) + { + if( mpEntryList->GetAddedHeight( i_nEntry, mnTop ) < + PixelToLogic( GetSizePixel() ).Height() ) + { + bRet = TRUE; + } + } + + return bRet; +} + +// ----------------------------------------------------------------------- + +USHORT ImplListBoxWindow::GetLastVisibleEntry() const +{ + USHORT nPos = mnTop; + long nWindowHeight = GetSizePixel().Height(); + USHORT nCount = mpEntryList->GetEntryCount(); + for( long nDiff = 0; nDiff < nWindowHeight && nPos < nCount; nDiff = mpEntryList->GetAddedHeight( nPos, mnTop ) ) + nPos++; + + if( nPos >= nCount ) + nPos = nCount-1; + + return nPos; +} + +// ----------------------------------------------------------------------- + void ImplListBoxWindow::MouseButtonDown( const MouseEvent& rMEvt ) { mbMouseMoveSelect = FALSE; // Nur bis zum ersten MouseButtonDown @@ -863,8 +974,10 @@ void ImplListBoxWindow::MouseMove( const MouseEvent& rMEvt ) { if ( IsMouseMoveSelect() ) { - USHORT nSelect = (USHORT) ( ( rMEvt.GetPosPixel().Y() + mnBorder ) / mnMaxHeight ) + (USHORT) mnTop; - nSelect = Min( nSelect, (USHORT) ( mnTop + mnMaxVisibleEntries ) ); + USHORT nSelect = GetEntryPosForPoint( rMEvt.GetPosPixel() ); + if( nSelect == LISTBOX_ENTRY_NOTFOUND ) + nSelect = mpEntryList->GetEntryCount() - 1; + nSelect = Min( nSelect, GetLastVisibleEntry() ); nSelect = Min( nSelect, (USHORT) ( mpEntryList->GetEntryCount() - 1 ) ); // Select only visible Entries with MouseMove, otherwise Tracking... if ( IsVisible( nSelect ) && @@ -944,14 +1057,15 @@ void ImplListBoxWindow::SelectEntry( USHORT nPos, BOOL bSelect ) if ( !IsVisible( nPos ) ) { delete mpLayoutData, mpLayoutData = NULL; - if ( !mnMaxVisibleEntries || !IsReallyVisible() || ( nPos < GetTopEntry() ) ) + USHORT nVisibleEntries = GetLastVisibleEntry()-mnTop; + if ( !nVisibleEntries || !IsReallyVisible() || ( nPos < GetTopEntry() ) ) { Resize(); SetTopEntry( nPos ); } else { - SetTopEntry( nPos-mnMaxVisibleEntries+1 ); + SetTopEntry( nPos-nVisibleEntries+1 ); } } } @@ -1105,7 +1219,11 @@ BOOL ImplListBoxWindow::SelectEntries( USHORT nSelect, LB_EVENT_TYPE eLET, BOOL if( bFocusChanged ) { - maFocusRect.SetPos( Point( 0, ( nSelect - mnTop ) * mnMaxHeight ) ); + long nHeightDiff = mpEntryList->GetAddedHeight( nSelect, mnTop, 0 ); + maFocusRect.SetPos( Point( 0, nHeightDiff ) ); + Size aSz( maFocusRect.GetWidth(), + mpEntryList->GetEntryHeight( nSelect ) ); + maFocusRect.SetSize( aSz ); if( HasFocus() ) ImplShowFocusRect(); } @@ -1139,7 +1257,11 @@ void ImplListBoxWindow::Tracking( const TrackingEvent& rTEvt ) mbTrackingSelect = FALSE; if ( mnTrackingSaveSelection != LISTBOX_ENTRY_NOTFOUND ) { - maFocusRect.SetPos( Point( 0, ( mnCurrentPos - mnTop ) * mnMaxHeight ) ); + long nHeightDiff = mpEntryList->GetAddedHeight( mnCurrentPos, mnTop, 0 ); + maFocusRect.SetPos( Point( 0, nHeightDiff ) ); + Size aSz( maFocusRect.GetWidth(), + mpEntryList->GetEntryHeight( mnCurrentPos ) ); + maFocusRect.SetSize( aSz ); ImplShowFocusRect(); } } @@ -1187,14 +1309,14 @@ void ImplListBoxWindow::Tracking( const TrackingEvent& rTEvt ) if ( mnCurrentPos != LISTBOX_ENTRY_NOTFOUND ) { nSelect = Min( (USHORT)(mnCurrentPos+1), (USHORT)(mpEntryList->GetEntryCount()-1) ); - if( nSelect >= mnTop + mnMaxVisibleEntries ) + if( nSelect >= GetLastVisibleEntry() ) SetTopEntry( mnTop+1 ); } } else { nSelect = (USHORT) ( ( aPt.Y() + mnBorder ) / mnMaxHeight ) + (USHORT) mnTop; - nSelect = Min( nSelect, (USHORT) ( mnTop + mnMaxVisibleEntries ) ); + nSelect = Min( nSelect, GetLastVisibleEntry() ); nSelect = Min( nSelect, (USHORT) ( mpEntryList->GetEntryCount() - 1 ) ); } @@ -1268,7 +1390,10 @@ void ImplListBoxWindow::Tracking( const TrackingEvent& rTEvt ) } else { - maFocusRect.SetPos( Point( 0, ( mnCurrentPos - mnTop ) * mnMaxHeight ) ); + long nHeightDiff = mpEntryList->GetAddedHeight( mnCurrentPos, mnTop, 0 ); + maFocusRect.SetPos( Point( 0, nHeightDiff ) ); + Size aSz( maFocusRect.GetWidth(), mpEntryList->GetEntryHeight( mnCurrentPos ) ); + maFocusRect.SetSize( aSz ); ImplShowFocusRect(); } } @@ -1351,7 +1476,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) nSelect = mpEntryList->FindFirstSelectable( mnCurrentPos + 1, true ); } - if( ( nSelect != LISTBOX_ENTRY_NOTFOUND ) && ( nSelect >= ( mnTop + mnMaxVisibleEntries ) ) ) + if( ( nSelect != LISTBOX_ENTRY_NOTFOUND ) && ( nSelect >= GetLastVisibleEntry() ) ) SetTopEntry( mnTop+1 ); bDone = TRUE; @@ -1364,8 +1489,9 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) { if ( IsReadOnly() ) { - SetTopEntry( ( mnTop > mnMaxVisibleEntries ) ? - (mnTop-mnMaxVisibleEntries) : 0 ); + USHORT nCurVis = GetLastVisibleEntry() - mnTop +1; + SetTopEntry( ( mnTop > nCurVis ) ? + (mnTop-nCurVis) : 0 ); } else if ( !bCtrl && !bMod2 ) { @@ -1376,7 +1502,10 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) else if ( mnCurrentPos ) { if( mnCurrentPos == mnTop ) - SetTopEntry( ( mnTop > mnMaxVisibleEntries ) ? ( mnTop-mnMaxVisibleEntries+1 ) : 0 ); + { + USHORT nCurVis = GetLastVisibleEntry() - mnTop +1; + SetTopEntry( ( mnTop > nCurVis ) ? ( mnTop-nCurVis+1 ) : 0 ); + } // find first selectable starting from mnTop looking foreward nSelect = mpEntryList->FindFirstSelectable( mnTop, true ); @@ -1391,7 +1520,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) { if ( IsReadOnly() ) { - SetTopEntry( mnTop + mnMaxVisibleEntries ); + SetTopEntry( GetLastVisibleEntry() ); } else if ( !bCtrl && !bMod2 ) { @@ -1402,13 +1531,14 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) else if ( (mnCurrentPos+1) < mpEntryList->GetEntryCount() ) { USHORT nCount = mpEntryList->GetEntryCount(); - USHORT nTmp = Min( mnMaxVisibleEntries, nCount ); + USHORT nCurVis = GetLastVisibleEntry() - mnTop +1; + USHORT nTmp = Min( nCurVis, nCount ); nTmp += mnTop - 1; if( mnCurrentPos == nTmp && mnCurrentPos != nCount - 1 ) { - long nTmp2 = Min( (long)(nCount-mnMaxVisibleEntries), (long)((long)mnTop+(long)mnMaxVisibleEntries-1) ); + long nTmp2 = Min( (long)(nCount-nCurVis), (long)((long)mnTop+(long)nCurVis-1) ); nTmp2 = Max( (long)0 , nTmp2 ); - nTmp = (USHORT)(nTmp2+(mnMaxVisibleEntries-1) ); + nTmp = (USHORT)(nTmp2+(nCurVis-1) ); SetTopEntry( (USHORT)nTmp2 ); } // find first selectable starting from nTmp looking backwards @@ -1457,8 +1587,9 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) { USHORT nCount = mpEntryList->GetEntryCount(); nSelect = mpEntryList->FindFirstSelectable( nCount - 1, false ); - if( nCount > mnMaxVisibleEntries ) - SetTopEntry( nCount - mnMaxVisibleEntries ); + USHORT nCurVis = GetLastVisibleEntry() - mnTop + 1; + if( nCount > nCurVis ) + SetTopEntry( nCount - nCurVis ); } bDone = TRUE; } @@ -1565,10 +1696,11 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) if ( nSelect != LISTBOX_ENTRY_NOTFOUND ) { + USHORT nCurVis = GetLastVisibleEntry() - mnTop + 1; if( nSelect < mnTop ) SetTopEntry( nSelect ); - else if( nSelect >= (mnTop + mnMaxVisibleEntries) ) - SetTopEntry( nSelect - mnMaxVisibleEntries + 1 ); + else if( nSelect >= (mnTop + nCurVis) ) + SetTopEntry( nSelect - nCurVis + 1 ); if ( mpEntryList->IsEntryPosSelected( nSelect ) ) nSelect = LISTBOX_ENTRY_NOTFOUND; @@ -1610,9 +1742,13 @@ void ImplListBoxWindow::ImplPaint( USHORT nPos, BOOL bErase, bool bLayout ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + const ImplEntryType* pEntry = mpEntryList->GetEntryPtr( nPos ); + if( ! pEntry ) + return; + long nWidth = GetOutputSizePixel().Width(); - long nY = ( nPos - mnTop ) * mnMaxHeight; - Rectangle aRect( Point( 0, nY ), Size( nWidth, mnMaxHeight ) ); + long nY = mpEntryList->GetAddedHeight( nPos, mnTop ); + Rectangle aRect( Point( 0, nY ), Size( nWidth, pEntry->mnHeight ) ); if( ! bLayout ) { @@ -1656,12 +1792,16 @@ void ImplListBoxWindow::ImplPaint( USHORT nPos, BOOL bErase, bool bLayout ) void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImagePos, bool bLayout ) { + const ImplEntryType* pEntry = mpEntryList->GetEntryPtr( nPos ); + if( ! pEntry ) + return; + // Bei Aenderungen in dieser Methode ggf. auch ImplWin::DrawEntry() anpassen. if ( mbInUserDraw ) nPos = mnUserDrawEntry; // real entry, not the matching entry from MRU - long nY = ( nPos - mnTop ) * mnMaxHeight; + long nY = mpEntryList->GetAddedHeight( nPos, mnTop ); Size aImgSz; if( bDrawImage && mpEntryList->HasImages() && !bLayout ) @@ -1670,7 +1810,7 @@ void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, if( !!aImage ) { aImgSz = aImage.GetSizePixel(); - Point aPtImg( mnBorder - mnLeft, nY + ( ( mnMaxHeight - aImgSz.Height() ) / 2 ) ); + Point aPtImg( mnBorder - mnLeft, nY + ( ( pEntry->mnHeight - aImgSz.Height() ) / 2 ) ); // pb: #106948# explicit mirroring for calc if ( mbMirroring ) @@ -1699,13 +1839,16 @@ void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, { long nMaxWidth = Max( static_cast< long >( mnMaxWidth ), GetOutputSizePixel().Width() - 2*mnBorder ); + // a multiline entry should only be as wide a the window + if( (pEntry->mnFlags & LISTBOX_ENTRY_FLAG_MULTILINE) ) + nMaxWidth = GetOutputSizePixel().Width() - 2*mnBorder; Rectangle aTextRect( Point( mnBorder - mnLeft, nY ), - Size( nMaxWidth, mnMaxHeight ) ); + Size( nMaxWidth, pEntry->mnHeight ) ); if( !bDrawTextAtImagePos && ( mpEntryList->HasEntryImage(nPos) || IsUserDrawEnabled() ) ) { - USHORT nImageWidth = Max( mnMaxImgWidth, (USHORT)maUserItemSize.Width() ); + long nImageWidth = Max( mnMaxImgWidth, maUserItemSize.Width() ); aTextRect.Left() += nImageWidth + IMG_TXT_DISTANCE; } @@ -1721,7 +1864,11 @@ void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, aTextRect.Left() -= ( aImgSz.Width() + IMG_TXT_DISTANCE ); } - DrawText( aTextRect, aStr, ImplGetTextStyle(), pVector, pDisplayText ); + USHORT nDrawStyle = ImplGetTextStyle(); + if( (pEntry->mnFlags & LISTBOX_ENTRY_FLAG_MULTILINE) ) + nDrawStyle |= MULTILINE_ENTRY_DRAW_FLAGS; + + DrawText( aTextRect, aStr, nDrawStyle, pVector, pDisplayText ); } } @@ -1734,7 +1881,7 @@ void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, SetLineColor( ( GetBackground().GetColor() != COL_LIGHTGRAY ) ? COL_LIGHTGRAY : COL_GRAY ); Point aStartPos( 0, nY ); if ( nPos == mnSeparatorPos ) - aStartPos.Y() += mnMaxHeight-1; + aStartPos.Y() += pEntry->mnHeight-1; Point aEndPos( aStartPos ); aEndPos.X() = GetOutputSizePixel().Width(); DrawLine( aStartPos, aEndPos ); @@ -1767,15 +1914,19 @@ void ImplListBoxWindow::ImplDoPaint( const Rectangle& rRect, bool bLayout ) for( USHORT i = (USHORT)mnTop; i < nCount && nY < nHeight + mnMaxHeight; i++ ) { - if( nY + mnMaxHeight >= rRect.Top() && + const ImplEntryType* pEntry = mpEntryList->GetEntryPtr( i ); + if( nY + pEntry->mnHeight >= rRect.Top() && nY <= rRect.Bottom() + mnMaxHeight ) { ImplPaint( i, FALSE, bLayout ); } - nY += mnMaxHeight; + nY += pEntry->mnHeight; } - maFocusRect.SetPos( Point( 0, ( mnCurrentPos - mnTop ) * mnMaxHeight ) ); + long nHeightDiff = mpEntryList->GetAddedHeight( mnCurrentPos, mnTop, 0 ); + maFocusRect.SetPos( Point( 0, nHeightDiff ) ); + Size aSz( maFocusRect.GetWidth(), mpEntryList->GetEntryHeight( mnCurrentPos ) ); + maFocusRect.SetSize( aSz ); if( HasFocus() && bShowFocusRect && !bLayout ) ImplShowFocusRect(); } @@ -1791,6 +1942,8 @@ void ImplListBoxWindow::Paint( const Rectangle& rRect ) USHORT ImplListBoxWindow::GetDisplayLineCount() const { + // FIXME: LISTBOX_ENTRY_FLAG_MULTILINE + USHORT nCount = mpEntryList->GetEntryCount(); long nHeight = GetOutputSizePixel().Height();// - mnMaxHeight + mnBorder; USHORT nEntries = static_cast< USHORT >( ( nHeight + mnMaxHeight - 1 ) / mnMaxHeight ); @@ -1810,9 +1963,11 @@ void ImplListBoxWindow::Resize() if ( bShowFocusRect ) ImplHideFocusRect(); - Size aSz( GetOutputSizePixel().Width(), mnMaxHeight ); - maFocusRect.SetSize( aSz ); - mnMaxVisibleEntries = (USHORT) ( GetOutputSizePixel().Height() / mnMaxHeight ); + if( mnCurrentPos != LISTBOX_ENTRY_NOTFOUND ) + { + Size aSz( GetOutputSizePixel().Width(), mpEntryList->GetEntryHeight( mnCurrentPos ) ); + maFocusRect.SetSize( aSz ); + } if ( bShowFocusRect ) ImplShowFocusRect(); @@ -1822,20 +1977,15 @@ void ImplListBoxWindow::Resize() // ----------------------------------------------------------------------- -void ImplListBoxWindow::CalcMaxVisibleEntries( const Size& rFloatSize ) -{ - if( mnMaxHeight ) - mnMaxVisibleEntries = (USHORT) ( (rFloatSize.Height()-4) / mnMaxHeight ); -} - -// ----------------------------------------------------------------------- - void ImplListBoxWindow::GetFocus() { USHORT nPos = mnCurrentPos; if ( nPos == LISTBOX_ENTRY_NOTFOUND ) nPos = 0; - maFocusRect.SetPos( Point( 0, ( nPos - mnTop ) * mnMaxHeight ) ); + long nHeightDiff = mpEntryList->GetAddedHeight( nPos, mnTop, 0 ); + maFocusRect.SetPos( Point( 0, nHeightDiff ) ); + Size aSz( maFocusRect.GetWidth(), mpEntryList->GetEntryHeight( nPos ) ); + maFocusRect.SetSize( aSz ); ImplShowFocusRect(); Control::GetFocus(); } @@ -1864,14 +2014,22 @@ void ImplListBoxWindow::RequestHelp( const HelpEvent& rHEvt ) void ImplListBoxWindow::SetTopEntry( USHORT nTop ) { - USHORT nMaxTop = 0; - if ( GetEntryList()->GetEntryCount() > mnMaxVisibleEntries ) - nMaxTop = GetEntryList()->GetEntryCount() - mnMaxVisibleEntries; - nTop = Min( nTop, nMaxTop ); + if( mpEntryList->GetEntryCount() == 0 ) + return; + + long nWHeight = PixelToLogic( GetSizePixel() ).Height(); + + USHORT nLastEntry = mpEntryList->GetEntryCount()-1; + if( nTop > nLastEntry ) + nTop = nLastEntry; + const ImplEntryType* pLast = mpEntryList->GetEntryPtr( nLastEntry ); + while( nTop > 0 && mpEntryList->GetAddedHeight( nLastEntry, nTop-1 ) + pLast->mnHeight <= nWHeight ) + nTop--; + if ( nTop != mnTop ) { delete mpLayoutData, mpLayoutData = NULL; - long nDiff = ( mnTop - nTop ) * mnMaxHeight; + long nDiff = mpEntryList->GetAddedHeight( mnTop, nTop, 0 ); Update(); ImplHideFocusRect(); mnTop = nTop; @@ -1887,16 +2045,16 @@ void ImplListBoxWindow::SetTopEntry( USHORT nTop ) // ----------------------------------------------------------------------- -void ImplListBoxWindow::SetLeftIndent( USHORT n ) +void ImplListBoxWindow::SetLeftIndent( long n ) { ScrollHorz( n - mnLeft ); } // ----------------------------------------------------------------------- -void ImplListBoxWindow::ScrollHorz( short n ) +void ImplListBoxWindow::ScrollHorz( long n ) { - short nDiff = 0; + long nDiff = 0; if ( n > 0 ) { long nWidth = GetOutputSizePixel().Width(); @@ -1907,7 +2065,7 @@ void ImplListBoxWindow::ScrollHorz( short n ) { if( mnLeft ) { - USHORT nAbs = -n; + long nAbs = -n; nDiff = - ( ( mnLeft > nAbs ) ? nAbs : mnLeft ); } } @@ -1930,6 +2088,8 @@ void ImplListBoxWindow::ScrollHorz( short n ) Size ImplListBoxWindow::CalcSize( USHORT nMaxLines ) const { + // FIXME: LISTBOX_ENTRY_FLAG_MULTILINE + Size aSz; // USHORT nL = Min( nMaxLines, mpEntryList->GetEntryCount() ); aSz.Height() = nMaxLines * mnMaxHeight; @@ -1941,8 +2101,9 @@ Size ImplListBoxWindow::CalcSize( USHORT nMaxLines ) const Rectangle ImplListBoxWindow::GetBoundingRectangle( USHORT nItem ) const { - Size aSz( GetSizePixel().Width(), GetEntryHeight() ); - long nY = ( nItem - GetTopEntry() ) * GetEntryHeight(); + const ImplEntryType* pEntry = mpEntryList->GetEntryPtr( nItem ); + Size aSz( GetSizePixel().Width(), pEntry ? pEntry->mnHeight : GetEntryHeight() ); + long nY = mpEntryList->GetAddedHeight( nItem, GetTopEntry() ) - mpEntryList->GetAddedHeight( GetTopEntry() ); Rectangle aRect( Point( 0, nY ), aSz ); return aRect; } @@ -2112,7 +2273,7 @@ void ImplListBox::RemoveEntry( USHORT nPos ) void ImplListBox::SetEntryFlags( USHORT nPos, long nFlags ) { - maLBWindow.GetEntryList()->SetEntryFlags( nPos, nFlags ); + maLBWindow.SetEntryFlags( nPos, nFlags ); } // ----------------------------------------------------------------------- @@ -2397,6 +2558,13 @@ void ImplListBox::StateChanged( StateChangedType nType ) { maLBWindow.SetControlBackground( GetControlBackground() ); } + else if( nType == STATE_CHANGE_MIRRORING ) + { + maLBWindow.EnableRTL( IsRTLEnabled() ); + mpHScrollBar->EnableRTL( IsRTLEnabled() ); + mpVScrollBar->EnableRTL( IsRTLEnabled() ); + ImplResizeControls(); + } Control::StateChanged( nType ); } @@ -3039,7 +3207,7 @@ void ImplListBoxFloatingWindow::StartFloat( BOOL bStartTracking ) // check if the control's parent is un-mirrored which is the case for form controls in a mirrored UI // where the document is unmirrored // because StartPopupMode() expects a rectangle in mirrored coordinates we have to re-mirror - if( GetParent()->GetParent()->ImplHasMirroredGraphics() && !GetParent()->GetParent()->IsRTLEnabled() ) + if( GetParent()->GetParent()->ImplIsAntiparallel() ) GetParent()->GetParent()->ImplReMirror( aRect ); StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN ); diff --git a/vcl/source/control/imgctrl.cxx b/vcl/source/control/imgctrl.cxx index 5287653bd367..e6930edeba95 100644 --- a/vcl/source/control/imgctrl.cxx +++ b/vcl/source/control/imgctrl.cxx @@ -30,42 +30,61 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" + #include <vcl/event.hxx> #include <vcl/imgctrl.hxx> +#include <com/sun/star/awt/ImageScaleMode.hdl> + +namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode; + // ----------------------------------------------------------------------- ImageControl::ImageControl( Window* pParent, WinBits nStyle ) : FixedImage( pParent, nStyle ) { - mbScaleImage = TRUE; + mnScaleMode = ImageScaleMode::Anisotropic; } // ----------------------------------------------------------------------- -void ImageControl::SetScaleImage( BOOL bScale ) +void ImageControl::SetScaleMode( const ::sal_Int16 _nMode ) { - if ( bScale != mbScaleImage ) + if ( _nMode != mnScaleMode ) { - mbScaleImage = bScale; + mnScaleMode = _nMode; Invalidate(); } } // ----------------------------------------------------------------------- -BOOL ImageControl::IsScaleImage() const +void ImageControl::Resize() { - // Make inline when changing member from dummy... - return mbScaleImage; + Invalidate(); } - // ----------------------------------------------------------------------- - -void ImageControl::Resize() +namespace { - Invalidate(); + static Size lcl_calcPaintSize( const Rectangle& _rPaintRect, const Size& _rBitmapSize ) + { + const Size aPaintSize = _rPaintRect.GetSize(); + + const double nRatioX = 1.0 * aPaintSize.Width() / _rBitmapSize.Width(); + const double nRatioY = 1.0 * aPaintSize.Height() / _rBitmapSize.Height(); + const double nRatioMin = ::std::min( nRatioX, nRatioY ); + + return Size( long( _rBitmapSize.Width() * nRatioMin ), long( _rBitmapSize.Height() * nRatioMin ) ); + } + + static Point lcl_centerWithin( const Rectangle& _rArea, const Size& _rObjectSize ) + { + Point aPos( _rArea.TopLeft() ); + aPos.X() += ( _rArea.GetWidth() - _rObjectSize.Width() ) / 2; + aPos.Y() += ( _rArea.GetHeight() - _rObjectSize.Height() ) / 2; + return aPos; + } } // ----------------------------------------------------------------------- @@ -84,42 +103,82 @@ void ImageControl::UserDraw( const UserDrawEvent& rUDEvt ) // nStyle |= IMAGE_DRAW_COLORTRANSFORM; } + const Rectangle& rPaintRect = rUDEvt.GetRect(); + const Size& rBitmapSize = maBmp.GetSizePixel(); + if( nStyle & IMAGE_DRAW_COLORTRANSFORM ) { // only images support IMAGE_DRAW_COLORTRANSFORM Image aImage( maBmp ); if ( !!aImage ) { - if ( mbScaleImage ) - rUDEvt.GetDevice()->DrawImage( rUDEvt.GetRect().TopLeft(), - rUDEvt.GetRect().GetSize(), - aImage, nStyle ); - else + switch ( mnScaleMode ) { - // Center... - Point aPos( rUDEvt.GetRect().TopLeft() ); - aPos.X() += ( rUDEvt.GetRect().GetWidth() - maBmp.GetSizePixel().Width() ) / 2; - aPos.Y() += ( rUDEvt.GetRect().GetHeight() - maBmp.GetSizePixel().Height() ) / 2; - rUDEvt.GetDevice()->DrawImage( aPos, aImage, nStyle ); + case ImageScaleMode::None: + { + rUDEvt.GetDevice()->DrawImage( + lcl_centerWithin( rPaintRect, rBitmapSize ), aImage, nStyle ); } + break; + + case ImageScaleMode::Isotropic: + { + const Size aPaintSize = lcl_calcPaintSize( rPaintRect, rBitmapSize ); + rUDEvt.GetDevice()->DrawImage( + lcl_centerWithin( rPaintRect, aPaintSize ), + aPaintSize, + aImage, nStyle ); + } + break; + + case ImageScaleMode::Anisotropic: + { + rUDEvt.GetDevice()->DrawImage( + rPaintRect.TopLeft(), + rPaintRect.GetSize(), + aImage, nStyle ); + } + break; + + default: + OSL_ENSURE( false, "ImageControl::UserDraw: unhandled scale mode!" ); + break; + + } // switch ( mnScaleMode ) } } else { - if ( mbScaleImage ) + switch ( mnScaleMode ) { + case ImageScaleMode::None: + { + maBmp.Draw( rUDEvt.GetDevice(), lcl_centerWithin( rPaintRect, rBitmapSize ) ); + } + break; + + case ImageScaleMode::Isotropic: + { + const Size aPaintSize = lcl_calcPaintSize( rPaintRect, rBitmapSize ); maBmp.Draw( rUDEvt.GetDevice(), - rUDEvt.GetRect().TopLeft(), - rUDEvt.GetRect().GetSize() ); + lcl_centerWithin( rPaintRect, aPaintSize ), + aPaintSize ); } - else + break; + + case ImageScaleMode::Anisotropic: { - // Center... - Point aPos( rUDEvt.GetRect().TopLeft() ); - aPos.X() += ( rUDEvt.GetRect().GetWidth() - maBmp.GetSizePixel().Width() ) / 2; - aPos.Y() += ( rUDEvt.GetRect().GetHeight() - maBmp.GetSizePixel().Height() ) / 2; - maBmp.Draw( rUDEvt.GetDevice(), aPos ); + maBmp.Draw( rUDEvt.GetDevice(), + rPaintRect.TopLeft(), + rPaintRect.GetSize() ); } + break; + + default: + OSL_ENSURE( false, "ImageControl::UserDraw: unhandled scale mode!" ); + break; + + } // switch ( mnScaleMode ) } } diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index df79f1580583..0accd17489c9 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -876,6 +876,18 @@ void ListBox::StateChanged( StateChangedType nType ) SetStyle( ImplInitStyle( GetStyle() ) ); mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) ? TRUE : FALSE ); } + else if( nType == STATE_CHANGE_MIRRORING ) + { + if( mpBtn ) + { + mpBtn->EnableRTL( IsRTLEnabled() ); + ImplInitDropDownButton( mpBtn ); + } + mpImplLB->EnableRTL( IsRTLEnabled() ); + if( mpImplWin ) + mpImplWin->EnableRTL( IsRTLEnabled() ); + Resize(); + } Control::StateChanged( nType ); } @@ -934,8 +946,6 @@ long ListBox::PreNotify( NotifyEvent& rNEvt ) default: { - if( mpFloatWin ) - mpImplLB->GetMainWindow()->CalcMaxVisibleEntries( mpFloatWin->CalcFloatSize() ); nDone = mpImplLB->ProcessKeyInput( aKeyEvt ); } } diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index c0bbd62b82c1..3f8779dc2e90 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -313,7 +313,6 @@ void SpinField::ImplInitSpinFieldData() mbInitialDown = FALSE; mbNoSelect = FALSE; mbInDropDown = FALSE; - EnableRTL( TRUE ); } // -------------------------------------------------------------------- @@ -765,6 +764,7 @@ void SpinField::Resize() { Control::Resize(); Size aSize = GetOutputSizePixel(); + bool bSubEditPositioned = false; if ( GetStyle() & (WB_SPIN|WB_DROPDOWN) ) { @@ -789,6 +789,7 @@ void SpinField::Resize() // use the themes drop down size Rectangle aContentRect = aContent.GetBoundRect(); mpEdit->SetPosPixel( aContentRect.TopLeft() ); + bSubEditPositioned = true; aSize = aContentRect.GetSize(); } else @@ -803,6 +804,11 @@ void SpinField::Resize() } } + if( ! bSubEditPositioned ) + { + // this moves our sub edit if RTL gets switched + mpEdit->SetPosPixel( Point() ); + } mpEdit->SetSizePixel( aSize ); if ( GetStyle() & WB_SPIN ) @@ -868,6 +874,12 @@ void SpinField::StateChanged( StateChangedType nType ) ImplInitSettings( FALSE, FALSE, TRUE ); Invalidate(); } + else if( nType == STATE_CHANGE_MIRRORING ) + { + if( mpEdit ) + mpEdit->StateChanged( STATE_CHANGE_MIRRORING ); + Resize(); + } } // ----------------------------------------------------------------------- diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 5509e7a4eb18..25a086060fcf 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -46,6 +46,7 @@ #include <vcl/tabpage.hxx> #include <vcl/tabctrl.hxx> #include <vcl/controllayout.hxx> +#include <vcl/sound.hxx> #include <vcl/window.h> @@ -54,18 +55,6 @@ // ======================================================================= -struct ImplTabCtrlData -{ - PushButton* mpLeftBtn; - PushButton* mpRightBtn; - std::hash_map< int, int > maLayoutPageIdToLine; - std::hash_map< int, int > maLayoutLineToPageId; - std::vector< Rectangle > maTabRectangles; - Point maItemsOffset; // offset of the tabitems -}; - -// ----------------------------------------------------------------------- - struct ImplTabItem { USHORT mnId; @@ -77,10 +66,28 @@ struct ImplTabItem ULONG mnHelpId; Rectangle maRect; USHORT mnLine; - BOOL mbFullVisible; + bool mbFullVisible; + bool mbEnabled; + Image maTabImage; + + ImplTabItem() + : mnId( 0 ), mnTabPageResId( 0 ), mpTabPage( NULL ), mnHelpId( 0 ), + mnLine( 0 ), mbFullVisible( FALSE ), mbEnabled( true ) + {} }; -DECLARE_LIST( ImplTabItemList, ImplTabItem* ) +// ----------------------------------------------------------------------- + +struct ImplTabCtrlData +{ + PushButton* mpLeftBtn; + PushButton* mpRightBtn; + std::hash_map< int, int > maLayoutPageIdToLine; + std::hash_map< int, int > maLayoutLineToPageId; + std::vector< Rectangle > maTabRectangles; + Point maItemsOffset; // offset of the tabitems + std::vector< ImplTabItem > maItemList; +}; // ----------------------------------------------------------------------- @@ -133,7 +140,6 @@ void TabControl::ImplInit( Window* pParent, WinBits nStyle ) Control::ImplInit( pParent, nStyle, NULL ); - mpItemList = new ImplTabItemList( 8, 8 ); mnLastWidth = 0; mnLastHeight = 0; mnBtnSize = 0; @@ -283,17 +289,6 @@ TabControl::~TabControl() { ImplFreeLayoutData(); - // Alle Items loeschen - ImplTabItem* pItem = mpItemList->First(); - while ( pItem ) - { - delete pItem; - pItem = mpItemList->Next(); - } - - // Itemlist loeschen - delete mpItemList; - // TabCtrl-Daten loeschen if ( mpTabCtrlData ) { @@ -309,13 +304,11 @@ TabControl::~TabControl() ImplTabItem* TabControl::ImplGetItem( USHORT nId ) const { - ImplTabItem* pItem = mpItemList->First(); - while ( pItem ) + for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin(); + it != mpTabCtrlData->maItemList.end(); ++it ) { - if ( pItem->mnId == nId ) - return pItem; - - pItem = mpItemList->Next(); + if( it->mnId == nId ) + return &(*it); } return NULL; @@ -395,6 +388,16 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ) { pItem->maFormatText = pItem->maText; Size aSize( GetCtrlTextWidth( pItem->maFormatText ), GetTextHeight() ); + Size aImageSize( 0, 0 ); + if( !!pItem->maTabImage ) + { + aImageSize = pItem->maTabImage.GetSizePixel(); + if( pItem->maFormatText.Len() ) + aImageSize.Width() += GetTextHeight()/4; + } + aSize.Width() += aImageSize.Width(); + if( aImageSize.Height() > aSize.Height() ) + aSize.Height() = aImageSize.Height(); Region aCtrlRegion( Rectangle( (const Point&)Point( 0, 0 ), aSize ) ); Region aBoundingRgn, aContentRgn; @@ -403,8 +406,8 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ) CTRL_STATE_ENABLED, aControlValue, rtl::OUString(), aBoundingRgn, aContentRgn ) ) { - Rectangle aCont(aContentRgn.GetBoundRect()); - return aCont.GetSize(); + Rectangle aCont(aContentRgn.GetBoundRect()); + return aCont.GetSize(); } aSize.Width() += TAB_TABOFFSET_X*2; @@ -426,6 +429,7 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ) { pItem->maFormatText.Erase( pItem->maFormatText.Len()-aAppendStr.Len()-1, 1 ); aSize.Width() = GetCtrlTextWidth( pItem->maFormatText ); + aSize.Width() += aImageSize.Width(); aSize.Width() += TAB_TABOFFSET_X*2; } while ( (aSize.Width()+4 >= nMaxWidth) && (pItem->maFormatText.Len() > aAppendStr.Len()) ); @@ -436,6 +440,12 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, long nMaxWidth ) } } + if( pItem->maFormatText.Len() == 0 ) + { + if( aSize.Height() < aImageSize.Height()+4 ) //leave space for focus rect + aSize.Height() = aImageSize.Height()+4; + } + return aSize; } @@ -449,7 +459,7 @@ Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight if ( nHeight == -1 ) nHeight = aWinSize.Height(); - if ( !mpItemList->Count() ) + if ( mpTabCtrlData->maItemList.empty() ) { return Rectangle( Point( TAB_OFFSET, TAB_OFFSET ), Size( nWidth-TAB_OFFSET*2, nHeight-TAB_OFFSET*2 ) ); @@ -495,7 +505,6 @@ Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight long nTextWidth2 = GetTextWidth( aTestStr ); mbExtraSpace = (nTextWidth1 == nTextWidth2); - ImplTabItem* pItem; Size aSize; const long nOffsetX = 2 + GetItemsOffset().X(); const long nOffsetY = 2 + GetItemsOffset().Y(); @@ -509,128 +518,124 @@ Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight nMaxWidth -= GetItemsOffset().X(); mbScroll = FALSE; - if( 1 ) + + USHORT nLines = 0; + USHORT nCurLine = 0; + long nLineWidthAry[100]; + USHORT nLinePosAry[101]; + + nLineWidthAry[0] = 0; + nLinePosAry[0] = 0; + for( std::vector<ImplTabItem>::iterator it = mpTabCtrlData->maItemList.begin(); + it != mpTabCtrlData->maItemList.end(); ++it ) { - USHORT nLines = 0; - USHORT nCurLine = 0; - long nLineWidthAry[100]; - USHORT nLinePosAry[101]; - - nLineWidthAry[0] = 0; - nLinePosAry[0] = 0; - pItem = mpItemList->First(); - while ( pItem ) + aSize = ImplGetItemSize( &(*it), nMaxWidth ); + + if ( ((nX+aSize.Width()) > nWidth - 2) && (nWidth > 2+nOffsetX) ) { - aSize = ImplGetItemSize( pItem, nMaxWidth ); + if ( nLines == 99 ) + break; - if ( ((nX+aSize.Width()) > nWidth - 2) && (nWidth > 2+nOffsetX) ) - { - if ( nLines == 99 ) - break; + nX = nOffsetX; + nY += aSize.Height(); + nLines++; + nLineWidthAry[nLines] = 0; + nLinePosAry[nLines] = nPos; + } - nX = nOffsetX; - nY += aSize.Height(); - nLines++; - nLineWidthAry[nLines] = 0; - nLinePosAry[nLines] = nPos; - } + Rectangle aNewRect( Point( nX, nY ), aSize ); + if ( mbSmallInvalidate && (it->maRect != aNewRect) ) + mbSmallInvalidate = FALSE; + it->maRect = aNewRect; + it->mnLine = nLines; + it->mbFullVisible = TRUE; - Rectangle aNewRect( Point( nX, nY ), aSize ); - if ( mbSmallInvalidate && (pItem->maRect != aNewRect) ) - mbSmallInvalidate = FALSE; - pItem->maRect = aNewRect; - pItem->mnLine = nLines; - pItem->mbFullVisible = TRUE; + nLineWidthAry[nLines] += aSize.Width(); + nX += aSize.Width(); - nLineWidthAry[nLines] += aSize.Width(); - nX += aSize.Width(); + if ( it->mnId == mnCurPageId ) + nCurLine = nLines; - if ( pItem->mnId == mnCurPageId ) - nCurLine = nLines; + nPos++; + } - pItem = mpItemList->Next(); - nPos++; + if ( nLines && !mpTabCtrlData->maItemList.empty() ) + { + long nDX = 0; + long nModDX = 0; + long nIDX = 0; + USHORT i; + USHORT n; + long nLineHeightAry[100]; + long nIH = mpTabCtrlData->maItemList[0].maRect.Bottom()-2; + + i = 0; + while ( i < nLines+1 ) + { + if ( i <= nCurLine ) + nLineHeightAry[i] = nIH*(nLines-(nCurLine-i)) + GetItemsOffset().Y(); + else + nLineHeightAry[i] = nIH*(i-nCurLine-1) + GetItemsOffset().Y(); + i++; } - if ( nLines ) + i = 0; + n = 0; + nLinePosAry[nLines+1] = (USHORT)mpTabCtrlData->maItemList.size(); + for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin(); + it != mpTabCtrlData->maItemList.end(); ++it ) { - long nDX = 0; - long nModDX = 0; - long nIDX = 0; - USHORT i; - USHORT n; - long nLineHeightAry[100]; - long nIH = mpItemList->GetObject( 0 )->maRect.Bottom()-2; - - i = 0; - while ( i < nLines+1 ) + if ( i == nLinePosAry[n] ) { - if ( i <= nCurLine ) - nLineHeightAry[i] = nIH*(nLines-(nCurLine-i)) + GetItemsOffset().Y(); - else - nLineHeightAry[i] = nIH*(i-nCurLine-1) + GetItemsOffset().Y(); - i++; - } + if ( n == nLines+1 ) + break; - i = 0; - n = 0; - nLinePosAry[nLines+1] = (USHORT)mpItemList->Count(); - pItem = mpItemList->First(); - while ( pItem ) - { - if ( i == nLinePosAry[n] ) + nIDX = 0; + if( nLinePosAry[n+1]-i > 0 ) { - if ( n == nLines+1 ) - break; - - nIDX = 0; - if( nLinePosAry[n+1]-i > 0 ) - { - nDX = (nWidth-nOffsetX-nLineWidthAry[n]) / (nLinePosAry[n+1]-i); - nModDX = (nWidth-nOffsetX-nLineWidthAry[n]) % (nLinePosAry[n+1]-i); - } - else - { - // FIXME: this is a bad case of tabctrl way too small - nDX = 0; - nModDX = 0; - } - n++; + nDX = (nWidth-nOffsetX-nLineWidthAry[n]) / (nLinePosAry[n+1]-i); + nModDX = (nWidth-nOffsetX-nLineWidthAry[n]) % (nLinePosAry[n+1]-i); } - - pItem->maRect.Left() += nIDX; - pItem->maRect.Right() += nIDX+nDX; - pItem->maRect.Top() = nLineHeightAry[n-1]; - pItem->maRect.Bottom() = nLineHeightAry[n-1]+nIH; - nIDX += nDX; - - if ( nModDX ) + else { - nIDX++; - pItem->maRect.Right()++; - nModDX--; + // FIXME: this is a bad case of tabctrl way too small + nDX = 0; + nModDX = 0; } + n++; + } + + it->maRect.Left() += nIDX; + it->maRect.Right() += nIDX+nDX; + it->maRect.Top() = nLineHeightAry[n-1]; + it->maRect.Bottom() = nLineHeightAry[n-1]+nIH; + nIDX += nDX; - pItem = mpItemList->Next(); - i++; + if ( nModDX ) + { + nIDX++; + it->maRect.Right()++; + nModDX--; } + + i++; } - else {//only one line - if(ImplGetSVData()->maNWFData.mbCenteredTabs) { - pItem = mpItemList->First(); - int nRightSpace=nMaxWidth;//space left on the right by the tabs - while ( pItem ) - { - nRightSpace-=pItem->maRect.Right()-pItem->maRect.Left(); - pItem = mpItemList->Next(); - } - pItem = mpItemList->First(); - while ( pItem ) - { - pItem->maRect.Left()+=(int) (nRightSpace/2); - pItem->maRect.Right()+=(int) (nRightSpace/2); - pItem = mpItemList->Next(); - } + } + else + {//only one line + if(ImplGetSVData()->maNWFData.mbCenteredTabs) + { + int nRightSpace=nMaxWidth;//space left on the right by the tabs + for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin(); + it != mpTabCtrlData->maItemList.end(); ++it ) + { + nRightSpace-=it->maRect.Right()-it->maRect.Left(); + } + for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin(); + it != mpTabCtrlData->maItemList.end(); ++it ) + { + it->maRect.Left()+=(int) (nRightSpace/2); + it->maRect.Right()+=(int) (nRightSpace/2); } } } @@ -642,7 +647,7 @@ Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight ImplPosScrollBtns(); } - return mpItemList->GetObject( nItemPos )->maRect; + return size_t(nItemPos) < mpTabCtrlData->maItemList.size() ? mpTabCtrlData->maItemList[nItemPos].maRect : Rectangle(); } // ----------------------------------------------------------------------- @@ -803,23 +808,48 @@ void TabControl::ImplShowFocus() aFont.SetWeight( (!ImplGetSVData()->maNWFData.mbNoBoldTabFocus) ? WEIGHT_BOLD : WEIGHT_LIGHT ); SetFont( aFont ); - USHORT nCurPos = GetPagePos( mnCurPageId ); - Rectangle aRect = ImplGetTabRect( nCurPos ); - ImplTabItem* pItem = mpItemList->GetObject( nCurPos ); - Size aTabSize = aRect.GetSize(); - long nTextHeight = GetTextHeight(); - long nTextWidth = GetCtrlTextWidth( pItem->maFormatText ); - USHORT nOff; + USHORT nCurPos = GetPagePos( mnCurPageId ); + Rectangle aRect = ImplGetTabRect( nCurPos ); + const ImplTabItem& rItem = mpTabCtrlData->maItemList[ nCurPos ]; + Size aTabSize = aRect.GetSize(); + Size aImageSize( 0, 0 ); + long nTextHeight = GetTextHeight(); + long nTextWidth = GetCtrlTextWidth( rItem.maFormatText ); + USHORT nOff; if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_MONO) ) nOff = 1; else nOff = 0; - aRect.Left() = aRect.Left()+((aTabSize.Width()-nTextWidth)/2)-nOff-1-1; - aRect.Top() = aRect.Top()+((aTabSize.Height()-nTextHeight)/2)-1-1; - aRect.Right() = aRect.Left()+nTextWidth+2; - aRect.Bottom() = aRect.Top()+nTextHeight+2; + if( !! rItem.maTabImage ) + { + aImageSize = rItem.maTabImage.GetSizePixel(); + if( rItem.maFormatText.Len() ) + aImageSize.Width() += GetTextHeight()/4; + } + + if( rItem.maFormatText.Len() ) + { + // show focus around text + aRect.Left() = aRect.Left()+aImageSize.Width()+((aTabSize.Width()-nTextWidth-aImageSize.Width())/2)-nOff-1-1; + aRect.Top() = aRect.Top()+((aTabSize.Height()-nTextHeight)/2)-1-1; + aRect.Right() = aRect.Left()+nTextWidth+2; + aRect.Bottom() = aRect.Top()+nTextHeight+2; + } + else + { + // show focus around image + long nXPos = aRect.Left()+((aTabSize.Width()-nTextWidth-aImageSize.Width())/2)-nOff-1; + long nYPos = aRect.Top(); + if( aImageSize.Height() < aRect.GetHeight() ) + nYPos += (aRect.GetHeight() - aImageSize.Height())/2; + + aRect.Left() = nXPos - 2; + aRect.Top() = nYPos - 2; + aRect.Right() = aRect.Left() + aImageSize.Width() + 4; + aRect.Bottom() = aRect.Top() + aImageSize.Height() + 4; + } ShowFocus( aRect ); SetFont( aOldFont ); @@ -907,14 +937,15 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo if( IsMouseOver() && pItem->maRect.IsInside( GetPointerPosPixel() ) ) { nState |= CTRL_STATE_ROLLOVER; - ImplTabItem* pI; - int idx=0; - while( (pI = mpItemList->GetObject(idx++)) != NULL ) - if( (pI != pItem) && (pI->maRect.IsInside( GetPointerPosPixel() ) ) ) + for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin(); + it != mpTabCtrlData->maItemList.end(); ++it ) + { + if( (&(*it) != pItem) && (it->maRect.IsInside( GetPointerPosPixel() ) ) ) { nState &= ~CTRL_STATE_ROLLOVER; // avoid multiple highlighted tabs break; } + } } TabitemValue tiValue; @@ -994,15 +1025,37 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo SetFont( aFont ); Size aTabSize = aRect.GetSize(); + Size aImageSize( 0, 0 ); long nTextHeight = GetTextHeight(); long nTextWidth = GetCtrlTextWidth( pItem->maFormatText ); - DrawCtrlText( Point( aRect.Left()+((aTabSize.Width()-nTextWidth)/2)-nOff-nOff3, - aRect.Top()+((aTabSize.Height()-nTextHeight)/2)-nOff3 ), - pItem->maFormatText, - 0, STRING_LEN, TEXT_DRAW_MNEMONIC, - bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL, - bLayout ? &mpLayoutData->m_aDisplayText : NULL - ); + if( !! pItem->maTabImage ) + { + aImageSize = pItem->maTabImage.GetSizePixel(); + if( pItem->maFormatText.Len() ) + aImageSize.Width() += GetTextHeight()/4; + } + long nXPos = aRect.Left()+((aTabSize.Width()-nTextWidth-aImageSize.Width())/2)-nOff-nOff3; + long nYPos = aRect.Top()+((aTabSize.Height()-nTextHeight)/2)-nOff3; + if( pItem->maFormatText.Len() ) + { + USHORT nStyle = TEXT_DRAW_MNEMONIC; + if( ! pItem->mbEnabled ) + nStyle |= TEXT_DRAW_DISABLE; + DrawCtrlText( Point( nXPos + aImageSize.Width(), nYPos ), + pItem->maFormatText, + 0, STRING_LEN, nStyle, + bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL, + bLayout ? &mpLayoutData->m_aDisplayText : NULL + ); + } + + if( !! pItem->maTabImage ) + { + Point aImgTL( nXPos, aRect.Top() ); + if( aImageSize.Height() < aRect.GetHeight() ) + aImgTL.Y() += (aRect.GetHeight() - aImageSize.Height())/2; + DrawImage( aImgTL, pItem->maTabImage, pItem->mbEnabled ? 0 : IMAGE_DRAW_DISABLE ); + } } // ----------------------------------------------------------------------- @@ -1018,7 +1071,14 @@ IMPL_LINK( TabControl, ImplScrollBtnHdl, PushButton*, EMPTYARG ) void TabControl::MouseButtonDown( const MouseEvent& rMEvt ) { if ( rMEvt.IsLeft() ) - SelectTabPage( GetPageId( rMEvt.GetPosPixel() ) ); + { + USHORT nPageId = GetPageId( rMEvt.GetPosPixel() ); + ImplTabItem* pItem = ImplGetItem( nPageId ); + if( pItem && pItem->mbEnabled ) + SelectTabPage( nPageId ); + else + Sound::Beep( SOUND_ERROR, this ); + } } // ----------------------------------------------------------------------- @@ -1059,17 +1119,14 @@ void TabControl::ImplPaint( const Rectangle& rRect, bool bLayout ) // find current item ImplTabItem* pCurItem = NULL; - ImplTabItem* pItem = mpItemList->First(); - pItem = mpItemList->First(); - while ( pItem ) + for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin(); + it != mpTabCtrlData->maItemList.end(); ++it ) { - if ( pItem->mnId == mnCurPageId ) + if ( it->mnId == mnCurPageId ) { - pCurItem = pItem; + pCurItem = &(*it); break; } - - pItem = mpItemList->Next(); } // Draw the TabPage border @@ -1178,25 +1235,26 @@ void TabControl::ImplPaint( const Rectangle& rRect, bool bLayout ) bool bDrawTabsRTL = IsNativeControlSupported( CTRL_TAB_ITEM, PART_TABS_DRAW_RTL ); ImplTabItem * pFirstTab = NULL; ImplTabItem * pLastTab = NULL; - unsigned idx; + size_t idx; // Event though there is a tab overlap with GTK+, the first tab is not // overlapped on the left side. Other tookits ignore this option. if ( bDrawTabsRTL ) { - pFirstTab = mpItemList->First(); - pLastTab = mpItemList->Last(); - idx = mpItemList->Count()-1; + pFirstTab = &mpTabCtrlData->maItemList.front(); + pLastTab = &mpTabCtrlData->maItemList.back(); + idx = mpTabCtrlData->maItemList.size()-1; } else { - pLastTab = mpItemList->Last(); - pFirstTab = mpItemList->First(); + pLastTab = &mpTabCtrlData->maItemList.back(); + pFirstTab = &mpTabCtrlData->maItemList.front(); idx = 0; } - while ( (pItem = mpItemList->GetObject(idx)) != NULL ) + while ( idx < mpTabCtrlData->maItemList.size() ) { + ImplTabItem* pItem = &mpTabCtrlData->maItemList[idx]; if ( pItem != pCurItem ) { Region aClipRgn( GetActiveClipRegion() ); @@ -1250,18 +1308,15 @@ void TabControl::Resize() mbSmallInvalidate = FALSE; else { - ImplTabItem* pItem; - pItem = mpItemList->First(); - while ( pItem ) + for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin(); + it != mpTabCtrlData->maItemList.end(); ++it ) { - if ( !pItem->mbFullVisible || - (pItem->maRect.Right()-2 >= nNewWidth) ) + if ( !it->mbFullVisible || + (it->maRect.Right()-2 >= nNewWidth) ) { mbSmallInvalidate = FALSE; break; } - - pItem = mpItemList->Next(); } } @@ -1341,7 +1396,7 @@ void TabControl::RequestHelp( const HelpEvent& rHEvt ) } } - // Bei Quick- oder Ballloon-Help zeigen wir den Text an, + // Bei Quick- oder Balloon-Help zeigen wir den Text an, // wenn dieser abgeschnitten ist if ( rHEvt.GetMode() & (HELPMODE_QUICK | HELPMODE_BALLOON) ) { @@ -1366,6 +1421,25 @@ void TabControl::RequestHelp( const HelpEvent& rHEvt ) } } } + + if ( rHEvt.GetMode() & HELPMODE_QUICK ) + { + ImplTabItem* pItem = ImplGetItem( nItemId ); + const XubString& rHelpText = pItem->maHelpText; + // show tooltip if not text but image is set and helptext is available + if ( rHelpText.Len() > 0 && pItem->maText.Len() == 0 && !!pItem->maTabImage ) + { + Rectangle aItemRect = ImplGetTabRect( GetPagePos( nItemId ) ); + Point aPt = OutputToScreenPixel( aItemRect.TopLeft() ); + aItemRect.Left() = aPt.X(); + aItemRect.Top() = aPt.Y(); + aPt = OutputToScreenPixel( aItemRect.BottomRight() ); + aItemRect.Right() = aPt.X(); + aItemRect.Bottom() = aPt.Y(); + Help::ShowQuickHelp( this, aItemRect, rHelpText ); + return; + } + } } Control::RequestHelp( rHEvt ); @@ -1393,14 +1467,13 @@ void TabControl::Command( const CommandEvent& rCEvt ) if ( bMenu ) { PopupMenu aMenu; - ImplTabItem* pItem = mpItemList->First(); - while ( pItem ) + for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin(); + it != mpTabCtrlData->maItemList.end(); ++it ) { - aMenu.InsertItem( pItem->mnId, pItem->maText, MIB_CHECKABLE | MIB_RADIOCHECK ); - if ( pItem->mnId == mnCurPageId ) - aMenu.CheckItem( pItem->mnId ); - aMenu.SetHelpId( pItem->mnId, pItem->mnHelpId ); - pItem = mpItemList->Next(); + aMenu.InsertItem( it->mnId, it->maText, MIB_CHECKABLE | MIB_RADIOCHECK ); + if ( it->mnId == mnCurPageId ) + aMenu.CheckItem( it->mnId ); + aMenu.SetHelpId( it->mnId, it->mnHelpId ); } USHORT nId = aMenu.Execute( this, aMenuPos ); @@ -1464,18 +1537,17 @@ void TabControl::DataChanged( const DataChangedEvent& rDCEvt ) Rectangle* TabControl::ImplFindPartRect( const Point& rPt ) { - ImplTabItem* pItem = mpItemList->First(); ImplTabItem* pFoundItem = NULL; int nFound = 0; - while ( pItem ) + for( std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin(); + it != mpTabCtrlData->maItemList.end(); ++it ) { - if ( pItem->maRect.IsInside( rPt ) ) + if ( it->maRect.IsInside( rPt ) ) { // assure that only one tab is highlighted at a time nFound++; - pFoundItem = pItem; + pFoundItem = &(*it); } - pItem = mpItemList->Next(); } // assure that only one tab is highlighted at a time return nFound == 1 ? &pFoundItem->maRect : NULL; @@ -1625,8 +1697,8 @@ void TabControl::InsertPage( const ResId& rResId, USHORT nPos ) // PageResID if ( nObjMask & RSC_TABCONTROLITEM_PAGERESID ) { - ImplTabItem* pItem = mpItemList->GetObject( GetPagePos( nItemId ) ); - pItem->mnTabPageResId = sal::static_int_cast<USHORT>(ReadLongRes()); + ImplTabItem& rItem = mpTabCtrlData->maItemList[ GetPagePos( nItemId ) ]; + rItem.mnTabPageResId = sal::static_int_cast<USHORT>(ReadLongRes()); } } @@ -1639,12 +1711,25 @@ void TabControl::InsertPage( USHORT nPageId, const XubString& rText, DBG_ASSERT( GetPagePos( nPageId ) == TAB_PAGE_NOTFOUND, "TabControl::InsertPage(): PageId already exists" ); - // CurPageId gegebenenfalls setzen + // set current page id if ( !mnCurPageId ) mnCurPageId = nPageId; - // PageItem anlegen - ImplTabItem* pItem = new ImplTabItem; + // insert new page item + ImplTabItem* pItem = NULL; + if( nPos == TAB_APPEND || size_t(nPos) >= mpTabCtrlData->maItemList.size() ) + { + mpTabCtrlData->maItemList.push_back( ImplTabItem() ); + pItem = &mpTabCtrlData->maItemList.back(); + } + else + { + std::vector< ImplTabItem >::iterator new_it = + mpTabCtrlData->maItemList.insert( mpTabCtrlData->maItemList.begin() + nPos, ImplTabItem() ); + pItem = &(*new_it); + } + + // init new page item pItem->mnId = nPageId; pItem->mpTabPage = NULL; pItem->mnTabPageResId = 0; @@ -1652,9 +1737,6 @@ void TabControl::InsertPage( USHORT nPageId, const XubString& rText, pItem->maText = rText; pItem->mbFullVisible = FALSE; - // In die StarView-Liste eintragen - mpItemList->Insert( pItem, nPos ); - mbFormat = TRUE; if ( IsUpdateMode() ) Invalidate(); @@ -1670,30 +1752,32 @@ void TabControl::RemovePage( USHORT nPageId ) { USHORT nPos = GetPagePos( nPageId ); - // Existiert Item + // does the item exist ? if ( nPos != TAB_PAGE_NOTFOUND ) { - // Item-Daten loeschen und Windows-Item entfernen - ImplTabItem* pItem = mpItemList->Remove( nPos ); + //remove page item + std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin() + nPos; + bool bIsCurrentPage = (it->mnId == mnCurPageId); + mpTabCtrlData->maItemList.erase( it ); + // If current page is removed, than first page gets the current page - if ( pItem->mnId == mnCurPageId ) + if ( bIsCurrentPage ) { mnCurPageId = 0; - // don't do this by simply setting mnCurPageId to pFirstItem->mnId - // this leaves a lot of stuff (such trivias as _showing_ the new current page) undone - // instead, call SetCurPageId - // without this, the next (outside) call to SetCurPageId with the id of the first page - // will result in doing nothing (as we assume that nothing changed, then), and the page - // will never be shown. - // 86875 - 05/11/2001 - frank.schoenheit@germany.sun.com - - ImplTabItem* pFirstItem = mpItemList->GetObject( 0 ); - if ( pFirstItem ) - SetCurPageId( pFirstItem->mnId ); - + if( ! mpTabCtrlData->maItemList.empty() ) + { + // don't do this by simply setting mnCurPageId to pFirstItem->mnId + // this leaves a lot of stuff (such trivias as _showing_ the new current page) undone + // instead, call SetCurPageId + // without this, the next (outside) call to SetCurPageId with the id of the first page + // will result in doing nothing (as we assume that nothing changed, then), and the page + // will never be shown. + // 86875 - 05/11/2001 - frank.schoenheit@germany.sun.com + + SetCurPageId( mpTabCtrlData->maItemList[0].mnId ); + } } - delete pItem; mbFormat = TRUE; if ( IsUpdateMode() ) @@ -1709,17 +1793,8 @@ void TabControl::RemovePage( USHORT nPageId ) void TabControl::Clear() { - // Alle Items loeschen - ImplTabItem* pItem = mpItemList->First(); - while ( pItem ) - { - // Item-Daten loeschen - delete pItem; - pItem = mpItemList->Next(); - } - - // Items aus der Liste loeschen - mpItemList->Clear(); + // clear item list + mpTabCtrlData->maItemList.clear(); mnCurPageId = 0; ImplFreeLayoutData(); @@ -1733,33 +1808,49 @@ void TabControl::Clear() // ----------------------------------------------------------------------- +void TabControl::EnablePage( USHORT i_nPageId, bool i_bEnable ) +{ + ImplTabItem* pItem = ImplGetItem( i_nPageId ); + + if ( pItem && pItem->mbEnabled != i_bEnable ) + { + pItem->mbEnabled = i_bEnable; + mbFormat = TRUE; + if( pItem->mnId == mnCurPageId ) + { + // SetCurPageId will change to an enabled page + SetCurPageId( mnCurPageId ); + } + else if ( IsUpdateMode() ) + Invalidate(); + } +} + +// ----------------------------------------------------------------------- + USHORT TabControl::GetPageCount() const { - return (USHORT)mpItemList->Count(); + return (USHORT)mpTabCtrlData->maItemList.size(); } // ----------------------------------------------------------------------- USHORT TabControl::GetPageId( USHORT nPos ) const { - ImplTabItem* pItem = mpItemList->GetObject( nPos ); - if ( pItem ) - return pItem->mnId; - else - return 0; + if( size_t(nPos) < mpTabCtrlData->maItemList.size() ) + return mpTabCtrlData->maItemList[ nPos ].mnId; + return 0; } // ----------------------------------------------------------------------- USHORT TabControl::GetPagePos( USHORT nPageId ) const { - ImplTabItem* pItem = mpItemList->First(); - while ( pItem ) + for( std::vector< ImplTabItem >::const_iterator it = mpTabCtrlData->maItemList.begin(); + it != mpTabCtrlData->maItemList.end(); ++it ) { - if ( pItem->mnId == nPageId ) - return (USHORT)mpItemList->GetCurPos(); - - pItem = mpItemList->Next(); + if ( it->mnId == nPageId ) + return (USHORT)(it - mpTabCtrlData->maItemList.begin()); } return TAB_PAGE_NOTFOUND; @@ -1769,12 +1860,10 @@ USHORT TabControl::GetPagePos( USHORT nPageId ) const USHORT TabControl::GetPageId( const Point& rPos ) const { - USHORT i = 0; - while ( i < mpItemList->Count() ) + for( size_t i = 0; i < mpTabCtrlData->maItemList.size(); ++i ) { - if ( ((TabControl*)this)->ImplGetTabRect( i ).IsInside( rPos ) ) - return mpItemList->GetObject( i )->mnId; - i++; + if ( ((TabControl*)this)->ImplGetTabRect( static_cast<USHORT>(i) ).IsInside( rPos ) ) + return mpTabCtrlData->maItemList[ i ].mnId; } return 0; @@ -1784,16 +1873,27 @@ USHORT TabControl::GetPageId( const Point& rPos ) const void TabControl::SetCurPageId( USHORT nPageId ) { - if ( nPageId == mnCurPageId ) + USHORT nPos = GetPagePos( nPageId ); + while( nPos != TAB_PAGE_NOTFOUND && + ! mpTabCtrlData->maItemList[nPos].mbEnabled ) { - if ( mnActPageId ) - mnActPageId = nPageId; - return; + nPos++; + if( size_t(nPos) >= mpTabCtrlData->maItemList.size() ) + nPos = 0; + if( mpTabCtrlData->maItemList[nPos].mnId == nPageId ) + break; } - ImplTabItem* pItem = ImplGetItem( nPageId ); - if ( pItem ) + if( nPos != TAB_PAGE_NOTFOUND ) { + nPageId = mpTabCtrlData->maItemList[nPos].mnId; + if ( nPageId == mnCurPageId ) + { + if ( mnActPageId ) + mnActPageId = nPageId; + return; + } + if ( mnActPageId ) mnActPageId = nPageId; else @@ -1978,6 +2078,29 @@ ULONG TabControl::GetHelpId( USHORT nPageId ) const // ----------------------------------------------------------------------- +void TabControl::SetPageImage( USHORT i_nPageId, const Image& i_rImage ) +{ + ImplTabItem* pItem = ImplGetItem( i_nPageId ); + + if ( pItem ) + { + pItem->maTabImage = i_rImage; + mbFormat = TRUE; + if ( IsUpdateMode() ) + Invalidate(); + } +} + +// ----------------------------------------------------------------------- + +const Image* TabControl::GetPageImage( USHORT i_nPageId ) const +{ + const ImplTabItem* pItem = ImplGetItem( i_nPageId ); + return pItem ? &pItem->maTabImage : NULL; +} + +// ----------------------------------------------------------------------- + Rectangle TabControl::GetCharacterBounds( USHORT nPageId, long nIndex ) const { Rectangle aRet; diff --git a/vcl/source/gdi/bitmap2.cxx b/vcl/source/gdi/bitmap2.cxx index de9da1fb638f..39aa9da8c470 100644 --- a/vcl/source/gdi/bitmap2.cxx +++ b/vcl/source/gdi/bitmap2.cxx @@ -756,18 +756,18 @@ BOOL Bitmap::ImplWriteDIB( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bCompre // MapMode is integer-based, and suffers from roundoffs, // especially if maPrefSize is small. Trying to circumvent // that by performing part of the math in floating point. - const Size aScale10000( + const Size aScale100000( OutputDevice::LogicToLogic( Size(100000L, 100000L), - maPrefMapMode, - MAP_100TH_MM ) ); - const double fScaleX((double)aScale10000.Width() * maPrefSize.Width()); - const double fScaleY((double)aScale10000.Height() * maPrefSize.Height()); - if( fabs(fScaleX) > 0.000000001 && - fabs(fScaleY) > 0.000000001 ) + MAP_100TH_MM, + maPrefMapMode ) ); + const double fBmpWidthM((double)maPrefSize.Width() / aScale100000.Width() ); + const double fBmpHeightM((double)maPrefSize.Height() / aScale100000.Height() ); + if( fabs(fBmpWidthM) > 0.000000001 && + fabs(fBmpHeightM) > 0.000000001 ) { - aHeader.nXPelsPerMeter = (UINT32)(rAcc.Width() / fScaleX + .5); - aHeader.nYPelsPerMeter = (UINT32)(rAcc.Height() / fScaleY + .5); + aHeader.nXPelsPerMeter = (UINT32)(rAcc.Width() / fBmpWidthM + .5); + aHeader.nYPelsPerMeter = (UINT32)(rAcc.Height() / fBmpHeightM + .5); } } diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx index 550477bbfc6e..5a65aac25d99 100644 --- a/vcl/source/gdi/bitmap3.cxx +++ b/vcl/source/gdi/bitmap3.cxx @@ -516,7 +516,7 @@ BOOL Bitmap::ImplMakeMonoDither() BOOL Bitmap::ImplMakeGreyscales( USHORT nGreys ) { - DBG_ASSERT( nGreys == 16 || nGreys == 256, "Only 16 or 256 greyscales are supported!" ) + DBG_ASSERT( nGreys == 16 || nGreys == 256, "Only 16 or 256 greyscales are supported!" ); BitmapReadAccess* pReadAcc = AcquireReadAccess(); BOOL bRet = FALSE; diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index fce0a042a12f..14c211e4e045 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: cvtsvm.cxx,v $ - * $Revision: 1.16 $ + * $Revision: 1.16.134.1 $ * * This file is part of OpenOffice.org. * @@ -408,9 +408,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); char aCode[ 5 ]; - MapMode aMapMode; Size aPrefSz; - INT32 nActions; INT16 nSize; INT16 nVersion; @@ -420,11 +418,11 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) rIStm >> nVersion; // Version rIStm >> aPrefSz.Width(); // PrefSize.Width() rIStm >> aPrefSz.Height(); // PrefSize.Height() - ImplReadMapMode( rIStm, aMapMode ); // MapMode - rIStm >> nActions; // Action count // Header-Kennung und Versionsnummer pruefen - if( ( memcmp( aCode, "SVGDI", sizeof( aCode ) ) != 0 ) || ( nVersion != 200 ) ) + if( rIStm.GetError() + || ( memcmp( aCode, "SVGDI", sizeof( aCode ) ) != 0 ) + || ( nVersion != 200 ) ) { rIStm.SetError( SVSTREAM_FILEFORMAT_ERROR ); rIStm.SetNumberFormatInt( nOldFormat ); @@ -432,17 +430,22 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) } else { + MapMode aMapMode; Polygon aActionPoly; Rectangle aRect; Point aPt, aPt1; Size aSz; Color aActionColor; INT32 nTmp, nTmp1, nActionSize; + INT32 nActions; INT16 nType; sal_uInt32 nUnicodeCommentStreamPos = 0; INT32 nUnicodeCommentActionNumber = 0; + ImplReadMapMode( rIStm, aMapMode ); // MapMode + rIStm >> nActions; // Action count + rMtf.SetPrefSize( aPrefSz ); rMtf.SetPrefMapMode( aMapMode ); @@ -1084,7 +1087,8 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) ImplSkipActions( rIStm, nFollowingActionCount ); rMtf.AddAction( new MetaTextLineAction( aStartPt, nWidth, (FontStrikeout) nStrikeout, - (FontUnderline) nUnderline ) ); + (FontUnderline) nUnderline, + UNDERLINE_NONE ) ); #ifdef CVTSVM_WRITE_SUBACTIONCOUNT i += nFollowingActionCount; @@ -2059,6 +2063,11 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, } break; +#if 0 + case( META_OVERLINECOLOR_ACTION ): + break; +#endif + case( META_TEXTLINE_ACTION ): { const MetaTextLineAction* pA = (MetaTextLineAction*) pAction; diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx index 33eadd075aa3..5c228072eb65 100644 --- a/vcl/source/gdi/font.cxx +++ b/vcl/source/gdi/font.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: font.cxx,v $ - * $Revision: 1.19 $ + * $Revision: 1.19.134.1 $ * * This file is part of OpenOffice.org. * @@ -64,6 +64,7 @@ Impl_Font::Impl_Font() : meWidthType = WIDTH_DONTKNOW; meItalic = ITALIC_NONE; meUnderline = UNDERLINE_NONE; + meOverline = UNDERLINE_NONE; meStrikeout = STRIKEOUT_NONE; meRelief = RELIEF_NONE; meEmphasisMark = EMPHASISMARK_NONE; @@ -97,6 +98,7 @@ Impl_Font::Impl_Font( const Impl_Font& rImplFont ) meWidthType = rImplFont.meWidthType; meItalic = rImplFont.meItalic; meUnderline = rImplFont.meUnderline; + meOverline = rImplFont.meOverline; meStrikeout = rImplFont.meStrikeout; meRelief = rImplFont.meRelief; meEmphasisMark = rImplFont.meEmphasisMark; @@ -141,6 +143,7 @@ bool Impl_Font::operator==( const Impl_Font& rOther ) const return false; if( (meUnderline != rOther.meUnderline) + || (meOverline != rOther.meOverline) || (meStrikeout != rOther.meStrikeout) || (meRelief != rOther.meRelief) || (meEmphasisMark != rOther.meEmphasisMark) @@ -593,6 +596,19 @@ void Font::SetUnderline( FontUnderline eUnderline ) // ----------------------------------------------------------------------- +void Font::SetOverline( FontUnderline eOverline ) +{ + DBG_CHKTHIS( Font, NULL ); + + if( mpImplFont->meOverline != eOverline ) + { + MakeUnique(); + mpImplFont->meOverline = eOverline; + } +} + +// ----------------------------------------------------------------------- + void Font::SetStrikeout( FontStrikeout eStrikeout ) { DBG_CHKTHIS( Font, NULL ); @@ -718,6 +734,11 @@ void Font::Merge( const Font& rFont ) SetUnderline( rFont.GetUnderline() ); SetWordLineMode( rFont.IsWordLineMode() ); } + if ( rFont.GetOverline() != UNDERLINE_DONTKNOW ) + { + SetOverline( rFont.GetOverline() ); + SetWordLineMode( rFont.IsWordLineMode() ); + } if ( rFont.GetStrikeout() != STRIKEOUT_DONTKNOW ) { SetStrikeout( rFont.GetStrikeout() ); @@ -785,6 +806,10 @@ SvStream& operator>>( SvStream& rIStm, Impl_Font& rImpl_Font ) rIStm >> bTmp; rImpl_Font.mbVertical = bTmp; rIStm >> nTmp16; rImpl_Font.meEmphasisMark = (FontEmphasisMark)nTmp16; } + if( aCompat.GetVersion() >= 3 ) + { + rIStm >> nTmp16; rImpl_Font.meOverline = (FontUnderline) nTmp16; + } // Relief // CJKContextLanguage @@ -795,7 +820,7 @@ SvStream& operator>>( SvStream& rIStm, Impl_Font& rImpl_Font ) SvStream& operator<<( SvStream& rOStm, const Impl_Font& rImpl_Font ) { - VersionCompat aCompat( rOStm, STREAM_WRITE, 2 ); + VersionCompat aCompat( rOStm, STREAM_WRITE, 3 ); rOStm.WriteByteString( rImpl_Font.maFamilyName, rOStm.GetStreamCharSet() ); rOStm.WriteByteString( rImpl_Font.maStyleName, rOStm.GetStreamCharSet() ); rOStm << rImpl_Font.maSize; @@ -823,6 +848,9 @@ SvStream& operator<<( SvStream& rOStm, const Impl_Font& rImpl_Font ) rOStm << (BOOL) rImpl_Font.mbVertical; rOStm << (UINT16) rImpl_Font.meEmphasisMark; + // new in version 3 + rOStm << (UINT16) rImpl_Font.meOverline; + return rOStm; } @@ -1082,8 +1110,8 @@ BOOL Font::IsOutline() const { return mpImplFont->mbOutline; } BOOL Font::IsShadow() const { return mpImplFont->mbShadow; } FontRelief Font::GetRelief() const { return mpImplFont->meRelief; } FontUnderline Font::GetUnderline() const { return mpImplFont->meUnderline; } +FontUnderline Font::GetOverline() const { return mpImplFont->meOverline; } FontStrikeout Font::GetStrikeout() const { return mpImplFont->meStrikeout; } FontEmphasisMark Font::GetEmphasisMark() const { return mpImplFont->meEmphasisMark; } BOOL Font::IsWordLineMode() const { return mpImplFont->mbWordLine; } BOOL Font::IsSameInstance( const Font& rFont ) const { return (mpImplFont == rFont.mpImplFont); } - diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 3c68eab59bf1..3a29e6d56095 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: gdimtf.cxx,v $ - * $Revision: 1.24 $ + * $Revision: 1.24.134.1 $ * * This file is part of OpenOffice.org. * @@ -759,6 +759,8 @@ BOOL GDIMetaFile::SaveStatus() pOutDev->IsTextFillColor() ) ); AddAction( new MetaTextLineColorAction( pOutDev->GetTextLineColor(), pOutDev->IsTextLineColor() ) ); + AddAction( new MetaOverlineColorAction( pOutDev->GetOverlineColor(), + pOutDev->IsOverlineColor() ) ); AddAction( new MetaTextAlignAction( pOutDev->GetTextAlign() ) ); AddAction( new MetaRasterOpAction( pOutDev->GetRasterOp() ) ); AddAction( new MetaMapModeAction( pOutDev->GetMapMode() ) ); @@ -1097,7 +1099,7 @@ void GDIMetaFile::Rotate( long nAngle10 ) { MetaTextLineAction* pAct = (MetaTextLineAction*) pAction; aMtf.AddAction( new MetaTextLineAction( ImplGetRotatedPoint( pAct->GetStartPoint(), aRotAnchor, aRotOffset, fSin, fCos ), - pAct->GetWidth(), pAct->GetStrikeout(), pAct->GetUnderline() ) ); + pAct->GetWidth(), pAct->GetStrikeout(), pAct->GetUnderline(), pAct->GetOverline() ) ); } break; @@ -1591,6 +1593,19 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol } break; + case( META_OVERLINECOLOR_ACTION ): + { + MetaOverlineColorAction* pAct = (MetaOverlineColorAction*) pAction; + + if( !pAct->IsSetting() ) + pAct->Duplicate(); + else + pAct = new MetaOverlineColorAction( pFncCol( pAct->GetColor(), pColParam ), TRUE ); + + aMtf.Insert( pAct, LIST_APPEND ); + } + break; + case( META_FONT_ACTION ): { MetaFontAction* pAct = (MetaFontAction*) pAction; diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx index 750599ef2aaa..a5a9886bd7a3 100644 --- a/vcl/source/gdi/image.cxx +++ b/vcl/source/gdi/image.cxx @@ -93,32 +93,29 @@ Image::Image( const ResId& rResId ) : pResMgr->Increment( pResMgr->GetObjSize( (RSHEADER_TYPE*)pResMgr->GetClass() ) ); } - if( !aBmpEx.IsEmpty() ) + if( nObjMask & RSC_IMAGE_MASKBITMAP ) { - if( nObjMask & RSC_IMAGE_MASKBITMAP ) + if( !aBmpEx.IsEmpty() && aBmpEx.GetTransparentType() == TRANSPARENT_NONE ) { - if( aBmpEx.GetTransparentType() == TRANSPARENT_NONE ) - { - const Bitmap aMaskBitmap( ResId( (RSHEADER_TYPE*)pResMgr->GetClass(), *pResMgr ) ); - aBmpEx = BitmapEx( aBmpEx.GetBitmap(), aMaskBitmap ); - } - - pResMgr->Increment( pResMgr->GetObjSize( (RSHEADER_TYPE*)pResMgr->GetClass() ) ); + const Bitmap aMaskBitmap( ResId( (RSHEADER_TYPE*)pResMgr->GetClass(), *pResMgr ) ); + aBmpEx = BitmapEx( aBmpEx.GetBitmap(), aMaskBitmap ); } - if( nObjMask & RSC_IMAGE_MASKCOLOR ) - { - if( aBmpEx.GetTransparentType() == TRANSPARENT_NONE ) - { - const Color aMaskColor( ResId( (RSHEADER_TYPE*)pResMgr->GetClass(), *pResMgr ) ); - aBmpEx = BitmapEx( aBmpEx.GetBitmap(), aMaskColor ); - } + pResMgr->Increment( pResMgr->GetObjSize( (RSHEADER_TYPE*)pResMgr->GetClass() ) ); + } - pResMgr->Increment( pResMgr->GetObjSize( (RSHEADER_TYPE*)pResMgr->GetClass() ) ); + if( nObjMask & RSC_IMAGE_MASKCOLOR ) + { + if( !aBmpEx.IsEmpty() && aBmpEx.GetTransparentType() == TRANSPARENT_NONE ) + { + const Color aMaskColor( ResId( (RSHEADER_TYPE*)pResMgr->GetClass(), *pResMgr ) ); + aBmpEx = BitmapEx( aBmpEx.GetBitmap(), aMaskColor ); } - ImplInit( aBmpEx ); + pResMgr->Increment( pResMgr->GetObjSize( (RSHEADER_TYPE*)pResMgr->GetClass() ) ); } + if( ! aBmpEx.IsEmpty() ) + ImplInit( aBmpEx ); } } diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 8525d17ea041..a67d6fa7feac 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -1504,92 +1504,99 @@ SvStream& operator>>( SvStream& rIStm, ImpGraphic& rImpGraphic ) // read Id rIStm >> nTmp; - if( NATIVE_FORMAT_50 == nTmp ) + // if there is no more data, avoid further expensive + // reading which will create VDevs and other stuff, just to + // read nothing. CAUTION: Eof is only true AFTER reading another + // byte, a speciality of SvMemoryStream (!) + if(!rIStm.GetError() && !rIStm.IsEof()) { - Graphic aGraphic; - GfxLink aLink; - VersionCompat* pCompat; + if( NATIVE_FORMAT_50 == nTmp ) + { + Graphic aGraphic; + GfxLink aLink; + VersionCompat* pCompat; - // read compat info - pCompat = new VersionCompat( rIStm, STREAM_READ ); - delete pCompat; + // read compat info + pCompat = new VersionCompat( rIStm, STREAM_READ ); + delete pCompat; - rIStm >> aLink; + rIStm >> aLink; - // set dummy link to avoid creation of additional link after filtering; - // we set a default link to avoid unnecessary swapping of native data - aGraphic.SetLink( GfxLink() ); + // set dummy link to avoid creation of additional link after filtering; + // we set a default link to avoid unnecessary swapping of native data + aGraphic.SetLink( GfxLink() ); - if( !rIStm.GetError() && aLink.LoadNative( aGraphic ) ) - { - // set link only, if no other link was set - const BOOL bSetLink = ( rImpGraphic.mpGfxLink == NULL ); + if( !rIStm.GetError() && aLink.LoadNative( aGraphic ) ) + { + // set link only, if no other link was set + const BOOL bSetLink = ( rImpGraphic.mpGfxLink == NULL ); - // assign graphic - rImpGraphic = *aGraphic.ImplGetImpGraphic(); + // assign graphic + rImpGraphic = *aGraphic.ImplGetImpGraphic(); - if( aLink.IsPrefMapModeValid() ) - rImpGraphic.ImplSetPrefMapMode( aLink.GetPrefMapMode() ); + if( aLink.IsPrefMapModeValid() ) + rImpGraphic.ImplSetPrefMapMode( aLink.GetPrefMapMode() ); - if( aLink.IsPrefSizeValid() ) - rImpGraphic.ImplSetPrefSize( aLink.GetPrefSize() ); + if( aLink.IsPrefSizeValid() ) + rImpGraphic.ImplSetPrefSize( aLink.GetPrefSize() ); - if( bSetLink ) - rImpGraphic.ImplSetLink( aLink ); + if( bSetLink ) + rImpGraphic.ImplSetLink( aLink ); + } + else + { + rIStm.Seek( nStmPos1 ); + rIStm.SetError( ERRCODE_IO_WRONGFORMAT ); + } } else { - rIStm.Seek( nStmPos1 ); - rIStm.SetError( ERRCODE_IO_WRONGFORMAT ); - } - } - else - { - BitmapEx aBmpEx; - const USHORT nOldFormat = rIStm.GetNumberFormatInt(); + BitmapEx aBmpEx; + const USHORT nOldFormat = rIStm.GetNumberFormatInt(); - rIStm.SeekRel( -4 ); - rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - rIStm >> aBmpEx; + rIStm.SeekRel( -4 ); + rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); + rIStm >> aBmpEx; - if( !rIStm.GetError() ) - { - UINT32 nMagic1(0), nMagic2(0); - ULONG nActPos = rIStm.Tell(); + if( !rIStm.GetError() ) + { + UINT32 nMagic1(0), nMagic2(0); + ULONG nActPos = rIStm.Tell(); - rIStm >> nMagic1 >> nMagic2; - rIStm.Seek( nActPos ); + rIStm >> nMagic1 >> nMagic2; + rIStm.Seek( nActPos ); - rImpGraphic = ImpGraphic( aBmpEx ); + rImpGraphic = ImpGraphic( aBmpEx ); - if( !rIStm.GetError() && ( 0x5344414e == nMagic1 ) && ( 0x494d4931 == nMagic2 ) ) - { - delete rImpGraphic.mpAnimation; - rImpGraphic.mpAnimation = new Animation; - rIStm >> *rImpGraphic.mpAnimation; + if( !rIStm.GetError() && ( 0x5344414e == nMagic1 ) && ( 0x494d4931 == nMagic2 ) ) + { + delete rImpGraphic.mpAnimation; + rImpGraphic.mpAnimation = new Animation; + rIStm >> *rImpGraphic.mpAnimation; - // #108077# manually set loaded BmpEx to Animation - // (which skips loading its BmpEx if already done) - rImpGraphic.mpAnimation->SetBitmapEx(aBmpEx); + // #108077# manually set loaded BmpEx to Animation + // (which skips loading its BmpEx if already done) + rImpGraphic.mpAnimation->SetBitmapEx(aBmpEx); + } + else + rIStm.ResetError(); } else + { + GDIMetaFile aMtf; + + rIStm.Seek( nStmPos1 ); rIStm.ResetError(); - } - else - { - GDIMetaFile aMtf; + rIStm >> aMtf; - rIStm.Seek( nStmPos1 ); - rIStm.ResetError(); - rIStm >> aMtf; + if( !rIStm.GetError() ) + rImpGraphic = aMtf; + else + rIStm.Seek( nStmPos1 ); + } - if( !rIStm.GetError() ) - rImpGraphic = aMtf; - else - rIStm.Seek( nStmPos1 ); + rIStm.SetNumberFormatInt( nOldFormat ); } - - rIStm.SetNumberFormatInt( nOldFormat ); } } diff --git a/vcl/source/gdi/impprn.cxx b/vcl/source/gdi/impprn.cxx index 01100c209aac..28d92a0b3832 100644 --- a/vcl/source/gdi/impprn.cxx +++ b/vcl/source/gdi/impprn.cxx @@ -577,7 +577,11 @@ void ImplQPrinter::AddQueuePage( GDIMetaFile* pPage, USHORT nPage, BOOL bNewJobS pQueuePage->mpMtf = pPage; pQueuePage->mnPage = nPage; pQueuePage->mbEndJob = FALSE; - if ( bNewJobSetup ) + // ensure that the first page has a valid setup, this is needed + // in GetPaperRanges (used in pullmodel) + // caution: this depends on mnCurPage in Printer being + // 0: not printing 1: after StartJob, 2 after first EndPage, 3+ at following EndPage calls + if ( bNewJobSetup || (nPage == 2 && ImplGetSVData()->maGDIData.mbPrinterPullModel) ) pQueuePage->mpSetup = new JobSetup( mpParent->GetJobSetup() ); maQueue.push_back( pQueuePage ); } diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 4b90699eed3d..4fe9a41be797 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: metaact.cxx,v $ - * $Revision: 1.21 $ + * $Revision: 1.21.134.1 $ * * This file is part of OpenOffice.org. * @@ -231,6 +231,7 @@ MetaAction* MetaAction::ReadMetaAction( SvStream& rIStm, ImplMetaReadData* pData case( META_TEXTCOLOR_ACTION ): pAction = new MetaTextColorAction; break; case( META_TEXTFILLCOLOR_ACTION ): pAction = new MetaTextFillColorAction; break; case( META_TEXTLINECOLOR_ACTION ): pAction = new MetaTextLineColorAction; break; + case( META_OVERLINECOLOR_ACTION ): pAction = new MetaOverlineColorAction; break; case( META_TEXTALIGN_ACTION ): pAction = new MetaTextAlignAction; break; case( META_MAPMODE_ACTION ): pAction = new MetaMapModeAction; break; case( META_FONT_ACTION ): pAction = new MetaFontAction; break; @@ -1677,12 +1678,14 @@ IMPL_META_ACTION( TextLine, META_TEXTLINE_ACTION ) MetaTextLineAction::MetaTextLineAction( const Point& rPos, long nWidth, FontStrikeout eStrikeout, - FontUnderline eUnderline ) : + FontUnderline eUnderline, + FontUnderline eOverline ) : MetaAction ( META_TEXTLINE_ACTION ), maPos ( rPos ), mnWidth ( nWidth ), meStrikeout ( eStrikeout ), - meUnderline ( eUnderline ) + meUnderline ( eUnderline ), + meOverline ( eOverline ) { } @@ -1690,7 +1693,7 @@ MetaTextLineAction::MetaTextLineAction( const Point& rPos, long nWidth, void MetaTextLineAction::Execute( OutputDevice* pOut ) { - pOut->DrawTextLine( maPos, mnWidth, meStrikeout, meUnderline ); + pOut->DrawTextLine( maPos, mnWidth, meStrikeout, meUnderline, meOverline ); } // ------------------------------------------------------------------------ @@ -1724,7 +1727,8 @@ sal_Bool MetaTextLineAction::Compare( const MetaAction& rMetaAction ) const return ( maPos == ((MetaTextLineAction&)rMetaAction).maPos ) && ( mnWidth == ((MetaTextLineAction&)rMetaAction).mnWidth ) && ( meStrikeout == ((MetaTextLineAction&)rMetaAction).meStrikeout ) && - ( meUnderline == ((MetaTextLineAction&)rMetaAction).meUnderline ); + ( meUnderline == ((MetaTextLineAction&)rMetaAction).meUnderline ) && + ( meOverline == ((MetaTextLineAction&)rMetaAction).meOverline ); } // ------------------------------------------------------------------------ @@ -1737,6 +1741,8 @@ void MetaTextLineAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) rOStm << mnWidth; rOStm << static_cast<sal_uInt32>(meStrikeout); rOStm << static_cast<sal_uInt32>(meUnderline); + // new in version 2 + rOStm << static_cast<sal_uInt32>(meOverline); } // ------------------------------------------------------------------------ @@ -1752,6 +1758,10 @@ void MetaTextLineAction::Read( SvStream& rIStm, ImplMetaReadData* ) meStrikeout = (FontStrikeout)nTemp; rIStm >> nTemp; meUnderline = (FontUnderline)nTemp; + if ( aCompat.GetVersion() >= 2 ) { + rIStm >> nTemp; + meUnderline = (FontUnderline)nTemp; + } } // ======================================================================== @@ -3264,6 +3274,64 @@ void MetaTextLineColorAction::Read( SvStream& rIStm, ImplMetaReadData* ) // ======================================================================== +IMPL_META_ACTION( OverlineColor, META_OVERLINECOLOR_ACTION ) + +// ------------------------------------------------------------------------ + +MetaOverlineColorAction::MetaOverlineColorAction( const Color& rColor, BOOL bSet ) : + MetaAction ( META_OVERLINECOLOR_ACTION ), + maColor ( rColor ), + mbSet ( bSet ) +{ +} + +// ------------------------------------------------------------------------ + +void MetaOverlineColorAction::Execute( OutputDevice* pOut ) +{ + if( mbSet ) + pOut->SetOverlineColor( maColor ); + else + pOut->SetOverlineColor(); +} + +// ------------------------------------------------------------------------ + +MetaAction* MetaOverlineColorAction::Clone() +{ + MetaAction* pClone = (MetaAction*) new MetaOverlineColorAction( *this ); + pClone->ResetRefCount(); + return pClone; +} + +// ------------------------------------------------------------------------ + +sal_Bool MetaOverlineColorAction::Compare( const MetaAction& rMetaAction ) const +{ + return ( maColor == ((MetaOverlineColorAction&)rMetaAction).maColor ) && + ( mbSet == ((MetaOverlineColorAction&)rMetaAction).mbSet ); +} + +// ------------------------------------------------------------------------ + +void MetaOverlineColorAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) +{ + WRITE_BASE_COMPAT( rOStm, 1, pData ); + maColor.Write( rOStm, TRUE ); + rOStm << mbSet; +} + +// ------------------------------------------------------------------------ + +void MetaOverlineColorAction::Read( SvStream& rIStm, ImplMetaReadData* ) +{ + COMPAT( rIStm ); + maColor.Read( rIStm, TRUE ); + rIStm >> mbSet; +} + +// ======================================================================== + IMPL_META_ACTION( TextAlign, META_TEXTALIGN_ACTION ) // ------------------------------------------------------------------------ diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index 6dd674c15bb8..4f8003722f15 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: outdev.cxx,v $ - * $Revision: 1.60.30.1 $ + * $Revision: 1.59.74.2 $ * * This file is part of OpenOffice.org. * @@ -43,6 +43,7 @@ #include <tools/debug.hxx> #include <vcl/svdata.hxx> #include <vcl/svapp.hxx> +#include <vcl/ctrl.hxx> #ifndef _POLY_HXX #include <tools/poly.hxx> #endif @@ -116,6 +117,7 @@ struct ImplObjStack Color* mpTextColor; Color* mpTextFillColor; Color* mpTextLineColor; + Color* mpOverlineColor; Point* mpRefPoint; TextAlign meTextAlign; RasterOp meRasterOp; @@ -152,6 +154,11 @@ static void ImplDeleteObjStack( ImplObjStack* pObjStack ) if ( pObjStack->mpTextLineColor ) delete pObjStack->mpTextLineColor; } + if ( pObjStack->mnFlags & PUSH_OVERLINECOLOR ) + { + if ( pObjStack->mpOverlineColor ) + delete pObjStack->mpOverlineColor; + } if ( pObjStack->mnFlags & PUSH_MAPMODE ) { if ( pObjStack->mpMapMode ) @@ -173,6 +180,22 @@ static void ImplDeleteObjStack( ImplObjStack* pObjStack ) // ----------------------------------------------------------------------- +bool OutputDevice::ImplIsAntiparallel() const +{ + bool bRet = false; + if( ImplGetGraphics() ) + { + if( ( (mpGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) && ! IsRTLEnabled() ) || + ( ! (mpGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) && IsRTLEnabled() ) ) + { + bRet = true; + } + } + return bRet; +} + +// ----------------------------------------------------------------------- + bool OutputDevice::ImplSelectClipRegion( const Region& rRegion, SalGraphics* pGraphics ) { @@ -447,6 +470,7 @@ OutputDevice::OutputDevice() : mbDevOutput = FALSE; mbOutputClipped = FALSE; maTextColor = Color( COL_BLACK ); + maOverlineColor = Color( COL_TRANSPARENT ); meTextAlign = maFont.GetAlign(); meRasterOp = ROP_OVERPAINT; mnAntialiasing = 0; @@ -564,11 +588,18 @@ void OutputDevice::EnableRTL( BOOL bEnable ) // under rare circumstances in the UI, eg the valueset control // because each virdev has its own SalGraphics we can safely switch the SalGraphics here // ...hopefully - if( Application::GetSettings().GetLayoutRTL() ) // allow mirroring only in BiDi Office - if( ImplGetGraphics() ) - mpGraphics->SetLayout( mbEnableRTL ? SAL_LAYOUT_BIDI_RTL : 0 ); + if( ImplGetGraphics() ) + mpGraphics->SetLayout( mbEnableRTL ? SAL_LAYOUT_BIDI_RTL : 0 ); } + // convenience: for controls also switch layout mode + if( dynamic_cast<Control*>(this) != 0 ) + SetLayoutMode( bEnable ? TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT : TEXT_LAYOUT_BIDI_LTR | TEXT_LAYOUT_TEXTORIGIN_LEFT); + + Window* pWin = dynamic_cast<Window*>(this); + if( pWin ) + pWin->StateChanged( STATE_CHANGE_MIRRORING ); + if( mpAlphaVDev ) mpAlphaVDev->EnableRTL( bEnable ); } @@ -766,7 +797,8 @@ int OutputDevice::ImplGetGraphics() const if ( mpGraphics ) { - mpGraphics->SetXORMode( (ROP_INVERT == meRasterOp) || (ROP_XOR == meRasterOp) ); + mpGraphics->SetXORMode( (ROP_INVERT == meRasterOp) || (ROP_XOR == meRasterOp), ROP_INVERT == meRasterOp ); + mpGraphics->setAntiAliasB2DDraw(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW); return TRUE; } @@ -1019,7 +1051,7 @@ void OutputDevice::ImplInitClipRegion() aRegion = *(pWindow->ImplGetWinChildClipRegion()); // --- RTL -- only this region is in frame coordinates, so re-mirror it // the mpWindowImpl->mpPaintRegion above is already correct (see ImplCallPaint()) ! - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) ImplReMirror ( aRegion ); } if ( mbClipRegion ) @@ -1970,7 +2002,7 @@ void OutputDevice::SetRasterOp( RasterOp eRasterOp ) mbInitLineColor = mbInitFillColor = TRUE; if( mpGraphics || ImplGetGraphics() ) - mpGraphics->SetXORMode( (ROP_INVERT == meRasterOp) || (ROP_XOR == meRasterOp) ); + mpGraphics->SetXORMode( (ROP_INVERT == meRasterOp) || (ROP_XOR == meRasterOp), ROP_INVERT == meRasterOp ); } if( mpAlphaVDev ) @@ -2711,15 +2743,14 @@ void OutputDevice::DrawPolyPolygon( const basegfx::B2DPolyPolygon& rB2DPolyPoly if( mbInitFillColor ) ImplInitFillColor(); - if(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) + if( (mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) != 0 + && mpGraphics->supportsOperation( OutDevSupport_B2DDraw ) ) { -#ifdef UNX // b2dpolygon support not implemented yet on non-UNX platforms - const ::basegfx::B2DHomMatrix aTransform = GetViewTransformation(); + const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation(); ::basegfx::B2DPolyPolygon aB2DPP = rB2DPolyPoly; aB2DPP.transform( aTransform ); if( mpGraphics->DrawPolyPolygon( aB2DPP, 0.0, this ) ) return; -#endif } // fallback to old polygon drawing if needed @@ -2776,7 +2807,7 @@ void OutputDevice::DrawPolyLine( if(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) { #ifdef UNX // b2dpolygon support not implemented yet on non-UNX platforms - const ::basegfx::B2DHomMatrix aTransform = GetViewTransformation(); + const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation(); // transform the line width ::basegfx::B2DVector aB2DLineWidth; if( fLineWidth == 0.0 ) // hairline? @@ -2848,6 +2879,13 @@ void OutputDevice::Push( USHORT nFlags ) else pData->mpTextLineColor = NULL; } + if ( nFlags & PUSH_OVERLINECOLOR ) + { + if ( IsOverlineColor() ) + pData->mpOverlineColor = new Color( GetOverlineColor() ); + else + pData->mpOverlineColor = NULL; + } if ( nFlags & PUSH_TEXTALIGN ) pData->meTextAlign = GetTextAlign(); if( nFlags & PUSH_TEXTLAYOUTMODE ) @@ -2939,6 +2977,13 @@ void OutputDevice::Pop() else SetTextLineColor(); } + if ( pData->mnFlags & PUSH_OVERLINECOLOR ) + { + if ( pData->mpOverlineColor ) + SetOverlineColor( *pData->mpOverlineColor ); + else + SetOverlineColor(); + } if ( pData->mnFlags & PUSH_TEXTALIGN ) SetTextAlign( pData->meTextAlign ); if( pData->mnFlags & PUSH_TEXTLAYOUTMODE ) diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index dafb288f4b68..bfe0751545c7 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: outdev3.cxx,v $ - * $Revision: 1.245 $ + * $Revision: 1.240.14.5 $ * * This file is part of OpenOffice.org. * @@ -30,7 +30,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <cmath> #include <cstring> #include <i18npool/mslangid.hxx> @@ -119,9 +118,6 @@ using namespace ::vcl; // ======================================================================= -//#ifdef USE_NEW_RTL_IMPLEMENTATION - - static void ImplRotatePos( long nOriginX, long nOriginY, long& rX, long& rY, int nOrientation ) { @@ -1887,6 +1883,7 @@ void ImplDevFontList::InitGenericGlyphFallback( void ) const "khmerossystem", "", "muktinarrow", "", "phetsarathot", "", + "padauk", "pinlonmyanmar", "", 0 }; @@ -3565,6 +3562,7 @@ bool OutputDevice::ImplNewFont() const } mbTextLines = ((maFont.GetUnderline() != UNDERLINE_NONE) && (maFont.GetUnderline() != UNDERLINE_DONTKNOW)) || + ((maFont.GetOverline() != UNDERLINE_NONE) && (maFont.GetOverline() != UNDERLINE_DONTKNOW)) || ((maFont.GetStrikeout() != STRIKEOUT_NONE) && (maFont.GetStrikeout() != STRIKEOUT_DONTKNOW)); mbTextSpecial = maFont.IsShadow() || maFont.IsOutline() || (maFont.GetRelief() != RELIEF_NONE); @@ -3738,9 +3736,11 @@ void OutputDevice::ImplInitAboveTextLineSize() ImplFontMetricData::ImplFontMetricData( const ImplFontSelectData& rFontSelData ) : ImplFontAttributes( rFontSelData ) { + // initialize the members provided by the font request mnWidth = rFontSelData.mnWidth; mnOrientation = sal::static_int_cast<short>(rFontSelData.mnOrientation); + // intialize the used font name if( rFontSelData.mpFontData ) { maName = rFontSelData.mpFontData->maName; @@ -3757,12 +3757,15 @@ ImplFontMetricData::ImplFontMetricData( const ImplFontSelectData& rFontSelData ) mbKernableFont = false; } + // reset metrics that are usually measured for the font instance mnAscent = 0; mnDescent = 0; mnIntLeading = 0; mnExtLeading = 0; mnSlant = 0; + mnMinKashida = 0; + // reset metrics that are usually derived from the measurements mnUnderlineSize = 0; mnUnderlineOffset = 0; mnBUnderlineSize = 0; @@ -3883,45 +3886,36 @@ void ImplFontMetricData::ImplInitAboveTextLineSize() long nIntLeading = mnIntLeading; // TODO: assess usage of nLeading below (changed in extleading CWS) // if no leading is available, we assume 15% of the ascent - nIntLeading = mnAscent*15/100; - if ( !nIntLeading ) - nIntLeading = 1; + if ( nIntLeading <= 0 ) + { + nIntLeading = mnAscent*15/100; + if ( !nIntLeading ) + nIntLeading = 1; + } long nLineHeight = ((nIntLeading*25)+50) / 100; if ( !nLineHeight ) nLineHeight = 1; - long nLineHeight2 = nLineHeight / 2; - if ( !nLineHeight2 ) - nLineHeight2 = 1; long nBLineHeight = ((nIntLeading*50)+50) / 100; if ( nBLineHeight == nLineHeight ) nBLineHeight++; - long nBLineHeight2 = nBLineHeight/2; - if ( !nBLineHeight2 ) - nBLineHeight2 = 1; long n2LineHeight = ((nIntLeading*16)+50) / 100; if ( !n2LineHeight ) n2LineHeight = 1; - long n2LineDY = n2LineHeight; - if ( n2LineDY <= 0 ) - n2LineDY = 1; - long n2LineDY2 = n2LineDY/2; - if ( !n2LineDY2 ) - n2LineDY2 = 1; - long nUnderlineOffset = -(mnAscent - ((nIntLeading/2)-1) ); + long nCeiling = -mnAscent; mnAboveUnderlineSize = nLineHeight; - mnAboveUnderlineOffset = nUnderlineOffset - nLineHeight2; + mnAboveUnderlineOffset = nCeiling + (nIntLeading - nLineHeight + 1) / 2; mnAboveBUnderlineSize = nBLineHeight; - mnAboveBUnderlineOffset = nUnderlineOffset - nBLineHeight2; + mnAboveBUnderlineOffset = nCeiling + (nIntLeading - nBLineHeight + 1) / 2; mnAboveDUnderlineSize = n2LineHeight; - mnAboveDUnderlineOffset1 = nUnderlineOffset - n2LineDY2 - n2LineHeight; - mnAboveDUnderlineOffset2 = mnAboveDUnderlineOffset1 + n2LineDY + n2LineHeight; + mnAboveDUnderlineOffset1 = nCeiling + (nIntLeading - 3*n2LineHeight + 1) / 2; + mnAboveDUnderlineOffset2 = nCeiling + (nIntLeading + n2LineHeight + 1) / 2; long nWCalcSize = nIntLeading; if ( nWCalcSize < 6 ) @@ -3934,7 +3928,7 @@ void ImplFontMetricData::ImplInitAboveTextLineSize() else mnAboveWUnderlineSize = ((nWCalcSize*50)+50) / 100; - mnAboveWUnderlineOffset = nUnderlineOffset; + mnAboveWUnderlineOffset = nCeiling + (nIntLeading + 1) / 2; } // ----------------------------------------------------------------------- @@ -4086,227 +4080,122 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY, // ----------------------------------------------------------------------- -void OutputDevice::ImplDrawTextLine( long nBaseX, - long nX, long nY, long nWidth, - FontStrikeout eStrikeout, - FontUnderline eUnderline, - BOOL bUnderlineAbove ) +void OutputDevice::ImplDrawWaveTextLine( long nBaseX, long nBaseY, + long nX, long nY, long nWidth, + FontUnderline eTextLine, + Color aColor, + BOOL bIsAbove ) { - if ( !nWidth ) - return; - ImplFontEntry* pFontEntry = mpFontEntry; - Color aUnderlineColor = GetTextLineColor(); - Color aStrikeoutColor = GetTextColor(); - long nBaseY = nY; long nLineHeight; - long nLinePos = 0; - long nLinePos2 = 0; - long nLeft; - BOOL bNormalLines = TRUE; + long nLinePos; - // TODO: fix rotated text - if( ImplHasMirroredGraphics() && IsRTLEnabled() ) - // --- RTL --- mirror at basex - nX = nBaseX - nWidth - (nX - nBaseX - 1); - - if ( !IsTextLineColor() ) - aUnderlineColor = GetTextColor(); - - if ( (eUnderline == UNDERLINE_SMALLWAVE) || - (eUnderline == UNDERLINE_WAVE) || - (eUnderline == UNDERLINE_DOUBLEWAVE) || - (eUnderline == UNDERLINE_BOLDWAVE) ) + if ( bIsAbove ) { - if ( bUnderlineAbove ) - { - nLinePos = pFontEntry->maMetric.mnAboveWUnderlineOffset; - nLineHeight = pFontEntry->maMetric.mnAboveWUnderlineSize; - } - else - { - nLinePos = pFontEntry->maMetric.mnWUnderlineOffset; - nLineHeight = pFontEntry->maMetric.mnWUnderlineSize; - } - if ( (eUnderline == UNDERLINE_SMALLWAVE) && - (nLineHeight > 3) ) - nLineHeight = 3; - long nLineWidth = (mnDPIX/300); - if ( !nLineWidth ) - nLineWidth = 1; - if ( eUnderline == UNDERLINE_BOLDWAVE ) - nLineWidth *= 2; - nLinePos += nY - (nLineHeight / 2); - long nLineWidthHeight = ((nLineWidth*mnDPIX)+(mnDPIY/2))/mnDPIY; - if ( eUnderline == UNDERLINE_DOUBLEWAVE ) - { - long nOrgLineHeight = nLineHeight; - nLineHeight /= 3; - if ( nLineHeight < 2 ) - { - if ( nOrgLineHeight > 1 ) - nLineHeight = 2; - else - nLineHeight = 1; - } - long nLineDY = nOrgLineHeight-(nLineHeight*2); - if ( nLineDY < nLineWidthHeight ) - nLineDY = nLineWidthHeight; - long nLineDY2 = nLineDY/2; - if ( !nLineDY2 ) - nLineDY2 = 1; - - nLinePos -= nLineWidthHeight-nLineDY2; - ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight, - nLineWidth, mpFontEntry->mnOrientation, aUnderlineColor ); - nLinePos += nLineWidthHeight+nLineDY; - ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight, - nLineWidth, mpFontEntry->mnOrientation, aUnderlineColor ); - } - else - { - nLinePos -= nLineWidthHeight/2; - ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight, - nLineWidth, mpFontEntry->mnOrientation, aUnderlineColor ); - } - - - if ( (eStrikeout == STRIKEOUT_NONE) || - (eStrikeout == STRIKEOUT_DONTKNOW) ) - bNormalLines = FALSE; + nLineHeight = pFontEntry->maMetric.mnAboveWUnderlineSize; + nLinePos = pFontEntry->maMetric.mnAboveWUnderlineOffset; } - - if ( bNormalLines && - ((eStrikeout == STRIKEOUT_SLASH) || (eStrikeout == STRIKEOUT_X)) ) + else { - BOOL bOldMap = IsMapModeEnabled(); - EnableMapMode( FALSE ); - Color aOldColor = GetTextColor(); - SetTextColor( aStrikeoutColor ); - ImplInitTextColor(); - xub_Unicode pChars[5]; - if ( eStrikeout == STRIKEOUT_SLASH ) - pChars[0] = '/'; - else // ( eStrikeout == STRIKEOUT_X ) - pChars[0] = 'X'; - pChars[3]=pChars[2]=pChars[1]=pChars[0]; - // calculate approximation of strikeout atom size - long nStrikeoutWidth = nWidth; - String aStrikeoutTest( pChars, 4 ); - SalLayout* pLayout = ImplLayout( aStrikeoutTest, 0, 4 ); - if( pLayout ) - { - nStrikeoutWidth = (pLayout->GetTextWidth() + 2) / 4; - pLayout->Release(); - if( nStrikeoutWidth <= 0 ) // sanity check - nStrikeoutWidth = 1; - } - // calculate acceptable strikeout length - // allow the strikeout to be one pixel larger than the text it strikes out - long nMaxWidth = nStrikeoutWidth/2; - if ( nMaxWidth < 2 ) - nMaxWidth = 2; - nMaxWidth += nWidth + 1; - // build strikeout string - long nFullStrikeoutWidth = 0; - String aStrikeoutText( pChars, 0 ); - while( (nFullStrikeoutWidth+=nStrikeoutWidth) < nMaxWidth+1 ) - aStrikeoutText += pChars[0]; - // if the text width is smaller than the strikeout text, then do not - // strike out at all. This case requires user interaction, e.g. adding - // a space to the text - if( (aStrikeoutText.Len() > 0) - && !(mpPDFWriter && mpPDFWriter->isBuiltinFont(mpFontEntry->maFontSelData.mpFontData) ) ) - { - if( mpFontEntry->mnOrientation ) - ImplRotatePos( nBaseX, nBaseY, nX, nY, mpFontEntry->mnOrientation ); - - // strikeout text has to be left aligned - ULONG nOrigTLM = mnTextLayoutMode; - mnTextLayoutMode = TEXT_LAYOUT_BIDI_STRONG | TEXT_LAYOUT_COMPLEX_DISABLED; - SalLayout* pSalLayout = ImplLayout( aStrikeoutText, 0, STRING_LEN ); - mnTextLayoutMode = nOrigTLM; - - if( pSalLayout ) - { - pSalLayout->DrawBase() = Point( nX+mnTextOffX, nY+mnTextOffY ); - pSalLayout->DrawText( *mpGraphics ); - pSalLayout->Release(); - } - } + nLineHeight = pFontEntry->maMetric.mnWUnderlineSize; + nLinePos = pFontEntry->maMetric.mnWUnderlineOffset; + } + if ( (eTextLine == UNDERLINE_SMALLWAVE) && (nLineHeight > 3) ) + nLineHeight = 3; + long nLineWidth = (mnDPIX/300); + if ( !nLineWidth ) + nLineWidth = 1; + if ( eTextLine == UNDERLINE_BOLDWAVE ) + nLineWidth *= 2; + nLinePos += nY - (nLineHeight / 2); + long nLineWidthHeight = ((nLineWidth*mnDPIX)+(mnDPIY/2))/mnDPIY; + if ( eTextLine == UNDERLINE_DOUBLEWAVE ) + { + long nOrgLineHeight = nLineHeight; + nLineHeight /= 3; + if ( nLineHeight < 2 ) + { + if ( nOrgLineHeight > 1 ) + nLineHeight = 2; + else + nLineHeight = 1; + } + long nLineDY = nOrgLineHeight-(nLineHeight*2); + if ( nLineDY < nLineWidthHeight ) + nLineDY = nLineWidthHeight; + long nLineDY2 = nLineDY/2; + if ( !nLineDY2 ) + nLineDY2 = 1; + + nLinePos -= nLineWidthHeight-nLineDY2; + ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight, + nLineWidth, mpFontEntry->mnOrientation, aColor ); + nLinePos += nLineWidthHeight+nLineDY; + ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight, + nLineWidth, mpFontEntry->mnOrientation, aColor ); + } + else + { + nLinePos -= nLineWidthHeight/2; + ImplDrawWaveLine( nBaseX, nBaseY, nX, nLinePos, nWidth, nLineHeight, + nLineWidth, mpFontEntry->mnOrientation, aColor ); + } +} - SetTextColor( aOldColor ); - ImplInitTextColor(); - EnableMapMode( bOldMap ); +// ----------------------------------------------------------------------- - switch( eUnderline ) - { - case UNDERLINE_NONE: - case UNDERLINE_DONTKNOW: - case UNDERLINE_SMALLWAVE: - case UNDERLINE_WAVE: - case UNDERLINE_DOUBLEWAVE: - case UNDERLINE_BOLDWAVE: - { - bNormalLines = FALSE; - } - break; - default: - { - ; // We don't want a gcc warning... - } +void OutputDevice::ImplDrawStraightTextLine( long nBaseX, long nBaseY, + long nX, long nY, long nWidth, + FontUnderline eTextLine, + Color aColor, + BOOL bIsAbove ) +{ + ImplFontEntry* pFontEntry = mpFontEntry; + long nLineHeight = 0; + long nLinePos = 0; + long nLinePos2 = 0; - } - } + if ( eTextLine > UNDERLINE_LAST ) + eTextLine = UNDERLINE_SINGLE; - if ( bNormalLines ) + switch ( eTextLine ) { - if ( eUnderline > UNDERLINE_LAST ) - eUnderline = UNDERLINE_SINGLE; - - if ( (eUnderline == UNDERLINE_SINGLE) || - (eUnderline == UNDERLINE_DOTTED) || - (eUnderline == UNDERLINE_DASH) || - (eUnderline == UNDERLINE_LONGDASH) || - (eUnderline == UNDERLINE_DASHDOT) || - (eUnderline == UNDERLINE_DASHDOTDOT) ) - { - if ( bUnderlineAbove ) + case UNDERLINE_SINGLE: + case UNDERLINE_DOTTED: + case UNDERLINE_DASH: + case UNDERLINE_LONGDASH: + case UNDERLINE_DASHDOT: + case UNDERLINE_DASHDOTDOT: + if ( bIsAbove ) { nLineHeight = pFontEntry->maMetric.mnAboveUnderlineSize; nLinePos = nY + pFontEntry->maMetric.mnAboveUnderlineOffset; } else { - if ( !pFontEntry->maMetric.mnUnderlineSize ) - ImplInitTextLineSize(); nLineHeight = pFontEntry->maMetric.mnUnderlineSize; nLinePos = nY + pFontEntry->maMetric.mnUnderlineOffset; } - } - else if ( (eUnderline == UNDERLINE_BOLD) || - (eUnderline == UNDERLINE_BOLDDOTTED) || - (eUnderline == UNDERLINE_BOLDDASH) || - (eUnderline == UNDERLINE_BOLDLONGDASH) || - (eUnderline == UNDERLINE_BOLDDASHDOT) || - (eUnderline == UNDERLINE_BOLDDASHDOTDOT) ) - { - if ( bUnderlineAbove ) + break; + case UNDERLINE_BOLD: + case UNDERLINE_BOLDDOTTED: + case UNDERLINE_BOLDDASH: + case UNDERLINE_BOLDLONGDASH: + case UNDERLINE_BOLDDASHDOT: + case UNDERLINE_BOLDDASHDOTDOT: + if ( bIsAbove ) { nLineHeight = pFontEntry->maMetric.mnAboveBUnderlineSize; nLinePos = nY + pFontEntry->maMetric.mnAboveBUnderlineOffset; } else { - if ( !pFontEntry->maMetric.mnBUnderlineSize ) - ImplInitTextLineSize(); nLineHeight = pFontEntry->maMetric.mnBUnderlineSize; nLinePos = nY + pFontEntry->maMetric.mnBUnderlineOffset; } - } - else if ( eUnderline == UNDERLINE_DOUBLE ) - { - if ( bUnderlineAbove ) + break; + case UNDERLINE_DOUBLE: + if ( bIsAbove ) { nLineHeight = pFontEntry->maMetric.mnAboveDUnderlineSize; nLinePos = nY + pFontEntry->maMetric.mnAboveDUnderlineOffset1; @@ -4314,221 +4203,379 @@ void OutputDevice::ImplDrawTextLine( long nBaseX, } else { - if ( !pFontEntry->maMetric.mnDUnderlineSize ) - ImplInitTextLineSize(); nLineHeight = pFontEntry->maMetric.mnDUnderlineSize; nLinePos = nY + pFontEntry->maMetric.mnDUnderlineOffset1; nLinePos2 = nY + pFontEntry->maMetric.mnDUnderlineOffset2; } - } - else - nLineHeight = 0; + break; + default: + break; + } - if ( nLineHeight ) + if ( nLineHeight ) + { + if ( mbLineColor || mbInitLineColor ) { - if ( mbLineColor || mbInitLineColor ) - { - mpGraphics->SetLineColor(); - mbInitLineColor = TRUE; - } - mpGraphics->SetFillColor( ImplColorToSal( aUnderlineColor ) ); - mbInitFillColor = TRUE; + mpGraphics->SetLineColor(); + mbInitLineColor = TRUE; + } + mpGraphics->SetFillColor( ImplColorToSal( aColor ) ); + mbInitFillColor = TRUE; - nLeft = nX; + long nLeft = nX; - if ( (eUnderline == UNDERLINE_SINGLE) || - (eUnderline == UNDERLINE_BOLD) ) - ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nWidth, nLineHeight ); - else if ( eUnderline == UNDERLINE_DOUBLE ) - { + switch ( eTextLine ) + { + case UNDERLINE_SINGLE: + case UNDERLINE_BOLD: ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nWidth, nLineHeight ); + break; + case UNDERLINE_DOUBLE: + ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nWidth, nLineHeight ); ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos2, nWidth, nLineHeight ); - } - else if ( (eUnderline == UNDERLINE_DOTTED) || - (eUnderline == UNDERLINE_BOLDDOTTED) ) - { - long nDotWidth = nLineHeight*mnDPIY; - nDotWidth += mnDPIY/2; - nDotWidth /= mnDPIY; - long nTempWidth = nDotWidth; - long nEnd = nLeft+nWidth; - while ( nLeft < nEnd ) - { - if ( nLeft+nTempWidth > nEnd ) - nTempWidth = nEnd-nLeft; - ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempWidth, nLineHeight ); - nLeft += nDotWidth*2; - - } - } - else if ( (eUnderline == UNDERLINE_DASH) || - (eUnderline == UNDERLINE_LONGDASH) || - (eUnderline == UNDERLINE_BOLDDASH) || - (eUnderline == UNDERLINE_BOLDLONGDASH) ) - { - long nDotWidth = nLineHeight*mnDPIY; - nDotWidth += mnDPIY/2; - nDotWidth /= mnDPIY; - long nMinDashWidth; - - long nMinSpaceWidth; - long nSpaceWidth; - long nDashWidth; - if ( (eUnderline == UNDERLINE_LONGDASH) || - (eUnderline == UNDERLINE_BOLDLONGDASH) ) - { - nMinDashWidth = nDotWidth*6; - nMinSpaceWidth = nDotWidth*2; - nDashWidth = 200; - nSpaceWidth = 100; - } - else + break; + case UNDERLINE_DOTTED: + case UNDERLINE_BOLDDOTTED: { - nMinDashWidth = nDotWidth*4; - nMinSpaceWidth = (nDotWidth*150)/100; - nDashWidth = 100; - nSpaceWidth = 50; + long nDotWidth = nLineHeight*mnDPIY; + nDotWidth += mnDPIY/2; + nDotWidth /= mnDPIY; + long nTempWidth = nDotWidth; + long nEnd = nLeft+nWidth; + while ( nLeft < nEnd ) + { + if ( nLeft+nTempWidth > nEnd ) + nTempWidth = nEnd-nLeft; + ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempWidth, nLineHeight ); + nLeft += nDotWidth*2; + } } - nDashWidth = ((nDashWidth*mnDPIX)+1270)/2540; - nSpaceWidth = ((nSpaceWidth*mnDPIX)+1270)/2540; - // DashWidth wird gegebenenfalls verbreitert, wenn - // die dicke der Linie im Verhaeltnis zur Laenge - // zu dick wird - if ( nDashWidth < nMinDashWidth ) - nDashWidth = nMinDashWidth; - if ( nSpaceWidth < nMinSpaceWidth ) - nSpaceWidth = nMinSpaceWidth; - long nTempWidth = nDashWidth; - long nEnd = nLeft+nWidth; - while ( nLeft < nEnd ) + break; + case UNDERLINE_DASH: + case UNDERLINE_LONGDASH: + case UNDERLINE_BOLDDASH: + case UNDERLINE_BOLDLONGDASH: { - if ( nLeft+nTempWidth > nEnd ) - nTempWidth = nEnd-nLeft; - ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempWidth, nLineHeight ); - nLeft += nDashWidth+nSpaceWidth; + long nDotWidth = nLineHeight*mnDPIY; + nDotWidth += mnDPIY/2; + nDotWidth /= mnDPIY; + long nMinDashWidth; + long nMinSpaceWidth; + long nSpaceWidth; + long nDashWidth; + if ( (eTextLine == UNDERLINE_LONGDASH) || + (eTextLine == UNDERLINE_BOLDLONGDASH) ) + { + nMinDashWidth = nDotWidth*6; + nMinSpaceWidth = nDotWidth*2; + nDashWidth = 200; + nSpaceWidth = 100; + } + else + { + nMinDashWidth = nDotWidth*4; + nMinSpaceWidth = (nDotWidth*150)/100; + nDashWidth = 100; + nSpaceWidth = 50; + } + nDashWidth = ((nDashWidth*mnDPIX)+1270)/2540; + nSpaceWidth = ((nSpaceWidth*mnDPIX)+1270)/2540; + // DashWidth wird gegebenenfalls verbreitert, wenn + // die dicke der Linie im Verhaeltnis zur Laenge + // zu dick wird + if ( nDashWidth < nMinDashWidth ) + nDashWidth = nMinDashWidth; + if ( nSpaceWidth < nMinSpaceWidth ) + nSpaceWidth = nMinSpaceWidth; + long nTempWidth = nDashWidth; + long nEnd = nLeft+nWidth; + while ( nLeft < nEnd ) + { + if ( nLeft+nTempWidth > nEnd ) + nTempWidth = nEnd-nLeft; + ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempWidth, nLineHeight ); + nLeft += nDashWidth+nSpaceWidth; + } } - } - else if ( (eUnderline == UNDERLINE_DASHDOT) || - (eUnderline == UNDERLINE_BOLDDASHDOT) ) - { - long nDotWidth = nLineHeight*mnDPIY; - nDotWidth += mnDPIY/2; - nDotWidth /= mnDPIY; - long nDashWidth = ((100*mnDPIX)+1270)/2540; - long nMinDashWidth = nDotWidth*4; - // DashWidth wird gegebenenfalls verbreitert, wenn - // die dicke der Linie im Verhaeltnis zur Laenge - // zu dick wird - if ( nDashWidth < nMinDashWidth ) - nDashWidth = nMinDashWidth; - long nTempDotWidth = nDotWidth; - long nTempDashWidth = nDashWidth; - long nEnd = nLeft+nWidth; - while ( nLeft < nEnd ) + break; + case UNDERLINE_DASHDOT: + case UNDERLINE_BOLDDASHDOT: { - if ( nLeft+nTempDotWidth > nEnd ) - nTempDotWidth = nEnd-nLeft; - ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDotWidth, nLineHeight ); - nLeft += nDotWidth*2; - if ( nLeft > nEnd ) - break; - if ( nLeft+nTempDashWidth > nEnd ) - nTempDashWidth = nEnd-nLeft; - ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDashWidth, nLineHeight ); - nLeft += nDashWidth+nDotWidth; + long nDotWidth = nLineHeight*mnDPIY; + nDotWidth += mnDPIY/2; + nDotWidth /= mnDPIY; + long nDashWidth = ((100*mnDPIX)+1270)/2540; + long nMinDashWidth = nDotWidth*4; + // DashWidth wird gegebenenfalls verbreitert, wenn + // die dicke der Linie im Verhaeltnis zur Laenge + // zu dick wird + if ( nDashWidth < nMinDashWidth ) + nDashWidth = nMinDashWidth; + long nTempDotWidth = nDotWidth; + long nTempDashWidth = nDashWidth; + long nEnd = nLeft+nWidth; + while ( nLeft < nEnd ) + { + if ( nLeft+nTempDotWidth > nEnd ) + nTempDotWidth = nEnd-nLeft; + ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDotWidth, nLineHeight ); + nLeft += nDotWidth*2; + if ( nLeft > nEnd ) + break; + if ( nLeft+nTempDashWidth > nEnd ) + nTempDashWidth = nEnd-nLeft; + ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDashWidth, nLineHeight ); + nLeft += nDashWidth+nDotWidth; + } } - } - else if ( (eUnderline == UNDERLINE_DASHDOTDOT) || - - (eUnderline == UNDERLINE_BOLDDASHDOTDOT) ) - { - long nDotWidth = nLineHeight*mnDPIY; - nDotWidth += mnDPIY/2; - - nDotWidth /= mnDPIY; - long nDashWidth = ((100*mnDPIX)+1270)/2540; - long nMinDashWidth = nDotWidth*4; - // DashWidth wird gegebenenfalls verbreitert, wenn - // die dicke der Linie im Verhaeltnis zur Laenge - // zu dick wird - if ( nDashWidth < nMinDashWidth ) - nDashWidth = nMinDashWidth; - long nTempDotWidth = nDotWidth; - long nTempDashWidth = nDashWidth; - long nEnd = nLeft+nWidth; - while ( nLeft < nEnd ) + break; + case UNDERLINE_DASHDOTDOT: + case UNDERLINE_BOLDDASHDOTDOT: { - if ( nLeft+nTempDotWidth > nEnd ) - nTempDotWidth = nEnd-nLeft; - ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDotWidth, nLineHeight ); - nLeft += nDotWidth*2; - if ( nLeft > nEnd ) - break; - if ( nLeft+nTempDotWidth > nEnd ) - nTempDotWidth = nEnd-nLeft; - ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDotWidth, nLineHeight ); - nLeft += nDotWidth*2; - if ( nLeft > nEnd ) - break; - if ( nLeft+nTempDashWidth > nEnd ) - nTempDashWidth = nEnd-nLeft; - ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDashWidth, nLineHeight ); - nLeft += nDashWidth+nDotWidth; + long nDotWidth = nLineHeight*mnDPIY; + nDotWidth += mnDPIY/2; + nDotWidth /= mnDPIY; + long nDashWidth = ((100*mnDPIX)+1270)/2540; + long nMinDashWidth = nDotWidth*4; + // DashWidth wird gegebenenfalls verbreitert, wenn + // die dicke der Linie im Verhaeltnis zur Laenge + // zu dick wird + if ( nDashWidth < nMinDashWidth ) + nDashWidth = nMinDashWidth; + long nTempDotWidth = nDotWidth; + long nTempDashWidth = nDashWidth; + long nEnd = nLeft+nWidth; + while ( nLeft < nEnd ) + { + if ( nLeft+nTempDotWidth > nEnd ) + nTempDotWidth = nEnd-nLeft; + ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDotWidth, nLineHeight ); + nLeft += nDotWidth*2; + if ( nLeft > nEnd ) + break; + if ( nLeft+nTempDotWidth > nEnd ) + nTempDotWidth = nEnd-nLeft; + ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDotWidth, nLineHeight ); + nLeft += nDotWidth*2; + if ( nLeft > nEnd ) + break; + if ( nLeft+nTempDashWidth > nEnd ) + nTempDashWidth = nEnd-nLeft; + ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nTempDashWidth, nLineHeight ); + nLeft += nDashWidth+nDotWidth; + } } - } + break; + default: + break; } + } +} - if ( eStrikeout > STRIKEOUT_LAST ) - eStrikeout = STRIKEOUT_SINGLE; +// ----------------------------------------------------------------------- - if ( eStrikeout == STRIKEOUT_SINGLE ) - { +void OutputDevice::ImplDrawStrikeoutLine( long nBaseX, long nBaseY, + long nX, long nY, long nWidth, + FontStrikeout eStrikeout, + Color aColor ) +{ + ImplFontEntry* pFontEntry = mpFontEntry; + long nLineHeight = 0; + long nLinePos = 0; + long nLinePos2 = 0; + + if ( eStrikeout > STRIKEOUT_LAST ) + eStrikeout = STRIKEOUT_SINGLE; + + switch ( eStrikeout ) + { + case STRIKEOUT_SINGLE: nLineHeight = pFontEntry->maMetric.mnStrikeoutSize; nLinePos = nY + pFontEntry->maMetric.mnStrikeoutOffset; - } - else if ( eStrikeout == STRIKEOUT_BOLD ) - { + break; + case STRIKEOUT_BOLD: nLineHeight = pFontEntry->maMetric.mnBStrikeoutSize; nLinePos = nY + pFontEntry->maMetric.mnBStrikeoutOffset; - } - else if ( eStrikeout == STRIKEOUT_DOUBLE ) - { + break; + case STRIKEOUT_DOUBLE: nLineHeight = pFontEntry->maMetric.mnDStrikeoutSize; nLinePos = nY + pFontEntry->maMetric.mnDStrikeoutOffset1; nLinePos2 = nY + pFontEntry->maMetric.mnDStrikeoutOffset2; - } - else - nLineHeight = 0; + break; + default: + break; + } - if ( nLineHeight ) + if ( nLineHeight ) + { + if ( mbLineColor || mbInitLineColor ) { - if ( mbLineColor || mbInitLineColor ) - { - mpGraphics->SetLineColor(); - mbInitLineColor = TRUE; - } - mpGraphics->SetFillColor( ImplColorToSal( aStrikeoutColor ) ); - mbInitFillColor = TRUE; + mpGraphics->SetLineColor(); + mbInitLineColor = TRUE; + } + mpGraphics->SetFillColor( ImplColorToSal( aColor ) ); + mbInitFillColor = TRUE; - nLeft = nX; + long nLeft = nX; - if ( (eStrikeout == STRIKEOUT_SINGLE) || - (eStrikeout == STRIKEOUT_BOLD) ) + switch ( eStrikeout ) + { + case STRIKEOUT_SINGLE: + case STRIKEOUT_BOLD: ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nWidth, nLineHeight ); - else if ( eStrikeout == STRIKEOUT_DOUBLE ) - { + break; + case STRIKEOUT_DOUBLE: ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos, nWidth, nLineHeight ); ImplDrawTextRect( nBaseX, nBaseY, nLeft, nLinePos2, nWidth, nLineHeight ); - } + break; + default: + break; } + } +} + +// ----------------------------------------------------------------------- + +void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, + long nX, long nY, long nWidth, + FontStrikeout eStrikeout, + Color aColor ) +{ + BOOL bOldMap = IsMapModeEnabled(); + EnableMapMode( FALSE ); + + Color aOldColor = GetTextColor(); + SetTextColor( aColor ); + ImplInitTextColor(); + + xub_Unicode pChars[5]; + if ( eStrikeout == STRIKEOUT_SLASH ) + pChars[0] = '/'; + else // ( eStrikeout == STRIKEOUT_X ) + pChars[0] = 'X'; + pChars[3]=pChars[2]=pChars[1]=pChars[0]; + + // calculate approximation of strikeout atom size + long nStrikeoutWidth = nWidth; + String aStrikeoutTest( pChars, 4 ); + SalLayout* pLayout = ImplLayout( aStrikeoutTest, 0, 4 ); + if ( pLayout ) + { + nStrikeoutWidth = (pLayout->GetTextWidth() + 2) / 4; + pLayout->Release(); + if ( nStrikeoutWidth <= 0 ) // sanity check + nStrikeoutWidth = 1; + } + + // calculate acceptable strikeout length + // allow the strikeout to be one pixel larger than the text it strikes out + long nMaxWidth = nStrikeoutWidth/2; + if ( nMaxWidth < 2 ) + nMaxWidth = 2; + nMaxWidth += nWidth + 1; + + // build strikeout string + long nFullStrikeoutWidth = 0; + String aStrikeoutText( pChars, 0 ); + while ( (nFullStrikeoutWidth+=nStrikeoutWidth) < nMaxWidth+1 ) + aStrikeoutText += pChars[0]; + + // if the text width is smaller than the strikeout text, then do not + // strike out at all. This case requires user interaction, e.g. adding + // a space to the text + if ( (aStrikeoutText.Len() > 0) + && !(mpPDFWriter && mpPDFWriter->isBuiltinFont(mpFontEntry->maFontSelData.mpFontData) ) ) + { + if ( mpFontEntry->mnOrientation ) + ImplRotatePos( nBaseX, nBaseY, nX, nY, mpFontEntry->mnOrientation ); + // strikeout text has to be left aligned + ULONG nOrigTLM = mnTextLayoutMode; + mnTextLayoutMode = TEXT_LAYOUT_BIDI_STRONG | TEXT_LAYOUT_COMPLEX_DISABLED; + SalLayout* pSalLayout = ImplLayout( aStrikeoutText, 0, STRING_LEN ); + mnTextLayoutMode = nOrigTLM; + + if ( pSalLayout ) + { + pSalLayout->DrawBase() = Point( nX+mnTextOffX, nY+mnTextOffY ); + pSalLayout->DrawText( *mpGraphics ); + pSalLayout->Release(); + } } + + SetTextColor( aOldColor ); + ImplInitTextColor(); + EnableMapMode( bOldMap ); +} + +// ----------------------------------------------------------------------- + +void OutputDevice::ImplDrawTextLine( long nBaseX, + long nX, long nY, long nWidth, + FontStrikeout eStrikeout, + FontUnderline eUnderline, + FontUnderline eOverline, + BOOL bUnderlineAbove ) +{ + if ( !nWidth ) + return; + + Color aStrikeoutColor = GetTextColor(); + Color aUnderlineColor = GetTextLineColor(); + Color aOverlineColor = GetOverlineColor(); + BOOL bStrikeoutDone = FALSE; + BOOL bUnderlineDone = FALSE; + BOOL bOverlineDone = FALSE; + + // TODO: fix rotated text + if ( IsRTLEnabled() ) + // --- RTL --- mirror at basex + nX = nBaseX - nWidth - (nX - nBaseX - 1); + + if ( !IsTextLineColor() ) + aUnderlineColor = GetTextColor(); + + if ( !IsOverlineColor() ) + aOverlineColor = GetTextColor(); + + if ( (eUnderline == UNDERLINE_SMALLWAVE) || + (eUnderline == UNDERLINE_WAVE) || + (eUnderline == UNDERLINE_DOUBLEWAVE) || + (eUnderline == UNDERLINE_BOLDWAVE) ) + { + ImplDrawWaveTextLine( nBaseX, nY, nX, nY, nWidth, eUnderline, aUnderlineColor, bUnderlineAbove ); + bUnderlineDone = TRUE; + } + if ( (eOverline == UNDERLINE_SMALLWAVE) || + (eOverline == UNDERLINE_WAVE) || + (eOverline == UNDERLINE_DOUBLEWAVE) || + (eOverline == UNDERLINE_BOLDWAVE) ) + { + ImplDrawWaveTextLine( nBaseX, nY, nX, nY, nWidth, eOverline, aOverlineColor, TRUE ); + bOverlineDone = TRUE; + } + + if ( (eStrikeout == STRIKEOUT_SLASH) || + (eStrikeout == STRIKEOUT_X) ) + { + ImplDrawStrikeoutChar( nBaseX, nY, nX, nY, nWidth, eStrikeout, aStrikeoutColor ); + bStrikeoutDone = TRUE; + } + + if ( !bUnderlineDone ) + ImplDrawStraightTextLine( nBaseX, nY, nX, nY, nWidth, eUnderline, aUnderlineColor, bUnderlineAbove ); + + if ( !bOverlineDone ) + ImplDrawStraightTextLine( nBaseX, nY, nX, nY, nWidth, eOverline, aOverlineColor, TRUE ); + + if ( !bStrikeoutDone ) + ImplDrawStrikeoutLine( nBaseX, nY, nX, nY, nWidth, eStrikeout, aStrikeoutColor ); } // ----------------------------------------------------------------------- void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout, - FontStrikeout eStrikeout, FontUnderline eUnderline, BOOL bWordLine, BOOL bUnderlineAbove ) + FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, BOOL bWordLine, BOOL bUnderlineAbove ) { if( bWordLine ) { @@ -4552,7 +4599,7 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout, else if( nWidth > 0 ) { ImplDrawTextLine( rSalLayout.DrawBase().X(), aStartPt.X(), aStartPt.Y(), nWidth, - eStrikeout, eUnderline, bUnderlineAbove ); + eStrikeout, eUnderline, eOverline, bUnderlineAbove ); nWidth = 0; } } @@ -4560,7 +4607,7 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout, if( nWidth > 0 ) { ImplDrawTextLine( rSalLayout.DrawBase().X(), aStartPt.X(), aStartPt.Y(), nWidth, - eStrikeout, eUnderline, bUnderlineAbove ); + eStrikeout, eUnderline, eOverline, bUnderlineAbove ); } } else @@ -4568,7 +4615,7 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout, Point aStartPt = rSalLayout.GetDrawPosition(); int nWidth = rSalLayout.GetTextWidth() / rSalLayout.GetUnitsPerPixel(); ImplDrawTextLine( rSalLayout.DrawBase().X(), aStartPt.X(), aStartPt.Y(), nWidth, - eStrikeout, eUnderline, bUnderlineAbove ); + eStrikeout, eUnderline, eOverline, bUnderlineAbove ); } } @@ -4577,7 +4624,7 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout, void OutputDevice::ImplDrawMnemonicLine( long nX, long nY, long nWidth ) { long nBaseX = nX; - if( ImplHasMirroredGraphics() && IsRTLEnabled() ) + if( /*ImplHasMirroredGraphics() &&*/ IsRTLEnabled() ) { // --- RTL --- // add some strange offset @@ -4586,7 +4633,7 @@ void OutputDevice::ImplDrawMnemonicLine( long nX, long nY, long nWidth ) nX = nBaseX - nWidth - (nX - nBaseX - 1); } - ImplDrawTextLine( nBaseX, nX, nY, nWidth, STRIKEOUT_NONE, UNDERLINE_SINGLE, FALSE ); + ImplDrawTextLine( nBaseX, nX, nY, nWidth, STRIKEOUT_NONE, UNDERLINE_SINGLE, UNDERLINE_NONE, FALSE ); } // ----------------------------------------------------------------------- @@ -4753,7 +4800,7 @@ void OutputDevice::ImplDrawEmphasisMark( long nBaseX, long nX, long nY, // TODO: pass nWidth as width of this mark long nWidth = 0; - if( ImplHasMirroredGraphics() && IsRTLEnabled() ) + if( IsRTLEnabled() ) // --- RTL --- mirror at basex nX = nBaseX - nWidth - (nX - nBaseX - 1); @@ -4971,16 +5018,20 @@ void OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout, BOOL bTextLines ) if( !IsRTLEnabled() ) { OutputDevice *pOutDevRef = (OutputDevice *)this; -#ifdef USE_NEW_RTL_IMPLEMENTATION - if( meOutDevType == OUTDEV_WINDOW ) - pOutDevRef = (OutputDevice*) ((Window *) this)->mpDummy4; -#endif - // mirror this window back long devX = w-pOutDevRef->mnOutWidth-pOutDevRef->mnOutOffX; // re-mirrored mnOutOffX rSalLayout.DrawBase().X() = devX + ( pOutDevRef->mnOutWidth - 1 - (rSalLayout.DrawBase().X() - devX) ) ; } } + else if( IsRTLEnabled() ) + { + //long w = meOutDevType == OUTDEV_VIRDEV ? mnOutWidth : mpGraphics->GetGraphicsWidth(); + //long x = rSalLayout.DrawBase().X(); + OutputDevice *pOutDevRef = (OutputDevice *)this; + // mirror this window back + long devX = pOutDevRef->mnOutOffX; // re-mirrored mnOutOffX + rSalLayout.DrawBase().X() = pOutDevRef->mnOutWidth - 1 - (rSalLayout.DrawBase().X() - devX) + devX; + } rSalLayout.DrawText( *mpGraphics ); } @@ -4989,7 +5040,7 @@ void OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout, BOOL bTextLines ) if( bTextLines ) ImplDrawTextLines( rSalLayout, - maFont.GetStrikeout(), maFont.GetUnderline(), + maFont.GetStrikeout(), maFont.GetUnderline(), maFont.GetOverline(), maFont.IsWordLineMode(), ImplIsUnderlineAbove( maFont ) ); // emphasis marks @@ -5003,6 +5054,7 @@ void OutputDevice::ImplDrawSpecialText( SalLayout& rSalLayout ) { Color aOldColor = GetTextColor(); Color aOldTextLineColor = GetTextLineColor(); + Color aOldOverlineColor = GetOverlineColor(); FontRelief eRelief = maFont.GetRelief(); Point aOrigPos = rSalLayout.DrawBase(); @@ -5012,18 +5064,22 @@ void OutputDevice::ImplDrawSpecialText( SalLayout& rSalLayout ) Color aTextColor( aOldColor ); Color aTextLineColor( aOldTextLineColor ); + Color aOverlineColor( aOldOverlineColor ); // we don't have a automatic color, so black is always drawn on white if ( aTextColor.GetColor() == COL_BLACK ) aTextColor = Color( COL_WHITE ); if ( aTextLineColor.GetColor() == COL_BLACK ) aTextLineColor = Color( COL_WHITE ); + if ( aOverlineColor.GetColor() == COL_BLACK ) + aOverlineColor = Color( COL_WHITE ); // relief-color is black for white text, in all other cases // we set this to LightGray if ( aTextColor.GetColor() == COL_WHITE ) aReliefColor = Color( COL_BLACK ); SetTextLineColor( aReliefColor ); + SetOverlineColor( aReliefColor ); SetTextColor( aReliefColor ); ImplInitTextColor(); @@ -5039,11 +5095,13 @@ void OutputDevice::ImplDrawSpecialText( SalLayout& rSalLayout ) rSalLayout.DrawOffset() -= Point( nOff, nOff); SetTextLineColor( aTextLineColor ); + SetOverlineColor( aOverlineColor ); SetTextColor( aTextColor ); ImplInitTextColor(); ImplDrawTextDirect( rSalLayout, mbTextLines ); SetTextLineColor( aOldTextLineColor ); + SetOverlineColor( aOldOverlineColor ); if ( aTextColor != aOldColor ) { @@ -5059,6 +5117,7 @@ void OutputDevice::ImplDrawSpecialText( SalLayout& rSalLayout ) if ( maFont.IsOutline() ) nOff++; SetTextLineColor(); + SetOverlineColor(); if ( (GetTextColor().GetColor() == COL_BLACK) || (GetTextColor().GetLuminance() < 8) ) SetTextColor( Color( COL_LIGHTGRAY ) ); @@ -5070,6 +5129,7 @@ void OutputDevice::ImplDrawSpecialText( SalLayout& rSalLayout ) rSalLayout.DrawBase() -= Point( nOff, nOff ); SetTextColor( aOldColor ); SetTextLineColor( aOldTextLineColor ); + SetOverlineColor( aOldOverlineColor ); ImplInitTextColor(); if ( !maFont.IsOutline() ) @@ -5098,10 +5158,12 @@ void OutputDevice::ImplDrawSpecialText( SalLayout& rSalLayout ) SetTextColor( Color( COL_WHITE ) ); SetTextLineColor( Color( COL_WHITE ) ); + SetOverlineColor( Color( COL_WHITE ) ); ImplInitTextColor(); ImplDrawTextDirect( rSalLayout, mbTextLines ); SetTextColor( aOldColor ); SetTextLineColor( aOldTextLineColor ); + SetOverlineColor( aOldOverlineColor ); ImplInitTextColor(); } } @@ -5286,6 +5348,30 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, } nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos ); } + else + { + // fallback to something really simple + USHORT nSpacePos = STRING_LEN; + long nW = 0; + do + { + nSpacePos = rStr.SearchBackward( sal_Unicode(' '), nSpacePos ); + if( nSpacePos != STRING_NOTFOUND ) + { + if( nSpacePos > nPos ) + nSpacePos--; + nW = GetTextWidth( rStr, nPos, nSpacePos-nPos ); + } + } while( nW > nWidth ); + + if( nSpacePos != STRING_NOTFOUND ) + { + nBreakPos = nSpacePos; + nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos ); + if( nBreakPos < rStr.Len()-1 ) + nBreakPos++; + } + } } if ( nLineWidth > nMaxLineWidth ) @@ -5327,6 +5413,11 @@ void OutputDevice::SetAntialiasing( USHORT nMode ) { mnAntialiasing = nMode; mbInitFont = TRUE; + + if(mpGraphics) + { + mpGraphics->setAntiAliasB2DDraw(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW); + } } if( mpAlphaVDev ) @@ -5670,6 +5761,65 @@ void OutputDevice::SetTextLineColor( const Color& rColor ) // ----------------------------------------------------------------------- +void OutputDevice::SetOverlineColor() +{ + DBG_TRACE( "OutputDevice::SetOverlineColor()" ); + DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); + + if ( mpMetaFile ) + mpMetaFile->AddAction( new MetaOverlineColorAction( Color(), FALSE ) ); + + maOverlineColor = Color( COL_TRANSPARENT ); + + if( mpAlphaVDev ) + mpAlphaVDev->SetOverlineColor(); +} + +// ----------------------------------------------------------------------- + +void OutputDevice::SetOverlineColor( const Color& rColor ) +{ + DBG_TRACE( "OutputDevice::SetOverlineColor()" ); + DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); + + Color aColor( rColor ); + + if ( mnDrawMode & ( DRAWMODE_BLACKTEXT | DRAWMODE_WHITETEXT | + DRAWMODE_GRAYTEXT | DRAWMODE_GHOSTEDTEXT | + DRAWMODE_SETTINGSTEXT ) ) + { + if ( mnDrawMode & DRAWMODE_BLACKTEXT ) + aColor = Color( COL_BLACK ); + else if ( mnDrawMode & DRAWMODE_WHITETEXT ) + aColor = Color( COL_WHITE ); + else if ( mnDrawMode & DRAWMODE_GRAYTEXT ) + { + const UINT8 cLum = aColor.GetLuminance(); + aColor = Color( cLum, cLum, cLum ); + } + else if ( mnDrawMode & DRAWMODE_SETTINGSTEXT ) + aColor = GetSettings().GetStyleSettings().GetFontColor(); + + if( (mnDrawMode & DRAWMODE_GHOSTEDTEXT) + && (aColor.GetColor() != COL_TRANSPARENT) ) + { + aColor = Color( (aColor.GetRed() >> 1) | 0x80, + (aColor.GetGreen() >> 1) | 0x80, + (aColor.GetBlue() >> 1) | 0x80 ); + } + } + + if ( mpMetaFile ) + mpMetaFile->AddAction( new MetaOverlineColorAction( aColor, TRUE ) ); + + maOverlineColor = aColor; + + if( mpAlphaVDev ) + mpAlphaVDev->SetOverlineColor( COL_BLACK ); +} + +// ----------------------------------------------------------------------- + void OutputDevice::SetTextAlign( TextAlign eAlign ) { @@ -5694,15 +5844,17 @@ void OutputDevice::SetTextAlign( TextAlign eAlign ) void OutputDevice::DrawTextLine( const Point& rPos, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, + FontUnderline eOverline, BOOL bUnderlineAbove ) { DBG_TRACE( "OutputDevice::DrawTextLine()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); if ( mpMetaFile ) - mpMetaFile->AddAction( new MetaTextLineAction( rPos, nWidth, eStrikeout, eUnderline ) ); + mpMetaFile->AddAction( new MetaTextLineAction( rPos, nWidth, eStrikeout, eUnderline, eOverline ) ); if ( ((eUnderline == UNDERLINE_NONE) || (eUnderline == UNDERLINE_DONTKNOW)) && + ((eOverline == UNDERLINE_NONE) || (eOverline == UNDERLINE_DONTKNOW)) && ((eStrikeout == STRIKEOUT_NONE) || (eStrikeout == STRIKEOUT_DONTKNOW)) ) return; @@ -5728,10 +5880,10 @@ void OutputDevice::DrawTextLine( const Point& rPos, long nWidth, Point aPos = ImplLogicToDevicePixel( rPos ); nWidth = ImplLogicWidthToDevicePixel( nWidth ); aPos += Point( mnTextOffX, mnTextOffY ); - ImplDrawTextLine( aPos.X(), aPos.X(), aPos.Y(), nWidth, eStrikeout, eUnderline, bUnderlineAbove ); + ImplDrawTextLine( aPos.X(), aPos.X(), aPos.Y(), nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove ); if( mpAlphaVDev ) - mpAlphaVDev->DrawTextLine( rPos, nWidth, eStrikeout, eUnderline, bUnderlineAbove ); + mpAlphaVDev->DrawTextLine( rPos, nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove ); } // ------------------------------------------------------------------------ @@ -6044,7 +6196,7 @@ bool OutputDevice::GetCaretPositions( const XubString& rStr, sal_Int32* pCaretXA } // handle window mirroring - if( ((OutputDevice*)this)->ImplHasMirroredGraphics() && IsRTLEnabled() ) + if( IsRTLEnabled() ) { for( i = 0; i < 2 * nLen; ++i ) pCaretXArray[i] = nWidth - pCaretXArray[i] - 1; @@ -6190,7 +6342,7 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( String& rStr, // SSA: hack for western office, ie text get right aligned // for debugging purposes of mirrored UI //static const char* pEnv = getenv( "SAL_RTL_MIRRORTEXT" ); - bool bRTLWindow = (((OutputDevice*)this)->ImplHasMirroredGraphics() && IsRTLEnabled()); + bool bRTLWindow = IsRTLEnabled(); bRightAlign ^= bRTLWindow; if( bRightAlign ) nLayoutFlags |= SAL_LAYOUT_RIGHT_ALIGN; @@ -7528,6 +7680,58 @@ FontMetric OutputDevice::GetFontMetric( const Font& rFont ) const // ----------------------------------------------------------------------- +long OutputDevice::GetMinKashida() const +{ + DBG_TRACE( "OutputDevice::GetMinKashida()" ); + DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); + if( mbNewFont && !ImplNewFont() ) + return 0; + + ImplFontEntry* pEntry = mpFontEntry; + ImplFontMetricData* pMetric = &(pEntry->maMetric); + return ImplDevicePixelToLogicWidth( pMetric->mnMinKashida ); +} +// ----------------------------------------------------------------------- + +long OutputDevice::GetMinKashida( const Font& rFont ) const +{ + // select font, query Kashida, select original font again + Font aOldFont = GetFont(); + const_cast<OutputDevice*>(this)->SetFont( rFont ); + long aKashida = GetMinKashida(); + const_cast<OutputDevice*>(this)->SetFont( aOldFont ); + return aKashida; +} + +// ----------------------------------------------------------------------- +xub_StrLen OutputDevice::ValidateKashidas ( const String& rTxt, + xub_StrLen nIdx, xub_StrLen nLen, + xub_StrLen nKashCount, + const xub_StrLen* pKashidaPos, + xub_StrLen* pKashidaPosDropped ) const +{ + // do layout + SalLayout* pSalLayout = ImplLayout( rTxt, nIdx, nLen ); + if( !pSalLayout ) + return 0; + xub_StrLen nDropped = 0; + for( int i = 0; i < nKashCount; ++i ) + { + if( !pSalLayout->IsKashidaPosValid( pKashidaPos[ i ] )) + { + pKashidaPosDropped[ nDropped ] = pKashidaPos [ i ]; + ++nDropped; + } + } + pSalLayout->Release(); + return nDropped; +} + + + +// ----------------------------------------------------------------------- + + // TODO: best is to get rid of this method completely ULONG OutputDevice::GetKerningPairCount() const { diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx index 03f2705e9ae9..d4c24ff44e20 100644 --- a/vcl/source/gdi/outdev6.cxx +++ b/vcl/source/gdi/outdev6.cxx @@ -166,6 +166,7 @@ void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, DBG_TRACE( "OutputDevice::DrawTransparent(B2D&,transparency)" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); +fprintf(stderr,"OD::DT( fT=%f, bAA=%d)\n",fTransparency,mnAntialiasing);//############## // AW: Do NOT paint empty PolyPolygons if(!rB2DPolyPoly.count()) return; @@ -185,11 +186,11 @@ void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, if( mbInitFillColor ) ImplInitFillColor(); - if(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) + if( (mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) != 0 + && mpGraphics->supportsOperation( OutDevSupport_B2DDraw ) ) { -#ifdef UNX // b2dpolygon support not implemented yet on non-UNX platforms - const ::basegfx::B2DHomMatrix aTransform = GetViewTransformation(); + const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation(); ::basegfx::B2DPolyPolygon aB2DPP = rB2DPolyPoly; aB2DPP.transform( aTransform ); @@ -208,7 +209,6 @@ void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, #endif return; } -#endif } // fallback to old polygon drawing if needed @@ -264,7 +264,12 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, // try hard to draw it directly, because the emulation layers are slower if( !pDisableNative - && mpGraphics->supportsOperation( OutDevSupport_B2DDraw ) ) + && mpGraphics->supportsOperation( OutDevSupport_B2DDraw ) +#ifdef WIN32 + // workaround bad dithering on remote displaying when using GDI+ with toolbar buttoin hilighting + && !rPolyPoly.IsRect() +#endif + ) { // prepare the graphics device if( mbInitClipRegion ) diff --git a/vcl/source/gdi/outmap.cxx b/vcl/source/gdi/outmap.cxx index 6ff1cf8ac706..dfa346dbab05 100644 --- a/vcl/source/gdi/outmap.cxx +++ b/vcl/source/gdi/outmap.cxx @@ -987,11 +987,11 @@ void OutputDevice::SetRelativeMapMode( const MapMode& rNewMapMode ) { if ( eOld > MAP_PIXEL ) { - DBG_ERRORFILE( "Not implemented MapUnit" ) + DBG_ERRORFILE( "Not implemented MapUnit" ); } else if ( eNew > MAP_PIXEL ) { - DBG_ERRORFILE( "Not implemented MapUnit" ) + DBG_ERRORFILE( "Not implemented MapUnit" ); } else { diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index 7aeb8a226835..9293ebf1aab2 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: pdfwriter.cxx,v $ - * $Revision: 1.24 $ + * $Revision: 1.24.134.1 $ * * This file is part of OpenOffice.org. * @@ -102,9 +102,10 @@ void PDFWriter::DrawTextLine( long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, + FontUnderline eOverline, BOOL bUnderlineAbove ) { - ((PDFWriterImpl*)pImplementation)->drawTextLine( rPos, nWidth, eStrikeout, eUnderline, bUnderlineAbove ); + ((PDFWriterImpl*)pImplementation)->drawTextLine( rPos, nWidth, eStrikeout, eUnderline, eOverline, bUnderlineAbove ); } void PDFWriter::DrawTextArray( @@ -405,6 +406,16 @@ void PDFWriter::SetTextLineColor( const Color& rColor ) ((PDFWriterImpl*)pImplementation)->setTextLineColor( rColor ); } +void PDFWriter::SetOverlineColor() +{ + ((PDFWriterImpl*)pImplementation)->setOverlineColor(); +} + +void PDFWriter::SetOverlineColor( const Color& rColor ) +{ + ((PDFWriterImpl*)pImplementation)->setOverlineColor( rColor ); +} + void PDFWriter::SetTextAlign( ::TextAlign eAlign ) { ((PDFWriterImpl*)pImplementation)->setTextAlign( eAlign ); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 987f8a3d275d..69f4674cae9c 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: pdfwriter_impl.cxx,v $ - * $Revision: 1.133.16.2 $ + * $Revision: 1.132.72.2 $ * * This file is part of OpenOffice.org. * @@ -1753,7 +1753,7 @@ inline void PDFWriterImpl::appendLiteralStringEncrypt( rtl::OStringBuffer& rInSt appendLiteralString( (const sal_Char*)m_pEncryptionBuffer, nChars, rOutBuffer ); } else - rOutBuffer.append( rInString.getStr(), nChars ); + appendLiteralString( rInString.getStr(), nChars , rOutBuffer ); rOutBuffer.append( ")" ); } @@ -4091,19 +4091,27 @@ we check in the following sequence: sal_Int32 nSetGoToRMode = 0; sal_Bool bTargetHasPDFExtension = sal_False; INetProtocol eTargetProtocol = aTargetURL.GetProtocol(); + sal_Bool bIsUNCPath = sal_False; // check if the protocol is a known one, or if there is no protocol at all (on target only) // if there is no protocol, make the target relative to the current document directory // getting the needed URL information from the current document path if( eTargetProtocol == INET_PROT_NOT_VALID ) { - INetURLObject aNewBase( aDocumentURL );//duplicate document URL - aNewBase.removeSegment(); //remove last segment from it, obtaining the base URL of the - //target document - aNewBase.insertName( rLink.m_aURL ); - aTargetURL = aNewBase;//reassign the new target URL + if( rLink.m_aURL.getLength() > 4 && rLink.m_aURL.compareToAscii( "\\\\\\\\", 4 ) == 0) + { + bIsUNCPath = sal_True; + } + else + { + INetURLObject aNewBase( aDocumentURL );//duplicate document URL + aNewBase.removeSegment(); //remove last segment from it, obtaining the base URL of the + //target document + aNewBase.insertName( rLink.m_aURL ); + aTargetURL = aNewBase;//reassign the new target URL //recompute the target protocol, with the new URL //normal URL processing resumes - eTargetProtocol = aTargetURL.GetProtocol(); + eTargetProtocol = aTargetURL.GetProtocol(); + } } rtl::OUString aFileExtension = aTargetURL.GetFileExtension(); @@ -4141,21 +4149,30 @@ we check in the following sequence: INetProtocol eBaseProtocol = aDocumentURL.GetProtocol(); //queue the string common to all types of actions aLine.append( "/A<</Type/Action/S"); - sal_Int32 nSetRelative = 0; + if( bIsUNCPath ) // handle Win UNC paths + { + aLine.append( "/Launch/Win<</F" ); + // INetURLObject is not good with UNC paths, use original path + appendLiteralStringEncrypt( rLink.m_aURL, rLink.m_nObject, aLine ); + aLine.append( ">>" ); + } + else + { + sal_Int32 nSetRelative = 0; //check if relative file link is requested and if the protocol is 'file://' - if( m_aContext.RelFsys && eBaseProtocol == eTargetProtocol && eTargetProtocol == INET_PROT_FILE ) - nSetRelative++; + if( m_aContext.RelFsys && eBaseProtocol == eTargetProtocol && eTargetProtocol == INET_PROT_FILE ) + nSetRelative++; - rtl::OUString aFragment = aTargetURL.GetMark( INetURLObject::NO_DECODE /*DECODE_WITH_CHARSET*/ ); //fragment as is, - if( nSetGoToRMode == 0 ) - switch( m_aContext.DefaultLinkAction ) - { - default: - case PDFWriter::URIAction : - case PDFWriter::URIActionDestination : - aLine.append( "/URI/URI" ); - break; - case PDFWriter::LaunchAction: + rtl::OUString aFragment = aTargetURL.GetMark( INetURLObject::NO_DECODE /*DECODE_WITH_CHARSET*/ ); //fragment as is, + if( nSetGoToRMode == 0 ) + switch( m_aContext.DefaultLinkAction ) + { + default: + case PDFWriter::URIAction : + case PDFWriter::URIActionDestination : + aLine.append( "/URI/URI" ); + break; + case PDFWriter::LaunchAction: // now: // if a launch action is requested and the hyperlink target has a fragment // and the target file does not have a pdf extension, or it's not a 'file:://' protocol @@ -4163,50 +4180,51 @@ we check in the following sequence: // This code will permit the correct opening of application on web pages, the one that // normally have fragments (but I may be wrong...) // and will force the use of URI when the protocol is not file:// - if( (aFragment.getLength() > 0 && !bTargetHasPDFExtension) || - eTargetProtocol != INET_PROT_FILE ) - aLine.append( "/URI/URI" ); - else - aLine.append( "/Launch/F" ); - break; - } + if( (aFragment.getLength() > 0 && !bTargetHasPDFExtension) || + eTargetProtocol != INET_PROT_FILE ) + aLine.append( "/URI/URI" ); + else + aLine.append( "/Launch/F" ); + break; + } //fragment are encoded in the same way as in the named destination processing - rtl::OUString aURLNoMark = aTargetURL.GetURLNoMark( INetURLObject::DECODE_WITH_CHARSET ); - if( nSetGoToRMode ) - {//add the fragment - aLine.append("/GoToR"); - aLine.append("/F"); - appendLiteralStringEncrypt( nSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURLNoMark, - INetURLObject::WAS_ENCODED, - INetURLObject::DECODE_WITH_CHARSET ) : - aURLNoMark, rLink.m_nObject, aLine ); - if( aFragment.getLength() > 0 ) - { - aLine.append("/D/"); - appendDestinationName( aFragment , aLine ); + rtl::OUString aURLNoMark = aTargetURL.GetURLNoMark( INetURLObject::DECODE_WITH_CHARSET ); + if( nSetGoToRMode ) + {//add the fragment + aLine.append("/GoToR"); + aLine.append("/F"); + appendLiteralStringEncrypt( nSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURLNoMark, + INetURLObject::WAS_ENCODED, + INetURLObject::DECODE_WITH_CHARSET ) : + aURLNoMark, rLink.m_nObject, aLine ); + if( aFragment.getLength() > 0 ) + { + aLine.append("/D/"); + appendDestinationName( aFragment , aLine ); + } } - } - else - { + else + { // change the fragment to accomodate the bookmark (only if the file extension is PDF and // the requested action is of the correct type) - if(m_aContext.DefaultLinkAction == PDFWriter::URIActionDestination && - bTargetHasPDFExtension && aFragment.getLength() > 0 ) - { - OStringBuffer aLineLoc( 1024 ); - appendDestinationName( aFragment , aLineLoc ); + if(m_aContext.DefaultLinkAction == PDFWriter::URIActionDestination && + bTargetHasPDFExtension && aFragment.getLength() > 0 ) + { + OStringBuffer aLineLoc( 1024 ); + appendDestinationName( aFragment , aLineLoc ); //substitute the fragment - aTargetURL.SetMark( aLineLoc.getStr() ); - } - rtl::OUString aURL = aTargetURL.GetMainURL( (nSetRelative || eTargetProtocol == INET_PROT_FILE) ? INetURLObject::DECODE_WITH_CHARSET : INetURLObject::NO_DECODE ); + aTargetURL.SetMark( aLineLoc.getStr() ); + } + rtl::OUString aURL = aTargetURL.GetMainURL( (nSetRelative || eTargetProtocol == INET_PROT_FILE) ? INetURLObject::DECODE_WITH_CHARSET : INetURLObject::NO_DECODE ); // check if we have a URL available, if the string is empty, set it as the original one // if( aURL.getLength() == 0 ) // appendLiteralStringEncrypt( rLink.m_aURL , rLink.m_nObject, aLine ); // else - appendLiteralStringEncrypt( nSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURL ) : - aURL , rLink.m_nObject, aLine ); - } + appendLiteralStringEncrypt( nSetRelative ? INetURLObject::GetRelURL( m_aContext.BaseURL, aURL ) : + aURL , rLink.m_nObject, aLine ); + } //<--- i56629 + } aLine.append( ">>\n" ); } if( rLink.m_nStructParent > 0 ) @@ -5196,6 +5214,8 @@ bool PDFWriterImpl::emitCatalog() sal_Int32 nStructureDict = 0; if(m_aStructure.size() > 1) { +///check if dummy structure containers are needed + addInternalStructureContainer(m_aStructure[0]); nStructureDict = m_aStructure[0].m_nObject = createObject(); emitStructure( m_aStructure[ 0 ] ); } @@ -6438,11 +6458,14 @@ void PDFWriterImpl::drawRelief( SalLayout& rLayout, const String& rText, bool bT Color aTextColor = m_aCurrentPDFState.m_aFont.GetColor(); Color aTextLineColor = m_aCurrentPDFState.m_aTextLineColor; + Color aOverlineColor = m_aCurrentPDFState.m_aOverlineColor; Color aReliefColor( COL_LIGHTGRAY ); if( aTextColor == COL_BLACK ) aTextColor = Color( COL_WHITE ); if( aTextLineColor == COL_BLACK ) aTextLineColor = Color( COL_WHITE ); + if( aOverlineColor == COL_BLACK ) + aOverlineColor = Color( COL_WHITE ); if( aTextColor == COL_WHITE ) aReliefColor = Color( COL_BLACK ); @@ -6451,7 +6474,8 @@ void PDFWriterImpl::drawRelief( SalLayout& rLayout, const String& rText, bool bT aSetFont.SetShadow( FALSE ); aSetFont.SetColor( aReliefColor ); - setTextLineColor( aTextLineColor ); + setTextLineColor( aReliefColor ); + setOverlineColor( aReliefColor ); setFont( aSetFont ); long nOff = 1 + getReferenceDevice()->mnDPIX/300; if( eRelief == RELIEF_ENGRAVED ) @@ -6463,6 +6487,7 @@ void PDFWriterImpl::drawRelief( SalLayout& rLayout, const String& rText, bool bT rLayout.DrawOffset() -= Point( nOff, nOff ); setTextLineColor( aTextLineColor ); + setOverlineColor( aOverlineColor ); aSetFont.SetColor( aTextColor ); setFont( aSetFont ); updateGraphicsState(); @@ -6476,6 +6501,7 @@ void PDFWriterImpl::drawShadow( SalLayout& rLayout, const String& rText, bool bT { Font aSaveFont = m_aCurrentPDFState.m_aFont; Color aSaveTextLineColor = m_aCurrentPDFState.m_aTextLineColor; + Color aSaveOverlineColor = m_aCurrentPDFState.m_aOverlineColor; Font& rFont = m_aCurrentPDFState.m_aFont; if( rFont.GetColor() == Color( COL_BLACK ) || rFont.GetColor().GetLuminance() < 8 ) @@ -6486,6 +6512,7 @@ void PDFWriterImpl::drawShadow( SalLayout& rLayout, const String& rText, bool bT rFont.SetOutline( FALSE ); setFont( rFont ); setTextLineColor( rFont.GetColor() ); + setOverlineColor( rFont.GetColor() ); updateGraphicsState(); long nOff = 1 + ((m_pReferenceDevice->mpFontEntry->mnLineHeight-24)/24); @@ -6497,6 +6524,7 @@ void PDFWriterImpl::drawShadow( SalLayout& rLayout, const String& rText, bool bT setFont( aSaveFont ); setTextLineColor( aSaveTextLineColor ); + setOverlineColor( aSaveOverlineColor ); updateGraphicsState(); } @@ -6888,9 +6916,11 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT // draw eventual textlines FontStrikeout eStrikeout = m_aCurrentPDFState.m_aFont.GetStrikeout(); FontUnderline eUnderline = m_aCurrentPDFState.m_aFont.GetUnderline(); + FontUnderline eOverline = m_aCurrentPDFState.m_aFont.GetOverline(); if( bTextLines && ( ( eUnderline != UNDERLINE_NONE && eUnderline != UNDERLINE_DONTKNOW ) || + ( eOverline != UNDERLINE_NONE && eOverline != UNDERLINE_DONTKNOW ) || ( eStrikeout != STRIKEOUT_NONE && eStrikeout != STRIKEOUT_DONTKNOW ) ) ) @@ -6917,7 +6947,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT { drawTextLine( m_pReferenceDevice->PixelToLogic( aStartPt ), m_pReferenceDevice->ImplDevicePixelToLogicWidth( nWidth ), - eStrikeout, eUnderline, bUnderlineAbove ); + eStrikeout, eUnderline, eOverline, bUnderlineAbove ); nWidth = 0; } } @@ -6926,7 +6956,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT { drawTextLine( m_pReferenceDevice->PixelToLogic( aStartPt ), m_pReferenceDevice->ImplDevicePixelToLogicWidth( nWidth ), - eStrikeout, eUnderline, bUnderlineAbove ); + eStrikeout, eUnderline, eOverline, bUnderlineAbove ); } } else @@ -6935,7 +6965,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const String& rText, bool bT int nWidth = rLayout.GetTextWidth() / rLayout.GetUnitsPerPixel(); drawTextLine( m_pReferenceDevice->PixelToLogic( aStartPt ), m_pReferenceDevice->ImplDevicePixelToLogicWidth( nWidth ), - eStrikeout, eUnderline, bUnderlineAbove ); + eStrikeout, eUnderline, eOverline, bUnderlineAbove ); } } @@ -7344,188 +7374,96 @@ void PDFWriterImpl::drawWaveLine( const Point& rStart, const Point& rStop, sal_I #define WCONV( x ) m_pReferenceDevice->ImplDevicePixelToLogicWidth( x ) #define HCONV( x ) m_pReferenceDevice->ImplDevicePixelToLogicHeight( x ) -void PDFWriterImpl::drawTextLine( const Point& rPos, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, bool bUnderlineAbove ) +void PDFWriterImpl::drawWaveTextLine( OStringBuffer& aLine, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove ) { - if ( !nWidth || - ( ((eStrikeout == STRIKEOUT_NONE)||(eStrikeout == STRIKEOUT_DONTKNOW)) && - ((eUnderline == UNDERLINE_NONE)||(eUnderline == UNDERLINE_DONTKNOW)) ) ) - return; - - MARK( "drawTextLine" ); - updateGraphicsState(); - // note: units in pFontEntry are ref device pixel ImplFontEntry* pFontEntry = m_pReferenceDevice->mpFontEntry; - Color aUnderlineColor = m_aCurrentPDFState.m_aTextLineColor; - Color aStrikeoutColor = m_aCurrentPDFState.m_aFont.GetColor(); long nLineHeight = 0; long nLinePos = 0; - long nLinePos2 = 0; - bool bNormalLines = true; - if ( bNormalLines && - ((eStrikeout == STRIKEOUT_SLASH) || (eStrikeout == STRIKEOUT_X)) ) - { - String aStrikeoutChar = String::CreateFromAscii( eStrikeout == STRIKEOUT_SLASH ? "/" : "X" ); - String aStrikeout = aStrikeoutChar; - while( m_pReferenceDevice->GetTextWidth( aStrikeout ) < nWidth ) - aStrikeout.Append( aStrikeout ); - - // do not get broader than nWidth modulo 1 character - while( m_pReferenceDevice->GetTextWidth( aStrikeout ) >= nWidth ) - aStrikeout.Erase( 0, 1 ); - aStrikeout.Append( aStrikeoutChar ); - BOOL bShadow = m_aCurrentPDFState.m_aFont.IsShadow(); - if( bShadow ) - { - Font aFont = m_aCurrentPDFState.m_aFont; - aFont.SetShadow( FALSE ); - setFont( aFont ); - updateGraphicsState(); - } - - // strikeout string is left aligned non-CTL text - ULONG nOrigTLM = m_pReferenceDevice->GetLayoutMode(); - m_pReferenceDevice->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG|TEXT_LAYOUT_COMPLEX_DISABLED ); - drawText( rPos, aStrikeout, 0, aStrikeout.Len(), false ); - m_pReferenceDevice->SetLayoutMode( nOrigTLM ); - - if( bShadow ) - { - Font aFont = m_aCurrentPDFState.m_aFont; - aFont.SetShadow( TRUE ); - setFont( aFont ); - updateGraphicsState(); - } + appendStrokingColor( aColor, aLine ); + aLine.append( "\n" ); - switch( eUnderline ) - { - case UNDERLINE_NONE: - case UNDERLINE_DONTKNOW: - case UNDERLINE_SMALLWAVE: - case UNDERLINE_WAVE: - case UNDERLINE_DOUBLEWAVE: - case UNDERLINE_BOLDWAVE: - { - bNormalLines = FALSE; - } - break; - default: - { - ; // No gcc warning - } - } + if ( bIsAbove ) + { + if ( !pFontEntry->maMetric.mnAboveWUnderlineSize ) + m_pReferenceDevice->ImplInitAboveTextLineSize(); + nLineHeight = HCONV( pFontEntry->maMetric.mnAboveWUnderlineSize ); + nLinePos = HCONV( pFontEntry->maMetric.mnAboveWUnderlineOffset ); } + else + { + if ( !pFontEntry->maMetric.mnWUnderlineSize ) + m_pReferenceDevice->ImplInitTextLineSize(); + nLineHeight = HCONV( pFontEntry->maMetric.mnWUnderlineSize ); + nLinePos = HCONV( pFontEntry->maMetric.mnWUnderlineOffset ); + } + if ( (eTextLine == UNDERLINE_SMALLWAVE) && (nLineHeight > 3) ) + nLineHeight = 3; - Point aPos( rPos ); - TextAlign eAlign = m_aCurrentPDFState.m_aFont.GetAlign(); - if( eAlign == ALIGN_TOP ) - aPos.Y() += HCONV( pFontEntry->maMetric.mnAscent ); - else if( eAlign == ALIGN_BOTTOM ) - aPos.Y() -= HCONV( pFontEntry->maMetric.mnDescent ); - - OStringBuffer aLine( 512 ); - // save GS - aLine.append( "q " ); + long nLineWidth = getReferenceDevice()->mnDPIX/450; + if ( ! nLineWidth ) + nLineWidth = 1; - // rotate and translate matrix - double fAngle = (double)m_aCurrentPDFState.m_aFont.GetOrientation() * M_PI / 1800.0; - Matrix3 aMat; - aMat.rotate( fAngle ); - aMat.translate( aPos.X(), aPos.Y() ); - aMat.append( m_aPages.back(), aLine ); - aLine.append( " cm\n" ); + if ( eTextLine == UNDERLINE_BOLDWAVE ) + nLineWidth = 3*nLineWidth; - if ( aUnderlineColor.GetTransparency() != 0 ) - aUnderlineColor = aStrikeoutColor; + m_aPages.back().appendMappedLength( (sal_Int32)nLineWidth, aLine ); + aLine.append( " w " ); - if ( (eUnderline == UNDERLINE_SMALLWAVE) || - (eUnderline == UNDERLINE_WAVE) || - (eUnderline == UNDERLINE_DOUBLEWAVE) || - (eUnderline == UNDERLINE_BOLDWAVE) ) + if ( eTextLine == UNDERLINE_DOUBLEWAVE ) { - appendStrokingColor( aUnderlineColor, aLine ); - aLine.append( "\n" ); - - if ( bUnderlineAbove ) + long nOrgLineHeight = nLineHeight; + nLineHeight /= 3; + if ( nLineHeight < 2 ) { - if ( !pFontEntry->maMetric.mnAboveWUnderlineSize ) - m_pReferenceDevice->ImplInitAboveTextLineSize(); - nLinePos = HCONV( pFontEntry->maMetric.mnAboveWUnderlineOffset ); - nLineHeight = HCONV( pFontEntry->maMetric.mnAboveWUnderlineSize ); - } - else - { - if ( !pFontEntry->maMetric.mnWUnderlineSize ) - m_pReferenceDevice->ImplInitTextLineSize(); - nLinePos = HCONV( pFontEntry->maMetric.mnWUnderlineOffset ); - nLineHeight = HCONV( pFontEntry->maMetric.mnWUnderlineSize ); - + if ( nOrgLineHeight > 1 ) + nLineHeight = 2; + else + nLineHeight = 1; } - if ( (eUnderline == UNDERLINE_SMALLWAVE) && - (nLineHeight > 3) ) - nLineHeight = 3; + long nLineDY = nOrgLineHeight-(nLineHeight*2); + if ( nLineDY < nLineWidth ) + nLineDY = nLineWidth; + long nLineDY2 = nLineDY/2; + if ( !nLineDY2 ) + nLineDY2 = 1; - long nLineWidth = getReferenceDevice()->mnDPIX/450; - if( ! nLineWidth ) - nLineWidth = 1; + nLinePos -= nLineWidth-nLineDY2; - if ( eUnderline == UNDERLINE_BOLDWAVE ) - nLineWidth = 3*nLineWidth; + m_aPages.back().appendWaveLine( nWidth, -nLinePos, 2*nLineHeight, aLine ); - m_aPages.back().appendMappedLength( (sal_Int32)nLineWidth, aLine ); - aLine.append( " w " ); - - if ( eUnderline == UNDERLINE_DOUBLEWAVE ) - { - long nOrgLineHeight = nLineHeight; - nLineHeight /= 3; - if ( nLineHeight < 2 ) - { - if ( nOrgLineHeight > 1 ) - nLineHeight = 2; - else - nLineHeight = 1; - } - long nLineDY = nOrgLineHeight-(nLineHeight*2); - if ( nLineDY < nLineWidth ) - nLineDY = nLineWidth; - long nLineDY2 = nLineDY/2; - if ( !nLineDY2 ) - nLineDY2 = 1; - - nLinePos -= nLineWidth-nLineDY2; - - m_aPages.back().appendWaveLine( nWidth, -nLinePos, 2*nLineHeight, aLine ); + nLinePos += nLineWidth+nLineDY; + m_aPages.back().appendWaveLine( nWidth, -nLinePos, 2*nLineHeight, aLine ); + } + else + { + if ( eTextLine != UNDERLINE_BOLDWAVE ) + nLinePos -= nLineWidth/2; + m_aPages.back().appendWaveLine( nWidth, -nLinePos, nLineHeight, aLine ); + } +} - nLinePos += nLineWidth+nLineDY; - m_aPages.back().appendWaveLine( nWidth, -nLinePos, 2*nLineHeight, aLine ); - } - else - { - if( eUnderline != UNDERLINE_BOLDWAVE ) - nLinePos -= nLineWidth/2; - m_aPages.back().appendWaveLine( nWidth, -nLinePos, nLineHeight, aLine ); - } +void PDFWriterImpl::drawStraightTextLine( OStringBuffer& aLine, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove ) +{ + // note: units in pFontEntry are ref device pixel + ImplFontEntry* pFontEntry = m_pReferenceDevice->mpFontEntry; + long nLineHeight = 0; + long nLinePos = 0; + long nLinePos2 = 0; - if ( (eStrikeout == STRIKEOUT_NONE) || - (eStrikeout == STRIKEOUT_DONTKNOW) ) - bNormalLines = false; - } + if ( eTextLine > UNDERLINE_BOLDWAVE ) + eTextLine = UNDERLINE_SINGLE; - if ( bNormalLines ) + switch ( eTextLine ) { - if ( eUnderline > UNDERLINE_BOLDWAVE ) - eUnderline = UNDERLINE_SINGLE; - - if ( (eUnderline == UNDERLINE_SINGLE) || - (eUnderline == UNDERLINE_DOTTED) || - (eUnderline == UNDERLINE_DASH) || - (eUnderline == UNDERLINE_LONGDASH) || - (eUnderline == UNDERLINE_DASHDOT) || - (eUnderline == UNDERLINE_DASHDOTDOT) ) - { - if ( bUnderlineAbove ) + case UNDERLINE_SINGLE: + case UNDERLINE_DOTTED: + case UNDERLINE_DASH: + case UNDERLINE_LONGDASH: + case UNDERLINE_DASHDOT: + case UNDERLINE_DASHDOTDOT: + if ( bIsAbove ) { if ( !pFontEntry->maMetric.mnAboveUnderlineSize ) m_pReferenceDevice->ImplInitAboveTextLineSize(); @@ -7539,16 +7477,14 @@ void PDFWriterImpl::drawTextLine( const Point& rPos, long nWidth, FontStrikeout nLineHeight = HCONV( pFontEntry->maMetric.mnUnderlineSize ); nLinePos = HCONV( pFontEntry->maMetric.mnUnderlineOffset ); } - } - else if ( (eUnderline == UNDERLINE_BOLD) || - (eUnderline == UNDERLINE_BOLDDOTTED) || - (eUnderline == UNDERLINE_BOLDDASH) || - - (eUnderline == UNDERLINE_BOLDLONGDASH) || - (eUnderline == UNDERLINE_BOLDDASHDOT) || - (eUnderline == UNDERLINE_BOLDDASHDOTDOT) ) - { - if ( bUnderlineAbove ) + break; + case UNDERLINE_BOLD: + case UNDERLINE_BOLDDOTTED: + case UNDERLINE_BOLDDASH: + case UNDERLINE_BOLDLONGDASH: + case UNDERLINE_BOLDDASHDOT: + case UNDERLINE_BOLDDASHDOTDOT: + if ( bIsAbove ) { if ( !pFontEntry->maMetric.mnAboveBUnderlineSize ) m_pReferenceDevice->ImplInitAboveTextLineSize(); @@ -7563,10 +7499,9 @@ void PDFWriterImpl::drawTextLine( const Point& rPos, long nWidth, FontStrikeout nLinePos = HCONV( pFontEntry->maMetric.mnBUnderlineOffset ); nLinePos += nLineHeight/2; } - } - else if ( eUnderline == UNDERLINE_DOUBLE ) - { - if ( bUnderlineAbove ) + break; + case UNDERLINE_DOUBLE: + if ( bIsAbove ) { if ( !pFontEntry->maMetric.mnAboveDUnderlineSize ) m_pReferenceDevice->ImplInitAboveTextLineSize(); @@ -7582,152 +7517,282 @@ void PDFWriterImpl::drawTextLine( const Point& rPos, long nWidth, FontStrikeout nLinePos = HCONV( pFontEntry->maMetric.mnDUnderlineOffset1 ); nLinePos2 = HCONV( pFontEntry->maMetric.mnDUnderlineOffset2 ); } - } - else - nLineHeight = 0; - - if ( nLineHeight ) - { - m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, true ); - aLine.append( " w " ); - appendStrokingColor( aUnderlineColor, aLine ); - aLine.append( "\n" ); - - if ( (eUnderline == UNDERLINE_DOTTED) || - (eUnderline == UNDERLINE_BOLDDOTTED) ) - { - aLine.append( "[ " ); - m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false ); - aLine.append( " ] 0 d\n" ); - } - else if ( (eUnderline == UNDERLINE_DASH) || - (eUnderline == UNDERLINE_LONGDASH) || - (eUnderline == UNDERLINE_BOLDDASH) || - (eUnderline == UNDERLINE_BOLDLONGDASH) ) - { - sal_Int32 nDashLength = 4*nLineHeight; - sal_Int32 nVoidLength = 2*nLineHeight; - if ( ( eUnderline == UNDERLINE_LONGDASH ) || ( eUnderline == UNDERLINE_BOLDLONGDASH ) ) - nDashLength = 8*nLineHeight; + default: + break; + } - aLine.append( "[ " ); - m_aPages.back().appendMappedLength( nDashLength, aLine, false ); - aLine.append( ' ' ); - m_aPages.back().appendMappedLength( nVoidLength, aLine, false ); - aLine.append( " ] 0 d\n" ); - } - else if ( (eUnderline == UNDERLINE_DASHDOT) || - (eUnderline == UNDERLINE_BOLDDASHDOT) ) - { - sal_Int32 nDashLength = 4*nLineHeight; - sal_Int32 nVoidLength = 2*nLineHeight; - aLine.append( "[ " ); - m_aPages.back().appendMappedLength( nDashLength, aLine, false ); - aLine.append( ' ' ); - m_aPages.back().appendMappedLength( nVoidLength, aLine, false ); - aLine.append( ' ' ); - m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false ); - aLine.append( ' ' ); - m_aPages.back().appendMappedLength( nVoidLength, aLine, false ); - aLine.append( " ] 0 d\n" ); - } - else if ( (eUnderline == UNDERLINE_DASHDOTDOT) || + if ( nLineHeight ) + { + m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, true ); + aLine.append( " w " ); + appendStrokingColor( aColor, aLine ); + aLine.append( "\n" ); - (eUnderline == UNDERLINE_BOLDDASHDOTDOT) ) - { - sal_Int32 nDashLength = 4*nLineHeight; - sal_Int32 nVoidLength = 2*nLineHeight; + switch ( eTextLine ) + { + case UNDERLINE_DOTTED: + case UNDERLINE_BOLDDOTTED: aLine.append( "[ " ); - m_aPages.back().appendMappedLength( nDashLength, aLine, false ); - aLine.append( ' ' ); - m_aPages.back().appendMappedLength( nVoidLength, aLine, false ); - aLine.append( ' ' ); m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false ); - aLine.append( ' ' ); - m_aPages.back().appendMappedLength( nVoidLength, aLine, false ); - aLine.append( ' ' ); - m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false ); - aLine.append( ' ' ); - m_aPages.back().appendMappedLength( nVoidLength, aLine, false ); aLine.append( " ] 0 d\n" ); - } + break; + case UNDERLINE_DASH: + case UNDERLINE_LONGDASH: + case UNDERLINE_BOLDDASH: + case UNDERLINE_BOLDLONGDASH: + { + sal_Int32 nDashLength = 4*nLineHeight; + sal_Int32 nVoidLength = 2*nLineHeight; + if ( ( eTextLine == UNDERLINE_LONGDASH ) || ( eTextLine == UNDERLINE_BOLDLONGDASH ) ) + nDashLength = 8*nLineHeight; + + aLine.append( "[ " ); + m_aPages.back().appendMappedLength( nDashLength, aLine, false ); + aLine.append( ' ' ); + m_aPages.back().appendMappedLength( nVoidLength, aLine, false ); + aLine.append( " ] 0 d\n" ); + } + break; + case UNDERLINE_DASHDOT: + case UNDERLINE_BOLDDASHDOT: + { + sal_Int32 nDashLength = 4*nLineHeight; + sal_Int32 nVoidLength = 2*nLineHeight; + aLine.append( "[ " ); + m_aPages.back().appendMappedLength( nDashLength, aLine, false ); + aLine.append( ' ' ); + m_aPages.back().appendMappedLength( nVoidLength, aLine, false ); + aLine.append( ' ' ); + m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false ); + aLine.append( ' ' ); + m_aPages.back().appendMappedLength( nVoidLength, aLine, false ); + aLine.append( " ] 0 d\n" ); + } + break; + case UNDERLINE_DASHDOTDOT: + case UNDERLINE_BOLDDASHDOTDOT: + { + sal_Int32 nDashLength = 4*nLineHeight; + sal_Int32 nVoidLength = 2*nLineHeight; + aLine.append( "[ " ); + m_aPages.back().appendMappedLength( nDashLength, aLine, false ); + aLine.append( ' ' ); + m_aPages.back().appendMappedLength( nVoidLength, aLine, false ); + aLine.append( ' ' ); + m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false ); + aLine.append( ' ' ); + m_aPages.back().appendMappedLength( nVoidLength, aLine, false ); + aLine.append( ' ' ); + m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, false ); + aLine.append( ' ' ); + m_aPages.back().appendMappedLength( nVoidLength, aLine, false ); + aLine.append( " ] 0 d\n" ); + } + break; + default: + break; + } + aLine.append( "0 " ); + m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine, true ); + aLine.append( " m " ); + m_aPages.back().appendMappedLength( (sal_Int32)nWidth, aLine, false ); + aLine.append( ' ' ); + m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine, true ); + aLine.append( " l S\n" ); + if ( eTextLine == UNDERLINE_DOUBLE ) + { aLine.append( "0 " ); - m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine, true ); + m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine, true ); aLine.append( " m " ); m_aPages.back().appendMappedLength( (sal_Int32)nWidth, aLine, false ); aLine.append( ' ' ); - m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine, true ); + m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine, true ); aLine.append( " l S\n" ); - if ( eUnderline == UNDERLINE_DOUBLE ) - { - aLine.append( "0 " ); - m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine, true ); - aLine.append( " m " ); - m_aPages.back().appendMappedLength( (sal_Int32)nWidth, aLine, false ); - aLine.append( ' ' ); - m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine, true ); - aLine.append( " l S\n" ); - } } + } +} - if ( eStrikeout > STRIKEOUT_X ) - eStrikeout = STRIKEOUT_SINGLE; +void PDFWriterImpl::drawStrikeoutLine( OStringBuffer& aLine, long nWidth, FontStrikeout eStrikeout, Color aColor ) +{ + // note: units in pFontEntry are ref device pixel + ImplFontEntry* pFontEntry = m_pReferenceDevice->mpFontEntry; + long nLineHeight = 0; + long nLinePos = 0; + long nLinePos2 = 0; - if ( eStrikeout == STRIKEOUT_SINGLE ) - { + if ( eStrikeout > STRIKEOUT_X ) + eStrikeout = STRIKEOUT_SINGLE; + + switch ( eStrikeout ) + { + case STRIKEOUT_SINGLE: if ( !pFontEntry->maMetric.mnStrikeoutSize ) m_pReferenceDevice->ImplInitTextLineSize(); nLineHeight = HCONV( pFontEntry->maMetric.mnStrikeoutSize ); nLinePos = HCONV( pFontEntry->maMetric.mnStrikeoutOffset ); - } - else if ( eStrikeout == STRIKEOUT_BOLD ) - { + break; + case STRIKEOUT_BOLD: if ( !pFontEntry->maMetric.mnBStrikeoutSize ) m_pReferenceDevice->ImplInitTextLineSize(); nLineHeight = HCONV( pFontEntry->maMetric.mnBStrikeoutSize ); nLinePos = HCONV( pFontEntry->maMetric.mnBStrikeoutOffset ); - - } - else if ( eStrikeout == STRIKEOUT_DOUBLE ) - { + break; + case STRIKEOUT_DOUBLE: if ( !pFontEntry->maMetric.mnDStrikeoutSize ) m_pReferenceDevice->ImplInitTextLineSize(); nLineHeight = HCONV( pFontEntry->maMetric.mnDStrikeoutSize ); nLinePos = HCONV( pFontEntry->maMetric.mnDStrikeoutOffset1 ); nLinePos2 = HCONV( pFontEntry->maMetric.mnDStrikeoutOffset2 ); - } - else - nLineHeight = 0; + break; + default: + break; + } - if ( nLineHeight ) - { - m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, true ); - aLine.append( " w " ); - appendStrokingColor( aStrikeoutColor, aLine ); - aLine.append( "\n" ); + if ( nLineHeight ) + { + m_aPages.back().appendMappedLength( (sal_Int32)nLineHeight, aLine, true ); + aLine.append( " w " ); + appendStrokingColor( aColor, aLine ); + aLine.append( "\n" ); + aLine.append( "0 " ); + m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine, true ); + aLine.append( " m " ); + m_aPages.back().appendMappedLength( (sal_Int32)nWidth, aLine, true ); + aLine.append( ' ' ); + m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine, true ); + aLine.append( " l S\n" ); + + if ( eStrikeout == STRIKEOUT_DOUBLE ) + { aLine.append( "0 " ); - m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine, true ); + m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine, true ); aLine.append( " m " ); m_aPages.back().appendMappedLength( (sal_Int32)nWidth, aLine, true ); aLine.append( ' ' ); - m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos), aLine, true ); + m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine, true ); aLine.append( " l S\n" ); + } + } +} - if ( eStrikeout == STRIKEOUT_DOUBLE ) - { - aLine.append( "0 " ); - m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine, true ); - aLine.append( " m " ); - m_aPages.back().appendMappedLength( (sal_Int32)nWidth, aLine, true ); - aLine.append( ' ' ); - m_aPages.back().appendMappedLength( (sal_Int32)(-nLinePos2-nLineHeight), aLine, true ); - aLine.append( " l S\n" ); +void PDFWriterImpl::drawStrikeoutChar( const Point& rPos, long nWidth, FontStrikeout eStrikeout ) +{ + String aStrikeoutChar = String::CreateFromAscii( eStrikeout == STRIKEOUT_SLASH ? "/" : "X" ); + String aStrikeout = aStrikeoutChar; + while( m_pReferenceDevice->GetTextWidth( aStrikeout ) < nWidth ) + aStrikeout.Append( aStrikeout ); - } - } + // do not get broader than nWidth modulo 1 character + while( m_pReferenceDevice->GetTextWidth( aStrikeout ) >= nWidth ) + aStrikeout.Erase( 0, 1 ); + aStrikeout.Append( aStrikeoutChar ); + BOOL bShadow = m_aCurrentPDFState.m_aFont.IsShadow(); + if ( bShadow ) + { + Font aFont = m_aCurrentPDFState.m_aFont; + aFont.SetShadow( FALSE ); + setFont( aFont ); + updateGraphicsState(); + } + + // strikeout string is left aligned non-CTL text + ULONG nOrigTLM = m_pReferenceDevice->GetLayoutMode(); + m_pReferenceDevice->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG|TEXT_LAYOUT_COMPLEX_DISABLED ); + drawText( rPos, aStrikeout, 0, aStrikeout.Len(), false ); + m_pReferenceDevice->SetLayoutMode( nOrigTLM ); + + if ( bShadow ) + { + Font aFont = m_aCurrentPDFState.m_aFont; + aFont.SetShadow( TRUE ); + setFont( aFont ); + updateGraphicsState(); + } +} + +void PDFWriterImpl::drawTextLine( const Point& rPos, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, bool bUnderlineAbove ) +{ + if ( !nWidth || + ( ((eStrikeout == STRIKEOUT_NONE)||(eStrikeout == STRIKEOUT_DONTKNOW)) && + ((eUnderline == UNDERLINE_NONE)||(eUnderline == UNDERLINE_DONTKNOW)) && + ((eOverline == UNDERLINE_NONE)||(eOverline == UNDERLINE_DONTKNOW)) ) ) + return; + + MARK( "drawTextLine" ); + updateGraphicsState(); + + // note: units in pFontEntry are ref device pixel + ImplFontEntry* pFontEntry = m_pReferenceDevice->mpFontEntry; + Color aUnderlineColor = m_aCurrentPDFState.m_aTextLineColor; + Color aOverlineColor = m_aCurrentPDFState.m_aOverlineColor; + Color aStrikeoutColor = m_aCurrentPDFState.m_aFont.GetColor(); + bool bStrikeoutDone = false; + bool bUnderlineDone = false; + bool bOverlineDone = false; + + if ( (eStrikeout == STRIKEOUT_SLASH) || (eStrikeout == STRIKEOUT_X) ) + { + drawStrikeoutChar( rPos, nWidth, eStrikeout ); + bStrikeoutDone = true; + } + + Point aPos( rPos ); + TextAlign eAlign = m_aCurrentPDFState.m_aFont.GetAlign(); + if( eAlign == ALIGN_TOP ) + aPos.Y() += HCONV( pFontEntry->maMetric.mnAscent ); + else if( eAlign == ALIGN_BOTTOM ) + aPos.Y() -= HCONV( pFontEntry->maMetric.mnDescent ); + + OStringBuffer aLine( 512 ); + // save GS + aLine.append( "q " ); + + // rotate and translate matrix + double fAngle = (double)m_aCurrentPDFState.m_aFont.GetOrientation() * M_PI / 1800.0; + Matrix3 aMat; + aMat.rotate( fAngle ); + aMat.translate( aPos.X(), aPos.Y() ); + aMat.append( m_aPages.back(), aLine ); + aLine.append( " cm\n" ); + + if ( aUnderlineColor.GetTransparency() != 0 ) + aUnderlineColor = aStrikeoutColor; + + if ( (eUnderline == UNDERLINE_SMALLWAVE) || + (eUnderline == UNDERLINE_WAVE) || + (eUnderline == UNDERLINE_DOUBLEWAVE) || + (eUnderline == UNDERLINE_BOLDWAVE) ) + { + drawWaveTextLine( aLine, nWidth, eUnderline, aUnderlineColor, bUnderlineAbove ); + bUnderlineDone = true; + } + + if ( (eOverline == UNDERLINE_SMALLWAVE) || + (eOverline == UNDERLINE_WAVE) || + (eOverline == UNDERLINE_DOUBLEWAVE) || + (eOverline == UNDERLINE_BOLDWAVE) ) + { + drawWaveTextLine( aLine, nWidth, eOverline, aOverlineColor, true ); + bOverlineDone = true; + } + + if ( !bUnderlineDone ) + { + drawStraightTextLine( aLine, nWidth, eUnderline, aUnderlineColor, bUnderlineAbove ); } + + if ( !bOverlineDone ) + { + drawStraightTextLine( aLine, nWidth, eOverline, aOverlineColor, true ); + } + + if ( !bStrikeoutDone ) + { + drawStrikeoutLine( aLine, nWidth, eStrikeout, aStrikeoutColor ); + } + aLine.append( "Q\n" ); writeBuffer( aLine.getStr(), aLine.getLength() ); } @@ -9021,7 +9086,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) { aLine.append( "[ /Indexed/DeviceRGB " ); aLine.append( (sal_Int32)(pAccess->GetPaletteEntryCount()-1) ); - aLine.append( " <\n" ); + aLine.append( "\n<" ); if( m_aContext.Encrypt ) { enableStringEncryption( rObject.m_nObject ); @@ -9046,14 +9111,10 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) appendHex(m_pEncryptionBuffer[nChar++], aLine ); appendHex(m_pEncryptionBuffer[nChar++], aLine ); appendHex(m_pEncryptionBuffer[nChar++], aLine ); - if( (i+1) & 15 ) - aLine.append( ' ' ); - else - aLine.append( "\n" ); } } } - else //no encryption requested + else //no encryption requested (PDF/A-1a program flow drops here) { for( USHORT i = 0; i < pAccess->GetPaletteEntryCount(); i++ ) { @@ -9061,13 +9122,9 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) appendHex( rColor.GetRed(), aLine ); appendHex( rColor.GetGreen(), aLine ); appendHex( rColor.GetBlue(), aLine ); - if( (i+1) & 15 ) - aLine.append( ' ' ); - else - aLine.append( "\n" ); } } - aLine.append( "> ]\n" ); + aLine.append( ">\n]\n" ); } } else @@ -9960,6 +10017,8 @@ void PDFWriterImpl::pop() rOld.m_aClipRegion = aState.m_aClipRegion; if( ! (aState.m_nFlags & PUSH_TEXTLINECOLOR ) ) setTextLineColor( aState.m_aTextLineColor ); + if( ! (aState.m_nFlags & PUSH_OVERLINECOLOR ) ) + setOverlineColor( aState.m_aOverlineColor ); if( ! (aState.m_nFlags & PUSH_TEXTALIGN ) ) setTextAlign( aState.m_aFont.GetAlign() ); if( ! (aState.m_nFlags & PUSH_TEXTFILLCOLOR) ) @@ -10117,27 +10176,6 @@ sal_Int32 PDFWriterImpl::setLinkDest( sal_Int32 nLinkId, sal_Int32 nDestId ) return 0; } -static OUString escapeStringLiteral( const OUString& rStr ) -{ - OUStringBuffer aBuf( rStr.getLength()*2 ); - const sal_Unicode* pUni = rStr.getStr(); - int nLen = rStr.getLength(); - for( ; nLen; nLen--, pUni++ ) - { - switch( *pUni ) - { - case sal_Unicode(')'): - case sal_Unicode('('): - case sal_Unicode('\\'): - aBuf.append( sal_Unicode( '\\' ) ); - default: - aBuf.append( *pUni ); - break; - } - } - return aBuf.makeStringAndClear(); -} - sal_Int32 PDFWriterImpl::setLinkURL( sal_Int32 nLinkId, const OUString& rURL ) { if( nLinkId < 0 || nLinkId >= (sal_Int32)m_aLinks.size() ) @@ -10163,7 +10201,7 @@ sal_Int32 PDFWriterImpl::setLinkURL( sal_Int32 nLinkId, const OUString& rURL ) if (m_xTrans.is()) m_xTrans->parseStrict( aURL ); - m_aLinks[ nLinkId ].m_aURL = escapeStringLiteral( aURL.Complete ); + m_aLinks[ nLinkId ].m_aURL = aURL.Complete; return 0; } @@ -10501,6 +10539,108 @@ void PDFWriterImpl::endStructureElement() #endif } +//---> i94258 +/* + * This function adds an internal structure list container to overcome the 8191 elements array limitation + * in kids element emission. + * Recursive function + * + */ +void PDFWriterImpl::addInternalStructureContainer( PDFStructureElement& rEle ) +{ + if( rEle.m_eType == PDFWriter::NonStructElement && + rEle.m_nOwnElement != rEle.m_nParentElement ) + return; + + for( std::list< sal_Int32 >::const_iterator it = rEle.m_aChildren.begin(); it != rEle.m_aChildren.end(); ++it ) + { + if( *it > 0 && *it < sal_Int32(m_aStructure.size()) ) + { + PDFStructureElement& rChild = m_aStructure[ *it ]; + if( rChild.m_eType != PDFWriter::NonStructElement ) + { + //triggered when a child of the rEle element is found + if( rChild.m_nParentElement == rEle.m_nOwnElement ) + addInternalStructureContainer( rChild );//examine the child + else + { + DBG_ERROR( "PDFWriterImpl::addInternalStructureContainer: invalid child structure element" ); +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "PDFWriterImpl::addInternalStructureContainer: invalid child structure elemnt with id %" SAL_PRIdINT32 "\n", *it ); +#endif + } + } + } + else + { + DBG_ERROR( "PDFWriterImpl::emitStructure: invalid child structure id" ); +#if OSL_DEBUG_LEVEL > 1 + fprintf( stderr, "PDFWriterImpl::addInternalStructureContainer: invalid child structure id %" SAL_PRIdINT32 "\n", *it ); +#endif + } + } + + if( rEle.m_nOwnElement != rEle.m_nParentElement ) + { + if( !rEle.m_aKids.empty() ) + { + if( rEle.m_aKids.size() > ncMaxPDFArraySize ) { + //then we need to add the containers for the kids elements + // a list to be used for the new kid element + std::list< PDFStructureElementKid > aNewKids; + std::list< sal_Int32 > aNewChildren; + + // add Div in RoleMap, in case no one else did (TODO: is it needed? Is it dangerous?) + OStringBuffer aNameBuf( "Div" ); + OString aAliasName( aNameBuf.makeStringAndClear() ); + m_aRoleMap[ aAliasName ] = getStructureTag( PDFWriter::Division ); + + while( rEle.m_aKids.size() > ncMaxPDFArraySize ) + { + sal_Int32 nCurrentStructElement = rEle.m_nOwnElement; + sal_Int32 nNewId = sal_Int32(m_aStructure.size()); + m_aStructure.push_back( PDFStructureElement() ); + PDFStructureElement& rEleNew = m_aStructure.back(); + rEleNew.m_aAlias = aAliasName; + rEleNew.m_eType = PDFWriter::Division; // a new Div type container + rEleNew.m_nOwnElement = nNewId; + rEleNew.m_nParentElement = nCurrentStructElement; + //inherit the same page as the first child to be reparented + rEleNew.m_nFirstPageObject = m_aStructure[ rEle.m_aChildren.front() ].m_nFirstPageObject; + rEleNew.m_nObject = createObject();//assign a PDF object number + //add the object to the kid list of the parent + aNewKids.push_back( PDFStructureElementKid( rEleNew.m_nObject ) ); + aNewChildren.push_back( nNewId ); + + std::list< sal_Int32 >::iterator aChildEndIt( rEle.m_aChildren.begin() ); + std::list< PDFStructureElementKid >::iterator aKidEndIt( rEle.m_aKids.begin() ); + advance( aChildEndIt, ncMaxPDFArraySize ); + advance( aKidEndIt, ncMaxPDFArraySize ); + + rEleNew.m_aKids.splice( rEleNew.m_aKids.begin(), + rEle.m_aKids, + rEle.m_aKids.begin(), + aKidEndIt ); + rEleNew.m_aChildren.splice( rEleNew.m_aChildren.begin(), + rEle.m_aChildren, + rEle.m_aChildren.begin(), + aChildEndIt ); + // set the kid's new parent + for( std::list< sal_Int32 >::const_iterator it = rEleNew.m_aChildren.begin(); + it != rEleNew.m_aChildren.end(); ++it ) + { + m_aStructure[ *it ].m_nParentElement = nNewId; + } + } + //finally add the new kids resulting from the container added + rEle.m_aKids.insert( rEle.m_aKids.begin(), aNewKids.begin(), aNewKids.end() ); + rEle.m_aChildren.insert( rEle.m_aChildren.begin(), aNewChildren.begin(), aNewChildren.end() ); + } + } + } +} +//<--- i94258 + bool PDFWriterImpl::setCurrentStructureElement( sal_Int32 nEle ) { bool bSuccess = false; diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 8bfaa121dab8..50c0bafc0489 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: pdfwriter_impl.hxx,v $ - * $Revision: 1.56 $ + * $Revision: 1.55.134.2 $ * * This file is part of OpenOffice.org. * @@ -474,7 +474,7 @@ public: sal_Int32 m_nParentElement; // index into structure vector sal_Int32 m_nFirstPageObject; bool m_bOpenMCSeq; - std::list< sal_Int32 > m_aChildren; // indices into strucure vector + std::list< sal_Int32 > m_aChildren; // indexes into structure vector std::list< PDFStructureElementKid > m_aKids; PDFStructAttributes m_aAttributes; Rectangle m_aBBox; @@ -654,6 +654,7 @@ private: Color m_aLineColor; Color m_aFillColor; Color m_aTextLineColor; + Color m_aOverlineColor; Region m_aClipRegion; sal_Int32 m_nAntiAlias; sal_Int32 m_nLayoutMode; @@ -667,16 +668,18 @@ private: static const sal_uInt16 updateLineColor = 0x0004; static const sal_uInt16 updateFillColor = 0x0008; static const sal_uInt16 updateTextLineColor = 0x0010; - static const sal_uInt16 updateClipRegion = 0x0020; - static const sal_uInt16 updateAntiAlias = 0x0040; - static const sal_uInt16 updateLayoutMode = 0x0080; - static const sal_uInt16 updateTransparentPercent = 0x0100; - static const sal_uInt16 updateDigitLanguage = 0x0200; + static const sal_uInt16 updateOverlineColor = 0x0020; + static const sal_uInt16 updateClipRegion = 0x0040; + static const sal_uInt16 updateAntiAlias = 0x0080; + static const sal_uInt16 updateLayoutMode = 0x0100; + static const sal_uInt16 updateTransparentPercent = 0x0200; + static const sal_uInt16 updateDigitLanguage = 0x0400; GraphicsState() : m_aLineColor( COL_TRANSPARENT ), m_aFillColor( COL_TRANSPARENT ), m_aTextLineColor( COL_TRANSPARENT ), + m_aOverlineColor( COL_TRANSPARENT ), m_nAntiAlias( 1 ), m_nLayoutMode( 0 ), m_nTransparentPercent( 0 ), @@ -689,6 +692,7 @@ private: m_aLineColor( rState.m_aLineColor ), m_aFillColor( rState.m_aFillColor ), m_aTextLineColor( rState.m_aTextLineColor ), + m_aOverlineColor( rState.m_aOverlineColor ), m_aClipRegion( rState.m_aClipRegion ), m_nAntiAlias( rState.m_nAntiAlias ), m_nLayoutMode( rState.m_nLayoutMode ), @@ -705,6 +709,7 @@ private: m_aLineColor = rState.m_aLineColor; m_aFillColor = rState.m_aFillColor; m_aTextLineColor = rState.m_aTextLineColor; + m_aOverlineColor = rState.m_aOverlineColor; m_aClipRegion = rState.m_aClipRegion; m_nAntiAlias = rState.m_nAntiAlias; m_nLayoutMode = rState.m_nLayoutMode; @@ -949,6 +954,12 @@ i12626 // puts the attribute objects of a structure element into the returned string, // helper for emitStructure rtl::OString emitStructureAttributes( PDFStructureElement& rEle ); + //--->i94258 + // the maximum array elements allowed for PDF array object + static const sal_uInt32 ncMaxPDFArraySize = 8191; + //check if internal dummy container are needed in the structure elements + void addInternalStructureContainer( PDFStructureElement& rEle ); + //<---i94258 // writes document structure sal_Int32 emitStructure( PDFStructureElement& rEle ); // writes structure parent tree @@ -1114,6 +1125,18 @@ public: m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateTextLineColor; } + void setOverlineColor() + { + m_aGraphicsStack.front().m_aOverlineColor = Color( COL_TRANSPARENT ); + m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateOverlineColor; + } + + void setOverlineColor( const Color& rColor ) + { + m_aGraphicsStack.front().m_aOverlineColor = rColor; + m_aGraphicsStack.front().m_nUpdateFlags |= GraphicsState::updateOverlineColor; + } + void setTextFillColor( const Color& rColor ) { m_aGraphicsStack.front().m_aFont.SetFillColor( rColor ); @@ -1177,7 +1200,11 @@ public: xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, bool bTextLines = true ); void drawText( const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, bool bTextLines = true ); - void drawTextLine( const Point& rPos, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, bool bUnderlineAbove ); + void drawTextLine( const Point& rPos, long nWidth, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, bool bUnderlineAbove ); + void drawWaveTextLine( rtl::OStringBuffer& aLine, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove ); + void drawStraightTextLine( rtl::OStringBuffer& aLine, long nWidth, FontUnderline eTextLine, Color aColor, bool bIsAbove ); + void drawStrikeoutLine( rtl::OStringBuffer& aLine, long nWidth, FontStrikeout eStrikeout, Color aColor ); + void drawStrikeoutChar( const Point& rPos, long nWidth, FontStrikeout eStrikeout ); void drawLine( const Point& rStart, const Point& rStop ); void drawLine( const Point& rStart, const Point& rStop, const LineInfo& rInfo ); diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index fa9cf7d1fa54..fd14b5224206 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -223,7 +223,7 @@ ImplRegion::ImplRegion( const ImplRegion& rImplRegion ) ImplRegion::~ImplRegion() { DBG_ASSERT( (this != &aImplEmptyRegion) && (this != &aImplNullRegion), - "ImplRegion::~ImplRegion() - Empty oder NULL-Region" ) + "ImplRegion::~ImplRegion() - Empty oder NULL-Region" ); ImplRegionBand* pBand = mpFirstBand; while ( pBand ) diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 298da07de1b2..509ad4f725ce 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -52,15 +52,12 @@ #include <vcl/gdimtf.hxx> #include <vcl/outdata.hxx> #include <vcl/print.hxx> -#ifndef _VCL_IMPLNCVT_HXX #include <implncvt.hxx> -#endif #include <vcl/outdev.h> #include <vcl/outdev.hxx> #include <vcl/unowrap.hxx> #include <vcl/sallayout.hxx> - -//#define USE_NEW_RTL_IMPLEMENTATION +#include "basegfx/polygon/b2dpolygon.hxx" // ---------------------------------------------------------------------------- // The only common SalFrame method @@ -84,7 +81,8 @@ SalFrameGeometry SalFrame::GetGeometry() // ---------------------------------------------------------------------------- SalGraphics::SalGraphics() - : m_nLayout( 0 ) +: m_nLayout( 0 ), + m_bAntiAliasB2DDraw(false) { // read global RTL settings if( Application::GetSettings().GetLayoutRTL() ) @@ -115,22 +113,28 @@ void SalGraphics::mirror( long& x, const OutputDevice *pOutDev, bool bBack ) con if( w ) { - if( pOutDev && !pOutDev->IsRTLEnabled() ) + if( pOutDev && pOutDev->ImplIsAntiparallel() ) { OutputDevice *pOutDevRef = (OutputDevice*) pOutDev; -#ifdef USE_NEW_RTL_IMPLEMENTATION - if( pOutDev->meOutDevType == OUTDEV_WINDOW ) - pOutDevRef = (OutputDevice*) ((Window *) pOutDev)->mpDummy4; // top of non-mirroring hierarchy -#endif - // mirror this window back - long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX - if( bBack ) - x = x - devX + pOutDevRef->GetOutOffXPixel(); + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + { + long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX + if( bBack ) + x = x - devX + pOutDevRef->GetOutOffXPixel(); + else + x = devX + (x - pOutDevRef->GetOutOffXPixel()); + } else - x = devX + (x - pOutDevRef->GetOutOffXPixel()); + { + long devX = pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX + if( bBack ) + x = x - pOutDevRef->GetOutputWidthPixel() + devX - pOutDevRef->GetOutOffXPixel() + 1; + else + x = pOutDevRef->GetOutputWidthPixel() - (x - devX) + pOutDevRef->GetOutOffXPixel() - 1; + } } - else + else if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) x = w-1-x; } } @@ -145,22 +149,28 @@ void SalGraphics::mirror( long& x, long& nWidth, const OutputDevice *pOutDev, bo if( w ) { - if( pOutDev && !pOutDev->IsRTLEnabled() ) + if( pOutDev && pOutDev->ImplIsAntiparallel() ) { OutputDevice *pOutDevRef = (OutputDevice*) pOutDev; -#ifdef USE_NEW_RTL_IMPLEMENTATION - if( pOutDev->meOutDevType == OUTDEV_WINDOW ) - pOutDevRef = (OutputDevice*) ((Window *) pOutDev)->mpDummy4; // top of non-mirroring hierarchy -#endif - // mirror this window back - long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX - if( bBack ) - x = x - devX + pOutDevRef->GetOutOffXPixel(); + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + { + long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX + if( bBack ) + x = x - devX + pOutDevRef->GetOutOffXPixel(); + else + x = devX + (x - pOutDevRef->GetOutOffXPixel()); + } else - x = devX + (x - pOutDevRef->GetOutOffXPixel()); + { + long devX = pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX + if( bBack ) + x = x - pOutDevRef->GetOutputWidthPixel() + devX - pOutDevRef->GetOutOffXPixel() + nWidth; + else + x = pOutDevRef->GetOutputWidthPixel() - (x - devX) + pOutDevRef->GetOutOffXPixel() - nWidth; + } } - else + else if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) x = w-nWidth-x; } @@ -178,38 +188,60 @@ BOOL SalGraphics::mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint * { sal_uInt32 i, j; - if( pOutDev && !pOutDev->IsRTLEnabled() ) + if( pOutDev && pOutDev->ImplIsAntiparallel() ) { OutputDevice *pOutDevRef = (OutputDevice*) pOutDev; -#ifdef USE_NEW_RTL_IMPLEMENTATION - if( pOutDev->meOutDevType == OUTDEV_WINDOW ) - pOutDevRef = (OutputDevice*) ((Window *) pOutDev)->mpDummy4; // top of non-mirroring hierarchy -#endif - // mirror this window back - long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX - if( bBack ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) { - for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) + long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX + if( bBack ) + { + for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) + { + //long x = w-1-pPtAry[i].mnX; + //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); + pPtAry2[j].mnX = pOutDevRef->GetOutOffXPixel() + (pPtAry[i].mnX - devX); + pPtAry2[j].mnY = pPtAry[i].mnY; + } + } + else { - //long x = w-1-pPtAry[i].mnX; - //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); - pPtAry2[j].mnX = pOutDevRef->GetOutOffXPixel() + (pPtAry[i].mnX - devX); - pPtAry2[j].mnY = pPtAry[i].mnY; + for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) + { + //long x = w-1-pPtAry[i].mnX; + //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); + pPtAry2[j].mnX = devX + (pPtAry[i].mnX - pOutDevRef->GetOutOffXPixel()); + pPtAry2[j].mnY = pPtAry[i].mnY; + } } } else { - for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) + long devX = pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX + if( bBack ) + { + for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) + { + //long x = w-1-pPtAry[i].mnX; + //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); + pPtAry2[j].mnX = pPtAry[i].mnX - pOutDevRef->GetOutputWidthPixel() + devX - pOutDevRef->GetOutOffXPixel() + 1; + pPtAry2[j].mnY = pPtAry[i].mnY; + } + } + else { - //long x = w-1-pPtAry[i].mnX; - //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); - pPtAry2[j].mnX = devX + (pPtAry[i].mnX - pOutDevRef->GetOutOffXPixel()); - pPtAry2[j].mnY = pPtAry[i].mnY; + for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) + { + //long x = w-1-pPtAry[i].mnX; + //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); + pPtAry2[j].mnX = pOutDevRef->GetOutputWidthPixel() - (pPtAry[i].mnX - devX) + pOutDevRef->GetOutOffXPixel() - 1; + pPtAry2[j].mnY = pPtAry[i].mnY; + } } } } - else + else if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) { for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) { @@ -245,11 +277,94 @@ void SalGraphics::mirror( Rectangle& rRect, const OutputDevice *pOutDev, bool bB rRect.Move( x - x_org, 0 ); } +basegfx::B2DPoint SalGraphics::mirror( const basegfx::B2DPoint& i_rPoint, const OutputDevice *i_pOutDev, bool i_bBack ) const +{ + long w; + if( i_pOutDev && i_pOutDev->GetOutDevType() == OUTDEV_VIRDEV ) + w = i_pOutDev->GetOutputWidthPixel(); + else + w = GetGraphicsWidth(); + + DBG_ASSERT( w, "missing graphics width" ); + + basegfx::B2DPoint aRet( i_rPoint ); + if( w ) + { + if( i_pOutDev && !i_pOutDev->IsRTLEnabled() ) + { + OutputDevice *pOutDevRef = (OutputDevice*)i_pOutDev; + // mirror this window back + double devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX + if( i_bBack ) + aRet.setX( i_rPoint.getX() - devX + pOutDevRef->GetOutOffXPixel() ); + else + aRet.setX( devX + (i_rPoint.getX() - pOutDevRef->GetOutOffXPixel()) ); + } + else + aRet.setX( w-1-i_rPoint.getX() ); + } + return aRet; +} + +basegfx::B2DPolygon SalGraphics::mirror( const basegfx::B2DPolygon& i_rPoly, const OutputDevice *i_pOutDev, bool i_bBack ) const +{ + long w; + if( i_pOutDev && i_pOutDev->GetOutDevType() == OUTDEV_VIRDEV ) + w = i_pOutDev->GetOutputWidthPixel(); + else + w = GetGraphicsWidth(); + + DBG_ASSERT( w, "missing graphics width" ); + + basegfx::B2DPolygon aRet; + if( w ) + { + sal_Int32 nPoints = i_rPoly.count(); + for( sal_Int32 i = 0; i < nPoints; i++ ) + { + aRet.append( mirror( i_rPoly.getB2DPoint( i ), i_pOutDev, i_bBack ) ); + if( i_rPoly.isPrevControlPointUsed( i ) ) + aRet.setPrevControlPoint( i, mirror( i_rPoly.getPrevControlPoint( i ), i_pOutDev, i_bBack ) ); + if( i_rPoly.isNextControlPointUsed( i ) ) + aRet.setNextControlPoint( i, mirror( i_rPoly.getNextControlPoint( i ), i_pOutDev, i_bBack ) ); + } + aRet.setClosed( i_rPoly.isClosed() ); + aRet.flip(); + } + else + aRet = i_rPoly; + return aRet; +} + +basegfx::B2DPolyPolygon SalGraphics::mirror( const basegfx::B2DPolyPolygon& i_rPoly, const OutputDevice *i_pOutDev, bool i_bBack ) const +{ + long w; + if( i_pOutDev && i_pOutDev->GetOutDevType() == OUTDEV_VIRDEV ) + w = i_pOutDev->GetOutputWidthPixel(); + else + w = GetGraphicsWidth(); + + DBG_ASSERT( w, "missing graphics width" ); + + basegfx::B2DPolyPolygon aRet; + if( w ) + { + sal_Int32 nPoly = i_rPoly.count(); + for( sal_Int32 i = 0; i < nPoly; i++ ) + aRet.append( mirror( i_rPoly.getB2DPolygon( i ), i_pOutDev, i_bBack ) ); + aRet.setClosed( i_rPoly.isClosed() ); + aRet.flip(); + } + else + aRet = i_rPoly; + return aRet; +} + // ---------------------------------------------------------------------------- BOOL SalGraphics::UnionClipRegion( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); return unionClipRegion( nX, nY, nWidth, nHeight ); } @@ -267,19 +382,19 @@ BOOL SalGraphics::UnionClipRegion( const ::basegfx::B2DPolyPolygon& rPoly, const void SalGraphics::DrawPixel( long nX, long nY, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, pOutDev ); drawPixel( nX, nY ); } void SalGraphics::DrawPixel( long nX, long nY, SalColor nSalColor, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, pOutDev ); drawPixel( nX, nY, nSalColor ); } void SalGraphics::DrawLine( long nX1, long nY1, long nX2, long nY2, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { mirror( nX1, pOutDev ); mirror( nX2, pOutDev ); @@ -288,7 +403,7 @@ void SalGraphics::DrawLine( long nX1, long nY1, long nX2, long nY2, const Out } void SalGraphics::DrawRect( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); drawRect( nX, nY, nWidth, nHeight ); } @@ -299,9 +414,10 @@ bool SalGraphics::drawPolyLine( { return false; } + void SalGraphics::DrawPolyLine( ULONG nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalPoint* pPtAry2 = new SalPoint[nPoints]; BOOL bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); @@ -311,9 +427,10 @@ void SalGraphics::DrawPolyLine( ULONG nPoints, const SalPoint* pPtAry, const Out else drawPolyLine( nPoints, pPtAry ); } -void SalGraphics::DrawPolygon( ULONG nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev ) + +void SalGraphics::DrawPolygon( ULONG nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalPoint* pPtAry2 = new SalPoint[nPoints]; BOOL bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); @@ -323,9 +440,10 @@ void SalGraphics::DrawPolygon( ULONG nPoints, const SalPoint* pPtAry, const O else drawPolygon( nPoints, pPtAry ); } -void SalGraphics::DrawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry, const OutputDevice *pOutDev ) + +void SalGraphics::DrawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { // TODO: optimize, reduce new/delete calls SalPoint **pPtAry2 = new SalPoint*[nPoly]; @@ -346,38 +464,95 @@ void SalGraphics::DrawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoint else drawPolyPolygon( nPoly, pPoints, pPtAry ); } -bool SalGraphics::DrawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPolygon, double fTransparency, const OutputDevice* ) + +bool SalGraphics::DrawPolyPolygon( const ::basegfx::B2DPolyPolygon& i_rPolyPolygon, double i_fTransparency, const OutputDevice* i_pOutDev ) { - DBG_ASSERT( !(m_nLayout & SAL_LAYOUT_BIDI_RTL), "DrawPolyPolygon - no mirroring implemented"); - return drawPolyPolygon( rPolyPolygon, fTransparency ); + bool bRet = false; + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + { + basegfx::B2DPolyPolygon aMirror( mirror( i_rPolyPolygon, i_pOutDev ) ); + bRet = drawPolyPolygon( aMirror, i_fTransparency ); + } + else + bRet = drawPolyPolygon( i_rPolyPolygon, i_fTransparency ); + return bRet; } + bool SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double /*fTransparency*/) { return false; } -sal_Bool SalGraphics::DrawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry, const OutputDevice* ) + +sal_Bool SalGraphics::DrawPolyLineBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry, const OutputDevice* pOutDev ) { - DBG_ASSERT( !(m_nLayout & SAL_LAYOUT_BIDI_RTL), "DrawPolyLineBezier - no mirroring implemented"); - return drawPolyLineBezier( nPoints, pPtAry, pFlgAry ); + sal_Bool bResult = sal_False; + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + { + SalPoint* pPtAry2 = new SalPoint[nPoints]; + BOOL bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); + bResult = drawPolyLineBezier( nPoints, bCopied ? pPtAry2 : pPtAry, pFlgAry ); + delete [] pPtAry2; + } + else + bResult = drawPolyLineBezier( nPoints, pPtAry, pFlgAry ); + return bResult; } -sal_Bool SalGraphics::DrawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry, const OutputDevice* ) + +sal_Bool SalGraphics::DrawPolygonBezier( ULONG nPoints, const SalPoint* pPtAry, const BYTE* pFlgAry, const OutputDevice* pOutDev ) { - DBG_ASSERT( !(m_nLayout & SAL_LAYOUT_BIDI_RTL), "DrawPolygonBezier - no mirroring implemented"); - return drawPolygonBezier( nPoints, pPtAry, pFlgAry ); + sal_Bool bResult = sal_False; + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + { + SalPoint* pPtAry2 = new SalPoint[nPoints]; + BOOL bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); + bResult = drawPolygonBezier( nPoints, bCopied ? pPtAry2 : pPtAry, pFlgAry ); + delete [] pPtAry2; + } + else + bResult = drawPolygonBezier( nPoints, pPtAry, pFlgAry ); + return bResult; } -sal_Bool SalGraphics::DrawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, - const SalPoint* const* pPtAry, const BYTE* const* pFlgAry, const OutputDevice* ) + +sal_Bool SalGraphics::DrawPolyPolygonBezier( sal_uInt32 i_nPoly, const sal_uInt32* i_pPoints, + const SalPoint* const* i_pPtAry, const BYTE* const* i_pFlgAry, const OutputDevice* i_pOutDev ) { - DBG_ASSERT( !(m_nLayout & SAL_LAYOUT_BIDI_RTL), "DrawPolyPolygonBezier - no mirroring implemented"); - return drawPolyPolygonBezier( nPoly, pPoints, pPtAry, pFlgAry ); + sal_Bool bRet = sal_False; + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + { + // TODO: optimize, reduce new/delete calls + SalPoint **pPtAry2 = new SalPoint*[i_nPoly]; + ULONG i; + for(i=0; i<i_nPoly; i++) + { + ULONG nPoints = i_pPoints[i]; + pPtAry2[i] = new SalPoint[ nPoints ]; + mirror( nPoints, i_pPtAry[i], pPtAry2[i], i_pOutDev ); + } + + bRet = drawPolyPolygonBezier( i_nPoly, i_pPoints, (PCONSTSALPOINT*)pPtAry2, i_pFlgAry ); + + for(i=0; i<i_nPoly; i++) + delete [] pPtAry2[i]; + delete [] pPtAry2; + } + else + bRet = drawPolyPolygonBezier( i_nPoly, i_pPoints, i_pPtAry, i_pFlgAry ); + return bRet; } -bool SalGraphics::DrawPolyLine( const ::basegfx::B2DPolygon& rPolygon, - const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin eLineJoin, - const OutputDevice* ) +bool SalGraphics::DrawPolyLine( const ::basegfx::B2DPolygon& i_rPolygon, + const ::basegfx::B2DVector& i_rLineWidth, basegfx::B2DLineJoin i_eLineJoin, + const OutputDevice* i_pOutDev ) { - DBG_ASSERT( !(m_nLayout & SAL_LAYOUT_BIDI_RTL), "DrawPolygon for B2D - no mirroring implemented"); - return drawPolyLine( rPolygon, rLineWidth, eLineJoin ); + bool bRet = false; + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + { + basegfx::B2DPolygon aMirror( mirror( i_rPolygon, i_pOutDev ) ); + bRet = drawPolyLine( aMirror, i_rLineWidth, i_eLineJoin ); + } + else + bRet = drawPolyLine( i_rPolygon, i_rLineWidth, i_eLineJoin ); + return bRet; } void SalGraphics::CopyArea( long nDestX, long nDestY, @@ -385,7 +560,7 @@ void SalGraphics::CopyArea( long nDestX, long nDestY, long nSrcWidth, long nSrcHeight, USHORT nFlags, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { mirror( nDestX, nSrcWidth, pOutDev ); mirror( nSrcX, nSrcWidth, pOutDev ); @@ -395,13 +570,13 @@ void SalGraphics::CopyArea( long nDestX, long nDestY, void SalGraphics::CopyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics, const OutputDevice *pOutDev, const OutputDevice *pSrcOutDev ) { - if( ( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) || - (pSrcGraphics && (pSrcGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) ) ) + if( ( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) || + (pSrcGraphics && ( (pSrcGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) || (pSrcOutDev && pSrcOutDev->IsRTLEnabled()) ) ) ) { SalTwoRect pPosAry2 = *pPosAry; - if( pSrcGraphics && (pSrcGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) ) + if( pSrcGraphics && (pSrcGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) || (pSrcOutDev && pSrcOutDev->IsRTLEnabled()) ) mirror( pPosAry2.mnSrcX, pPosAry2.mnSrcWidth, pSrcOutDev ); - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); copyBits( &pPosAry2, pSrcGraphics ); } @@ -411,7 +586,7 @@ void SalGraphics::CopyBits( const SalTwoRect* pPosAry, void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect pPosAry2 = *pPosAry; mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); @@ -424,7 +599,7 @@ void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap, SalColor nTransparentColor, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect pPosAry2 = *pPosAry; mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); @@ -437,7 +612,7 @@ void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap, const SalBitmap& rTransparentBitmap, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect pPosAry2 = *pPosAry; mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); @@ -450,7 +625,7 @@ void SalGraphics::DrawMask( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap, SalColor nMaskColor, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect pPosAry2 = *pPosAry; mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); @@ -461,25 +636,25 @@ void SalGraphics::DrawMask( const SalTwoRect* pPosAry, } SalBitmap* SalGraphics::GetBitmap( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); return getBitmap( nX, nY, nWidth, nHeight ); } SalColor SalGraphics::GetPixel( long nX, long nY, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, pOutDev ); return getPixel( nX, nY ); } void SalGraphics::Invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); invert( nX, nY, nWidth, nHeight, nFlags ); } void SalGraphics::Invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nFlags, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalPoint* pPtAry2 = new SalPoint[nPoints]; BOOL bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); @@ -492,7 +667,7 @@ void SalGraphics::Invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nF BOOL SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); return drawEPS( nX, nY, nWidth, nHeight, pPtr, nSize ); } @@ -500,7 +675,7 @@ BOOL SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* BOOL SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { Point pt( aPos ); Region rgn( rControlRegion ); @@ -548,7 +723,7 @@ BOOL SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& aCaption, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { Region rgn( rControlRegion ); mirror( rgn, pOutDev ); @@ -565,7 +740,7 @@ BOOL SalGraphics::DrawNativeControlText( ControlType nType, ControlPart nPart, c ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& aCaption, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { Region rgn( rControlRegion ); mirror( rgn, pOutDev ); @@ -582,7 +757,7 @@ BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { Region rgn( rControlRegion ); mirror( rgn, pOutDev ); @@ -611,7 +786,7 @@ bool SalGraphics::DrawAlphaBitmap( const SalTwoRect& rPosAry, const SalBitmap& rAlphaBitmap, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect pPosAry2 = rPosAry; mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); @@ -624,7 +799,7 @@ bool SalGraphics::DrawAlphaBitmap( const SalTwoRect& rPosAry, bool SalGraphics::DrawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); return drawAlphaRect( nX, nY, nWidth, nHeight, nTransparency ); diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 9e02b42aa789..6b695b8a22f6 100755 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: sallayout.cxx,v $ - * $Revision: 1.94 $ + * $Revision: 1.94.90.2 $ * * This file is part of OpenOffice.org. * @@ -243,97 +243,86 @@ sal_UCS4 GetLocalizedChar( sal_UCS4 nChar, LanguageType eLang ) return nChar; int nOffset; - switch( eLang ) + // eLang & LANGUAGE_MASK_PRIMARY catches language independent of region. + // CAVEAT! To some like Mongolian MS assigned the same primary language + // although the script type is different! + switch( eLang & LANGUAGE_MASK_PRIMARY ) { default: nOffset = 0; break; - case LANGUAGE_ARABIC: - case LANGUAGE_ARABIC_SAUDI_ARABIA: - case LANGUAGE_ARABIC_IRAQ: - case LANGUAGE_ARABIC_EGYPT: - case LANGUAGE_ARABIC_LIBYA: - case LANGUAGE_ARABIC_ALGERIA: - case LANGUAGE_ARABIC_MOROCCO: - case LANGUAGE_ARABIC_TUNISIA: - case LANGUAGE_ARABIC_OMAN: - case LANGUAGE_ARABIC_YEMEN: - case LANGUAGE_ARABIC_SYRIA: - case LANGUAGE_ARABIC_JORDAN: - case LANGUAGE_ARABIC_LEBANON: - case LANGUAGE_ARABIC_KUWAIT: - case LANGUAGE_ARABIC_UAE: - case LANGUAGE_ARABIC_BAHRAIN: - case LANGUAGE_ARABIC_QATAR: - case LANGUAGE_URDU: - case LANGUAGE_URDU_PAKISTAN: - case LANGUAGE_URDU_INDIA: - case LANGUAGE_PUNJABI: //??? - nOffset = 0x0660 - '0'; // arabic/persian/urdu + case LANGUAGE_ARABIC_SAUDI_ARABIA & LANGUAGE_MASK_PRIMARY: + nOffset = 0x0660 - '0'; // arabic-indic digits break; - case LANGUAGE_BENGALI: + case LANGUAGE_URDU & LANGUAGE_MASK_PRIMARY: + case LANGUAGE_PUNJABI & LANGUAGE_MASK_PRIMARY: //??? + case LANGUAGE_SINDHI & LANGUAGE_MASK_PRIMARY: + nOffset = 0x06F0 - '0'; // eastern arabic-indic digits + break; + case LANGUAGE_BENGALI & LANGUAGE_MASK_PRIMARY: nOffset = 0x09E6 - '0'; // bengali break; - case LANGUAGE_HINDI: + case LANGUAGE_HINDI & LANGUAGE_MASK_PRIMARY: nOffset = 0x0966 - '0'; // devanagari break; - #if 0 + case LANGUAGE_AMHARIC_ETHIOPIA & LANGUAGE_MASK_PRIMARY: + case LANGUAGE_TIGRIGNA_ETHIOPIA & LANGUAGE_MASK_PRIMARY: // TODO case: nOffset = 0x1369 - '0'; // ethiopic break; - #endif - case LANGUAGE_GUJARATI: + case LANGUAGE_GUJARATI & LANGUAGE_MASK_PRIMARY: nOffset = 0x0AE6 - '0'; // gujarati break; - #if 0 - // TODO case: +#ifdef LANGUAGE_GURMUKHI // TODO case: + case LANGUAGE_GURMUKHI & LANGUAGE_MASK_PRIMARY: nOffset = 0x0A66 - '0'; // gurmukhi break; - #endif - case LANGUAGE_KANNADA: +#endif + case LANGUAGE_KANNADA & LANGUAGE_MASK_PRIMARY: nOffset = 0x0CE6 - '0'; // kannada break; - case LANGUAGE_KHMER: + case LANGUAGE_KHMER & LANGUAGE_MASK_PRIMARY: nOffset = 0x17E0 - '0'; // khmer break; - case LANGUAGE_LAO: + case LANGUAGE_LAO & LANGUAGE_MASK_PRIMARY: nOffset = 0x0ED0 - '0'; // lao break; - case LANGUAGE_MALAYALAM: - nOffset = 0x0D66 - '0'; // malayalam + case LANGUAGE_MALAYALAM & LANGUAGE_MASK_PRIMARY: + nOffset = 0x0D66 - '0'; // malayalam break; - case LANGUAGE_MONGOLIAN: - nOffset = 0x1810 - '0'; // mongolian + case LANGUAGE_MONGOLIAN & LANGUAGE_MASK_PRIMARY: + if (eLang == LANGUAGE_MONGOLIAN_MONGOLIAN) + nOffset = 0x1810 - '0'; // mongolian + else + nOffset = 0; // mongolian cyrillic break; - #if 0 - // TODO case: - nOffset = 0x1040 - '0'; // myanmar + case LANGUAGE_BURMESE & LANGUAGE_MASK_PRIMARY: + nOffset = 0x1040 - '0'; // myanmar break; - #endif - case LANGUAGE_ORIYA: - nOffset = 0x0B66 - '0'; // oriya + case LANGUAGE_ORIYA & LANGUAGE_MASK_PRIMARY: + nOffset = 0x0B66 - '0'; // oriya break; - case LANGUAGE_TAMIL: - nOffset = 0x0BE7 - '0'; // tamil + case LANGUAGE_TAMIL & LANGUAGE_MASK_PRIMARY: + nOffset = 0x0BE7 - '0'; // tamil break; - case LANGUAGE_TELUGU: - nOffset = 0x0C66 - '0'; // telugu + case LANGUAGE_TELUGU & LANGUAGE_MASK_PRIMARY: + nOffset = 0x0C66 - '0'; // telugu break; - case LANGUAGE_THAI: - nOffset = 0x0E50 - '0'; // thai + case LANGUAGE_THAI & LANGUAGE_MASK_PRIMARY: + nOffset = 0x0E50 - '0'; // thai break; - case LANGUAGE_TIBETAN: - nOffset = 0x0F20 - '0'; // tibetan + case LANGUAGE_TIBETAN & LANGUAGE_MASK_PRIMARY: + nOffset = 0x0F20 - '0'; // tibetan break; #if 0 // TODO: use language type for these digit substitutions? // TODO case: - nOffset = 0x2776 - '0'; // dingbat circled + nOffset = 0x2776 - '0'; // dingbat circled break; // TODO case: - nOffset = 0x2070 - '0'; // superscript + nOffset = 0x2070 - '0'; // superscript break; // TODO case: - nOffset = 0x2080 - '0'; // subscript + nOffset = 0x2080 - '0'; // subscript break; #endif } @@ -567,7 +556,7 @@ ImplLayoutArgs::ImplLayoutArgs( const xub_Unicode* pStr, int nLen, UBiDi* pParaBidi = ubidi_openSized( mnLength, 0, &rcI18n ); if( !pParaBidi ) return; - ubidi_setPara( pParaBidi, mpStr, mnLength, nLevel, NULL, &rcI18n ); + ubidi_setPara( pParaBidi, reinterpret_cast<const UChar *>(mpStr), mnLength, nLevel, NULL, &rcI18n ); // UChar != sal_Unicode in MinGW UBiDi* pLineBidi = pParaBidi; int nSubLength = mnEndCharPos - mnMinCharPos; @@ -1715,6 +1704,9 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs ) } mpLayouts[n]->AdjustLayout( aMultiArgs ); + // disable glyph-injection for glyph-fallback SalLayout iteration + mpLayouts[n]->DisableGlyphInjection( true ); + // remove unused parts of component if( n > 0 ) { @@ -1893,6 +1885,10 @@ void MultiSalLayout::AdjustLayout( ImplLayoutArgs& rArgs ) } mpLayouts[0]->Simplify( true ); + + // reenable glyph-injection + for( n = 0; n < mnLevel; ++n ) + mpLayouts[n]->DisableGlyphInjection( false ); } // ----------------------------------------------------------------------- diff --git a/vcl/source/helper/canvasbitmap.cxx b/vcl/source/helper/canvasbitmap.cxx index 7b450f6c0fa9..1e487b141d80 100644 --- a/vcl/source/helper/canvasbitmap.cxx +++ b/vcl/source/helper/canvasbitmap.cxx @@ -150,9 +150,6 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) : m_aLayout.ScanLineStride = m_pBmpAcc->GetScanlineSize(); m_aLayout.PlaneStride = 0; - if( !(m_pBmpAcc->GetScanlineFormat() & BMP_FORMAT_TOP_DOWN) ) - m_aLayout.ScanLineStride *= -1; - switch( m_pBmpAcc->GetScanlineFormat() ) { case BMP_FORMAT_1BIT_MSB_PAL: @@ -436,8 +433,6 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) : const Size aSize = m_aBitmap.GetSizePixel(); m_aLayout.ScanLineBytes = m_aLayout.ScanLineStride = (aSize.Width()*m_nBitsPerOutputPixel + 7)/8; - if( !(m_pBmpAcc->GetScanlineFormat() & BMP_FORMAT_TOP_DOWN) ) - m_aLayout.ScanLineStride *= -1; } } } @@ -515,8 +510,12 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getData( rendering::IntegerB bitmapLayout.ScanLineBytes = bitmapLayout.ScanLineStride= aRequestedBytes.getWidth(); + sal_Int32 nScanlineStride=bitmapLayout.ScanLineStride; if( !(m_pBmpAcc->GetScanlineFormat() & BMP_FORMAT_TOP_DOWN) ) - bitmapLayout.ScanLineStride *= -1; + { + pOutBuf += bitmapLayout.ScanLineStride*(aRequestedBytes.getHeight()-1); + nScanlineStride *= -1; + } if( !m_aBmpEx.IsTransparent() ) { @@ -527,7 +526,7 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getData( rendering::IntegerB { Scanline pScan = m_pBmpAcc->GetScanline(y); rtl_copyMemory(pOutBuf, pScan+aRequestedBytes.Left(), aRequestedBytes.getWidth()); - pOutBuf += bitmapLayout.ScanLineStride; + pOutBuf += nScanlineStride; } } else @@ -568,7 +567,7 @@ uno::Sequence< sal_Int8 > SAL_CALL VclCanvasBitmap::getData( rendering::IntegerB } } - pOutBuf += bitmapLayout.ScanLineStride; + pOutBuf += nScanlineStride; } } @@ -870,6 +869,59 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertToARGB( con return aRes; } +uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertToPARGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException,uno::RuntimeException) +{ + vos::OGuard aGuard( Application::GetSolarMutex() ); + + const sal_Size nLen( deviceColor.getLength() ); + const sal_Int32 nComponentsPerPixel(m_aComponentTags.getLength()); + ENSURE_ARG_OR_THROW2(nLen%nComponentsPerPixel==0, + "number of channels no multiple of pixel element count", + static_cast<rendering::XBitmapPalette*>(this), 01); + + uno::Sequence< rendering::ARGBColor > aRes(nLen/nComponentsPerPixel); + rendering::ARGBColor* pOut( aRes.getArray() ); + + if( m_bPalette ) + { + OSL_ENSURE(m_nIndexIndex != -1, + "Invalid color channel indices"); + ENSURE_OR_THROW(m_pBmpAcc, + "Unable to get BitmapAccess"); + + for( sal_Size i=0; i<nLen; i+=nComponentsPerPixel ) + { + const BitmapColor aCol = m_pBmpAcc->GetPaletteColor( + sal::static_int_cast<USHORT>(deviceColor[i+m_nIndexIndex])); + + // TODO(F3): Convert result to sRGB color space + const double nAlpha( m_nAlphaIndex != -1 ? 1.0 - deviceColor[i+m_nAlphaIndex] : 1.0 ); + *pOut++ = rendering::ARGBColor(nAlpha, + nAlpha*toDoubleColor(aCol.GetRed()), + nAlpha*toDoubleColor(aCol.GetGreen()), + nAlpha*toDoubleColor(aCol.GetBlue())); + } + } + else + { + OSL_ENSURE(m_nRedIndex != -1 && m_nGreenIndex != -1 && m_nBlueIndex != -1, + "Invalid color channel indices"); + + for( sal_Size i=0; i<nLen; i+=nComponentsPerPixel ) + { + // TODO(F3): Convert result to sRGB color space + const double nAlpha( m_nAlphaIndex != -1 ? 1.0 - deviceColor[i+m_nAlphaIndex] : 1.0 ); + *pOut++ = rendering::ARGBColor( + nAlpha, + nAlpha*deviceColor[i+m_nRedIndex], + nAlpha*deviceColor[i+m_nGreenIndex], + nAlpha*deviceColor[i+m_nBlueIndex]); + } + } + + return aRes; +} + uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromRGB( const uno::Sequence<rendering::RGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException) { vos::OGuard aGuard( Application::GetSolarMutex() ); @@ -950,6 +1002,48 @@ uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromARGB( const uno::Se return aRes; } +uno::Sequence< double > SAL_CALL VclCanvasBitmap::convertFromPARGB( const uno::Sequence<rendering::ARGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException) +{ + vos::OGuard aGuard( Application::GetSolarMutex() ); + + const sal_Size nLen( rgbColor.getLength() ); + const sal_Int32 nComponentsPerPixel(m_aComponentTags.getLength()); + + uno::Sequence< double > aRes(nLen*nComponentsPerPixel); + double* pColors=aRes.getArray(); + + if( m_bPalette ) + { + for( sal_Size i=0; i<nLen; ++i ) + { + const double nAlpha( rgbColor[i].Alpha ); + pColors[m_nIndexIndex] = m_pBmpAcc->GetBestPaletteIndex( + BitmapColor(toByteColor(rgbColor[i].Red / nAlpha), + toByteColor(rgbColor[i].Green / nAlpha), + toByteColor(rgbColor[i].Blue / nAlpha))); + if( m_nAlphaIndex != -1 ) + pColors[m_nAlphaIndex] = nAlpha; + + pColors += nComponentsPerPixel; + } + } + else + { + for( sal_Size i=0; i<nLen; ++i ) + { + const double nAlpha( rgbColor[i].Alpha ); + pColors[m_nRedIndex] = rgbColor[i].Red / nAlpha; + pColors[m_nGreenIndex] = rgbColor[i].Green / nAlpha; + pColors[m_nBlueIndex] = rgbColor[i].Blue / nAlpha; + if( m_nAlphaIndex != -1 ) + pColors[m_nAlphaIndex] = nAlpha; + + pColors += nComponentsPerPixel; + } + } + return aRes; +} + sal_Int32 SAL_CALL VclCanvasBitmap::getBitsPerPixel( ) throw (uno::RuntimeException) { vos::OGuard aGuard( Application::GetSolarMutex() ); @@ -1163,6 +1257,65 @@ uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToAR return aRes; } +uno::Sequence<rendering::ARGBColor> SAL_CALL VclCanvasBitmap::convertIntegerToPARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException,uno::RuntimeException) +{ + vos::OGuard aGuard( Application::GetSolarMutex() ); + + const BYTE* pIn( reinterpret_cast<const BYTE*>(deviceColor.getConstArray()) ); + const sal_Size nLen( deviceColor.getLength() ); + const sal_Int32 nNumColors((nLen*8 + m_nBitsPerOutputPixel-1)/m_nBitsPerOutputPixel); + + uno::Sequence< rendering::ARGBColor > aRes(nNumColors); + rendering::ARGBColor* pOut( aRes.getArray() ); + + ENSURE_OR_THROW(m_pBmpAcc, + "Unable to get BitmapAccess"); + + if( m_aBmpEx.IsTransparent() ) + { + const long nNonAlphaBytes( (m_nBitsPerInputPixel+7)/8 ); + const sal_Int32 nBytesPerPixel((m_nBitsPerOutputPixel+7)/8); + const sal_uInt8 nAlphaFactor( m_aBmpEx.IsAlpha() ? 1 : 255 ); + for( sal_Size i=0; i<nLen; i+=nBytesPerPixel ) + { + // if palette, index is guaranteed to be 8 bit + const BitmapColor aCol = + m_bPalette ? + m_pBmpAcc->GetPaletteColor(*pIn) : + m_pBmpAcc->GetPixelFromData(pIn,0); + + // TODO(F3): Convert result to sRGB color space + const double nAlpha( 1.0 - toDoubleColor(nAlphaFactor*pIn[nNonAlphaBytes]) ); + *pOut++ = rendering::ARGBColor(nAlpha, + nAlpha*toDoubleColor(aCol.GetRed()), + nAlpha*toDoubleColor(aCol.GetGreen()), + nAlpha*toDoubleColor(aCol.GetBlue())); + pIn += nBytesPerPixel; + } + } + else + { + for( sal_Int32 i=0; i<nNumColors; ++i ) + { + const BitmapColor aCol = + m_bPalette ? + m_pBmpAcc->GetPaletteColor( + sal::static_int_cast<USHORT>( + m_pBmpAcc->GetPixelFromData( + pIn, i ))) : + m_pBmpAcc->GetPixelFromData(pIn, i); + + // TODO(F3): Convert result to sRGB color space + *pOut++ = rendering::ARGBColor(1.0, + toDoubleColor(aCol.GetRed()), + toDoubleColor(aCol.GetGreen()), + toDoubleColor(aCol.GetBlue())); + } + } + + return aRes; +} + uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromRGB( const uno::Sequence<rendering::RGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException) { vos::OGuard aGuard( Application::GetSolarMutex() ); @@ -1261,6 +1414,56 @@ uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromARGB( co return aRes; } +uno::Sequence< ::sal_Int8 > SAL_CALL VclCanvasBitmap::convertIntegerFromPARGB( const uno::Sequence<rendering::ARGBColor>& rgbColor ) throw (lang::IllegalArgumentException,uno::RuntimeException) +{ + vos::OGuard aGuard( Application::GetSolarMutex() ); + + const sal_Size nLen( rgbColor.getLength() ); + const sal_Int32 nNumBytes((nLen*m_nBitsPerOutputPixel+7)/8); + + uno::Sequence< sal_Int8 > aRes(nNumBytes); + BYTE* pColors=reinterpret_cast<BYTE*>(aRes.getArray()); + + if( m_aBmpEx.IsTransparent() ) + { + const long nNonAlphaBytes( (m_nBitsPerInputPixel+7)/8 ); + for( sal_Size i=0; i<nLen; ++i ) + { + const double nAlpha( rgbColor[i].Alpha ); + const BitmapColor aCol(toByteColor(rgbColor[i].Red / nAlpha), + toByteColor(rgbColor[i].Green / nAlpha), + toByteColor(rgbColor[i].Blue / nAlpha)); + const BitmapColor aCol2 = + m_bPalette ? + BitmapColor( + sal::static_int_cast<BYTE>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : + aCol; + + m_pBmpAcc->SetPixelOnData(pColors,0,aCol2); + pColors += nNonAlphaBytes; + *pColors++ = 255 - toByteColor(nAlpha); + } + } + else + { + for( sal_Size i=0; i<nLen; ++i ) + { + const BitmapColor aCol(toByteColor(rgbColor[i].Red), + toByteColor(rgbColor[i].Green), + toByteColor(rgbColor[i].Blue)); + const BitmapColor aCol2 = + m_bPalette ? + BitmapColor( + sal::static_int_cast<BYTE>(m_pBmpAcc->GetBestPaletteIndex( aCol ))) : + aCol; + + m_pBmpAcc->SetPixelOnData(pColors,i,aCol2); + } + } + + return aRes; +} + BitmapEx VclCanvasBitmap::getBitmapEx() const { return m_aBmpEx; diff --git a/vcl/source/helper/canvastools.cxx b/vcl/source/helper/canvastools.cxx index 3a239d7c3b3c..a4a991366d97 100644 --- a/vcl/source/helper/canvastools.cxx +++ b/vcl/source/helper/canvastools.cxx @@ -250,28 +250,61 @@ namespace vcl { // read ARGB color aARGBColors = rLayout.ColorSpace->convertIntegerToARGB(aPixelData); - for( sal_Int32 x=0; x<nWidth; ++x ) + + if( rWriteAcc->HasPalette() ) { - const rendering::ARGBColor& rColor=aARGBColors[x]; - rWriteAcc->SetPixel( aRect.Y1, x, - BitmapColor( toByteColor(rColor.Red), - toByteColor(rColor.Green), - toByteColor(rColor.Blue) )); - rAlphaAcc->SetPixel( aRect.Y1, x, - BitmapColor( 255 - toByteColor(rColor.Alpha) )); + for( sal_Int32 x=0; x<nWidth; ++x ) + { + const rendering::ARGBColor& rColor=aARGBColors[x]; + rWriteAcc->SetPixel( aRect.Y1, x, + (BYTE)rWriteAcc->GetBestPaletteIndex( + BitmapColor( toByteColor(rColor.Red), + toByteColor(rColor.Green), + toByteColor(rColor.Blue))) ); + rAlphaAcc->SetPixel( aRect.Y1, x, + BitmapColor( 255 - toByteColor(rColor.Alpha) )); + } + } + else + { + for( sal_Int32 x=0; x<nWidth; ++x ) + { + const rendering::ARGBColor& rColor=aARGBColors[x]; + rWriteAcc->SetPixel( aRect.Y1, x, + BitmapColor( toByteColor(rColor.Red), + toByteColor(rColor.Green), + toByteColor(rColor.Blue) )); + rAlphaAcc->SetPixel( aRect.Y1, x, + BitmapColor( 255 - toByteColor(rColor.Alpha) )); + } } } else { // read RGB color aRGBColors = rLayout.ColorSpace->convertIntegerToRGB(aPixelData); - for( sal_Int32 x=0; x<nWidth; ++x ) + if( rWriteAcc->HasPalette() ) + { + for( sal_Int32 x=0; x<nWidth; ++x ) + { + const rendering::RGBColor& rColor=aRGBColors[x]; + rWriteAcc->SetPixel( aRect.Y1, x, + (BYTE)rWriteAcc->GetBestPaletteIndex( + BitmapColor( toByteColor(rColor.Red), + toByteColor(rColor.Green), + toByteColor(rColor.Blue))) ); + } + } + else { - const rendering::RGBColor& rColor=aRGBColors[x]; - rWriteAcc->SetPixel( aRect.Y1, x, - BitmapColor( toByteColor(rColor.Red), - toByteColor(rColor.Green), - toByteColor(rColor.Blue) )); + for( sal_Int32 x=0; x<nWidth; ++x ) + { + const rendering::RGBColor& rColor=aRGBColors[x]; + rWriteAcc->SetPixel( aRect.Y1, x, + BitmapColor( toByteColor(rColor.Red), + toByteColor(rColor.Green), + toByteColor(rColor.Blue) )); + } } } } @@ -404,7 +437,7 @@ namespace vcl { // limit scoped access ScopedBitmapWriteAccess pWriteAccess( aBitmap.AcquireWriteAccess(), aBitmap ); - ScopedBitmapWriteAccess pAlphaWriteAccess( aAlpha.AcquireWriteAccess(), + ScopedBitmapWriteAccess pAlphaWriteAccess( nAlphaDepth ? aAlpha.AcquireWriteAccess() : NULL, aAlpha ); ENSURE_OR_THROW(pWriteAccess.get() != NULL, @@ -652,6 +685,23 @@ namespace vcl } return aRes; } + virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB( const uno::Sequence< double >& deviceColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) + { + const double* pIn( deviceColor.getConstArray() ); + const sal_Size nLen( deviceColor.getLength() ); + ENSURE_ARG_OR_THROW2(nLen%4==0, + "number of channels no multiple of 4", + static_cast<rendering::XColorSpace*>(this), 0); + + uno::Sequence< rendering::ARGBColor > aRes(nLen/4); + rendering::ARGBColor* pOut( aRes.getArray() ); + for( sal_Size i=0; i<nLen; i+=4 ) + { + *pOut++ = rendering::ARGBColor(pIn[3],pIn[3]*pIn[0],pIn[3]*pIn[1],pIn[3]*pIn[2]); + pIn += 4; + } + return aRes; + } virtual uno::Sequence< double > SAL_CALL convertFromRGB( const uno::Sequence< rendering::RGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) { const rendering::RGBColor* pIn( rgbColor.getConstArray() ); @@ -686,6 +736,23 @@ namespace vcl } return aRes; } + virtual uno::Sequence< double > SAL_CALL convertFromPARGB( const uno::Sequence< rendering::ARGBColor >& rgbColor ) throw (lang::IllegalArgumentException, uno::RuntimeException) + { + const rendering::ARGBColor* pIn( rgbColor.getConstArray() ); + const sal_Size nLen( rgbColor.getLength() ); + + uno::Sequence< double > aRes(nLen*4); + double* pColors=aRes.getArray(); + for( sal_Size i=0; i<nLen; ++i ) + { + *pColors++ = pIn->Red/pIn->Alpha; + *pColors++ = pIn->Green/pIn->Alpha; + *pColors++ = pIn->Blue/pIn->Alpha; + *pColors++ = pIn->Alpha; + ++pIn; + } + return aRes; + } public: StandardColorSpace() : m_aComponentTags(4) diff --git a/vcl/source/helper/threadex.cxx b/vcl/source/helper/threadex.cxx index 637d9919f933..ae6a5935d23e 100644 --- a/vcl/source/helper/threadex.cxx +++ b/vcl/source/helper/threadex.cxx @@ -115,9 +115,12 @@ long SolarThreadExecutor::impl_execute( const TimeValue* _pTimeout ) osl_resetCondition( m_aStart ); osl_resetCondition( m_aFinish ); ULONG nSolarMutexCount = Application::ReleaseSolarMutex(); - Application::PostUserEvent( LINK( this, SolarThreadExecutor, worker ) ); + ULONG nEvent = Application::PostUserEvent( LINK( this, SolarThreadExecutor, worker ) ); if ( osl_cond_result_timeout == osl_waitCondition( m_aStart, _pTimeout ) ) + { m_bTimeout = true; + Application::RemoveUserEvent( nEvent ); + } else osl_waitCondition( m_aFinish, NULL ); if( nSolarMutexCount ) diff --git a/vcl/source/src/images.src b/vcl/source/src/images.src index 44ab1e4f70ee..a2b057c8d234 100644 --- a/vcl/source/src/images.src +++ b/vcl/source/src/images.src @@ -112,7 +112,14 @@ Bitmap (SV_RESID_BITMAP_RADIO + SV_RESID_MONOOFFSET) Bitmap SV_RESID_BITMAP_MSGBOX { - File = "msgbox.bmp"; + File = "msgbox.png"; +}; + +// ----------------------------------------------------------------------- + +Bitmap SV_RESID_BITMAP_MSGBOX_HC +{ + File = "msgbox_hc.png"; }; // ----------------------------------------------------------------------- diff --git a/vcl/source/window/dndevdis.cxx b/vcl/source/window/dndevdis.cxx index 168c20fc5188..3b317ab18cae 100644 --- a/vcl/source/window/dndevdis.cxx +++ b/vcl/source/window/dndevdis.cxx @@ -89,7 +89,7 @@ void SAL_CALL DNDEventDispatcher::drop( const DropTargetDropEvent& dtde ) while( pChildWindow->ImplGetClientWindow() ) pChildWindow = pChildWindow->ImplGetClientWindow(); - if( pChildWindow->ImplHasMirroredGraphics() && !pChildWindow->IsRTLEnabled() ) + if( pChildWindow->ImplIsAntiparallel() ) pChildWindow->ImplReMirror( location ); aSolarGuard.clear(); @@ -145,7 +145,7 @@ void SAL_CALL DNDEventDispatcher::dragEnter( const DropTargetDragEnterEvent& dtd while( pChildWindow->ImplGetClientWindow() ) pChildWindow = pChildWindow->ImplGetClientWindow(); - if( pChildWindow->ImplHasMirroredGraphics() && !pChildWindow->IsRTLEnabled() ) + if( pChildWindow->ImplIsAntiparallel() ) pChildWindow->ImplReMirror( location ); aSolarGuard.clear(); @@ -208,7 +208,7 @@ void SAL_CALL DNDEventDispatcher::dragOver( const DropTargetDragEvent& dtde ) while( pChildWindow->ImplGetClientWindow() ) pChildWindow = pChildWindow->ImplGetClientWindow(); - if( pChildWindow->ImplHasMirroredGraphics() && !pChildWindow->IsRTLEnabled() ) + if( pChildWindow->ImplIsAntiparallel() ) pChildWindow->ImplReMirror( location ); aSolarGuard.clear(); @@ -266,7 +266,7 @@ void SAL_CALL DNDEventDispatcher::dropActionChanged( const DropTargetDragEvent& while( pChildWindow->ImplGetClientWindow() ) pChildWindow = pChildWindow->ImplGetClientWindow(); - if( pChildWindow->ImplHasMirroredGraphics() && !pChildWindow->IsRTLEnabled() ) + if( pChildWindow->ImplIsAntiparallel() ) pChildWindow->ImplReMirror( location ); aSolarGuard.clear(); @@ -323,7 +323,7 @@ void SAL_CALL DNDEventDispatcher::dragGestureRecognized( const DragGestureEvent& while( pChildWindow->ImplGetClientWindow() ) pChildWindow = pChildWindow->ImplGetClientWindow(); - if( pChildWindow->ImplHasMirroredGraphics() && !pChildWindow->IsRTLEnabled() ) + if( pChildWindow->ImplIsAntiparallel() ) pChildWindow->ImplReMirror( origin ); aSolarGuard.clear(); diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index fa2ba198a755..b5f1ada74a98 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -768,6 +768,8 @@ void ImplPopupFloatWin::MouseButtonDown( const MouseEvent& rMEvt ) { // get mouse pos at a static window to have a fixed reference point PointerState aState = GetParent()->GetPointerState(); + if (ImplHasMirroredGraphics() && IsRTLEnabled()) + ImplMirrorFramePos(aState.maPos); maTearOffPosition = GetWindow( WINDOW_BORDER )->GetPosPixel(); maDelta = aState.maPos - maTearOffPosition; } @@ -786,6 +788,8 @@ void ImplPopupFloatWin::Tracking( const TrackingEvent& rTEvt ) { // move the window according to mouse pos PointerState aState = GetParent()->GetPointerState(); + if (ImplHasMirroredGraphics() && IsRTLEnabled()) + ImplMirrorFramePos(aState.maPos); maTearOffPosition = aState.maPos - maDelta; GetWindow( WINDOW_BORDER )->SetPosPixel( maTearOffPosition ); } diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 69d422fe372b..81f6380ad160 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2291,7 +2291,7 @@ Size Menu::ImplCalcSize( Window* pWin ) for ( USHORT i = (USHORT)pItemList->Count(); i; ) { MenuItemData* pData = pItemList->GetDataFromPos( --i ); - if ( ImplIsVisible( i ) && ( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE )) + if ( ImplIsVisible( i ) && (( pData->eType == MENUITEM_IMAGE ) || ( pData->eType == MENUITEM_STRINGIMAGE ))) { Size aImgSz = pData->aImage.GetSizePixel(); if ( aImgSz.Height() > aMaxImgSz.Height() ) @@ -3577,7 +3577,15 @@ USHORT PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, ULONG nPopupM if ( GetItemCount() ) { SalMenu* pMenu = ImplGetSalMenu(); - if( pMenu && pMenu->ShowNativePopupMenu( pWin, aRect, nPopupModeFlags | FLOATWIN_POPUPMODE_GRABFOCUS ) ) + Rectangle aNativeRect( aRect ); + if( pW->IsRTLEnabled() && Application::GetSettings().GetLayoutRTL() ) + { + Point aPt( aRect.TopLeft() ); + aPt.X() += aSz.Width(); + pW->ImplMirrorFramePos( aPt ); + aNativeRect = Rectangle( aPt, aNativeRect.GetSize() ); + } + if( pMenu && pMenu->ShowNativePopupMenu( pWin, aNativeRect, nPopupModeFlags | FLOATWIN_POPUPMODE_GRABFOCUS ) ) { pWin->StopExecute(0); pWin->doShutdown(); diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx index b7124506e5e8..bd727092a836 100644 --- a/vcl/source/window/msgbox.cxx +++ b/vcl/source/window/msgbox.cxx @@ -58,15 +58,17 @@ static void ImplInitMsgBoxImageList() ImplSVData* pSVData = ImplGetSVData(); if ( !pSVData->maWinData.mpMsgBoxImgList ) { - BitmapEx aBmpEx; ResMgr* pResMgr = ImplGetResMgr(); pSVData->maWinData.mpMsgBoxImgList = new ImageList(4); + pSVData->maWinData.mpMsgBoxHCImgList = new ImageList(4); if( pResMgr ) { Color aNonAlphaMask( 0xC0, 0xC0, 0xC0 ); pSVData->maWinData.mpMsgBoxImgList->InsertFromHorizontalBitmap ( ResId( SV_RESID_BITMAP_MSGBOX, *pResMgr ), 4, &aNonAlphaMask ); - } + pSVData->maWinData.mpMsgBoxHCImgList->InsertFromHorizontalBitmap + ( ResId( SV_RESID_BITMAP_MSGBOX_HC, *pResMgr ), 4, &aNonAlphaMask ); + } } } @@ -498,7 +500,8 @@ void InfoBox::ImplInitInfoBoxData() if ( !GetText().Len() ) SetText( Application::GetDisplayName() ); - SetImage( InfoBox::GetStandardImage() ); + SetImage( GetSettings().GetStyleSettings().GetDialogColor().IsDark() ? + InfoBox::GetStandardImageHC() : InfoBox::GetStandardImage() ); mnSoundType = ((USHORT)SOUND_INFO)+1; } @@ -528,6 +531,14 @@ Image InfoBox::GetStandardImage() // ----------------------------------------------------------------------- +Image InfoBox::GetStandardImageHC() +{ + ImplInitMsgBoxImageList(); + return ImplGetSVData()->maWinData.mpMsgBoxHCImgList->GetImage( 4 ); +} + +// ----------------------------------------------------------------------- + void WarningBox::ImplInitWarningBoxData() { // Default Text is the display title from the application @@ -580,7 +591,8 @@ void ErrorBox::ImplInitErrorBoxData() if ( !GetText().Len() ) SetText( Application::GetDisplayName() ); - SetImage( ErrorBox::GetStandardImage() ); + SetImage( GetSettings().GetStyleSettings().GetDialogColor().IsDark() ? + ErrorBox::GetStandardImageHC() : ErrorBox::GetStandardImage() ); mnSoundType = ((USHORT)SOUND_ERROR)+1; } @@ -611,13 +623,22 @@ Image ErrorBox::GetStandardImage() // ----------------------------------------------------------------------- +Image ErrorBox::GetStandardImageHC() +{ + ImplInitMsgBoxImageList(); + return ImplGetSVData()->maWinData.mpMsgBoxHCImgList->GetImage( 1 ); +} + +// ----------------------------------------------------------------------- + void QueryBox::ImplInitQueryBoxData() { // Default Text is the display title from the application if ( !GetText().Len() ) SetText( Application::GetDisplayName() ); - SetImage( QueryBox::GetStandardImage() ); + SetImage( GetSettings().GetStyleSettings().GetDialogColor().IsDark() ? + QueryBox::GetStandardImageHC() : QueryBox::GetStandardImage() ); mnSoundType = ((USHORT)SOUND_QUERY)+1; } @@ -654,6 +675,16 @@ Image QueryBox::GetStandardImage() return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 2 ); } +// ----------------------------------------------------------------------- + +Image QueryBox::GetStandardImageHC() +{ + ImplInitMsgBoxImageList(); + return ImplGetSVData()->maWinData.mpMsgBoxHCImgList->GetImage( 2 ); +} + +// ----------------------------------------------------------------------- + Size MessBox::GetOptimalSize(WindowSizeType eType) const { switch( eType ) { diff --git a/vcl/source/window/scrwnd.cxx b/vcl/source/window/scrwnd.cxx index 31870b45ff06..4b77477976a9 100644 --- a/vcl/source/window/scrwnd.cxx +++ b/vcl/source/window/scrwnd.cxx @@ -31,7 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <math.h> +// #include <math.h> #include <limits.h> #include <tools/time.hxx> #include <tools/debug.hxx> diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 3fdc789bf781..d9891430f29d 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: window.cxx,v $ - * $Revision: 1.286 $ + * $Revision: 1.285.38.2 $ * * This file is part of OpenOffice.org. * @@ -100,6 +100,8 @@ #include "vcl/pdfextoutdevdata.hxx" #include "vcl/lazydelete.hxx" +#include <set> + using namespace rtl; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -380,10 +382,25 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, BOOL bCallHdl ) if( defFontheight > maxFontheight ) defFontheight = maxFontheight; - // if the UI is korean, always use 9pt + // if the UI is korean, chinese or another locale + // where the system font size is kown to be often too small to + // generate readable fonts enforce a minimum font size of 9 points + bool bBrokenLangFontHeight = false; + static const LanguageType eBrokenSystemFontSizeLanguages[] = + { LANGUAGE_KOREAN, LANGUAGE_KOREAN_JOHAB, + LANGUAGE_CHINESE_HONGKONG, LANGUAGE_CHINESE_MACAU, LANGUAGE_CHINESE_SIMPLIFIED, LANGUAGE_CHINESE_SINGAPORE, LANGUAGE_CHINESE_TRADITIONAL + }; + static std::set< LanguageType > aBrokenSystemFontSizeLanguagesSet( + eBrokenSystemFontSizeLanguages, + eBrokenSystemFontSizeLanguages + + (sizeof(eBrokenSystemFontSizeLanguages)/sizeof(eBrokenSystemFontSizeLanguages[0])) + ); LanguageType aLang = Application::GetSettings().GetUILanguage(); - if( aLang == LANGUAGE_KOREAN || aLang == LANGUAGE_KOREAN_JOHAB ) + if( aBrokenSystemFontSizeLanguagesSet.find( aLang ) != aBrokenSystemFontSizeLanguagesSet.end() ) + { defFontheight = Max(9, defFontheight); + bBrokenLangFontHeight = true; + } // i22098, toolfont will be scaled differently to avoid bloated rulers and status bars for big fonts int toolfontheight = defFontheight; @@ -393,18 +410,28 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, BOOL bCallHdl ) aFont = aStyleSettings.GetAppFont(); aFont.SetHeight( defFontheight ); aStyleSettings.SetAppFont( aFont ); - //aFont = aStyleSettings.GetHelpFont(); - //aFont.SetHeight( defFontheight ); - //aStyleSettings.SetHelpFont( aFont ); aFont = aStyleSettings.GetTitleFont(); aFont.SetHeight( defFontheight ); aStyleSettings.SetTitleFont( aFont ); aFont = aStyleSettings.GetFloatTitleFont(); aFont.SetHeight( defFontheight ); aStyleSettings.SetFloatTitleFont( aFont ); - //aFont = aStyleSettings.GetMenuFont(); - //aFont.SetHeight( defFontheight ); - //aStyleSettings.SetMenuFont( aFont ); + // keep menu and help font size from system unless in broken locale size + if( bBrokenLangFontHeight ) + { + aFont = aStyleSettings.GetMenuFont(); + if( aFont.GetHeight() < defFontheight ) + { + aFont.SetHeight( defFontheight ); + aStyleSettings.SetMenuFont( aFont ); + } + aFont = aStyleSettings.GetHelpFont(); + if( aFont.GetHeight() < defFontheight ) + { + aFont.SetHeight( defFontheight ); + aStyleSettings.SetHelpFont( aFont ); + } + } // use different height for toolfont aFont = aStyleSettings.GetToolFont(); @@ -682,7 +709,7 @@ void Window::ImplInitWindowData( WindowType nType ) mpWindowImpl->mbDisableAccessibleLabelForRelation = FALSE; // TRUE: do not set LabelFor relation on accessible objects mpWindowImpl->mbDisableAccessibleLabeledByRelation = FALSE; // TRUE: do not set LabeledBy relation on accessible objects - mbEnableRTL = TRUE; // TRUE: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active + mbEnableRTL = Application::GetSettings().GetLayoutRTL(); // TRUE: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active } // ----------------------------------------------------------------------- @@ -747,6 +774,9 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste mpWindowImpl->mpOverlapData->mnTopLevel = 1; } + if( pParent && ! mpWindowImpl->mbFrame ) + mbEnableRTL = pParent->mbEnableRTL; + // test for frame creation if ( mpWindowImpl->mbFrame ) { @@ -1361,7 +1391,7 @@ Window* Window::ImplFindWindow( const Point& rFramePos ) USHORT Window::ImplHitTest( const Point& rFramePos ) { Point aFramePos( rFramePos ); - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { // - RTL - re-mirror frame pos at this window ImplReMirror( aFramePos ); @@ -2374,7 +2404,7 @@ void Window::ImplCallPaint( const Region* pRegion, USHORT nPaintFlags ) Rectangle aPaintRect = aPaintRegion.GetBoundRect(); // - RTL - re-mirror paint rect and region at this window - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { ImplReMirror( aPaintRect ); ImplReMirror( aPaintRegion ); @@ -2648,7 +2678,7 @@ void Window::ImplInvalidate( const Region* pRegion, USHORT nFlags ) if ( pRegion ) { // --- RTL --- remirror region before intersecting it - if ( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if ( ImplIsAntiparallel() ) { Region aRgn( *pRegion ); ImplReMirror( aRgn ); @@ -2869,7 +2899,7 @@ void Window::ImplScroll( const Rectangle& rRect, bScrollChilds = FALSE; // --- RTL --- check if this window requires special action - BOOL bReMirror = ( ImplHasMirroredGraphics() && !IsRTLEnabled() ); + BOOL bReMirror = ( ImplIsAntiparallel() ); Rectangle aRectMirror( rRect ); if( bReMirror ) @@ -3241,12 +3271,21 @@ void Window::ImplPosSizeWindow( long nX, long nY, // #106948# always mirror our pos if our parent is not mirroring, even // if we are also not mirroring // --- RTL --- check if parent is in different coordinates - if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplHasMirroredGraphics() && !mpWindowImpl->mpParent->IsRTLEnabled() ) + if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() ) + { + // --- RTL --- (re-mirror at parent window) + nX = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - nX; + } + } + else if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() ) + { + // mirrored window in LTR UI { // --- RTL --- (re-mirror at parent window) nX = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - nX; } } + // check maPos as well, as it could have been changed for client windows (ImplCallMove()) if ( mpWindowImpl->mnAbsScreenX != aPtDev.X() || nX != mpWindowImpl->mnX || nOrgX != mpWindowImpl->maPos.X() ) { @@ -6105,7 +6144,7 @@ Region Window::GetWindowClipRegionPixel( USHORT nFlags ) const Region* pWinChildClipRegion = ((Window*)this)->ImplGetWinChildClipRegion(); aWinClipRegion = *pWinChildClipRegion; // --- RTL --- remirror clip region before passing it to somebody - if( ((Window*)this)->ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) ImplReMirror( aWinClipRegion ); } @@ -6153,7 +6192,7 @@ void Window::ExpandPaintClipRegion( const Region& rRegion ) Region aWinChildRegion = *ImplGetWinChildClipRegion(); // --- RTL -- only this region is in frame coordinates, so re-mirror it - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) ImplReMirror( aWinChildRegion ); aDevPixRegion.Intersect( aWinChildRegion ); if( ! aDevPixRegion.IsEmpty() ) @@ -7175,7 +7214,7 @@ void Window::SetPosSizePixel( long nX, long nY, Window* pParent = pWindow->GetParent(); nX += pParent->mnOutOffX; } - if( GetParent() && GetParent()->ImplHasMirroredGraphics() && !GetParent()->IsRTLEnabled() ) + if( GetParent() && GetParent()->ImplIsAntiparallel() ) { // --- RTL --- (re-mirror at parent window) Rectangle aRect( Point ( nX, nY ), Size( nWidth, nHeight ) ); @@ -7297,7 +7336,7 @@ long Window::ImplGetUnmirroredOutOffX() long offx = mnOutOffX; if( ImplHasMirroredGraphics() ) { - if( mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplHasMirroredGraphics() && !mpWindowImpl->mpParent->IsRTLEnabled() ) + if( mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() ) { if ( !ImplIsOverlapWindow() ) offx -= mpWindowImpl->mpParent->mnOutOffX; @@ -7830,6 +7869,10 @@ void Window::SetPointerPosPixel( const Point& rPos ) // mirroring is required here, SetPointerPos bypasses SalGraphics mpGraphics->mirror( aPos.X(), this ); } + else if( ImplIsAntiparallel() ) + { + ImplReMirror( aPos ); + } mpWindowImpl->mpFrame->SetPointerPos( aPos.X(), aPos.Y() ); } @@ -7840,7 +7883,7 @@ Point Window::GetPointerPosPixel() DBG_CHKTHIS( Window, ImplDbgCheckWindow ); Point aPos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY ); - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { // --- RTL --- (re-mirror mouse pos at this window) ImplReMirror( aPos ); @@ -7855,13 +7898,11 @@ Point Window::GetLastPointerPosPixel() DBG_CHKTHIS( Window, ImplDbgCheckWindow ); Point aPos( mpWindowImpl->mpFrameData->mnBeforeLastMouseX, mpWindowImpl->mpFrameData->mnBeforeLastMouseY ); -#ifndef REMOTE_APPSERVER - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { // --- RTL --- (re-mirror mouse pos at this window) ImplReMirror( aPos ); } -#endif return ImplFrameToOutput( aPos ); } @@ -7893,7 +7934,7 @@ Window::PointerState Window::GetPointerState() SalFrame::SalPointerState aSalPointerState; aSalPointerState = mpWindowImpl->mpFrame->GetPointerState(); - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { // --- RTL --- (re-mirror mouse pos at this window) ImplReMirror( aSalPointerState.maPos ); @@ -9661,7 +9702,7 @@ Reference< ::com::sun::star::rendering::XSpriteCanvas > Window::GetFullscreenSpr return xSpriteCanvas; } -void Window::ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev, const Region* pOuterClip ) +void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rPos ) { BOOL bRVisible = mpWindowImpl->mbReallyVisible; mpWindowImpl->mbReallyVisible = mpWindowImpl->mbVisible; @@ -9670,8 +9711,8 @@ void Window::ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev long nOldDPIX = ImplGetDPIX(); long nOldDPIY = ImplGetDPIY(); - mnDPIX = pTargetOutDev->ImplGetDPIX(); - mnDPIY = pTargetOutDev->ImplGetDPIY(); + mnDPIX = i_pTargetOutDev->ImplGetDPIX(); + mnDPIY = i_pTargetOutDev->ImplGetDPIY(); BOOL bOutput = IsOutputEnabled(); EnableOutput(); @@ -9683,8 +9724,8 @@ void Window::ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev SetClipRegion(); GDIMetaFile* pOldMtf = GetConnectMetaFile(); - pMtf->WindEnd(); - SetConnectMetaFile( pMtf ); + GDIMetaFile aMtf; + SetConnectMetaFile( &aMtf ); // put a push action to metafile Push(); @@ -9709,6 +9750,10 @@ void Window::ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev SetTextLineColor( GetTextLineColor() ); else SetTextLineColor(); + if( IsOverlineColor() ) + SetOverlineColor( GetOverlineColor() ); + else + SetOverlineColor(); if( IsTextFillColor() ) SetTextFillColor( GetTextFillColor() ); else @@ -9723,8 +9768,6 @@ void Window::ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev SetDigitLanguage( GetDigitLanguage() ); Rectangle aPaintRect( Point( 0, 0 ), GetOutputSizePixel() ); aClipRegion.Intersect( aPaintRect ); - if( pOuterClip ) - aClipRegion.Intersect( *pOuterClip ); SetClipRegion( aClipRegion ); // do the actual paint @@ -9741,37 +9784,30 @@ void Window::ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev EnableOutput( bOutput ); mpWindowImpl->mbReallyVisible = bRVisible; + // paint metafile to VDev + VirtualDevice* pMaskedDevice = new VirtualDevice( *i_pTargetOutDev, 0, 0 ); + pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel() ); + pMaskedDevice->EnableRTL( IsRTLEnabled() ); + aMtf.WindStart(); + aMtf.Play( pMaskedDevice ); + BitmapEx aBmpEx( pMaskedDevice->GetBitmapEx( Point( 0, 0 ), pMaskedDevice->GetOutputSizePixel() ) ); + i_pTargetOutDev->DrawBitmapEx( i_rPos, aBmpEx ); + // get rid of virtual device now so they don't pile up during recursive calls + delete pMaskedDevice, pMaskedDevice = NULL; + + for( Window* pChild = mpWindowImpl->mpFirstChild; pChild; pChild = pChild->mpWindowImpl->mpNext ) { if( pChild->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame && pChild->IsVisible() ) { - Region aClip( aPaintRect ); - if( pOuterClip ) - aClip.Intersect( *pOuterClip ); - sal_Int32 nDeltaX = GetOutOffXPixel() - pChild->GetOutOffXPixel(); - sal_Int32 nDeltaY = GetOutOffYPixel() - pChild->GetOutOffYPixel(); - pMtf->Move( nDeltaX, nDeltaY ); - aClip.Move( nDeltaX, nDeltaY ); - pChild->ImplPaintToMetaFile( pMtf, pTargetOutDev, &aClip ); - pMtf->Move( -nDeltaX, -nDeltaY ); - } - } - - for( Window* pOverlap = mpWindowImpl->mpFirstOverlap; pOverlap; pOverlap = pOverlap->mpWindowImpl->mpNext ) - { - if( pOverlap->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame && pOverlap->IsVisible() ) - { - Region aClip; - sal_Int32 nDeltaX = GetOutOffXPixel() - pOverlap->GetOutOffXPixel(); - sal_Int32 nDeltaY = GetOutOffYPixel() - pOverlap->GetOutOffYPixel(); - pMtf->Move( nDeltaX, nDeltaY ); - if( pOuterClip ) - { - aClip = *pOuterClip; - aClip.Move( nDeltaX, nDeltaY ); - } - pOverlap->ImplPaintToMetaFile( pMtf, pTargetOutDev, pOuterClip ? &aClip : NULL ); - pMtf->Move( -nDeltaX, -nDeltaY ); + long nDeltaX = pChild->mnOutOffX - mnOutOffX; + if( ImplHasMirroredGraphics() ) + nDeltaX = mnOutWidth - nDeltaX - pChild->mnOutWidth; + long nDeltaY = pChild->GetOutOffYPixel() - GetOutOffYPixel(); + Point aPos( i_rPos ); + Point aDelta( nDeltaX, nDeltaY ); + aPos += aDelta; + pChild->ImplPaintToDevice( i_pTargetOutDev, aPos ); } } @@ -9788,7 +9824,11 @@ void Window::ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev void Window::PaintToDevice( OutputDevice* pDev, const Point& rPos, const Size& /*rSize*/ ) { // FIXME: scaling: currently this is for pixel copying only - GDIMetaFile aMF; + + DBG_ASSERT( ! pDev->ImplHasMirroredGraphics(), "PaintToDevice to mirroring graphics" ); + DBG_ASSERT( ! pDev->IsRTLEnabled(), "PaintToDevice to mirroring device" ); + + Point aPos = pDev->LogicToPixel( rPos ); Window* pRealParent = NULL; @@ -9808,23 +9848,14 @@ void Window::PaintToDevice( OutputDevice* pDev, const Point& rPos, const Size& / mpWindowImpl->mbVisible = TRUE; if( mpWindowImpl->mpBorderWindow ) - mpWindowImpl->mpBorderWindow->ImplPaintToMetaFile( &aMF, pDev ); + mpWindowImpl->mpBorderWindow->ImplPaintToDevice( pDev, rPos ); else - ImplPaintToMetaFile( &aMF, pDev ); + ImplPaintToDevice( pDev, rPos ); mpWindowImpl->mbVisible = bVisible; if( pRealParent ) SetParent( pRealParent ); - - pDev->Push(); - pDev->SetMapMode(); - - aMF.Move( aPos.X(), aPos.Y() ); - aMF.WindStart(); - aMF.Play( pDev ); - - pDev->Pop(); } XubString Window::GetSurroundingText() const diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 42389fc12e40..d70f607a6cc6 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -68,8 +68,6 @@ DBG_NAMEEX( Window ) #define IMPL_MAXSAVEBACKSIZE (640*480) #define IMPL_MAXALLSAVEBACKSIZE (800*600*2) -//#define USE_NEW_RTL_IMPLEMENTATION - // ======================================================================= struct ImplFocusDelData : public ImplDelData @@ -690,15 +688,10 @@ IMPL_LINK( Window, ImplTrackTimerHdl, Timer*, pTimer ) // Tracking-Event erzeugen Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY ); - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { // - RTL - re-mirror frame pos at pChild -#ifdef USE_NEW_RTL_IMPLEMENTATION - Window *pRefWindow = (Window*) mpDummy4; - pRefWindow->ImplReMirror( aMousePos ); -#else ImplReMirror( aMousePos ); -#endif } MouseEvent aMEvt( ImplFrameToOutput( aMousePos ), mpWindowImpl->mpFrameData->mnClickCount, 0, @@ -768,15 +761,10 @@ void Window::EndTracking( USHORT nFlags ) if ( !(nFlags & ENDTRACK_DONTCALLHDL) ) { Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY ); - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { // - RTL - re-mirror frame pos at pChild -#ifdef USE_NEW_RTL_IMPLEMENTATION - Window *pRefWindow = (Window*) mpDummy4; - pRefWindow->ImplReMirror( aMousePos ); -#else ImplReMirror( aMousePos ); -#endif } MouseEvent aMEvt( ImplFrameToOutput( aMousePos ), @@ -1459,11 +1447,19 @@ Window* Window::ImplGetTopmostFrameWindow() // making these Methods out of line to be able to change them lateron without complete rebuild // TODO: Set the SmartId in here and remove mpWindowImpl->mnHelpId -void Window::SetHelpId( ULONG nHelpId ) { mpWindowImpl->mnHelpId = nHelpId; } -ULONG Window::GetHelpId() const { return mpWindowImpl->mnHelpId; } +void Window::SetHelpId( ULONG nHelpId ) +{ + SetSmartHelpId(SmartId(nHelpId)); +} + +ULONG Window::GetHelpId() const +{ + return mpWindowImpl->mnHelpId; +} void Window::SetSmartHelpId( const SmartId& aId, SmartIdUpdateMode aMode ) { + mpWindowImpl->maHelpText = String(); // create SmartId if required if ( (aMode == SMART_SET_STR) || (aMode == SMART_SET_ALL) || ( (aMode == SMART_SET_SMART) && aId.HasString() ) ) { @@ -1476,7 +1472,9 @@ void Window::SetSmartHelpId( const SmartId& aId, SmartIdUpdateMode aMode ) ImplGetWinData()->mpSmartHelpId->UpdateId( aId, aMode ); if ( (aMode == SMART_SET_NUM) || (aMode == SMART_SET_ALL) || ( (aMode == SMART_SET_SMART) && aId.HasNumeric() ) ) + { mpWindowImpl->mnHelpId = aId.GetNum(); + } } SmartId Window::GetSmartHelpId() const diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 56fcdee394d3..a8be05bf4909 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -80,9 +80,6 @@ extern void MyOutputDebugString( char *s); #endif -//#define USE_NEW_RTL_IMPLEMENTATION - - // ======================================================================= #define IMPL_MIN_NEEDSYSWIN 49 @@ -458,15 +455,10 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, // Ein paar Test ausfuehren und Message abfangen oder Status umsetzen if ( pChild ) { - if( pChild->ImplHasMirroredGraphics() && !pChild->IsRTLEnabled() ) + if( pChild->ImplIsAntiparallel() ) { // - RTL - re-mirror frame pos at pChild -#ifdef USE_NEW_RTL_IMPLEMENTATION - Window *pRefWindow = (Window*) pChild->mpDummy4; - pRefWindow->ImplReMirror( aMousePos ); -#else pChild->ImplReMirror( aMousePos ); -#endif } // no mouse messages to system object windows ? // !!!KA: Is it OK to comment this out? !!! diff --git a/vcl/test/canvasbitmaptest.cxx b/vcl/test/canvasbitmaptest.cxx index 18b677659774..ae0e79f0959f 100644 --- a/vcl/test/canvasbitmaptest.cxx +++ b/vcl/test/canvasbitmaptest.cxx @@ -32,6 +32,7 @@ #include "precompiled_vcl.hxx" // bootstrap stuff +#include <sal/main.h> #include <rtl/bootstrap.hxx> #include <rtl/ref.hxx> #include <comphelper/processfactory.hxx> @@ -54,20 +55,45 @@ #include <cppuhelper/compbase3.hxx> #include <tools/diagnose_ex.h> +#include <tools/extendapplicationenvironment.hxx> #include "vcl/svapp.hxx" #include "vcl/canvastools.hxx" +#include "vcl/canvasbitmap.hxx" #include "vcl/dialog.hxx" #include "vcl/outdev.hxx" #include "vcl/bmpacc.hxx" #include "vcl/virdev.hxx" #include "vcl/bitmapex.hxx" -#include "canvasbitmap.hxx" using namespace ::com::sun::star; using namespace ::vcl::unotools; +// ----------------------------------------------------------------------- + +void Main(); + +// ----------------------------------------------------------------------- + +SAL_IMPLEMENT_MAIN() +{ + tools::extendApplicationEnvironment(); + + uno::Reference< lang::XMultiServiceFactory > xMS; + xMS = cppu::createRegistryServiceFactory( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), + sal_True ); + + InitVCL( xMS ); + ::Main(); + DeInitVCL(); + + return 0; +} + +// ----------------------------------------------------------------------- + namespace com { namespace sun { namespace star { namespace rendering { @@ -258,28 +284,28 @@ void checkCanvasBitmap( const rtl::Reference<VclCanvasBitmap>& xBmp, if( nOriginalDepth > 8 ) { const uno::Sequence<sal_Int8> aComponentTags( xBmp->getComponentTags() ); - uno::Sequence<rendering::ARGBColor> aARGBColors(1); - uno::Sequence<rendering::RGBColor> aRGBColors(1); + uno::Sequence<rendering::ARGBColor> aARGBColor(1); + uno::Sequence<rendering::RGBColor> aRGBColor(1); uno::Sequence<sal_Int8> aPixel3, aPixel4; const Color aCol(COL_GREEN); - aARGBColors[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed()); - aARGBColors[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen()); - aARGBColors[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue()); - aARGBColors[0].Alpha = 1.0; + aARGBColor[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed()); + aARGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen()); + aARGBColor[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue()); + aARGBColor[0].Alpha = 1.0; - aRGBColors[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed()); - aRGBColors[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen()); - aRGBColors[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue()); + aRGBColor[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed()); + aRGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen()); + aRGBColor[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue()); - aPixel3 = xBmp->convertIntegerFromARGB( aARGBColors ); + aPixel3 = xBmp->convertIntegerFromARGB( aARGBColor ); aPixel4 = xBmp->getPixel( aLayout, geometry::IntegerPoint2D(5,0) ); test( aPixel3 == aPixel4, "Green pixel from bitmap matches with manually converted green pixel" ); if( !aContainedBmpEx.IsTransparent() ) { - aPixel3 = xBmp->convertIntegerFromRGB( aRGBColors ); + aPixel3 = xBmp->convertIntegerFromRGB( aRGBColor ); test( aPixel3 == aPixel4, "Green pixel from bitmap matches with manually RGB-converted green pixel" ); } @@ -409,28 +435,28 @@ void checkBitmapImport( const rtl::Reference<VclCanvasBitmap>& xBmp, if( nOriginalDepth > 8 ) { const uno::Sequence<sal_Int8> aComponentTags( xBmp->getComponentTags() ); - uno::Sequence<rendering::ARGBColor> aARGBColors(1); - uno::Sequence<rendering::RGBColor> aRGBColors(1); + uno::Sequence<rendering::ARGBColor> aARGBColor(1); + uno::Sequence<rendering::RGBColor> aRGBColor(1); uno::Sequence<sal_Int8> aPixel3, aPixel4; const Color aCol(COL_GREEN); - aARGBColors[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed()); - aARGBColors[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen()); - aARGBColors[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue()); - aARGBColors[0].Alpha = 1.0; + aARGBColor[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed()); + aARGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen()); + aARGBColor[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue()); + aARGBColor[0].Alpha = 1.0; - aRGBColors[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed()); - aRGBColors[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen()); - aRGBColors[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue()); + aRGBColor[0].Red = vcl::unotools::toDoubleColor(aCol.GetRed()); + aRGBColor[0].Green = vcl::unotools::toDoubleColor(aCol.GetGreen()); + aRGBColor[0].Blue = vcl::unotools::toDoubleColor(aCol.GetBlue()); - aPixel3 = xBmp->convertIntegerFromARGB( aARGBColors ); + aPixel3 = xBmp->convertIntegerFromARGB( aARGBColor ); aPixel4 = xBmp->getPixel( aLayout, geometry::IntegerPoint2D(5,0) ); test( aPixel3 == aPixel4, "Green pixel from bitmap matches with manually converted green pixel" ); if( !aContainedBmpEx.IsTransparent() ) { - aPixel3 = xBmp->convertIntegerFromRGB( aRGBColors ); + aPixel3 = xBmp->convertIntegerFromRGB( aRGBColor ); test( aPixel3 == aPixel4, "Green pixel from bitmap matches with manually RGB-converted green pixel" ); } @@ -631,6 +657,13 @@ private: return uno::Sequence< rendering::ARGBColor >(); } + virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB( const uno::Sequence< double >& ) throw (lang::IllegalArgumentException, + uno::RuntimeException) + { + test(false, "Method not implemented"); + return uno::Sequence< rendering::ARGBColor >(); + } + virtual uno::Sequence< double > SAL_CALL convertFromRGB( const uno::Sequence< rendering::RGBColor >& ) throw (lang::IllegalArgumentException, uno::RuntimeException) { @@ -645,6 +678,13 @@ private: return uno::Sequence< double >(); } + virtual uno::Sequence< double > SAL_CALL convertFromPARGB( const uno::Sequence< rendering::ARGBColor >& ) throw (lang::IllegalArgumentException, + uno::RuntimeException) + { + test(false, "This method is not expected to be called!"); + return uno::Sequence< double >(); + } + virtual ::sal_Int32 SAL_CALL getBitsPerPixel( ) throw (uno::RuntimeException) { return mnBitsPerPixel; @@ -660,9 +700,17 @@ private: return util::Endianness::LITTLE; } - virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerColorSpace( const uno::Sequence< ::sal_Int8 >&, - const uno::Reference< rendering::XIntegerBitmapColorSpace >& ) throw (lang::IllegalArgumentException, - uno::RuntimeException) + virtual uno::Sequence< double > SAL_CALL convertFromIntegerColorSpace( const uno::Sequence< ::sal_Int8 >& , + const uno::Reference< rendering::XColorSpace >& ) throw (lang::IllegalArgumentException, + uno::RuntimeException) + { + test(false, "Method not implemented"); + return uno::Sequence< double >(); + } + + virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertToIntegerColorSpace( const uno::Sequence< ::sal_Int8 >& , + const uno::Reference< rendering::XIntegerBitmapColorSpace >& ) throw (lang::IllegalArgumentException, + uno::RuntimeException) { test(false, "Method not implemented"); return uno::Sequence< sal_Int8 >(); @@ -722,6 +770,44 @@ private: return aRes; } + virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException, + uno::RuntimeException) + { + const sal_Size nLen( deviceColor.getLength() ); + const sal_Int32 nBytesPerPixel(mnBitsPerPixel == 8 ? 1 : 4); + test(nLen%nBytesPerPixel==0, + "number of channels no multiple of pixel element count"); + + uno::Sequence< rendering::ARGBColor > aRes( nLen / nBytesPerPixel ); + rendering::ARGBColor* pOut( aRes.getArray() ); + + if( getPalette().is() ) + { + for( sal_Size i=0; i<nLen; ++i ) + { + *pOut++ = rendering::ARGBColor( + 1.0, + vcl::unotools::toDoubleColor(deviceColor[i]), + vcl::unotools::toDoubleColor(deviceColor[i]), + vcl::unotools::toDoubleColor(deviceColor[i])); + } + } + else + { + for( sal_Size i=0; i<nLen; i+=4 ) + { + const double fAlpha=vcl::unotools::toDoubleColor(deviceColor[i+3]); + *pOut++ = rendering::ARGBColor( + fAlpha, + fAlpha*vcl::unotools::toDoubleColor(deviceColor[i+0]), + fAlpha*vcl::unotools::toDoubleColor(deviceColor[i+1]), + fAlpha*vcl::unotools::toDoubleColor(deviceColor[i+2])); + } + } + + return aRes; + } + virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const uno::Sequence< rendering::RGBColor >& ) throw (lang::IllegalArgumentException, uno::RuntimeException) { @@ -736,6 +822,13 @@ private: return uno::Sequence< sal_Int8 >(); } + virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB( const uno::Sequence< rendering::ARGBColor >& ) throw (lang::IllegalArgumentException, + uno::RuntimeException) + { + test(false, "Method not implemented"); + return uno::Sequence< sal_Int8 >(); + } + public: TestBitmap( const geometry::IntegerSize2D& rSize, bool bPalette ) : maSize(rSize), @@ -784,14 +877,14 @@ public: void TestWindow::Paint( const Rectangle& ) { - static sal_Int8 lcl_depths[]={1,4,8,16,24,32}; + static sal_Int8 lcl_depths[]={1,4,8,16,24}; try { // Testing VclCanvasBitmap wrapper // =============================== - for( int i=0; i<sizeof(lcl_depths)/sizeof(*lcl_depths); ++i ) + for( unsigned int i=0; i<sizeof(lcl_depths)/sizeof(*lcl_depths); ++i ) { const sal_Int8 nDepth( lcl_depths[i] ); Bitmap aBitmap(Size(200,200),nDepth); @@ -801,8 +894,8 @@ void TestWindow::Paint( const Rectangle& ) aBitmap); if( pAcc.get() ) { - BitmapColor aBlack; - BitmapColor aWhite; + BitmapColor aBlack(0); + BitmapColor aWhite(0); if( pAcc->HasPalette() ) { aBlack.SetIndex( sal::static_int_cast<BYTE>(pAcc->GetBestPaletteIndex(BitmapColor(0,0,0))) ); @@ -943,73 +1036,14 @@ void TestWindow::Paint( const Rectangle& ) exit(2); } -USHORT TestApp::Exception( USHORT nError ) -{ - switch( nError & EXC_MAJORTYPE ) - { - case EXC_RSCNOTLOADED: - Abort( String::CreateFromAscii( - "Error: could not load language resources.\nPlease check your installation.\n" ) ); - break; - } - return 0; -} +} // namespace -void TestApp::Main() +void Main() { - bool bHelp = false; - - for( USHORT i = 0; i < GetCommandLineParamCount(); i++ ) - { - ::rtl::OUString aParam = GetCommandLineParam( i ); - - if( aParam.equalsAscii( "--help" ) || - aParam.equalsAscii( "-h" ) ) - bHelp = true; - } - - if( bHelp ) - { - printf( "outdevgrind - Profile OutputDevice\n" ); - return; - } - - //------------------------------------------------- - // create the global service-manager - //------------------------------------------------- - uno::Reference< lang::XMultiServiceFactory > xFactory; - try - { - uno::Reference< uno::XComponentContext > xCtx = ::cppu::defaultBootstrap_InitialComponentContext(); - xFactory = uno::Reference< lang::XMultiServiceFactory >( xCtx->getServiceManager(), - uno::UNO_QUERY ); - if( xFactory.is() ) - ::comphelper::setProcessServiceFactory( xFactory ); - } - catch( uno::Exception& ) - { - } + TestWindow aWindow; + aWindow.Execute(); + aWindow.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "VCL - canvasbitmaptest" ) ) ); - if( !xFactory.is() ) - { - fprintf( stderr, - "Could not bootstrap UNO, installation must be in disorder. Exiting.\n" ); - exit( 1 ); - } - - // Create UCB. - uno::Sequence< uno::Any > aArgs( 2 ); - aArgs[ 0 ] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL ); - aArgs[ 1 ] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE ); - ::ucbhelper::ContentBroker::initialize( xFactory, aArgs ); - - TestWindow pWindow; - pWindow.Execute(); - - // clean up UCB - ::ucbhelper::ContentBroker::deinitialize(); + Application::Execute(); } -} // namespace - -TestApp aTestApp; diff --git a/vcl/test/dndtest.cxx b/vcl/test/dndtest.cxx index bd912fcdf444..2d426acf84b5 100755 --- a/vcl/test/dndtest.cxx +++ b/vcl/test/dndtest.cxx @@ -138,7 +138,7 @@ class StringTransferable : public ::cppu::WeakImplHelper1< XTransferable > Sequence< DataFlavor > m_aFlavorList; public: - StringTransferable( const OUString& rString ) : m_aFlavorList( 1 ), m_aData( rString ) + StringTransferable( const OUString& rString ) : m_aData( rString ), m_aFlavorList( 1 ) { DataFlavor df; @@ -297,7 +297,7 @@ void MyWin::Resize() void SAL_CALL MyDragAndDropListener::dragGestureRecognized( const DragGestureEvent& dge ) throw(RuntimeException) { - printf( "XDragGestureListener::dragGestureRecognized called ( Window: %X, %d, %d ).\n", m_pWindow, dge.DragOriginX, dge.DragOriginY ); + printf( "XDragGestureListener::dragGestureRecognized called ( Window: %p, %"SAL_PRIdINT32", %"SAL_PRIdINT32" ).\n", m_pWindow, dge.DragOriginX, dge.DragOriginY ); Reference< XDragSource > xDragSource( dge.DragSource, UNO_QUERY ); xDragSource->startDrag( dge, -1, 0, 0, new StringTransferable( OUString::createFromAscii( "TestString" ) ), this ); @@ -308,7 +308,7 @@ void SAL_CALL MyDragAndDropListener::dragGestureRecognized( const DragGestureEve void SAL_CALL MyDragAndDropListener::drop( const DropTargetDropEvent& dtde ) throw(RuntimeException) { - printf( "XDropTargetListener::drop called ( Window: %X, %d, %d ).\n", m_pWindow, dtde.LocationX, dtde.LocationY ); + printf( "XDropTargetListener::drop called ( Window: %p, %"SAL_PRIdINT32", %"SAL_PRIdINT32" ).\n", m_pWindow, dtde.LocationX, dtde.LocationY ); dtde.Context->dropComplete( sal_True ); } @@ -317,7 +317,7 @@ void SAL_CALL MyDragAndDropListener::drop( const DropTargetDropEvent& dtde ) thr void SAL_CALL MyDragAndDropListener::dragEnter( const DropTargetDragEnterEvent& dtdee ) throw(RuntimeException) { - printf( "XDropTargetListener::dragEnter called ( Window: %X, %d, %d ).\n", m_pWindow, dtdee.LocationX, dtdee.LocationY ); + printf( "XDropTargetListener::dragEnter called ( Window: %p, %"SAL_PRIdINT32", %"SAL_PRIdINT32" ).\n", m_pWindow, dtdee.LocationX, dtdee.LocationY ); dtdee.Context->acceptDrag( dtdee.DropAction ); } @@ -325,14 +325,14 @@ void SAL_CALL MyDragAndDropListener::dragEnter( const DropTargetDragEnterEvent& void SAL_CALL MyDragAndDropListener::dragExit( const DropTargetEvent& ) throw(RuntimeException) { - printf( "XDropTargetListener::dragExit called ( Window: %X ).\n", m_pWindow ); + printf( "XDropTargetListener::dragExit called ( Window: %p ).\n", m_pWindow ); } // ----------------------------------------------------------------------- void SAL_CALL MyDragAndDropListener::dragOver( const DropTargetDragEvent& dtde ) throw(RuntimeException) { - printf( "XDropTargetListener::dragOver called ( Window: %X, %d, %d ).\n", m_pWindow, dtde.LocationX, dtde.LocationY ); + printf( "XDropTargetListener::dragOver called ( Window: %p, %"SAL_PRIdINT32", %"SAL_PRIdINT32" ).\n", m_pWindow, dtde.LocationX, dtde.LocationY ); dtde.Context->acceptDrag( dtde.DropAction ); } @@ -340,7 +340,7 @@ void SAL_CALL MyDragAndDropListener::dragOver( const DropTargetDragEvent& dtde ) void SAL_CALL MyDragAndDropListener::dropActionChanged( const DropTargetDragEvent& dtde ) throw(RuntimeException) { - printf( "XDropTargetListener::dropActionChanged called ( Window: %X, %d, %d ).\n", m_pWindow, dtde.LocationX, dtde.LocationY ); + printf( "XDropTargetListener::dropActionChanged called ( Window: %p, %"SAL_PRIdINT32", %"SAL_PRIdINT32" ).\n", m_pWindow, dtde.LocationX, dtde.LocationY ); dtde.Context->acceptDrag( dtde.DropAction ); } @@ -348,42 +348,42 @@ void SAL_CALL MyDragAndDropListener::dropActionChanged( const DropTargetDragEven void SAL_CALL MyDragAndDropListener::dragDropEnd( const DragSourceDropEvent& dsde ) throw(RuntimeException) { - printf( "XDragSourceListener::dropDropEnd called ( Window: %X, %s ).\n", m_pWindow, dsde.DropSuccess ? "sucess" : "failed" ); + printf( "XDragSourceListener::dropDropEnd called ( Window: %p, %s ).\n", m_pWindow, dsde.DropSuccess ? "sucess" : "failed" ); } // ----------------------------------------------------------------------- void SAL_CALL MyDragAndDropListener::dragEnter( const DragSourceDragEvent& ) throw(RuntimeException) { - printf( "XDragSourceListener::dragEnter called ( Window: %X ).\n", m_pWindow ); + printf( "XDragSourceListener::dragEnter called ( Window: %p ).\n", m_pWindow ); } // ----------------------------------------------------------------------- void SAL_CALL MyDragAndDropListener::dragExit( const DragSourceEvent& ) throw(RuntimeException) { - printf( "XDragSourceListener::dragExit called ( Window: %X ).\n", m_pWindow ); + printf( "XDragSourceListener::dragExit called ( Window: %p ).\n", m_pWindow ); } // ----------------------------------------------------------------------- void SAL_CALL MyDragAndDropListener::dragOver( const DragSourceDragEvent& ) throw(RuntimeException) { - printf( "XDragSourceListener::dragOver called ( Window: %X ).\n", m_pWindow ); + printf( "XDragSourceListener::dragOver called ( Window: %p ).\n", m_pWindow ); } // ----------------------------------------------------------------------- void SAL_CALL MyDragAndDropListener::dropActionChanged( const DragSourceDragEvent& ) throw(RuntimeException) { - printf( "XDragSourceListener::dropActionChanged called ( Window: %X ).\n", m_pWindow ); + printf( "XDragSourceListener::dropActionChanged called ( Window: %p ).\n", m_pWindow ); } // ----------------------------------------------------------------------- void SAL_CALL MyDragAndDropListener::disposing( const EventObject& ) throw(RuntimeException) { - printf( "XEventListener::disposing called ( Window: %X ).\n", m_pWindow ); + printf( "XEventListener::disposing called ( Window: %p ).\n", m_pWindow ); } // ----------------------------------------------------------------------- diff --git a/vcl/test/makefile.mk b/vcl/test/makefile.mk index 45f36555c302..4f10be112d2c 100644 --- a/vcl/test/makefile.mk +++ b/vcl/test/makefile.mk @@ -46,13 +46,12 @@ TARGETTYPE=GUI # --- Files -------------------------------------------------------- -OBJFILES= \ +APP1OBJS= \ $(OBJ)$/dndtest.obj APP1NOSAL= TRUE APP1TARGET= $(TARGET) -APP1OBJS= $(OBJFILES) $(OBJ)$/salmain.obj APP1STDLIBS= $(CPPULIB) \ $(CPPUHELPERLIB) \ $(TOOLSLIB) \ @@ -68,12 +67,6 @@ APP2TARGET= canvasbitmaptest APP2OBJS= \ $(OBJ)$/canvasbitmaptest.obj -.IF "$(GUI)"!="UNX" - APP2OBJS += $(OBJ)$/salmain.obj -.ELSE - APP2OBJS += $(SLO)$/salmain.obj -.ENDIF - APP2NOSAL= TRUE APP2STDLIBS=$(TOOLSLIB) \ $(COMPHELPERLIB) \ diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx index 1d430530ea07..91f4b3280448 100644 --- a/vcl/unx/gtk/a11y/atkutil.cxx +++ b/vcl/unx/gtk/a11y/atkutil.cxx @@ -640,6 +640,8 @@ long WindowEventHandler(void *, ::VclSimpleEvent 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; diff --git a/vcl/unx/gtk/app/makefile.mk b/vcl/unx/gtk/app/makefile.mk index 9596b83ac689..22ebcea7b8c9 100644 --- a/vcl/unx/gtk/app/makefile.mk +++ b/vcl/unx/gtk/app/makefile.mk @@ -62,6 +62,10 @@ SLOFILES=\ $(SLO)$/gtkinst.obj \ $(SLO)$/gtksys.obj +EXCEPTIONSFILES=\ + $(SLO)$/gtkdata.obj\ + $(SLO)$/gtkinst.obj + .ELSE # "$(ENABLE_GTK)" != "" dummy: diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index 0c7b28d1027b..d0618328e59c 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -571,11 +571,12 @@ BOOL GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP ((nType == CTRL_TOOLTIP) && ( (nPart==PART_ENTIRE_CONTROL) ) ) || ((nType == CTRL_MENU_POPUP) && - ( (nPart==PART_ENTIRE_CONTROL) ) + ( (nPart==PART_ENTIRE_CONTROL) || (nPart==PART_MENU_ITEM) || (nPart==PART_MENU_ITEM_CHECK_MARK) || (nPart==PART_MENU_ITEM_RADIO_MARK) - ) || + ) + ) || ((nType == CTRL_PROGRESS) && ( (nPart == PART_ENTIRE_CONTROL) ) ) || diff --git a/vcl/unx/headless/svpgdi.cxx b/vcl/unx/headless/svpgdi.cxx index 6f3879289976..4ee06961444a 100644 --- a/vcl/unx/headless/svpgdi.cxx +++ b/vcl/unx/headless/svpgdi.cxx @@ -219,7 +219,7 @@ void SvpSalGraphics::SetFillColor( SalColor nSalColor ) m_aFillColor = basebmp::Color( nSalColor ); } -void SvpSalGraphics::SetXORMode( BOOL bSet ) +void SvpSalGraphics::SetXORMode( bool bSet, bool ) { m_aDrawMode = bSet ? DrawMode_XOR : DrawMode_PAINT; } diff --git a/vcl/unx/headless/svpgdi.hxx b/vcl/unx/headless/svpgdi.hxx index 353ef24a7f01..984a77cccfad 100644 --- a/vcl/unx/headless/svpgdi.hxx +++ b/vcl/unx/headless/svpgdi.hxx @@ -82,7 +82,7 @@ public: virtual void SetFillColor( SalColor nSalColor ); - virtual void SetXORMode( BOOL bSet ); + virtual void SetXORMode( bool bSet, bool ); virtual void SetROPLineColor( SalROPColor nROPColor ); virtual void SetROPFillColor( SalROPColor nROPColor ); diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx index 45a07f8bd558..12302c1bbae2 100644 --- a/vcl/unx/headless/svppspgraphics.cxx +++ b/vcl/unx/headless/svppspgraphics.cxx @@ -273,7 +273,7 @@ void PspGraphics::SetROPFillColor( SalROPColor ) DBG_ASSERT( 0, "Error: PrinterGfx::SetROPFillColor() not implemented" ); } -void PspGraphics::SetXORMode( BOOL bSet ) +void PspGraphics::SetXORMode( bool bSet, bool ) { (void)bSet; DBG_ASSERT( !bSet, "Error: PrinterGfx::SetXORMode() not implemented" ); diff --git a/vcl/unx/headless/svppspgraphics.hxx b/vcl/unx/headless/svppspgraphics.hxx index 2469bdcebf1b..9cbbac446477 100644 --- a/vcl/unx/headless/svppspgraphics.hxx +++ b/vcl/unx/headless/svppspgraphics.hxx @@ -111,7 +111,7 @@ public: virtual void SetLineColor( SalColor nSalColor ); virtual void SetFillColor(); virtual void SetFillColor( SalColor nSalColor ); - virtual void SetXORMode( BOOL bSet ); + virtual void SetXORMode( bool bSet, bool ); virtual void SetROPLineColor( SalROPColor nROPColor ); virtual void SetROPFillColor( SalROPColor nROPColor ); diff --git a/vcl/unx/inc/pspgraphics.h b/vcl/unx/inc/pspgraphics.h index e8cf38dfc49e..c8c0abf29fd6 100644 --- a/vcl/unx/inc/pspgraphics.h +++ b/vcl/unx/inc/pspgraphics.h @@ -110,7 +110,7 @@ public: virtual void SetLineColor( SalColor nSalColor ); virtual void SetFillColor(); virtual void SetFillColor( SalColor nSalColor ); - virtual void SetXORMode( BOOL bSet ); + virtual void SetXORMode( bool bSet, bool ); virtual void SetROPLineColor( SalROPColor nROPColor ); virtual void SetROPFillColor( SalROPColor nROPColor ); diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h index b3e1efbdab44..0a5028b764eb 100644 --- a/vcl/unx/inc/salgdi.h +++ b/vcl/unx/inc/salgdi.h @@ -130,7 +130,7 @@ protected: BOOL bInvert50GC_ : 1; // is Invert50 GC valid BOOL bStippleGC_ : 1; // is Stipple GC valid BOOL bTrackingGC_ : 1; // is Tracking GC valid - BOOL bXORMode_ : 1; // is ROP XOR Mode set + bool bXORMode_ : 1; // is ROP XOR Mode set BOOL bDitherBrush_ : 1; // is solid or tile void SetClipRegion( GC pGC, @@ -242,7 +242,7 @@ public: virtual void SetFillColor( SalColor nSalColor ); - virtual void SetXORMode( BOOL bSet ); + virtual void SetXORMode( bool bSet, bool ); virtual void SetROPLineColor( SalROPColor nROPColor ); virtual void SetROPFillColor( SalROPColor nROPColor ); diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx index 3fcf7fcdda06..f18d31890247 100644 --- a/vcl/unx/source/app/saldisp.cxx +++ b/vcl/unx/source/app/saldisp.cxx @@ -236,7 +236,7 @@ static BOOL sal_GetVisualInfo( Display *pDisplay, XID nVID, XVisualInfo &rVI ) XFree( pInfos ); DBG_ASSERT( rVI.visualid == nVID, - "sal_GetVisualInfo: could not get correct visual by visualId" ) + "sal_GetVisualInfo: could not get correct visual by visualId" ); return TRUE; } @@ -632,7 +632,7 @@ fd , SalX11Display *pDisplay ) { DBG_ASSERT( ConnectionNumber( pDisplay->GetDisplay() ) == fd, - "wrong fd in DisplayHasEvent" ) + "wrong fd in DisplayHasEvent" ); vos::IMutex* pSalInstYieldMutex = GetSalData()->m_pInstance->GetYieldMutex(); ::vos::OGuard aGuard( *pSalInstYieldMutex ); diff --git a/vcl/unx/source/gdi/pspgraphics.cxx b/vcl/unx/source/gdi/pspgraphics.cxx index 44c3e19f589f..7b8a0f173707 100644 --- a/vcl/unx/source/gdi/pspgraphics.cxx +++ b/vcl/unx/source/gdi/pspgraphics.cxx @@ -347,12 +347,9 @@ void PspGraphics::SetROPFillColor( SalROPColor ) DBG_ASSERT( 0, "Error: PrinterGfx::SetROPFillColor() not implemented" ); } -void PspGraphics::SetXORMode( BOOL -#ifdef DBG_UTIL -bSet -#endif -) +void PspGraphics::SetXORMode( bool bSet, bool ) { + (void)bSet; DBG_ASSERT( !bSet, "Error: PrinterGfx::SetXORMode() not implemented" ); } @@ -838,6 +835,8 @@ bool PspGraphics::AddTempDevFont( ImplDevFontList*, const String&,const String& return false; } +void RegisterFontSubstitutors( ImplDevFontList* ); + void PspGraphics::GetDevFontList( ImplDevFontList *pList ) { ::std::list< psp::fontID > aList; @@ -849,6 +848,10 @@ void PspGraphics::GetDevFontList( ImplDevFontList *pList ) for (it = aList.begin(); it != aList.end(); ++it) if (rMgr.getFontFastInfo (*it, aInfo)) AnnounceFonts( pList, aInfo ); + + // register platform specific font substitutions if available + if( rMgr.hasFontconfig() ) + RegisterFontSubstitutors( pList ); } void PspGraphics::GetDevFontSubstList( OutputDevice* pOutDev ) diff --git a/vcl/unx/source/gdi/salbmp.cxx b/vcl/unx/source/gdi/salbmp.cxx index 07fffb6b2218..f70f445ed28c 100644 --- a/vcl/unx/source/gdi/salbmp.cxx +++ b/vcl/unx/source/gdi/salbmp.cxx @@ -141,9 +141,15 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( const Size& rSize, USHORT nBitCount, case( 4 ): pDIB->mnFormat |= BMP_FORMAT_4BIT_MSN_PAL; break; case( 8 ): pDIB->mnFormat |= BMP_FORMAT_8BIT_PAL; break; #ifdef OSL_BIGENDIAN - case(16 ) : pDIB->mnFormat|= BMP_FORMAT_16BIT_TC_MSB_MASK; break; + case(16 ): + pDIB->mnFormat|= BMP_FORMAT_16BIT_TC_MSB_MASK; + pDIB->maColorMask = ColorMask( 0xf800, 0x07e0, 0x001f ); + break; #else - case(16 ) : pDIB->mnFormat|= BMP_FORMAT_16BIT_TC_LSB_MASK; break; + case(16 ): + pDIB->mnFormat|= BMP_FORMAT_16BIT_TC_LSB_MASK; + pDIB->maColorMask = ColorMask( 0xf800, 0x07e0, 0x001f ); + break; #endif default: nBitCount = 24; @@ -251,7 +257,7 @@ BitmapBuffer* X11SalBitmap::ImplCreateDIB( Drawable aDrawable, case( 16 ): { nDstFormat |= BMP_FORMAT_24BIT_TC_BGR; - aSrcBuf.maColorMask = ColorMask( pImage->red_mask, pImage->green_mask, pImage->blue_mask ); + aSrcBuf.maColorMask = ColorMask( pImage->red_mask, pImage->green_mask, pImage->blue_mask ); if( LSBFirst == pImage->byte_order ) { diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index 8eff0b5d4588..dabce7c59b9e 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -166,7 +166,7 @@ void X11SalGraphics::freeResources() { Display *pDisplay = GetXDisplay(); - DBG_ASSERT( !pPaintRegion_, "pPaintRegion_" ) + DBG_ASSERT( !pPaintRegion_, "pPaintRegion_" ); if( pClipRegion_ ) XDestroyRegion( pClipRegion_ ), pClipRegion_ = None; if( hBrush_ ) XFreePixmap( pDisplay, hBrush_ ), hBrush_ = None; @@ -720,7 +720,7 @@ void X11SalGraphics::SetROPFillColor( SalROPColor nROPColor ) } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -void X11SalGraphics::SetXORMode( BOOL bSet ) +void X11SalGraphics::SetXORMode( bool bSet, bool ) { if( !bXORMode_ == bSet ) { @@ -1183,9 +1183,18 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly { const int k = (nPointIdx < nPointCount) ? nPointIdx : 0; const ::basegfx::B2DPoint& aPoint = aInnerPolygon.getB2DPoint( k ); + // convert the B2DPoint into XRENDER units - aNewXPF.x = XDoubleToFixed( aPoint.getX() ); - aNewXPF.y = XDoubleToFixed( aPoint.getY() ); + if(getAntiAliasB2DDraw()) + { + aNewXPF.x = XDoubleToFixed( aPoint.getX() ); + aNewXPF.y = XDoubleToFixed( aPoint.getY() ); + } + else + { + aNewXPF.x = XDoubleToFixed( basegfx::fround( aPoint.getX() ) ); + aNewXPF.y = XDoubleToFixed( basegfx::fround( aPoint.getY() ) ); + } // check if enough data is available for a new HalfTrapezoid if( nPointIdx == 0 ) diff --git a/vcl/unx/source/gdi/salgdi2.cxx b/vcl/unx/source/gdi/salgdi2.cxx index 8086ea8e8ea5..c10abac60bb0 100644 --- a/vcl/unx/source/gdi/salgdi2.cxx +++ b/vcl/unx/source/gdi/salgdi2.cxx @@ -1158,6 +1158,7 @@ bool X11SalGraphics::supportsOperation( OutDevSupportType eType ) const switch( eType ) { case OutDevSupport_TransparentRect: + case OutDevSupport_B2DDraw: { XRenderPeer& rPeer = XRenderPeer::GetInstance(); if( rPeer.GetVersion() >= 0x02 ) diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx index f9fcf0929a88..55bb81ea5d6b 100644 --- a/vcl/unx/source/gdi/salgdi3.cxx +++ b/vcl/unx/source/gdi/salgdi3.cxx @@ -795,8 +795,11 @@ CairoWrapper::CairoWrapper() if( !XQueryExtension( GetX11SalData()->GetDisplay()->GetDisplay(), "RENDER", &nDummy, &nDummy, &nDummy ) ) return; - +#ifdef MACOSX + OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( "libcairo.2.dylib" )); +#else OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( "libcairo.so.2" )); +#endif mpCairoLib = osl_loadModule( aLibName.pData, SAL_LOADMODULE_DEFAULT ); if( !mpCairoLib ) return; @@ -1542,13 +1545,13 @@ bool X11SalGraphics::AddTempDevFont( ImplDevFontList* pFontList, // ---------------------------------------------------------------------------- -static void RegisterFontSubstitutors( ImplDevFontList* ); +void RegisterFontSubstitutors( ImplDevFontList* ); void X11SalGraphics::GetDevFontList( ImplDevFontList *pList ) { // allow disabling of native X11 fonts static const char* pEnableX11FontStr = getenv( "SAL_ENABLE_NATIVE_XFONTS" ); - if( !pEnableX11FontStr || (pEnableX11FontStr[0] != '0') ) + if( pEnableX11FontStr && (pEnableX11FontStr[0] != '0') ) { // announce X11 fonts XlfdStorage* pX11FontList = GetDisplay()->GetXlfdList(); @@ -1803,21 +1806,36 @@ public: bool FindFontSubstitute( ImplFontSelectData&, OUString& rMissingCodes ) const; }; -static void RegisterFontSubstitutors( ImplDevFontList* pList ) +void RegisterFontSubstitutors( ImplDevFontList* pList ) { - bool bDisableFC = false; + // init font substitution defaults + int nDisableBits = 0; #ifdef SOLARIS - bDisableFC = true; + nDisableBits = 1; // disable "font fallback" here on default #endif + // apply the environment variable if any const char* pEnvStr = ::getenv( "SAL_DISABLE_FC_SUBST" ); if( pEnvStr ) - bDisableFC = (*pEnvStr == '\0') || (*pEnvStr != '0'); - if( bDisableFC ) - return; - static FcPreMatchSubstititution aSubstPreMatch; - static FcGlyphFallbackSubstititution aSubstFallback; - pList->SetPreMatchHook( &aSubstPreMatch ); - pList->SetFallbackHook( &aSubstFallback ); + { + if( (*pEnvStr >= '0') && (*pEnvStr <= '9') ) + nDisableBits = (*pEnvStr - '0'); + else + nDisableBits = ~0U; // no specific bits set: disable all + } + + // register font fallback substitutions (unless disabled by bit0) + if( (nDisableBits & 1) == 0 ) + { + static FcPreMatchSubstititution aSubstPreMatch; + pList->SetPreMatchHook( &aSubstPreMatch ); + } + + // register glyph fallback substitutions (unless disabled by bit1) + if( (nDisableBits & 2) == 0 ) + { + static FcGlyphFallbackSubstititution aSubstFallback; + pList->SetFallbackHook( &aSubstFallback ); + } } // ----------------------------------------------------------------------- diff --git a/vcl/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx index 8ae294c97d6d..d76977944c11 100644 --- a/vcl/unx/source/plugadapt/salplug.cxx +++ b/vcl/unx/source/plugadapt/salplug.cxx @@ -434,7 +434,7 @@ static const char * get_desktop_environment() static const char* autodetect_plugin() { const char * desktop = get_desktop_environment(); - const char * pRet = NULL; + const char * pRet = "gen"; // no server at all: dummy plugin if ( desktop == desktop_strings[DESKTOP_NONE] ) @@ -444,7 +444,13 @@ static const char* autodetect_plugin() else if( desktop == desktop_strings[DESKTOP_KDE] ) pRet = "kde"; else - pRet = "gen"; + { + // #i95296# use the much nicer looking gtk plugin + // on desktops that set gtk variables (e.g. XFCE) + static const char* pEnv = getenv( "GTK2_RC_FILES" ); + if( pEnv && *pEnv ) // check for existance and non emptiness + pRet = "gtk"; + } #if OSL_DEBUG_LEVEL > 1 std::fprintf( stderr, "plugin autodetection: %s\n", pRet ); diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx index e113ad4b138f..157558f28125 100644 --- a/vcl/unx/source/window/salframe.cxx +++ b/vcl/unx/source/window/salframe.cxx @@ -996,7 +996,7 @@ void X11SalFrame::SetIcon( USHORT nIcon ) { const String& rWM( pDisplay_->getWMAdaptor()->getWindowManagerName() ); if( rWM.EqualsAscii( "KWin" ) ) // assume KDE is running - iconSize = 16; + iconSize = 48; static bool bGnomeIconSize = false; static bool bGnomeChecked = false; if( ! bGnomeChecked ) @@ -1018,7 +1018,7 @@ void X11SalFrame::SetIcon( USHORT nIcon ) XFree( pProps ); } if( bGnomeIconSize ) - iconSize = 20; + iconSize = 48; } XWMHints Hints; @@ -3907,7 +3907,7 @@ long X11SalFrame::HandleStateEvent( XPropertyEvent *pEvent ) DBG_ASSERT( actual_type = pEvent->atom && 32 == actual_format && 2 == nitems - && 0 == bytes_after, "HandleStateEvent" ) + && 0 == bytes_after, "HandleStateEvent" ); if( *(unsigned long*)prop == NormalState ) nShowState_ = SHOWSTATE_NORMAL; diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk index de86f48dddf4..98fe62caae26 100644 --- a/vcl/util/makefile.mk +++ b/vcl/util/makefile.mk @@ -179,6 +179,7 @@ SHL1STDLIBS+=\ $(SALLIB) \ $(BASEGFXLIB) \ $(ICUUCLIB) \ + $(ICUDATALIB) \ $(ICULELIB) \ $(JVMACCESSLIB) SHL1USE_EXPORTS=name @@ -228,7 +229,8 @@ SHL1STDLIBS += $(PSPLIB) SHL1STDLIBS += $(UWINAPILIB) \ $(GDI32LIB) \ - $(MSIMG32LIB) \ + $(GDIPLUSLIB) \ + $(MSIMG32LIB) \ $(WINSPOOLLIB) \ $(OLE32LIB) \ $(SHELL32LIB) \ diff --git a/vcl/util/makefile2.pmk b/vcl/util/makefile2.pmk index 8da0f6e559cb..0e57d7aeb80b 100644 --- a/vcl/util/makefile2.pmk +++ b/vcl/util/makefile2.pmk @@ -31,11 +31,7 @@ # Reduction of exported symbols: CDEFS += -DVCL_DLLIMPLEMENTATION -.IF "$(COMNAME)" == "gcc3" && "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE" -CFLAGS += -fvisibility=hidden -.ELIF "$(COMNAME)" == "sunpro5" && "$(CCNUMVER)" >= "00050005" -CFLAGS += -xldscope=hidden -.ENDIF +VISIBILITY_HIDDEN=TRUE .IF "$(GUIBASE)"=="aqua" OBJCXXFLAGS=-x objective-c++ -fobjc-exceptions diff --git a/vcl/win/inc/saldata.hxx b/vcl/win/inc/saldata.hxx index abd88cbbc639..d743a7b7dae1 100644 --- a/vcl/win/inc/saldata.hxx +++ b/vcl/win/inc/saldata.hxx @@ -135,6 +135,9 @@ public: TempFontItem* mpTempFontItem; BOOL mbThemeChanged; // true if visual theme was changed: throw away theme handles + // for GdiPlus GdiplusStartup/GdiplusShutdown + ULONG_PTR gdiplusToken; + std::set< HMENU > mhMenuSet; // keeps track of menu handles created by VCL, used by IsKnownMenuHandle() std::map< UINT,USHORT > maVKMap; // map some dynamic VK_* entries }; diff --git a/vcl/win/inc/salgdi.h b/vcl/win/inc/salgdi.h index a43efed328b0..f9d4681e0e6e 100644 --- a/vcl/win/inc/salgdi.h +++ b/vcl/win/inc/salgdi.h @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: salgdi.h,v $ - * $Revision: 1.32 $ + * $Revision: 1.30.20.5 $ * * This file is part of OpenOffice.org. * @@ -52,7 +52,7 @@ class ImplFontAttrCache; #define PALRGB_TO_RGB(nPalRGB) ((nPalRGB)&0x00ffffff) // win32 platform specific options. Move them to the PMK file? -#define USE_UNISCRIBE + #define GCP_KERN_HACK #define GNG_VERT_HACK @@ -78,6 +78,7 @@ public: bool IsGlyphApiDisabled() const { return mbDisableGlyphApi; } bool SupportsKorean() const { return mbHasKoreanRange; } bool SupportsCJK() const { return mbHasCJKSupport; } + bool SupportsArabic() const { return mbHasArabicSupport; } bool AliasSymbolsHigh() const { return mbAliasSymbolsHigh; } bool AliasSymbolsLow() const { return mbAliasSymbolsLow; } @@ -96,6 +97,7 @@ private: mutable bool mbDisableGlyphApi; mutable bool mbHasKoreanRange; mutable bool mbHasCJKSupport; + mutable bool mbHasArabicSupport; mutable ImplFontCharMap* mpUnicodeMap; mutable const Ucs2SIntMap* mpEncodingVector; @@ -165,7 +167,11 @@ public: BOOL mbVirDev; // is VirDev BOOL mbWindow; // is Window BOOL mbScreen; // is Screen compatible - BOOL mbXORMode; // _every_ output with RasterOp XOR + bool mbXORMode; // _every_ output with RasterOp XOR + + // remember RGB values for SetLineColor/SetFillColor + SalColor maLineColor; + SalColor maFillColor; HFONT ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFontScale, HFONT& o_rOldFont ); @@ -263,7 +269,7 @@ public: // filled accordingly virtual void SetFillColor( SalColor nSalColor ); // enable/disable XOR drawing - virtual void SetXORMode( BOOL bSet ); + virtual void SetXORMode( bool bSet, bool ); // set line color for raster operations virtual void SetROPLineColor( SalROPColor nROPColor ); // set fill color for raster operations @@ -333,6 +339,7 @@ public: bool bVertical, Int32Vector& rWidths, Ucs2UIntMap& rUnicodeEnc ); + virtual int GetMinKashidaWidth(); virtual BOOL GetGlyphBoundRect( long nIndex, Rectangle& ); virtual BOOL GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& ); diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index b1ee05a9c2e3..d57cdd48eed2 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -56,6 +56,25 @@ #include <vcl/timer.hxx> #include <wincomp.hxx> // CS_DROPSHADOW +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif + +#if defined _MSC_VER +#pragma warning(push, 1) +#endif + +#include <GdiPlus.h> +#include <GdiPlusEnums.h> +#include <GdiPlusColor.h> + +#if defined _MSC_VER +#pragma warning(pop) +#endif + // ======================================================================= void SalAbort( const XubString& rErrorText ) @@ -418,6 +437,9 @@ SalData::SalData() mpTempFontItem = 0; mbThemeChanged = FALSE; // true if visual theme was changed: throw away theme handles + // init with NULL + gdiplusToken = 0; + initKeyCodeMap(); SetSalData( this ); @@ -433,8 +455,11 @@ SalData::~SalData() void InitSalData() { SalData* pSalData = new SalData; - (void)pSalData; CoInitialize(0); +
+ // init GDIPlus
+ static Gdiplus::GdiplusStartupInput gdiplusStartupInput;
+ Gdiplus::GdiplusStartup(&pSalData->gdiplusToken, &gdiplusStartupInput, NULL);
} @@ -442,6 +467,13 @@ void DeInitSalData() { CoUninitialize(); SalData* pSalData = GetSalData(); + + // deinit GDIPlus + if(pSalData) + { + Gdiplus::GdiplusShutdown(pSalData->gdiplusToken);
+ } + delete pSalData; } diff --git a/vcl/win/source/gdi/MAKEFILE.MK b/vcl/win/source/gdi/MAKEFILE.MK index d9cdd067edb3..d50abc1b5aa3 100644 --- a/vcl/win/source/gdi/MAKEFILE.MK +++ b/vcl/win/source/gdi/MAKEFILE.MK @@ -54,6 +54,7 @@ CFLAGS += -DWINVER=0x0400 SLOFILES= $(SLO)$/salgdi.obj \ $(SLO)$/salgdi2.obj \ $(SLO)$/salgdi3.obj \ + $(SLO)$/salgdi_gdiplus.obj \ $(SLO)$/salvd.obj \ $(SLO)$/salprn.obj \ $(SLO)$/salbmp.obj \ diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx index 29bf48081e60..55caa086a57a 100644 --- a/vcl/win/source/gdi/salgdi.cxx +++ b/vcl/win/source/gdi/salgdi.cxx @@ -1006,6 +1006,7 @@ void WinSalGraphics::SetLineColor() void WinSalGraphics::SetLineColor( SalColor nSalColor ) { + maLineColor = nSalColor; COLORREF nPenColor = PALETTERGB( SALCOLOR_RED( nSalColor ), SALCOLOR_GREEN( nSalColor ), SALCOLOR_BLUE( nSalColor ) ); @@ -1087,6 +1088,7 @@ void WinSalGraphics::SetFillColor() void WinSalGraphics::SetFillColor( SalColor nSalColor ) { + maFillColor = nSalColor; SalData* pSalData = GetSalData(); BYTE nRed = SALCOLOR_RED( nSalColor ); BYTE nGreen = SALCOLOR_GREEN( nSalColor ); @@ -1189,7 +1191,7 @@ void WinSalGraphics::SetFillColor( SalColor nSalColor ) // ----------------------------------------------------------------------- -void WinSalGraphics::SetXORMode( BOOL bSet ) +void WinSalGraphics::SetXORMode( bool bSet, bool ) { mbXORMode = bSet; ::SetROP2( mhDC, bSet ? R2_XORPEN : R2_COPYPEN ); @@ -1418,25 +1420,6 @@ void WinSalGraphics::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoint // ----------------------------------------------------------------------- -bool WinSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double /*fTransparency*/ ) -{ - // TODO: implement and advertise OutDevSupport_B2DDraw support - return false; -} - -// ----------------------------------------------------------------------- - -bool WinSalGraphics::drawPolyLine( - const basegfx::B2DPolygon& /*rPolygon*/, - const basegfx::B2DVector& /*rLineWidths*/, - basegfx::B2DLineJoin /*eLineJoin*/) -{ - // TODO: implement - return false; -} - -// ----------------------------------------------------------------------- - #define SAL_POLY_STACKBUF 32 // ----------------------------------------------------------------------- diff --git a/vcl/win/source/gdi/salgdi2.cxx b/vcl/win/source/gdi/salgdi2.cxx index 0498a57f43fc..0a60c6971213 100644 --- a/vcl/win/source/gdi/salgdi2.cxx +++ b/vcl/win/source/gdi/salgdi2.cxx @@ -46,12 +46,16 @@ bool WinSalGraphics::supportsOperation( OutDevSupportType eType ) const { + static bool bAllowForTest(true); bool bRet = false; + switch( eType ) { case OutDevSupport_TransparentRect: bRet = mbVirDev || mbWindow; break; + case OutDevSupport_B2DDraw: + bRet = bAllowForTest; default: break; } return bRet; diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index 4511ff0c3fef..de08f1c25b50 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: salgdi3.cxx,v $ - * $Revision: 1.97 $ + * $Revision: 1.95.14.5 $ * * This file is part of OpenOffice.org. * @@ -33,6 +33,7 @@ #include <string.h> #include <malloc.h> +#include <osl/module.h> #include <tools/svwin.h> #include <rtl/logfile.hxx> #include <rtl/tencinfo.h> @@ -72,14 +73,13 @@ #include <tools/stream.hxx> #include <rtl/bootstrap.hxx> - #include <vector> #include <set> -#ifndef INCLUDED_MAP +//#ifndef INCLUDED_MAP #include <map> -#define INCLUDED_MAP -#endif +//#define INCLUDED_MAP +//#endif static const int MAXFONTHEIGHT = 2048; @@ -111,6 +111,8 @@ static bool bImplSalCourierNew = false; // ======================================================================= +// ----------------------------------------------------------------------- + // TODO: also support temporary TTC font files typedef std::map< String, ImplDevFontAttributes > FontAttrMap; @@ -806,6 +808,7 @@ ImplWinFontData::ImplWinFontData( const ImplDevFontAttributes& rDFS, mbDisableGlyphApi( false ), mbHasKoreanRange( false ), mbHasCJKSupport( false ), + mbHasArabicSupport ( false ), mbAliasSymbolsLow( false ), mbAliasSymbolsHigh( false ), mnId( 0 ), @@ -936,7 +939,8 @@ void ImplWinFontData::ReadOs2Table( HDC hDC ) const mbHasCJKSupport = (ulUnicodeRange2 & 0x2DF00000); mbHasKoreanRange= (ulUnicodeRange1 & 0x10000000) | (ulUnicodeRange2 & 0x01100000); - } + mbHasArabicSupport = (ulUnicodeRange1 & 0x00002000); + } } // ----------------------------------------------------------------------- @@ -1521,6 +1525,8 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric ) if( mpWinFontData[0]->SupportsKorean() ) pMetric->mnDescent += pMetric->mnExtLeading; } + + pMetric->mnMinKashida = GetMinKashidaWidth(); } // ----------------------------------------------------------------------- diff --git a/vcl/win/source/gdi/salgdi_gdiplus.cxx b/vcl/win/source/gdi/salgdi_gdiplus.cxx new file mode 100644 index 000000000000..8709fc872540 --- /dev/null +++ b/vcl/win/source/gdi/salgdi_gdiplus.cxx @@ -0,0 +1,195 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: salgdi.cxx,v $ + * $Revision: 1.36 $ + * + * 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 <string.h> +#include <tools/svwin.h> +#include <wincomp.hxx> +#include <saldata.hxx> +#include <salgdi.h> +#include <tools/debug.hxx> + +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif + +#if defined _MSC_VER +#pragma warning(push, 1) +#endif + +#include <GdiPlus.h> +#include <GdiPlusEnums.h> +#include <GdiPlusColor.h> + +#if defined _MSC_VER +#pragma warning(pop) +#endif + +#include <basegfx/polygon/b2dpolygon.hxx> + +// ----------------------------------------------------------------------- + +void impAddB2DPolygonToGDIPlusGraphicsPath(Gdiplus::GraphicsPath& rPath, const basegfx::B2DPolygon& rPolygon) +{ + const sal_uInt32 nCount(rPolygon.count());
+
+ if(nCount)
+ {
+ 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);
+ }
+ else
+ {
+ rPath.AddLine(aFCurr, aFNext);
+ }
+
+ if(a + 1 < nEdgeCount)
+ {
+ aCurr = aNext;
+ aFCurr = aFNext;
+ }
+ }
+ }
+} + +bool WinSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPolygon, double fTransparency) +{ + const sal_uInt32 nCount(rPolyPolygon.count());
+ + if(mbBrush && nCount && (fTransparency >= 0.0 && fTransparency < 1.0)) + { + Gdiplus::Graphics aGraphics(mhDC);
+ 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;
+ + for(sal_uInt32 a(0); a < nCount; a++) + { + aPath.StartFigure(); + impAddB2DPolygonToGDIPlusGraphicsPath(aPath, rPolyPolygon.getB2DPolygon(a)); + aPath.CloseFigure(); + } + + if(getAntiAliasB2DDraw()) + { + aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
+ }
+ else
+ {
+ aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeNone);
+ }
+
+ aGraphics.FillPath(&aTestBrush, &aPath);
+ } + + return true; +} + +bool WinSalGraphics::drawPolyLine(const basegfx::B2DPolygon& rPolygon, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin eLineJoin) +{ + const sal_uInt32 nCount(rPolygon.count());
+ + if(mbPen && nCount) + { + Gdiplus::Graphics aGraphics(mhDC);
+ Gdiplus::Color aTestColor(255, SALCOLOR_RED(maLineColor), SALCOLOR_GREEN(maLineColor), SALCOLOR_BLUE(maLineColor));
+ Gdiplus::Pen aTestPen(aTestColor, Gdiplus::REAL(rLineWidths.getX()));
+ Gdiplus::GraphicsPath aPath;
+
+ switch(eLineJoin)
+ {
+ default : // basegfx::B2DLINEJOIN_NONE : + { + break; + } + case basegfx::B2DLINEJOIN_BEVEL : + { + aTestPen.SetLineJoin(Gdiplus::LineJoinBevel);
+ break; + } + case basegfx::B2DLINEJOIN_MIDDLE : + case basegfx::B2DLINEJOIN_MITER : + { + const Gdiplus::REAL aMiterLimit(15.0); + aTestPen.SetMiterLimit(aMiterLimit);
+ aTestPen.SetLineJoin(Gdiplus::LineJoinMiter);
+ break; + } + case basegfx::B2DLINEJOIN_ROUND : + { + aTestPen.SetLineJoin(Gdiplus::LineJoinRound);
+ break; + } + }
+ + impAddB2DPolygonToGDIPlusGraphicsPath(aPath, rPolygon); +
+ if(getAntiAliasB2DDraw())
+ {
+ aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
+ }
+ else
+ {
+ aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeNone);
+ }
+
+ aGraphics.DrawPath(&aTestPen, &aPath);
+ } + + return true; +} + +// ----------------------------------------------------------------------- diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index 36cb76800eac..24f45d6cba1e 100755 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: winlayout.cxx,v $ - * $Revision: 1.115 $ + * $Revision: 1.113.6.9 $ * * This file is part of OpenOffice.org. * @@ -54,6 +54,7 @@ // for GetMirroredChar #include <vcl/svapp.hxx> +#define USE_UNISCRIBE #ifdef USE_UNISCRIBE #include <Usp10.h> #include <ShLwApi.h> @@ -102,8 +103,15 @@ private: public: int GetCachedGlyphWidth( int nCharCode ) const; void CacheGlyphWidth( int nCharCode, int nCharWidth ); + + bool InitKashidaHandling( HDC ); + int GetMinKashidaWidth() const { return mnMinKashidaWidth; } + int GetMinKashidaGlyph() const { return mnMinKashidaGlyph; } + private: IntMap maWidthMap; + mutable int mnMinKashidaWidth; + mutable int mnMinKashidaGlyph; }; // ----------------------------------------------------------------------- @@ -545,6 +553,8 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs ) } // scale layout metrics if needed + // TODO: does it make the code more simple if the metric scaling + // is moved to the methods that need metric scaling (e.g. FillDXArray())? if( mfFontScale != 1.0 ) { mnWidth = (long)(mnWidth * mfFontScale); @@ -886,7 +896,7 @@ void SimpleWinLayout::ApplyDXArray( const ImplLayoutArgs& rArgs ) nOldWidth += mpGlyphAdvances[ j ]; int nDiff = nOldWidth - pDXArray[ i ]; - // disabled because of #104768# + // disabled because of #104768# // works great for static text, but problems when typing // if( nDiff>+1 || nDiff<-1 ) // only bother with changing anything when something moved @@ -1046,11 +1056,15 @@ public: //long mnPixelWidth; int mnXOffset; ABC maABCWidths; + bool mbHasKashidas; public: bool IsEmpty() const { return (mnEndGlyphPos <= 0); } + bool HasKashidas() const { return mbHasKashidas; } }; +// ----------------------------------------------------------------------- + class UniscribeLayout : public WinLayout { public: @@ -1065,11 +1079,13 @@ public: virtual long FillDXArray( long* pDXArray ) const; virtual int GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const; virtual void GetCaretPositions( int nArraySize, long* pCaretXArray ) const; + virtual bool IsKashidaPosValid ( int nCharPos ) const; // for glyph+font+script fallback virtual void MoveGlyph( int nStart, long nNewXPos ); virtual void DropGlyph( int nStart ); virtual void Simplify( bool bIsBase ); + virtual void DisableGlyphInjection( bool bDisable ) { mbDisableGlyphInjection = bDisable; } protected: virtual ~UniscribeLayout(); @@ -1103,6 +1119,15 @@ private: GOFFSET* mpGlyphOffsets; // glyph offsets to the "naive" layout SCRIPT_VISATTR* mpVisualAttrs; // glyph visual attributes mutable int* mpGlyphs2Chars; // map from absolute_glyph_pos to absolute_char_pos + + // kashida stuff + void InitKashidaHandling(); + void KashidaItemFix( int nMinGlyphPos, int nEndGlyphPos ); + bool KashidaWordFix( int nMinGlyphPos, int nEndGlyphPos, int* pnCurrentPos ); + + int mnMinKashidaWidth; + int mnMinKashidaGlyph; + bool mbDisableGlyphInjection; }; // ----------------------------------------------------------------------- @@ -1243,21 +1268,23 @@ static bool InitUSP() UniscribeLayout::UniscribeLayout( HDC hDC, const ImplWinFontData& rWinFontData, ImplWinFontEntry& rWinFontEntry ) : WinLayout( hDC, rWinFontData, rWinFontEntry ), - mnItemCount(0), + mnItemCount( 0 ), mpScriptItems( NULL ), mpVisualItems( NULL ), mpLogClusters( NULL ), mpCharWidths( NULL ), mnCharCapacity( 0 ), mnSubStringMin( 0 ), - mnGlyphCapacity(0), + mnGlyphCapacity( 0 ), mnGlyphCount( 0 ), mpOutGlyphs( NULL ), mpGlyphAdvances( NULL ), mpJustifications( NULL ), mpGlyphOffsets( NULL ), mpVisualAttrs( NULL ), - mpGlyphs2Chars( NULL ) + mpGlyphs2Chars( NULL ), + mnMinKashidaGlyph( 0 ), + mbDisableGlyphInjection( false ) {} // ----------------------------------------------------------------------- @@ -1669,6 +1696,8 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs ) } // scale layout metrics if needed + // TODO: does it make the code more simple if the metric scaling + // is moved to the methods that need metric scaling (e.g. FillDXArray())? if( mfFontScale != 1.0 ) { mnBaseAdv = (int)((double)mnBaseAdv*mfFontScale); @@ -1757,9 +1786,16 @@ bool UniscribeLayout::GetItemSubrange( const VisualItem& rVisualItem, // ----------------------------------------------------------------------- int UniscribeLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, - int& nStart, sal_Int32* pGlyphAdvances, int* pCharPosAry ) const + int& nStartx8, sal_Int32* pGlyphAdvances, int* pCharPosAry ) const { - if( nStart > mnGlyphCount ) // nStart>MAX means no more glyphs + // HACK to allow fake-glyph insertion (e.g. for kashidas) + // TODO: use iterator idiom instead of GetNextGlyphs(...) + // TODO: else make sure that the limit for glyph injection is sufficient (currently 256) + int nSubIter = nStartx8 & 0xff; + int nStart = nStartx8 >> 8; + + // check the glyph iterator + if( nStart > mnGlyphCount ) // nStart>MAX means no more glyphs return 0; // find the visual item for the nStart glyph position @@ -1788,9 +1824,9 @@ int UniscribeLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, } // after the last visual item there are no more glyphs - if( nItem >= mnItemCount ) + if( (nItem >= mnItemCount) || (nStart < 0) ) { - nStart = mnGlyphCount + 1; + nStartx8 = (mnGlyphCount + 1) << 8; return 0; } @@ -1809,7 +1845,10 @@ int UniscribeLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, bool bRC = GetItemSubrange( *pVI, nMinGlyphPos, nEndGlyphPos ); DBG_ASSERT( bRC, "USPLayout::GNG GISR() returned false" ); if( !bRC ) + { + nStartx8 = (mnGlyphCount + 1) << 8; return 0; + } // make sure nStart is inside the range of relevant glyphs if( nStart < nMinGlyphPos ) @@ -1880,16 +1919,72 @@ int UniscribeLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int nCount = 0; while( nCount < nLen ) { + // prepare return values + sal_GlyphId aGlyphId = mpOutGlyphs[ nStart ]; + int nGlyphWidth = pGlyphWidths[ nStart ]; + int nCharPos = -1; // no need to determine charpos + if( mpGlyphs2Chars ) // unless explicitly requested+provided + nCharPos = mpGlyphs2Chars[ nStart ]; + + // inject kashida glyphs if needed + if( !mbDisableGlyphInjection + && mpJustifications + && mnMinKashidaWidth + && mpVisualAttrs[nStart].uJustification >= SCRIPT_JUSTIFY_ARABIC_NORMAL ) + { + // prepare draw position adjustment + int nExtraOfs = (nSubIter++) * mnMinKashidaWidth; + // calculate space available for the injected glyphs + nGlyphWidth = mpGlyphAdvances[ nStart ]; + const int nExtraWidth = mpJustifications[ nStart ] - nGlyphWidth; + const int nToFillWidth = nExtraWidth - nExtraOfs; + if( (4*nToFillWidth >= mnMinKashidaWidth) // prevent glyph-injection if there is no room + || ((nSubIter > 1) && (nToFillWidth > 0)) ) // unless they can overlap with others + { + // handle if there is not sufficient room for a full glyph + if( nToFillWidth < mnMinKashidaWidth ) + { + // overlap it with the previously injected glyph if possible + int nOverlap = mnMinKashidaWidth - nToFillWidth; + // else overlap it with both neighboring glyphs + if( nSubIter <= 1 ) + nOverlap /= 2; + nExtraOfs -= nOverlap; + } + nGlyphWidth = mnMinKashidaWidth; + aGlyphId = mnMinKashidaGlyph; + nCharPos = -1; + } + else + { + nExtraOfs += nToFillWidth; // at right of cell + nSubIter = 0; // done with glyph injection + } + if( !bManualCellAlign ) + nExtraOfs -= nExtraWidth; // adjust for right-aligned cells + + // adjust the draw position for the injected-glyphs case + if( nExtraOfs ) + { + aRelativePos.X() += nExtraOfs; + rPos = GetDrawPosition( aRelativePos ); + } + } + // update return values - *(pGlyphs++) = mpOutGlyphs[ nStart ]; + *(pGlyphs++) = aGlyphId; if( pGlyphAdvances ) - *(pGlyphAdvances++) = pGlyphWidths[ nStart ]; + *(pGlyphAdvances++) = nGlyphWidth; if( pCharPosAry ) - *(pCharPosAry++) = mpGlyphs2Chars[ nStart ]; + *(pCharPosAry++) = nCharPos; // increment counter of returned glyphs ++nCount; + // reduce code complexity by returning early in glyph-injection case + if( nSubIter != 0 ) + break; + // stop after the last visible glyph in this visual item if( ++nStart >= nEndGlyphPos ) { @@ -1899,7 +1994,7 @@ int UniscribeLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, // RTL-justified glyph positioning is not easy // simplify the code by just returning only one glyph at a time - if( mpJustifications && !bManualCellAlign && pVI->mpScriptItem->a.fRTL ) + if( mpJustifications && pVI->mpScriptItem->a.fRTL ) break; // stop when the x-position of the next glyph is unexpected @@ -1914,13 +2009,16 @@ int UniscribeLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, } ++nStart; + nStartx8 = (nStart << 8) + nSubIter; return nCount; } // ----------------------------------------------------------------------- -void UniscribeLayout::MoveGlyph( int nStart, long nNewXPos ) +void UniscribeLayout::MoveGlyph( int nStartx8, long nNewXPos ) { + DBG_ASSERT( !(nStartx8 & 0xff), "USP::MoveGlyph(): glyph injection not disabled!" ); + int nStart = nStartx8 >> 8; if( nStart > mnGlyphCount ) return; @@ -1940,14 +2038,9 @@ void UniscribeLayout::MoveGlyph( int nStart, long nNewXPos ) for( int i = mnItemCount; --i >= 0; ++pVI ) if( (nStart >= pVI->mnMinGlyphPos) && (nStart < pVI->mnEndGlyphPos) ) break; - #if OSL_DEBUG_LEVEL > 0 - bool bRC = - #endif - GetItemSubrange( *pVI, nMinGlyphPos, nEndGlyphPos ); + bool bRC = GetItemSubrange( *pVI, nMinGlyphPos, nEndGlyphPos ); + (void)bRC; // avoid var-not-used warning DBG_ASSERT( bRC, "USPLayout::MoveG GISR() returned false" ); - #if OSL_DEBUG_LEVEL > 0 - (void)bRC; - #endif } long nDelta = nNewXPos - pVI->mnXOffset; @@ -1968,13 +2061,15 @@ void UniscribeLayout::MoveGlyph( int nStart, long nNewXPos ) // ----------------------------------------------------------------------- -void UniscribeLayout::DropGlyph( int nStart ) +void UniscribeLayout::DropGlyph( int nStartx8 ) { + DBG_ASSERT( !(nStartx8 & 0xff), "USP::DropGlyph(): glyph injection not disabled!" ); + int nStart = nStartx8 >> 8; DBG_ASSERT( nStart<=mnGlyphCount, "USPLayout::MoveG nStart overflow" ); if( nStart > 0 ) // nStart>0 means absolute glyph pos + 1 --nStart; - else // if( !nStart ) // nStart==0 for first visible glyph + else // nStart<=0 for first visible glyph { const VisualItem* pVI = mpVisualItems; for( int i = mnItemCount, nDummy; --i >= 0; ++pVI ) @@ -2336,19 +2431,25 @@ void UniscribeLayout::ApplyDXArray( const ImplLayoutArgs& rArgs ) || (rVisualItem.mnEndCharPos <= mnMinCharPos) ) continue; - bool bHasKashida = false; + // if needed prepare special handling for arabic justification + rVisualItem.mbHasKashidas = false; if( rVisualItem.mpScriptItem->a.fRTL ) { for( i = rVisualItem.mnMinGlyphPos; i < rVisualItem.mnEndGlyphPos; ++i ) - if ( (1U << mpVisualAttrs[i].uJustification) & 0x7F89 ) // any Arabic justification ? - { - // yes - bHasKashida = true; + if ( (1U << mpVisualAttrs[i].uJustification) & 0xFF89 ) // any Arabic justification ? + { // the last SCRIPT_JUSTIFY_xxx + // yes // == 15 (usp 1.6) + rVisualItem.mbHasKashidas = true; + // so prepare for kashida handling + InitKashidaHandling(); break; } - if ( bHasKashida ) + + if( rVisualItem.HasKashidas() ) for( i = rVisualItem.mnMinGlyphPos; i < rVisualItem.mnEndGlyphPos; ++i ) { + // TODO: check if we still need this hack after correction of kashida placing? + // (i87688): apparently yes, we still need it! if ( mpVisualAttrs[i].uJustification == SCRIPT_JUSTIFY_NONE ) // usp decided that justification can't be applied here // but maybe our Kashida algorithm thinks differently. @@ -2363,7 +2464,6 @@ void UniscribeLayout::ApplyDXArray( const ImplLayoutArgs& rArgs ) } } - // convert virtual charwidths to glyph justification values HRESULT nRC = (*pScriptApplyLogicalWidth)( mpCharWidths + rVisualItem.mnMinCharPos, @@ -2383,24 +2483,23 @@ void UniscribeLayout::ApplyDXArray( const ImplLayoutArgs& rArgs ) break; } - // TODO: for kashida justification - // check the widths which are added to mpJustification - // if added width is smaller than iKashidaWidth returned by - // ScriptGetFontProperties, do something (either enlarge to - // iKashidaWidth, or reduce to original width). - // Need to think of a way to compensate the change in overall - // width. - // to prepare for the next visual item // update nXOffset to the next items position // before the mpJustifications[] array gets modified int nMinGlyphPos, nEndGlyphPos; if( GetItemSubrange( rVisualItem, nMinGlyphPos, nEndGlyphPos ) ) + { for( i = nMinGlyphPos; i < nEndGlyphPos; ++i ) nXOffset += mpJustifications[ i ]; + if( rVisualItem.mbHasKashidas ) + KashidaItemFix( nMinGlyphPos, nEndGlyphPos ); + } + + // workaround needed for older USP versions: // right align the justification-adjusted glyphs in their cells for RTL-items - if( bManualCellAlign && rVisualItem.mpScriptItem->a.fRTL && !bHasKashida ) + // unless the right alignment is done by inserting kashidas + if( bManualCellAlign && rVisualItem.mpScriptItem->a.fRTL && !rVisualItem.HasKashidas() ) { for( i = nMinGlyphPos; i < nEndGlyphPos; ++i ) { @@ -2417,17 +2516,164 @@ void UniscribeLayout::ApplyDXArray( const ImplLayoutArgs& rArgs ) // ----------------------------------------------------------------------- +void UniscribeLayout::InitKashidaHandling() +{ + if( mnMinKashidaGlyph != 0 ) // already initialized + return; + + mrWinFontEntry.InitKashidaHandling( mhDC ); + mnMinKashidaWidth = static_cast<int>(mfFontScale * mrWinFontEntry.GetMinKashidaWidth()); + mnMinKashidaGlyph = mrWinFontEntry.GetMinKashidaGlyph(); +} + +// adjust the kashida placement matching to the WriterEngine +void UniscribeLayout::KashidaItemFix( int nMinGlyphPos, int nEndGlyphPos ) +{ + // workaround needed for all known USP versions: + // ApplyLogicalWidth does not match ScriptJustify behaviour + for( int i = nMinGlyphPos; i < nEndGlyphPos; ++i ) + { + // check for vowels + if( (i > nMinGlyphPos && !mpGlyphAdvances[ i-1 ]) + && (1U << mpVisualAttrs[i].uJustification) & 0xFF89 ) + { + // vowel, we do it like ScriptJustify does + // the vowel gets the extra width + long nSpaceAdded = mpJustifications[ i ] - mpGlyphAdvances[ i ]; + mpJustifications [ i ] = mpGlyphAdvances [ i ]; + mpJustifications [ i - 1 ] += nSpaceAdded; + } + } + + // redistribute the widths for kashidas + for( int i = nMinGlyphPos; i < nEndGlyphPos; ) + KashidaWordFix ( nMinGlyphPos, nEndGlyphPos, &i ); +} + +bool UniscribeLayout::KashidaWordFix ( int nMinGlyphPos, int nEndGlyphPos, int* pnCurrentPos ) +{ + // doing pixel work within a word. + // sometimes we have extra pixels and sometimes we miss some pixels to get to mnMinKashidaWidth + + // find the next kashida + int nMinPos = *pnCurrentPos; + int nMaxPos = *pnCurrentPos; + for( int i = nMaxPos; i < nEndGlyphPos; ++i ) + { + if( (mpVisualAttrs[ i ].uJustification >= SCRIPT_JUSTIFY_ARABIC_BLANK) + && (mpVisualAttrs[ i ].uJustification < SCRIPT_JUSTIFY_ARABIC_NORMAL) ) + break; + nMaxPos = i; + } + *pnCurrentPos = nMaxPos + 1; + if( nMinPos == nMaxPos ) + return false; + + // calculate the available space for an extra kashida + long nMaxAdded = 0; + int nKashPos = -1; + for( int i = nMaxPos; i >= nMinPos; --i ) + { + long nSpaceAdded = mpJustifications[ i ] - mpGlyphAdvances[ i ]; + if( nSpaceAdded > nMaxAdded ) + { + nKashPos = i; + nMaxAdded = nSpaceAdded; + } + } + + // return early if there is no need for an extra kashida + if ( nMaxAdded <= 0 ) + return false; + // return early if there is not enough space for an extra kashida + if( 2*nMaxAdded < mnMinKashidaWidth ) + return false; + + // redistribute the extra spacing to the kashida position + for( int i = nMinPos; i <= nMaxPos; ++i ) + { + if( i == nKashPos ) + continue; + // everything else should not have extra spacing + long nSpaceAdded = mpJustifications[ i ] - mpGlyphAdvances[ i ]; + if( nSpaceAdded > 0 ) + { + mpJustifications[ i ] -= nSpaceAdded; + mpJustifications[ nKashPos ] += nSpaceAdded; + } + } + + // check if we fulfill minimal kashida width + long nSpaceAdded = mpJustifications[ nKashPos ] - mpGlyphAdvances[ nKashPos ]; + if( nSpaceAdded < mnMinKashidaWidth ) + { + // ugly: steal some pixels + long nSteal = 1; + if ( nMaxPos - nMinPos > 0 && ((mnMinKashidaWidth - nSpaceAdded) > (nMaxPos - nMinPos))) + nSteal = (mnMinKashidaWidth - nSpaceAdded) / (nMaxPos - nMinPos); + for( int i = nMinPos; i <= nMaxPos; ++i ) + { + if( i == nKashPos ) + continue; + nSteal = Min( mnMinKashidaWidth - nSpaceAdded, nSteal ); + if ( nSteal > 0 ) + { + mpJustifications [ i ] -= nSteal; + mpJustifications [ nKashPos ] += nSteal; + nSpaceAdded += nSteal; + } + if( nSpaceAdded >= mnMinKashidaWidth ) + return true; + } + } + + // blank padding + long nSpaceMissing = mnMinKashidaWidth - nSpaceAdded; + if( nSpaceMissing > 0 ) + { + // inner glyph: distribute extra space evenly + if( (nMinPos > nMinGlyphPos) && (nMaxPos < nEndGlyphPos - 1) ) + { + mpJustifications [ nKashPos ] += nSpaceMissing; + long nHalfSpace = nSpaceMissing / 2; + mpJustifications [ nMinPos - 1 ] -= nHalfSpace; + mpJustifications [ nMaxPos + 1 ] -= nSpaceMissing - nHalfSpace; + } + // rightmost: left glyph gets extra space + else if( nMinPos > nMinGlyphPos ) + { + mpJustifications [ nMinPos - 1 ] -= nSpaceMissing; + mpJustifications [ nKashPos ] += nSpaceMissing; + } + // leftmost: right glyph gets extra space + else if( nMaxPos < nEndGlyphPos - 1 ) + { + mpJustifications [ nKashPos ] += nSpaceMissing; + mpJustifications [ nMaxPos + 1 ] -= nSpaceMissing; + } + else + return false; + } + + return true; +} + +// ----------------------------------------------------------------------- + void UniscribeLayout::Justify( long nNewWidth ) { long nOldWidth = 0; int i; for( i = mnMinCharPos; i < mnEndCharPos; ++i ) nOldWidth += mpCharWidths[ i ]; + if( nOldWidth <= 0 ) + return; - nNewWidth *= mnUnitsPerPixel; + nNewWidth *= mnUnitsPerPixel; // convert into font units if( nNewWidth == nOldWidth ) return; - double fStretch = (double)nNewWidth / nOldWidth; + // prepare to distribute the extra width evenly among the visual items + const double fStretch = (double)nNewWidth / nOldWidth; // initialize justifications array mpJustifications = new int[ mnGlyphCapacity ]; @@ -2451,18 +2697,12 @@ void UniscribeLayout::Justify( long nNewWidth ) nItemWidth += mpCharWidths[ i ]; nItemWidth = (int)((fStretch - 1.0) * nItemWidth + 0.5); - SCRIPT_FONTPROPERTIES aFontProperties; - int nMinKashida = 1; - HRESULT nRC = (*pScriptGetFontProperties)( mhDC, &rScriptCache, &aFontProperties ); - if( !nRC ) - nMinKashida = aFontProperties.iKashidaWidth; - - nRC = (*pScriptJustify) ( + HRESULT nRC = (*pScriptJustify) ( mpVisualAttrs + rVisualItem.mnMinGlyphPos, mpGlyphAdvances + rVisualItem.mnMinGlyphPos, rVisualItem.mnEndGlyphPos - rVisualItem.mnMinGlyphPos, nItemWidth, - nMinKashida, + mnMinKashidaWidth, mpJustifications + rVisualItem.mnMinGlyphPos ); rVisualItem.mnXOffset = nXOffset; @@ -2471,6 +2711,45 @@ void UniscribeLayout::Justify( long nNewWidth ) } } +// ----------------------------------------------------------------------- + +bool UniscribeLayout::IsKashidaPosValid ( int nCharPos ) const +{ + // we have to find the visual item first since the mpLogClusters[] + // needed to find the cluster start is relative to to the visual item + int nMinGlyphIndex = -1; + for( int nItem = 0; nItem < mnItemCount; ++nItem ) + { + const VisualItem& rVisualItem = mpVisualItems[ nItem ]; + if( (nCharPos >= rVisualItem.mnMinCharPos) + && (nCharPos < rVisualItem.mnEndCharPos) ) + { + nMinGlyphIndex = rVisualItem.mnMinGlyphPos; + break; + } + } + // Invalid char pos or leftmost glyph in visual item + if ( nMinGlyphIndex == -1 || !mpLogClusters[ nCharPos ] ) + return false; + +// This test didn't give the expected results +/* if( mpLogClusters[ nCharPos+1 ] == mpLogClusters[ nCharPos ]) + // two chars, one glyph + return false;*/ + + const int nGlyphPos = mpLogClusters[ nCharPos ] + nMinGlyphIndex; + if( nGlyphPos <= 0 ) + return true; + // justification is only allowed if the glyph to the left has not SCRIPT_JUSTIFY_NONE + // and not SCRIPT_JUSTIFY_ARABIC_BLANK + // special case: glyph to the left is vowel (no advance width) + if ( mpVisualAttrs[ nGlyphPos-1 ].uJustification == SCRIPT_JUSTIFY_ARABIC_BLANK + || ( mpVisualAttrs[ nGlyphPos-1 ].uJustification == SCRIPT_JUSTIFY_NONE + && mpGlyphAdvances [ nGlyphPos-1 ] )) + return false; + return true; +} + #endif // USE_UNISCRIBE // ======================================================================= @@ -2519,13 +2798,26 @@ SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe return pWinLayout; } +// ----------------------------------------------------------------------- + +int WinSalGraphics::GetMinKashidaWidth() +{ + if( !mpWinFontEntry[0] ) + return 0; + mpWinFontEntry[0]->InitKashidaHandling( mhDC ); + int nMinKashida = static_cast<int>(mfFontScale * mpWinFontEntry[0]->GetMinKashidaWidth()); + return nMinKashida; +} + // ======================================================================= ImplWinFontEntry::ImplWinFontEntry( ImplFontSelectData& rFSD ) -: ImplFontEntry( rFSD ), - maWidthMap( 512 ), - mpKerningPairs( NULL ), - mnKerningPairs( -1 ) +: ImplFontEntry( rFSD ) +, maWidthMap( 512 ) +, mpKerningPairs( NULL ) +, mnKerningPairs( -1 ) +, mnMinKashidaWidth( -1 ) +, mnMinKashidaGlyph( -1 ) { #ifdef USE_UNISCRIBE maScriptCache = NULL; @@ -2582,6 +2874,33 @@ int ImplWinFontEntry::GetKerning( sal_Unicode cLeft, sal_Unicode cRight ) const return nKernAmount; } +// ----------------------------------------------------------------------- + +bool ImplWinFontEntry::InitKashidaHandling( HDC hDC ) +{ + if( mnMinKashidaWidth >= 0 ) // already cached? + return mnMinKashidaWidth; + + // initialize the kashida width + mnMinKashidaWidth = 0; + mnMinKashidaGlyph = 0; +#ifdef USE_UNISCRIBE + if (aUspModule || (bUspEnabled && InitUSP())) + { + SCRIPT_FONTPROPERTIES aFontProperties; + aFontProperties.cBytes = sizeof (aFontProperties); + SCRIPT_CACHE& rScriptCache = GetScriptCache(); + HRESULT nRC = (*pScriptGetFontProperties)( hDC, &rScriptCache, &aFontProperties ); + if( nRC != 0 ) + return false; + mnMinKashidaWidth = aFontProperties.iKashidaWidth; + mnMinKashidaGlyph = aFontProperties.wgKashida; + } +#endif // USE_UNISCRIBE + + return true; +} + // ======================================================================= ImplFontData* ImplWinFontData::Clone() const diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index dce8947f49d3..fd0f065ce2bc 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -96,6 +96,10 @@ #define COMPILE_MULTIMON_STUBS #include <multimon.h> #include <vector> +#ifdef __MINGW32__ +#include <algorithm> +using ::std::max; +#endif #include <com/sun/star/uno/Exception.hdl> @@ -2504,7 +2508,7 @@ static void ImplGetKeyNameText( LONG lParam, sal_Unicode* pBuf, nKeyLen = GetKeyNameTextW( lParam, aKeyBuf, nMaxKeyLen ); // #i12401# the current unicows.dll has a bug in CharUpperBuffW, which corrupts the stack // fall back to the ANSI version instead - DBG_ASSERT( nKeyLen <= nMaxKeyLen, "Invalid key name length!" ) + DBG_ASSERT( nKeyLen <= nMaxKeyLen, "Invalid key name length!" ); if( nKeyLen > nMaxKeyLen ) nKeyLen = 0; else if( nKeyLen > 0 ) @@ -2525,7 +2529,7 @@ static void ImplGetKeyNameText( LONG lParam, sal_Unicode* pBuf, { sal_Char aAnsiKeyBuf[ nMaxKeyLen ]; int nAnsiKeyLen = GetKeyNameTextA( lParam, aAnsiKeyBuf, nMaxKeyLen ); - DBG_ASSERT( nAnsiKeyLen <= nMaxKeyLen, "Invalid key name length!" ) + DBG_ASSERT( nAnsiKeyLen <= nMaxKeyLen, "Invalid key name length!" ); if( nAnsiKeyLen > nMaxKeyLen ) nAnsiKeyLen = 0; else if( nAnsiKeyLen > 0 ) @@ -5598,7 +5602,7 @@ static BOOL ImplHandleIMEEndComposition( HWND hWnd ) // ----------------------------------------------------------------------- -static void ImplHandleAppCommand( HWND hWnd, LPARAM lParam ) +static boolean ImplHandleAppCommand( HWND hWnd, LPARAM lParam ) { sal_Int16 nCommand = 0; switch( GET_APPCOMMAND_LPARAM(lParam) ) @@ -5622,7 +5626,7 @@ static void ImplHandleAppCommand( HWND hWnd, LPARAM lParam ) case APPCOMMAND_VOLUME_UP: nCommand = MEDIA_COMMAND_VOLUME_UP; break; break; default: - return; + return false; } WinSalFrame* pFrame = GetWindowPtr( hWnd ); @@ -5635,8 +5639,13 @@ static void ImplHandleAppCommand( HWND hWnd, LPARAM lParam ) NotifyEvent aNCmdEvt( EVENT_COMMAND, pWindow, &aCEvt ); if ( !ImplCallPreNotify( aNCmdEvt ) ) + { pWindow->Command( aCEvt ); + return true; + } } + + return false; } @@ -6195,7 +6204,11 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP ImplHandleIMENotify( hWnd, wParam ); break; case WM_APPCOMMAND: - ImplHandleAppCommand( hWnd, lParam ); + if( ImplHandleAppCommand( hWnd, lParam ) ) + { + rDef = false; + nRet = 1; + } break; #if WINVER >= 0x0500 case WM_IME_REQUEST: diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx index 5b735430f8f9..cf64d58110e8 100644 --- a/vcl/workben/svpclient.cxx +++ b/vcl/workben/svpclient.cxx @@ -30,6 +30,7 @@ #include <sal/main.h> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/awt/ImageScaleMode.hpp> #include <vcl/event.hxx> #include <vcl/svapp.hxx> @@ -141,7 +142,7 @@ MyWin::MyWin( Window* pParent, WinBits nWinStyle ) : m_aSvpBitmaps.Show(); m_aImage.SetPosSizePixel( Point( 170, 10 ), Size( 400, 400 ) ); - m_aImage.SetScaleImage( FALSE ); + m_aImage.SetScaleMode( com::sun::star::awt::ImageScaleMode::None ); m_aImage.Show(); m_aQuitButton.SetPosSizePixel( Point( 10, 300 ), Size( 120,25 ) ); |