diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2010-01-29 22:03:10 +0100 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2010-01-29 22:03:10 +0100 |
commit | 324721c3ef3715b002328683f8045c5bcfca0013 (patch) | |
tree | ad304244c9b1d3abdb5eb4e414fa6b4c26100125 | |
parent | 0ce0dd5863208500d8d4658f1f68f34e254ab015 (diff) | |
parent | 7f5f6c30e89c27422a1576ccceb9b0d79c8e3f0d (diff) |
rebased to m70
987 files changed, 27571 insertions, 15262 deletions
diff --git a/basebmp/test/basictest.cxx b/basebmp/test/basictest.cxx index 15d2da39851a..d4d836a4b553 100644 --- a/basebmp/test/basictest.cxx +++ b/basebmp/test/basictest.cxx @@ -30,7 +30,7 @@ // autogenerated file with codegen.pl -#include <cppunit/simpleheader.hxx> +#include <testshl/simpleheader.hxx> #include <basegfx/vector/b2isize.hxx> #include <basegfx/point/b2ipoint.hxx> diff --git a/basebmp/test/bmpmasktest.cxx b/basebmp/test/bmpmasktest.cxx index afadcad3b3fb..1b9e4ca0c68f 100644 --- a/basebmp/test/bmpmasktest.cxx +++ b/basebmp/test/bmpmasktest.cxx @@ -30,7 +30,7 @@ // autogenerated file with codegen.pl -#include <cppunit/simpleheader.hxx> +#include <testshl/simpleheader.hxx> #include <basegfx/vector/b2isize.hxx> #include <basegfx/range/b2irange.hxx> diff --git a/basebmp/test/bmptest.cxx b/basebmp/test/bmptest.cxx index 33ed58c25402..978c4bbe6243 100644 --- a/basebmp/test/bmptest.cxx +++ b/basebmp/test/bmptest.cxx @@ -30,7 +30,7 @@ // autogenerated file with codegen.pl -#include <cppunit/simpleheader.hxx> +#include <testshl/simpleheader.hxx> #include <basegfx/vector/b2isize.hxx> #include <basegfx/range/b2irange.hxx> diff --git a/basebmp/test/cliptest.cxx b/basebmp/test/cliptest.cxx index 2172b0b667a7..41da8cac617a 100644 --- a/basebmp/test/cliptest.cxx +++ b/basebmp/test/cliptest.cxx @@ -30,7 +30,7 @@ // autogenerated file with codegen.pl -#include <cppunit/simpleheader.hxx> +#include <testshl/simpleheader.hxx> #include <basegfx/vector/b2isize.hxx> #include <basegfx/point/b2ipoint.hxx> diff --git a/basebmp/test/filltest.cxx b/basebmp/test/filltest.cxx index fcc4e5df5fa3..ba25cfa9044e 100644 --- a/basebmp/test/filltest.cxx +++ b/basebmp/test/filltest.cxx @@ -30,7 +30,7 @@ // autogenerated file with codegen.pl -#include <cppunit/simpleheader.hxx> +#include <testshl/simpleheader.hxx> #include <basegfx/vector/b2isize.hxx> #include <basegfx/range/b2drange.hxx> diff --git a/basebmp/test/linetest.cxx b/basebmp/test/linetest.cxx index 1a424864f893..b78175128eba 100644 --- a/basebmp/test/linetest.cxx +++ b/basebmp/test/linetest.cxx @@ -30,7 +30,7 @@ // autogenerated file with codegen.pl -#include <cppunit/simpleheader.hxx> +#include <testshl/simpleheader.hxx> #include <basegfx/vector/b2isize.hxx> #include <basegfx/point/b2ipoint.hxx> diff --git a/basebmp/test/makefile.mk b/basebmp/test/makefile.mk index 3ea13868aeb4..f7a5dded4cf1 100644 --- a/basebmp/test/makefile.mk +++ b/basebmp/test/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # 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 @@ -57,7 +57,7 @@ CFLAGS += -fno-inline # SunStudio 12 (-m64 and -m32 modes): three test cases of the unit tests fail # if compiled with default -xalias_level (and optimization level -xO3) -.IF "$(OS)"=="SOLARIS" +.IF "$(OS)"=="SOLARIS" # For Sun Studio 8 this switch does not work: compilation fails on bitmapdevice.cxx .IF "$(CCNUMVER)"!="00050005" CDEFS+=-xalias_level=compatible @@ -68,7 +68,7 @@ CDEFS+=-xalias_level=compatible .IF "$(L10N_framework)"=="" # BEGIN ---------------------------------------------------------------- -# auto generated Target:tests by codegen.pl +# auto generated Target:tests by codegen.pl SHL1OBJS= \ $(SLO)$/basictest.obj \ $(SLO)$/bmpmasktest.obj \ @@ -88,13 +88,14 @@ SHL1OBJS= \ # source/makefile.mk SHL1TARGET= tests SHL1STDLIBS= $(SALLIB) \ + $(TESTSHL2LIB)\ $(CPPUNITLIB) \ - $(BASEGFXLIB) + $(BASEGFXLIB) SHL1IMPLIB= i$(SHL1TARGET) DEF1NAME =$(SHL1TARGET) -SHL1VERSIONMAP = export.map +SHL1VERSIONMAP = export.map .ENDIF # END ------------------------------------------------------------------ @@ -111,7 +112,7 @@ SHL1VERSIONMAP = export.map # $(CPPUHELPERLIB) \ # $(UCBHELPERLIB) \ # $(SALLIB) \ -# $(VCLLIB) +# $(VCLLIB) # #.IF "$(GUI)"!="UNX" #APP2DEF= $(MISC)$/$(TARGET).def @@ -119,12 +120,12 @@ SHL1VERSIONMAP = export.map #------------------------------- All object files ------------------------------- # do this here, so we get right dependencies -SLOFILES=$(SHL1OBJS) +SLOFILES=$(SHL1OBJS) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk -.INCLUDE : _cppunit.mk +.INCLUDE : _cppunit.mk # --- Enable test execution in normal build ------------------------ .IF "$(L10N_framework)"=="" diff --git a/basebmp/test/masktest.cxx b/basebmp/test/masktest.cxx index 61f329f094f2..94e5bc42a5ea 100644 --- a/basebmp/test/masktest.cxx +++ b/basebmp/test/masktest.cxx @@ -30,7 +30,7 @@ // autogenerated file with codegen.pl -#include <cppunit/simpleheader.hxx> +#include <testshl/simpleheader.hxx> #include <basegfx/vector/b2isize.hxx> #include <basegfx/range/b2irange.hxx> diff --git a/basebmp/test/polytest.cxx b/basebmp/test/polytest.cxx index e35c8c834bd9..da118e4b6d8a 100644 --- a/basebmp/test/polytest.cxx +++ b/basebmp/test/polytest.cxx @@ -30,7 +30,7 @@ // autogenerated file with codegen.pl -#include <cppunit/simpleheader.hxx> +#include <testshl/simpleheader.hxx> #include <basegfx/vector/b2isize.hxx> #include <basegfx/range/b2irange.hxx> diff --git a/basegfx/inc/basegfx/curve/b2dcubicbezier.hxx b/basegfx/inc/basegfx/curve/b2dcubicbezier.hxx index 4dc2f45568f1..81be451499ea 100644 --- a/basegfx/inc/basegfx/curve/b2dcubicbezier.hxx +++ b/basegfx/inc/basegfx/curve/b2dcubicbezier.hxx @@ -203,6 +203,22 @@ namespace basegfx sense to use reserve(4) at the vector as preparation. */ void getAllExtremumPositions(::std::vector< double >& rResults) const; + + /** Get optimum-split position on this segment + + This method calculates the positions of all points of the segment + that have the maximimum distance to the corresponding line from + startpoint-endpoint. This helps to approximate the bezier curve + with a minimum number of line segments + + @param fResults + Result positions are in the range ]0.0 .. 1.0[ + Cubic beziers have at most two of these positions + + @return + Returns the number of split positions found + */ + int getMaxDistancePositions( double fResults[2]) const; }; } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx b/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx index c7c79d0cd6e9..10b023c5f68c 100644 --- a/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx +++ b/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx @@ -52,12 +52,22 @@ namespace basegfx B2DHomMatrix(const B2DHomMatrix& rMat); ~B2DHomMatrix(); + /** constructor to allow setting all needed values for a 3x2 matrix at once. The + parameter f_0x1 e.g. is the same as using set(0, 1, f) + */ + B2DHomMatrix(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2); + /// unshare this matrix with all internally shared instances void makeUnique(); double get(sal_uInt16 nRow, sal_uInt16 nColumn) const; void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue); + /** allow setting all needed values for a 3x2 matrix in one call. The + parameter f_0x1 e.g. is the same as using set(0, 1, f) + */ + void set3x2(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2); + // test if last line is default to see if last line needs to be // involved in calculations bool isLastLineDefault() const; diff --git a/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx b/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx index 0b200b812bed..c90f673a8194 100644 --- a/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx +++ b/basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx @@ -40,45 +40,190 @@ namespace basegfx { - class DecomposedB2DHomMatrixContainer + namespace tools { - private: - B2DHomMatrix maB2DHomMatrix; - B2DVector maScale; - B2DVector maTranslate; - double mfRotate; - double mfShearX; + /** If the rotation angle is an approximate multiple of pi/2, + force fSin/fCos to -1/0/1, to maintain orthogonality (which + might also be advantageous for the other cases, but: for + multiples of pi/2, the exact values _can_ be attained. It + would be largely unintuitive, if a 180 degrees rotation + would introduce slight roundoff errors, instead of exactly + mirroring the coordinate system) + */ + void createSinCosOrthogonal(double& o_rSin, double& rCos, double fRadiant); - // bitfield - unsigned mbDecomposed : 1; + /** Tooling methods for on-the-fly matrix generation e.g. for inline + multiplications + */ + B2DHomMatrix createScaleB2DHomMatrix(double fScaleX, double fScaleY); + B2DHomMatrix createShearXB2DHomMatrix(double fShearX); + B2DHomMatrix createShearYB2DHomMatrix(double fShearY); + B2DHomMatrix createRotateB2DHomMatrix(double fRadiant); + B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY); - void impCheckDecompose() + /// inline versions for parameters as tuples + inline B2DHomMatrix createScaleB2DHomMatrix(const B2DTuple& rScale) { - if(!mbDecomposed) - { - maB2DHomMatrix.decompose(maScale, maTranslate, mfRotate, mfShearX); - mbDecomposed = true; - } + return createScaleB2DHomMatrix(rScale.getX(), rScale.getY()); + } + + inline B2DHomMatrix createTranslateB2DHomMatrix(const B2DTuple& rTranslate) + { + return createTranslateB2DHomMatrix(rTranslate.getX(), rTranslate.getY()); + } + + /** Tooling methods for faster completely combined matrix creation + when scale, shearX, rotation and translation needs to be done in + exactly that order. It's faster since it direcly calculates + each matrix value based on a symbolic calculation of the three + matrix multiplications. + Inline versions for parameters as tuples added, too. + */ + B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix( + double fScaleX, double fScaleY, + double fShearX, + double fRadiant, + double fTranslateX, double fTranslateY); + inline B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix( + const B2DTuple& rScale, + double fShearX, + double fRadiant, + const B2DTuple& rTranslate) + { + return createScaleShearXRotateTranslateB2DHomMatrix( + rScale.getX(), rScale.getY(), + fShearX, + fRadiant, + rTranslate.getX(), rTranslate.getY()); + } + + B2DHomMatrix createShearXRotateTranslateB2DHomMatrix( + double fShearX, + double fRadiant, + double fTranslateX, double fTranslateY); + inline B2DHomMatrix createShearXRotateTranslateB2DHomMatrix( + double fShearX, + double fRadiant, + const B2DTuple& rTranslate) + { + return createShearXRotateTranslateB2DHomMatrix( + fShearX, + fRadiant, + rTranslate.getX(), rTranslate.getY()); } - public: - DecomposedB2DHomMatrixContainer(const B2DHomMatrix& rB2DHomMatrix) - : maB2DHomMatrix(rB2DHomMatrix), - maScale(), - maTranslate(), - mfRotate(0.0), - mfShearX(0.0), - mbDecomposed(false) + B2DHomMatrix createScaleTranslateB2DHomMatrix( + double fScaleX, double fScaleY, + double fTranslateX, double fTranslateY); + inline B2DHomMatrix createScaleTranslateB2DHomMatrix( + const B2DTuple& rScale, + const B2DTuple& rTranslate) { + return createScaleTranslateB2DHomMatrix( + rScale.getX(), rScale.getY(), + rTranslate.getX(), rTranslate.getY()); } - // data access - const B2DHomMatrix& getB2DHomMatrix() const { return maB2DHomMatrix; } - const B2DVector& getScale() const { const_cast< DecomposedB2DHomMatrixContainer* >(this)->impCheckDecompose(); return maScale; } - const B2DVector& getTranslate() const { const_cast< DecomposedB2DHomMatrixContainer* >(this)->impCheckDecompose(); return maTranslate; } - double getRotate() const { const_cast< DecomposedB2DHomMatrixContainer* >(this)->impCheckDecompose(); return mfRotate; } - double getShearX() const { const_cast< DecomposedB2DHomMatrixContainer* >(this)->impCheckDecompose(); return mfShearX; } - }; + /// special for the often used case of rotation around a point + B2DHomMatrix createRotateAroundPoint( + double fPointX, double fPointY, + double fRadiant); + inline B2DHomMatrix createRotateAroundPoint( + const B2DTuple& rPoint, + double fRadiant) + { + return createRotateAroundPoint( + rPoint.getX(), rPoint.getY(), + fRadiant); + } + } // end of namespace tools +} // end of namespace basegfx + +/////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + namespace tools + { + class B2DHomMatrixBufferedDecompose + { + private: + B2DVector maScale; + B2DVector maTranslate; + double mfRotate; + double mfShearX; + + public: + B2DHomMatrixBufferedDecompose(const B2DHomMatrix& rB2DHomMatrix) + : maScale(), + maTranslate(), + mfRotate(0.0), + mfShearX(0.0) + { + rB2DHomMatrix.decompose(maScale, maTranslate, mfRotate, mfShearX); + } + + // data access + B2DHomMatrix getB2DHomMatrix() const + { + return createScaleShearXRotateTranslateB2DHomMatrix( + maScale, mfShearX, mfRotate, maTranslate); + } + + const B2DVector& getScale() const { return maScale; } + const B2DVector& getTranslate() const { return maTranslate; } + double getRotate() const { return mfRotate; } + double getShearX() const { return mfShearX; } + }; + } // end of namespace tools +} // end of namespace basegfx + +/////////////////////////////////////////////////////////////////////////////// + +namespace basegfx +{ + namespace tools + { + class B2DHomMatrixBufferedOnDemandDecompose + { + private: + B2DHomMatrix maB2DHomMatrix; + B2DVector maScale; + B2DVector maTranslate; + double mfRotate; + double mfShearX; + + // bitfield + unsigned mbDecomposed : 1; + + void impCheckDecompose() + { + if(!mbDecomposed) + { + maB2DHomMatrix.decompose(maScale, maTranslate, mfRotate, mfShearX); + mbDecomposed = true; + } + } + + public: + B2DHomMatrixBufferedOnDemandDecompose(const B2DHomMatrix& rB2DHomMatrix) + : maB2DHomMatrix(rB2DHomMatrix), + maScale(), + maTranslate(), + mfRotate(0.0), + mfShearX(0.0), + mbDecomposed(false) + { + } + + // data access + const B2DHomMatrix& getB2DHomMatrix() const { return maB2DHomMatrix; } + const B2DVector& getScale() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return maScale; } + const B2DVector& getTranslate() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return maTranslate; } + double getRotate() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return mfRotate; } + double getShearX() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return mfShearX; } + }; + } // end of namespace tools } // end of namespace basegfx /////////////////////////////////////////////////////////////////////////////// diff --git a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx index ee12d55d460b..c0de4b57ced8 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: b2dpolygon.hxx,v $ - * $Revision: 1.14 $ * * This file is part of OpenOffice.org. * @@ -88,7 +87,9 @@ namespace basegfx /// Coordinate insert/append void insert(sal_uInt32 nIndex, const basegfx::B2DPoint& rPoint, sal_uInt32 nCount = 1); - void append(const basegfx::B2DPoint& rPoint, sal_uInt32 nCount = 1); + void append(const basegfx::B2DPoint& rPoint, sal_uInt32 nCount); + void append(const basegfx::B2DPoint& rPoint); + void reserve(sal_uInt32 nCount); /// Basic ControlPoint interface basegfx::B2DPoint getPrevControlPoint(sal_uInt32 nIndex) const; diff --git a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx index 5eff6b0b9cc1..47ff41b75e70 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx @@ -288,14 +288,6 @@ namespace basegfx */ B2DPolygon createPolygonFromCircle( const B2DPoint& rCenter, double fRadius ); - /** append a unit circle with one point and the control vectors to the given polygon - */ - void appendUnitCircleQuadrant(B2DPolygon& rPolygon, sal_uInt32 nQuadrant, bool bEndPoint); - - /** append a segment of unit circle with one point and the control vectors to the given polygon - */ - void appendUnitCircleQuadrantSegment(B2DPolygon& rPolygon, sal_uInt32 nQuadrant, double fStart, double fEnd, bool bEndPoint); - /** create a polygon which describes the unit circle and close it @param nStartQuadrant @@ -325,59 +317,6 @@ namespace basegfx */ B2DPolygon createPolygonFromEllipse( const B2DPoint& rCenter, double fRadiusX, double fRadiusY ); - /** append a unit circle with one point and the control vectors to the given polygon - */ - void appendUnitCircleQuadrant(B2DPolygon& rPolygon, sal_uInt32 nQuadrant); - - /** append a segment of unit circle with start point, the control vectors and end point to the given polygon - */ - void appendUnitCircleQuadrantSegment(B2DPolygon& rPolygon, sal_uInt32 nQuadrant, double fStart, double fEnd); - - /** Create an ellipse polygon with given radii. - - This method creates an ellipse approximation consisting of - four cubic bezier segments, which approximate the given - ellipse with an error of less than 0.5 percent. - - @param rCenter - Center point of the circle - - @param fRadiusX - Radius of the ellipse in X direction - - @param fRadiusY - Radius of the ellipse in Y direction - - @param fStart - Start angle where the ellipe segment starts in the range [0.0 .. 2PI[ - - @param fEnd - End angle where the ellipe segment ends in the range [0.0 .. 2PI[ - */ - B2DPolygon createPolygonFromEllipse( const B2DPoint& rCenter, double fRadiusX, double fRadiusY ); - - /** Create an ellipse polygon with given radii and the given angles, from start to end - - This method creates an ellipse approximation consisting of - four cubic bezier segments, which approximate the given - ellipse with an error of less than 0.5 percent. - - @param rCenter - Center point of the circle - - @param fRadiusX - Radius of the ellipse in X direction - - @param fRadiusY - Radius of the ellipse in Y direction - - @param fStart - Start angle where the ellipe segment starts in the range [0.0 .. 2PI[ - - @param fEnd - End angle where the ellipe segment ends in the range [0.0 .. 2PI[ - */ - /** Create an unit ellipse polygon with the given angles, from start to end */ B2DPolygon createPolygonFromEllipseSegment( const B2DPoint& rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd ); diff --git a/basegfx/inc/basegfx/range/b1drange.hxx b/basegfx/inc/basegfx/range/b1drange.hxx index efca06d92dfd..366431c3cd50 100644 --- a/basegfx/inc/basegfx/range/b1drange.hxx +++ b/basegfx/inc/basegfx/range/b1drange.hxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: b1drange.hxx,v $ - * $Revision: 1.15 $ * * This file is part of OpenOffice.org. * @@ -131,6 +130,11 @@ namespace basegfx return maRange.overlaps(rRange.maRange); } + bool overlapsMore(const B1DRange& rRange) const + { + return maRange.overlapsMore(rRange.maRange); + } + void expand(double fValue) { maRange.expand(fValue); diff --git a/basegfx/inc/basegfx/range/b2drange.hxx b/basegfx/inc/basegfx/range/b2drange.hxx index 66892865399f..8a70d4782f47 100644 --- a/basegfx/inc/basegfx/range/b2drange.hxx +++ b/basegfx/inc/basegfx/range/b2drange.hxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: b2drange.hxx,v $ - * $Revision: 1.19 $ * * This file is part of OpenOffice.org. * @@ -222,6 +221,14 @@ namespace basegfx ); } + bool overlapsMore(const B2DRange& rRange) const + { + return ( + maRangeX.overlapsMore(rRange.maRangeX) + && maRangeY.overlapsMore(rRange.maRangeY) + ); + } + void expand(const B2DTuple& rTuple) { maRangeX.expand(rTuple.getX()); diff --git a/basegfx/inc/basegfx/range/basicrange.hxx b/basegfx/inc/basegfx/range/basicrange.hxx index a7c402c905c8..59d13cf530c0 100644 --- a/basegfx/inc/basegfx/range/basicrange.hxx +++ b/basegfx/inc/basegfx/range/basicrange.hxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: basicrange.hxx,v $ - * $Revision: 1.15 $ * * This file is part of OpenOffice.org. * @@ -142,6 +141,14 @@ namespace basegfx } } + bool overlapsMore(const BasicRange& rRange) const + { + if(isEmpty() || rRange.isEmpty()) + return false; + // returns true if the overlap is more than just a touching at the limits + return ((rRange.mnMaximum > mnMinimum) && (rRange.mnMinimum < mnMaximum)); + } + bool operator==( const BasicRange& rRange ) const { return (mnMinimum == rRange.mnMinimum && mnMaximum == rRange.mnMaximum); diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx index e7247a95333b..83c620df7870 100644 --- a/basegfx/source/curve/b2dcubicbezier.cxx +++ b/basegfx/source/curve/b2dcubicbezier.cxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: b2dcubicbezier.cxx,v $ - * $Revision: 1.16 $ * * This file is part of OpenOffice.org. * @@ -1045,6 +1044,65 @@ namespace basegfx impCheckExtremumResult(fCY / (2 * fBY), rResults); } } + + int B2DCubicBezier::getMaxDistancePositions( double pResult[2]) const + { + // the distance from the bezier to a line through start and end + // is proportional to (ENDx-STARTx,ENDy-STARTy)*(+BEZIERy(t),-BEZIERx(t)) + // this distance becomes zero for at least t==0 and t==1 + // its extrema that are between 0..1 are interesting as split candidates + // its derived function has the form dD/dt = fA*t^2 + 2*fB*t + fC + const B2DPoint aRelativeEndPoint(maEndPoint-maStartPoint); + const double fA = 3 * (maEndPoint.getX() - maControlPointB.getX()) * aRelativeEndPoint.getY() + - 3 * (maEndPoint.getY() - maControlPointB.getY()) * aRelativeEndPoint.getX(); + const double fB = (maControlPointB.getX() - maControlPointA.getX()) * aRelativeEndPoint.getY() + - (maControlPointB.getY() - maControlPointA.getY()) * aRelativeEndPoint.getX(); + const double fC = (maControlPointA.getX() - maStartPoint.getX()) * aRelativeEndPoint.getY() + - (maControlPointA.getY() - maStartPoint.getY()) * aRelativeEndPoint.getX(); + + // test for degenerated case: non-cubic curve + if( fTools::equalZero(fA) ) + { + // test for degenerated case: straight line + if( fTools::equalZero(fB) ) + return 0; + + // degenerated case: quadratic bezier + pResult[0] = -fC / (2*fB); + + // test root: ignore it when it is outside the curve + int nCount = ((pResult[0] > 0) && (pResult[0] < 1)); + return nCount; + } + + // derivative is polynomial of order 2 + // check if the polynomial has non-imaginary roots + const double fD = fB*fB - fA*fC; + if( fD >= 0.0 ) // TODO: is this test needed? geometrically not IMHO + { + // calculate the first root + const double fS = sqrt(fD); + const double fQ = fB + ((fB >= 0) ? +fS : -fS); + pResult[0] = fQ / fA; + // test root: ignore it when it is outside the curve + int nCount = ((pResult[0] > 0) && (pResult[0] < 1)); + + // ignore multiplicit roots + if( !fTools::equalZero(fD) ) + { + // calculate the second root + const double fRoot = fC / fQ; + pResult[ nCount ] = fC / fQ; + // test root: ignore it when it is outside the curve + nCount += ((fRoot > 0) && (fRoot < 1)); + } + + return nCount; + } + + return 0; + } + } // end of namespace basegfx // eof diff --git a/basegfx/source/matrix/b2dhommatrix.cxx b/basegfx/source/matrix/b2dhommatrix.cxx index 352113fa8ed3..a7777352effb 100644 --- a/basegfx/source/matrix/b2dhommatrix.cxx +++ b/basegfx/source/matrix/b2dhommatrix.cxx @@ -36,6 +36,9 @@ #include <hommatrixtemplate.hxx> #include <basegfx/tuple/b2dtuple.hxx> #include <basegfx/vector/b2dvector.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> + +/////////////////////////////////////////////////////////////////////////////// namespace basegfx { @@ -60,6 +63,17 @@ namespace basegfx { } + B2DHomMatrix::B2DHomMatrix(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2) + : mpImpl( IdentityMatrix::get() ) // use common identity matrix, will be made unique with 1st set-call + { + mpImpl->set(0, 0, f_0x0); + mpImpl->set(0, 1, f_0x1); + mpImpl->set(0, 2, f_0x2); + mpImpl->set(1, 0, f_1x0); + mpImpl->set(1, 1, f_1x1); + mpImpl->set(1, 2, f_1x2); + } + B2DHomMatrix& B2DHomMatrix::operator=(const B2DHomMatrix& rMat) { mpImpl = rMat.mpImpl; @@ -81,6 +95,16 @@ namespace basegfx mpImpl->set(nRow, nColumn, fValue); } + void B2DHomMatrix::set3x2(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2) + { + mpImpl->set(0, 0, f_0x0); + mpImpl->set(0, 1, f_0x1); + mpImpl->set(0, 2, f_0x2); + mpImpl->set(1, 0, f_1x0); + mpImpl->set(1, 1, f_1x1); + mpImpl->set(1, 2, f_1x2); + } + bool B2DHomMatrix::isLastLineDefault() const { return mpImpl->isLastLineDefault(); @@ -206,56 +230,9 @@ namespace basegfx if(!fTools::equalZero(fRadiant)) { double fSin(0.0); - double fCos(0.0); - - // is the rotation angle an approximate multiple of pi/2? - // If yes, force fSin/fCos to -1/0/1, to maintain - // orthogonality (which might also be advantageous for the - // other cases, but: for multiples of pi/2, the exact - // values _can_ be attained. It would be largely - // unintuitive, if a 180 degrees rotation would introduce - // slight roundoff errors, instead of exactly mirroring - // the coordinate system). - if( fTools::equalZero( fmod( fRadiant, F_PI2 ) ) ) - { - // determine quadrant - const sal_Int32 nQuad( - (4 + fround( 4/F_2PI*fmod( fRadiant, F_2PI ) )) % 4 ); - switch( nQuad ) - { - case 0: // -2pi,0,2pi - fSin = 0.0; - fCos = 1.0; - break; - - case 1: // -3/2pi,1/2pi - fSin = 1.0; - fCos = 0.0; - break; - - case 2: // -pi,pi - fSin = 0.0; - fCos = -1.0; - break; - - case 3: // -1/2pi,3/2pi - fSin = -1.0; - fCos = 0.0; - break; - - default: - OSL_ENSURE( false, - "B2DHomMatrix::rotate(): Impossible case reached" ); - } - } - else - { - // TODO(P1): Maybe use glibc's sincos here (though - // that's kinda non-portable...) - fSin = sin(fRadiant); - fCos = cos(fRadiant); - } + double fCos(1.0); + tools::createSinCosOrthogonal(fSin, fCos, fRadiant); Impl2DHomMatrix aRotMat; aRotMat.set(0, 0, fCos); @@ -474,104 +451,7 @@ namespace basegfx return true; } - -/* Old version: Used 3D decompose when shaer was involved and also a determinant test - (but only in that case). Keeping as comment since it also worked and to allow a - fallback in case the new version makes trouble somehow. Definitely missing in the 2nd - case is the sign correction for Y-Scale, this would need to be added following the above - pattern - - bool B2DHomMatrix::decompose(B2DTuple& rScale, B2DTuple& rTranslate, double& rRotate, double& rShearX) const - { - // when perspective is used, decompose is not made here - if(!mpImpl->isLastLineDefault()) - return false; - - // test for rotation and shear - if(fTools::equalZero(get(0, 1)) - && fTools::equalZero(get(1, 0))) - { - // no rotation and shear, direct value extraction - rRotate = rShearX = 0.0; - - // copy scale values - rScale.setX(get(0, 0)); - rScale.setY(get(1, 1)); - - // copy translation values - rTranslate.setX(get(0, 2)); - rTranslate.setY(get(1, 2)); - - return true; - } - else - { - // test if shear is zero. That's the case, if the unit vectors in the matrix - // are perpendicular -> scalar is zero - const ::basegfx::B2DVector aUnitVecX(get(0, 0), get(1, 0)); - const ::basegfx::B2DVector aUnitVecY(get(0, 1), get(1, 1)); - - if(fTools::equalZero(aUnitVecX.scalar(aUnitVecY))) - { - // no shear, direct value extraction - rShearX = 0.0; - - // calculate rotation - rShearX = 0.0; - rRotate = atan2(aUnitVecX.getY(), aUnitVecX.getX()); - - // calculate scale values - rScale.setX(aUnitVecX.getLength()); - rScale.setY(aUnitVecY.getLength()); - - // copy translation values - rTranslate.setX(get(0, 2)); - rTranslate.setY(get(1, 2)); - - return true; - } - else - { - // If determinant is zero, decomposition is not possible - if(0.0 == determinant()) - return false; - - // copy 2x2 matrix and translate vector to 3x3 matrix - ::basegfx::B3DHomMatrix a3DHomMat; - - a3DHomMat.set(0, 0, get(0, 0)); - a3DHomMat.set(0, 1, get(0, 1)); - a3DHomMat.set(1, 0, get(1, 0)); - a3DHomMat.set(1, 1, get(1, 1)); - a3DHomMat.set(0, 3, get(0, 2)); - a3DHomMat.set(1, 3, get(1, 2)); - - ::basegfx::B3DTuple r3DScale, r3DTranslate, r3DRotate, r3DShear; - - if(a3DHomMat.decompose(r3DScale, r3DTranslate, r3DRotate, r3DShear)) - { - // copy scale values - rScale.setX(r3DScale.getX()); - rScale.setY(r3DScale.getY()); - - // copy shear - rShearX = r3DShear.getX(); - - // copy rotate - rRotate = r3DRotate.getZ(); - - // copy translate - rTranslate.setX(r3DTranslate.getX()); - rTranslate.setY(r3DTranslate.getY()); - - return true; - } - } - } - - return false; - } */ - } // end of namespace basegfx +/////////////////////////////////////////////////////////////////////////////// // eof diff --git a/basegfx/source/matrix/b2dhommatrixtools.cxx b/basegfx/source/matrix/b2dhommatrixtools.cxx index 59a1ff432fc7..2c71193f6352 100644 --- a/basegfx/source/matrix/b2dhommatrixtools.cxx +++ b/basegfx/source/matrix/b2dhommatrixtools.cxx @@ -38,6 +38,339 @@ namespace basegfx { + namespace tools + { + void createSinCosOrthogonal(double& o_rSin, double& o_rCos, double fRadiant) + { + if( fTools::equalZero( fmod( fRadiant, F_PI2 ) ) ) + { + // determine quadrant + const sal_Int32 nQuad( + (4 + fround( 4/F_2PI*fmod( fRadiant, F_2PI ) )) % 4 ); + switch( nQuad ) + { + case 0: // -2pi,0,2pi + o_rSin = 0.0; + o_rCos = 1.0; + break; + + case 1: // -3/2pi,1/2pi + o_rSin = 1.0; + o_rCos = 0.0; + break; + + case 2: // -pi,pi + o_rSin = 0.0; + o_rCos = -1.0; + break; + + case 3: // -1/2pi,3/2pi + o_rSin = -1.0; + o_rCos = 0.0; + break; + + default: + OSL_ENSURE( false, "createSinCos: Impossible case reached" ); + } + } + else + { + // TODO(P1): Maybe use glibc's sincos here (though + // that's kinda non-portable...) + o_rSin = sin(fRadiant); + o_rCos = cos(fRadiant); + } + } + + B2DHomMatrix createScaleB2DHomMatrix(double fScaleX, double fScaleY) + { + B2DHomMatrix aRetval; + const double fOne(1.0); + + if(!fTools::equal(fScaleX, fOne)) + { + aRetval.set(0, 0, fScaleX); + } + + if(!fTools::equal(fScaleY, fOne)) + { + aRetval.set(1, 1, fScaleY); + } + + return aRetval; + } + + B2DHomMatrix createShearXB2DHomMatrix(double fShearX) + { + B2DHomMatrix aRetval; + + if(!fTools::equalZero(fShearX)) + { + aRetval.set(0, 1, fShearX); + } + + return aRetval; + } + + B2DHomMatrix createShearYB2DHomMatrix(double fShearY) + { + B2DHomMatrix aRetval; + + if(!fTools::equalZero(fShearY)) + { + aRetval.set(1, 0, fShearY); + } + + return aRetval; + } + + B2DHomMatrix createRotateB2DHomMatrix(double fRadiant) + { + B2DHomMatrix aRetval; + + if(!fTools::equalZero(fRadiant)) + { + double fSin(0.0); + double fCos(1.0); + + createSinCosOrthogonal(fSin, fCos, fRadiant); + aRetval.set(0, 0, fCos); + aRetval.set(1, 1, fCos); + aRetval.set(1, 0, fSin); + aRetval.set(0, 1, -fSin); + } + + return aRetval; + } + + B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY) + { + B2DHomMatrix aRetval; + + if(!(fTools::equalZero(fTranslateX) && fTools::equalZero(fTranslateY))) + { + aRetval.set(0, 2, fTranslateX); + aRetval.set(1, 2, fTranslateY); + } + + return aRetval; + } + + B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix( + double fScaleX, double fScaleY, + double fShearX, + double fRadiant, + double fTranslateX, double fTranslateY) + { + const double fOne(1.0); + + if(fTools::equal(fScaleX, fOne) && fTools::equal(fScaleY, fOne)) + { + /// no scale, take shortcut + return createShearXRotateTranslateB2DHomMatrix(fShearX, fRadiant, fTranslateX, fTranslateY); + } + else + { + /// scale used + if(fTools::equalZero(fShearX)) + { + /// no shear + if(fTools::equalZero(fRadiant)) + { + /// no rotate, take shortcut + return createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, fTranslateX, fTranslateY); + } + else + { + /// rotate and scale used, no shear + double fSin(0.0); + double fCos(1.0); + + createSinCosOrthogonal(fSin, fCos, fRadiant); + + B2DHomMatrix aRetval( + /* Row 0, Column 0 */ fCos * fScaleX, + /* Row 0, Column 1 */ fScaleY * -fSin, + /* Row 0, Column 2 */ fTranslateX, + /* Row 1, Column 0 */ fSin * fScaleX, + /* Row 1, Column 1 */ fScaleY * fCos, + /* Row 1, Column 2 */ fTranslateY); + + return aRetval; + } + } + else + { + /// scale and shear used + if(fTools::equalZero(fRadiant)) + { + /// scale and shear, but no rotate + B2DHomMatrix aRetval( + /* Row 0, Column 0 */ fScaleX, + /* Row 0, Column 1 */ fScaleY * fShearX, + /* Row 0, Column 2 */ fTranslateX, + /* Row 1, Column 0 */ 0.0, + /* Row 1, Column 1 */ fScaleY, + /* Row 1, Column 2 */ fTranslateY); + + return aRetval; + } + else + { + /// scale, shear and rotate used + double fSin(0.0); + double fCos(1.0); + + createSinCosOrthogonal(fSin, fCos, fRadiant); + + B2DHomMatrix aRetval( + /* Row 0, Column 0 */ fCos * fScaleX, + /* Row 0, Column 1 */ fScaleY * ((fCos * fShearX) - fSin), + /* Row 0, Column 2 */ fTranslateX, + /* Row 1, Column 0 */ fSin * fScaleX, + /* Row 1, Column 1 */ fScaleY * ((fSin * fShearX) + fCos), + /* Row 1, Column 2 */ fTranslateY); + + return aRetval; + } + } + } + } + + B2DHomMatrix createShearXRotateTranslateB2DHomMatrix( + double fShearX, + double fRadiant, + double fTranslateX, double fTranslateY) + { + if(fTools::equalZero(fShearX)) + { + /// no shear + if(fTools::equalZero(fRadiant)) + { + /// no shear, no rotate, take shortcut + return createTranslateB2DHomMatrix(fTranslateX, fTranslateY); + } + else + { + /// no shear, but rotate used + double fSin(0.0); + double fCos(1.0); + + createSinCosOrthogonal(fSin, fCos, fRadiant); + + B2DHomMatrix aRetval( + /* Row 0, Column 0 */ fCos, + /* Row 0, Column 1 */ -fSin, + /* Row 0, Column 2 */ fTranslateX, + /* Row 1, Column 0 */ fSin, + /* Row 1, Column 1 */ fCos, + /* Row 1, Column 2 */ fTranslateY); + + return aRetval; + } + } + else + { + /// shear used + if(fTools::equalZero(fRadiant)) + { + /// no rotate, but shear used + B2DHomMatrix aRetval( + /* Row 0, Column 0 */ 1.0, + /* Row 0, Column 1 */ fShearX, + /* Row 0, Column 2 */ fTranslateX, + /* Row 1, Column 0 */ 0.0, + /* Row 1, Column 1 */ 1.0, + /* Row 1, Column 2 */ fTranslateY); + + return aRetval; + } + else + { + /// shear and rotate used + double fSin(0.0); + double fCos(1.0); + + createSinCosOrthogonal(fSin, fCos, fRadiant); + + B2DHomMatrix aRetval( + /* Row 0, Column 0 */ fCos, + /* Row 0, Column 1 */ (fCos * fShearX) - fSin, + /* Row 0, Column 2 */ fTranslateX, + /* Row 1, Column 0 */ fSin, + /* Row 1, Column 1 */ (fSin * fShearX) + fCos, + /* Row 1, Column 2 */ fTranslateY); + + return aRetval; + } + } + } + + B2DHomMatrix createScaleTranslateB2DHomMatrix( + double fScaleX, double fScaleY, + double fTranslateX, double fTranslateY) + { + const double fOne(1.0); + + if(fTools::equal(fScaleX, fOne) && fTools::equal(fScaleY, fOne)) + { + /// no scale, take shortcut + return createTranslateB2DHomMatrix(fTranslateX, fTranslateY); + } + else + { + /// scale used + if(fTools::equalZero(fTranslateX) && fTools::equalZero(fTranslateY)) + { + /// no translate, but scale. + B2DHomMatrix aRetval; + + aRetval.set(0, 0, fScaleX); + aRetval.set(1, 1, fScaleY); + + return aRetval; + } + else + { + /// translate and scale + B2DHomMatrix aRetval( + /* Row 0, Column 0 */ fScaleX, + /* Row 0, Column 1 */ 0.0, + /* Row 0, Column 2 */ fTranslateX, + /* Row 1, Column 0 */ 0.0, + /* Row 1, Column 1 */ fScaleY, + /* Row 1, Column 2 */ fTranslateY); + + return aRetval; + } + } + } + + B2DHomMatrix createRotateAroundPoint( + double fPointX, double fPointY, + double fRadiant) + { + B2DHomMatrix aRetval; + + if(!fTools::equalZero(fRadiant)) + { + double fSin(0.0); + double fCos(1.0); + + createSinCosOrthogonal(fSin, fCos, fRadiant); + + aRetval.set3x2( + /* Row 0, Column 0 */ fCos, + /* Row 0, Column 1 */ -fSin, + /* Row 0, Column 2 */ (fPointX * (1.0 - fCos)) + (fSin * fPointY), + /* Row 1, Column 0 */ fSin, + /* Row 1, Column 1 */ fCos, + /* Row 1, Column 2 */ (fPointY * (1.0 - fCos)) - (fSin * fPointX)); + } + + return aRetval; + } + } // end of namespace tools } // end of namespace basegfx /////////////////////////////////////////////////////////////////////////////// diff --git a/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx index 1a9264ab769e..c22b5ea94011 100644 --- a/basegfx/source/polygon/b2dlinegeometry.cxx +++ b/basegfx/source/polygon/b2dlinegeometry.cxx @@ -40,6 +40,7 @@ #include <basegfx/range/b2drange.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/curve/b2dcubicbezier.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -85,11 +86,9 @@ namespace basegfx // get size of the arrow const B2DRange aArrowSize(getRange(rArrow)); - // build ArrowTransform - B2DHomMatrix aArrowTransform; - - // center in X, align with axis in Y - aArrowTransform.translate(-aArrowSize.getCenter().getX(), -aArrowSize.getMinimum().getY()); + // build ArrowTransform; center in X, align with axis in Y + B2DHomMatrix aArrowTransform(basegfx::tools::createTranslateB2DHomMatrix( + -aArrowSize.getCenter().getX(), -aArrowSize.getMinimum().getY())); // scale to target size const double fArrowScale(fWidth / (aArrowSize.getRange().getX())); diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index 467a4b90f516..48d00ddcec7d 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: b2dpolygon.cxx,v $ - * $Revision: 1.22 $ * * This file is part of OpenOffice.org. * @@ -123,6 +122,16 @@ public: maVector[nIndex].setCoordinate(rValue); } + void reserve(sal_uInt32 nCount) + { + maVector.reserve(nCount); + } + + void append(const CoordinateData2D& rValue) + { + maVector.push_back(rValue); + } + void insert(sal_uInt32 nIndex, const CoordinateData2D& rValue, sal_uInt32 nCount) { if(nCount) @@ -380,6 +389,17 @@ public: } } + void append(const ControlVectorPair2D& rValue) + { + maVector.push_back(rValue); + + if(!rValue.getPrevVector().equalZero()) + mnUsedVectors += 1; + + if(!rValue.getNextVector().equalZero()) + mnUsedVectors += 1; + } + void insert(sal_uInt32 nIndex, const ControlVectorPair2D& rValue, sal_uInt32 nCount) { if(nCount) @@ -741,6 +761,24 @@ public: maPoints.setCoordinate(nIndex, rValue); } + void reserve(sal_uInt32 nCount) + { + maPoints.reserve(nCount); + } + + void append(const basegfx::B2DPoint& rPoint) + { + mpBufferedData.reset(); // TODO: is this needed? + const CoordinateData2D aCoordinate(rPoint); + maPoints.append(aCoordinate); + + if(mpControlVector) + { + const ControlVectorPair2D aVectorPair; + mpControlVector->append(aVectorPair); + } + } + void insert(sal_uInt32 nIndex, const basegfx::B2DPoint& rPoint, sal_uInt32 nCount) { if(nCount) @@ -1190,6 +1228,11 @@ namespace basegfx } } + void B2DPolygon::reserve(sal_uInt32 nCount) + { + mpPolygon->reserve(nCount); + } + void B2DPolygon::insert(sal_uInt32 nIndex, const B2DPoint& rPoint, sal_uInt32 nCount) { OSL_ENSURE(nIndex <= mpPolygon->count(), "B2DPolygon Insert outside range (!)"); @@ -1208,6 +1251,11 @@ namespace basegfx } } + void B2DPolygon::append(const B2DPoint& rPoint) + { + mpPolygon->append(rPoint); + } + B2DPoint B2DPolygon::getPrevControlPoint(sal_uInt32 nIndex) const { OSL_ENSURE(nIndex < mpPolygon->count(), "B2DPolygon access outside range (!)"); diff --git a/basegfx/source/polygon/b2dpolygonclipper.cxx b/basegfx/source/polygon/b2dpolygonclipper.cxx index f0d325942c07..87e44ed3d063 100644 --- a/basegfx/source/polygon/b2dpolygonclipper.cxx +++ b/basegfx/source/polygon/b2dpolygonclipper.cxx @@ -40,6 +40,7 @@ #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/curve/b2dcubicbezier.hxx> #include <basegfx/tools/rectcliptools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -361,11 +362,10 @@ namespace basegfx else if(rCandidate.count()) { const B2DVector aEdge(rPointB - rPointA); - B2DHomMatrix aMatrixTransform; B2DPolygon aCandidate(rCandidate); // translate and rotate polygon so that given edge is on x axis - aMatrixTransform.translate(-rPointA.getX(), -rPointA.getY()); + B2DHomMatrix aMatrixTransform(basegfx::tools::createTranslateB2DHomMatrix(-rPointA.getX(), -rPointA.getY())); aMatrixTransform.rotate(-atan2(aEdge.getY(), aEdge.getX())); aCandidate.transform(aMatrixTransform); @@ -395,11 +395,10 @@ namespace basegfx else if(rCandidate.count()) { const B2DVector aEdge(rPointB - rPointA); - B2DHomMatrix aMatrixTransform; B2DPolyPolygon aCandidate(rCandidate); // translate and rotate polygon so that given edge is on x axis - aMatrixTransform.translate(-rPointA.getX(), -rPointA.getY()); + B2DHomMatrix aMatrixTransform(basegfx::tools::createTranslateB2DHomMatrix(-rPointA.getX(), -rPointA.getY())); aMatrixTransform.rotate(-atan2(aEdge.getY(), aEdge.getX())); aCandidate.transform(aMatrixTransform); diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx index 26016942717d..da6ff8904725 100644 --- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx +++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: b2dpolygoncutandtouch.cxx,v $ - * $Revision: 1.8 $ * * This file is part of OpenOffice.org. * @@ -430,6 +429,7 @@ namespace basegfx // create subdivided polygons and find cuts between them // Keep adaptiveSubdivideByCount due to needed quality + aTempPolygonA.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygonA.append(rCubicA.getStartPoint()); rCubicA.adaptiveSubdivideByCount(aTempPolygonA, SUBDIVIDE_FOR_CUT_TEST_COUNT); aTempPolygonEdge.append(rCurrB); @@ -470,8 +470,10 @@ namespace basegfx // create subdivided polygons and find cuts between them // Keep adaptiveSubdivideByCount due to needed quality + aTempPolygonA.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygonA.append(rCubicA.getStartPoint()); rCubicA.adaptiveSubdivideByCount(aTempPolygonA, SUBDIVIDE_FOR_CUT_TEST_COUNT); + aTempPolygonB.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygonB.append(rCubicB.getStartPoint()); rCubicB.adaptiveSubdivideByCount(aTempPolygonB, SUBDIVIDE_FOR_CUT_TEST_COUNT); @@ -497,6 +499,13 @@ namespace basegfx const B2DCubicBezier& rCubicA, sal_uInt32 nInd, temporaryPointVector& rTempPoints) { + // avoid expensive part of this method if possible + // TODO: use hasAnyExtremum() method instead when it becomes available + double fDummy; + const bool bHasAnyExtremum = rCubicA.getMinimumExtremumPosition( fDummy ); + if( !bHasAnyExtremum ) + return; + // find all self-intersections on the given bezier segment. Add an entry to the tempPoints // for each self intersection point with the cut value describing the relative position on given // bezier segment. @@ -505,6 +514,7 @@ namespace basegfx // create subdivided polygon and find cuts on it // Keep adaptiveSubdivideByCount due to needed quality + aTempPolygon.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygon.append(rCubicA.getStartPoint()); rCubicA.adaptiveSubdivideByCount(aTempPolygon, SUBDIVIDE_FOR_CUT_TEST_COUNT); findCuts(aTempPolygon, aTempPointVector); @@ -557,7 +567,14 @@ namespace basegfx const bool bEdgeBIsCurve(aCubicB.isBezier()); const B2DRange aRangeB(aCubicB.getRange()); - if(aRangeA.overlaps(aRangeB)) + // only overlapping segments need to be tested + // consecutive segments touch of course + bool bOverlap = false; + if( b > a+1) + bOverlap = aRangeA.overlaps(aRangeB); + else + bOverlap = aRangeA.overlapsMore(aRangeB); + if( bOverlap) { if(bEdgeAIsCurve && bEdgeBIsCurve) { @@ -599,7 +616,13 @@ namespace basegfx const B2DPoint aNextB(rCandidate.getB2DPoint(b + 1L == nPointCount ? 0L : b + 1L)); const B2DRange aRangeB(aCurrB, aNextB); - if(aRangeA.overlaps(aRangeB)) + // consecutive segments touch of course + bool bOverlap = false; + if( b > a+1) + bOverlap = aRangeA.overlaps(aRangeB); + else + bOverlap = aRangeA.overlapsMore(aRangeB); + if( bOverlap) { findEdgeCutsTwoEdges(aCurrA, aNextA, aCurrB, aNextB, a, b, rTempPoints, rTempPoints); } @@ -688,6 +711,7 @@ namespace basegfx // create subdivided polygon and find cuts on it // Keep adaptiveSubdivideByCount due to needed quality + aTempPolygon.reserve(SUBDIVIDE_FOR_CUT_TEST_COUNT + 8); aTempPolygon.append(rCubicA.getStartPoint()); rCubicA.adaptiveSubdivideByCount(aTempPolygon, SUBDIVIDE_FOR_CUT_TEST_COUNT); findTouches(aTempPolygon, rPointPolygon, aTempPointVector); @@ -796,7 +820,13 @@ namespace basegfx const bool bEdgeBIsCurve(aCubicB.isBezier()); const B2DRange aRangeB(aCubicB.getRange()); - if(aRangeA.overlaps(aRangeB)) + // consecutive segments touch of course + bool bOverlap = false; + if( b > a+1) + bOverlap = aRangeA.overlaps(aRangeB); + else + bOverlap = aRangeA.overlapsMore(aRangeB); + if( bOverlap) { if(bEdgeAIsCurve && bEdgeBIsCurve) { @@ -838,7 +868,13 @@ namespace basegfx const B2DPoint aNextB(rCandidateB.getB2DPoint(b + 1L == nPointCountB ? 0L : b + 1L)); const B2DRange aRangeB(aCurrB, aNextB); - if(aRangeA.overlaps(aRangeB)) + // consecutive segments touch of course + bool bOverlap = false; + if( b > a+1) + bOverlap = aRangeA.overlaps(aRangeB); + else + bOverlap = aRangeA.overlapsMore(aRangeB); + if( bOverlap) { // test for simple edge-edge cuts findEdgeCutsTwoEdges(aCurrA, aNextA, aCurrB, aNextB, a, b, rTempPointsA, rTempPointsB); diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index c1e5dc80d8c4..d62462b8c097 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: b2dpolygontools.cxx,v $ - * $Revision: 1.29.4.1 $ * * This file is part of OpenOffice.org. * @@ -34,7 +33,6 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #include <osl/diagnose.h> #include <rtl/math.hxx> - #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/range/b2drange.hxx> @@ -44,6 +42,8 @@ #include <basegfx/matrix/b3dhommatrix.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/curve/b2dbeziertools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <osl/mutex.hxx> #include <numeric> #include <limits> @@ -55,6 +55,7 @@ #ifdef DBG_UTIL static double fAngleBoundStartValue = ANGLE_BOUND_START_VALUE; #endif +#define STEPSPERQUARTER (3) ////////////////////////////////////////////////////////////////////////////// @@ -192,6 +193,9 @@ namespace basegfx B2DCubicBezier aBezier; aBezier.setStartPoint(rCandidate.getB2DPoint(0)); + // perf: try to avoid too many realloctions by guessing the result's pointcount + aRetval.reserve(nPointCount*4); + // add start point (always) aRetval.append(aBezier.getStartPoint()); @@ -272,6 +276,9 @@ namespace basegfx B2DCubicBezier aBezier; aBezier.setStartPoint(rCandidate.getB2DPoint(0)); + // perf: try to avoid too many realloctions by guessing the result's pointcount + aRetval.reserve(nPointCount*4); + // add start point (always) aRetval.append(aBezier.getStartPoint()); @@ -342,6 +349,9 @@ namespace basegfx B2DCubicBezier aBezier; aBezier.setStartPoint(rCandidate.getB2DPoint(0)); + // perf: try to avoid too many realloctions by guessing the result's pointcount + aRetval.reserve(nPointCount*4); + // add start point (always) aRetval.append(aBezier.getStartPoint()); @@ -1832,145 +1842,106 @@ namespace basegfx return createPolygonFromEllipse( rCenter, fRadius, fRadius ); } - void appendUnitCircleQuadrant(B2DPolygon& rPolygon, sal_uInt32 nQuadrant) + B2DPolygon impCreateUnitCircle(sal_uInt32 nStartQuadrant) { - const double fZero(0.0); - const double fOne(1.0); + B2DPolygon aUnitCircle; const double fKappa((M_SQRT2 - 1.0) * 4.0 / 3.0); + const double fScaledKappa(fKappa * (1.0 / STEPSPERQUARTER)); + const B2DHomMatrix aRotateMatrix(createRotateB2DHomMatrix(F_PI2 / STEPSPERQUARTER)); + + B2DPoint aPoint(1.0, 0.0); + B2DPoint aForward(1.0, fScaledKappa); + B2DPoint aBackward(1.0, -fScaledKappa); - // create closed unit-circle with 4 segments - switch(nQuadrant) + if(0 != nStartQuadrant) { - case 0 : // first quadrant - { - rPolygon.append(B2DPoint(fOne, fZero)); - rPolygon.appendBezierSegment(B2DPoint(fOne, fKappa), B2DPoint(fKappa, fOne), B2DPoint(fZero, fOne)); - break; - } - case 1 : // second quadrant - { - rPolygon.append(B2DPoint(fZero, fOne)); - rPolygon.appendBezierSegment(B2DPoint(-fKappa, fOne), B2DPoint(-fOne, fKappa), B2DPoint(-fOne, fZero)); - break; - } - case 2 : // third quadrant - { - rPolygon.append(B2DPoint(-fOne, fZero)); - rPolygon.appendBezierSegment(B2DPoint(-fOne, -fKappa), B2DPoint(-fKappa, -fOne), B2DPoint(fZero, -fOne)); - break; - } - default : // last quadrant - { - rPolygon.append(B2DPoint(fZero, -fOne)); - rPolygon.appendBezierSegment(B2DPoint(fKappa, -fOne), B2DPoint(fOne, -fKappa), B2DPoint(fOne, fZero)); - break; - } + const B2DHomMatrix aQuadrantMatrix(createRotateB2DHomMatrix(F_PI2 * (nStartQuadrant % 4))); + aPoint *= aQuadrantMatrix; + aBackward *= aQuadrantMatrix; + aForward *= aQuadrantMatrix; } - } - B2DPolygon createPolygonFromUnitCircle(sal_uInt32 nStartQuadrant) - { - B2DPolygon aRetval; + aUnitCircle.append(aPoint); - // create unit-circle with all 4 segments, close it - appendUnitCircleQuadrant(aRetval, nStartQuadrant % 4); nStartQuadrant++; - appendUnitCircleQuadrant(aRetval, nStartQuadrant % 4); nStartQuadrant++; - appendUnitCircleQuadrant(aRetval, nStartQuadrant % 4); nStartQuadrant++; - appendUnitCircleQuadrant(aRetval, nStartQuadrant % 4); nStartQuadrant++; - aRetval.setClosed(true); + for(sal_uInt32 a(0); a < STEPSPERQUARTER * 4; a++) + { + aPoint *= aRotateMatrix; + aBackward *= aRotateMatrix; + aUnitCircle.appendBezierSegment(aForward, aBackward, aPoint); + aForward *= aRotateMatrix; + } - // remove double points between segments created by segmented creation - aRetval.removeDoublePoints(); + aUnitCircle.setClosed(true); + aUnitCircle.removeDoublePoints(); - return aRetval; + return aUnitCircle; } - B2DPolygon createPolygonFromEllipse( const B2DPoint& rCenter, double fRadiusX, double fRadiusY ) + B2DPolygon createPolygonFromUnitCircle(sal_uInt32 nStartQuadrant) { - const double fOne(1.0); - B2DPolygon aRetval(createPolygonFromUnitCircle()); - - // transformation necessary? - const sal_Bool bScale(!fTools::equal(fRadiusX, fOne) || !fTools::equal(fRadiusY, fOne)); - const sal_Bool bTranslate(!rCenter.equalZero()); - - if(bScale || bTranslate) + switch(nStartQuadrant % 4) { - B2DHomMatrix aMatrix; - - if(bScale) + case 1 : { - aMatrix.scale(fRadiusX, fRadiusY); - } - - if(bTranslate) - { - aMatrix.translate(rCenter.getX(), rCenter.getY()); - } + static B2DPolygon aUnitCircleStartQuadrantOne; - aRetval.transform(aMatrix); - } - - return aRetval; - } - - void appendUnitCircleQuadrantSegment(B2DPolygon& rPolygon, sal_uInt32 nQuadrant, double fStart, double fEnd) - { - OSL_ENSURE(fStart >= 0.0 && fStart <= 1.0, "appendUnitCircleQuadrantSegment: Access out of range (!)"); - OSL_ENSURE(fEnd >= 0.0 && fEnd <= 1.0, "appendUnitCircleQuadrantSegment: Access out of range (!)"); - OSL_ENSURE(fEnd >= fStart, "appendUnitCircleQuadrantSegment: Access out of range (!)"); - const double fOne(1.0); - const bool bStartIsZero(fTools::equalZero(fStart)); - const bool bEndIsOne(fTools::equal(fEnd, fOne)); - - if(bStartIsZero && bEndIsOne) - { - // add completely - appendUnitCircleQuadrant(rPolygon, nQuadrant); - } - else - { - // split and add - B2DPolygon aQuadrant; - appendUnitCircleQuadrant(aQuadrant, nQuadrant); - const bool bStartEndEqual(fTools::equal(fStart, fEnd)); + if(!aUnitCircleStartQuadrantOne.count()) + { + ::osl::Mutex m_mutex; + aUnitCircleStartQuadrantOne = impCreateUnitCircle(1); + } - if(bStartEndEqual) + return aUnitCircleStartQuadrantOne; + } + case 2 : { - if(bStartIsZero) + static B2DPolygon aUnitCircleStartQuadrantTwo; + + if(!aUnitCircleStartQuadrantTwo.count()) { - // both zero, add start point - rPolygon.append(aQuadrant.getB2DPoint(0L)); + ::osl::Mutex m_mutex; + aUnitCircleStartQuadrantTwo = impCreateUnitCircle(2); } - else if(bEndIsOne) + + return aUnitCircleStartQuadrantTwo; + } + case 3 : + { + static B2DPolygon aUnitCircleStartQuadrantThree; + + if(!aUnitCircleStartQuadrantThree.count()) { - // both one, add end point - rPolygon.append(aQuadrant.getB2DPoint(1L)); + ::osl::Mutex m_mutex; + aUnitCircleStartQuadrantThree = impCreateUnitCircle(3); } - else - { - // both equal but not zero, add split point - B2DCubicBezier aCubicBezier( - aQuadrant.getB2DPoint(0L), aQuadrant.getNextControlPoint(0L), - aQuadrant.getPrevControlPoint(1L), aQuadrant.getB2DPoint(1L)); - aCubicBezier.split(fStart, &aCubicBezier, 0); - rPolygon.append(aCubicBezier.getEndPoint()); - } + return aUnitCircleStartQuadrantThree; } - else + default : // case 0 : { - B2DCubicBezier aCubicBezier( - aQuadrant.getB2DPoint(0L), aQuadrant.getNextControlPoint(0L), - aQuadrant.getPrevControlPoint(1L), aQuadrant.getB2DPoint(1L)); + static B2DPolygon aUnitCircleStartQuadrantZero; + + if(!aUnitCircleStartQuadrantZero.count()) + { + ::osl::Mutex m_mutex; + aUnitCircleStartQuadrantZero = impCreateUnitCircle(0); + } - aCubicBezier = aCubicBezier.snippet(fStart, fEnd); - rPolygon.append(aCubicBezier.getStartPoint()); - rPolygon.appendBezierSegment(aCubicBezier.getControlPointA(), aCubicBezier.getControlPointB(), aCubicBezier.getEndPoint()); + return aUnitCircleStartQuadrantZero; } } } + B2DPolygon createPolygonFromEllipse( const B2DPoint& rCenter, double fRadiusX, double fRadiusY ) + { + B2DPolygon aRetval(createPolygonFromUnitCircle()); + const B2DHomMatrix aMatrix(createScaleTranslateB2DHomMatrix(fRadiusX, fRadiusY, rCenter.getX(), rCenter.getY())); + + aRetval.transform(aMatrix); + + return aRetval; + } + B2DPolygon createPolygonFromUnitEllipseSegment( double fStart, double fEnd ) { B2DPolygon aRetval; @@ -1997,49 +1968,74 @@ namespace basegfx fEnd = 0.0; } - const sal_uInt32 nQuadrantStart(sal_uInt32(fStart / F_PI2) % 4L); - const sal_uInt32 nQuadrantEnd(sal_uInt32(fEnd / F_PI2) % 4L); - sal_uInt32 nCurrentQuadrant(nQuadrantStart); - bool bStartDone(false); - bool bEndDone(false); - - do + if(fTools::equal(fStart, fEnd)) { - if(!bStartDone && nQuadrantStart == nCurrentQuadrant) - { - if(nQuadrantStart == nQuadrantEnd && fTools::moreOrEqual(fEnd, fStart)) - { - // both in one quadrant and defining the complete segment, create start to end - double fSplitOffsetStart((fStart - (nCurrentQuadrant * F_PI2)) / F_PI2); - double fSplitOffsetEnd((fEnd - (nCurrentQuadrant * F_PI2)) / F_PI2); - appendUnitCircleQuadrantSegment(aRetval, nCurrentQuadrant, fSplitOffsetStart, fSplitOffsetEnd); - bStartDone = bEndDone = true; - } - else - { - // create start to quadrant end - const double fSplitOffsetStart((fStart - (nCurrentQuadrant * F_PI2)) / F_PI2); - appendUnitCircleQuadrantSegment(aRetval, nCurrentQuadrant, fSplitOffsetStart, 1.0); - bStartDone = true; - } - } - else if(!bEndDone && nQuadrantEnd == nCurrentQuadrant) + // same start and end angle, add single point + aRetval.append(B2DPoint(cos(fStart), sin(fStart))); + } + else + { + const sal_uInt32 nSegments(STEPSPERQUARTER * 4); + const double fAnglePerSegment(F_PI2 / STEPSPERQUARTER); + const sal_uInt32 nStartSegment(sal_uInt32(fStart / fAnglePerSegment) % nSegments); + const sal_uInt32 nEndSegment(sal_uInt32(fEnd / fAnglePerSegment) % nSegments); + const double fKappa((M_SQRT2 - 1.0) * 4.0 / 3.0); + const double fScaledKappa(fKappa * (1.0 / STEPSPERQUARTER)); + + B2DPoint aSegStart(cos(fStart), sin(fStart)); + aRetval.append(aSegStart); + + if(nStartSegment == nEndSegment && fTools::more(fEnd, fStart)) { - // create quadrant start to end - const double fSplitOffsetEnd((fEnd - (nCurrentQuadrant * F_PI2)) / F_PI2); - appendUnitCircleQuadrantSegment(aRetval, nCurrentQuadrant, 0.0, fSplitOffsetEnd); - bEndDone = true; + // start and end in one sector and in the right order, create in one segment + const B2DPoint aSegEnd(cos(fEnd), sin(fEnd)); + const double fFactor(fScaledKappa * ((fEnd - fStart) / fAnglePerSegment)); + + aRetval.appendBezierSegment( + aSegStart + (B2DPoint(-aSegStart.getY(), aSegStart.getX()) * fFactor), + aSegEnd - (B2DPoint(-aSegEnd.getY(), aSegEnd.getX()) * fFactor), + aSegEnd); } else { - // add quadrant completely - appendUnitCircleQuadrant(aRetval, nCurrentQuadrant); - } + double fSegEndRad((nStartSegment + 1) * fAnglePerSegment); + double fFactor(fScaledKappa * ((fSegEndRad - fStart) / fAnglePerSegment)); + B2DPoint aSegEnd(cos(fSegEndRad), sin(fSegEndRad)); + + aRetval.appendBezierSegment( + aSegStart + (B2DPoint(-aSegStart.getY(), aSegStart.getX()) * fFactor), + aSegEnd - (B2DPoint(-aSegEnd.getY(), aSegEnd.getX()) * fFactor), + aSegEnd); + + sal_uInt32 nSegment((nStartSegment + 1) % nSegments); + aSegStart = aSegEnd; + + while(nSegment != nEndSegment) + { + // No end in this sector, add full sector. + fSegEndRad = (nSegment + 1) * fAnglePerSegment; + aSegEnd = B2DPoint(cos(fSegEndRad), sin(fSegEndRad)); + + aRetval.appendBezierSegment( + aSegStart + (B2DPoint(-aSegStart.getY(), aSegStart.getX()) * fScaledKappa), + aSegEnd - (B2DPoint(-aSegEnd.getY(), aSegEnd.getX()) * fScaledKappa), + aSegEnd); + + nSegment = (nSegment + 1) % nSegments; + aSegStart = aSegEnd; + } - // next step - nCurrentQuadrant = (nCurrentQuadrant + 1L) % 4L; + // End in this sector + const double fSegStartRad(nSegment * fAnglePerSegment); + fFactor = fScaledKappa * ((fEnd - fSegStartRad) / fAnglePerSegment); + aSegEnd = B2DPoint(cos(fEnd), sin(fEnd)); + + aRetval.appendBezierSegment( + aSegStart + (B2DPoint(-aSegStart.getY(), aSegStart.getX()) * fFactor), + aSegEnd - (B2DPoint(-aSegEnd.getY(), aSegEnd.getX()) * fFactor), + aSegEnd); + } } - while(!(bStartDone && bEndDone)); // remove double points between segments created by segmented creation aRetval.removeDoublePoints(); @@ -2050,28 +2046,9 @@ namespace basegfx B2DPolygon createPolygonFromEllipseSegment( const B2DPoint& rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd ) { B2DPolygon aRetval(createPolygonFromUnitEllipseSegment(fStart, fEnd)); + const B2DHomMatrix aMatrix(createScaleTranslateB2DHomMatrix(fRadiusX, fRadiusY, rCenter.getX(), rCenter.getY())); - // transformation necessary? - const double fOne(1.0); - const sal_Bool bScale(!fTools::equal(fRadiusX, fOne) || !fTools::equal(fRadiusY, fOne)); - const sal_Bool bTranslate(!rCenter.equalZero()); - - if(bScale || bTranslate) - { - B2DHomMatrix aMatrix; - - if(bScale) - { - aMatrix.scale(fRadiusX, fRadiusY); - } - - if(bTranslate) - { - aMatrix.translate(rCenter.getX(), rCenter.getY()); - } - - aRetval.transform(aMatrix); - } + aRetval.transform(aMatrix); return aRetval; } @@ -2701,11 +2678,7 @@ namespace basegfx if(nPointCount) { - B2DHomMatrix aMatrix; - - aMatrix.translate(-rCenter.getX(), -rCenter.getY()); - aMatrix.rotate(fAngle); - aMatrix.translate(rCenter.getX(), rCenter.getY()); + const B2DHomMatrix aMatrix(basegfx::tools::createRotateAroundPoint(rCenter, fAngle)); aRetval.transform(aMatrix); } @@ -3269,6 +3242,9 @@ namespace basegfx B2DCubicBezier aBezier; aBezier.setStartPoint(rCandidate.getB2DPoint(0)); + // try to avoid costly reallocations + aRetval.reserve( nEdgeCount+1); + // add start point aRetval.append(aBezier.getStartPoint()); diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx index 2247c237d90f..e38ec3809fb1 100644 --- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx +++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx @@ -36,6 +36,7 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <rtl/ustring.hxx> #include <rtl/math.hxx> @@ -705,7 +706,7 @@ namespace basegfx // |y1'| = |-sin phi cos phi| |(y1 - y2)/2| const B2DPoint p1(nLastX, nLastY); const B2DPoint p2(nX, nY); - B2DHomMatrix aTransform; aTransform.rotate(-fPhi*M_PI/180); + B2DHomMatrix aTransform(basegfx::tools::createRotateB2DHomMatrix(-fPhi*M_PI/180)); const B2DPoint p1_prime( aTransform * B2DPoint(((p1-p2)/2.0)) ); @@ -797,8 +798,7 @@ namespace basegfx fTheta1, fTheta2 )); // transform ellipse by rotation & move to final center - aTransform.identity(); - aTransform.scale(fRX,fRY); + aTransform = basegfx::tools::createScaleB2DHomMatrix(fRX, fRY); aTransform.translate(aCenter_prime.getX(), aCenter_prime.getY()); aTransform.rotate(fPhi*M_PI/180); diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx index ea303886dd88..52e0f0fcc36f 100644 --- a/basegfx/source/polygon/b3dpolygontools.cxx +++ b/basegfx/source/polygon/b3dpolygontools.cxx @@ -875,52 +875,147 @@ namespace basegfx } else { + bool bRetval(false); const B3DVector aPlaneNormal(rCandidate.getNormal()); if(!aPlaneNormal.equalZero()) { - const double fAbsX(fabs(aPlaneNormal.getX())); - const double fAbsY(fabs(aPlaneNormal.getY())); - const double fAbsZ(fabs(aPlaneNormal.getZ())); + const sal_uInt32 nPointCount(rCandidate.count()); - if(fAbsX > fAbsY && fAbsX > fAbsZ) + if(nPointCount) { - // normal points mostly in X-Direction, use YZ-Polygon projection for check - B3DHomMatrix aTrans; + B3DPoint aCurrentPoint(rCandidate.getB3DPoint(nPointCount - 1)); + const double fAbsX(fabs(aPlaneNormal.getX())); + const double fAbsY(fabs(aPlaneNormal.getY())); + const double fAbsZ(fabs(aPlaneNormal.getZ())); - aTrans.set(0, 0, 0.0); - aTrans.set(0, 1, 1.0); - aTrans.set(1, 1, 0.0); - aTrans.set(1, 2, 1.0); - - const B2DPolygon aYZ(createB2DPolygonFromB3DPolygon(rCandidate, aTrans)); - - return isInside(aYZ, B2DPoint(rPoint.getY(), rPoint.getZ()), bWithBorder); - } - else if(fAbsY > fAbsX && fAbsY > fAbsZ) - { - // normal points mostly in Y-Direction, use XZ-Polygon projection for check - B3DHomMatrix aTrans; - - aTrans.set(1, 1, 0.0); - aTrans.set(1, 2, 1.0); - - const B2DPolygon aXZ(createB2DPolygonFromB3DPolygon(rCandidate, aTrans)); - - return isInside(aXZ, B2DPoint(rPoint.getX(), rPoint.getZ()), bWithBorder); - } - else - { - // normal points mostly in Z-Direction, use XY-Polygon projection for check - B3DHomMatrix aTrans; - - const B2DPolygon aXY(createB2DPolygonFromB3DPolygon(rCandidate, aTrans)); - - return isInside(aXY, B2DPoint(rPoint.getX(), rPoint.getY()), bWithBorder); + if(fAbsX > fAbsY && fAbsX > fAbsZ) + { + // normal points mostly in X-Direction, use YZ-Polygon projection for check + // x -> y, y -> z + for(sal_uInt32 a(0); a < nPointCount; a++) + { + const B3DPoint aPreviousPoint(aCurrentPoint); + aCurrentPoint = rCandidate.getB3DPoint(a); + + // cross-over in Z? + const bool bCompZA(fTools::more(aPreviousPoint.getZ(), rPoint.getZ())); + const bool bCompZB(fTools::more(aCurrentPoint.getZ(), rPoint.getZ())); + + if(bCompZA != bCompZB) + { + // cross-over in Y? + const bool bCompYA(fTools::more(aPreviousPoint.getY(), rPoint.getY())); + const bool bCompYB(fTools::more(aCurrentPoint.getY(), rPoint.getY())); + + if(bCompYA == bCompYB) + { + if(bCompYA) + { + bRetval = !bRetval; + } + } + else + { + const double fCompare( + aCurrentPoint.getY() - (aCurrentPoint.getZ() - rPoint.getZ()) * + (aPreviousPoint.getY() - aCurrentPoint.getY()) / + (aPreviousPoint.getZ() - aCurrentPoint.getZ())); + + if(fTools::more(fCompare, rPoint.getY())) + { + bRetval = !bRetval; + } + } + } + } + } + else if(fAbsY > fAbsX && fAbsY > fAbsZ) + { + // normal points mostly in Y-Direction, use XZ-Polygon projection for check + // x -> x, y -> z + for(sal_uInt32 a(0); a < nPointCount; a++) + { + const B3DPoint aPreviousPoint(aCurrentPoint); + aCurrentPoint = rCandidate.getB3DPoint(a); + + // cross-over in Z? + const bool bCompZA(fTools::more(aPreviousPoint.getZ(), rPoint.getZ())); + const bool bCompZB(fTools::more(aCurrentPoint.getZ(), rPoint.getZ())); + + if(bCompZA != bCompZB) + { + // cross-over in X? + const bool bCompXA(fTools::more(aPreviousPoint.getX(), rPoint.getX())); + const bool bCompXB(fTools::more(aCurrentPoint.getX(), rPoint.getX())); + + if(bCompXA == bCompXB) + { + if(bCompXA) + { + bRetval = !bRetval; + } + } + else + { + const double fCompare( + aCurrentPoint.getX() - (aCurrentPoint.getZ() - rPoint.getZ()) * + (aPreviousPoint.getX() - aCurrentPoint.getX()) / + (aPreviousPoint.getZ() - aCurrentPoint.getZ())); + + if(fTools::more(fCompare, rPoint.getX())) + { + bRetval = !bRetval; + } + } + } + } + } + else + { + // normal points mostly in Z-Direction, use XY-Polygon projection for check + // x -> x, y -> y + for(sal_uInt32 a(0); a < nPointCount; a++) + { + const B3DPoint aPreviousPoint(aCurrentPoint); + aCurrentPoint = rCandidate.getB3DPoint(a); + + // cross-over in Y? + const bool bCompYA(fTools::more(aPreviousPoint.getY(), rPoint.getY())); + const bool bCompYB(fTools::more(aCurrentPoint.getY(), rPoint.getY())); + + if(bCompYA != bCompYB) + { + // cross-over in X? + const bool bCompXA(fTools::more(aPreviousPoint.getX(), rPoint.getX())); + const bool bCompXB(fTools::more(aCurrentPoint.getX(), rPoint.getX())); + + if(bCompXA == bCompXB) + { + if(bCompXA) + { + bRetval = !bRetval; + } + } + else + { + const double fCompare( + aCurrentPoint.getX() - (aCurrentPoint.getY() - rPoint.getY()) * + (aPreviousPoint.getX() - aCurrentPoint.getX()) / + (aPreviousPoint.getY() - aCurrentPoint.getY())); + + if(fTools::more(fCompare, rPoint.getX())) + { + bRetval = !bRetval; + } + } + } + } + } } } - return false; + return bRetval; } } diff --git a/basegfx/source/tools/gradienttools.cxx b/basegfx/source/tools/gradienttools.cxx index 9e78039cd590..51989899ebf4 100644 --- a/basegfx/source/tools/gradienttools.cxx +++ b/basegfx/source/tools/gradienttools.cxx @@ -32,9 +32,9 @@ #include "precompiled_basegfx.hxx" #include <basegfx/tools/gradienttools.hxx> - #include <basegfx/point/b2dpoint.hxx> #include <basegfx/range/b2drange.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> namespace basegfx { @@ -79,9 +79,8 @@ namespace basegfx 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()); + o_rGradientInfo.maTextureTransform = basegfx::tools::createRotateAroundPoint(aCenter, fAngle) + * o_rGradientInfo.maTextureTransform; } // add object translate @@ -158,9 +157,8 @@ namespace basegfx 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()); + o_rGradientInfo.maTextureTransform = basegfx::tools::createRotateAroundPoint(aCenter, fAngle) + * o_rGradientInfo.maTextureTransform; } } @@ -232,9 +230,8 @@ namespace basegfx 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()); + o_rGradientInfo.maTextureTransform = basegfx::tools::createRotateAroundPoint(aCenter, fAngle) + * o_rGradientInfo.maTextureTransform; } // add defined offsets after rotation diff --git a/basegfx/source/tools/unopolypolygon.cxx b/basegfx/source/tools/unopolypolygon.cxx index 6d8fcd83edb0..05dbe5b1c823 100755 --- a/basegfx/source/tools/unopolypolygon.cxx +++ b/basegfx/source/tools/unopolypolygon.cxx @@ -44,8 +44,8 @@ #include <basegfx/tools/canvastools.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> - #include <basegfx/tools/unopolypolygon.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> using namespace ::com::sun::star; @@ -138,9 +138,7 @@ namespace unotools if( !aOffset.equalZero() ) { - B2DHomMatrix aTranslate; - aTranslate.translate( aOffset.getX(), aOffset.getY() ); - + const B2DHomMatrix aTranslate(tools::createTranslateB2DHomMatrix(aOffset)); aSrcPoly.transform( aTranslate ); } diff --git a/basegfx/test/basegfx1d.cxx b/basegfx/test/basegfx1d.cxx index f058b0034fa7..454ed23289b2 100644 --- a/basegfx/test/basegfx1d.cxx +++ b/basegfx/test/basegfx1d.cxx @@ -33,7 +33,7 @@ #include "precompiled_basegfx.hxx" // autogenerated file with codegen.pl -#include <cppunit/simpleheader.hxx> +#include <testshl/simpleheader.hxx> namespace basegfx1d { diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx index 4f0305df953f..1bd15702e143 100644 --- a/basegfx/test/basegfx2d.cxx +++ b/basegfx/test/basegfx2d.cxx @@ -33,7 +33,7 @@ #include "precompiled_basegfx.hxx" // autogenerated file with codegen.pl -#include <cppunit/simpleheader.hxx> +#include <testshl/simpleheader.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/polygon/b2dpolygon.hxx> @@ -484,8 +484,13 @@ public: } while ( nIndex >= 0 ); + // Adapted number of spaces to 50 and 67 because of the new circle construction + // methods which produce more points and thus more spaces, too. Use both since + // depending on float precision and the getContinuity() implemetation using + // fTools::equal, linux and mac produce more 'C' than 'S' statements, while WIN32 + // uses more 'S' statements (as it should be for circles) CPPUNIT_ASSERT_MESSAGE("exporting to circle does not produce the expected number of coordinates", - nCount==18); + nCount==67 || nCount==50); const B2DPolygon aRect( tools::createPolygonFromRect( B2DRange(0.0,0.0,4000.0,4000.0) )); diff --git a/basegfx/test/basegfx3d.cxx b/basegfx/test/basegfx3d.cxx index fc59ffbced4e..f0fe463ce23d 100644 --- a/basegfx/test/basegfx3d.cxx +++ b/basegfx/test/basegfx3d.cxx @@ -33,7 +33,7 @@ #include "precompiled_basegfx.hxx" // autogenerated file with codegen.pl -#include <cppunit/simpleheader.hxx> +#include <testshl/simpleheader.hxx> namespace basegfx3d { diff --git a/basegfx/test/makefile.mk b/basegfx/test/makefile.mk index 1bd4d59b98d5..da61c60f9308 100644 --- a/basegfx/test/makefile.mk +++ b/basegfx/test/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # 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 @@ -46,7 +46,7 @@ SHL1OBJS= \ $(SLO)$/basegfx1d.obj \ $(SLO)$/basegfx2d.obj \ $(SLO)$/basegfx3d.obj \ - $(SLO)$/testtools.obj + $(SLO)$/testtools.obj # linking statically against basegfx parts SHL1LIBS=\ @@ -66,23 +66,24 @@ SHL1STDLIBS= \ $(SALLIB) \ $(CPPUHELPERLIB) \ $(CPPULIB) \ + $(TESTSHL2LIB) \ $(CPPUNITLIB) SHL1IMPLIB= i$(SHL1TARGET) DEF1NAME =$(SHL1TARGET) -SHL1VERSIONMAP = export.map +SHL1VERSIONMAP = export.map # END ------------------------------------------------------------------ #------------------------------- All object files ------------------------------- # do this here, so we get right dependencies -SLOFILES=$(SHL1OBJS) +SLOFILES=$(SHL1OBJS) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk -.INCLUDE : _cppunit.mk +.INCLUDE : _cppunit.mk # --- Enable testshl2 execution in normal build ------------------------ diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx index 9cf2dd978759..7a5e81a5512a 100644 --- a/canvas/source/cairo/cairo_canvashelper.cxx +++ b/canvas/source/cairo/cairo_canvashelper.cxx @@ -958,6 +958,7 @@ namespace cairocanvas void CanvasHelper::doPolyPolygonPath( const uno::Reference< rendering::XPolyPolygon2D >& xPolyPolygon, Operation aOperation, + bool bNoLineJoin, const uno::Sequence< rendering::Texture >* pTextures, Cairo* pCairo ) const { @@ -967,10 +968,47 @@ namespace cairocanvas if( !pCairo ) pCairo = mpCairo.get(); - doPolyPolygonImplementation( rPolyPoly, aOperation, - pCairo, pTextures, - mpSurfaceProvider, - xPolyPolygon->getFillRule() ); + if(bNoLineJoin && Stroke == aOperation) + { + // emulate rendering::PathJoinType::NONE by painting single edges + for(sal_uInt32 a(0); a < rPolyPoly.count(); a++) + { + const basegfx::B2DPolygon aCandidate(rPolyPoly.getB2DPolygon(a)); + const sal_uInt32 nPointCount(aCandidate.count()); + + if(nPointCount) + { + const sal_uInt32 nEdgeCount(aCandidate.isClosed() ? nPointCount + 1: nPointCount); + basegfx::B2DPolygon aEdge; + aEdge.append(aCandidate.getB2DPoint(0)); + aEdge.append(basegfx::B2DPoint(0.0, 0.0)); + + for(sal_uInt32 a(0); a < nEdgeCount; a++) + { + const sal_uInt32 nNextIndex((a + 1) % nPointCount); + aEdge.setB2DPoint(1, aCandidate.getB2DPoint(nNextIndex)); + aEdge.setNextControlPoint(0, aCandidate.getNextControlPoint(a)); + aEdge.setPrevControlPoint(1, aCandidate.getPrevControlPoint(nNextIndex)); + + doPolyPolygonImplementation( basegfx::B2DPolyPolygon(aEdge), + aOperation, + pCairo, pTextures, + mpSurfaceProvider, + xPolyPolygon->getFillRule() ); + + // prepare next step + aEdge.setB2DPoint(0, aEdge.getB2DPoint(1)); + } + } + } + } + else + { + doPolyPolygonImplementation( rPolyPoly, aOperation, + pCairo, pTextures, + mpSurfaceProvider, + xPolyPolygon->getFillRule() ); + } } uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawPolyPolygon( const rendering::XCanvas* , @@ -1039,9 +1077,12 @@ namespace cairocanvas break; } + bool bNoLineJoin(false); + switch( strokeAttributes.JoinType ) { // cairo doesn't have join type NONE so we use MITER as it's pretty close case rendering::PathJoinType::NONE: + bNoLineJoin = true; case rendering::PathJoinType::MITER: cairo_set_line_join( mpCairo.get(), CAIRO_LINE_JOIN_MITER ); break; @@ -1063,7 +1104,7 @@ namespace cairocanvas // TODO(rodo) use LineArray of strokeAttributes - doPolyPolygonPath( xPolyPolygon, Stroke ); + doPolyPolygonPath( xPolyPolygon, Stroke, bNoLineJoin ); cairo_restore( mpCairo.get() ); } else @@ -1147,7 +1188,7 @@ namespace cairocanvas cairo_save( mpCairo.get() ); useStates( viewState, renderState, true ); - doPolyPolygonPath( xPolyPolygon, Fill, &textures ); + doPolyPolygonPath( xPolyPolygon, Fill, false, &textures ); cairo_restore( mpCairo.get() ); } diff --git a/canvas/source/cairo/cairo_canvashelper.hxx b/canvas/source/cairo/cairo_canvashelper.hxx index 1e69a9f41e5b..90d365d63b3c 100644 --- a/canvas/source/cairo/cairo_canvashelper.hxx +++ b/canvas/source/cairo/cairo_canvashelper.hxx @@ -276,6 +276,7 @@ namespace cairocanvas void doPolyPolygonPath( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, Operation aOperation, + bool bNoLineJoin = false, const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >* pTextures=NULL, ::cairo::Cairo* pCairo=NULL ) const; diff --git a/canvas/source/directx/dx_canvashelper.cxx b/canvas/source/directx/dx_canvashelper.cxx index 0642b6c50efb..607f7c076e21 100755 --- a/canvas/source/directx/dx_canvashelper.cxx +++ b/canvas/source/directx/dx_canvashelper.cxx @@ -46,6 +46,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/tools/canvastools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <comphelper/sequence.hxx> #include <canvas/canvastools.hxx> @@ -367,7 +368,11 @@ namespace dxcanvas pGraphics->GetPixelOffsetMode() ); pGraphics->SetPixelOffsetMode( Gdiplus::PixelOffsetModeNone ); - aPen.SetMiterLimit( static_cast< Gdiplus::REAL >(strokeAttributes.MiterLimit) ); + const bool bIsMiter(rendering::PathJoinType::MITER == strokeAttributes.JoinType); + const bool bIsNone(rendering::PathJoinType::NONE == strokeAttributes.JoinType); + + if(bIsMiter) + aPen.SetMiterLimit( static_cast< Gdiplus::REAL >(strokeAttributes.MiterLimit) ); const ::std::vector< Gdiplus::REAL >& rDashArray( ::comphelper::sequenceToContainer< ::std::vector< Gdiplus::REAL > >( @@ -380,9 +385,10 @@ namespace dxcanvas aPen.SetLineCap( gdiCapFromCap(strokeAttributes.StartCapType), gdiCapFromCap(strokeAttributes.EndCapType), Gdiplus::DashCapFlat ); - aPen.SetLineJoin( gdiJoinFromJoin(strokeAttributes.JoinType) ); + if(!bIsNone) + aPen.SetLineJoin( gdiJoinFromJoin(strokeAttributes.JoinType) ); - GraphicsPathSharedPtr pPath( tools::graphicsPathFromXPolyPolygon2D( xPolyPolygon ) ); + GraphicsPathSharedPtr pPath( tools::graphicsPathFromXPolyPolygon2D( xPolyPolygon, bIsNone ) ); // TODO(E1): Return value Gdiplus::Status hr = pGraphics->DrawPath( &aPen, pPath.get() ); @@ -733,10 +739,8 @@ namespace dxcanvas // add output offset if( !maOutputOffset.equalZero() ) { - ::basegfx::B2DHomMatrix aOutputOffset; - aOutputOffset.translate( maOutputOffset.getX(), - maOutputOffset.getY() ); - + const basegfx::B2DHomMatrix aOutputOffset(basegfx::tools::createTranslateB2DHomMatrix( + maOutputOffset.getX(), maOutputOffset.getY())); aTransform = aOutputOffset * aTransform; } @@ -774,10 +778,8 @@ namespace dxcanvas // add output offset if( !maOutputOffset.equalZero() ) { - ::basegfx::B2DHomMatrix aOutputOffset; - aOutputOffset.translate( maOutputOffset.getX(), - maOutputOffset.getY() ); - + const basegfx::B2DHomMatrix aOutputOffset(basegfx::tools::createTranslateB2DHomMatrix( + maOutputOffset.getX(), maOutputOffset.getY())); aTransform = aOutputOffset * aTransform; } diff --git a/canvas/source/directx/dx_canvashelper_texturefill.cxx b/canvas/source/directx/dx_canvashelper_texturefill.cxx index f291d197c4de..73a2d49bfb62 100755 --- a/canvas/source/directx/dx_canvashelper_texturefill.cxx +++ b/canvas/source/directx/dx_canvashelper_texturefill.cxx @@ -43,6 +43,7 @@ #include <basegfx/numeric/ftools.hxx> #include <basegfx/tools/tools.hxx> #include <basegfx/tools/canvastools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <canvas/parametricpolypolygon.hxx> @@ -452,8 +453,7 @@ namespace dxcanvas aFillBrush.SetColor( aFillColor ); const double nCurrScale( (nStepCount-i)/(double)nStepCount ); - aScaleMatrix.identity(); - aScaleMatrix.translate( -0.5, -0.5 ); + aScaleMatrix = basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5); // handle anisotrophic polygon scaling if( rValues.mnAspectRatio < 1.0 ) diff --git a/canvas/source/directx/dx_config.cxx b/canvas/source/directx/dx_config.cxx index 48f44e3ba816..e124d4d78e6a 100755 --- a/canvas/source/directx/dx_config.cxx +++ b/canvas/source/directx/dx_config.cxx @@ -144,6 +144,9 @@ namespace dxcanvas } } + void DXCanvasItem::Notify( const com::sun::star::uno::Sequence<rtl::OUString>& ) {} + void DXCanvasItem::Commit() {} + bool DXCanvasItem::isDeviceUsable( const DeviceInfo& rDeviceInfo ) const { return maValues.find(rDeviceInfo) == maValues.end(); diff --git a/canvas/source/directx/dx_config.hxx b/canvas/source/directx/dx_config.hxx index 34deddb509a7..1fffcb2ed56e 100644 --- a/canvas/source/directx/dx_config.hxx +++ b/canvas/source/directx/dx_config.hxx @@ -77,6 +77,8 @@ namespace dxcanvas bool isBlacklistCurrentDevice() const; void blacklistDevice( const DeviceInfo& rDeviceInfo ); void adaptMaxTextureSize( basegfx::B2IVector& io_maxTextureSize ) const; + virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames); + virtual void Commit(); private: typedef std::set< DeviceInfo > ValueSet; diff --git a/canvas/source/directx/dx_impltools.cxx b/canvas/source/directx/dx_impltools.cxx index 40164c9a1d87..4f5b92d6bcb5 100755 --- a/canvas/source/directx/dx_impltools.cxx +++ b/canvas/source/directx/dx_impltools.cxx @@ -194,7 +194,8 @@ namespace dxcanvas void graphicsPathFromB2DPolygon( GraphicsPathSharedPtr& rOutput, ::std::vector< Gdiplus::PointF >& rPoints, - const ::basegfx::B2DPolygon& rPoly ) + const ::basegfx::B2DPolygon& rPoly, + bool bNoLineJoin) { const sal_uInt32 nPoints( rPoly.count() ); @@ -241,7 +242,18 @@ namespace dxcanvas rPoints[nCurrOutput++] = Gdiplus::PointF( static_cast<Gdiplus::REAL>(rPoint.getX()), static_cast<Gdiplus::REAL>(rPoint.getY()) ); - rOutput->AddBeziers( &rPoints[0], nCurrOutput ); + if(bNoLineJoin && nCurrOutput > 7) + { + for(sal_uInt32 a(3); a < nCurrOutput; a+=3) + { + rOutput->StartFigure(); + rOutput->AddBezier(rPoints[a - 3], rPoints[a - 2], rPoints[a - 1], rPoints[a]); + } + } + else + { + rOutput->AddBeziers( &rPoints[0], nCurrOutput ); + } } else { @@ -251,7 +263,20 @@ namespace dxcanvas // Therefore, simply don't pass the last two // points here. if( nCurrOutput > 3 ) - rOutput->AddBeziers( &rPoints[0], nCurrOutput-2 ); + { + if(bNoLineJoin && nCurrOutput > 7) + { + for(sal_uInt32 a(3); a < nCurrOutput; a+=3) + { + rOutput->StartFigure(); + rOutput->AddBezier(rPoints[a - 3], rPoints[a - 2], rPoints[a - 1], rPoints[a]); + } + } + else + { + rOutput->AddBeziers( &rPoints[0], nCurrOutput-2 ); + } + } } } else @@ -267,10 +292,27 @@ namespace dxcanvas static_cast<Gdiplus::REAL>(rPoint.getY()) ); } - rOutput->AddLines( &rPoints[0], nPoints ); + if(bNoLineJoin && nPoints > 2) + { + for(sal_uInt32 a(1); a < nPoints; a++) + { + rOutput->StartFigure(); + rOutput->AddLine(rPoints[a - 1], rPoints[a]); + } + + if(bClosedPolygon) + { + rOutput->StartFigure(); + rOutput->AddLine(rPoints[nPoints - 1], rPoints[0]); + } + } + else + { + rOutput->AddLines( &rPoints[0], nPoints ); + } } - if( bClosedPolygon ) + if( bClosedPolygon && !bNoLineJoin ) rOutput->CloseFigure(); } } @@ -426,17 +468,17 @@ namespace dxcanvas return pRes; } - GraphicsPathSharedPtr graphicsPathFromB2DPolygon( const ::basegfx::B2DPolygon& rPoly ) + GraphicsPathSharedPtr graphicsPathFromB2DPolygon( const ::basegfx::B2DPolygon& rPoly, bool bNoLineJoin ) { GraphicsPathSharedPtr pRes( new Gdiplus::GraphicsPath() ); ::std::vector< Gdiplus::PointF > aPoints; - graphicsPathFromB2DPolygon( pRes, aPoints, rPoly ); + graphicsPathFromB2DPolygon( pRes, aPoints, rPoly, bNoLineJoin ); return pRes; } - GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly ) + GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly, bool bNoLineJoin ) { GraphicsPathSharedPtr pRes( new Gdiplus::GraphicsPath() ); ::std::vector< Gdiplus::PointF > aPoints; @@ -446,24 +488,25 @@ namespace dxcanvas { graphicsPathFromB2DPolygon( pRes, aPoints, - rPoly.getB2DPolygon( nCurrPoly ) ); + rPoly.getB2DPolygon( nCurrPoly ), + bNoLineJoin); } return pRes; } - GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D( const uno::Reference< rendering::XPolyPolygon2D >& xPoly ) + GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D( const uno::Reference< rendering::XPolyPolygon2D >& xPoly, bool bNoLineJoin ) { LinePolyPolygon* pPolyImpl = dynamic_cast< LinePolyPolygon* >( xPoly.get() ); if( pPolyImpl ) { - return pPolyImpl->getGraphicsPath(); + return pPolyImpl->getGraphicsPath( bNoLineJoin ); } else { return tools::graphicsPathFromB2DPolyPolygon( - polyPolygonFromXPolyPolygon2D( xPoly ) ); + polyPolygonFromXPolyPolygon2D( xPoly ), bNoLineJoin ); } } diff --git a/canvas/source/directx/dx_impltools.hxx b/canvas/source/directx/dx_impltools.hxx index 072d1063235d..222b1a927305 100755 --- a/canvas/source/directx/dx_impltools.hxx +++ b/canvas/source/directx/dx_impltools.hxx @@ -107,11 +107,18 @@ namespace dxcanvas GraphicsPathSharedPtr graphicsPathFromRealPoint2DSequence( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& ); - GraphicsPathSharedPtr graphicsPathFromB2DPolygon( const ::basegfx::B2DPolygon& rPoly ); - GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly ); + GraphicsPathSharedPtr graphicsPathFromB2DPolygon( + const ::basegfx::B2DPolygon& rPoly, + bool bNoLineJoin = false); + + GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon( + const ::basegfx::B2DPolyPolygon& rPoly, + bool bNoLineJoin = false); + + GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D( + const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >&, + bool bNoLineJoin = false ); - GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D( const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D >& ); bool drawGdiPlusBitmap( const GraphicsSharedPtr& rGraphics, const BitmapSharedPtr& rBitmap ); bool drawDIBits( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics, diff --git a/canvas/source/directx/dx_linepolypolygon.cxx b/canvas/source/directx/dx_linepolypolygon.cxx index e63adc3dc613..9a5569384eae 100755 --- a/canvas/source/directx/dx_linepolypolygon.cxx +++ b/canvas/source/directx/dx_linepolypolygon.cxx @@ -46,14 +46,14 @@ namespace dxcanvas { } - GraphicsPathSharedPtr LinePolyPolygon::getGraphicsPath() const + GraphicsPathSharedPtr LinePolyPolygon::getGraphicsPath( bool bNoLineJoin ) const { // generate GraphicsPath only on demand (gets deleted as soon // as any of the modifying methods above touches the // B2DPolyPolygon). if( !mpPath ) { - mpPath = tools::graphicsPathFromB2DPolyPolygon( getPolyPolygonUnsafe() ); + mpPath = tools::graphicsPathFromB2DPolyPolygon( getPolyPolygonUnsafe(), bNoLineJoin ); mpPath->SetFillMode( const_cast<LinePolyPolygon*>(this)->getFillRule() == rendering::FillRule_EVEN_ODD ? Gdiplus::FillModeAlternate : Gdiplus::FillModeWinding ); } diff --git a/canvas/source/directx/dx_linepolypolygon.hxx b/canvas/source/directx/dx_linepolypolygon.hxx index 431cd1b87b4f..3e061d76e768 100755 --- a/canvas/source/directx/dx_linepolypolygon.hxx +++ b/canvas/source/directx/dx_linepolypolygon.hxx @@ -45,7 +45,7 @@ namespace dxcanvas public: explicit LinePolyPolygon( const ::basegfx::B2DPolyPolygon& ); - GraphicsPathSharedPtr getGraphicsPath() const; + GraphicsPathSharedPtr getGraphicsPath( bool bNoLineJoin = false) const; private: // overridden, to clear mpPath diff --git a/canvas/source/simplecanvas/simplecanvasimpl.cxx b/canvas/source/simplecanvas/simplecanvasimpl.cxx index 185979b0220e..7ca251458d22 100644 --- a/canvas/source/simplecanvas/simplecanvasimpl.cxx +++ b/canvas/source/simplecanvas/simplecanvasimpl.cxx @@ -46,6 +46,7 @@ #include <comphelper/servicedecl.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "canvas/canvastools.hxx" @@ -287,10 +288,7 @@ namespace ::sal_Int8 nTextDirection ) throw (uno::RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - - basegfx::B2DHomMatrix offsetTransform; - offsetTransform.translate(aOutPos.X,aOutPos.Y); - + const basegfx::B2DHomMatrix offsetTransform(basegfx::tools::createTranslateB2DHomMatrix(aOutPos.X,aOutPos.Y)); rendering::RenderState aRenderState( createStrokingRenderState() ); tools::appendToRenderState(aRenderState, offsetTransform); @@ -305,10 +303,7 @@ namespace const geometry::RealPoint2D& aLeftTop ) throw (uno::RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - - basegfx::B2DHomMatrix offsetTransform; - offsetTransform.translate(aLeftTop.X,aLeftTop.Y); - + const basegfx::B2DHomMatrix offsetTransform(basegfx::tools::createTranslateB2DHomMatrix(aLeftTop.X,aLeftTop.Y)); rendering::RenderState aRenderState( createStrokingRenderState() ); tools::appendToRenderState(aRenderState, offsetTransform); diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx index 23d6124e4cb8..278789637c72 100644 --- a/canvas/source/tools/canvastools.cxx +++ b/canvas/source/tools/canvastools.cxx @@ -63,6 +63,7 @@ #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/tools/canvastools.hxx> #include <basegfx/numeric/ftools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <cppuhelper/compbase1.hxx> #include <rtl/instance.hxx> @@ -679,9 +680,8 @@ namespace canvas i_transformation ); // now move resulting left,top point of bounds to (0,0) - ::basegfx::B2DHomMatrix aCorrectedTransform; - aCorrectedTransform.translate( -aTransformedRect.getMinX(), - -aTransformedRect.getMinY() ); + const basegfx::B2DHomMatrix aCorrectedTransform(basegfx::tools::createTranslateB2DHomMatrix( + -aTransformedRect.getMinX(), -aTransformedRect.getMinY())); // prepend to original transformation o_transform = aCorrectedTransform * i_transformation; @@ -745,9 +745,8 @@ namespace canvas transformation ); // now move resulting left,top point of bounds to (0,0) - ::basegfx::B2DHomMatrix aCorrectedTransform; - aCorrectedTransform.translate( -aTransformedRect.getMinX(), - -aTransformedRect.getMinY() ); + basegfx::B2DHomMatrix aCorrectedTransform(basegfx::tools::createTranslateB2DHomMatrix( + -aTransformedRect.getMinX(), -aTransformedRect.getMinY())); // scale to match outRect const double xDenom( aTransformedRect.getWidth() ); diff --git a/canvas/source/tools/surface.cxx b/canvas/source/tools/surface.cxx index c3161758ea3e..96162f6d78af 100644 --- a/canvas/source/tools/surface.cxx +++ b/canvas/source/tools/surface.cxx @@ -33,6 +33,7 @@ #include "surface.hxx" #include <basegfx/polygon/b2dpolygonclipper.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <comphelper/scopeguard.hxx> #include <boost/bind.hpp> @@ -150,9 +151,8 @@ namespace canvas // 4) scale to normalized device coordinates // 5) flip y-axis // 6) translate to account for viewport transform - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate(maSourceOffset.getX(), - maSourceOffset.getY()); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix( + maSourceOffset.getX(), maSourceOffset.getY())); aTransform = aTransform * rTransform; aTransform.translate(::basegfx::fround(rPos.getX()), ::basegfx::fround(rPos.getY())); @@ -277,8 +277,7 @@ namespace canvas // 1) offset of surface subarea // 2) surface transform // 3) translation to output position [rPos] - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate(aPos1.getX(),aPos1.getY()); + basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(aPos1.getX(), aPos1.getY())); aTransform = aTransform * rTransform; aTransform.translate(::basegfx::fround(rPos.getX()), ::basegfx::fround(rPos.getY())); @@ -380,7 +379,7 @@ namespace canvas // be transformed by the overall transform and uv coordinates will // be calculated from the result, and this is why we need to use // integer coordinates here... - ::basegfx::B2DHomMatrix aTransform; + basegfx::B2DHomMatrix aTransform; aTransform = aTransform * rTransform; aTransform.translate(::basegfx::fround(rPos.getX()), ::basegfx::fround(rPos.getY())); diff --git a/comphelper/inc/comphelper/servicedecl.hxx b/comphelper/inc/comphelper/servicedecl.hxx index a11598bdca85..7b77d3ba29e7 100644 --- a/comphelper/inc/comphelper/servicedecl.hxx +++ b/comphelper/inc/comphelper/servicedecl.hxx @@ -169,21 +169,20 @@ template <bool> struct with_args; /// @internal namespace detail { - template <typename ImplT> -class ServiceImpl - : public ::cppu::ImplInheritanceHelper1<ImplT, css::lang::XServiceInfo>, +class OwnServiceImpl + : public ImplT, private ::boost::noncopyable { - typedef ::cppu::ImplInheritanceHelper1<ImplT,css::lang::XServiceInfo> BaseT; + typedef ImplT BaseT; public: - ServiceImpl( + OwnServiceImpl( ServiceDecl const& rServiceDecl, css::uno::Sequence<css::uno::Any> const& args, css::uno::Reference<css::uno::XComponentContext> const& xContext ) - : BaseT(args, xContext), m_rServiceDecl(rServiceDecl) {} - ServiceImpl( + :BaseT(args, xContext), m_rServiceDecl(rServiceDecl) {} + OwnServiceImpl( ServiceDecl const& rServiceDecl, css::uno::Reference<css::uno::XComponentContext> const& xContext ) : BaseT(xContext), m_rServiceDecl(rServiceDecl) {} @@ -206,6 +205,22 @@ private: ServiceDecl const& m_rServiceDecl; }; +template <typename ImplT> +class ServiceImpl : public OwnServiceImpl< ::cppu::ImplInheritanceHelper1<ImplT,css::lang::XServiceInfo> > +{ +typedef OwnServiceImpl< ::cppu::ImplInheritanceHelper1<ImplT,css::lang::XServiceInfo> > ServiceImpl_BASE; +public: + ServiceImpl( + ServiceDecl const& rServiceDecl, + css::uno::Sequence<css::uno::Any> const& args, + css::uno::Reference<css::uno::XComponentContext> const& xContext ) + : ServiceImpl_BASE(rServiceDecl, args, xContext) {} + ServiceImpl( + ServiceDecl const& rServiceDecl, + css::uno::Reference<css::uno::XComponentContext> const& xContext ) + : ServiceImpl_BASE(rServiceDecl, xContext) {} +}; + template <typename ServiceImplT> struct PostProcessDefault { css::uno::Reference<css::uno::XInterface> @@ -230,7 +245,7 @@ struct CreateFunc<ImplT, PostProcessFuncT, with_args<false> > { const& xContext ) const { return m_postProcessFunc( - new ServiceImpl<ImplT>( rServiceDecl, xContext ) ); + new ImplT( rServiceDecl, xContext ) ); } }; @@ -247,7 +262,7 @@ struct CreateFunc<ImplT, PostProcessFuncT, with_args<true> > { const& xContext ) const { return m_postProcessFunc( - new ServiceImpl<ImplT>( rServiceDecl, args, xContext ) ); + new ImplT( rServiceDecl, args, xContext ) ); } }; @@ -261,18 +276,17 @@ struct CreateFunc<ImplT, PostProcessFuncT, with_args<true> > { or just (uno::Reference<uno::XComponentContext>) */ template <typename ImplT_, typename WithArgsT = with_args<false> > -struct class_ { +struct serviceimpl_base { typedef ImplT_ ImplT; - typedef detail::ServiceImpl<ImplT_> ServiceImplT; detail::CreateFuncF const m_createFunc; - typedef detail::PostProcessDefault<ServiceImplT> PostProcessDefaultT; + typedef detail::PostProcessDefault<ImplT> PostProcessDefaultT; /** Default ctor. Implementation class without args, expecting component context as single argument. */ - class_() : m_createFunc( + serviceimpl_base() : m_createFunc( detail::CreateFunc<ImplT, PostProcessDefaultT, WithArgsT>( PostProcessDefaultT() ) ) {} @@ -284,11 +298,29 @@ struct class_ { uno::Reference<uno::XInterface> */ template <typename PostProcessFuncT> - explicit class_( PostProcessFuncT const& postProcessFunc ) + explicit serviceimpl_base( PostProcessFuncT const& postProcessFunc ) : m_createFunc( detail::CreateFunc<ImplT, PostProcessFuncT, WithArgsT>( postProcessFunc ) ) {} }; +template <typename ImplT_, typename WithArgsT = with_args<false> > +struct class_ : public serviceimpl_base< detail::ServiceImpl<ImplT_>, WithArgsT > +{ + typedef serviceimpl_base< detail::ServiceImpl<ImplT_>, WithArgsT > baseT; + /** Default ctor. Implementation class without args, expecting + component context as single argument. + */ + class_() : baseT() {} + template <typename PostProcessFuncT> + /** Ctor to pass a post processing function/functor. + + @tpl PostProcessDefaultT let your compiler deduce this + @param postProcessFunc function/functor that gets the yet unacquired + ImplT_ pointer returning a + uno::Reference<uno::XInterface> + */ + explicit class_( PostProcessFuncT const& postProcessFunc ) : baseT( postProcessFunc ) {} +}; // // component_... helpers with arbitrary service declarations: diff --git a/comphelper/qa/makefile.mk b/comphelper/qa/makefile.mk index cfc597570bc4..52c57a9d77de 100644 --- a/comphelper/qa/makefile.mk +++ b/comphelper/qa/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # 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 @@ -43,7 +43,7 @@ INCPRE += $(MISC)$/$(TARGET)$/inc SHL1TARGET = $(TARGET)_weakbag SHL1OBJS = $(SLO)$/test_weakbag.obj -SHL1STDLIBS = $(CPPUHELPERLIB) $(CPPULIB) $(CPPUNITLIB) $(SALLIB) +SHL1STDLIBS = $(CPPUHELPERLIB) $(CPPULIB) $(CPPUNITLIB) $(TESTSHL2LIB) $(SALLIB) SHL1VERSIONMAP = version.map SHL1IMPLIB = i$(SHL1TARGET) DEF1NAME = $(SHL1TARGET) @@ -55,4 +55,4 @@ SLOFILES = $(SHL1OBJS) ALLTAR: test test .PHONY: $(SHL1TARGETN) - testshl2 $(SHL1TARGETN) + $(TESTSHL2) $(SHL1TARGETN) diff --git a/comphelper/qa/test_string.cxx b/comphelper/qa/test_string.cxx index 035e56fdb8c4..c237158beccc 100644 --- a/comphelper/qa/test_string.cxx +++ b/comphelper/qa/test_string.cxx @@ -32,7 +32,7 @@ #include "sal/config.h" #include "comphelper/string.hxx" -#include "cppunit/simpleheader.hxx" +#include "testshl/simpleheader.hxx" #include "rtl/string.h" #include "rtl/ustring.h" #include "rtl/ustring.hxx" diff --git a/comphelper/qa/test_weakbag.cxx b/comphelper/qa/test_weakbag.cxx index dd4a8356eb5a..470ac2eef6c0 100644 --- a/comphelper/qa/test_weakbag.cxx +++ b/comphelper/qa/test_weakbag.cxx @@ -35,7 +35,7 @@ #include "com/sun/star/uno/XInterface.hpp" #include "comphelper/weakbag.hxx" #include "cppuhelper/weak.hxx" -#include "cppunit/simpleheader.hxx" +#include "testshl/simpleheader.hxx" namespace { diff --git a/comphelper/source/misc/comphelper_services.cxx b/comphelper/source/misc/comphelper_services.cxx index 77ab145e2581..8fa318a92eb1 100644 --- a/comphelper/source/misc/comphelper_services.cxx +++ b/comphelper/source/misc/comphelper_services.cxx @@ -39,6 +39,7 @@ extern void createRegistryInfo_AnyCompareFactory(); extern void createRegistryInfo_OfficeInstallationDirectories(); extern void createRegistryInfo_OInstanceLocker(); extern void createRegistryInfo_Map(); +extern void createRegistryInfo_OSimpleLogRing(); //........................................................................ namespace comphelper { namespace module @@ -63,6 +64,7 @@ namespace comphelper { namespace module createRegistryInfo_OfficeInstallationDirectories(); createRegistryInfo_OInstanceLocker(); createRegistryInfo_Map(); + createRegistryInfo_OSimpleLogRing(); } } } diff --git a/comphelper/source/misc/documentiologring.cxx b/comphelper/source/misc/documentiologring.cxx index 7969b938e108..8b999aaf4449 100644 --- a/comphelper/source/misc/documentiologring.cxx +++ b/comphelper/source/misc/documentiologring.cxx @@ -34,6 +34,8 @@ #include <com/sun/star/frame/DoubleInitializationException.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <comphelper_module.hxx>
+
#include "documentiologring.hxx"
using namespace ::com::sun::star;
@@ -56,33 +58,33 @@ OSimpleLogRing::~OSimpleLogRing() }
// ----------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL OSimpleLogRing::impl_staticGetSupportedServiceNames()
+uno::Sequence< ::rtl::OUString > SAL_CALL OSimpleLogRing::getSupportedServiceNames_static()
{
uno::Sequence< rtl::OUString > aResult( 1 );
- aResult[0] = impl_staticGetServiceName();
+ aResult[0] = getServiceName_static();
return aResult;
}
// ----------------------------------------------------------
-::rtl::OUString SAL_CALL OSimpleLogRing::impl_staticGetImplementationName()
+::rtl::OUString SAL_CALL OSimpleLogRing::getImplementationName_static()
{
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.logging.SimpleLogRing" ) );
}
// ----------------------------------------------------------
-::rtl::OUString SAL_CALL OSimpleLogRing::impl_staticGetSingletonName()
+::rtl::OUString SAL_CALL OSimpleLogRing::getSingletonName_static()
{
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.logging.DocumentIOLogRing" ) );
}
// ----------------------------------------------------------
-::rtl::OUString SAL_CALL OSimpleLogRing::impl_staticGetServiceName()
+::rtl::OUString SAL_CALL OSimpleLogRing::getServiceName_static()
{
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.logging.SimpleLogRing" ) );
}
// ----------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL OSimpleLogRing::impl_staticCreateSelfInstance( const uno::Reference< uno::XComponentContext >& rxContext )
+uno::Reference< uno::XInterface > SAL_CALL OSimpleLogRing::Create( const uno::Reference< uno::XComponentContext >& rxContext )
{
return static_cast< cppu::OWeakObject* >( new OSimpleLogRing( rxContext ) );
}
@@ -149,13 +151,13 @@ void SAL_CALL OSimpleLogRing::initialize( const uno::Sequence< uno::Any >& aArgu // ----------------------------------------------------------
::rtl::OUString SAL_CALL OSimpleLogRing::getImplementationName() throw (uno::RuntimeException)
{
- return impl_staticGetImplementationName();
+ return getImplementationName_static();
}
// ----------------------------------------------------------
::sal_Bool SAL_CALL OSimpleLogRing::supportsService( const ::rtl::OUString& aServiceName ) throw (uno::RuntimeException)
{
- const uno::Sequence< rtl::OUString > & aSupportedNames = impl_staticGetSupportedServiceNames();
+ const uno::Sequence< rtl::OUString > & aSupportedNames = getSupportedServiceNames_static();
for ( sal_Int32 nInd = 0; nInd < aSupportedNames.getLength(); nInd++ )
{
if ( aSupportedNames[ nInd ].equals( aServiceName ) )
@@ -168,8 +170,13 @@ void SAL_CALL OSimpleLogRing::initialize( const uno::Sequence< uno::Any >& aArgu // ----------------------------------------------------------
uno::Sequence< ::rtl::OUString > SAL_CALL OSimpleLogRing::getSupportedServiceNames() throw (uno::RuntimeException)
{
- return impl_staticGetSupportedServiceNames();
+ return getSupportedServiceNames_static();
}
} // namespace comphelper
+void createRegistryInfo_OSimpleLogRing()
+{
+ static ::comphelper::module::OAutoRegistration< ::comphelper::OSimpleLogRing > aAutoRegistration;
+ static ::comphelper::module::OSingletonRegistration< ::comphelper::OSimpleLogRing > aSingletonRegistration;
+}
diff --git a/comphelper/source/misc/documentiologring.hxx b/comphelper/source/misc/documentiologring.hxx index ae7d2a6eaf19..b2b935c478af 100644 --- a/comphelper/source/misc/documentiologring.hxx +++ b/comphelper/source/misc/documentiologring.hxx @@ -60,17 +60,16 @@ public: virtual ~OSimpleLogRing(); static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL - impl_staticGetSupportedServiceNames(); + getSupportedServiceNames_static(); - static ::rtl::OUString SAL_CALL impl_staticGetImplementationName(); + static ::rtl::OUString SAL_CALL getImplementationName_static(); - static ::rtl::OUString SAL_CALL impl_staticGetSingletonName(); + static ::rtl::OUString SAL_CALL getSingletonName_static(); - static ::rtl::OUString SAL_CALL impl_staticGetServiceName(); + static ::rtl::OUString SAL_CALL getServiceName_static(); static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL - impl_staticCreateSelfInstance( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); + Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); // XSimpleLogRing virtual void SAL_CALL logString( const ::rtl::OUString& aMessage ) throw (::com::sun::star::uno::RuntimeException); diff --git a/comphelper/source/property/ChainablePropertySetInfo.cxx b/comphelper/source/property/ChainablePropertySetInfo.cxx index b27cef88319c..c5d134eb9982 100644 --- a/comphelper/source/property/ChainablePropertySetInfo.cxx +++ b/comphelper/source/property/ChainablePropertySetInfo.cxx @@ -76,7 +76,7 @@ void ChainablePropertySetInfo::add( PropertyInfo* pMap, sal_Int32 nCount ) { OUString aName( pMap->mpName, pMap->mnNameLen, RTL_TEXTENCODING_ASCII_US ); -#ifndef PRODUCT +#ifdef DBG_UTIL PropertyInfoHash::iterator aIter = maMap.find( aName ); if( aIter != maMap.end() ) OSL_ENSURE( sal_False, "Warning: PropertyInfo added twice, possible error!"); diff --git a/comphelper/source/property/MasterPropertySetInfo.cxx b/comphelper/source/property/MasterPropertySetInfo.cxx index e74d21b2d755..91a9a17856d4 100644 --- a/comphelper/source/property/MasterPropertySetInfo.cxx +++ b/comphelper/source/property/MasterPropertySetInfo.cxx @@ -84,7 +84,7 @@ void MasterPropertySetInfo::add( PropertyInfo* pMap, sal_Int32 nCount, sal_uInt8 { OUString aName( pMap->mpName, pMap->mnNameLen, RTL_TEXTENCODING_ASCII_US ); -#ifndef PRODUCT +#ifdef DBG_UTIL PropertyDataHash::iterator aIter = maMap.find( aName ); if( aIter != maMap.end() ) OSL_ENSURE( sal_False, "Warning: PropertyInfo added twice, possible error!"); @@ -102,7 +102,7 @@ void MasterPropertySetInfo::add( PropertyInfoHash &rHash, sal_uInt8 nMapId ) while ( aIter != aEnd ) { -#ifndef PRODUCT +#ifdef DBG_UTIL PropertyDataHash::iterator aDebugIter = maMap.find( (*aIter).first ); if( aDebugIter != maMap.end() ) OSL_ENSURE( sal_False, "Warning: PropertyInfo added twice, possible error!"); diff --git a/comphelper/source/property/opropertybag.cxx b/comphelper/source/property/opropertybag.cxx index 8b816e8c1ce9..caa895021103 100644 --- a/comphelper/source/property/opropertybag.cxx +++ b/comphelper/source/property/opropertybag.cxx @@ -240,7 +240,7 @@ namespace comphelper if ( !( _element >>= aProperty ) ) throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); - ::osl::MutexGuard aGuard( m_aMutex ); + ::osl::ClearableMutexGuard g( m_aMutex ); // check whether the type is allowed, everything else will be checked // by m_aDynamicProperties @@ -254,6 +254,7 @@ namespace comphelper // our property info is dirty m_pArrayHelper.reset(); + g.clear(); setModified(sal_True); } @@ -346,7 +347,7 @@ namespace comphelper //-------------------------------------------------------------------- void SAL_CALL OPropertyBag::addProperty( const ::rtl::OUString& _rName, ::sal_Int16 _nAttributes, const Any& _rInitialValue ) throw (PropertyExistException, IllegalTypeException, IllegalArgumentException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); + ::osl::ClearableMutexGuard g( m_aMutex ); // check whether the type is allowed, everything else will be checked // by m_aDynamicProperties @@ -362,19 +363,21 @@ namespace comphelper // our property info is dirty m_pArrayHelper.reset(); + g.clear(); setModified(sal_True); } //-------------------------------------------------------------------- void SAL_CALL OPropertyBag::removeProperty( const ::rtl::OUString& _rName ) throw (UnknownPropertyException, NotRemoveableException, RuntimeException) { - ::osl::MutexGuard aGuard( m_aMutex ); + ::osl::ClearableMutexGuard g( m_aMutex ); m_aDynamicProperties.removeProperty( _rName ); // our property info is dirty m_pArrayHelper.reset(); + g.clear(); setModified(sal_True); } diff --git a/comphelper/source/property/property.cxx b/comphelper/source/property/property.cxx index fe6cbaa9d767..0ccc28d4238b 100644 --- a/comphelper/source/property/property.cxx +++ b/comphelper/source/property/property.cxx @@ -38,15 +38,11 @@ #include <osl/diagnose.h> #if OSL_DEBUG_LEVEL > 0 - #ifndef _RTL_STRBUF_HXX_ #include <rtl/strbuf.hxx> - #endif - #ifndef _CPPUHELPER_EXC_HLP_HXX_ #include <cppuhelper/exc_hlp.hxx> - #endif - #ifndef _OSL_THREAD_H_ #include <osl/thread.h> - #endif + #include <com/sun/star/lang/XServiceInfo.hpp> + #include <typeinfo> #endif #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> @@ -71,6 +67,10 @@ namespace comphelper using ::com::sun::star::uno::cpp_queryInterface; using ::com::sun::star::uno::cpp_acquire; using ::com::sun::star::uno::cpp_release; +#if OSL_DEBUG_LEVEL > 0 + using ::com::sun::star::lang::XServiceInfo; +#endif + using ::com::sun::star::uno::UNO_QUERY; /** === end UNO using === **/ namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute; @@ -110,7 +110,18 @@ void copyProperties(const Reference<XPropertySet>& _rxSource, ::rtl::OStringBuffer aBuffer; aBuffer.append( "::comphelper::copyProperties: could not copy property '" ); aBuffer.append( ::rtl::OString( pSourceProps->Name.getStr(), pSourceProps->Name.getLength(), RTL_TEXTENCODING_ASCII_US ) ); - aBuffer.append( "' to the destination set.\n" ); + aBuffer.append( "' to the destination set (a '" ); + + Reference< XServiceInfo > xSI( _rxDest, UNO_QUERY ); + if ( xSI.is() ) + { + aBuffer.append( ::rtl::OUStringToOString( xSI->getImplementationName(), osl_getThreadTextEncoding() ) ); + } + else + { + aBuffer.append( typeid( *_rxDest.get() ).name() ); + } + aBuffer.append( "' implementation).\n" ); Any aException( ::cppu::getCaughtException() ); aBuffer.append( "Caught an exception of type '" ); diff --git a/comphelper/source/property/propertysetinfo.cxx b/comphelper/source/property/propertysetinfo.cxx index e155d695e2c9..83b769553331 100644 --- a/comphelper/source/property/propertysetinfo.cxx +++ b/comphelper/source/property/propertysetinfo.cxx @@ -82,7 +82,7 @@ void PropertyMapImpl::add( PropertyMapEntry* pMap, sal_Int32 nCount ) throw() { OUString aName( pMap->mpName, pMap->mnNameLen, RTL_TEXTENCODING_ASCII_US ); -#ifndef PRODUCT +#ifdef DBG_UTIL PropertyMap::iterator aIter = maPropertyMap.find( aName ); if( aIter != maPropertyMap.end() ) { diff --git a/cppcanvas/source/mtfrenderer/bitmapaction.cxx b/cppcanvas/source/mtfrenderer/bitmapaction.cxx index 355dd336e2c5..4f54b10c4879 100644 --- a/cppcanvas/source/mtfrenderer/bitmapaction.cxx +++ b/cppcanvas/source/mtfrenderer/bitmapaction.cxx @@ -35,25 +35,21 @@ #include <com/sun/star/rendering/XBitmap.hpp> #include <com/sun/star/rendering/RepaintResult.hpp> #include <com/sun/star/rendering/XCachedPrimitive.hpp> - #include <vcl/bitmapex.hxx> #include <tools/gen.hxx> #include <vcl/canvastools.hxx> - #include <canvas/canvastools.hxx> - #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/vector/b2dsize.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/range/b2drange.hxx> #include <basegfx/tools/canvastools.hxx> - #include <boost/utility.hpp> - #include "cachedprimitivebase.hxx" #include "bitmapaction.hxx" #include "outdevstate.hxx" #include "mtftools.hxx" +#include <basegfx/matrix/b2dhommatrixtools.hxx> using namespace ::com::sun::star; @@ -112,9 +108,7 @@ namespace cppcanvas // Setup transformation such that the next render call is // moved rPoint away. - ::basegfx::B2DHomMatrix aLocalTransformation; - aLocalTransformation.translate( rDstPoint.getX(), - rDstPoint.getY() ); + const basegfx::B2DHomMatrix aLocalTransformation(basegfx::tools::createTranslateB2DHomMatrix(rDstPoint)); ::canvas::tools::appendToRenderState( maState, aLocalTransformation ); @@ -144,15 +138,12 @@ namespace cppcanvas // moved rPoint away, and scaled according to the ratio // given by src and dst size. const ::Size aBmpSize( rBmpEx.GetSizePixel() ); - ::basegfx::B2DHomMatrix aLocalTransformation; const ::basegfx::B2DVector aScale( rDstSize.getX() / aBmpSize.Width(), rDstSize.getY() / aBmpSize.Height() ); - aLocalTransformation.scale( aScale.getX(), aScale.getY() ); - aLocalTransformation.translate( rDstPoint.getX(), - rDstPoint.getY() ); - ::canvas::tools::appendToRenderState( maState, - aLocalTransformation ); + const basegfx::B2DHomMatrix aLocalTransformation(basegfx::tools::createScaleTranslateB2DHomMatrix( + aScale, rDstPoint)); + ::canvas::tools::appendToRenderState( maState, aLocalTransformation ); // correct clip (which is relative to original transform) tools::modifyClip( maState, diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index c6f9a295b332..8ea2ae453a97 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -34,19 +34,14 @@ #include <canvas/debug.hxx> #include <tools/diagnose_ex.h> #include <canvas/verbosetrace.hxx> - #include <osl/mutex.hxx> #include <vos/mutex.hxx> #include <vcl/svapp.hxx> - #include <rtl/logfile.hxx> - #include <comphelper/sequence.hxx> #include <comphelper/anytostring.hxx> #include <cppuhelper/exc_hlp.hxx> - #include <cppcanvas/canvas.hxx> - #include <com/sun/star/rendering/XGraphicDevice.hpp> #include <com/sun/star/rendering/TexturingMode.hpp> #include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp> @@ -59,7 +54,6 @@ #include <com/sun/star/rendering/XCanvas.hpp> #include <com/sun/star/rendering/PathCapType.hpp> #include <com/sun/star/rendering/PathJoinType.hpp> - #include <basegfx/tools/canvastools.hxx> #include <basegfx/numeric/ftools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> @@ -73,7 +67,6 @@ #include <basegfx/tuple/b2dtuple.hxx> #include <basegfx/polygon/b2dpolygonclipper.hxx> #include <basegfx/polygon/b2dpolypolygoncutter.hxx> - #include <canvas/canvastools.hxx> #include <vcl/canvastools.hxx> #include <vcl/salbtype.hxx> @@ -84,11 +77,9 @@ #include <vcl/graphictools.hxx> #include <tools/poly.hxx> #include <i18npool/mslangid.hxx> - #include <implrenderer.hxx> #include <tools.hxx> #include <outdevstate.hxx> - #include <action.hxx> #include <bitmapaction.hxx> #include <lineaction.hxx> @@ -96,15 +87,13 @@ #include <polypolyaction.hxx> #include <textaction.hxx> #include <transparencygroupaction.hxx> - #include <vector> #include <algorithm> #include <iterator> - #include <boost/scoped_array.hpp> - #include "mtftools.hxx" #include "outdevstate.hxx" +#include <basegfx/matrix/b2dhommatrixtools.hxx> using namespace ::com::sun::star; @@ -286,10 +275,25 @@ namespace (getState( rParms.mrStates ).mapModeTransform * aWidth).getX(); // setup reasonable defaults - o_rStrokeAttributes.MiterLimit = 1.0; + o_rStrokeAttributes.MiterLimit = 15.0; // 1.0 was no good default; GDI+'s limit is 10.0, our's is 15.0 o_rStrokeAttributes.StartCapType = rendering::PathCapType::BUTT; o_rStrokeAttributes.EndCapType = rendering::PathCapType::BUTT; - o_rStrokeAttributes.JoinType = rendering::PathJoinType::MITER; + + switch(rLineInfo.GetLineJoin()) + { + default: // B2DLINEJOIN_NONE, B2DLINEJOIN_MIDDLE + o_rStrokeAttributes.JoinType = rendering::PathJoinType::NONE; + break; + case basegfx::B2DLINEJOIN_BEVEL: + o_rStrokeAttributes.JoinType = rendering::PathJoinType::BEVEL; + break; + case basegfx::B2DLINEJOIN_MITER: + o_rStrokeAttributes.JoinType = rendering::PathJoinType::MITER; + break; + case basegfx::B2DLINEJOIN_ROUND: + o_rStrokeAttributes.JoinType = rendering::PathJoinType::ROUND; + break; + } if( LINE_DASH == rLineInfo.GetStyle() ) { @@ -729,12 +733,11 @@ namespace cppcanvas fabs( aBounds.getHeight()*sin(nRotation) ) + fabs( aBounds.getWidth()*cos(nRotation) ))); - aTextureTransformation.scale( nScale, nScale ); - - // translate back origin to center of + // scale and translate back origin to center of // primitive - aTextureTransformation.translate( 0.5*aBounds.getWidth(), - 0.5*aBounds.getHeight() ); + aTextureTransformation = basegfx::tools::createScaleTranslateB2DHomMatrix( + nScale, nScale, 0.5*aBounds.getWidth(), 0.5*aBounds.getHeight()) + * aTextureTransformation; } break; @@ -856,9 +859,8 @@ namespace cppcanvas aTextureTransformation.scale( nScaleX, nScaleY ); // rotate texture according to gradient rotation - aTextureTransformation.translate( -0.5*nScaleX, -0.5*nScaleY ); - aTextureTransformation.rotate( nRotation ); - aTextureTransformation.translate( 0.5*nScaleX, 0.5*nScaleY ); + aTextureTransformation = basegfx::tools::createRotateAroundPoint(0.5*nScaleX, 0.5*nScaleY, nRotation) + * aTextureTransformation; aTextureTransformation.translate( nOffsetX, nOffsetY ); } diff --git a/cppcanvas/source/mtfrenderer/mtftools.cxx b/cppcanvas/source/mtfrenderer/mtftools.cxx index e4e227955da6..b6a548aa49be 100644 --- a/cppcanvas/source/mtfrenderer/mtftools.cxx +++ b/cppcanvas/source/mtfrenderer/mtftools.cxx @@ -34,10 +34,8 @@ #include <canvas/debug.hxx> #include <tools/diagnose_ex.h> #include <canvas/verbosetrace.hxx> - #include <com/sun/star/rendering/RenderState.hpp> #include <com/sun/star/rendering/XCanvas.hpp> - #include <basegfx/numeric/ftools.hxx> #include <basegfx/tools/canvastools.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> @@ -45,16 +43,15 @@ #include <basegfx/range/b2drectangle.hxx> #include <basegfx/vector/b2dvector.hxx> #include <canvas/canvastools.hxx> - #include <vcl/gdimtf.hxx> #include <vcl/metaact.hxx> #include <vcl/virdev.hxx> #include <vcl/metric.hxx> #include <tools/poly.hxx> - #include "mtftools.hxx" #include "outdevstate.hxx" #include "polypolyaction.hxx" +#include <basegfx/matrix/b2dhommatrixtools.hxx> @@ -111,9 +108,9 @@ namespace cppcanvas const ::Size aSizePixel( rVDev.LogicToPixel( aSizeLogic ) ); - o_rMatrix.identity(); - o_rMatrix.scale( aSizePixel.Width() / (double)aSizeLogic.Width(), - aSizePixel.Height() / (double)aSizeLogic.Height() ); + o_rMatrix = basegfx::tools::createScaleB2DHomMatrix( + aSizePixel.Width() / (double)aSizeLogic.Width(), + aSizePixel.Height() / (double)aSizeLogic.Height() ); return o_rMatrix; } diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx index f1191e6e57f3..038b68c3008e 100644 --- a/cppcanvas/source/mtfrenderer/textaction.cxx +++ b/cppcanvas/source/mtfrenderer/textaction.cxx @@ -48,6 +48,7 @@ #include <basegfx/vector/b2dsize.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <tools/gen.hxx> #include <vcl/canvastools.hxx> @@ -93,9 +94,7 @@ namespace cppcanvas NULL, &rState.fontRotation ); - ::basegfx::B2DHomMatrix aLocalTransformation; - - aLocalTransformation.rotate( rState.fontRotation ); + basegfx::B2DHomMatrix aLocalTransformation(basegfx::tools::createRotateB2DHomMatrix(rState.fontRotation)); aLocalTransformation.translate( rStartPoint.getX(), rStartPoint.getY() ); ::canvas::tools::appendToRenderState( o_rRenderState, diff --git a/goodies/inc/chtuner.hxx b/goodies/inc/chtuner.hxx index 4c7e288d2ce3..7a54c1e05a41 100644 --- a/goodies/inc/chtuner.hxx +++ b/goodies/inc/chtuner.hxx @@ -38,7 +38,7 @@ #endif -#include <svtools/lstner.hxx> +#include <svl/lstner.hxx> class ChannelItem; class ChannelList; diff --git a/goodies/inc/goodies.hrc b/goodies/inc/goodies.hrc index 18584985a603..139987c4f6ee 100644 --- a/goodies/inc/goodies.hrc +++ b/goodies/inc/goodies.hrc @@ -31,7 +31,7 @@ #define _GOODIES_HRC #ifndef _SOLAR_HRC -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #endif // Dialoge --------------------------------------------------------------- diff --git a/goodies/inc/grfmgr.hxx b/goodies/inc/grfmgr.hxx index b44c27ea65e3..1ef351ae6d32 100644 --- a/goodies/inc/grfmgr.hxx +++ b/goodies/inc/grfmgr.hxx @@ -353,7 +353,7 @@ public: void ReleaseFromCache(); const Graphic& GetGraphic() const; - void SetGraphic( const Graphic& rGraphic ); + void SetGraphic( const Graphic& rGraphic, const GraphicObject* pCopyObj = 0); void SetGraphic( const Graphic& rGraphic, const String& rLink ); /** Get graphic transformed according to given attributes diff --git a/goodies/inc/pch/precompiled_goodies.hxx b/goodies/inc/pch/precompiled_goodies.hxx index b0d1ba09410b..fe6f2ec433e5 100644 --- a/goodies/inc/pch/precompiled_goodies.hxx +++ b/goodies/inc/pch/precompiled_goodies.hxx @@ -96,13 +96,13 @@ #include "rtl/uuid.h" #include "svtools/FilterConfigItem.hxx" -#include "svtools/cacheoptions.hxx" +#include "unotools/cacheoptions.hxx" #include "svtools/fltcall.hxx" -#include "svtools/itemprop.hxx" -#include "svtools/lstner.hxx" -#include "svtools/solar.hrc" +#include "svl/itemprop.hxx" +#include "svl/lstner.hxx" +#include "svl/solar.hrc" #include "svtools/stdctrl.hxx" -#include "svtools/svarray.hxx" +#include "svl/svarray.hxx" #include "toolkit/helper/vclunohelper.hxx" diff --git a/goodies/source/filter.vcl/egif/egif.cxx b/goodies/source/filter.vcl/egif/egif.cxx index e1547c7339d0..9f2aeaddd686 100644 --- a/goodies/source/filter.vcl/egif/egif.cxx +++ b/goodies/source/filter.vcl/egif/egif.cxx @@ -35,7 +35,7 @@ #include <vcl/svapp.hxx> #include <vcl/msgbox.hxx> #include <vcl/window.hxx> -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #include <svtools/fltcall.hxx> #include <svtools/FilterConfigItem.hxx> #include "giflzwc.hxx" diff --git a/goodies/source/filter.vcl/eos2met/eos2met.cxx b/goodies/source/filter.vcl/eos2met/eos2met.cxx index b176d186a217..b818e9cd26ba 100644 --- a/goodies/source/filter.vcl/eos2met/eos2met.cxx +++ b/goodies/source/filter.vcl/eos2met/eos2met.cxx @@ -47,7 +47,7 @@ #include <vcl/virdev.hxx> #include <vcl/svapp.hxx> #include <vcl/msgbox.hxx> -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #include "strings.hrc" #include "dlgeos2.hxx" @@ -1753,7 +1753,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) Polygon aSimplePoly; const Polygon& rPoly = pA->GetPolygon(); if ( rPoly.HasFlags() ) - rPoly.GetSimple( aSimplePoly ); + rPoly.AdaptiveSubdivide( aSimplePoly ); else aSimplePoly = rPoly; METLine( aSimplePoly ); @@ -1772,7 +1772,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) Polygon aSimplePoly; const Polygon& rPoly = pA->GetPolygon(); if ( rPoly.HasFlags() ) - rPoly.GetSimple( aSimplePoly ); + rPoly.AdaptiveSubdivide( aSimplePoly ); else aSimplePoly = rPoly; if( aGDIFillColor != Color( COL_TRANSPARENT ) ) @@ -1809,7 +1809,7 @@ void METWriter::WriteOrders( const GDIMetaFile* pMTF ) if ( aSimplePolyPoly[ i ].HasFlags() ) { Polygon aSimplePoly; - aSimplePolyPoly[ i ].GetSimple( aSimplePoly ); + aSimplePolyPoly[ i ].AdaptiveSubdivide( aSimplePoly ); aSimplePolyPoly[ i ] = aSimplePoly; } } diff --git a/goodies/source/filter.vcl/epbm/epbm.cxx b/goodies/source/filter.vcl/epbm/epbm.cxx index 92aeb501e141..a624e7f45cfb 100644 --- a/goodies/source/filter.vcl/epbm/epbm.cxx +++ b/goodies/source/filter.vcl/epbm/epbm.cxx @@ -35,7 +35,7 @@ #include <vcl/graph.hxx> #include <vcl/bmpacc.hxx> #include <vcl/msgbox.hxx> -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #include <svtools/fltcall.hxx> #include <svtools/FilterConfigItem.hxx> #include "strings.hrc" diff --git a/goodies/source/filter.vcl/epgm/epgm.cxx b/goodies/source/filter.vcl/epgm/epgm.cxx index b6056339f11e..32d6e74a5cfe 100644 --- a/goodies/source/filter.vcl/epgm/epgm.cxx +++ b/goodies/source/filter.vcl/epgm/epgm.cxx @@ -35,7 +35,7 @@ #include <vcl/graph.hxx> #include <vcl/bmpacc.hxx> #include <vcl/msgbox.hxx> -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #include <svtools/fltcall.hxx> #include <svtools/FilterConfigItem.hxx> #include "strings.hrc" diff --git a/goodies/source/filter.vcl/epict/epict.cxx b/goodies/source/filter.vcl/epict/epict.cxx index 4df7abea01fc..cd9e33edd5d9 100644 --- a/goodies/source/filter.vcl/epict/epict.cxx +++ b/goodies/source/filter.vcl/epict/epict.cxx @@ -33,7 +33,7 @@ #include <vcl/metaact.hxx> #include <svtools/filter.hxx> -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #include <svtools/fltcall.hxx> #include <math.h> @@ -55,6 +55,9 @@ #include "dlgepct.hrc" #include "dlgepct.hxx" +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> + //============================== PictWriter =================================== struct PictWriterAttrStackMember { @@ -77,7 +80,6 @@ struct PictPattern { sal_uInt32 nLo, nHi; }; - class PictWriter { private: @@ -178,6 +180,7 @@ private: void WriteTextArray(Point & rPoint, const String& rString, const sal_Int32 * pDXAry); + void HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon); void WriteOpcodes(const GDIMetaFile & rMTF); void WriteHeader(const GDIMetaFile & rMTF); @@ -1371,6 +1374,65 @@ void PictWriter::WriteTextArray(Point & rPoint, const String& rString, const sal } } +void PictWriter::HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon) +{ + if(rLinePolygon.count()) + { + basegfx::B2DPolyPolygon aLinePolyPolygon(rLinePolygon); + basegfx::B2DPolyPolygon aFillPolyPolygon; + + rInfo.applyToB2DPolyPolygon(aLinePolyPolygon, aFillPolyPolygon); + + if(aLinePolyPolygon.count()) + { + aLinePolyPolygon = aLinePolyPolygon.getDefaultAdaptiveSubdivision(); + const sal_uInt32 nPolyCount(aLinePolyPolygon.count()); + SetAttrForFrame(); + + for(sal_uInt32 a(0); a < nPolyCount; a++) + { + const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a)); + const sal_uInt32 nPointCount(aCandidate.count()); + + if(nPointCount) + { + const sal_uInt32 nEdgeCount(aCandidate.isClosed() ? nPointCount + 1 : nPointCount); + const basegfx::B2DPoint aCurr(aCandidate.getB2DPoint(0)); + Point nCurr(basegfx::fround(aCurr.getX()), basegfx::fround(aCurr.getY())); + + for(sal_uInt32 b(0); b < nEdgeCount; b++) + { + const sal_uInt32 nNextIndex((b + 1) % nPointCount); + const basegfx::B2DPoint aNext(aCandidate.getB2DPoint(nNextIndex)); + const Point nNext(basegfx::fround(aNext.getX()), basegfx::fround(aNext.getY())); + + WriteOpcode_Line(nCurr, nNext); + nCurr = nNext; + } + } + } + } + + if(aFillPolyPolygon.count()) + { + const Color aOldLineColor(aLineColor); + const Color aOldFillColor(aFillColor); + + aLineColor = Color( COL_TRANSPARENT ); + aFillColor = aOldLineColor; + SetAttrForPaint(); + + for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++) + { + const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a).getDefaultAdaptiveSubdivision()); + WriteOpcode_Poly(PDM_PAINT, aPolygon); + } + + aLineColor = aOldLineColor; + aFillColor = aOldFillColor; + } + } +} void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) { @@ -1417,8 +1479,19 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) if( aLineColor != Color( COL_TRANSPARENT ) ) { - SetAttrForFrame(); - WriteOpcode_Line( pA->GetStartPoint(),pA->GetEndPoint() ); + if(pA->GetLineInfo().IsDefault()) + { + SetAttrForFrame(); + WriteOpcode_Line( pA->GetStartPoint(),pA->GetEndPoint() ); + } + else + { + // LineInfo used; handle Dash/Dot and fat lines + basegfx::B2DPolygon aPolygon; + aPolygon.append(basegfx::B2DPoint(pA->GetStartPoint().X(), pA->GetStartPoint().Y())); + aPolygon.append(basegfx::B2DPoint(pA->GetEndPoint().X(), pA->GetEndPoint().Y())); + HandleLineInfoPolyPolygons(pA->GetLineInfo(), aPolygon); + } } break; } @@ -1571,24 +1644,35 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) { const Polygon& rPoly = pA->GetPolygon(); - Polygon aSimplePoly; - if ( rPoly.HasFlags() ) - rPoly.GetSimple( aSimplePoly ); - else - aSimplePoly = rPoly; - - const USHORT nSize = aSimplePoly.GetSize(); - Point aLast; - - if ( nSize ) + if( rPoly.GetSize() ) { - SetAttrForFrame(); - aLast = aSimplePoly[0]; + if(pA->GetLineInfo().IsDefault()) + { + Polygon aSimplePoly; + if ( rPoly.HasFlags() ) + rPoly.AdaptiveSubdivide( aSimplePoly ); + else + aSimplePoly = rPoly; - for ( USHORT i = 1; i < nSize; i++ ) + const USHORT nSize = aSimplePoly.GetSize(); + Point aLast; + + if ( nSize ) + { + SetAttrForFrame(); + aLast = aSimplePoly[0]; + + for ( USHORT i = 1; i < nSize; i++ ) + { + WriteOpcode_Line( aLast, aSimplePoly[i] ); + aLast = aSimplePoly[i]; + } + } + } + else { - WriteOpcode_Line( aLast, aSimplePoly[i] ); - aLast = aSimplePoly[i]; + // LineInfo used; handle Dash/Dot and fat lines + HandleLineInfoPolyPolygons(pA->GetLineInfo(), rPoly.getB2DPolygon()); } } } @@ -1603,7 +1687,7 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) Polygon aSimplePoly; if ( rPoly.HasFlags() ) - rPoly.GetSimple( aSimplePoly ); + rPoly.AdaptiveSubdivide( aSimplePoly ); else aSimplePoly = rPoly; @@ -1632,7 +1716,7 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) if ( aSimplePolyPoly[ i ].HasFlags() ) { Polygon aSimplePoly; - aSimplePolyPoly[ i ].GetSimple( aSimplePoly ); + aSimplePolyPoly[ i ].AdaptiveSubdivide( aSimplePoly ); aSimplePolyPoly[ i ] = aSimplePoly; } } diff --git a/goodies/source/filter.vcl/epict/makefile.mk b/goodies/source/filter.vcl/epict/makefile.mk index 4aa4bab80ffc..9f25a562488a 100644 --- a/goodies/source/filter.vcl/epict/makefile.mk +++ b/goodies/source/filter.vcl/epict/makefile.mk @@ -61,7 +61,7 @@ RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs .IF "$(L10N_framework)"=="" SHL1TARGET= ept$(DLLPOSTFIX) SHL1IMPLIB= epict -SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB) +SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB) $(BASEGFXLIB) SHL1LIBS= $(SLB)$/epict.lib diff --git a/goodies/source/filter.vcl/eppm/eppm.cxx b/goodies/source/filter.vcl/eppm/eppm.cxx index 8cd71176e31b..d17b4f7777ae 100644 --- a/goodies/source/filter.vcl/eppm/eppm.cxx +++ b/goodies/source/filter.vcl/eppm/eppm.cxx @@ -35,7 +35,7 @@ #include <vcl/graph.hxx> #include <vcl/bmpacc.hxx> #include <vcl/msgbox.hxx> -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #include <svtools/fltcall.hxx> #include <svtools/FilterConfigItem.hxx> #include "strings.hrc" diff --git a/goodies/source/filter.vcl/eps/eps.cxx b/goodies/source/filter.vcl/eps/eps.cxx index 8a163659050a..83b5a94f97f2 100644 --- a/goodies/source/filter.vcl/eps/eps.cxx +++ b/goodies/source/filter.vcl/eps/eps.cxx @@ -46,7 +46,7 @@ #include <vcl/msgbox.hxx> #include <vcl/cvtgrf.hxx> #include <vcl/gradient.hxx> -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #include <svtools/fltcall.hxx> #include <svtools/FilterConfigItem.hxx> #include <vcl/graphictools.hxx> @@ -388,7 +388,7 @@ BOOL PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter bTextFillColor = TRUE; aTextFillColor = Color( COL_BLACK ); fLineWidth = 1; - fMiterLimit = 10; + fMiterLimit = 15; // use same limit as most graphic systems and basegfx eLineCap = SvtGraphicStroke::capButt; eJoinType = SvtGraphicStroke::joinMiter; aBackgroundColor = Color( COL_WHITE ); @@ -701,7 +701,40 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev ) Polygon aPoly( ( (const MetaPolyLineAction*) pMA )->GetPolygon() ); const LineInfo& rLineInfo = ( ( const MetaPolyLineAction*)pMA )->GetLineInfo(); ImplWriteLineInfo( rLineInfo ); - ImplPolyLine( aPoly ); + + if(basegfx::B2DLINEJOIN_NONE == rLineInfo.GetLineJoin() + && rLineInfo.GetWidth() > 1) + { + // emulate B2DLINEJOIN_NONE by creating single edges + const sal_uInt16 nPoints(aPoly.GetSize()); + const bool bCurve(aPoly.HasFlags()); + + for(sal_uInt16 a(0); a + 1 < nPoints; a++) + { + if(bCurve + && POLY_NORMAL != aPoly.GetFlags(a + 1) + && a + 2 < nPoints + && POLY_NORMAL != aPoly.GetFlags(a + 2) + && a + 3 < nPoints) + { + const Polygon aSnippet(4, + aPoly.GetConstPointAry() + a, + aPoly.GetConstFlagAry() + a); + ImplPolyLine(aSnippet); + a += 2; + } + else + { + const Polygon aSnippet(2, + aPoly.GetConstPointAry() + a); + ImplPolyLine(aSnippet); + } + } + } + else + { + ImplPolyLine( aPoly ); + } } break; @@ -2343,8 +2376,28 @@ void PSWriter::ImplWriteLineInfo( const LineInfo& rLineInfo ) SvtGraphicStroke::DashArray l_aDashArray; if ( rLineInfo.GetStyle() == LINE_DASH ) l_aDashArray.push_back( 2 ); - double fLWidth = ( ( rLineInfo.GetWidth() + 1 ) + ( rLineInfo.GetWidth() + 1 ) ) * 0.5; - ImplWriteLineInfo( fLWidth, 10.0, SvtGraphicStroke::capButt, SvtGraphicStroke::joinMiter, l_aDashArray ); + const double fLWidth(( ( rLineInfo.GetWidth() + 1 ) + ( rLineInfo.GetWidth() + 1 ) ) * 0.5); + SvtGraphicStroke::JoinType aJoinType(SvtGraphicStroke::joinMiter); + + switch(rLineInfo.GetLineJoin()) + { + default: // B2DLINEJOIN_NONE, B2DLINEJOIN_MIDDLE + // do NOT use SvtGraphicStroke::joinNone here + // since it will be written as numerical value directly + // and is NOT a valid EPS value + break; + case basegfx::B2DLINEJOIN_MITER: + aJoinType = SvtGraphicStroke::joinMiter; + break; + case basegfx::B2DLINEJOIN_BEVEL: + aJoinType = SvtGraphicStroke::joinBevel; + break; + case basegfx::B2DLINEJOIN_ROUND: + aJoinType = SvtGraphicStroke::joinRound; + break; + } + + ImplWriteLineInfo( fLWidth, fMiterLimit, SvtGraphicStroke::capButt, aJoinType, l_aDashArray ); } //--------------------------------------------------------------------------------- diff --git a/goodies/source/filter.vcl/etiff/etiff.cxx b/goodies/source/filter.vcl/etiff/etiff.cxx index 12289cb8f0a9..3cdec42d0978 100644 --- a/goodies/source/filter.vcl/etiff/etiff.cxx +++ b/goodies/source/filter.vcl/etiff/etiff.cxx @@ -35,7 +35,7 @@ #include <vcl/svapp.hxx> #include <vcl/msgbox.hxx> #include <vcl/bmpacc.hxx> -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #include <svtools/fltcall.hxx> #include <svtools/FilterConfigItem.hxx> diff --git a/goodies/source/filter.vcl/ieps/ieps.cxx b/goodies/source/filter.vcl/ieps/ieps.cxx index f315ee864310..7f1ecfc65bd0 100644 --- a/goodies/source/filter.vcl/ieps/ieps.cxx +++ b/goodies/source/filter.vcl/ieps/ieps.cxx @@ -164,12 +164,54 @@ static void MakeAsMeta(Graphic &rGraphic) rGraphic = aMtf; } +static oslProcessError runProcessWithPathSearch(const rtl::OUString &rProgName, + rtl_uString* pArgs[], sal_uInt32 nArgs, oslProcess *pProcess, + oslFileHandle *pIn, oslFileHandle *pOut, oslFileHandle *pErr) +{ +#ifdef WNT + /* + * ooo#72096 + * On Window the underlying SearchPath searches in order of... + * The directory from which the application loaded. + * The current directory. + * The Windows system directory. + * The Windows directory. + * The directories that are listed in the PATH environment variable. + * + * Because one of our programs is called "convert" and there is a convert + * in the windows system directory, we want to explicitly search the PATH + * to avoid picking up on that one if ImageMagick's convert preceeds it in + * PATH. + * + */ + rtl::OUString url; + rtl::OUString path(_wgetenv(L"PATH")); + + oslFileError err = osl_searchFileURL(rProgName.pData, path.pData, &url.pData); + if (err != osl_File_E_None) + return osl_Process_E_NotFound; + return osl_executeProcess_WithRedirectedIO(url.pData, + pArgs, nArgs, osl_Process_HIDDEN, + osl_getCurrentSecurity(), 0, 0, 0, pProcess, pIn, pOut, pErr); +#else + return osl_executeProcess_WithRedirectedIO(rProgName.pData, + pArgs, nArgs, osl_Process_SEARCHPATH | osl_Process_HIDDEN, + osl_getCurrentSecurity(), 0, 0, 0, pProcess, pIn, pOut, pErr); +#endif +} + +#if defined(WNT) || defined(OS2) +# define EXESUFFIX ".exe" +#else +# define EXESUFFIX "" +#endif + static bool RenderAsEMF(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &rGraphic) { TempFile aTemp; aTemp.EnableKillingFile(); rtl::OUString fileName = - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pstoedit")); + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pstoedit"EXESUFFIX)); rtl::OUString arg1 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-f")); rtl::OUString arg2 = @@ -186,10 +228,10 @@ static bool RenderAsEMF(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &r oslFileHandle pIn = NULL; oslFileHandle pOut = NULL; oslFileHandle pErr = NULL; - oslProcessError eErr = osl_executeProcess_WithRedirectedIO(fileName.pData, - args, sizeof(args)/sizeof(rtl_uString *), - osl_Process_SEARCHPATH | osl_Process_HIDDEN, - osl_getCurrentSecurity(), 0, 0, 0, &aProcess, &pIn, &pOut, &pErr); + oslProcessError eErr = runProcessWithPathSearch(fileName, + args, sizeof(args)/sizeof(rtl_uString *), + &aProcess, &pIn, &pOut, &pErr); + if (eErr!=osl_Process_E_None) return false; @@ -222,15 +264,15 @@ static bool RenderAsEMF(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &r } static bool RenderAsPNGThroughHelper(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, - Graphic &rGraphic, rtl::OUString &rProgName, rtl_uString **pArgs, size_t nArgs) + Graphic &rGraphic, rtl::OUString &rProgName, rtl_uString *pArgs[], size_t nArgs) { oslProcess aProcess; oslFileHandle pIn = NULL; oslFileHandle pOut = NULL; oslFileHandle pErr = NULL; - oslProcessError eErr = osl_executeProcess_WithRedirectedIO(rProgName.pData, - pArgs, nArgs, osl_Process_SEARCHPATH | osl_Process_HIDDEN, - osl_getCurrentSecurity(), 0, 0, 0, &aProcess, &pIn, &pOut, &pErr); + oslProcessError eErr = runProcessWithPathSearch(rProgName, + pArgs, nArgs, + &aProcess, &pIn, &pOut, &pErr); if (eErr!=osl_Process_E_None) return false; @@ -251,7 +293,7 @@ static bool RenderAsPNGThroughHelper(const sal_uInt8* pBuf, sal_uInt32 nBytesRea aMemStm.Seek(0); if ( - eFileErr == osl_File_E_None && + aMemStm.GetEndOfData() && GraphicConverter::Import(aMemStm, rGraphic, CVT_PNG) == ERRCODE_NONE ) { @@ -270,7 +312,7 @@ static bool RenderAsPNGThroughConvert(const sal_uInt8* pBuf, sal_uInt32 nBytesRe Graphic &rGraphic) { rtl::OUString fileName = - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("convert")); + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("convert"EXESUFFIX)); // density in pixel/inch rtl::OUString arg1 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-density")); // since the preview is also used for PDF-Export & printing on non-PS-printers, @@ -293,10 +335,10 @@ static bool RenderAsPNGThroughGS(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, { #ifdef WNT rtl::OUString fileName = - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gswin32c")); + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gswin32c"EXESUFFIX)); #else rtl::OUString fileName = - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gs")); + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gs"EXESUFFIX)); #endif rtl::OUString arg1 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-q")); diff --git a/goodies/source/filter.vcl/ios2met/ios2met.cxx b/goodies/source/filter.vcl/ios2met/ios2met.cxx index 0fbf24f56029..8c3c19e22379 100644 --- a/goodies/source/filter.vcl/ios2met/ios2met.cxx +++ b/goodies/source/filter.vcl/ios2met/ios2met.cxx @@ -846,7 +846,7 @@ void OS2METReader::ReadRelLine(BOOL bGivenPos, USHORT nOrderLen) if (nPolySize==0) return; Polygon aPolygon(nPolySize); for (i=0; i<nPolySize; i++) { -#if (defined SOLARIS && defined PPC) || defined IRIX +#if defined SOLARIS && defined PPC UINT8 nunsignedbyte; *pOS2MET >> nunsignedbyte; aP0.X()+=(INT8)nunsignedbyte; *pOS2MET >> nunsignedbyte; aP0.Y()+=(INT8)nunsignedbyte; diff --git a/goodies/source/filter.vcl/ipcd/ipcd.cxx b/goodies/source/filter.vcl/ipcd/ipcd.cxx index f70d1c8b84c5..f7a5f3652cbf 100644 --- a/goodies/source/filter.vcl/ipcd/ipcd.cxx +++ b/goodies/source/filter.vcl/ipcd/ipcd.cxx @@ -36,7 +36,7 @@ #include <vcl/bmpacc.hxx> #include <vcl/svapp.hxx> #include <svtools/fltcall.hxx> -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #include <svtools/FilterConfigItem.hxx> //============================ PCDReader ================================== diff --git a/goodies/source/graphic/grfcache.cxx b/goodies/source/graphic/grfcache.cxx index 1a2af16ed741..f0a41ceca53f 100644 --- a/goodies/source/graphic/grfcache.cxx +++ b/goodies/source/graphic/grfcache.cxx @@ -37,6 +37,8 @@ #include <tools/poly.hxx> #include "grfcache.hxx" +#include <memory> + // ----------- // - Defines - // ----------- @@ -612,7 +614,12 @@ void GraphicCache::AddGraphicObject( const GraphicObject& rObj, Graphic& rSubsti if( !bInserted ) { GraphicCacheEntry* pEntry = static_cast< GraphicCacheEntry* >( maGraphicCache.First() ); - const GraphicID aID( rObj ); + ::std::auto_ptr< GraphicID > apID; + + if( !pID ) + { + apID.reset( new GraphicID( rObj ) ); + } while( !bInserted && pEntry ) { @@ -647,10 +654,13 @@ void GraphicCache::AddGraphicObject( const GraphicObject& rObj, Graphic& rSubsti } } } - else if( rEntryID == aID ) + else { - pEntry->AddGraphicObjectReference( rObj, rSubstitute ); - bInserted = TRUE; + if( rEntryID == *apID ) + { + pEntry->AddGraphicObjectReference( rObj, rSubstitute ); + bInserted = TRUE; + } } if( !bInserted ) diff --git a/goodies/source/graphic/grfmgr.cxx b/goodies/source/graphic/grfmgr.cxx index 5cb37a51e81f..7f5970383075 100644 --- a/goodies/source/graphic/grfmgr.cxx +++ b/goodies/source/graphic/grfmgr.cxx @@ -44,7 +44,7 @@ #include <vcl/metaact.hxx> #include <vcl/virdev.hxx> #include <vcl/salbtype.hxx> -#include <svtools/cacheoptions.hxx> +#include <unotools/cacheoptions.hxx> #include "grfmgr.hxx" // ----------- @@ -845,7 +845,7 @@ const Graphic& GraphicObject::GetGraphic() const // ----------------------------------------------------------------------------- -void GraphicObject::SetGraphic( const Graphic& rGraphic ) +void GraphicObject::SetGraphic( const Graphic& rGraphic, const GraphicObject* pCopyObj ) { mpMgr->ImplUnregisterObj( *this ); @@ -858,7 +858,7 @@ void GraphicObject::SetGraphic( const Graphic& rGraphic ) delete mpLink, mpLink = NULL; delete mpSimpleCache, mpSimpleCache = NULL; - mpMgr->ImplRegisterObj( *this, maGraphic ); + mpMgr->ImplRegisterObj( *this, maGraphic, 0, pCopyObj); if( mpSwapOutTimer ) mpSwapOutTimer->Start(); diff --git a/goodies/source/inv/invader.cxx b/goodies/source/inv/invader.cxx index be15ff2e75d4..0aed6e76848f 100644 --- a/goodies/source/inv/invader.cxx +++ b/goodies/source/inv/invader.cxx @@ -37,7 +37,7 @@ #include "invader.hrc" #include "strings.hrc" #include "score.hxx" -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #include <cppuhelper/servicefactory.hxx> #include <comphelper/processfactory.hxx> #include <vcl/msgbox.hxx> diff --git a/goodies/source/unographic/descriptor.cxx b/goodies/source/unographic/descriptor.cxx index e75b008cfb69..c19318d6e11e 100644 --- a/goodies/source/unographic/descriptor.cxx +++ b/goodies/source/unographic/descriptor.cxx @@ -37,7 +37,7 @@ #include <vos/mutex.hxx> #include <unotools/ucbstreamhelper.hxx> #include <svtools/filter.hxx> -#include <svtools/itemprop.hxx> +#include <svl/itemprop.hxx> #ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATE_HDL_ #include <com/sun/star/beans/PropertyState.hpp> diff --git a/goodies/source/unographic/provider.cxx b/goodies/source/unographic/provider.cxx index 2eb0aede9bdf..1f7de99d4473 100644 --- a/goodies/source/unographic/provider.cxx +++ b/goodies/source/unographic/provider.cxx @@ -46,7 +46,7 @@ #include <tools/resmgr.hxx> #include <unotools/ucbstreamhelper.hxx> #include <svtools/filter.hxx> -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #include <vcl/salbtype.hxx> #include <vcl/virdev.hxx> #include <com/sun/star/io/XStream.hpp> diff --git a/goodies/source/unographic/renderer.cxx b/goodies/source/unographic/renderer.cxx index 78f006cc69be..d280ed832999 100644 --- a/goodies/source/unographic/renderer.cxx +++ b/goodies/source/unographic/renderer.cxx @@ -48,7 +48,7 @@ #include <toolkit/helper/vclunohelper.hxx> #include <comphelper/propertysetinfo.hxx> -#include <svtools/itemprop.hxx> +#include <svl/itemprop.hxx> #include "grfmgr.hxx" #include "graphic.hxx" #include "renderer.hxx" diff --git a/goodies/source/unographic/transformer.cxx b/goodies/source/unographic/transformer.cxx index 4422d161d7c4..7e18c10cdd41 100644 --- a/goodies/source/unographic/transformer.cxx +++ b/goodies/source/unographic/transformer.cxx @@ -43,7 +43,7 @@ #include <tools/resid.hxx> #include <tools/resmgr.hxx> #include <unotools/ucbstreamhelper.hxx> -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #include <vcl/salbtype.hxx> #include <vcl/virdev.hxx> #include <vcl/bmpacc.hxx> diff --git a/i18npool/source/characterclassification/cclass_unicode_parser.cxx b/i18npool/source/characterclassification/cclass_unicode_parser.cxx index 27d6443a27fc..39e925cb7eb9 100644 --- a/i18npool/source/characterclassification/cclass_unicode_parser.cxx +++ b/i18npool/source/characterclassification/cclass_unicode_parser.cxx @@ -1038,7 +1038,7 @@ void cclass_Unicode::parseText( ParseResult& r, const OUString& rText, sal_Int32 if ( !xNatNumSup.is() ) { throw RuntimeException( OUString( -#ifndef PRODUCT +#ifdef DBG_UTIL RTL_CONSTASCII_USTRINGPARAM( "cclass_Unicode::parseText: can't instanciate " NATIVENUMBERSUPPLIER_SERVICENAME ) diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index 9126162d6f36..91d856b19e62 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -39,11 +39,6 @@ #include <stdio.h> #include <string.h> -#if OSL_DEBUG_LEVEL == 0 && !defined(NDEBUG) -#define NDEBUG -#endif -#include <assert.h> - // Cyrillic upper case #define C_CYR_A "\xD0\x90" #define C_CYR_B "\xD0\x91" @@ -277,7 +272,7 @@ const char* expected_name( int i, int last ) else if( i==1 ) return "NumberingType"; else if( i==2 ) return "Suffix"; else if( i==last ) return "Value"; - else { assert(0); return ""; } + else { OSL_ASSERT(0); return ""; } } static const char* expected_type( int i, int last ) @@ -287,7 +282,7 @@ const char* expected_type( int i, int last ) else if( i==1 ) return "sal_Int16"; else if( i==2 ) return "OUString"; else if( i==last ) return "sal_Int32"; - else { assert(0); return ""; } + else { OSL_ASSERT(0); return ""; } } static void failedToConvert( int i, int last ) @@ -461,7 +456,7 @@ DefaultNumberingProvider::makeNumberingString( const Sequence<beans::PropertyVal return OUString::createFromAscii(""); // ignore prefix and suffix case PAGE_DESCRIPTOR: case BITMAP: - assert(0); + OSL_ASSERT(0); throw IllegalArgumentException(); case CHARS_UPPER_LETTER_N: lcl_formatChars1( upperLetter, 26, number-1, result ); // 1=>A, 2=>B, ..., 26=>Z, 27=>AA, 28=>BB, ... @@ -480,7 +475,7 @@ DefaultNumberingProvider::makeNumberingString( const Sequence<beans::PropertyVal } catch (Exception& ) { // When translteration property is missing, return default number (bug #101141#) result += OUString::valueOf( number ); - // assert(0); + // OSL_ASSERT(0); // throw IllegalArgumentException(); } break; @@ -674,7 +669,7 @@ DefaultNumberingProvider::makeNumberingString( const Sequence<beans::PropertyVal break; default: - assert(0); + OSL_ASSERT(0); throw IllegalArgumentException(); } diff --git a/i18npool/source/isolang/inwnt.cxx b/i18npool/source/isolang/inwnt.cxx index 7d5e4d3216e7..2550eb3acd10 100644 --- a/i18npool/source/isolang/inwnt.cxx +++ b/i18npool/source/isolang/inwnt.cxx @@ -104,11 +104,7 @@ LanguageType MsLangId::getPlatformSystemUILanguage() { // TODO: this could be distinguished, #if(WINVER >= 0x0500) // needs _run_ time differentiation though, not at compile time. -#if 0 getPlatformSystemLanguageImpl( nImplSystemUILanguage, &GetUserDefaultUILanguage, &GetSystemDefaultUILanguage); -#endif - getPlatformSystemLanguageImpl( nImplSystemUILanguage, - &GetUserDefaultLangID, &GetSystemDefaultLangID); return nImplSystemUILanguage; } diff --git a/i18npool/source/isolang/mslangid.cxx b/i18npool/source/isolang/mslangid.cxx index 3476341fbc79..aab92d717429 100644 --- a/i18npool/source/isolang/mslangid.cxx +++ b/i18npool/source/isolang/mslangid.cxx @@ -154,7 +154,7 @@ LanguageType MsLangId::resolveSystemLanguageByScriptType( LanguageType nLang, sa if (nConfiguredAsianFallback == LANGUAGE_SYSTEM) nLang = LANGUAGE_CHINESE_SIMPLIFIED; else - nLang = nConfiguredComplexFallback; + nLang = nConfiguredAsianFallback; break; case ::com::sun::star::i18n::ScriptType::COMPLEX: if (nConfiguredComplexFallback == LANGUAGE_SYSTEM) diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index 083fbc548c8c..e119e71ec14c 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -38,13 +38,6 @@ #include <stdio.h> #include "rtl/instance.hxx" -#if OSL_DEBUG_LEVEL == 0 -# ifndef NDEBUG -# define NDEBUG -# endif -#endif -#include <assert.h> - using namespace com::sun::star::i18n; using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -1136,7 +1129,7 @@ LocaleData::getContinuousNumberingLevels( const lang::Locale& rLocale ) throw(Ru rVal.Value <<= (sal_Int16) sVal.toInt32(); break; default: - assert(0); + OSL_ASSERT(0); } } } @@ -1260,7 +1253,7 @@ LocaleData::getOutlineNumberingLevels( const lang::Locale& rLocale ) throw(Runti case 10: level[j].sTransliteration = tmp; break; case 11: level[j].nNatNum = tmp.toInt32(); break; default: - assert(0); + OSL_ASSERT(0); } } } diff --git a/i18npool/source/search/makefile.mk b/i18npool/source/search/makefile.mk index 1b48919624f6..2e81ec3f1d53 100644 --- a/i18npool/source/search/makefile.mk +++ b/i18npool/source/search/makefile.mk @@ -50,6 +50,12 @@ SLOFILES= \ $(EXCEPTIONSFILES) \ $(SLO)$/levdis.obj +# on unxsoli, no optimization for textsearch because of i105945 +.IF "$(OS)$(COM)$(CPUNAME)"=="SOLARISC52INTEL" +EXCEPTIONSNOOPTFILES= \ + $(SLO)$/textsearch.obj +.ENDIF + SHL1TARGET= $(TARGET) SHL1OBJS= $(SLOFILES) diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx index 96f033f4e4e3..2518a6cb0481 100644 --- a/i18npool/source/search/textsearch.cxx +++ b/i18npool/source/search/textsearch.cxx @@ -562,6 +562,7 @@ sal_Int32 TextSearch::GetDiff( const sal_Unicode cChr ) const } +// TextSearch::NSrchFrwrd is mis-optimized on unxsoli (#i105945#) SearchResult TextSearch::NSrchFrwrd( const OUString& searchStr, sal_Int32 startPos, sal_Int32 endPos ) throw(RuntimeException) { diff --git a/i18npool/source/textconversion/genconv_dict.cxx b/i18npool/source/textconversion/genconv_dict.cxx index 23a264603df9..a49bf3031bbc 100644 --- a/i18npool/source/textconversion/genconv_dict.cxx +++ b/i18npool/source/textconversion/genconv_dict.cxx @@ -39,6 +39,8 @@ #include <rtl/strbuf.hxx> #include <rtl/ustring.hxx> +#include <vector> + using namespace ::rtl; void make_hhc_char(FILE *sfp, FILE *cfp); @@ -357,8 +359,8 @@ void make_stc_word(FILE *sfp, FILE *cfp) { sal_Int32 count, i, length; sal_Unicode STC_WordData[0x10000]; - Index *STC_WordEntry_S2T = (Index*) malloc(0x10000 * sizeof(Index)); - Index *STC_WordEntry_T2S = (Index*) malloc(0x10000 * sizeof(Index)); + std::vector<Index> STC_WordEntry_S2T(0x10000); + std::vector<Index> STC_WordEntry_T2S(0x10000); sal_Int32 count_S2T = 0, count_T2S = 0; sal_Int32 line = 0, char_total = 0; sal_Char Cstr[1024]; @@ -416,7 +418,7 @@ void make_stc_word(FILE *sfp, FILE *cfp) sal_uInt16 STC_WordIndex[0x100]; if (count_S2T > 0) { - qsort(STC_WordEntry_S2T, count_S2T, sizeof(Index), Index_comp); + qsort(&STC_WordEntry_S2T[0], count_S2T, sizeof(Index), Index_comp); fprintf(cfp, "\nstatic const sal_uInt16 STC_WordEntry_S2T[] = {"); count = 0; @@ -449,7 +451,7 @@ void make_stc_word(FILE *sfp, FILE *cfp) } if (count_T2S > 0) { - qsort(STC_WordEntry_T2S, count_T2S, sizeof(Index), Index_comp); + qsort(&STC_WordEntry_T2S[0], count_T2S, sizeof(Index), Index_comp); fprintf(cfp, "\nstatic const sal_uInt16 STC_WordEntry_T2S[] = {"); count = 0; @@ -480,7 +482,5 @@ void make_stc_word(FILE *sfp, FILE *cfp) fprintf (cfp, "\tconst sal_uInt16* getSTC_WordEntry_T2S() { return NULL; }\n"); fprintf (cfp, "\tconst sal_uInt16* getSTC_WordIndex_T2S(sal_Int32& count) { count = 0; return NULL; }\n"); } - free(STC_WordEntry_S2T); - free(STC_WordEntry_T2S); } diff --git a/o3tl/qa/makefile.mk b/o3tl/qa/makefile.mk index 70fe224cf6a9..b592790516da 100644 --- a/o3tl/qa/makefile.mk +++ b/o3tl/qa/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # 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 @@ -51,6 +51,7 @@ SHL1OBJS= \ SHL1TARGET= tests SHL1STDLIBS= $(SALLIB) \ + $(TESTSHL2LIB)\ $(CPPUNITLIB) SHL1IMPLIB= i$(SHL1TARGET) diff --git a/o3tl/qa/test-cow_wrapper.cxx b/o3tl/qa/test-cow_wrapper.cxx index 6bb169e951a4..eebbb633f82b 100644 --- a/o3tl/qa/test-cow_wrapper.cxx +++ b/o3tl/qa/test-cow_wrapper.cxx @@ -1,6 +1,6 @@ // autogenerated file with codegen.pl -#include <cppunit/simpleheader.hxx> +#include <testshl/simpleheader.hxx> #include "cow_wrapper_clients.hxx" diff --git a/o3tl/qa/test-heap_ptr.cxx b/o3tl/qa/test-heap_ptr.cxx index 5e247a8b9abc..25f2209c94f5 100644 --- a/o3tl/qa/test-heap_ptr.cxx +++ b/o3tl/qa/test-heap_ptr.cxx @@ -28,7 +28,7 @@ * ************************************************************************/ -#include <cppunit/simpleheader.hxx> +#include <testshl/simpleheader.hxx> #include <o3tl/heap_ptr.hxx> diff --git a/o3tl/qa/test-range.cxx b/o3tl/qa/test-range.cxx index 626d9b6e3a90..fa956db96005 100644 --- a/o3tl/qa/test-range.cxx +++ b/o3tl/qa/test-range.cxx @@ -29,7 +29,7 @@ ************************************************************************/ -#include <cppunit/simpleheader.hxx> +#include <testshl/simpleheader.hxx> #include <o3tl/range.hxx> #include <vector> diff --git a/padmin/source/adddlg.cxx b/padmin/source/adddlg.cxx index 052de2cbb731..58c37dcffa83 100644 --- a/padmin/source/adddlg.cxx +++ b/padmin/source/adddlg.cxx @@ -807,7 +807,7 @@ AddPrinterDialog::~AddPrinterDialog() void AddPrinterDialog::updateSettings() { - if( ! GetDisplayBackground().GetColor().IsDark() ) + if( ! GetSettings().GetStyleSettings().GetHighContrastMode() ) m_aTitleImage.SetImage( Image( BitmapEx( PaResId( RID_BMP_PRINTER ) ) ) ); else m_aTitleImage.SetImage( Image( BitmapEx( PaResId( RID_BMP_PRINTER_HC ) ) ) ); diff --git a/padmin/source/cmddlg.cxx b/padmin/source/cmddlg.cxx index 9aa65c8ce204..c6daf547369c 100644 --- a/padmin/source/cmddlg.cxx +++ b/padmin/source/cmddlg.cxx @@ -79,20 +79,22 @@ void CommandStore::getSystemPdfCommands( ::std::list< String >& rCommands ) pPipe = popen( "which gs 2>/dev/null", "r" ); if( pPipe ) { - fgets( pBuffer, sizeof( pBuffer ), pPipe ); - int nLen = strlen( pBuffer ); - if( pBuffer[nLen-1] == '\n' ) // strip newline - pBuffer[--nLen] = 0; - aCommand = String( ByteString( pBuffer ), aEncoding ); - if( ( ( aCommand.GetChar( 0 ) == '/' ) - || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' ) - || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) ) - && nLen > 2 - && aCommand.GetChar( nLen-2 ) == 'g' - && aCommand.GetChar( nLen-1 ) == 's' ) + if (fgets( pBuffer, sizeof( pBuffer ), pPipe ) != NULL) { - aCommand.AppendAscii( " -q -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=\"(OUTFILE)\" -" ); - aSysCommands.push_back( aCommand ); + int nLen = strlen( pBuffer ); + if( pBuffer[nLen-1] == '\n' ) // strip newline + pBuffer[--nLen] = 0; + aCommand = String( ByteString( pBuffer ), aEncoding ); + if( ( ( aCommand.GetChar( 0 ) == '/' ) + || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' ) + || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) ) + && nLen > 2 + && aCommand.GetChar( nLen-2 ) == 'g' + && aCommand.GetChar( nLen-1 ) == 's' ) + { + aCommand.AppendAscii( " -q -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=\"(OUTFILE)\" -" ); + aSysCommands.push_back( aCommand ); + } } pclose( pPipe ); } @@ -100,19 +102,21 @@ void CommandStore::getSystemPdfCommands( ::std::list< String >& rCommands ) pPipe = popen( "which distill 2>/dev/null", "r" ); if( pPipe ) { - fgets( pBuffer, sizeof( pBuffer ), pPipe ); - int nLen = strlen( pBuffer ); - if( pBuffer[nLen-1] == '\n' ) // strip newline - pBuffer[--nLen] = 0; - aCommand = String( ByteString( pBuffer ), aEncoding ); - if( ( ( aCommand.GetChar( 0 ) == '/' ) - || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' ) - || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) ) - && nLen > 7 - && aCommand.Copy( nLen - 8 ).EqualsAscii( "/distill" ) ) + if (fgets( pBuffer, sizeof( pBuffer ), pPipe ) != NULL) { - aCommand.AppendAscii( " (TMP) ; mv `echo (TMP) | sed s/\\.ps\\$/.pdf/` \"(OUTFILE)\"" ); - aSysCommands.push_back( aCommand ); + int nLen = strlen( pBuffer ); + if( pBuffer[nLen-1] == '\n' ) // strip newline + pBuffer[--nLen] = 0; + aCommand = String( ByteString( pBuffer ), aEncoding ); + if( ( ( aCommand.GetChar( 0 ) == '/' ) + || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '/' ) + || ( aCommand.GetChar( 0 ) == '.' && aCommand.GetChar( 1 ) == '.' && aCommand.GetChar( 2 ) == '/' ) ) + && nLen > 7 + && aCommand.Copy( nLen - 8 ).EqualsAscii( "/distill" ) ) + { + aCommand.AppendAscii( " (TMP) ; mv `echo (TMP) | sed s/\\.ps\\$/.pdf/` \"(OUTFILE)\"" ); + aSysCommands.push_back( aCommand ); + } } pclose( pPipe ); } diff --git a/padmin/source/padialog.cxx b/padmin/source/padialog.cxx index 5b49409a1c8a..5a6a1d0e319e 100644 --- a/padmin/source/padialog.cxx +++ b/padmin/source/padialog.cxx @@ -60,11 +60,16 @@ #include "unotools/localedatawrapper.hxx" #include "unotools/configitem.hxx" #include "unotools/configmgr.hxx" + +#include "com/sun/star/awt/Size.hpp" + using namespace psp; using namespace rtl; using namespace padmin; using namespace osl; +using namespace com::sun::star; using namespace com::sun::star::uno; +using namespace com::sun::star::beans; PADialog* PADialog::Create( Window* pParent, BOOL bAdmin ) { @@ -96,7 +101,6 @@ PADialog::PADialog( Window* pParent, BOOL /*bAdmin*/ ) : m_aCancelButton( this, PaResId( RID_PA_BTN_CANCEL ) ), m_aDefPrt( PaResId( RID_PA_STR_DEFPRT ) ), m_aRenameStr( PaResId( RID_PA_STR_RENAME ) ), - m_pPrinter( 0 ), m_rPIManager( PrinterInfoManager::get() ) { FreeResource(); @@ -106,7 +110,7 @@ PADialog::PADialog( Window* pParent, BOOL /*bAdmin*/ ) : void PADialog::updateSettings() { - if( ! GetDisplayBackground().GetColor().IsDark() ) + if( ! GetSettings().GetStyleSettings().GetHighContrastMode() ) { m_aPrinterImg = Image( BitmapEx( PaResId( RID_BMP_SMALL_PRINTER ) ) ); m_aFaxImg = Image( BitmapEx( PaResId( RID_BMP_SMALL_FAX ) ) ); @@ -248,18 +252,6 @@ IMPL_LINK( PADialog, SelectHdl, ListBox*, pListBox ) return 0; } -IMPL_LINK( PADialog, EndPrintHdl, void*, EMPTYARG ) -{ - String aInfoString( PaResId( RID_PA_TXT_TESTPAGE_PRINTED ) ); - InfoBox aInfoBox( this, aInfoString ); - aInfoBox.SetText( String( PaResId( RID_BXT_TESTPAGE ) ) ); - aInfoBox.Execute(); - - delete m_pPrinter; - m_pPrinter = NULL; - return 0; -} - void PADialog::UpdateDefPrt() { m_rPIManager.setDefaultPrinter( getSelectedDevice() ); @@ -369,66 +361,77 @@ static Color approachColor( const Color& rFrom, const Color& rTo ) return aColor; } -#define DELTA 5.0 -void PADialog::PrintTestPage() +class SpaPrinterController : public vcl::PrinterController { - if( m_pPrinter ) // already printing; user pressed button twice - return; +public: + SpaPrinterController( const boost::shared_ptr<Printer>& i_pPrinter ) + : vcl::PrinterController( i_pPrinter ) + {} + virtual ~SpaPrinterController() + {} + + virtual int getPageCount() const { return 1; } + virtual Sequence< PropertyValue > getPageParameters( int i_nPage ) const; + virtual void printPage( int i_nPage ) const; + virtual void jobFinished( com::sun::star::view::PrintableState ); +}; + +Sequence< PropertyValue > SpaPrinterController::getPageParameters( int ) const +{ + Sequence< PropertyValue > aRet( 1 ); - String sPrinter( getSelectedDevice() ); + Size aPageSize( getPrinter()->GetPaperSizePixel() ); + aPageSize = getPrinter()->PixelToLogic( aPageSize, MapMode( MAP_100TH_MM ) ); + + awt::Size aSize; + aSize.Width = aPageSize.Width(); + aSize.Height = aPageSize.Height(); + aRet[0].Value = makeAny(aSize); - m_pPrinter = new Printer( sPrinter ); + return aRet; +} - PrinterInfo aInfo( m_rPIManager.getPrinterInfo( sPrinter ) ); +void SpaPrinterController::printPage( int ) const +{ + const double DELTA = 5.0; + + boost::shared_ptr<Printer> pPrinter( getPrinter() ); + + PrinterInfo aInfo( psp::PrinterInfoManager::get().getPrinterInfo( pPrinter->GetName() ) ); const PPDParser* pPrintParser = aInfo.m_pParser; MapMode aMapMode( MAP_100TH_MM ); Bitmap aButterfly( PaResId( RID_BUTTERFLY ) ); - m_pPrinter->SetMapMode( aMapMode ); - m_pPrinter->SetEndPrintHdl( LINK( this, PADialog, EndPrintHdl ) ); + pPrinter->SetMapMode( aMapMode ); Any aRet = utl::ConfigManager::GetDirectConfigProperty( utl::ConfigManager::PRODUCTNAME ); OUString aJobName; aRet >>= aJobName; aJobName = aJobName + OUString( RTL_CONSTASCII_USTRINGPARAM( " Testpage" ) ); - if( m_pPrinter->GetName() != sPrinter || ! m_pPrinter->StartJob( aJobName ) ) - { - String aString( PaResId( RID_ERR_NOPRINTER ) ); - aString.SearchAndReplaceAscii( "%s", sPrinter ); - ErrorBox aErrorBox( this, WB_OK | WB_DEF_OK, aString ); - aErrorBox.SetText( String( PaResId( RID_BXT_ENVIRONMENT ) ) ); - aErrorBox.Execute(); - delete m_pPrinter; - m_pPrinter = 0; - return; - } - m_pPrinter->StartPage(); - - Size aPaperSize=m_pPrinter->GetOutputSize(); + Size aPaperSize=pPrinter->GetOutputSize(); Point aCenter( aPaperSize.Width()/2-300, aPaperSize.Height() - aPaperSize.Width()/2 ); Point aP1( aPaperSize.Width()/48, 0), aP2( aPaperSize.Width()/40, 0 ), aPoint; - m_pPrinter->DrawRect( Rectangle( Point( 0,0 ), aPaperSize ) ); - m_pPrinter->DrawRect( Rectangle( Point( 100,100 ), + pPrinter->DrawRect( Rectangle( Point( 0,0 ), aPaperSize ) ); + pPrinter->DrawRect( Rectangle( Point( 100,100 ), Size( aPaperSize.Width()-200, aPaperSize.Height()-200 ) ) ); - m_pPrinter->DrawRect( Rectangle( Point( 200,200 ), + pPrinter->DrawRect( Rectangle( Point( 200,200 ), Size( aPaperSize.Width()-400, aPaperSize.Height()-400 ) ) ); - m_pPrinter->DrawRect( Rectangle( Point( 300,300 ), + pPrinter->DrawRect( Rectangle( Point( 300,300 ), Size( aPaperSize.Width()-600, aPaperSize.Height()-600 ) ) ); - Font aFont( m_pPrinter->GetFont() ); - aFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM( "Courier" ) ) ); + Font aFont( String( RTL_CONSTASCII_USTRINGPARAM( "Courier" ) ), Size( 0, 400 ) ); aFont.SetWeight( WEIGHT_NORMAL ); aFont.SetItalic( ITALIC_NONE ); - m_pPrinter->SetFont( aFont ); + pPrinter->SetFont( aFont ); OUStringBuffer aPrintText(1024); long nWidth = 0, nMaxWidth = 0; @@ -455,12 +458,12 @@ void PADialog::PrintTestPage() aToken = String::CreateFromAscii( aResIds[i].pDirect ); else aToken = String( PaResId( aResIds[i].nResId ) ); - nMaxWidth = ( nWidth = m_pPrinter->GetTextWidth( aToken ) ) > nMaxWidth ? nWidth : nMaxWidth; + nMaxWidth = ( nWidth = pPrinter->GetTextWidth( aToken ) ) > nMaxWidth ? nWidth : nMaxWidth; aPrintText.append( aToken ); aPrintText.append( (sal_Unicode)'\n' ); }; - m_pPrinter->DrawText( Rectangle( Point( 1000, 2000 ), + pPrinter->DrawText( Rectangle( Point( 1000, 1000 ), Size( aPaperSize.Width() - 2000, aPaperSize.Height() - 4000 ) ), aPrintText.makeStringAndClear(), @@ -470,7 +473,7 @@ void PADialog::PrintTestPage() const LocaleDataWrapper& rLocaleWrapper( aSettings.GetLocaleDataWrapper() ); aPrintText.appendAscii( ": " ); - aPrintText.append( sPrinter ); + aPrintText.append( pPrinter->GetName() ); aPrintText.appendAscii( "\n: " ); if( pPrintParser ) aPrintText.append( pPrintParser->getPrinterName() ); @@ -487,17 +490,17 @@ void PADialog::PrintTestPage() aPrintText.appendAscii( "\n: " ); aPrintText.append( rLocaleWrapper.getTime( Time() ) ); - m_pPrinter->DrawText( Rectangle( Point( 1100 + nMaxWidth, 2000 ), + pPrinter->DrawText( Rectangle( Point( 1100 + nMaxWidth, 1000 ), Size( aPaperSize.Width() - 2100 - nMaxWidth, aPaperSize.Height() - 4000 ) ), aPrintText.makeStringAndClear(), TEXT_DRAW_MULTILINE ); - m_pPrinter->DrawBitmap( Point( aPaperSize.Width() - 4000, 1000 ), + pPrinter->DrawBitmap( Point( aPaperSize.Width() - 4000, 1000 ), Size( 3000,3000 ), aButterfly ); - m_pPrinter->SetFillColor(); - m_pPrinter->DrawRect( Rectangle( Point( aPaperSize.Width() - 4000, 1000 ), + pPrinter->SetFillColor(); + pPrinter->DrawRect( Rectangle( Point( aPaperSize.Width() - 4000, 1000 ), Size( 3000,3000 ) ) ); Color aWhite( 0xff, 0xff, 0xff ); @@ -511,22 +514,22 @@ void PADialog::PrintTestPage() Gradient aGradient( GRADIENT_LINEAR, aBlack, aWhite ); aGradient.SetAngle( 900 ); - m_pPrinter->DrawGradient( Rectangle( Point( 1000, 5500 ), + pPrinter->DrawGradient( Rectangle( Point( 1000, 5500 ), Size( aPaperSize.Width() - 2000, 500 ) ), aGradient ); aGradient.SetStartColor( aDarkRed ); aGradient.SetEndColor( aLightBlue ); - m_pPrinter->DrawGradient( Rectangle( Point( 1000, 6300 ), + pPrinter->DrawGradient( Rectangle( Point( 1000, 6300 ), Size( aPaperSize.Width() - 2000, 500 ) ), aGradient ); aGradient.SetStartColor( aDarkBlue ); aGradient.SetEndColor( aLightGreen ); - m_pPrinter->DrawGradient( Rectangle( Point( 1000, 7100 ), + pPrinter->DrawGradient( Rectangle( Point( 1000, 7100 ), Size( aPaperSize.Width() - 2000, 500 ) ), aGradient ); aGradient.SetStartColor( aDarkGreen ); aGradient.SetEndColor( aLightRed ); - m_pPrinter->DrawGradient( Rectangle( Point( 1000, 7900 ), + pPrinter->DrawGradient( Rectangle( Point( 1000, 7900 ), Size( aPaperSize.Width() - 2000, 500 ) ), aGradient ); @@ -543,7 +546,7 @@ void PADialog::PrintTestPage() { aLineInfo.SetWidth( n/3 ); aLineColor = approachColor( aLineColor, aApproachColor ); - m_pPrinter->SetLineColor( aLineColor ); + pPrinter->SetLineColor( aLineColor ); // switch aproach color if( aApproachColor.IsRGBEqual( aLineColor ) ) @@ -556,7 +559,7 @@ void PADialog::PrintTestPage() aApproachColor = Color( 0, 200, 0 ); } - m_pPrinter->DrawLine( project( aP1 ) + aCenter, + pPrinter->DrawLine( project( aP1 ) + aCenter, project( aP2 ) + aCenter, aLineInfo ); aPoint.X() = (int)((((double)aP1.X())*cosd - ((double)aP1.Y())*sind)*factor); @@ -569,8 +572,38 @@ void PADialog::PrintTestPage() #if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL fprintf( stderr, "%d lines\n",n ); #endif - m_pPrinter->EndPage(); - m_pPrinter->EndJob(); +} + +void SpaPrinterController::jobFinished( com::sun::star::view::PrintableState ) +{ + String aInfoString( PaResId( RID_PA_TXT_TESTPAGE_PRINTED ) ); + InfoBox aInfoBox( NULL, aInfoString ); + aInfoBox.SetText( String( PaResId( RID_BXT_TESTPAGE ) ) ); + aInfoBox.Execute(); +} + +void PADialog::PrintTestPage() +{ + String sPrinter( getSelectedDevice() ); + + boost::shared_ptr<Printer> pPrinter( new Printer( sPrinter ) ); + + if( pPrinter->GetName() != sPrinter ) + { + String aString( PaResId( RID_ERR_NOPRINTER ) ); + aString.SearchAndReplaceAscii( "%s", sPrinter ); + + ErrorBox aErrorBox( this, WB_OK | WB_DEF_OK, aString ); + aErrorBox.SetText( String( PaResId( RID_BXT_ENVIRONMENT ) ) ); + aErrorBox.Execute(); + return; + } + + boost::shared_ptr<vcl::PrinterController> pController( new SpaPrinterController( pPrinter ) ); + JobSetup aJobSetup( pPrinter->GetJobSetup() ); + aJobSetup.SetValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) ), + String( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) ); + Printer::PrintJob( pController, aJobSetup ); } void PADialog::AddDevice() diff --git a/padmin/source/padialog.hxx b/padmin/source/padialog.hxx index ac6ee8f4279f..0350f66a2905 100644 --- a/padmin/source/padialog.hxx +++ b/padmin/source/padialog.hxx @@ -83,7 +83,6 @@ namespace padmin { String m_aDefPrt; String m_aRenameStr; - Printer* m_pPrinter; ::psp::PrinterInfoManager& m_rPIManager; ::std::list< ::rtl::OUString > m_aPrinters; @@ -94,7 +93,6 @@ namespace padmin { DECL_LINK( ClickBtnHdl, PushButton* ); DECL_LINK( DoubleClickHdl, ListBox* ); DECL_LINK( SelectHdl, ListBox* ); - DECL_LINK( EndPrintHdl, void* ); DECL_LINK( DelPressedHdl, ListBox* ); PADialog( Window*, BOOL ); diff --git a/rsc/inc/rsctools.hxx b/rsc/inc/rsctools.hxx index eb9f8937b939..fd8e49135eb0 100644 --- a/rsc/inc/rsctools.hxx +++ b/rsc/inc/rsctools.hxx @@ -138,28 +138,41 @@ public: sal_uInt32 Size(){ return( nLen ); }; void Put( sal_uInt64 lVal ) { + union + { + sal_uInt64 lVal64; + sal_uInt32 aVal32[2]; + }; + lVal64 = lVal; if( bSwap ) { - Put( *(((sal_uInt32*)&lVal)+1) ); - Put( *(sal_uInt32*)&lVal ); + Put( aVal32[1] ); + Put( aVal32[0] ); } else { - Put( *(sal_uInt32*)&lVal ); - Put( *(((sal_uInt32*)&lVal)+1) ); + Put( aVal32[0] ); + Put( aVal32[1] ); } } void Put( sal_Int32 lVal ) { + union + { + sal_uInt32 lVal32; + sal_uInt16 aVal16[2]; + }; + lVal32 = lVal; + if( bSwap ) { - Put( *(((sal_uInt16*)&lVal) +1) ); - Put( *(sal_uInt16*)&lVal ); + Put( aVal16[1] ); + Put( aVal16[0] ); } else { - Put( *(sal_uInt16*)&lVal ); - Put( *(((sal_uInt16*)&lVal) +1) ); + Put( aVal16[0] ); + Put( aVal16[1] ); } } void Put( sal_uInt32 nValue ) @@ -171,15 +184,22 @@ public: void PutAt( sal_uInt32 nPos, INT32 lVal ) { + union + { + sal_uInt32 lVal32; + sal_uInt16 aVal16[2]; + }; + lVal32 = lVal; + if( bSwap ) { - PutAt( nPos, *(((sal_uInt16*)&lVal) +1) ); - PutAt( nPos + 2, *(sal_uInt16*)&lVal ); + PutAt( nPos, aVal16[1] ); + PutAt( nPos + 2, aVal16[0] ); } else { - PutAt( nPos, *(sal_uInt16*)&lVal ); - PutAt( nPos + 2, *(((sal_uInt16*)&lVal) +1) ); + PutAt( nPos, aVal16[0] ); + PutAt( nPos + 2, aVal16[1] ); } } void PutAt( sal_uInt32 nPos, sal_uInt32 lVal ) diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx index 9ae58087a335..e59a1e056f4b 100644 --- a/rsc/source/parser/rscicpx.cxx +++ b/rsc/source/parser/rscicpx.cxx @@ -2281,6 +2281,7 @@ RscTop * RscTypCont::InitClassTabControl( RscTop * pSuper, RSC_TABCONTROL_ITEMLIST ); INS_WINBIT( pClassTabControl, SingleLine ); + INS_WINBIT( pClassTabControl, DropDown ); } return pClassTabControl; diff --git a/rsc/source/parser/rsclex.cxx b/rsc/source/parser/rsclex.cxx index 3c2c95e541d1..8c34637fa304 100644 --- a/rsc/source/parser/rsclex.cxx +++ b/rsc/source/parser/rsclex.cxx @@ -317,7 +317,7 @@ int yylex() /****************** yyerror **********************************************/ #ifdef RS6000 extern "C" void yyerror( char* pMessage ) -#elif defined HP9000 || defined SCO || defined IRIX || defined SOLARIS +#elif defined HP9000 || defined SCO || defined SOLARIS extern "C" void yyerror( const char* pMessage ) #else void yyerror( char* pMessage ) diff --git a/rsc/source/parser/rsclex.hxx b/rsc/source/parser/rsclex.hxx index 89feed4dd132..63afd0b208c7 100644 --- a/rsc/source/parser/rsclex.hxx +++ b/rsc/source/parser/rsclex.hxx @@ -107,7 +107,7 @@ class ObjectStack { extern "C" int yyparse(); // forward Deklaration fuer erzeugte Funktion extern "C" void yyerror( char * ); extern "C" int yylex( void ); -#elif defined( HP9000 ) || defined( SCO ) || defined ( IRIX ) || defined ( SOLARIS ) +#elif defined( HP9000 ) || defined( SCO ) || defined ( SOLARIS ) extern "C" int yyparse(); // forward Deklaration fuer erzeugte Funktion extern "C" void yyerror( const char * ); extern "C" int yylex( void ); diff --git a/rsc/source/rsc/makefile.mk b/rsc/source/rsc/makefile.mk index 40e2d77740a3..89abd22207d9 100644 --- a/rsc/source/rsc/makefile.mk +++ b/rsc/source/rsc/makefile.mk @@ -40,10 +40,6 @@ ENABLE_EXCEPTIONS=true .INCLUDE : settings.mk -.IF "$(OS)"=="IRIX" -NOOPTFILES= $(OBJ)$/rsc.obj -.ENDIF - OBJFILES= $(OBJ)$/rsc.obj .INCLUDE : target.mk diff --git a/sax/inc/sax/tools/converter.hxx b/sax/inc/sax/tools/converter.hxx index 18212dfb9b8b..f8c988d2fceb 100644 --- a/sax/inc/sax/tools/converter.hxx +++ b/sax/inc/sax/tools/converter.hxx @@ -31,11 +31,13 @@ #ifndef _SAX_CONVERTER_HXX #define _SAX_CONVERTER_HXX -#include <sal/types.h> #include "sax/dllapi.h" -#include <com/sun/star/util/Date.hpp> + +#include <sal/types.h> + #include <com/sun/star/util/MeasureUnit.hpp> + namespace rtl { class OUString; @@ -43,8 +45,12 @@ class OUStringBuffer; } namespace com { namespace sun { namespace star { - namespace util { struct DateTime; } -}}} + namespace util { + struct Date; + struct DateTime; + struct Duration; + } +} } } namespace sax { @@ -138,31 +144,43 @@ public: /** convert string to double number (using ::rtl::math) with unit conversion */ static bool convertDouble(double& rValue, const ::rtl::OUString& rString, sal_Int16 nTargetUnit ); - /** convert double to ISO Time String */ - static void convertTime( ::rtl::OUStringBuffer& rBuffer, - const double& fTime); + /** convert double to ISO "duration" string; negative durations allowed */ + static void convertDuration(::rtl::OUStringBuffer& rBuffer, + const double fTime); - /** convert util::DateTime to ISO Time String */ - static void convertTime( ::rtl::OUStringBuffer& rBuffer, - const ::com::sun::star::util::DateTime& rDateTime ); + /** convert util::Duration to ISO "duration" string */ + static void convertDuration(::rtl::OUStringBuffer& rBuffer, + const ::com::sun::star::util::Duration& rDuration); - /** convert ISO Time String to double */ - static bool convertTime( double& fTime, + /** convert ISO "duration" string to double; negative durations allowed */ + static bool convertDuration(double & rfTime, const ::rtl::OUString& rString); - /** convert ISO Time String to util::DateTime */ - static bool convertTime( ::com::sun::star::util::DateTime& rDateTime, - const ::rtl::OUString& rString ); + /** convert ISO "duration" string to util::Duration */ + static bool convertDuration(::com::sun::star::util::Duration& rDuration, + const ::rtl::OUString& rString); - /** convert util::DateTime to ISO Date String */ + /** convert util::Date to ISO "date" string */ + static void convertDate( ::rtl::OUStringBuffer& rBuffer, + const com::sun::star::util::Date& rDate ); + + /** convert util::DateTime to ISO "date" or "dateTime" string */ static void convertDateTime( ::rtl::OUStringBuffer& rBuffer, const com::sun::star::util::DateTime& rDateTime, bool bAddTimeIf0AM = false ); - /** convert ISO Date String to util::DateTime */ + /** convert ISO "date" or "dateTime" string to util::DateTime */ static bool convertDateTime( com::sun::star::util::DateTime& rDateTime, const ::rtl::OUString& rString ); + /** convert ISO "date" or "dateTime" string to util::DateTime or + util::Date */ + static bool convertDateOrDateTime( + com::sun::star::util::Date & rDate, + com::sun::star::util::DateTime & rDateTime, + bool & rbDateTime, + const ::rtl::OUString & rString ); + /** gets the position of the first comma after npos in the string rStr. Commas inside '"' pairs are not matched */ static sal_Int32 indexOfComma( const ::rtl::OUString& rStr, diff --git a/sax/source/expatwrap/attrlistimpl.cxx b/sax/source/expatwrap/attrlistimpl.cxx index 1ec1128516fd..4eb07be50311 100644 --- a/sax/source/expatwrap/attrlistimpl.cxx +++ b/sax/source/expatwrap/attrlistimpl.cxx @@ -32,13 +32,6 @@ #include <vector> -#if OSL_DEBUG_LEVEL == 0 -# ifndef NDEBUG -# define NDEBUG -# endif -#endif -#include <assert.h> - #include <cppuhelper/weak.hxx> using namespace ::std; diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index e1f5161b7e3a..b1726f750127 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -46,11 +46,7 @@ #include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase2.hxx> -#ifdef SYSTEM_EXPAT #include <expat.h> -#else -#include "expat/xmlparse.h" -#endif using namespace ::rtl; using namespace ::std; diff --git a/sax/source/fastparser/fastparser.hxx b/sax/source/fastparser/fastparser.hxx index 07cb6afac77d..3e6220a0c782 100644 --- a/sax/source/fastparser/fastparser.hxx +++ b/sax/source/fastparser/fastparser.hxx @@ -42,11 +42,7 @@ #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> diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 354ee1936094..e13df493628a 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -32,8 +32,9 @@ #include <com/sun/star/i18n/UnicodeType.hpp> #include <com/sun/star/util/DateTime.hpp> #include <com/sun/star/util/Date.hpp> -#include <com/sun/star/util/Time.hpp> +#include <com/sun/star/util/Duration.hpp> #include <com/sun/star/uno/Sequence.hxx> + #include <rtl/ustrbuf.hxx> #include <rtl/math.hxx> #include "sax/tools/converter.hxx" @@ -683,11 +684,10 @@ bool Converter::convertDouble(double& rValue, const ::rtl::OUString& rString) return ( eStatus == rtl_math_ConversionStatus_Ok ); } -/** convert double to ISO Time String; negative durations allowed */ -void Converter::convertTime( ::rtl::OUStringBuffer& rBuffer, - const double& fTime) +/** convert double to ISO "duration" string; negative durations allowed */ +void Converter::convertDuration(::rtl::OUStringBuffer& rBuffer, + const double fTime) { - double fValue = fTime; // take care of negative durations as specified in: @@ -755,9 +755,9 @@ void Converter::convertTime( ::rtl::OUStringBuffer& rBuffer, rBuffer.append( sal_Unicode('S')); } -/** convert ISO Time String to double; negative durations allowed */ -bool Converter::convertTime( double& fTime, - const ::rtl::OUString& rString) +/** convert ISO "duration" string to double; negative durations allowed */ +bool Converter::convertDuration(double& rfTime, + const ::rtl::OUString& rString) { rtl::OUString aTrimmed = rString.trim().toAsciiUpperCase(); const sal_Unicode* pStr = aTrimmed.getStr(); @@ -880,64 +880,403 @@ bool Converter::convertTime( double& fTime, fTempTime = -fTempTime; } - fTime = fTempTime; + rfTime = fTempTime; } return bSuccess; } -/** convert util::DateTime to ISO Time String */ -void Converter::convertTime( ::rtl::OUStringBuffer& rBuffer, - const ::com::sun::star::util::DateTime& rDateTime ) +/** convert util::Duration to ISO "duration" string */ +void Converter::convertDuration(::rtl::OUStringBuffer& rBuffer, + const ::util::Duration& rDuration) { - double fHour = rDateTime.Hours; - double fMin = rDateTime.Minutes; - double fSec = rDateTime.Seconds; - double fSec100 = rDateTime.HundredthSeconds; - double fTempTime = fHour / 24; - fTempTime += fMin / (24 * 60); - fTempTime += fSec / (24 * 60 * 60); - fTempTime += fSec100 / (24 * 60 * 60 * 100); - convertTime( rBuffer, fTempTime ); + if (rDuration.Negative) + { + rBuffer.append(sal_Unicode('-')); + } + rBuffer.append(sal_Unicode('P')); + const bool bHaveDate(static_cast<sal_Int32>(rDuration.Years) + +static_cast<sal_Int32>(rDuration.Months) + +static_cast<sal_Int32>(rDuration.Days)); + if (rDuration.Years) + { + rBuffer.append(static_cast<sal_Int32>(rDuration.Years)); + rBuffer.append(sal_Unicode('Y')); + } + if (rDuration.Months) + { + rBuffer.append(static_cast<sal_Int32>(rDuration.Months)); + rBuffer.append(sal_Unicode('M')); + } + if (rDuration.Days) + { + rBuffer.append(static_cast<sal_Int32>(rDuration.Days)); + rBuffer.append(sal_Unicode('D')); + } + const sal_Int32 nHSecs(static_cast<sal_Int32>(rDuration.Seconds) + + static_cast<sal_Int32>(rDuration.HundredthSeconds)); + if (static_cast<sal_Int32>(rDuration.Hours) + + static_cast<sal_Int32>(rDuration.Minutes) + nHSecs) + { + rBuffer.append(sal_Unicode('T')); // time separator + if (rDuration.Hours) + { + rBuffer.append(static_cast<sal_Int32>(rDuration.Hours)); + rBuffer.append(sal_Unicode('H')); + } + if (rDuration.Minutes) + { + rBuffer.append(static_cast<sal_Int32>(rDuration.Minutes)); + rBuffer.append(sal_Unicode('M')); + } + if (nHSecs) + { + // seconds must not be omitted (i.e. ".42S" is not valid) + rBuffer.append(static_cast<sal_Int32>(rDuration.Seconds)); + if (rDuration.HundredthSeconds) + { + rBuffer.append(sal_Unicode('.')); + const sal_Int32 nHundredthSeconds( + rDuration.HundredthSeconds % 100); + if (nHundredthSeconds < 10) + { + rBuffer.append(sal_Unicode('0')); + } + rBuffer.append(nHundredthSeconds); + } + rBuffer.append(sal_Unicode('S')); + } + } + else if (!bHaveDate) + { + // zero duration: XMLSchema-2 says there must be at least one component + rBuffer.append(sal_Unicode('0')); + rBuffer.append(sal_Unicode('D')); + } } -/** convert ISO Time String to util::DateTime */ -bool Converter::convertTime( ::com::sun::star::util::DateTime& rDateTime, - const ::rtl::OUString& rString ) +enum Result { R_NOTHING, R_OVERFLOW, R_SUCCESS }; + +static Result +readUnsignedNumber(const ::rtl::OUString & rString, + sal_Int32 & io_rnPos, sal_Int32 & o_rNumber) { - double fCalculatedTime = 0.0; - if( convertTime( fCalculatedTime, rString ) ) + bool bOverflow(false); + sal_Int32 nTemp(0); + + for (sal_Int32 nPos = io_rnPos; (nPos < rString.getLength()); ++nPos) { - // #101357# declare as volatile to prevent optimization - // (gcc 3.0.1 Linux) - volatile double fTempTime = fCalculatedTime; - fTempTime *= 24; - double fHoursValue = ::rtl::math::approxFloor (fTempTime); - fTempTime -= fHoursValue; - fTempTime *= 60; - double fMinsValue = ::rtl::math::approxFloor (fTempTime); - fTempTime -= fMinsValue; - fTempTime *= 60; - double fSecsValue = ::rtl::math::approxFloor (fTempTime); - fTempTime -= fSecsValue; - double f100SecsValue = 0.0; - - if( fTempTime > 0.00001 ) - f100SecsValue = fTempTime; - - rDateTime.Year = 0; - rDateTime.Month = 0; - rDateTime.Day = 0; - rDateTime.Hours = static_cast < sal_uInt16 > ( fHoursValue ); - rDateTime.Minutes = static_cast < sal_uInt16 > ( fMinsValue ); - rDateTime.Seconds = static_cast < sal_uInt16 > ( fSecsValue ); - rDateTime.HundredthSeconds = static_cast < sal_uInt16 > ( f100SecsValue * 100.0 ); + const sal_Unicode c = rString[nPos]; + if ((sal_Unicode('0') <= c) && (c <= sal_Unicode('9'))) + { + nTemp *= 10; + nTemp += (c - sal_Unicode('0')); + if (nTemp >= SAL_MAX_INT16) + { + bOverflow = true; + } + } + else + { + if (io_rnPos != nPos) // read something? + { + io_rnPos = nPos; + if (bOverflow) + { + return R_OVERFLOW; + } + else + { + o_rNumber = nTemp; + return R_SUCCESS; + } + } + else break; + } + } + + o_rNumber = -1; + return R_NOTHING; +} +static bool +readDurationT(const ::rtl::OUString & rString, sal_Int32 & io_rnPos) +{ + if ((io_rnPos < rString.getLength()) && + (rString[io_rnPos] == sal_Unicode('T'))) + { + ++io_rnPos; return true; } return false; } -/** convert util::DateTime to ISO Date String */ +static bool +readDurationComponent(const ::rtl::OUString & rString, + sal_Int32 & io_rnPos, sal_Int32 & io_rnTemp, bool & io_rbTimePart, + sal_Int32 & o_rnTarget, const sal_Unicode c) +{ + if ((io_rnPos < rString.getLength())) + { + if (c == rString[io_rnPos]) + { + ++io_rnPos; + if (-1 != io_rnTemp) + { + o_rnTarget = io_rnTemp; + io_rnTemp = -1; + if (!io_rbTimePart) + { + io_rbTimePart = readDurationT(rString, io_rnPos); + } + return (R_OVERFLOW != + readUnsignedNumber(rString, io_rnPos, io_rnTemp)); + } + else + { + return false; + } + } + } + return true; +} + +/** convert ISO "duration" string to util::Duration */ +bool Converter::convertDuration(util::Duration& rDuration, + const ::rtl::OUString& rString) +{ + const ::rtl::OUString string = rString.trim().toAsciiUpperCase(); + sal_Int32 nPos(0); + + bool bIsNegativeDuration(false); + if (string.getLength() && (sal_Unicode('-') == string[0])) + { + bIsNegativeDuration = true; + ++nPos; + } + + if ((nPos < string.getLength()) + && (string[nPos] != sal_Unicode('P'))) // duration must start with "P" + { + return false; + } + + ++nPos; + + /// last read number; -1 == no valid number! always reset after using! + sal_Int32 nTemp(-1); + bool bTimePart(false); // have we read 'T'? + bool bSuccess(false); + sal_Int32 nYears(0); + sal_Int32 nMonths(0); + sal_Int32 nDays(0); + sal_Int32 nHours(0); + sal_Int32 nMinutes(0); + sal_Int32 nSeconds(0); + sal_Int32 nHundredthSeconds(0); + + bTimePart = readDurationT(string, nPos); + bSuccess = (R_SUCCESS == readUnsignedNumber(string, nPos, nTemp)); + + if (!bTimePart && bSuccess) + { + bSuccess = readDurationComponent(string, nPos, nTemp, bTimePart, + nYears, sal_Unicode('Y')); + } + + if (!bTimePart && bSuccess) + { + bSuccess = readDurationComponent(string, nPos, nTemp, bTimePart, + nMonths, sal_Unicode('M')); + } + + if (!bTimePart && bSuccess) + { + bSuccess = readDurationComponent(string, nPos, nTemp, bTimePart, + nDays, sal_Unicode('D')); + } + + if (bTimePart) + { + if (-1 == nTemp) // a 'T' must be followed by a component + { + bSuccess = false; + } + + if (bSuccess) + { + bSuccess = readDurationComponent(string, nPos, nTemp, bTimePart, + nHours, sal_Unicode('H')); + } + + if (bSuccess) + { + bSuccess = readDurationComponent(string, nPos, nTemp, bTimePart, + nMinutes, sal_Unicode('M')); + } + + // eeek! seconds are icky. + if ((nPos < string.getLength()) && bSuccess) + { + if (sal_Unicode('.') == string[nPos]) + { + ++nPos; + if (-1 != nTemp) + { + nSeconds = nTemp; + nTemp = -1; + const sal_Int32 nStart(nPos); + bSuccess = + (R_SUCCESS == readUnsignedNumber(string, nPos, nTemp)); + if ((nPos < string.getLength()) && bSuccess) + { + if (sal_Unicode('S') == string[nPos]) + { + ++nPos; + if (-1 != nTemp) + { + nTemp = -1; + const sal_Int32 nDigits = nPos - nStart; + OSL_ENSURE(nDigits > 0, "bad code monkey"); + nHundredthSeconds = 10 * + (string[nStart] - sal_Unicode('0')); + if (nDigits >= 2) + { + nHundredthSeconds += + (string[nStart+1] - sal_Unicode('0')); + } + } + else + { + bSuccess = false; + } + } + } + } + else + { + bSuccess = false; + } + } + else if (sal_Unicode('S') == string[nPos]) + { + ++nPos; + if (-1 != nTemp) + { + nSeconds = nTemp; + nTemp = -1; + } + else + { + bSuccess = false; + } + } + } + } + + if (nPos != string.getLength()) // string not processed completely? + { + bSuccess = false; + } + + if (nTemp != -1) // unprocessed number? + { + bSuccess = false; + } + + if (bSuccess) + { + rDuration.Negative = bIsNegativeDuration; + rDuration.Years = static_cast<sal_Int16>(nYears); + rDuration.Months = static_cast<sal_Int16>(nMonths); + rDuration.Days = static_cast<sal_Int16>(nDays); + rDuration.Hours = static_cast<sal_Int16>(nHours); + rDuration.Minutes = static_cast<sal_Int16>(nMinutes); + rDuration.Seconds = static_cast<sal_Int16>(nSeconds); + rDuration.HundredthSeconds = static_cast<sal_Int16>(nHundredthSeconds); + } + + return bSuccess; +} + +#if 0 +//FIXME +struct Test { + static bool eqDuration(util::Duration a, util::Duration b) { + return a.Years == b.Years && a.Months == b.Months && a.Days == b.Days + && a.Hours == b.Hours && a.Minutes == b.Minutes + && a.Seconds == b.Seconds + && a.HundredthSeconds == b.HundredthSeconds + && a.Negative == b.Negative; + } + static void doTest(util::Duration const & rid, const char * pis) + { + bool bSuccess(false); + ::rtl::OUStringBuffer buf; + Converter::convertDuration(buf, rid); + ::rtl::OUString os(buf.makeStringAndClear()); + OSL_TRACE(::rtl::OUStringToOString(os.getStr(), RTL_TEXTENCODING_UTF8)); + OSL_ASSERT(os.equalsAscii(pis)); + util::Duration od; + bSuccess = Converter::convertDuration(od, os); + OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dH", + od.Negative, od.Years, od.Months, od.Days, + od.Hours, od.Minutes, od.Seconds, od.HundredthSeconds); + OSL_ASSERT(bSuccess); + OSL_ASSERT(eqDuration(rid, od)); + } + static void doTestF(const char * pis) + { + util::Duration od; + bool bSuccess = Converter::convertDuration(od, + ::rtl::OUString::createFromAscii(pis)); + OSL_TRACE("%d %dY %dM %dD %dH %dM %dS %dH", + od.Negative, od.Years, od.Months, od.Days, + od.Hours, od.Minutes, od.Seconds, od.HundredthSeconds); + OSL_ASSERT(!bSuccess); + } + Test() { + OSL_TRACE("\nSAX CONVERTER TEST BEGIN\n"); + doTest( util::Duration(false, 1, 0, 0, 0, 0, 0, 0), "P1Y" ); + doTest( util::Duration(false, 0, 42, 0, 0, 0, 0, 0), "P42M" ); + doTest( util::Duration(false, 0, 0, 111, 0, 0, 0, 0), "P111D" ); + doTest( util::Duration(false, 0, 0, 0, 52, 0, 0, 0), "PT52H" ); + doTest( util::Duration(false, 0, 0, 0, 0, 717, 0, 0), "PT717M" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 121, 0), "PT121S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 19), "PT0.19S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 9), "PT0.09S" ); + doTest( util::Duration(true , 0, 0, 9999, 0, 0, 0, 0), "-P9999D" ); + doTest( util::Duration(true , 7, 6, 5, 4, 3, 2, 1), + "-P7Y6M5DT4H3M2.01S" ); + doTest( util::Duration(false, 0, 6, 0, 0, 3, 0, 0), "P6MT3M" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 0), "P0D" ); + doTestF("1Y1M"); + doTestF("P-1Y1M"); + doTestF("P1M1Y"); + doTestF("PT1Y"); + doTestF("P1Y1M1M"); + doTestF("P1YT1MT1M"); + doTestF("P1YT"); + doTestF("P99999999999Y"); + doTestF("PT.1S"); + doTestF("PT5M.134S"); + doTestF("PT1.S"); + OSL_TRACE("\nSAX CONVERTER TEST END\n"); + } +}; +static Test test; +#endif + +/** convert util::Date to ISO "date" string */ +void Converter::convertDate( + ::rtl::OUStringBuffer& i_rBuffer, + const util::Date& i_rDate) +{ + const util::DateTime dt( + 0, 0, 0, 0, i_rDate.Day, i_rDate.Month, i_rDate.Year); + convertDateTime(i_rBuffer, dt, false); +} + +/** convert util::DateTime to ISO "date" or "dateTime" string */ void Converter::convertDateTime( ::rtl::OUStringBuffer& i_rBuffer, const com::sun::star::util::DateTime& i_rDateTime, @@ -990,9 +1329,36 @@ void Converter::convertDateTime( } } -/** convert ISO Date String to util::DateTime */ -bool Converter::convertDateTime( com::sun::star::util::DateTime& rDateTime, - const ::rtl::OUString& rString ) +/** convert ISO "date" or "dateTime" string to util::DateTime */ +bool Converter::convertDateTime( util::DateTime& rDateTime, + const ::rtl::OUString& rString ) +{ + bool isDateTime; + util::Date date; + if (convertDateOrDateTime(date, rDateTime, isDateTime, rString)) + { + if (!isDateTime) + { + rDateTime.Year = date.Year; + rDateTime.Month = date.Month; + rDateTime.Day = date.Day; + rDateTime.Hours = 0; + rDateTime.Minutes = 0; + rDateTime.Seconds = 0; + rDateTime.HundredthSeconds = 0; + } + return true; + } + else + { + return false; + } +} + +/** convert ISO "date" or "dateTime" string to util::DateTime or util::Date */ +bool Converter::convertDateOrDateTime( + util::Date & rDate, util::DateTime & rDateTime, + bool & rbDateTime, const ::rtl::OUString & rString ) { bool bSuccess = true; @@ -1077,13 +1443,25 @@ bool Converter::convertDateTime( com::sun::star::util::DateTime& rDateTime, if (bSuccess) { - rDateTime.Year = (sal_uInt16)nYear; - rDateTime.Month = (sal_uInt16)nMonth; - rDateTime.Day = (sal_uInt16)nDay; - rDateTime.Hours = (sal_uInt16)nHour; - rDateTime.Minutes = (sal_uInt16)nMin; - rDateTime.Seconds = (sal_uInt16)nSec; - rDateTime.HundredthSeconds = (sal_uInt16)(sDoubleStr.toDouble() * 100); + if ( aTimeStr.getLength() > 0 ) // time is optional + { + rDateTime.Year = static_cast<sal_uInt16>(nYear); + rDateTime.Month = static_cast<sal_uInt16>(nMonth); + rDateTime.Day = static_cast<sal_uInt16>(nDay); + rDateTime.Hours = static_cast<sal_uInt16>(nHour); + rDateTime.Minutes = static_cast<sal_uInt16>(nMin); + rDateTime.Seconds = static_cast<sal_uInt16>(nSec); + rDateTime.HundredthSeconds = + static_cast<sal_uInt16>((sDoubleStr).toDouble() * 100); + rbDateTime = true; + } + else + { + rDate.Year = static_cast<sal_uInt16>(nYear); + rDate.Month = static_cast<sal_uInt16>(nMonth); + rDate.Day = static_cast<sal_uInt16>(nDay); + rbDateTime = false; + } } return bSuccess; } diff --git a/sax/test/sax/testsax.cxx b/sax/test/sax/testsax.cxx index 07491bae33ec..8fe989676993 100644 --- a/sax/test/sax/testsax.cxx +++ b/sax/test/sax/testsax.cxx @@ -31,11 +31,6 @@ #include <stdio.h> #include <string.h> -#if OSL_DEBUG_LEVEL == 0 -#define NDEBUG -#endif -#include <assert.h> - #include <osl/time.h> #include <osl/diagnose.h> @@ -245,12 +240,12 @@ Reference < XInputStream > createStreamFromSequence( { Reference < XInterface > xOutStreamService = xSMgr->createInstance( OUString::createFromAscii("com.sun.star.io.Pipe") ); - assert( xOutStreamService.is() ); + OSL_ASSERT( xOutStreamService.is() ); Reference< XOutputStream > rOutStream( xOutStreamService , UNO_QUERY ); - assert( rOutStream.is() ); + OSL_ASSERT( rOutStream.is() ); Reference< XInputStream > rInStream( xOutStreamService , UNO_QUERY ); - assert( rInStream.is() ); + OSL_ASSERT( rInStream.is() ); rOutStream->writeBytes( seqBytes ); rOutStream->flush(); @@ -379,7 +374,7 @@ public: // ExtendedDocumentHandler virtual void SAL_CALL endElement(const OUString& aName) throw (SAXException,RuntimeException) { - assert( m_iLevel ); + OSL_ASSERT( m_iLevel ); m_iLevel --; if( m_bPrint ) { int i; diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx index 46ae3529439c..0e20af6118af 100644 --- a/sot/source/sdstor/stgstrms.cxx +++ b/sot/source/sdstor/stgstrms.cxx @@ -1104,7 +1104,7 @@ StgTmpStrm::~StgTmpStrm() } } -ULONG StgTmpStrm::GetSize() +ULONG StgTmpStrm::GetSize() const { ULONG n; if( pStrm ) diff --git a/sot/source/sdstor/stgstrms.hxx b/sot/source/sdstor/stgstrms.hxx index 806d562af6d0..fd7971da3aba 100644 --- a/sot/source/sdstor/stgstrms.hxx +++ b/sot/source/sdstor/stgstrms.hxx @@ -167,8 +167,7 @@ public: ~StgTmpStrm(); BOOL Copy( StgTmpStrm& ); void SetSize( ULONG ); - using SvMemoryStream::GetSize; - ULONG GetSize(); + ULONG GetSize() const; }; #endif diff --git a/svtools/inc/PasswordHelper.hxx b/svl/inc/PasswordHelper.hxx index 7139a3ebe361..c915ebe3854a 100644 --- a/svtools/inc/PasswordHelper.hxx +++ b/svl/inc/PasswordHelper.hxx @@ -31,7 +31,7 @@ #ifndef _SVTOOLS_PASSWORDHELPER_HXX #define _SVTOOLS_PASSWORDHELPER_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include "sal/types.h" #include "com/sun/star/uno/Sequence.hxx" diff --git a/svtools/inc/adrparse.hxx b/svl/inc/adrparse.hxx index 439168441057..a317e27b2779 100644 --- a/svtools/inc/adrparse.hxx +++ b/svl/inc/adrparse.hxx @@ -31,7 +31,7 @@ #ifndef _ADRPARSE_HXX #define _ADRPARSE_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/list.hxx> #include <tools/string.hxx> diff --git a/svtools/inc/broadcast.hxx b/svl/inc/broadcast.hxx index e3e409c46e96..e80a2e446ebf 100644 --- a/svtools/inc/broadcast.hxx +++ b/svl/inc/broadcast.hxx @@ -30,7 +30,7 @@ #ifndef _SVT_BROADCAST_HXX #define _SVT_BROADCAST_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/rtti.hxx> class SvtListener; diff --git a/svtools/inc/cntnrsrt.hxx b/svl/inc/cntnrsrt.hxx index 13553f7f16fd..13553f7f16fd 100644 --- a/svtools/inc/cntnrsrt.hxx +++ b/svl/inc/cntnrsrt.hxx diff --git a/svtools/inc/cntwids.hrc b/svl/inc/cntwids.hrc index fcb9f855453b..fcb9f855453b 100644 --- a/svtools/inc/cntwids.hrc +++ b/svl/inc/cntwids.hrc diff --git a/svtools/source/svsql/converter.hxx b/svl/inc/converter.hxx index f6a5d67ca966..d012a56e7416 100644 --- a/svtools/source/svsql/converter.hxx +++ b/svl/inc/converter.hxx @@ -30,7 +30,7 @@ #ifndef _SV_CONVERTER_HXX_ #define _SV_CONVERTER_HXX_ -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/solar.h> class SvDbaseConverter diff --git a/svtools/inc/filenotation.hxx b/svl/inc/filenotation.hxx index 460d425d471a..c74c6c39c803 100644 --- a/svtools/inc/filenotation.hxx +++ b/svl/inc/filenotation.hxx @@ -31,7 +31,7 @@ #ifndef SVTOOLS_FILENOTATION_HXX #define SVTOOLS_FILENOTATION_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <rtl/ustring.hxx> //......................................................................... diff --git a/svtools/inc/folderrestriction.hxx b/svl/inc/folderrestriction.hxx index f7e683b31ad6..82fb4e1efef5 100644 --- a/svtools/inc/folderrestriction.hxx +++ b/svl/inc/folderrestriction.hxx @@ -31,7 +31,7 @@ #ifndef SVTOOLS_FOLDER_RESTRICTION_HXX #define SVTOOLS_FOLDER_RESTRICTION_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/string.hxx> #ifndef INCLUDED_VECTOR diff --git a/svtools/inc/fstathelper.hxx b/svl/inc/fstathelper.hxx index b9761d7131a0..1e613782b4e6 100644 --- a/svtools/inc/fstathelper.hxx +++ b/svl/inc/fstathelper.hxx @@ -31,7 +31,7 @@ #ifndef _SVTOOLS_FSTATHELPER_HXX #define _SVTOOLS_FSTATHELPER_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/solar.h> class UniString; diff --git a/svtools/inc/inetdef.hxx b/svl/inc/inetdef.hxx index 6ea380529147..6ea380529147 100644 --- a/svtools/inc/inetdef.hxx +++ b/svl/inc/inetdef.hxx diff --git a/svtools/inc/inetmsg.hxx b/svl/inc/inetmsg.hxx index f011102a79e2..f011102a79e2 100644 --- a/svtools/inc/inetmsg.hxx +++ b/svl/inc/inetmsg.hxx diff --git a/svtools/inc/inetstrm.hxx b/svl/inc/inetstrm.hxx index 46e15d5e4cf4..46e15d5e4cf4 100644 --- a/svtools/inc/inetstrm.hxx +++ b/svl/inc/inetstrm.hxx diff --git a/svtools/inc/instrm.hxx b/svl/inc/instrm.hxx index 58a70fcc6917..add43d4cc380 100644 --- a/svtools/inc/instrm.hxx +++ b/svl/inc/instrm.hxx @@ -31,7 +31,7 @@ #ifndef SVTOOLS_INSTRM_HXX #define SVTOOLS_INSTRM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <com/sun/star/uno/Reference.h> #include <tools/stream.hxx> diff --git a/svtools/inc/listener.hxx b/svl/inc/listener.hxx index 6d70f135eb92..a121197b1dd0 100644 --- a/svtools/inc/listener.hxx +++ b/svl/inc/listener.hxx @@ -30,7 +30,7 @@ #ifndef _SVT_LISTENER_HXX #define _SVT_LISTENER_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/rtti.hxx> class SvtBroadcaster; diff --git a/svtools/inc/listeneriter.hxx b/svl/inc/listeneriter.hxx index e531ead6bf5d..a2ac5693f741 100644 --- a/svtools/inc/listeneriter.hxx +++ b/svl/inc/listeneriter.hxx @@ -30,7 +30,7 @@ #ifndef _SVT_LISTENERITER_HXX #define _SVT_LISTENERITER_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/rtti.hxx> class SvtListener; diff --git a/svtools/inc/lngmisc.hxx b/svl/inc/lngmisc.hxx index 6bfe7b1c737c..55322246f773 100644 --- a/svtools/inc/lngmisc.hxx +++ b/svl/inc/lngmisc.hxx @@ -31,7 +31,7 @@ #ifndef _SVTOOLS_LNGMISC_HXX_ #define _SVTOOLS_LNGMISC_HXX_ -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/solar.h> #include <sal/types.h> #include <rtl/ustring.hxx> diff --git a/svtools/source/syslocale/makefile.mk b/svl/inc/makefile.mk index a393c174856f..9368bce7cde1 100644 --- a/svtools/source/syslocale/makefile.mk +++ b/svl/inc/makefile.mk @@ -8,7 +8,7 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.5 $ +# $Revision: 1.4 $ # # This file is part of OpenOffice.org. # @@ -28,21 +28,25 @@ # for a copy of the LGPLv3 License. # #************************************************************************* -PRJ=..$/.. +PRJ=.. -PRJNAME=svtools -TARGET=syslocale +PRJNAME=svl +TARGET=inc # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk +.INCLUDE : $(PRJ)$/util$/svl.pmk # --- Files -------------------------------------------------------- +# --- Targets ------------------------------------------------------- -SLOFILES = \ - $(SLO)$/syslocale.obj +.INCLUDE : target.mk -# --- Targets ------------------------------------------------------ +.IF "$(ENABLE_PCH)"!="" +ALLTAR : \ + $(SLO)$/precompiled.pch \ + $(SLO)$/precompiled_ex.pch + +.ENDIF # "$(ENABLE_PCH)"!="" -.INCLUDE : target.mk diff --git a/svtools/inc/memberid.hrc b/svl/inc/memberid.hrc index c917bd993e97..c917bd993e97 100644 --- a/svtools/inc/memberid.hrc +++ b/svl/inc/memberid.hrc diff --git a/svtools/inc/nfsymbol.hxx b/svl/inc/nfsymbol.hxx index 46fe47599359..46fe47599359 100644 --- a/svtools/inc/nfsymbol.hxx +++ b/svl/inc/nfsymbol.hxx diff --git a/svtools/inc/numuno.hxx b/svl/inc/numuno.hxx index c31829dec020..d243c49a3113 100644 --- a/svtools/inc/numuno.hxx +++ b/svl/inc/numuno.hxx @@ -30,7 +30,7 @@ #ifndef _NUMUNO_HXX #define _NUMUNO_HXX -#include "svtools/svtdllapi.h" +#include "svl/svldllapi.h" #include <com/sun/star/util/XNumberFormatsSupplier.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> #include <cppuhelper/implbase2.hxx> @@ -57,7 +57,7 @@ com::sun::star::uno::Reference<com::sun::star::uno::XInterface> SAL_CALL // SvNumberFormatsSupplierObj: aggregate to document, // construct with SvNumberFormatter -class SVT_DLLPUBLIC SvNumberFormatsSupplierObj : public cppu::WeakAggImplHelper2< +class SVL_DLLPUBLIC SvNumberFormatsSupplierObj : public cppu::WeakAggImplHelper2< com::sun::star::util::XNumberFormatsSupplier, com::sun::star::lang::XUnoTunnel> { diff --git a/svtools/inc/outstrm.hxx b/svl/inc/outstrm.hxx index e11c7ed1c1a9..c01d8f460c58 100644 --- a/svtools/inc/outstrm.hxx +++ b/svl/inc/outstrm.hxx @@ -31,7 +31,7 @@ #ifndef SVTOOLS_OUTSTRM_HXX #define SVTOOLS_OUTSTRM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <com/sun/star/uno/Reference.h> #include <tools/stream.hxx> diff --git a/svtools/inc/svtool.h b/svl/inc/pch/precompiled_svl.cxx index d088daa44249..27b37170856c 100644 --- a/svtools/inc/svtool.h +++ b/svl/inc/pch/precompiled_svl.cxx @@ -6,7 +6,7 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svtool.h,v $ + * $RCSfile: precompiled_svl.cxx,v $ * $Revision: 1.3 $ * * This file is part of OpenOffice.org. @@ -28,13 +28,5 @@ * ************************************************************************/ -#ifndef _SVTOOL_H -#define _SVTOOL_H +#include "precompiled_svl.hxx" -#if defined( W30 ) && defined( _MSC_VER ) -#define SVEXPORT _export -#else -#define SVEXPORT -#endif - -#endif // _SVTOOL_H diff --git a/svl/inc/pch/precompiled_svl.hxx b/svl/inc/pch/precompiled_svl.hxx new file mode 100644 index 000000000000..3a813a2db2dd --- /dev/null +++ b/svl/inc/pch/precompiled_svl.hxx @@ -0,0 +1,435 @@ +/************************************************************************* + * + * 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: precompiled_svl.hxx,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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): Generated on 2006-09-01 17:50:05.076676 + +#ifdef PRECOMPILED_HEADERS + +//---MARKER--- +#include "sal/config.h" +#include "sal/types.h" + +#include "com/sun/star/accessibility/AccessibleEventId.hpp" +#include "com/sun/star/accessibility/AccessibleRelationType.hpp" +#include "com/sun/star/accessibility/AccessibleRole.hpp" +#include "com/sun/star/accessibility/AccessibleStateType.hpp" +#include "com/sun/star/accessibility/AccessibleTextType.hpp" +#include "com/sun/star/accessibility/XAccessible.hpp" +#include "com/sun/star/accessibility/XAccessibleContext.hpp" +#include "com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp" +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <com/sun/star/accessibility/AccessibleEventObject.hpp> +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp> +#include <com/sun/star/accessibility/AccessibleTableModelChangeType.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp> +#include <com/sun/star/accessibility/XAccessibleStateSet.hpp> +#include <com/sun/star/accessibility/XAccessibleTable.hpp> +#include <com/sun/star/accessibility/XAccessibleValue.hpp> + +#include "com/sun/star/awt/FontWeight.hpp" +#include "com/sun/star/beans/XPropertySet.hpp" +#include "com/sun/star/beans/XPropertySetInfo.hpp" +#include "com/sun/star/io/XAsyncOutputMonitor.hpp" +#include "com/sun/star/lang/EventObject.hpp" +#include "com/sun/star/lang/Locale.hpp" +#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" +#include "com/sun/star/lang/XComponent.hpp" +#include "com/sun/star/lang/XMultiComponentFactory.hpp" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/ucb/Command.hpp" +#include "com/sun/star/ucb/CommandAbortedException.hpp" +#include "com/sun/star/ucb/IllegalIdentifierException.hpp" +#include "com/sun/star/ucb/UnsupportedCommandException.hpp" +#include "com/sun/star/ucb/XCommandEnvironment.hpp" +#include "com/sun/star/ucb/XCommandProcessor.hpp" +#include "com/sun/star/ucb/XContent.hpp" +#include "com/sun/star/ucb/XContentIdentifier.hpp" +#include "com/sun/star/ucb/XContentIdentifierFactory.hpp" +#include "com/sun/star/ucb/XContentProvider.hpp" +#include "com/sun/star/ucb/XContentProviderManager.hpp" +#include "com/sun/star/ui/dialogs/XFilePicker.hpp" +#include "com/sun/star/ui/dialogs/XFolderPicker.hpp" +#include "com/sun/star/uno/Exception.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uri/XUriReference.hpp" +#include "com/sun/star/uri/XUriReferenceFactory.hpp" +#include <com/sun/star/awt/KeyEvent.hpp> +#include <com/sun/star/awt/KeyModifier.hpp> +#include <com/sun/star/awt/LineEndFormat.hpp> +#include <com/sun/star/awt/XFocusListener.hpp> +#include <com/sun/star/awt/XImageConsumer.hpp> +#include <com/sun/star/awt/XItemEventBroadcaster.hpp> +#include <com/sun/star/awt/XTextArea.hpp> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <com/sun/star/beans/PropertyState.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/PropertyValues.hpp> +#include <com/sun/star/beans/XFastPropertySet.hpp> +#include <com/sun/star/beans/XMaterialHolder.hpp> +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#include <com/sun/star/beans/XPropertiesChangeListener.hpp> +#include <com/sun/star/beans/XPropertyAccess.hpp> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XHierarchicalNameAccess.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/container/XNameReplace.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/datatransfer/XMimeContentType.hpp> +#include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp> +#include <com/sun/star/datatransfer/XTransferable.hpp> +#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> +#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp> +#include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp> +#include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp> +#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp> +#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp> +#include <com/sun/star/datatransfer/dnd/DropTargetDragEvent.hpp> +#include <com/sun/star/datatransfer/dnd/DropTargetDropEvent.hpp> +#include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp> +#include <com/sun/star/datatransfer/dnd/XDragSourceListener.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTargetDragContext.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> +#include <com/sun/star/document/XEventsSupplier.hpp> +#include <com/sun/star/document/XExporter.hpp> +#include <com/sun/star/document/XTypeDetection.hpp> +#include <com/sun/star/document/XViewDataSupplier.hpp> +#include <com/sun/star/embed/Actions.hpp> +#include <com/sun/star/embed/Aspects.hpp> +#include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/embed/EmbedMisc.hpp> +#include <com/sun/star/embed/EmbedStates.hpp> +#include <com/sun/star/embed/NoVisualAreaSizeException.hpp> +#include <com/sun/star/embed/XActionsApproval.hpp> +#include <com/sun/star/embed/XComponentSupplier.hpp> +#include <com/sun/star/embed/XEmbedPersist.hpp> +#include <com/sun/star/embed/XExtendedStorageStream.hpp> +#include <com/sun/star/embed/XHierarchicalStorageAccess.hpp> +#include <com/sun/star/embed/XStateChangeListener.hpp> +#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/embed/XTransactedObject.hpp> +#include <com/sun/star/frame/DoubleInitializationException.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/frame/XConfigManager.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XDocumentTemplates.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/XTerminateListener.hpp> +#include <com/sun/star/frame/status/ItemState.hpp> +#include <com/sun/star/frame/status/ItemStatus.hpp> +#include <com/sun/star/frame/status/Visibility.hpp> +#include <com/sun/star/graphic/XGraphicProvider.hpp> +#include <com/sun/star/i18n/AmPmValue.hpp> +#include <com/sun/star/i18n/CalendarDisplayCode.hpp> +#include <com/sun/star/i18n/CalendarDisplayIndex.hpp> +#include <com/sun/star/i18n/CalendarFieldIndex.hpp> +#include <com/sun/star/i18n/CharacterIteratorMode.hpp> +#include <com/sun/star/i18n/CollatorOptions.hpp> +#include <com/sun/star/i18n/InputSequenceCheckMode.hpp> +#include <com/sun/star/i18n/KNumberFormatType.hpp> +#include <com/sun/star/i18n/KNumberFormatUsage.hpp> +#include <com/sun/star/i18n/NumberFormatCode.hpp> +#include <com/sun/star/i18n/ScriptType.hpp> +#include <com/sun/star/i18n/TransliterationModules.hpp> +#include <com/sun/star/i18n/Weekdays.hpp> +#include <com/sun/star/i18n/WordType.hpp> +#include <com/sun/star/i18n/XBreakIterator.hpp> +#include <com/sun/star/i18n/XCollator.hpp> +#include <com/sun/star/i18n/XExtendedCalendar.hpp> +#include <com/sun/star/i18n/XExtendedInputSequenceChecker.hpp> +#include <com/sun/star/io/IOException.hpp> +#include <com/sun/star/io/NotConnectedException.hpp> +#include <com/sun/star/io/XActiveDataControl.hpp> +#include <com/sun/star/io/XActiveDataSource.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/io/XPersist.hpp> +#include <com/sun/star/io/XPersistObject.hpp> +#include <com/sun/star/io/XSeekable.hpp> +#include <com/sun/star/io/XStream.hpp> +#include <com/sun/star/io/XTruncate.hpp> +#include <com/sun/star/java/InvalidJavaSettingsException.hpp> +#include <com/sun/star/java/JavaDisabledException.hpp> +#include <com/sun/star/java/JavaNotFoundException.hpp> +#include <com/sun/star/java/JavaVMCreationFailureException.hpp> +#include <com/sun/star/java/RestartRequiredException.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#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/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/packages/NoEncryptionException.hpp> +#include <com/sun/star/registry/XRegistryKey.hpp> +#include <com/sun/star/registry/XSimpleRegistry.hpp> +#include <com/sun/star/script/XTypeConverter.hpp> +#include <com/sun/star/sdb/CommandType.hpp> +#include <com/sun/star/sdb/SQLContext.hpp> +#include <com/sun/star/sdb/XCompletedConnection.hpp> +#include <com/sun/star/sdbc/SQLWarning.hpp> +#include <com/sun/star/sdbc/XConnection.hpp> +#include <com/sun/star/sdbc/XDataSource.hpp> +#include <com/sun/star/sdbc/XResultSet.hpp> +#include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> +#include <com/sun/star/sdbcx/XTablesSupplier.hpp> +#include <com/sun/star/svg/XSVGWriter.hpp> +#include <com/sun/star/system/SystemShellExecuteFlags.hpp> +#include <com/sun/star/system/XProxySettings.hpp> +#include <com/sun/star/system/XSystemShellExecute.hpp> +#include <com/sun/star/task/DocumentPasswordRequest.hpp> +#include <com/sun/star/task/DocumentMSPasswordRequest.hpp> +#include <com/sun/star/task/MasterPasswordRequest.hpp> +#include <com/sun/star/task/NoMasterException.hpp> +#include <com/sun/star/task/PasswordRequestMode.hpp> +#include <com/sun/star/task/XInteractionAbort.hpp> +#include <com/sun/star/task/XInteractionContinuation.hpp> +#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/XInteractionPassword.hpp> +#include <com/sun/star/task/XInteractionRequest.hpp> +#include <com/sun/star/task/XInteractionRetry.hpp> +#include <com/sun/star/task/XJob.hpp> +#include <com/sun/star/task/XJobExecutor.hpp> +#include <com/sun/star/task/XPasswordContainer.hpp> +#include <com/sun/star/ucb/CommandAbortedException.hpp> +#include <com/sun/star/ucb/ContentCreationException.hpp> +#include <com/sun/star/ucb/FileSystemNotation.hpp> +#include <com/sun/star/ucb/IOErrorCode.hpp> +#include <com/sun/star/ucb/InteractiveIOException.hpp> +#include <com/sun/star/ucb/NumberedSortingInfo.hpp> +#include <com/sun/star/ucb/TransferResult.hpp> +#include <com/sun/star/ucb/XAnyCompareFactory.hpp> +#include <com/sun/star/ucb/XCommandEnvironment.hpp> +#include <com/sun/star/ucb/XContent.hpp> +#include <com/sun/star/ucb/XContentAccess.hpp> +#include <com/sun/star/ucb/XContentProviderManager.hpp> +#include <com/sun/star/ucb/XDynamicResultSet.hpp> +#include <com/sun/star/ucb/XProgressHandler.hpp> +#include <com/sun/star/ucb/XSimpleFileAccess.hpp> +#include <com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp> +#include <com/sun/star/ui/ImageType.hpp> +#include <com/sun/star/ui/XAcceleratorConfiguration.hpp> +#include <com/sun/star/ui/XImageManager.hpp> +#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> +#include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> +#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> +#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> +#include <com/sun/star/ui/dialogs/XFilePicker.hpp> +#include <com/sun/star/ui/dialogs/XFilterManager.hpp> +#include <com/sun/star/uno/Any.h> +#include <com/sun/star/uno/Exception.hpp> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/RuntimeException.hpp> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/uno/XAggregation.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/uno/XCurrentContext.hpp> +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/uno/XWeak.hpp> +#include <com/sun/star/util/AliasProgrammaticPair.hpp> +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/util/DateTimeRange.hpp> +#include <com/sun/star/util/SearchAlgorithms.hpp> +#include <com/sun/star/util/SearchFlags.hpp> +#include <com/sun/star/util/SearchOptions.hpp> +#include <com/sun/star/util/SearchResult.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/util/XChangesBatch.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/util/XCloseBroadcaster.hpp> +#include <com/sun/star/util/XCloseable.hpp> +#include <com/sun/star/util/XModifiable.hpp> +#include <com/sun/star/util/XModifyListener.hpp> +#include <com/sun/star/util/XNumberFormatTypes.hpp> +#include <com/sun/star/util/XNumberFormats.hpp> +#include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#include <com/sun/star/util/XOfficeInstallationDirectories.hpp> +#include <com/sun/star/util/XStringSubstitution.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/util/XUpdatable.hpp> +#include <com/sun/star/view/XPrintable.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <com/sun/star/xml/sax/XParser.hpp> + +#include <algorithm> +#include <deque> +#include <hash_map> +#include <limits> + +#include <list> +#include <map> +#include <memory> +#include <queue> +#include <set> +#include <stack> +#include <utility> +#include <vector> + + +#include <i18npool/lang.h> +#include <i18npool/mslangid.hxx> + +#include "comphelper/processfactory.hxx" +#include <comphelper/accessibleeventnotifier.hxx> +#include <comphelper/broadcasthelper.hxx> +#include <comphelper/configurationhelper.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/regpathhelper.hxx> +#include <comphelper/sequence.hxx> +#include <comphelper/sequenceashashmap.hxx> +#include <comphelper/servicehelper.hxx> +#include <comphelper/stl_types.hxx> +#include <comphelper/storagehelper.hxx> +#include <comphelper/types.hxx> +#include <comphelper/uno3.hxx> + +#include "cppuhelper/bootstrap.hxx" +#include "cppuhelper/exc_hlp.hxx" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/interfacecontainer.hxx" +#include "cppuhelper/weakref.hxx" +#include <cppuhelper/bootstrap.hxx> +#include <cppuhelper/exc_hlp.hxx> +#include <cppuhelper/factory.hxx> +#include <cppuhelper/interfacecontainer.h> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/queryinterface.hxx> +#include <cppuhelper/servicefactory.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakagg.hxx> +#include <cppuhelper/weakref.hxx> + +#include <osl/conditn.hxx> +#include <osl/conditn.hxx> +#include <osl/diagnose.h> +#include <osl/endian.h> +#include <osl/file.h> +#include <osl/file.hxx> +#include <osl/module.h> +#include <osl/module.hxx> +#include <osl/mutex.h> +#include <osl/mutex.hxx> +#include <osl/process.h> +#include <osl/thread.h> +#include <osl/thread.hxx> + +#include <rsc/rscsfx.hxx> + +#include "rtl/crc.h" +#include "rtl/memory.h" +#include "rtl/strbuf.hxx" +#include "rtl/string.h" +#include "rtl/string.hxx" +#include "rtl/textenc.h" +#include "rtl/ustrbuf.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include <rtl/alloc.h> +#include <rtl/byteseq.hxx> +#include <rtl/cipher.h> +#include <rtl/crc.h> +#include <rtl/digest.h> +#include <rtl/logfile.hxx> +#include <rtl/math.hxx> +#include <rtl/memory.h> +#include <rtl/strbuf.hxx> +#include <rtl/string.hxx> +#include <rtl/tencinfo.h> +#include <rtl/textcvt.h> +#include <rtl/textenc.h> +#include <rtl/ustrbuf.hxx> +#include <rtl/ustring.h> +#include <rtl/ustring.hxx> +#include <rtl/uuid.h> + +#include "unotools/configitem.hxx" +#include "unotools/configmgr.hxx" + +#include <sot/clsids.hxx> + +#include <tools/inetdef.hxx> + +#include <ucbhelper/commandenvironment.hxx> +#include <ucbhelper/content.hxx> +#include <ucbhelper/contentbroker.hxx> +#include <ucbhelper/fileidentifierconverter.hxx> + +#include <uno/mapping.hxx> + +#include <unotools/bootstrap.hxx> +#include <unotools/collatorwrapper.hxx> +#include <unotools/configitem.hxx> +#include <unotools/configmgr.hxx> +#include <unotools/confignode.hxx> +#include <unotools/configpathes.hxx> +#include <unotools/nativenumberwrapper.hxx> +#include <unotools/numberformatcodewrapper.hxx> +#include <unotools/processfactory.hxx> + +#include <vos/mutex.hxx> +#include <vos/process.hxx> +#include <vos/ref.hxx> +#include <vos/refernce.hxx> +#include <vos/security.hxx> +#include <vos/thread.hxx> +#include <vos/timer.hxx> + +//---MARKER--- + +#endif + diff --git a/svtools/inc/pickerhelper.hxx b/svl/inc/pickerhelper.hxx index 4be84296c678..e8ef23e145d4 100644 --- a/svtools/inc/pickerhelper.hxx +++ b/svl/inc/pickerhelper.hxx @@ -31,7 +31,7 @@ #ifndef _PICKERHELPER_HXX #define _PICKERHELPER_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include "sal/types.h" #include "com/sun/star/uno/Reference.hxx" diff --git a/svtools/inc/pickerhistory.hxx b/svl/inc/pickerhistory.hxx index f99ad5dcc0f1..e67729a1bbd8 100644 --- a/svtools/inc/pickerhistory.hxx +++ b/svl/inc/pickerhistory.hxx @@ -31,7 +31,7 @@ #ifndef SVTOOLS_PICKERHISTORY_HXX #define SVTOOLS_PICKERHISTORY_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <com/sun/star/uno/XInterface.hpp> //......................................................................... diff --git a/svtools/inc/pickerhistoryaccess.hxx b/svl/inc/pickerhistoryaccess.hxx index 983b0c416ef3..210fd9b92139 100644 --- a/svtools/inc/pickerhistoryaccess.hxx +++ b/svl/inc/pickerhistoryaccess.hxx @@ -31,7 +31,7 @@ #ifndef SVTOOLS_PICKERHISTORYACCESS_HXX #define SVTOOLS_PICKERHISTORYACCESS_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #ifndef _COM_SUN_STAR_UNO_REFERENX_HXX_ #include <com/sun/star/uno/Reference.hxx> diff --git a/svtools/inc/poolcach.hxx b/svl/inc/poolcach.hxx index 20d9e4d19c43..21cfec4662a0 100644 --- a/svtools/inc/poolcach.hxx +++ b/svl/inc/poolcach.hxx @@ -30,7 +30,7 @@ #ifndef _SFXPOOLCACH_HXX #define _SFXPOOLCACH_HXX -#include "svtools/svtdllapi.h" +#include "svl/svldllapi.h" #include <tools/solar.h> class SfxItemModifyArr_Impl; @@ -39,7 +39,7 @@ class SfxItemSet; class SfxPoolItem; class SfxSetItem; -class SVT_DLLPUBLIC SfxItemPoolCache +class SVL_DLLPUBLIC SfxItemPoolCache { SfxItemPool *pPool; SfxItemModifyArr_Impl *pCache; diff --git a/svtools/inc/strmadpt.hxx b/svl/inc/strmadpt.hxx index 7a080c1c7bcc..2fd190f9adef 100644 --- a/svtools/inc/strmadpt.hxx +++ b/svl/inc/strmadpt.hxx @@ -31,7 +31,7 @@ #ifndef SVTOOLS_STRMADPT_HXX #define SVTOOLS_STRMADPT_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/io/XSeekable.hpp> diff --git a/svtools/inc/stylepool.hxx b/svl/inc/stylepool.hxx index 1b1f129d7f4c..d69bb928e432 100644 --- a/svtools/inc/stylepool.hxx +++ b/svl/inc/stylepool.hxx @@ -32,7 +32,7 @@ #include <boost/shared_ptr.hpp> #include <rtl/ustring.hxx> -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> class StylePoolImpl; class StylePoolIterImpl; diff --git a/svtools/inc/svtools/aeitem.hxx b/svl/inc/svl/aeitem.hxx index 5cfd3d0fc15e..446d9b8aeeb7 100644 --- a/svtools/inc/svtools/aeitem.hxx +++ b/svl/inc/svl/aeitem.hxx @@ -30,14 +30,14 @@ #ifndef _AEITEM_HXX #define _AEITEM_HXX -#include "svtools/svtdllapi.h" -#include <svtools/poolitem.hxx> -#include <svtools/eitem.hxx> +#include "svl/svldllapi.h" +#include <svl/poolitem.hxx> +#include <svl/eitem.hxx> class SfxAllEnumValueArr; class SvUShorts; -class SVT_DLLPUBLIC SfxAllEnumItem: public SfxEnumItem +class SVL_DLLPUBLIC SfxAllEnumItem: public SfxEnumItem { SfxAllEnumValueArr* pValues; SvUShorts* pDisabledValues; diff --git a/svtools/inc/svtools/brdcst.hxx b/svl/inc/svl/brdcst.hxx index 2f9270f3cd4b..cfa45d5aa89a 100644 --- a/svtools/inc/svtools/brdcst.hxx +++ b/svl/inc/svl/brdcst.hxx @@ -30,9 +30,9 @@ #ifndef _SFXBRDCST_HXX #define _SFXBRDCST_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/rtti.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> class SfxListener; class SfxHint; diff --git a/svtools/inc/svtools/cancel.hxx b/svl/inc/svl/cancel.hxx index 5929fc4db47a..2808b77d3139 100644 --- a/svtools/inc/svtools/cancel.hxx +++ b/svl/inc/svl/cancel.hxx @@ -30,16 +30,16 @@ #ifndef _SFXCANCEL_HXX #define _SFXCANCEL_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/string.hxx> #include <tools/ref.hxx> -#include <svtools/brdcst.hxx> -#include <svtools/smplhint.hxx> +#include <svl/brdcst.hxx> +#include <svl/smplhint.hxx> class SfxCancellable; #ifdef _SFX_CANCEL_CXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> SV_DECL_PTRARR( SfxCancellables_Impl, SfxCancellable*, 0, 4 ) diff --git a/svtools/inc/svtools/cenumitm.hxx b/svl/inc/svl/cenumitm.hxx index d65825849869..3d354899cd9d 100644 --- a/svtools/inc/svtools/cenumitm.hxx +++ b/svl/inc/svl/cenumitm.hxx @@ -31,9 +31,9 @@ #ifndef _SVTOOLS_CENUMITM_HXX #define _SVTOOLS_CENUMITM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/debug.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> //============================================================================ DBG_NAMEEX(SfxEnumItemInterface) diff --git a/svtools/inc/svtools/cintitem.hxx b/svl/inc/svl/cintitem.hxx index a944e2139818..72421f93e0cb 100644 --- a/svtools/inc/svtools/cintitem.hxx +++ b/svl/inc/svl/cintitem.hxx @@ -31,9 +31,9 @@ #ifndef _SVTOOLS_CINTITEM_HXX #define _SVTOOLS_CINTITEM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/debug.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> //============================================================================ DBG_NAMEEX_VISIBILITY(CntByteItem, SVL_DLLPUBLIC) diff --git a/svtools/inc/svtools/cjkoptions.hxx b/svl/inc/svl/cjkoptions.hxx index e4298b4d162c..720ead5422f0 100644 --- a/svtools/inc/svtools/cjkoptions.hxx +++ b/svl/inc/svl/cjkoptions.hxx @@ -30,15 +30,15 @@ #ifndef _SVTOOLS_CJKOPTIONS_HXX #define _SVTOOLS_CJKOPTIONS_HXX -#include "svtools/svtdllapi.h" +#include "svl/svldllapi.h" #include <sal/types.h> -#include <svtools/options.hxx> +#include <unotools/options.hxx> class SvtCJKOptions_Impl; // class SvtCJKOptions -------------------------------------------------- -class SVT_DLLPUBLIC SvtCJKOptions: public svt::detail::Options +class SVL_DLLPUBLIC SvtCJKOptions: public utl::detail::Options { private: SvtCJKOptions_Impl* pImp; diff --git a/svtools/inc/svtools/cnclhint.hxx b/svl/inc/svl/cnclhint.hxx index 38781a6c2143..a2ce75ac1a4b 100644 --- a/svtools/inc/svtools/cnclhint.hxx +++ b/svl/inc/svl/cnclhint.hxx @@ -30,8 +30,8 @@ #ifndef _SFXCNCLHINT_HXX #define _SFXCNCLHINT_HXX -#include <svtools/hint.hxx> -#include <svtools/cancel.hxx> +#include <svl/hint.hxx> +#include <svl/cancel.hxx> #include <tools/rtti.hxx> #define SFXCANCELHINT_REMOVED 1 diff --git a/svtools/inc/svtools/cntwall.hxx b/svl/inc/svl/cntwall.hxx index 51b2982fe1dd..dca27f2284e6 100644 --- a/svtools/inc/svtools/cntwall.hxx +++ b/svl/inc/svl/cntwall.hxx @@ -30,14 +30,14 @@ #ifndef _CNTWALL_HXX #define _CNTWALL_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #ifndef SHL_HXX #include <tools/shl.hxx> #endif #include <tools/rtti.hxx> #include <tools/color.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> class SvStream; diff --git a/svtools/inc/svtools/ctloptions.hxx b/svl/inc/svl/ctloptions.hxx index 6c09ad98a45e..28b2191cad94 100644 --- a/svtools/inc/svtools/ctloptions.hxx +++ b/svl/inc/svl/ctloptions.hxx @@ -30,18 +30,17 @@ #ifndef _SVTOOLS_CTLOPTIONS_HXX #define _SVTOOLS_CTLOPTIONS_HXX -#include "svtools/svtdllapi.h" +#include "svl/svldllapi.h" #include <sal/types.h> -#include <svtools/brdcst.hxx> -#include <svtools/lstner.hxx> -#include <svtools/options.hxx> +#include <svl/brdcst.hxx> +#include <svl/lstner.hxx> +#include <unotools/options.hxx> class SvtCTLOptions_Impl; // class SvtCTLOptions -------------------------------------------------------- -class SVT_DLLPUBLIC SvtCTLOptions: - public svt::detail::Options, public SfxBroadcaster, public SfxListener +class SVL_DLLPUBLIC SvtCTLOptions : public utl::detail::Options { private: SvtCTLOptions_Impl* m_pImp; @@ -52,8 +51,6 @@ public: SvtCTLOptions( sal_Bool bDontLoad = sal_False ); virtual ~SvtCTLOptions(); - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - void SetCTLFontEnabled( sal_Bool _bEnabled ); sal_Bool IsCTLFontEnabled() const; diff --git a/svtools/inc/svtools/ctypeitm.hxx b/svl/inc/svl/ctypeitm.hxx index 2592c6e0f388..808596397aa0 100644 --- a/svtools/inc/svtools/ctypeitm.hxx +++ b/svl/inc/svl/ctypeitm.hxx @@ -30,8 +30,8 @@ #ifndef _SVTOOLS_CTYPEITM_HXX #define _SVTOOLS_CTYPEITM_HXX -#include <svtools/inettype.hxx> -#include <svtools/custritm.hxx> +#include <svl/inettype.hxx> +#include <svl/custritm.hxx> //========================================================================= diff --git a/svtools/inc/svtools/custritm.hxx b/svl/inc/svl/custritm.hxx index 83a88b1f240f..8a3344f6dc0b 100644 --- a/svtools/inc/svtools/custritm.hxx +++ b/svl/inc/svl/custritm.hxx @@ -31,9 +31,9 @@ #ifndef _SVTOOLS_CUSTRITM_HXX #define _SVTOOLS_CUSTRITM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/debug.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> //============================================================================ DBG_NAMEEX_VISIBILITY(CntUnencodedStringItem, SVL_DLLPUBLIC) diff --git a/svtools/inc/svtools/dateitem.hxx b/svl/inc/svl/dateitem.hxx index 073c1a6ef825..c66c9a84285d 100644 --- a/svtools/inc/svtools/dateitem.hxx +++ b/svl/inc/svl/dateitem.hxx @@ -33,7 +33,7 @@ #include <tools/rtti.hxx> #include <tools/datetime.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> class SvStream; diff --git a/svtools/inc/svtools/documentlockfile.hxx b/svl/inc/svl/documentlockfile.hxx index f2625f7955bb..c62f81bc77ef 100644 --- a/svtools/inc/svtools/documentlockfile.hxx +++ b/svl/inc/svl/documentlockfile.hxx @@ -32,7 +32,7 @@ #ifndef _SVT_DOCUMENTLOCKFILE_HXX #define _SVT_DOCUMENTLOCKFILE_HXX -#include <svtools/svtdllapi.h> +#include <svl/svldllapi.h> #include <com/sun/star/io/XStream.hpp> #include <com/sun/star/io/XInputStream.hpp> @@ -41,11 +41,11 @@ #include <com/sun/star/io/XTruncate.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <svtools/lockfilecommon.hxx> +#include <svl/lockfilecommon.hxx> namespace svt { -class SVT_DLLPUBLIC DocumentLockFile : public LockFileCommon +class SVL_DLLPUBLIC DocumentLockFile : public LockFileCommon { // the workaround for automated testing! static sal_Bool m_bAllowInteraction; diff --git a/svtools/inc/svtools/eitem.hxx b/svl/inc/svl/eitem.hxx index f9e1927a881d..55ed3c47ee33 100644 --- a/svtools/inc/svtools/eitem.hxx +++ b/svl/inc/svl/eitem.hxx @@ -31,11 +31,11 @@ #ifndef _SFXENUMITEM_HXX #define _SFXENUMITEM_HXX -#include "svtools/svtdllapi.h" -#include <svtools/cenumitm.hxx> +#include "svl/svldllapi.h" +#include <svl/cenumitm.hxx> //============================================================================ -class SVT_DLLPUBLIC SfxEnumItem: public CntEnumItem +class SVL_DLLPUBLIC SfxEnumItem: public CntEnumItem { protected: SfxEnumItem(USHORT which = 0, USHORT nValue = 0): @@ -50,7 +50,7 @@ public: }; //============================================================================ -class SVT_DLLPUBLIC SfxBoolItem: public CntBoolItem +class SVL_DLLPUBLIC SfxBoolItem: public CntBoolItem { public: TYPEINFO(); diff --git a/svtools/inc/svtools/filerec.hxx b/svl/inc/svl/filerec.hxx index 77ba6c1b5c52..d28bb3033b56 100644 --- a/svtools/inc/svtools/filerec.hxx +++ b/svl/inc/svl/filerec.hxx @@ -33,10 +33,10 @@ //========================================================================= -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/debug.hxx> #include <tools/stream.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> SV_DECL_VARARR( SfxUINT32s, UINT32, 8, 8 ) diff --git a/svtools/inc/svtools/flagitem.hxx b/svl/inc/svl/flagitem.hxx index 5298bbd1678b..fa056bb00488 100644 --- a/svtools/inc/svtools/flagitem.hxx +++ b/svl/inc/svl/flagitem.hxx @@ -30,10 +30,10 @@ #ifndef _SFXFLAGITEM_HXX #define _SFXFLAGITEM_HXX -#include "svtools/svtdllapi.h" +#include "svl/svldllapi.h" #include <tools/solar.h> #include <tools/rtti.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> class SvStream; @@ -41,9 +41,9 @@ extern USHORT nSfxFlagVal[16]; // ----------------------------------------------------------------------- -DBG_NAMEEX_VISIBILITY(SfxFlagItem, SVT_DLLPUBLIC) +DBG_NAMEEX_VISIBILITY(SfxFlagItem, SVL_DLLPUBLIC) -class SVT_DLLPUBLIC SfxFlagItem: public SfxPoolItem +class SVL_DLLPUBLIC SfxFlagItem: public SfxPoolItem { USHORT nVal; diff --git a/svtools/inc/svtools/globalnameitem.hxx b/svl/inc/svl/globalnameitem.hxx index f19ea1dd8457..4422220fe640 100644 --- a/svtools/inc/svtools/globalnameitem.hxx +++ b/svl/inc/svl/globalnameitem.hxx @@ -30,15 +30,15 @@ #ifndef _GLOBALNAMEITEM_HXX #define _GLOBALNAMEITEM_HXX -#include "svtools/svtdllapi.h" +#include "svl/svldllapi.h" #include <tools/solar.h> #include <tools/rtti.hxx> #include <tools/globname.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> // ----------------------------------------------------------------------- -class SVT_DLLPUBLIC SfxGlobalNameItem: public SfxPoolItem +class SVL_DLLPUBLIC SfxGlobalNameItem: public SfxPoolItem { SvGlobalName m_aName; diff --git a/svtools/inc/svtools/hint.hxx b/svl/inc/svl/hint.hxx index 9417b2bc1702..e2d43ea602ca 100644 --- a/svtools/inc/svtools/hint.hxx +++ b/svl/inc/svl/hint.hxx @@ -30,7 +30,7 @@ #ifndef _SFXHINT_HXX #define _SFXHINT_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/rtti.hxx> class SVL_DLLPUBLIC SfxHint diff --git a/svtools/inc/svtools/httpcook.hxx b/svl/inc/svl/httpcook.hxx index 354680a86f30..09769396eb11 100644 --- a/svtools/inc/svtools/httpcook.hxx +++ b/svl/inc/svl/httpcook.hxx @@ -34,7 +34,7 @@ #include <tools/datetime.hxx> #include <tools/stream.hxx> #include <tools/string.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> /*======================================================================= * diff --git a/svtools/inc/svtools/ilstitem.hxx b/svl/inc/svl/ilstitem.hxx index 0bc76f1d0627..c581f938197f 100644 --- a/svtools/inc/svtools/ilstitem.hxx +++ b/svl/inc/svl/ilstitem.hxx @@ -31,8 +31,8 @@ #ifndef _SFXILSTITEM_HXX #define _SFXILSTITEM_HXX -#include "svtools/svldllapi.h" -#include <svtools/poolitem.hxx> +#include "svl/svldllapi.h" +#include <svl/poolitem.hxx> #include <com/sun/star/uno/Sequence.hxx> class SvULongs; diff --git a/svtools/inc/svtools/imageitm.hxx b/svl/inc/svl/imageitm.hxx index e0151729c2e0..bfd888bdd944 100644 --- a/svtools/inc/svtools/imageitm.hxx +++ b/svl/inc/svl/imageitm.hxx @@ -31,13 +31,13 @@ #ifndef _SVT_IMAGEITM_HXX #define _SVT_IMAGEITM_HXX -#include "svtools/svtdllapi.h" -#include <svtools/intitem.hxx> +#include "svl/svldllapi.h" +#include <svl/intitem.hxx> class String; struct SfxImageItem_Impl; -class SVT_DLLPUBLIC SfxImageItem : public SfxInt16Item +class SVL_DLLPUBLIC SfxImageItem : public SfxInt16Item { SfxImageItem_Impl* pImp; public: diff --git a/svtools/inc/svtools/inethist.hxx b/svl/inc/svl/inethist.hxx index ad64e1131bf3..7d4577897faf 100644 --- a/svtools/inc/svtools/inethist.hxx +++ b/svl/inc/svl/inethist.hxx @@ -30,12 +30,12 @@ #ifndef _INETHIST_HXX #define _INETHIST_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/solar.h> #include <tools/string.hxx> #include <tools/urlobj.hxx> -#include <svtools/brdcst.hxx> -#include <svtools/hint.hxx> +#include <svl/brdcst.hxx> +#include <svl/hint.hxx> /*======================================================================== * diff --git a/svtools/inc/svtools/inettype.hxx b/svl/inc/svl/inettype.hxx index 2d9f0ba8694c..5f3bfbaab225 100644 --- a/svtools/inc/svtools/inettype.hxx +++ b/svl/inc/svl/inettype.hxx @@ -31,7 +31,7 @@ #ifndef _INETTYPE_HXX #define _INETTYPE_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/inetmime.hxx> #include <com/sun/star/lang/Locale.hpp> diff --git a/svtools/inc/svtools/intitem.hxx b/svl/inc/svl/intitem.hxx index fe2a3543e630..7bfa3433c6b6 100644 --- a/svtools/inc/svtools/intitem.hxx +++ b/svl/inc/svl/intitem.hxx @@ -31,11 +31,11 @@ #ifndef _SFXINTITEM_HXX #define _SFXINTITEM_HXX -#include "svtools/svtdllapi.h" -#include <svtools/cintitem.hxx> +#include "svl/svldllapi.h" +#include <svl/cintitem.hxx> //============================================================================ -class SVT_DLLPUBLIC SfxByteItem: public CntByteItem +class SVL_DLLPUBLIC SfxByteItem: public CntByteItem { public: TYPEINFO(); @@ -53,9 +53,9 @@ public: }; //============================================================================ -DBG_NAMEEX_VISIBILITY(SfxInt16Item, SVT_DLLPUBLIC) +DBG_NAMEEX_VISIBILITY(SfxInt16Item, SVL_DLLPUBLIC) -class SVT_DLLPUBLIC SfxInt16Item: public SfxPoolItem +class SVL_DLLPUBLIC SfxInt16Item: public SfxPoolItem { INT16 m_nValue; @@ -115,7 +115,7 @@ inline void SfxInt16Item::SetValue(INT16 nTheValue) } //============================================================================ -class SVT_DLLPUBLIC SfxUInt16Item: public CntUInt16Item +class SVL_DLLPUBLIC SfxUInt16Item: public CntUInt16Item { public: TYPEINFO(); @@ -134,7 +134,7 @@ public: }; //============================================================================ -class SVT_DLLPUBLIC SfxInt32Item: public CntInt32Item +class SVL_DLLPUBLIC SfxInt32Item: public CntInt32Item { public: TYPEINFO(); @@ -154,7 +154,7 @@ public: }; //============================================================================ -class SVT_DLLPUBLIC SfxUInt32Item: public CntUInt32Item +class SVL_DLLPUBLIC SfxUInt32Item: public CntUInt32Item { public: TYPEINFO(); diff --git a/svtools/inc/svtools/isethint.hxx b/svl/inc/svl/isethint.hxx index d30fc4a65b27..d08819723f43 100644 --- a/svtools/inc/svtools/isethint.hxx +++ b/svl/inc/svl/isethint.hxx @@ -30,10 +30,10 @@ #ifndef _SFXISETHINT_HXX #define _SFXISETHINT_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #ifndef _HINT_HXX -#include <svtools/hint.hxx> +#include <svl/hint.hxx> #endif class SfxItemSet; diff --git a/svtools/inc/svtools/itemiter.hxx b/svl/inc/svl/itemiter.hxx index 6a9b5e212720..50bbe7902e83 100644 --- a/svtools/inc/svtools/itemiter.hxx +++ b/svl/inc/svl/itemiter.hxx @@ -30,9 +30,9 @@ #ifndef _SFXITEMITER_HXX #define _SFXITEMITER_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/solar.h> -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> class SfxPoolItem; class SfxItemSet; diff --git a/svtools/inc/svtools/itempool.hxx b/svl/inc/svl/itempool.hxx index 81407cee2d0c..d99f29626d38 100644 --- a/svtools/inc/svtools/itempool.hxx +++ b/svl/inc/svl/itempool.hxx @@ -31,7 +31,7 @@ #ifndef _SFXITEMPOOL_HXX #define _SFXITEMPOOL_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #ifndef INCLUDED_LIMITS_H #include <limits.h> @@ -39,8 +39,8 @@ #endif #include <tools/solar.h> #include <tools/string.hxx> -#include <svtools/svarray.hxx> -#include <svtools/poolitem.hxx> +#include <svl/svarray.hxx> +#include <svl/poolitem.hxx> #include <vector> class SvStream; diff --git a/svtools/inc/svtools/itemprop.hxx b/svl/inc/svl/itemprop.hxx index feab0eab004b..873c34785d5f 100644 --- a/svtools/inc/svtools/itemprop.hxx +++ b/svl/inc/svl/itemprop.hxx @@ -30,10 +30,10 @@ #ifndef _SFX_ITEMPROP_HXX #define _SFX_ITEMPROP_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/solar.h> #include <tools/string.hxx> -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> #include <cppuhelper/implbase1.hxx> #include <com/sun/star/beans/XPropertySetInfo.hpp> #include <com/sun/star/beans/PropertyState.hpp> diff --git a/svtools/inc/svtools/itemset.hxx b/svl/inc/svl/itemset.hxx index 4cc3edcf65c7..a09cfbc2bbb2 100644 --- a/svtools/inc/svtools/itemset.hxx +++ b/svl/inc/svl/itemset.hxx @@ -30,14 +30,14 @@ #ifndef _SFXITEMSET_HXX #define _SFXITEMSET_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #if STLPORT_VERSION<321 #include <stdarg.h> #else #include <cstdarg> // std::va_list and friends #endif -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include <tools/rtti.hxx> #include <tools/solar.h> diff --git a/svtools/inc/svtools/languageoptions.hxx b/svl/inc/svl/languageoptions.hxx index ed247ac01fa3..0cba5235674a 100644 --- a/svtools/inc/svtools/languageoptions.hxx +++ b/svl/inc/svl/languageoptions.hxx @@ -30,11 +30,12 @@ #ifndef _SVTOOLS_LANGUAGEOPTIONS_HXX #define _SVTOOLS_LANGUAGEOPTIONS_HXX -#include "svtools/svtdllapi.h" +#include "svl/svldllapi.h" #include <sal/types.h> -#include <svtools/brdcst.hxx> -#include <svtools/lstner.hxx> +#include <svl/brdcst.hxx> +#include <svl/lstner.hxx> #include <unotools/configitem.hxx> +#include <unotools/options.hxx> #include <i18npool/lang.h> // class SvtLanguageOptions ---------------------------------------------------- @@ -47,7 +48,7 @@ class SvtCJKOptions; class SvtCTLOptions; -class SVT_DLLPUBLIC SvtLanguageOptions : public SfxBroadcaster, public SfxListener +class SVL_DLLPUBLIC SvtLanguageOptions : public ::utl::detail::Options { private: SvtCJKOptions* m_pCJKOptions; @@ -78,8 +79,6 @@ public: SvtLanguageOptions( sal_Bool _bDontLoad = sal_False ); ~SvtLanguageOptions(); - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - // CJK options sal_Bool IsCJKFontEnabled() const; sal_Bool IsVerticalTextEnabled() const; @@ -113,7 +112,7 @@ public: }; /** #i42730# Gives access to the Windows 16bit system locale */ -class SVT_DLLPUBLIC SvtSystemLanguageOptions : public utl::ConfigItem +class SVL_DLLPUBLIC SvtSystemLanguageOptions : public utl::ConfigItem { private: ::rtl::OUString m_sWin16SystemLocale; @@ -123,6 +122,7 @@ public: ~SvtSystemLanguageOptions(); virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames ); LanguageType GetWin16SystemLanguage(); }; diff --git a/svtools/inc/svtools/lckbitem.hxx b/svl/inc/svl/lckbitem.hxx index b21e91a3fd46..77cb63414f4e 100644 --- a/svtools/inc/svtools/lckbitem.hxx +++ b/svl/inc/svl/lckbitem.hxx @@ -30,11 +30,11 @@ #ifndef _LCKBITEM_HXX #define _LCKBITEM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/solar.h> #include <tools/rtti.hxx> #include <tools/stream.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> // ----------------------------------------------------------------------- diff --git a/svtools/inc/svtools/lockfilecommon.hxx b/svl/inc/svl/lockfilecommon.hxx index c8bd6251f9cb..c1e18aac7e14 100644 --- a/svtools/inc/svtools/lockfilecommon.hxx +++ b/svl/inc/svl/lockfilecommon.hxx @@ -32,7 +32,7 @@ #ifndef _SVT_LOCKFILECOMMON_HXX #define _SVT_LOCKFILECOMMON_HXX -#include <svtools/svtdllapi.h> +#include <svl/svldllapi.h> #include <com/sun/star/io/XStream.hpp> #include <com/sun/star/io/XInputStream.hpp> @@ -54,7 +54,7 @@ namespace svt { // This is a general implementation that is used in document lock file implementation and in sharing control file implementation -class SVT_DLLPUBLIC LockFileCommon +class SVL_DLLPUBLIC LockFileCommon { protected: ::osl::Mutex m_aMutex; diff --git a/svtools/inc/svtools/lstner.hxx b/svl/inc/svl/lstner.hxx index 99a6e10701f5..c9993834b42a 100644 --- a/svtools/inc/svtools/lstner.hxx +++ b/svl/inc/svl/lstner.hxx @@ -30,9 +30,9 @@ #ifndef _SFXLSTNER_HXX #define _SFXLSTNER_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/rtti.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> class SfxBroadcaster; class SfxHint; diff --git a/svtools/inc/svtools/macitem.hxx b/svl/inc/svl/macitem.hxx index 2e43120f653d..747b9ec0bf17 100644 --- a/svtools/inc/svtools/macitem.hxx +++ b/svl/inc/svl/macitem.hxx @@ -32,8 +32,8 @@ // class SvxMacroItem ---------------------------------------------------- -#include "svtools/svtdllapi.h" -#include <svtools/poolitem.hxx> +#include "svl/svldllapi.h" +#include <svl/poolitem.hxx> #include <tools/rtti.hxx> #include <tools/debug.hxx> #include <tools/string.hxx> @@ -72,7 +72,7 @@ public: class SjJSbxObject; -class SVT_DLLPUBLIC SvxMacro +class SVL_DLLPUBLIC SvxMacro { String aMacName; String aLibName; @@ -125,7 +125,7 @@ DECLARE_TABLE( _SvxMacroTableDtor, SvxMacro* ) #define SVX_MACROTBL_AKTVERSION SVX_MACROTBL_VERSION40 -class SVT_DLLPUBLIC SvxMacroTableDtor : public _SvxMacroTableDtor +class SVL_DLLPUBLIC SvxMacroTableDtor : public _SvxMacroTableDtor { public: inline SvxMacroTableDtor( const USHORT nInitSz = 0, const USHORT nReSz = 1 ); @@ -152,7 +152,7 @@ inline SvxMacroTableDtor::SvxMacroTableDtor( const USHORT nInitSz, Dieses Item beschreibt eine Makro-Tabelle. */ -class SVT_DLLPUBLIC SvxMacroItem: public SfxPoolItem +class SVL_DLLPUBLIC SvxMacroItem: public SfxPoolItem { public: TYPEINFO(); diff --git a/svtools/inc/svtools/metitem.hxx b/svl/inc/svl/metitem.hxx index a37d119d57c1..5a1e6627542f 100644 --- a/svtools/inc/svtools/metitem.hxx +++ b/svl/inc/svl/metitem.hxx @@ -30,14 +30,14 @@ #ifndef _SFXMETRICITEM_HXX #define _SFXMETRICITEM_HXX -#include "svtools/svtdllapi.h" -#include <svtools/intitem.hxx> +#include "svl/svldllapi.h" +#include <svl/intitem.hxx> -DBG_NAMEEX_VISIBILITY(SfxMetricItem, SVT_DLLPUBLIC) +DBG_NAMEEX_VISIBILITY(SfxMetricItem, SVL_DLLPUBLIC) // ----------------------------------------------------------------------- -class SVT_DLLPUBLIC SfxMetricItem: public SfxInt32Item +class SVL_DLLPUBLIC SfxMetricItem: public SfxInt32Item { public: TYPEINFO(); diff --git a/svtools/inc/svtools/nfkeytab.hxx b/svl/inc/svl/nfkeytab.hxx index ba8c24f319f6..ba8c24f319f6 100644 --- a/svtools/inc/svtools/nfkeytab.hxx +++ b/svl/inc/svl/nfkeytab.hxx diff --git a/svtools/inc/svtools/nfversi.hxx b/svl/inc/svl/nfversi.hxx index 23375369ddb3..23375369ddb3 100644 --- a/svtools/inc/svtools/nfversi.hxx +++ b/svl/inc/svl/nfversi.hxx diff --git a/svtools/inc/svtools/nranges.hxx b/svl/inc/svl/nranges.hxx index 6996669cdeb1..e527a456a014 100644 --- a/svtools/inc/svtools/nranges.hxx +++ b/svl/inc/svl/nranges.hxx @@ -40,12 +40,12 @@ #define NUMTYPE USHORT #define SfxNumRanges SfxUShortRanges -#include <svtools/nranges.hxx> +#include <svl/nranges.hxx> #undef NUMTYPE #define NUMTYPE ULONG #define SfxNumRanges SfxULongRanges -#include <svtools/nranges.hxx> +#include <svl/nranges.hxx> #define _SFXNRANGES_HXX diff --git a/svtools/inc/svtools/ondemand.hxx b/svl/inc/svl/ondemand.hxx index e8361307eb9e..3369f286b2cd 100644 --- a/svtools/inc/svtools/ondemand.hxx +++ b/svl/inc/svl/ondemand.hxx @@ -31,7 +31,7 @@ #ifndef INCLUDED_SVTOOLS_ONDEMAND_HXX #define INCLUDED_SVTOOLS_ONDEMAND_HXX -#include <svtools/syslocale.hxx> +#include <unotools/syslocale.hxx> #include <i18npool/lang.h> #include <unotools/localedatawrapper.hxx> #include <unotools/calendarwrapper.hxx> diff --git a/svtools/inc/svtools/ownlist.hxx b/svl/inc/svl/ownlist.hxx index 472f50e6ef60..21e9ffa74210 100644 --- a/svtools/inc/svtools/ownlist.hxx +++ b/svl/inc/svl/ownlist.hxx @@ -31,7 +31,7 @@ #ifndef _OWNLIST_HXX #define _OWNLIST_HXX -#include "svtools/svtdllapi.h" +#include "svl/svldllapi.h" #include <tools/stream.hxx> #include <tools/ownlist.hxx> #include <com/sun/star/uno/Sequence.hxx> @@ -79,7 +79,7 @@ public: }; //========================================================================= -class SVT_DLLPUBLIC SvCommandList +class SVL_DLLPUBLIC SvCommandList /* [Beschreibung] Die Liste enth"alt Objekte vom Typ SvCommand. Wird ein Objekt @@ -95,8 +95,8 @@ class SVT_DLLPUBLIC SvCommandList BOOL FillFromSequence( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& ); void FillSequence( com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& ); - SVT_DLLPUBLIC friend SvStream& operator >> ( SvStream& rStm, SvCommandList & ); - SVT_DLLPUBLIC friend SvStream& operator << ( SvStream&, const SvCommandList & ); + SVL_DLLPUBLIC friend SvStream& operator >> ( SvStream& rStm, SvCommandList & ); + SVL_DLLPUBLIC friend SvStream& operator << ( SvStream&, const SvCommandList & ); }; #endif // _OWNLIST_HXX diff --git a/svtools/inc/svtools/poolitem.hxx b/svl/inc/svl/poolitem.hxx index 7e0fea44b87a..1d0a2e982fae 100644 --- a/svtools/inc/svtools/poolitem.hxx +++ b/svl/inc/svl/poolitem.hxx @@ -30,7 +30,7 @@ #ifndef _SFXPOOLITEM_HXX #define _SFXPOOLITEM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <com/sun/star/uno/Any.hxx> #define TF_POOLABLE @@ -40,8 +40,8 @@ #include <tools/solar.h> #include <tools/debug.hxx> #include <tools/string.hxx> -#include <svtools/svarray.hxx> -#include <svtools/hint.hxx> +#include <svl/svarray.hxx> +#include <svl/hint.hxx> typedef long SfxArgumentError; diff --git a/svtools/inc/svtools/ptitem.hxx b/svl/inc/svl/ptitem.hxx index 923ab73da1d5..b0deff81e884 100644 --- a/svtools/inc/svtools/ptitem.hxx +++ b/svl/inc/svl/ptitem.hxx @@ -30,17 +30,17 @@ #ifndef _SFXPTITEM_HXX #define _SFXPTITEM_HXX -#include "svtools/svtdllapi.h" -#include <svtools/poolitem.hxx> +#include "svl/svldllapi.h" +#include <svl/poolitem.hxx> #include <tools/gen.hxx> class SvStream; -DBG_NAMEEX_VISIBILITY(SfxPointItem, SVT_DLLPUBLIC) +DBG_NAMEEX_VISIBILITY(SfxPointItem, SVL_DLLPUBLIC) // ----------------------------------------------------------------------- -class SVT_DLLPUBLIC SfxPointItem: public SfxPoolItem +class SVL_DLLPUBLIC SfxPointItem: public SfxPoolItem { Point aVal; diff --git a/svtools/inc/svtools/rectitem.hxx b/svl/inc/svl/rectitem.hxx index 39c85d9ab228..1f944bab4102 100644 --- a/svtools/inc/svtools/rectitem.hxx +++ b/svl/inc/svl/rectitem.hxx @@ -30,18 +30,18 @@ #ifndef _SFXRECTITEM_HXX #define _SFXRECTITEM_HXX -#include "svtools/svtdllapi.h" +#include "svl/svldllapi.h" #include <tools/debug.hxx> #include <tools/gen.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> class SvStream; -DBG_NAMEEX_VISIBILITY(SfxRectangleItem, SVT_DLLPUBLIC) +DBG_NAMEEX_VISIBILITY(SfxRectangleItem, SVL_DLLPUBLIC) // ----------------------------------------------------------------------- -class SVT_DLLPUBLIC SfxRectangleItem: public SfxPoolItem +class SVL_DLLPUBLIC SfxRectangleItem: public SfxPoolItem { Rectangle aVal; diff --git a/svtools/inc/svtools/restrictedpaths.hxx b/svl/inc/svl/restrictedpaths.hxx index 218e34cd4556..a3ced1b93019 100644 --- a/svtools/inc/svtools/restrictedpaths.hxx +++ b/svl/inc/svl/restrictedpaths.hxx @@ -31,15 +31,15 @@ #ifndef SVTOOLS_RESTRICTEDPATHS_HXX #define SVTOOLS_RESTRICTEDPATHS_HXX -#include <svtools/urlfilter.hxx> -#include <svtools/svtdllapi.h> +#include <svl/urlfilter.hxx> +#include <svl/svldllapi.h> #include <tools/string.hxx> #include <vector> namespace svt { - class SVT_DLLPUBLIC RestrictedPaths : public IUrlFilter + class SVL_DLLPUBLIC RestrictedPaths : public IUrlFilter { private: ::std::vector< String > m_aUnrestrictedURLs; diff --git a/svtools/inc/svtools/rngitem.hxx b/svl/inc/svl/rngitem.hxx index 52831f93f71f..d55ba25a06c2 100644 --- a/svtools/inc/svtools/rngitem.hxx +++ b/svl/inc/svl/rngitem.hxx @@ -35,7 +35,7 @@ #define NUMTYPE USHORT #define SfxXRangeItem SfxRangeItem #define SfxXRangesItem SfxUShortRangesItem -#include <svtools/rngitem.hxx> +#include <svl/rngitem.hxx> #undef NUMTYPE #undef SfxXRangeItem #undef SfxXRangesItem @@ -44,7 +44,7 @@ #define NUMTYPE ULONG #define SfxXRangeItem SfxULongRangeItem #define SfxXRangesItem SfxULongRangesItem -#include <svtools/rngitem.hxx> +#include <svl/rngitem.hxx> #undef NUMTYPE #undef SfxXRangeItem #undef SfxXRangesItem @@ -53,14 +53,14 @@ #define _SFXRNGITEM_HXX #else -#include "svtools/svtdllapi.h" -#include <svtools/poolitem.hxx> +#include "svl/svldllapi.h" +#include <svl/poolitem.hxx> class SvStream; // ----------------------------------------------------------------------- -class SVT_DLLPUBLIC SfxXRangeItem : public SfxPoolItem +class SVL_DLLPUBLIC SfxXRangeItem : public SfxPoolItem { private: NUMTYPE nFrom; @@ -89,7 +89,7 @@ public: // ----------------------------------------------------------------------- -class SVT_DLLPUBLIC SfxXRangesItem : public SfxPoolItem +class SVL_DLLPUBLIC SfxXRangesItem : public SfxPoolItem { private: NUMTYPE* _pRanges; diff --git a/svtools/inc/svtools/sfontitm.hxx b/svl/inc/svl/sfontitm.hxx index e1394dec91b3..a12466519d1b 100644 --- a/svtools/inc/svtools/sfontitm.hxx +++ b/svl/inc/svl/sfontitm.hxx @@ -34,7 +34,7 @@ #include <tools/color.hxx> #include <tools/gen.hxx> #include <i18npool/lang.h> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> //============================================================================ class SfxFontItem: public SfxPoolItem diff --git a/svtools/inc/svtools/sharecontrolfile.hxx b/svl/inc/svl/sharecontrolfile.hxx index 8735f8c5ccf7..1febb4e77583 100644 --- a/svtools/inc/svtools/sharecontrolfile.hxx +++ b/svl/inc/svl/sharecontrolfile.hxx @@ -31,7 +31,7 @@ #ifndef _SVT_SHARECONTROLFILE_HXX #define _SVT_SHARECONTROLFILE_HXX -#include <svtools/svtdllapi.h> +#include <svl/svldllapi.h> #include <com/sun/star/io/XStream.hpp> #include <com/sun/star/io/XInputStream.hpp> @@ -40,7 +40,7 @@ #include <com/sun/star/io/XTruncate.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <svtools/lockfilecommon.hxx> +#include <svl/lockfilecommon.hxx> #define SHARED_OOOUSERNAME_ID LOCKFILE_OOOUSERNAME_ID #define SHARED_SYSUSERNAME_ID LOCKFILE_SYSUSERNAME_ID @@ -51,7 +51,7 @@ namespace svt { -class SVT_DLLPUBLIC ShareControlFile : public LockFileCommon +class SVL_DLLPUBLIC ShareControlFile : public LockFileCommon { ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream; ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xInputStream; diff --git a/svtools/inc/svtools/slstitm.hxx b/svl/inc/svl/slstitm.hxx index 742d437fb842..9b1c0050cf6b 100644 --- a/svtools/inc/svtools/slstitm.hxx +++ b/svl/inc/svl/slstitm.hxx @@ -30,10 +30,10 @@ #ifndef _SFXSLSTITM_HXX #define _SFXSLSTITM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/rtti.hxx> #include <tools/list.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include <com/sun/star/uno/Sequence.h> class SfxImpStringList; diff --git a/svtools/inc/svtools/smplhint.hxx b/svl/inc/svl/smplhint.hxx index 9858fefd86f0..089a86dae3f2 100644 --- a/svtools/inc/svtools/smplhint.hxx +++ b/svl/inc/svl/smplhint.hxx @@ -30,8 +30,8 @@ #ifndef _SFXSMPLHINT_HXX #define _SFXSMPLHINT_HXX -#include "svtools/svldllapi.h" -#include <svtools/hint.hxx> +#include "svl/svldllapi.h" +#include <svl/hint.hxx> #include <tools/rtti.hxx> #define SFX_HINT_DYING 0x00000001 diff --git a/svtools/inc/svtools/solar.hrc b/svl/inc/svl/solar.hrc index 348422ef6477..26ab8a959c5e 100644 --- a/svtools/inc/svtools/solar.hrc +++ b/svl/inc/svl/solar.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2009 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: solar.hrc,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -132,6 +129,8 @@ #define RID_FILTER_START (RID_LIB_START+10200) #define RID_FILTER_END (RID_LIB_START+10299) +// do *NOT* add more ranges here, RID_LIB_END is (RID_LIB_START + 10000) + #define RID_APP_START 20000 #define RID_APP_END 31999 @@ -144,12 +143,6 @@ #define RID_SD_START (27000) #define RID_SD_END (27999) -#define RID_Sa_START (28000) -#define RID_Sa_END (28999) - -#define RID_Sb_START (29000) -#define RID_Sb_END (29999) - #define RID_OBJ_START (30000) #define RID_OBJ_END (32767) @@ -175,6 +168,9 @@ #define HID_START 32768 +#define HID_VCL_START (HID_START+100) +#define HID_VCL_END (HID_START+150) + #define HID_SVTOOLS_START (HID_START+200) #define HID_SVTOOLS_END (HID_START+299) @@ -191,20 +187,13 @@ #define HID_WIZARD_END (HID_LIB_START+999) //please note: There is also HID_WIZARD2 below -#define HID_EXTENSIONS_START (HID_LIB_START+1000) -#define HID_EXTENSIONS_END (HID_LIB_START+1099) +// FREE -#define HID_SO2_START (HID_LIB_START+1100) -#define HID_SO2_END (HID_LIB_START+1149) +#define HID_CUI_START (HID_LIB_START+1100) +#define HID_CUI_END (HID_LIB_START+1699) -#define HID_MAIL_START (HID_LIB_START+1150) -#define HID_MAIL_END (HID_LIB_START+1199) - -#define HID_INET_START (HID_LIB_START+1200) -#define HID_INET_END (HID_LIB_START+1259) - -#define HID_OFA_START (HID_LIB_START+1260) -#define HID_OFA_END (HID_LIB_START+1399) +#define HID_OFA_START (HID_LIB_START+1760) +#define HID_OFA_END (HID_LIB_START+1999) #define HID_HELP_START (HID_LIB_START+2000) #define HID_HELP_END (HID_LIB_START+2050) @@ -218,8 +207,10 @@ #define HID_GOODIES_START (HID_LIB_START+2100) #define HID_GOODIES_END (HID_LIB_START+2199) +#if 0 // currently unused range #define HID_SCHEDULE_START (HID_LIB_START+2200) #define HID_SCHEDULE_END (HID_LIB_START+3399) +#endif #define HID_CHANNEL_START (HID_LIB_START+3400) #define HID_CHANNEL_END (HID_LIB_START+3499) @@ -278,8 +269,8 @@ #define HID_OBJ_START (HID_START+30000) #define HID_OBJ_END (HID_START+32767) -#define HID_SIM_START (HID_OBJ_START+ 0) -#define HID_SIM_END (HID_OBJ_START+ 239) +#define HID_CUI3_START (HID_OBJ_START+ 0) +#define HID_CUI3_END (HID_OBJ_START+ 239) #define HID_AVMEDIA_START (HID_OBJ_START+ 240) #define HID_AVMEDIA_END (HID_OBJ_START+ 255) @@ -308,5 +299,8 @@ #define HID_FORMULA_START (HID_OBJ_START+2081) #define HID_FORMULA_END (HID_OBJ_START+2280) +#define HID_EXTENSIONS_START (HID_OBJ_START+2281) +#define HID_EXTENSIONS_END (HID_OBJ_START+2800) + #endif diff --git a/svtools/inc/svtools/stritem.hxx b/svl/inc/svl/stritem.hxx index a2430b142c1d..21ee9fadd1ec 100644 --- a/svtools/inc/svtools/stritem.hxx +++ b/svl/inc/svl/stritem.hxx @@ -31,11 +31,11 @@ #ifndef _SFXSTRITEM_HXX #define _SFXSTRITEM_HXX -#include "svtools/svtdllapi.h" -#include <svtools/custritm.hxx> +#include "svl/svldllapi.h" +#include <svl/custritm.hxx> //============================================================================ -class SVT_DLLPUBLIC SfxStringItem: public CntUnencodedStringItem +class SVL_DLLPUBLIC SfxStringItem: public CntUnencodedStringItem { public: TYPEINFO(); diff --git a/svtools/inc/svtools/style.hrc b/svl/inc/svl/style.hrc index ed4db1bf46d0..ed4db1bf46d0 100644 --- a/svtools/inc/svtools/style.hrc +++ b/svl/inc/svl/style.hrc diff --git a/svtools/inc/svtools/style.hxx b/svl/inc/svl/style.hxx index 17e4bf7b9c06..66c130d346dd 100644 --- a/svtools/inc/svtools/style.hxx +++ b/svl/inc/svl/style.hxx @@ -38,16 +38,16 @@ #include <vector> #include <comphelper/weak.hxx> #include <cppuhelper/implbase2.hxx> -#include "svtools/svtdllapi.h" +#include "svl/svldllapi.h" #include <rsc/rscsfx.hxx> #include <tools/string.hxx> -#include <svtools/hint.hxx> -#include <svtools/lstner.hxx> -#include <svtools/brdcst.hxx> -#include <svtools/poolitem.hxx> +#include <svl/hint.hxx> +#include <svl/lstner.hxx> +#include <svl/brdcst.hxx> +#include <svl/poolitem.hxx> #ifndef _SFX_STYLE_HRC -#include <svtools/style.hrc> +#include <svl/style.hrc> #endif class SfxItemSet; @@ -91,7 +91,7 @@ SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *p ) from: #define VIRTUAL510 virtual -class SVT_DLLPUBLIC SfxStyleSheetBase : public comphelper::OWeakTypeObject +class SVL_DLLPUBLIC SfxStyleSheetBase : public comphelper::OWeakTypeObject { friend class SfxStyleSheetBasePool; @@ -165,7 +165,7 @@ typedef std::vector< rtl::Reference< SfxStyleSheetBase > > SfxStyles; //========================================================================= -class SVT_DLLPUBLIC SfxStyleSheetIterator +class SVL_DLLPUBLIC SfxStyleSheetIterator /* [Beschreibung] @@ -195,8 +195,8 @@ protected: private: USHORT GetPos(){return nAktPosition;} - SVT_DLLPRIVATE BOOL IsTrivialSearch(); - SVT_DLLPRIVATE BOOL DoesStyleMatch(SfxStyleSheetBase *pStyle); + SVL_DLLPRIVATE BOOL IsTrivialSearch(); + SVL_DLLPRIVATE BOOL DoesStyleMatch(SfxStyleSheetBase *pStyle); void* pImp; SfxStyleSheetBase* pAktStyle; @@ -210,7 +210,7 @@ friend class SfxStyleSheetBasePool; class SfxStyleSheetBasePool_Impl; -class SVT_DLLPUBLIC SfxStyleSheetBasePool: public SfxBroadcaster, public comphelper::OWeakTypeObject +class SVL_DLLPUBLIC SfxStyleSheetBasePool: public SfxBroadcaster, public comphelper::OWeakTypeObject { friend class SfxStyleSheetIterator; friend class SfxStyleSheetBase; @@ -218,8 +218,8 @@ friend class SfxStyleSheetBase; SfxStyleSheetBasePool_Impl *pImp; private: - SVT_DLLPRIVATE BOOL Load1_Impl( SvStream& ); - SVT_DLLPRIVATE SfxStyleSheetIterator& GetIterator_Impl(); + SVL_DLLPRIVATE BOOL Load1_Impl( SvStream& ); + SVL_DLLPRIVATE SfxStyleSheetIterator& GetIterator_Impl(); protected: String aAppName; SfxItemPool& rPool; @@ -287,7 +287,7 @@ public: //========================================================================= -class SVT_DLLPUBLIC SfxStyleSheet: public SfxStyleSheetBase, +class SVL_DLLPUBLIC SfxStyleSheet: public SfxStyleSheetBase, public SfxListener, public SfxBroadcaster { public: @@ -306,7 +306,7 @@ protected: //========================================================================= -class SVT_DLLPUBLIC SfxStyleSheetPool: public SfxStyleSheetBasePool +class SVL_DLLPUBLIC SfxStyleSheetPool: public SfxStyleSheetBasePool { protected: using SfxStyleSheetBasePool::Create; @@ -334,7 +334,7 @@ public: //======================================================================== -class SVT_DLLPUBLIC SfxStyleSheetPoolHint : public SfxHint +class SVL_DLLPUBLIC SfxStyleSheetPoolHint : public SfxHint { USHORT nHint; @@ -348,7 +348,7 @@ public: //========================================================================= -class SVT_DLLPUBLIC SfxStyleSheetHint: public SfxHint +class SVL_DLLPUBLIC SfxStyleSheetHint: public SfxHint { SfxStyleSheetBase* pStyleSh; USHORT nHint; @@ -364,7 +364,7 @@ public: { return nHint; } }; -class SVT_DLLPUBLIC SfxStyleSheetHintExtended: public SfxStyleSheetHint +class SVL_DLLPUBLIC SfxStyleSheetHintExtended: public SfxStyleSheetHint { String aName; @@ -379,7 +379,7 @@ public: const String& GetOldName() { return aName; } }; -class SVT_DLLPUBLIC SfxUnoStyleSheet : public ::cppu::ImplInheritanceHelper2< SfxStyleSheet, ::com::sun::star::style::XStyle, ::com::sun::star::lang::XUnoTunnel > +class SVL_DLLPUBLIC SfxUnoStyleSheet : public ::cppu::ImplInheritanceHelper2< SfxStyleSheet, ::com::sun::star::style::XStyle, ::com::sun::star::lang::XUnoTunnel > { public: SfxUnoStyleSheet( const UniString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, USHORT _nMaske ); diff --git a/svtools/inc/svtools/svarray.hxx b/svl/inc/svl/svarray.hxx index 3ab3676fa5e0..555b7ad5fe84 100644 --- a/svtools/inc/svtools/svarray.hxx +++ b/svl/inc/svl/svarray.hxx @@ -101,7 +101,7 @@ *********************************************************************** #endif -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #ifndef INCLUDED_STRING_H #include <string.h> // memmove() @@ -1034,7 +1034,7 @@ public:\ #define C40_PTR_REPLACE( c, p) Replace( (c const *) p ) #define C40_GETPOS( c, r) GetPos( (c const *)r ) #else -#if defined WTC || defined IRIX || defined ICC || defined HPUX || (defined GCC && __GNUC__ >= 3) || (defined(WNT) && _MSC_VER >= 1400) +#if defined WTC || defined ICC || defined HPUX || (defined GCC && __GNUC__ >= 3) || (defined(WNT) && _MSC_VER >= 1400) #define C40_INSERT( c, p, n ) Insert( (c const *&) p, n ) #define C40_PUSH( c, p) Push( (c const *&) p ) #define C40_PTR_INSERT( c, p ) Insert( (c const *&) p ) diff --git a/svtools/inc/svtools/svdde.hxx b/svl/inc/svl/svdde.hxx index 82681ed9d240..96a1ffa6bf22 100644 --- a/svtools/inc/svtools/svdde.hxx +++ b/svl/inc/svl/svdde.hxx @@ -31,7 +31,7 @@ #ifndef _SVDDE_HXX #define _SVDDE_HXX -#include "svtools/svtdllapi.h" +#include "svl/svldllapi.h" #include <sot/exchange.hxx> #include <tools/string.hxx> #include <tools/list.hxx> @@ -84,7 +84,7 @@ DECLARE_LIST( StringList, String * ) // - DdeData - // ----------- -class SVT_DLLPUBLIC DdeData +class SVL_DLLPUBLIC DdeData { friend class DdeInternal; friend class DdeService; @@ -93,7 +93,7 @@ class SVT_DLLPUBLIC DdeData DdeDataImp* pImp; //#if 0 // _SOLAR__PRIVATE - SVT_DLLPRIVATE void Lock(); + SVL_DLLPRIVATE void Lock(); //#endif void SetFormat( ULONG nFmt ); @@ -155,7 +155,7 @@ public: // - DdeTransaction - // ------------------ -class SVT_DLLPUBLIC DdeTransaction +class SVL_DLLPUBLIC DdeTransaction { public: virtual void Data( const DdeData* ); @@ -205,7 +205,7 @@ private: // - DdeLink - // ----------- -class SVT_DLLPUBLIC DdeLink : public DdeTransaction +class SVL_DLLPUBLIC DdeLink : public DdeTransaction { Link aNotify; @@ -222,7 +222,7 @@ public: // - DdeWarmLink - // --------------- -class SVT_DLLPUBLIC DdeWarmLink : public DdeLink +class SVL_DLLPUBLIC DdeWarmLink : public DdeLink { public: DdeWarmLink( DdeConnection&, const String&, long = 0 ); @@ -232,7 +232,7 @@ public: // - DdeHotLink - // -------------- -class SVT_DLLPUBLIC DdeHotLink : public DdeLink +class SVL_DLLPUBLIC DdeHotLink : public DdeLink { public: DdeHotLink( DdeConnection&, const String&, long = 0 ); @@ -242,7 +242,7 @@ public: // - DdeRequest - // -------------- -class SVT_DLLPUBLIC DdeRequest : public DdeTransaction +class SVL_DLLPUBLIC DdeRequest : public DdeTransaction { public: DdeRequest( DdeConnection&, const String&, long = 0 ); @@ -252,7 +252,7 @@ public: // - DdePoke - // ----------- -class SVT_DLLPUBLIC DdePoke : public DdeTransaction +class SVL_DLLPUBLIC DdePoke : public DdeTransaction { public: DdePoke( DdeConnection&, const String&, const char*, long, @@ -265,7 +265,7 @@ public: // - DdeExecute - // -------------- -class SVT_DLLPUBLIC DdeExecute : public DdeTransaction +class SVL_DLLPUBLIC DdeExecute : public DdeTransaction { public: DdeExecute( DdeConnection&, const String&, long = 0 ); @@ -275,7 +275,7 @@ public: // - DdeConnection - // ----------------- -class SVT_DLLPUBLIC DdeConnection +class SVL_DLLPUBLIC DdeConnection { friend class DdeInternal; friend class DdeTransaction; @@ -307,7 +307,7 @@ private: // - DdeItem - // ----------- -class SVT_DLLPUBLIC DdeItem +class SVL_DLLPUBLIC DdeItem { friend class DdeInternal; friend class DdeTopic; @@ -336,7 +336,7 @@ public: // - DdeItem - // ----------- -class SVT_DLLPUBLIC DdeGetPutItem : public DdeItem +class SVL_DLLPUBLIC DdeGetPutItem : public DdeItem { public: DdeGetPutItem( const sal_Unicode* p ); @@ -352,9 +352,9 @@ public: // - DdeTopic - // ------------ -class SVT_DLLPUBLIC DdeTopic +class SVL_DLLPUBLIC DdeTopic { - SVT_DLLPRIVATE void _Disconnect( long ); + SVL_DLLPRIVATE void _Disconnect( long ); public: virtual void Connect( long ); @@ -421,7 +421,7 @@ private: // - DdeService - // -------------- -class SVT_DLLPUBLIC DdeService +class SVL_DLLPUBLIC DdeService { friend class DdeInternal; @@ -448,7 +448,7 @@ private: ConvList* pConv; short nStatus; - SVT_DLLPRIVATE BOOL HasCbFormat( USHORT ); + SVL_DLLPRIVATE BOOL HasCbFormat( USHORT ); public: DdeService( const String& ); diff --git a/svtools/inc/iniadrtk.hxx b/svl/inc/svl/svldata.hxx index 1e42abcc6261..468e6025cb5a 100644 --- a/svtools/inc/iniadrtk.hxx +++ b/svl/inc/svl/svldata.hxx @@ -6,8 +6,8 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: iniadrtk.hxx,v $ - * $Revision: 1.3 $ + * $RCSfile: svldata.hxx,v $ + * $Revision: 1.4 $ * * This file is part of OpenOffice.org. * @@ -28,36 +28,48 @@ * ************************************************************************/ -#ifndef SVTOOLS_INIADRTK_HXX -#define SVTOOLS_INIADRTK_HXX +#ifndef _SVL_SVLDATA_HXX +#define _SVL_SVLDATA_HXX -class String; +#include <tools/simplerm.hxx> + +class SfxItemPool; //============================================================================ -enum AddressToken +class ImpSvlData { - ADDRESS_COMPANY, - ADDRESS_STREET, - ADDRESS_COUNTRY, - ADDRESS_PLZ, - ADDRESS_CITY, - ADDRESS_TITLE, - ADDRESS_POSITION, - ADDRESS_TEL_PRIVATE, - ADDRESS_TEL_COMPANY, - ADDRESS_FAX, - ADDRESS_EMAIL, - ADDRESS_STATE, - ADDRESS_FATHERSNAME, - ADDRESS_APARTMENT +public: + const SfxItemPool * pStoringPool; + void* m_pThreadsafeRMs; + // one SimpleResMgr for each language for which a resource was requested + // (When using the 'non-simple' resmgr, the first request for any language wins, any + // further request for any other language supply the resmgr of the first call. + // For the simple resmgr we have a mgr for each language ever requested). + +private: + ImpSvlData(): + pStoringPool(0), m_pThreadsafeRMs(NULL) + {} + + ~ImpSvlData(); + +public: + SimpleResMgr * GetSimpleRM(const ::com::sun::star::lang::Locale& rLocale); + static ImpSvlData & GetSvlData(); }; //============================================================================ -class SfxIniManagerAddressEntry +class SvtSimpleResId { + String m_sValue; + public: - static String get(const String & rAddress, AddressToken eToken); + SvtSimpleResId(USHORT nId, const ::com::sun::star::lang::Locale aLocale) : m_sValue(ImpSvlData::GetSvlData().GetSimpleRM(aLocale)->ReadString(nId)) { }; + + operator String () const { return m_sValue; } }; -#endif // SVTOOLS_INIADRTK_HXX + + +#endif // _SVL_SVLDATA_HXX diff --git a/svtools/inc/svtools/svldllapi.h b/svl/inc/svl/svldllapi.h index 29b2ae29100a..29b2ae29100a 100644 --- a/svtools/inc/svtools/svldllapi.h +++ b/svl/inc/svl/svldllapi.h diff --git a/svtools/inc/svtools/svstdarr.hxx b/svl/inc/svl/svstdarr.hxx index 050b228be4ab..869c70e1cac6 100644 --- a/svtools/inc/svtools/svstdarr.hxx +++ b/svl/inc/svl/svstdarr.hxx @@ -43,8 +43,8 @@ *********************************************************************** #endif -#include "svtools/svldllapi.h" -#include <svtools/svarray.hxx> +#include "svl/svldllapi.h" +#include <svl/svarray.hxx> //#ifdef _SVSTDARR_BOOLS #ifndef _SVSTDARR_BOOLS_DECL diff --git a/svtools/inc/svtools/svtools.hrc b/svl/inc/svl/svtools.hrc index 245d31a2dd21..e4cc91cfcb49 100644 --- a/svtools/inc/svtools/svtools.hrc +++ b/svl/inc/svl/svtools.hrc @@ -30,7 +30,7 @@ #ifndef _SVTOOLS_HRC #define _SVTOOLS_HRC "$Revision: 1.0" -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #define RID_SVTOOLS_BITMAP_START (RID_SVTOOLS_START + 0) #define RID_SVTOOLS_IMAGELIST_START (RID_SVTOOLS_START + 0) @@ -90,17 +90,7 @@ #define STR_SVT_SAMPLES_HELP (RID_SVTOOLS_START+66) #define STR_WARNING_ITEM (RID_SVTOOLS_START+90) -#define STR_CSTAT_NEVER_UPD (RID_SVTOOLS_START+91) -#define STR_CSTAT_IN_UPD (RID_SVTOOLS_START+92) -#define STR_CSTAT_UPD_NEWER (RID_SVTOOLS_START+93) -#define STR_CSTAT_UPD_NOT_NEWER (RID_SVTOOLS_START+94) -#define STR_CSTAT_UPD_CANCEL (RID_SVTOOLS_START+95) -#define STR_CSTAT_ERR_GENERAL (RID_SVTOOLS_START+96) -#define STR_CSTAT_ERR_NOTEXISTS (RID_SVTOOLS_START+97) -#define STR_CSTAT_ERR_NOTREACHED (RID_SVTOOLS_START+98) #define STR_COLUM_DT_AUTO (RID_SVTOOLS_START+99) -#define STR_CSTAT_UPD_IMMEDIATELY (RID_SVTOOLS_START+100) -#define STR_CSTAT_ERR_OFFLINE (RID_SVTOOLS_START+101) #define CONFIG_BASIC_FORMAT_START (RID_SVTOOLS_START+102) #define STR_BASICKEY_FORMAT_ON (RID_SVTOOLS_START+103) diff --git a/svtools/inc/svtools/szitem.hxx b/svl/inc/svl/szitem.hxx index d3fb920aa012..c4b52d4939c0 100644 --- a/svtools/inc/svtools/szitem.hxx +++ b/svl/inc/svl/szitem.hxx @@ -32,7 +32,7 @@ #include <tools/gen.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> class SfxArguments; class SvStream; diff --git a/svtools/inc/svtools/undo.hxx b/svl/inc/svl/undo.hxx index 38cbfb227f1b..354de8b451c7 100644 --- a/svtools/inc/svtools/undo.hxx +++ b/svl/inc/svl/undo.hxx @@ -30,14 +30,14 @@ #ifndef _UNDO_HXX #define _UNDO_HXX -#include "svtools/svtdllapi.h" +#include "svl/svldllapi.h" #include <tools/rtti.hxx> #include <tools/string.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> //==================================================================== -class SVT_DLLPUBLIC SfxRepeatTarget +class SVL_DLLPUBLIC SfxRepeatTarget { public: TYPEINFO(); @@ -46,7 +46,7 @@ public: //==================================================================== -class SVT_DLLPUBLIC SfxUndoAction +class SVL_DLLPUBLIC SfxUndoAction { BOOL bLinked; public: @@ -79,7 +79,7 @@ SV_DECL_PTRARR( SfxUndoActions, SfxUndoAction*, 20, 8 ) /** do not make use of this implementation details, unless you really really have to! */ -struct SVT_DLLPUBLIC SfxUndoArray +struct SVL_DLLPUBLIC SfxUndoArray { SfxUndoActions aUndoActions; USHORT nMaxUndoActions; @@ -95,7 +95,7 @@ struct SVT_DLLPUBLIC SfxUndoArray /** do not make use of this implementation details, unless you really really have to! */ -class SVT_DLLPUBLIC SfxListUndoAction : public SfxUndoAction, public SfxUndoArray +class SVL_DLLPUBLIC SfxListUndoAction : public SfxUndoAction, public SfxUndoArray /* [Beschreibung] @@ -135,7 +135,7 @@ class SVT_DLLPUBLIC SfxListUndoAction : public SfxUndoAction, public SfxUndoArra //========================================================================= -class SVT_DLLPUBLIC SfxUndoManager +class SVL_DLLPUBLIC SfxUndoManager { friend class SfxLinkUndoAction; @@ -197,7 +197,7 @@ public: //========================================================================= -class SVT_DLLPUBLIC SfxLinkUndoAction : public SfxUndoAction +class SVL_DLLPUBLIC SfxLinkUndoAction : public SfxUndoAction /* [Beschreibung] diff --git a/svtools/inc/svtools/urlfilter.hxx b/svl/inc/svl/urlfilter.hxx index 6370a75a1fd7..6370a75a1fd7 100644 --- a/svtools/inc/svtools/urlfilter.hxx +++ b/svl/inc/svl/urlfilter.hxx diff --git a/svtools/inc/svtools/visitem.hxx b/svl/inc/svl/visitem.hxx index 9ace1212d967..1a3918526def 100644 --- a/svtools/inc/svtools/visitem.hxx +++ b/svl/inc/svl/visitem.hxx @@ -31,9 +31,9 @@ #ifndef _SFXVISIBILITYITEM_HXX #define _SFXVISIBILITYITEM_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #include <tools/debug.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include <com/sun/star/frame/status/Visibility.hpp> //============================================================================ diff --git a/svtools/inc/svtools/zforlist.hxx b/svl/inc/svl/zforlist.hxx index 5fd4ee5478da..85d8c0bf6d3a 100644 --- a/svtools/inc/svtools/zforlist.hxx +++ b/svl/inc/svl/zforlist.hxx @@ -30,20 +30,20 @@ #ifndef _ZFORLIST_HXX #define _ZFORLIST_HXX -#include "svtools/svtdllapi.h" +#include "svl/svldllapi.h" #include <tools/string.hxx> #ifndef _TABLE_HXX //autogen #include <tools/table.hxx> #endif #include <i18npool/lang.h> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/i18n/NumberFormatCode.hpp> #include <unotools/localedatawrapper.hxx> -#include <svtools/ondemand.hxx> +#include <svl/ondemand.hxx> #include <tools/link.hxx> -#include <svtools/nfkeytab.hxx> +#include <svl/nfkeytab.hxx> #include <map> @@ -231,7 +231,7 @@ typedef ::std::map< sal_uInt32, sal_uInt32 > SvNumberFormatterMergeMap; /** Language/country dependent currency entries */ -class SVT_DLLPUBLIC NfCurrencyEntry +class SVL_DLLPUBLIC NfCurrencyEntry { String aSymbol; /// currency symbol String aBankSymbol; /// currency abbreviation @@ -251,7 +251,7 @@ private: //#if 0 // _SOLAR__PRIVATE // nDecimalFormat := 0, 1, 2 // #,##0 or #,##0.00 or #,##0.-- are assigned - SVT_DLLPRIVATE void Impl_BuildFormatStringNumChars( String&, + SVL_DLLPRIVATE void Impl_BuildFormatStringNumChars( String&, const LocaleDataWrapper&, USHORT nDecimalFormat ) const; //#endif // __PRIVATE @@ -328,12 +328,12 @@ public: typedef NfCurrencyEntry* NfCurrencyEntryPtr; SV_DECL_PTRARR_DEL( NfCurrencyTable, NfCurrencyEntryPtr, 128, 1 ) typedef String* WSStringPtr; -SV_DECL_PTRARR_DEL_VISIBILITY( NfWSStringsDtor, WSStringPtr, 8, 1, SVT_DLLPUBLIC ) +SV_DECL_PTRARR_DEL_VISIBILITY( NfWSStringsDtor, WSStringPtr, 8, 1, SVL_DLLPUBLIC ) class SvNumberFormatterRegistry_Impl; -class SVT_DLLPUBLIC SvNumberFormatter +class SVL_DLLPUBLIC SvNumberFormatter { public: /** @@ -824,37 +824,37 @@ private: #ifdef _ZFORLIST_CXX // ----- private Methoden ----- - SVT_DLLPRIVATE static BOOL bCurrencyTableInitialized; - SVT_DLLPRIVATE static USHORT nSystemCurrencyPosition; - SVT_DLLPRIVATE static SvNumberFormatterRegistry_Impl* pFormatterRegistry; + SVL_DLLPRIVATE static BOOL bCurrencyTableInitialized; + SVL_DLLPRIVATE static USHORT nSystemCurrencyPosition; + SVL_DLLPRIVATE static SvNumberFormatterRegistry_Impl* pFormatterRegistry; // get the registry, create one if none exists - SVT_DLLPRIVATE static SvNumberFormatterRegistry_Impl& GetFormatterRegistry(); + SVL_DLLPRIVATE static SvNumberFormatterRegistry_Impl& GetFormatterRegistry(); // called by ctors - SVT_DLLPRIVATE void ImpConstruct( LanguageType eLang ); + SVL_DLLPRIVATE void ImpConstruct( LanguageType eLang ); // Changes initialized language/country, clears the entries and generates // new ones, may ONLY be called by the binary file format load - SVT_DLLPRIVATE void ImpChangeSysCL( LanguageType eLnge, BOOL bLoadingSO5 ); + SVL_DLLPRIVATE void ImpChangeSysCL( LanguageType eLnge, BOOL bLoadingSO5 ); // Generate builtin formats provided by i18n behind CLOffset, // if bLoadingSO5==FALSE also generate additional i18n formats. - SVT_DLLPRIVATE void ImpGenerateFormats( sal_uInt32 CLOffset, BOOL bLoadingSO5 ); + SVL_DLLPRIVATE void ImpGenerateFormats( sal_uInt32 CLOffset, BOOL bLoadingSO5 ); // Generate additional formats provided by i18n - SVT_DLLPRIVATE void ImpGenerateAdditionalFormats( + SVL_DLLPRIVATE void ImpGenerateAdditionalFormats( sal_uInt32 CLOffset, NumberFormatCodeWrapper& rNumberFormatCode, BOOL bAfterLoadingSO5 ); - SVT_DLLPRIVATE SvNumberformat* ImpInsertFormat( + SVL_DLLPRIVATE SvNumberformat* ImpInsertFormat( const ::com::sun::star::i18n::NumberFormatCode& rCode, sal_uInt32 nPos, BOOL bAfterLoadingSO5 = FALSE, sal_Int16 nOrgIndex = 0 ); // ImpInsertNewStandardFormat for new (since version ...) builtin formats - SVT_DLLPRIVATE SvNumberformat* ImpInsertNewStandardFormat( + SVL_DLLPRIVATE SvNumberformat* ImpInsertNewStandardFormat( const ::com::sun::star::i18n::NumberFormatCode& rCode, sal_uInt32 nPos, USHORT nVersion, @@ -862,41 +862,41 @@ private: sal_Int16 nOrgIndex = 0 ); // Return CLOffset or (MaxCLOffset + SV_COUNTRY_LANGUAGE_OFFSET) if new language/country - SVT_DLLPRIVATE sal_uInt32 ImpGetCLOffset(LanguageType eLnge) const; + SVL_DLLPRIVATE sal_uInt32 ImpGetCLOffset(LanguageType eLnge) const; // Test whether format code already exists, then return index key, // otherwise NUMBERFORMAT_ENTRY_NOT_FOUND - SVT_DLLPRIVATE sal_uInt32 ImpIsEntry( const String& rString, + SVL_DLLPRIVATE sal_uInt32 ImpIsEntry( const String& rString, sal_uInt32 CLOffset, LanguageType eLnge ); // Create builtin formats for language/country if necessary, return CLOffset - SVT_DLLPRIVATE sal_uInt32 ImpGenerateCL( LanguageType eLnge, BOOL bLoadingSO5 = FALSE ); + SVL_DLLPRIVATE sal_uInt32 ImpGenerateCL( LanguageType eLnge, BOOL bLoadingSO5 = FALSE ); // Build negative currency format, old compatibility style - SVT_DLLPRIVATE void ImpGetNegCurrFormat( String& sNegStr, const String& rCurrSymbol ); + SVL_DLLPRIVATE void ImpGetNegCurrFormat( String& sNegStr, const String& rCurrSymbol ); // Build positive currency format, old compatibility style - SVT_DLLPRIVATE void ImpGetPosCurrFormat( String& sPosStr, const String& rCurrSymbol ); + SVL_DLLPRIVATE void ImpGetPosCurrFormat( String& sPosStr, const String& rCurrSymbol ); // Create <type>theCurrencyTable</type> with all <type>NfCurrencyEntry</type> - SVT_DLLPRIVATE static void ImpInitCurrencyTable(); + SVL_DLLPRIVATE static void ImpInitCurrencyTable(); // Return the format index of the currency format of the system locale. // Format is created if not already present. - SVT_DLLPRIVATE sal_uInt32 ImpGetDefaultSystemCurrencyFormat(); + SVL_DLLPRIVATE sal_uInt32 ImpGetDefaultSystemCurrencyFormat(); // Return the format index of the currency format of the current locale. // Format is created if not already present. - SVT_DLLPRIVATE sal_uInt32 ImpGetDefaultCurrencyFormat(); + SVL_DLLPRIVATE sal_uInt32 ImpGetDefaultCurrencyFormat(); // Return the default format for a given type and current locale. // May ONLY be called from within GetStandardFormat(). - SVT_DLLPRIVATE sal_uInt32 ImpGetDefaultFormat( short nType ); + SVL_DLLPRIVATE sal_uInt32 ImpGetDefaultFormat( short nType ); // Return the index in a sequence of format codes matching an enum of // NfIndexTableOffset. If not found 0 is returned. If the sequence doesn't // contain any format code elements a default element is created and inserted. - SVT_DLLPRIVATE sal_Int32 ImpGetFormatCodeIndex( + SVL_DLLPRIVATE sal_Int32 ImpGetFormatCodeIndex( ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode >& rSeq, const NfIndexTableOffset nTabOff ); @@ -906,13 +906,13 @@ private: // Return the default index in the sequence. // Non-PRODUCT version may check locale data for matching defaults in one // FormatElement group. - SVT_DLLPRIVATE sal_Int32 ImpAdjustFormatCodeDefault( + SVL_DLLPRIVATE sal_Int32 ImpAdjustFormatCodeDefault( ::com::sun::star::i18n::NumberFormatCode * pFormatArr, sal_Int32 nCount, BOOL bCheckCorrectness = TRUE ); // used as a loop body inside of GetNewCurrencySymbolString() and GetCurrencyEntry() -#ifdef PRODUCT +#ifndef DBG_UTIL inline #endif static BOOL ImpLookupCurrencyEntryLoopBody( diff --git a/svtools/inc/svtools/zformat.hxx b/svl/inc/svl/zformat.hxx index ef567acf32df..c88eeeea88f4 100644 --- a/svtools/inc/svtools/zformat.hxx +++ b/svl/inc/svl/zformat.hxx @@ -30,12 +30,12 @@ #ifndef _ZFORMAT_HXX #define _ZFORMAT_HXX -#include "svtools/svtdllapi.h" +#include "svl/svldllapi.h" #include <tools/string.hxx> #include <i18npool/mslangid.hxx> -#include <svtools/zforlist.hxx> -#include <svtools/nfversi.hxx> -#include <svtools/nfkeytab.hxx> +#include <svl/zforlist.hxx> +#include <svl/nfversi.hxx> +#include <svl/nfkeytab.hxx> // We need ImpSvNumberformatScan for the private SvNumberformat definitions. #ifdef _ZFORMAT_CXX @@ -175,7 +175,7 @@ private: }; -class SVT_DLLPUBLIC SvNumberformat +class SVL_DLLPUBLIC SvNumberformat { public: // Ctor for Load @@ -467,11 +467,11 @@ private: BOOL bStandard; // If this is a default standard format BOOL bIsUsed; // Flag as used for storing - SVT_DLLPRIVATE USHORT ImpGetNumForStringElementCount( USHORT nNumFor ) const; + SVL_DLLPRIVATE USHORT ImpGetNumForStringElementCount( USHORT nNumFor ) const; - SVT_DLLPRIVATE BOOL ImpIsOtherCalendar( const ImpSvNumFor& rNumFor ) const; + SVL_DLLPRIVATE BOOL ImpIsOtherCalendar( const ImpSvNumFor& rNumFor ) const; - SVT_DLLPRIVATE BOOL ImpSwitchToSpecifiedCalendar( String& rOrgCalendar, + SVL_DLLPRIVATE BOOL ImpSwitchToSpecifiedCalendar( String& rOrgCalendar, double& fOrgDateTime, const ImpSvNumFor& rNumFor ) const; #ifdef _ZFORMAT_CXX // ----- private implementation methods ----- @@ -482,37 +482,37 @@ private: const SvNumberFormatter& GetFormatter() const { return *rScan.GetNumberformatter(); } // divide in substrings and color conditions - SVT_DLLPRIVATE short ImpNextSymbol( String& rString, + SVL_DLLPRIVATE short ImpNextSymbol( String& rString, xub_StrLen& nPos, String& sSymbol ); // read string until ']' and strip blanks (after condition) - SVT_DLLPRIVATE static xub_StrLen ImpGetNumber( String& rString, + SVL_DLLPRIVATE static xub_StrLen ImpGetNumber( String& rString, xub_StrLen& nPos, String& sSymbol ); // get xxx of "[$-xxx]" as LanguageType, starting at and advancing position nPos - SVT_DLLPRIVATE static LanguageType ImpGetLanguageType( const String& rString, xub_StrLen& nPos ); + SVL_DLLPRIVATE static LanguageType ImpGetLanguageType( const String& rString, xub_StrLen& nPos ); // standard number output - SVT_DLLPRIVATE void ImpGetOutputStandard( double& fNumber, String& OutString ); - SVT_DLLPRIVATE void ImpGetOutputStdToPrecision( double& rNumber, String& rOutString, sal_uInt16 nPrecision ) const; + SVL_DLLPRIVATE void ImpGetOutputStandard( double& fNumber, String& OutString ); + SVL_DLLPRIVATE void ImpGetOutputStdToPrecision( double& rNumber, String& rOutString, sal_uInt16 nPrecision ) const; // numbers in input line - SVT_DLLPRIVATE void ImpGetOutputInputLine( double fNumber, String& OutString ); + SVL_DLLPRIVATE void ImpGetOutputInputLine( double fNumber, String& OutString ); // check subcondition // OP undefined => -1 // else 0 or 1 - SVT_DLLPRIVATE short ImpCheckCondition(double& fNumber, + SVL_DLLPRIVATE short ImpCheckCondition(double& fNumber, double& fLimit, SvNumberformatLimitOps eOp); - SVT_DLLPRIVATE ULONG ImpGGT(ULONG x, ULONG y); - SVT_DLLPRIVATE ULONG ImpGGTRound(ULONG x, ULONG y); + SVL_DLLPRIVATE ULONG ImpGGT(ULONG x, ULONG y); + SVL_DLLPRIVATE ULONG ImpGGTRound(ULONG x, ULONG y); // Helper function for number strings // append string symbols, insert leading 0 or ' ', or ... - SVT_DLLPRIVATE BOOL ImpNumberFill( String& sStr, + SVL_DLLPRIVATE BOOL ImpNumberFill( String& sStr, double& rNumber, xub_StrLen& k, USHORT& j, @@ -520,7 +520,7 @@ private: short eSymbolType ); // Helper function to fill in the integer part and the group (AKA thousand) separators - SVT_DLLPRIVATE BOOL ImpNumberFillWithThousands( String& sStr, + SVL_DLLPRIVATE BOOL ImpNumberFillWithThousands( String& sStr, double& rNumber, xub_StrLen k, USHORT j, @@ -531,20 +531,20 @@ private: // Helper function to fill in the group (AKA thousand) separators // or to skip additional digits - SVT_DLLPRIVATE void ImpDigitFill( String& sStr, + SVL_DLLPRIVATE void ImpDigitFill( String& sStr, xub_StrLen nStart, xub_StrLen& k, USHORT nIx, xub_StrLen & nDigitCount, utl::DigitGroupingIterator & ); - SVT_DLLPRIVATE BOOL ImpGetDateOutput( double fNumber, + SVL_DLLPRIVATE BOOL ImpGetDateOutput( double fNumber, USHORT nIx, String& OutString ); - SVT_DLLPRIVATE BOOL ImpGetTimeOutput( double fNumber, + SVL_DLLPRIVATE BOOL ImpGetTimeOutput( double fNumber, USHORT nIx, String& OutString ); - SVT_DLLPRIVATE BOOL ImpGetDateTimeOutput( double fNumber, + SVL_DLLPRIVATE BOOL ImpGetDateTimeOutput( double fNumber, USHORT nIx, String& OutString ); @@ -553,23 +553,23 @@ private: // know a "before" era (like zh_TW ROC or ja_JP Gengou). If switched and // rOrgCalendar was "gregorian" the string is emptied. If rOrgCalendar was // empty the previous calendar name and date/time are returned. - SVT_DLLPRIVATE BOOL ImpFallBackToGregorianCalendar( String& rOrgCalendar, double& fOrgDateTime ); + SVL_DLLPRIVATE BOOL ImpFallBackToGregorianCalendar( String& rOrgCalendar, double& fOrgDateTime ); // Append a "G" short era string of the given calendar. In the case of a // Gengou calendar this is a one character abbreviation, for other // calendars the XExtendedCalendar::getDisplayString() method is called. - SVT_DLLPRIVATE static void ImpAppendEraG( String& OutString, const CalendarWrapper& rCal, + SVL_DLLPRIVATE static void ImpAppendEraG( String& OutString, const CalendarWrapper& rCal, sal_Int16 nNatNum ); - SVT_DLLPRIVATE BOOL ImpGetNumberOutput( double fNumber, + SVL_DLLPRIVATE BOOL ImpGetNumberOutput( double fNumber, USHORT nIx, String& OutString ); - SVT_DLLPRIVATE void ImpCopyNumberformat( const SvNumberformat& rFormat ); + SVL_DLLPRIVATE void ImpCopyNumberformat( const SvNumberformat& rFormat ); // normal digits or other digits, depending on ImpSvNumFor.aNatNum, // [NatNum1], [NatNum2], ... - SVT_DLLPRIVATE String ImpGetNatNumString( const SvNumberNatNum& rNum, sal_Int32 nVal, + SVL_DLLPRIVATE String ImpGetNatNumString( const SvNumberNatNum& rNum, sal_Int32 nVal, USHORT nMinDigits = 0 ) const; String ImpIntToString( USHORT nIx, sal_Int32 nVal, USHORT nMinDigits = 0 ) const @@ -581,7 +581,7 @@ private: } // transliterate according to NativeNumber - SVT_DLLPRIVATE void ImpTransliterateImpl( String& rStr, const SvNumberNatNum& rNum ) const; + SVL_DLLPRIVATE void ImpTransliterateImpl( String& rStr, const SvNumberNatNum& rNum ) const; void ImpTransliterate( String& rStr, const SvNumberNatNum& rNum ) const { diff --git a/svtools/inc/urihelper.hxx b/svl/inc/urihelper.hxx index 209f3f04e28a..8be500e438ce 100644 --- a/svtools/inc/urihelper.hxx +++ b/svl/inc/urihelper.hxx @@ -31,7 +31,7 @@ #ifndef SVTOOLS_URIHELPER_HXX #define SVTOOLS_URIHELPER_HXX -#include "svtools/svtdllapi.h" +#include "svl/svldllapi.h" #include "com/sun/star/uno/Reference.hxx" #include <com/sun/star/uno/RuntimeException.hpp> #include <rtl/textenc.h> @@ -64,7 +64,7 @@ namespace URIHelper { existence (see URIHelper::GetMaybeFileHdl), or use bCheckFileExists = false if you want to generate file URLs without checking for their existence. */ -SVT_DLLPUBLIC UniString +SVL_DLLPUBLIC UniString SmartRel2Abs(INetURLObject const & rTheBaseURIRef, ByteString const & rTheRelURIRef, Link const & rMaybeFileHdl = Link(), @@ -91,7 +91,7 @@ SmartRel2Abs(INetURLObject const & rTheBaseURIRef, existence (see URIHelper::GetMaybeFileHdl), or use bCheckFileExists = false if you want to generate file URLs without checking for their existence. */ -SVT_DLLPUBLIC UniString +SVL_DLLPUBLIC UniString SmartRel2Abs(INetURLObject const & rTheBaseURIRef, UniString const & rTheRelURIRef, Link const & rMaybeFileHdl = Link(), @@ -106,10 +106,10 @@ SmartRel2Abs(INetURLObject const & rTheBaseURIRef, INetURLObject::FSysStyle eStyle = INetURLObject::FSYS_DETECT); //============================================================================ -SVT_DLLPUBLIC void SetMaybeFileHdl(Link const & rTheMaybeFileHdl); +SVL_DLLPUBLIC void SetMaybeFileHdl(Link const & rTheMaybeFileHdl); //============================================================================ -SVT_DLLPUBLIC Link GetMaybeFileHdl(); +SVL_DLLPUBLIC Link GetMaybeFileHdl(); /** Converts a URI reference to a relative one, ignoring certain differences (for @@ -131,7 +131,7 @@ SVT_DLLPUBLIC Link GetMaybeFileHdl(); @exception com::sun::star::uno::RuntimeException if any error occurs */ -SVT_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::uri::XUriReference > +SVL_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::uri::XUriReference > normalizedMakeRelative( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context, @@ -159,11 +159,11 @@ normalizedMakeRelative( @deprecated No code should rely on the default component context. */ -SVT_DLLPUBLIC rtl::OUString simpleNormalizedMakeRelative( +SVL_DLLPUBLIC rtl::OUString simpleNormalizedMakeRelative( rtl::OUString const & baseUriReference, rtl::OUString const & uriReference); //============================================================================ -SVT_DLLPUBLIC UniString +SVL_DLLPUBLIC UniString FindFirstURLInText(UniString const & rText, xub_StrLen & rBegin, xub_StrLen & rEnd, @@ -200,7 +200,7 @@ FindFirstURLInText(UniString const & rText, @return The input URI with any password component removed. */ -SVT_DLLPUBLIC UniString +SVL_DLLPUBLIC UniString removePassword(UniString const & rURI, INetURLObject::EncodeMechanism eEncodeMechanism = INetURLObject::WAS_ENCODED, @@ -229,7 +229,7 @@ removePassword(UniString const & rURI, @return The style bit corresponding to the queried content provider's conventions, or FSysStyle(0) if these cannot be determined. */ -SVT_DLLPUBLIC INetURLObject::FSysStyle queryFSysStyle(UniString const & rFileUrl, +SVL_DLLPUBLIC INetURLObject::FSysStyle queryFSysStyle(UniString const & rFileUrl, bool bAddConvenienceStyles = true) throw (com::sun::star::uno::RuntimeException); diff --git a/svtools/inc/urlbmk.hxx b/svl/inc/urlbmk.hxx index d3342b398878..d3342b398878 100644 --- a/svtools/inc/urlbmk.hxx +++ b/svl/inc/urlbmk.hxx diff --git a/svtools/inc/whiter.hxx b/svl/inc/whiter.hxx index 87ed2cbc76f0..d2bd7c88d521 100644 --- a/svtools/inc/whiter.hxx +++ b/svl/inc/whiter.hxx @@ -30,7 +30,7 @@ #ifndef _SFX_WHITER_HXX #define _SFX_WHITER_HXX -#include "svtools/svldllapi.h" +#include "svl/svldllapi.h" #ifndef INCLUDED_LIMITS_H #include <limits.h> diff --git a/svtools/inc/xmlement.hxx b/svl/inc/xmlement.hxx index ed0e4dafc57a..ed0e4dafc57a 100644 --- a/svtools/inc/xmlement.hxx +++ b/svl/inc/xmlement.hxx diff --git a/svl/prj/build.lst b/svl/prj/build.lst new file mode 100644 index 000000000000..f2d4bf324d01 --- /dev/null +++ b/svl/prj/build.lst @@ -0,0 +1,22 @@ +sl svl : l10n rsc offuh ucbhelper unotools cppu cppuhelper comphelper sal sot NULL +sl svl usr1 - all svl_mkout NULL +sl svl\inc nmake - all svl_inc NULL +sl svl\unx\source\svdde nmake - u svl_usdde svl_inc NULL +sl svl\unx\source\svdde nmake - p svl_psdde svl_inc NULL +sl svl\source\config nmake - all svl_conf svl_inc NULL +sl svl\source\filepicker nmake - all svl_filepick svl_inc NULL +sl svl\source\filerec nmake - all svl_file svl_inc NULL +sl svl\source\items nmake - all svl__item svl_inc NULL +sl svl\source\memtools nmake - all svl_mem svl_inc NULL +sl svl\source\misc nmake - all svl__misc svl_inc NULL +sl svl\source\notify nmake - all svl_not svl_inc NULL +sl svl\source\numbers nmake - all svl_num svl_inc NULL +sl svl\source\svdde nmake - all svl__dde svl_inc NULL +sl svl\source\svsql nmake - all svl_sql svl_inc NULL +sl svl\source\undo nmake - all svl_undo svl_inc NULL +sl svl\source\uno nmake - all svl_uno svl_inc NULL +sl svl\util nmake - all svl_util svl_usdde.u svl_psdde.p svl_conf svl_filepick svl_file svl__item svl_mem svl__misc svl_not svl_num svl__dde svl_sql svl_undo svl_uno NULL +sl svl\source\fsstor nmake - all svl_fsstor svl_inc NULL +sl svl\source\passwordcontainer nmake - all svl_passcont svl_inc NULL + + diff --git a/svl/prj/d.lst b/svl/prj/d.lst new file mode 100644 index 000000000000..a5c2564e81cd --- /dev/null +++ b/svl/prj/d.lst @@ -0,0 +1,22 @@ +mkdir: %COMMON_DEST%\bin%_EXT%\hid +mkdir: %COMMON_DEST%\res%_EXT% +mkdir: %_DEST%\inc%_EXT%\svl + +..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid +..\%__SRC%\lib\isvl.lib %_DEST%\lib%_EXT%\isvl.lib +..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\* +..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\* +..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\* +..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\* + +..\inc\svl\*.hrc %_DEST%\inc%_EXT%\svl\*.hrc +..\inc\svl\*.hxx %_DEST%\inc%_EXT%\svl\*.hxx +..\inc\svl\*.h %_DEST%\inc%_EXT%\svl\*.h +..\inc\*.hrc %_DEST%\inc%_EXT%\svl\*.hrc +..\inc\*.hxx %_DEST%\inc%_EXT%\svl\*.hxx +..\inc\*.h %_DEST%\inc%_EXT%\svl\*.h + +dos: sh -c "if test %OS% = MACOSX; then macosx-create-bundle %_DEST%\bin%_EXT%\bmp=%__PRJROOT%\%__SRC%\bin%_EXT%; fi" + +*.xml %_DEST%\xml%_EXT%\*.xml + diff --git a/svtools/qa/complex/ConfigItems/CheckConfigItems.java b/svl/qa/complex/ConfigItems/CheckConfigItems.java index 97cc21fdec9f..6f4d0ba3d945 100644 --- a/svtools/qa/complex/ConfigItems/CheckConfigItems.java +++ b/svl/qa/complex/ConfigItems/CheckConfigItems.java @@ -102,7 +102,7 @@ public class CheckConfigItems extends ComplexTestCase // create module manager m_xTest = (XJob)UnoRuntime.queryInterface( XJob.class, - m_xSmgr.createInstance("com.sun.star.comp.svtools.ConfigItemTest")); + m_xSmgr.createInstance("com.sun.star.comp.svl.ConfigItemTest")); } //------------------------------------------- diff --git a/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx b/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx index d853bf926467..d853bf926467 100644 --- a/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx +++ b/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx diff --git a/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx b/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx index fc2f4681e4fe..58bb58f8c215 100644 --- a/svtools/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx +++ b/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx @@ -37,7 +37,7 @@ #define SVTOOLS_ACCESSIBILITYOPTTEST_HXX #include <com/sun/star/container/XNameAccess.hpp> -#include <svtools/accessibilityoptions.hxx> +#include <svl/accessibilityoptions.hxx> namespace css = ::com::sun::star; diff --git a/svtools/qa/complex/ConfigItems/helper/ConfigItemTest.cxx b/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx index b21d9d76755e..ad9dda313a5c 100644 --- a/svtools/qa/complex/ConfigItems/helper/ConfigItemTest.cxx +++ b/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx @@ -51,7 +51,7 @@ //============================================================================= namespace css = ::com::sun::star; -namespace svtools{ +namespace svl{ //============================================================================= static const ::rtl::OUString PROP_TEST = ::rtl::OUString::createFromAscii("Test"); @@ -196,7 +196,7 @@ css::uno::Sequence< ::rtl::OUString > SAL_CALL ConfigItemTest::getSupportedServi //============================================================================= ::rtl::OUString SAL_CALL ConfigItemTest::st_getImplementationName() { - return ::rtl::OUString::createFromAscii("com.sun.star.comp.svtools.ConfigItemTest"); + return ::rtl::OUString::createFromAscii("com.sun.star.comp.svl.ConfigItemTest"); } //============================================================================= @@ -215,15 +215,15 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL ConfigItemTest::st_create(c return xObject; } -} // namespace svtools +} // namespace svl //============================================================================= static ::cppu::ImplementationEntry const lRegEntries[] = { { - &::svtools::ConfigItemTest::st_create, - &::svtools::ConfigItemTest::st_getImplementationName, - &::svtools::ConfigItemTest::st_getSupportedServiceNames, + &::svl::ConfigItemTest::st_create, + &::svl::ConfigItemTest::st_getImplementationName, + &::svl::ConfigItemTest::st_getSupportedServiceNames, &::cppu::createSingleComponentFactory, 0, 0 }, diff --git a/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.cxx b/svl/qa/complex/ConfigItems/helper/HistoryOptTest.cxx index 723b3e44f3e5..082328835fca 100644 --- a/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.cxx +++ b/svl/qa/complex/ConfigItems/helper/HistoryOptTest.cxx @@ -34,7 +34,7 @@ ************************************************************************/ #include "HistoryOptTest.hxx" -#include "configitems/historyoptions_const.hxx" +#include <unotools/historyoptions_const.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/PropertyValue.hpp> diff --git a/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.hxx b/svl/qa/complex/ConfigItems/helper/HistoryOptTest.hxx index fca9802d2781..8415d9f989b9 100644 --- a/svtools/qa/complex/ConfigItems/helper/HistoryOptTest.hxx +++ b/svl/qa/complex/ConfigItems/helper/HistoryOptTest.hxx @@ -37,7 +37,7 @@ #define SVTOOLS_HISTORYOPTTEST_HXX #include <com/sun/star/container/XNameAccess.hpp> -#include <svtools/historyoptions.hxx> +#include <unotools/historyoptions.hxx> namespace css = ::com::sun::star; diff --git a/svtools/qa/complex/ConfigItems/helper/PrintOptTest.cxx b/svl/qa/complex/ConfigItems/helper/PrintOptTest.cxx index 69504e4d5d7e..69504e4d5d7e 100644 --- a/svtools/qa/complex/ConfigItems/helper/PrintOptTest.cxx +++ b/svl/qa/complex/ConfigItems/helper/PrintOptTest.cxx diff --git a/svtools/qa/complex/ConfigItems/helper/PrintOptTest.hxx b/svl/qa/complex/ConfigItems/helper/PrintOptTest.hxx index 14d4267b8878..79505a4e6faf 100644 --- a/svtools/qa/complex/ConfigItems/helper/PrintOptTest.hxx +++ b/svl/qa/complex/ConfigItems/helper/PrintOptTest.hxx @@ -37,7 +37,7 @@ #define SVTOOLS_PRINTOPTTEST_HXX #include <com/sun/star/container/XNameAccess.hpp> -#include <svtools/printoptions.hxx> +#include <svl/printoptions.hxx> namespace css = ::com::sun::star; diff --git a/svtools/qa/complex/ConfigItems/helper/UserOptTest.cxx b/svl/qa/complex/ConfigItems/helper/UserOptTest.cxx index 14ee513ee0cb..14ee513ee0cb 100644 --- a/svtools/qa/complex/ConfigItems/helper/UserOptTest.cxx +++ b/svl/qa/complex/ConfigItems/helper/UserOptTest.cxx diff --git a/svtools/qa/complex/ConfigItems/helper/UserOptTest.hxx b/svl/qa/complex/ConfigItems/helper/UserOptTest.hxx index 8234b0b7edf4..72ff71cafe2d 100644 --- a/svtools/qa/complex/ConfigItems/helper/UserOptTest.hxx +++ b/svl/qa/complex/ConfigItems/helper/UserOptTest.hxx @@ -37,7 +37,7 @@ #define SVTOOLS_USEROPTTEST_HXX #include <com/sun/star/container/XNameAccess.hpp> -#include <svtools/useroptions.hxx> +#include <unotools/useroptions.hxx> namespace css = ::com::sun::star; diff --git a/svtools/qa/complex/ConfigItems/helper/exports.map b/svl/qa/complex/ConfigItems/helper/exports.map index 85610ad80888..85610ad80888 100644 --- a/svtools/qa/complex/ConfigItems/helper/exports.map +++ b/svl/qa/complex/ConfigItems/helper/exports.map diff --git a/svtools/qa/complex/ConfigItems/helper/makefile.mk b/svl/qa/complex/ConfigItems/helper/makefile.mk index 6070d25b7bd4..d41fe6c129c6 100644 --- a/svtools/qa/complex/ConfigItems/helper/makefile.mk +++ b/svl/qa/complex/ConfigItems/helper/makefile.mk @@ -34,7 +34,7 @@ #************************************************************************* PRJ=..$/..$/..$/.. -PRJNAME= svtools +PRJNAME= svl TARGET= ConfigItemTest USE_DEFFILE= TRUE ENABLE_EXCEPTIONS= TRUE @@ -60,7 +60,7 @@ SHL1OBJS= \ $(SLO)$/ConfigItemTest.obj SHL1STDLIBS= \ - $(SVTOOLLIB) \ + $(SVLIB) \ $(SVLLIB) \ $(UNOTOOLSLIB) \ $(COMPHELPERLIB) \ diff --git a/svtools/qa/complex/ConfigItems/makefile.mk b/svl/qa/complex/ConfigItems/makefile.mk index f85c5b0a8e65..1291184346bc 100644 --- a/svtools/qa/complex/ConfigItems/makefile.mk +++ b/svl/qa/complex/ConfigItems/makefile.mk @@ -34,7 +34,7 @@ #************************************************************************* PRJ = ..$/..$/.. TARGET = CheckConfigItems -PRJNAME = svtools +PRJNAME = svl PACKAGE = complex$/ConfigItems # --- Settings ----------------------------------------------------- diff --git a/svtools/qa/complex/passwordcontainer/MasterPasswdHandler.java b/svl/qa/complex/passwordcontainer/MasterPasswdHandler.java index bf6159ee38c5..bf6159ee38c5 100644 --- a/svtools/qa/complex/passwordcontainer/MasterPasswdHandler.java +++ b/svl/qa/complex/passwordcontainer/MasterPasswdHandler.java diff --git a/svtools/qa/complex/passwordcontainer/PasswordContainerTest.java b/svl/qa/complex/passwordcontainer/PasswordContainerTest.java index 5da0676f8bb9..5da0676f8bb9 100644 --- a/svtools/qa/complex/passwordcontainer/PasswordContainerTest.java +++ b/svl/qa/complex/passwordcontainer/PasswordContainerTest.java diff --git a/svtools/qa/complex/passwordcontainer/PasswordContainerUnitTest.java b/svl/qa/complex/passwordcontainer/PasswordContainerUnitTest.java index aee1c9355a3f..aee1c9355a3f 100644 --- a/svtools/qa/complex/passwordcontainer/PasswordContainerUnitTest.java +++ b/svl/qa/complex/passwordcontainer/PasswordContainerUnitTest.java diff --git a/svtools/qa/complex/passwordcontainer/Test01.java b/svl/qa/complex/passwordcontainer/Test01.java index 6de96de05ec9..6de96de05ec9 100644 --- a/svtools/qa/complex/passwordcontainer/Test01.java +++ b/svl/qa/complex/passwordcontainer/Test01.java diff --git a/svtools/qa/complex/passwordcontainer/Test02.java b/svl/qa/complex/passwordcontainer/Test02.java index 5d65d8090cf9..5d65d8090cf9 100644 --- a/svtools/qa/complex/passwordcontainer/Test02.java +++ b/svl/qa/complex/passwordcontainer/Test02.java diff --git a/svtools/qa/complex/passwordcontainer/Test03.java b/svl/qa/complex/passwordcontainer/Test03.java index 69de8b88578b..69de8b88578b 100644 --- a/svtools/qa/complex/passwordcontainer/Test03.java +++ b/svl/qa/complex/passwordcontainer/Test03.java diff --git a/svtools/qa/complex/passwordcontainer/TestHelper.java b/svl/qa/complex/passwordcontainer/TestHelper.java index 0f83a9ef9963..0f83a9ef9963 100644 --- a/svtools/qa/complex/passwordcontainer/TestHelper.java +++ b/svl/qa/complex/passwordcontainer/TestHelper.java diff --git a/svtools/qa/complex/passwordcontainer/makefile.mk b/svl/qa/complex/passwordcontainer/makefile.mk index 4ce811bd3616..c3ff7538af0f 100644 --- a/svtools/qa/complex/passwordcontainer/makefile.mk +++ b/svl/qa/complex/passwordcontainer/makefile.mk @@ -31,7 +31,7 @@ PRJ = ..$/..$/.. TARGET = PasswordContainerUnitTest -PRJNAME = svtools +PRJNAME=svl PACKAGE = complex$/passwordcontainer # --- Settings ----------------------------------------------------- diff --git a/svtools/qa/export.map b/svl/qa/export.map index 80373c145ac1..80373c145ac1 100755..100644 --- a/svtools/qa/export.map +++ b/svl/qa/export.map diff --git a/svtools/qa/makefile.mk b/svl/qa/makefile.mk index cbb59a0d10ac..439277ea62b0 100644 --- a/svtools/qa/makefile.mk +++ b/svl/qa/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # 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 @@ -30,7 +30,7 @@ #************************************************************************* PRJ = .. -PRJNAME = svtools +PRJNAME=svl TARGET = qa ENABLE_EXCEPTIONS = true @@ -40,7 +40,7 @@ ENABLE_EXCEPTIONS = true .INCLUDE : settings.mk # BEGIN ---------------------------------------------------------------- -# auto generated Target:job by codegen.pl +# auto generated Target:job by codegen.pl SHL1OBJS= \ $(SLO)$/test_URIHelper.obj @@ -49,10 +49,11 @@ SHL1STDLIBS=\ $(CPPULIB) \ $(CPPUHELPERLIB) \ $(SALLIB) \ - $(SVTOOLLIB) \ + $(SVLLIB) \ $(TOOLSLIB) \ $(UNOTOOLSLIB) \ - $(CPPUNITLIB) + $(TESTSHL2LIB) \ + $(CPPUNITLIB) SHL1IMPLIB= i$(SHL1TARGET) DEF1NAME =$(SHL1TARGET) @@ -71,15 +72,15 @@ SHL1VERSIONMAP= export.map # LLA: old stuff # USE_DEFFILE = true -# +# # .INCLUDE: settings.mk -# +# # .IF "$(OS)" == "WNT" # REGEXP = "s/^[\#].*$$//" # .ELSE # OS, WNT # REGEXP = 's/^[\#].*$$//' # .ENDIF # OS, WNT -# +# # SHL1TARGET = URIHelper # SHL1OBJS = \ # $(SLO)$/test_URIHelper.obj @@ -90,12 +91,12 @@ SHL1VERSIONMAP= export.map # $(SVTOOLLIB) \ # $(TOOLSLIB) \ # $(UNOTOOLSLIB) -# +# # DEF1NAME = $(SHL1TARGET) # DEF1EXPORTFILE = $(MISC)$/$(SHL1TARGET).dxp -# +# # .INCLUDE: target.mk -# +# # $(MISC)$/$(SHL1TARGET).dxp: sce$/$(SHL1TARGET).sce # + $(TYPE) $< | sed $(REGEXP) > $@ # + $(TYPE) $@ | sed "s/^/test_/" > $(MISC)$/$(SHL1TARGET).tst diff --git a/svtools/qa/test_URIHelper.cxx b/svl/qa/test_URIHelper.cxx index d60780132903..3cf6d30d1813 100644 --- a/svtools/qa/test_URIHelper.cxx +++ b/svl/qa/test_URIHelper.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "sal/config.h" @@ -57,7 +57,7 @@ #include "cppuhelper/bootstrap.hxx" #include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase2.hxx" -#include "cppunit/simpleheader.hxx" +#include "testshl/simpleheader.hxx" #include "osl/diagnose.h" #include "rtl/strbuf.hxx" #include "rtl/string.h" diff --git a/svtools/source/config/cjkoptions.cxx b/svl/source/config/cjkoptions.cxx index 66d70cd1e2a3..c149c91c86f5 100644 --- a/svtools/source/config/cjkoptions.cxx +++ b/svl/source/config/cjkoptions.cxx @@ -29,16 +29,11 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION +#include <svl/cjkoptions.hxx> -#include <svtools/cjkoptions.hxx> - -#include <svtools/languageoptions.hxx> +#include <svl/languageoptions.hxx> #include <i18npool/lang.h> #include <unotools/configitem.hxx> #include <tools/debug.hxx> @@ -173,6 +168,7 @@ void SvtCJKOptions_Impl::SetAll(sal_Bool bSet) SetModified(); Commit(); + NotifyListeners(0); } } /*-- 10.04.01 12:41:56--------------------------------------------------- @@ -245,6 +241,7 @@ void SvtCJKOptions_Impl::Load() void SvtCJKOptions_Impl::Notify( const Sequence< OUString >& ) { Load(); + NotifyListeners(0); } /*-- 10.04.01 12:41:57--------------------------------------------------- diff --git a/svtools/source/config/ctloptions.cxx b/svl/source/config/ctloptions.cxx index 5d2bf131add1..a776bc4b807c 100644 --- a/svtools/source/config/ctloptions.cxx +++ b/svl/source/config/ctloptions.cxx @@ -29,16 +29,11 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION +#include <svl/ctloptions.hxx> -#include <svtools/ctloptions.hxx> - -#include <svtools/languageoptions.hxx> +#include <svl/languageoptions.hxx> #include <i18npool/mslangid.hxx> #include <unotools/configitem.hxx> #include <tools/debug.hxx> @@ -46,10 +41,9 @@ #include <com/sun/star/uno/Sequence.hxx> #include <osl/mutex.hxx> #include <vos/mutex.hxx> -#include <svtools/smplhint.hxx> -#include <vcl/svapp.hxx> +#include <svl/smplhint.hxx> #include <rtl/instance.hxx> - +#include <unotools/syslocale.hxx> #include <itemholder2.hxx> using namespace ::com::sun::star; @@ -60,7 +54,7 @@ using namespace ::com::sun::star::uno; // SvtCJKOptions_Impl ---------------------------------------------------------- -class SvtCTLOptions_Impl : public utl::ConfigItem, public SfxBroadcaster +class SvtCTLOptions_Impl : public utl::ConfigItem { private: sal_Bool m_bIsLoaded; @@ -160,7 +154,7 @@ SvtCTLOptions_Impl::~SvtCTLOptions_Impl() void SvtCTLOptions_Impl::Notify( const Sequence< rtl::OUString >& ) { Load(); - Broadcast(SfxSimpleHint(SFX_HINT_CTL_SETTINGS_CHANGED)); + NotifyListeners(SFX_HINT_CTL_SETTINGS_CHANGED); } // ----------------------------------------------------------------------------- void SvtCTLOptions_Impl::Commit() @@ -252,7 +246,7 @@ void SvtCTLOptions_Impl::Commit() aValues.realloc(nRealCount); PutProperties( aNames, aValues ); //broadcast changes - Broadcast(SfxSimpleHint(SFX_HINT_CTL_SETTINGS_CHANGED)); + NotifyListeners(SFX_HINT_CTL_SETTINGS_CHANGED); } // ----------------------------------------------------------------------------- void SvtCTLOptions_Impl::Load() @@ -314,7 +308,7 @@ void SvtCTLOptions_Impl::Load() ((eSystemLanguage != LANGUAGE_SYSTEM) && ( nWinScript & SCRIPTTYPE_COMPLEX ))) ) { m_bCTLFontEnabled = sal_True; - sal_uInt16 nLanguage = Application::GetSettings().GetLanguage(); + sal_uInt16 nLanguage = SvtSysLocale().GetLanguage(); //enable sequence checking for the appropriate languages m_bCTLSequenceChecking = m_bCTLRestricted = m_bCTLTypeAndReplace = (MsLangId::needsSequenceChecking( nLanguage) || @@ -330,6 +324,7 @@ void SvtCTLOptions_Impl::SetCTLFontEnabled( sal_Bool _bEnabled ) { m_bCTLFontEnabled = _bEnabled; SetModified(); + NotifyListeners(0); } } //------------------------------------------------------------------------------ @@ -339,6 +334,7 @@ void SvtCTLOptions_Impl::SetCTLSequenceChecking( sal_Bool _bEnabled ) { SetModified(); m_bCTLSequenceChecking = _bEnabled; + NotifyListeners(0); } } //------------------------------------------------------------------------------ @@ -348,6 +344,7 @@ void SvtCTLOptions_Impl::SetCTLSequenceCheckingRestricted( sal_Bool _bEnabled ) { SetModified(); m_bCTLRestricted = _bEnabled; + NotifyListeners(0); } } //------------------------------------------------------------------------------ @@ -357,6 +354,7 @@ void SvtCTLOptions_Impl::SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnabl { SetModified(); m_bCTLTypeAndReplace = _bEnabled; + NotifyListeners(0); } } //------------------------------------------------------------------------------ @@ -366,6 +364,7 @@ void SvtCTLOptions_Impl::SetCTLCursorMovement( SvtCTLOptions::CursorMovement _eM { SetModified(); m_eCTLCursorMovement = _eMovement; + NotifyListeners(0); } } //------------------------------------------------------------------------------ @@ -375,6 +374,7 @@ void SvtCTLOptions_Impl::SetCTLTextNumerals( SvtCTLOptions::TextNumerals _eNumer { SetModified(); m_eCTLTextNumerals = _eNumerals; + NotifyListeners(0); } } // global ---------------------------------------------------------------- @@ -399,7 +399,7 @@ SvtCTLOptions::SvtCTLOptions( sal_Bool bDontLoad ) ++nCTLRefCount; m_pImp = pCTLOptions; - StartListening( *m_pImp); + m_pImp->AddListener(this); } // ----------------------------------------------------------------------- @@ -409,6 +409,7 @@ SvtCTLOptions::~SvtCTLOptions() // Global access, must be guarded (multithreading) ::osl::MutexGuard aGuard( CTLMutex::get() ); + m_pImp->RemoveListener(this); if ( !--nCTLRefCount ) DELETEZ( pCTLOptions ); } @@ -490,14 +491,5 @@ sal_Bool SvtCTLOptions::IsReadOnly(EOption eOption) const DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" ); return pCTLOptions->IsReadOnly(eOption); } -/* -----------------30.04.2003 10:40----------------- - - --------------------------------------------------*/ -void SvtCTLOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - vos::OGuard aVclGuard( Application::GetSolarMutex() ); - Broadcast( rHint ); -} - // ----------------------------------------------------------------------------- diff --git a/svl/source/config/itemholder2.cxx b/svl/source/config/itemholder2.cxx new file mode 100644 index 000000000000..695c6598140c --- /dev/null +++ b/svl/source/config/itemholder2.cxx @@ -0,0 +1,182 @@ +/************************************************************************* + * + * 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: itemholder2.cxx,v $ + * $Revision: 1.13 $ + * + * 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_svl.hxx" + +#include "itemholder2.hxx" + +//----------------------------------------------- +// includes +#include <comphelper/processfactory.hxx> +#include <com/sun/star/lang/XComponent.hpp> + +#include <svl/cjkoptions.hxx> +#include <svl/ctloptions.hxx> +#include <svl/languageoptions.hxx> +#include <unotools/options.hxx> + +#include <tools/debug.hxx> + +//----------------------------------------------- +// namespaces + +namespace css = ::com::sun::star; + +//----------------------------------------------- +// declarations + +//----------------------------------------------- +ItemHolder2::ItemHolder2() + : ItemHolderMutexBase() +{ + try + { + css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); + css::uno::Reference< css::lang::XComponent > xCfg( + xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")), + css::uno::UNO_QUERY); + if (xCfg.is()) + xCfg->addEventListener(static_cast< css::lang::XEventListener* >(this)); + } +// #i37892 got errorhandling from ConfigManager::GetConfigurationProvider() + catch(css::uno::RuntimeException& rREx) + { + throw rREx; + } +#ifdef DBG_UTIL + catch(css::uno::Exception& rEx) + { + static sal_Bool bMessage = sal_True; + if(bMessage) + { + bMessage = sal_False; + ::rtl::OString sMsg("CreateInstance with arguments exception: "); + sMsg += ::rtl::OString(rEx.Message.getStr(), + rEx.Message.getLength(), + RTL_TEXTENCODING_ASCII_US); + DBG_ERROR(sMsg.getStr()); + } + } +#else + catch(css::uno::Exception&){} +#endif +} + +//----------------------------------------------- +ItemHolder2::~ItemHolder2() +{ + impl_releaseAllItems(); +} + +//----------------------------------------------- +void ItemHolder2::holdConfigItem(EItem eItem) +{ + static ItemHolder2* pHolder = new ItemHolder2(); + pHolder->impl_addItem(eItem); +} + +//----------------------------------------------- +void SAL_CALL ItemHolder2::disposing(const css::lang::EventObject&) + throw(css::uno::RuntimeException) +{ + impl_releaseAllItems(); +} + +//----------------------------------------------- +void ItemHolder2::impl_addItem(EItem eItem) +{ + ::osl::ResettableMutexGuard aLock(m_aLock); + + TItems::const_iterator pIt; + for ( pIt = m_lItems.begin(); + pIt != m_lItems.end() ; + ++pIt ) + { + const TItemInfo& rInfo = *pIt; + if (rInfo.eItem == eItem) + return; + } + + TItemInfo aNewItem; + aNewItem.eItem = eItem; + impl_newItem(aNewItem); + if (aNewItem.pItem) + m_lItems.push_back(aNewItem); +} + +//----------------------------------------------- +void ItemHolder2::impl_releaseAllItems() +{ + ::osl::ResettableMutexGuard aLock(m_aLock); + + TItems::iterator pIt; + for ( pIt = m_lItems.begin(); + pIt != m_lItems.end() ; + ++pIt ) + { + TItemInfo& rInfo = *pIt; + impl_deleteItem(rInfo); + } + m_lItems.clear(); +} + +//----------------------------------------------- +void ItemHolder2::impl_newItem(TItemInfo& rItem) +{ + switch(rItem.eItem) + { + case E_CJKOPTIONS : + rItem.pItem = new SvtCJKOptions(); + break; + + case E_CTLOPTIONS : + rItem.pItem = new SvtCTLOptions(); + break; + + case E_LANGUAGEOPTIONS : +// capsulate CTL and CJL options ! rItem.pItem = new SvtLanguageOptions(); + break; + + default: + OSL_ASSERT(false); + break; + } +} + +//----------------------------------------------- +void ItemHolder2::impl_deleteItem(TItemInfo& rItem) +{ + if (rItem.pItem) + { + delete rItem.pItem; + rItem.pItem = 0; + } +} diff --git a/svl/source/config/itemholder2.hxx b/svl/source/config/itemholder2.hxx new file mode 100644 index 000000000000..192df8f746c9 --- /dev/null +++ b/svl/source/config/itemholder2.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * 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: itemholder2.hxx,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. + * + ************************************************************************/ + +#ifndef INCLUDED_SVTOOLS_ITEMHOLDER2_HXX_ +#define INCLUDED_SVTOOLS_ITEMHOLDER2_HXX_ + +//----------------------------------------------- +// includes + +#include <unotools/itemholderbase.hxx> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/lang/XEventListener.hpp> + +//----------------------------------------------- +// namespaces + +#ifdef css +#error "Cant use css as namespace alias." +#else +#define css ::com::sun::star +#endif + +//----------------------------------------------- +// definitions + +class ItemHolder2 : private ItemHolderMutexBase + , public ::cppu::WeakImplHelper1< css::lang::XEventListener > +{ + //........................................... + // member + private: + + TItems m_lItems; + + //........................................... + // c++ interface + public: + + ItemHolder2(); + virtual ~ItemHolder2(); + static void holdConfigItem(EItem eItem); + + //........................................... + // uno interface + public: + + virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) + throw(css::uno::RuntimeException); + + //........................................... + // helper + private: + + void impl_addItem(EItem eItem); + void impl_releaseAllItems(); + void impl_newItem(TItemInfo& rItem); + void impl_deleteItem(TItemInfo& rItem); +}; + +//----------------------------------------------- +// namespaces + +#undef css + +#endif // INCLUDED_SVTOOLS_ITEMHOLDER2_HXX_ diff --git a/svtools/source/config/languageoptions.cxx b/svl/source/config/languageoptions.cxx index 0dffafee86d2..f16c0b6add49 100644 --- a/svtools/source/config/languageoptions.cxx +++ b/svl/source/config/languageoptions.cxx @@ -29,23 +29,17 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - -#include <svtools/languageoptions.hxx> -#include <svtools/cjkoptions.hxx> -#include <svtools/ctloptions.hxx> -#include <vcl/svapp.hxx> +#include <svl/languageoptions.hxx> +#include <svl/cjkoptions.hxx> +#include <svl/ctloptions.hxx> #include <i18npool/mslangid.hxx> #include <vos/mutex.hxx> -#include <vcl/svapp.hxx> #include <osl/mutex.hxx> #include <rtl/instance.hxx> #include <com/sun/star/i18n/ScriptType.hpp> +#include <unotools/syslocale.hxx> using namespace ::com::sun::star; // global ---------------------------------------------------------------------- @@ -61,7 +55,8 @@ SvtLanguageOptions::SvtLanguageOptions( sal_Bool _bDontLoad ) m_pCJKOptions = new SvtCJKOptions( _bDontLoad ); m_pCTLOptions = new SvtCTLOptions( _bDontLoad ); - StartListening(*m_pCTLOptions); + m_pCTLOptions->AddListener(this); + m_pCJKOptions->AddListener(this); } //------------------------------------------------------------------------------ SvtLanguageOptions::~SvtLanguageOptions() @@ -69,6 +64,9 @@ SvtLanguageOptions::~SvtLanguageOptions() // Global access, must be guarded (multithreading) ::osl::MutexGuard aGuard( ALMutex::get() ); + m_pCTLOptions->RemoveListener(this); + m_pCJKOptions->RemoveListener(this); + delete m_pCJKOptions; delete m_pCTLOptions; } @@ -205,23 +203,15 @@ sal_Bool SvtLanguageOptions::IsReadOnly(SvtLanguageOptions::EOption eOption) con } return bReadOnly; } -/* -----------------30.04.2003 11:03----------------- - - --------------------------------------------------*/ -void SvtLanguageOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - vos::OGuard aVclGuard( Application::GetSolarMutex() ); - Broadcast( rHint ); -} +/* -----------------30.04.2003 11:03-----------------*/ -// ----------------------------------------------------------------------------- // returns for a language the scripttype sal_uInt16 SvtLanguageOptions::GetScriptTypeOfLanguage( sal_uInt16 nLang ) { if( LANGUAGE_DONTKNOW == nLang ) nLang = LANGUAGE_ENGLISH_US; else if( LANGUAGE_SYSTEM == nLang ) - nLang = Application::GetSettings().GetLanguage(); + nLang = SvtSysLocale().GetLanguage(); sal_Int16 nScriptType = MsLangId::getScriptType( nLang ); USHORT nScript; @@ -270,6 +260,12 @@ void SvtSystemLanguageOptions::Commit() { //does nothing } + +void SvtSystemLanguageOptions::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& ) +{ + // no listeners supported yet +} + /*-- 27.10.2005 08:36:14--------------------------------------------------- -----------------------------------------------------------------------*/ diff --git a/svl/source/config/makefile.mk b/svl/source/config/makefile.mk new file mode 100644 index 000000000000..82c4ae12828f --- /dev/null +++ b/svl/source/config/makefile.mk @@ -0,0 +1,54 @@ +#************************************************************************* +# +# 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: makefile.mk,v $ +# +# $Revision: 1.61 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* +PRJ=..$/.. + +PRJNAME=svl +TARGET=config + +ENABLE_EXCEPTIONS := TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svl.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES= \ + $(SLO)$/cjkoptions.obj \ + $(SLO)$/ctloptions.obj \ + $(SLO)$/itemholder2.obj \ + $(SLO)$/languageoptions.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + diff --git a/svtools/source/filepicker/makefile.mk b/svl/source/filepicker/makefile.mk index d00ac5170e1a..644c70af0b1a 100644 --- a/svtools/source/filepicker/makefile.mk +++ b/svl/source/filepicker/makefile.mk @@ -30,7 +30,7 @@ #************************************************************************* PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=filepicker ENABLE_EXCEPTIONS=TRUE diff --git a/svtools/source/filepicker/pickerhelper.cxx b/svl/source/filepicker/pickerhelper.cxx index 0d8b2db9d8a0..cda263338d5d 100644 --- a/svtools/source/filepicker/pickerhelper.cxx +++ b/svl/source/filepicker/pickerhelper.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "pickerhelper.hxx" #include "rtl/ustring.hxx" diff --git a/svtools/source/filepicker/pickerhistory.cxx b/svl/source/filepicker/pickerhistory.cxx index 5bd584618f09..5cc12779f0b5 100644 --- a/svtools/source/filepicker/pickerhistory.cxx +++ b/svl/source/filepicker/pickerhistory.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "pickerhistory.hxx" #include "pickerhistoryaccess.hxx" #include <cppuhelper/weakref.hxx> diff --git a/svtools/source/filerec/filerec.cxx b/svl/source/filerec/filerec.cxx index 262e5135572a..ac35a748eef7 100644 --- a/svtools/source/filerec/filerec.cxx +++ b/svl/source/filerec/filerec.cxx @@ -29,8 +29,8 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include <svtools/filerec.hxx> +#include "precompiled_svl.hxx" +#include <svl/filerec.hxx> #include <osl/endian.h> //======================================================================== diff --git a/svtools/source/filerec/makefile.mk b/svl/source/filerec/makefile.mk index 33e4b4923183..c590e38a7ea1 100644 --- a/svtools/source/filerec/makefile.mk +++ b/svl/source/filerec/makefile.mk @@ -31,7 +31,7 @@ PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=filerec # --- Settings ----------------------------------------------------- diff --git a/svtools/source/fsstor/exports.map b/svl/source/fsstor/exports.map index f4ed78b9e970..f4ed78b9e970 100644 --- a/svtools/source/fsstor/exports.map +++ b/svl/source/fsstor/exports.map diff --git a/svtools/source/fsstor/fsfactory.cxx b/svl/source/fsstor/fsfactory.cxx index 33df962be846..e47593ba8f8b 100644 --- a/svtools/source/fsstor/fsfactory.cxx +++ b/svl/source/fsstor/fsfactory.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "fsfactory.hxx" #include "cppuhelper/factory.hxx" diff --git a/svtools/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx index cec018533a9a..bae02feae1dd 100644 --- a/svtools/source/fsstor/fsstorage.cxx +++ b/svl/source/fsstor/fsstorage.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> diff --git a/svtools/source/fsstor/fsstorage.hxx b/svl/source/fsstor/fsstorage.hxx index 670a6917dd40..670a6917dd40 100644 --- a/svtools/source/fsstor/fsstorage.hxx +++ b/svl/source/fsstor/fsstorage.hxx diff --git a/svtools/source/fsstor/makefile.mk b/svl/source/fsstor/makefile.mk index f55f6747f9e1..7f46009750fd 100644 --- a/svtools/source/fsstor/makefile.mk +++ b/svl/source/fsstor/makefile.mk @@ -30,7 +30,7 @@ #************************************************************************* PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=fsstorage.uno LIBTARGET=NO ENABLE_EXCEPTIONS=TRUE diff --git a/svtools/source/fsstor/oinputstreamcontainer.cxx b/svl/source/fsstor/oinputstreamcontainer.cxx index dc08a7a34602..53be03699ba0 100644 --- a/svtools/source/fsstor/oinputstreamcontainer.cxx +++ b/svl/source/fsstor/oinputstreamcontainer.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "oinputstreamcontainer.hxx" #include <cppuhelper/typeprovider.hxx> diff --git a/svtools/source/fsstor/oinputstreamcontainer.hxx b/svl/source/fsstor/oinputstreamcontainer.hxx index 308f4283b430..308f4283b430 100644 --- a/svtools/source/fsstor/oinputstreamcontainer.hxx +++ b/svl/source/fsstor/oinputstreamcontainer.hxx diff --git a/svtools/source/fsstor/ostreamcontainer.cxx b/svl/source/fsstor/ostreamcontainer.cxx index d801f49532b2..dac7c9c31375 100644 --- a/svtools/source/fsstor/ostreamcontainer.cxx +++ b/svl/source/fsstor/ostreamcontainer.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "ostreamcontainer.hxx" diff --git a/svtools/source/fsstor/ostreamcontainer.hxx b/svl/source/fsstor/ostreamcontainer.hxx index 6198587c3d35..6198587c3d35 100644 --- a/svtools/source/fsstor/ostreamcontainer.hxx +++ b/svl/source/fsstor/ostreamcontainer.hxx diff --git a/svtools/source/inc/fsfactory.hxx b/svl/source/inc/fsfactory.hxx index 5954ecebabc2..5954ecebabc2 100644 --- a/svtools/source/inc/fsfactory.hxx +++ b/svl/source/inc/fsfactory.hxx diff --git a/svtools/source/inc/passwordcontainer.hxx b/svl/source/inc/passwordcontainer.hxx index a067672f3cf6..a067672f3cf6 100644 --- a/svtools/source/inc/passwordcontainer.hxx +++ b/svl/source/inc/passwordcontainer.hxx diff --git a/svtools/source/inc/poolio.hxx b/svl/source/inc/poolio.hxx index fb30fc04832d..0018b403796f 100644 --- a/svtools/source/inc/poolio.hxx +++ b/svl/source/inc/poolio.hxx @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include <svtools/brdcst.hxx> +#include <svl/brdcst.hxx> #ifndef DELETEZ diff --git a/svtools/source/items/aeitem.cxx b/svl/source/items/aeitem.cxx index 63fbd1db6227..55dc818d0160 100644 --- a/svtools/source/items/aeitem.cxx +++ b/svl/source/items/aeitem.cxx @@ -29,16 +29,16 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif #include <tools/string.hxx> #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> -#include <svtools/svarray.hxx> -#include <svtools/aeitem.hxx> +#include <svl/svstdarr.hxx> +#include <svl/svarray.hxx> +#include <svl/aeitem.hxx> // STATIC DATA ----------------------------------------------------------- diff --git a/svtools/source/items1/cenumitm.cxx b/svl/source/items/cenumitm.cxx index 1906e62a8cf8..3c2f7764a351 100644 --- a/svtools/source/items1/cenumitm.cxx +++ b/svl/source/items/cenumitm.cxx @@ -29,10 +29,10 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <com/sun/star/uno/Any.hxx> #include <tools/stream.hxx> -#include <svtools/cenumitm.hxx> +#include <svl/cenumitm.hxx> #include <whassert.hxx> #ifndef _CPPUHELPER_EXTRACT_HXX_ diff --git a/svtools/source/items1/cintitem.cxx b/svl/source/items/cintitem.cxx index 97cce9b75591..9d9d58421fc4 100644 --- a/svtools/source/items1/cintitem.cxx +++ b/svl/source/items/cintitem.cxx @@ -29,10 +29,10 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <com/sun/star/uno/Any.hxx> #include <tools/stream.hxx> -#include <svtools/cintitem.hxx> +#include <svl/cintitem.hxx> //============================================================================ // diff --git a/svtools/source/items1/cntwall.cxx b/svl/source/items/cntwall.cxx index 67e9387fbe26..824ad6b2b5b0 100644 --- a/svtools/source/items1/cntwall.cxx +++ b/svl/source/items/cntwall.cxx @@ -29,14 +29,14 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <tools/debug.hxx> #include <tools/string.hxx> #include <tools/stream.hxx> #include <tools/vcompat.hxx> -#include <svtools/cntwall.hxx> +#include <svl/cntwall.hxx> #define CNTWALLPAPERITEM_STREAM_MAGIC ( (UINT32)0xfefefefe ) #define CNTWALLPAPERITEM_STREAM_SEEKREL (-( (long)( sizeof( UINT32 ) ) ) ) diff --git a/svtools/source/misc/config.src b/svl/source/items/cstitem.src index e11aeb86f402..54951dd3761e 100644 --- a/svtools/source/misc/config.src +++ b/svl/source/items/cstitem.src @@ -6,8 +6,8 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: config.src,v $ - * $Revision: 1.29 $ + * $RCSfile: cstitem.src,v $ + * $Revision: 1.7 $ * * This file is part of OpenOffice.org. * @@ -28,11 +28,10 @@ * ************************************************************************/ -#include <svtools/svtools.hrc> - -String STR_WARNING_ITEM +#include <svl/svtools.hrc> +String STR_COLUM_DT_AUTO { - Text [ en-US ] = "Incorrect Version!" ; + Text [ en-US ] = "automatic" ; }; @@ -64,3 +63,10 @@ String STR_WARNING_ITEM + + + + + + + diff --git a/svtools/source/items1/ctypeitm.cxx b/svl/source/items/ctypeitm.cxx index 552d4a6a9041..69302ebdb868 100644 --- a/svtools/source/items1/ctypeitm.cxx +++ b/svl/source/items/ctypeitm.cxx @@ -29,12 +29,12 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <com/sun/star/uno/Any.hxx> #include <unotools/intlwrapper.hxx> #include <tools/stream.hxx> -#include <svtools/ctypeitm.hxx> +#include <svl/ctypeitm.hxx> //============================================================================ // The following defines are copied from chaos/source/items/cstritem.cxx: diff --git a/svtools/source/items1/custritm.cxx b/svl/source/items/custritm.cxx index 9f573beb56fd..8687aafbae49 100644 --- a/svtools/source/items1/custritm.cxx +++ b/svl/source/items/custritm.cxx @@ -29,12 +29,12 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <com/sun/star/uno/Any.hxx> #include <unotools/intlwrapper.hxx> #include <tools/stream.hxx> -#include <svtools/custritm.hxx> +#include <svl/custritm.hxx> //============================================================================ // diff --git a/svtools/source/items1/dateitem.cxx b/svl/source/items/dateitem.cxx index 4ba6e1d460f9..d6ef8fdc7c9e 100644 --- a/svtools/source/items1/dateitem.cxx +++ b/svl/source/items/dateitem.cxx @@ -29,17 +29,18 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" // include --------------------------------------------------------------- #define _DATETIMEITEM_CXX -#include <svtools/dateitem.hxx> +#include <svl/dateitem.hxx> +#include <svl/svldata.hxx> +#include <svl/svtools.hrc> #include <unotools/intlwrapper.hxx> #include <comphelper/processfactory.hxx> - #include <tools/stream.hxx> #include <tools/debug.hxx> #include <tools/datetime.hxx> @@ -48,11 +49,6 @@ #include <com/sun/star/lang/Locale.hpp> -#include <vcl/svapp.hxx> - -#include <svtools/svtdata.hxx> -#include <svtools/svtools.hrc> - // STATIC DATA ----------------------------------------------------------- DBG_NAME(SfxDateTimeItem) @@ -259,10 +255,12 @@ SfxItemPresentation SfxColumnDateTimeItem::GetPresentation ::com::sun::star::lang::Locale aLocale; if (GetDateTime() == DateTime(Date(1, 2, 3), Time(3, 2, 1))) - rText = String(SvtResId(STR_COLUM_DT_AUTO, + { + rText = String(SvtSimpleResId(STR_COLUM_DT_AUTO, pIntlWrapper ? pIntlWrapper->getLocale() : aLocale)); + } else if (pIntlWrapper) { rText = pIntlWrapper->getLocaleData()->getDate(GetDateTime()); diff --git a/svtools/source/items/eitem.cxx b/svl/source/items/eitem.cxx index f7b95665391d..16d5aae5a16f 100644 --- a/svtools/source/items/eitem.cxx +++ b/svl/source/items/eitem.cxx @@ -29,8 +29,8 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include <svtools/eitem.hxx> +#include "precompiled_svl.hxx" +#include <svl/eitem.hxx> //============================================================================ // // class SfxEnumItem diff --git a/svtools/source/items/flagitem.cxx b/svl/source/items/flagitem.cxx index e59f981c5afa..537632db04ff 100644 --- a/svtools/source/items/flagitem.cxx +++ b/svl/source/items/flagitem.cxx @@ -29,10 +29,10 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" -#include <svtools/flagitem.hxx> -#include <svtools/poolitem.hxx> +#include <svl/flagitem.hxx> +#include <svl/poolitem.hxx> #include <tools/stream.hxx> // STATIC DATA ----------------------------------------------------------- diff --git a/svtools/source/items/globalnameitem.cxx b/svl/source/items/globalnameitem.cxx index 6a8359fb39b8..1b676a95bf71 100644 --- a/svtools/source/items/globalnameitem.cxx +++ b/svl/source/items/globalnameitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/script/XTypeConverter.hpp> @@ -38,7 +38,7 @@ #include <comphelper/processfactory.hxx> -#include <svtools/globalnameitem.hxx> +#include <svl/globalnameitem.hxx> // STATIC DATA ----------------------------------------------------------- diff --git a/svtools/source/items1/ilstitem.cxx b/svl/source/items/ilstitem.cxx index a26c054eeadb..4d2cb0a3b5b9 100644 --- a/svtools/source/items1/ilstitem.cxx +++ b/svl/source/items/ilstitem.cxx @@ -29,16 +29,16 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <com/sun/star/script/XTypeConverter.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <comphelper/processfactory.hxx> -#include <svtools/ilstitem.hxx> +#include <svl/ilstitem.hxx> #define _SVSTDARR_ULONGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> TYPEINIT1_AUTOFACTORY(SfxIntegerListItem, SfxPoolItem); diff --git a/svtools/source/items/imageitm.cxx b/svl/source/items/imageitm.cxx index cc4a2ebd4f3b..dec2626472cc 100644 --- a/svtools/source/items/imageitm.cxx +++ b/svl/source/items/imageitm.cxx @@ -29,9 +29,9 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" -#include <svtools/imageitm.hxx> +#include <svl/imageitm.hxx> #include <com/sun/star/uno/Sequence.hxx> TYPEINIT1( SfxImageItem, SfxInt16Item ); diff --git a/svtools/source/items/intitem.cxx b/svl/source/items/intitem.cxx index b20f245f964b..1133cdf553d1 100644 --- a/svtools/source/items/intitem.cxx +++ b/svl/source/items/intitem.cxx @@ -29,13 +29,13 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" -#include <svtools/intitem.hxx> +#include <svl/intitem.hxx> #include <com/sun/star/uno/Any.hxx> #include <tools/bigint.hxx> #include <tools/stream.hxx> -#include <svtools/metitem.hxx> +#include <svl/metitem.hxx> //============================================================================ // diff --git a/svtools/source/items1/itemiter.cxx b/svl/source/items/itemiter.cxx index 9a7fa4d72c88..c8c6eea67c82 100644 --- a/svtools/source/items1/itemiter.cxx +++ b/svl/source/items/itemiter.cxx @@ -29,14 +29,14 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif -#include <svtools/itemiter.hxx> -#include <svtools/itempool.hxx> -#include <svtools/itemset.hxx> +#include <svl/itemiter.hxx> +#include <svl/itempool.hxx> +#include <svl/itemset.hxx> // STATIC DATA ----------------------------------------------------------- diff --git a/svtools/source/items1/itempool.cxx b/svl/source/items/itempool.cxx index e54bca8d3c19..5f34560e8471 100644 --- a/svtools/source/items1/itempool.cxx +++ b/svl/source/items/itempool.cxx @@ -29,17 +29,17 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <string.h> #include <stdio.h> #ifndef GCC #endif -#include <svtools/itempool.hxx> +#include <svl/itempool.hxx> #include "whassert.hxx" -#include <svtools/brdcst.hxx> -#include <svtools/smplhint.hxx> +#include <svl/brdcst.hxx> +#include <svl/smplhint.hxx> #include "poolio.hxx" #include <algorithm> @@ -589,7 +589,7 @@ void SfxItemPool::Delete() for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) if (*ppHtArr) { -#ifndef PRODUCT +#ifdef DBG_UTIL ReleaseRef( **ppHtArr, (*ppHtArr)->GetRefCount() ); #endif delete *ppHtArr; @@ -598,7 +598,7 @@ void SfxItemPool::Delete() } if ( *ppDefaultItem ) { -#ifndef PRODUCT +#ifdef DBG_UTIL SetRefCount( **ppDefaultItem, 0 ); #endif DELETEZ( *ppDefaultItem ); @@ -621,7 +621,7 @@ void SfxItemPool::Delete() for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr ) if (*ppHtArr) { -#ifndef PRODUCT +#ifdef DBG_UTIL ReleaseRef( **ppHtArr, (*ppHtArr)->GetRefCount() ); #endif delete *ppHtArr; @@ -630,7 +630,7 @@ void SfxItemPool::Delete() } if ( *ppDefaultItem ) { -#ifndef PRODUCT +#ifdef DBG_UTIL SetRefCount( **ppDefaultItem, 0 ); #endif delete *ppDefaultItem; diff --git a/svtools/source/items1/itemprop.cxx b/svl/source/items/itemprop.cxx index 354e0a1441ba..3add3f466495 100644 --- a/svtools/source/items1/itemprop.cxx +++ b/svl/source/items/itemprop.cxx @@ -29,11 +29,11 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" -#include <svtools/itemprop.hxx> -#include <svtools/itempool.hxx> -#include <svtools/itemset.hxx> +#include <svl/itemprop.hxx> +#include <svl/itempool.hxx> +#include <svl/itemset.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <hash_map> /************************************************************************* @@ -43,7 +43,7 @@ using namespace com::sun::star; using namespace com::sun::star::beans; using namespace com::sun::star::lang; using namespace com::sun::star::uno; -using namespace ::rtl; + /*-- 16.02.2009 10:03:55--------------------------------------------------- -----------------------------------------------------------------------*/ @@ -262,7 +262,7 @@ void SfxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry& rEn /* -----------------------------06.06.01 12:32-------------------------------- ---------------------------------------------------------------------------*/ -void SfxItemPropertySet::getPropertyValue( const OUString &rName, +void SfxItemPropertySet::getPropertyValue( const rtl::OUString &rName, const SfxItemSet& rSet, Any& rAny ) const throw(RuntimeException, UnknownPropertyException) { @@ -275,7 +275,7 @@ void SfxItemPropertySet::getPropertyValue( const OUString &rName, /* -----------------------------21.02.00 11:26-------------------------------- ---------------------------------------------------------------------------*/ -Any SfxItemPropertySet::getPropertyValue( const OUString &rName, +Any SfxItemPropertySet::getPropertyValue( const rtl::OUString &rName, const SfxItemSet& rSet ) const throw(RuntimeException, UnknownPropertyException) { @@ -327,7 +327,7 @@ void SfxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry& rEn /* -----------------------------21.02.00 11:26-------------------------------- ---------------------------------------------------------------------------*/ -void SfxItemPropertySet::setPropertyValue( const OUString &rName, +void SfxItemPropertySet::setPropertyValue( const rtl::OUString &rName, const Any& aVal, SfxItemSet& rSet ) const throw(RuntimeException, @@ -360,7 +360,7 @@ PropertyState SfxItemPropertySet::getPropertyState(const SfxItemPropertySimpleEn return eRet; } PropertyState SfxItemPropertySet::getPropertyState( - const OUString& rName, const SfxItemSet& rSet) const + const rtl::OUString& rName, const SfxItemSet& rSet) const throw(UnknownPropertyException) { PropertyState eRet = PropertyState_DIRECT_VALUE; @@ -489,7 +489,7 @@ Sequence< Property > SAL_CALL ---------------------------------------------------------------------------*/ Property SAL_CALL - SfxExtItemPropertySetInfo::getPropertyByName( const OUString& rPropertyName ) +SfxExtItemPropertySetInfo::getPropertyByName( const rtl::OUString& rPropertyName ) throw(UnknownPropertyException, RuntimeException) { return aExtMap.getPropertyByName( rPropertyName ); @@ -498,7 +498,7 @@ Property SAL_CALL ---------------------------------------------------------------------------*/ sal_Bool SAL_CALL - SfxExtItemPropertySetInfo::hasPropertyByName( const OUString& rPropertyName ) +SfxExtItemPropertySetInfo::hasPropertyByName( const rtl::OUString& rPropertyName ) throw(RuntimeException) { return aExtMap.hasPropertyByName( rPropertyName ); diff --git a/svtools/source/items1/itemset.cxx b/svl/source/items/itemset.cxx index fee00dca854a..45516660ee21 100644 --- a/svtools/source/items1/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <string.h> @@ -43,12 +43,12 @@ #define _SVSTDARR_USHORTS #define _SVSTDARR_ULONGS -#include <svtools/svstdarr.hxx> -#include <svtools/itemset.hxx> -#include <svtools/itempool.hxx> -#include <svtools/itemiter.hxx> +#include <svl/svstdarr.hxx> +#include <svl/itemset.hxx> +#include <svl/itempool.hxx> +#include <svl/itemiter.hxx> #include "whiter.hxx" -#include <svtools/nranges.hxx> +#include <svl/nranges.hxx> #include "whassert.hxx" #include <tools/stream.hxx> diff --git a/svtools/source/items1/lckbitem.cxx b/svl/source/items/lckbitem.cxx index c848e377b257..04e2edb70026 100644 --- a/svtools/source/items1/lckbitem.cxx +++ b/svl/source/items/lckbitem.cxx @@ -29,11 +29,11 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #define _LCKBITEM_CXX -#include <svtools/lckbitem.hxx> -#include <svtools/poolitem.hxx> +#include <svl/lckbitem.hxx> +#include <svl/poolitem.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <tools/cachestr.hxx> diff --git a/svtools/source/items/macitem.cxx b/svl/source/items/macitem.cxx index 480fb844ccc7..511ca2bba57c 100644 --- a/svtools/source/items/macitem.cxx +++ b/svl/source/items/macitem.cxx @@ -29,13 +29,13 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <tools/stream.hxx> #ifndef GCC #endif -#include <svtools/macitem.hxx> +#include <svl/macitem.hxx> // STATIC DATA ----------------------------------------------------------- diff --git a/svtools/source/items1/makefile.mk b/svl/source/items/makefile.mk index 9a7d13ff7d0f..d779e16e24d1 100644 --- a/svtools/source/items1/makefile.mk +++ b/svl/source/items/makefile.mk @@ -8,7 +8,7 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.5 $ +# $Revision: 1.13 $ # # This file is part of OpenOffice.org. # @@ -30,8 +30,8 @@ #************************************************************************* PRJ=..$/.. -PRJNAME=svtools -TARGET=items1 +PRJNAME=svl +TARGET=items ENABLE_EXCEPTIONS=TRUE # --- Settings ----------------------------------------------------- @@ -42,32 +42,40 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- SLOFILES=\ - $(SLO)$/bintitem.obj \ + $(SLO)$/aeitem.obj \ $(SLO)$/cenumitm.obj \ $(SLO)$/cintitem.obj \ $(SLO)$/cntwall.obj \ - $(SLO)$/cstitem.obj \ $(SLO)$/ctypeitm.obj \ $(SLO)$/custritm.obj \ - $(SLO)$/dateitem.obj \ - $(SLO)$/dtritem.obj \ - $(SLO)$/frqitem.obj \ + $(SLO)$/dateitem.obj \ + $(SLO)$/eitem.obj \ + $(SLO)$/flagitem.obj \ + $(SLO)$/globalnameitem.obj \ $(SLO)$/ilstitem.obj \ + $(SLO)$/imageitm.obj \ + $(SLO)$/intitem.obj \ $(SLO)$/itemiter.obj \ $(SLO)$/itempool.obj \ $(SLO)$/itemprop.obj \ $(SLO)$/itemset.obj \ $(SLO)$/lckbitem.obj \ + $(SLO)$/macitem.obj \ + $(SLO)$/poolcach.obj \ $(SLO)$/poolio.obj \ - $(SLO)$/stylepool.obj \ $(SLO)$/poolitem.obj \ + $(SLO)$/ptitem.obj \ + $(SLO)$/rectitem.obj \ + $(SLO)$/rngitem.obj \ $(SLO)$/sfontitm.obj \ $(SLO)$/sitem.obj \ $(SLO)$/slstitm.obj \ - $(SLO)$/tfrmitem.obj \ - $(SLO)$/tresitem.obj \ - $(SLO)$/whiter.obj \ - $(SLO)$/visitem.obj + $(SLO)$/stritem.obj \ + $(SLO)$/style.obj \ + $(SLO)$/stylepool.obj \ + $(SLO)$/szitem.obj \ + $(SLO)$/visitem.obj \ + $(SLO)$/whiter.obj SRS1NAME=$(TARGET) SRC1FILES=\ diff --git a/svtools/source/items1/nranges.cxx b/svl/source/items/nranges.cxx index e12c7428d513..789da8dc5ff9 100644 --- a/svtools/source/items1/nranges.cxx +++ b/svl/source/items/nranges.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" // compiled via include from itemset.cxx only! diff --git a/svtools/source/items/poolcach.cxx b/svl/source/items/poolcach.cxx index 2c758a7e25fa..e64325213ff4 100644 --- a/svtools/source/items/poolcach.cxx +++ b/svl/source/items/poolcach.cxx @@ -29,15 +29,15 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <limits.h> #ifndef GCC #endif -#include <svtools/itempool.hxx> -#include <svtools/itemset.hxx> +#include <svl/itempool.hxx> +#include <svl/itemset.hxx> #include "poolcach.hxx" // STATIC DATA ----------------------------------------------------------- diff --git a/svtools/source/items1/poolio.cxx b/svl/source/items/poolio.cxx index f2eb94ef7f67..4383ac99d2ed 100644 --- a/svtools/source/items1/poolio.cxx +++ b/svl/source/items/poolio.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <string.h> #include <stdio.h> @@ -38,11 +38,11 @@ #endif #include <tools/solar.h> -#include <svtools/itempool.hxx> +#include <svl/itempool.hxx> #include "whassert.hxx" -#include <svtools/brdcst.hxx> -#include <svtools/filerec.hxx> -#include <svtools/svtdata.hxx> +#include <svl/brdcst.hxx> +#include <svl/filerec.hxx> +#include <svl/svldata.hxx> #include "poolio.hxx" // STATIC DATA ----------------------------------------------------------- @@ -67,7 +67,7 @@ void SfxItemPool::SetStoringPool( const SfxItemPool *pStoringPool ) */ { - ImpSvtData::GetSvtData().pStoringPool = pStoringPool; + ImpSvlData::GetSvlData().pStoringPool = pStoringPool; } //------------------------------------------------------------------------- @@ -84,7 +84,7 @@ const SfxItemPool* SfxItemPool::GetStoringPool() */ { - return ImpSvtData::GetSvtData().pStoringPool; + return ImpSvlData::GetSvlData().pStoringPool; } //------------------------------------------------------------------------- @@ -169,7 +169,7 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const // jeder Pool ist als ganzes ein Record SfxMiniRecordWriter aPoolRec( &rStream, SFX_ITEMPOOL_REC ); - ImpSvtData::GetSvtData().pStoringPool = this; + ImpSvlData::GetSvlData().pStoringPool = this; // Einzel-Header (Version des Inhalts und Name) { @@ -309,7 +309,7 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const } // weitere Pools rausschreiben - ImpSvtData::GetSvtData().pStoringPool = 0; + ImpSvlData::GetSvlData().pStoringPool = 0; aPoolRec.Close(); if ( !rStream.GetError() && pSecondary ) pSecondary->Store( rStream ); diff --git a/svtools/source/items1/poolitem.cxx b/svl/source/items/poolitem.cxx index ef160b4a8b4c..4957c5c16945 100644 --- a/svtools/source/items1/poolitem.cxx +++ b/svl/source/items/poolitem.cxx @@ -29,9 +29,9 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include <tools/stream.hxx> // STATIC DATA ----------------------------------------------------------- diff --git a/svtools/source/items/ptitem.cxx b/svl/source/items/ptitem.cxx index ac1e94fd1727..30fef0227397 100644 --- a/svtools/source/items/ptitem.cxx +++ b/svl/source/items/ptitem.cxx @@ -29,14 +29,14 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" -#include <svtools/ptitem.hxx> +#include <svl/ptitem.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/awt/Point.hpp> #include <tools/stream.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include "memberid.hrc" using namespace ::com::sun::star; diff --git a/svtools/source/items/rectitem.cxx b/svl/source/items/rectitem.cxx index f9faeeeaa824..26c4876d8c2c 100644 --- a/svtools/source/items/rectitem.cxx +++ b/svl/source/items/rectitem.cxx @@ -29,14 +29,14 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" -#include <svtools/rectitem.hxx> +#include <svl/rectitem.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/awt/Rectangle.hpp> #include <tools/stream.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include "memberid.hrc" // STATIC DATA ----------------------------------------------------------- diff --git a/svtools/source/items/rngitem.cxx b/svl/source/items/rngitem.cxx index 0c62de7229f4..b6340d662112 100644 --- a/svtools/source/items/rngitem.cxx +++ b/svl/source/items/rngitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <tools/stream.hxx> #ifndef NUMTYPE @@ -37,13 +37,13 @@ #define NUMTYPE USHORT #define SfxXRangeItem SfxRangeItem #define SfxXRangesItem SfxUShortRangesItem -#include <svtools/rngitem.hxx> +#include <svl/rngitem.hxx> #include "rngitem_inc.cxx" #define NUMTYPE sal_uInt32 #define SfxXRangeItem SfxULongRangeItem #define SfxXRangesItem SfxULongRangesItem -#include <svtools/rngitem.hxx> +#include <svl/rngitem.hxx> #include "rngitem_inc.cxx" #else diff --git a/svtools/source/items/rngitem_inc.cxx b/svl/source/items/rngitem_inc.cxx index d8cc7ed185ae..d8cc7ed185ae 100755..100644 --- a/svtools/source/items/rngitem_inc.cxx +++ b/svl/source/items/rngitem_inc.cxx diff --git a/svtools/source/items1/sfontitm.cxx b/svl/source/items/sfontitm.cxx index ee7119c95e1c..9ec06bc5a105 100644 --- a/svtools/source/items1/sfontitm.cxx +++ b/svl/source/items/sfontitm.cxx @@ -29,10 +29,10 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <tools/stream.hxx> #include <tools/vcompat.hxx> -#include <svtools/sfontitm.hxx> +#include <svl/sfontitm.hxx> //============================================================================ // diff --git a/svtools/source/items1/sitem.cxx b/svl/source/items/sitem.cxx index 2a917e93bb79..52f0931c9eae 100644 --- a/svtools/source/items1/sitem.cxx +++ b/svl/source/items/sitem.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" // INCLUDE --------------------------------------------------------------- #ifndef GCC @@ -38,8 +38,8 @@ #include <tools/string.hxx> #include <tools/stream.hxx> -#include <svtools/poolitem.hxx> -#include <svtools/itemset.hxx> +#include <svl/poolitem.hxx> +#include <svl/itemset.hxx> // STATIC DATA ----------------------------------------------------------- diff --git a/svtools/source/items1/slstitm.cxx b/svl/source/items/slstitm.cxx index 87163d41e033..d0dd801bb6f9 100644 --- a/svtools/source/items1/slstitm.cxx +++ b/svl/source/items/slstitm.cxx @@ -29,10 +29,10 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" -#include <svtools/slstitm.hxx> -#include <svtools/poolitem.hxx> +#include <svl/slstitm.hxx> +#include <svl/poolitem.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <tools/stream.hxx> diff --git a/svtools/source/items/stritem.cxx b/svl/source/items/stritem.cxx index 37968dc3ee1d..5f6b692106a3 100644 --- a/svtools/source/items/stritem.cxx +++ b/svl/source/items/stritem.cxx @@ -29,8 +29,8 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include <svtools/stritem.hxx> +#include "precompiled_svl.hxx" +#include <svl/stritem.hxx> //============================================================================ // diff --git a/svtools/source/items/style.cxx b/svl/source/items/style.cxx index ad11f1527ce7..756a2f7edc21 100644 --- a/svtools/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif @@ -43,17 +43,16 @@ #include <tools/tenccvt.hxx> #include <comphelper/processfactory.hxx> #include <unotools/intlwrapper.hxx> -#include <svtools/smplhint.hxx> -#include <svtools/poolitem.hxx> -#include <svtools/itemset.hxx> -#include <svtools/itempool.hxx> +#include <svl/smplhint.hxx> +#include <svl/poolitem.hxx> +#include <svl/itemset.hxx> +#include <svl/itempool.hxx> #include <poolio.hxx> -#include <svtools/filerec.hxx> -#include <svtools/itemiter.hxx> -#include <svtools/style.hxx> -#include <svtools/svstdarr.hxx> -#include <vcl/svapp.hxx> - +#include <svl/filerec.hxx> +#include <svl/itemiter.hxx> +#include <svl/style.hxx> +#include <svl/svstdarr.hxx> +#include <unotools/syslocale.hxx> #include <algorithm> #define STYLESTREAM "SfxStyleSheets" @@ -393,7 +392,7 @@ XubString SfxStyleSheetBase::GetDescription( SfxMapUnit eMetric ) const SfxPoolItem* pItem = aIter.FirstItem(); IntlWrapper aIntlWrapper(comphelper::getProcessServiceFactory(), - Application::GetSettings().GetLanguage()); + SvtSysLocale().GetLanguage()); while ( pItem ) { XubString aItemPresentation; @@ -702,11 +701,11 @@ SfxStyleSheetBase* SfxStyleSheetBasePool::Create( const SfxStyleSheetBase& r ) SfxStyleSheetBase& SfxStyleSheetBasePool::Make( const XubString& rName, SfxStyleFamily eFam, USHORT mask, USHORT nPos) { - DBG_ASSERT( eFam != SFX_STYLE_FAMILY_ALL, "svtools::SfxStyleSheetBasePool::Make(), FamilyAll is not a allowed Familie" ); + DBG_ASSERT( eFam != SFX_STYLE_FAMILY_ALL, "svl::SfxStyleSheetBasePool::Make(), FamilyAll is not a allowed Familie" ); SfxStyleSheetIterator aIter(this, eFam, mask); rtl::Reference< SfxStyleSheetBase > xStyle( aIter.Find( rName ) ); - DBG_ASSERT( !xStyle.is(), "svtools::SfxStyleSheetBasePool::Make(), StyleSheet already exists" ); + DBG_ASSERT( !xStyle.is(), "svl::SfxStyleSheetBasePool::Make(), StyleSheet already exists" ); SfxStyleSheetIterator& rIter = GetIterator_Impl(); if( !xStyle.is() ) @@ -820,15 +819,15 @@ void SfxStyleSheetBasePool::Remove( SfxStyleSheetBase* p ) void SfxStyleSheetBasePool::Insert( SfxStyleSheetBase* p ) { - DBG_ASSERT( p, "svtools::SfxStyleSheetBasePool::Insert(), no stylesheet?" ); + DBG_ASSERT( p, "svl::SfxStyleSheetBasePool::Insert(), no stylesheet?" ); SfxStyleSheetIterator aIter(this, p->GetFamily(), p->GetMask()); SfxStyleSheetBase* pOld = aIter.Find( p->GetName() ); - DBG_ASSERT( !pOld, "svtools::SfxStyleSheetBasePool::Insert(), StyleSheet already inserted" ); + DBG_ASSERT( !pOld, "svl::SfxStyleSheetBasePool::Insert(), StyleSheet already inserted" ); if( p->GetParent().Len() ) { pOld = aIter.Find( p->GetParent() ); - DBG_ASSERT( pOld, "svtools::SfxStyleSheetBasePool::Insert(), Parent not found!" ); + DBG_ASSERT( pOld, "svl::SfxStyleSheetBasePool::Insert(), Parent not found!" ); } aStyles.push_back( rtl::Reference< SfxStyleSheetBase >( p ) ); Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *p ) ); diff --git a/svtools/source/items1/stylepool.cxx b/svl/source/items/stylepool.cxx index 5f31500be73c..6d214b6b94dd 100644 --- a/svtools/source/items1/stylepool.cxx +++ b/svl/source/items/stylepool.cxx @@ -27,6 +27,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svl.hxx" #ifdef _MSC_VER #pragma hdrstop @@ -36,8 +38,8 @@ #include <map> #include "stylepool.hxx" -#include <svtools/itemiter.hxx> -#include <svtools/itempool.hxx> +#include <svl/itemiter.hxx> +#include <svl/itempool.hxx> using namespace boost; diff --git a/svtools/source/items/szitem.cxx b/svl/source/items/szitem.cxx index ec3ff83dd2ec..a7667a25a97c 100644 --- a/svtools/source/items/szitem.cxx +++ b/svl/source/items/szitem.cxx @@ -29,15 +29,15 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" -#include <svtools/szitem.hxx> +#include <svl/szitem.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/awt/Size.hpp> #include <tools/stream.hxx> #include <tools/gen.hxx> -#include <svtools/poolitem.hxx> +#include <svl/poolitem.hxx> #include "memberid.hrc" // STATIC DATA ----------------------------------------------------------- diff --git a/svtools/source/items1/visitem.cxx b/svl/source/items/visitem.cxx index 112b223a8be0..e4ff302541fe 100644 --- a/svtools/source/items1/visitem.cxx +++ b/svl/source/items/visitem.cxx @@ -29,8 +29,8 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include <svtools/visitem.hxx> +#include "precompiled_svl.hxx" +#include <svl/visitem.hxx> #include <com/sun/star/uno/Any.hxx> #include <tools/stream.hxx> diff --git a/svtools/source/items1/whassert.hxx b/svl/source/items/whassert.hxx index fe9a834816c2..fe9a834816c2 100644 --- a/svtools/source/items1/whassert.hxx +++ b/svl/source/items/whassert.hxx diff --git a/svtools/source/items1/whiter.cxx b/svl/source/items/whiter.cxx index 461daf7ac012..b5e53e0bc278 100644 --- a/svtools/source/items1/whiter.cxx +++ b/svl/source/items/whiter.cxx @@ -29,13 +29,13 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" // INCLUDE --------------------------------------------------------------- #ifndef GCC #endif #include "whiter.hxx" -#include <svtools/itemset.hxx> +#include <svl/itemset.hxx> DBG_NAME(SfxWhichIter) diff --git a/svtools/source/memtools/makefile.mk b/svl/source/memtools/makefile.mk index 4592bceff8cc..8f59391a25ee 100644 --- a/svtools/source/memtools/makefile.mk +++ b/svl/source/memtools/makefile.mk @@ -31,7 +31,7 @@ PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=svarray # --- Settings ----------------------------------------------------- diff --git a/svtools/source/memtools/svarray.cxx b/svl/source/memtools/svarray.cxx index fe682e5f535d..e2fa809c1b52 100644 --- a/svtools/source/memtools/svarray.cxx +++ b/svl/source/memtools/svarray.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #define _SVARRAY_CXX @@ -59,7 +59,7 @@ #define _SVSTDARR_XUB_STRLEN #define _SVSTDARR_XUB_STRLENSORT -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <tools/string.hxx> #include <tools/debug.hxx> diff --git a/svtools/source/misc1/PasswordHelper.cxx b/svl/source/misc/PasswordHelper.cxx index 53c447bde830..a1125306eb7b 100644 --- a/svtools/source/misc1/PasswordHelper.cxx +++ b/svl/source/misc/PasswordHelper.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC diff --git a/svtools/source/misc1/adrparse.cxx b/svl/source/misc/adrparse.cxx index 37c25d6c669f..b45650846df5 100644 --- a/svtools/source/misc1/adrparse.cxx +++ b/svl/source/misc/adrparse.cxx @@ -29,16 +29,16 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <tools/inetmime.hxx> #include <adrparse.hxx> -namespace unnamed_svtools_adrparse {} -using namespace unnamed_svtools_adrparse; +namespace unnamed_svl_adrparse {} +using namespace unnamed_svl_adrparse; // unnamed namespaces don't work well yet //============================================================================ -namespace unnamed_svtools_adrparse { +namespace unnamed_svl_adrparse { enum ElementType { ELEMENT_START, ELEMENT_DELIM, ELEMENT_ITEM, ELEMENT_END }; diff --git a/svtools/source/misc/documentlockfile.cxx b/svl/source/misc/documentlockfile.cxx index 990f1ba58d73..b0c4148749e7 100644 --- a/svtools/source/misc/documentlockfile.cxx +++ b/svl/source/misc/documentlockfile.cxx @@ -30,7 +30,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <stdio.h> @@ -56,9 +56,9 @@ #include <ucbhelper/content.hxx> -#include <svtools/useroptions.hxx> +#include <unotools/useroptions.hxx> -#include <svtools/documentlockfile.hxx> +#include <svl/documentlockfile.hxx> using namespace ::com::sun::star; diff --git a/svtools/source/misc1/filenotation.cxx b/svl/source/misc/filenotation.cxx index f5e5ae934e3d..d50645c97439 100644 --- a/svtools/source/misc1/filenotation.cxx +++ b/svl/source/misc/filenotation.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "filenotation.hxx" #include <osl/file.h> #include <osl/diagnose.h> diff --git a/svtools/source/misc1/folderrestriction.cxx b/svl/source/misc/folderrestriction.cxx index 7f95bdaaa0bc..9ec7ead0a4be 100644 --- a/svtools/source/misc1/folderrestriction.cxx +++ b/svl/source/misc/folderrestriction.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "folderrestriction.hxx" #include "osl/process.h" diff --git a/svtools/source/misc1/fstathelper.cxx b/svl/source/misc/fstathelper.cxx index 82480fc83473..43619e879a91 100644 --- a/svtools/source/misc1/fstathelper.cxx +++ b/svl/source/misc/fstathelper.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <tools/date.hxx> #include <tools/time.hxx> #include <tools/string.hxx> diff --git a/svtools/source/misc1/inethist.cxx b/svl/source/misc/inethist.cxx index 5a1a3719d7ca..290312c0efd8 100644 --- a/svtools/source/misc1/inethist.cxx +++ b/svl/source/misc/inethist.cxx @@ -29,8 +29,8 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include <svtools/inethist.hxx> +#include "precompiled_svl.hxx" +#include <svl/inethist.hxx> #ifndef INCLUDED_ALGORITHM #include <algorithm> diff --git a/svtools/source/misc1/inettype.cxx b/svl/source/misc/inettype.cxx index ce62d7f3b2fc..47183be1d7b2 100644 --- a/svtools/source/misc1/inettype.cxx +++ b/svl/source/misc/inettype.cxx @@ -29,27 +29,27 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <tools/table.hxx> #include <tools/wldcrd.hxx> -#include <svtools/inettype.hxx> -#include <svtools/svtdata.hxx> +#include <svl/inettype.hxx> +#include <svl/svldata.hxx> #ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #endif #ifndef _SVSTDARR_STRINGSSORT_DECL #define _SVSTDARR_STRINGSSORT -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #undef _SVSTDARR_STRINGSSORT #endif -namespace unnamed_svtools_inettype {} -using namespace unnamed_svtools_inettype; +namespace unnamed_svl_inettype {} +using namespace unnamed_svl_inettype; // unnamed namespaces don't work well yet //============================================================================ -namespace unnamed_svtools_inettype { +namespace unnamed_svl_inettype { //============================================================================ struct MediaTypeEntry @@ -804,7 +804,7 @@ INetContentType Registration::GetContentType4Extension(UniString const & // //============================================================================ -namespace unnamed_svtools_inettype { +namespace unnamed_svl_inettype { MediaTypeEntry const * seekEntry(UniString const & rTypeName, MediaTypeEntry const * pMap, sal_Size nSize) diff --git a/svtools/source/misc1/lngmisc.cxx b/svl/source/misc/lngmisc.cxx index e00540af1ab1..df7c28d22b1d 100644 --- a/svtools/source/misc1/lngmisc.cxx +++ b/svl/source/misc/lngmisc.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <lngmisc.hxx> #include <tools/solar.h> #include <tools/string.hxx> diff --git a/svtools/source/misc/lockfilecommon.cxx b/svl/source/misc/lockfilecommon.cxx index ef2cf89d8572..f13ed574a87f 100644 --- a/svtools/source/misc/lockfilecommon.cxx +++ b/svl/source/misc/lockfilecommon.cxx @@ -30,7 +30,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <stdio.h> @@ -57,9 +57,9 @@ #include <ucbhelper/content.hxx> -#include <svtools/useroptions.hxx> +#include <unotools/useroptions.hxx> -#include <svtools/lockfilecommon.hxx> +#include <svl/lockfilecommon.hxx> using namespace ::com::sun::star; diff --git a/svtools/source/misc1/makefile.mk b/svl/source/misc/makefile.mk index dd143ea4e972..adc659a7b60b 100644 --- a/svtools/source/misc1/makefile.mk +++ b/svl/source/misc/makefile.mk @@ -30,8 +30,8 @@ #************************************************************************* PRJ=..$/.. -PRJNAME=svtools -TARGET=misc1 +PRJNAME=svl +TARGET=misc # --- Settings ----------------------------------------------------- @@ -41,10 +41,16 @@ TARGET=misc1 # --- Files -------------------------------------------------------- EXCEPTIONSFILES=\ - $(SLO)$/fstathelper.obj \ + $(SLO)$/documentlockfile.obj \ $(SLO)$/folderrestriction.obj \ + $(SLO)$/fstathelper.obj \ + $(SLO)$/lockfilecommon.obj \ + $(SLO)$/ownlist.obj \ + $(SLO)$/restrictedpaths.obj \ + $(SLO)$/sharecontrolfile.obj \ $(SLO)$/strmadpt.obj \ - $(SLO)$/svtdata.obj + $(SLO)$/svldata.obj \ + $(SLO)$/urihelper.obj SLOFILES=\ $(EXCEPTIONSFILES) \ @@ -52,7 +58,6 @@ SLOFILES=\ $(SLO)$/filenotation.obj \ $(SLO)$/inethist.obj \ $(SLO)$/inettype.obj \ - $(SLO)$/iniadrtk.obj \ $(SLO)$/lngmisc.obj \ $(SLO)$/PasswordHelper.obj diff --git a/svtools/source/misc1/mediatyp.src b/svl/source/misc/mediatyp.src index c7acdf8efc45..63033af29d03 100644 --- a/svtools/source/misc1/mediatyp.src +++ b/svl/source/misc/mediatyp.src @@ -35,7 +35,7 @@ //============================================================================ #ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #endif String STR_SVT_MIMETYPE_APP_OCTSTREAM diff --git a/svtools/source/misc/ownlist.cxx b/svl/source/misc/ownlist.cxx index 346b4ff7251e..def341d57b7c 100644 --- a/svtools/source/misc/ownlist.cxx +++ b/svl/source/misc/ownlist.cxx @@ -29,12 +29,12 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <ctype.h> #include <stdio.h> #include <com/sun/star/beans/PropertyValues.hpp> -#include <svtools/ownlist.hxx> +#include <svl/ownlist.hxx> using namespace com::sun::star; diff --git a/svtools/source/misc/restrictedpaths.cxx b/svl/source/misc/restrictedpaths.cxx index 354e32126680..9eda454604b1 100644 --- a/svtools/source/misc/restrictedpaths.cxx +++ b/svl/source/misc/restrictedpaths.cxx @@ -29,14 +29,14 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include <svtools/restrictedpaths.hxx> +#include "precompiled_svl.hxx" +#include <svl/restrictedpaths.hxx> #include <algorithm> #include <osl/process.h> #include <tools/urlobj.hxx> #include <unotools/localfilehelper.hxx> -#include <svtools/syslocale.hxx> +#include <unotools/syslocale.hxx> namespace svt { diff --git a/svtools/source/misc/sharecontrolfile.cxx b/svl/source/misc/sharecontrolfile.cxx index dbea89f54bcc..9249fa3f33de 100644 --- a/svtools/source/misc/sharecontrolfile.cxx +++ b/svl/source/misc/sharecontrolfile.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <stdio.h> @@ -57,9 +57,9 @@ #include <unotools/bootstrap.hxx> #include <unotools/streamwrap.hxx> -#include <svtools/useroptions.hxx> +#include <unotools/useroptions.hxx> -#include <svtools/sharecontrolfile.hxx> +#include <svl/sharecontrolfile.hxx> using namespace ::com::sun::star; diff --git a/svtools/source/misc1/strmadpt.cxx b/svl/source/misc/strmadpt.cxx index 4c4835609b7b..9803f2bcc32f 100644 --- a/svtools/source/misc1/strmadpt.cxx +++ b/svl/source/misc/strmadpt.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <functional> // needed under Solaris when including <algorithm>... diff --git a/svtools/source/misc1/svtdata.cxx b/svl/source/misc/svldata.cxx index 51247a628c0e..0ba8075069cd 100644 --- a/svtools/source/misc1/svtdata.cxx +++ b/svl/source/misc/svldata.cxx @@ -6,7 +6,7 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: svtdata.cxx,v $ + * $RCSfile: svldata.cxx,v $ * $Revision: 1.7 $ * * This file is part of OpenOffice.org. @@ -29,20 +29,20 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <map> #include <tools/resmgr.hxx> #include <tools/shl.hxx> #include <vos/process.hxx> -#include <svtools/svtdata.hxx> +#include <svl/svldata.hxx> -namespace unnamed_svtools_svtdata {} -using namespace unnamed_svtools_svtdata; +namespace unnamed_svl_svldata {} +using namespace unnamed_svl_svldata; // unnamed namespaces don't work well yet //============================================================================ -namespace unnamed_svtools_svtdata { +namespace unnamed_svl_svldata { typedef std::map< rtl::OUString, SimpleResMgr * > SimpleResMgrMap; @@ -50,13 +50,14 @@ typedef std::map< rtl::OUString, SimpleResMgr * > SimpleResMgrMap; //============================================================================ // -// ImpSvtData +// ImpSvlData // //============================================================================ -ImpSvtData::~ImpSvtData() +static ImpSvlData* pSvlData = 0; + +ImpSvlData::~ImpSvlData() { - delete pResMgr; for (SimpleResMgrMap::iterator t = static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs)->begin(); t != static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs)->end(); ++t) @@ -65,17 +66,7 @@ ImpSvtData::~ImpSvtData() } //============================================================================ -ResMgr * ImpSvtData::GetResMgr(const ::com::sun::star::lang::Locale aLocale) -{ - if (!pResMgr) - { - pResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(svt), aLocale ); - } - return pResMgr; -} - -//============================================================================ -SimpleResMgr* ImpSvtData::GetSimpleRM(const ::com::sun::star::lang::Locale& rLocale) +SimpleResMgr* ImpSvlData::GetSimpleRM(const ::com::sun::star::lang::Locale& rLocale) { if (!m_pThreadsafeRMs) m_pThreadsafeRMs = new SimpleResMgrMap; @@ -92,22 +83,12 @@ SimpleResMgr* ImpSvtData::GetSimpleRM(const ::com::sun::star::lang::Locale& rLoc return rResMgr; } -ResMgr * ImpSvtData::GetPatchResMgr(const ::com::sun::star::lang::Locale& aLocale) -{ - if (!pPatchResMgr) - { - pPatchResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(svp), aLocale); - } - return pPatchResMgr; -} - //============================================================================ // static -ImpSvtData & ImpSvtData::GetSvtData() +ImpSvlData & ImpSvlData::GetSvlData() { - void ** pAppData = GetAppData(SHL_SVT); - if (!*pAppData) - *pAppData= new ImpSvtData; - return *static_cast<ImpSvtData *>(*pAppData); + if (!pSvlData) + pSvlData= new ImpSvlData; + return *pSvlData; } diff --git a/svtools/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx index 1ddb4c6dd6f9..5473bf1c995d 100644 --- a/svtools/source/misc/urihelper.cxx +++ b/svl/source/misc/urihelper.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <urihelper.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" @@ -67,8 +67,8 @@ #include <unotools/charclass.hxx> #include "rtl/instance.hxx" -namespace unnamed_svtools_urihelper {} -using namespace unnamed_svtools_urihelper; +namespace unnamed_svl_urihelper {} +using namespace unnamed_svl_urihelper; // unnamed namespaces don't work well yet... namespace css = com::sun::star; @@ -80,7 +80,7 @@ using namespace com::sun::star; // //============================================================================ -namespace unnamed_svtools_urihelper { +namespace unnamed_svl_urihelper { inline UniString toUniString(ByteString const & rString) { @@ -425,7 +425,7 @@ rtl::OUString URIHelper::simpleNormalizedMakeRelative( // //============================================================================ -namespace unnamed_svtools_urihelper { +namespace unnamed_svl_urihelper { inline xub_StrLen nextChar(UniString const & rStr, xub_StrLen nPos) { diff --git a/svtools/source/notify/brdcst.cxx b/svl/source/notify/brdcst.cxx index 3a698c725c5c..08562fe9fece 100644 --- a/svtools/source/notify/brdcst.cxx +++ b/svl/source/notify/brdcst.cxx @@ -29,20 +29,20 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif #include <tools/debug.hxx> -#include <svtools/hint.hxx> -#include <svtools/smplhint.hxx> -#include <svtools/lstner.hxx> +#include <svl/hint.hxx> +#include <svl/smplhint.hxx> +#include <svl/lstner.hxx> SV_DECL_PTRARR( SfxListenerArr_Impl, SfxListener*, 0, 2 ) #define _SFX_BRDCST_CXX -#include <svtools/brdcst.hxx> +#include <svl/brdcst.hxx> //==================================================================== DBG_NAME(SfxBroadcaster) diff --git a/svtools/source/notify/broadcast.cxx b/svl/source/notify/broadcast.cxx index e363f545c719..ede14e4171b2 100644 --- a/svtools/source/notify/broadcast.cxx +++ b/svl/source/notify/broadcast.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif @@ -38,7 +38,7 @@ #include "listener.hxx" #include "listeneriter.hxx" #include "broadcast.hxx" -#include <svtools/smplhint.hxx> +#include <svl/smplhint.hxx> //==================================================================== diff --git a/svtools/source/notify/cancel.cxx b/svl/source/notify/cancel.cxx index 32a76a7df9c1..1df3abb22776 100644 --- a/svtools/source/notify/cancel.cxx +++ b/svl/source/notify/cancel.cxx @@ -29,15 +29,15 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #define _SFX_CANCEL_CXX -#include <svtools/cancel.hxx> +#include <svl/cancel.hxx> #include <vos/mutex.hxx> #include <tools/debug.hxx> -#include <svtools/smplhint.hxx> -#include <svtools/cnclhint.hxx> +#include <svl/smplhint.hxx> +#include <svl/cnclhint.hxx> #include <rtl/instance.hxx> namespace { struct lclMutex : public rtl::Static< ::vos::OMutex, lclMutex >{}; } diff --git a/svtools/source/notify/hint.cxx b/svl/source/notify/hint.cxx index 9ae3bf8f8b21..36bcfb9990d9 100644 --- a/svtools/source/notify/hint.cxx +++ b/svl/source/notify/hint.cxx @@ -29,11 +29,11 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif -#include <svtools/hint.hxx> +#include <svl/hint.hxx> //==================================================================== diff --git a/svtools/source/notify/isethint.cxx b/svl/source/notify/isethint.cxx index 67d484219ac6..5138fb2a9ad9 100644 --- a/svtools/source/notify/isethint.cxx +++ b/svl/source/notify/isethint.cxx @@ -29,13 +29,13 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif -#include <svtools/isethint.hxx> -#include <svtools/itemset.hxx> +#include <svl/isethint.hxx> +#include <svl/itemset.hxx> //==================================================================== diff --git a/svtools/source/notify/listener.cxx b/svl/source/notify/listener.cxx index 0ce072b44dfb..7d9a223e1a73 100644 --- a/svtools/source/notify/listener.cxx +++ b/svl/source/notify/listener.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif diff --git a/svtools/source/notify/listenerbase.cxx b/svl/source/notify/listenerbase.cxx index 25f1f1da1901..bb1569c128c5 100644 --- a/svtools/source/notify/listenerbase.cxx +++ b/svl/source/notify/listenerbase.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif diff --git a/svtools/source/notify/listenerbase.hxx b/svl/source/notify/listenerbase.hxx index e73f9dfc37c5..e73f9dfc37c5 100644 --- a/svtools/source/notify/listenerbase.hxx +++ b/svl/source/notify/listenerbase.hxx diff --git a/svtools/source/notify/listeneriter.cxx b/svl/source/notify/listeneriter.cxx index 08fcb5b7e9ac..1f92eadfedbc 100644 --- a/svtools/source/notify/listeneriter.cxx +++ b/svl/source/notify/listeneriter.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif #include <tools/debug.hxx> diff --git a/svtools/source/notify/lstner.cxx b/svl/source/notify/lstner.cxx index d7345d7ed3db..4be2020967b5 100644 --- a/svtools/source/notify/lstner.cxx +++ b/svl/source/notify/lstner.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif @@ -37,13 +37,13 @@ #include <tools/debug.hxx> #endif -#include <svtools/hint.hxx> -#include <svtools/brdcst.hxx> +#include <svl/hint.hxx> +#include <svl/brdcst.hxx> SV_DECL_PTRARR( SfxBroadcasterArr_Impl, SfxBroadcaster*, 0, 2 ) #define _SFX_LSTNER_CXX -#include <svtools/lstner.hxx> +#include <svl/lstner.hxx> //==================================================================== DBG_NAME(SfxListener) diff --git a/svtools/source/notify/makefile.mk b/svl/source/notify/makefile.mk index 8e4c4b211258..0d26860d02b5 100644 --- a/svtools/source/notify/makefile.mk +++ b/svl/source/notify/makefile.mk @@ -31,7 +31,7 @@ PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=notify # --- Settings ----------------------------------------------------- diff --git a/svtools/source/notify/smplhint.cxx b/svl/source/notify/smplhint.cxx index 6fddffc23e56..454710a1b79f 100644 --- a/svtools/source/notify/smplhint.cxx +++ b/svl/source/notify/smplhint.cxx @@ -29,11 +29,11 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif -#include <svtools/smplhint.hxx> +#include <svl/smplhint.hxx> //==================================================================== diff --git a/svtools/source/numbers/makefile.mk b/svl/source/numbers/makefile.mk index 46cd3985df1a..db4b30070ce8 100644 --- a/svtools/source/numbers/makefile.mk +++ b/svl/source/numbers/makefile.mk @@ -31,7 +31,7 @@ PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=numbers LIBTARGET=NO @@ -41,7 +41,7 @@ PROJECTPCHSOURCE= # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk +.INCLUDE : $(PRJ)$/util$/svl.pmk # --- Files -------------------------------------------------------- diff --git a/svtools/source/numbers/nbdll.cxx b/svl/source/numbers/nbdll.cxx index d7cf20f6059f..2bc5121e18fd 100644 --- a/svtools/source/numbers/nbdll.cxx +++ b/svl/source/numbers/nbdll.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifdef WIN #include <svwin.h> diff --git a/svtools/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx index d65a2fd696ce..23f627834955 100644 --- a/svtools/source/numbers/numfmuno.cxx +++ b/svl/source/numbers/numfmuno.cxx @@ -29,11 +29,10 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif -#include <vcl/svapp.hxx> #include <tools/color.hxx> #include <tools/debug.hxx> #include <i18npool/mslangid.hxx> @@ -45,9 +44,9 @@ #include "numfmuno.hxx" #include "numuno.hxx" -#include <svtools/zforlist.hxx> -#include <svtools/zformat.hxx> -#include <svtools/itemprop.hxx> +#include <svl/zforlist.hxx> +#include <svl/zformat.hxx> +#include <svl/itemprop.hxx> using namespace com::sun::star; diff --git a/svtools/source/numbers/numfmuno.hxx b/svl/source/numbers/numfmuno.hxx index 4148069fb37e..4148069fb37e 100644 --- a/svtools/source/numbers/numfmuno.hxx +++ b/svl/source/numbers/numfmuno.hxx diff --git a/svtools/source/numbers/numhead.cxx b/svl/source/numbers/numhead.cxx index 7e79aad624f3..3bb650b0c9ae 100644 --- a/svtools/source/numbers/numhead.cxx +++ b/svl/source/numbers/numhead.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif #include <tools/debug.hxx> @@ -139,7 +139,7 @@ ImpSvNumMultipleReadHeader::ImpSvNumMultipleReadHeader(SvStream& rNewStream) : ImpSvNumMultipleReadHeader::~ImpSvNumMultipleReadHeader() { - DBG_ASSERT( pMemStream->Tell() == pMemStream->GetSize(), + DBG_ASSERT( pMemStream->Tell() == pMemStream->GetEndOfData(), "Sizes nicht vollstaendig gelesen" ); delete pMemStream; delete [] pBuf; diff --git a/svtools/source/numbers/numhead.hxx b/svl/source/numbers/numhead.hxx index de23b3cbccf4..de23b3cbccf4 100644 --- a/svtools/source/numbers/numhead.hxx +++ b/svl/source/numbers/numhead.hxx diff --git a/svtools/source/numbers/numuno.cxx b/svl/source/numbers/numuno.cxx index f91bf82b4e60..3cc90998e2dc 100644 --- a/svtools/source/numbers/numuno.cxx +++ b/svl/source/numbers/numuno.cxx @@ -29,13 +29,12 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif #define _ZFORLIST_DECLARE_TABLE -#include <vcl/svapp.hxx> #include <tools/color.hxx> #include <tools/debug.hxx> #include <vos/mutex.hxx> @@ -44,7 +43,7 @@ #include "numuno.hxx" #include "numfmuno.hxx" -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> using namespace com::sun::star; diff --git a/svtools/source/numbers/supservs.cxx b/svl/source/numbers/supservs.cxx index 1035cd056406..7e4d8560dae7 100644 --- a/svtools/source/numbers/supservs.cxx +++ b/svl/source/numbers/supservs.cxx @@ -29,14 +29,13 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.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> -#include <vcl/svapp.hxx> #include <tools/stream.hxx> #include <strmadpt.hxx> #include "instrm.hxx" diff --git a/svtools/source/numbers/supservs.hxx b/svl/source/numbers/supservs.hxx index df48d6567ecc..7dbbfe27177d 100644 --- a/svtools/source/numbers/supservs.hxx +++ b/svl/source/numbers/supservs.hxx @@ -32,7 +32,7 @@ #define _SVTOOLS_NUMBERS_SUPPLIERSERVICE_HXX_ #include "numuno.hxx" -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/io/XPersistObject.hpp> diff --git a/svtools/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index 7aac440e8b58..372ae2b15abf 100644 --- a/svtools/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <ctype.h> #include <stdlib.h> @@ -44,16 +44,16 @@ #include <com/sun/star/i18n/CalendarFieldIndex.hpp> #include <unotools/digitgroupingiterator.hxx> -#include <svtools/zforlist.hxx> // NUMBERFORMAT_XXX +#include <svl/zforlist.hxx> // NUMBERFORMAT_XXX #include "zforscan.hxx" -#include <svtools/zformat.hxx> +#include <svl/zformat.hxx> #define _ZFORFIND_CXX #include "zforfind.hxx" #undef _ZFORFIND_CXX -#ifdef PRODUCT +#ifndef DBG_UTIL #define NF_TEST_CALENDAR 0 #else #define NF_TEST_CALENDAR 0 diff --git a/svtools/inc/zforfind.hxx b/svl/source/numbers/zforfind.hxx index 049925f2034f..049925f2034f 100644 --- a/svtools/inc/zforfind.hxx +++ b/svl/source/numbers/zforfind.hxx diff --git a/svtools/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index bb15e0ece1d6..6b0f7001f987 100644 --- a/svtools/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -29,17 +29,12 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif // #include <math.h> #include <tools/debug.hxx> -#ifndef _SOUND_HXX //autogen -#include <vcl/sound.hxx> -#endif -#include <vcl/svapp.hxx> -#include <vcl/settings.hxx> #include <unotools/charclass.hxx> #include <i18npool/mslangid.hxx> #include <unotools/localedatawrapper.hxx> @@ -48,23 +43,22 @@ #include <com/sun/star/i18n/KNumberFormatUsage.hpp> #include <com/sun/star/i18n/KNumberFormatType.hpp> #include <comphelper/processfactory.hxx> +#include <unotools/misccfg.hxx> #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #define _ZFORLIST_CXX #include <osl/mutex.hxx> -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> #undef _ZFORLIST_CXX #include "zforscan.hxx" #include "zforfind.hxx" -#include <svtools/zformat.hxx> +#include <svl/zformat.hxx> #include "numhead.hxx" -#include <svtools/syslocaleoptions.hxx> -#include "listener.hxx" -#include <svtools/smplhint.hxx> +#include <unotools/syslocaleoptions.hxx> #include <unotools/digitgroupingiterator.hxx> #include <rtl/logfile.hxx> #include <rtl/instance.hxx> @@ -108,7 +102,7 @@ static sal_uInt32 __FAR_DATA theIndexTable[NF_INDEX_TABLE_ENTRIES]; also handles one instance of the SysLocale options */ -class SvNumberFormatterRegistry_Impl : public SvtListener +class SvNumberFormatterRegistry_Impl : public utl::ConfigurationListener { List aFormatters; SvtSysLocaleOptions aSysLocaleOptions; @@ -125,30 +119,26 @@ public: sal_uInt32 Count() { return aFormatters.Count(); } - virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint ); - + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); }; SvNumberFormatterRegistry_Impl::SvNumberFormatterRegistry_Impl() { eSysLanguage = MsLangId::getRealLanguage( LANGUAGE_SYSTEM ); - aSysLocaleOptions.AddListener( *this ); + aSysLocaleOptions.AddListener( this ); } SvNumberFormatterRegistry_Impl::~SvNumberFormatterRegistry_Impl() { - aSysLocaleOptions.RemoveListener( *this ); + aSysLocaleOptions.RemoveListener( this ); } -void SvNumberFormatterRegistry_Impl::Notify( SvtBroadcaster&, const SfxHint& rHint ) +void SvNumberFormatterRegistry_Impl::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 nHint ) { - const SfxSimpleHint* pHint = PTR_CAST( SfxSimpleHint, &rHint ); - if( pHint ) - { - if ( pHint->GetId() & SYSLOCALEOPTIONS_HINT_LOCALE ) + if ( nHint & SYSLOCALEOPTIONS_HINT_LOCALE ) { ::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() ); for ( SvNumberFormatter* p = (SvNumberFormatter*)aFormatters.First(); @@ -158,7 +148,7 @@ void SvNumberFormatterRegistry_Impl::Notify( SvtBroadcaster&, const SfxHint& rHi } eSysLanguage = MsLangId::getRealLanguage( LANGUAGE_SYSTEM ); } - if ( pHint->GetId() & SYSLOCALEOPTIONS_HINT_CURRENCY ) + if ( nHint & SYSLOCALEOPTIONS_HINT_CURRENCY ) { ::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() ); for ( SvNumberFormatter* p = (SvNumberFormatter*)aFormatters.First(); @@ -167,7 +157,6 @@ void SvNumberFormatterRegistry_Impl::Notify( SvtBroadcaster&, const SfxHint& rHi p->ResetDefaultSystemCurrency(); } } - } } @@ -241,7 +230,7 @@ SvNumberFormatter::~SvNumberFormatter() void SvNumberFormatter::ImpConstruct( LanguageType eLang ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aTimeLog, "svtools", "er93726", "SvNumberFormatter::ImpConstruct" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aTimeLog, "svl", "er93726", "SvNumberFormatter::ImpConstruct" ); if ( eLang == LANGUAGE_DONTKNOW ) eLang = UNKNOWN_SUBSTITUTE; @@ -311,7 +300,7 @@ void SvNumberFormatter::ChangeIntl(LanguageType eLnge) if( !pMutex ) { // #i77768# Due to a static reference in the toolkit lib - // we need a mutex that lives longer than the svtools library. + // we need a mutex that lives longer than the svl library. // Otherwise the dtor would use a destructed mutex!! pMutex = new ::osl::Mutex; } @@ -539,7 +528,6 @@ BOOL SvNumberFormatter::PutEntry(String& rString, sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey(); if (nPos - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET) { - Sound::Beep(); DBG_ERROR("SvNumberFormatter:: Zu viele Formate pro CL"); delete p_Entry; } @@ -605,15 +593,14 @@ sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( String & rString, // #62389# empty format string (of Writer) => General standard format if (!rString.Len()) ; // nothing - else if (eLnge == LANGUAGE_SYSTEM && eSysLnge != - Application::GetSettings().GetLanguage()) + else if (eLnge == LANGUAGE_SYSTEM && eSysLnge != SvtSysLocale().GetLanguage()) { sal_uInt32 nOrig = GetEntryKey( rString, eSysLnge ); if (nOrig == NUMBERFORMAT_ENTRY_NOT_FOUND) nKey = nOrig; // none avaliable, maybe user-defined else - nKey = GetFormatForLanguageIfBuiltIn( nOrig, - Application::GetSettings().GetLanguage()); + nKey = GetFormatForLanguageIfBuiltIn( nOrig, SvtSysLocale().GetLanguage() ); + if (nKey == nOrig) { // Not a builtin format, convert. @@ -621,7 +608,7 @@ sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( String & rString, // language and wouldn't match eSysLnge anymore, do that on a copy. String aTmp( rString); rNewInserted = PutandConvertEntrySystem( aTmp, rCheckPos, rType, - nKey, eLnge, Application::GetSettings().GetLanguage()); + nKey, eLnge, SvtSysLocale().GetLanguage()); if (rCheckPos > 0) { DBG_ERRORFILE("SvNumberFormatter::GetIndexPuttingAndConverting: bad format code string for current locale"); @@ -689,7 +676,7 @@ void SvNumberFormatter::SetFormatUsed(sal_uInt32 nFIndex) BOOL SvNumberFormatter::Load( SvStream& rStream ) { - LanguageType eSysLang = Application::GetSettings().GetLanguage(); + LanguageType eSysLang = SvtSysLocale().GetLanguage(); SvNumberFormatter* pConverter = NULL; ImpSvNumMultipleReadHeader aHdr( rStream ); @@ -898,7 +885,7 @@ BOOL SvNumberFormatter::Save( SvStream& rStream ) const ImpSvNumMultipleWriteHeader aHdr( rStream ); // ab 364i wird gespeichert was SYSTEM wirklich war, vorher hart LANGUAGE_SYSTEM rStream << (USHORT) SV_NUMBERFORMATTER_VERSION; - rStream << (USHORT) Application::GetSettings().GetLanguage() << (USHORT) IniLnge; + rStream << (USHORT) SvtSysLocale().GetLanguage() << (USHORT) IniLnge; SvNumberFormatTable* pTable = (SvNumberFormatTable*) &aFTable; SvNumberformat* pEntry = (SvNumberformat*) pTable->First(); while (pEntry) @@ -2904,7 +2891,6 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter nNewKey = nPos+1; if (nPos - nCLOffset >= SV_COUNTRY_LANGUAGE_OFFSET) { - Sound::Beep(); DBG_ERROR( "SvNumberFormatter:: Zu viele Formate pro CL"); delete pNewEntry; @@ -3009,7 +2995,7 @@ USHORT SvNumberFormatter::ExpandTwoDigitYear( USHORT nYear ) const // static USHORT SvNumberFormatter::GetYear2000Default() { - return Application::GetSettings().GetMiscSettings().GetTwoDigitYearStart(); + return (USHORT) ::utl::MiscCfg().GetYear2000(); } @@ -3110,7 +3096,7 @@ void SvNumberFormatter::SetDefaultSystemCurrency( const String& rAbbrev, Languag { ::osl::MutexGuard aGuard( GetMutex() ); if ( eLang == LANGUAGE_SYSTEM ) - eLang = Application::GetSettings().GetLanguage(); + eLang = SvtSysLocale().GetLanguage(); const NfCurrencyTable& rTable = GetTheCurrencyTable(); USHORT nCount = rTable.Count(); const NfCurrencyEntryPtr* ppData = rTable.GetData(); @@ -3231,7 +3217,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat() // static // try to make it inline if possible since this a loop body // TRUE: continue; FALSE: break loop, if pFoundEntry==NULL dupe found -#ifdef PRODUCT +#ifndef DBG_UTIL inline #endif BOOL SvNumberFormatter::ImpLookupCurrencyEntryLoopBody( @@ -3551,9 +3537,9 @@ void SvNumberFormatter::ImpInitCurrencyTable() return ; bInitializing = TRUE; - RTL_LOGFILE_CONTEXT_AUTHOR( aTimeLog, "svtools", "er93726", "SvNumberFormatter::ImpInitCurrencyTable" ); + RTL_LOGFILE_CONTEXT_AUTHOR( aTimeLog, "svl", "er93726", "SvNumberFormatter::ImpInitCurrencyTable" ); - LanguageType eSysLang = Application::GetSettings().GetLanguage(); + LanguageType eSysLang = SvtSysLocale().GetLanguage(); LocaleDataWrapper* pLocaleData = new LocaleDataWrapper( ::comphelper::getProcessServiceFactory(), MsLangId::convertLanguageToLocale( eSysLang ) ); diff --git a/svtools/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index b137016efcff..8c49ed34c5a7 100644 --- a/svtools/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <stdio.h> #include <ctype.h> #include <float.h> @@ -49,11 +49,11 @@ #include <com/sun/star/i18n/AmPmValue.hpp> #define _ZFORMAT_CXX -#include <svtools/zformat.hxx> +#include <svl/zformat.hxx> #include "zforscan.hxx" #include "zforfind.hxx" -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> #include "numhead.hxx" #include <unotools/digitgroupingiterator.hxx> #include "nfsymbol.hxx" diff --git a/svtools/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index dcdae90ae8a2..116ea4ce2f82 100644 --- a/svtools/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifndef GCC #endif @@ -41,8 +41,8 @@ #include <unotools/numberformatcodewrapper.hxx> #include <rtl/instance.hxx> -#include <svtools/zforlist.hxx> -#include <svtools/zformat.hxx> +#include <svl/zforlist.hxx> +#include <svl/zformat.hxx> #include <unotools/digitgroupingiterator.hxx> #define _ZFORSCAN_CXX diff --git a/svtools/source/numbers/zforscan.hxx b/svl/source/numbers/zforscan.hxx index e873e838f3f2..f7be8f49eb1d 100644 --- a/svtools/source/numbers/zforscan.hxx +++ b/svl/source/numbers/zforscan.hxx @@ -34,7 +34,7 @@ #include <tools/date.hxx> #include <i18npool/lang.h> #include <tools/color.hxx> -#include <svtools/nfkeytab.hxx> +#include <svl/nfkeytab.hxx> #include "nfsymbol.hxx" class SvNumberFormatter; diff --git a/svtools/source/passwordcontainer/exports.map b/svl/source/passwordcontainer/exports.map index f4ed78b9e970..f4ed78b9e970 100644 --- a/svtools/source/passwordcontainer/exports.map +++ b/svl/source/passwordcontainer/exports.map diff --git a/svtools/source/passwordcontainer/makefile.mk b/svl/source/passwordcontainer/makefile.mk index 31e1336ad966..3c74246ee3ed 100644 --- a/svtools/source/passwordcontainer/makefile.mk +++ b/svl/source/passwordcontainer/makefile.mk @@ -30,7 +30,7 @@ #************************************************************************* PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=passwordcontainer.uno LIBTARGET=NO ENABLE_EXCEPTIONS=TRUE diff --git a/svtools/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index cebde0705f12..4d629958e5bf 100644 --- a/svtools/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -29,11 +29,11 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "passwordcontainer.hxx" -#include <svtools/pathoptions.hxx> +#include <unotools/pathoptions.hxx> #include "cppuhelper/factory.hxx" #include <com/sun/star/registry/XSimpleRegistry.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -152,17 +152,10 @@ static vector< ::rtl::OUString > getInfoFromInd( ::rtl::OUString aInd ) static sal_Bool shorterUrl( ::rtl::OUString& aURL ) { sal_Int32 aInd = aURL.lastIndexOf( sal_Unicode( '/' ) ); - - if( aInd > 0 ) + if( aInd > 0 && aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) ) != aInd-2 ) { - sal_Int32 aPrevInd = aURL.lastIndexOf( sal_Unicode( '/' ), aInd ); - if ( aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) ) - != aPrevInd - 2 || - aInd != aURL.getLength() - 1 ) - { - aURL = aURL.copy( 0, aInd ); - return sal_True; - } + aURL = aURL.copy( 0, aInd ); + return sal_True; } return sal_False; @@ -1480,7 +1473,7 @@ Sequence< ::rtl::OUString > SAL_CALL PasswordContainer::impl_getStaticSupportedS ::rtl::OUString SAL_CALL PasswordContainer::impl_getStaticImplementationName() throw(uno::RuntimeException) { - return ::rtl::OUString::createFromAscii("stardiv.svtools.PasswordContainer"); + return ::rtl::OUString::createFromAscii("stardiv.svl.PasswordContainer"); } //------------------------------------------------------------------------- @@ -1563,7 +1556,7 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( Reference< XRegistryKey > xNewKey; xNewKey = xRegistryKey->createKey( - ::rtl::OUString::createFromAscii( "/stardiv.svtools.PasswordContainer/UNO/SERVICES" )); + ::rtl::OUString::createFromAscii( "/stardiv.svl.PasswordContainer/UNO/SERVICES" )); xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.task.PasswordContainer")); return sal_True; diff --git a/svtools/source/passwordcontainer/syscreds.cxx b/svl/source/passwordcontainer/syscreds.cxx index b8c223040e6d..faf086e369bd 100644 --- a/svtools/source/passwordcontainer/syscreds.cxx +++ b/svl/source/passwordcontainer/syscreds.cxx @@ -59,6 +59,11 @@ void SysCredentialsConfigItem::Notify( m_pOwner->persistentConfigChanged(); } +void SysCredentialsConfigItem::Commit() +{ + // does nothing +} + uno::Sequence< rtl::OUString > SysCredentialsConfigItem::getSystemCredentialsURLs() { @@ -112,7 +117,7 @@ void SysCredentialsConfigItem::setSystemCredentialsURLs( namespace { - // TODO: This code is actually copied from svtools/source/passwordcontainer.cxx + // TODO: This code is actually copied from svl/source/passwordcontainer.cxx bool removeLastSegment( ::rtl::OUString & aURL ) { sal_Int32 aInd = aURL.lastIndexOf( sal_Unicode( '/' ) ); @@ -134,7 +139,7 @@ namespace bool findURL( StringSet const & rContainer, rtl::OUString const & aURL, rtl::OUString & aResult ) { - // TODO: This code is actually copied from svtools/source/passwordcontainer.cxx + // TODO: This code is actually copied from svl/source/passwordcontainer.cxx if( !rContainer.empty() && aURL.getLength() ) { ::rtl::OUString aUrl( aURL ); diff --git a/svtools/source/passwordcontainer/syscreds.hxx b/svl/source/passwordcontainer/syscreds.hxx index b037e17c348e..68de21049fdc 100644 --- a/svtools/source/passwordcontainer/syscreds.hxx +++ b/svl/source/passwordcontainer/syscreds.hxx @@ -49,7 +49,7 @@ class SysCredentialsConfigItem : public utl::ConfigItem virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString > & seqPropertyNames ); - //virtual void Commit(); + virtual void Commit(); com::sun::star::uno::Sequence< rtl::OUString > getSystemCredentialsURLs(); diff --git a/svtools/source/svdde/ddecli.cxx b/svl/source/svdde/ddecli.cxx index e31e53d07522..dd3c9c237f9a 100644 --- a/svtools/source/svdde/ddecli.cxx +++ b/svl/source/svdde/ddecli.cxx @@ -29,16 +29,16 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #define UNICODE #include <string.h> // memset #include "ddeimp.hxx" -#include <svtools/svdde.hxx> +#include <svl/svdde.hxx> #include <osl/thread.h> #include <tools/debug.hxx> -#include <vcl/svapp.hxx> +#include <tools/solarmutex.hxx> #include <vos/mutex.hxx> // static DWORD hDdeInst = NULL; @@ -367,9 +367,11 @@ const String& DdeTransaction::GetName() const void __EXPORT DdeTransaction::Data( const DdeData* p ) { - Application::GetSolarMutex().acquire(); - aData.Call( (void*)p ); - Application::GetSolarMutex().release(); + if ( ::tools::SolarMutex::Acquire() ) + { + aData.Call( (void*)p ); + ::tools::SolarMutex::Release(); + } } // --- DdeTransaction::Done() -------------------------------------- diff --git a/svtools/source/svdde/ddedata.cxx b/svl/source/svdde/ddedata.cxx index 9167c8585b08..8ae22a8cfb20 100644 --- a/svtools/source/svdde/ddedata.cxx +++ b/svl/source/svdde/ddedata.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" // ACHTUNG: es wird angenommen, dass StarView-Clipboard-Foamatnummern // und Windows-Formatnummern identisch sind! Ist dies einmal nicht der @@ -40,7 +40,7 @@ #include <string.h> #include "ddeimp.hxx" -#include <svtools/svdde.hxx> +#include <svl/svdde.hxx> #include <osl/thread.h> diff --git a/svtools/source/svdde/ddedll.cxx b/svl/source/svdde/ddedll.cxx index 696d7b2851d2..b27272a2a910 100644 --- a/svtools/source/svdde/ddedll.cxx +++ b/svl/source/svdde/ddedll.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #ifdef WIN diff --git a/svtools/source/svdde/ddeimp.hxx b/svl/source/svdde/ddeimp.hxx index dcdf5b3be33c..dcdf5b3be33c 100644 --- a/svtools/source/svdde/ddeimp.hxx +++ b/svl/source/svdde/ddeimp.hxx diff --git a/svtools/source/svdde/ddeinf.cxx b/svl/source/svdde/ddeinf.cxx index 7c2fb82789e6..b5154e1f7530 100644 --- a/svtools/source/svdde/ddeinf.cxx +++ b/svl/source/svdde/ddeinf.cxx @@ -29,13 +29,13 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #define UNICODE #include <string.h> #include "ddeimp.hxx" -#include <svtools/svdde.hxx> +#include <svl/svdde.hxx> // --- DdeInternal::InfCallback() ---------------------------------- diff --git a/svtools/source/svdde/ddeml1.cxx b/svl/source/svdde/ddeml1.cxx index 6cc09b612ecf..9d1351b17f16 100644 --- a/svtools/source/svdde/ddeml1.cxx +++ b/svl/source/svdde/ddeml1.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" /* ToDo / Bugs: @@ -1089,7 +1089,7 @@ ImpService* ImpDdeMgr::PutService( HSZ hszService ) String aStr( (ULONG)hWndServer ); aStr += pBuf; HSZ hszInstServ = DdeCreateStringHandle( (PSZ)(const char*)pBuf, 850 ); - delete pBuf; + delete [] pBuf; pPtr->hBaseServName = hszService; pPtr->hInstServName = hszInstServ; diff --git a/svtools/source/svdde/ddeml2.cxx b/svl/source/svdde/ddeml2.cxx index 979897136a46..e0cdee2d52d1 100644 --- a/svtools/source/svdde/ddeml2.cxx +++ b/svl/source/svdde/ddeml2.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #define INCL_DOS #include <stdlib.h> diff --git a/svtools/source/svdde/ddemldeb.cxx b/svl/source/svdde/ddemldeb.cxx index bb53743a2915..18da7c07fd3c 100644 --- a/svtools/source/svdde/ddemldeb.cxx +++ b/svl/source/svdde/ddemldeb.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "ddemlimp.hxx" diff --git a/svtools/source/svdde/ddemldeb.hxx b/svl/source/svdde/ddemldeb.hxx index 39d3d836882a..39d3d836882a 100644 --- a/svtools/source/svdde/ddemldeb.hxx +++ b/svl/source/svdde/ddemldeb.hxx diff --git a/svtools/source/svdde/ddemlimp.hxx b/svl/source/svdde/ddemlimp.hxx index 47ad53d0b9fe..47ad53d0b9fe 100644 --- a/svtools/source/svdde/ddemlimp.hxx +++ b/svl/source/svdde/ddemlimp.hxx diff --git a/svtools/source/svdde/ddemlos2.h b/svl/source/svdde/ddemlos2.h index fe685e95fecf..fe685e95fecf 100644 --- a/svtools/source/svdde/ddemlos2.h +++ b/svl/source/svdde/ddemlos2.h diff --git a/svtools/source/svdde/ddestrg.cxx b/svl/source/svdde/ddestrg.cxx index 40af3b1cbc27..9cd594a7920d 100644 --- a/svtools/source/svdde/ddestrg.cxx +++ b/svl/source/svdde/ddestrg.cxx @@ -29,12 +29,12 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #define UNICODE #include "ddeimp.hxx" -#include <svtools/svdde.hxx> +#include <svl/svdde.hxx> #if defined( WIN ) && defined( MSC ) #pragma code_seg( "SVDDE_MISC_CODE" ) diff --git a/svtools/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx index a2124548b4c8..ec718d4e56ee 100644 --- a/svtools/source/svdde/ddesvr.cxx +++ b/svl/source/svdde/ddesvr.cxx @@ -29,12 +29,12 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #define UNICODE #include "ddeimp.hxx" -#include <svtools/svdde.hxx> -#include <svtools/svarray.hxx> +#include <svl/svdde.hxx> +#include <svl/svarray.hxx> #include <tools/debug.hxx> #include <osl/thread.h> @@ -190,7 +190,7 @@ HDDEDATA CALLBACK _export DdeInternal::SvrCallback( pInst->hDdeInstSvr, (LPBYTE) pPairs, sizeof(HSZPAIR) * (nTopics+1), 0, NULL, nCbType, 0); - delete pPairs; + delete [] pPairs; return h; } diff --git a/svtools/source/svdde/ddewrap.cxx b/svl/source/svdde/ddewrap.cxx index b0b023ad3a75..650ec5b1b31f 100644 --- a/svtools/source/svdde/ddewrap.cxx +++ b/svl/source/svdde/ddewrap.cxx @@ -30,7 +30,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #define _SVTOOLS_SVDDE_DDEWRAP_CXX_ #if defined _MSC_VER diff --git a/svtools/source/svdde/ddewrap.hxx b/svl/source/svdde/ddewrap.hxx index 77d012ccbba5..77d012ccbba5 100644 --- a/svtools/source/svdde/ddewrap.hxx +++ b/svl/source/svdde/ddewrap.hxx diff --git a/svtools/source/svdde/makefile.mk b/svl/source/svdde/makefile.mk index f4c72aff2094..321a4b5ced03 100644 --- a/svtools/source/svdde/makefile.mk +++ b/svl/source/svdde/makefile.mk @@ -34,13 +34,13 @@ PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=svdde # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk +.INCLUDE : $(PRJ)$/util$/svl.pmk # --- Files -------------------------------------------------------- diff --git a/svtools/source/svsql/converter.cxx b/svl/source/svsql/converter.cxx index c87290265e90..826b64adc48d 100644 --- a/svtools/source/svsql/converter.cxx +++ b/svl/source/svsql/converter.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "converter.hxx" INT32 SvDbaseConverter::ConvertPrecisionToDbase(INT32 _nLen, INT32 _nScale) diff --git a/svtools/source/svsql/makefile.mk b/svl/source/svsql/makefile.mk index 55c400b83ef3..ae3abf24db24 100644 --- a/svtools/source/svsql/makefile.mk +++ b/svl/source/svsql/makefile.mk @@ -31,7 +31,7 @@ PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=svsql # --- Settings ----------------------------------------------------- diff --git a/svtools/source/undo/makefile.mk b/svl/source/undo/makefile.mk index b277fa3c906f..7c51df3f17fc 100644 --- a/svtools/source/undo/makefile.mk +++ b/svl/source/undo/makefile.mk @@ -31,14 +31,14 @@ PRJ=..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=undo ENABLE_EXCEPTIONS=TRUE # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk +.INCLUDE : $(PRJ)$/util$/svl.pmk # --- Files -------------------------------------------------------- diff --git a/svtools/source/undo/undo.cxx b/svl/source/undo/undo.cxx index 2f733d4f03b3..a8442098237e 100644 --- a/svtools/source/undo/undo.cxx +++ b/svl/source/undo/undo.cxx @@ -29,13 +29,13 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include <com/sun/star/uno/Exception.hpp> #include <tools/debug.hxx> -#include <svtools/undo.hxx> +#include <svl/undo.hxx> using ::com::sun::star::uno::Exception; @@ -313,7 +313,7 @@ USHORT SfxUndoManager::GetUndoActionCount() const XubString SfxUndoManager::GetUndoActionComment( USHORT nNo ) const { - DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::GetUndoActionComment(), illegal id!" ); + DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svl::SfxUndoManager::GetUndoActionComment(), illegal id!" ); if( nNo < pActUndoArray->nCurUndoAction ) { return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]->GetComment(); //! @@ -329,7 +329,7 @@ XubString SfxUndoManager::GetUndoActionComment( USHORT nNo ) const USHORT SfxUndoManager::GetUndoActionId( USHORT nNo ) const { - DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::GetUndoActionId(), illegal id!" ); + DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svl::SfxUndoManager::GetUndoActionId(), illegal id!" ); if( nNo < pActUndoArray->nCurUndoAction ) { return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]->GetId(); //! @@ -344,7 +344,7 @@ USHORT SfxUndoManager::GetUndoActionId( USHORT nNo ) const SfxUndoAction* SfxUndoManager::GetUndoAction( USHORT nNo ) const { - DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::GetUndoAction(), illegal id!" ); + DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svl::SfxUndoManager::GetUndoAction(), illegal id!" ); if( nNo < pActUndoArray->nCurUndoAction ) { return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]; //! @@ -360,7 +360,7 @@ SfxUndoAction* SfxUndoManager::GetUndoAction( USHORT nNo ) const /** clears the redo stack and removes the top undo action */ void SfxUndoManager::RemoveLastUndoAction() { - DBG_ASSERT( pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::RemoveLastUndoAction(), no action to remove?!" ); + DBG_ASSERT( pActUndoArray->nCurUndoAction, "svl::SfxUndoManager::RemoveLastUndoAction(), no action to remove?!" ); if( pActUndoArray->nCurUndoAction ) { pActUndoArray->nCurUndoAction--; @@ -387,7 +387,7 @@ BOOL SfxUndoManager::Undo( USHORT ) try { - DBG_ASSERT( pActUndoArray == pUndoArray, "svtools::SfxUndoManager::Undo(), LeaveListAction() not yet called!" ); + DBG_ASSERT( pActUndoArray == pUndoArray, "svl::SfxUndoManager::Undo(), LeaveListAction() not yet called!" ); if ( pActUndoArray->nCurUndoAction ) { Undo( *pActUndoArray->aUndoActions[ --pActUndoArray->nCurUndoAction ] ); @@ -587,11 +587,11 @@ void SfxUndoManager::LeaveListAction() if( pActUndoArray == pUndoArray ) { - DBG_ERROR( "svtools::SfxUndoManager::LeaveListAction(), called without calling EnterListAction()!" ); + DBG_ERROR( "svl::SfxUndoManager::LeaveListAction(), called without calling EnterListAction()!" ); return; } - DBG_ASSERT(pActUndoArray->pFatherUndoArray,"svtools::SfxUndoManager::LeaveListAction(), no father undo array!?"); + DBG_ASSERT(pActUndoArray->pFatherUndoArray,"svl::SfxUndoManager::LeaveListAction(), no father undo array!?"); SfxUndoArray* pTmp=pActUndoArray; pActUndoArray=pActUndoArray->pFatherUndoArray; diff --git a/svl/source/uno/makefile.mk b/svl/source/uno/makefile.mk new file mode 100644 index 000000000000..af26b20cd8df --- /dev/null +++ b/svl/source/uno/makefile.mk @@ -0,0 +1,51 @@ +#************************************************************************* +# +# 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: makefile.mk,v $ +# +# $Revision: 1.21 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=svl +TARGET=unoiface +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/svl.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES= \ + $(SLO)$/registerservices.obj\ + $(SLO)$/pathservice.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/svtools/uno/pathservice.cxx b/svl/source/uno/pathservice.cxx index 65d08609483a..78c339773aec 100644 --- a/svtools/uno/pathservice.cxx +++ b/svl/source/uno/pathservice.cxx @@ -29,9 +29,9 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" -#include <svtools/pathoptions.hxx> +#include <unotools/pathoptions.hxx> #include "sal/types.h" #include "rtl/ustring.hxx" #include <cppuhelper/implbase2.hxx> @@ -54,7 +54,7 @@ public: virtual OUString SAL_CALL getImplementationName() throw(css::uno::RuntimeException) { - return OUString::createFromAscii("com.sun.star.comp.svtools.PathService"); + return OUString::createFromAscii("com.sun.star.comp.svl.PathService"); } virtual sal_Bool SAL_CALL supportsService ( diff --git a/svtools/source/uno/registerservices.cxx b/svl/source/uno/registerservices.cxx index a3e9f39c2dba..39be9e177fea 100644 --- a/svtools/source/uno/registerservices.cxx +++ b/svl/source/uno/registerservices.cxx @@ -29,13 +29,14 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_svl.hxx" #include "sal/types.h" #include "rtl/ustring.hxx" #include <cppuhelper/factory.hxx> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/registry/XRegistryKey.hpp> +#include <svl/svldllapi.h> namespace css = com::sun::star; using css::uno::Reference; @@ -49,19 +50,20 @@ using rtl::OUString; DECLARE_CREATEINSTANCE( SvNumberFormatterServiceObj ) DECLARE_CREATEINSTANCE( SvNumberFormatsSupplierServiceObject ) +DECLARE_CREATEINSTANCE( PathService ) // ------------------------------------------------------------------------------------- extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( +SVL_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment ( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( +SVL_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo ( void * /* _pServiceManager */, void * _pRegistryKey) { if (_pRegistryKey) @@ -82,12 +84,17 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( xNewKey->createKey ( OUString::createFromAscii( "com.sun.star.util.NumberFormatter" ) ); + xNewKey = xRegistryKey->createKey( + OUString::createFromAscii( "/com.sun.star.comp.svl.PathService/UNO/SERVICES" ) ); + xNewKey->createKey ( + OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" ) ); + return sal_True; } return sal_False; } -SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory ( +SVL_DLLPUBLIC void* SAL_CALL component_getFactory ( const sal_Char * pImplementationName, void * _pServiceManager, void * /* _pRegistryKey*/) { void * pResult = 0; @@ -122,6 +129,18 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory ( SvNumberFormatterServiceObj_CreateInstance, aServiceNames); } + else if (rtl_str_compare ( + pImplementationName, "com.sun.star.comp.svl.PathService") == 0) + { + Sequence< OUString > aServiceNames(1); + aServiceNames.getArray()[0] = + OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" ); + xFactory = ::cppu::createSingleFactory ( + reinterpret_cast< css::lang::XMultiServiceFactory* >( _pServiceManager ), + OUString::createFromAscii( pImplementationName ), + PathService_CreateInstance, + aServiceNames); + } if ( xFactory.is() ) { xFactory->acquire(); diff --git a/svtools/unx/inc/convert.hxx b/svl/unx/inc/convert.hxx index e91ee4ed2791..e91ee4ed2791 100644 --- a/svtools/unx/inc/convert.hxx +++ b/svl/unx/inc/convert.hxx diff --git a/svtools/unx/source/svdde/ddedummy.cxx b/svl/unx/source/svdde/ddedummy.cxx index 6f627807bfd3..2aec705bc7ef 100644 --- a/svtools/unx/source/svdde/ddedummy.cxx +++ b/svl/unx/source/svdde/ddedummy.cxx @@ -29,8 +29,8 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include <svtools/svdde.hxx> +#include "precompiled_svl.hxx" +#include <svl/svdde.hxx> #include <rtl/instance.hxx> DdeData::DdeData() diff --git a/svtools/unx/source/svdde/makefile.mk b/svl/unx/source/svdde/makefile.mk index d0203fd6378b..c6e89eaf2630 100644 --- a/svtools/unx/source/svdde/makefile.mk +++ b/svl/unx/source/svdde/makefile.mk @@ -31,13 +31,13 @@ PRJ=..$/..$/.. -PRJNAME=svtools +PRJNAME=svl TARGET=svdde # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk +.INCLUDE : $(PRJ)$/util$/svl.pmk # --- Files -------------------------------------------------------- diff --git a/svl/util/makefile.mk b/svl/util/makefile.mk new file mode 100644 index 000000000000..47a37a6e9173 --- /dev/null +++ b/svl/util/makefile.mk @@ -0,0 +1,126 @@ +#************************************************************************* +#* +# 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: makefile.mk,v $ +# +# $Revision: 1.67 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=.. + +PRJNAME=svl +TARGET=svl +RESTARGETSIMPLE=svs +GEN_HID=TRUE +# GEN_HID_OTHER=TRUE +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# --- general section ---------------------------------------------------- + +.IF "$(GUI)"!="UNX" +LIB2TARGET= $(LB)$/isvl.lib +LIB2FILES= $(LB)$/_isvl.lib +.ENDIF + +LIB1TARGET= $(SLB)$/svl.lib +LIB1FILES= \ + $(SLB)$/config.lib \ + $(SLB)$/svdde.lib \ + $(SLB)$/undo.lib \ + $(SLB)$/numbers.lib \ + $(SLB)$/numbers.uno.lib \ + $(SLB)$/filerec.lib \ + $(SLB)$/filepicker.lib \ + $(SLB)$/items.lib \ + $(SLB)$/misc.lib \ + $(SLB)$/notify.lib \ + $(SLB)$/unoiface.lib \ + $(SLB)$/svarray.lib \ + $(SLB)$/svsql.lib + +# generation of resourcen-lib ---------------------------------------- + +RESLIB1NAME= $(RESTARGETSIMPLE) +RESLIB1SRSFILES=\ + $(SRS)$/items.srs \ + $(SRS)$/misc.srs + +# build the shared library -------------------------------------------------- + +SHL1TARGET= svl$(DLLPOSTFIX) +SHL1IMPLIB= _isvl +SHL1USE_EXPORTS=name +#Do not link with VCL or any other library that links with VCL +SHL1STDLIBS= \ + $(UNOTOOLSLIB) \ + $(TOOLSLIB) \ + $(I18NISOLANGLIB) \ + $(UCBHELPERLIB) \ + $(COMPHELPERLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(VOSLIB) \ + $(SOTLIB) \ + $(SALLIB) + +.IF "$(GUI)"=="WNT" +SHL1STDLIBS+= \ + $(UWINAPILIB) \ + $(ADVAPI32LIB) \ + $(GDI32LIB) +.ENDIF # WNT + +SHL1LIBS= $(SLB)$/svl.lib + +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) +DEF1DEPN= $(SLB)$/svl.lib +DEFLIB1NAME=svl +DEF1DES =SvTools lite + +# --- Targets ------------------------------------------------------ + +.IF "$(GUI)"=="UNX" +SVTTARGETS= $(LB)$/lib$(SHL1TARGET)$(DLLPOST) +.ELSE +SVTTARGETS= $(LB)$/isvl.lib +.ENDIF + +# just a quick fix - has to be cleaned up some day... +.IF "$(L10N-framework)"=="" +ALL: $(SLB)$/svl.lib \ + $(MISC)$/$(SHL1TARGET).def \ + $(SVTTARGETS) \ + ALLTAR +.ENDIF # "$(L10N-framework)"=="" + +.INCLUDE : target.mk + diff --git a/svtools/util/svl.pmk b/svl/util/svl.pmk index aec76257e743..aec76257e743 100644 --- a/svtools/util/svl.pmk +++ b/svl/util/svl.pmk diff --git a/svtools/bmpmaker/bmp.cxx b/svtools/bmpmaker/bmp.cxx index df20c7e05376..b91dae79bbad 100644 --- a/svtools/bmpmaker/bmp.cxx +++ b/svtools/bmpmaker/bmp.cxx @@ -43,7 +43,7 @@ using namespace std; #include <vcl/svapp.hxx> -#include "svtools/solar.hrc" +#include "svl/solar.hrc" #include "filedlg.hxx" #include "bmpcore.hxx" #include "bmp.hrc" diff --git a/svtools/bmpmaker/bmpsum.cxx b/svtools/bmpmaker/bmpsum.cxx index 0633eb4c6a09..3eee49ef695d 100644 --- a/svtools/bmpmaker/bmpsum.cxx +++ b/svtools/bmpmaker/bmpsum.cxx @@ -45,7 +45,7 @@ #include <vcl/bmpacc.hxx> #include <vcl/pngread.hxx> -#include "svtools/solar.hrc" +#include "svl/solar.hrc" #define EXIT_NOERROR 0x00000000 #define EXIT_INVALIDFILE 0x00000001 diff --git a/svtools/inc/apearcfg.hxx b/svtools/inc/apearcfg.hxx index 1123eb839eff..412faab3107b 100644 --- a/svtools/inc/apearcfg.hxx +++ b/svtools/inc/apearcfg.hxx @@ -87,6 +87,7 @@ public: ~SvtTabAppearanceCfg( ); virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames); USHORT GetLookNFeel () const { return nLookNFeel; } void SetLookNFeel ( USHORT nSet ); diff --git a/svtools/inc/calendar.hxx b/svtools/inc/calendar.hxx index 6f20a7f8c6c3..1c81945a669c 100644 --- a/svtools/inc/calendar.hxx +++ b/svtools/inc/calendar.hxx @@ -251,6 +251,7 @@ private: USHORT mnDragScrollHitTest; #ifdef _SV_CALENDAR_CXX + using Control::ImplInitSettings; using Window::ImplInit; SVT_DLLPRIVATE void ImplInit( WinBits nWinStyle ); SVT_DLLPRIVATE void ImplInitSettings(); diff --git a/svtools/inc/extcolorcfg.hxx b/svtools/inc/extcolorcfg.hxx index f8154c86f88f..228ef9823fd2 100644 --- a/svtools/inc/extcolorcfg.hxx +++ b/svtools/inc/extcolorcfg.hxx @@ -34,8 +34,8 @@ #include <rtl/ustring.hxx> #include <tools/color.hxx> #include <com/sun/star/uno/Sequence.h> -#include <svtools/brdcst.hxx> -#include <svtools/lstner.hxx> +#include <svl/brdcst.hxx> +#include <svl/lstner.hxx> //----------------------------------------------------------------------------- namespace svtools{ diff --git a/svtools/source/dialogs/filedlg2.hrc b/svtools/inc/filedlg2.hrc index a75e9047eafb..a75e9047eafb 100644 --- a/svtools/source/dialogs/filedlg2.hrc +++ b/svtools/inc/filedlg2.hrc diff --git a/svtools/inc/flbytes.hxx b/svtools/inc/flbytes.hxx deleted file mode 100644 index 86c19191de2a..000000000000 --- a/svtools/inc/flbytes.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: flbytes.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 _FLBYTES_HXX -#define _FLBYTES_HXX - -#include <tools/debug.hxx> -#include <tools/stream.hxx> - -//============================================================================ -class SvFillLockBytes : public SvLockBytes -{ - SvLockBytesRef xLockBytes; - ULONG nFilledSize; - BOOL bTerminated; - BOOL bSync; -public: - TYPEINFO(); - - SvFillLockBytes( SvLockBytes* pLockBytes ); - virtual ErrCode ReadAt( - ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pRead ) const; - virtual ErrCode WriteAt( - ULONG nPos, const void* pBuffer, ULONG nCount, ULONG* pWritten ); - virtual ErrCode Flush() const; - virtual ErrCode SetSize( ULONG nSize ); - virtual ErrCode LockRegion( ULONG nPos, ULONG nCount, LockType ); - virtual ErrCode UnlockRegion( ULONG nPos, ULONG nCount, LockType ); - virtual ErrCode Stat( SvLockBytesStat*, SvLockBytesStatFlag ) const; - ErrCode FillAppend( const void* pBuffer, ULONG nCount, ULONG *pWritten ); - ULONG Tell() const { return nFilledSize; } - void Seek( ULONG nPos ) { nFilledSize = nPos; } - - void Terminate(); -}; - -SV_DECL_IMPL_REF( SvFillLockBytes ) - -//============================================================================ -class SvSyncLockBytes: public SvOpenLockBytes -{ - SvAsyncLockBytesRef m_xAsyncLockBytes; - -public: - TYPEINFO(); - - /// Create a synchronous wrapper around existing asynchronous lock bytes. - /// - /// @param pTheAsyncLockBytes Must not be null. - inline SvSyncLockBytes(SvAsyncLockBytes * pTheAsyncLockBytes); - - /// Create a synchronous wrapper around an existing stream. - /// - /// @descr This is like first creating asynchronous lock bytes around the - /// stream and than creating a synchronous wrapper around the asynchronous - /// lock bytes. - /// - /// @param pStream Must not be null. - /// - /// @param bOwner True if these lock bytes own the stream (delete it on - /// destruction). - SvSyncLockBytes(SvStream * pStream, BOOL bOwner): - m_xAsyncLockBytes(new SvAsyncLockBytes(pStream, bOwner)) {} - - virtual const SvStream * GetStream() const - { return m_xAsyncLockBytes->GetStream(); } - - virtual void SetSynchronMode(BOOL bSync = TRUE) - { m_xAsyncLockBytes->SetSynchronMode(bSync); } - - virtual BOOL IsSynchronMode() const - { return m_xAsyncLockBytes->IsSynchronMode(); } - - virtual ErrCode ReadAt(ULONG nPos, void * pBuffer, ULONG nCount, - ULONG * pRead) const; - - virtual ErrCode WriteAt(ULONG nPos, const void * pBuffer, ULONG nCount, - ULONG * pWritten); - - virtual ErrCode Flush() const { return m_xAsyncLockBytes->Flush(); } - - virtual ErrCode SetSize(ULONG nSize) - { return m_xAsyncLockBytes->SetSize(nSize); } - - virtual ErrCode LockRegion(ULONG nPos, ULONG nCount, LockType eType) - { return m_xAsyncLockBytes->LockRegion(nPos, nCount, eType); } - - virtual ErrCode UnlockRegion(ULONG nPos, ULONG nCount, LockType eType) - { return m_xAsyncLockBytes->UnlockRegion(nPos, nCount, eType); } - - virtual ErrCode Stat(SvLockBytesStat * pStat, SvLockBytesStatFlag eFlag) - const - { return m_xAsyncLockBytes->Stat(pStat, eFlag); } - - virtual ErrCode FillAppend(const void * pBuffer, ULONG nCount, - ULONG * pWritten) - { return m_xAsyncLockBytes->FillAppend(pBuffer, nCount, pWritten); } - - virtual ULONG Tell() const { return m_xAsyncLockBytes->Tell(); } - - virtual ULONG Seek(ULONG nPos) - { return m_xAsyncLockBytes->Seek(nPos); } - - virtual void Terminate() { m_xAsyncLockBytes->Terminate(); } -}; - -inline SvSyncLockBytes::SvSyncLockBytes(SvAsyncLockBytes * - pTheAsyncLockBytes): - m_xAsyncLockBytes(pTheAsyncLockBytes) -{ - DBG_ASSERT(m_xAsyncLockBytes.Is(), - "SvSyncLockBytes::SvSyncLockBytes(): Null"); -} - -SV_DECL_IMPL_REF(SvSyncLockBytes); - -//============================================================================ -struct SvCompositeLockBytes_Impl; -class SvCompositeLockBytes : public SvLockBytes -{ - SvCompositeLockBytes_Impl* pImpl; -public: - TYPEINFO(); - - SvCompositeLockBytes( ); - ~SvCompositeLockBytes(); - - void Append( SvLockBytes* pLockBytes, ULONG nPos, ULONG nOffset ); - ULONG RelativeOffset( ULONG nPos ) const; - void SetIsPending( BOOL bSet ); - SvLockBytes* GetLastLockBytes() const; - - virtual ErrCode ReadAt( - ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pRead ) const; - virtual ErrCode WriteAt( - ULONG nPos, const void* pBuffer, ULONG nCount, ULONG* pWritten ); - virtual ErrCode Flush() const; - virtual ErrCode SetSize( ULONG nSize ); - virtual ErrCode LockRegion( ULONG nPos, ULONG nCount, LockType ); - virtual ErrCode UnlockRegion( ULONG nPos, ULONG nCount, LockType ); - virtual ErrCode Stat( SvLockBytesStat*, SvLockBytesStatFlag ) const; -}; - -SV_DECL_IMPL_REF( SvCompositeLockBytes ) - - -#endif diff --git a/svtools/inc/fontsubstconfig.hxx b/svtools/inc/fontsubstconfig.hxx index 7bcb20e509fe..7ce7e64362b5 100644 --- a/svtools/inc/fontsubstconfig.hxx +++ b/svtools/inc/fontsubstconfig.hxx @@ -53,6 +53,7 @@ public: virtual ~SvtFontSubstConfig(); virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& _rPropertyNames); sal_Bool IsEnabled() const {return bIsEnabled;} void Enable(sal_Bool bSet) {bIsEnabled = bSet; SetModified();} diff --git a/svtools/inc/imgdef.hxx b/svtools/inc/imgdef.hxx index e5b682d91bfe..2881fe5150bc 100644 --- a/svtools/inc/imgdef.hxx +++ b/svtools/inc/imgdef.hxx @@ -38,17 +38,6 @@ enum SfxSymbolsSize SFX_SYMBOLS_SIZE_AUTO }; -enum SfxSymbolsStyle -{ - SFX_SYMBOLS_STYLE_AUTO, - SFX_SYMBOLS_STYLE_DEFAULT, - SFX_SYMBOLS_STYLE_HICONTRAST, - SFX_SYMBOLS_STYLE_INDUSTRIAL, - SFX_SYMBOLS_STYLE_CRYSTAL, - SFX_SYMBOLS_STYLE_TANGO, - SFX_SYMBOLS_STYLE_CLASSIC -}; - #define SFX_TOOLBOX_CHANGESYMBOLSET 0x0001 #define SFX_TOOLBOX_CHANGEOUTSTYLE 0x0002 #define SFX_TOOLBOX_CHANGEBUTTONTYPE 0x0004 diff --git a/svtools/inc/inidef.hxx b/svtools/inc/inidef.hxx deleted file mode 100644 index c7744d8be2d0..000000000000 --- a/svtools/inc/inidef.hxx +++ /dev/null @@ -1,146 +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: inidef.hxx,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. - * - ************************************************************************/ - -#ifndef _SFXINIDEF_HXX -#define _SFXINIDEF_HXX - -#ifndef _INIMGR_HXX -#include <iniman.hxx> -#endif - -class SfxIniEntry; -class SfxIniDefaulterList; -class SfxIniDefaultManager; - -#if _SOLAR__PRIVATE -#include <svtools/svarray.hxx> - -class SfxIniDefaulter; -SV_DECL_PTRARR( SfxIniDefaulterList, SfxIniDefaulter*, 0, 2 ); -#endif - -//======================================================================== - -class SfxIniDefaulter - -/* [Beschreibung] - - Instanzen dieser Klasse k"onnen (f"ur die Laufzeit eines Moduls, z.B. - einer DLL-Nutzung oder einer Applikation) angelegt werden, um Defaults - f"ur eine Anzahl von ini-Eintr"agen zu liefern. Diese Defaults werden - erfragt, wenn ein <SfxIniManager> einen Eintrag nicht in den ini-Files - finden kann. - - Defaults verschiedener <SfxIniDefaulter>-Instanzen d"urfen sich nicht - unterscheiden, da die Reihenfolge der Abarbeitung nicht definiert ist. - - Die Instanzen brauchen nicht zerst"ort zu werden, au\ser wenn der - dazugeh"orige Code entladen wird (load-on-demand DLLs). Sonst geschieht - dies automatisch beim Zerst"oren des <SfxIniDefaultManager>. -*/ - -{ - SfxIniDefaultManager* _pManager; - -public: - SfxIniDefaulter( SfxIniDefaultManager *pManager ); - ~SfxIniDefaulter(); - - virtual BOOL QueryDefault( String &aValue, - const SfxIniEntry &rEntry ) = 0; -}; - -//======================================================================== - -class SfxIniDefaultManager - -/* [Beschreibung] - - Genau eine Instanz dieser Klasse mu\s in jeder Application-Subklasse, - die diesen Mechanismus nutzen m"ochte, in deren Ctor angelegt werden - und sollte in deren Dtor zerst"ort werden. -*/ - -{ - SfxIniDefaulterList* _pList; - -public: - SfxIniDefaultManager(); - ~SfxIniDefaultManager(); - -#if _SOLAR__PRIVATE - void Insert( SfxIniDefaulter *pDefaulter ) - { _pList->C40_INSERT( SfxIniDefaulter, pDefaulter, _pList->Count() ); } - void Remove( SfxIniDefaulter *pDefaulter ) - { _pList->Remove( _pList->C40_GETPOS( SfxIniDefaulter, pDefaulter ) ); } - BOOL QueryDefault( String &aValue, - const SfxIniEntry &rEntry ); -#endif -}; - -//======================================================================== - -class SfxIniEntry - -/* [Beschreibung] - - Instanzen dieser Klasse beschreiben einen Eintrag eines Ini-Files, - um mit der Klasse <SfxIniDefaulter> erfragt werden zu k"onnen, falls - der <SfxIniManager> einen Eintrag nicht in den Ini-Files auffindet. -*/ - -{ -friend class SfxIniManager; - - const String& _aGroup; - const String& _aKey; - SfxIniGroup _eGroup; - SfxIniKey _eKey; - USHORT _nIndex; - -private: - SfxIniEntry( const String& aGroup, - const String& aKey, - SfxIniGroup eGroup, - SfxIniKey eKey, - USHORT nIndex ); - SfxIniEntry( const SfxIniEntry & ); // n.i. - SfxIniEntry& operator=( const SfxIniEntry & ); // n.i. - -public: - const String& GetGroupName() const { return _aGroup; } - SfxIniGroup GetGroup() const { return _eGroup; } - const String& GetKeyName() const { return _aKey; } - SfxIniKey GetKey() const { return _eKey; } - USHORT GetIndex() const { return _nIndex; } -}; - -#endif - diff --git a/svtools/inc/iniprop.hxx b/svtools/inc/iniprop.hxx deleted file mode 100644 index 8ba56baa287b..000000000000 --- a/svtools/inc/iniprop.hxx +++ /dev/null @@ -1,64 +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: iniprop.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 _SFXINIPROP_HXX -#define _SFXINIPROP_HXX - -#include <limits.h> -#include <tools/rtti.hxx> -#ifndef _APP_HXX -#include <vcl/svapp.hxx> -#endif - -class SfxIniManager; - -//------------------------------------------------------------------------ - -class SfxAppIniManagerProperty: public ApplicationProperty - -// fuer Application::Property(), um von ueberall an den AppIniManger zu kommen - -{ - SfxIniManager* _pIniManager; - -public: - TYPEINFO(); - SfxAppIniManagerProperty() - : _pIniManager(0) - {} - ~SfxAppIniManagerProperty(); - - SfxIniManager* GetIniManager() const { return _pIniManager; } - void SetIniManager( SfxIniManager *pIniManager ) - { _pIniManager = pIniManager; } -}; - - -#endif - diff --git a/svtools/inc/privsplt.hxx b/svtools/inc/privsplt.hxx deleted file mode 100644 index 50a500de8848..000000000000 --- a/svtools/inc/privsplt.hxx +++ /dev/null @@ -1,86 +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: privsplt.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 _SV_PRIVSPLT_HXX -#define _SV_PRIVSPLT_HXX - -#include <vcl/fixed.hxx> - -enum PRIVSPLIT_DIRECTION {PRIVSPLIT_HORZ,PRIVSPLIT_VERT }; - -class SvPrivatSplit : public FixedLine -{ - private: - - Link aCtrModifiedLink; - BOOL aMovingFlag; - Pointer aWinPointer; - PRIVSPLIT_DIRECTION eAdrSplit; - short nOldX; - short nOldY; - short nNewX; - short nNewY; - short nMinPos; - short nMaxPos; - Range aXMovingRange; - Range aYMovingRange; - short nDeltaX; - short nDeltaY; - void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); - - protected: - virtual void MouseButtonDown( const MouseEvent& rMEvt ); - virtual void Tracking( const TrackingEvent& rTEvt ); - - public: - - SvPrivatSplit( Window* pWindow, const ResId& rResId,PRIVSPLIT_DIRECTION eAdrSplit); - - SvPrivatSplit( Window* pParent,PRIVSPLIT_DIRECTION eAdrSplit, WinBits nStyle = 0); - - virtual short GetDeltaX(); - virtual short GetDeltaY(); - - virtual void CtrModified(); - - void SetXRange(Range cRgeX); - void SetYRange(Range cRgeY); - - void MoveSplitTo(Point aPos); - - virtual void StateChanged( StateChangedType nType ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - - void SetCtrModifiedHdl( const Link& rLink ) { aCtrModifiedLink = rLink; } - const Link& GetCtrModifiedHdl() const { return aCtrModifiedLink; } -}; - - -#endif diff --git a/svtools/inc/reginfo.hxx b/svtools/inc/reginfo.hxx deleted file mode 100644 index bb3596797c6e..000000000000 --- a/svtools/inc/reginfo.hxx +++ /dev/null @@ -1,65 +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: reginfo.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 _REGINFO_HXX -#define _REGINFO_HXX - -struct RegInfo_Impl; - -#include <tools/string.hxx> - -class RegInfo -{ - - public: - - RegInfo(); - ~RegInfo(); - - const String& GetGroup() const { return aCurrentGroup; } - void SetAppGroup( const String& rGroup ); - void DeleteAppGroup( const String& rGroup ); - - String ReadKey( const String& rKey ) const; - String ReadKey( const String& rKey, const String& rDefault ) const; - void WriteKey( const String& rKey, const String& rValue ); - void DeleteKey( const String& rKey ); - String GetKeyName( USHORT nKey ) const; - String ReadKey( USHORT nKey ) const; - USHORT GetKeyCount() const; - - private: - - String aCurrentGroup; - RegInfo_Impl* pImp; - -}; - - -#endif diff --git a/svtools/inc/reqitem.hxx b/svtools/inc/reqitem.hxx deleted file mode 100644 index 32fdf4f066dc..000000000000 --- a/svtools/inc/reqitem.hxx +++ /dev/null @@ -1,68 +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: reqitem.hxx,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. - * - ************************************************************************/ -#ifndef _REQITEM_HXX -#define _REQITEM_HXX - -#include <solar.h> -#include <rtti.hxx> - -#if _SOLAR__PRIVATE -#include <svtools/poolitem.hxx> -#else -#include <sfxipool.hxx> -#endif - -// ----------------------------------------------------------------------- - -class SfxRequestItem: public SfxSetItem - -/** [Description] - - Represents a function call with optional arguments. -*/ - -{ -public: - TYPEINFO(); - SfxRequestItem(); - SfxRequestItem( USHORT nWhich, SvStream & ); - SfxRequestItem( const SfxRequestItem& ); - ~SfxRequestItem(); - - virtual int operator==( const SfxPoolItem& ) const; - virtual - virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; - virtual SfxPoolItem* Create(SvStream &, USHORT nItemVersion) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion ) const; -}; - - -#endif - diff --git a/svtools/inc/roadmap.hxx b/svtools/inc/roadmap.hxx index 8a6f75eb1428..14ed6abceed6 100644 --- a/svtools/inc/roadmap.hxx +++ b/svtools/inc/roadmap.hxx @@ -54,64 +54,8 @@ namespace svt typedef sal_Int32 ItemIndex; }; - class RoadmapImpl; - - - class ORoadmapIDHyperLabel : public FixedText - { - public: - ORoadmapIDHyperLabel( Window* _pParent, const ResId& _rId ); - ORoadmapIDHyperLabel( Window* _pParent, WinBits _nWinStyle = 0 ); - ~ORoadmapIDHyperLabel( ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - }; - - class ORoadmapHyperLabel : public RoadmapTypes - { - private: - ORoadmapIDHyperLabel* mpIDLabel; - HyperLabel* mpDescHyperLabel; - - - public: - - ORoadmapHyperLabel( Window* _pParent, const ResId& _rId ); - ORoadmapHyperLabel( Window* _pParent, WinBits _nWinStyle = 0 ); - ~ORoadmapHyperLabel( ); - - void SetID( sal_Int16 _ID ); - sal_Int16 GetID() const; - - void SetIndex( sal_Int32 _Index ); - sal_Int32 GetIndex() const; - - void SetLabel( ::rtl::OUString _rText ); - ::rtl::OUString GetLabel( ); - - void SetLabelAndSize( ItemIndex _RMIndex, ::rtl::OUString _rText, const Size& rNewSize); - - void SetPosition( ORoadmapHyperLabel* OldHyperLabel ); - Point GetLogicalPosition(); - - void ToggleBackgroundColor( const Color& _rGBColor ); - void SetInteractive( sal_Bool _bInteractive ); - - void SetClickHdl( const Link& rLink ); - const Link& GetClickHdl() const; - void SetZOrder( ORoadmapHyperLabel* pRefRoadmapHyperLabel, USHORT nFlags ); - void Enable( BOOL bEnable = TRUE); - BOOL IsEnabled() const; - void GrabFocus(); - - void SetIDLabel(ORoadmapIDHyperLabel* _pIDLabel){mpIDLabel = _pIDLabel;}; - ORoadmapIDHyperLabel* GetIDLabel() const { return mpIDLabel;}; - - HyperLabel* GetDescriptionHyperLabel() const { return mpDescHyperLabel;}; - void SetDescriptionHyperLabel(HyperLabel* _pDescriptionHyperLabel){mpDescHyperLabel = _pDescriptionHyperLabel;}; - }; - - + class RoadmapItem; //===================================================================== //= Roadmap @@ -135,7 +79,7 @@ namespace svt void EnableRoadmapItem( ItemId _nItemId, sal_Bool _bEnable, ItemIndex _nStartIndex = 0 ); sal_Bool IsRoadmapItemEnabled( ItemId _nItemId, ItemIndex _nStartIndex = 0 ) const; - void ChangeRoadmapItemLabel( ItemId _nID, ::rtl::OUString sLabel, ItemIndex _nStartIndex = 0 ); + void ChangeRoadmapItemLabel( ItemId _nID, const ::rtl::OUString& sLabel, ItemIndex _nStartIndex = 0 ); ::rtl::OUString GetRoadmapItemLabel( ItemId _nID, ItemIndex _nStartIndex = 0 ); void ChangeRoadmapItemID( ItemId _nID, ItemId _NewID, ItemIndex _nStartIndex = 0 ); @@ -149,8 +93,8 @@ namespace svt ItemId GetItemID( ItemIndex _nIndex ) const; ItemIndex GetItemIndex( ItemId _nID ) const; - void InsertRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled = sal_True ); - void ReplaceRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled ); + void InsertRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled = sal_True ); + void ReplaceRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled ); void DeleteRoadmapItem( ItemIndex _nIndex ); ItemId GetCurrentRoadmapItemID() const; @@ -172,22 +116,20 @@ namespace svt private: DECL_LINK(ImplClickHdl, HyperLabel*); - ORoadmapHyperLabel* GetByIndex( ItemIndex _nItemIndex ); - const ORoadmapHyperLabel* GetByIndex( ItemIndex _nItemIndex ) const; + RoadmapItem* GetByIndex( ItemIndex _nItemIndex ); + const RoadmapItem* GetByIndex( ItemIndex _nItemIndex ) const; - ORoadmapHyperLabel* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 ); - const ORoadmapHyperLabel* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 ) const; - ORoadmapHyperLabel* GetPreviousHyperLabel( ItemIndex _Index); + RoadmapItem* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 ); + const RoadmapItem* GetByID( ItemId _nID, ItemIndex _nStartIndex = 0 ) const; + RoadmapItem* GetPreviousHyperLabel( ItemIndex _Index); void DrawHeadline(); void DeselectOldRoadmapItems(); ItemId GetNextAvailableItemId( ItemIndex _NewIndex ); ItemId GetPreviousAvailableItemId( ItemIndex _NewIndex ); - ORoadmapHyperLabel* GetByPointer(Window* pWindow); - void InitializeHyperLabelSize(); - ORoadmapHyperLabel* InsertHyperLabel( ItemIndex _Index, ::rtl::OUString _aStr, ItemId _RMID, sal_Bool _bEnabled = sal_True ); - void UpdatefollowingHyperLabels( ItemIndex _Index, sal_Int16 _nadd = 1); - void SetRoadmapLabel(ORoadmapHyperLabel* CurHyperLabel, sal_Int32 _nPrefix, String _sDescription); + RoadmapItem* GetByPointer(Window* pWindow); + RoadmapItem* InsertHyperLabel( ItemIndex _Index, const ::rtl::OUString& _aStr, ItemId _RMID, sal_Bool _bEnabled = sal_True ); + void UpdatefollowingHyperLabels( ItemIndex _Index ); }; //......................................................................... diff --git a/svtools/source/svrtf/rtfkeywd.hxx b/svtools/inc/rtfkeywd.hxx index f76399ffd824..f76399ffd824 100644 --- a/svtools/source/svrtf/rtfkeywd.hxx +++ b/svtools/inc/rtfkeywd.hxx diff --git a/svtools/source/svrtf/rtfout.hxx b/svtools/inc/rtfout.hxx index ba20add1d968..ba20add1d968 100644 --- a/svtools/source/svrtf/rtfout.hxx +++ b/svtools/inc/rtfout.hxx diff --git a/svtools/source/svrtf/rtftoken.h b/svtools/inc/rtftoken.h index c7981361ffc9..c7981361ffc9 100644 --- a/svtools/source/svrtf/rtftoken.h +++ b/svtools/inc/rtftoken.h diff --git a/svtools/inc/sectctr.hxx b/svtools/inc/sectctr.hxx deleted file mode 100644 index da73e7aed4a7..000000000000 --- a/svtools/inc/sectctr.hxx +++ /dev/null @@ -1,154 +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: sectctr.hxx,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 _SV_SECTCTR_HXX -#define _SV_SECTCTR_HXX - -#include <vcl/sv.h> -#include <vcl/ctrl.hxx> - -class ImplSplitWindow; -class ScrollBar; -class ScrollBarBox; -class SvSection; - -#define SECTION_APPEND ((USHORT)0xFFFF) -#define SECTION_NOTFOUND ((USHORT)0xFFFF) - -#define WB_SECTION_STYLE WB_VSCROLL | WB_HSCROLL | WB_TABSTOP - -class SvSectionControl : public Control -{ -private: - - Window aSplitWinContainer; - ImplSplitWindow* pSplitWin; - ScrollBar* pVScrollBar; - ScrollBar* pHScrollBar; - ScrollBarBox* pScrollBarBox; - DockingWindow* pDummy; - long nRealHeight; - long nMaxHeight; - long nMinWidth; - Wallpaper aWallpaper; - - DECL_LINK( ScrollHdl, ScrollBar* ); - DECL_LINK( EndScrollHdl, ScrollBar* ); - - -protected: - - virtual void Resize(); - virtual void Paint( const Rectangle& rRect ); - virtual void StateChanged( StateChangedType nStateChange ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - virtual void Command( const CommandEvent& rCEvt ); - virtual long PreNotify( NotifyEvent& rNEvt ); - virtual long Notify( NotifyEvent& rNEvt ); - virtual long KeyEventNotify( const KeyEvent& rKEvt ); - using Control::SetPosSizePixel; - virtual void SetPosSizePixel( long nX, long nY,long nWidth, long nHeight,USHORT nFlags); - - - - long CalcMaxHeight(); - long CalcRealHeight(); - long CalcSectionWidth(); - - void SetScrollBars(BOOL bVert,BOOL bHorz); - void ShowScrollBarBox(); - void UpdateScrollBars(); - - BOOL VScrollResize(Size &aSize); - BOOL HScrollResize(Size &aSize); - void SetChildPos(long nPos, BOOL bScrolling = TRUE); - -public: - SvSectionControl( Window* pParent,WinBits nStyle = WB_SECTION_STYLE); - SvSectionControl( Window* pParent, const ResId& rResId ); - ~SvSectionControl(); - - - void InsertSection( USHORT nSectionId,SvSection* pSection,long nSize,USHORT nPos); - void InsertSection( USHORT nSectionId,SvSection* pSection,USHORT nPos); - void RemoveSection( USHORT nSectionId ); - void Clear(); - - USHORT GetSectionCount() const; - USHORT GetSectionId( USHORT nPos ) const; - USHORT GetSectionPos( USHORT nSectionId ) const; - USHORT GetSectionId( const Point& rPos ) const; - - void SetSectionSize( USHORT nId, long nNewSize ); - long GetSectionSize( USHORT nId ) const; - - /* - void SetCurSectionId( USHORT nSectionId ); - USHORT GetCurSectionId() const; - - void SetFirstSectionId( USHORT nSectionId ); - USHORT GetFirstSectionId() const { return GetSectionId( mnFirstSectionPos ); } - - void MakeVisible( USHORT nSectionId ); - */ - - void SetSectionWidth( USHORT nSectionId, long nWidth); - long GetSectionWidth( USHORT nSectionId ) const; - - void SetSection( USHORT nSectionId, SvSection* pPage ); - SvSection* GetSection( USHORT nSectionId ) const; - - void SetSectionText( USHORT nSectionId, const XubString& rText ); - XubString GetSectionText( USHORT nSectionId ) const; - - void SetHelpText( USHORT nSectionId, const XubString& rText ); - const XubString& GetHelpText( USHORT nSectionId ) const; - - void SetHelpId( USHORT nSectionId, ULONG nHelpId ); - ULONG GetHelpId( USHORT nSectionId ) const; - - void SetHelpText( const XubString& rText ) - { Control::SetHelpText( rText ); } - const XubString& GetHelpText() const - { return Control::GetHelpText(); } - - void SetHelpId( ULONG nId ) - { Control::SetHelpId( nId ); } - ULONG GetHelpId() const - { return Control::GetHelpId(); } - - using Control::SetBackground; - void SetBackground( const Wallpaper& rBackground ){aWallpaper=rBackground; } - const Wallpaper& GetBackground() const { return aWallpaper; } - -}; - - -#endif diff --git a/svtools/inc/svipcdef.h b/svtools/inc/svipcdef.h deleted file mode 100644 index ec944f92d0f0..000000000000 --- a/svtools/inc/svipcdef.h +++ /dev/null @@ -1,71 +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: svipcdef.h,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 _SVIPCDEF_H -#define _SVIPCDEF_H - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined (WNT) || defined (WIN) -#define CDECL __cdecl -#elif defined CSET -#define CDECL _System -#else -#define CDECL -#endif - -#if defined WIN -#define _EXTLIBCALL_ _pascal -#else -#define _EXTLIBCALL_ CDECL -#endif - -typedef void (CDECL *IPCCallbackFunc)(void*); - -extern void _EXTLIBCALL_ IPCFreeMemory(void*); -extern short _EXTLIBCALL_ IPCGetStatus(void*); -extern short _EXTLIBCALL_ IPCInit(void); -extern void _EXTLIBCALL_ IPCDeInit(void); -extern void* _EXTLIBCALL_ IPCConnectServer(const char*, IPCCallbackFunc); -extern void _EXTLIBCALL_ IPCDisconnectServer(void *); -#ifdef WIN -extern long CDECL IPCCALLFUNCTION(void *,unsigned long,void *, - short,const char *, char, ...); -#else -extern long CDECL IPCCallFunction(void *,unsigned long,void *, - short,const char *, char, ...); -#endif -#ifdef __cplusplus -} -#endif - -#endif diff --git a/svtools/inc/svtools/accessibilityoptions.hxx b/svtools/inc/svtools/accessibilityoptions.hxx index 85b914354a3a..bde908fb1851 100644 --- a/svtools/inc/svtools/accessibilityoptions.hxx +++ b/svtools/inc/svtools/accessibilityoptions.hxx @@ -33,14 +33,14 @@ #include "svtools/svtdllapi.h" #include <unotools/configitem.hxx> #include <tools/string.hxx> -#include <svtools/brdcst.hxx> -#include <svtools/lstner.hxx> -#include <svtools/options.hxx> +#include <svl/brdcst.hxx> +#include <svl/lstner.hxx> +#include <unotools/options.hxx> class SvtAccessibilityOptions_Impl; class SVT_DLLPUBLIC SvtAccessibilityOptions: - public svt::detail::Options, public SfxBroadcaster, private SfxListener + public utl::detail::Options, private SfxListener { private: static SvtAccessibilityOptions_Impl* volatile sm_pSingleImplConfig; diff --git a/svtools/inc/svtools/accessiblefactory.hxx b/svtools/inc/svtools/accessiblefactory.hxx index f7cad847edda..f4d8a03ef872 100644 --- a/svtools/inc/svtools/accessiblefactory.hxx +++ b/svtools/inc/svtools/accessiblefactory.hxx @@ -40,6 +40,7 @@ #endif #include "AccessibleBrowseBoxObjType.hxx" #include "accessibletableprovider.hxx" +#include "accessibletable.hxx" namespace com { namespace sun { namespace star { namespace accessibility { @@ -89,6 +90,11 @@ namespace svt const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, IAccessibleTableProvider& _rBrowseBox ) const = 0; + virtual table::IAccessibleTableControl* + createAccessibleTableControl( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, + table::IAccessibleTable& _rTable + ) const = 0; virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > createAccessibleIconChoiceCtrl( diff --git a/svtools/inc/svtools/accessibletable.hxx b/svtools/inc/svtools/accessibletable.hxx new file mode 100755 index 000000000000..0e3f08bfc568 --- /dev/null +++ b/svtools/inc/svtools/accessibletable.hxx @@ -0,0 +1,185 @@ +/************************************************************************* + * + * 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: accessibletable.hxx,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 _SVTOOLS_ACCESSIBLETABLE_HXX +#define _SVTOOLS_ACCESSIBLETABLE_HXX + +#include <vcl/window.hxx> +#include <unotools/accessiblestatesethelper.hxx> +#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> + +// ============================================================================ + +namespace svt{ namespace table +{ + +typedef sal_Int32 RowPos; + +// ============================================================================ + +enum AccessibleTableType +{ + /** Child index of the column header bar (first row). */ + TCINDEX_COLUMNHEADERBAR = 0, + /** Child index of the row header bar ("handle column"). */ + TCINDEX_ROWHEADERBAR = 1, + /** Child index of the data table. */ + TCINDEX_TABLE = 2 +}; + +enum AccessibleTableControlObjType +{ + TCTYPE_GRIDCONTROL, /// The GridControl itself. + TCTYPE_TABLE, /// The data table. + TCTYPE_ROWHEADERBAR, /// The row header bar. + TCTYPE_COLUMNHEADERBAR, /// The horizontal column header bar. + TCTYPE_TABLECELL, /// A cell of the data table. + TCTYPE_ROWHEADERCELL, /// A cell of the row header bar. + TCTYPE_COLUMNHEADERCELL, /// A cell of the column header bar. +}; + +// ============================================================================ + +#define XACC ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + +/** This abstract class provides methods to implement an accessible table object. +*/ +class IAccessibleTable +{ +public: + /** @return The position of the current row. */ + virtual sal_Int32 GetCurrentRow() const = 0; + /** @return The position of the current column. */ + virtual sal_Int32 GetCurrentColumn() const = 0; + /** Creates and returns the accessible object of the whole GridControl. */ + virtual XACC CreateAccessible()= 0; + virtual XACC CreateAccessibleControl( sal_Int32 _nIndex )= 0; + virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const= 0; + virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow )= 0; + virtual sal_Bool HasColHeader() = 0; + virtual sal_Bool HasRowHeader() = 0; + + /** return the description of the specified object. + @param eObjType + The type to ask for + @param _nPosition + The position of a tablecell (index position), header bar colum/row cell + @return + The description of the specified object. + */ + virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const= 0; + + /** Fills the StateSet with all states (except DEFUNC and SHOWING, done by + the accessible object), depending on the specified object type. */ + virtual void FillAccessibleStateSet( + ::utl::AccessibleStateSetHelper& rStateSet, + AccessibleTableControlObjType eObjType ) const= 0; + + // Window + virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) = 0; + virtual void GrabFocus()= 0; + virtual XACC GetAccessible( BOOL bCreate = TRUE )= 0; + virtual Window* GetAccessibleParentWindow() const= 0; + virtual Window* GetWindowInstance()= 0; + virtual sal_Int32 GetAccessibleControlCount() const = 0; + virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint )= 0; + virtual long GetRowCount() const= 0; + virtual long GetColumnCount() const= 0; + virtual sal_Bool HasRowHeader() const= 0; + virtual sal_Int32 GetSelectedRowCount() const= 0; + virtual bool IsRowSelected( long _nRow ) const= 0; + virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint )= 0; + virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, BOOL _bOnScreen = TRUE ) = 0; + virtual Rectangle calcTableRect( BOOL _bOnScreen = TRUE ) = 0; + virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex)= 0; + virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint)= 0; + virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const= 0; + virtual ::rtl::OUString GetRowDescription( sal_Int32 _nRow ) const = 0; + virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const = 0; + virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const = 0; + virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const = 0; + virtual ::rtl::OUString GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0; + virtual std::vector<sal_Int32>& GetSelectedRows() = 0; +}; + +// ---------------------------------------------------------------------------- + +/** interface for an implementation of a table control's Accesible component +*/ +class IAccessibleTableControl +{ +public: + /** returns the XAccessible object itself + + The reference returned here can be used to control the life time of the + IAccessibleTableImplementation object. + + The returned reference is guaranteed to not be <NULL/>. + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getMyself() = 0; + + /** disposes the accessible implementation, so that it becomes defunc + */ + virtual void dispose() = 0; + + /** checks whether the accessible implementation, and its context, are still alive + @return <TRUE/>, if the object is not disposed or disposing. + */ + virtual sal_Bool isAlive() const = 0; + + /** returns the accessible object for the row or the column header bar + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getTableHeader( ::svt::table::AccessibleTableControlObjType _eObjType ) = 0; + + /** returns the accessible object for the table representation + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getTable() = 0; + + ///** Commits an event to all listeners. */ + virtual void commitEvent( + sal_Int16 nEventId, + const ::com::sun::star::uno::Any& rNewValue, + const ::com::sun::star::uno::Any& rOldValue + ) = 0; +}; + +// ---------------------------------------------------------------------------- + +// ============================================================================ +} // namespace table +} // namespace svt + +// ============================================================================ + +#endif // _SVTOOLS_ACCESSIBLETABLE_HXX + diff --git a/svtools/inc/svtools/addxmltostorageoptions.hxx b/svtools/inc/svtools/addxmltostorageoptions.hxx deleted file mode 100644 index 1704de8b1700..000000000000 --- a/svtools/inc/svtools/addxmltostorageoptions.hxx +++ /dev/null @@ -1,162 +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: addxmltostorageoptions.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_ADDXMLTOSTORAGEOPTIONS_HXX -#define INCLUDED_SVTOOLS_ADDXMLTOSTORAGEOPTIONS_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 SvtAddXMLToStorageOptions_Impl; - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short collect informations about security features - @descr - - - @implements - - @base - - - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SVL_DLLPUBLIC SvtAddXMLToStorageOptions: 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 - - *//*-*****************************************************************************************************/ - - SvtAddXMLToStorageOptions(); - virtual ~SvtAddXMLToStorageOptions(); - - //--------------------------------------------------------------------------------------------------------- - // interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short interface methods to get value of config key - @descr - - @seealso - - - @param - @return The values which represent current state of internal variable. - - @onerror No error should occurre! - *//*-*****************************************************************************************************/ - - sal_Bool IsWriter_Add_XML_to_Storage() const; - sal_Bool IsCalc_Add_XML_to_Storage() const; - sal_Bool IsImpress_Add_XML_to_Storage() const; - sal_Bool IsDraw_Add_XML_to_Storage() const; - - //------------------------------------------------------------------------------------------------------------- - // 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 SvtAddXMLToStorageOptions_Impl* m_pDataContainer; /// impl. data container as dynamic pointer for smaller memory requirements! - static sal_Int32 m_nRefCount; /// internal ref count mechanism - -}; // class SvtAddXMLToStorageOptions - -#endif diff --git a/svtools/inc/svtools/bintitem.hxx b/svtools/inc/svtools/bintitem.hxx deleted file mode 100644 index 83119d9f3b18..000000000000 --- a/svtools/inc/svtools/bintitem.hxx +++ /dev/null @@ -1,88 +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: bintitem.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 _BINTITEM_HXX -#define _BINTITEM_HXX - -#include <tools/solar.h> -#include <tools/rtti.hxx> -#include <tools/bigint.hxx> -#include <tools/debug.hxx> - -#include <svtools/poolitem.hxx> - -class SfxArguments; -class SvStream; - -DBG_NAMEEX(SfxBigIntItem) - -class SfxBigIntItem: public SfxPoolItem -{ - BigInt aVal; - -public: - TYPEINFO(); - SfxBigIntItem(); - SfxBigIntItem(USHORT nWhich, const BigInt& rValue); - SfxBigIntItem(USHORT nWhich, SvStream &); - SfxBigIntItem(const SfxBigIntItem&); - ~SfxBigIntItem() { DBG_DTOR(SfxBigIntItem, 0); } - - virtual SfxItemPresentation GetPresentation( - SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * = 0 ) const; - - virtual int operator==(const SfxPoolItem&) const; - using SfxPoolItem::Compare; - virtual int Compare(const SfxPoolItem &rWith) const; - virtual SfxPoolItem* Clone(SfxItemPool *pPool = 0) const; - virtual SfxPoolItem* Create(SvStream &, USHORT nVersion) const; - virtual SvStream& Store(SvStream &, USHORT nItemVersion) const; - - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; - - virtual SfxFieldUnit GetUnit() const; // FUNIT_NONE - - const BigInt& GetValue() const { return aVal; } - void SetValue(const BigInt& rNewVal) - { - DBG_ASSERT(GetRefCount() == 0, "SetValue() with pooled item"); - aVal = rNewVal; - } -}; - -#endif /* _BINTITEM_HXX */ - diff --git a/svtools/inc/svtools/colorcfg.hxx b/svtools/inc/svtools/colorcfg.hxx index 9a0d570e7cc0..dd3ba4018280 100644 --- a/svtools/inc/svtools/colorcfg.hxx +++ b/svtools/inc/svtools/colorcfg.hxx @@ -34,9 +34,9 @@ #include <rtl/ustring.hxx> #include <tools/color.hxx> #include <com/sun/star/uno/Sequence.h> -#include <svtools/brdcst.hxx> -#include <svtools/lstner.hxx> -#include <svtools/options.hxx> +#include <svl/brdcst.hxx> +#include <svl/lstner.hxx> +#include <unotools/options.hxx> //----------------------------------------------------------------------------- namespace svtools{ @@ -108,7 +108,7 @@ struct ColorConfigValue ---------------------------------------------------------------------------*/ class SVT_DLLPUBLIC ColorConfig: - public svt::detail::Options, public SfxBroadcaster, public SfxListener + public utl::detail::Options { friend class ColorConfig_Impl; private: @@ -117,12 +117,9 @@ public: ColorConfig(); virtual ~ColorConfig(); - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - // get the configured value - if bSmart is set the default color setting is provided // instead of the automatic color ColorConfigValue GetColorValue(ColorConfigEntry eEntry, sal_Bool bSmart = sal_True)const; - static Color GetDefaultColor(ColorConfigEntry eEntry); }; /* -----------------------------22.03.2002 15:31------------------------------ diff --git a/svtools/inc/svtools/cstitem.hxx b/svtools/inc/svtools/cstitem.hxx deleted file mode 100644 index 654ee9c15a75..000000000000 --- a/svtools/inc/svtools/cstitem.hxx +++ /dev/null @@ -1,94 +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: cstitem.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 _CSTITEM_HXX -#define _CSTITEM_HXX - -#include <tools/rtti.hxx> - -#include <svtools/poolitem.hxx> - -class SvStream; - -enum CrawlStatus -{ - CSTAT_NEVER_UPD = 0, /* noch nie ueberprueft */ - CSTAT_IN_UPD = 1, /* Ueberpruefung laeuft */ - CSTAT_UPD_NEWER = 2, /* wurde ueberprueft und ist neuer */ - CSTAT_UPD_NOT_NEWER = 3, /* wurde ueberprueft und ist nicht neuer */ - CSTAT_UPD_CANCEL = 4, /* Ueberpruefung vom Benutzer abgebrochen */ - CSTAT_ERR_GENERAL = 5, /* allgemeiner Fehler */ - CSTAT_ERR_NOTEXISTS = 6, /* Server existiert nicht */ - CSTAT_ERR_NOTREACHED = 7, /* Server nicht ereicht */ - CSTAT_UPD_IMMEDIATELY = 8, /* es wird gleich ueberprueftt */ - CSTAT_ERR_OFFLINE = 9 /* Ueberpruefung nicht m�glich, da Offline */ -}; - -DBG_NAMEEX(SfxCrawlStatusItem) - -// class SfxDateTimeRangeItem ------------------------------------------------- - -class SfxCrawlStatusItem : public SfxPoolItem -{ -private: - CrawlStatus eStatus; -public: - TYPEINFO(); - - SfxCrawlStatusItem( const SfxCrawlStatusItem& rCpy ); - SfxCrawlStatusItem( USHORT nWhich ); - SfxCrawlStatusItem( USHORT nWhich, CrawlStatus eStat ); - ~SfxCrawlStatusItem() { DBG_DTOR(SfxCrawlStatusItem, 0); } - - virtual int operator==( const SfxPoolItem& ) const; - using SfxPoolItem::Compare; - virtual int Compare( const SfxPoolItem &rWith ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; - virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; - virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; - - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * pIntlWrapper = 0 ) - const; - - CrawlStatus GetStatus() const { return eStatus; } - void SetStatus(CrawlStatus eNew) { eStatus = eNew; } - - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; -}; - -#endif - diff --git a/svtools/inc/svtools/dtritem.hxx b/svtools/inc/svtools/dtritem.hxx deleted file mode 100644 index 87666a306a43..000000000000 --- a/svtools/inc/svtools/dtritem.hxx +++ /dev/null @@ -1,93 +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: dtritem.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 _DTRITEM_HXX -#define _DTRITEM_HXX - -#include <tools/rtti.hxx> -#include <tools/datetime.hxx> - -#include <svtools/poolitem.hxx> - -class SvStream; - -DBG_NAMEEX(SfxDateTimeRangeItem) - -// class SfxDateTimeRangeItem ------------------------------------------------- - -class SfxDateTimeRangeItem : public SfxPoolItem -{ -private: - DateTime aStartDateTime; - DateTime aEndDateTime; - -public: - TYPEINFO(); - - SfxDateTimeRangeItem( const SfxDateTimeRangeItem& rCpy ); - SfxDateTimeRangeItem( USHORT nWhich ); - SfxDateTimeRangeItem( USHORT nWhich, const DateTime& rStartDT, - const DateTime& rEndDT ); - - ~SfxDateTimeRangeItem() - { DBG_DTOR(SfxDateTimeRangeItem, 0); } - - virtual int operator==( const SfxPoolItem& ) const; - using SfxPoolItem::Compare; - virtual int Compare( const SfxPoolItem &rWith ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; - virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; - virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, - SfxMapUnit ePresMetric, - XubString &rText, - const IntlWrapper * pIntlWrapper = 0 ) - const; - - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; - - const DateTime& GetStartDateTime() const { return aStartDateTime; } - const DateTime& GetEndDateTime() const { return aEndDateTime; } - - void SetStartDateTime( const DateTime& rDT ) - { DBG_ASSERT( GetRefCount() == 0, "SetDateTime() with pooled item" ); - aStartDateTime = rDT; } - - void SetEndDateTime( const DateTime& rDT ) - { DBG_ASSERT( GetRefCount() == 0, "SetDateTime() with pooled item" ); - aEndDateTime = rDT; } -}; - -#endif - diff --git a/svtools/inc/svtools/editbrowsebox.hxx b/svtools/inc/svtools/editbrowsebox.hxx index c72c7c54f877..60fcbc9efb1a 100644 --- a/svtools/inc/svtools/editbrowsebox.hxx +++ b/svtools/inc/svtools/editbrowsebox.hxx @@ -675,6 +675,7 @@ namespace svt private: virtual void PaintField(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const; + using Control::ImplInitSettings; SVT_DLLPRIVATE void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground ); SVT_DLLPRIVATE void DetermineFocus( const sal_uInt16 _nGetFocusFlags = 0); inline void HideAndDisable(CellControllerRef& rController); diff --git a/svtools/inc/svtools/embedhlp.hxx b/svtools/inc/svtools/embedhlp.hxx index f4cccd3115b8..68763a3fd487 100644 --- a/svtools/inc/svtools/embedhlp.hxx +++ b/svtools/inc/svtools/embedhlp.hxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: embedhlp.hxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -131,6 +128,13 @@ namespace svt BOOL is() const { return mxObj.is(); } BOOL IsChart() const; + + // #i104867# + // Provides a graphic version number for the fetchable Graphic during this object's lifetime. Internally, + // that number is incremented at each change of the Graphic. This mechanism is needed to identify if a + // remembered Graphic (e.g. primitives) has changed compared to the current one, but without actively + // fetching the Graphic what would be too expensive e.g. for charts + sal_uInt32 getGraphicVersion() const; void SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM );//#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this method }; } diff --git a/svtools/inc/svtools/fmtfield.hxx b/svtools/inc/svtools/fmtfield.hxx index e2fe243f8399..27e9376ea1c7 100644 --- a/svtools/inc/svtools/fmtfield.hxx +++ b/svtools/inc/svtools/fmtfield.hxx @@ -33,7 +33,7 @@ #include "svtools/svtdllapi.h" #include <vcl/spinfld.hxx> -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> //#define REGEXP_SUPPORT diff --git a/svtools/inc/svtools/frqitem.hxx b/svtools/inc/svtools/frqitem.hxx deleted file mode 100644 index 11b2d31a1123..000000000000 --- a/svtools/inc/svtools/frqitem.hxx +++ /dev/null @@ -1,178 +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: frqitem.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 _FRQITEM_HXX -#define _FRQITEM_HXX - -#include <tools/rtti.hxx> -#include <tools/time.hxx> -#include <tools/datetime.hxx> -#include <tools/string.hxx> - -#include <svtools/poolitem.hxx> - -class SvStream; - -DBG_NAMEEX(SfxFrequencyItem) - -// class SfxFrequencyItem ------------------------------------------------- - -/////////////////////////////////////////////////////////////////////////////// -/* -FRQ_DAILY - * jeden X'ten Tag - nInterval1 = 1 .. 999 - - * jeden Wochentag - nInterval1 = USHRT_MAX - -FRQ_WEEKLY - + wiederhole jede X'te Woche - nInterval1 = 1 .. 99 - - + an SU, MO, TU, WE, TH, FR, SA - nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY | WD_WEDNESDAY | - WD_THURSDAY | WD_FRIDAY | WD_SATURDAY - -FRQ_MONTHLY_DAILY - * jeden X'ten Tag von jedem X'ten Monat - nInterval1 = 1 .. 31 - nInterval2 = 1 .. 6 - -FRQ_MONTHLY_LOGIC - * jeden ersten, zweiten, dritten, vierten oder letzten Wochentag jeden X'ten Monats - nInterval1 = 0 .. 4 - nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY | WD_WEDNESDAY | - WD_THURSDAY | WD_FRIDAY | WD_SATURDAY - nInterval3 = 1 .. 6 - -=============================================================================== - -FRQ_TIME_AT - * Update um Uhrzeit - nTime1 = 00:00:00 - 24:00:00 - -FRQ_TIME_REPEAT - * Wiederhole alle X Stunden - nTInterval1 = 1 .. 8 - + zwischen Uhrzeit 1 und 2 - nTime1 = 00:00:00 - 24:00:00 - nTime2 = 00:00:00 - 24:00:00 - -*/ -/////////////////////////////////////////////////////////////////////////////// - -enum FrequencyMode -{ - FRQ_DAILY = 1, - FRQ_WEEKLY = 2, - FRQ_MONTHLY_DAILY = 3, - FRQ_MONTHLY_LOGIC = 4 -}; - -enum FrequencyTimeMode -{ - FRQ_TIME_AT = 1, - FRQ_TIME_REPEAT = 2, - FRQ_TIME_REPEAT_RANGE = 3 -}; - -#define WD_SUNDAY 0x0001 -#define WD_MONDAY 0x0002 -#define WD_TUESDAY 0x0004 -#define WD_WEDNESDAY 0x0008 -#define WD_THURSDAY 0x0010 -#define WD_FRIDAY 0x0020 -#define WD_SATURDAY 0x0040 - -class SfxFrequencyItem : public SfxPoolItem -{ -private: - FrequencyMode eFrqMode; - FrequencyTimeMode eFrqTimeMode; - - USHORT nDInterval1; - USHORT nDInterval2; - USHORT nDInterval3; - - USHORT nTInterval1; - Time aTime1; - Time aTime2; - - BOOL bMissingDate; - DateTime aMissingDate; - - Time _CalcTime( BOOL bForToday ) const; -public: - TYPEINFO(); - - SfxFrequencyItem( const SfxFrequencyItem& rCpy ); - SfxFrequencyItem( USHORT nWhich ); - SfxFrequencyItem( USHORT nWhich, FrequencyMode eMode, FrequencyTimeMode eTMode, - USHORT nDI1, USHORT nDI2, USHORT nDI3, USHORT nTI1, - const Time& rT1, const Time& rT2 ); - ~SfxFrequencyItem() { DBG_DTOR(SfxFrequencyItem, 0); } - - virtual int operator==( const SfxPoolItem& ) const; - using SfxPoolItem::Compare; - virtual int Compare( const SfxPoolItem &rWith ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; - virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; - virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; - virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, - SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, XubString &rText, - const IntlWrapper * = 0 ) const; - - DateTime CalcNextTick( const DateTime& rNow, BOOL bFirst = FALSE ); - - BOOL HasMissingDate() const { return bMissingDate; } - DateTime GetMissingDate() const { return aMissingDate; } - - FrequencyMode GetFrequencyMode() const { return eFrqMode; } - FrequencyTimeMode GetFrequencyTimeMode() const { return eFrqTimeMode; } - USHORT GetDInterval_1() const { return nDInterval1; } - USHORT GetDInterval_2() const { return nDInterval2; } - USHORT GetDInterval_3() const { return nDInterval3; } - USHORT GetTInterval_1() const { return nTInterval1; } - const Time& GetTime_1() const { return aTime1; } - const Time& GetTime_2() const { return aTime2; } - - void SetFrequencyMode(FrequencyMode eNew) { eFrqMode = eNew; } - void SetFrequencyTimeMode(FrequencyTimeMode eNew){ eFrqTimeMode = eNew; } - void SetDInterval_1(USHORT nNew) { nDInterval1 = nNew; } - void SetDInterval_2(USHORT nNew) { nDInterval2 = nNew; } - void SetDInterval_3(USHORT nNew) { nDInterval3 = nNew; } - void SetTInterval_1(USHORT nNew) { nTInterval1 = nNew; } - void SetTime_1(const Time& rNew) { aTime1 = rNew; } - void SetTime_2(const Time& rNew) { aTime2 = rNew; } -}; - -#endif - diff --git a/svtools/inc/svtools/helpid.hrc b/svtools/inc/svtools/helpid.hrc index efbb0d2628d9..937898f37af1 100644 --- a/svtools/inc/svtools/helpid.hrc +++ b/svtools/inc/svtools/helpid.hrc @@ -33,7 +33,7 @@ // include --------------------------------------------------------------- -#include <svtools/solar.hrc> +#include <svl/solar.hrc> // Help-Ids -------------------------------------------------------------- diff --git a/svtools/inc/svtools/helpopt.hxx b/svtools/inc/svtools/helpopt.hxx index 7c8c322ec916..7a9a06b8bc5f 100644 --- a/svtools/inc/svtools/helpopt.hxx +++ b/svtools/inc/svtools/helpopt.hxx @@ -37,13 +37,13 @@ #define INCLUDED_LIST #endif #include <tools/string.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> typedef std::list< sal_Int32 > IdList; class SvtHelpOptions_Impl; -class SVT_DLLPUBLIC SvtHelpOptions: public svt::detail::Options +class SVT_DLLPUBLIC SvtHelpOptions: public utl::detail::Options { SvtHelpOptions_Impl* pImp; diff --git a/svtools/inc/svtools/htmlout.hxx b/svtools/inc/svtools/htmlout.hxx index 1f0b91c3c353..13df12b64ea9 100644 --- a/svtools/inc/svtools/htmlout.hxx +++ b/svtools/inc/svtools/htmlout.hxx @@ -34,7 +34,7 @@ #include "svtools/svtdllapi.h" #include <tools/solar.h> #include <rtl/textenc.h> -#include <svtools/macitem.hxx> +#include <svl/macitem.hxx> class Color; class ImageMap; diff --git a/svtools/inc/svtools/hyperlabel.hxx b/svtools/inc/svtools/hyperlabel.hxx index c11568816158..939b1799c0de 100644 --- a/svtools/inc/svtools/hyperlabel.hxx +++ b/svtools/inc/svtools/hyperlabel.hxx @@ -75,26 +75,25 @@ namespace svt void SetIndex( sal_Int32 _Index ); sal_Int32 GetIndex() const; - void SetLabelAndSize( ::rtl::OUString _rText, const Size& rNewSize); - void SetLabel( ::rtl::OUString _rText ); + void SetLabel( const ::rtl::OUString& _rText ); sal_Int32 GetLogicWidth(); ::rtl::OUString GetLabel( ); - void SetHyperLabelPosition(sal_uInt16 XPos, sal_uInt16 YPos); - Point GetLogicalPosition(); - void ToggleBackgroundColor( const Color& _rGBColor ); void SetInteractive( sal_Bool _bInteractive ); void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; } const Link& GetClickHdl() const { return maClickHdl; } + Size CalcMinimumSize( long nMaxWidth = 0 ) const; + private: DECL_LINK(ImplClickHdl, HyperLabel*); - sal_Bool ImplCalcMinimumSize(const Size& _rCompSize ); + private: + using FixedText::CalcMinimumSize; }; } diff --git a/svtools/inc/svtools/imapobj.hxx b/svtools/inc/svtools/imapobj.hxx index 3671bf50878c..46b73ee95f2c 100644 --- a/svtools/inc/svtools/imapobj.hxx +++ b/svtools/inc/svtools/imapobj.hxx @@ -33,7 +33,7 @@ #include "svtools/svtdllapi.h" #include <tools/string.hxx> -#include <svtools/macitem.hxx> +#include <svl/macitem.hxx> class Point; class Rectangle; @@ -96,7 +96,7 @@ public: static rtl_TextEncoding nActualTextEncoding; - IMapObject() {}; + IMapObject(); IMapObject( const String& rURL, const String& rAltText, const String& rDesc, diff --git a/svtools/inc/svtools/insdlg.hxx b/svtools/inc/svtools/insdlg.hxx index 191c3db68397..9721d55761f0 100644 --- a/svtools/inc/svtools/insdlg.hxx +++ b/svtools/inc/svtools/insdlg.hxx @@ -38,7 +38,7 @@ #include <sot/formats.hxx> #ifndef _OWNCONT_HXX -#include <svtools/ownlist.hxx> +#include <svl/ownlist.hxx> #endif #include <svtools/transfer.hxx> diff --git a/svtools/inc/svtools/menuoptions.hxx b/svtools/inc/svtools/menuoptions.hxx index 1d93d9068e1c..2bc5588519c2 100644 --- a/svtools/inc/svtools/menuoptions.hxx +++ b/svtools/inc/svtools/menuoptions.hxx @@ -34,10 +34,10 @@ // includes //_________________________________________________________________________________________________________________ -#include "svtools/svldllapi.h" +#include "svtools/svtdllapi.h" #include <sal/types.h> #include <osl/mutex.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> //_________________________________________________________________________________________________________________ // forward declarations @@ -67,7 +67,7 @@ class SvtMenuOptions_Impl; @devstatus ready to use *//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtMenuOptions: public svt::detail::Options +class SVT_DLLPUBLIC SvtMenuOptions: public utl::detail::Options { //------------------------------------------------------------------------------------------------------------- // public methods @@ -98,8 +98,8 @@ class SVL_DLLPUBLIC SvtMenuOptions: public svt::detail::Options SvtMenuOptions(); virtual ~SvtMenuOptions(); - void AddListener( const Link& rLink ); - void RemoveListener( const Link& rLink ); + void AddListenerLink( const Link& rLink ); + void RemoveListenerLink( const Link& rLink ); //--------------------------------------------------------------------------------------------------------- // interface //--------------------------------------------------------------------------------------------------------- @@ -148,7 +148,7 @@ class SVL_DLLPUBLIC SvtMenuOptions: public svt::detail::Options @onerror - *//*-*****************************************************************************************************/ - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + SVT_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); //------------------------------------------------------------------------------------------------------------- // private member diff --git a/svtools/inc/svtools/miscopt.hxx b/svtools/inc/svtools/miscopt.hxx index 1b81bb8a5fc9..556dd7f0cc7e 100644 --- a/svtools/inc/svtools/miscopt.hxx +++ b/svtools/inc/svtools/miscopt.hxx @@ -39,7 +39,7 @@ #include <osl/mutex.hxx> #include <com/sun/star/uno/Sequence.h> #include <rtl/ustring.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> //_________________________________________________________________________________________________________________ // forward declarations @@ -71,7 +71,7 @@ class Link; @devstatus ready to use *//*-*************************************************************************************************************/ -class SVT_DLLPUBLIC SvtMiscOptions: public svt::detail::Options +class SVT_DLLPUBLIC SvtMiscOptions: public utl::detail::Options { //------------------------------------------------------------------------------------------------------------- // public methods @@ -102,8 +102,8 @@ class SVT_DLLPUBLIC SvtMiscOptions: public svt::detail::Options SvtMiscOptions(); virtual ~SvtMiscOptions(); - void AddListener( const Link& rLink ); - void RemoveListener( const Link& rLink ); + void AddListenerLink( const Link& rLink ); + void RemoveListenerLink( const Link& rLink ); //--------------------------------------------------------------------------------------------------------- // interface diff --git a/svtools/inc/svtools/optionsdrawinglayer.hxx b/svtools/inc/svtools/optionsdrawinglayer.hxx index 120cccfa4232..18ce9c65e897 100644 --- a/svtools/inc/svtools/optionsdrawinglayer.hxx +++ b/svtools/inc/svtools/optionsdrawinglayer.hxx @@ -35,7 +35,7 @@ // includes //_________________________________________________________________________________________________________________ -#include "svtools/svldllapi.h" +#include "svtools/svtdllapi.h" #include <sal/types.h> #include <osl/mutex.hxx> #include <rtl/ustring.hxx> @@ -68,7 +68,7 @@ class SvtOptionsDrawinglayer_Impl; @devstatus ready to use *//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtOptionsDrawinglayer +class SVT_DLLPUBLIC SvtOptionsDrawinglayer { //------------------------------------------------------------------------------------------------------------- // public methods @@ -217,7 +217,7 @@ class SVL_DLLPUBLIC SvtOptionsDrawinglayer @onerror - *//*-*****************************************************************************************************/ - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + SVT_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); //------------------------------------------------------------------------------------------------------------- // private member diff --git a/svtools/inc/svtools/parhtml.hxx b/svtools/inc/svtools/parhtml.hxx index f5de6aea358d..e1eb53c6e052 100644 --- a/svtools/inc/svtools/parhtml.hxx +++ b/svtools/inc/svtools/parhtml.hxx @@ -34,7 +34,7 @@ #include "svtools/svtdllapi.h" #include <tools/solar.h> #include <tools/string.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <svtools/svparser.hxx> diff --git a/svtools/inc/svtools/parrtf.hxx b/svtools/inc/svtools/parrtf.hxx index 94e81e798bdf..1882b127ae90 100644 --- a/svtools/inc/svtools/parrtf.hxx +++ b/svtools/inc/svtools/parrtf.hxx @@ -33,7 +33,7 @@ #include "svtools/svtdllapi.h" #include <svtools/svparser.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> struct RtfParserState_Impl { diff --git a/svtools/inc/svtools/printoptions.hxx b/svtools/inc/svtools/printoptions.hxx index b00c27f94130..15147b21b62e 100644 --- a/svtools/inc/svtools/printoptions.hxx +++ b/svtools/inc/svtools/printoptions.hxx @@ -35,7 +35,7 @@ #include <sal/types.h> #include <osl/mutex.hxx> #include <rtl/ustring.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> class SvtPrintOptions_Impl; @@ -45,7 +45,7 @@ class SvtPrintOptions_Impl; class PrinterOptions; -class SVT_DLLPUBLIC SvtBasePrintOptions: public svt::detail::Options +class SVT_DLLPUBLIC SvtBasePrintOptions: public utl::detail::Options { protected: diff --git a/svtools/inc/svtools/section.hxx b/svtools/inc/svtools/section.hxx deleted file mode 100644 index 48941d06b7ca..000000000000 --- a/svtools/inc/svtools/section.hxx +++ /dev/null @@ -1,104 +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: section.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 _SV_SECTION_HXX -#define _SV_SECTION_HXX - -#include <vcl/sv.h> -#include <vcl/ctrl.hxx> -#include <vcl/dockwin.hxx> -#include <vcl/tabpage.hxx> -#include <svtools/expander.hxx> -#include <svtools/privsplt.hxx> - -class SvSectionControl; - -class SvSection : public DockingWindow -{ -private: - SvSectionControl* pSectionControl; - USHORT nSectionID; - Window* pChildWin; - XubString aName; - long nHeight; - long nMinHeight; - long nMinWidth; - long nOldHeight; - - DECL_LINK( ToggleHdl, SvExpander* ); - DECL_LINK( SplitHdl, SvPrivatSplit* ); - - void ImplExpandSection(); - void ImplShrinkSection(); - -protected: - SvExpander aExpander; - Window aChildWinContainer; - SvPrivatSplit aPrivatSplit; - - virtual void Resize(); - virtual void Paint( const Rectangle& rRect ); - virtual long Notify( NotifyEvent& rNEvt ); - -public: - SvSection(const XubString& rName,SvSectionControl* pParent, - WinBits nStyle = 0); - SvSection(const XubString& rName,SvSectionControl* pParent, - Window* pChildWin, WinBits nStyle = 0); - - virtual void SetScrollPos(long nPos); - void SetChildPos(long nPos); - - void SetSectionControl(SvSectionControl* pParent); - const SvSectionControl* GetSectionControl()const ; - void SetSectionText( const XubString& ); - const XubString& GetSectionText() const {return aName;} - - void SetChildWin(Window* pChildWin); - Window* GetChildWin() const {return pChildWin;} - - void SetSectionID(USHORT nId) {nSectionID=nId;} - USHORT GetSectionID() const {return nSectionID;} - - void SetMaxHeight(long nHeight); - long GetMaxHeight(); - - void SetMinHeight(long nHeight); - long GetMinHeight(); - - void SetMinWidth(long nWidth); - long GetMinWidth(); - - void ExpandSection(); - void ShrinkSection(); - BOOL IsExpanded(); -}; - -#endif diff --git a/svtools/inc/svtools/svlbox.hxx b/svtools/inc/svtools/svlbox.hxx index 7371c2feee05..a7f385941fc6 100644 --- a/svtools/inc/svtools/svlbox.hxx +++ b/svtools/inc/svtools/svlbox.hxx @@ -52,7 +52,7 @@ #include <vcl/mnemonicengine.hxx> #include <tools/gen.hxx> #include <svtools/treelist.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <svtools/transfer.hxx> class Application; diff --git a/svtools/inc/svtools/svmedit.hxx b/svtools/inc/svtools/svmedit.hxx index b1e0d368c9ba..ccf77299965c 100644 --- a/svtools/inc/svtools/svmedit.hxx +++ b/svtools/inc/svtools/svmedit.hxx @@ -61,6 +61,7 @@ protected: void DataChanged( const DataChangedEvent& rDCEvt ); virtual long PreNotify( NotifyEvent& rNEvt ); long Notify( NotifyEvent& rNEvt ); + using Control::ImplInitSettings; void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); WinBits ImplInitStyle( WinBits nStyle ); diff --git a/svtools/inc/svtools/svtdata.hxx b/svtools/inc/svtools/svtdata.hxx index c929faad3d13..b1cc8136ef68 100644 --- a/svtools/inc/svtools/svtdata.hxx +++ b/svtools/inc/svtools/svtdata.hxx @@ -32,34 +32,22 @@ #define _SVTOOLS_SVTDATA_HXX #include <tools/resid.hxx> -#include <tools/simplerm.hxx> +#include <com/sun/star/lang/Locale.hpp> class ResMgr; class SfxItemDesruptorList_Impl; -class SfxItemPool; -class Twain; //============================================================================ class ImpSvtData { public: - Twain * pTwain; - const SfxItemPool * pStoringPool; SfxItemDesruptorList_Impl * pItemDesruptList; - ResMgr * pResMgr; ResMgr * pPatchResMgr; - void* m_pThreadsafeRMs; - // one SimpleResMgr for each language for which a resource was requested - // (When using the 'non-simple' resmgr, the first request for any language wins, any - // further request for any other language supply the resmgr of the first call. - // For the simple resmgr we have a mgr for each language ever requested). - private: ImpSvtData(): - pTwain(0), pStoringPool(0), pItemDesruptList(0), pResMgr(0), - pPatchResMgr(NULL), m_pThreadsafeRMs(NULL) + pItemDesruptList(0), pResMgr(0), pPatchResMgr(0) {} ~ImpSvtData(); @@ -67,13 +55,9 @@ private: public: ResMgr * GetResMgr(const ::com::sun::star::lang::Locale aLocale); ResMgr * GetResMgr(); // VCL dependant, only available in SVT, not in SVL! - ResMgr * GetPatchResMgr(); ResMgr * GetPatchResMgr(const ::com::sun::star::lang::Locale& aLocale); - - SimpleResMgr * GetSimpleRM(const ::com::sun::star::lang::Locale& rLocale); - static ImpSvtData & GetSvtData(); }; @@ -100,18 +84,5 @@ public: // VCL dependant, only available in SVT, not in SVL! }; -//============================================================================ -class SvtSimpleResId -{ - String m_sValue; - -public: - SvtSimpleResId(USHORT nId, const ::com::sun::star::lang::Locale aLocale) : m_sValue(ImpSvtData::GetSvtData().GetSimpleRM(aLocale)->ReadString(nId)) { }; - - operator String () const { return m_sValue; } -}; - - - #endif // _SVTOOLS_SVTDATA_HXX diff --git a/svtools/inc/svtools/syntaxhighlight.hxx b/svtools/inc/svtools/syntaxhighlight.hxx index e2b575c7e085..c9680821affc 100644 --- a/svtools/inc/svtools/syntaxhighlight.hxx +++ b/svtools/inc/svtools/syntaxhighlight.hxx @@ -40,7 +40,7 @@ #include <tools/stream.hxx> #include <tools/shl.hxx> -#include <svtools/brdcst.hxx> +#include <svl/brdcst.hxx> #include <svtools/svtdllapi.h> @@ -60,7 +60,7 @@ #include <tools/string.hxx> #include <tools/gen.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> // Token-Typen TT_... @@ -137,7 +137,7 @@ class SimpleTokenizer_Impl String getTokStr( /*out*/const sal_Unicode* pStartPos, /*out*/const sal_Unicode* pEndPos ); -#ifndef PRODUCT +#ifdef DBG_UTIL // TEST: Token ausgeben String getFullTokenStr( /*out*/TokenTypes eType, /*out*/const sal_Unicode* pStartPos, /*out*/const sal_Unicode* pEndPos ); diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx index 98fddcb7d9e1..e3edd0b681ae 100644 --- a/svtools/inc/svtools/table/tablecontrol.hxx +++ b/svtools/inc/svtools/table/tablecontrol.hxx @@ -30,6 +30,8 @@ #include <vcl/ctrl.hxx> #include <vcl/seleng.hxx> #include <svtools/table/tabledatawindow.hxx> +#include <svtools/accessibletable.hxx> +#include "svtaccessiblefactory.hxx" //........................................................................ namespace svt { namespace table @@ -38,6 +40,8 @@ namespace svt { namespace table class TableControl_Impl; class TableDataWindow; + class AccessibleTableControl_Impl; + //==================================================================== //= TableControl //==================================================================== @@ -55,10 +59,11 @@ namespace svt { namespace table The control supports the concept of a <em>current</em> (or <em>active</em> cell). + The control supports accessibility, this is encapsulated in IAccessibleTable // TODO: scrolling? */ - class TableControl : public Control + class TableControl : public Control, public IAccessibleTable { private: DECL_LINK( ImplMouseButtonDownHdl, MouseEvent* ); @@ -66,6 +71,8 @@ namespace svt { namespace table TableControl_Impl* m_pImpl; public: + ::std::auto_ptr< AccessibleTableControl_Impl > m_pAccessTable; + TableControl( Window* _pParent, WinBits _nStyle ); ~TableControl(); @@ -88,11 +95,11 @@ namespace svt { namespace table if there is no active cell, e.g. because the table does not contain any rows or columns. */ - RowPos GetCurrentRow() const; + sal_Int32 GetCurrentRow() const; /** returns the row, which contains the input point*/ - RowPos GetCurrentRow (const Point& rPoint); + ColPos GetCurrentRow (const Point& rPoint); /** retrieves the current column @@ -103,7 +110,7 @@ namespace svt { namespace table if there is no active cell, e.g. because the table does not contain any rows or columns. */ - ColPos GetCurrentColumn() const; + sal_Int32 GetCurrentColumn() const; /** activates the cell at the given position @@ -113,7 +120,7 @@ namespace svt { namespace table or impossibility to execute the move at all (for instance because of invalid coordinates). */ - bool GoTo( ColPos _nColumn, RowPos _nRow ); + bool GoTo( ColPos _nColumnPos, RowPos _nRow); /** moves the active cell to the given column, by keeping the active row @@ -147,26 +154,91 @@ namespace svt { namespace table void InvalidateDataWindow(RowPos _nRowStart, bool _bRemoved); /**gets the vector, which contains the selected rows */ - std::vector<RowPos> getSelectedRows(); + std::vector<sal_Int32>& GetSelectedRows(); /**after removing a row, updates the vector which contains the selected rows if the row, which should be removed, is selected, it will be erased from the vector */ void removeSelectedRow(RowPos _nRowPos); SelectionEngine* getSelEngine(); TableDataWindow* getDataWindow(); - // protected: + // Window overridables virtual void GetFocus(); virtual void LoseFocus(); virtual void KeyInput( const KeyEvent& rKEvt ); //virtual long Notify(NotifyEvent& rNEvt); + /** Creates and returns the accessible object of the whole BrowseBox. */ + virtual XACC CreateAccessible(); + virtual XACC CreateAccessibleControl( sal_Int32 _nIndex ); + virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const; + virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow ); + virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const; + virtual void FillAccessibleStateSet( + ::utl::AccessibleStateSetHelper& rStateSet, + AccessibleTableControlObjType eObjType ) const; + + //// Window + virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ); + virtual void GrabFocus(); + virtual XACC GetAccessible( BOOL bCreate = TRUE ); + virtual Window* GetAccessibleParentWindow() const; + virtual Window* GetWindowInstance(); + virtual sal_Int32 GetAccessibleControlCount() const; + virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ); + virtual long GetRowCount() const; + virtual long GetColumnCount() const; + virtual sal_Bool HasRowHeader() const; + virtual sal_Int32 GetSelectedRowCount() const; + virtual bool IsRowSelected( long _nRow ) const; + virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint ); + virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, BOOL _bOnScreen = TRUE ); + virtual Rectangle calcTableRect( BOOL _bOnScreen = TRUE ); + virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex); + virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint); + virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const; + virtual ::rtl::OUString GetRowDescription( sal_Int32 _nRow ) const; + virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const; + virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const; + virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const; + virtual ::rtl::OUString GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const; + virtual sal_Bool HasRowHeader(); + virtual sal_Bool HasColHeader(); + virtual sal_Bool isAccessibleAlive( ) const; + virtual void commitGridControlEvent( sal_Int16 _nEventId, const com::sun::star::uno::Any& _rNewValue, const com::sun::star::uno::Any& _rOldValue ); + + + protected: + /// retrieves the XAccessible implementation associated with the GridControl instance + ::svt::IAccessibleFactory& getAccessibleFactory(); + private: TableControl(); // never implemented TableControl( const TableControl& ); // never implemented TableControl& operator=( const TableControl& ); // never implemented }; + class AccessibleTableControl_Impl + { + public: + AccessibleFactoryAccess m_aFactoryAccess; + IAccessibleTableControl* m_pAccessible; + + public: + AccessibleTableControl_Impl() : m_pAccessible(NULL) + { + } + + + /// @see AccessibleTableControl::getTableRowHeader + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getAccessibleTableHeader( AccessibleTableControlObjType _eObjType ); + /// @see AccessibleTableControl::getTable + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getAccessibleTable( ); + + }; + //........................................................................ } } // namespace svt::table //........................................................................ diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx index a1af1e1750ed..6e74d35b8586 100644 --- a/svtools/inc/svtools/table/tablemodel.hxx +++ b/svtools/inc/svtools/table/tablemodel.hxx @@ -434,13 +434,13 @@ namespace svt { namespace table virtual void setCellContent(std::vector<std::vector<rtl::OUString> > cellContent)=0; /** gets the content of the cells */ - virtual std::vector<std::vector<rtl::OUString> > getCellContent() = 0; + virtual std::vector<std::vector<rtl::OUString> >& getCellContent() = 0; /**sets title of header rows */ virtual void setRowHeaderName(std::vector<rtl::OUString> cellColumnContent)=0; /** gets title of header rows */ - virtual std::vector<rtl::OUString> getRowHeaderName() = 0; + virtual std::vector<rtl::OUString>& getRowHeaderName() = 0; /// destroys the table model instance virtual ~ITableModel() { } diff --git a/svtools/inc/svtools/textdata.hxx b/svtools/inc/svtools/textdata.hxx index 5b44b1364492..bd119b63c095 100644 --- a/svtools/inc/svtools/textdata.hxx +++ b/svtools/inc/svtools/textdata.hxx @@ -32,8 +32,8 @@ #define _TEXTDATA_HXX #include "svtools/svtdllapi.h" -#include <svtools/brdcst.hxx> -#include <svtools/smplhint.hxx> +#include <svl/brdcst.hxx> +#include <svl/smplhint.hxx> #include <tools/string.hxx> #define TEXTUNDO_START 100 diff --git a/svtools/inc/svtools/texteng.hxx b/svtools/inc/svtools/texteng.hxx index c1d7746d73c6..e1d64aa42ecd 100644 --- a/svtools/inc/svtools/texteng.hxx +++ b/svtools/inc/svtools/texteng.hxx @@ -54,7 +54,7 @@ class Timer; class TextLine; class TETextPortion; -#include <svtools/brdcst.hxx> +#include <svl/brdcst.hxx> #include <tools/link.hxx> #include <vcl/font.hxx> #include <tools/string.hxx> diff --git a/svtools/inc/svtools/tfrmitem.hxx b/svtools/inc/svtools/tfrmitem.hxx deleted file mode 100644 index 93e245a731a2..000000000000 --- a/svtools/inc/svtools/tfrmitem.hxx +++ /dev/null @@ -1,90 +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: tfrmitem.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 _TFRMITEM_HXX -#define _TFRMITEM_HXX - -#include <tools/rtti.hxx> - -#include <svtools/poolitem.hxx> - -class SvStream; - -enum SfxOpenMode -{ - SfxOpenSelect = 0, // selected in view - SfxOpenOpen = 1, // doubleclicked or <enter> - SfxOpenAddTask = 2, // doubleclicked or <enter> with Ctrl-Modifier - SfxOpenDontKnow = 3, - SfxOpenReserved1 = 4, - SfxOpenReserved2 = 5, - SfxOpenModeLast = 5 -}; - -DBG_NAMEEX(SfxTargetFrameItem) - -// class SfxTargetFrameItem ------------------------------------------------- - -class SfxTargetFrameItem : public SfxPoolItem -{ -private: - String _aFrames[ (USHORT)SfxOpenModeLast+1 ]; -public: - TYPEINFO(); - - SfxTargetFrameItem( const SfxTargetFrameItem& rCpy ); - SfxTargetFrameItem( USHORT nWhich ); - SfxTargetFrameItem( - USHORT nWhich, - const String& rOpenSelectFrame, - const String& rOpenOpenFrame, - const String& rOpenAddTaskFrame ); - ~SfxTargetFrameItem(); - - virtual int operator==( const SfxPoolItem& ) const; - virtual SfxPoolItem* Create( SvStream&, USHORT nItemVersion ) const; - virtual SvStream& Store( SvStream&, USHORT nItemVersion ) const; - virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; - - virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ) const; - virtual BOOL PutValue ( const com::sun::star::uno::Any& rVal, - BYTE nMemberId = 0 ); - /* - Framebezeichner im Sfx: - _browser : Beamerview - _document : Desktopview - _blank : new task - "" : do nothing - */ - String GetTargetFrame( SfxOpenMode eMode ) const; -}; - -#endif - diff --git a/svtools/inc/svtools/tresitem.hxx b/svtools/inc/svtools/tresitem.hxx deleted file mode 100644 index 6282d3a7d4ff..000000000000 --- a/svtools/inc/svtools/tresitem.hxx +++ /dev/null @@ -1,65 +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: tresitem.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 SVTOOLS_TRESITEM_HXX -#define SVTOOLS_TRESITEM_HXX - -#include <com/sun/star/ucb/TransferResult.hpp> -#include <svtools/poolitem.hxx> - -//============================================================================ -class CntTransferResultItem: public SfxPoolItem -{ - com::sun::star::ucb::TransferResult m_aResult; - -public: - TYPEINFO(); - - CntTransferResultItem(USHORT which = 0): SfxPoolItem(which) {} - - CntTransferResultItem(USHORT which, - com::sun::star::ucb::TransferResult const & - rTheResult): - SfxPoolItem(which), m_aResult(rTheResult) {} - - virtual int operator ==(SfxPoolItem const & rItem) const; - - virtual BOOL QueryValue(com::sun::star::uno::Any & rVal, BYTE = 0) const; - - virtual BOOL PutValue(const com::sun::star::uno::Any & rVal, BYTE = 0); - - virtual SfxPoolItem * Clone(SfxItemPool * = 0) const; - - com::sun::star::ucb::TransferResult const & GetValue() const - { return m_aResult; } -}; - -#endif // SVTOOLS_TRESITEM_HXX - diff --git a/svtools/inc/svtools/valueset.hxx b/svtools/inc/svtools/valueset.hxx index 647851008c8f..fc12f9517b6d 100644 --- a/svtools/inc/svtools/valueset.hxx +++ b/svtools/inc/svtools/valueset.hxx @@ -285,6 +285,7 @@ private: #ifdef _SV_VALUESET_CXX friend class ValueSetAcc; friend class ValueItemAcc; + using Control::ImplInitSettings; using Window::ImplInit; SVT_DLLPRIVATE void ImplInit(); SVT_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); diff --git a/svtools/inc/svtuno.hxx b/svtools/inc/svtuno.hxx deleted file mode 100644 index 378251488707..000000000000 --- a/svtools/inc/svtuno.hxx +++ /dev/null @@ -1,63 +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: svtuno.hxx,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 _SVTOOLS_SVTUNO_HXX -#define _SVTOOLS_SVTUNO_HXX - -// Macro to define const unicode a'la "..." -// It's better then "OUString::createFromAscii(...)" !!! -#define DEFINE_CONST_UNICODE(CONSTASCII) UniString(RTL_CONSTASCII_USTRINGPARAM(CONSTASCII)) -#define DEFINE_CONST_OUSTRING(CONSTASCII) OUString(RTL_CONSTASCII_USTRINGPARAM(CONSTASCII)) - -// defines --------------------------------------------------------------- -#define UNOANY ::com::sun::star::uno::Any -#define UNOEXCEPTION ::com::sun::star::uno::Exception -#define UNOMUTEX ::osl::Mutex -#define UNOMUTEXGUARD ::osl::MutexGuard -#define UNOOIMPLEMENTATIONID ::cppu::OImplementationId -#define UNOOTYPECOLLECTION ::cppu::OTypeCollection -#define UNOOUSTRING ::rtl::OUString -#define UNOPROPERTYVALUE ::com::sun::star::beans::PropertyValue -#define UNOSTRINGPAIR ::com::sun::star::beans::StringPair -#define UNOREFERENCE ::com::sun::star::uno::Reference -#define UNORUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException -#define UNOINVALIDREGISTRYEXCEPTION ::com::sun::star::registry::InvalidRegistryException -#define UNOSEQUENCE ::com::sun::star::uno::Sequence -#define UNOTYPE ::com::sun::star::uno::Type -#define UNOURL ::com::sun::star::util::URL -#define UNOXINTERFACE ::com::sun::star::uno::XInterface -#define UNOXMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory -#define UNOXSINGLESERVICEFACTORY ::com::sun::star::lang::XSingleServiceFactory -#define UNOXTYPEPROVIDER ::com::sun::star::lang::XTypeProvider -#define UNOILLEGALARGUMENTEXCEPTION ::com::sun::star::lang::IllegalArgumentException - -// ----------------------------------------------------------------------- - -#endif diff --git a/svtools/inc/twain.hxx b/svtools/inc/twain.hxx deleted file mode 100644 index 786a8e65a624..000000000000 --- a/svtools/inc/twain.hxx +++ /dev/null @@ -1,99 +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: twain.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 _TWAIN_HXX -#define _TWAIN_HXX - -// please add new platforms if TWAIN is available -#if defined WIN || defined WNT || defined UNX -#define TWAIN_AVAILABLE 1 -#else -#undef TWAIN_AVAILABLE -#endif - -// include following only, if define is not set -#ifndef _TWAIN_HXX_CHECK - -#include <vcl/bitmap.hxx> - -// ----------- -// - Defines - -// ----------- - -#define TWAIN_ERR_NO_ERROR 0 -#define TWAIN_ERR_MODULE_NOT_LOADED 2 -#define TWAIN_ERR_DSMENTRY_NOT_FOUND 4 -#define TWAIN_ERR_SOURCE_MANAGER_NOT_OPENED 6 -#define TWAIN_ERR_SOURCE_SELECTION_DIALOG 8 - -// --------- -// - Twain - -// --------- - -struct TwainImp; -namespace com { namespace sun { namespace star { namespace lang { struct EventObject; } } } } - -class Twain -{ -friend class TwainEventListener; - -private: - - TwainImp* mpImp; - - Bitmap maBitmap; - Link maUpdateLink; - USHORT mnErrorCode; - BOOL mbScanning; - - Twain(); - Twain( const Twain& rTwain ); - const Twain& operator=( const Twain& rTwain ) { return *this; } - -protected: - - void Disposing( const com::sun::star::lang::EventObject& rEventObject ); - -public: - - Twain( const Link& rUpdateLink ); - ~Twain(); - - BOOL SelectSource(); - BOOL PerformTransfer(); - - Bitmap GetBitmap(); - - BOOL IsScanning() const { return mbScanning; } - USHORT GetErrorCode() const { return mnErrorCode; } -}; - -#endif // _TWAIN_HXX_CHECK -#endif // _TWAIN_HXX diff --git a/svtools/inc/whmap.hxx b/svtools/inc/whmap.hxx deleted file mode 100644 index 9677bdf328ce..000000000000 --- a/svtools/inc/whmap.hxx +++ /dev/null @@ -1,61 +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: whmap.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 _SFX_WHMAP_HXX -#define _SFX_WHMAP_HXX - -#include <solar.h> - -struct SfxWhichMapEntry -{ - USHORT nWhichId; - USHORT nSlotId; -}; - -class SfxWhichMap -{ - const SfxWhichMapEntry *pMap; - -public: - inline SfxWhichMap( const SfxWhichMapEntry *pMappings = 0 ); - virtual ~SfxWhichMap(); - - int IsNull() const - { return 0 == pMap; } - virtual USHORT GetWhich(USHORT nSlot) const; - virtual USHORT GetSlot(USHORT nWhich) const; - virtual SfxWhichMap*Clone() const; -}; - -inline SfxWhichMap::SfxWhichMap( const SfxWhichMapEntry *pMappings ): - pMap( pMappings ) -{ -} - -#endif diff --git a/svtools/inc/xmlcnimp.hxx b/svtools/inc/xmlcnimp.hxx deleted file mode 100644 index 8fb212fe70bd..000000000000 --- a/svtools/inc/xmlcnimp.hxx +++ /dev/null @@ -1,143 +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: xmlcnimp.hxx,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. - * - ************************************************************************/ - -#ifndef _SVTOOLS_XMLCNIMP_HXX -#define _SVTOOLS_XMLCNIMP_HXX - -#include <com/sun/star/container/XNameAccess.hpp> -#include <svtools/svarray.hxx> - -#ifndef _SVTOOLS_NMSPMAP_HXX -#include <xmloff/nmspmap.hxx> -#endif - -namespace rtl { class OUString; } - -typedef ::rtl::OUString *OUStringPtr; -SV_DECL_PTRARR_DEL( OUStringsDtor2_Impl, OUStringPtr, 5, 5 ) - -class SvXMLAttrContainerItem_Impl -{ - SvXMLNamespaceMap aNamespaceMap; - SvUShorts aPrefixPoss; - OUStringsDtor2_Impl aLNames; - OUStringsDtor2_Impl aValues; - - inline sal_uInt16 GetPrefixPos( sal_uInt16 i ) const; -public: - - SvXMLAttrContainerItem_Impl( const SvXMLAttrContainerItem_Impl& rImpl ); - SvXMLAttrContainerItem_Impl(); - - int operator ==( const SvXMLAttrContainerItem_Impl& rCmp ) const; - - BOOL AddAttr( const ::rtl::OUString& rLName, const ::rtl::OUString& rValue ); - BOOL AddAttr( const ::rtl::OUString& rPrefix, const ::rtl::OUString& rNamespace, - const ::rtl::OUString& rLName, const ::rtl::OUString& rValue ); - BOOL AddAttr( const ::rtl::OUString& rPrefix, - const ::rtl::OUString& rLName, - const ::rtl::OUString& rValue ); - - sal_uInt16 GetAttrCount() const { return aLNames.Count(); } - inline ::rtl::OUString GetAttrNamespace( sal_uInt16 i ) const; - inline ::rtl::OUString GetAttrPrefix( sal_uInt16 i ) const; - inline const ::rtl::OUString& GetAttrLName( sal_uInt16 i ) const; - inline const ::rtl::OUString& GetAttrValue( sal_uInt16 i ) const; - - sal_uInt16 GetFirstNamespaceIndex() const { return aNamespaceMap.GetFirstIndex(); } - sal_uInt16 GetNextNamespaceIndex( sal_uInt16 nIdx ) const { return aNamespaceMap.GetNextIndex( nIdx ); } - inline const ::rtl::OUString& GetNamespace( sal_uInt16 i ) const; - inline const ::rtl::OUString& GetPrefix( sal_uInt16 i ) const; - - BOOL SetAt( sal_uInt16 i, - const ::rtl::OUString& rLName, const ::rtl::OUString& rValue ); - BOOL SetAt( sal_uInt16 i, - const ::rtl::OUString& rPrefix, const ::rtl::OUString& rNamespace, - const ::rtl::OUString& rLName, const ::rtl::OUString& rValue ); - BOOL SetAt( sal_uInt16 i, - const ::rtl::OUString& rPrefix, - const ::rtl::OUString& rLName, - const ::rtl::OUString& rValue ); - - void Remove( sal_uInt16 i ); -}; - -inline sal_uInt16 SvXMLAttrContainerItem_Impl::GetPrefixPos( sal_uInt16 i ) const -{ -// DBG_ASSERT( i >= 0 && i < aPrefixPoss.Count(), -// "SvXMLAttrContainerItem_Impl::GetPrefixPos: illegal index" ); - return aPrefixPoss[i]; -} - -inline ::rtl::OUString SvXMLAttrContainerItem_Impl::GetAttrNamespace( sal_uInt16 i ) const -{ - ::rtl::OUString sRet; - sal_uInt16 nPos = GetPrefixPos( i ); - if( USHRT_MAX != nPos ) - sRet = aNamespaceMap.GetNameByIndex( nPos ); - return sRet; -} - -inline ::rtl::OUString SvXMLAttrContainerItem_Impl::GetAttrPrefix( sal_uInt16 i ) const -{ - ::rtl::OUString sRet; - sal_uInt16 nPos = GetPrefixPos( i ); - if( USHRT_MAX != nPos ) - sRet = aNamespaceMap.GetPrefixByIndex( nPos ); - return sRet; -} - -inline const ::rtl::OUString& SvXMLAttrContainerItem_Impl::GetAttrLName(sal_uInt16 i) const -{ - DBG_ASSERT( i >= 0 && i < aLNames.Count(), - "SvXMLAttrContainerItem_Impl::GetLName: illegal index" ); - return *aLNames[i]; -} - -inline const ::rtl::OUString& SvXMLAttrContainerItem_Impl::GetAttrValue(sal_uInt16 i) const -{ - DBG_ASSERT( i >= 0 && i < aValues.Count(), - "SvXMLAttrContainerItem_Impl::GetValue: illegal index" ); - return *aValues[i]; -} - -inline const ::rtl::OUString& SvXMLAttrContainerItem_Impl::GetNamespace( - sal_uInt16 i ) const -{ - return aNamespaceMap.GetNameByIndex( i ); -} - -inline const ::rtl::OUString& SvXMLAttrContainerItem_Impl::GetPrefix( sal_uInt16 i ) const -{ - return aNamespaceMap.GetPrefixByIndex( i ); -} - -#endif - diff --git a/svtools/prj/build.lst b/svtools/prj/build.lst index a60199740561..5a67b9414181 100644 --- a/svtools/prj/build.lst +++ b/svtools/prj/build.lst @@ -1,55 +1,28 @@ -st svtools : l10n 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 -st svtools\prj get - all st_prj NULL -st svtools\res get - all st_res NULL -st svtools\win\inc get - all st_winc NULL -st svtools\win\res get - all st_wres NULL -st svtools\os2\inc get - all st_oinc NULL -st svtools\mac\inc get - all st_minc NULL -st svtools\unx\inc get - all st_uinc NULL -st svtools\bmpmaker nmake - all st_bmp st_inc NULL -st svtools\source\memtools nmake - all st_mem st_inc NULL -st svtools\source\numbers nmake - all st_num st_inc NULL -st svtools\source\notify nmake - all st_not st_inc NULL -st svtools\source\config nmake - all st_conf st_inc NULL -st svtools\unx\source\svdde nmake - u st_usdde st_inc NULL -st svtools\unx\source\svdde nmake - p st_psdde st_inc NULL -st svtools\mac\source\svdde nmake - m st_msdde st_inc NULL -st svtools\mac\source\misc nmake - m st_msc st_inc NULL -st svtools\source\control nmake - all st_ctl st_inc NULL -st svtools\source\filerec nmake - all st_file st_inc NULL -st svtools\source\filter.vcl\filter nmake - all st_vfilt st_inc NULL -st svtools\source\filter.vcl\wmf nmake - all st_vwmf st_inc NULL -st svtools\source\filter.vcl\igif nmake - all st_vigif st_inc NULL -st svtools\source\filter.vcl\jpeg nmake - all st_vjpeg st_inc NULL -st svtools\source\filter.vcl\ixbm nmake - all st_vixbm st_inc NULL -st svtools\source\filter.vcl\ixpm nmake - all st_vixpm st_inc NULL +st svtools : l10n svl 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\bmpmaker nmake - all st_bmp st_inc NULL st svtools\source\brwbox nmake - all st__brw st_bmp st_inc NULL -st svtools\source\urlobj nmake - all st__url st_inc NULL -st svtools\source\misc nmake - all st__misc st_bmp st_inc NULL -st svtools\source\misc1 nmake - all st__misc1 st_inc NULL +st svtools\source\config nmake - all st_conf st_inc NULL st svtools\source\contnr nmake - all st__ctr st_inc NULL -st svtools\source\svdde nmake - all st__dde st_inc NULL -st svtools\source\items nmake - all st__item st_inc NULL -st svtools\source\items1 nmake - all st__item1 st_inc NULL -st svtools\source\undo nmake - all st_undo st_inc NULL -st svtools\source\plugapp nmake - all st_papp st_inc NULL +st svtools\source\control nmake - all st_ctl st_inc NULL st svtools\source\dialogs nmake - all st_dial st_inc NULL -st svtools\source\edit nmake - all st_edit st_inc NULL -st svtools\source\table nmake - all st_table st_inc NULL -st svtools\source\uno nmake - all st_uno st_inc NULL -st svtools\source\svrtf nmake - all st_rtf st_inc NULL -st svtools\source\svsql nmake - all st_sql st_inc NULL +st svtools\source\edit nmake - all st_edit st_inc NULL +st svtools\source\filter.vcl\filter nmake - all st_vfilt st_inc NULL +st svtools\source\filter.vcl\wmf nmake - all st_vwmf st_inc NULL +st svtools\source\filter.vcl\igif nmake - all st_vigif st_inc NULL +st svtools\source\filter.vcl\jpeg nmake - all st_vjpeg st_inc NULL +st svtools\source\filter.vcl\ixbm nmake - all st_vixbm st_inc NULL +st svtools\source\filter.vcl\ixpm nmake - all st_vixpm st_inc NULL +st svtools\source\java nmake - all st_svtjava st_inc NULL +st svtools\source\misc nmake - all st__misc st_bmp st_inc NULL +st svtools\source\plugapp nmake - all st_papp st_inc NULL st svtools\source\svhtml nmake - all st_html st_inc NULL -st svtools\source\syslocale nmake - all st_sysloc st_inc NULL -st svtools\source\filepicker nmake - all st_filepick st_inc NULL -st svtools\util nmake - all st_util st__brw st__ctr st__dde st__item st__item1 st__misc st__misc1 st__url st_ctl st_dial st_edit st_file st_html st_papp st_rtf st_sql st_usdde.u st_psdde.p st_msdde.m st_msc.m st_undo st_table st_uno st_vfilt st_vigif st_vixbm st_vixpm st_vjpeg st_vwmf st_sysloc st_filepick st_not st_conf st_mem st_num st_svtjava NULL -st svtools\source\fsstor nmake - all st_fsstor st_inc NULL +st svtools\source\svrtf nmake - all st_rtf st_inc NULL +st svtools\source\table nmake - all st_table st_inc NULL +st svtools\source\uno nmake - all st_uno st_inc NULL +st svtools\source\urlobj nmake - all st__url st_inc NULL +st svtools\util nmake - all st_util st__brw st__ctr st_conf st_ctl st_dial st_edit st__misc st__url st_html st_papp st_rtf st_table st_uno st_vfilt st_vigif st_vixbm st_vixpm st_vjpeg st_vwmf st_svtjava NULL st svtools\source\hatchwindow nmake - all st_hatchwin st_inc NULL -st svtools\source\passwordcontainer nmake - all st_passcont st_inc NULL st svtools\source\productregistration nmake - all st_prodreg st_util st_inc NULL -st svtools\uno nmake - all st_svtuno st_util st_inc NULL -st svtools\source\java nmake - all st_svtjava st_inc NULL st svtools\workben\unodialog nmake - all st_workben_udlg st_util NULL diff --git a/svtools/prj/d.lst b/svtools/prj/d.lst index 3dc9c0b013bb..0a3ccd8a9819 100644 --- a/svtools/prj/d.lst +++ b/svtools/prj/d.lst @@ -5,11 +5,8 @@ mkdir: %_DEST%\inc%_EXT%\svtools ..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid ..\%__SRC%\srs\ehdl.srs %_DEST%\res%_EXT%\svtools.srs ..\%COMMON_OUTDIR%\srs\ehdl_srs.hid %COMMON_DEST%\res%_EXT%\svtools_srs.hid -..\%__SRC%\lib\isvl.lib %_DEST%\lib%_EXT%\isvl.lib ..\%__SRC%\lib\svtool.lib %_DEST%\lib%_EXT%\svtool.lib ..\%__SRC%\slb\svt.lib %_DEST%\lib%_EXT%\xsvtool.lib -..\%__SRC%\bin\dllver.exe %_DEST%\bin%_EXT%\dllver.exe -..\%__SRC%\bin\dllver %_DEST%\bin%_EXT%\dllver ..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\* ..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\* ..\%__SRC%\bin\bmp.* %_DEST%\bin%_EXT%\bmp.* @@ -25,309 +22,12 @@ mkdir: %_DEST%\inc%_EXT%\svtools ..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\* ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\* -..\inc\svtools\svldllapi.h %_DEST%\inc%_EXT%\svtools\svldllapi.h -..\inc\svtools\svtdllapi.h %_DEST%\inc%_EXT%\svtools\svtdllapi.h - -..\inc\svtools\globalnameitem.hxx %_DEST%\inc%_EXT%\svtools\globalnameitem.hxx -..\inc\imagemgr.hxx %_DEST%\inc%_EXT%\svtools\imagemgr.hxx -..\inc\imagemgr.hrc %_DEST%\inc%_EXT%\svtools\imagemgr.hrc -..\inc\testtool.hxx %_DEST%\inc%_EXT%\svtools\testtool.hxx -..\inc\flbytes.hxx %_DEST%\inc%_EXT%\svtools\flbytes.hxx -..\inc\adrparse.hxx %_DEST%\inc%_EXT%\svtools\adrparse.hxx -..\inc\svtools\aeitem.hxx %_DEST%\inc%_EXT%\svtools\aeitem.hxx -..\inc\svtools\brdcst.hxx %_DEST%\inc%_EXT%\svtools\brdcst.hxx -..\inc\broadcast.hxx %_DEST%\inc%_EXT%\svtools\broadcast.hxx -..\inc\svtools\brwbox.hxx %_DEST%\inc%_EXT%\svtools\brwbox.hxx -..\inc\calendar.hxx %_DEST%\inc%_EXT%\svtools\calendar.hxx -..\inc\svtools\cancel.hxx %_DEST%\inc%_EXT%\svtools\cancel.hxx -..\inc\cntnrsrt.hxx %_DEST%\inc%_EXT%\svtools\cntnrsrt.hxx -..\inc\svtools\colrdlg.hxx %_DEST%\inc%_EXT%\svtools\colrdlg.hxx -..\inc\svtools\colctrl.hxx %_DEST%\inc%_EXT%\svtools\colctrl.hxx -..\inc\ctrlbox.hxx %_DEST%\inc%_EXT%\svtools\ctrlbox.hxx -..\inc\ctrltool.hxx %_DEST%\inc%_EXT%\svtools\ctrltool.hxx -..\inc\collatorres.hxx %_DEST%\inc%_EXT%\svtools\collatorres.hxx -..\inc\indexentryres.hxx %_DEST%\inc%_EXT%\svtools\indexentryres.hxx -..\inc\cntwids.hrc %_DEST%\inc%_EXT%\svtools\cntwids.hrc -..\inc\svtools\dateitem.hxx %_DEST%\inc%_EXT%\svtools\dateitem.hxx -..\inc\svtools\dtritem.hxx %_DEST%\inc%_EXT%\svtools\dtritem.hxx -..\inc\svtools\frqitem.hxx %_DEST%\inc%_EXT%\svtools\frqitem.hxx -..\inc\svtools\cstitem.hxx %_DEST%\inc%_EXT%\svtools\cstitem.hxx -..\inc\svtools\tfrmitem.hxx %_DEST%\inc%_EXT%\svtools\tfrmitem.hxx -..\inc\svtools\cntwall.hxx %_DEST%\inc%_EXT%\svtools\cntwall.hxx -..\inc\svtools\langtab.hxx %_DEST%\inc%_EXT%\svtools\langtab.hxx -..\inc\itemdel.hxx %_DEST%\inc%_EXT%\svtools\itemdel.hxx -..\inc\wallitem.hxx %_DEST%\inc%_EXT%\svtools\wallitem.hxx -..\inc\svtools\sfontitm.hxx %_DEST%\inc%_EXT%\svtools\sfontitm.hxx -..\inc\svtools\bintitem.hxx %_DEST%\inc%_EXT%\svtools\bintitem.hxx -..\inc\stylepool.hxx %_DEST%\inc%_EXT%\svtools\stylepool.hxx -..\inc\dialogcontrolling.hxx %_DEST%\inc%_EXT%\svtools\dialogcontrolling.hxx -..\inc\svtools\eitem.hxx %_DEST%\inc%_EXT%\svtools\eitem.hxx -..\inc\eventcfg.hxx %_DEST%\inc%_EXT%\svtools\eventcfg.hxx -..\inc\filedlg.hxx %_DEST%\inc%_EXT%\svtools\filedlg.hxx -..\inc\svtools\filerec.hxx %_DEST%\inc%_EXT%\svtools\filerec.hxx -..\inc\svtools\flagitem.hxx %_DEST%\inc%_EXT%\svtools\flagitem.hxx -..\inc\svtools\fltcall.hxx %_DEST%\inc%_EXT%\svtools\fltcall.hxx -..\inc\svtools\wmf.hxx %_DEST%\inc%_EXT%\svtools\wmf.hxx -..\inc\fltdefs.hxx %_DEST%\inc%_EXT%\svtools\fltdefs.hxx -..\inc\svtools\filter.hxx %_DEST%\inc%_EXT%\svtools\filter.hxx -..\inc\svtools\FilterConfigItem.hxx %_DEST%\inc%_EXT%\svtools\FilterConfigItem.hxx -..\inc\svtools\fmtfield.hxx %_DEST%\inc%_EXT%\svtools\fmtfield.hxx -..\inc\svtools\hint.hxx %_DEST%\inc%_EXT%\svtools\hint.hxx -..\inc\svtools\accessibletableprovider.hxx %_DEST%\inc%_EXT%\svtools\accessibletableprovider.hxx -..\inc\svtools\AccessibleBrowseBoxObjType.hxx %_DEST%\inc%_EXT%\svtools\AccessibleBrowseBoxObjType.hxx -..\inc\svtools\accessiblefactory.hxx %_DEST%\inc%_EXT%\svtools\accessiblefactory.hxx -..\inc\svtools\textwindowpeer.hxx %_DEST%\inc%_EXT%\svtools\textwindowpeer.hxx -..\inc\imgdef.hxx %_DEST%\inc%_EXT%\svtools\imgdef.hxx -..\inc\inetdef.hxx %_DEST%\inc%_EXT%\svtools\inetdef.hxx -..\inc\svtools\inethist.hxx %_DEST%\inc%_EXT%\svtools\inethist.hxx -..\inc\inetmsg.hxx %_DEST%\inc%_EXT%\svtools\inetmsg.hxx -..\inc\inetstrm.hxx %_DEST%\inc%_EXT%\svtools\inetstrm.hxx -..\inc\svtools\intitem.hxx %_DEST%\inc%_EXT%\svtools\intitem.hxx -..\inc\svtools\visitem.hxx %_DEST%\inc%_EXT%\svtools\visitem.hxx -..\inc\svtools\imageitm.hxx %_DEST%\inc%_EXT%\svtools\imageitm.hxx -..\inc\svtools\isethint.hxx %_DEST%\inc%_EXT%\svtools\isethint.hxx -..\inc\svtools\itemiter.hxx %_DEST%\inc%_EXT%\svtools\itemiter.hxx -..\inc\svtools\itempool.hxx %_DEST%\inc%_EXT%\svtools\itempool.hxx -..\inc\svtools\itemset.hxx %_DEST%\inc%_EXT%\svtools\itemset.hxx -..\inc\svtools\lckbitem.hxx %_DEST%\inc%_EXT%\svtools\lckbitem.hxx -..\inc\listener.hxx %_DEST%\inc%_EXT%\svtools\listener.hxx -..\inc\listeneriter.hxx %_DEST%\inc%_EXT%\svtools\listeneriter.hxx -..\inc\svtools\lstner.hxx %_DEST%\inc%_EXT%\svtools\lstner.hxx -..\inc\svtools\macitem.hxx %_DEST%\inc%_EXT%\svtools\macitem.hxx -..\inc\memberid.hrc %_DEST%\inc%_EXT%\svtools\memberid.hrc -..\inc\svtools\nranges.hxx %_DEST%\inc%_EXT%\svtools\nranges.hxx -..\inc\svtools\ownlist.hxx %_DEST%\inc%_EXT%\svtools\ownlist.hxx -..\inc\prgsbar.hxx %_DEST%\inc%_EXT%\svtools\prgsbar.hxx -..\inc\svtools\prnsetup.hxx %_DEST%\inc%_EXT%\svtools\prnsetup.hxx -..\inc\poolcach.hxx %_DEST%\inc%_EXT%\svtools\poolcach.hxx -..\inc\svtools\poolitem.hxx %_DEST%\inc%_EXT%\svtools\poolitem.hxx -..\inc\svtools\printdlg.hxx %_DEST%\inc%_EXT%\svtools\printdlg.hxx -..\inc\svtools\ptitem.hxx %_DEST%\inc%_EXT%\svtools\ptitem.hxx -..\inc\svtools\szitem.hxx %_DEST%\inc%_EXT%\svtools\szitem.hxx -..\inc\svtools\rectitem.hxx %_DEST%\inc%_EXT%\svtools\rectitem.hxx -..\inc\svtools\rngitem.hxx %_DEST%\inc%_EXT%\svtools\rngitem.hxx -..\inc\ruler.hxx %_DEST%\inc%_EXT%\svtools\ruler.hxx -..\inc\scrwin.hxx %_DEST%\inc%_EXT%\svtools\scrwin.hxx -..\inc\svtools\sharecontrolfile.hxx %_DEST%\inc%_EXT%\svtools\sharecontrolfile.hxx -..\inc\svtools\documentlockfile.hxx %_DEST%\inc%_EXT%\svtools\documentlockfile.hxx -..\inc\svtools\lockfilecommon.hxx %_DEST%\inc%_EXT%\svtools\lockfilecommon.hxx -..\inc\svtools\slstitm.hxx %_DEST%\inc%_EXT%\svtools\slstitm.hxx -..\inc\svtools\ilstitem.hxx %_DEST%\inc%_EXT%\svtools\ilstitem.hxx -..\inc\svtools\smplhint.hxx %_DEST%\inc%_EXT%\svtools\smplhint.hxx -..\inc\svtools\cnclhint.hxx %_DEST%\inc%_EXT%\svtools\cnclhint.hxx -..\inc\svtools\inettype.hxx %_DEST%\inc%_EXT%\svtools\inettype.hxx -..\inc\svtools\brwhead.hxx %_DEST%\inc%_EXT%\svtools\brwhead.hxx -..\inc\svtools\solar.hrc %_DEST%\inc%_EXT%\svtools\solar.hrc -..\inc\scriptedtext.hxx %_DEST%\inc%_EXT%\svtools\scriptedtext.hxx -..\inc\svtools\stdctrl.hxx %_DEST%\inc%_EXT%\svtools\stdctrl.hxx -..\inc\svtools\stritem.hxx %_DEST%\inc%_EXT%\svtools\stritem.hxx -..\inc\svtools\style.hrc %_DEST%\inc%_EXT%\svtools\style.hrc -..\inc\svtools\style.hxx %_DEST%\inc%_EXT%\svtools\style.hxx -..\inc\svtools\svarray.hxx %_DEST%\inc%_EXT%\svtools\svarray.hxx -..\inc\svtools\svdde.hxx %_DEST%\inc%_EXT%\svtools\svdde.hxx -..\inc\svtools\svtdata.hxx %_DEST%\inc%_EXT%\svtools\svtdata.hxx -..\inc\tabbar.hxx %_DEST%\inc%_EXT%\svtools\tabbar.hxx -..\inc\taskbar.hxx %_DEST%\inc%_EXT%\svtools\taskbar.hxx -..\inc\svtools\undo.hxx %_DEST%\inc%_EXT%\svtools\undo.hxx -..\inc\whiter.hxx %_DEST%\inc%_EXT%\svtools\whiter.hxx -..\inc\svtools\valueset.hxx %_DEST%\inc%_EXT%\svtools\valueset.hxx -..\inc\stdmenu.hxx %_DEST%\inc%_EXT%\svtools\stdmenu.hxx -..\inc\svtools\headbar.hxx %_DEST%\inc%_EXT%\svtools\headbar.hxx -..\inc\svtools\svicnvw.hxx %_DEST%\inc%_EXT%\svtools\svicnvw.hxx -..\inc\svtools\svlbitm.hxx %_DEST%\inc%_EXT%\svtools\svlbitm.hxx -..\inc\svtools\svlbox.hxx %_DEST%\inc%_EXT%\svtools\svlbox.hxx -..\inc\svtools\svtabbx.hxx %_DEST%\inc%_EXT%\svtools\svtabbx.hxx -..\inc\svtools\svtreebx.hxx %_DEST%\inc%_EXT%\svtools\svtreebx.hxx -..\inc\tooltiplbox.hxx %_DEST%\inc%_EXT%\svtools\tooltiplbox.hxx -..\inc\svtools\treelist.hxx %_DEST%\inc%_EXT%\svtools\treelist.hxx -..\inc\svtools\xtextedt.hxx %_DEST%\inc%_EXT%\svtools\xtextedt.hxx -..\inc\svtools\texteng.hxx %_DEST%\inc%_EXT%\svtools\texteng.hxx -..\inc\svtools\textview.hxx %_DEST%\inc%_EXT%\svtools\textview.hxx -..\inc\svtools\textdata.hxx %_DEST%\inc%_EXT%\svtools\textdata.hxx -..\inc\txtattr.hxx %_DEST%\inc%_EXT%\svtools\txtattr.hxx -..\inc\sychconv.hxx %_DEST%\inc%_EXT%\svtools\sychconv.hxx -..\inc\svtools\ttprops.hxx %_DEST%\inc%_EXT%\svtools\ttprops.hxx -..\inc\svtools\transfer.hxx %_DEST%\inc%_EXT%\svtools\transfer.hxx -..\inc\svtools\embedtransfer.hxx %_DEST%\inc%_EXT%\svtools\embedtransfer.hxx -..\inc\svtools\embedhlp.hxx %_DEST%\inc%_EXT%\svtools\embedhlp.hxx -..\inc\cliplistener.hxx %_DEST%\inc%_EXT%\svtools\cliplistener.hxx -..\inc\txtcmp.hxx %_DEST%\inc%_EXT%\svtools\txtcmp.hxx -..\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 -..\inc\svtools\nfversi.hxx %_DEST%\inc%_EXT%\svtools\nfversi.hxx -..\inc\svtools\nfkeytab.hxx %_DEST%\inc%_EXT%\svtools\nfkeytab.hxx -..\inc\nfsymbol.hxx %_DEST%\inc%_EXT%\svtools\nfsymbol.hxx -..\inc\svtools\wizdlg.hxx %_DEST%\inc%_EXT%\svtools\wizdlg.hxx -..\inc\svtools\zforlist.hxx %_DEST%\inc%_EXT%\svtools\zforlist.hxx -..\inc\svtools\zformat.hxx %_DEST%\inc%_EXT%\svtools\zformat.hxx -..\inc\numuno.hxx %_DEST%\inc%_EXT%\svtools\numuno.hxx -..\inc\svtools\ondemand.hxx %_DEST%\inc%_EXT%\svtools\ondemand.hxx -..\inc\svtools\loginerr.hxx %_DEST%\inc%_EXT%\svtools\loginerr.hxx -..\inc\svtools\logindlg.hxx %_DEST%\inc%_EXT%\svtools\logindlg.hxx -..\inc\svtools\httpcook.hxx %_DEST%\inc%_EXT%\svtools\httpcook.hxx -..\inc\imageresourceaccess.hxx %_DEST%\inc%_EXT%\svtools\imageresourceaccess.hxx -..\inc\svtools\itemprop.hxx %_DEST%\inc%_EXT%\svtools\itemprop.hxx -..\inc\addresstemplate.hxx %_DEST%\inc%_EXT%\svtools\addresstemplate.hxx -..\inc\svtools\genericunodialog.hxx %_DEST%\inc%_EXT%\svtools\genericunodialog.hxx -..\inc\svtools\editbrowsebox.hxx %_DEST%\inc%_EXT%\svtools\editbrowsebox.hxx -..\inc\svtools\editimplementation.hxx %_DEST%\inc%_EXT%\svtools\editimplementation.hxx -..\inc\templatefoldercache.hxx %_DEST%\inc%_EXT%\svtools\templatefoldercache.hxx -..\inc\folderrestriction.hxx %_DEST%\inc%_EXT%\svtools\folderrestriction.hxx -..\inc\filenotation.hxx %_DEST%\inc%_EXT%\svtools\filenotation.hxx -..\inc\svtools\urlcontrol.hxx %_DEST%\inc%_EXT%\svtools\urlcontrol.hxx -..\inc\svtools\fileurlbox.hxx %_DEST%\inc%_EXT%\svtools\fileurlbox.hxx -..\inc\svtools\toolboxcontroller.hxx %_DEST%\inc%_EXT%\svtools\toolboxcontroller.hxx -..\inc\framestatuslistener.hxx %_DEST%\inc%_EXT%\svtools\framestatuslistener.hxx -..\inc\statusbarcontroller.hxx %_DEST%\inc%_EXT%\svtools\statusbarcontroller.hxx -..\inc\svtools\generictoolboxcontroller.hxx %_DEST%\inc%_EXT%\svtools\generictoolboxcontroller.hxx -..\inc\svtools\restrictedpaths.hxx %_DEST%\inc%_EXT%\svtools\restrictedpaths.hxx - -..\inc\svtools\imap.hxx %_DEST%\inc%_EXT%\svtools\imap.hxx -..\inc\svtools\imapobj.hxx %_DEST%\inc%_EXT%\svtools\imapobj.hxx -..\inc\svtools\imaprect.hxx %_DEST%\inc%_EXT%\svtools\imaprect.hxx -..\inc\svtools\imapcirc.hxx %_DEST%\inc%_EXT%\svtools\imapcirc.hxx -..\inc\svtools\imappoly.hxx %_DEST%\inc%_EXT%\svtools\imappoly.hxx - -..\inc\svtools\parhtml.hxx %_DEST%\inc%_EXT%\svtools\parhtml.hxx -..\inc\htmltokn.h %_DEST%\inc%_EXT%\svtools\htmltokn.h -..\inc\htmlkywd.hxx %_DEST%\inc%_EXT%\svtools\htmlkywd.hxx -..\inc\svtools\svparser.hxx %_DEST%\inc%_EXT%\svtools\svparser.hxx -..\inc\svtools\htmlout.hxx %_DEST%\inc%_EXT%\svtools\htmlout.hxx -..\source\svrtf\rtfout.hxx %_DEST%\inc%_EXT%\svtools\rtfout.hxx -..\inc\svtools\parrtf.hxx %_DEST%\inc%_EXT%\svtools\parrtf.hxx -..\source\svrtf\rtftoken.h %_DEST%\inc%_EXT%\svtools\rtftoken.h -..\source\svrtf\rtfkeywd.hxx %_DEST%\inc%_EXT%\svtools\rtfkeywd.hxx - -..\inc\svtools\ctypeitm.hxx %_DEST%\inc%_EXT%\svtools\ctypeitm.hxx - -..\inc\strmadpt.hxx %_DEST%\inc%_EXT%\svtools\strmadpt.hxx -..\inc\instrm.hxx %_DEST%\inc%_EXT%\svtools\instrm.hxx -..\inc\outstrm.hxx %_DEST%\inc%_EXT%\svtools\outstrm.hxx - -..\inc\svtools\section.hxx %_DEST%\inc%_EXT%\svtools\section.hxx -..\inc\sectctr.hxx %_DEST%\inc%_EXT%\svtools\sectctr.hxx -..\inc\privsplt.hxx %_DEST%\inc%_EXT%\svtools\privsplt.hxx -..\inc\expander.hxx %_DEST%\inc%_EXT%\svtools\expander.hxx -..\source\svsql\converter.hxx %_DEST%\inc%_EXT%\svtools\converter.hxx - -..\inc\filectrl.hxx %_DEST%\inc%_EXT%\svtools\filectrl.hxx -..\inc\svtools\cenumitm.hxx %_DEST%\inc%_EXT%\svtools\cenumitm.hxx -..\inc\svtools\cintitem.hxx %_DEST%\inc%_EXT%\svtools\cintitem.hxx -..\inc\svtools\custritm.hxx %_DEST%\inc%_EXT%\svtools\custritm.hxx - -..\inc\sfxecode.hxx %_DEST%\inc%_EXT%\svtools\sfxecode.hxx -..\inc\svtools\ehdl.hxx %_DEST%\inc%_EXT%\svtools\ehdl.hxx -..\inc\svtools\svtools.hrc %_DEST%\inc%_EXT%\svtools\svtools.hrc -..\source\dialogs\filedlg2.hrc %_DEST%\inc%_EXT%\svtools\filedlg2.hrc - -..\inc\xmlement.hxx %_DEST%\inc%_EXT%\svtools\xmlement.hxx -..\inc\svtools\tresitem.hxx %_DEST%\inc%_EXT%\svtools\tresitem.hxx -..\inc\urihelper.hxx %_DEST%\inc%_EXT%\svtools\urihelper.hxx -..\inc\reginfo.hxx %_DEST%\inc%_EXT%\svtools\reginfo.hxx -..\inc\cacheoptions.hxx %_DEST%\inc%_EXT%\svtools\cacheoptions.hxx -..\inc\svtools\cjkoptions.hxx %_DEST%\inc%_EXT%\svtools\cjkoptions.hxx -..\inc\javaoptions.hxx %_DEST%\inc%_EXT%\svtools\javaoptions.hxx -..\inc\svtools\accelcfg.hxx %_DEST%\inc%_EXT%\svtools\accelcfg.hxx -..\inc\svtools\pathoptions.hxx %_DEST%\inc%_EXT%\svtools\pathoptions.hxx -..\inc\svtools\useroptions.hxx %_DEST%\inc%_EXT%\svtools\useroptions.hxx -..\inc\fstathelper.hxx %_DEST%\inc%_EXT%\svtools\fstathelper.hxx -..\inc\svtools\saveopt.hxx %_DEST%\inc%_EXT%\svtools\saveopt.hxx -..\inc\svtools\undoopt.hxx %_DEST%\inc%_EXT%\svtools\undoopt.hxx -..\inc\svtools\helpopt.hxx %_DEST%\inc%_EXT%\svtools\helpopt.hxx -..\inc\svtools\optionsdlg.hxx %_DEST%\inc%_EXT%\svtools\optionsdlg.hxx -..\inc\svtools\moduleoptions.hxx %_DEST%\inc%_EXT%\svtools\moduleoptions.hxx -..\inc\svtools\securityoptions.hxx %_DEST%\inc%_EXT%\svtools\securityoptions.hxx -..\inc\svtools\extendedsecurityoptions.hxx %_DEST%\inc%_EXT%\svtools\extendedsecurityoptions.hxx -..\inc\svtools\miscopt.hxx %_DEST%\inc%_EXT%\svtools\miscopt.hxx -..\inc\svtools\localisationoptions.hxx %_DEST%\inc%_EXT%\svtools\localisationoptions.hxx -..\inc\svtools\workingsetoptions.hxx %_DEST%\inc%_EXT%\svtools\workingsetoptions.hxx -..\inc\svtools\viewoptions.hxx %_DEST%\inc%_EXT%\svtools\viewoptions.hxx -..\inc\svtools\internaloptions.hxx %_DEST%\inc%_EXT%\svtools\internaloptions.hxx -..\inc\svtools\startoptions.hxx %_DEST%\inc%_EXT%\svtools\startoptions.hxx -..\inc\svtools\historyoptions.hxx %_DEST%\inc%_EXT%\svtools\historyoptions.hxx -..\inc\svtools\inetoptions.hxx %_DEST%\inc%_EXT%\svtools\inetoptions.hxx -..\inc\svtools\menuoptions.hxx %_DEST%\inc%_EXT%\svtools\menuoptions.hxx -..\inc\svtools\options3d.hxx %_DEST%\inc%_EXT%\svtools\options3d.hxx -..\inc\svtools\optionsdrawinglayer.hxx %_DEST%\inc%_EXT%\svtools\optionsdrawinglayer.hxx -..\inc\svtools\fontoptions.hxx %_DEST%\inc%_EXT%\svtools\fontoptions.hxx -..\inc\svtools\addxmltostorageoptions.hxx %_DEST%\inc%_EXT%\svtools\addxmltostorageoptions.hxx -..\inc\svtools\defaultoptions.hxx %_DEST%\inc%_EXT%\svtools\defaultoptions.hxx -..\inc\svtools\printwarningoptions.hxx %_DEST%\inc%_EXT%\svtools\printwarningoptions.hxx -..\inc\svtools\printoptions.hxx %_DEST%\inc%_EXT%\svtools\printoptions.hxx -..\inc\svtools\dynamicmenuoptions.hxx %_DEST%\inc%_EXT%\svtools\dynamicmenuoptions.hxx -..\inc\svtools\compatibility.hxx %_DEST%\inc%_EXT%\svtools\compatibility.hxx -..\inc\svtools\syslocaleoptions.hxx %_DEST%\inc%_EXT%\svtools\syslocaleoptions.hxx -..\inc\localresaccess.hxx %_DEST%\inc%_EXT%\svtools\localresaccess.hxx -..\inc\svtools\wizardmachine.hxx %_DEST%\inc%_EXT%\svtools\wizardmachine.hxx -..\inc\svtools\roadmapwizard.hxx %_DEST%\inc%_EXT%\svtools\roadmapwizard.hxx -..\inc\roadmap.hxx %_DEST%\inc%_EXT%\svtools\roadmap.hxx -..\inc\svtools\hyperlabel.hxx %_DEST%\inc%_EXT%\svtools\hyperlabel.hxx -..\inc\svtools\fixedhyper.hxx %_DEST%\inc%_EXT%\svtools\fixedhyper.hxx -..\inc\helpagentwindow.hxx %_DEST%\inc%_EXT%\svtools\helpagentwindow.hxx -..\inc\pickerhistory.hxx %_DEST%\inc%_EXT%\svtools\pickerhistory.hxx -..\inc\pickerhistoryaccess.hxx %_DEST%\inc%_EXT%\svtools\pickerhistoryaccess.hxx -..\inc\pickerhelper.hxx %_DEST%\inc%_EXT%\svtools\pickerhelper.hxx -..\inc\regoptions.hxx %_DEST%\inc%_EXT%\svtools\regoptions.hxx -..\inc\svtools\accessibilityoptions.hxx %_DEST%\inc%_EXT%\svtools\accessibilityoptions.hxx -..\inc\svtools\cmdoptions.hxx %_DEST%\inc%_EXT%\svtools\cmdoptions.hxx -..\inc\svtools\ctloptions.hxx %_DEST%\inc%_EXT%\svtools\ctloptions.hxx -..\inc\svtools\languageoptions.hxx %_DEST%\inc%_EXT%\svtools\languageoptions.hxx -..\inc\svtools\sourceviewconfig.hxx %_DEST%\inc%_EXT%\svtools\sourceviewconfig.hxx -..\inc\svtools\colorcfg.hxx %_DEST%\inc%_EXT%\svtools\colorcfg.hxx - -..\inc\lngmisc.hxx %_DEST%\inc%_EXT%\svtools\lngmisc.hxx -..\inc\svtools\lingucfg.hxx %_DEST%\inc%_EXT%\svtools\lingucfg.hxx -..\inc\linguprops.hxx %_DEST%\inc%_EXT%\svtools\linguprops.hxx -..\inc\searchopt.hxx %_DEST%\inc%_EXT%\svtools\searchopt.hxx - -..\inc\PasswordHelper.hxx %_DEST%\inc%_EXT%\svtools\PasswordHelper.hxx - -..\inc\svtools\syslocale.hxx %_DEST%\inc%_EXT%\svtools\syslocale.hxx - -..\inc\unoimap.hxx %_DEST%\inc%_EXT%\svtools\unoimap.hxx -..\inc\unoevent.hxx %_DEST%\inc%_EXT%\svtools\unoevent.hxx - -..\inc\svtools\stringtransfer.hxx %_DEST%\inc%_EXT%\svtools\stringtransfer.hxx - -..\inc\ivctrl.hxx %_DEST%\inc%_EXT%\svtools\ivctrl.hxx -..\inc\fileview.hxx %_DEST%\inc%_EXT%\svtools\fileview.hxx -..\inc\templdlg.hxx %_DEST%\inc%_EXT%\svtools\templdlg.hxx -..\inc\asynclink.hxx %_DEST%\inc%_EXT%\svtools\asynclink.hxx -..\inc\svtools\inettbc.hxx %_DEST%\inc%_EXT%\svtools\inettbc.hxx -..\inc\svtools\urlfilter.hxx %_DEST%\inc%_EXT%\svtools\urlfilter.hxx - -..\inc\controldims.hrc %_DEST%\inc%_EXT%\svtools\controldims.hrc - -..\inc\svtools\helpid.hrc %_DEST%\inc%_EXT%\svtools\helpid.hrc -..\inc\svtools\insdlg.hxx %_DEST%\inc%_EXT%\svtools\insdlg.hxx -..\inc\soerr.hxx %_DEST%\inc%_EXT%\svtools\soerr.hxx -..\inc\sores.hxx %_DEST%\inc%_EXT%\svtools\sores.hxx - -..\inc\textwindowaccessibility.hxx %_DEST%\inc%_EXT%\svtools\textwindowaccessibility.hxx - -..\inc\fontsubstconfig.hxx %_DEST%\inc%_EXT%\svtools\fontsubstconfig.hxx -..\inc\apearcfg.hxx %_DEST%\inc%_EXT%\svtools\apearcfg.hxx -..\inc\fltrcfg.hxx %_DEST%\inc%_EXT%\svtools\fltrcfg.hxx -..\inc\misccfg.hxx %_DEST%\inc%_EXT%\svtools\misccfg.hxx -..\inc\acceleratorexecute.hxx %_DEST%\inc%_EXT%\svtools\acceleratorexecute.hxx - -..\inc\QueryFolderName.hxx %_DEST%\inc%_EXT%\svtools\QueryFolderName.hxx -..\inc\DocumentInfoPreview.hxx %_DEST%\inc%_EXT%\svtools\DocumentInfoPreview.hxx -..\inc\svtools\javacontext.hxx %_DEST%\inc%_EXT%\svtools\javacontext.hxx -..\inc\svtools\javainteractionhandler.hxx %_DEST%\inc%_EXT%\svtools\javainteractionhandler.hxx -..\inc\dialogclosedlistener.hxx %_DEST%\inc%_EXT%\svtools\dialogclosedlistener.hxx -..\inc\svtools\options.hxx %_DEST%\inc%_EXT%\svtools\options.hxx -..\inc\contextmenuhelper.hxx %_DEST%\inc%_EXT%\svtools\contextmenuhelper.hxx -..\inc\extcolorcfg.hxx %_DEST%\inc%_EXT%\svtools\extcolorcfg.hxx - -..\inc\svtools\chartprettypainter.hxx %_DEST%\inc%_EXT%\svtools\chartprettypainter.hxx -..\inc\svtools\extensionlistbox.hxx %_DEST%\inc%_EXT%\svtools\extensionlistbox.hxx +..\inc\svtools\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx +..\inc\svtools\*.h %_DEST%\inc%_EXT%\svtools\*.h +..\inc\svtools\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc +..\inc\*.hxx %_DEST%\inc%_EXT%\svtools\*.hxx +..\inc\*.h %_DEST%\inc%_EXT%\svtools\*.h +..\inc\*.hrc %_DEST%\inc%_EXT%\svtools\*.hrc dos: sh -c "if test %OS% = MACOSX; then macosx-create-bundle %_DEST%\bin%_EXT%\bmp=%__PRJROOT%\%__SRC%\bin%_EXT%; fi" diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index 086e00674a8e..09d1f5c869b9 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -50,7 +50,7 @@ #include <svtools/svtdata.hxx> #ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #endif #include <algorithm> @@ -70,17 +70,7 @@ namespace svt sal_Bool isHiContrast(Window* _pWindow) { OSL_ENSURE(_pWindow,"Window must be not null!"); - Window* pIter = _pWindow; - // while( pIter && pIter->GetBackground().GetColor().GetColor() == COL_TRANSPARENT ) - while( pIter ) - { - const Color& aColor = pIter->GetBackground().GetColor(); - if ( aColor.GetColor() == COL_TRANSPARENT ) - pIter = pIter->GetParent(); - else - break; - } - return pIter && pIter->GetBackground().GetColor().IsDark(); + return _pWindow && _pWindow->GetSettings().GetStyleSettings().GetHighContrastMode(); } //.............................................................. diff --git a/svtools/source/brwbox/editbrowsebox.src b/svtools/source/brwbox/editbrowsebox.src index 39991363c906..c04e1294c0af 100644 --- a/svtools/source/brwbox/editbrowsebox.src +++ b/svtools/source/brwbox/editbrowsebox.src @@ -33,7 +33,7 @@ #endif #ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #endif ImageList RID_SVTOOLS_IMAGELIST_EDITBROWSEBOX diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx index 6f1e3882d705..4077231c5c84 100644 --- a/svtools/source/config/accessibilityoptions.cxx +++ b/svtools/source/config/accessibilityoptions.cxx @@ -31,11 +31,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - #include <svtools/accessibilityoptions.hxx> #include "configitems/accessibilityoptions_const.hxx" @@ -57,10 +52,10 @@ #include <unotools/processfactory.hxx> #endif #ifndef _SVT_LOGHELPER_HXX_ -#include <loghelper.hxx> +#include <unotools/loghelper.hxx> #endif -#include <svtools/smplhint.hxx> +#include <svl/smplhint.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> @@ -544,7 +539,7 @@ SvtAccessibilityOptions::~SvtAccessibilityOptions() void SvtAccessibilityOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) { - Broadcast( rHint ); + NotifyListeners(0); if ( rHint.IsA(TYPE(SfxSimpleHint)) ) { if ( ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_ACCESSIBILITY_CHANGED ) diff --git a/svtools/source/config/addxmltostorageoptions.cxx b/svtools/source/config/addxmltostorageoptions.cxx deleted file mode 100644 index 92e2369a2a70..000000000000 --- a/svtools/source/config/addxmltostorageoptions.cxx +++ /dev/null @@ -1,291 +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: addxmltostorageoptions.cxx,v $ - * $Revision: 1.9 $ - * - * 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/addxmltostorageoptions.hxx> -#include <unotools/configmgr.hxx> -#include <unotools/configitem.hxx> -#include <tools/debug.hxx> -#include <tools/string.hxx> -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/uno/Sequence.hxx> - -#include <rtl/logfile.hxx> -#include "itemholder1.hxx" - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::utl; -using namespace ::rtl; -using namespace ::osl; -using namespace ::com::sun::star::uno; - -//***************************************************************************************************************** -// initialize static member -// DON'T DO IT IN YOUR HEADER! -// see definition for further informations -//***************************************************************************************************************** -SvtAddXMLToStorageOptions_Impl* SvtAddXMLToStorageOptions::m_pDataContainer = 0; -sal_Int32 SvtAddXMLToStorageOptions::m_nRefCount = 0; - - -//_________________________________________________________________________________________________________________ -// private declarations! -//_________________________________________________________________________________________________________________ - -class SvtAddXMLToStorageOptions_Impl : public ConfigItem -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - SvtAddXMLToStorageOptions_Impl(); - - //--------------------------------------------------------------------------------------------------------- - // overloaded methods of baseclass - //--------------------------------------------------------------------------------------------------------- - - //--------------------------------------------------------------------------------------------------------- - // public interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short access method to get internal values - @descr These method give us a chance to regulate acces to ouer internal values. - It's not used in the moment - but it's possible for the feature! - - @seealso - - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - sal_Bool IsWriter_Add_XML_to_Storage() const { return bAddXmlToStg_Writer; } - sal_Bool IsCalc_Add_XML_to_Storage() const { return bAddXmlToStg_Calc; } - sal_Bool IsImpress_Add_XML_to_Storage() const { return bAddXmlToStg_Impress; } - sal_Bool IsDraw_Add_XML_to_Storage() const { return bAddXmlToStg_Draw; } - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return list of key names of ouer configuration management which represent oue module tree - @descr These methods return a static const list of key names. We need it to get needed values from our - configuration management. - - @seealso - - - @param - - @return A list of needed configuration keys is returned. - - @onerror - - *//*-*****************************************************************************************************/ - - static Sequence< OUString > GetPropertyNames(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - sal_Bool bAddXmlToStg_Writer, - bAddXmlToStg_Calc, - bAddXmlToStg_Impress, - bAddXmlToStg_Draw; -}; - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtAddXMLToStorageOptions_Impl::SvtAddXMLToStorageOptions_Impl() - // Init baseclasses first - : ConfigItem( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( - "Office.Common/AddXMLToStorage"))), - // Init member then. - bAddXmlToStg_Writer( FALSE ), - bAddXmlToStg_Calc( FALSE ), - bAddXmlToStg_Impress( FALSE ), - bAddXmlToStg_Draw( FALSE ) -{ - // Use our static list of configuration keys to get his values. - Sequence< OUString > seqNames = GetPropertyNames(); - Sequence< Any > seqValues = GetProperties( seqNames ); - - // Copy values from list in right order to ouer internal member. - sal_Int32 nPropertyCount = seqValues.getLength(); - const Any* pValue = seqValues.getConstArray(); - for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty, ++pValue ) - if( pValue->hasValue() ) - - switch( nProperty ) - { - case 0: - *pValue >>= bAddXmlToStg_Writer; - break; - case 1: - *pValue >>= bAddXmlToStg_Calc; - break; - case 2: - *pValue >>= bAddXmlToStg_Impress; - break; - case 3: - *pValue >>= bAddXmlToStg_Draw; - break; - } -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Sequence< OUString > SvtAddXMLToStorageOptions_Impl::GetPropertyNames() -{ - // Build static list of configuration key names. - static const sal_Char* pProperties[] = - { - "Writer", - "Calc", - "Impress", - "Draw" - }; - - const sal_uInt16 nCnt = sizeof(pProperties) / sizeof( pProperties[0] ); - Sequence<OUString> aNames( nCnt ); - OUString* pNames = aNames.getArray(); - for( sal_uInt16 n = 0; n < nCnt; ++n ) - pNames[ n ] = OUString::createFromAscii( pProperties[ n ] ); - return aNames; -} - - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtAddXMLToStorageOptions::SvtAddXMLToStorageOptions() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( GetOwnStaticMutex() ); - // Increase ouer refcount ... - ++m_nRefCount; - // ... and initialize ouer data container only if it not already exist! - if( !m_pDataContainer ) - { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtAddXMLToStorageOptions_Impl::ctor()"); - m_pDataContainer = new SvtAddXMLToStorageOptions_Impl; - - ItemHolder1::holdConfigItem(E_ADDXMLTOSTORAGEOPTIONS); - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtAddXMLToStorageOptions::~SvtAddXMLToStorageOptions() -{ - // Global access, must be guarded (multithreading!) - MutexGuard aGuard( GetOwnStaticMutex() ); - // Decrease ouer refcount. - // If last instance was deleted ... - // we must destroy ouer static data container! - if( !--m_nRefCount ) - delete m_pDataContainer, m_pDataContainer = 0; -} - -sal_Bool SvtAddXMLToStorageOptions::IsWriter_Add_XML_to_Storage() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsWriter_Add_XML_to_Storage(); -} -sal_Bool SvtAddXMLToStorageOptions::IsCalc_Add_XML_to_Storage() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsCalc_Add_XML_to_Storage(); -} -sal_Bool SvtAddXMLToStorageOptions::IsImpress_Add_XML_to_Storage() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsImpress_Add_XML_to_Storage(); -} -sal_Bool SvtAddXMLToStorageOptions::IsDraw_Add_XML_to_Storage() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsDraw_Add_XML_to_Storage(); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Mutex& SvtAddXMLToStorageOptions::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/apearcfg.cxx b/svtools/source/config/apearcfg.cxx index 35a07a715dd5..0d4865ee563e 100644 --- a/svtools/source/config/apearcfg.cxx +++ b/svtools/source/config/apearcfg.cxx @@ -31,11 +31,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - #include "apearcfg.hxx" #include "com/sun/star/uno/Any.hxx" @@ -176,6 +171,11 @@ void SvtTabAppearanceCfg::Commit() } PutProperties(rNames, aValues); } + +void SvtTabAppearanceCfg::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& ) +{ +} + /*-------------------------------------------------------------------- Beschreibung: --------------------------------------------------------------------*/ diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx index 0c39fde11390..9008d7a27ee1 100644 --- a/svtools/source/config/colorcfg.cxx +++ b/svtools/source/config/colorcfg.cxx @@ -31,11 +31,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - #include <svtools/colorcfg.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> @@ -46,8 +41,8 @@ #include <unotools/configitem.hxx> #include <unotools/configpathes.hxx> #include <com/sun/star/uno/Sequence.h> -#include <svtools/poolitem.hxx> //Any2Bool -#include <svtools/smplhint.hxx> +#include <svl/poolitem.hxx> //Any2Bool +#include <svl/smplhint.hxx> #include <vos/mutex.hxx> #include <itemholder2.hxx> @@ -81,15 +76,12 @@ ColorConfig_Impl* ColorConfig::m_pImpl = NULL; /* -----------------------------16.01.01 15:36-------------------------------- ---------------------------------------------------------------------------*/ -class ColorConfig_Impl : public utl::ConfigItem, public SfxBroadcaster +class ColorConfig_Impl : public utl::ConfigItem { ColorConfigValue m_aConfigValues[ColorConfigEntryCount]; sal_Bool m_bEditMode; rtl::OUString m_sIsVisible; rtl::OUString m_sLoadedScheme; - sal_Bool m_bIsBroadcastEnabled; - static sal_Bool m_bLockBroadcast; - static sal_Bool m_bBroadcastWhenUnlocked; uno::Sequence< ::rtl::OUString> GetPropertyNames(const rtl::OUString& rScheme); public: @@ -118,13 +110,6 @@ public: void ClearModified(){ConfigItem::ClearModified();} void SettingsChanged(); - static void DisableBroadcast(); - static void EnableBroadcast(); - static sal_Bool IsEnableBroadcast(); - - static void LockBroadcast(); - static void UnlockBroadcast(); - // #100822# DECL_LINK( DataChangedEventListener, VclWindowEvent* ); @@ -219,13 +204,10 @@ uno::Sequence< OUString> ColorConfig_Impl::GetPropertyNames(const rtl::OUString& /* -----------------------------22.03.2002 14:37------------------------------ ---------------------------------------------------------------------------*/ -sal_Bool ColorConfig_Impl::m_bLockBroadcast = sal_False; -sal_Bool ColorConfig_Impl::m_bBroadcastWhenUnlocked = sal_False; ColorConfig_Impl::ColorConfig_Impl(sal_Bool bEditMode) : ConfigItem(C2U("Office.UI/ColorScheme")), m_bEditMode(bEditMode), - m_sIsVisible(C2U("/IsVisible")), - m_bIsBroadcastEnabled(sal_True) + m_sIsVisible(C2U("/IsVisible")) { if(!m_bEditMode) { @@ -249,23 +231,6 @@ ColorConfig_Impl::~ColorConfig_Impl() // #100822# ::Application::RemoveEventListener( LINK(this, ColorConfig_Impl, DataChangedEventListener) ); } -// ----------------------------------------------------------------------------- -void ColorConfig_Impl::DisableBroadcast() -{ - if ( ColorConfig::m_pImpl ) - ColorConfig::m_pImpl->m_bIsBroadcastEnabled = sal_False; -} -// ----------------------------------------------------------------------------- -void ColorConfig_Impl::EnableBroadcast() -{ - if ( ColorConfig::m_pImpl ) - ColorConfig::m_pImpl->m_bIsBroadcastEnabled = sal_True; -} -// ----------------------------------------------------------------------------- -sal_Bool ColorConfig_Impl::IsEnableBroadcast() -{ - return ColorConfig::m_pImpl ? ColorConfig::m_pImpl->m_bIsBroadcastEnabled : sal_False; -} /* -----------------------------22.03.2002 14:38------------------------------ ---------------------------------------------------------------------------*/ @@ -308,16 +273,7 @@ void ColorConfig_Impl::Notify( const uno::Sequence<OUString>& ) { //loading via notification always uses the default setting Load(::rtl::OUString()); - - vos::OGuard aVclGuard( Application::GetSolarMutex() ); - - if(m_bLockBroadcast) - { - m_bBroadcastWhenUnlocked = sal_True; - ImplUpdateApplicationSettings(); - } - else - Broadcast(SfxSimpleHint(SFX_HINT_COLORS_CHANGED)); + NotifyListeners(0); } /* -----------------------------22.03.2002 14:38------------------------------ @@ -414,34 +370,7 @@ void ColorConfig_Impl::SettingsChanged() ImplUpdateApplicationSettings(); - Broadcast( SfxSimpleHint( SFX_HINT_COLORS_CHANGED ) ); -} -/* -----------------11.12.2002 09:21----------------- - * - * --------------------------------------------------*/ -void ColorConfig_Impl::LockBroadcast() -{ - m_bLockBroadcast = sal_True; -} -/* -----------------11.12.2002 09:21----------------- - * - * --------------------------------------------------*/ -void ColorConfig_Impl::UnlockBroadcast() -{ - if ( m_bBroadcastWhenUnlocked ) - { - m_bBroadcastWhenUnlocked = ColorConfig::m_pImpl != NULL; - if ( m_bBroadcastWhenUnlocked ) - { - ColorConfig::m_pImpl->ImplUpdateApplicationSettings(); - if ( ColorConfig::m_pImpl->IsEnableBroadcast() ) - { - m_bBroadcastWhenUnlocked = sal_False; - ColorConfig::m_pImpl->Broadcast(SfxSimpleHint(SFX_HINT_COLORS_CHANGED)); - } - } - } - m_bLockBroadcast = sal_False; + NotifyListeners(0); } /* -----------------------------2002/08/16 12:07 ----------------------------- #100822# @@ -500,7 +429,7 @@ ColorConfig::ColorConfig() ItemHolder2::holdConfigItem(E_COLORCFG); } ++nColorRefCount_Impl; - StartListening( *m_pImpl); + m_pImpl->AddListener(this); } /* -----------------------------16.01.01 15:36-------------------------------- @@ -508,7 +437,7 @@ ColorConfig::ColorConfig() ColorConfig::~ColorConfig() { ::osl::MutexGuard aGuard( ColorMutex_Impl::get() ); - EndListening( *m_pImpl); + m_pImpl->RemoveListener(this); if(!--nColorRefCount_Impl) { delete m_pImpl; @@ -636,15 +565,6 @@ ColorConfigValue ColorConfig::GetColorValue(ColorConfigEntry eEntry, sal_Bool bS return aRet; } -/* -----------------------------12.04.2002 09:25------------------------------ - - ---------------------------------------------------------------------------*/ -void ColorConfig::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - vos::OGuard aVclGuard( Application::GetSolarMutex() ); - - Broadcast( rHint ); -} /* -----------------------------25.03.2002 12:01------------------------------ ---------------------------------------------------------------------------*/ @@ -652,14 +572,14 @@ EditableColorConfig::EditableColorConfig() : m_pImpl(new ColorConfig_Impl), m_bModified(sal_False) { - m_pImpl->LockBroadcast(); + m_pImpl->BlockBroadcasts(TRUE); } /*-- 25.03.2002 12:03:08--------------------------------------------------- -----------------------------------------------------------------------*/ EditableColorConfig::~EditableColorConfig() { - m_pImpl->UnlockBroadcast(); + m_pImpl->BlockBroadcasts(FALSE); if(m_bModified) m_pImpl->SetModified(); if(m_pImpl->IsModified()) @@ -757,12 +677,12 @@ void EditableColorConfig::Commit() // ----------------------------------------------------------------------------- void EditableColorConfig::DisableBroadcast() { - m_pImpl->DisableBroadcast(); + m_pImpl->BlockBroadcasts(TRUE); } // ----------------------------------------------------------------------------- void EditableColorConfig::EnableBroadcast() { - m_pImpl->EnableBroadcast(); + m_pImpl->BlockBroadcasts(FALSE); } // ----------------------------------------------------------------------------- diff --git a/svtools/source/config/extcolorcfg.cxx b/svtools/source/config/extcolorcfg.cxx index 4610a1571baf..89bf41ac9f58 100644 --- a/svtools/source/config/extcolorcfg.cxx +++ b/svtools/source/config/extcolorcfg.cxx @@ -27,11 +27,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ - -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" #include "extcolorcfg.hxx" #include <com/sun/star/uno/Any.hxx> @@ -43,8 +40,8 @@ #include <unotools/configitem.hxx> #include <unotools/configpathes.hxx> #include <com/sun/star/uno/Sequence.h> -#include <svtools/poolitem.hxx> //Any2Bool -#include <svtools/smplhint.hxx> +#include <svl/poolitem.hxx> //Any2Bool +#include <svl/smplhint.hxx> #include <vos/mutex.hxx> /* #100822# ---- diff --git a/svtools/source/config/fontsubstconfig.cxx b/svtools/source/config/fontsubstconfig.cxx index 8fe799dec67a..dc9bfa64e6d4 100644 --- a/svtools/source/config/fontsubstconfig.cxx +++ b/svtools/source/config/fontsubstconfig.cxx @@ -31,13 +31,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - #include "fontsubstconfig.hxx" -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> @@ -129,6 +124,10 @@ SvtFontSubstConfig::~SvtFontSubstConfig() /*-- 18.01.01 12:08:00--------------------------------------------------- -----------------------------------------------------------------------*/ +void SvtFontSubstConfig::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& ) +{ +} + void SvtFontSubstConfig::Commit() { Sequence<OUString> aNames(1); diff --git a/svtools/source/config/helpopt.cxx b/svtools/source/config/helpopt.cxx index 0ca09c176072..16982a695e11 100644 --- a/svtools/source/config/helpopt.cxx +++ b/svtools/source/config/helpopt.cxx @@ -31,11 +31,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - #include <svtools/helpopt.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> diff --git a/svtools/source/config/itemholder2.cxx b/svtools/source/config/itemholder2.cxx index 590e0f85ade1..759fabbee686 100644 --- a/svtools/source/config/itemholder2.cxx +++ b/svtools/source/config/itemholder2.cxx @@ -31,11 +31,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - #include "itemholder2.hxx" //----------------------------------------------- @@ -45,18 +40,12 @@ #include <svtools/accessibilityoptions.hxx> #include <apearcfg.hxx> -#include <svtools/cjkoptions.hxx> +#include <svtools/menuoptions.hxx> #include <svtools/colorcfg.hxx> -#include <svtools/ctloptions.hxx> #include <fontsubstconfig.hxx> #include <svtools/helpopt.hxx> -#include <svtools/languageoptions.hxx> -#include <misccfg.hxx> #include <svtools/printoptions.hxx> -#include <svtools/syslocaleoptions.hxx> -#include <svtools/undoopt.hxx> -#include <svtools/useroptions.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> #include <svtools/miscopt.hxx> @@ -178,18 +167,10 @@ void ItemHolder2::impl_newItem(TItemInfo& rItem) // no ref count rItem.pItem = new SvtTabAppearanceCfg(); break; - case E_CJKOPTIONS : - rItem.pItem = new SvtCJKOptions(); - break; - case E_COLORCFG : rItem.pItem = new ::svtools::ColorConfig(); break; - case E_CTLOPTIONS : - rItem.pItem = new SvtCTLOptions(); - break; - case E_FONTSUBSTCONFIG : // no ref count rItem.pItem = new SvtFontSubstConfig(); break; @@ -198,12 +179,8 @@ void ItemHolder2::impl_newItem(TItemInfo& rItem) rItem.pItem = new SvtHelpOptions(); break; - case E_LANGUAGEOPTIONS : -// capsulate CTL and CJL options ! rItem.pItem = new SvtLanguageOptions(); - break; - - case E_MISCCFG : -// no ref count rItem.pItem = new SfxMiscCfg(); + case E_MENUOPTIONS : + rItem.pItem = new SvtMenuOptions(); break; case E_PRINTOPTIONS : @@ -214,17 +191,6 @@ void ItemHolder2::impl_newItem(TItemInfo& rItem) rItem.pItem = new SvtPrintFileOptions(); break; - case E_SYSLOCALEOPTIONS : - rItem.pItem = new SvtSysLocaleOptions(); - break; - - case E_UNDOOPTIONS : - rItem.pItem = new SvtUndoOptions(); - break; - - case E_USEROPTIONS : - rItem.pItem = new SvtUserOptions(); - break; case E_MISCOPTIONS : rItem.pItem = new SvtMiscOptions(); break; diff --git a/svtools/source/config/itemholder2.hxx b/svtools/source/config/itemholder2.hxx index d32eee1fc093..192df8f746c9 100644 --- a/svtools/source/config/itemholder2.hxx +++ b/svtools/source/config/itemholder2.hxx @@ -34,7 +34,7 @@ //----------------------------------------------- // includes -#include "itemholderbase.hxx" +#include <unotools/itemholderbase.hxx> #include <cppuhelper/implbase1.hxx> #include <com/sun/star/lang/XEventListener.hpp> diff --git a/svtools/source/config/makefile.mk b/svtools/source/config/makefile.mk index 9c0985329eb3..9de32bd9e43d 100644 --- a/svtools/source/config/makefile.mk +++ b/svtools/source/config/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # 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 @@ -32,80 +32,28 @@ PRJ=..$/.. PRJNAME=svtools TARGET=config -TARGET1=heavyconfig -LIBTARGET=NO ENABLE_EXCEPTIONS := TRUE # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svl.pmk +.INCLUDE : $(PRJ)$/util$/svt.pmk # --- Files -------------------------------------------------------- -SLOFILES = $(LIB1OBJFILES) $(LIB2OBJFILES) - -# --- config.lib Files -------------------------------------------------------- -LIB1TARGET= $(SLB)$/$(TARGET).lib - -LIB1OBJFILES= \ - $(SLO)$/accelcfg.obj \ - $(SLO)$/fltrcfg.obj \ - $(SLO)$/xmlaccelcfg.obj \ - $(SLO)$/moduleoptions.obj \ - $(SLO)$/pathoptions.obj \ - $(SLO)$/saveopt.obj \ - $(SLO)$/lingucfg.obj \ - $(SLO)$/javaoptions.obj \ - $(SLO)$/securityoptions.obj \ - $(SLO)$/localisationoptions.obj \ - $(SLO)$/workingsetoptions.obj \ - $(SLO)$/viewoptions.obj \ - $(SLO)$/internaloptions.obj \ - $(SLO)$/startoptions.obj \ - $(SLO)$/historyoptions.obj \ - $(SLO)$/inetoptions.obj \ - $(SLO)$/menuoptions.obj \ - $(SLO)$/dynamicmenuoptions.obj \ - $(SLO)$/optionsdrawinglayer.obj \ - $(SLO)$/fontoptions.obj \ - $(SLO)$/addxmltostorageoptions.obj \ - $(SLO)$/defaultoptions.obj \ - $(SLO)$/searchopt.obj \ - $(SLO)$/printwarningoptions.obj \ - $(SLO)$/cacheoptions.obj \ - $(SLO)$/regoptions.obj \ - $(SLO)$/cmdoptions.obj \ - $(SLO)$/extendedsecurityoptions.obj \ - $(SLO)$/sourceviewconfig.obj \ - $(SLO)$/compatibility.obj \ - $(SLO)$/eventcfg.obj \ - $(SLO)$/optionsdlg.obj \ - $(SLO)$/itemholder1.obj \ - $(SLO)$/options.obj - -# $(SLO)$/miscopt.obj \ -# --- heavyconfig.lib Files -------------------------------------------------------- -LIB2TARGET= $(SLB)$/$(TARGET1).lib - -LIB2OBJFILES= \ - $(SLO)$/accessibilityoptions.obj \ - $(SLO)$/fontsubstconfig.obj \ - $(SLO)$/misccfg.obj \ - $(SLO)$/apearcfg.obj \ - $(SLO)$/helpopt.obj \ - $(SLO)$/printoptions.obj \ - $(SLO)$/languageoptions.obj \ - $(SLO)$/ctloptions.obj \ - $(SLO)$/cjkoptions.obj \ - $(SLO)$/colorcfg.obj \ - $(SLO)$/extcolorcfg.obj \ - $(SLO)$/undoopt.obj \ - $(SLO)$/useroptions.obj \ - $(SLO)$/syslocaleoptions.obj \ - $(SLO)$/itemholder2.obj \ - $(SLO)$/miscopt.obj +SLOFILES= \ + $(SLO)$/accessibilityoptions.obj \ + $(SLO)$/apearcfg.obj \ + $(SLO)$/colorcfg.obj \ + $(SLO)$/extcolorcfg.obj \ + $(SLO)$/fontsubstconfig.obj \ + $(SLO)$/helpopt.obj \ + $(SLO)$/itemholder2.obj \ + $(SLO)$/menuoptions.obj \ + $(SLO)$/miscopt.obj \ + $(SLO)$/optionsdrawinglayer.obj \ + $(SLO)$/printoptions.obj # --- Targets ------------------------------------------------------ diff --git a/svtools/source/config/menuoptions.cxx b/svtools/source/config/menuoptions.cxx index 2d0e8d905ad9..8c00d7165ba5 100644 --- a/svtools/source/config/menuoptions.cxx +++ b/svtools/source/config/menuoptions.cxx @@ -46,7 +46,7 @@ #include <vcl/svapp.hxx> #include <rtl/logfile.hxx> -#include "itemholder1.hxx" +#include "itemholder2.hxx" //_________________________________________________________________________________________________________________ // namespaces @@ -111,8 +111,8 @@ class SvtMenuOptions_Impl : public ConfigItem SvtMenuOptions_Impl(); ~SvtMenuOptions_Impl(); - void AddListener( const Link& rLink ); - void RemoveListener( const Link& rLink ); + void AddListenerLink( const Link& rLink ); + void RemoveListenerLink( const Link& rLink ); //--------------------------------------------------------------------------------------------------------- // overloaded methods of baseclass @@ -412,12 +412,12 @@ Sequence< OUString > SvtMenuOptions_Impl::impl_GetPropertyNames() return seqPropertyNames; } -void SvtMenuOptions_Impl::AddListener( const Link& rLink ) +void SvtMenuOptions_Impl::AddListenerLink( const Link& rLink ) { aList.Insert( new Link( rLink ) ); } -void SvtMenuOptions_Impl::RemoveListener( const Link& rLink ) +void SvtMenuOptions_Impl::RemoveListenerLink( const Link& rLink ) { for ( USHORT n=0; n<aList.Count(); n++ ) { @@ -452,7 +452,7 @@ SvtMenuOptions::SvtMenuOptions() RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtMenuOptions_Impl::ctor()"); m_pDataContainer = new SvtMenuOptions_Impl(); - ItemHolder1::holdConfigItem(E_MENUOPTIONS); + ItemHolder2::holdConfigItem(E_MENUOPTIONS); } } @@ -553,12 +553,12 @@ Mutex& SvtMenuOptions::GetOwnStaticMutex() return *pMutex; } -void SvtMenuOptions::AddListener( const Link& rLink ) +void SvtMenuOptions::AddListenerLink( const Link& rLink ) { - m_pDataContainer->AddListener( rLink ); + m_pDataContainer->AddListenerLink( rLink ); } -void SvtMenuOptions::RemoveListener( const Link& rLink ) +void SvtMenuOptions::RemoveListenerLink( const Link& rLink ) { - m_pDataContainer->RemoveListener( rLink ); + m_pDataContainer->RemoveListenerLink( rLink ); } diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx index 7a6dc4281da6..af6861a5104f 100644 --- a/svtools/source/config/miscopt.cxx +++ b/svtools/source/config/miscopt.cxx @@ -33,10 +33,6 @@ //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION #include <svtools/miscopt.hxx> #include <unotools/configmgr.hxx> @@ -231,8 +227,8 @@ class SvtMiscOptions_Impl : public ConfigItem inline sal_Bool IsUseSystemPrintDialogReadOnly() const { return m_bIsUseSystemPrintDialogRO; } - void AddListener( const Link& rLink ); - void RemoveListener( const Link& rLink ); + void AddListenerLink( const Link& rLink ); + void RemoveListenerLink( const Link& rLink ); void CallListeners(); //------------------------------------------------------------------------------------------------------------- @@ -260,42 +256,6 @@ class SvtMiscOptions_Impl : public ConfigItem void ImplSetSymbolsStyle( bool bValue, sal_Int16 nSet, const ::rtl::OUString &rName ); }; -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -static sal_Int16 implSymbolsStyleFromVCL( ULONG nStyle ) -{ - switch ( nStyle ) - { - case STYLE_SYMBOLS_AUTO: return SFX_SYMBOLS_STYLE_AUTO; - case STYLE_SYMBOLS_DEFAULT: return SFX_SYMBOLS_STYLE_DEFAULT; - case STYLE_SYMBOLS_HICONTRAST: return SFX_SYMBOLS_STYLE_HICONTRAST; - case STYLE_SYMBOLS_INDUSTRIAL: return SFX_SYMBOLS_STYLE_INDUSTRIAL; - case STYLE_SYMBOLS_CRYSTAL: return SFX_SYMBOLS_STYLE_CRYSTAL; - case STYLE_SYMBOLS_TANGO: return SFX_SYMBOLS_STYLE_TANGO; - case STYLE_SYMBOLS_CLASSIC: return SFX_SYMBOLS_STYLE_CLASSIC; - } - - return SFX_SYMBOLS_STYLE_AUTO; -} - -static ULONG implSymbolsStyleToVCL( sal_Int16 nStyle ) -{ - switch ( nStyle ) - { - case SFX_SYMBOLS_STYLE_AUTO: return STYLE_SYMBOLS_AUTO; - case SFX_SYMBOLS_STYLE_DEFAULT: return STYLE_SYMBOLS_DEFAULT; - case SFX_SYMBOLS_STYLE_HICONTRAST: return STYLE_SYMBOLS_HICONTRAST; - case SFX_SYMBOLS_STYLE_INDUSTRIAL: return STYLE_SYMBOLS_INDUSTRIAL; - case SFX_SYMBOLS_STYLE_CRYSTAL: return STYLE_SYMBOLS_CRYSTAL; - case SFX_SYMBOLS_STYLE_TANGO: return STYLE_SYMBOLS_TANGO; - case SFX_SYMBOLS_STYLE_CLASSIC: return STYLE_SYMBOLS_CLASSIC; - } - - return STYLE_SYMBOLS_AUTO; -} - //***************************************************************************************************************** // constructor //***************************************************************************************************************** @@ -503,12 +463,12 @@ void SvtMiscOptions_Impl::Load( const Sequence< OUString >& rPropertyNames ) } } -void SvtMiscOptions_Impl::AddListener( const Link& rLink ) +void SvtMiscOptions_Impl::AddListenerLink( const Link& rLink ) { aList.Insert( new Link( rLink ) ); } -void SvtMiscOptions_Impl::RemoveListener( const Link& rLink ) +void SvtMiscOptions_Impl::RemoveListenerLink( const Link& rLink ) { for ( USHORT n=0; n<aList.Count(); n++ ) { @@ -543,7 +503,7 @@ void SvtMiscOptions_Impl::SetSymbolsSize( sal_Int16 nSet ) sal_Int16 SvtMiscOptions_Impl::GetSymbolsStyle() const { - return implSymbolsStyleFromVCL( Application::GetSettings().GetStyleSettings().GetSymbolsStyle() ); + return (sal_Int16)Application::GetSettings().GetStyleSettings().GetSymbolsStyle(); } ::rtl::OUString SvtMiscOptions_Impl::GetSymbolsStyleName() const @@ -553,7 +513,7 @@ sal_Int16 SvtMiscOptions_Impl::GetSymbolsStyle() const sal_Int16 SvtMiscOptions_Impl::GetCurrentSymbolsStyle() const { - return implSymbolsStyleFromVCL( Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyle() ); + return (sal_Int16)Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyle(); } void SvtMiscOptions_Impl::ImplSetSymbolsStyle( bool bValue, sal_Int16 nSet, const ::rtl::OUString &rName ) @@ -565,7 +525,7 @@ void SvtMiscOptions_Impl::ImplSetSymbolsStyle( bool bValue, sal_Int16 nSet, cons StyleSettings aStyleSettings = aAllSettings.GetStyleSettings(); if ( bValue ) - aStyleSettings.SetSymbolsStyle( implSymbolsStyleToVCL( nSet ) ); + aStyleSettings.SetSymbolsStyle( nSet ); else aStyleSettings.SetSymbolsStyleName( rName ); @@ -863,12 +823,12 @@ Mutex & SvtMiscOptions::GetInitMutex() return *pMutex; } -void SvtMiscOptions::AddListener( const Link& rLink ) +void SvtMiscOptions::AddListenerLink( const Link& rLink ) { - m_pDataContainer->AddListener( rLink ); + m_pDataContainer->AddListenerLink( rLink ); } -void SvtMiscOptions::RemoveListener( const Link& rLink ) +void SvtMiscOptions::RemoveListenerLink( const Link& rLink ) { - m_pDataContainer->RemoveListener( rLink ); + m_pDataContainer->RemoveListenerLink( rLink ); } diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx index abb044c7863e..43490c5ea79e 100644 --- a/svtools/source/config/optionsdrawinglayer.cxx +++ b/svtools/source/config/optionsdrawinglayer.cxx @@ -27,6 +27,9 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svtools.hxx" + #ifdef _MSC_VER #pragma hdrstop #endif @@ -191,6 +194,7 @@ public: //--------------------------------------------------------------------------------------------------------- virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames); //--------------------------------------------------------------------------------------------------------- // public interface @@ -735,6 +739,10 @@ void SvtOptionsDrawinglayer_Impl::Commit() PutProperties( aSeqNames, aSeqValues ); } +void SvtOptionsDrawinglayer_Impl::Notify( const com::sun::star::uno::Sequence<rtl::OUString>& ) +{ +} + //***************************************************************************************************************** // public method //***************************************************************************************************************** diff --git a/svtools/source/config/printoptions.cxx b/svtools/source/config/printoptions.cxx index 0f54366c47f6..9627a2ce10d9 100644 --- a/svtools/source/config/printoptions.cxx +++ b/svtools/source/config/printoptions.cxx @@ -31,11 +31,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ @@ -73,7 +68,7 @@ #endif #ifndef _SVT_LOGHELPER_HXX -#include <loghelper.hxx> +#include <unotools/loghelper.hxx> #endif #include <itemholder2.hxx> diff --git a/svtools/source/config/test/test.cxx b/svtools/source/config/test/test.cxx index 4090f7cb8bf5..1ac0038b5131 100644 --- a/svtools/source/config/test/test.cxx +++ b/svtools/source/config/test/test.cxx @@ -42,7 +42,7 @@ // my own includes //_________________________________________________________________________________________________________________ -#include <svtools/dynamicmenuoptions.hxx> +#include <unotools/dynamicmenuoptions.hxx> //_________________________________________________________________________________________________________________ // interface includes diff --git a/svtools/source/contnr/contentenumeration.cxx b/svtools/source/contnr/contentenumeration.cxx index af379db9b12b..a0e6b353dfb6 100644 --- a/svtools/source/contnr/contentenumeration.cxx +++ b/svtools/source/contnr/contentenumeration.cxx @@ -31,7 +31,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" #include "contentenumeration.hxx" -#include <svtools/urlfilter.hxx> +#include <svl/urlfilter.hxx> #include <svtools/inettbc.hxx> #include "imagemgr.hxx" diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 274557051c27..7fddf18ee266 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -37,7 +37,7 @@ #include <svtools/headbar.hxx> #include <svtools/svtabbx.hxx> -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #include "fileview.hrc" #include "contentenumeration.hxx" #include <svtools/AccessibleBrowseBoxObjType.hxx> @@ -78,8 +78,8 @@ #include <vcl/sound.hxx> #include <unotools/ucbhelper.hxx> #include <unotools/intlwrapper.hxx> -#include <svtools/syslocale.hxx> -#include <svtools/urlfilter.hxx> +#include <unotools/syslocale.hxx> +#include <svl/urlfilter.hxx> using namespace ::com::sun::star::lang; using namespace ::com::sun::star::sdbc; @@ -167,7 +167,7 @@ namespace static sal_Bool isHighContrast( const Window* _pView ) { - return _pView->GetDisplayBackground().GetColor().IsDark(); + return _pView->GetSettings().GetStyleSettings().GetHighContrastMode(); } // ----------------------------------------------------------------------- diff --git a/svtools/source/contnr/fileview.src b/svtools/source/contnr/fileview.src index c86db1ce418a..9d1cdb618cda 100644 --- a/svtools/source/contnr/fileview.src +++ b/svtools/source/contnr/fileview.src @@ -30,7 +30,7 @@ // includes ------------------------------------------------------------------ -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #include "fileview.hrc" #include <svtools/helpid.hrc> diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index d4ec597aebfc..d443beb7fff9 100644 --- a/svtools/source/contnr/imivctl.hxx +++ b/svtools/source/contnr/imivctl.hxx @@ -45,7 +45,7 @@ #include <limits.h> #include "ivctrl.hxx" -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> class IcnCursor_Impl; class SvtIconChoiceCtrl; diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx index c0f40fd306df..916738af70ae 100644 --- a/svtools/source/contnr/ivctrl.cxx +++ b/svtools/source/contnr/ivctrl.cxx @@ -201,7 +201,7 @@ BOOL SvtIconChoiceCtrl::EditingEntry( SvxIconChoiceCtrlEntry* ) } void SvtIconChoiceCtrl::DrawEntryImage( SvxIconChoiceCtrlEntry* pEntry, const Point& rPos, OutputDevice& rDev ) { - rDev.DrawImage ( rPos, GetDisplayBackground().GetColor().IsDark() ? pEntry->GetImageHC() : pEntry->GetImage() ); + rDev.DrawImage( rPos, GetSettings().GetStyleSettings().GetHighContrastMode() ? pEntry->GetImageHC() : pEntry->GetImage() ); } String SvtIconChoiceCtrl::GetEntryText( SvxIconChoiceCtrlEntry* pEntry, BOOL ) { @@ -579,8 +579,7 @@ Rectangle SvtIconChoiceCtrl::GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) co void SvtIconChoiceCtrl::FillLayoutData() const { - DBG_ASSERT( !mpLayoutData, "SvtIconChoiceCtrl::FillLayoutData: shouldn't this be called with non-existent layout data only?" ); - mpLayoutData = new ::vcl::ControlLayoutData(); + CreateLayoutData(); SvtIconChoiceCtrl* pNonConstMe = const_cast< SvtIconChoiceCtrl* >( this ); @@ -598,7 +597,7 @@ void SvtIconChoiceCtrl::FillLayoutData() const sal_Bool bLargeIconMode = WB_ICON == ( _pImp->GetStyle() & ( VIEWMODE_MASK ) ); sal_uInt16 nTextPaintFlags = bLargeIconMode ? PAINTFLAG_HOR_CENTERED : PAINTFLAG_VER_CENTERED; - _pImp->PaintItem( aTextRect, IcnViewFieldTypeText, pEntry, nTextPaintFlags, pNonConstMe, &sEntryText, mpLayoutData ); + _pImp->PaintItem( aTextRect, IcnViewFieldTypeText, pEntry, nTextPaintFlags, pNonConstMe, &sEntryText, GetLayoutData() ); ++nPos; } diff --git a/svtools/source/contnr/svcontnr.src b/svtools/source/contnr/svcontnr.src index c26c906eb3f6..f81bc3fdfa9b 100644 --- a/svtools/source/contnr/svcontnr.src +++ b/svtools/source/contnr/svcontnr.src @@ -28,7 +28,7 @@ * ************************************************************************/ -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> Image RID_IMG_TREENODE_COLLAPSED { diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index e17b81e548a9..f2674279f4df 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -50,7 +50,7 @@ #include <svtools/svtdata.hxx> #ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #endif // #102891# -------------------- diff --git a/svtools/source/contnr/svimpicn.cxx b/svtools/source/contnr/svimpicn.cxx index 37ee096dc6d9..8d7a79701d27 100644 --- a/svtools/source/contnr/svimpicn.cxx +++ b/svtools/source/contnr/svimpicn.cxx @@ -46,7 +46,7 @@ #ifndef _SVLBITM_HXX #include <svtools/svlbitm.hxx> #endif -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx index ccd98e6a32a1..e9125b7fb2e1 100644 --- a/svtools/source/contnr/svlbitm.cxx +++ b/svtools/source/contnr/svlbitm.cxx @@ -590,8 +590,7 @@ void SvLBoxContextBmp::Paint( const Point& _rPos, SvLBox& _rDev, BmpColorMode eMode( BMP_COLOR_NORMAL ); if ( !!m_pImpl->m_aImage1_hc ) { // we really have HC images - const Wallpaper& rDeviceBackground = _rDev.GetDisplayBackground(); - if ( rDeviceBackground.GetColor().IsDark() ) + if ( _rDev.GetSettings().GetStyleSettings().GetHighContrastMode() ) eMode = BMP_COLOR_HIGHCONTRAST; } diff --git a/svtools/source/contnr/svlbox.cxx b/svtools/source/contnr/svlbox.cxx index e56db398b8fb..77a9a3798d6d 100644 --- a/svtools/source/contnr/svlbox.cxx +++ b/svtools/source/contnr/svlbox.cxx @@ -48,7 +48,7 @@ #include <rtl/instance.hxx> #define _SVSTDARR_ULONGSSORT -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #ifndef _SVEDI_HXX #include <svtools/svmedit.hxx> diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx index 1770810c7a5d..3b4907e7a80d 100644 --- a/svtools/source/contnr/svtabbx.cxx +++ b/svtools/source/contnr/svtabbx.cxx @@ -34,7 +34,7 @@ #include <svtools/headbar.hxx> #include <svtools/svtdata.hxx> #ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #endif #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx index a697928842af..503325ddf802 100644 --- a/svtools/source/contnr/svtreebx.cxx +++ b/svtools/source/contnr/svtreebx.cxx @@ -1813,7 +1813,7 @@ long SvTreeListBox::PaintEntry1(SvLBoxEntry* pEntry,long nLine,USHORT nTabFlags, const Image* pImg = 0; BmpColorMode eBitmapMode = BMP_COLOR_NORMAL; - if ( GetDisplayBackground().GetColor().IsDark() ) + if ( GetSettings().GetStyleSettings().GetHighContrastMode() ) eBitmapMode = BMP_COLOR_HIGHCONTRAST; if( IsExpanded(pEntry) ) diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index 2b212fdcffeb..06de35ba19aa 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -33,18 +33,18 @@ #include "templwin.hxx" #include "templdlg.hxx" #include <svtools/svtdata.hxx> -#include <svtools/pathoptions.hxx> -#include <svtools/dynamicmenuoptions.hxx> -#include <svtools/extendedsecurityoptions.hxx> +#include <unotools/pathoptions.hxx> +#include <unotools/dynamicmenuoptions.hxx> +#include <unotools/extendedsecurityoptions.hxx> #include <svtools/xtextedt.hxx> -#include <svtools/inettype.hxx> +#include <svl/inettype.hxx> #include "imagemgr.hxx" #include <svtools/miscopt.hxx> #include "templatefoldercache.hxx" #include "imgdef.hxx" #include "txtattr.hxx" #ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #endif #ifndef _SVTOOLS_TEMPLWIN_HRC #include "templwin.hrc" @@ -52,8 +52,8 @@ #ifndef _SVT_HELPID_HRC #include <svtools/helpid.hrc> #endif -#include <svtools/pathoptions.hxx> -#include <svtools/viewoptions.hxx> +#include <unotools/pathoptions.hxx> +#include <unotools/viewoptions.hxx> #include <unotools/ucbhelper.hxx> #include "unotools/configmgr.hxx" @@ -369,7 +369,7 @@ SvtIconWindow_Impl::SvtIconWindow_Impl( Window* pParent ) : // insert the categories // "New Document" - sal_Bool bHiContrast = GetBackground().GetColor().IsDark(); + sal_Bool bHiContrast = GetSettings().GetStyleSettings().GetHighContrastMode(); Image aImage( SvtResId( bHiContrast ? IMG_SVT_NEWDOC_HC : IMG_SVT_NEWDOC ) ); nMaxTextLength = aImage.GetSizePixel().Width(); String aEntryStr = String( SvtResId( STR_SVT_NEWDOC ) ); @@ -1348,7 +1348,7 @@ void SvtTemplateWindow::InitToolBoxImages() { SvtMiscOptions aMiscOpt; BOOL bLarge = aMiscOpt.AreCurrentSymbolsLarge(); - sal_Bool bHiContrast = aFileViewTB.GetBackground().GetColor().IsDark(); + sal_Bool bHiContrast = aFileViewTB.GetSettings().GetStyleSettings().GetHighContrastMode(); aFileViewTB.SetItemImage( TI_DOCTEMPLATE_BACK, Image( SvtResId( bLarge ? bHiContrast ? IMG_SVT_DOCTEMPL_HC_BACK_LARGE : IMG_SVT_DOCTEMPLATE_BACK_LARGE @@ -1372,7 +1372,7 @@ void SvtTemplateWindow::InitToolBoxImages() void SvtTemplateWindow::UpdateIcons() { - pIconWin->UpdateIcons( aFileViewTB.GetBackground().GetColor().IsDark() ); + pIconWin->UpdateIcons( aFileViewTB.GetSettings().GetStyleSettings().GetHighContrastMode() ); } // ------------------------------------------------------------------------ diff --git a/svtools/source/contnr/templwin.hxx b/svtools/source/contnr/templwin.hxx index bd3eb4afd5dd..050ba7ab6739 100644 --- a/svtools/source/contnr/templwin.hxx +++ b/svtools/source/contnr/templwin.hxx @@ -38,7 +38,7 @@ #include "fileview.hxx" #include "ivctrl.hxx" #include <svtools/svmedit2.hxx> -#include <svtools/restrictedpaths.hxx> +#include <svl/restrictedpaths.hxx> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/lang/Locale.hpp> diff --git a/svtools/source/contnr/templwin.src b/svtools/source/contnr/templwin.src index 30149de4da14..f7f42b7e176b 100644 --- a/svtools/source/contnr/templwin.src +++ b/svtools/source/contnr/templwin.src @@ -33,7 +33,7 @@ #include "templwin.hrc" #include "controldims.hrc" #include <svtools/helpid.hrc> -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> // Magenta and Grey as mask colors #define MASK_COL_MAGENTA Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx index eb4e533b628c..c1491571dd1c 100644 --- a/svtools/source/contnr/treelist.cxx +++ b/svtools/source/contnr/treelist.cxx @@ -38,7 +38,7 @@ #include <svtools/treelist.hxx> -#ifndef PRODUCT +#ifdef DBG_UTIL // Prueft Integritaet der Liste nach jeder Operation //#define CHECK_INTEGRITY #endif diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx index 8ff008eaf7e4..481f6f2ceeae 100644 --- a/svtools/source/control/calendar.cxx +++ b/svtools/source/control/calendar.cxx @@ -62,7 +62,7 @@ #include <com/sun/star/i18n/CalendarFieldIndex.hpp> #define _SV_CALENDAR_CXX -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #include <svtools/svtdata.hxx> #include <calendar.hxx> diff --git a/svtools/source/control/calendar.src b/svtools/source/control/calendar.src index 44bffd361847..043dd9808663 100644 --- a/svtools/source/control/calendar.src +++ b/svtools/source/control/calendar.src @@ -28,7 +28,7 @@ * ************************************************************************/ -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> String STR_SVT_CALENDAR_DAY { Text [ en-US ] = "Day" ; diff --git a/svtools/source/control/collatorres.cxx b/svtools/source/control/collatorres.cxx index 692d470b8f5b..c976d7442bc0 100644 --- a/svtools/source/control/collatorres.cxx +++ b/svtools/source/control/collatorres.cxx @@ -32,7 +32,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" #include <svtools/svtdata.hxx> -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #include <collatorres.hxx> diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 5be239a5593e..b0d20bf7ce30 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -43,7 +43,7 @@ #include <unotools/charclass.hxx> #include <svtools/svtdata.hxx> -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #include <ctrlbox.hxx> #include <ctrltool.hxx> @@ -644,8 +644,7 @@ void FontNameBox::DataChanged( const DataChangedEvent& rDCEvt ) void FontNameBox::InitBitmaps( void ) { - Color aCol = GetSettings().GetStyleSettings().GetWindowColor(); - BOOL bHC = aCol.IsDark(); + BOOL bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); maImagePrinterFont = Image( SvtResId( bHC? RID_IMG_PRINTERFONT_HC : RID_IMG_PRINTERFONT ) ); maImageBitmapFont = Image( SvtResId( bHC? RID_IMG_BITMAPFONT_HC : RID_IMG_BITMAPFONT ) ); diff --git a/svtools/source/control/ctrlbox.src b/svtools/source/control/ctrlbox.src index 5cfee79e5f11..05c75577cdbf 100644 --- a/svtools/source/control/ctrlbox.src +++ b/svtools/source/control/ctrlbox.src @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #ifndef IMAGE_STDBTN_COLOR #define IMAGE_STDBTN_COLOR Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; } diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index 77bb996584bd..1573ed531662 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -45,7 +45,7 @@ #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #include <svtools/svtdata.hxx> #include <ctrltool.hxx> diff --git a/svtools/source/control/ctrltool.src b/svtools/source/control/ctrltool.src index 267a65e98517..ab8005cd9698 100644 --- a/svtools/source/control/ctrltool.src +++ b/svtools/source/control/ctrltool.src @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> String STR_SVT_STYLE_LIGHT { diff --git a/svtools/source/control/filectrl.cxx b/svtools/source/control/filectrl.cxx index d820dce097ed..f00cf45be0e6 100644 --- a/svtools/source/control/filectrl.cxx +++ b/svtools/source/control/filectrl.cxx @@ -78,6 +78,9 @@ WinBits FileControl::ImplInitStyle( WinBits nStyle ) maButton.SetStyle( (maButton.GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) ); } + const WinBits nAlignmentStyle = ( WB_TOP | WB_VCENTER | WB_BOTTOM ); + maEdit.SetStyle( ( maEdit.GetStyle() & ~nAlignmentStyle ) | ( nStyle & nAlignmentStyle ) ); + if ( !(nStyle & WB_NOGROUP) ) nStyle |= WB_GROUP; diff --git a/svtools/source/control/fileurlbox.cxx b/svtools/source/control/fileurlbox.cxx index 936f8b3e25c5..554f713fd4d6 100644 --- a/svtools/source/control/fileurlbox.cxx +++ b/svtools/source/control/fileurlbox.cxx @@ -32,7 +32,7 @@ #include "precompiled_svtools.hxx" #include <svtools/fileurlbox.hxx> #include <osl/file.h> -#include "filenotation.hxx" +#include "svl/filenotation.hxx" //......................................................................... namespace svt diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx index 387c1db34fc1..bbf00329cf93 100644 --- a/svtools/source/control/fmtfield.cxx +++ b/svtools/source/control/fmtfield.cxx @@ -36,7 +36,7 @@ #include <comphelper/processfactory.hxx> #include <unotools/localedatawrapper.hxx> #include <vcl/svapp.hxx> -#include <svtools/zformat.hxx> +#include <svl/zformat.hxx> #include <svtools/fmtfield.hxx> #include <i18npool/mslangid.hxx> #include <com/sun/star/lang/Locale.hpp> @@ -45,7 +45,7 @@ #include <com/sun/star/util/SearchResult.hpp> #include <com/sun/star/util/SearchFlags.hpp> #include <com/sun/star/lang/Locale.hpp> -#include <svtools/syslocale.hxx> +#include <unotools/syslocale.hxx> #ifndef REGEXP_SUPPORT #include <map> diff --git a/svtools/source/control/hyperlabel.cxx b/svtools/source/control/hyperlabel.cxx index ec8387ecb662..7d7477130e0d 100644 --- a/svtools/source/control/hyperlabel.cxx +++ b/svtools/source/control/hyperlabel.cxx @@ -107,35 +107,16 @@ namespace svt } - void HyperLabel::SetLabelAndSize(::rtl::OUString _rText, const Size& _rNewSize ) + Size HyperLabel::CalcMinimumSize( long nMaxWidth ) const { - Size rLocSize = _rNewSize; - Size rLogicLocSize = PixelToLogic( _rNewSize, MAP_APPFONT ); - SetLabel( _rText ); - ImplCalcMinimumSize( rLocSize ); - rLocSize.Height() = ( m_pImpl->m_aMinSize.Height()); -// else -// rLocSize = LogicToPixel( Size( rLogicLocSize.Width(), LABELBASEMAPHEIGHT ), MAP_APPFONT ); - SetSizePixel( rLocSize ); - Show(); - } - - sal_Bool HyperLabel::ImplCalcMinimumSize(const Size& _rCompSize ) - { - sal_Bool b_AdjustMinWidth = sal_False; - m_pImpl->m_aMinSize = CalcMinimumSize( ); - if ( m_pImpl->m_aMinSize.Width() >= _rCompSize.Width() ) // the MinimumSize is used to size the FocusRectangle - { - m_pImpl->m_aMinSize.Width() = _rCompSize.Width(); // and for the MouseMove method - m_pImpl->m_aMinSize = CalcMinimumSize(_rCompSize.Width() ); - b_AdjustMinWidth = sal_True; - } + m_pImpl->m_aMinSize = FixedText::CalcMinimumSize( nMaxWidth ); + // the MinimumSize is used to size the FocusRectangle + // and for the MouseMove method m_pImpl->m_aMinSize.Height() += 2; m_pImpl->m_aMinSize.Width() += 1; - return b_AdjustMinWidth; + return m_pImpl->m_aMinSize; } - void HyperLabel::implInit() { ToggleBackgroundColor( COL_TRANSPARENT ); @@ -234,17 +215,6 @@ namespace svt m_pImpl->bInteractive = ( _bInteractive && IsEnabled() ); } - void HyperLabel::SetHyperLabelPosition(sal_uInt16 XPos, sal_uInt16 YPos) - { - SetPosPixel( LogicToPixel( Point( XPos, YPos ), MAP_APPFONT ) ); - } - - Point HyperLabel::GetLogicalPosition() - { - Point aPoint = GetPosPixel( ); - return PixelToLogic( aPoint, MAP_APPFONT ); - } - sal_Int16 HyperLabel::GetID() const { return m_pImpl->ID; @@ -270,10 +240,9 @@ namespace svt return GetText(); } - void HyperLabel::SetLabel( ::rtl::OUString _rText ) + void HyperLabel::SetLabel( const ::rtl::OUString& _rText ) { SetText(_rText); - Show(); } diff --git a/svtools/source/control/indexentryres.cxx b/svtools/source/control/indexentryres.cxx index 49096144b215..f69e9b34e5ea 100644 --- a/svtools/source/control/indexentryres.cxx +++ b/svtools/source/control/indexentryres.cxx @@ -32,7 +32,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" #include <svtools/svtdata.hxx> -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #include <indexentryres.hxx> diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index 4a01a03ad759..b4904afee418 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -66,16 +66,16 @@ #include <vos/mutex.hxx> #endif #include <vcl/svapp.hxx> -#include <svtools/historyoptions.hxx> -#include <svtools/eitem.hxx> -#include <svtools/stritem.hxx> -#include <svtools/cancel.hxx> -#include <svtools/itemset.hxx> -#include "urihelper.hxx" -#include <svtools/pathoptions.hxx> +#include <unotools/historyoptions.hxx> +#include <svl/eitem.hxx> +#include <svl/stritem.hxx> +#include <svl/cancel.hxx> +#include <svl/itemset.hxx> +#include "svl/urihelper.hxx" +#include <unotools/pathoptions.hxx> #define _SVSTDARR_STRINGSDTOR -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <ucbhelper/commandenvironment.hxx> #include <ucbhelper/content.hxx> #include <unotools/localfilehelper.hxx> @@ -83,7 +83,7 @@ #include "iodlg.hrc" #include <asynclink.hxx> -#include <svtools/urlfilter.hxx> +#include <svl/urlfilter.hxx> #include <vector> #include <algorithm> diff --git a/svtools/source/control/makefile.mk b/svtools/source/control/makefile.mk index 10bb6beb50e4..eecf983ab756 100644 --- a/svtools/source/control/makefile.mk +++ b/svtools/source/control/makefile.mk @@ -77,7 +77,6 @@ SLOFILES=\ $(SLO)$/calendar.obj \ $(SLO)$/filectrl.obj \ $(SLO)$/scrwin.obj \ - $(SLO)$/reginfo.obj \ $(SLO)$/collatorres.obj \ $(SLO)$/indexentryres.obj \ $(SLO)$/hyperlabel.obj \ diff --git a/svtools/source/control/reginfo.cxx b/svtools/source/control/reginfo.cxx deleted file mode 100644 index 24daba5e6123..000000000000 --- a/svtools/source/control/reginfo.cxx +++ /dev/null @@ -1,375 +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: reginfo.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" - -#include "reginfo.hxx" -#include <tools/debug.hxx> -#include <osl/thread.h> - -#define MAXREGVALUE 200 - -// ***************************************************************************** -#if defined(WIN) || defined(WNT) - -#include <tools/svwin.h> - -#define DBG_HDL DBG_ASSERT(pImp->bValidGroup, "Keine Gruppe gesetzt"); \ - if( !pImp->bValidGroup ) return - -struct RegInfo_Impl -{ - HKEY aGroupHdl; - BOOL bValidGroup; -}; - -RegInfo::RegInfo() -{ - pImp=new RegInfo_Impl; - pImp->bValidGroup = FALSE; -} - -RegInfo::~RegInfo() -{ - if(pImp->bValidGroup) - RegCloseKey( pImp->aGroupHdl ); - delete pImp; -} - -String RegInfo::GetKeyName( USHORT nKey ) const -{ - DBG_HDL String::EmptyString(); - char aBuffer[MAXREGVALUE]; - RegEnumKey( pImp->aGroupHdl, nKey, aBuffer, MAXREGVALUE ); - return String( UniString::CreateFromAscii(aBuffer) ); -} - -USHORT RegInfo::GetKeyCount() const -{ - DBG_HDL 0; -#ifdef WNT - DWORD nKeys; - DWORD Dum1=10, Dum2, Dum3, Dum4, Dum5, Dum6, Dum7; - char s[10]; - FILETIME aDumFileTime; - RegQueryInfoKey( pImp->aGroupHdl, s, &Dum1, 0, &nKeys, &Dum2, &Dum3, - &Dum4, &Dum5, &Dum6, &Dum7, &aDumFileTime ); - return (USHORT) nKeys; -#else - char aBuffer[MAXREGVALUE]; - USHORT n=0; - while(RegEnumKey( - pImp->aGroupHdl, n, aBuffer, MAXREGVALUE) == ERROR_SUCCESS) - n++; - return n; -#endif -} - -inline String MakeAppGroupString_Impl( const String &rGroup ) -{ - String aGroup( UniString::CreateFromAscii("SvAppGroups\\") ); - aGroup+=rGroup; - return aGroup; -} - -void RegInfo::SetAppGroup( const String& rGroup ) -{ - aCurrentGroup = MakeAppGroupString_Impl(rGroup); - if( pImp->bValidGroup ) - { - RegCloseKey( pImp->aGroupHdl ); - pImp->bValidGroup = FALSE; - } - ByteString aBStr( aCurrentGroup, osl_getThreadTextEncoding() ); - RegCreateKey( HKEY_CLASSES_ROOT, aBStr.GetBuffer(), &pImp->aGroupHdl ); - pImp->bValidGroup = TRUE; -} - -void RegInfo::DeleteAppGroup( const String &rGroup ) -{ - String aOldGroup = aCurrentGroup; - SetAppGroup( rGroup ); - DBG_HDL; - USHORT nMax = GetKeyCount(); - for( USHORT n = nMax; n--; ) - { - String aKey( GetKeyName( n )); - DeleteKey( aKey ); - } - RegCloseKey( pImp->aGroupHdl ); - - ByteString aBStr( rGroup, osl_getThreadTextEncoding() ); - RegDeleteKey( HKEY_CLASSES_ROOT, aBStr.GetBuffer() ); - pImp->bValidGroup = FALSE; - if( rGroup != aOldGroup ) - SetAppGroup( aOldGroup ); -} - -BOOL ReadKey_Impl( const String& rKey, - HKEY aHdl, String& rResult ) -{ - char s[MAXREGVALUE]; - LONG aLen=MAXREGVALUE; - - ByteString aBStr( rKey, osl_getThreadTextEncoding() ); - LONG nRes = RegQueryValue( aHdl, aBStr.GetBuffer(), s, &aLen); - if(nRes == ERROR_SUCCESS) - { - rResult = UniString::CreateFromAscii(s); - return TRUE; - } - else - return FALSE; -} - -String RegInfo::ReadKey( const String& rKey ) const -{ - DBG_HDL String::EmptyString(); - String aRes; - if(ReadKey_Impl( rKey, pImp->aGroupHdl, aRes)) - return aRes; - else - return String::EmptyString(); -} - -String RegInfo::ReadKey( const String& rKey, const String &rDefault ) const -{ - DBG_HDL String::EmptyString(); - String aRes; - if(ReadKey_Impl( rKey, pImp->aGroupHdl, aRes)) - return aRes; - else - return rDefault; -} - -void RegInfo::WriteKey( const String& rKey, const String& rValue ) -{ - DBG_HDL; - ByteString aBStr( rKey, osl_getThreadTextEncoding() ); - ByteString aBStr1( rValue, osl_getThreadTextEncoding() ); - RegSetValue( pImp->aGroupHdl, aBStr.GetBuffer(), REG_SZ, aBStr1.GetBuffer(), 0); -} - - -void RegInfo::DeleteKey( const String& rKey ) -{ - DBG_HDL; - ByteString aBStr( rKey, osl_getThreadTextEncoding() ); - RegDeleteKey( pImp->aGroupHdl, aBStr.GetBuffer() ); -} - -// ***************************************************************************** -#elif defined(OS2) - -#define INCL_WINSHELLDATA -#include <svpm.h> - -struct RegInfo_Impl -{ - char *pKeyList; - String aCurrentApp; - void BuildKeyList( const String &rGroup ); -}; - -void RegInfo_Impl::BuildKeyList( const String &rGroup ) -{ - ByteString aBStr( rGroup, osl_getThreadTextEncoding() ); - USHORT nLen = 0; - do - { - nLen+=1000; - delete[] pKeyList; - pKeyList = new char[nLen]; - *(int *)pKeyList = 0; - } - while( PrfQueryProfileString( - HINI_USERPROFILE, (PCSZ)aBStr.GetBuffer(), - 0, 0, pKeyList, nLen) == nLen); -} - - -RegInfo::RegInfo() -{ - pImp=new RegInfo_Impl; - pImp->pKeyList = 0; -} - -RegInfo::~RegInfo() -{ - delete[] pImp->pKeyList; - delete pImp; -} - -inline String MakeAppGroupString_Impl( const String &rGroup ) -{ - String aGroup(UniString::CreateFromAscii("SvAppGroups:")); - aGroup+=rGroup; - return aGroup; -} - -String RegInfo::GetKeyName( USHORT nKey ) const -{ - if( !pImp->pKeyList ) - pImp->BuildKeyList(pImp->aCurrentApp); - - const char *pc=pImp->pKeyList; - for( USHORT n=0; n<nKey; n++ ) - while(*pc++); - - return String(UniString::CreateFromAscii(pc)); -} - -USHORT RegInfo::GetKeyCount() const -{ - if( !pImp->pKeyList ) - pImp->BuildKeyList( pImp->aCurrentApp); - - const char *pc=pImp->pKeyList; - USHORT nRet=0; - while(*pc) - { - while(*pc++); - nRet++; - } - return nRet; -} - -void RegInfo::SetAppGroup( const String& rGroup ) -{ - delete[] pImp->pKeyList; - pImp->pKeyList = 0; - aCurrentGroup = rGroup; - pImp->aCurrentApp = MakeAppGroupString_Impl( rGroup ); -} - -void RegInfo::DeleteAppGroup( const String &rGroup ) -{ - ByteString aBStr( MakeAppGroupString_Impl( rGroup ), osl_getThreadTextEncoding() ); - PrfWriteProfileString( - HINI_USERPROFILE, (PCSZ)aBStr.GetBuffer(), 0, 0); -} - - -String RegInfo::ReadKey( const String& rKey ) const -{ - ULONG ulBufferMax = MAXREGVALUE; - char *pBuffer= new char[MAXREGVALUE]; - ByteString aBStr( pImp->aCurrentApp, osl_getThreadTextEncoding() ); - ByteString aBStr1( rKey, osl_getThreadTextEncoding() ); - *pBuffer=0; - PrfQueryProfileData( - HINI_USERPROFILE, (PCSZ)aBStr.GetBuffer(), (PCSZ)aBStr1.GetBuffer(), pBuffer, &ulBufferMax); - String aRet(UniString::CreateFromAscii(pBuffer)); - delete[] pBuffer; - return aRet; -} - - -String RegInfo::ReadKey( const String& rKey, const String &rDefault ) const -{ - String aResult = ReadKey(rKey); - if (!aResult.Len()) - return rDefault; - else - return aResult; -} - - -void RegInfo::WriteKey( const String& rKey, const String& rValue ) -{ - ByteString aBStr( pImp->aCurrentApp, osl_getThreadTextEncoding() ); - ByteString aBStr1( rKey, osl_getThreadTextEncoding() ); - PrfWriteProfileData( - HINI_USERPROFILE, (PCSZ)aBStr.GetBuffer(), (PCSZ)aBStr1.GetBuffer(), (PVOID)rValue.GetBuffer(), rValue.Len()*2); -} - -void RegInfo::DeleteKey( const String& rKey ) -{ - ByteString aBStr( pImp->aCurrentApp, osl_getThreadTextEncoding() ); - ByteString aBStr1( rKey, osl_getThreadTextEncoding() ); - PrfWriteProfileString( - HINI_USERPROFILE, (PCSZ)aBStr.GetBuffer(), (PCSZ)rKey.GetBuffer(), 0); -} - -// ***************************************************************************** - -#else - -RegInfo::RegInfo() -{ -} - - -RegInfo::~RegInfo() -{ -} - -String RegInfo::GetKeyName( USHORT ) const -{ - return String::EmptyString(); -} - -USHORT RegInfo::GetKeyCount() const -{ - return 0; -} - -void RegInfo::SetAppGroup( const String& ) -{ - return ; -} - -void RegInfo::DeleteAppGroup( const String& ) -{ - return; -} - -String RegInfo::ReadKey( const String& ) const -{ - return String::EmptyString(); -} - -String RegInfo::ReadKey( const String&, const String& ) const -{ - return String::EmptyString(); -} - -void RegInfo::WriteKey( const String&, const String& ) -{ - return; -} - -void RegInfo::DeleteKey( const String& ) -{ - return; -} - -#endif diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx index b0e178e631d9..693bca733813 100644 --- a/svtools/source/control/roadmap.cxx +++ b/svtools/source/control/roadmap.cxx @@ -49,11 +49,10 @@ #endif #include <memory> -#define RMENTRYPOINT_X 4 -#define RMENTRYPOINT_Y 27 -#define RMITEMDISTANCE_Y 6 +#define ROADMAP_INDENT_X 4 +#define ROADMAP_INDENT_Y 27 +#define ROADMAP_ITEM_DISTANCE_Y 6 #define RMINCOMPLETE -1 -#define NREMOVERMITEM -1 #define NADDITEM 1 #define INCOMPLETELABEL ::String::CreateFromAscii("...") // TODO: Cast to String @@ -63,30 +62,18 @@ namespace svt //......................................................................... typedef std::vector< ::rtl::OUString > S_Vector; - typedef std::vector< ORoadmapHyperLabel* > HL_Vector; + typedef std::vector< RoadmapItem* > HL_Vector; //===================================================================== - //= FontChanger + //= ColorChanger //===================================================================== -// class FontChanger -// { -// protected: -// OutputDevice* m_pDev; -// -// public: -// FontChanger( OutputDevice* _pDev, const Font& _rNewFont ) -// :m_pDev( _pDev ) -// { -// m_pDev->Push( PUSH_FONT ); -// m_pDev->SetFont( _rNewFont ); -// } -// -// ~FontChanger() -// { -// m_pDev->Pop( ); -// } -// }; - + class IDLabel : public FixedText + { + public: + IDLabel( Window* _pParent, WinBits _nWinStyle = 0 ); + ~IDLabel( ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + }; //===================================================================== //= ColorChanger @@ -111,6 +98,51 @@ namespace svt } }; + //===================================================================== + //= RoadmapItem + //===================================================================== + class RoadmapItem : public RoadmapTypes + { + private: + IDLabel* mpID; + HyperLabel* mpDescription; + const Size m_aItemPlayground; + + public: + RoadmapItem( ORoadmap& _rParent, const Size& _rItemPlayground ); + ~RoadmapItem( ); + + void SetID( sal_Int16 _ID ); + sal_Int16 GetID() const; + + void SetIndex( ItemIndex _Index ); + ItemIndex GetIndex() const; + + void SetLabel( const ::rtl::OUString& _rText ); + ::rtl::OUString GetLabel( ); + + void Update( ItemIndex _RMIndex, const ::rtl::OUString& _rText ); + + void SetPosition( RoadmapItem* OldHyperLabel ); + + void ToggleBackgroundColor( const Color& _rGBColor ); + void SetInteractive( sal_Bool _bInteractive ); + + void SetClickHdl( const Link& rLink ); + const Link& GetClickHdl() const; + void SetZOrder( RoadmapItem* pRefRoadmapHyperLabel, USHORT nFlags ); + void Enable( BOOL bEnable = TRUE); + BOOL IsEnabled() const; + void GrabFocus(); + + bool Contains( const Window* _pWindow ) const; + + HyperLabel* GetDescriptionHyperLabel() const { return mpDescription; } + + private: + void ImplUpdateIndex( const ItemIndex _nIndex ); + void ImplUpdatePosSize(); + }; //===================================================================== //= RoadmapImpl @@ -118,27 +150,32 @@ namespace svt class RoadmapImpl : public RoadmapTypes { protected: + const ORoadmap& m_rAntiImpl; Link m_aSelectHdl; BitmapEx m_aPicture; HL_Vector m_aRoadmapSteps; ItemId m_iCurItemID; sal_Bool m_bInteractive; sal_Bool m_bComplete; + Size m_aItemSizePixel; public: - RoadmapImpl() : - m_bInteractive( sal_True ), - m_bComplete( sal_True ) {} + RoadmapImpl( const ORoadmap& _rAntiImpl ) + :m_rAntiImpl( _rAntiImpl ) + ,m_iCurItemID( -1 ) + ,m_bInteractive( sal_True ) + ,m_bComplete( sal_True ) + { + } - Size aHyperLabelPixelSize; - ORoadmapHyperLabel* InCompleteHyperLabel; + RoadmapItem* InCompleteHyperLabel; - void addHyperLabel( ORoadmapHyperLabel* _rRoadmapStep ) { m_aRoadmapSteps.push_back(_rRoadmapStep); } + void addHyperLabel( RoadmapItem* _rRoadmapStep ) { m_aRoadmapSteps.push_back(_rRoadmapStep); } HL_Vector& getHyperLabels() { return m_aRoadmapSteps; } const HL_Vector& getHyperLabels() const { return m_aRoadmapSteps; } - void insertHyperLabel( ItemIndex _Index, ORoadmapHyperLabel* _rRoadmapStep ) { m_aRoadmapSteps.insert( m_aRoadmapSteps.begin() + _Index, _rRoadmapStep ); } + void insertHyperLabel( ItemIndex _Index, RoadmapItem* _rRoadmapStep ) { m_aRoadmapSteps.insert( m_aRoadmapSteps.begin() + _Index, _rRoadmapStep ); } ItemIndex getItemCount() const { return m_aRoadmapSteps.size();} @@ -157,6 +194,9 @@ namespace svt void setSelectHdl( const Link& _rHdl ) { m_aSelectHdl = _rHdl; } const Link& getSelectHdl( ) const { return m_aSelectHdl; } + void initItemSize(); + const Size& getItemSize() const { return m_aItemSizePixel; } + void removeHyperLabel( ItemIndex _Index ) { if ( ( _Index > -1 ) && ( _Index < getItemCount() ) ) @@ -172,8 +212,21 @@ namespace svt //= Roadmap //===================================================================== //--------------------------------------------------------------------- - ORoadmap::ORoadmap( Window* _pParent, const ResId& _rId ):Control( _pParent, _rId ) - ,m_pImpl( new RoadmapImpl() ) + void RoadmapImpl::initItemSize() + { + Size aLabelSize( m_rAntiImpl.GetOutputSizePixel() ); + aLabelSize.Height() = m_rAntiImpl.LogicToPixel( Size( 0, LABELBASEMAPHEIGHT ), MAP_APPFONT ).Height(); + aLabelSize.Width() -= m_rAntiImpl.LogicToPixel( Size( 2 * ROADMAP_INDENT_X, 0 ), MAP_APPFONT ).Width(); + m_aItemSizePixel = aLabelSize; + } + + //===================================================================== + //= Roadmap + //===================================================================== + //--------------------------------------------------------------------- + ORoadmap::ORoadmap( Window* _pParent, const ResId& _rId ) + :Control( _pParent, _rId ) + ,m_pImpl( new RoadmapImpl( *this ) ) { implInit(); } @@ -181,7 +234,7 @@ namespace svt //--------------------------------------------------------------------- ORoadmap::ORoadmap( Window* _pParent, WinBits _nWinStyle ) :Control( _pParent, _nWinStyle ) - , m_pImpl( new RoadmapImpl() ) + ,m_pImpl( new RoadmapImpl( *this ) ) { implInit(); @@ -216,14 +269,15 @@ namespace svt // on this with calculating a new bold font. // Unfortunately, the OutputDevice does not offer a notify mechanism for a changed font. // So settings the font from outside is simply a forbidded scenario at the moment + EnableMapMode( sal_False ); } //--------------------------------------------------------------------- ORoadmap::~ORoadmap( ) { - HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels(); + HL_Vector aItemsCopy = m_pImpl->getHyperLabels(); m_pImpl->getHyperLabels().clear(); - for ( HL_Vector::iterator i = pLocRoadmapItems.begin(); i< pLocRoadmapItems.end(); i++) + for ( HL_Vector::iterator i = aItemsCopy.begin(); i< aItemsCopy.end(); ++i ) { delete *i; } @@ -240,54 +294,43 @@ namespace svt } - void ORoadmap::InitializeHyperLabelSize() + RoadmapItem* ORoadmap::GetPreviousHyperLabel( ItemIndex _Index) { - Size aSize = GetSizePixel(); - Size aLogicSize = PixelToLogic( aSize, MAP_APPFONT ); - aLogicSize.Height() = LABELBASEMAPHEIGHT; - aLogicSize.Width() -= (2*RMENTRYPOINT_X); - m_pImpl->aHyperLabelPixelSize = LogicToPixel( aLogicSize, MAP_APPFONT ); - EnableMapMode( sal_False ); - } - - - ORoadmapHyperLabel* ORoadmap::GetPreviousHyperLabel( ItemIndex _Index) - { - ORoadmapHyperLabel* OldHyperLabel = NULL; - if (_Index > 0) - OldHyperLabel = m_pImpl->getHyperLabels().at( _Index - 1 ); - return OldHyperLabel; + RoadmapItem* pOldItem = NULL; + if ( _Index > 0 ) + pOldItem = m_pImpl->getHyperLabels().at( _Index - 1 ); + return pOldItem; } //--------------------------------------------------------------------- - ORoadmapHyperLabel* ORoadmap::InsertHyperLabel( ItemIndex _Index, ::rtl::OUString _sLabel, ItemId _RMID, sal_Bool _bEnabled) + RoadmapItem* ORoadmap::InsertHyperLabel( ItemIndex _Index, const ::rtl::OUString& _sLabel, ItemId _RMID, sal_Bool _bEnabled) { - if (m_pImpl->getItemCount() == 0 ) - InitializeHyperLabelSize(); - ORoadmapHyperLabel* CurHyperLabel; - ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( _Index); + if ( m_pImpl->getItemCount() == 0 ) + m_pImpl->initItemSize(); + + RoadmapItem* pItem = NULL; + RoadmapItem* pOldItem = GetPreviousHyperLabel( _Index ); - if (_RMID != RMINCOMPLETE ) + pItem = new RoadmapItem( *this, m_pImpl->getItemSize() ); + if ( _RMID != RMINCOMPLETE ) { - CurHyperLabel = new ORoadmapHyperLabel(this, WB_WORDBREAK); - CurHyperLabel->SetInteractive( m_pImpl->isInteractive() ); - m_pImpl->insertHyperLabel(_Index, CurHyperLabel ); + pItem->SetInteractive( m_pImpl->isInteractive() ); + m_pImpl->insertHyperLabel( _Index, pItem ); } else { - CurHyperLabel = new ORoadmapHyperLabel(this); - CurHyperLabel->SetInteractive( sal_False ); + pItem->SetInteractive( sal_False ); } - CurHyperLabel->SetPosition( OldHyperLabel ); - CurHyperLabel->SetLabelAndSize( _Index, _sLabel, m_pImpl->aHyperLabelPixelSize ); - CurHyperLabel->SetClickHdl(LINK( this, ORoadmap, ImplClickHdl ) ); - CurHyperLabel->SetID( _RMID ); - CurHyperLabel->SetIndex( _Index ); + pItem->SetPosition( pOldItem ); + pItem->Update( _Index, _sLabel ); + pItem->SetClickHdl(LINK( this, ORoadmap, ImplClickHdl ) ); + pItem->SetID( _RMID ); + pItem->SetIndex( _Index ); if (!_bEnabled) - CurHyperLabel->Enable( _bEnabled ); - return CurHyperLabel; + pItem->Enable( _bEnabled ); + return pItem; } //--------------------------------------------------------------------- @@ -308,12 +351,14 @@ namespace svt void ORoadmap::SetRoadmapInteractive( sal_Bool _bInteractive ) { m_pImpl->setInteractive( _bInteractive ); - ORoadmapHyperLabel* CurHyperLabel; - HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels(); - for ( HL_Vector::iterator i = pLocRoadmapItems.begin(); i< pLocRoadmapItems.end(); i++) + + const HL_Vector& rItems = m_pImpl->getHyperLabels(); + for ( HL_Vector::const_iterator i = rItems.begin(); + i < rItems.end(); + ++i + ) { - CurHyperLabel = *i; - CurHyperLabel->SetInteractive( _bInteractive ); + (*i)->SetInteractive( _bInteractive ); } } @@ -326,76 +371,55 @@ namespace svt //--------------------------------------------------------------------- void ORoadmap::SetRoadmapComplete( sal_Bool _bComplete ) { - sal_Bool OldbComplete = m_pImpl->isComplete(); - m_pImpl->setComplete( _bComplete); - if (_bComplete) + sal_Bool bWasComplete = m_pImpl->isComplete(); + m_pImpl->setComplete( _bComplete ); + if ( _bComplete ) { if ( m_pImpl->InCompleteHyperLabel != NULL) { - if (m_pImpl->getItemCount() > 0) - { - HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels(); - pLocRoadmapItems.pop_back(); - delete m_pImpl->InCompleteHyperLabel; - } + delete m_pImpl->InCompleteHyperLabel; m_pImpl->InCompleteHyperLabel = NULL; } } - else if (OldbComplete) - m_pImpl->InCompleteHyperLabel = InsertHyperLabel( m_pImpl->getItemCount(), ::String::CreateFromAscii("..."), RMINCOMPLETE ); + else if ( bWasComplete ) + m_pImpl->InCompleteHyperLabel = InsertHyperLabel( m_pImpl->getItemCount(), ::String::CreateFromAscii( "..." ), RMINCOMPLETE ); } //--------------------------------------------------------------------- - void ORoadmap::SetRoadmapLabel(ORoadmapHyperLabel* CurHyperLabel, sal_Int32 _nPrefix, String _sDescription) + void ORoadmap::UpdatefollowingHyperLabels( ItemIndex _nIndex ) { - const xub_StrLen n_Pos = _sDescription.Search( String::CreateFromAscii(".") ); - if ( n_Pos != STRING_NOTFOUND ) + const HL_Vector& rItems = m_pImpl->getHyperLabels(); + if ( _nIndex < (ItemIndex)rItems.size() ) { - const String sID = ::String::CreateFromInt32( _nPrefix ); - _sDescription.Replace(0 , n_Pos, sID ); - } - CurHyperLabel->SetLabelAndSize( _nPrefix, _sDescription, m_pImpl->aHyperLabelPixelSize ); - } - - //--------------------------------------------------------------------- - void ORoadmap::UpdatefollowingHyperLabels( ItemIndex _Index, sal_Int16 ) - { - if ( _Index < ( m_pImpl->getItemCount() ) ) - { - Point aPos; - String sLabel; - HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels(); - ORoadmapHyperLabel* CurHyperLabel = NULL; - ItemIndex n_CurPrefix = _Index + 1 ; - for ( HL_Vector::iterator i = pLocRoadmapItems.begin()+ _Index; i< pLocRoadmapItems.end(); i++) + RoadmapItem* pItem = NULL; + for ( HL_Vector::const_iterator i = rItems.begin() + _nIndex; + i< rItems.end(); + ++i, ++_nIndex + ) { - CurHyperLabel = *i; - aPos = CurHyperLabel->GetLogicalPosition(); - CurHyperLabel->SetIndex( n_CurPrefix - 1); - sLabel = CurHyperLabel->GetLabel(); - SetRoadmapLabel(CurHyperLabel, n_CurPrefix, sLabel); - ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( n_CurPrefix-1); - CurHyperLabel->SetPosition( OldHyperLabel); - n_CurPrefix++; + pItem = *i; + + pItem->SetIndex( _nIndex ); + pItem->SetPosition( GetPreviousHyperLabel( _nIndex ) ); } } if ( ! m_pImpl->isComplete() ) { - ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( m_pImpl->getItemCount()); - m_pImpl->InCompleteHyperLabel->SetPosition( OldHyperLabel ); - m_pImpl->InCompleteHyperLabel->SetLabelAndSize( m_pImpl->getItemCount(), ::String::CreateFromAscii("..."), m_pImpl->aHyperLabelPixelSize ); + RoadmapItem* pOldItem = GetPreviousHyperLabel( m_pImpl->getItemCount() ); + m_pImpl->InCompleteHyperLabel->SetPosition( pOldItem ); + m_pImpl->InCompleteHyperLabel->Update( m_pImpl->getItemCount(), ::String::CreateFromAscii("...") ); } } //--------------------------------------------------------------------- - void ORoadmap::ReplaceRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _RMID, sal_Bool _bEnabled ) + void ORoadmap::ReplaceRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _RMID, sal_Bool _bEnabled ) { - ORoadmapHyperLabel* CurHyperLabel = GetByIndex( _Index); - if ( CurHyperLabel != NULL ) + RoadmapItem* pItem = GetByIndex( _Index); + if ( pItem != NULL ) { - CurHyperLabel->SetLabelAndSize( _Index, _RoadmapItem, m_pImpl->aHyperLabelPixelSize ); - CurHyperLabel->SetID( _RMID ); - CurHyperLabel->Enable( _bEnabled ); + pItem->Update( _Index, _RoadmapItem ); + pItem->SetID( _RMID ); + pItem->Enable( _bEnabled ); } } @@ -408,7 +432,7 @@ namespace svt //--------------------------------------------------------------------- RoadmapTypes::ItemId ORoadmap::GetItemID( ItemIndex _nIndex ) const { - const ORoadmapHyperLabel* pHyperLabel = GetByIndex( _nIndex ); + const RoadmapItem* pHyperLabel = GetByIndex( _nIndex ); if ( pHyperLabel ) return pHyperLabel->GetID(); return -1; @@ -417,28 +441,26 @@ namespace svt //--------------------------------------------------------------------- RoadmapTypes::ItemIndex ORoadmap::GetItemIndex( ItemId _nID ) const { - ORoadmapHyperLabel* CurHyperLabel; ItemId nLocID = 0; - HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels(); - ItemIndex nResult = 0; - for ( HL_Vector::iterator i = LocHyperLabels.begin(); i< LocHyperLabels.end(); i++) + const HL_Vector& rItems = m_pImpl->getHyperLabels(); + for ( HL_Vector::const_iterator i = rItems.begin(); + i < rItems.end(); + ++i + ) { - CurHyperLabel = *i; - nLocID = CurHyperLabel->GetID(); + nLocID = (*i)->GetID(); if ( nLocID == _nID ) - return nResult; - nResult++; + return ItemIndex( i - rItems.begin() ); } return -1; } //--------------------------------------------------------------------- - void ORoadmap::InsertRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled ) + void ORoadmap::InsertRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled ) { - ORoadmapHyperLabel* CurHyperLabel; - CurHyperLabel = InsertHyperLabel(_Index, _RoadmapItem, _nUniqueId, _bEnabled); + InsertHyperLabel( _Index, _RoadmapItem, _nUniqueId, _bEnabled ); // Todo: YPos is superfluous, if items are always appended - UpdatefollowingHyperLabels( _Index + 1); + UpdatefollowingHyperLabels( _Index + 1 ); } //--------------------------------------------------------------------- @@ -447,7 +469,7 @@ namespace svt if ( m_pImpl->getItemCount() > 0 && ( _Index > -1) && ( _Index < m_pImpl->getItemCount() ) ) { m_pImpl->removeHyperLabel( _Index ); - UpdatefollowingHyperLabels( _Index, NREMOVERMITEM); + UpdatefollowingHyperLabels( _Index ); } } @@ -460,33 +482,33 @@ namespace svt //--------------------------------------------------------------------- sal_Bool ORoadmap::IsRoadmapItemEnabled( ItemId _nItemId, ItemIndex _nStartIndex ) const { - const ORoadmapHyperLabel* _pLabelItem = GetByID( _nItemId, _nStartIndex ); + const RoadmapItem* _pLabelItem = GetByID( _nItemId, _nStartIndex ); return _pLabelItem ? _pLabelItem->IsEnabled() : sal_False; } //--------------------------------------------------------------------- void ORoadmap::EnableRoadmapItem( ItemId _nItemId, sal_Bool _bEnable, ItemIndex _nStartIndex ) { - ORoadmapHyperLabel* CurHyperLabel = GetByID( _nItemId, _nStartIndex ); - if ( CurHyperLabel != NULL ) - CurHyperLabel->Enable( _bEnable ); + RoadmapItem* pItem = GetByID( _nItemId, _nStartIndex ); + if ( pItem != NULL ) + pItem->Enable( _bEnable ); } //--------------------------------------------------------------------- - void ORoadmap::ChangeRoadmapItemLabel( ItemId _nID, ::rtl::OUString _sLabel, ItemIndex _nStartIndex ) + void ORoadmap::ChangeRoadmapItemLabel( ItemId _nID, const ::rtl::OUString& _sLabel, ItemIndex _nStartIndex ) { - ORoadmapHyperLabel* CurHyperLabel = GetByID( _nID, _nStartIndex ); - if ( CurHyperLabel != NULL ) + RoadmapItem* pItem = GetByID( _nID, _nStartIndex ); + if ( pItem != NULL ) { - CurHyperLabel->SetLabelAndSize( CurHyperLabel->GetIndex(), _sLabel, m_pImpl->aHyperLabelPixelSize ); - HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels(); - ItemIndex Index = _nStartIndex; - for ( HL_Vector::iterator i = pLocRoadmapItems.begin()+ Index; i< pLocRoadmapItems.end(); i++) + pItem->Update( pItem->GetIndex(), _sLabel ); + + const HL_Vector& rItems = m_pImpl->getHyperLabels(); + for ( HL_Vector::const_iterator i = rItems.begin() + _nStartIndex; + i < rItems.end(); + ++i + ) { - CurHyperLabel = *i; - ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( Index ); - CurHyperLabel->SetPosition( OldHyperLabel); - Index++; + (*i)->SetPosition( GetPreviousHyperLabel( i - rItems.begin() ) ); } } } @@ -495,9 +517,9 @@ namespace svt ::rtl::OUString ORoadmap::GetRoadmapItemLabel( ItemId _nID, ItemIndex _nStartIndex ) { - ORoadmapHyperLabel* CurHyperLabel = GetByID( _nID, _nStartIndex ); - if ( CurHyperLabel != NULL ) - return CurHyperLabel->GetLabel(); + RoadmapItem* pItem = GetByID( _nID, _nStartIndex ); + if ( pItem != NULL ) + return pItem->GetLabel(); else return ::rtl::OUString(); } @@ -505,47 +527,47 @@ namespace svt //--------------------------------------------------------------------- void ORoadmap::ChangeRoadmapItemID( ItemId _nID, ItemId _NewID, ItemIndex _nStartIndex ) { - ORoadmapHyperLabel* CurHyperLabel = GetByID( _nID, _nStartIndex ); - if ( CurHyperLabel != NULL ) - CurHyperLabel->SetID( _NewID ); + RoadmapItem* pItem = GetByID( _nID, _nStartIndex ); + if ( pItem != NULL ) + pItem->SetID( _NewID ); } //--------------------------------------------------------------------- - ORoadmapHyperLabel* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex) + RoadmapItem* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex) { - ORoadmapHyperLabel* CurHyperLabel; ItemId nLocID = 0; - HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels(); - for ( HL_Vector::iterator i = LocHyperLabels.begin()+ _nStartIndex; i< LocHyperLabels.end(); i++) + const HL_Vector& rItems = m_pImpl->getHyperLabels(); + for ( HL_Vector::const_iterator i = rItems.begin() + _nStartIndex; + i < rItems.end(); + ++i + ) { - CurHyperLabel = *i; - nLocID = CurHyperLabel->GetID(); + nLocID = (*i)->GetID(); if ( nLocID == _nID ) - return CurHyperLabel; + return *i; } return NULL; } //--------------------------------------------------------------------- - const ORoadmapHyperLabel* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex ) const + const RoadmapItem* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex ) const { return const_cast< ORoadmap* >( this )->GetByID( _nID, _nStartIndex ); } //--------------------------------------------------------------------- - ORoadmapHyperLabel* ORoadmap::GetByIndex( ItemIndex _nItemIndex) + RoadmapItem* ORoadmap::GetByIndex( ItemIndex _nItemIndex) { - HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels(); - if ((_nItemIndex > -1) && (_nItemIndex < m_pImpl->getItemCount( ) ) ) + const HL_Vector& rItems = m_pImpl->getHyperLabels(); + if ( ( _nItemIndex > -1 ) && ( _nItemIndex < (ItemIndex)rItems.size() ) ) { - ORoadmapHyperLabel* CurHyperLabel = LocHyperLabels.at(_nItemIndex); // Vectors are one-based - return CurHyperLabel; + return rItems.at( _nItemIndex ); } return NULL; } //--------------------------------------------------------------------- - const ORoadmapHyperLabel* ORoadmap::GetByIndex( ItemIndex _nItemIndex ) const + const RoadmapItem* ORoadmap::GetByIndex( ItemIndex _nItemIndex ) const { return const_cast< ORoadmap* >( this )->GetByIndex( _nItemIndex ); } @@ -553,14 +575,14 @@ namespace svt //--------------------------------------------------------------------- RoadmapTypes::ItemId ORoadmap::GetNextAvailableItemId( ItemIndex _nNewIndex ) { - ORoadmapHyperLabel* CurHyperLabel; + RoadmapItem* pItem = NULL; ItemIndex searchIndex = ++_nNewIndex; while ( searchIndex < m_pImpl->getItemCount() ) { - CurHyperLabel = GetByIndex( searchIndex ); - if ( CurHyperLabel->IsEnabled() ) - return CurHyperLabel->GetID( ); + pItem = GetByIndex( searchIndex ); + if ( pItem->IsEnabled() ) + return pItem->GetID( ); ++searchIndex; } @@ -570,13 +592,13 @@ namespace svt //--------------------------------------------------------------------- RoadmapTypes::ItemId ORoadmap::GetPreviousAvailableItemId( ItemIndex _nNewIndex ) { - ORoadmapHyperLabel* CurHyperLabel; + RoadmapItem* pItem = NULL; ItemIndex searchIndex = --_nNewIndex; while ( searchIndex > -1 ) { - CurHyperLabel = GetByIndex( searchIndex ); - if ( CurHyperLabel->IsEnabled() ) - return CurHyperLabel->GetID( ); + pItem = GetByIndex( searchIndex ); + if ( pItem->IsEnabled() ) + return pItem->GetID( ); searchIndex--; } @@ -586,12 +608,13 @@ namespace svt //--------------------------------------------------------------------- void ORoadmap::DeselectOldRoadmapItems() { - HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels(); - ORoadmapHyperLabel* CurHyperLabel = NULL; - for ( HL_Vector::iterator i = pLocRoadmapItems.begin(); i< pLocRoadmapItems.end(); i++) + const HL_Vector& rItems = m_pImpl->getHyperLabels(); + for ( HL_Vector::const_iterator i = rItems.begin(); + i < rItems.end(); + ++i + ) { - CurHyperLabel = *i; - CurHyperLabel->ToggleBackgroundColor( COL_TRANSPARENT ); + (*i)->ToggleBackgroundColor( COL_TRANSPARENT ); } } @@ -617,7 +640,7 @@ namespace svt //--------------------------------------------------------------------- void ORoadmap::GetFocus() { - ORoadmapHyperLabel* pCurHyperLabel = GetByID( GetCurrentRoadmapItemID() ); + RoadmapItem* pCurHyperLabel = GetByID( GetCurrentRoadmapItemID() ); if ( pCurHyperLabel != NULL ) pCurHyperLabel->GrabFocus(); } @@ -626,15 +649,15 @@ namespace svt sal_Bool ORoadmap::SelectRoadmapItemByID( ItemId _nNewID ) { DeselectOldRoadmapItems(); - ORoadmapHyperLabel* CurHyperLabel = GetByID( _nNewID ); - if (CurHyperLabel != NULL) + RoadmapItem* pItem = GetByID( _nNewID ); + if ( pItem != NULL ) { - if (CurHyperLabel->IsEnabled()) + if ( pItem->IsEnabled() ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - CurHyperLabel->ToggleBackgroundColor( rStyleSettings.GetHighlightColor() ); //HighlightColor + pItem->ToggleBackgroundColor( rStyleSettings.GetHighlightColor() ); //HighlightColor - CurHyperLabel->GrabFocus(); + pItem->GrabFocus(); m_pImpl->setCurItemID(_nNewID); Select(); @@ -670,7 +693,7 @@ namespace svt //--------------------------------------------------------------------- void ORoadmap::DrawHeadline() { - Point aTextPos = LogicToPixel( Point( RMENTRYPOINT_X, 8 ), MAP_APPFONT ); + Point aTextPos = LogicToPixel( Point( ROADMAP_INDENT_X, 8 ), MAP_APPFONT ); Size aOutputSize( GetOutputSizePixel() ); @@ -683,15 +706,16 @@ namespace svt } //--------------------------------------------------------------------- - ORoadmapHyperLabel* ORoadmap::GetByPointer(Window* pWindow) + RoadmapItem* ORoadmap::GetByPointer(Window* pWindow) { - ORoadmapHyperLabel* CurHyperLabel; - HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels(); - for ( HL_Vector::iterator i = LocHyperLabels.begin(); i< LocHyperLabels.end(); i++) + const HL_Vector& rItems = m_pImpl->getHyperLabels(); + for ( HL_Vector::const_iterator i = rItems.begin(); + i < rItems.end(); + ++i + ) { - CurHyperLabel = *i; - if ( (CurHyperLabel->GetIDLabel() == pWindow) || (CurHyperLabel->GetDescriptionHyperLabel() == pWindow) ) - return CurHyperLabel; + if ( (*i)->Contains( pWindow ) ) + return *i; } return NULL; } @@ -703,30 +727,30 @@ namespace svt if ( _rNEvt.GetType() == EVENT_KEYINPUT ) { Window* pWindow = _rNEvt.GetWindow(); - ORoadmapHyperLabel* CurHyperLabel = GetByPointer( pWindow ); - if ( CurHyperLabel != NULL ) + RoadmapItem* pItem = GetByPointer( pWindow ); + if ( pItem != NULL ) { sal_Int16 nKeyCode = _rNEvt.GetKeyEvent()->GetKeyCode().GetCode(); switch( nKeyCode ) { case KEY_UP: - { // Note: Performancewhise this is not optimal, because we search for an ID in the labels + { // Note: Performancewise this is not optimal, because we search for an ID in the labels // and afterwards we search again for a label with the appropriate ID -> // unnecessarily we search twice!!! - ItemId nPrevItemID = GetPreviousAvailableItemId( CurHyperLabel->GetIndex() ); + ItemId nPrevItemID = GetPreviousAvailableItemId( pItem->GetIndex() ); if ( nPrevItemID != -1 ) return SelectRoadmapItemByID( nPrevItemID ); } break; case KEY_DOWN: { - ItemId nNextItemID = GetNextAvailableItemId( CurHyperLabel->GetIndex() ); + ItemId nNextItemID = GetNextAvailableItemId( pItem->GetIndex() ); if ( nNextItemID != -1 ) return SelectRoadmapItemByID( nNextItemID ); } break; case KEY_SPACE: - return SelectRoadmapItemByID( CurHyperLabel->GetID() ); + return SelectRoadmapItemByID( pItem->GetID() ); } } } @@ -736,9 +760,12 @@ namespace svt //--------------------------------------------------------------------- IMPL_LINK(ORoadmap, ImplClickHdl, HyperLabel*, _CurHyperLabel) { - return SelectRoadmapItemByID( _CurHyperLabel->GetID() ); + return SelectRoadmapItemByID( _CurHyperLabel->GetID() ); } + + + //--------------------------------------------------------------------- void ORoadmap::DataChanged( const DataChangedEvent& rDCEvt ) { if ((( rDCEvt.GetType() == DATACHANGED_SETTINGS ) || @@ -752,216 +779,228 @@ namespace svt aFont.SetColor( aTextColor ); SetFont( aFont ); RoadmapTypes::ItemId curItemID = GetCurrentRoadmapItemID(); - ORoadmapHyperLabel* pLabelItem = GetByID( curItemID ); + RoadmapItem* pLabelItem = GetByID( curItemID ); pLabelItem->ToggleBackgroundColor(rStyleSettings.GetHighlightColor()); Invalidate(); } } - ORoadmapHyperLabel::ORoadmapHyperLabel( Window* _pParent, const ResId& ) + //--------------------------------------------------------------------- + RoadmapItem::RoadmapItem( ORoadmap& _rParent, const Size& _rItemPlayground ) + :m_aItemPlayground( _rItemPlayground ) { - mpIDLabel = new ORoadmapIDHyperLabel(_pParent, WB_WORDBREAK); - mpDescHyperLabel = new HyperLabel(_pParent, WB_NOTABSTOP | WB_WORDBREAK); + mpID = new IDLabel( &_rParent, WB_WORDBREAK ); + mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetFieldTextColor( ) ); + mpID->Show(); + mpDescription = new HyperLabel( &_rParent, WB_NOTABSTOP | WB_WORDBREAK ); + mpDescription->Show(); } - - ORoadmapHyperLabel::ORoadmapHyperLabel( Window* _pParent, WinBits ) + //--------------------------------------------------------------------- + bool RoadmapItem::Contains( const Window* _pWindow ) const { - mpIDLabel = new ORoadmapIDHyperLabel(_pParent, WB_WORDBREAK); - mpIDLabel->SetTextColor( mpIDLabel->GetSettings().GetStyleSettings().GetFieldTextColor( ) ); - mpDescHyperLabel = new HyperLabel(_pParent, WB_NOTABSTOP | WB_WORDBREAK); + return ( mpID == _pWindow ) || ( mpDescription == _pWindow ); } //--------------------------------------------------------------------- - void ORoadmapHyperLabel::GrabFocus() + void RoadmapItem::GrabFocus() { - if ( mpDescHyperLabel ) - mpDescHyperLabel->GrabFocus(); + if ( mpDescription ) + mpDescription->GrabFocus(); } - - void ORoadmapHyperLabel::SetInteractive( sal_Bool _bInteractive ) + //--------------------------------------------------------------------- + void RoadmapItem::SetInteractive( sal_Bool _bInteractive ) { - if ( mpDescHyperLabel ) - mpDescHyperLabel->SetInteractive(_bInteractive); + if ( mpDescription ) + mpDescription->SetInteractive(_bInteractive); } - void ORoadmapHyperLabel::SetID( sal_Int16 _ID ) + //--------------------------------------------------------------------- + void RoadmapItem::SetID( sal_Int16 _ID ) { - if ( mpDescHyperLabel ) - mpDescHyperLabel->SetID(_ID); + if ( mpDescription ) + mpDescription->SetID(_ID); } - sal_Int16 ORoadmapHyperLabel::GetID() const + //--------------------------------------------------------------------- + sal_Int16 RoadmapItem::GetID() const { - return mpDescHyperLabel ? mpDescHyperLabel->GetID() : sal_Int16(-1); + return mpDescription ? mpDescription->GetID() : sal_Int16(-1); } - void ORoadmapHyperLabel::SetIndex( sal_Int32 _Index ) + //--------------------------------------------------------------------- + void RoadmapItem::ImplUpdateIndex( const ItemIndex _nIndex ) { - if ( mpDescHyperLabel ) - mpDescHyperLabel->SetIndex(_Index); - } + if ( mpDescription ) + mpDescription->SetIndex( _nIndex ); + if ( mpID ) + { + ::rtl::OUString aIDText = ::rtl::OUString::valueOf( (sal_Int32)( _nIndex + 1 ) ) + ::rtl::OUString::createFromAscii( "." ); + mpID->SetText( aIDText ); + } - sal_Int32 ORoadmapHyperLabel::GetIndex() const - { - return mpDescHyperLabel ? mpDescHyperLabel->GetIndex() : sal_Int32(-1); + // update the geometry of both controls + ImplUpdatePosSize(); } - - void ORoadmapHyperLabel::SetLabel( ::rtl::OUString _rText ) + //--------------------------------------------------------------------- + void RoadmapItem::SetIndex( ItemIndex _Index ) { - if ( mpDescHyperLabel ) - mpDescHyperLabel->SetText(_rText); + ImplUpdateIndex( _Index ); } + //--------------------------------------------------------------------- + RoadmapTypes::ItemIndex RoadmapItem::GetIndex() const + { + return mpDescription ? mpDescription->GetIndex() : ItemIndex(-1); + } - ::rtl::OUString ORoadmapHyperLabel::GetLabel( ) + //--------------------------------------------------------------------- + void RoadmapItem::SetLabel( const ::rtl::OUString& _rText ) { - return mpDescHyperLabel ? mpDescHyperLabel->GetText() : String(); + if ( mpDescription ) + mpDescription->SetText(_rText); } + //--------------------------------------------------------------------- + ::rtl::OUString RoadmapItem::GetLabel( ) + { + return mpDescription ? mpDescription->GetText() : String(); + } - void ORoadmapHyperLabel::SetPosition(ORoadmapHyperLabel* OldHyperLabel) + //--------------------------------------------------------------------- + void RoadmapItem::SetPosition( RoadmapItem* _pOldItem ) { - Point aNewLogicalPoint; - Point aNewPoint; - if (OldHyperLabel == NULL) + Point aIDPos; + if ( _pOldItem == NULL ) { - aNewLogicalPoint = Point( RMENTRYPOINT_X, RMENTRYPOINT_Y); - aNewPoint = mpIDLabel->LogicToPixel(aNewLogicalPoint, MAP_APPFONT ); + aIDPos = mpID->LogicToPixel( Point( ROADMAP_INDENT_X, ROADMAP_INDENT_Y ), MAP_APPFONT ); } else { - Size aOldSize = OldHyperLabel->GetDescriptionHyperLabel()->GetSizePixel(); - Point aOldLogicalPoint = OldHyperLabel->GetLogicalPosition(); - aNewLogicalPoint = Point(aOldLogicalPoint.X(), (aOldLogicalPoint.Y() + RMITEMDISTANCE_Y)); - aNewPoint = mpIDLabel->LogicToPixel(aNewLogicalPoint, MAP_APPFONT ); - aNewPoint = Point(aNewPoint.X(),aNewPoint.Y() + aOldSize.Height()); + Size aOldSize = _pOldItem->GetDescriptionHyperLabel()->GetSizePixel(); + + aIDPos = _pOldItem->mpID->GetPosPixel(); + aIDPos.Y() += aOldSize.Height(); + aIDPos.Y() += mpID->GetParent()->LogicToPixel( Size( 0, ROADMAP_ITEM_DISTANCE_Y ) ).Height(); } - mpIDLabel->SetPosPixel( aNewPoint ); - sal_Int32 xDescPos = aNewPoint.X() + mpIDLabel->GetSizePixel().Width(); - mpDescHyperLabel->SetPosPixel( Point(xDescPos, aNewPoint.Y()) ); - } + mpID->SetPosPixel( aIDPos ); + sal_Int32 nDescPos = aIDPos.X() + mpID->GetSizePixel().Width(); + mpDescription->SetPosPixel( Point( nDescPos, aIDPos.Y() ) ); + } - void ORoadmapHyperLabel::SetZOrder( ORoadmapHyperLabel* pRefRoadmapHyperLabel, USHORT nFlags ) + //--------------------------------------------------------------------- + void RoadmapItem::SetZOrder( RoadmapItem* pRefRoadmapHyperLabel, USHORT nFlags ) { if (pRefRoadmapHyperLabel == NULL) - mpDescHyperLabel->SetZOrder( NULL, nFlags); //WINDOW_ZORDER_FIRST ); + mpDescription->SetZOrder( NULL, nFlags); //WINDOW_ZORDER_FIRST ); else - mpDescHyperLabel->SetZOrder( pRefRoadmapHyperLabel->mpDescHyperLabel, nFlags); //, WINDOW_ZORDER_BEHIND ); + mpDescription->SetZOrder( pRefRoadmapHyperLabel->mpDescription, nFlags); //, WINDOW_ZORDER_BEHIND ); } - - void ORoadmapHyperLabel::Enable( BOOL _bEnable) + //--------------------------------------------------------------------- + void RoadmapItem::Enable( BOOL _bEnable) { - mpIDLabel->Enable(_bEnable); - mpDescHyperLabel->Enable(_bEnable); + mpID->Enable(_bEnable); + mpDescription->Enable(_bEnable); } - BOOL ORoadmapHyperLabel::IsEnabled() const + //--------------------------------------------------------------------- + BOOL RoadmapItem::IsEnabled() const { - return mpIDLabel->IsEnabled(); + return mpID->IsEnabled(); } -// void ORoadmapHyperLabel::GrabFocus() -// { -// mpDescHyperLabel->GrabFocus(); -// -// } - - void ORoadmapHyperLabel::ToggleBackgroundColor( const Color& _rGBColor ) + //--------------------------------------------------------------------- + void RoadmapItem::ToggleBackgroundColor( const Color& _rGBColor ) { if (_rGBColor == COL_TRANSPARENT) { - mpIDLabel->SetTextColor( mpIDLabel->GetSettings().GetStyleSettings().GetFieldTextColor( ) ); - mpIDLabel->SetControlBackground( COL_TRANSPARENT ); + mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetFieldTextColor( ) ); + mpID->SetControlBackground( COL_TRANSPARENT ); } else { - mpIDLabel->SetControlBackground( mpIDLabel->GetSettings().GetStyleSettings().GetHighlightColor() ); - mpIDLabel->SetTextColor( mpIDLabel->GetSettings().GetStyleSettings().GetHighlightTextColor( ) ); + mpID->SetControlBackground( mpID->GetSettings().GetStyleSettings().GetHighlightColor() ); + mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetHighlightTextColor( ) ); } - mpDescHyperLabel->ToggleBackgroundColor(_rGBColor); + mpDescription->ToggleBackgroundColor(_rGBColor); } - - Point ORoadmapHyperLabel::GetLogicalPosition() + //--------------------------------------------------------------------- + void RoadmapItem::ImplUpdatePosSize() { - Point aPoint = mpIDLabel->GetPosPixel( ); - Size aSize = Size(aPoint.X(), aPoint.Y()); - aSize = mpIDLabel->PixelToLogic( aSize, MAP_APPFONT ); - aPoint = Point(aSize.Width(), aSize.Height()); - return aPoint; - } + // calculate widths + long nIDWidth = mpID->GetTextWidth( mpID->GetText() ); + long nMaxIDWidth = mpID->GetTextWidth( ::rtl::OUString::createFromAscii( "100." ) ); + nIDWidth = ::std::min( nIDWidth, nMaxIDWidth ); + + // check how many space the description would need + Size aDescriptionSize = mpDescription->CalcMinimumSize( m_aItemPlayground.Width() - nIDWidth ); + + // position and size both controls + Size aIDSize( nIDWidth, aDescriptionSize.Height() ); + mpID->SetSizePixel( aIDSize ); + Point aIDPos = mpID->GetPosPixel(); + mpDescription->SetPosPixel( Point( aIDPos.X() + nIDWidth, aIDPos.Y() ) ); + mpDescription->SetSizePixel( aDescriptionSize ); + } - void ORoadmapHyperLabel::SetLabelAndSize( ItemIndex _RMIndex, ::rtl::OUString _rText, const Size& _rNewSize) + //--------------------------------------------------------------------- + void RoadmapItem::Update( ItemIndex _RMIndex, const ::rtl::OUString& _rText ) { - Size rIDSize = _rNewSize; - ::rtl::OUString aStr = ::rtl::OUString::valueOf( (sal_Int32)( _RMIndex + 1 ) ) + ::rtl::OUString::createFromAscii( "." ); - rIDSize.Width() = (sal_Int32) mpIDLabel->GetTextWidth( aStr ); - long nMaxWidth = mpIDLabel->GetTextWidth( ::rtl::OUString::createFromAscii("100.") ); - rIDSize.Width() = ::std::min( rIDSize.getWidth(),nMaxWidth ); - mpIDLabel->SetSizePixel(mpIDLabel->LogicToPixel( rIDSize)); - mpIDLabel->SetText( aStr); - mpIDLabel->Show(); - Size rDescSize = _rNewSize; - rDescSize.Width() -= rIDSize.Width(); - sal_Int32 xDescPos = mpIDLabel->GetPosPixel().X() + mpIDLabel->GetSizePixel().Width(); - sal_Int32 yDescPos = mpIDLabel->GetPosPixel().Y(); - Point aPoint = Point(xDescPos, yDescPos); - mpDescHyperLabel->SetPosPixel( aPoint ); - mpDescHyperLabel->SetLabelAndSize(_rText, rDescSize); - mpIDLabel->SetSizePixel( Size( mpIDLabel->GetSizePixel().Width(), mpDescHyperLabel->GetSizePixel().Height() ) ); + // update description label + mpDescription->SetLabel( _rText ); + + // update the index in both controls, which triggers updating the geometry of both + ImplUpdateIndex( _RMIndex ); } - ORoadmapHyperLabel::~ORoadmapHyperLabel( ) + //--------------------------------------------------------------------- + RoadmapItem::~RoadmapItem( ) { { - ::std::auto_ptr<Control> aTemp(mpIDLabel); - mpIDLabel = NULL; + ::std::auto_ptr<Control> aTemp(mpID); + mpID = NULL; } { - ::std::auto_ptr<Control> aTemp(mpDescHyperLabel); - mpDescHyperLabel = NULL; + ::std::auto_ptr<Control> aTemp(mpDescription); + mpDescription = NULL; } } - - void ORoadmapHyperLabel::SetClickHdl( const Link& rLink ) - { - if ( mpDescHyperLabel ) - mpDescHyperLabel->SetClickHdl( rLink); - } - - const Link& ORoadmapHyperLabel::GetClickHdl( ) const + //--------------------------------------------------------------------- + void RoadmapItem::SetClickHdl( const Link& rLink ) { - return mpDescHyperLabel->GetClickHdl(); + if ( mpDescription ) + mpDescription->SetClickHdl( rLink); } - - ORoadmapIDHyperLabel::ORoadmapIDHyperLabel( Window* _pParent, const ResId& _rId ) - :FixedText( _pParent, _rId ) + //--------------------------------------------------------------------- + const Link& RoadmapItem::GetClickHdl( ) const { + return mpDescription->GetClickHdl(); } - ORoadmapIDHyperLabel::ORoadmapIDHyperLabel( Window* _pParent, WinBits _nWinStyle ) + //--------------------------------------------------------------------- + IDLabel::IDLabel( Window* _pParent, WinBits _nWinStyle ) :FixedText( _pParent, _nWinStyle ) { } - - ORoadmapIDHyperLabel::~ORoadmapIDHyperLabel( ) + //--------------------------------------------------------------------- + IDLabel::~IDLabel( ) { } - - void ORoadmapIDHyperLabel::DataChanged( const DataChangedEvent& rDCEvt ) + //--------------------------------------------------------------------- + void IDLabel::DataChanged( const DataChangedEvent& rDCEvt ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); FixedText::DataChanged( rDCEvt ); diff --git a/svtools/source/control/taskstat.cxx b/svtools/source/control/taskstat.cxx index 86098af7de4a..82165a711285 100644 --- a/svtools/source/control/taskstat.cxx +++ b/svtools/source/control/taskstat.cxx @@ -43,7 +43,7 @@ #include <vcl/svapp.hxx> #include <unotools/calendarwrapper.hxx> -#include <svtools/syslocale.hxx> +#include <unotools/syslocale.hxx> #include <taskbar.hxx> // ======================================================================= diff --git a/svtools/source/control/urlcontrol.cxx b/svtools/source/control/urlcontrol.cxx index 1252fc17a1d6..899867414e2f 100644 --- a/svtools/source/control/urlcontrol.cxx +++ b/svtools/source/control/urlcontrol.cxx @@ -31,12 +31,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#ifndef SVTOOL_URLCONTROL_HXX #include <svtools/urlcontrol.hxx> -#endif -#ifndef SVTOOLS_FILENOTATION_HXX_ -#include "filenotation.hxx" -#endif +#include "svl/filenotation.hxx" //......................................................................... namespace svt diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index 14ede88482a6..aa18a3683916 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -39,7 +39,7 @@ #include "addresstemplate.hrc" #endif #ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #endif #ifndef _SVT_HELPID_HRC #include <svtools/helpid.hrc> @@ -70,7 +70,7 @@ #include <com/sun/star/sdb/CommandType.hpp> #include "localresaccess.hxx" #ifndef SVTOOLS_FILENOTATION_HXX_ -#include "filenotation.hxx" +#include "svl/filenotation.hxx" #endif #include <tools/urlobj.hxx> @@ -324,8 +324,20 @@ public: virtual void setDatasourceName(const ::rtl::OUString& _rName); virtual void setCommand(const ::rtl::OUString& _rCommand); + + virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames); + virtual void Commit(); }; + +void AssignmentPersistentData::Notify( const com::sun::star::uno::Sequence<rtl::OUString>& ) +{ +} + +void AssignmentPersistentData::Commit() +{ +} + // ------------------------------------------------------------------- AssignmentPersistentData::AssignmentPersistentData() :ConfigItem( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.DataAccess/AddressBook" ))) diff --git a/svtools/source/dialogs/addresstemplate.src b/svtools/source/dialogs/addresstemplate.src index 9c4997cae9d2..63c0e6475597 100644 --- a/svtools/source/dialogs/addresstemplate.src +++ b/svtools/source/dialogs/addresstemplate.src @@ -29,7 +29,7 @@ ************************************************************************/ #ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #endif #ifndef _SVT_ADDRESSTEMPLATE_HRC_ #include "addresstemplate.hrc" diff --git a/svtools/source/dialogs/logindlg.cxx b/svtools/source/dialogs/logindlg.cxx index 7ac65a77947d..791e373086af 100644 --- a/svtools/source/dialogs/logindlg.cxx +++ b/svtools/source/dialogs/logindlg.cxx @@ -38,7 +38,7 @@ #include "logindlg.hrc" #endif #ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #endif #include <svtools/svtdata.hxx> diff --git a/svtools/source/dialogs/logindlg.src b/svtools/source/dialogs/logindlg.src index 897597f383bf..b3ef357bbae4 100644 --- a/svtools/source/dialogs/logindlg.src +++ b/svtools/source/dialogs/logindlg.src @@ -29,7 +29,7 @@ ************************************************************************/ #ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #endif #ifndef _SVTOOLS_LOGINDLG_HRC_ diff --git a/svtools/source/dialogs/printdlg.cxx b/svtools/source/dialogs/printdlg.cxx index 68acffc62a74..a006f209af18 100644 --- a/svtools/source/dialogs/printdlg.cxx +++ b/svtools/source/dialogs/printdlg.cxx @@ -47,7 +47,7 @@ #include <svtools/printdlg.hxx> #include <svtools/svtdata.hxx> #include <filedlg.hxx> -#include "pickerhelper.hxx" +#include "svl/pickerhelper.hxx" #ifndef _SVT_HELPID_HRC #include <svtools/helpid.hrc> #endif @@ -172,7 +172,7 @@ PrintDialog::~PrintDialog() void PrintDialog::ImplSetImages() { - if( ! GetSettings().GetStyleSettings().GetDialogColor().IsDark() ) + if( ! GetSettings().GetStyleSettings().GetHighContrastMode() ) { maImgCollate.SetModeImage( Image( SvtResId( RID_IMG_PRNDLG_COLLATE ) ), BMP_COLOR_NORMAL ); maImgNotCollate.SetModeImage( Image( SvtResId( RID_IMG_PRNDLG_NOCOLLATE ) ), BMP_COLOR_NORMAL ); diff --git a/svtools/source/dialogs/printdlg.hrc b/svtools/source/dialogs/printdlg.hrc index cae57cefdb0e..2f2f43e3ba10 100644 --- a/svtools/source/dialogs/printdlg.hrc +++ b/svtools/source/dialogs/printdlg.hrc @@ -28,7 +28,7 @@ * ************************************************************************/ -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #define FL_PRINTER 1 #define LB_NAMES 2 diff --git a/svtools/source/dialogs/prnsetup.cxx b/svtools/source/dialogs/prnsetup.cxx index dedb5b2d7143..74cfe7b1286a 100644 --- a/svtools/source/dialogs/prnsetup.cxx +++ b/svtools/source/dialogs/prnsetup.cxx @@ -59,7 +59,7 @@ void ImplFillPrnDlgListBox( const Printer* pPrinter, } pBox->Enable( nCount != 0 ); - pPropBtn->Enable( pPrinter->HasSupport( SUPPORT_SETUPDIALOG ) ); + pPropBtn->Show( pPrinter->HasSupport( SUPPORT_SETUPDIALOG ) ); } // ----------------------------------------------------------------------- diff --git a/svtools/source/dialogs/prnsetup.hrc b/svtools/source/dialogs/prnsetup.hrc index 33f98f7ed5e0..00623d97084c 100644 --- a/svtools/source/dialogs/prnsetup.hrc +++ b/svtools/source/dialogs/prnsetup.hrc @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #define FL_PRINTER 1 #define LB_NAMES 2 diff --git a/svtools/inc/propctrl.hxx b/svtools/source/dialogs/propctrl.hxx index b2698f6a1c8e..59019fc21b90 100644 --- a/svtools/inc/propctrl.hxx +++ b/svtools/source/dialogs/propctrl.hxx @@ -34,7 +34,7 @@ #include "sbx.hxx" #include "sbxbase.hxx" #include "sbxres.hxx" -#include <svtools/brdcst.hxx> +#include <svl/brdcst.hxx> */ diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx index b0fff49e5e8d..c7473e446986 100644 --- a/svtools/source/dialogs/roadmapwizard.cxx +++ b/svtools/source/dialogs/roadmapwizard.cxx @@ -32,7 +32,7 @@ #include "precompiled_svtools.hxx" #include <svtools/roadmapwizard.hxx> -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #include <svtools/svtdata.hxx> #include "roadmap.hxx" #include <tools/debug.hxx> diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx index c436256a31c4..602c2e3e6f8a 100644 --- a/svtools/source/dialogs/wizardmachine.cxx +++ b/svtools/source/dialogs/wizardmachine.cxx @@ -36,7 +36,7 @@ #include <vcl/msgbox.hxx> #include <svtools/svtdata.hxx> #ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #endif //......................................................................... diff --git a/svtools/source/dialogs/wizardmachine.src b/svtools/source/dialogs/wizardmachine.src index d83fdd98824b..2fa50ef20bf6 100644 --- a/svtools/source/dialogs/wizardmachine.src +++ b/svtools/source/dialogs/wizardmachine.src @@ -29,7 +29,7 @@ ************************************************************************/ #ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #endif String STR_WIZDLG_FINISH diff --git a/svtools/source/edit/svmedit.cxx b/svtools/source/edit/svmedit.cxx index 135761195e48..8c60a62063df 100644 --- a/svtools/source/edit/svmedit.cxx +++ b/svtools/source/edit/svmedit.cxx @@ -43,11 +43,11 @@ #include <svtools/svmedit.hxx> #include <svtools/xtextedt.hxx> -#include <svtools/brdcst.hxx> -#include <svtools/undo.hxx> +#include <svl/brdcst.hxx> +#include <svl/undo.hxx> #include <svtools/textwindowpeer.hxx> -#include <svtools/lstner.hxx> -#include <svtools/smplhint.hxx> +#include <svl/lstner.hxx> +#include <svl/smplhint.hxx> // IDs erstmal aus VCL geklaut, muss mal richtig delivert werden... @@ -1478,7 +1478,7 @@ long MultiLineEdit::PreNotify( NotifyEvent& rNEvt ) { long nDone = 0; -#if (OSL_DEBUG_LEVEL > 1) && !defined( PRODUCT ) +#if (OSL_DEBUG_LEVEL > 1) && defined(DBG_UTIL) if( rNEvt.GetType() == EVENT_KEYINPUT ) { const KeyEvent& rKEvent = *rNEvt.GetKeyEvent(); diff --git a/svtools/source/edit/syntaxhighlight.cxx b/svtools/source/edit/syntaxhighlight.cxx index e2e71e86b662..7e2f98d0d37f 100644 --- a/svtools/source/edit/syntaxhighlight.cxx +++ b/svtools/source/edit/syntaxhighlight.cxx @@ -682,7 +682,7 @@ String SimpleTokenizer_Impl::getTokStr return String( pStartPos, (USHORT)( pEndPos - pStartPos ) ); } -#ifndef PRODUCT +#ifdef DBG_UTIL // TEST: Token ausgeben String SimpleTokenizer_Impl::getFullTokenStr( /*out*/TokenTypes eType, /*out*/const sal_Unicode* pStartPos, /*out*/const sal_Unicode* pEndPos ) diff --git a/svtools/source/edit/textdat2.hxx b/svtools/source/edit/textdat2.hxx index 51336e75741e..7ee667db2305 100644 --- a/svtools/source/edit/textdat2.hxx +++ b/svtools/source/edit/textdat2.hxx @@ -32,7 +32,7 @@ #ifndef _TEXTDAT2_HXX #define _TEXTDAT2_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <tools/list.hxx> #include <vcl/seleng.hxx> #include <vcl/virdev.hxx> diff --git a/svtools/source/edit/textdoc.hxx b/svtools/source/edit/textdoc.hxx index 45b03e70ac47..b940bb6f4da7 100644 --- a/svtools/source/edit/textdoc.hxx +++ b/svtools/source/edit/textdoc.hxx @@ -31,7 +31,7 @@ #ifndef _TEXTDOC_HXX #define _TEXTDOC_HXX -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #include <svtools/textdata.hxx> #include <txtattr.hxx> diff --git a/svtools/source/edit/texteng.cxx b/svtools/source/edit/texteng.cxx index e7eff8385206..596ca89054e7 100644 --- a/svtools/source/edit/texteng.cxx +++ b/svtools/source/edit/texteng.cxx @@ -40,7 +40,7 @@ #include <textdat2.hxx> #include <textundo.hxx> #include <textund2.hxx> -#include <svtools/ctloptions.hxx> +#include <svl/ctloptions.hxx> #include <vcl/window.hxx> #include <vcl/edit.hxx> diff --git a/svtools/source/edit/textundo.hxx b/svtools/source/edit/textundo.hxx index fe2c53bca45e..7ce7169e1563 100644 --- a/svtools/source/edit/textundo.hxx +++ b/svtools/source/edit/textundo.hxx @@ -30,7 +30,7 @@ #ifndef _TEXTUNDO_HXX #define _TEXTUNDO_HXX -#include <svtools/undo.hxx> +#include <svl/undo.hxx> class TextEngine; diff --git a/svtools/source/edit/textview.cxx b/svtools/source/edit/textview.cxx index e0697a488287..99b6fc900885 100644 --- a/svtools/source/edit/textview.cxx +++ b/svtools/source/edit/textview.cxx @@ -36,7 +36,7 @@ #include <svtools/textdata.hxx> #include <textdat2.hxx> -#include <svtools/undo.hxx> +#include <svl/undo.hxx> #include <vcl/cursor.hxx> #include <vcl/window.hxx> #include <vcl/svapp.hxx> @@ -44,7 +44,7 @@ #include <tools/stream.hxx> #include <sot/formats.hxx> -#include <urlbmk.hxx> +#include <svl/urlbmk.hxx> #ifndef _COM_SUN_STAR_TEXT_XBREAKITERATOR_HPP_ #include <com/sun/star/i18n/XBreakIterator.hpp> diff --git a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx index 1bc83575ec38..584814dd9e92 100644 --- a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx +++ b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx @@ -37,7 +37,7 @@ #include "FilterConfigCache.hxx" #include <osl/file.hxx> #include <osl/module.hxx> -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #include <svtools/fltcall.hxx> #include "dlgexpor.hxx" #include "dlgejpg.hxx" @@ -49,7 +49,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/uno/Any.h> -#include <svtools/syslocale.hxx> +#include <unotools/syslocale.hxx> #include "vcl/svapp.hxx" #if defined WIN || (defined OS2 && !defined ICC) diff --git a/svtools/source/filter.vcl/filter/dlgejpg.hrc b/svtools/source/filter.vcl/filter/dlgejpg.hrc index 4342a89d1d24..67ac915df367 100644 --- a/svtools/source/filter.vcl/filter/dlgejpg.hrc +++ b/svtools/source/filter.vcl/filter/dlgejpg.hrc @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #define BTN_OK 1 #define BTN_CANCEL 1 diff --git a/svtools/source/filter.vcl/filter/dlgepng.hrc b/svtools/source/filter.vcl/filter/dlgepng.hrc index 79d4b189aa5a..d687141abf56 100644 --- a/svtools/source/filter.vcl/filter/dlgepng.hrc +++ b/svtools/source/filter.vcl/filter/dlgepng.hrc @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #define BTN_OK 1 #define BTN_CANCEL 1 diff --git a/svtools/source/filter.vcl/filter/dlgexpor.hrc b/svtools/source/filter.vcl/filter/dlgexpor.hrc index 28921b5f178c..cae15d7276d2 100644 --- a/svtools/source/filter.vcl/filter/dlgexpor.hrc +++ b/svtools/source/filter.vcl/filter/dlgexpor.hrc @@ -27,7 +27,7 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #define BTN_OK_PIX 1 #define BTN_CANCEL_PIX 1 diff --git a/svtools/source/filter.vcl/filter/filter.cxx b/svtools/source/filter.vcl/filter/filter.cxx index 3586ddd02ddd..306307a0bf91 100644 --- a/svtools/source/filter.vcl/filter/filter.cxx +++ b/svtools/source/filter.vcl/filter/filter.cxx @@ -54,7 +54,7 @@ #include "jpeg.hxx" #include "xbmread.hxx" #include "xpmread.hxx" -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #include "strings.hrc" #include "sgffilt.hxx" #include "osl/module.hxx" diff --git a/svtools/source/filter.vcl/filter/filter2.cxx b/svtools/source/filter.vcl/filter/filter2.cxx index d570dd34e50f..9e0e3ba43d54 100644 --- a/svtools/source/filter.vcl/filter/filter2.cxx +++ b/svtools/source/filter.vcl/filter/filter2.cxx @@ -471,7 +471,8 @@ BOOL GraphicDescriptor::ImpDetectJPG( SvStream& rStm, BOOL bExtendedInfo ) // Groesse des verbleibenden Puffers ermitteln if ( bLinked ) - nMax = ( (SvMemoryStream&) rStm ).GetSize() - 16; + nMax = static_cast< SvMemoryStream& >(rStm).GetEndOfData() + - 16; else nMax = DATA_SIZE - 16; diff --git a/svtools/source/filter.vcl/filter/makefile.mk b/svtools/source/filter.vcl/filter/makefile.mk index 2229f8f05546..ecdf48ba5671 100644 --- a/svtools/source/filter.vcl/filter/makefile.mk +++ b/svtools/source/filter.vcl/filter/makefile.mk @@ -40,6 +40,8 @@ LIBTARGET=NO .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/util$/svt.pmk +SOLARINC+=-I../../inc + # --- Files -------------------------------------------------------- SRS1NAME=$(TARGET) diff --git a/svtools/source/filter.vcl/filter/strings.hrc b/svtools/source/filter.vcl/filter/strings.hrc index 0cfa4e6bf7c4..a3356982609a 100644 --- a/svtools/source/filter.vcl/filter/strings.hrc +++ b/svtools/source/filter.vcl/filter/strings.hrc @@ -27,4 +27,4 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> diff --git a/svtools/source/filter.vcl/igif/decode.cxx b/svtools/source/filter.vcl/igif/decode.cxx index 960a91845bf8..9babc02665a3 100644 --- a/svtools/source/filter.vcl/igif/decode.cxx +++ b/svtools/source/filter.vcl/igif/decode.cxx @@ -51,7 +51,6 @@ GIFLZWDecompressor::GIFLZWDecompressor( BYTE cDataSize ) : bEOIFound ( FALSE ), nDataSize ( cDataSize ) { - pTable = new GIFLZWTableEntry[ 4096 ]; pOutBuf = new BYTE[ 4096 ]; nClearCode = 1 << nDataSize; @@ -61,6 +60,8 @@ GIFLZWDecompressor::GIFLZWDecompressor( BYTE cDataSize ) : nOldCode = 0xffff; pOutBufData = pOutBuf + 4096; + pTable = new GIFLZWTableEntry[ 4098 ]; + for( USHORT i = 0; i < nTableSize; i++ ) { pTable[i].pPrev = NULL; diff --git a/svtools/source/filter.vcl/igif/makefile.mk b/svtools/source/filter.vcl/igif/makefile.mk index 0562813c00cc..49e2461bd7a8 100644 --- a/svtools/source/filter.vcl/igif/makefile.mk +++ b/svtools/source/filter.vcl/igif/makefile.mk @@ -38,6 +38,7 @@ TARGET=igif .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/util$/svt.pmk +SOLARINC+=-I../../inc # --- Files -------------------------------------------------------- diff --git a/svtools/source/filter.vcl/ixbm/makefile.mk b/svtools/source/filter.vcl/ixbm/makefile.mk index 9c090e1de04a..41d6f7425474 100644 --- a/svtools/source/filter.vcl/ixbm/makefile.mk +++ b/svtools/source/filter.vcl/ixbm/makefile.mk @@ -38,6 +38,7 @@ TARGET=ixbm .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/util$/svt.pmk +SOLARINC+=-I../../inc # --- Files -------------------------------------------------------- diff --git a/svtools/source/filter.vcl/ixpm/makefile.mk b/svtools/source/filter.vcl/ixpm/makefile.mk index 2e5cb851ebbf..10792f41ab3a 100644 --- a/svtools/source/filter.vcl/ixpm/makefile.mk +++ b/svtools/source/filter.vcl/ixpm/makefile.mk @@ -38,6 +38,7 @@ TARGET=ixpm .INCLUDE : settings.mk .INCLUDE : $(PRJ)$/util$/svt.pmk +SOLARINC+=-I../../inc # --- Files -------------------------------------------------------- diff --git a/svtools/source/filter.vcl/ixpm/xpmread.cxx b/svtools/source/filter.vcl/ixpm/xpmread.cxx index 0aa070e41596..1a667908f2f1 100644 --- a/svtools/source/filter.vcl/ixpm/xpmread.cxx +++ b/svtools/source/filter.vcl/ixpm/xpmread.cxx @@ -109,6 +109,10 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic ) mnColors = ImplGetULONG( 2 ); mnCpp = ImplGetULONG( 3 ); } + if ( mnColors > ( SAL_MAX_UINT32 / ( 4 + mnCpp ) ) ) + mbStatus = sal_False; + if ( ( mnWidth * mnCpp ) >= XPMSTRINGBUF ) + mbStatus = sal_False; if ( mbStatus && mnWidth && mnHeight && mnColors && mnCpp ) { mnIdentifier = XPMCOLORS; @@ -118,15 +122,20 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic ) // 1 Byte -> 0xff wenn Farbe transparent ist // 3 Bytes -> RGB Wert der Farbe mpColMap = new BYTE[ mnColors * ( 4 + mnCpp ) ]; - - for ( ULONG i = 0; i < mnColors; i++ ) + if ( mpColMap ) { - if ( ImplGetColor( i ) == FALSE ) + for ( ULONG i = 0; i < mnColors; i++ ) { - mbStatus = FALSE; - break; + if ( ImplGetColor( i ) == FALSE ) + { + mbStatus = FALSE; + break; + } } } + else + mbStatus = sal_False; + if ( mbStatus ) { // bei mehr als 256 Farben wird eine 24 Bit Grafik erstellt @@ -630,7 +639,7 @@ BOOL XPMReader::ImplGetString( void ) mnStatus &=~XPMSTRING; // end of parameter by eol break; } - if ( mnStringSize >= XPMSTRINGBUF ) + if ( mnStringSize >= ( XPMSTRINGBUF - 1 ) ) { mbStatus = FALSE; break; diff --git a/svtools/source/filter.vcl/jpeg/makefile.mk b/svtools/source/filter.vcl/jpeg/makefile.mk index 86c9c89c8bf0..7a9b5fc509c9 100644 --- a/svtools/source/filter.vcl/jpeg/makefile.mk +++ b/svtools/source/filter.vcl/jpeg/makefile.mk @@ -43,6 +43,8 @@ TARGET=jpeg CFLAGS+=-DSYSTEM_JPEG .ENDIF +SOLARINC+=-I../../inc + # --- Files -------------------------------------------------------- SLOFILES= $(SLO)$/jpegc.obj \ diff --git a/svtools/source/filter.vcl/wmf/emfwr.cxx b/svtools/source/filter.vcl/wmf/emfwr.cxx index df56afc4a250..e011dde1a0e8 100644 --- a/svtools/source/filter.vcl/wmf/emfwr.cxx +++ b/svtools/source/filter.vcl/wmf/emfwr.cxx @@ -33,6 +33,9 @@ #include "emfwr.hxx" #include <vcl/salbtype.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <vcl/lineinfo.hxx> // ----------- // - Defines - @@ -829,6 +832,46 @@ void EMFWriter::ImplWriteTextRecord( const Point& rPos, const String rText, cons // ----------------------------------------------------------------------------- +void EMFWriter::Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon) +{ + if(rLinePolygon.count()) + { + basegfx::B2DPolyPolygon aLinePolyPolygon(rLinePolygon); + basegfx::B2DPolyPolygon aFillPolyPolygon; + + rInfo.applyToB2DPolyPolygon(aLinePolyPolygon, aFillPolyPolygon); + + if(aLinePolyPolygon.count()) + { + for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++) + { + const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a)); + ImplWritePolygonRecord( Polygon(aCandidate), FALSE ); + } + } + + if(aFillPolyPolygon.count()) + { + const Color aOldLineColor(maVDev.GetLineColor()); + const Color aOldFillColor(maVDev.GetFillColor()); + + maVDev.SetLineColor(); + maVDev.SetFillColor(aOldLineColor); + + for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++) + { + const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a)); + ImplWritePolyPolygonRecord(PolyPolygon(Polygon(aPolygon))); + } + + maVDev.SetLineColor(aOldLineColor); + maVDev.SetFillColor(aOldFillColor); + } + } +} + +// ----------------------------------------------------------------------------- + void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) { for( ULONG j = 0, nActionCount = rMtf.GetActionCount(); j < nActionCount; j++ ) @@ -871,20 +914,31 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) { const MetaLineAction* pA = (const MetaLineAction*) pAction; - ImplCheckLineAttr(); + if(pA->GetLineInfo().IsDefault()) + { + ImplCheckLineAttr(); - ImplBeginRecord( WIN_EMR_MOVETOEX ); - ImplWritePoint( pA->GetStartPoint() ); - ImplEndRecord(); + ImplBeginRecord( WIN_EMR_MOVETOEX ); + ImplWritePoint( pA->GetStartPoint() ); + ImplEndRecord(); - ImplBeginRecord( WIN_EMR_LINETO ); - ImplWritePoint( pA->GetEndPoint() ); - ImplEndRecord(); + ImplBeginRecord( WIN_EMR_LINETO ); + ImplWritePoint( pA->GetEndPoint() ); + ImplEndRecord(); - ImplBeginRecord( WIN_EMR_SETPIXELV ); - ImplWritePoint( pA->GetEndPoint() ); - ImplWriteColor( maVDev.GetLineColor() ); - ImplEndRecord(); + ImplBeginRecord( WIN_EMR_SETPIXELV ); + ImplWritePoint( pA->GetEndPoint() ); + ImplWriteColor( maVDev.GetLineColor() ); + ImplEndRecord(); + } + else + { + // LineInfo used; handle Dash/Dot and fat lines + basegfx::B2DPolygon aPolygon; + aPolygon.append(basegfx::B2DPoint(pA->GetStartPoint().X(), pA->GetStartPoint().Y())); + aPolygon.append(basegfx::B2DPoint(pA->GetEndPoint().X(), pA->GetEndPoint().Y())); + Impl_handleLineInfoPolyPolygons(pA->GetLineInfo(), aPolygon); + } } } break; @@ -983,7 +1037,23 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf ) case( META_POLYLINE_ACTION ): { if( maVDev.IsLineColor() ) - ImplWritePolygonRecord( ( (const MetaPolyLineAction*) pAction )->GetPolygon(), FALSE ); + { + const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pAction; + const Polygon& rPoly = pA->GetPolygon(); + + if( rPoly.GetSize() ) + { + if(pA->GetLineInfo().IsDefault()) + { + ImplWritePolygonRecord( rPoly, FALSE ); + } + else + { + // LineInfo used; handle Dash/Dot and fat lines + Impl_handleLineInfoPolyPolygons(pA->GetLineInfo(), rPoly.getB2DPolygon()); + } + } + } } break; diff --git a/svtools/source/filter.vcl/wmf/emfwr.hxx b/svtools/source/filter.vcl/wmf/emfwr.hxx index 150aa1692ade..2d3c8801ba49 100644 --- a/svtools/source/filter.vcl/wmf/emfwr.hxx +++ b/svtools/source/filter.vcl/wmf/emfwr.hxx @@ -42,6 +42,9 @@ // - EMFWriter - // ------------- +class LineInfo; +namespace basegfx { class B2DPolygon; } + class EMFWriter { private: @@ -86,6 +89,7 @@ private: void ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, const Size& rSz, UINT32 nROP ); void ImplWriteTextRecord( const Point& rPos, const String rText, const sal_Int32* pDXArray, sal_uInt32 nWidth ); + void Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon); void ImplWrite( const GDIMetaFile& rMtf ); public: diff --git a/svtools/source/filter.vcl/wmf/wmfwr.cxx b/svtools/source/filter.vcl/wmf/wmfwr.cxx index ee3a71c51f9d..30d4ff06c0d2 100644 --- a/svtools/source/filter.vcl/wmf/wmfwr.cxx +++ b/svtools/source/filter.vcl/wmf/wmfwr.cxx @@ -33,7 +33,7 @@ #include <vcl/salbtype.hxx> #include "wmfwr.hxx" -#include <vcl/fontcvt.hxx> +#include <unotools/fontcvt.hxx> #include <rtl/crc.h> #include <rtl/tencinfo.h> #include <tools/tenccvt.hxx> @@ -42,8 +42,9 @@ #include <i18nutil/unicode.hxx> //unicode::getUnicodeScriptType #endif - #include <vcl/metric.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> //====================== MS-Windows-defines =============================== @@ -755,7 +756,7 @@ void WMFWriter::WMFRecord_Polygon(const Polygon & rPoly) Polygon aSimplePoly; if ( rPoly.HasFlags() ) - rPoly.GetSimple( aSimplePoly ); + rPoly.AdaptiveSubdivide( aSimplePoly ); else aSimplePoly = rPoly; nSize = aSimplePoly.GetSize(); @@ -770,7 +771,7 @@ void WMFWriter::WMFRecord_PolyLine(const Polygon & rPoly) USHORT nSize,i; Polygon aSimplePoly; if ( rPoly.HasFlags() ) - rPoly.GetSimple( aSimplePoly ); + rPoly.AdaptiveSubdivide( aSimplePoly ); else aSimplePoly = rPoly; nSize=aSimplePoly.GetSize(); @@ -792,7 +793,7 @@ void WMFWriter::WMFRecord_PolyPolygon(const PolyPolygon & rPolyPoly) if ( aSimplePolyPoly[ i ].HasFlags() ) { Polygon aSimplePoly; - aSimplePolyPoly[ i ].GetSimple( aSimplePoly ); + aSimplePolyPoly[ i ].AdaptiveSubdivide( aSimplePoly ); aSimplePolyPoly[ i ] = aSimplePoly; } } @@ -1136,6 +1137,49 @@ void WMFWriter::SetAllAttr() } +void WMFWriter::HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon) +{ + if(rLinePolygon.count()) + { + basegfx::B2DPolyPolygon aLinePolyPolygon(rLinePolygon); + basegfx::B2DPolyPolygon aFillPolyPolygon; + + rInfo.applyToB2DPolyPolygon(aLinePolyPolygon, aFillPolyPolygon); + + if(aLinePolyPolygon.count()) + { + aSrcLineInfo = rInfo; + SetLineAndFillAttr(); + + for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++) + { + const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a)); + WMFRecord_PolyLine(Polygon(aCandidate)); + } + } + + if(aFillPolyPolygon.count()) + { + const Color aOldLineColor(aSrcLineColor); + const Color aOldFillColor(aSrcFillColor); + + aSrcLineColor = Color( COL_TRANSPARENT ); + aSrcFillColor = aOldLineColor; + SetLineAndFillAttr(); + + for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++) + { + const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a)); + WMFRecord_Polygon(Polygon(aPolygon)); + } + + aSrcLineColor = aOldLineColor; + aSrcFillColor = aOldFillColor; + SetLineAndFillAttr(); + } + } +} + void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) { ULONG nA, nACount; @@ -1176,10 +1220,21 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) case META_LINE_ACTION: { const MetaLineAction* pA = (const MetaLineAction *) pMA; - aSrcLineInfo = pA->GetLineInfo(); - SetLineAndFillAttr(); - WMFRecord_MoveTo( pA->GetStartPoint() ); - WMFRecord_LineTo( pA->GetEndPoint() ); + if(pA->GetLineInfo().IsDefault()) + { + aSrcLineInfo = pA->GetLineInfo(); + SetLineAndFillAttr(); + WMFRecord_MoveTo( pA->GetStartPoint() ); + WMFRecord_LineTo( pA->GetEndPoint() ); + } + else + { + // LineInfo used; handle Dash/Dot and fat lines + basegfx::B2DPolygon aPolygon; + aPolygon.append(basegfx::B2DPoint(pA->GetStartPoint().X(), pA->GetStartPoint().Y())); + aPolygon.append(basegfx::B2DPoint(pA->GetEndPoint().X(), pA->GetEndPoint().Y())); + HandleLineInfoPolyPolygons(pA->GetLineInfo(), aPolygon); + } } break; @@ -1241,9 +1296,22 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) case META_POLYLINE_ACTION: { const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pMA; - aSrcLineInfo = pA->GetLineInfo(); - SetLineAndFillAttr(); - WMFRecord_PolyLine( pA->GetPolygon() ); + const Polygon& rPoly = pA->GetPolygon(); + + if( rPoly.GetSize() ) + { + if(pA->GetLineInfo().IsDefault()) + { + aSrcLineInfo = pA->GetLineInfo(); + SetLineAndFillAttr(); + WMFRecord_PolyLine( rPoly ); + } + else + { + // LineInfo used; handle Dash/Dot and fat lines + HandleLineInfoPolyPolygons(pA->GetLineInfo(), rPoly.getB2DPolygon()); + } + } } break; diff --git a/svtools/source/filter.vcl/wmf/wmfwr.hxx b/svtools/source/filter.vcl/wmf/wmfwr.hxx index 48986a280404..03ca14e7633f 100644 --- a/svtools/source/filter.vcl/wmf/wmfwr.hxx +++ b/svtools/source/filter.vcl/wmf/wmfwr.hxx @@ -65,6 +65,9 @@ struct WMFWriterAttrStackMember // ------------- class StarSymbolToMSMultiFont; +class LineInfo; +namespace basegfx { class B2DPolygon; } + class WMFWriter { private: @@ -202,6 +205,7 @@ private: void SetLineAndFillAttr(); void SetAllAttr(); + void HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon); void WriteRecords(const GDIMetaFile & rMTF); void WriteHeader(const GDIMetaFile & rMTF, BOOL bPlaceable); diff --git a/svtools/source/inc/hatchwindowfactory.hxx b/svtools/source/hatchwindow/hatchwindowfactory.hxx index 72eaa58bb16d..72eaa58bb16d 100644 --- a/svtools/source/inc/hatchwindowfactory.hxx +++ b/svtools/source/hatchwindow/hatchwindowfactory.hxx diff --git a/svtools/inc/filectrl.hrc b/svtools/source/inc/filectrl.hrc index 13fb89afd382..13fb89afd382 100644 --- a/svtools/inc/filectrl.hrc +++ b/svtools/source/inc/filectrl.hrc diff --git a/svtools/inc/gifread.hxx b/svtools/source/inc/gifread.hxx index 8a9d299930c9..8a9d299930c9 100644 --- a/svtools/inc/gifread.hxx +++ b/svtools/source/inc/gifread.hxx diff --git a/svtools/inc/gradwrap.hxx b/svtools/source/inc/gradwrap.hxx index 28c9d8db1fcd..28c9d8db1fcd 100644 --- a/svtools/inc/gradwrap.hxx +++ b/svtools/source/inc/gradwrap.hxx diff --git a/svtools/inc/iodlg.hrc b/svtools/source/inc/iodlg.hrc index 36e3092064cd..9c41e06a2b6c 100644 --- a/svtools/inc/iodlg.hrc +++ b/svtools/source/inc/iodlg.hrc @@ -32,7 +32,7 @@ #define _SVTOOLS_IODLGIMPL_HRC #ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #endif // ModalDialog DLG_SVT_EXPLORERFILE diff --git a/svtools/inc/jpeg.hxx b/svtools/source/inc/jpeg.hxx index d8de26c31009..d8de26c31009 100644 --- a/svtools/inc/jpeg.hxx +++ b/svtools/source/inc/jpeg.hxx diff --git a/svtools/inc/msgrd.hxx b/svtools/source/inc/msgrd.hxx index 381ae71c7b83..381ae71c7b83 100644 --- a/svtools/inc/msgrd.hxx +++ b/svtools/source/inc/msgrd.hxx diff --git a/svtools/inc/msgwr.hxx b/svtools/source/inc/msgwr.hxx index c347938fd34d..c347938fd34d 100644 --- a/svtools/inc/msgwr.hxx +++ b/svtools/source/inc/msgwr.hxx diff --git a/svtools/inc/property.hxx b/svtools/source/inc/property.hxx index cfdc62dd350c..2a756f177608 100644 --- a/svtools/inc/property.hxx +++ b/svtools/source/inc/property.hxx @@ -54,17 +54,17 @@ #endif #include <vcl/combobox.hxx> #include <vcl/field.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <vcl/virdev.hxx> #include <vcl/scrbar.hxx> -#include <svtools/svarray.hxx> +#include <svl/svarray.hxx> #ifndef _SVSTDARR_STRINGS #define _SVSTDARR_STRINGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <vcl/tabpage.hxx> #include <vcl/tabctrl.hxx> diff --git a/svtools/inc/sgfbram.hxx b/svtools/source/inc/sgfbram.hxx index ca7e90b59cd4..ca7e90b59cd4 100644 --- a/svtools/inc/sgfbram.hxx +++ b/svtools/source/inc/sgfbram.hxx diff --git a/svtools/inc/sgffilt.hxx b/svtools/source/inc/sgffilt.hxx index a93522fcf590..a93522fcf590 100644 --- a/svtools/inc/sgffilt.hxx +++ b/svtools/source/inc/sgffilt.hxx diff --git a/svtools/inc/sgvmain.hxx b/svtools/source/inc/sgvmain.hxx index 58e43e0a00b2..58e43e0a00b2 100644 --- a/svtools/inc/sgvmain.hxx +++ b/svtools/source/inc/sgvmain.hxx diff --git a/svtools/inc/sgvspln.hxx b/svtools/source/inc/sgvspln.hxx index 7e9976eaf25b..7e9976eaf25b 100644 --- a/svtools/inc/sgvspln.hxx +++ b/svtools/source/inc/sgvspln.hxx diff --git a/svtools/inc/svimpbox.hxx b/svtools/source/inc/svimpbox.hxx index 10463fc05906..10463fc05906 100644 --- a/svtools/inc/svimpbox.hxx +++ b/svtools/source/inc/svimpbox.hxx diff --git a/svtools/inc/svimpicn.hxx b/svtools/source/inc/svimpicn.hxx index 724a92543700..724a92543700 100644 --- a/svtools/inc/svimpicn.hxx +++ b/svtools/source/inc/svimpicn.hxx diff --git a/svtools/inc/xbmread.hxx b/svtools/source/inc/xbmread.hxx index c9623fbb2cda..c9623fbb2cda 100644 --- a/svtools/inc/xbmread.hxx +++ b/svtools/source/inc/xbmread.hxx diff --git a/svtools/inc/xpmread.hxx b/svtools/source/inc/xpmread.hxx index f1a76c9bc62f..f1a76c9bc62f 100644 --- a/svtools/inc/xpmread.hxx +++ b/svtools/source/inc/xpmread.hxx diff --git a/svtools/source/items/makefile.mk b/svtools/source/items/makefile.mk deleted file mode 100644 index 651e54bb7e23..000000000000 --- a/svtools/source/items/makefile.mk +++ /dev/null @@ -1,65 +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: makefile.mk,v $ -# -# $Revision: 1.13 $ -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJNAME=svtools -TARGET=items -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/util$/svt.pmk - -# --- Files -------------------------------------------------------- - -SLOFILES=\ - $(SLO)$/aeitem.obj \ - $(SLO)$/eitem.obj \ - $(SLO)$/flagitem.obj \ - $(SLO)$/globalnameitem.obj \ - $(SLO)$/imageitm.obj \ - $(SLO)$/intitem.obj \ - $(SLO)$/itemdel.obj \ - $(SLO)$/macitem.obj \ - $(SLO)$/poolcach.obj \ - $(SLO)$/ptitem.obj \ - $(SLO)$/rectitem.obj \ - $(SLO)$/rngitem.obj \ - $(SLO)$/stritem.obj \ - $(SLO)$/style.obj \ - $(SLO)$/szitem.obj \ - $(SLO)$/wallitem.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/svtools/source/items1/bintitem.cxx b/svtools/source/items1/bintitem.cxx deleted file mode 100644 index a3b6c1c2b54d..000000000000 --- a/svtools/source/items1/bintitem.cxx +++ /dev/null @@ -1,169 +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: bintitem.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" -#include <com/sun/star/uno/Any.hxx> -#include <tools/stream.hxx> -#include <tools/bigint.hxx> -#include <svtools/bintitem.hxx> - -// STATIC DATA - -DBG_NAME(SfxBigIntItem) - -// RTTI -TYPEINIT1_AUTOFACTORY(SfxBigIntItem, SfxPoolItem); - -// SfxBigIntItem - -//============================================================================ -SfxBigIntItem::SfxBigIntItem() - : SfxPoolItem(0), - aVal(0) -{ - DBG_CTOR(SfxBigIntItem, 0); -} - -//============================================================================ -SfxBigIntItem::SfxBigIntItem(USHORT which, const BigInt& rValue) - : SfxPoolItem(which), - aVal(rValue) -{ - DBG_CTOR(SfxBigIntItem, 0); -} - -//============================================================================ -SfxBigIntItem::SfxBigIntItem(USHORT which, SvStream &rStream) - : SfxPoolItem(which) -{ - DBG_CTOR(SfxBigIntItem, 0); - ByteString sTmp; - rStream.ReadByteString(sTmp); - BigInt aTmp(sTmp); - aVal = aTmp; -} - -//============================================================================ -SfxBigIntItem::SfxBigIntItem(const SfxBigIntItem& rItem) - : SfxPoolItem(rItem), - aVal(rItem.aVal) -{ - DBG_CTOR(SfxBigIntItem, 0); -} - -//============================================================================ -SfxItemPresentation SfxBigIntItem::GetPresentation( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * ) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - rText = aVal.GetString(); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//============================================================================ -int SfxBigIntItem::operator==(const SfxPoolItem& rItem) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - DBG_ASSERT(SfxPoolItem::operator==(rItem), "unequal type"); - return ((SfxBigIntItem&)rItem).aVal == aVal; -} - -//============================================================================ -int SfxBigIntItem::Compare(const SfxPoolItem& rItem) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - DBG_ASSERT(SfxPoolItem::operator==(rItem), "unequal type"); - - if (((const SfxBigIntItem&)rItem ).aVal < aVal ) - return -1; - else if (((const SfxBigIntItem&)rItem ).aVal == aVal) - return 0; - else - return 1; -} - -//============================================================================ -SfxPoolItem* SfxBigIntItem::Clone(SfxItemPool *) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - return new SfxBigIntItem(*this); -} - -//============================================================================ -SfxPoolItem* SfxBigIntItem::Create(SvStream &rStream, USHORT) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - return new SfxBigIntItem(Which(), rStream); -} - -//============================================================================ -SvStream& SfxBigIntItem::Store(SvStream &rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - rStream.WriteByteString( aVal.GetByteString() ); - return rStream; -} - -//============================================================================ -SfxFieldUnit SfxBigIntItem::GetUnit() const -{ - DBG_CHKTHIS(SfxBigIntItem, 0); - return SFX_FUNIT_NONE; -} - -//============================================================================ -// virtual -BOOL SfxBigIntItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE ) -{ - double aValue = 0.0; - if ( rVal >>= aValue ) - { - SetValue( aValue ); - return TRUE; - } - - DBG_ERROR( "SfxBigIntItem::PutValue - Wrong type!" ); - return FALSE; -} - -//============================================================================ -// virtual -BOOL SfxBigIntItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const -{ - double aValue = GetValue(); - rVal <<= aValue; - return TRUE; -} - diff --git a/svtools/source/items1/cstitem.cxx b/svtools/source/items1/cstitem.cxx deleted file mode 100644 index 9755f4bb9944..000000000000 --- a/svtools/source/items1/cstitem.cxx +++ /dev/null @@ -1,252 +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: cstitem.cxx,v $ - * $Revision: 1.9 $ - * - * 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 <com/sun/star/uno/Any.hxx> - -#include <unotools/intlwrapper.hxx> - -#include <tools/stream.hxx> -#include <tools/debug.hxx> -#include <tools/datetime.hxx> - -#include <svtools/svtdata.hxx> -#include <svtools/cstitem.hxx> - -#include <svtools/svtools.hrc> -#include <com/sun/star/lang/Locale.hpp> - -DBG_NAME( SfxCrawlStatusItem ) -TYPEINIT1( SfxCrawlStatusItem, SfxPoolItem ); - -// ----------------------------------------------------------------------- - -SfxCrawlStatusItem::SfxCrawlStatusItem( USHORT which ) : - SfxPoolItem( which ) -{ - DBG_CTOR( SfxCrawlStatusItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxCrawlStatusItem::SfxCrawlStatusItem( USHORT which, CrawlStatus eStat ) : - SfxPoolItem( which ), - eStatus( eStat ) -{ - DBG_CTOR( SfxCrawlStatusItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxCrawlStatusItem::SfxCrawlStatusItem( const SfxCrawlStatusItem& rItem ) : - SfxPoolItem( rItem ), - eStatus( rItem.eStatus ) -{ - DBG_CTOR( SfxCrawlStatusItem, 0 ); -} - -// ----------------------------------------------------------------------- - -int SfxCrawlStatusItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxCrawlStatusItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - return ((SfxCrawlStatusItem&)rItem).eStatus == eStatus; -} - -// ----------------------------------------------------------------------- - -int SfxCrawlStatusItem::Compare( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxCrawlStatusItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - if( ((const SfxCrawlStatusItem&)rItem).eStatus < eStatus ) - return -1; - else if( ((const SfxCrawlStatusItem&)rItem).eStatus == eStatus ) - return 0; - else - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxCrawlStatusItem::Create( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxCrawlStatusItem, 0); - - USHORT _eStatus; - rStream >> _eStatus; - - return new SfxCrawlStatusItem( Which(), (CrawlStatus)_eStatus ); -} - -// ----------------------------------------------------------------------- - -SvStream& SfxCrawlStatusItem::Store( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS( SfxCrawlStatusItem, 0 ); - - USHORT nStatus = (USHORT)eStatus; - rStream << (USHORT) nStatus; - - return rStream; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxCrawlStatusItem::Clone( SfxItemPool* ) const -{ - DBG_CHKTHIS( SfxCrawlStatusItem, 0 ); - return new SfxCrawlStatusItem( *this ); -} -// ----------------------------------------------------------------------- - -SfxItemPresentation SfxCrawlStatusItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * pIntlWrapper -) const -{ - DBG_CHKTHIS(SfxCrawlStatusItem, 0); - DBG_ASSERT(pIntlWrapper, - "SfxCrawlStatusItem::GetPresentation():" - " Using default IntlWrapper"); - - ::com::sun::star::lang::Locale aLocale; - - switch (eStatus) - { - case CSTAT_NEVER_UPD: - rText = String(SvtResId(STR_CSTAT_NEVER_UPD, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_IN_UPD: - rText = String(SvtResId(STR_CSTAT_IN_UPD, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_UPD_NEWER: - rText = String(SvtResId(STR_CSTAT_UPD_NEWER, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_UPD_NOT_NEWER: - rText = String(SvtResId(STR_CSTAT_UPD_NOT_NEWER, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_UPD_CANCEL: - rText = String(SvtResId(STR_CSTAT_UPD_CANCEL, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_ERR_GENERAL: - rText = String(SvtResId(STR_CSTAT_ERR_GENERAL, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_ERR_NOTEXISTS: - rText = String(SvtResId(STR_CSTAT_ERR_NOTEXISTS, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_ERR_NOTREACHED: - rText = String(SvtResId(STR_CSTAT_ERR_NOTREACHED, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_UPD_IMMEDIATELY: - rText = String(SvtResId(STR_CSTAT_UPD_IMMEDIATELY, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - case CSTAT_ERR_OFFLINE: - rText = String(SvtResId(STR_CSTAT_ERR_OFFLINE, - pIntlWrapper ? - pIntlWrapper->getLocale() : - aLocale)); - break; - - default: - rText.Erase(); - break; - } - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxCrawlStatusItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE ) -{ - sal_Int16 aValue = sal_Int16(); - if ( rVal >>= aValue ) - { - SetStatus( static_cast< CrawlStatus >( aValue ) ); - return TRUE; - } - - DBG_ERROR( "SfxCrawlStatusItem::PutValue - Wrong type!" ); - return FALSE; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxCrawlStatusItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const -{ - sal_Int16 aValue = sal::static_int_cast< sal_Int16 >(GetStatus()); - rVal <<= aValue; - return TRUE; -} - diff --git a/svtools/source/items1/cstitem.src b/svtools/source/items1/cstitem.src deleted file mode 100644 index 8d6e2d0280c0..000000000000 --- a/svtools/source/items1/cstitem.src +++ /dev/null @@ -1,112 +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: cstitem.src,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. - * - ************************************************************************/ - -#include <svtools/svtools.hrc> -String STR_CSTAT_NEVER_UPD -{ - Text [ en-US ] = "No update has occurred" ; -}; -String STR_CSTAT_IN_UPD -{ - Text [ en-US ] = "Updating in progress" ; -}; -String STR_CSTAT_UPD_NEWER -{ - Text [ en-US ] = "Changes discovered" ; -}; -String STR_CSTAT_UPD_NOT_NEWER -{ - Text [ en-US ] = "No changes discovered" ; -}; -String STR_CSTAT_UPD_CANCEL -{ - Text [ en-US ] = "Canceled by user" ; -}; -String STR_CSTAT_UPD_IMMEDIATELY -{ - Text [ en-US ] = "Updating immediately" ; -}; -String STR_CSTAT_ERR_OFFLINE -{ - Text [ en-US ] = "failed, you have not been online" ; -}; -String STR_CSTAT_ERR_GENERAL -{ - Text [ en-US ] = "General error" ; -}; -String STR_CSTAT_ERR_NOTEXISTS -{ - Text [ en-US ] = "Server does not exist" ; -}; -String STR_CSTAT_ERR_NOTREACHED -{ - Text [ en-US ] = "Server not available" ; -}; -String STR_COLUM_DT_AUTO -{ - Text [ en-US ] = "automatic" ; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/svtools/source/items1/dtritem.cxx b/svtools/source/items1/dtritem.cxx deleted file mode 100644 index fa3a36b762f5..000000000000 --- a/svtools/source/items1/dtritem.cxx +++ /dev/null @@ -1,244 +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: dtritem.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" -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/util/DateTimeRange.hpp> - -#include <unotools/intlwrapper.hxx> -#include <comphelper/processfactory.hxx> - -#include <tools/stream.hxx> -#include <tools/debug.hxx> -#include <tools/datetime.hxx> -#include <rtl/math.hxx> - -#include <vcl/svapp.hxx> - -#include <svtools/dtritem.hxx> - - -DBG_NAME( SfxDateTimeRangeItem ) -TYPEINIT1( SfxDateTimeRangeItem, SfxPoolItem ); - -// ----------------------------------------------------------------------- - -SfxDateTimeRangeItem::SfxDateTimeRangeItem( USHORT which ) : - SfxPoolItem( which ) -{ - DBG_CTOR( SfxDateTimeRangeItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxDateTimeRangeItem::SfxDateTimeRangeItem( USHORT which, const DateTime& rStartDT, - const DateTime& rEndDT ) : - SfxPoolItem( which ), - aStartDateTime( rStartDT ), - aEndDateTime( rEndDT ) -{ - DBG_CTOR( SfxDateTimeRangeItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxDateTimeRangeItem::SfxDateTimeRangeItem( const SfxDateTimeRangeItem& rItem ) : - SfxPoolItem( rItem ), - aStartDateTime( rItem.aStartDateTime ), - aEndDateTime( rItem.aEndDateTime ) -{ - DBG_CTOR( SfxDateTimeRangeItem, 0 ); -} - -// ----------------------------------------------------------------------- - -int SfxDateTimeRangeItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - return ((SfxDateTimeRangeItem&)rItem ).aStartDateTime == aStartDateTime && - ((SfxDateTimeRangeItem&)rItem ).aEndDateTime == aEndDateTime; -} - -// ----------------------------------------------------------------------- - -int SfxDateTimeRangeItem::Compare( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - double fThisRange = aEndDateTime - aStartDateTime; - double fRange = ((const SfxDateTimeRangeItem&)rItem).aEndDateTime - - ((const SfxDateTimeRangeItem&)rItem).aStartDateTime; - - if ( ::rtl::math::approxEqual( fRange, fThisRange ) ) - return 0; - else if ( fRange < fThisRange ) - return -1; - else - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxDateTimeRangeItem::Create( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxDateTimeRangeItem, 0); - - sal_uInt32 nStartDate, nEndDate; - sal_Int32 nStartTime, nEndTime; - - rStream >> nStartDate; - rStream >> nStartTime; - - rStream >> nEndDate; - rStream >> nEndTime; - - DateTime aStartDT, aEndDT; - - aStartDT.SetDate( nStartDate ); - aStartDT.SetTime( nStartTime ); - - aEndDT.SetDate( nEndDate ); - aEndDT.SetTime( nEndTime ); - - return new SfxDateTimeRangeItem( Which(), aStartDT, aEndDT ); -} - -// ----------------------------------------------------------------------- - -SvStream& SfxDateTimeRangeItem::Store( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); - - rStream << aStartDateTime.GetDate(); - rStream << aStartDateTime.GetTime(); - - rStream << aEndDateTime.GetDate(); - rStream << aEndDateTime.GetTime(); - - return rStream; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxDateTimeRangeItem::Clone( SfxItemPool* ) const -{ - DBG_CHKTHIS( SfxDateTimeRangeItem, 0 ); - - return new SfxDateTimeRangeItem( *this ); -} -// ----------------------------------------------------------------------- - -SfxItemPresentation SfxDateTimeRangeItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * pIntlWrapper -) const -{ - DBG_CHKTHIS(SfxDateTimeRangeItem, 0); - DateTime aRange(aEndDateTime - (const Time&)aStartDateTime); - if (pIntlWrapper) - { - rText = pIntlWrapper->getLocaleData()->getDate(aRange); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += pIntlWrapper->getLocaleData()->getTime(aRange); - } - else - { - DBG_WARNING("SfxDateTimeRangeItem::GetPresentation():" - " Using default en_US IntlWrapper"); - const IntlWrapper aIntlWrapper( - ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US ); - rText = aIntlWrapper.getLocaleData()->getDate(aRange); - rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); - rText += aIntlWrapper.getLocaleData()->getTime(aRange); - } - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxDateTimeRangeItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE ) -{ - com::sun::star::util::DateTimeRange aValue; - if ( rVal >>= aValue ) - { - aStartDateTime = DateTime( Date( aValue.StartDay, - aValue.StartMonth, - aValue.StartYear ), - Time( aValue.StartHours, - aValue.StartMinutes, - aValue.StartSeconds, - aValue.StartHundredthSeconds ) ); - aEndDateTime = DateTime( Date( aValue.EndDay, - aValue.EndMonth, - aValue.EndYear ), - Time( aValue.EndHours, - aValue.EndMinutes, - aValue.EndSeconds, - aValue.EndHundredthSeconds ) ); - return TRUE; - } - - DBG_ERROR( "SfxDateTimeRangeItem::PutValue - Wrong type!" ); - return FALSE; -} - -//---------------------------------------------------------------------------- -// virtual -BOOL SfxDateTimeRangeItem::QueryValue( com::sun::star::uno::Any& rVal, - BYTE nMemberId ) const -{ - nMemberId &= ~CONVERT_TWIPS; - com::sun::star::util::DateTimeRange aValue( aStartDateTime.Get100Sec(), - aStartDateTime.GetSec(), - aStartDateTime.GetMin(), - aStartDateTime.GetHour(), - aStartDateTime.GetDay(), - aStartDateTime.GetMonth(), - aStartDateTime.GetYear(), - aEndDateTime.Get100Sec(), - aEndDateTime.GetSec(), - aEndDateTime.GetMin(), - aEndDateTime.GetHour(), - aEndDateTime.GetDay(), - aEndDateTime.GetMonth(), - aEndDateTime.GetYear() ); - rVal <<= aValue; - return TRUE; -} - - diff --git a/svtools/source/items1/frqitem.cxx b/svtools/source/items1/frqitem.cxx deleted file mode 100644 index 4068ef8f97f1..000000000000 --- a/svtools/source/items1/frqitem.cxx +++ /dev/null @@ -1,580 +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: frqitem.cxx,v $ - * $Revision: 1.8.136.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_svtools.hxx" -#ifndef GCC -#endif - -#include <unotools/intlwrapper.hxx> - -#include <tools/stream.hxx> -#include <tools/debug.hxx> -#include <tools/datetime.hxx> - -#include <svtools/frqitem.hxx> - -DBG_NAME( SfxFrequencyItem ) - -TYPEINIT1( SfxFrequencyItem, SfxPoolItem ); - -#define MAX_GOTO 32000 - -#define DECL_SAVE_GOTO() \ - ULONG nSafetyMeasures = 0; - -#define SAVE_GOTO(tag) \ - if(nSafetyMeasures < MAX_GOTO) \ - { nSafetyMeasures++; goto tag; } - -// ----------------------------------------------------------------------- - -SfxFrequencyItem::SfxFrequencyItem( USHORT which ) : - SfxPoolItem ( which ), - eFrqMode ( FRQ_DAILY ), - eFrqTimeMode ( FRQ_TIME_AT ), - nDInterval1 ( 1 ), - nDInterval2 ( 0 ), - nDInterval3 ( 0 ), - nTInterval1 ( 1 ), - aTime1 ( Time( 12, 0, 0 ) ), - aTime2 ( Time( 12, 0, 0 ) ), - bMissingDate ( FALSE ), - aMissingDate ( DateTime(0, 0) ) -{ - DBG_CTOR( SfxFrequencyItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxFrequencyItem::SfxFrequencyItem( USHORT which, FrequencyMode eMode, FrequencyTimeMode eTMode, - USHORT nDI1, USHORT nDI2, USHORT nDI3, USHORT nTI1, - const Time& rT1, const Time& rT2 ) : - SfxPoolItem ( which ), - eFrqMode ( eMode ), - eFrqTimeMode ( eTMode ), - nDInterval1 ( nDI1 ), - nDInterval2 ( nDI2 ), - nDInterval3 ( nDI3 ), - nTInterval1 ( nTI1 ), - aTime1 ( rT1 ), - aTime2 ( rT2 ), - bMissingDate ( FALSE ) -{ - DBG_CTOR( SfxFrequencyItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxFrequencyItem::SfxFrequencyItem( const SfxFrequencyItem& rItem ) : - SfxPoolItem ( rItem ), - eFrqMode ( rItem.eFrqMode ), - eFrqTimeMode ( rItem.eFrqTimeMode ), - nDInterval1 ( rItem.nDInterval1 ), - nDInterval2 ( rItem.nDInterval2 ), - nDInterval3 ( rItem.nDInterval3 ), - nTInterval1 ( rItem.nTInterval1 ), - aTime1 ( rItem.aTime1 ), - aTime2 ( rItem.aTime2 ), - bMissingDate ( rItem.bMissingDate ) -{ - DBG_CTOR( SfxFrequencyItem, 0 ); -} - -// ----------------------------------------------------------------------- - -int SfxFrequencyItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxFrequencyItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - return ((SfxFrequencyItem&)rItem ).eFrqMode == eFrqMode && - ((SfxFrequencyItem&)rItem ).eFrqTimeMode == eFrqTimeMode && - ((SfxFrequencyItem&)rItem ).nDInterval1 == nDInterval1 && - ((SfxFrequencyItem&)rItem ).nDInterval2 == nDInterval2 && - ((SfxFrequencyItem&)rItem ).nDInterval3 == nDInterval3 && - ((SfxFrequencyItem&)rItem ).nTInterval1 == nTInterval1 && - ((SfxFrequencyItem&)rItem ).aTime1 == aTime1 && - ((SfxFrequencyItem&)rItem ).aTime2 == aTime2; -} - -// ----------------------------------------------------------------------- - -int SfxFrequencyItem::Compare( const SfxPoolItem& -#ifdef DBG_UTIL -rItem -#endif -) const -{ - DBG_CHKTHIS( SfxFrequencyItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - -/* DateTime aThisRange( aEndDateTime - aStartDateTime ); - DateTime aRange(((const SfxFrequencyItem&)rItem).aEndDateTime - - ((const SfxFrequencyItem&)rItem).aStartDateTime ); - if( aRange < aThisRange ) - return -1; - else if( aRange == aThisRange ) - return 0; - else -*/ - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxFrequencyItem::Create( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxFrequencyItem, 0); - - USHORT _eFrqMode; - USHORT _eFrqTimeMode; - USHORT _nDInterval1; - USHORT _nDInterval2; - USHORT _nDInterval3; - USHORT _nTInterval1; - long _nTime1; - long _nTime2; - - rStream >> _eFrqMode; - rStream >> _eFrqTimeMode; - rStream >> _nDInterval1; - rStream >> _nDInterval2; - rStream >> _nDInterval3; - rStream >> _nTInterval1; - rStream >> _nTime1; - rStream >> _nTime2; - - return new SfxFrequencyItem( Which(), (FrequencyMode)_eFrqMode, - (FrequencyTimeMode) _eFrqTimeMode, _nDInterval1, _nDInterval2, _nDInterval3, - _nTInterval1, Time(_nTime1), Time(_nTime2) ); -} - -// ----------------------------------------------------------------------- - -SvStream& SfxFrequencyItem::Store( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS( SfxFrequencyItem, 0 ); - - USHORT nEMode = (USHORT)eFrqMode; - USHORT nETimeMode = (USHORT)eFrqTimeMode; - - rStream << (USHORT) nEMode; - rStream << (USHORT) nETimeMode; - - rStream << nDInterval1; - rStream << nDInterval2; - rStream << nDInterval3; - - rStream << nTInterval1; - rStream << aTime1.GetTime(); - rStream << aTime2.GetTime(); - - return rStream; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxFrequencyItem::Clone( SfxItemPool* ) const -{ - DBG_CHKTHIS( SfxFrequencyItem, 0 ); - return new SfxFrequencyItem( *this ); -} - -// ----------------------------------------------------------------------- - -SfxItemPresentation SfxFrequencyItem::GetPresentation -( - SfxItemPresentation /*ePresentation*/, - SfxMapUnit /*eCoreMetric*/, - SfxMapUnit /*ePresentationMetric*/, - XubString& rText, - const IntlWrapper * -) const -{ - DBG_CHKTHIS(SfxFrequencyItem, 0); - rText.AssignAscii(RTL_CONSTASCII_STRINGPARAM("SNIY")); - return SFX_ITEM_PRESENTATION_NAMELESS; -} - -// ----------------------------------------------------------------------- - -Time SfxFrequencyItem::_CalcTime( BOOL bForToday ) const -{ - Time aNow; - Time aTime; - - DECL_SAVE_GOTO(); - - switch( eFrqTimeMode ) - { - ////////////////////////////////////////////////////////// - // FRQ_TIME_AT - // - // Update um Uhrzeit - // nTime1 = 00:00:00 - 24:00:00 - // - case FRQ_TIME_AT : - aTime = aTime1; - break; - - ////////////////////////////////////////////////////////// - // FRQ_TIME_REPEAT - // - // Wiederhole alle X Stunden - // nTInterval1 = 1 .. 8 - // - case FRQ_TIME_REPEAT : - aTime = Time( 0, 0 ); - if( bForToday ) - { - - RECALC_TIME_REPEAT: - if( aNow > aTime ) - { - aTime += Time( nTInterval1, 0 ); - SAVE_GOTO( RECALC_TIME_REPEAT ); - } - break; - } - break; - - ////////////////////////////////////////////////////////// - // FRQ_TIME_REPEAT_RANGE - // - // FRQ_TIME_REPEAT zwischen Uhrzeit 1 und 2 - // nTime1 = 00:00:00 - 24:00:00 - // nTime2 = 00:00:00 - 24:00:00 - // - case FRQ_TIME_REPEAT_RANGE : - aTime = aTime1; - if( bForToday ) - { - if( aNow > aTime2 ) - return aTime1; - - RECALC_TIME_REPEAT_RANGE: - if( aNow > aTime ) - { - aTime += Time( nTInterval1, 0 ); - if( aTime > aTime2 ) - return aTime1; - SAVE_GOTO( RECALC_TIME_REPEAT_RANGE ); - } - break; - } - break; - } - return aTime; -} - -DateTime SfxFrequencyItem::CalcNextTick( const DateTime& rBase, BOOL bFirst ) -{ - Date aDateToday; - Time aTimeToday; - Date aDateBase; - Time aTimeBase; - - if( bFirst ) - { - aDateBase = Date( 17, 2, 1969 ); - aTimeBase = Time( 8, 0, 0 ); - } - else - { - aDateBase = rBase.GetDate(); - aTimeBase = rBase.GetTime(); - } - - Time aNextTime( _CalcTime(FALSE) ); - Date aNextDate( aDateBase ); - bMissingDate = FALSE; - - DECL_SAVE_GOTO(); - - switch( eFrqMode ) - { - ////////////////////////////////////////////////////////// - // FRQ_DAILY - // - // jeden X'ten Tag - // nInterval1 = 1 .. 999 - // - // jeden Wochentag - // nInterval1 = USHRT_MAX - // - case FRQ_DAILY : - { - if( bFirst ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - aNextTime = _CalcTime( FALSE ); - aNextDate = aDateToday + (USHORT) - ((nDInterval1 == USHRT_MAX)? 1 : nDInterval1); - } - else - aNextDate = aDateToday; - break; - } - - RECALC_FRQ_DAILY: - if( aNextDate < aDateToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - aNextDate += (USHORT)((nDInterval1 == USHRT_MAX)? 1 : nDInterval1); - SAVE_GOTO( RECALC_FRQ_DAILY ); - } - - if( aNextDate == aDateToday ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - aNextDate += (USHORT)((nDInterval1 == USHRT_MAX)? 1 : nDInterval1); - aNextTime = _CalcTime( FALSE ); - } - } - else - aNextTime = _CalcTime( FALSE ); - } break; - - ////////////////////////////////////////////////////////// - // FRQ_WEEKLY - // wiederhole jede X'te Woche - // nInterval1 = 1 .. 99 - // - // an SU, MO, TU, WE, TH, FR, SA - // nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY | - // WD_WEDNESDAY | WD_THURSDAY | WD_FRIDAY | - // WD_SATURDAY - // - case FRQ_WEEKLY : - { - BOOL bInRecalc = FALSE; - - RECALC_FRQ_WEEKLY: - if( !bFirst || bInRecalc ) - aNextDate += (nDInterval1 - 1) * 7; - - aNextDate -= (USHORT) ((aNextDate.GetDayOfWeek() != SUNDAY) ? - aNextDate.GetDayOfWeek() + 1 : 0); - - if( nDInterval2 & WD_SUNDAY && (aNextDate >= aDateToday) ) - aNextDate += 0; - else if( nDInterval2 & WD_MONDAY && (aNextDate + 1 >= aDateToday) ) - aNextDate += 1; - else if( nDInterval2 & WD_TUESDAY && (aNextDate + 2 >= aDateToday) ) - aNextDate += 2; - else if( nDInterval2 & WD_WEDNESDAY && (aNextDate + 3 >= aDateToday) ) - aNextDate += 3; - else if( nDInterval2 & WD_THURSDAY && (aNextDate + 4 >= aDateToday) ) - aNextDate += 4; - else if( nDInterval2 & WD_FRIDAY && (aNextDate + 5 >= aDateToday) ) - aNextDate += 5; - else if( nDInterval2 & WD_SATURDAY && (aNextDate + 6 >= aDateToday) ) - aNextDate += 6; - - if( aNextDate < aDateToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - aNextDate += 7; - SAVE_GOTO( RECALC_FRQ_WEEKLY ); - } - if( aNextDate == aDateToday ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - bInRecalc = TRUE; - aNextDate += 7; - SAVE_GOTO( RECALC_FRQ_WEEKLY ); - } - } - else - aNextTime = _CalcTime( FALSE ); - } break; - - ////////////////////////////////////////////////////////// - // FRQ_MONTHLY_DAILY - // - // jeden X'ten Tag von jedem X'ten Monat - // nInterval1 = 1 .. 31 - // nInterval2 = 1 .. 6 - // - case FRQ_MONTHLY_DAILY : - { - BOOL bInRecalc = FALSE; - aNextDate.SetDay( nDInterval1 ); - - RECALC_FRQ_MONTHLY_DAILY: - if( nDInterval2 > 1 || bInRecalc ) - { - long nMonth = aNextDate.GetMonth() - 1; - nMonth += nDInterval2; - aNextDate.SetYear( - sal::static_int_cast< USHORT >( - aNextDate.GetYear() + nMonth / 12 ) ); - aNextDate.SetMonth( - sal::static_int_cast< USHORT >( ( nMonth % 12 ) + 1 ) ); - } - - if( aNextDate < aDateToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - SAVE_GOTO( RECALC_FRQ_MONTHLY_DAILY ); - } - - if( aNextDate == aDateToday ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - SAVE_GOTO( RECALC_FRQ_MONTHLY_DAILY ); - } - } - else - aNextTime = _CalcTime( FALSE ); - } break; - - ////////////////////////////////////////////////////////// - // FRQ_MONTHLY_LOGIC - // - // jeden ersten, zweiten, dritten, vierten oder letzten - // Wochentag jeden X'ten Monats - // nInterval1 = 0 .. 4 - // nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY | - // WD_WEDNESDAY | WD_THURSDAY | WD_FRIDAY | - // WD_SATURDAY - // nInterval3 = 1 .. 6 - // - case FRQ_MONTHLY_LOGIC : - { - BOOL bInRecalc = FALSE; - - RECALC_FRQ_MONTHLY_LOGIC: - if( nDInterval3 > 1 || bInRecalc ) - { - long nMonth = aNextDate.GetMonth() - 1; - nMonth += nDInterval3; - aNextDate.SetYear( - sal::static_int_cast< USHORT >( - aNextDate.GetYear() + nMonth / 12 ) ); - aNextDate.SetMonth( - sal::static_int_cast< USHORT >( ( nMonth % 12 ) + 1 ) ); - } - - USHORT nDay; - if( nDInterval2 & WD_SUNDAY ) - nDay = 6; - else if( nDInterval2 & WD_MONDAY ) - nDay = 0; - else if( nDInterval2 & WD_TUESDAY ) - nDay = 1; - else if( nDInterval2 & WD_WEDNESDAY ) - nDay = 2; - else if( nDInterval2 & WD_THURSDAY ) - nDay = 3; - else if( nDInterval2 & WD_FRIDAY ) - nDay = 4; - else nDay = 5; - - if( nDInterval1 == 4 ) - { - DateTime aDT = aNextDate; - aDT.SetDay( 1 ); - aDT += (long)(aNextDate.GetDaysInMonth() - 1); - if( aDT.GetDayOfWeek() != nDay ) - for( aDT--; aDT.GetDayOfWeek() != nDay; aDT-- ) ; - aNextDate = aDT; - } - else - { - DateTime aDT = aNextDate; - aDT.SetDay( 1 ); - aDT += (long)(nDay - USHORT(aDT.GetDayOfWeek())); - if( aDT.GetMonth() != aNextDate.GetMonth() ) - aDT += 7L; - aDT += (long)(nDInterval1 * 7); - aNextDate = aDT; - } - - if( aNextDate < aDateToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - SAVE_GOTO( RECALC_FRQ_MONTHLY_LOGIC ); - } - - if( aNextDate == aDateToday ) - { - aNextTime = _CalcTime( TRUE ); - if( aNextTime < aTimeToday ) - { - bMissingDate = TRUE; - aMissingDate.SetDate(aNextDate.GetDate()); - aMissingDate.SetTime(_CalcTime(FALSE).GetTime()); - - bInRecalc = TRUE; - SAVE_GOTO( RECALC_FRQ_MONTHLY_LOGIC ); - } - } - else - aNextTime = _CalcTime( FALSE ); - } break; - } - - return DateTime( aNextDate, aNextTime ); -} - diff --git a/svtools/source/items1/tfrmitem.cxx b/svtools/source/items1/tfrmitem.cxx deleted file mode 100644 index a7019ff69947..000000000000 --- a/svtools/source/items1/tfrmitem.cxx +++ /dev/null @@ -1,184 +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: tfrmitem.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" -#include <com/sun/star/uno/Any.hxx> - -#include <tools/stream.hxx> -#include <tools/debug.hxx> -#include <tools/string.hxx> - -#include <svtools/tfrmitem.hxx> - -DBG_NAME( SfxTargetFrameItem ) -TYPEINIT1( SfxTargetFrameItem, SfxPoolItem ); - -// ----------------------------------------------------------------------- - -SfxTargetFrameItem::SfxTargetFrameItem( USHORT which ) : - SfxPoolItem( which ) -{ - DBG_CTOR( SfxTargetFrameItem, 0 ); -} - -// ----------------------------------------------------------------------- - -SfxTargetFrameItem::SfxTargetFrameItem( const SfxTargetFrameItem& rItem ) : - SfxPoolItem( rItem ) -{ - DBG_CTOR( SfxTargetFrameItem, 0 ); - for( USHORT nCur = 0; nCur <= (USHORT)SfxOpenModeLast; nCur++ ) - _aFrames[nCur] = rItem._aFrames[nCur]; -} - -// ----------------------------------------------------------------------- - -SfxTargetFrameItem::SfxTargetFrameItem( USHORT which, - const String& rOpenSelectFrame, const String& rOpenOpenFrame, - const String& rOpenAddTaskFrame ) : SfxPoolItem( which ) -{ - DBG_CTOR( SfxTargetFrameItem, 0 ); - _aFrames[ (USHORT)SfxOpenSelect ] = rOpenSelectFrame; - _aFrames[ (USHORT)SfxOpenOpen ] = rOpenOpenFrame; - _aFrames[ (USHORT)SfxOpenAddTask ] = rOpenAddTaskFrame; -} - -// ----------------------------------------------------------------------- - -SfxTargetFrameItem::~SfxTargetFrameItem() -{ - DBG_DTOR(SfxTargetFrameItem, 0); -} - -// ----------------------------------------------------------------------- - -String SfxTargetFrameItem::GetTargetFrame( SfxOpenMode eMode ) const -{ - DBG_CHKTHIS( SfxTargetFrameItem, 0 ); - if( eMode <= SfxOpenModeLast ) - return _aFrames[ (USHORT)eMode ]; - String aResult; - return aResult; -} - -// ----------------------------------------------------------------------- - -int SfxTargetFrameItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_CHKTHIS( SfxTargetFrameItem, 0 ); - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" ); - - for( USHORT nCur = 0; nCur <= (USHORT)SfxOpenModeLast; nCur++ ) - { - if( _aFrames[nCur] != ((const SfxTargetFrameItem&)rItem)._aFrames[nCur] ) - return 0; - } - return 1; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxTargetFrameItem::Create( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS(SfxTargetFrameItem, 0); - SfxTargetFrameItem* pItem = new SfxTargetFrameItem( Which() ); - USHORT nCount = 0; - rStream >> nCount; - for(USHORT nCur=0; nCur<= (USHORT)SfxOpenModeLast && nCount; nCur++,nCount--) - { - readByteString(rStream, pItem->_aFrames[ nCur ]); - } - // die uebriggebliebenen ueberspringen - String aTemp; - while( nCount ) - { - readByteString(rStream, aTemp); - nCount--; - } - return pItem; -} - -// ----------------------------------------------------------------------- - -SvStream& SfxTargetFrameItem::Store( SvStream& rStream, USHORT ) const -{ - DBG_CHKTHIS( SfxTargetFrameItem, 0 ); - USHORT nCount = (USHORT)(SfxOpenModeLast+1); - rStream << nCount; - for( USHORT nCur = 0; nCur <= (USHORT)SfxOpenModeLast; nCur++ ) - { - writeByteString(rStream, _aFrames[ nCur ]); - } - return rStream; -} - -// ----------------------------------------------------------------------- - -SfxPoolItem* SfxTargetFrameItem::Clone( SfxItemPool* ) const -{ - DBG_CHKTHIS( SfxTargetFrameItem, 0 ); - return new SfxTargetFrameItem( *this ); -} - -// ----------------------------------------------------------------------- -// virtual -BOOL SfxTargetFrameItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const -{ - String aVal; - for ( int i = 0; i <= SfxOpenModeLast; i++ ) - { - aVal += _aFrames[ i ]; - aVal += ';' ; - } - - rVal <<= rtl::OUString( aVal ); - return TRUE; -} - -// ----------------------------------------------------------------------- -// virtual -BOOL SfxTargetFrameItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE ) -{ - rtl::OUString aValue; - if ( rVal >>= aValue ) - { - const String aVal( aValue ); - - for ( USHORT i = 0; i <= SfxOpenModeLast; i++ ) - _aFrames[ i ] = aVal.GetToken( i ); - - return TRUE; - } - - DBG_ERROR( "SfxTargetFrameItem::PutValue - Wrong type!" ); - return FALSE; -} - diff --git a/svtools/source/items1/tresitem.cxx b/svtools/source/items1/tresitem.cxx deleted file mode 100644 index 6e70c82a4d03..000000000000 --- a/svtools/source/items1/tresitem.cxx +++ /dev/null @@ -1,78 +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: tresitem.cxx,v $ - * $Revision: 1.6 $ - * - * 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/tresitem.hxx> - -using namespace com::sun::star; - -//============================================================================ -// -// CntTransferResultItem -// -//============================================================================ - -TYPEINIT1_AUTOFACTORY(CntTransferResultItem, SfxPoolItem) - -//============================================================================ -// virtual -int CntTransferResultItem::operator ==(SfxPoolItem const & rItem) const -{ - if (CntTransferResultItem * pResultItem = PTR_CAST(CntTransferResultItem, - &rItem)) - return m_aResult.Source == pResultItem->m_aResult.Source - && m_aResult.Target == pResultItem->m_aResult.Target - && m_aResult.Result == pResultItem->m_aResult.Result; - return false; -} - -//============================================================================ -// virtual -BOOL CntTransferResultItem::QueryValue(uno::Any & rVal, BYTE) const -{ - rVal <<= m_aResult; - return true; -} - -//============================================================================ -// virtual -BOOL CntTransferResultItem::PutValue(uno::Any const & rVal, BYTE) -{ - return rVal >>= m_aResult; -} - -//============================================================================ -// virtual -SfxPoolItem * CntTransferResultItem::Clone(SfxItemPool *) const -{ - return new CntTransferResultItem(*this); -} - diff --git a/svtools/source/java/javaerror.src b/svtools/source/java/javaerror.src index 3063bcd994d5..3460df859c2b 100644 --- a/svtools/source/java/javaerror.src +++ b/svtools/source/java/javaerror.src @@ -28,7 +28,7 @@ * ************************************************************************/ -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> WarningBox WARNINGBOX_JAVANOTFOUND { diff --git a/svtools/source/java/javainteractionhandler.cxx b/svtools/source/java/javainteractionhandler.cxx index 30f8775a6d5f..a7808c80992b 100644 --- a/svtools/source/java/javainteractionhandler.cxx +++ b/svtools/source/java/javainteractionhandler.cxx @@ -33,7 +33,7 @@ -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #include <tools/resid.hxx> #include <com/sun/star/task/XInteractionContinuation.hpp> #include <com/sun/star/task/XInteractionAbort.hpp> diff --git a/svtools/source/java/patchjavaerror.src b/svtools/source/java/patchjavaerror.src index bfdfd5a8bcba..2d2ad06a9592 100644 --- a/svtools/source/java/patchjavaerror.src +++ b/svtools/source/java/patchjavaerror.src @@ -28,7 +28,7 @@ * ************************************************************************/ -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> WarningBox WARNINGBOX_JAVANOTFOUND { diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx index 6e89193f1b6b..4084aa47bc80 100644 --- a/svtools/source/misc/ehdl.cxx +++ b/svtools/source/misc/ehdl.cxx @@ -45,7 +45,7 @@ #include <svtools/ehdl.hxx> #include <svtools/svtdata.hxx> -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #include "sfxecode.hxx" //========================================================================= diff --git a/svtools/source/misc/ehdl.src b/svtools/source/misc/ehdl.src index ed32172a92e2..5267d13765c3 100644 --- a/svtools/source/misc/ehdl.src +++ b/svtools/source/misc/ehdl.src @@ -29,7 +29,7 @@ ************************************************************************/ #define __RSC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #include "sfxecode.hxx" // pragma ---------------------------------------------------------------- diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index 6bd1126f8082..3554f6955171 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: embedhlp.cxx,v $ - * $Revision: 1.28 $ * * This file is part of OpenOffice.org. * @@ -33,7 +32,7 @@ #include <svtools/embedhlp.hxx> #include <svtools/filter.hxx> -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #include <svtools/svtdata.hxx> #include <comphelper/embeddedobjectcontainer.hxx> @@ -58,6 +57,7 @@ #include <cppuhelper/implbase4.hxx> #include "vcl/svapp.hxx" #include <rtl/logfile.hxx> +#include <vos/mutex.hxx> using namespace com::sun::star; @@ -189,7 +189,6 @@ void SAL_CALL EmbedEventListener_Impl::modified( const lang::EventObject& ) thro pObject->UpdateReplacementOnDemand(); } } - } void SAL_CALL EmbedEventListener_Impl::notifyEvent( const document::EventObject& aEvent ) throw( uno::RuntimeException ) @@ -250,6 +249,9 @@ struct EmbeddedObjectRef_Impl sal_Int64 nViewAspect; BOOL bIsLocked; sal_Bool bNeedUpdate; + + // #i104867# + sal_uInt32 mnGraphicVersion; awt::Size aDefaultSizeForChart_In_100TH_MM;//#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this member }; @@ -262,6 +264,7 @@ void EmbeddedObjectRef::Construct_Impl() mpImp->nViewAspect = embed::Aspects::MSOLE_CONTENT; mpImp->bIsLocked = FALSE; mpImp->bNeedUpdate = sal_False; + mpImp->mnGraphicVersion = 0; mpImp->aDefaultSizeForChart_In_100TH_MM = awt::Size(8000,7000); } @@ -297,12 +300,14 @@ EmbeddedObjectRef::EmbeddedObjectRef( const EmbeddedObjectRef& rObj ) mpImp->pGraphic = 0; mpImp->pHCGraphic = 0; + mpImp->mnGraphicVersion = 0; } EmbeddedObjectRef::~EmbeddedObjectRef() { delete mpImp->pGraphic; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); Clear(); } /* @@ -453,10 +458,15 @@ void EmbeddedObjectRef::GetReplacement( BOOL bUpdate ) DELETEZ( mpImp->pGraphic ); mpImp->aMediaType = ::rtl::OUString(); mpImp->pGraphic = new Graphic; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); + mpImp->mnGraphicVersion++; } else if ( !mpImp->pGraphic ) + { mpImp->pGraphic = new Graphic; + mpImp->mnGraphicVersion++; + } else { DBG_ERROR("No update, but replacement exists already!"); @@ -469,6 +479,7 @@ void EmbeddedObjectRef::GetReplacement( BOOL bUpdate ) GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); if( mpImp->pGraphic ) pGF->ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW ); + mpImp->mnGraphicVersion++; delete pGraphicStream; } } @@ -598,6 +609,7 @@ Graphic* EmbeddedObjectRef::GetHCGraphic() const mpImp->pHCGraphic = pGraphic; else delete pGraphic; + mpImp->mnGraphicVersion++; } delete pStream; @@ -615,7 +627,9 @@ void EmbeddedObjectRef::SetGraphicStream( const uno::Reference< io::XInputStream delete mpImp->pGraphic; mpImp->pGraphic = new Graphic(); mpImp->aMediaType = rMediaType; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); + mpImp->mnGraphicVersion++; SvStream* pGraphicStream = ::utl::UcbStreamHelper::CreateStream( xInGrStream ); @@ -623,6 +637,7 @@ void EmbeddedObjectRef::SetGraphicStream( const uno::Reference< io::XInputStream { GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); pGF->ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW ); + mpImp->mnGraphicVersion++; if ( mpImp->pContainer ) { @@ -645,7 +660,9 @@ void EmbeddedObjectRef::SetGraphic( const Graphic& rGraphic, const ::rtl::OUStri delete mpImp->pGraphic; mpImp->pGraphic = new Graphic( rGraphic ); mpImp->aMediaType = rMediaType; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); + mpImp->mnGraphicVersion++; if ( mpImp->pContainer ) SetGraphicToContainer( rGraphic, *mpImp->pContainer, mpImp->aPersistName, rMediaType ); @@ -880,7 +897,9 @@ void EmbeddedObjectRef::UpdateReplacementOnDemand() { DELETEZ( mpImp->pGraphic ); mpImp->bNeedUpdate = sal_True; - if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic ); + if ( mpImp->pHCGraphic ) + DELETEZ( mpImp->pHCGraphic ); + mpImp->mnGraphicVersion++; if( mpImp->pContainer ) { @@ -914,6 +933,12 @@ BOOL EmbeddedObjectRef::IsChart() const return sal_False; } +// #i104867# +sal_uInt32 EmbeddedObjectRef::getGraphicVersion() const +{ + return mpImp->mnGraphicVersion; +} + void EmbeddedObjectRef::SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM ) { //#i103460# charts do not necessaryly have an own size within ODF files, @@ -928,4 +953,5 @@ void EmbeddedObjectRef::SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM ) xSizeTransmitter->setDefaultSize( mpImp->aDefaultSizeForChart_In_100TH_MM ); } -} +} // namespace svt + diff --git a/svtools/source/misc/errtxt.src b/svtools/source/misc/errtxt.src index ebd922bfedf7..3ab58ef92dbf 100644 --- a/svtools/source/misc/errtxt.src +++ b/svtools/source/misc/errtxt.src @@ -29,7 +29,7 @@ ************************************************************************/ #define __RSC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #include "sfxecode.hxx" // pragma ---------------------------------------------------------------- Resource RID_ERRCTX diff --git a/svtools/source/misc/flbytes.cxx b/svtools/source/misc/flbytes.cxx deleted file mode 100644 index acf53d9b3e94..000000000000 --- a/svtools/source/misc/flbytes.cxx +++ /dev/null @@ -1,432 +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: flbytes.cxx,v $ - * $Revision: 1.6 $ - * - * 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 <vcl/svapp.hxx> -#include <flbytes.hxx> - -#ifndef _SVSTDARR_ULONGS_DECL -#define _SVSTDARR_ULONGS -#include <svtools/svstdarr.hxx> -#undef _SVSTDARR_ULONGS -#endif - -namespace unnamed_svtools_flbytes {} using namespace unnamed_svtools_flbytes; - // unnamed namespaces don't work well yet - -//============================================================================ -namespace unnamed_svtools_flbytes { - -inline ULONG MyMin( long a, long b ) -{ - return Max( long( Min( a , b ) ), 0L ); -} - -} - -//============================================================================ -// -// SvFillLockBytes -// -//============================================================================ - -TYPEINIT1(SvFillLockBytes, SvLockBytes); - -//============================================================================ -SvFillLockBytes::SvFillLockBytes( SvLockBytes* pLockBytes ) - : xLockBytes( pLockBytes ), - nFilledSize( 0 ), - bTerminated( FALSE ) -{ -} - -//============================================================================ -ErrCode SvFillLockBytes::ReadAt( ULONG nPos, void* pBuffer, ULONG nCount, - ULONG *pRead ) const -{ - if( bTerminated ) - return xLockBytes->ReadAt( nPos, pBuffer, nCount, pRead ); - else - { - ULONG nWanted = nPos + nCount; - if( IsSynchronMode() ) - { - while( nWanted > nFilledSize && !bTerminated ) - Application::Yield(); - return xLockBytes->ReadAt( nPos, pBuffer, nCount, pRead ); - } - else - { - ULONG nRead = MyMin( nCount, long( nFilledSize ) - nPos ); - ULONG nErr = xLockBytes->ReadAt( nPos, pBuffer, nRead, pRead ); - return ( !nCount || nRead == nCount || nErr ) ? - nErr : ERRCODE_IO_PENDING; - } - } -} - -//============================================================================ -ErrCode SvFillLockBytes::WriteAt( ULONG nPos, const void* pBuffer, - ULONG nCount, ULONG *pWritten ) -{ - if( bTerminated ) - return xLockBytes->WriteAt( nPos, pBuffer, nCount, pWritten ); - else - { - ULONG nWanted = nPos + nCount; - if( IsSynchronMode() ) - { - while( nWanted > nFilledSize && !bTerminated ) - Application::Yield(); - return xLockBytes->WriteAt( nPos, pBuffer, nCount, pWritten ); - } - else - { - ULONG nRead = MyMin( nCount, long( nFilledSize ) - nPos ); - ULONG nErr = xLockBytes->WriteAt( nPos, pBuffer, nRead, pWritten ); - return ( !nCount || nRead == nCount || nErr ) ? - nErr : ERRCODE_IO_PENDING; - } - } -} - -//============================================================================ -ErrCode SvFillLockBytes::Flush() const -{ - return xLockBytes->Flush( ); -} - -//============================================================================ -ErrCode SvFillLockBytes::SetSize( ULONG nSize ) -{ - return xLockBytes->SetSize( nSize ); -} - -//============================================================================ -ErrCode SvFillLockBytes::LockRegion( ULONG nPos, ULONG nCount, LockType eType) -{ - return xLockBytes->LockRegion( nPos, nCount, eType ); -} - -//============================================================================ -ErrCode SvFillLockBytes::UnlockRegion( - ULONG nPos, ULONG nCount, LockType eType) -{ - return xLockBytes->UnlockRegion( nPos, nCount, eType ); -} - -//============================================================================ -ErrCode SvFillLockBytes::Stat( - SvLockBytesStat* pStat, SvLockBytesStatFlag eFlag) const -{ - return xLockBytes->Stat( pStat, eFlag ); -} - -//============================================================================ -ErrCode SvFillLockBytes::FillAppend( const void* pBuffer, ULONG nCount, ULONG *pWritten ) -{ - ErrCode nRet = xLockBytes->WriteAt( - nFilledSize, pBuffer, nCount, pWritten ); - nFilledSize += *pWritten; - return nRet; -} - -//============================================================================ -void SvFillLockBytes::Terminate() -{ - bTerminated = TRUE; -} - -//============================================================================ -SV_DECL_IMPL_REF_LIST( SvLockBytes, SvLockBytes* ) - -//============================================================================ -// -// SvSyncLockBytes -// -//============================================================================ - -TYPEINIT1(SvSyncLockBytes, SvOpenLockBytes); - -//============================================================================ -// virtual -ErrCode SvSyncLockBytes::ReadAt(ULONG nPos, void * pBuffer, ULONG nCount, - ULONG * pRead) const -{ - for (ULONG nReadTotal = 0;;) - { - ULONG nReadCount = 0; - ErrCode nError = m_xAsyncLockBytes->ReadAt(nPos, pBuffer, nCount, - &nReadCount); - nReadTotal += nReadCount; - if (nError != ERRCODE_IO_PENDING || !IsSynchronMode()) - { - if (pRead) - *pRead = nReadTotal; - return nError; - } - nPos += nReadCount; - pBuffer = static_cast< sal_Char * >(pBuffer) + nReadCount; - nCount -= nReadCount; - Application::Yield(); - } -} - -//============================================================================ -// virtual -ErrCode SvSyncLockBytes::WriteAt(ULONG nPos, const void * pBuffer, - ULONG nCount, ULONG * pWritten) -{ - for (ULONG nWrittenTotal = 0;;) - { - ULONG nWrittenCount = 0; - ErrCode nError = m_xAsyncLockBytes->WriteAt(nPos, pBuffer, nCount, - &nWrittenCount); - nWrittenTotal += nWrittenCount; - if (nError != ERRCODE_IO_PENDING || !IsSynchronMode()) - { - if (pWritten) - *pWritten = nWrittenTotal; - return nError; - } - nPos += nWrittenCount; - pBuffer = static_cast< sal_Char const * >(pBuffer) + nWrittenCount; - nCount -= nWrittenCount; - Application::Yield(); - } -} - -//============================================================================ -// -// SvCompositeLockBytes -// -//============================================================================ - -struct SvCompositeLockBytes_Impl -{ - SvLockBytesMemberList aLockBytes; - SvULongs aPositions; - SvULongs aOffsets; - BOOL bPending; - ULONG RelativeOffset( ULONG nPos ) const; - ErrCode ReadWrite_Impl( - ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pProcessed, - BOOL bRead ); - SvCompositeLockBytes_Impl() : bPending( FALSE ){} -}; - -//============================================================================ -ULONG SvCompositeLockBytes_Impl::RelativeOffset( ULONG nPos ) const -{ - const SvULongs& rPositions = aPositions; - const SvULongs& rOffsets = aOffsets; - - USHORT nMinPos = 0; - USHORT nListCount = rPositions.Count(); - - // Erster Lockbytes, der bearbeitet werden muss - while( nMinPos + 1 < nListCount && rPositions[ nMinPos + 1 ] <= nPos ) - nMinPos ++; - ULONG nSectionStart = rPositions[ nMinPos ]; - if( nSectionStart > nPos ) - return ULONG_MAX; - return rOffsets[ nMinPos ] + nPos - nSectionStart; -} - -//============================================================================ -ErrCode SvCompositeLockBytes_Impl::ReadWrite_Impl( - ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pProcessed, - BOOL bRead ) -{ - ErrCode nErr = ERRCODE_NONE; - SvULongs& rPositions = aPositions; - SvULongs& rOffsets = aOffsets; - SvLockBytesMemberList& rLockBytes = aLockBytes; - - ULONG nBytes = nCount; - USHORT nListCount = rPositions.Count(); - USHORT nMinPos = 0; - - // Erster Lockbytes, der bearbeitet werden muss - while( nMinPos + 1 < nListCount && rPositions[ nMinPos + 1 ] <= nPos ) - nMinPos ++; - ULONG nSectionStart = rPositions[ nMinPos ]; - - if( nSectionStart > nPos ) - { - // Es wird aus fuehrendem Leerbereich gearbeitet - *pProcessed = 0; - return ERRCODE_IO_CANTREAD; - } - - ULONG nDone; - while( nMinPos < nListCount ) - { - ULONG nToProcess; - ULONG nSectionStop; - if( nMinPos + 1 < nListCount ) - { - nSectionStop = rPositions[ nMinPos + 1 ]; - nToProcess = MyMin( long( nSectionStop ) - nPos, nBytes ); - } - else - { - nToProcess = nBytes; - nSectionStop = 0; - } - ULONG nAbsPos = nPos - nSectionStart + rOffsets[ nMinPos ]; - SvLockBytes* pLB = rLockBytes.GetObject( nMinPos ); - if( bRead ) - nErr = pLB->ReadAt( nAbsPos, pBuffer, nToProcess, &nDone ); - else - nErr = pLB->WriteAt( nAbsPos, pBuffer, nToProcess, &nDone ); - nBytes -= nDone; - if( nErr || nDone < nToProcess || !nBytes ) - { - *pProcessed = nCount - nBytes; - // Wenn aus dem letzten LockBytes nichts mehr gelesen wurde und - // bPending gesetzt ist, Pending zurueck - if( !nDone && nMinPos == nListCount - 1 ) - return bPending ? ERRCODE_IO_PENDING : nErr; - else return nErr; - } - pBuffer = static_cast< sal_Char * >(pBuffer) + nDone; - nPos += nDone; - nSectionStart = nSectionStop; - nMinPos++; - } - return nErr; -} - -//============================================================================ -TYPEINIT1(SvCompositeLockBytes, SvLockBytes); - -//============================================================================ -SvCompositeLockBytes::SvCompositeLockBytes() - : pImpl( new SvCompositeLockBytes_Impl ) -{ -} - -//============================================================================ -SvCompositeLockBytes::~SvCompositeLockBytes() -{ - delete pImpl; -} - -//============================================================================ -void SvCompositeLockBytes::SetIsPending( BOOL bSet ) -{ - pImpl->bPending = bSet; -} - -//============================================================================ -ULONG SvCompositeLockBytes::RelativeOffset( ULONG nPos ) const -{ - return pImpl->RelativeOffset( nPos ); -} - -//============================================================================ -ErrCode SvCompositeLockBytes::ReadAt( - ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pRead ) const -{ - return pImpl->ReadWrite_Impl( nPos, pBuffer, nCount, pRead, TRUE ); -} - -//============================================================================ -ErrCode SvCompositeLockBytes::WriteAt( - ULONG nPos, const void* pBuffer, ULONG nCount, ULONG* pWritten ) -{ - return pImpl->ReadWrite_Impl( - nPos, const_cast< void * >(pBuffer), nCount, pWritten, FALSE ); -} - -//============================================================================ -ErrCode SvCompositeLockBytes::Flush() const -{ - SvLockBytesMemberList& rLockBytes = pImpl->aLockBytes; - ErrCode nErr = ERRCODE_NONE; - for( USHORT nCount = (USHORT)rLockBytes.Count(); !nErr && nCount--; ) - nErr = rLockBytes.GetObject( nCount )->Flush(); - return nErr; -} - -//============================================================================ -ErrCode SvCompositeLockBytes::SetSize( ULONG ) -{ - DBG_ERROR( "not implemented" ); - return ERRCODE_IO_NOTSUPPORTED; -} - -//============================================================================ -ErrCode SvCompositeLockBytes::LockRegion( ULONG, ULONG, LockType ) -{ - DBG_ERROR( "not implemented" ); - return ERRCODE_IO_NOTSUPPORTED; -} - -//============================================================================ -ErrCode SvCompositeLockBytes::UnlockRegion( - ULONG, ULONG, LockType ) -{ - DBG_ERROR( "not implemented" ); - return ERRCODE_IO_NOTSUPPORTED; -} - -//============================================================================ -ErrCode SvCompositeLockBytes::Stat( - SvLockBytesStat* pStat, SvLockBytesStatFlag eFlag) const -{ - USHORT nMax = pImpl->aPositions.Count() - 1; - - SvLockBytesStat aStat; - ErrCode nErr = pImpl->aLockBytes.GetObject( nMax )->Stat( &aStat, eFlag ); - pStat->nSize = pImpl->aPositions[ nMax ] + aStat.nSize; - - return nErr; -} - -//============================================================================ -void SvCompositeLockBytes::Append( - SvLockBytes* pLockBytes, ULONG nPos, ULONG nOffset ) -{ - USHORT nCount = pImpl->aOffsets.Count(); - pImpl->aLockBytes.Insert( pLockBytes, nCount ); - pImpl->aPositions.Insert( nPos, nCount ); - pImpl->aOffsets.Insert( nOffset, nCount ); -} - -//============================================================================ -SvLockBytes* SvCompositeLockBytes::GetLastLockBytes() const -{ - return pImpl->aLockBytes.Count() ? - pImpl->aLockBytes.GetObject( pImpl->aLockBytes.Count() - 1 ) : 0; -} - diff --git a/svtools/source/misc/helpagent.src b/svtools/source/misc/helpagent.src index 3b9e2a450ec1..181583bc8f6d 100644 --- a/svtools/source/misc/helpagent.src +++ b/svtools/source/misc/helpagent.src @@ -29,7 +29,7 @@ ************************************************************************/ #ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #endif Bitmap BMP_HELP_AGENT_IMAGE diff --git a/svtools/source/misc/helpagentwindow.cxx b/svtools/source/misc/helpagentwindow.cxx index 368c55a94ade..51cd7ebfb740 100644 --- a/svtools/source/misc/helpagentwindow.cxx +++ b/svtools/source/misc/helpagentwindow.cxx @@ -39,7 +39,7 @@ #include <svtools/svtdata.hxx> #ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #endif #ifndef _SVT_HELPID_HRC #include <svtools/helpid.hrc> diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx index 314242063711..76752b27354e 100644 --- a/svtools/source/misc/imagemgr.cxx +++ b/svtools/source/misc/imagemgr.cxx @@ -55,9 +55,10 @@ #include <rtl/logfile.hxx> #include <unotools/configmgr.hxx> -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #include "imagemgr.hrc" #include <svtools/svtdata.hxx> +#include <vos/mutex.hxx> // globals ******************************************************************* diff --git a/svtools/source/misc/imagemgr.src b/svtools/source/misc/imagemgr.src index 0aada34305da..e082398beaa1 100644 --- a/svtools/source/misc/imagemgr.src +++ b/svtools/source/misc/imagemgr.src @@ -29,7 +29,7 @@ ************************************************************************/ // includes ****************************************************************** -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #include "imagemgr.hrc" // images ******************************************************************** diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx index 9fb60111094e..b0aaee113c20 100644 --- a/svtools/source/misc/imap.cxx +++ b/svtools/source/misc/imap.cxx @@ -36,7 +36,7 @@ #include <vcl/mapmod.hxx> #include <vcl/window.hxx> -#include "urihelper.hxx" +#include "svl/urihelper.hxx" #include <svtools/imap.hxx> #include <svtools/imapobj.hxx> #include <svtools/imapcirc.hxx> @@ -64,6 +64,12 @@ UINT16 IMapObject::nActualTextEncoding = (UINT16) RTL_TEXTENCODING_DONTKNOW; #pragma optimize ( "", off ) #endif +IMapObject::IMapObject() + : bActive( false ) + , nReadVersion( 0 ) +{ +} + IMapObject::IMapObject( const String& rURL, const String& rAltText, const String& rDesc, const String& rTarget, const String& rName, BOOL bURLActive ) : aURL( rURL ) @@ -72,6 +78,7 @@ IMapObject::IMapObject( const String& rURL, const String& rAltText, const String , aTarget( rTarget ) , aName( rName ) , bActive( bURLActive ) +, nReadVersion( 0 ) { } diff --git a/svtools/source/misc/imap2.cxx b/svtools/source/misc/imap2.cxx index b1e03a574188..1dd10c36c81a 100644 --- a/svtools/source/misc/imap2.cxx +++ b/svtools/source/misc/imap2.cxx @@ -43,7 +43,7 @@ #endif #include <sot/formats.hxx> -#include "urihelper.hxx" +#include "svl/urihelper.hxx" #include <svtools/imap.hxx> #include <svtools/imap.hxx> #include <svtools/imapobj.hxx> diff --git a/svtools/source/misc/inidef.cxx b/svtools/source/misc/inidef.cxx deleted file mode 100644 index bdecd1b833dd..000000000000 --- a/svtools/source/misc/inidef.cxx +++ /dev/null @@ -1,269 +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: inidef.cxx,v $ - * $Revision: 1.6 $ - * - * 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 <tools/string.hxx> -#include "inetdef.hxx" -#include "inidef.hxx" - -//======================================================================== - -class SfxStdIniDef_Impl: public SfxIniDefaulter -{ -public: - SfxStdIniDef_Impl( SfxIniDefaultManager *pDefMgr ) - : SfxIniDefaulter( pDefMgr ) - {} - virtual BOOL QueryDefault( String &rValue, const SfxIniEntry &rEntry ); -}; - -//------------------------------------------------------------------------- - -BOOL SfxStdIniDef_Impl::QueryDefault( String &rValue, const SfxIniEntry &rEntry ) -{ - switch ( rEntry.GetKey() ) - { - case SFX_KEY_BROWSERRESTORE: - { - rValue = "1"; - return TRUE; - } - - case SFX_KEY_INET_HOME: - { - if ( System::GetLanguage() == LANGUAGE_GERMAN ) - rValue = "http://www.stardivision.de"; - else - rValue = "http://www.stardivision.com"; - return TRUE; - } - - case SFX_KEY_INET_MEMCACHE: - rValue = "4"; - return TRUE; - - case SFX_KEY_INET_DISKCACHE: - rValue = "2048"; - return TRUE; - - case SFX_KEY_INET_CACHEEXPIRATION: - rValue = "3"; - return TRUE; - - case SFX_KEY_INET_MAXHTTPCONS: - rValue = "4"; - return TRUE; - - case SFX_KEY_INET_MAXFTPCONS: - rValue = "2"; - return TRUE; - -// case SFX_KEY_INET_JAVAMINHEAP: -// rValue = "256"; -// return TRUE; - -// case SFX_KEY_INET_JAVAMAXHEAP: -// rValue = ""; -// return TRUE; - - case SFX_KEY_INET_USERAGENT: - rValue = INET_DEF_CALLERNAME; - return TRUE; - - case SFX_KEY_INET_EXE_JAVASCRIPT: -#ifdef SOLAR_JAVA - rValue = "0"; // noch "0", solange es noch soviel Bugs gibt -#else - rValue = "0"; // immer "0" -#endif - return TRUE; - - case SFX_KEY_INET_EXE_PLUGIN: - rValue = "1"; - return TRUE; - -/* case SFX_KEY_INET_JAVA_ENABLE: -#ifdef SOLAR_JAVA - rValue = "1"; -#else - rValue = "0"; -#endif - return TRUE; */ - -// case SFX_KEY_INET_NETACCESS: -// rValue = "2"; -// return TRUE; - - case SFX_KEY_INET_CHANNELS: - rValue = "1"; - return TRUE; - - case SFX_KEY_BASIC_ENABLE: - rValue = "1"; - return TRUE; - - case SFX_KEY_INET_COOKIES: - rValue = "1"; - return TRUE; - - case SFX_KEY_ICONGRID: - rValue = "100;70;0"; - return TRUE; - - case SFX_KEY_METAFILEPRINT: - rValue = "1"; - return TRUE; - } - - return SfxIniDefaulter::QueryDefault( rValue, rEntry ); -} - -//========================================================================= - -SfxIniDefaultManager::SfxIniDefaultManager() -: _pList( new SfxIniDefaulterList ) -{ - new SfxStdIniDef_Impl( this ); -} - -//------------------------------------------------------------------------- - -SfxIniDefaultManager::~SfxIniDefaultManager() -{ - if ( _pList ) - { - for ( USHORT n = _pList->Count(); n--; ) - delete _pList->GetObject(n); - delete _pList; - } -} - -//------------------------------------------------------------------------- - -BOOL SfxIniDefaultManager::QueryDefault -( - String& rValue, /* out: Default-Wert f"ur 'rEntry' - (Default ist Leerstring) */ - const SfxIniEntry& rEntry // in: Beschreibung des Eintrags -) - -/* [Beschreibung] - - "Uber diese interne Methode besorgt sich der <SfxIniManager> den - Default f"ur einen in 'rEntry' beschriebenen Eintrag. -*/ - -{ - for ( USHORT n = _pList->Count(); n--; ) - if ( _pList->GetObject(n)->QueryDefault( rValue, rEntry ) ) - return TRUE; - return FALSE; -} - -//========================================================================= - -SfxIniDefaulter::SfxIniDefaulter( SfxIniDefaultManager *pManager ) - -/* [Beschreibung] - - Der Ctor dieser Klasse meldet die neue Instanz automatisch am - <SfxiniDefaultManager> 'pManager' an. -*/ - -: _pManager( pManager ) - -{ - pManager->Insert( this ); -} - -//------------------------------------------------------------------------- - -SfxIniDefaulter::~SfxIniDefaulter() - -/* [Beschreibung] - - Der Dtor dieser Klasse meldet die neue Instanz automatisch am - <SfxiniDefaultManager> ab, der im Ctor angegeben wurde. -*/ - -{ - _pManager->Remove( this ); -} - -//------------------------------------------------------------------------- - -BOOL SfxIniDefaulter::QueryDefault -( - String& rValue, /* out: Default-Wert f"ur 'rEntry' - (Default ist Leerstring) */ - const SfxIniEntry& rEntry // in: Beschreibung des Eintrags -) - -/* [Beschreibung] - - Diese virtuelle Methode mu\s "uberladen werden. Sie soll dann in - 'rValue' einen Default-Wert f"ur den in 'rEntry' beschriebenen - ini-Eintrag setzen, falls ihr dieser bekannt ist. - - - [Returnwert] - - TRUE In 'rValue' befindet sich der Default-Wert. - - FALSE F"ur diesen Eintrag ist kein Default-Wert bekannt. - -*/ - -{ - return FALSE; -}; - -//======================================================================== - -SfxIniEntry::SfxIniEntry -( - const String& aGroup, - const String& aKey, - SfxIniGroup eGroup, - SfxIniKey eKey, - USHORT nIndex -) -: _aGroup( aGroup ), - _aKey( aKey ), - _eGroup( eGroup ), - _eKey( eKey ), - _nIndex( nIndex ) -{ -} - - diff --git a/svtools/source/items/itemdel.cxx b/svtools/source/misc/itemdel.cxx index 4028aa497c22..9db70f852d30 100644 --- a/svtools/source/items/itemdel.cxx +++ b/svtools/source/misc/itemdel.cxx @@ -37,8 +37,8 @@ #include <limits.h> #include <svtools/svtdata.hxx> -#include <svtools/svarray.hxx> -#include <svtools/itempool.hxx> +#include <svl/svarray.hxx> +#include <svl/itempool.hxx> // STATIC DATA ----------------------------------------------------------- diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx index 870e6378a216..ef2cedcc50c2 100644 --- a/svtools/source/misc/langtab.cxx +++ b/svtools/source/misc/langtab.cxx @@ -42,10 +42,10 @@ #include <i18npool/lang.h> #include <i18npool/mslangid.hxx> -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #include <svtools/svtdata.hxx> #include <svtools/langtab.hxx> -#include <svtools/syslocale.hxx> +#include <unotools/syslocale.hxx> using namespace ::com::sun::star; diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src index 4458d4b0f132..0aa90f8e96b9 100644 --- a/svtools/source/misc/langtab.src +++ b/svtools/source/misc/langtab.src @@ -29,7 +29,7 @@ ************************************************************************/ // include --------------------------------------------------------------- -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #define RSC_RESOURCE_USAGE 1 #include <i18npool/lang.h> diff --git a/svtools/source/misc/makefile.mk b/svtools/source/misc/makefile.mk index a23092e120da..77cf8a41a8bd 100644 --- a/svtools/source/misc/makefile.mk +++ b/svtools/source/misc/makefile.mk @@ -46,11 +46,9 @@ ENABLE_EXCEPTIONS := TRUE SRS1NAME=misc SRC1FILES=\ - config.src \ - iniman.src \ ehdl.src \ - imagemgr.src \ helpagent.src \ + imagemgr.src \ langtab.src SRS2NAME=ehdl @@ -59,33 +57,28 @@ SRC2FILES=\ SLOFILES=\ $(SLO)$/acceleratorexecute.obj \ + $(SLO)$/chartprettypainter.obj \ $(SLO)$/cliplistener.obj \ + $(SLO)$/dialogclosedlistener.obj\ + $(SLO)$/dialogcontrolling.obj \ + $(SLO)$/ehdl.obj \ $(SLO)$/embedhlp.obj \ $(SLO)$/embedtransfer.obj \ + $(SLO)$/helpagentwindow.obj \ $(SLO)$/imagemgr.obj \ $(SLO)$/imageresourceaccess.obj \ - $(SLO)$/templatefoldercache.obj \ - $(SLO)$/transfer.obj \ - $(SLO)$/transfer2.obj \ - $(SLO)$/stringtransfer.obj \ - $(SLO)$/urihelper.obj \ - $(SLO)$/svtaccessiblefactory.obj \ - $(SLO)$/ehdl.obj \ - $(SLO)$/flbytes.obj \ - $(SLO)$/helpagentwindow.obj \ $(SLO)$/imap.obj \ $(SLO)$/imap2.obj \ $(SLO)$/imap3.obj \ - $(SLO)$/ownlist.obj \ - $(SLO)$/vcldata.obj \ - $(SLO)$/restrictedpaths.obj \ - $(SLO)$/dialogclosedlistener.obj\ - $(SLO)$/dialogcontrolling.obj \ - $(SLO)$/chartprettypainter.obj \ - $(SLO)$/lockfilecommon.obj \ - $(SLO)$/sharecontrolfile.obj \ - $(SLO)$/documentlockfile.obj \ - $(SLO)$/langtab.obj + $(SLO)$/itemdel.obj \ + $(SLO)$/langtab.obj \ + $(SLO)$/stringtransfer.obj \ + $(SLO)$/svtaccessiblefactory.obj \ + $(SLO)$/svtdata.obj \ + $(SLO)$/templatefoldercache.obj \ + $(SLO)$/transfer.obj \ + $(SLO)$/transfer2.obj \ + $(SLO)$/wallitem.obj # --- Targets ------------------------------------------------------- diff --git a/svtools/source/misc/svtaccessiblefactory.cxx b/svtools/source/misc/svtaccessiblefactory.cxx index b2d57c250d32..a4b3cc1e8ecc 100644 --- a/svtools/source/misc/svtaccessiblefactory.cxx +++ b/svtools/source/misc/svtaccessiblefactory.cxx @@ -107,6 +107,15 @@ namespace svt return NULL; } + virtual table::IAccessibleTableControl* + createAccessibleTableControl( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*_rxParent*/, + table::IAccessibleTable& /*_rTable*/ + ) const + { + return NULL; + } + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > createAccessibleIconChoiceCtrl( SvtIconChoiceCtrl& /*_rIconCtrl*/, diff --git a/svtools/source/misc/vcldata.cxx b/svtools/source/misc/svtdata.cxx index 28b2e833e974..2bc1977e9197 100644 --- a/svtools/source/misc/vcldata.cxx +++ b/svtools/source/misc/svtdata.cxx @@ -6,8 +6,8 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: vcldata.cxx,v $ - * $Revision: 1.10 $ + * $RCSfile: svtdata.cxx,v $ + * $Revision: 1.7 $ * * This file is part of OpenOffice.org. * @@ -30,21 +30,49 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svtools.hxx" -#include <vcl/svapp.hxx> -#include <vcl/settings.hxx> + +#include <map> +#include <tools/resmgr.hxx> +#include <tools/shl.hxx> +#include <vos/process.hxx> #include <svtools/svtdata.hxx> +#include <vcl/svapp.hxx> //============================================================================ // -// class ImpSvtData +// ImpSvtData // //============================================================================ +ImpSvtData::~ImpSvtData() +{ + delete pResMgr; +} + +//============================================================================ +ResMgr * ImpSvtData::GetResMgr(const ::com::sun::star::lang::Locale aLocale) +{ + if (!pResMgr) + { + pResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(svt), aLocale ); + } + return pResMgr; +} + ResMgr * ImpSvtData::GetResMgr() { return GetResMgr(Application::GetSettings().GetUILocale()); } +ResMgr * ImpSvtData::GetPatchResMgr(const ::com::sun::star::lang::Locale& aLocale) +{ + if (!pPatchResMgr) + { + pPatchResMgr = ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(svp), aLocale); + } + return pPatchResMgr; +} + ResMgr * ImpSvtData::GetPatchResMgr() { return GetPatchResMgr(Application::GetSettings().GetUILocale()); @@ -55,3 +83,13 @@ SvpResId::SvpResId( USHORT nId ) : { } +//============================================================================ +// static +ImpSvtData & ImpSvtData::GetSvtData() +{ + void ** pAppData = GetAppData(SHL_SVT); + if (!*pAppData) + *pAppData= new ImpSvtData; + return *static_cast<ImpSvtData *>(*pAppData); +} + diff --git a/svtools/source/misc/templatefoldercache.cxx b/svtools/source/misc/templatefoldercache.cxx index 93ed9a7f5c90..348a9638399b 100644 --- a/svtools/source/misc/templatefoldercache.cxx +++ b/svtools/source/misc/templatefoldercache.cxx @@ -45,7 +45,7 @@ #include <vos/refernce.hxx> #include <tools/urlobj.hxx> #include <tools/debug.hxx> -#include <svtools/pathoptions.hxx> +#include <unotools/pathoptions.hxx> #include "comphelper/processfactory.hxx" diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index 0bcd00af40aa..4a814637e1af 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -76,7 +76,7 @@ #include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/lang/XInitialization.hpp> -#include "urlbmk.hxx" +#include "svl/urlbmk.hxx" #include "inetimg.hxx" #include <svtools/wmf.hxx> #include <svtools/imap.hxx> diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx index 8dcbbf9d93dc..027dbc31572d 100644 --- a/svtools/source/misc/transfer2.cxx +++ b/svtools/source/misc/transfer2.cxx @@ -50,7 +50,7 @@ #include <com/sun/star/datatransfer/dnd/XDropTargetDragContext.hpp> #endif -#include "urlbmk.hxx" +#include "svl/urlbmk.hxx" #include "inetimg.hxx" #include <svtools/imap.hxx> #include <svtools/transfer.hxx> diff --git a/svtools/source/items/wallitem.cxx b/svtools/source/misc/wallitem.cxx index 32797f69a48c..6ceb414db003 100644 --- a/svtools/source/items/wallitem.cxx +++ b/svtools/source/misc/wallitem.cxx @@ -52,7 +52,7 @@ #include <vcl/cvtgrf.hxx> #include "wallitem.hxx" -#include <svtools/cntwall.hxx> +#include <svl/cntwall.hxx> // ----------------------------------------------------------------------- diff --git a/svtools/source/misc1/iniadrtk.cxx b/svtools/source/misc1/iniadrtk.cxx deleted file mode 100644 index 8d4c929fc988..000000000000 --- a/svtools/source/misc1/iniadrtk.cxx +++ /dev/null @@ -1,76 +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: iniadrtk.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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include <tools/string.hxx> -#include <iniadrtk.hxx> - -//============================================================================ -// -// class SfxIniManagerAddressEntry -// -//============================================================================ - -// static -String SfxIniManagerAddressEntry::get(const String & rAddress, - AddressToken eToken) -{ - String aToken; - USHORT i = 0, nTxt = 0; - - while ( i < rAddress.Len() ) - { - while ( i < rAddress.Len() && rAddress.GetChar(i) != '#' ) - { - if ( rAddress.GetChar(i) == '\\' ) - i++; - aToken += rAddress.GetChar(i++); - } - - // rAddress[i] == '#' oder am Ende, also eine Position weiter gehen - i++; - - if ( eToken == (AddressToken)nTxt ) - break; - else if ( i >= rAddress.Len() ) - { - aToken.Erase(); - break; - } - else - { - aToken.Erase(); - nTxt++; - } - } - return aToken; -} - diff --git a/svtools/source/plugapp/testtool.src b/svtools/source/plugapp/testtool.src index 599675a6c494..78b63c2fb819 100644 --- a/svtools/source/plugapp/testtool.src +++ b/svtools/source/plugapp/testtool.src @@ -28,7 +28,7 @@ * ************************************************************************/ #include "testtool.hrc" -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #define Control_Control 5 diff --git a/svtools/source/productregistration/makefile.mk b/svtools/source/productregistration/makefile.mk index bc964e142232..1892f1600dd8 100644 --- a/svtools/source/productregistration/makefile.mk +++ b/svtools/source/productregistration/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # 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 @@ -57,6 +57,7 @@ SHL1STDLIBS=\ $(TKLIB) \ $(VCLLIB) \ $(SVLLIB) \ + $(UNOTOOLSLIB) \ $(TOOLSLIB) \ $(CPPUHELPERLIB) \ $(CPPULIB) \ diff --git a/svtools/source/productregistration/productregistration.cxx b/svtools/source/productregistration/productregistration.cxx index b3d90a73b231..f5fc03337cd6 100644 --- a/svtools/source/productregistration/productregistration.cxx +++ b/svtools/source/productregistration/productregistration.cxx @@ -32,10 +32,10 @@ #include "precompiled_svtools.hxx" #include "productregistration.hxx" -#include "regoptions.hxx" +#include "unotools/regoptions.hxx" #include "registrationdlg.hxx" #ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #endif #include "cppuhelper/factory.hxx" #include <cppuhelper/implbase1.hxx> @@ -308,18 +308,18 @@ namespace svt sal_Bool bDeactivateJob = sal_True; // our config options - RegOptions aRegOptions; + utl::RegOptions aRegOptions; // check them for the permissions for the dialog - RegOptions::DialogPermission ePermission( aRegOptions.getDialogPermission() ); + utl::RegOptions::DialogPermission ePermission( aRegOptions.getDialogPermission() ); - if ( RegOptions::dpDisabled != ePermission ) + if ( utl::RegOptions::dpDisabled != ePermission ) { // the dialog is _not_ disabled // for this session, I'm no interested in the dialog registration anymore aRegOptions.markSessionDone( ); - if ( ( RegOptions::dpNotThisSession == ePermission ) // first trigger session not reached - || ( RegOptions::dpRemindLater == ePermission ) // or at a later reminder date + if ( ( utl::RegOptions::dpNotThisSession == ePermission ) // first trigger session not reached + || ( utl::RegOptions::dpRemindLater == ePermission ) // or at a later reminder date ) { // the dialog should be executed during one of the next sessions bDeactivateJob = sal_False; @@ -327,7 +327,7 @@ namespace svt else { // if we're here, the dialog should be executed during this session - OSL_ENSURE( RegOptions::dpThisSession == ePermission, "OProductRegistration::execute: invalid permissions!" ); + OSL_ENSURE( utl::RegOptions::dpThisSession == ePermission, "OProductRegistration::execute: invalid permissions!" ); { // this is some kind of HACK. @@ -412,7 +412,7 @@ namespace svt OSL_ENSURE( xSystemShell.is(), "OProductRegistration::doOnlineRegistration: invalid SystemExecute component!" ); // access the configuration to retrieve the URL we shall use for registration - RegOptions aOptions; + utl::RegOptions aOptions; OUString sRegistrationURL( aOptions.getRegistrationURL( ) ); OSL_ENSURE( sRegistrationURL.getLength(), "OProductRegistration::doOnlineRegistration: invalid URL found!" ); @@ -436,7 +436,7 @@ namespace svt aRegistrationError.Execute(); // try again later - RegOptions aRegOptions; + utl::RegOptions aRegOptions; aRegOptions.activateReminder( 7 ); } } diff --git a/svtools/source/productregistration/registrationdlg.cxx b/svtools/source/productregistration/registrationdlg.cxx index 83018cfa804b..d3969828cb1f 100644 --- a/svtools/source/productregistration/registrationdlg.cxx +++ b/svtools/source/productregistration/registrationdlg.cxx @@ -35,7 +35,7 @@ #if 0 /* @@@ */ #include <svtools/svtdata.hxx> #ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #endif #endif /* @@@ */ diff --git a/svtools/source/productregistration/registrationdlg.src b/svtools/source/productregistration/registrationdlg.src index 86024ef765cd..f9462a420061 100644 --- a/svtools/source/productregistration/registrationdlg.src +++ b/svtools/source/productregistration/registrationdlg.src @@ -32,7 +32,7 @@ #include "registrationdlg.hrc" #endif #ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> +#include <svl/svtools.hrc> #endif #ifndef _SVT_HELPID_HRC #include <svtools/helpid.hrc> diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index 5b584a37059d..5bb26367075e 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -32,11 +32,11 @@ #include "precompiled_svtools.hxx" #include <tools/urlobj.hxx> -#include <svtools/zformat.hxx> -#include <svtools/macitem.hxx> +#include <svl/zformat.hxx> +#include <svl/macitem.hxx> #include <tools/cachestr.hxx> #include <vcl/svapp.hxx> -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> #include <svtools/htmlout.hxx> #include "htmlkywd.hxx" @@ -44,7 +44,7 @@ #include <svtools/imaprect.hxx> #include <svtools/imapcirc.hxx> #include <svtools/imappoly.hxx> -#include "urihelper.hxx" +#include "svl/urihelper.hxx" #ifndef RTL_CONSTASCII_STRINGPARAM #define RTL_CONSTASCII_STRINGPARAM( c ) c, sizeof(c)-1 diff --git a/svtools/source/svhtml/htmlsupp.cxx b/svtools/source/svhtml/htmlsupp.cxx index 11f48e7fdf5d..9103161afb51 100644 --- a/svtools/source/svhtml/htmlsupp.cxx +++ b/svtools/source/svhtml/htmlsupp.cxx @@ -36,7 +36,7 @@ #include <tools/urlobj.hxx> #ifndef _SVSTDARR_HXX #define _SVSTDARR_ULONGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <svtools/parhtml.hxx> diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index 215133c8efb4..b4eb6c05cffd 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -40,12 +40,12 @@ #include <rtl/strbuf.hxx> #ifndef _SVSTDARR_HXX #define _SVSTDARR_ULONGS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #endif #include <tools/tenccvt.hxx> #include <tools/datetime.hxx> -#include <svtools/inettype.hxx> +#include <svl/inettype.hxx> #include <comphelper/string.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/document/XDocumentProperties.hpp> diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx index c7444dd5cbcb..2af7af71adac 100644 --- a/svtools/source/svrtf/svparser.cxx +++ b/svtools/source/svrtf/svparser.cxx @@ -37,7 +37,7 @@ #include <tools/stream.hxx> #include <tools/debug.hxx> #define _SVSTDARR_USHORTS -#include <svtools/svstdarr.hxx> +#include <svl/svstdarr.hxx> #include <rtl/textcvt.h> #include <rtl/tencinfo.h> @@ -66,7 +66,7 @@ struct SvParser_Impl rtl_TextToUnicodeConverter hConv; rtl_TextToUnicodeContext hContext; -#ifndef PRODUCT +#ifdef DBG_UTIL SvFileStream aOut; #endif @@ -100,7 +100,7 @@ SvParser::SvParser( SvStream& rIn, BYTE nStackSize ) pTokenStack = new TokenStackType[ nTokenStackSize ]; pTokenStackPos = pTokenStack; -#ifndef PRODUCT +#ifdef DBG_UTIL // wenn die Datei schon existiert, dann Anhaengen: if( !pImplData ) @@ -119,7 +119,7 @@ SvParser::SvParser( SvStream& rIn, BYTE nStackSize ) SvParser::~SvParser() { -#ifndef PRODUCT +#ifdef DBG_UTIL if( pImplData->aOut.IsOpen() ) pImplData->aOut << "\n\n >>>>>>>>>>>>>>> Dump Ende <<<<<<<<<<<<<<<\n"; pImplData->aOut.Close(); @@ -417,7 +417,7 @@ sal_Unicode SvParser::GetNextChar() return sal_Unicode(EOF); } -#ifndef PRODUCT +#ifdef DBG_UTIL if( pImplData->aOut.IsOpen() ) pImplData->aOut << ByteString::ConvertFromUnicode( c, RTL_TEXTENCODING_MS_1251 ); diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index c8895a19408d..1d7b046ae94b 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -30,10 +30,35 @@ #include "tablegeometry.hxx" #include "tablecontrol_impl.hxx" #include "svtools/table/tabledatawindow.hxx" +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/accessibility/AccessibleRole.hpp> + +using namespace ::com::sun::star::uno; +using ::com::sun::star::accessibility::XAccessible; +using namespace ::com::sun::star::accessibility; +using namespace ::com::sun::star::lang; +using namespace utl; +//using namespace rtl; //........................................................................ namespace svt { namespace table { -//........................................................................ + //==================================================================== + //= AccessibleTableControl_Impl + //==================================================================== + // ---------------------------------------------------------------------------- + Reference< XAccessible > AccessibleTableControl_Impl::getAccessibleTableHeader( AccessibleTableControlObjType _eObjType ) + { + if ( m_pAccessible && m_pAccessible->isAlive() ) + return m_pAccessible->getTableHeader( _eObjType ); + return NULL; + } + // ---------------------------------------------------------------------------- + Reference< XAccessible > AccessibleTableControl_Impl::getAccessibleTable( ) + { + if ( m_pAccessible && m_pAccessible->isAlive() ) + return m_pAccessible->getTable( ); + return NULL; + } //==================================================================== //= TableControl @@ -45,12 +70,17 @@ namespace svt { namespace table { m_pImpl->getDataWindow()->SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) ); m_pImpl->getDataWindow()->SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) ); + m_pAccessTable.reset(new ::svt::table::AccessibleTableControl_Impl()); } //-------------------------------------------------------------------- TableControl::~TableControl() { DELETEZ( m_pImpl ); + if ( m_pAccessTable->m_pAccessible ) + { + m_pAccessTable->m_pAccessible->dispose(); + } } //-------------------------------------------------------------------- @@ -59,7 +89,7 @@ namespace svt { namespace table if ( !m_pImpl->getInputHandler()->GetFocus( *m_pImpl ) ) { Control::GetFocus(); - GrabFocus(); + Control::GrabFocus(); } } @@ -109,13 +139,13 @@ namespace svt { namespace table } //-------------------------------------------------------------------- - RowPos TableControl::GetCurrentRow() const + sal_Int32 TableControl::GetCurrentRow() const { return m_pImpl->getCurRow(); } //-------------------------------------------------------------------- - ColPos TableControl::GetCurrentColumn() const + sal_Int32 TableControl::GetCurrentColumn() const { return m_pImpl->getCurColumn(); } @@ -126,6 +156,11 @@ namespace svt { namespace table return m_pImpl->goTo( _nColumn, _nRow ); } //-------------------------------------------------------------------- + sal_Bool TableControl::GoToCell(sal_Int32 _nColPos, sal_Int32 _nRowPos) + { + return m_pImpl->goTo( _nColPos, _nRowPos ); + } + //-------------------------------------------------------------------- void TableControl::InvalidateDataWindow(RowPos _nRowStart, bool _bRemoved) { Rectangle _rRect; @@ -135,7 +170,7 @@ namespace svt { namespace table return m_pImpl->invalidateRow(_nRowStart, _rRect); } //-------------------------------------------------------------------- - std::vector<RowPos> TableControl::getSelectedRows() + std::vector<sal_Int32>& TableControl::GetSelectedRows() { return m_pImpl->getSelectedRows(); } @@ -174,6 +209,331 @@ namespace svt { namespace table { return m_pImpl->getDataWindow(); } + + Reference< XAccessible > TableControl::CreateAccessible() + { + Window* pParent = GetAccessibleParentWindow(); + DBG_ASSERT( pParent, "TableControl::CreateAccessible - parent not found" ); + + if( pParent && !m_pAccessTable->m_pAccessible) + { + Reference< XAccessible > xAccParent = pParent->GetAccessible(); + if( xAccParent.is() ) + { + m_pAccessTable->m_pAccessible = getAccessibleFactory().createAccessibleTableControl( + xAccParent, *this + ); + } + } + Reference< XAccessible > xAccessible; + if ( m_pAccessTable->m_pAccessible ) + xAccessible = m_pAccessTable->m_pAccessible->getMyself(); + return xAccessible; + } + Reference<XAccessible> TableControl::CreateAccessibleControl( sal_Int32 _nIndex ) + { + (void)_nIndex; + DBG_ASSERT( FALSE, "TableControl::CreateAccessibleControl: to be overwritten!" ); + return NULL; + } + ::rtl::OUString TableControl::GetAccessibleObjectName( AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const + { + ::rtl::OUString aRetText; + switch( eObjType ) + { + case TCTYPE_GRIDCONTROL: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GridControl" ) ); + break; + case TCTYPE_TABLE: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Table" ) ); + break; + case TCTYPE_ROWHEADERBAR: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RowHeaderBar" ) ); + break; + case TCTYPE_COLUMNHEADERBAR: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderBar" ) ); + break; + case TCTYPE_TABLECELL: + aRetText = GetCellContent(_nRow, _nCol); + break; + case TCTYPE_ROWHEADERCELL: + aRetText = GetRowName(_nRow); + break; + case TCTYPE_COLUMNHEADERCELL: + aRetText = GetColumnName(_nCol); + break; + default: + OSL_ENSURE(0,"GridControl::GetAccessibleName: invalid enum!"); + } + return aRetText; + } +// ----------------------------------------------------------------------------- + +::rtl::OUString TableControl::GetAccessibleObjectDescription( AccessibleTableControlObjType eObjType, sal_Int32 ) const +{ + ::rtl::OUString aRetText; + switch( eObjType ) + { + case TCTYPE_GRIDCONTROL: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GridControl description" ) ); + break; + case TCTYPE_TABLE: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLE description" ) ); + break; + case TCTYPE_ROWHEADERBAR: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERBAR description" ) ); + break; + case TCTYPE_COLUMNHEADERBAR: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERBAR description" ) ); + break; + case TCTYPE_TABLECELL: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLECELL description" ) ); + break; + case TCTYPE_ROWHEADERCELL: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERCELL description" ) ); + break; + case TCTYPE_COLUMNHEADERCELL: + aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERCELL description" ) ); + break; + } + return aRetText; +} +// ----------------------------------------------------------------------------- + +::rtl::OUString TableControl::GetRowDescription( sal_Int32 _nRow) const +{ + (void)_nRow; + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "row description" ) ); +} +// ----------------------------------------------------------------------------- + +::rtl::OUString TableControl::GetRowName( sal_Int32 _nIndex) const +{ + return GetModel()->getRowHeaderName()[_nIndex]; +} +// ----------------------------------------------------------------------------- + +::rtl::OUString TableControl::GetColumnDescription( sal_uInt16 _nColumn) const +{ + (void)_nColumn; + return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "col description" ) ); +} +// ----------------------------------------------------------------------------- + +::rtl::OUString TableControl::GetColumnName( sal_Int32 _nIndex) const +{ + return GetModel()->getColumnModel(_nIndex)->getName(); +} + +// ----------------------------------------------------------------------------- + +::rtl::OUString TableControl::GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const +{ + ::rtl::OUString cellContent = ::rtl::OUString::createFromAscii(""); + std::vector<std::vector<rtl::OUString> >& aTableContent = GetModel()->getCellContent(); + if(&aTableContent) + { + std::vector<rtl::OUString>& aRowContent = aTableContent[_nRowPos]; + if(&aRowContent) + cellContent = aRowContent[_nColPos]; + } + return cellContent; +} +// ----------------------------------------------------------------------------- + +void TableControl::FillAccessibleStateSet( + ::utl::AccessibleStateSetHelper& rStateSet, + AccessibleTableControlObjType eObjType ) const +{ + switch( eObjType ) + { + case TCTYPE_GRIDCONTROL: + case TCTYPE_TABLE: + + rStateSet.AddState( AccessibleStateType::FOCUSABLE ); + rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE); + if ( HasFocus() ) + rStateSet.AddState( AccessibleStateType::FOCUSED ); + if ( IsActive() ) + rStateSet.AddState( AccessibleStateType::ACTIVE ); + if ( IsEnabled() ) + rStateSet.AddState( AccessibleStateType::ENABLED ); + if ( IsReallyVisible() ) + rStateSet.AddState( AccessibleStateType::VISIBLE ); + rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); + + break; + case TCTYPE_ROWHEADERBAR: + rStateSet.AddState( AccessibleStateType::VISIBLE ); + rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); + break; + case TCTYPE_COLUMNHEADERBAR: + rStateSet.AddState( AccessibleStateType::VISIBLE ); + rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS ); + break; + case TCTYPE_TABLECELL: + { + //sal_Int32 nRow = GetCurRow(); + //sal_uInt16 nColumn = GetCurColumnId(); + //if ( IsFieldVisible(nRow,nColumn) ) + // rStateSet.AddState( AccessibleStateType::VISIBLE ); + rStateSet.AddState( AccessibleStateType::TRANSIENT ); + rStateSet.AddState( AccessibleStateType::SELECTABLE); + if( GetSelectedRowCount()>0) + rStateSet.AddState( AccessibleStateType::SELECTED); + } + break; + case TCTYPE_ROWHEADERCELL: + rStateSet.AddState( AccessibleStateType::VISIBLE ); + rStateSet.AddState( AccessibleStateType::TRANSIENT ); + break; + case TCTYPE_COLUMNHEADERCELL: + rStateSet.AddState( AccessibleStateType::VISIBLE ); + break; + } +} + +Rectangle TableControl::GetWindowExtentsRelative( Window *pRelativeWindow ) +{ + return Control::GetWindowExtentsRelative( pRelativeWindow ); +} +//----------------------------------------------------------------------------- +void TableControl::GrabFocus() +{ + Control::GrabFocus(); +} +// ----------------------------------------------------------------------------- +Reference< XAccessible > TableControl::GetAccessible( BOOL bCreate ) +{ + return Control::GetAccessible( bCreate ); +} +// ----------------------------------------------------------------------------- +Window* TableControl::GetAccessibleParentWindow() const +{ + return Control::GetAccessibleParentWindow(); +} +// ----------------------------------------------------------------------------- +Window* TableControl::GetWindowInstance() +{ + return this; +} + +sal_Bool TableControl::HasRowHeader() +{ + return GetModel()->hasRowHeaders(); +} +//-------------------------------------------------------------------------------- +sal_Bool TableControl::HasColHeader() +{ + return GetModel()->hasColumnHeaders(); +} +//-------------------------------------------------------------------------------- +sal_Int32 TableControl::GetAccessibleControlCount() const +{ + sal_Int32 count = 0; + if(GetRowCount()>0) + count+=1; + if(GetModel()->hasRowHeaders()) + count+=1; + if(GetModel()->hasColumnHeaders()) + count+=1; + return count; +} +sal_Bool TableControl::ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) +{ + sal_Int32 nRow = m_pImpl->getCurrentRow(_rPoint); + sal_Int32 nCol = GetCurrentColumn(); + _rnIndex = nRow * GetColumnCount() + nCol; + return nRow>=0 ? sal_True : sal_False; +} + +long TableControl::GetRowCount() const +{ + return m_pImpl->getRowCount(); +} +long TableControl::GetColumnCount() const +{ + return m_pImpl->getColumnCount(); +} +sal_Bool TableControl::HasRowHeader() const +{ + PTableModel pModel = GetModel(); + return pModel->hasRowHeaders(); +} +sal_Int32 TableControl::GetSelectedRowCount() const +{ + return m_pImpl->getSelectedRows().size(); +} +bool TableControl::IsRowSelected( long _nRow ) const +{ + return m_pImpl->isRowSelected(m_pImpl->getSelectedRows(), _nRow); +} +sal_Bool TableControl::ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint ) +{ + _rnRow = m_pImpl->getCurrentRow(_rPoint); + _rnColPos = GetCurrentColumn(); + return _rnRow>=0 ? sal_True : sal_False; +} +void TableControl::FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const +{ + if ( GetCurrentRow() == _nRow && GetCurrentColumn() == _nColumnPos ) + _rStateSet.AddState( AccessibleStateType::FOCUSED ); + else // only transient when column is not focused + _rStateSet.AddState( AccessibleStateType::TRANSIENT ); +} +Rectangle TableControl::GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) +{ + (void)_nRow; + (void)_nColumnPos; + return GetCharacterBounds(nIndex); +} +sal_Int32 TableControl::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) +{ + (void)_nRow; + (void)_nColumnPos; + return GetIndexForPoint(_rPoint);
+; +} + // -----------------------------------------------------------------------------
+sal_Bool TableControl::isAccessibleAlive( ) const
+{
+ return ( NULL != m_pAccessTable->m_pAccessible ) && m_pAccessTable->m_pAccessible->isAlive();
+}
+ +// ----------------------------------------------------------------------------- +::svt::IAccessibleFactory& TableControl::getAccessibleFactory() +{ + return m_pAccessTable->m_aFactoryAccess.getFactory(); +} +// -----------------------------------------------------------------------------
+void TableControl::commitGridControlEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue )
+{
+ if ( isAccessibleAlive() )
+ m_pAccessTable->m_pAccessible->commitEvent( _nEventId, _rNewValue, _rOldValue);
+} +// -----------------------------------------------------------------------------
+Rectangle TableControl::calcHeaderRect(sal_Bool _bIsColumnBar,BOOL _bOnScreen)
+{
+ (void)_bOnScreen;
+ Rectangle aRectTable, aRectTableWithHeaders;
+ m_pImpl->impl_getAllVisibleDataCellArea(aRectTable);
+ m_pImpl->impl_getAllVisibleCellsArea(aRectTableWithHeaders);
+ Size aSizeTable(aRectTable.GetSize());
+ Size aSizeTableWithHeaders(aRectTableWithHeaders.GetSize());
+ if(_bIsColumnBar)
+ return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width()-aSizeTable.Width(), aSizeTableWithHeaders.Height()));
+ else
+ return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width(), aSizeTableWithHeaders.Height()-aSizeTable.Height()));
+}
+// -----------------------------------------------------------------------------
+Rectangle TableControl::calcTableRect(BOOL _bOnScreen)
+{
+ (void)_bOnScreen;
+ Rectangle aRect;
+ m_pImpl->impl_getAllVisibleDataCellArea(aRect);
+ return aRect;
+}
+ //........................................................................ -} } // namespace svt::table +}} // namespace svt::table //........................................................................ diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index e1ff3aeb7f2a..89c0eed4229a 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -181,24 +181,23 @@ namespace svt { namespace table { (void)pCellEntryType; } - virtual std::vector<std::vector<rtl::OUString> > getCellContent() + virtual std::vector<std::vector<rtl::OUString> >& getCellContent() { - std::vector<rtl::OUString> cCC; - cCC.push_back(rtl::OUString::createFromAscii("")); - std::vector<std::vector<rtl::OUString> > cC; - cC.push_back(cCC); - return cC; + return *( new std::vector<std::vector<rtl::OUString> >); } virtual void setRowHeaderName(std::vector<rtl::OUString> pCellEntryType) { (void)pCellEntryType; } - virtual std::vector<rtl::OUString> getRowHeaderName() + virtual std::vector<rtl::OUString>& getRowHeaderName() { - std::vector<rtl::OUString> cCC; - cCC.push_back(rtl::OUString::createFromAscii("")); - return cCC; + aRowHeaderNames.clear(); + aRowHeaderNames.push_back(rtl::OUString::createFromAscii("")); + return aRowHeaderNames; } + + private: + std::vector<rtl::OUString> aRowHeaderNames; }; @@ -882,7 +881,7 @@ namespace svt { namespace table impl_getAllVisibleDataCellArea( aAllDataCellsArea ); //get the vector, which contains row vectors, each containing the data for the cells in this row - std::vector<std::vector<rtl::OUString> > aCellContent = m_pModel->getCellContent(); + std::vector<std::vector<rtl::OUString> >& aCellContent = m_pModel->getCellContent(); //if the vector is empty, fill it with empty data, so the table can be painted if(aCellContent.empty()) { @@ -895,7 +894,7 @@ namespace svt { namespace table } std::vector<std::vector<rtl::OUString> >::iterator it = aCellContent.begin()+m_nTopRow; //get the vector, which contains the row header titles - std::vector<rtl::OUString> aRowHeaderContent; + std::vector<rtl::OUString>& aRowHeaderContent = m_pModel->getRowHeaderName(); ::std::vector<rtl::OUString>::iterator itRowName = aRowHeaderContent.begin(); if(m_pModel->hasRowHeaders()) @@ -1525,7 +1524,7 @@ namespace svt { namespace table } //------------------------------------------------------------------------------- - std::vector<RowPos> TableControl_Impl::getSelectedRows() + std::vector<RowPos>& TableControl_Impl::getSelectedRows() { return m_nRowSelected; } diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx index 410bc8b4c3a1..0a25e82e4502 100644 --- a/svtools/source/table/tablecontrol_impl.hxx +++ b/svtools/source/table/tablecontrol_impl.hxx @@ -138,6 +138,8 @@ namespace svt { namespace table inline RowPos getCurRow() const { return m_nCurRow; } inline void setCurRow(RowPos curRow){ m_nCurRow = curRow; } inline RowPos getTopRow() const { return m_nTopRow; } + inline long getRowCount() const { return m_nRowCount; } + inline long getColumnCount() const { return m_nColumnCount; } inline long getColHeaderHightPixel() const { return m_nColHeaderHeightPixel; } @@ -194,7 +196,7 @@ namespace svt { namespace table /** to be called when a new row is added to the control*/ void invalidateRow(RowPos _nRowPos, Rectangle& _rCellRect ); /** returns the vector, which contains the selected rows*/ - std::vector<RowPos> getSelectedRows(); + std::vector<RowPos>& getSelectedRows(); /** updates the vector, which contains the selected rows after removing the row nRowPos*/ void removeSelectedRow(RowPos _nRowPos); void invalidateRows(RowPos _nRowStart, Rectangle& _rCellRect ); @@ -208,15 +210,6 @@ namespace svt { namespace table virtual SelectionEngine* getSelEngine(); TableDataWindow* getDataWindow(); - - private: - /** toggles the cursor visibility - - The method is not bound to the classes public invariants, as it's used in - situations where the they must not necessarily be fullfilled. - */ - void impl_ni_doSwitchCursor( bool _bOn ); - /** retrieves the area occupied by the totality of (at least partially) visible cells The returned area includes row and column headers. Also, it takes into @@ -234,6 +227,13 @@ namespace svt { namespace table minus the row and column header areas. */ void impl_getAllVisibleDataCellArea( Rectangle& _rCellArea ) const; + private: + /** toggles the cursor visibility + + The method is not bound to the classes public invariants, as it's used in + situations where the they must not necessarily be fullfilled. + */ + void impl_ni_doSwitchCursor( bool _bOn ); /** returns the number of visible rows. diff --git a/svtools/uno/addrtempuno.cxx b/svtools/source/uno/addrtempuno.cxx index b2aff7ae711d..b2aff7ae711d 100644 --- a/svtools/uno/addrtempuno.cxx +++ b/svtools/source/uno/addrtempuno.cxx diff --git a/svtools/source/uno/contextmenuhelper.cxx b/svtools/source/uno/contextmenuhelper.cxx index be7738adaf14..b3ae322aa3ba 100644 --- a/svtools/source/uno/contextmenuhelper.cxx +++ b/svtools/source/uno/contextmenuhelper.cxx @@ -611,7 +611,7 @@ ContextMenuHelper::completeMenuProperties( // menu correctly. const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); bool bShowMenuImages( rSettings.GetUseImagesInMenus() ); - bool bIsHiContrast( rSettings.GetMenuColor().IsDark() ); + bool bIsHiContrast( rSettings.GetHighContrastMode() ); if ( pMenu ) { diff --git a/svtools/source/uno/makefile.mk b/svtools/source/uno/makefile.mk index 51e55a1f9123..82e509f1ce08 100644 --- a/svtools/source/uno/makefile.mk +++ b/svtools/source/uno/makefile.mk @@ -46,18 +46,20 @@ SRS1NAME= uno SRC1FILES= unoifac2.src SLOFILES= \ - $(SLO)$/unoiface.obj \ - $(SLO)$/unoevent.obj \ - $(SLO)$/unoimap.obj \ - $(SLO)$/toolboxcontroller.obj \ + $(SLO)$/addrtempuno.obj \ + $(SLO)$/contextmenuhelper.obj \ $(SLO)$/framestatuslistener.obj \ - $(SLO)$/statusbarcontroller.obj \ - $(SLO)$/genericunodialog.obj \ $(SLO)$/generictoolboxcontroller.obj \ + $(SLO)$/genericunodialog.obj \ + $(SLO)$/miscservices.obj\ + $(SLO)$/statusbarcontroller.obj \ + $(SLO)$/toolboxcontroller.obj \ $(SLO)$/treecontrolpeer.obj \ $(SLO)$/unocontroltablemodel.obj \ - $(SLO)$/registerservices.obj\ - $(SLO)$/contextmenuhelper.obj + $(SLO)$/unoevent.obj \ + $(SLO)$/unoiface.obj \ + $(SLO)$/unoimap.obj \ + $(SLO)$/svtxgridcontrol.obj # --- Targets ------------------------------------------------------ diff --git a/svtools/uno/miscservices.cxx b/svtools/source/uno/miscservices.cxx index e5c5aac3c35d..0f7b79720179 100644 --- a/svtools/uno/miscservices.cxx +++ b/svtools/source/uno/miscservices.cxx @@ -92,11 +92,6 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo ( xNewKey->createKey ( OUString::createFromAscii( "com.sun.star.ui.dialogs.FilterOptionsDialog" ) ); - xNewKey = xRegistryKey->createKey( - OUString::createFromAscii( "/com.sun.star.comp.svtools.PathService/UNO/SERVICES" ) ); - xNewKey->createKey ( - OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" ) ); - return sal_True; } return sal_False; @@ -135,18 +130,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( SvFilterOptionsDialog_CreateInstance, aServiceNames); } - else if (rtl_str_compare ( - pImplementationName, "com.sun.star.comp.svtools.PathService") == 0) - { - Sequence< OUString > aServiceNames(1); - aServiceNames.getArray()[0] = - OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" ); - xFactory = ::cppu::createSingleFactory ( - reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ), - OUString::createFromAscii( pImplementationName ), - PathService_CreateInstance, - aServiceNames); - } if ( xFactory.is() ) { xFactory->acquire(); diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx new file mode 100755 index 000000000000..2f2c896ee6a8 --- /dev/null +++ b/svtools/source/uno/svtxgridcontrol.cxx @@ -0,0 +1,458 @@ +/************************************************************************* + * + * 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: SVTXGridControl.cxx,v $ + * $Revision: 1.32 $ + * + * 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 "svtxgridcontrol.hxx" +#include <com/sun/star/view/SelectionType.hpp> +#include "svtools/table/gridtablerenderer.hxx" +#include "svtools/table/defaultinputhandler.hxx" +#include "svtools/table/tablecontrol.hxx" +#include "unocontroltablemodel.hxx" +#include <comphelper/sequence.hxx> +#include <rtl/ref.hxx> +#include <tools/debug.hxx> +#include <toolkit/helper/property.hxx> +#include <comphelper/processfactory.hxx> +#include <com/sun/star/awt/grid/XGridColumn.hpp> +#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>
+#include <com/sun/star/accessibility/AccessibleTableModelChangeType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+ + +using ::rtl::OUString; +using namespace ::svt::table; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::awt::grid; +using namespace ::com::sun::star::view; +using namespace ::toolkit; +using namespace ::com::sun::star::accessibility; +using namespace ::com::sun::star::accessibility::AccessibleEventId;
+using namespace ::com::sun::star::accessibility::AccessibleTableModelChangeType;
+using ::com::sun::star::accessibility::AccessibleTableModelChange;
+ + +SVTXGridControl::SVTXGridControl() + :m_pTableModel (new UnoControlTableModel()), + m_xDataModel(0), + m_xColumnModel(0), + m_bHasColumnHeaders(false), + m_bHasRowHeaders(false), + m_bVScroll(false), + m_bHScroll(false) +{ +} + +//-------------------------------------------------------------------- +SVTXGridControl::~SVTXGridControl() +{ + DELETEZ(m_pTableModel); +} + +::com::sun::star::uno::Any SVTXGridControl::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::awt::grid::XGridControl*, this ), + SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ), + SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); + return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); +} + +// ::com::sun::star::lang::XTypeProvider +IMPL_XTYPEPROVIDER_START( SVTXGridControl ) + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridControl>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel>* ) NULL ), + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener>* ) NULL ), + VCLXWindow::getTypes() +IMPL_XTYPEPROVIDER_END + +::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL SVTXGridControl::getColumnModel( ) throw (::com::sun::star::uno::RuntimeException) +{ + return NULL; +} +void SAL_CALL SVTXGridControl::setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException) +{ + (void)model; +} +::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL SVTXGridControl::getDataModel( ) throw (::com::sun::star::uno::RuntimeException) +{ + return NULL; +} +void SAL_CALL SVTXGridControl::setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException) +{ + (void)model; +} +sal_Int32 SAL_CALL SVTXGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) +{ + TableControl* pTable = (TableControl*)GetWindow(); + return pTable->GetCurrentRow( Point(x,y) ); +} + +void SAL_CALL SVTXGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) +{ + (void)listener; +} + +void SAL_CALL SVTXGridControl::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) +{ + (void) listener; +} + +void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const Any& aValue) throw(RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + TableControl* pTable = (TableControl*)GetWindow(); + + switch( GetPropertyId( PropertyName ) ) + { + case BASEPROPERTY_GRID_SELECTIONMODE: + { + SelectionType eSelectionType; + if( aValue >>= eSelectionType ) + { + SelectionMode eSelMode; + switch( eSelectionType ) + { + case SelectionType_SINGLE: eSelMode = SINGLE_SELECTION; break; + case SelectionType_RANGE: eSelMode = RANGE_SELECTION; break; + case SelectionType_MULTI: eSelMode = MULTIPLE_SELECTION; break; + // case SelectionType_NONE: + default: eSelMode = NO_SELECTION; break; + } + if( pTable->getSelEngine()->GetSelectionMode() != eSelMode ) + pTable->getSelEngine()->SetSelectionMode( eSelMode ); + } + break; + } + case BASEPROPERTY_HSCROLL: + { + sal_Bool bHScroll = true; + if( aValue >>= bHScroll ) + { + m_bHScroll = bHScroll; + } + break; + } + case BASEPROPERTY_VSCROLL: + { + sal_Bool bVScroll = true; + if( aValue >>= bVScroll ) + { + m_bVScroll = bVScroll; + } + break; + } + case BASEPROPERTY_GRID_SHOWROWHEADER: + { + sal_Bool rowHeader = true; + if( aValue >>= rowHeader ) + { + m_pTableModel->setRowHeaders(rowHeader); + } + break; + } + + case BASEPROPERTY_GRID_SHOWCOLUMNHEADER: + { + sal_Bool colHeader = true; + if( aValue >>= colHeader ) + { + m_pTableModel->setColumnHeaders(colHeader); + } + break; + } + case BASEPROPERTY_GRID_DATAMODEL: + { + m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY ); + Sequence<Sequence< ::rtl::OUString > > cellData = m_xDataModel->getData(); + Sequence<rtl::OUString> rowData(0); + std::vector< std::vector< rtl::OUString > > aCellContent(0); + for(int i = 0; i< m_xDataModel->getRowCount();++i) + { + rowData = cellData[i]; + std::vector<rtl::OUString> newRow( + comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowData)); + if(newRow.size() < (unsigned)m_pTableModel->getColumnCount()) + newRow.resize( m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii("")); + aCellContent.push_back(newRow); + } + m_pTableModel->setCellContent(aCellContent); + Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders(); + std::vector< rtl::OUString > newRow( + comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowHeaders)); + m_pTableModel->setRowCount(m_xDataModel->getRowCount()); + m_pTableModel->setRowHeaderName(newRow); + break; + } + case BASEPROPERTY_GRID_COLUMNMODEL: + { + m_xColumnModel = Reference< XGridColumnModel >( aValue, UNO_QUERY ); + Sequence<Reference< XGridColumn > > columns = m_xColumnModel->getColumns(); + std::vector<Reference< XGridColumn > > aNewColumns( + comphelper::sequenceToContainer<std::vector<Reference< XGridColumn > > >(columns)); + /* if(m_pTable->GetColumnCount().size()>0) + m_pTable->GetColumnName.clear();*/ + for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col ) + { + UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]); + m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn); + } + break; + } + default: + VCLXWindow::setProperty( PropertyName, aValue ); + break; + } +} + +Any SVTXGridControl::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + const sal_uInt16 nPropId = GetPropertyId( PropertyName ); + TableControl* pTable = (TableControl*)GetWindow(); + if(pTable) + { + switch(nPropId) + { + case BASEPROPERTY_GRID_SELECTIONMODE: + { + SelectionType eSelectionType; + + SelectionMode eSelMode = pTable->getSelEngine()->GetSelectionMode(); + switch( eSelMode ) + { + case SINGLE_SELECTION: eSelectionType = SelectionType_SINGLE; break; + case RANGE_SELECTION: eSelectionType = SelectionType_RANGE; break; + case MULTIPLE_SELECTION:eSelectionType = SelectionType_MULTI; break; +// case NO_SELECTION: + default: eSelectionType = SelectionType_NONE; break; + } + return Any( eSelectionType ); + } + case BASEPROPERTY_GRID_SHOWROWHEADER: + { + return Any ((sal_Bool) m_pTableModel->hasRowHeaders()); + } + case BASEPROPERTY_GRID_SHOWCOLUMNHEADER: + return Any ((sal_Bool) m_pTableModel->hasColumnHeaders()); + case BASEPROPERTY_GRID_DATAMODEL: + return Any ( m_xDataModel ); + case BASEPROPERTY_GRID_COLUMNMODEL: + return Any ( m_xColumnModel); + case BASEPROPERTY_HSCROLL: + return Any ( m_bHScroll); + case BASEPROPERTY_VSCROLL: + return Any ( m_bVScroll); + } + } + return VCLXWindow::getProperty( PropertyName ); +} + +void SVTXGridControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) +{ + PushPropertyIds( rIds, + BASEPROPERTY_GRID_SHOWROWHEADER, + BASEPROPERTY_GRID_SHOWCOLUMNHEADER, + BASEPROPERTY_GRID_DATAMODEL, + BASEPROPERTY_GRID_COLUMNMODEL, + BASEPROPERTY_GRID_SELECTIONMODE, + 0); + VCLXWindow::ImplGetPropertyIds( rIds, true ); +} +void SAL_CALL SVTXGridControl::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException) +{ + TableControl* pTable = (TableControl*)GetWindow(); + if ( pTable ) + { + pTable->SetModel(PTableModel(m_pTableModel)); + //m_pTable->SetPosSizePixel( Point( nPosX, nPosY ), Size(nWidth, nHeight) ); + pTable->Show( bVisible ); + } +} +void SAL_CALL SVTXGridControl::setFocus() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + if ( GetWindow()) + GetWindow()->GrabFocus(); +} +void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) +{ + std::vector<OUString> aNewRow( + comphelper::sequenceToContainer< std::vector<rtl::OUString > >(Event.rowData)); + if(aNewRow.size()< (unsigned)m_pTableModel->getColumnCount()) + aNewRow.resize(m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii("")); + m_pTableModel->getCellContent().push_back(aNewRow); + if(m_pTableModel->hasRowHeaders()) + m_pTableModel->getRowHeaderName().push_back(Event.headerName); + m_pTableModel->setRowCount(m_pTableModel->getRowHeaderName().size()); + TableControl* pTable = (TableControl*)GetWindow(); + pTable->InvalidateDataWindow(m_pTableModel->getRowHeaderName().size()-1, false); + //pTable->GrabFocus(); + if(pTable->isAccessibleAlive()) + { + pTable->commitGridControlEvent(TABLE_MODEL_CHANGED,
+ makeAny( AccessibleTableModelChange(INSERT, m_pTableModel->getRowCount()-1, m_pTableModel->getRowCount(), 0, m_pTableModel->getColumnCount())),
+ Any());
+ pTable->commitGridControlEvent(CHILD,
+ makeAny( pTable->m_pAccessTable->m_pAccessible->getTableHeader(TCTYPE_ROWHEADERBAR)),
+ Any());
+ for (sal_Int32 i = 0 ; i <= m_pTableModel->getColumnCount() ; ++i) + { + pTable->commitGridControlEvent( + CHILD, + makeAny( pTable->m_pAccessTable->m_pAccessible->getTable() ), + Any()); + }
+ } +} + +void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) +{ + TableControl* pTable = (TableControl*)GetWindow(); + //unsigned int rows =m_pImpl->aCellContent.size()-1; + if(Event.index == -1) + { + if(m_pTableModel->hasRowHeaders()) + m_pTableModel->getRowHeaderName().clear(); + m_pTableModel->getCellContent().clear(); + if(pTable->isAccessibleAlive()) + { + pTable->commitGridControlEvent(TABLE_MODEL_CHANGED,
+ makeAny( AccessibleTableModelChange(DELETE, 0, m_pTableModel->getColumnCount(), 0, m_pTableModel->getColumnCount())),
+ Any());
+ } + } + else + { + pTable->removeSelectedRow(Event.index); + if(m_pTableModel->getCellContent().size()>1) + { + if(m_pTableModel->hasRowHeaders()) + m_pTableModel->getRowHeaderName().erase(m_pTableModel->getRowHeaderName().begin()+Event.index); + m_pTableModel->getCellContent().erase(m_pTableModel->getCellContent().begin()+Event.index); + + } + else + { + if(m_pTableModel->hasRowHeaders()) + m_pTableModel->getRowHeaderName().clear(); + m_pTableModel->getCellContent().clear(); + //m_pImpl->nRowCount=0; + } + } + //pTable->InvalidateDataWindow(Event.index, true); + m_pTableModel->setRowCount(m_pTableModel->getCellContent().size()); + pTable->InvalidateDataWindow(Event.index, true); + if(pTable->isAccessibleAlive()) + { + pTable->commitGridControlEvent(TABLE_MODEL_CHANGED,
+ makeAny( AccessibleTableModelChange(DELETE, Event.index, Event.index+1, 0, m_pTableModel->getColumnCount())),
+ Any());
+ //pTable->commitGridControlEvent(CHILD,
+ // makeAny( pTable->m_pAccessTable->m_pAccessible->getTableHeader(TCTYPE_ROWHEADERBAR)),
+ // Any());
+ //for (sal_Int32 i = 0 ; i <= m_pTableModel->getColumnCount() ; ++i) + //{ + // pTable->commitGridControlEvent( + // CHILD, + // makeAny( pTable->m_pAccessTable->m_pAccessible->getTable() ), + // Any()); + //}
+ } + //pTable->Invalidate(); +} + +void SAL_CALL SVTXGridControl::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) +{ + (void) Event; +} + + void SAL_CALL SVTXGridControl::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) + { + VCLXWindow::disposing( Source ); + } + +::sal_Int32 SAL_CALL SVTXGridControl::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException) +{ + return 0; +} + +::sal_Int32 SAL_CALL SVTXGridControl::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException) +{ + return 0; +} + +void SAL_CALL SVTXGridControl::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException) +{ + (void)length; + (void)start; +} + +void SAL_CALL SVTXGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException) +{ + (void)end; + (void)start; +} + +::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL SVTXGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException) +{ + TableControl* pTable = (TableControl*)GetWindow(); + std::vector<RowPos>& selectedRows = pTable->GetSelectedRows(); + Sequence<sal_Int32> selectedRowsToSequence(comphelper::containerToSequence(selectedRows)); + return selectedRowsToSequence; +} + +::sal_Bool SAL_CALL SVTXGridControl::isCellEditable() throw (::com::sun::star::uno::RuntimeException) +{ + return sal_False; +} + +::sal_Bool SAL_CALL SVTXGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException) +{ + return sal_False; +} + +::sal_Bool SAL_CALL SVTXGridControl::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException) +{ + (void)index; + return sal_False; +} + +void SAL_CALL SVTXGridControl::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) +{ + (void)y; +} + +void SAL_CALL SVTXGridControl::selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException) +{ + (void)x; +} diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx new file mode 100755 index 000000000000..9ca6901681c9 --- /dev/null +++ b/svtools/source/uno/svtxgridcontrol.hxx @@ -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: SVTXGridControl.hxx,v $ + * $Revision: 1.32 $ + * + * 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 _SVT_GRIDCONTROL_HXX_ +#define _SVT_GRIDCONTROL_HXX_ + +#include <unocontroltablemodel.hxx> +#include <svtools/table/tablecontrol.hxx> +#include <com/sun/star/awt/grid/XGridControl.hpp> +#include <com/sun/star/awt/grid/XGridDataListener.hpp> +#include <com/sun/star/awt/grid/GridDataEvent.hpp> +#include <com/sun/star/awt/grid/XGridColumnModel.hpp> +#include <com/sun/star/awt/grid/XGridDataModel.hpp> +#include <com/sun/star/awt/grid/XGridSelectionListener.hpp> +#include <toolkit/awt/vclxwindow.hxx> +#include <toolkit/awt/vclxwindows.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <cppuhelper/implbase2.hxx> +//#include <toolkit/helper/listenermultiplexer.hxx> + + +using namespace ::svt::table; + +class SVTXGridControl : public ::cppu::ImplInheritanceHelper2< VCLXWindow, ::com::sun::star::awt::grid::XGridControl, + ::com::sun::star::awt::grid::XGridDataListener> +{ +private: + UnoControlTableModel* m_pTableModel; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >m_xDataModel; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >m_xColumnModel; + bool m_bHasColumnHeaders; + bool m_bHasRowHeaders; + bool m_bVScroll; + bool m_bHScroll; + +public: + SVTXGridControl(); + ~SVTXGridControl(); + //XGridDataListener overridables + virtual void SAL_CALL rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL dataChanged(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); + + ::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() { VCLXWindow::acquire(); } + void SAL_CALL release() throw() { VCLXWindow::release(); } + + // ::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::awt::grid::XGridControl + ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel( ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel( ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException); + + virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isCellEditable() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); + + void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); + static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds ); + void SAL_CALL setVisible(sal_Bool bVisible) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setFocus() throw(::com::sun::star::uno::RuntimeException); + }; + #endif // _SVT_GRIDCONTROL_HXX_ diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index eb8a543d31f9..a8d05c49a7ae 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -646,7 +646,7 @@ sal_Bool ToolboxController::isHighContrast() const vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow ) - bHighContrast = ( ((ToolBox *)pWindow)->GetBackground().GetColor().IsDark() ); + bHighContrast = ( ((ToolBox *)pWindow)->GetSettings().GetStyleSettings().GetHighContrastMode() ); } return bHighContrast; diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx index e322dbb8f96e..b4ddc2cc472d 100644 --- a/svtools/source/uno/unocontroltablemodel.cxx +++ b/svtools/source/uno/unocontroltablemodel.cxx @@ -47,38 +47,6 @@ using namespace ::svt::table; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::awt::grid; -using namespace ::svt::table; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::view; -using namespace ::toolkit; - -class UnoControlTableColumn : public IColumnModel - { - private: - ColumnID m_nID; - String m_sName; - bool m_bIsResizable; - TableMetrics m_nWidth; - TableMetrics m_nMinWidth; - TableMetrics m_nMaxWidth; - - public: - UnoControlTableColumn(Reference<XGridColumn>); - - // IColumnModel overridables - virtual ColumnID getID() const; - virtual bool setID( const ColumnID _nID ); - virtual String getName() const; - virtual void setName( const String& _rName ); - virtual bool isResizable() const; - virtual void setResizable( bool _bResizable ); - virtual TableMetrics getWidth() const; - virtual void setWidth( TableMetrics _nWidth ); - virtual TableMetrics getMinWidth() const; - virtual void setMinWidth( TableMetrics _nMinWidth ); - virtual TableMetrics getMaxWidth() const; - virtual void setMaxWidth( TableMetrics _nMaxWidth ); - }; //-------------------------------------------------------------------- UnoControlTableColumn::UnoControlTableColumn(Reference<XGridColumn> m_xGridColumn) @@ -181,7 +149,7 @@ class UnoControlTableColumn : public IColumnModel //==================================================================== struct UnoControlTableModel_Impl { - ::std::vector< PColumnModel > aColumns; + ::std::vector< PColumnModel >& aColumns; TableSize nRowCount; bool bHasColumnHeaders; bool bHasRowHeaders; @@ -190,11 +158,12 @@ class UnoControlTableColumn : public IColumnModel TableMetrics nRowHeight; TableMetrics nColumnHeaderHeight; TableMetrics nRowHeaderWidth; - std::vector<rtl::OUString> aRowHeadersTitle; - std::vector<std::vector<rtl::OUString> > aCellContent; + std::vector<rtl::OUString>& aRowHeadersTitle; + std::vector<std::vector<rtl::OUString> >& aCellContent; UnoControlTableModel_Impl() - :nRowCount ( 0 ) + :aColumns ( *(new std::vector< PColumnModel> (0))) + ,nRowCount ( 0 ) ,bHasColumnHeaders ( false ) ,bHasRowHeaders ( false ) ,pRenderer ( ) @@ -202,8 +171,8 @@ class UnoControlTableColumn : public IColumnModel ,nRowHeight ( 4 * 100 ) // 40 mm ,nColumnHeaderHeight( 5 * 100 ) // 50 mm ,nRowHeaderWidth ( 10 * 100 ) // 50 mm - ,aRowHeadersTitle ( 0 ) - ,aCellContent ( 0 ) + ,aRowHeadersTitle ( *(new std::vector<rtl::OUString>(0))) + ,aCellContent ( *(new std::vector<std::vector<OUString> >(0))) { } }; @@ -213,16 +182,10 @@ class UnoControlTableColumn : public IColumnModel //==================================================================== //-------------------------------------------------------------------- UnoControlTableModel::UnoControlTableModel() - :m_pImpl( new UnoControlTableModel_Impl ), - m_xDataModel(0), - m_xColumnModel(0), - m_bHasColumnHeaders(false), - m_bHasRowHeaders(false), - m_bVScroll(false), - m_bHScroll(false) - { - m_pImpl->bHasColumnHeaders = m_bHasColumnHeaders; - m_pImpl->bHasRowHeaders = m_bHasRowHeaders; + :m_pImpl( new UnoControlTableModel_Impl ) + { + m_pImpl->bHasColumnHeaders = false; + m_pImpl->bHasRowHeaders = false; m_pImpl->pRenderer.reset( new GridTableRenderer( *this ) ); m_pImpl->pInputHandler.reset( new DefaultInputHandler ); } @@ -236,7 +199,7 @@ class UnoControlTableColumn : public IColumnModel //-------------------------------------------------------------------- TableSize UnoControlTableModel::getColumnCount() const { - m_pImpl->aColumns.resize( m_xColumnModel->getColumnCount()); + //m_pImpl->aColumns.resize( m_xColumnModel->getColumnCount()); return (TableSize)m_pImpl->aColumns.size(); } @@ -312,6 +275,11 @@ class UnoControlTableColumn : public IColumnModel } //-------------------------------------------------------------------- + std::vector<PColumnModel>& UnoControlTableModel::getColumnModel() + { + return m_pImpl->aColumns; + } + //-------------------------------------------------------------------- PColumnModel UnoControlTableModel::getColumnModelByID( ColumnID id ) { (void)id; @@ -376,7 +344,7 @@ class UnoControlTableColumn : public IColumnModel //-------------------------------------------------------------------- ScrollbarVisibility UnoControlTableModel::getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const { - if(overAllHeight>=actHeight && !m_bVScroll) + if(overAllHeight>=actHeight)// && !m_bVScroll) return ScrollbarShowNever; else return ScrollbarShowAlways; @@ -385,7 +353,7 @@ class UnoControlTableColumn : public IColumnModel //-------------------------------------------------------------------- ScrollbarVisibility UnoControlTableModel::getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const { - if(overAllWidth>=actWidth && !m_bHScroll) + if(overAllWidth>=actWidth)// && !m_bHScroll) return ScrollbarShowNever; else return ScrollbarShowAlways; @@ -393,25 +361,26 @@ class UnoControlTableColumn : public IColumnModel //-------------------------------------------------------------------- void UnoControlTableModel::setCellContent(std::vector<std::vector<rtl::OUString> > cellContent) { - if(cellContent.empty()) - { - unsigned int i = m_pImpl->aColumns.size(); - std::vector<rtl::OUString> emptyCells; - while(i!=0) - { - cellContent.push_back(emptyCells); - --i; - } - } - std::vector<rtl::OUString> cCC; - for(::std::vector<std::vector<rtl::OUString> >::iterator iter = cellContent.begin(); iter!= cellContent.end();++iter) - { - cCC = *iter; - m_pImpl->aCellContent.push_back(cCC); - } - } - - std::vector<std::vector<rtl::OUString> > UnoControlTableModel::getCellContent() + //if(cellContent.empty()) + //{ + // unsigned int i = m_pImpl->aColumns.size(); + // std::vector<rtl::OUString>& emptyCells; + // while(i!=0) + // { + // cellContent.push_back(emptyCells); + // --i; + // } + //} + //std::vector<rtl::OUString> cCC; + //for(::std::vector<std::vector<rtl::OUString> >::iterator iter = cellContent.begin(); iter!= cellContent.end();++iter) + //{ + // cCC = *iter; + // m_pImpl->aCellContent.push_back(cCC); + //} + m_pImpl->aCellContent.swap( cellContent ); + } + + std::vector<std::vector<rtl::OUString> >& UnoControlTableModel::getCellContent() { return m_pImpl->aCellContent; } @@ -435,378 +404,8 @@ class UnoControlTableColumn : public IColumnModel } } - std::vector<rtl::OUString> UnoControlTableModel::getRowHeaderName() + std::vector<rtl::OUString>& UnoControlTableModel::getRowHeaderName() { return m_pImpl->aRowHeadersTitle; } -::com::sun::star::uno::Any UnoControlTableModel::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::awt::grid::XGridControl*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ), - //SAL_STATIC_CAST( com::sun::star::lang::XEventListener*, this ), - //SAL_STATIC_CAST( com::sun::star::awt::XMouseListener*, this ), - SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); - return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); -} - -// ::com::sun::star::lang::XTypeProvider -IMPL_XTYPEPROVIDER_START( UnoControlTableModel ) - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridControl>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener>* ) NULL ), - VCLXWindow::getTypes() -IMPL_XTYPEPROVIDER_END - -::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL UnoControlTableModel::getColumnModel( ) throw (::com::sun::star::uno::RuntimeException) -{ - return NULL; -} -void SAL_CALL UnoControlTableModel::setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException) -{ - (void)model; -} -::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL UnoControlTableModel::getDataModel( ) throw (::com::sun::star::uno::RuntimeException) -{ - return NULL; -} -void SAL_CALL UnoControlTableModel::setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException) -{ - (void)model; -} -sal_Int32 SAL_CALL UnoControlTableModel::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) -{ - TableControl* pTableControl = (TableControl*)GetWindow(); - return pTableControl->GetCurrentRow( Point(x,y) ); -} - -/* -void SAL_CALL UnoControlTableModel::addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException) -{ - VCLXWindow::addMouseListener( listener ); -} - -void SAL_CALL UnoControlTableModel::removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException) -{ - VCLXWindow::removeMouseListener( listener ); -} -*/ -/* -void SAL_CALL UnoControlTableModel::mousePressed( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) -{ - (void)rEvent; -} -void SAL_CALL UnoControlTableModel::mouseReleased( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) -{ - (void)rEvent; -} -void SAL_CALL UnoControlTableModel::mouseEntered( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) -{ - (void) rEvent; -} -void SAL_CALL UnoControlTableModel::mouseExited( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) -{ - (void) rEvent; -} -*/ -void SAL_CALL UnoControlTableModel::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) -{ - (void)listener; -} - -void SAL_CALL UnoControlTableModel::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) -{ - (void) listener; -} - -void UnoControlTableModel::setProperty( const ::rtl::OUString& PropertyName, const Any& aValue) throw(RuntimeException) -{ - ::vos::OGuard aGuard( GetMutex() ); - - TableControl* pTableControl = (TableControl*)GetWindow(); - - switch( GetPropertyId( PropertyName ) ) - { - case BASEPROPERTY_GRID_SELECTIONMODE: - { - SelectionType eSelectionType; - if( aValue >>= eSelectionType ) - { - SelectionMode eSelMode; - switch( eSelectionType ) - { - case SelectionType_SINGLE: eSelMode = SINGLE_SELECTION; break; - case SelectionType_RANGE: eSelMode = RANGE_SELECTION; break; - case SelectionType_MULTI: eSelMode = MULTIPLE_SELECTION; break; - // case SelectionType_NONE: - default: eSelMode = NO_SELECTION; break; - } - if( pTableControl->getSelEngine()->GetSelectionMode() != eSelMode ) - pTableControl->getSelEngine()->SetSelectionMode( eSelMode ); - } - break; - } - case BASEPROPERTY_HSCROLL: - { - sal_Bool bHScroll = true; - if( aValue >>= bHScroll ) - { - m_bHScroll = bHScroll; - } - break; - } - case BASEPROPERTY_VSCROLL: - { - sal_Bool bVScroll = true; - if( aValue >>= bVScroll ) - { - m_bVScroll = bVScroll; - } - break; - } - case BASEPROPERTY_GRID_SHOWROWHEADER: - { - sal_Bool rowHeader = true; - if( aValue >>= rowHeader ) - { - setRowHeaders(rowHeader); - } - break; - } - - case BASEPROPERTY_GRID_SHOWCOLUMNHEADER: - { - sal_Bool colHeader = true; - if( aValue >>= colHeader ) - { - setColumnHeaders(colHeader); - } - break; - } - case BASEPROPERTY_GRID_DATAMODEL: - { - m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY ); - Sequence<Sequence< ::rtl::OUString > > cellData = m_xDataModel->getData(); - Sequence<rtl::OUString> rowData(0); - for(int i = 0; i< m_xDataModel->getRowCount();++i) - { - rowData = cellData[i]; - std::vector<rtl::OUString> newRow( - comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowData)); - if(newRow.size()<m_pImpl->aColumns.size()) - newRow.resize(m_pImpl->aColumns.size(),rtl::OUString::createFromAscii("")); - m_pImpl->aCellContent.push_back(newRow); - } - Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders(); - std::vector< rtl::OUString > newRow( - comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowHeaders)); - m_pImpl->nRowCount = m_xDataModel->getRowCount(); - setRowHeaderName(newRow); - break; - } - case BASEPROPERTY_GRID_COLUMNMODEL: - { - m_xColumnModel = Reference< XGridColumnModel >( aValue, UNO_QUERY ); - Sequence<Reference< XGridColumn > > columns = m_xColumnModel->getColumns(); - std::vector<Reference< XGridColumn > > aNewColumns( - comphelper::sequenceToContainer<std::vector<Reference< XGridColumn > > >(columns)); - if(!m_pImpl->aColumns.empty()) - m_pImpl->aColumns.clear(); - for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col ) - { - UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]); - m_pImpl->aColumns.push_back((PColumnModel)tableColumn); - } - break; - } - default: - VCLXWindow::setProperty( PropertyName, aValue ); - break; - } -} - -Any UnoControlTableModel::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException) -{ - ::vos::OGuard aGuard( GetMutex() ); - - const sal_uInt16 nPropId = GetPropertyId( PropertyName ); - TableControl* pTableControl = (TableControl*)GetWindow(); - if(pTableControl) - { - switch(nPropId) - { - case BASEPROPERTY_GRID_SELECTIONMODE: - { - SelectionType eSelectionType; - - SelectionMode eSelMode = pTableControl->getSelEngine()->GetSelectionMode(); - switch( eSelMode ) - { - case SINGLE_SELECTION: eSelectionType = SelectionType_SINGLE; break; - case RANGE_SELECTION: eSelectionType = SelectionType_RANGE; break; - case MULTIPLE_SELECTION:eSelectionType = SelectionType_MULTI; break; -// case NO_SELECTION: - default: eSelectionType = SelectionType_NONE; break; - } - return Any( eSelectionType ); - } - case BASEPROPERTY_GRID_SHOWROWHEADER: - { - return Any ((sal_Bool) pTableControl->GetModel()->hasRowHeaders()); - } - case BASEPROPERTY_GRID_SHOWCOLUMNHEADER: - return Any ((sal_Bool) pTableControl->GetModel()->hasColumnHeaders()); - case BASEPROPERTY_GRID_DATAMODEL: - return Any ( m_xDataModel ); - case BASEPROPERTY_GRID_COLUMNMODEL: - return Any ( m_xColumnModel); - case BASEPROPERTY_HSCROLL: - return Any ( m_bHScroll); - case BASEPROPERTY_VSCROLL: - return Any ( m_bVScroll); - } - } - return VCLXWindow::getProperty( PropertyName ); -} - -void UnoControlTableModel::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_GRID_SHOWROWHEADER, - BASEPROPERTY_GRID_SHOWCOLUMNHEADER, - BASEPROPERTY_GRID_DATAMODEL, - BASEPROPERTY_GRID_COLUMNMODEL, - BASEPROPERTY_GRID_SELECTIONMODE, - 0); - VCLXWindow::ImplGetPropertyIds( rIds, true ); -} -void SAL_CALL UnoControlTableModel::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException) -{ - TableControl* pTable = (TableControl*)GetWindow(); - if ( pTable ) - { - pTable->SetModel(PTableModel(this)); - pTable->Show( bVisible ); - } -} -void SAL_CALL UnoControlTableModel::setFocus() throw(::com::sun::star::uno::RuntimeException) -{ - ::vos::OGuard aGuard( GetMutex() ); - if ( GetWindow()) - GetWindow()->GrabFocus(); -} -void SAL_CALL UnoControlTableModel::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) -{ - std::vector<OUString> aNewRow( - comphelper::sequenceToContainer< std::vector<rtl::OUString > >(Event.rowData)); - if(aNewRow.size()<m_pImpl->aColumns.size()) - aNewRow.resize(m_pImpl->aColumns.size(),rtl::OUString::createFromAscii("")); - m_pImpl->aCellContent.push_back(aNewRow); - if(hasRowHeaders()) - m_pImpl->aRowHeadersTitle.push_back(Event.headerName); - m_pImpl->nRowCount=m_pImpl->aCellContent.size(); - TableControl* pTable = (TableControl*)GetWindow(); - pTable->InvalidateDataWindow(m_pImpl->nRowCount-1, false); - //pTable->GrabFocus(); -} - -void SAL_CALL UnoControlTableModel::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) -{ - TableControl* pTable = (TableControl*)GetWindow(); - //unsigned int rows =m_pImpl->aCellContent.size()-1; - if(Event.index == -1) - { - if(hasRowHeaders()) - m_pImpl->aRowHeadersTitle.clear(); - m_pImpl->aCellContent.clear(); - } - else - { - pTable->removeSelectedRow(Event.index); - if(m_pImpl->aCellContent.size()>1) - { - if(hasRowHeaders()) - m_pImpl->aRowHeadersTitle.erase(m_pImpl->aRowHeadersTitle.begin()+Event.index); - m_pImpl->aCellContent.erase(m_pImpl->aCellContent.begin()+Event.index); - - } - else - { - if(hasRowHeaders()) - m_pImpl->aRowHeadersTitle.clear(); - m_pImpl->aCellContent.clear(); - //m_pImpl->nRowCount=0; - } - } - //pTable->InvalidateDataWindow(Event.index, true); - setRowCount(m_pImpl->aCellContent.size()); - pTable->InvalidateDataWindow(Event.index, true); - //pTable->Invalidate(); -} - -void SAL_CALL UnoControlTableModel::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) -{ - (void) Event; -} - - void SAL_CALL UnoControlTableModel::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) - { - VCLXWindow::disposing( Source ); - } - -::sal_Int32 SAL_CALL UnoControlTableModel::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException) -{ - return 0; -} - -::sal_Int32 SAL_CALL UnoControlTableModel::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException) -{ - return 0; -} - -void SAL_CALL UnoControlTableModel::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException) -{ - (void)length; - (void)start; -} - -void SAL_CALL UnoControlTableModel::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException) -{ - (void)end; - (void)start; -} - -::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoControlTableModel::getSelection() throw (::com::sun::star::uno::RuntimeException) -{ - TableControl* pTable = (TableControl*)GetWindow(); - std::vector<RowPos> selectedRows = pTable->getSelectedRows(); - Sequence<sal_Int32> selectedRowsToSequence(comphelper::containerToSequence(selectedRows)); - return selectedRowsToSequence; -} - -::sal_Bool SAL_CALL UnoControlTableModel::isCellEditable() throw (::com::sun::star::uno::RuntimeException) -{ - return sal_False; -} - -::sal_Bool SAL_CALL UnoControlTableModel::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException) -{ - return sal_False; -} - -::sal_Bool SAL_CALL UnoControlTableModel::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException) -{ - (void)index; - return sal_False; -} - -void SAL_CALL UnoControlTableModel::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) -{ - (void)y; -} - -void SAL_CALL UnoControlTableModel::selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException) -{ - (void)x; -} diff --git a/svtools/source/uno/unocontroltablemodel.hxx b/svtools/source/uno/unocontroltablemodel.hxx index 5da9cc871756..fe3d1f28e9ed 100644 --- a/svtools/source/uno/unocontroltablemodel.hxx +++ b/svtools/source/uno/unocontroltablemodel.hxx @@ -43,25 +43,48 @@ #include <toolkit/awt/vclxwindows.hxx> #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/implbase2.hxx> +#include <com/sun/star/awt/grid/XGridColumn.hpp> //#include <toolkit/helper/listenermultiplexer.hxx> using namespace ::svt::table; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::awt::grid; + +class UnoControlTableColumn : public IColumnModel + { + private: + ColumnID m_nID; + String m_sName; + bool m_bIsResizable; + TableMetrics m_nWidth; + TableMetrics m_nMinWidth; + TableMetrics m_nMaxWidth; + + public: + UnoControlTableColumn(Reference<XGridColumn>); + + // IColumnModel overridables + virtual ColumnID getID() const; + virtual bool setID( const ColumnID _nID ); + virtual String getName() const; + virtual void setName( const String& _rName ); + virtual bool isResizable() const; + virtual void setResizable( bool _bResizable ); + virtual TableMetrics getWidth() const; + virtual void setWidth( TableMetrics _nWidth ); + virtual TableMetrics getMinWidth() const; + virtual void setMinWidth( TableMetrics _nMinWidth ); + virtual TableMetrics getMaxWidth() const; + virtual void setMaxWidth( TableMetrics _nMaxWidth ); + }; struct UnoControlTableModel_Impl; - class UnoControlTableModel : public ITableModel, public ::cppu::ImplInheritanceHelper2< VCLXWindow, ::com::sun::star::awt::grid::XGridControl, - ::com::sun::star::awt::grid::XGridDataListener> + class UnoControlTableModel : public ITableModel { private: UnoControlTableModel_Impl* m_pImpl; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >m_xDataModel; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >m_xColumnModel; - bool m_bHasColumnHeaders; - bool m_bHasRowHeaders; - bool m_bVScroll; - bool m_bHScroll; - //MouseListenerMultiplexer m_aMouseListeners; public: UnoControlTableModel(); @@ -103,6 +126,7 @@ using namespace ::svt::table; virtual void addTableModelListener( const PTableModelListener& listener ); virtual void removeTableModelListener( const PTableModelListener& listener ); virtual PColumnModel getColumnModel( ColPos column ); + virtual std::vector<PColumnModel>& getColumnModel(); virtual PColumnModel getColumnModelByID( ColumnID id ); virtual PTableRenderer getRenderer() const; virtual PTableInputHandler getInputHandler() const; @@ -112,59 +136,9 @@ using namespace ::svt::table; virtual ScrollbarVisibility getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const; virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const; virtual void setCellContent(std::vector<std::vector<rtl::OUString> > cellContent); - virtual std::vector<std::vector<rtl::OUString> > getCellContent(); + virtual std::vector<std::vector<rtl::OUString> >& getCellContent(); virtual void setRowHeaderName(std::vector<rtl::OUString> cellColumnContent); - virtual std::vector<rtl::OUString> getRowHeaderName(); - - //XGridDataListener overridables - virtual void SAL_CALL rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL dataChanged(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); - - ::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() { VCLXWindow::acquire(); } - void SAL_CALL release() throw() { VCLXWindow::release(); } - - // ::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::awt::grid::XGridControl - ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel( ) throw (::com::sun::star::uno::RuntimeException); - void SAL_CALL setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel( ) throw (::com::sun::star::uno::RuntimeException); - void SAL_CALL setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException); - - virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isCellEditable() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); - - //void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException); - //void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException); - //::com::sun::star::awt::XMouseListener - /* - virtual void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException); - */ - - void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); - static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds ); - void SAL_CALL setVisible(sal_Bool bVisible) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL setFocus() throw(::com::sun::star::uno::RuntimeException); + virtual std::vector<rtl::OUString>& getRowHeaderName(); }; inline void UnoControlTableModel::SetColumnWidth( ColPos _nColumn, TableMetrics _nWidth100thMM ) diff --git a/svtools/source/uno/unoevent.cxx b/svtools/source/uno/unoevent.cxx index 19d40c17ce5c..6fc8b0017ad8 100644 --- a/svtools/source/uno/unoevent.cxx +++ b/svtools/source/uno/unoevent.cxx @@ -40,7 +40,7 @@ #include <tools/rtti.hxx> #include <tools/solar.h> #include "unoevent.hxx" -#include <svtools/macitem.hxx> +#include <svl/macitem.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; diff --git a/svtools/source/uno/unoifac2.hrc b/svtools/source/uno/unoifac2.hrc index 4e8cf0303da5..4f46edffdc51 100644 --- a/svtools/source/uno/unoifac2.hrc +++ b/svtools/source/uno/unoifac2.hrc @@ -33,7 +33,7 @@ #ifndef _SOLAR_HRC -#include <svtools/solar.hrc> +#include <svl/solar.hrc> #endif //! Um den berblick ber alle benutzten HelpID's zu behalten sind diese diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index 54cc448ff89e..9c7c3eec33d1 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -48,14 +48,13 @@ #include <toolkit/helper/convert.hxx> #include <toolkit/helper/property.hxx> #include <svtools/fmtfield.hxx> -#include <numuno.hxx> +#include <svl/numuno.hxx> #include <calendar.hxx> #include <prgsbar.hxx> #include <svtools/svtreebx.hxx> #include "treecontrolpeer.hxx" -//#include "vclxgridcontrol.hxx" -#include "unocontroltablemodel.hxx" +#include "svtxgridcontrol.hxx" #include <svtools/table/tablecontrol.hxx> namespace @@ -172,10 +171,8 @@ SAL_DLLPUBLIC_EXPORT Window* CreateWindow( VCLXWindow** ppNewComp, const ::com:: { if ( pParent ) { - ::svt::table::TableControl* m_pTable = new ::svt::table::TableControl(pParent, nWinBits); - UnoControlTableModel* pModel = new UnoControlTableModel(); - *ppNewComp = pModel; - pWindow = m_pTable; + pWindow = new ::svt::table::TableControl(pParent, nWinBits); + *ppNewComp = new SVTXGridControl; } else { @@ -552,86 +549,6 @@ void VCLXMultiLineEdit::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) } // ---------------------------------------------------- -// class VCLXFileDialog -// ---------------------------------------------------- -/* -VCLXFileDialog::VCLXFileDialog() -{ -} - -VCLXFileDialog::~VCLXFileDialog() -{ -} - -::com::sun::star::uno::Any VCLXFileDialog::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::awt::XXX*, this ) ); - return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); -} - -// ::com::sun::star::lang::XTypeProvider -IMPL_XTYPEPROVIDER_START( VCLXFileDialog ) - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XXX>* ) NULL ) -IMPL_XTYPEPROVIDER_END - -void VCLXFileDialog::setPath( const ::rtl::OUString& rPath ) -{ - ::vos::OGuard aGuard( GetMutex() ); - - FileDialog* pDlg = (FileDialog*)GetWindow(); - if ( pDlg ) - pDlg->SetPath( ::rtl::OUStringToOString( rPath, CHARSET_SYSTEM ) ); -} - -::rtl::OUString VCLXFileDialog::getPath() -{ - ::vos::OGuard aGuard( GetMutex() ); - - ::rtl::OUString aPath; - FileDialog* pDlg = (FileDialog*)GetWindow(); - if ( pDlg ) - aPath = StringToOUString( pDlg->GetPath(), CHARSET_SYSTEM ); - return aPath; -} - -void VCLXFileDialog::setFilters( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& rFilterNames, const ::com::sun::star::uno::Sequence< ::rtl::OUString>& rMasks ) -{ - ::vos::OGuard aGuard( GetMutex() ); - - FileDialog* pDlg = (FileDialog*)GetWindow(); - if ( pDlg ) - { - sal_uInt32 nFlts = rFilterNames.getLength(); - for ( sal_uInt32 n = 0; n < nFlts; n++ ) - pDlg->AddFilter( - ::rtl::OUStringToOString( rFilterNames.getConstArray()[n], CHARSET_SYSTEM ), - ::rtl::OUStringToOString( rMasks.getConstArray()[n], CHARSET_SYSTEM ) ); - } -} - -void VCLXFileDialog::setCurrentFilter( const ::rtl::OUString& rFilterName ) -{ - ::vos::OGuard aGuard( GetMutex() ); - - FileDialog* pDlg = (FileDialog*)GetWindow(); - if ( pDlg ) - pDlg->SetCurFilter( ::rtl::OUStringToOString( rFilterName, CHARSET_SYSTEM ) ); -} - -::rtl::OUString VCLXFileDialog::getCurrentFilter() -{ - ::vos::OGuard aGuard( GetMutex() ); - - ::rtl::OUString aFilter; - FileDialog* pDlg = (FileDialog*)GetWindow(); - if ( pDlg ) - aFilter = StringToOUString( pDlg->GetCurFilter(), CHARSET_SYSTEM ); - return aFilter; -} -*/ - -// ---------------------------------------------------- // class VCLXFileControl // ---------------------------------------------------- VCLXFileControl::VCLXFileControl() : maTextListeners( *this ) diff --git a/svtools/uno/exports.map b/svtools/uno/exports.map deleted file mode 100644 index f4ed78b9e970..000000000000 --- a/svtools/uno/exports.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/svtools/uno/makefile.mk b/svtools/uno/makefile.mk deleted file mode 100644 index 8f61c7100508..000000000000 --- a/svtools/uno/makefile.mk +++ /dev/null @@ -1,81 +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: makefile.mk,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. -# -#************************************************************************* - -PRJ=.. -PRJNAME=svtools -TARGET=svtmisc.uno -LIBTARGET=NO -ENABLE_EXCEPTIONS=TRUE -VISIBILITY_HIDDEN=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk -DLLPRE= - -# --- Files ------------------------------------- - -SLOFILES= \ - $(SLO)$/addrtempuno.obj \ - $(SLO)$/miscservices.obj \ - $(SLO)$/pathservice.obj - -SHL1TARGET= $(TARGET) -SHL1IMPLIB= i$(TARGET) - -SHL1OBJS= \ - $(SLO)$/svtdata.obj \ - $(SLOFILES) - -SHL1LIBS= \ - $(SLB)$/filter.uno.lib - -SHL1STDLIBS=\ - $(SVTOOLLIB) \ - $(TKLIB) \ - $(VCLLIB) \ - $(SVLLIB) \ - $(UNOTOOLSLIB) \ - $(TOOLSLIB) \ - $(COMPHELPERLIB) \ - $(VOSLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(SALLIB) - -SHL1VERSIONMAP=exports.map -SHL1DEF= $(MISC)$/$(SHL1TARGET).def -DEF1NAME= $(SHL1TARGET) - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/svtools/util/makefile.mk b/svtools/util/makefile.mk index 80596d23e866..22be04f95d3f 100644 --- a/svtools/util/makefile.mk +++ b/svtools/util/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* #* # 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 @@ -35,7 +35,6 @@ PRJNAME=svtools TARGET=svtool RESTARGET=svt RESTARGETPATCH=svp -RESTARGETSIMPLE=svs GEN_HID=TRUE GEN_HID_OTHER=TRUE ENABLE_EXCEPTIONS=TRUE @@ -49,54 +48,33 @@ USE_LDUMP2=TRUE # --- general section ---------------------------------------------------- .IF "$(GUI)"!="UNX" -LIB3TARGET= $(LB)$/svtool.lib -LIB3FILES= $(LB)$/_svt.lib +LIB2TARGET= $(LB)$/svtool.lib +LIB2FILES= $(LB)$/_svt.lib .ENDIF -.IF "$(GUI)"!="UNX" -LIB4TARGET= $(LB)$/isvl.lib -LIB4FILES= $(LB)$/_isvl.lib -.ENDIF - -LIB7TARGET= $(SLB)$/svt.lib -LIB7FILES= \ - $(SLB)$/misc.lib \ - $(SLB)$/items.lib \ +LIB1TARGET= $(SLB)$/svt.lib +LIB1FILES= \ $(SLB)$/browse.lib \ + $(SLB)$/config.lib \ + $(SLB)$/svcontnr.lib \ $(SLB)$/ctrl.lib \ $(SLB)$/dialogs.lib \ $(SLB)$/edit.lib \ - $(SLB)$/unoiface.lib \ $(SLB)$/filter.lib \ + $(SLB)$/filter.uno.lib \ $(SLB)$/igif.lib \ $(SLB)$/jpeg.lib \ $(SLB)$/ixpm.lib \ $(SLB)$/ixbm.lib \ - $(SLB)$/numbers.lib \ - $(SLB)$/numbers.uno.lib \ $(SLB)$/wmf.lib \ - $(SLB)$/undo.lib \ - $(SLB)$/urlobj.lib \ + $(SLB)$/java.lib \ + $(SLB)$/misc.lib \ $(SLB)$/plugapp.lib \ - $(SLB)$/svcontnr.lib \ - $(SLB)$/syslocale.lib \ - $(SLB)$/svdde.lib \ $(SLB)$/svhtml.lib \ $(SLB)$/svrtf.lib \ - $(SLB)$/heavyconfig.lib \ $(SLB)$/table.lib \ - $(SLB)$/java.lib - -LIB8TARGET= $(SLB)$/svl.lib -LIB8FILES= \ - $(SLB)$/config.lib \ - $(SLB)$/filerec.lib \ - $(SLB)$/filepicker.lib \ - $(SLB)$/items1.lib \ - $(SLB)$/misc1.lib \ - $(SLB)$/notify.lib \ - $(SLB)$/svarray.lib \ - $(SLB)$/svsql.lib + $(SLB)$/unoiface.lib \ + $(SLB)$/urlobj.lib # generation of resourcen-lib ---------------------------------------- @@ -113,12 +91,6 @@ RESLIB1SRSFILES= \ $(SRS)$/browse.srs \ $(SRS)$/javaerror.srs -RESLIB2NAME= $(RESTARGETSIMPLE) -RESLIB2SRSFILES=\ - $(SRS)$/items1.srs \ - $(SRS)$/misc1.srs - - RESLIB3NAME= $(RESTARGETPATCH) RESLIB3SRSFILES= \ $(SRS)$/patchjavaerror.srs @@ -140,6 +112,7 @@ SHL1STDLIBS+= \ $(VCLLIB) \ $(SVLLIB) \ $(SOTLIB) \ + $(BASEGFXLIB) \ $(UNOTOOLSLIB) \ $(TOOLSLIB) \ $(I18NISOLANGLIB) \ @@ -169,55 +142,16 @@ SHL1STDLIBS+= \ $(OLEAUT32LIB) .ENDIF # WNT -SHL1OBJS= \ - $(SLO)$/svtdata.obj - SHL1LIBS= \ $(SLB)$/svt.lib SHL1DEF= $(MISC)$/$(SHL1TARGET).def -SHL1DEPN=$(SHL2TARGETN) DEF1NAME= $(SHL1TARGET) -DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt DEFLIB1NAME =svt DEF1DES =SvTools -# --- svtools lite -------------------------------------------------- - -SHL2TARGET= svl$(DLLPOSTFIX) -SHL2IMPLIB= _isvl -SHL2USE_EXPORTS=name -#Do not link with VCL or any other library that links with VCL -SHL2STDLIBS= \ - $(UNOTOOLSLIB) \ - $(TOOLSLIB) \ - $(I18NISOLANGLIB) \ - $(UCBHELPERLIB) \ - $(COMPHELPERLIB) \ - $(CPPUHELPERLIB) \ - $(CPPULIB) \ - $(VOSLIB) \ - $(VCLLIB) \ - $(SALLIB) - -.IF "$(GUI)"=="WNT" -SHL2STDLIBS+= \ - $(UWINAPILIB) \ - $(ADVAPI32LIB) \ - $(GDI32LIB) -.ENDIF # WNT - -SHL2LIBS= $(SLB)$/svl.lib - -SHL2DEF= $(MISC)$/$(SHL2TARGET).def - -DEF2NAME= $(SHL2TARGET) -DEF2DEPN= $(MISC)$/$(SHL2TARGET).flt $(SLB)$/svl.lib -DEFLIB2NAME=svl -DEF2DES =SvTools lite - # --- g2g application -------------------------------------------------- APP2TARGET = g2g @@ -241,19 +175,14 @@ APP2STDLIBS+= $(VCLLIB) \ # --- Targets ------------------------------------------------------ .IF "$(GUI)"=="UNX" -SVTTARGETS= $(LB)$/lib$(SHL2TARGET)$(DLLPOST) $(LB)$/lib$(SHL1TARGET)$(DLLPOST) +SVTTARGETS= $(LB)$/lib$(SHL1TARGET)$(DLLPOST) .ELSE -SVTTARGETS= $(LB)$/isvl.lib \ - $(BIN)$/$(SHL2TARGET)$(DLLPOST) $(BIN)$/$(SHL1TARGET)$(DLLPOST) +SVTTARGETS= $(BIN)$/$(SHL1TARGET)$(DLLPOST) .ENDIF # just a quick fix - has to be cleaned up some day... .IF "$(L10N-framework)"=="" -ALL: $(SLB)$/svl.lib \ - $(SLB)$/svt.lib \ - $(MISC)$/$(SHL2TARGET).flt \ - $(MISC)$/$(SHL1TARGET).flt \ - $(MISC)$/$(SHL2TARGET).def \ +ALL: $(SLB)$/svt.lib \ $(MISC)$/$(SHL1TARGET).def \ $(SVTTARGETS) \ ALLTAR @@ -261,15 +190,4 @@ ALL: $(SLB)$/svl.lib \ .INCLUDE : target.mk -# --- Svtools-Control-Filter-Datei --- - -$(MISC)$/$(SHL1TARGET).flt: svt.flt - @echo ------------------------------ - @echo Making: $@ - $(TYPE) svt.flt >$@ - -$(MISC)$/$(SHL2TARGET).flt: svl.flt - @echo ------------------------------ - @echo Making: $@ - $(TYPE) svl.flt >$@ diff --git a/svtools/util/svl.flt b/svtools/util/svl.flt deleted file mode 100644 index be7de3bce8c5..000000000000 --- a/svtools/util/svl.flt +++ /dev/null @@ -1,85 +0,0 @@ -AUTO_CODE -BrowserDataWin -BrowserColumn -ButtonFrame -CreateLoader -DdeString -DlgSource -DlgExport -EditWindow -FileEntry -GIFLZWDecompressor -GIFReader -PNGReader -ImpDetect -ImpDraw -ImpGet -ImpPut -ImpSvNum -JPEGReader -WMFReader -EnhWMFReader -WMFWriter -LinkStub -MultiTextLineInfo -Regexpr -RemoteControlServer -RemoteControlService -RetStream -SCmdStream -SbxArrayRef -SbxBasicFormater -SbxRes -SbxVariableRef -SfxListUndoAction -SfxPointerEntry -SfxUINT32s -SfxULongRangeItem -SfxULongRanges -SfxULongRangesItem -SgfFontLst -SgfFontOne -StatementCommand -StatementControl -StatementFlow -StatementList -StatementSlot -SVDDE_MISC_CODE -SvInterfaceClient -SvImp -SvStringLockBytes -svtools -SVTOOLS_FILTER -SVTOOLS_CODE -SVTOOLS_FILTER4 -SVTOOLS_FILTER_CODE -ValueSetItem -WMFRecord -WriteRecord -XPMReader -XBMReader -_grow -_ImplINetHistoryLoadTimer -_ImplINetHistoryStoreTimer -sRTF_ -sHTML_ -SdbSqlScanner -Sdbyy_scan -SqlInternalNode -unnamed -WEP -LIBMAIN -LibMain -??_7 -??_8 -??_C -??_E -??_F -??_G -??_H -??_I -0Imp -Impl@@ -Imp@@ -__CT -_STL diff --git a/svtools/util/svt.flt b/svtools/util/svt.flt deleted file mode 100644 index f021d41b1dca..000000000000 --- a/svtools/util/svt.flt +++ /dev/null @@ -1,81 +0,0 @@ -AUTO_CODE -BrowserDataWin -BrowserColumn -ButtonFrame -CreateLoader -DdeString -DlgSource -DlgExport -EditWindow -FileEntry -GIFLZWDecompressor -GIFReader -PNGReader -ImpDetect -ImpDraw -ImpGet -ImpPut -ImpSv -JPEGReader -WMFReader -EnhWMFReader -WMFWriter -LinkStub -MultiTextLineInfo -Regexpr -RemoteControlServer -RemoteControlService -RetStream -SCmdStream -SbxArrayRef -SbxBasicFormater -SbxRes -SbxVariableRef -SfxListUndoAction -SfxPointerEntry -SfxUINT32s -SfxULongRangeItem -SfxULongRanges -SfxULongRangesItem -SgfFontLst -SgfFontOne -StatementCommand -StatementControl -StatementFlow -StatementList -StatementSlot -SVDDE_MISC_CODE -SvInterfaceClient -SvImp -SvStringLockBytes -SVTOOLS_FILTER -SVTOOLS_CODE -SVTOOLS_FILTER4 -SVTOOLS_FILTER_CODE -ValueSetItem -WMFRecord -WriteRecord -XPMReader -XBMReader -_grow -_ImplINetHistoryLoadTimer -_ImplINetHistoryStoreTimer -sRTF_ -sHTML_ -unnamed -svtools\ -WEP -LIBMAIN -LibMain -??_7 -??_8 -??_C -??_E -??_F -??_G -??_H -??_I -0Imp -Impl@@ -Imp@@ -__CT diff --git a/svtools/win/res/makefile.mk b/svtools/win/res/makefile.mk deleted file mode 100644 index 3c33d006edf9..000000000000 --- a/svtools/win/res/makefile.mk +++ /dev/null @@ -1,30 +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: makefile.mk,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. -# -#************************************************************************* diff --git a/svtools/workben/unodialog/udlg_global.hrc b/svtools/workben/unodialog/udlg_global.hrc index 71a67cd2b7e8..bde0e5e86ce2 100644 --- a/svtools/workben/unodialog/udlg_global.hrc +++ b/svtools/workben/unodialog/udlg_global.hrc @@ -31,7 +31,7 @@ #ifndef SVTOOLS_UDLG_GLOBAL_HRC #define SVTOOLS_UDLG_GLOBAL_HRC -#include <svtools/solar.hrc> +#include <svl/solar.hrc> //===================================================================== //= bases diff --git a/toolkit/inc/toolkit/awt/vclxprinter.hxx b/toolkit/inc/toolkit/awt/vclxprinter.hxx index e94864b51280..4db43a3c5d77 100644 --- a/toolkit/inc/toolkit/awt/vclxprinter.hxx +++ b/toolkit/inc/toolkit/awt/vclxprinter.hxx @@ -43,9 +43,7 @@ #include <toolkit/helper/mutexandbroadcasthelper.hxx> #include <cppuhelper/propshlp.hxx> -class Printer; -class String; - +#include "vcl/oldprintadaptor.hxx" // Fuer den Drucker relevante Properties: /* @@ -65,20 +63,17 @@ class VCLXPrinterPropertySet : public ::com::sun::star::awt::XPrinterPropertySe public MutexAndBroadcastHelper, public ::cppu::OPropertySetHelper { -private: - Printer* mpPrinter; +protected: + boost::shared_ptr<Printer> mpPrinter; ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > mxPrnDevice; sal_Int16 mnOrientation; sal_Bool mbHorizontal; - -protected: - public: VCLXPrinterPropertySet( const String& rPrinterName ); virtual ~VCLXPrinterPropertySet(); - Printer* GetPrinter() const { return mpPrinter; } + Printer* GetPrinter() const { return mpPrinter.get(); } ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > GetDevice(); // ::com::sun::star::uno::XInterface @@ -120,6 +115,8 @@ class VCLXPrinter: public ::com::sun::star::awt::XPrinter, public VCLXPrinterPropertySet, public ::cppu::OWeakObject { + boost::shared_ptr<vcl::OldStylePrintAdaptor> mpListener; + JobSetup maInitJobSetup; public: VCLXPrinter( const String& rPrinterName ); ~VCLXPrinter(); diff --git a/toolkit/inc/toolkit/awt/vclxtopwindow.hxx b/toolkit/inc/toolkit/awt/vclxtopwindow.hxx index 7b4f1922b99e..4716120a347b 100644 --- a/toolkit/inc/toolkit/awt/vclxtopwindow.hxx +++ b/toolkit/inc/toolkit/awt/vclxtopwindow.hxx @@ -32,31 +32,45 @@ #define _TOOLKIT_AWT_VCLXTOPWINDOW_HXX_ #include <com/sun/star/awt/XSystemDependentWindowPeer.hpp> -#include <com/sun/star/awt/XTopWindow.hpp> +#include <com/sun/star/awt/XTopWindow2.hpp> #include <com/sun/star/awt/XMenuBar.hpp> #include <cppuhelper/weak.hxx> #include <osl/mutex.hxx> -#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase1.hxx> #include <toolkit/awt/vclxcontainer.hxx> -typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::XTopWindow, - ::com::sun::star::awt::XSystemDependentWindowPeer - > VCLXTopWindow_XBase; +typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XTopWindow2 + > VCLXTopWindow_XBase; +typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XSystemDependentWindowPeer + > VCLXTopWindow_SBase; -class TOOLKIT_DLLPUBLIC VCLXTopWindow_Base: public VCLXTopWindow_XBase +class TOOLKIT_DLLPUBLIC VCLXTopWindow_Base :public VCLXTopWindow_XBase + ,public VCLXTopWindow_SBase { +private: + const bool m_bWHWND; + protected: ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar> mxMenuBar; + bool isSystemDependentWindowPeer() const { return m_bWHWND; } + virtual ::vos::IMutex& GetMutexImpl() = 0; virtual Window* GetWindowImpl() = 0; virtual ::cppu::OInterfaceContainerHelper& GetTopWindowListenersImpl() = 0; + VCLXTopWindow_Base( const bool _bSupportSystemWindowPeer ); + public: virtual ~VCLXTopWindow_Base(); + // XInterface equivalents + ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); + // XTypeProvider equivalents + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::awt::XSystemDependentWindowPeer ::com::sun::star::uno::Any SAL_CALL getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException); @@ -66,6 +80,14 @@ public: void SAL_CALL toFront() throw(::com::sun::star::uno::RuntimeException); void SAL_CALL toBack() throw(::com::sun::star::uno::RuntimeException); void SAL_CALL setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& xMenu ) throw(::com::sun::star::uno::RuntimeException); + + // XTopWindow2 + virtual ::sal_Bool SAL_CALL getIsMaximized() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setIsMaximized( ::sal_Bool _ismaximized ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getIsMinimized() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setIsMinimized( ::sal_Bool _isminimized ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getDisplay() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDisplay( ::sal_Int32 _display ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException); }; // ---------------------------------------------------- @@ -75,9 +97,6 @@ public: class VCLXTopWindow: public VCLXTopWindow_Base, public VCLXContainer { -private: - bool m_bWHWND; - protected: virtual vos::IMutex& GetMutexImpl(); virtual Window* GetWindowImpl(); diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx index 3e61a9e9aa87..b6958c720f29 100644 --- a/toolkit/inc/toolkit/awt/vclxwindows.hxx +++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx @@ -32,6 +32,7 @@ #define _TOOLKIT_AWT_VCLXWINDOWS_HXX_ #include <toolkit/dllapi.h> + #include <com/sun/star/beans/PropertyValues.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -88,8 +89,8 @@ #include <cppuhelper/weak.hxx> #include <cppuhelper/implbase2.hxx> -#include <toolkit/awt/vclxwindow.hxx> -#include <toolkit/awt/vclxtopwindow.hxx> +#include "toolkit/awt/vclxwindow.hxx" +#include "toolkit/awt/vclxtopwindow.hxx" #include <cppuhelper/implbase1.hxx> #include <vcl/pointr.hxx> diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx index fbfe90494279..f82df1f5b53f 100644 --- a/toolkit/inc/toolkit/helper/property.hxx +++ b/toolkit/inc/toolkit/helper/property.hxx @@ -197,6 +197,7 @@ namespace rtl { #define BASEPROPERTY_GRID_COLUMNMODEL 143 #define BASEPROPERTY_GRID_SELECTIONMODE 144 #define BASEPROPERTY_ENABLEVISIBLE 145 // sal_Bool +#define BASEPROPERTY_REFERENCE_DEVICE 146 // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen. diff --git a/toolkit/qa/complex/toolkit/interface_tests/makefile.mk b/toolkit/qa/complex/toolkit/interface_tests/makefile.mk index 8c9cb27ecd04..ed7855663f36 100755 --- a/toolkit/qa/complex/toolkit/interface_tests/makefile.mk +++ b/toolkit/qa/complex/toolkit/interface_tests/makefile.mk @@ -40,7 +40,7 @@ PACKAGE = complex$/toolkit$/interface_tests #----- compile .java files ----------------------------------------- -JARFILES = mysql.jar sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar +JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar JAVAFILES = _XAccessibleComponent.java \ _XAccessibleContext.java \ _XAccessibleExtendedComponent.java \ diff --git a/toolkit/qa/complex/toolkit/makefile.mk b/toolkit/qa/complex/toolkit/makefile.mk index b375d1d5b238..c895c8403498 100755 --- a/toolkit/qa/complex/toolkit/makefile.mk +++ b/toolkit/qa/complex/toolkit/makefile.mk @@ -40,7 +40,7 @@ PACKAGE = complex$/toolkit #----- compile .java files ----------------------------------------- -JARFILES = mysql.jar sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar +JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar JAVAFILES = CheckAccessibleStatusBar.java CheckAccessibleStatusBarItem.java CheckAsyncCallback.java CallbackClass.java JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) SUBDIRS = interface_tests diff --git a/toolkit/source/awt/vclxdialog.cxx b/toolkit/source/awt/vclxdialog.cxx index 0712f8ca074c..32f2931e7438 100644 --- a/toolkit/source/awt/vclxdialog.cxx +++ b/toolkit/source/awt/vclxdialog.cxx @@ -66,6 +66,7 @@ DBG_NAME( VCLXDialog ) VCLXDialog::VCLXDialog() : VCLXWindow() + , VCLXTopWindow_Base( true ) , VCLXDialog_Base() , Bin() , bRealized( false ) diff --git a/toolkit/source/awt/vclxprinter.cxx b/toolkit/source/awt/vclxprinter.cxx index 69d8dd827497..a8059463a297 100644 --- a/toolkit/source/awt/vclxprinter.cxx +++ b/toolkit/source/awt/vclxprinter.cxx @@ -102,10 +102,10 @@ IMPL_XTYPEPROVIDER_END VCLXPrinterPropertySet::VCLXPrinterPropertySet( const String& rPrinterName ) : OPropertySetHelper( BrdcstHelper ) + , mpPrinter( new Printer( rPrinterName ) ) { osl::Guard< vos::IMutex > aSolarGuard( Application::GetSolarMutex() ); - mpPrinter = new Printer( rPrinterName ); mnOrientation = 0; mbHorizontal = sal_False; } @@ -113,8 +113,7 @@ VCLXPrinterPropertySet::VCLXPrinterPropertySet( const String& rPrinterName ) VCLXPrinterPropertySet::~VCLXPrinterPropertySet() { osl::Guard< vos::IMutex > aSolarGuard( Application::GetSolarMutex() ); - - delete mpPrinter; + mpPrinter.reset(); } ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinterPropertySet::GetDevice() @@ -326,13 +325,16 @@ IMPL_XTYPEPROVIDER_START( VCLXPrinter ) VCLXPrinterPropertySet::getTypes() IMPL_XTYPEPROVIDER_END -sal_Bool VCLXPrinter::start( const ::rtl::OUString& rJobName, sal_Int16 /*nCopies*/, sal_Bool /*bCollate*/ ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) +sal_Bool VCLXPrinter::start( const ::rtl::OUString& /*rJobName*/, sal_Int16 /*nCopies*/, sal_Bool /*bCollate*/ ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { ::osl::Guard< ::osl::Mutex > aGuard( Mutex ); sal_Bool bDone = sal_True; - if ( GetPrinter() ) - bDone = GetPrinter()->StartJob( rJobName ); + if ( mpListener.get() ) + { + maInitJobSetup = mpPrinter->GetJobSetup(); + mpListener.reset( new vcl::OldStylePrintAdaptor( mpPrinter ) ); + } return bDone; } @@ -341,24 +343,28 @@ void VCLXPrinter::end( ) throw(::com::sun::star::awt::PrinterException, ::com:: { ::osl::Guard< ::osl::Mutex > aGuard( Mutex ); - if ( GetPrinter() ) - GetPrinter()->EndJob(); + if ( mpListener.get() ) + { + Printer::PrintJob( mpListener, maInitJobSetup ); + mpListener.reset(); + } } void VCLXPrinter::terminate( ) throw(::com::sun::star::uno::RuntimeException) { ::osl::Guard< ::osl::Mutex > aGuard( Mutex ); - if ( GetPrinter() ) - GetPrinter()->AbortJob(); + mpListener.reset(); } ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinter::startPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException) { ::osl::Guard< ::osl::Mutex > aGuard( Mutex ); - if ( GetPrinter() ) - GetPrinter()->StartPage(); + if ( mpListener.get() ) + { + mpListener->StartPage(); + } return GetDevice(); } @@ -366,8 +372,10 @@ void VCLXPrinter::endPage( ) throw(::com::sun::star::awt::PrinterException, ::c { ::osl::Guard< ::osl::Mutex > aGuard( Mutex ); - if ( GetPrinter() ) - GetPrinter()->EndPage(); + if ( mpListener.get() ) + { + mpListener->EndPage(); + } } diff --git a/toolkit/source/awt/vclxtopwindow.cxx b/toolkit/source/awt/vclxtopwindow.cxx index 26e457d74583..6e532c7bef3e 100644 --- a/toolkit/source/awt/vclxtopwindow.cxx +++ b/toolkit/source/awt/vclxtopwindow.cxx @@ -46,6 +46,7 @@ #include <vcl/syschild.hxx> #include <vcl/sysdata.hxx> #include <cppuhelper/typeprovider.hxx> +#include <comphelper/sequence.hxx> #include <toolkit/awt/vclxtopwindow.hxx> #include <toolkit/awt/vclxmenu.hxx> @@ -54,13 +55,44 @@ #include <vcl/wrkwin.hxx> #include <vcl/syswin.hxx> #include <vcl/menu.hxx> +#include <vcl/svapp.hxx> #include <tools/debug.hxx> +using ::com::sun::star::uno::RuntimeException; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::Type; +using ::com::sun::star::uno::Any; +using ::com::sun::star::lang::IndexOutOfBoundsException; + +VCLXTopWindow_Base::VCLXTopWindow_Base( const bool _bSupportSystemWindowPeer ) + :m_bWHWND( _bSupportSystemWindowPeer ) +{ +} + VCLXTopWindow_Base::~VCLXTopWindow_Base() { } +Any VCLXTopWindow_Base::queryInterface( const Type & rType ) throw(RuntimeException) +{ + ::com::sun::star::uno::Any aRet( VCLXTopWindow_XBase::queryInterface( rType ) ); + + // do not expose XSystemDependentWindowPeer if we do not have a system window handle + if ( !aRet.hasValue() && m_bWHWND ) + aRet = VCLXTopWindow_SBase::queryInterface( rType ); + + return aRet; +} + +Sequence< Type > VCLXTopWindow_Base::getTypes() throw(RuntimeException) +{ + Sequence< Type > aTypes( VCLXTopWindow_XBase::getTypes() ); + if ( m_bWHWND ) + aTypes = ::comphelper::concatSequences( aTypes, VCLXTopWindow_SBase::getTypes() ); + return aTypes; +} + ::com::sun::star::uno::Any VCLXTopWindow_Base::getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& /*ProcessId*/, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutexImpl() ); @@ -157,6 +189,81 @@ void VCLXTopWindow_Base::setMenuBar( const ::com::sun::star::uno::Reference< ::c mxMenuBar = rxMenu; } +//-------------------------------------------------------------------- +::sal_Bool SAL_CALL VCLXTopWindow_Base::getIsMaximized() throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutexImpl() ); + + const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( GetWindowImpl() ); + if ( !pWindow ) + return sal_False; + + return pWindow->IsMaximized(); +} + +//-------------------------------------------------------------------- +void SAL_CALL VCLXTopWindow_Base::setIsMaximized( ::sal_Bool _ismaximized ) throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutexImpl() ); + + WorkWindow* pWindow = dynamic_cast< WorkWindow* >( GetWindowImpl() ); + if ( !pWindow ) + return; + + pWindow->Maximize( _ismaximized ); +} + +//-------------------------------------------------------------------- +::sal_Bool SAL_CALL VCLXTopWindow_Base::getIsMinimized() throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutexImpl() ); + + const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( GetWindowImpl() ); + if ( !pWindow ) + return sal_False; + + return pWindow->IsMinimized(); +} + +//-------------------------------------------------------------------- +void SAL_CALL VCLXTopWindow_Base::setIsMinimized( ::sal_Bool _isMinimized ) throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutexImpl() ); + + WorkWindow* pWindow = dynamic_cast< WorkWindow* >( GetWindowImpl() ); + if ( !pWindow ) + return; + + _isMinimized ? pWindow->Minimize() : pWindow->Restore(); +} + +//-------------------------------------------------------------------- +::sal_Int32 SAL_CALL VCLXTopWindow_Base::getDisplay() throw (RuntimeException) +{ + ::vos::OGuard aGuard( GetMutexImpl() ); + + const SystemWindow* pWindow = dynamic_cast< const SystemWindow* >( GetWindowImpl() ); + if ( !pWindow ) + return 0; + + return pWindow->GetScreenNumber(); +} + +//-------------------------------------------------------------------- +void SAL_CALL VCLXTopWindow_Base::setDisplay( ::sal_Int32 _display ) throw (RuntimeException, IndexOutOfBoundsException) +{ + ::vos::OGuard aGuard( GetMutexImpl() ); + + if ( ( _display < 0 ) || ( _display >= (sal_Int32)Application::GetScreenCount() ) ) + throw IndexOutOfBoundsException(); + + SystemWindow* pWindow = dynamic_cast< SystemWindow* >( GetWindowImpl() ); + if ( !pWindow ) + return; + + pWindow->SetScreenNumber( _display ); +} + // ---------------------------------------------------- // class VCLXTopWindow // ---------------------------------------------------- @@ -167,7 +274,7 @@ void VCLXTopWindow::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) } VCLXTopWindow::VCLXTopWindow(bool bWHWND) - : m_bWHWND(bWHWND) + : VCLXTopWindow_Base( bWHWND ) { } @@ -193,24 +300,19 @@ Window* VCLXTopWindow::GetWindowImpl() // ::com::sun::star::uno::XInterface ::com::sun::star::uno::Any VCLXTopWindow::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { - ::com::sun::star::uno::Any aRet; - if(! m_bWHWND) { - aRet = ::cppu::queryInterface( rType, - SAL_STATIC_CAST( ::com::sun::star::awt::XTopWindow*, this ) ); - } - else { - aRet = ::cppu::queryInterface( rType, - SAL_STATIC_CAST( ::com::sun::star::awt::XTopWindow*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XSystemDependentWindowPeer*, this ) ); - } - return (aRet.hasValue() ? aRet : VCLXContainer::queryInterface( rType )); + ::com::sun::star::uno::Any aRet( VCLXTopWindow_Base::queryInterface( rType ) ); + + if ( !aRet.hasValue() ) + aRet = VCLXContainer::queryInterface( rType ); + + return aRet; } ::com::sun::star::uno::Sequence< sal_Int8 > VCLXTopWindow::getImplementationId() throw(::com::sun::star::uno::RuntimeException) { static ::cppu::OImplementationId* pId = NULL; static ::cppu::OImplementationId* pIdWithHandle = NULL; - if ( m_bWHWND ) + if ( isSystemDependentWindowPeer() ) { if( !pIdWithHandle ) { @@ -242,41 +344,5 @@ Window* VCLXTopWindow::GetWindowImpl() ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > VCLXTopWindow::getTypes() throw(::com::sun::star::uno::RuntimeException) { - static ::cppu::OTypeCollection* pCollection = NULL; - static ::cppu::OTypeCollection* pCollectionWithHandle = NULL; - - if ( m_bWHWND ) - { - if( !pCollectionWithHandle ) - { - ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); - if( !pCollectionWithHandle ) - { - static ::cppu::OTypeCollection collectionWithHandle( - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSystemDependentWindowPeer>* ) NULL ), - VCLXContainer::getTypes() ); - pCollectionWithHandle = &collectionWithHandle; - } - } - - return (*pCollectionWithHandle).getTypes(); - } - else - { - if( !pCollection ) - { - ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); - if( !pCollection ) - { - static ::cppu::OTypeCollection collection( - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow>* ) NULL ), - VCLXContainer::getTypes() ); - pCollection = &collection; - } - } - return (*pCollection).getTypes(); - } + return ::comphelper::concatSequences( VCLXTopWindow_Base::getTypes(), VCLXContainer::getTypes() ); } diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index 9ca21c5fb36b..3d2069ab8385 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -64,6 +64,7 @@ #include <vcl/dockwin.hxx> #include <vcl/pdfextoutdevdata.hxx> #include <vcl/tabpage.hxx> +#include <vcl/button.hxx> #include <comphelper/asyncnotification.hxx> #include <toolkit/helper/solarrelease.hxx> @@ -76,6 +77,7 @@ 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::awt::XDevice; using ::com::sun::star::style::VerticalAlignment; using ::com::sun::star::style::VerticalAlignment_TOP; using ::com::sun::star::style::VerticalAlignment_MIDDLE; @@ -1585,6 +1587,18 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: sal_uInt16 nPropType = GetPropertyId( PropertyName ); switch ( nPropType ) { + case BASEPROPERTY_REFERENCE_DEVICE: + { + Control* pControl = dynamic_cast< Control* >( pWindow ); + OSL_ENSURE( pControl, "VCLXWindow::setProperty( RefDevice ): need a Control for this!" ); + if ( !pControl ) + break; + Reference< XDevice > xDevice( Value, UNO_QUERY ); + OutputDevice* pDevice = VCLUnoHelper::GetOutputDevice( xDevice ); + pControl->SetReferenceDevice( pDevice ); + } + break; + case BASEPROPERTY_CONTEXT_WRITING_MODE: { OSL_VERIFY( Value >>= mpImpl->mnContextWritingMode ); @@ -2103,6 +2117,19 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: sal_uInt16 nPropType = GetPropertyId( PropertyName ); switch ( nPropType ) { + case BASEPROPERTY_REFERENCE_DEVICE: + { + Control* pControl = dynamic_cast< Control* >( GetWindow() ); + OSL_ENSURE( pControl, "VCLXWindow::setProperty( RefDevice ): need a Control for this!" ); + if ( !pControl ) + break; + + VCLXDevice* pDevice = new VCLXDevice; + pDevice->SetOutputDevice( pControl->GetReferenceDevice() ); + aProp <<= Reference< XDevice >( pDevice ); + } + break; + case BASEPROPERTY_CONTEXT_WRITING_MODE: aProp <<= mpImpl->mnContextWritingMode; break; diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index b49fa1a621d6..e41de1e8bd25 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -408,6 +408,7 @@ void VCLXButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_VERTICALALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_REFERENCE_DEVICE, 0); VCLXImageConsumer::ImplGetPropertyIds( rIds ); } @@ -420,9 +421,6 @@ VCLXButton::VCLXButton() VCLXButton::~VCLXButton() { -#ifndef __SUNPRO_CC - OSL_TRACE ("%s", __FUNCTION__); -#endif } ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXButton::CreateAccessibleContext() @@ -817,6 +815,7 @@ void VCLXCheckBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_VERTICALALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_REFERENCE_DEVICE, 0); VCLXImageConsumer::ImplGetPropertyIds( rIds ); } @@ -1116,6 +1115,7 @@ void VCLXRadioButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_VERTICALALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_REFERENCE_DEVICE, 0); VCLXImageConsumer::ImplGetPropertyIds( rIds ); } @@ -1540,6 +1540,7 @@ void VCLXListBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_ALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_REFERENCE_DEVICE, BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, 0); VCLXWindow::ImplGetPropertyIds( rIds ); @@ -2759,6 +2760,7 @@ void VCLXFixedText::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_VERTICALALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_REFERENCE_DEVICE, 0); VCLXWindow::ImplGetPropertyIds( rIds ); } @@ -3388,6 +3390,7 @@ void VCLXEdit::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_PAINTTRANSPARENT, BASEPROPERTY_AUTOHSCROLL, BASEPROPERTY_AUTOVSCROLL, + BASEPROPERTY_VERTICALALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, 0); @@ -3762,6 +3765,7 @@ void VCLXComboBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_ALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_REFERENCE_DEVICE, BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, 0); // no, don't call VCLXEdit here - it has properties which we do *not* want to have at at combo box @@ -4280,6 +4284,7 @@ void VCLXDateField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_ENFORCE_FORMAT, BASEPROPERTY_TEXT, BASEPROPERTY_HIDEINACTIVESELECTION, + BASEPROPERTY_VERTICALALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, @@ -4621,6 +4626,7 @@ void VCLXTimeField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_ENFORCE_FORMAT, BASEPROPERTY_TEXT, BASEPROPERTY_HIDEINACTIVESELECTION, + BASEPROPERTY_VERTICALALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, @@ -4924,6 +4930,7 @@ void VCLXNumericField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_VALUE_DOUBLE, BASEPROPERTY_ENFORCE_FORMAT, BASEPROPERTY_HIDEINACTIVESELECTION, + BASEPROPERTY_VERTICALALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, @@ -5518,6 +5525,7 @@ void VCLXCurrencyField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_VALUE_DOUBLE, BASEPROPERTY_ENFORCE_FORMAT, BASEPROPERTY_HIDEINACTIVESELECTION, + BASEPROPERTY_VERTICALALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, @@ -5865,6 +5873,7 @@ void VCLXPatternField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_TABSTOP, BASEPROPERTY_TEXT, BASEPROPERTY_HIDEINACTIVESELECTION, + BASEPROPERTY_VERTICALALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, diff --git a/toolkit/source/controls/formattedcontrol.cxx b/toolkit/source/controls/formattedcontrol.cxx index 6171067f1185..5ac7a0237479 100644 --- a/toolkit/source/controls/formattedcontrol.cxx +++ b/toolkit/source/controls/formattedcontrol.cxx @@ -160,6 +160,7 @@ namespace toolkit ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR ); ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION ); ImplRegisterProperty( BASEPROPERTY_ENFORCE_FORMAT ); + ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN ); ImplRegisterProperty( BASEPROPERTY_WRITING_MODE ); ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE ); ImplRegisterProperty( BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR ); diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx index 0775b6ee74f3..21876feb072b 100644 --- a/toolkit/source/controls/unocontrol.cxx +++ b/toolkit/source/controls/unocontrol.cxx @@ -1050,10 +1050,10 @@ void UnoControl::draw( sal_Int32 x, sal_Int32 y ) throw(RuntimeException) if ( xDrawPeerView.is() ) { - Reference< XVclWindowPeer > xWindowPeer; - xWindowPeer.set( xDrawPeer, UNO_QUERY ); - if ( xWindowPeer.is() ) - xWindowPeer->setDesignMode( mbDesignMode ); + Reference< XVclWindowPeer > xWindowPeer; + xWindowPeer.set( xDrawPeer, UNO_QUERY ); + if ( xWindowPeer.is() ) + xWindowPeer->setDesignMode( mbDesignMode ); xDrawPeerView->draw( x, y ); } diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index cc5faa27eec8..a4febcd33b33 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/awt/FontSlant.hpp> #include <com/sun/star/awt/MouseWheelBehavior.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> +#include <com/sun/star/awt/XDevice.hpp> #include <com/sun/star/text/WritingMode2.hpp> #include <com/sun/star/io/XMarkableStream.hpp> #include <toolkit/controls/unocontrolmodel.hxx> @@ -262,7 +263,11 @@ void UnoControlModel::ImplPropertyChanged( sal_uInt16 ) switch ( nPropId ) { case BASEPROPERTY_GRAPHIC: - aDefault <<= makeAny( Reference< graphic::XGraphic >() ); + aDefault <<= Reference< graphic::XGraphic >(); + break; + + case BASEPROPERTY_REFERENCE_DEVICE: + aDefault <<= Reference< awt::XDevice >(); break; case BASEPROPERTY_VERTICALALIGN: diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index 3abacef7b67f..9e508c884f59 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -476,6 +476,7 @@ void UnoEditControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) t // ---------------------------------------------------- UnoControlFileControlModel::UnoControlFileControlModel() { + ImplRegisterProperty( BASEPROPERTY_ALIGN ); ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); ImplRegisterProperty( BASEPROPERTY_BORDER ); ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR ); @@ -489,6 +490,7 @@ UnoControlFileControlModel::UnoControlFileControlModel() ImplRegisterProperty( BASEPROPERTY_READONLY ); ImplRegisterProperty( BASEPROPERTY_TABSTOP ); ImplRegisterProperty( BASEPROPERTY_TEXT ); + ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN ); ImplRegisterProperty( BASEPROPERTY_WRITING_MODE ); ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE ); ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION ); diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx index e71c03bae47d..a59af95a2e1f 100644 --- a/toolkit/source/helper/property.cxx +++ b/toolkit/source/helper/property.cxx @@ -47,6 +47,7 @@ #include <com/sun/star/awt/FontUnderline.hpp> #include <com/sun/star/awt/FontStrikeout.hpp> #include <com/sun/star/awt/FontPitch.hpp> +#include <com/sun/star/awt/XDevice.hpp> #include <com/sun/star/awt/tree/XTreeDataModel.hpp> #include <com/sun/star/awt/grid/XGridDataModel.hpp> #include <com/sun/star/awt/grid/XGridColumnModel.hpp> @@ -65,6 +66,7 @@ using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Reference; +using ::com::sun::star::awt::XDevice; using ::com::sun::star::awt::FontDescriptor; using ::com::sun::star::style::VerticalAlignment; @@ -275,12 +277,13 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) 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 ), - DECL_PROP_2 ( "ShowRowHeader", GRID_SHOWROWHEADER, sal_Bool, BOUND, MAYBEDEFAULT ), - DECL_PROP_2 ( "ShowColumnHeader", GRID_SHOWCOLUMNHEADER, sal_Bool, BOUND, MAYBEDEFAULT ), - DECL_PROP_3 ( "GridDataModel", GRID_DATAMODEL, Reference< ::com::sun::star::awt::grid::XGridDataModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ), - DECL_PROP_3 ( "ColumnModel", GRID_COLUMNMODEL, Reference< ::com::sun::star::awt::grid::XGridColumnModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ), - DECL_PROP_3 ( "SelectionModel", GRID_SELECTIONMODE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT, MAYBEVOID ), - DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ) + DECL_PROP_2 ( "ShowRowHeader", GRID_SHOWROWHEADER, sal_Bool, BOUND, MAYBEDEFAULT ), + DECL_PROP_2 ( "ShowColumnHeader", GRID_SHOWCOLUMNHEADER, sal_Bool, BOUND, MAYBEDEFAULT ), + DECL_PROP_3 ( "GridDataModel", GRID_DATAMODEL, Reference< ::com::sun::star::awt::grid::XGridDataModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ), + DECL_PROP_3 ( "ColumnModel", GRID_COLUMNMODEL, Reference< ::com::sun::star::awt::grid::XGridColumnModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ), + DECL_PROP_3 ( "SelectionModel", GRID_SELECTIONMODE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT, MAYBEVOID ), + DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ), + DECL_PROP_3 ( "ReferenceDevice", REFERENCE_DEVICE, Reference< XDevice >,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 902792918de0..423e40c4f305 100644 --- a/toolkit/source/helper/throbberimpl.cxx +++ b/toolkit/source/helper/throbberimpl.cxx @@ -110,9 +110,9 @@ namespace toolkit { FixedImage* pImage = static_cast< FixedImage* >( mxParent->GetWindow() ); if ( pImage ) - return pImage->GetSettings().GetStyleSettings().GetFaceColor().IsDark(); + return pImage->GetSettings().GetStyleSettings().GetHighContrastMode(); else - return Application::GetSettings().GetStyleSettings().GetFaceColor().IsDark(); + return Application::GetSettings().GetStyleSettings().GetHighContrastMode(); } // ----------------------------------------------------------------------- diff --git a/toolkit/src2xml/include.lst b/toolkit/src2xml/include.lst index 7b35ccc73c73..d4be6f5e3517 100644 --- a/toolkit/src2xml/include.lst +++ b/toolkit/src2xml/include.lst @@ -128,7 +128,6 @@ ../../cppcanvas/inc ../../cppcanvas/source/inc ../../cppcanvas/unxlngi6.pro/inc -../../sandbox/unxlngi6.pro/inc ../../eventattacher/unxlngi6.pro/inc ../../unotools/inc ../../unotools/unxlngi6.pro/inc @@ -301,4 +300,4 @@ ../../cli_ure/inc ../../cli_ure/unxlngi6.pro/inc ../../psprint/inc -../../psprint/unxlngi6.pro/inc
\ No newline at end of file +../../psprint/unxlngi6.pro/inc diff --git a/toolkit/workben/layout/editor.cxx b/toolkit/workben/layout/editor.cxx index dd218de40da7..3b5bd768566b 100644 --- a/toolkit/workben/layout/editor.cxx +++ b/toolkit/workben/layout/editor.cxx @@ -34,7 +34,6 @@ #undef NDEBUG /* -#include <assert.h> #include <stdio.h> #include <string.h> */ @@ -189,12 +188,12 @@ public: while ( xParent.is() && !uno::Reference< awt::XWindow >( xParent, uno::UNO_QUERY ).is() ) { uno::Reference< awt::XLayoutContainer > xContainer( xParent, uno::UNO_QUERY ); - assert( xContainer.is() ); + OSL_ASSERT( xContainer.is() ); xParent = uno::Reference< awt::XLayoutContainer >( xContainer->getParent(), uno::UNO_QUERY ); } mxWidget = WidgetFactory::createWidget( xToolkit, xParent, unoName, nAttrbs ); - assert( mxWidget.is() ); + OSL_ASSERT( mxWidget.is() ); mxContainer = uno::Reference< awt::XLayoutContainer >( mxWidget, uno::UNO_QUERY ); mrLabel = mrUnoName = unoName; @@ -340,7 +339,7 @@ public: else maChildren.push_back( pChild ); - assert( pChild->mpParent == NULL ); + OSL_ASSERT( pChild->mpParent == NULL ); pChild->mpParent = this; // store container props @@ -1733,7 +1732,7 @@ EditorImpl::EditorImpl( layout::Dialog *dialog, mxFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ) ), uno::UNO_QUERY ); - assert( mxToolkit.is() ); + OSL_ASSERT( mxToolkit.is() ); // custom widgets #if DEBUG_PRINT @@ -1890,7 +1889,7 @@ IMPL_LINK( EditorImpl, CreateWidgetHdl, layout::Button *, pBtn ) if ( pBtn == *it ) break; } - assert( i < WIDGETS_SPECS_LEN ); + OSL_ASSERT( i < WIDGETS_SPECS_LEN ); createWidget( WIDGETS_SPECS[i].pName ); return 0; } diff --git a/tools/inc/poly.h b/tools/inc/poly.h index ed70359be0c0..4f281a9b1359 100644 --- a/tools/inc/poly.h +++ b/tools/inc/poly.h @@ -99,17 +99,4 @@ public: ~ImplPolyPolygon(); }; -inline long MinMax( long nVal, long nMin, long nMax ) -{ - return( nVal >= nMin ? ( nVal <= nMax ? nVal : nMax ) : nMin ); -} - -// ------------------------------------------------------------------ - -inline long FRound( double fVal ) -{ - return( fVal > 0.0 ? (long) ( fVal + 0.5 ) : -(long) ( -fVal + 0.5 ) ); -} - - #endif // _SV_POLY_H diff --git a/tools/inc/tools/date.hxx b/tools/inc/tools/date.hxx index 87602e27d874..e14be54b7df1 100644 --- a/tools/inc/tools/date.hxx +++ b/tools/inc/tools/date.hxx @@ -115,6 +115,9 @@ public: TOOLS_DLLPUBLIC friend Date operator +( const Date& rDate, long nDays ); TOOLS_DLLPUBLIC friend Date operator -( const Date& rDate, long nDays ); TOOLS_DLLPUBLIC friend long operator -( const Date& rDate1, const Date& rDate2 ); + + static long DateToDays( USHORT nDay, USHORT nMonth, USHORT nYear ); + }; #endif // _DATE_HXX diff --git a/tools/inc/tools/fldunit.hxx b/tools/inc/tools/fldunit.hxx new file mode 100644 index 000000000000..786796030eb3 --- /dev/null +++ b/tools/inc/tools/fldunit.hxx @@ -0,0 +1,44 @@ +/************************************************************************* + * + * 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: fldunit.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 _TOOLS_FLDUNIT_HXX +#define _TOOLS_FLDUNIT_HXX + +// -------------- +// - FieldTypes - +// -------------- + +// By changes you must also change: rsc/vclrsc.hxx +enum FieldUnit { FUNIT_NONE, FUNIT_MM, FUNIT_CM, FUNIT_M, FUNIT_KM, + FUNIT_TWIP, FUNIT_POINT, FUNIT_PICA, + FUNIT_INCH, FUNIT_FOOT, FUNIT_MILE, FUNIT_CUSTOM, + FUNIT_PERCENT, FUNIT_100TH_MM }; + +#endif // _TOOLS_FLDUNIT_HXX diff --git a/tools/inc/tools/fontenum.hxx b/tools/inc/tools/fontenum.hxx new file mode 100644 index 000000000000..6c529cedb30d --- /dev/null +++ b/tools/inc/tools/fontenum.hxx @@ -0,0 +1,175 @@ +/************************************************************************* + * + * 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: vclenum.hxx,v $ + * $Revision: 1.6 $ + * + * 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_FONTENUM_HXX +#define _TOOLS_FONTENUM_HXX + +#include <sal/types.h> +#include <tools/solar.h> + +#ifndef ENUM_FONTFAMILY_DECLARED +#define ENUM_FONTFAMILY_DECLARED + +enum FontFamily { FAMILY_DONTKNOW, FAMILY_DECORATIVE, FAMILY_MODERN, + FAMILY_ROMAN, FAMILY_SCRIPT, FAMILY_SWISS, FAMILY_SYSTEM, FontFamily_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_FONTPITCH_DECLARED +#define ENUM_FONTPITCH_DECLARED + +enum FontPitch { PITCH_DONTKNOW, PITCH_FIXED, PITCH_VARIABLE, FontPitch_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_TEXTALIGN_DECLARED +#define ENUM_TEXTALIGN_DECLARED + +enum TextAlign { ALIGN_TOP, ALIGN_BASELINE, ALIGN_BOTTOM, TextAlign_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_FONTWEIGHT_DECLARED +#define ENUM_FONTWEIGHT_DECLARED + +enum FontWeight { WEIGHT_DONTKNOW, WEIGHT_THIN, WEIGHT_ULTRALIGHT, + WEIGHT_LIGHT, WEIGHT_SEMILIGHT, WEIGHT_NORMAL, + WEIGHT_MEDIUM, WEIGHT_SEMIBOLD, WEIGHT_BOLD, + WEIGHT_ULTRABOLD, WEIGHT_BLACK, FontWeight_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_FONTWIDTH_DECLARED +#define ENUM_FONTWIDTH_DECLARED + +enum FontWidth { WIDTH_DONTKNOW, WIDTH_ULTRA_CONDENSED, WIDTH_EXTRA_CONDENSED, + WIDTH_CONDENSED, WIDTH_SEMI_CONDENSED, WIDTH_NORMAL, + WIDTH_SEMI_EXPANDED, WIDTH_EXPANDED, WIDTH_EXTRA_EXPANDED, + WIDTH_ULTRA_EXPANDED, + FontWidth_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_FONTITALIC_DECLARED +#define ENUM_FONTITALIC_DECLARED + +enum FontItalic { ITALIC_NONE, ITALIC_OBLIQUE, ITALIC_NORMAL, ITALIC_DONTKNOW, FontItalic_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_FONTUNDERLINE_DECLARED +#define ENUM_FONTUNDERLINE_DECLARED + +enum FontUnderline { UNDERLINE_NONE, UNDERLINE_SINGLE, UNDERLINE_DOUBLE, + UNDERLINE_DOTTED, UNDERLINE_DONTKNOW, + UNDERLINE_DASH, UNDERLINE_LONGDASH, + UNDERLINE_DASHDOT, UNDERLINE_DASHDOTDOT, + UNDERLINE_SMALLWAVE, + UNDERLINE_WAVE, UNDERLINE_DOUBLEWAVE, + UNDERLINE_BOLD, UNDERLINE_BOLDDOTTED, + UNDERLINE_BOLDDASH, UNDERLINE_BOLDLONGDASH, + UNDERLINE_BOLDDASHDOT, UNDERLINE_BOLDDASHDOTDOT, + UNDERLINE_BOLDWAVE, + FontUnderline_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_FONTSTRIKEOUT_DECLARED +#define ENUM_FONTSTRIKEOUT_DECLARED + +enum FontStrikeout { STRIKEOUT_NONE, STRIKEOUT_SINGLE, STRIKEOUT_DOUBLE, + STRIKEOUT_DONTKNOW, STRIKEOUT_BOLD, + STRIKEOUT_SLASH, STRIKEOUT_X, + FontStrikeout_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_FONTEMPHASISMARK_DECLARED +#define ENUM_FONTEMPHASISMARK_DECLARED + +typedef USHORT FontEmphasisMark; +#define EMPHASISMARK_NONE ((FontEmphasisMark)0x0000) +#define EMPHASISMARK_DOT ((FontEmphasisMark)0x0001) +#define EMPHASISMARK_CIRCLE ((FontEmphasisMark)0x0002) +#define EMPHASISMARK_DISC ((FontEmphasisMark)0x0003) +#define EMPHASISMARK_ACCENT ((FontEmphasisMark)0x0004) +#define EMPHASISMARK_STYLE ((FontEmphasisMark)0x00FF) +#define EMPHASISMARK_POS_ABOVE ((FontEmphasisMark)0x1000) +#define EMPHASISMARK_POS_BELOW ((FontEmphasisMark)0x2000) + +// Only for kompability +#define EMPHASISMARK_DOTS_ABOVE (EMPHASISMARK_DOT | EMPHASISMARK_POS_ABOVE) +#define EMPHASISMARK_DOTS_BELOW (EMPHASISMARK_DOT | EMPHASISMARK_POS_BELOW) +#define EMPHASISMARK_SIDE_DOTS (EMPHASISMARK_ACCENT | EMPHASISMARK_POS_ABOVE) +#define EMPHASISMARK_CIRCLE_ABOVE (EMPHASISMARK_CIRCLE | EMPHASISMARK_POS_ABOVE) + +#endif + +// ------------------------------------------------------------ + +#ifndef ENUM_FONTTYPE_DECLARED +#define ENUM_FONTTYPE_DECLARED + +enum FontType { TYPE_DONTKNOW, TYPE_RASTER, TYPE_VECTOR, TYPE_SCALABLE, + FontType_FORCE_EQUAL_SIZE=SAL_MAX_ENUM }; + +#endif + +#ifndef ENUM_FONTEMBEDDEDBITMAP_DECLARED +#define ENUM_FONTEMBEDDEDBITMAP_DECLARED + +enum FontEmbeddedBitmap { EMBEDDEDBITMAP_DONTKNOW, EMBEDDEDBITMAP_FALSE, EMBEDDEDBITMAP_TRUE }; + +#endif + +#ifndef ENUM_FONTANTIALIAS_DECLARED +#define ENUM_FONTANTIALIAS_DECLARED + +enum FontAntiAlias { ANTIALIAS_DONTKNOW, ANTIALIAS_FALSE, ANTIALIAS_TRUE }; + +#endif + +#endif // _TOOLS_FONTENUM_HXX diff --git a/tools/inc/tools/fsys.hxx b/tools/inc/tools/fsys.hxx index 8223d77106e3..f1da7579aee6 100644 --- a/tools/inc/tools/fsys.hxx +++ b/tools/inc/tools/fsys.hxx @@ -570,7 +570,7 @@ void FSysEnableSysErrorBox( BOOL bEnable ); //======================================================================== -#if defined(DBG_UTIL) && !defined(PRODUCT) +#if defined(DBG_UTIL) void FSysTest(); #endif diff --git a/tools/inc/tools/gen.hxx b/tools/inc/tools/gen.hxx index e01eb98842c2..0d82f4d73160 100644 --- a/tools/inc/tools/gen.hxx +++ b/tools/inc/tools/gen.hxx @@ -37,6 +37,37 @@ class SvStream; +// -------------------- +// - Helper functions - +// -------------------- + +inline long MinMax( long nVal, long nMin, long nMax ); +inline long AlignedWidth4Bytes( long nWidthBits ); +inline long FRound( double fVal ); + +// --------------- +// - Inlines - +// --------------- + +inline long MinMax( long nVal, long nMin, long nMax ) +{ + return( nVal >= nMin ? ( nVal <= nMax ? nVal : nMax ) : nMin ); +} + +// ------------------------------------------------------------------ + +inline long AlignedWidth4Bytes( long nWidthBits ) +{ + return( ( ( nWidthBits + 31 ) >> 5 ) << 2 ); +} + +// ------------------------------------------------------------------ + +inline long FRound( double fVal ) +{ + return( fVal > 0.0 ? (long) ( fVal + 0.5 ) : -(long) ( -fVal + 0.5 ) ); +} + // -------- // - Pair - // -------- diff --git a/tools/inc/tools/inetdef.hxx b/tools/inc/tools/inetdef.hxx index 38cd8935e06b..d9861f64961d 100644 --- a/tools/inc/tools/inetdef.hxx +++ b/tools/inc/tools/inetdef.hxx @@ -61,8 +61,6 @@ #define TOOLS_INETDEF_OS "FreeBSD/amd64" #elif defined SINIX #define TOOLS_INETDEF_OS "SINIX" -#elif defined IRIX -#define TOOLS_INETDEF_OS "IRIX" #else // AIX, HPUX, SOLARIS, ... #define TOOLS_INETDEF_OS "Unix" #endif // AIX, HPUX, SOLARIS, ... diff --git a/tools/inc/tools/mapunit.hxx b/tools/inc/tools/mapunit.hxx new file mode 100644 index 000000000000..76267192347a --- /dev/null +++ b/tools/inc/tools/mapunit.hxx @@ -0,0 +1,44 @@ +/************************************************************************* + * + * 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: mapunit.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 _TOOLS_MAPUNIT_HXX +#define _TOOLS_MAPUNIT_HXX + +// ----------------- +// - MapMode-Types - +// ----------------- + +// By changes you must also change: rsc/vclrsc.hxx +enum MapUnit { MAP_100TH_MM, MAP_10TH_MM, MAP_MM, MAP_CM, + MAP_1000TH_INCH, MAP_100TH_INCH, MAP_10TH_INCH, MAP_INCH, + MAP_POINT, MAP_TWIP, MAP_PIXEL, MAP_SYSFONT, MAP_APPFONT, + MAP_RELATIVE, MAP_REALAPPFONT, MAP_LASTENUMDUMMY }; + +#endif // _TOOLS_MAPUNIT_HXX diff --git a/tools/inc/tools/multisel.hxx b/tools/inc/tools/multisel.hxx index 46fd8947e21b..9de3cc172e70 100644 --- a/tools/inc/tools/multisel.hxx +++ b/tools/inc/tools/multisel.hxx @@ -35,6 +35,9 @@ #include <tools/list.hxx> #include <tools/string.hxx> +#include <vector> +#include <set> + //------------------------------------------------------------------ #ifdef _SV_MULTISEL_CXX @@ -112,4 +115,105 @@ public: const Range& GetRange( ULONG nRange ) const { return *(const Range*)aSels.GetObject(nRange); } }; +class TOOLS_DLLPUBLIC StringRangeEnumerator +{ + struct Range + { + sal_Int32 nFirst; + sal_Int32 nLast; + + Range() : nFirst( -1 ), nLast( -1 ) {} + Range( sal_Int32 i_nFirst, sal_Int32 i_nLast ) : nFirst( i_nFirst ), nLast( i_nLast ) {} + }; + std::vector< StringRangeEnumerator::Range > maSequence; + sal_Int32 mnCount; + sal_Int32 mnMin; + sal_Int32 mnMax; + sal_Int32 mnOffset; + + bool insertRange( sal_Int32 nFirst, sal_Int32 nLast, bool bSequence, bool bMayAdjust ); + bool checkValue( sal_Int32, const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const; +public: + class TOOLS_DLLPUBLIC Iterator + { + const StringRangeEnumerator* pEnumerator; + const std::set< sal_Int32 >* pPossibleValues; + sal_Int32 nRangeIndex; + sal_Int32 nCurrent; + + friend class StringRangeEnumerator; + Iterator( const StringRangeEnumerator* i_pEnum, + const std::set< sal_Int32 >* i_pPossibleValues, + sal_Int32 i_nRange, + sal_Int32 i_nCurrent ) + : pEnumerator( i_pEnum ), pPossibleValues( i_pPossibleValues ) + , nRangeIndex( i_nRange ), nCurrent( i_nCurrent ) {} + public: + Iterator() : pEnumerator( NULL ), pPossibleValues( NULL ), nRangeIndex( -1 ), nCurrent( -1 ) {} + Iterator& operator++(); + sal_Int32 operator*() const; + bool operator==(const Iterator&) const; + bool operator!=(const Iterator& i_rComp) const + { return ! (*this == i_rComp); } + }; + + friend class StringRangeEnumerator::Iterator; + + StringRangeEnumerator() : mnCount( 0 ), mnMin( -1 ), mnMax( -1 ), mnOffset( -1 ) {} + StringRangeEnumerator( const rtl::OUString& i_rInput, + sal_Int32 i_nMinNumber = -1, + sal_Int32 i_nMaxNumber = -1, + sal_Int32 i_nLogicalOffset = -1 + ); + + size_t size() const { return size_t(mnCount); } + Iterator begin( const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const; + Iterator end( const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const; + + sal_Int32 getMin() const { return mnMin; } + void setMin( sal_Int32 i_nMinValue ) { mnMin = i_nMinValue; } + sal_Int32 getMax() const { return mnMax; } + void setMax( sal_Int32 i_nMaxValue ) { mnMax = i_nMaxValue; } + sal_Int32 getLogicalOffset() const { return mnOffset; } + void setLogicalOffset( sal_Int32 i_nOffset ) { mnOffset = i_nOffset; } + + bool setRange( const rtl::OUString& i_rNewRange, bool i_bStrict = false ); + bool hasValue( sal_Int32 nValue, const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const; + + + /** + i_rPageRange: the string to be changed into a sequence of numbers + valid format example "5-3,9,9,7-8" ; instead of ',' ';' or ' ' are allowed as well + o_rPageVector: the output sequence of numbers + i_nLogicalOffset: an offset to be applied to each number in the string before inserting it in the resulting sequence + example: a user enters page numbers from 1 to n (since that is logical) + of course usable page numbers in code would start from 0 and end at n-1 + so the logical offset would be -1 + i_nMinNumber: the minimum allowed number, a negative number means no minimum check + i_nMaxNumber: the maximum allowed number, a negative number means no maximum check + + @returns: true if the input string was valid, o_rPageVector will contain the resulting sequence + false if the input string was invalid, o_rPageVector will be unchanged + + behavior: + - only non-negative sequence numbers are allowed + - only non-negative values in the input string are allowed + - the string "-3" will be either + * an error if no minimum is given + * or result in the sequence i_nMinNumber to 3 + - the string "3-" will be either + * an error if no maximum is given + * or result in the seqeuence 3 to i_nMaxNumber + - an empty string as input is valid and will result in the range [min,max] if given + or an empty vector, if not + */ + static bool getRangesFromString( const rtl::OUString& i_rPageRange, + std::vector< sal_Int32 >& o_rPageVector, + sal_Int32 i_nMinNumber = -1, + sal_Int32 i_nMaxNumber = -1, + sal_Int32 i_nLogicalOffset = -1, + std::set< sal_Int32 >* i_pPossibleValues = NULL + ); +}; + #endif // _SV_MULTISEL_HXX diff --git a/tools/inc/tools/poly.hxx b/tools/inc/tools/poly.hxx index a77782bc963c..05092957c48e 100644 --- a/tools/inc/tools/poly.hxx +++ b/tools/inc/tools/poly.hxx @@ -182,7 +182,6 @@ public: void Clip( const Rectangle& rRect, BOOL bPolygon = TRUE ); void Optimize( ULONG nOptimizeFlags, const PolyOptimizeData* pData = NULL ); - void GetSimple( Polygon& rResult ) const; /** Adaptive subdivision of polygons with curves This method adaptively subdivides bezier arcs within the @@ -288,7 +287,6 @@ public: void Clip( const Rectangle& rRect ); void Optimize( ULONG nOptimizeFlags, const PolyOptimizeData* pData = NULL ); - void GetSimple( PolyPolygon& rResult ) const; /** Adaptive subdivision of polygons with curves This method adaptively subdivides bezier arcs within the diff --git a/tools/inc/tools/solar.h b/tools/inc/tools/solar.h index 46fe42b9c36f..195a6fd3ce87 100644 --- a/tools/inc/tools/solar.h +++ b/tools/inc/tools/solar.h @@ -385,14 +385,14 @@ template<typename T> inline T Abs(T a) { return (a>=0?a:-a); } #define __DLLEXTENSION "la.so" #elif defined LINUX && defined M68K #define __DLLEXTENSION "lm.so" +#elif defined LINUX && defined HPPA + #define __DLLEXTENSION "lh.so" #elif defined LINUX #error unknown plattform #elif defined FREEBSD && defined X86 #define __DLLEXTENSION "fi.so" #elif defined FREEBSD && defined X86_64 #define __DLLEXTENSION "fx.so" -#elif defined IRIX - #define __DLLEXTENSION "im.so" #elif defined MACOSX && defined POWERPC #define __DLLEXTENSION "mxp.dylib" #elif defined MACOSX && defined X86 diff --git a/svtools/source/misc/iniman.src b/tools/inc/tools/solarmutex.hxx index afc129318653..42aff1f23f43 100644 --- a/svtools/source/misc/iniman.src +++ b/tools/inc/tools/solarmutex.hxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: iniman.src,v $ - * $Revision: 1.27 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -27,42 +24,22 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ +#ifndef _TOOLS_SOLARMUTEX_HXX +#define _TOOLS_SOLARMUTEX_HXX -#include <svtools/svtools.hrc> +#include "tools/toolsdllapi.h" +#include <vos/mutex.hxx> -ErrorBox ERRBOX_CHECK_PLZ +namespace tools { - BUTTONS = WB_OK ; - Message [ en-US ] = "The ZIP code specified is invalid.\nA ZIP code should begin with a number (or in some cases a letter) and\ncan only contain numbers, letters, spaces and dashes."; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + class TOOLS_DLLPUBLIC SolarMutex + { + public: + static ::vos::IMutex* GetSolarMutex(); + static void SetSolarMutex( ::vos::IMutex* pMutex ); + static bool Acquire(); + static void Release(); + }; +} + +#endif diff --git a/tools/inc/tools/stream.hxx b/tools/inc/tools/stream.hxx index bacaac89fe44..23496322fa4c 100644 --- a/tools/inc/tools/stream.hxx +++ b/tools/inc/tools/stream.hxx @@ -776,6 +776,9 @@ class TOOLS_DLLPUBLIC SvMemoryStream : public SvStream SvMemoryStream (const SvMemoryStream&); SvMemoryStream & operator= (const SvMemoryStream&); + friend class SvCacheStream; + sal_Size GetSize() const { return nSize; } + protected: sal_Size nSize; sal_Size nResize; @@ -817,7 +820,7 @@ public: virtual void ResetError(); - sal_Size GetSize() const { return nSize; } + sal_Size GetEndOfData() const { return nEndOfData; } const void* GetData() { Flush(); return pBuf; } operator const void*() { Flush(); return pBuf; } virtual sal_uInt16 IsA() const; diff --git a/tools/inc/tools/wintypes.hxx b/tools/inc/tools/wintypes.hxx new file mode 100644 index 000000000000..a9c23de87ddd --- /dev/null +++ b/tools/inc/tools/wintypes.hxx @@ -0,0 +1,337 @@ +/************************************************************************* + * + * 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: wintypes.hxx,v $ + * $Revision: 1.9 $ + * + * 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_WINTYPES_HXX +#define _TOOLS_WINTYPES_HXX + +#include <tools/solar.h> +#include <sal/types.h> + +// ---------------- +// - Window-Types - +// ---------------- + +typedef USHORT WindowType; +#define WINDOW_BASE 0x0100 +#define WINDOW_FIRST (WINDOW_BASE + 0x30) +#define WINDOW_MESSBOX (WINDOW_FIRST) +#define WINDOW_INFOBOX (WINDOW_FIRST + 0x01) +#define WINDOW_WARNINGBOX (WINDOW_FIRST + 0x02) +#define WINDOW_ERRORBOX (WINDOW_FIRST + 0x03) +#define WINDOW_QUERYBOX (WINDOW_FIRST + 0x04) +#define WINDOW_WINDOW (WINDOW_FIRST + 0x05) +#define WINDOW_SYSWINDOW (WINDOW_FIRST + 0x06) +#define WINDOW_WORKWINDOW (WINDOW_FIRST + 0x07) +// #define WINDOW_MDIWINDOW (WINDOW_FIRST + 0x08) +#define WINDOW_FLOATINGWINDOW (WINDOW_FIRST + 0x09) +#define WINDOW_DIALOG (WINDOW_FIRST + 0x0a) +#define WINDOW_MODELESSDIALOG (WINDOW_FIRST + 0x0b) +#define WINDOW_MODALDIALOG (WINDOW_FIRST + 0x0c) +#define WINDOW_SYSTEMDIALOG (WINDOW_FIRST + 0x0d) +#define WINDOW_PATHDIALOG (WINDOW_FIRST + 0x0e) +#define WINDOW_FILEDIALOG (WINDOW_FIRST + 0x0f) +#define WINDOW_PRINTERSETUPDIALOG (WINDOW_FIRST + 0x10) +#define WINDOW_PRINTDIALOG (WINDOW_FIRST + 0x11) +#define WINDOW_COLORDIALOG (WINDOW_FIRST + 0x12) +#define WINDOW_FONTDIALOG (WINDOW_FIRST + 0x13) +#define WINDOW_CONTROL (WINDOW_FIRST + 0x14) +#define WINDOW_BUTTON (WINDOW_FIRST + 0x15) +#define WINDOW_PUSHBUTTON (WINDOW_FIRST + 0x16) +#define WINDOW_OKBUTTON (WINDOW_FIRST + 0x17) +#define WINDOW_CANCELBUTTON (WINDOW_FIRST + 0x18) +#define WINDOW_HELPBUTTON (WINDOW_FIRST + 0x19) +#define WINDOW_IMAGEBUTTON (WINDOW_FIRST + 0x1a) +#define WINDOW_MENUBUTTON (WINDOW_FIRST + 0x1b) +#define WINDOW_MOREBUTTON (WINDOW_FIRST + 0x1c) +#define WINDOW_SPINBUTTON (WINDOW_FIRST + 0x1d) +#define WINDOW_RADIOBUTTON (WINDOW_FIRST + 0x1e) +#define WINDOW_IMAGERADIOBUTTON (WINDOW_FIRST + 0x1f) +#define WINDOW_CHECKBOX (WINDOW_FIRST + 0x20) +#define WINDOW_TRISTATEBOX (WINDOW_FIRST + 0x21) +#define WINDOW_EDIT (WINDOW_FIRST + 0x22) +#define WINDOW_MULTILINEEDIT (WINDOW_FIRST + 0x23) +#define WINDOW_COMBOBOX (WINDOW_FIRST + 0x24) +#define WINDOW_LISTBOX (WINDOW_FIRST + 0x25) +#define WINDOW_MULTILISTBOX (WINDOW_FIRST + 0x26) +#define WINDOW_FIXEDTEXT (WINDOW_FIRST + 0x27) +#define WINDOW_FIXEDLINE (WINDOW_FIRST + 0x28) +#define WINDOW_FIXEDBITMAP (WINDOW_FIRST + 0x29) +#define WINDOW_FIXEDIMAGE (WINDOW_FIRST + 0x2a) +#define WINDOW_GROUPBOX (WINDOW_FIRST + 0x2c) +#define WINDOW_SCROLLBAR (WINDOW_FIRST + 0x2d) +#define WINDOW_SCROLLBARBOX (WINDOW_FIRST + 0x2e) +#define WINDOW_SPLITTER (WINDOW_FIRST + 0x2f) +#define WINDOW_SPLITWINDOW (WINDOW_FIRST + 0x30) +#define WINDOW_SPINFIELD (WINDOW_FIRST + 0x31) +#define WINDOW_PATTERNFIELD (WINDOW_FIRST + 0x32) +#define WINDOW_NUMERICFIELD (WINDOW_FIRST + 0x33) +#define WINDOW_METRICFIELD (WINDOW_FIRST + 0x34) +#define WINDOW_CURRENCYFIELD (WINDOW_FIRST + 0x35) +#define WINDOW_DATEFIELD (WINDOW_FIRST + 0x36) +#define WINDOW_TIMEFIELD (WINDOW_FIRST + 0x37) +#define WINDOW_PATTERNBOX (WINDOW_FIRST + 0x38) +#define WINDOW_NUMERICBOX (WINDOW_FIRST + 0x39) +#define WINDOW_METRICBOX (WINDOW_FIRST + 0x3a) +#define WINDOW_CURRENCYBOX (WINDOW_FIRST + 0x3b) +#define WINDOW_DATEBOX (WINDOW_FIRST + 0x3c) +#define WINDOW_TIMEBOX (WINDOW_FIRST + 0x3d) +#define WINDOW_LONGCURRENCYFIELD (WINDOW_FIRST + 0x3e) +#define WINDOW_LONGCURRENCYBOX (WINDOW_FIRST + 0x3f) +#define WINDOW_TOOLBOX (WINDOW_FIRST + 0x41) +#define WINDOW_DOCKINGWINDOW (WINDOW_FIRST + 0x42) +#define WINDOW_STATUSBAR (WINDOW_FIRST + 0x43) +#define WINDOW_TABPAGE (WINDOW_FIRST + 0x44) +#define WINDOW_TABCONTROL (WINDOW_FIRST + 0x45) +#define WINDOW_TABDIALOG (WINDOW_FIRST + 0x46) +#define WINDOW_BORDERWINDOW (WINDOW_FIRST + 0x47) +#define WINDOW_BUTTONDIALOG (WINDOW_FIRST + 0x48) +#define WINDOW_SYSTEMCHILDWINDOW (WINDOW_FIRST + 0x49) +#define WINDOW_FIXEDBORDER (WINDOW_FIRST + 0x4a) +#define WINDOW_SLIDER (WINDOW_FIRST + 0x4b) +#define WINDOW_MENUBARWINDOW (WINDOW_FIRST + 0x4c) +#define WINDOW_TREELISTBOX (WINDOW_FIRST + 0x4d) +#define WINDOW_HELPTEXTWINDOW (WINDOW_FIRST + 0x4e) +#define WINDOW_INTROWINDOW (WINDOW_FIRST + 0x4f) +#define WINDOW_LISTBOXWINDOW (WINDOW_FIRST + 0x50) +#define WINDOW_DOCKINGAREA (WINDOW_FIRST + 0x51) +#define WINDOW_LAST (WINDOW_DOCKINGAREA) + + +// --------------- +// - Window-Bits - +// --------------- + +// By changes you must also change: rsc/vclrsc.hxx +typedef sal_Int64 WinBits; + +// Window-Bits fuer Window +#define WB_CLIPCHILDREN ((WinBits)0x00000001) +#define WB_DIALOGCONTROL ((WinBits)0x00000002) +#define WB_NODIALOGCONTROL ((WinBits)0x00000004) +#define WB_BORDER ((WinBits)0x00000008) +#define WB_NOBORDER ((WinBits)0x00000010) +#define WB_SIZEABLE ((WinBits)0x00000020) +#define WB_3DLOOK ((WinBits)0x00000040) +#define WB_AUTOSIZE ((WinBits)0x00000080) + +// Window-Bits fuer SystemWindows +#define WB_MOVEABLE ((WinBits)0x00000100) +#define WB_ROLLABLE ((WinBits)0x00000200) +#define WB_CLOSEABLE ((WinBits)0x00000400) +#define WB_STANDALONE ((WinBits)0x00000800) +#define WB_APP ((WinBits)0x00001000) +#define WB_PINABLE ((WinBits)0x00002000) +#define WB_SYSTEMWINDOW ((WinBits)SAL_CONST_INT64(0x40000000)) +// warning: do not confuse WB_SYSTEMCHILDWINDOW with the SystemChildWindow class + +// the SystemChildWindow class was there first and is a very specialized +// sytem child window type for plugged applications. The SystemChildWindow class +// explicitly should never use the WB_SYSTEMCHILDWINDOW WinBit + +// WB_SYSTEMCHILDWINDOW on the other hand is to be used on system windows +// which should be created as system child windows with (more or less) +// normal event handling +#define WB_SYSTEMCHILDWINDOW ((WinBits)SAL_CONST_INT64(0x8000000000)) +#define WB_SIZEMOVE (WB_SIZEABLE | WB_MOVEABLE) + +// Standard-Window-Bits fuer ChildWindows +#define WB_TABSTOP ((WinBits)0x00000100) +#define WB_NOTABSTOP ((WinBits)0x00000200) +#define WB_GROUP ((WinBits)0x00000400) +#define WB_NOGROUP ((WinBits)0x00000800) +#define WB_HORZ ((WinBits)0x00001000) +#define WB_VERT ((WinBits)0x00002000) +#define WB_LEFT ((WinBits)0x00004000) +#define WB_CENTER ((WinBits)0x00008000) +#define WB_RIGHT ((WinBits)0x00010000) +#define WB_TOP ((WinBits)0x00020000) +#define WB_VCENTER ((WinBits)0x00040000) +#define WB_BOTTOM ((WinBits)0x00080000) +#define WB_DRAG ((WinBits)0x00100000) +#define WB_SPIN ((WinBits)0x00200000) +#define WB_REPEAT ((WinBits)0x00400000) +#define WB_NOPOINTERFOCUS ((WinBits)0x00800000) +#define WB_WORDBREAK ((WinBits)0x01000000) +#define WB_NOLABEL ((WinBits)0x02000000) +#define WB_SORT ((WinBits)0x04000000) +#define WB_DROPDOWN ((WinBits)0x08000000) +#define WB_AUTOHSCROLL ((WinBits)SAL_CONST_INT64(0x10000000)) +#define WB_DOCKABLE ((WinBits)SAL_CONST_INT64(0x20000000)) +#define WB_AUTOVSCROLL ((WinBits)SAL_CONST_INT64(0x40000000)) +#define WB_HYPHENATION (((WinBits)SAL_CONST_INT64(0x80000000)) | WB_WORDBREAK) +#define WB_CHILDDLGCTRL ((WinBits)SAL_CONST_INT64(0x100000000000)) + +// system floating window +#define WB_SYSTEMFLOATWIN ((WinBits)SAL_CONST_INT64(0x100000000)) +#define WB_INTROWIN ((WinBits)SAL_CONST_INT64(0x200000000)) +#define WB_NOSHADOW ((WinBits)SAL_CONST_INT64(0x400000000)) +#define WB_TOOLTIPWIN ((WinBits)SAL_CONST_INT64(0x800000000)) +#define WB_OWNERDRAWDECORATION ((WinBits)SAL_CONST_INT64(0x2000000000)) +#define WB_DEFAULTWIN ((WinBits)SAL_CONST_INT64(0x4000000000)) +#define WB_NEEDSFOCUS ((WinBits)SAL_CONST_INT64(0x1000000000)) + +#define WB_HIDE ((WinBits)SAL_CONST_INT64(0x80000000)) +#define WB_HSCROLL WB_HORZ +#define WB_VSCROLL WB_VERT +#define WB_TOPIMAGE WB_TOP + +// Window-Bits for PushButtons +#define WB_DEFBUTTON ((WinBits)0x10000000) +#define WB_NOLIGHTBORDER ((WinBits)0x20000000) +#define WB_RECTSTYLE ((WinBits)0x08000000) +#define WB_SMALLSTYLE ((WinBits)0x04000000) +#define WB_TOGGLE ((WinBits)SAL_CONST_INT64(0x1000000000)) +#define WB_BEVELBUTTON ((WinBits)SAL_CONST_INT64(0x2000000000)) + +// Window-Bits for FixedText +#define WB_PATHELLIPSIS ((WinBits)0x00100000) +#define WB_EXTRAOFFSET ((WinBits)0x02000000) +#define WB_NOMULTILINE ((WinBits)0x10000000) +#define WB_INFO ((WinBits)0x20000000) + +// Window-Bits for CheckBox +#define WB_CBLINESTYLE ((WinBits)SAL_CONST_INT64(0x2000000000)) + +// Window-Bits for Edit +#define WB_PASSWORD ((WinBits)0x01000000) +#define WB_READONLY ((WinBits)0x02000000) +#define WB_NOHIDESELECTION ((WinBits)SAL_CONST_INT64(0x1000000000)) +#define WB_FORCECTRLBACKGROUND ((WinBits)0x80000000) + +// Window-Bits for MultiLineEdit +#define WB_IGNORETAB ((WinBits)0x20000000) + +// Window-Bits for ListBox and MultiListBox +#define WB_SIMPLEMODE ((WinBits)0x20000000) + +// Window-Bits for FixedBitmap +#define WB_FAST ((WinBits)0x04000000) +#define WB_SCALE ((WinBits)0x08000000) +#define WB_TOPLEFTVISIBLE ((WinBits)0x10000000) + +// Window-Bits for ToolBox +#define WB_LINESPACING ((WinBits)0x01000000) +#define WB_SCROLL ((WinBits)0x02000000) +#define WB_FORCETABCYCLE ((WinBits)0x04000000) + +// Window-Bits for TabControl +#define WB_SINGLELINE ((WinBits)0x02000000) + +// Window-Bits for DockingWindows +#define WB_DOCKBORDER ((WinBits)0x00001000) + +// Window-Bits for SplitWindow +#define WB_NOSPLITDRAW ((WinBits)0x01000000) +#define WB_FLATSPLITDRAW ((WinBits)0x02000000) + +// Window-Bits for MessageBoxen +#define WB_OK ((WinBits)0x00100000) +#define WB_OK_CANCEL ((WinBits)0x00200000) +#define WB_YES_NO ((WinBits)0x00400000) +#define WB_YES_NO_CANCEL ((WinBits)0x00800000) +#define WB_RETRY_CANCEL ((WinBits)0x01000000) +#define WB_DEF_OK ((WinBits)0x02000000) +#define WB_DEF_CANCEL ((WinBits)0x04000000) +#define WB_DEF_RETRY ((WinBits)0x08000000) +#define WB_DEF_YES ((WinBits)SAL_CONST_INT64(0x10000000)) +#define WB_DEF_NO ((WinBits)SAL_CONST_INT64(0x20000000)) +#define WB_ABORT_RETRY_IGNORE ((WinBits)SAL_CONST_INT64(0x1000000000)) +#define WB_DEF_IGNORE ((WinBits)SAL_CONST_INT64(0x2000000000)) + +// Standard-WinBits +#define WB_STDWORK (WB_SIZEMOVE | WB_CLOSEABLE) +#define WB_STDDOCKWIN (WB_DOCKABLE | WB_MOVEABLE | WB_CLOSEABLE) +#define WB_STDFLOATWIN (WB_SIZEMOVE | WB_CLOSEABLE | WB_ROLLABLE) +#define WB_STDDIALOG (WB_MOVEABLE | WB_CLOSEABLE) +#define WB_STDMODELESS (WB_STDDIALOG) +#define WB_STDMODAL (WB_STDDIALOG) +#define WB_STDTABDIALOG (WB_STDDIALOG) +#define WB_STDTABCONTROL 0 + +// For TreeListBox +#define WB_HASBUTTONS ((WinBits)0x00800000) +#define WB_HASLINES ((WinBits)0x01000000) +#define WB_HASLINESATROOT ((WinBits)0x02000000) + +// For FileOpen Dialog +#define WB_PATH ((WinBits)0x00100000) +#define WB_OPEN ((WinBits)0x00200000) +#define WB_SAVEAS ((WinBits)0x00400000) + +// For Slider +// Window-Bits for TabControl +#define WB_SLIDERSET ((WinBits)0x02000000) + + +// -------------------- +// - extended WinBits - +// -------------------- +#define WB_EXT_DOCUMENT ((WinBits)0x00000001) +#define WB_EXT_DOCMODIFIED ((WinBits)0x00000002) + +// --------------- +// - WindowAlign - +// --------------- + +// By changes you must also change: rsc/vclrsc.hxx +enum WindowAlign { WINDOWALIGN_LEFT, WINDOWALIGN_TOP, WINDOWALIGN_RIGHT, WINDOWALIGN_BOTTOM }; +enum ImageAlign { IMAGEALIGN_LEFT, IMAGEALIGN_TOP, IMAGEALIGN_RIGHT, IMAGEALIGN_BOTTOM, + IMAGEALIGN_LEFT_TOP, IMAGEALIGN_LEFT_BOTTOM, IMAGEALIGN_TOP_LEFT, + IMAGEALIGN_TOP_RIGHT, IMAGEALIGN_RIGHT_TOP, IMAGEALIGN_RIGHT_BOTTOM, + IMAGEALIGN_BOTTOM_LEFT, IMAGEALIGN_BOTTOM_RIGHT, IMAGEALIGN_CENTER }; +enum SymbolAlign { SYMBOLALIGN_LEFT, SYMBOLALIGN_RIGHT }; + +// ------------ +// - TriState - +// ------------ + +// By changes you must also change: rsc/vclrsc.hxx +enum TriState { STATE_NOCHECK, STATE_CHECK, STATE_DONTKNOW }; + + +// ---------------------- +// - ButtonDialog-Types - +// ---------------------- + +typedef USHORT StandardButtonType; +#define BUTTON_OK ((StandardButtonType)0) +#define BUTTON_CANCEL ((StandardButtonType)1) +#define BUTTON_YES ((StandardButtonType)2) +#define BUTTON_NO ((StandardButtonType)3) +#define BUTTON_RETRY ((StandardButtonType)4) +#define BUTTON_HELP ((StandardButtonType)5) +#define BUTTON_CLOSE ((StandardButtonType)6) +#define BUTTON_MORE ((StandardButtonType)7) +#define BUTTON_IGNORE ((StandardButtonType)8) +#define BUTTON_ABORT ((StandardButtonType)9) +#define BUTTON_LESS ((StandardButtonType)10) +#define BUTTON_COUNT 11 + +#endif // _TOOLS_WINTYPES_HXX + diff --git a/tools/prj/d.lst b/tools/prj/d.lst index e8fde61686a4..3208ecbb3168 100644 --- a/tools/prj/d.lst +++ b/tools/prj/d.lst @@ -34,7 +34,11 @@ mkdir: %_DEST%\inc%_EXT%\bootstrp ..\inc\tools\postx.h %_DEST%\inc%_EXT%\tools\postx.h ..\inc\tools\prex.h %_DEST%\inc%_EXT%\tools\prex.h -..\inc\tools\agapi.hxx %_DEST%\inc%_EXT%\tools\agapi.hxx +..\inc\tools\solarmutex.hxx %_DEST%\inc%_EXT%\tools\solarmutex.hxx +..\inc\tools\wintypes.hxx %_DEST%\inc%_EXT%\tools\wintypes.hxx +..\inc\tools\mapunit.hxx %_DEST%\inc%_EXT%\tools\mapunit.hxx +..\inc\tools\fldunit.hxx %_DEST%\inc%_EXT%\tools\fldunit.hxx +..\inc\tools\fontenum.hxx %_DEST%\inc%_EXT%\tools\fontenum.hxx ..\inc\tools\agapi.hxx %_DEST%\inc%_EXT%\tools\agapi.hxx ..\inc\tools\agitem.hxx %_DEST%\inc%_EXT%\tools\agitem.hxx ..\inc\tools\appendunixshellword.hxx %_DEST%\inc%_EXT%\tools\appendunixshellword.hxx diff --git a/tools/qa/makefile.mk b/tools/qa/makefile.mk index 15f9c6a9fdaf..c63aa966b7fc 100644 --- a/tools/qa/makefile.mk +++ b/tools/qa/makefile.mk @@ -40,7 +40,7 @@ DLLPRE = # no leading "lib" on .so files SHL1TARGET = test_pathutils SHL1OBJS = $(SLO)$/test_pathutils.obj $(SLO)$/pathutils.obj -SHL1STDLIBS = $(CPPUNITLIB) $(SALLIB) +SHL1STDLIBS = $(CPPUNITLIB) $(SALLIB) $(TESTSHL2LIB) SHL1VERSIONMAP = version.map SHL1IMPLIB = i$(SHL1TARGET) DEF1NAME = $(SHL1TARGET) @@ -52,4 +52,4 @@ SLOFILES = $(SHL1OBJS) ALLTAR: test test .PHONY: $(SHL1TARGETN) - testshl2 $(SHL1TARGETN) -forward $(BIN)$/$(TARGET).rdb + $(TESTSHL2) $(SHL1TARGETN) -forward $(BIN)$/$(TARGET).rdb diff --git a/tools/qa/test_pathutils.cxx b/tools/qa/test_pathutils.cxx index 9cd4e2110937..c028a2f654c4 100644 --- a/tools/qa/test_pathutils.cxx +++ b/tools/qa/test_pathutils.cxx @@ -33,7 +33,7 @@ #include <cwchar> -#include "cppunit/simpleheader.hxx" +#include "testshl/simpleheader.hxx" #include "tools/pathutils.hxx" namespace { diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx index 7f204d5e46da..5f0d7f3ebe1d 100644 --- a/tools/source/datetime/tdate.cxx +++ b/tools/source/datetime/tdate.cxx @@ -88,7 +88,7 @@ inline USHORT DaysInMonth( USHORT nMonth, USHORT nYear ) // ----------------------------------------------------------------------- -static long DateToDays( USHORT nDay, USHORT nMonth, USHORT nYear ) +long Date::DateToDays( USHORT nDay, USHORT nMonth, USHORT nYear ) { long nDays; @@ -489,9 +489,9 @@ Date operator -( const Date& rDate, long nDays ) long operator -( const Date& rDate1, const Date& rDate2 ) { - ULONG nTempDays1 = DateToDays( rDate1.GetDay(), rDate1.GetMonth(), + ULONG nTempDays1 = Date::DateToDays( rDate1.GetDay(), rDate1.GetMonth(), rDate1.GetYear() ); - ULONG nTempDays2 = DateToDays( rDate2.GetDay(), rDate2.GetMonth(), + ULONG nTempDays2 = Date::DateToDays( rDate2.GetDay(), rDate2.GetMonth(), rDate2.GetYear() ); return nTempDays1 - nTempDays2; } diff --git a/tools/source/fsys/unx.cxx b/tools/source/fsys/unx.cxx index 76910683df13..4a2e3c6ad76a 100644 --- a/tools/source/fsys/unx.cxx +++ b/tools/source/fsys/unx.cxx @@ -36,7 +36,7 @@ #include <stdlib.h> #include <unistd.h> #include <utime.h> -#if defined HPUX || defined LINUX || defined IRIX +#if defined HPUX || defined LINUX #include <mntent.h> #define mnttab mntent #elif defined SCO diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index f7ffed5e4dd1..e0f711bd2883 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -1022,16 +1022,14 @@ 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 == '/') - ) - ) + while (p1 != pEnd && *p1 != '/' && + *p1 != nFragmentDelimiter) + { + ++p1; + } + if (parseHostOrNetBiosName( + pPos + 2, p1, bOctets, ENCODE_ALL, + RTL_TEXTENCODING_DONTKNOW, true, NULL)) { aSynAbsURIRef. appendAscii(RTL_CONSTASCII_STRINGPARAM("//")); diff --git a/tools/source/fsys/wntmsc.cxx b/tools/source/fsys/wntmsc.cxx index 0e8e5ebc7918..153fbf37de2e 100644 --- a/tools/source/fsys/wntmsc.cxx +++ b/tools/source/fsys/wntmsc.cxx @@ -91,7 +91,7 @@ struct dirent *readdir( DIR *pDir ) pDir->h = FindFirstFile( pBuf, &pDir->aDirEnt ); bOk = pDir->h != INVALID_HANDLE_VALUE; pDir->p = NULL; - delete pBuf; + delete [] pBuf; } else pDir->h = INVALID_HANDLE_VALUE; diff --git a/tools/source/generic/line.cxx b/tools/source/generic/line.cxx index 5e698d50c006..d86ff82cb739 100644 --- a/tools/source/generic/line.cxx +++ b/tools/source/generic/line.cxx @@ -39,11 +39,6 @@ #include <cstdlib> #include <math.h> -inline long FRound( double fVal ) -{ - return( fVal > 0.0 ? (long) ( fVal + 0.5 ) : -(long) ( -fVal + 0.5 ) ); -} - // -------- // - Line - // -------- diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 5cca29b3066e..509d2ab4969d 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -957,59 +957,6 @@ void Polygon::Optimize( ULONG nOptimizeFlags, const PolyOptimizeData* pData ) } } -// ----------------------------------------------------------------------- - -void Polygon::GetSimple( Polygon& rResult ) const -{ - if( !mpImplPolygon->mpFlagAry ) - rResult = *this; - else - { - ::std::vector< Point > aPointVector; - - for( USHORT i = 0, nCount = GetSize(); i < nCount; ) - { - if( ( ( i + 3 ) < nCount ) && - ( POLY_NORMAL == mpImplPolygon->mpFlagAry[ i ] ) && - ( POLY_CONTROL == mpImplPolygon->mpFlagAry[ i + 1 ] ) && - ( POLY_CONTROL == mpImplPolygon->mpFlagAry[ i + 2 ] ) && - ( POLY_NORMAL == mpImplPolygon->mpFlagAry[ i + 3 ] ) ) - { - const USHORT nSegmentPoints = 25; - const Polygon aSegmentPoly( mpImplPolygon->mpPointAry[ i ], mpImplPolygon->mpPointAry[ i + 1 ], - mpImplPolygon->mpPointAry[ i + 3 ], mpImplPolygon->mpPointAry[ i + 2 ], - nSegmentPoints ); - const USHORT nSegmentSize = aSegmentPoly.GetSize(); - - if( nSegmentSize ) - { - const Point* pPointArray = aSegmentPoly.mpImplPolygon->mpPointAry; - const Point* pCur = pPointArray; - const Point* pLast; - - aPointVector.push_back( *( pLast = pCur ) ); - - for( USHORT j = 1; j < nSegmentSize; j++ ) - if( *( pCur = pPointArray + j ) != *pLast ) - aPointVector.push_back( *( pLast = pCur ) ); - } - - i += 3; - } - else - aPointVector.push_back( mpImplPolygon->mpPointAry[ i++ ] ); - } - - // fill result polygon - rResult = Polygon( (USHORT)aPointVector.size() ); - ::std::vector< Point >::iterator aIter( aPointVector.begin() ), aEnd( aPointVector.end() ); - Point* pPointArray = rResult.mpImplPolygon->mpPointAry; - USHORT nPoints = rResult.mpImplPolygon->mnPoints; - while( nPoints-- && aIter != aEnd ) - *pPointArray++ = *aIter++; - } -} - // ======================================================================= /* Recursively subdivide cubic bezier curve via deCasteljau. @@ -1668,7 +1615,16 @@ void Polygon::Clip( const Rectangle& rRect, BOOL bPolygon ) Rectangle Polygon::GetBoundRect() const { DBG_CHKTHIS( Polygon, NULL ); - DBG_ASSERT( !mpImplPolygon->mpFlagAry, "GetBoundRect could fail with beziers!" ); + // Removing the assert. Bezier curves have the attribute that each single + // curve segment defined by four points can not exit the four-point polygon + // defined by that points. This allows to say that the curve segment can also + // never leave the Range of it's defining points. + // The result is that Polygon::GetBoundRect() may not create the minimal + // BoundRect of the Polygon (to get that, use basegfx::B2DPolygon classes), + // but will always create a valid BoundRect, at least as long as this method + // 'blindly' travels over all points, including control points. + // + // DBG_ASSERT( !mpImplPolygon->mpFlagAry, "GetBoundRect could fail with beziers!" ); USHORT nCount = mpImplPolygon->mnPoints; if( ! nCount ) diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx index ff97e6006a41..692e47a9d1d2 100644 --- a/tools/source/generic/poly2.cxx +++ b/tools/source/generic/poly2.cxx @@ -346,23 +346,6 @@ void PolyPolygon::Optimize( ULONG nOptimizeFlags, const PolyOptimizeData* pData // ----------------------------------------------------------------------- -void PolyPolygon::GetSimple( PolyPolygon& rResult ) const -{ - DBG_CHKTHIS( PolyPolygon, NULL ); - - rResult.Clear(); - - Polygon aPolygon; - - for( USHORT i = 0; i < mpImplPolyPolygon->mnCount; i++ ) - { - mpImplPolyPolygon->mpPolyAry[ i ]->GetSimple( aPolygon ); - rResult.Insert( aPolygon ); - } -} - -// ----------------------------------------------------------------------- - void PolyPolygon::AdaptiveSubdivide( PolyPolygon& rResult, const double d ) const { DBG_CHKTHIS( PolyPolygon, NULL ); diff --git a/tools/source/memtools/makefile.mk b/tools/source/memtools/makefile.mk index 037dadbf4a46..51d831ec0fed 100644 --- a/tools/source/memtools/makefile.mk +++ b/tools/source/memtools/makefile.mk @@ -47,6 +47,8 @@ SLOFILES= $(SLO)$/contnr.obj \ $(SLO)$/mempool.obj \ $(SLO)$/multisel.obj +EXCEPTIONSFILES= $(SLO)$/multisel.obj $(OBJ)$/multisel.obj + OBJFILES= $(OBJ)$/contnr.obj \ $(OBJ)$/table.obj \ $(OBJ)$/unqidx.obj \ diff --git a/tools/source/memtools/multisel.cxx b/tools/source/memtools/multisel.cxx index 6b32badc283e..5fe920b6998a 100644 --- a/tools/source/memtools/multisel.cxx +++ b/tools/source/memtools/multisel.cxx @@ -41,12 +41,16 @@ #include <tools/debug.hxx> #include <tools/multisel.hxx> +#include "rtl/ustrbuf.hxx" + #ifdef MI_DEBUG #define DBG(x) x #else #define DBG(x) #endif +using namespace rtl; + //================================================================== #ifdef MI_DEBUG @@ -865,3 +869,297 @@ void MultiSelection::SetTotalRange( const Range& rTotRange ) bCurValid = FALSE; nCurIndex = 0; } + +// ----------------------------------------------------------------------- +// +// StringRangeEnumerator +// +// ----------------------------------------------------------------------- +StringRangeEnumerator::StringRangeEnumerator( const rtl::OUString& i_rInput, + sal_Int32 i_nMinNumber, + sal_Int32 i_nMaxNumber, + sal_Int32 i_nLogicalOffset + ) + : mnCount( 0 ) + , mnMin( i_nMinNumber ) + , mnMax( i_nMaxNumber ) + , mnOffset( i_nLogicalOffset ) +{ + setRange( i_rInput ); +} + +bool StringRangeEnumerator::checkValue( sal_Int32 i_nValue, const std::set< sal_Int32 >* i_pPossibleValues ) const +{ + if( mnMin >= 0 && i_nValue < mnMin ) + return false; + if( mnMax >= 0 && i_nValue > mnMax ) + return false; + if( i_nValue < 0 ) + return false; + if( i_pPossibleValues && i_pPossibleValues->find( i_nValue ) == i_pPossibleValues->end() ) + return false; + return true; +} + +bool StringRangeEnumerator::insertRange( sal_Int32 i_nFirst, sal_Int32 i_nLast, bool bSequence, bool bMayAdjust ) +{ + bool bSuccess = true; + if( bSequence ) + { + if( i_nFirst == -1 ) + i_nFirst = mnMin; + if( i_nLast == -1 ) + i_nLast = mnMax; + if( bMayAdjust ) + { + if( i_nFirst < mnMin ) + i_nFirst = mnMin; + if( i_nFirst > mnMax ) + i_nFirst = mnMax; + if( i_nLast < mnMin ) + i_nLast = mnMin; + if( i_nLast > mnMax ) + i_nLast = mnMax; + } + if( checkValue( i_nFirst ) && checkValue( i_nLast ) ) + { + maSequence.push_back( Range( i_nFirst, i_nLast ) ); + sal_Int32 nNumber = i_nLast - i_nFirst; + nNumber = nNumber < 0 ? -nNumber : nNumber; + mnCount += nNumber + 1; + } + else + bSuccess = false; + } + else + { + if( i_nFirst >= 0 ) + { + if( checkValue( i_nFirst ) ) + { + maSequence.push_back( Range( i_nFirst, i_nFirst ) ); + mnCount++; + } + else + bSuccess = false; + } + if( i_nLast >= 0 ) + { + if( checkValue( i_nLast ) ) + { + maSequence.push_back( Range( i_nLast, i_nLast ) ); + mnCount++; + } + else + bSuccess = false; + } + } + + return bSuccess; +} + +bool StringRangeEnumerator::setRange( const rtl::OUString& i_rNewRange, bool i_bStrict ) +{ + mnCount = 0; + maSequence.clear(); + + // we love special cases + if( i_rNewRange.getLength() == 0 ) + { + if( mnMin >= 0 && mnMax >= 0 ) + { + insertRange( mnMin, mnMax, mnMin != mnMax, ! i_bStrict ); + } + return true; + } + + const sal_Unicode* pInput = i_rNewRange.getStr(); + rtl::OUStringBuffer aNumberBuf( 16 ); + sal_Int32 nLastNumber = -1, nNumber = -1; + bool bSequence = false; + bool bSuccess = true; + while( *pInput ) + { + while( *pInput >= sal_Unicode('0') && *pInput <= sal_Unicode('9') ) + aNumberBuf.append( *pInput++ ); + if( aNumberBuf.getLength() ) + { + if( nNumber != -1 ) + { + if( bSequence ) + { + if( ! insertRange( nLastNumber, nNumber, true, ! i_bStrict ) && i_bStrict ) + { + bSuccess = false; + break; + } + nLastNumber = -1; + } + else + { + if( ! insertRange( nNumber, nNumber, false, ! i_bStrict ) && i_bStrict ) + { + bSuccess = false; + break; + } + } + } + nNumber = aNumberBuf.makeStringAndClear().toInt32(); + nNumber += mnOffset; + } + bool bInsertRange = false; + if( *pInput == sal_Unicode('-') ) + { + nLastNumber = nNumber; + nNumber = -1; + bSequence = true; + } + else if( *pInput == ' ' ) + { + } + else if( *pInput == sal_Unicode(',') || *pInput == sal_Unicode(';') ) + bInsertRange = true; + else if( *pInput ) + { + + bSuccess = false; + break; // parse error + } + + if( bInsertRange ) + { + if( ! insertRange( nLastNumber, nNumber, bSequence, ! i_bStrict ) && i_bStrict ) + { + bSuccess = false; + break; + } + nNumber = nLastNumber = -1; + bSequence = false; + } + if( *pInput ) + pInput++; + } + // insert last entries + insertRange( nLastNumber, nNumber, bSequence, ! i_bStrict ); + + return bSuccess; +} + +bool StringRangeEnumerator::hasValue( sal_Int32 i_nValue, const std::set< sal_Int32 >* i_pPossibleValues ) const +{ + if( i_pPossibleValues && i_pPossibleValues->find( i_nValue ) == i_pPossibleValues->end() ) + return false; + size_t n = maSequence.size(); + for( size_t i= 0; i < n; ++i ) + { + const StringRangeEnumerator::Range rRange( maSequence[i] ); + if( rRange.nFirst < rRange.nLast ) + { + if( i_nValue >= rRange.nFirst && i_nValue <= rRange.nLast ) + return true; + } + else + { + if( i_nValue >= rRange.nLast && i_nValue <= rRange.nFirst ) + return true; + } + } + return false; +} + +StringRangeEnumerator::Iterator& StringRangeEnumerator::Iterator::operator++() +{ + if( nRangeIndex >= 0 && nCurrent >= 0 && pEnumerator ) + { + const StringRangeEnumerator::Range& rRange( pEnumerator->maSequence[nRangeIndex] ); + bool bRangeChange = false; + if( rRange.nLast < rRange.nFirst ) + { + // backward range + if( nCurrent > rRange.nLast ) + nCurrent--; + else + bRangeChange = true; + } + else + { + // forward range + if( nCurrent < rRange.nLast ) + nCurrent++; + else + bRangeChange = true; + } + if( bRangeChange ) + { + nRangeIndex++; + if( size_t(nRangeIndex) == pEnumerator->maSequence.size() ) + { + // reached the end + nRangeIndex = nCurrent = -1; + } + else + nCurrent = pEnumerator->maSequence[nRangeIndex].nFirst; + } + if( nRangeIndex != -1 && nCurrent != -1 ) + { + if( ! pEnumerator->checkValue( nCurrent, pPossibleValues ) ) + return ++(*this); + } + } + return *this; +} + +sal_Int32 StringRangeEnumerator::Iterator::operator*() const +{ + return nCurrent; +} + +bool StringRangeEnumerator::Iterator::operator==( const Iterator& i_rCompare ) const +{ + return i_rCompare.pEnumerator == pEnumerator && i_rCompare.nRangeIndex == nRangeIndex && i_rCompare.nCurrent == nCurrent; +} + +StringRangeEnumerator::Iterator StringRangeEnumerator::begin( const std::set< sal_Int32 >* i_pPossibleValues ) const +{ + StringRangeEnumerator::Iterator it( this, + i_pPossibleValues, + maSequence.empty() ? -1 : 0, + maSequence.empty() ? -1 : maSequence[0].nFirst ); + if( ! checkValue(*it, i_pPossibleValues ) ) + ++it; + return it; +} + +StringRangeEnumerator::Iterator StringRangeEnumerator::end( const std::set< sal_Int32 >* i_pPossibleValues ) const +{ + return StringRangeEnumerator::Iterator( this, i_pPossibleValues, -1, -1 ); +} + +bool StringRangeEnumerator::getRangesFromString( const OUString& i_rPageRange, + std::vector< sal_Int32 >& o_rPageVector, + sal_Int32 i_nMinNumber, + sal_Int32 i_nMaxNumber, + sal_Int32 i_nLogicalOffset, + std::set< sal_Int32 >* i_pPossibleValues + ) +{ + StringRangeEnumerator aEnum; + aEnum.setMin( i_nMinNumber ); + aEnum.setMax( i_nMaxNumber ); + aEnum.setLogicalOffset( i_nLogicalOffset ); + + bool bRes = aEnum.setRange( i_rPageRange ); + if( bRes ) + { + o_rPageVector.clear(); + o_rPageVector.reserve( aEnum.size() ); + for( StringRangeEnumerator::Iterator it = aEnum.begin( i_pPossibleValues ); + it != aEnum.end( i_pPossibleValues ); ++it ) + { + o_rPageVector.push_back( *it ); + } + } + + return bRes; +} + diff --git a/tools/source/memtools/table.cxx b/tools/source/memtools/table.cxx index ba0dbb8a90f9..75aafddb6c58 100644 --- a/tools/source/memtools/table.cxx +++ b/tools/source/memtools/table.cxx @@ -125,26 +125,37 @@ BOOL Table::Insert( ULONG nKey, void* p ) { USHORT n = 0; USHORT nTempCount = (USHORT)nCount * 2; - void** pNodes = Container::ImpGetOnlyNodes(); - ULONG nCompareKey = (ULONG)(*pNodes); - while ( nKey > nCompareKey ) + //<!--Modified by PengYunQuan for resolving a NULL pointer access + + if( void** pNodes = Container::ImpGetOnlyNodes() ) { - n += 2; - pNodes += 2; - if ( n < nTempCount ) - nCompareKey = (ULONG)(*pNodes); - else + ULONG nCompareKey = (ULONG)(*pNodes); + while ( nKey > nCompareKey ) { - nCompareKey = 0; - break; + n += 2; + pNodes += 2; + if ( n < nTempCount ) + nCompareKey = (ULONG)(*pNodes); + else + { + nCompareKey = 0; + break; + } } - } - // Testen, ob sich der Key schon in der Tabelle befindet - if ( nKey == nCompareKey ) - return FALSE; + // Testen, ob sich der Key schon in der Tabelle befindet + if ( nKey == nCompareKey ) + return FALSE; - i = n; + i = n; + } + else + { + i = 0; + if ( ImplGetIndex( nKey, &i ) != TABLE_ENTRY_NOTFOUND ) + return FALSE; + } + //-->Modified by PengYunQuan for resolving a NULL pointer access } else { diff --git a/tools/source/misc/makefile.mk b/tools/source/misc/makefile.mk index 7742c471445f..adc098b023b8 100644 --- a/tools/source/misc/makefile.mk +++ b/tools/source/misc/makefile.mk @@ -42,9 +42,10 @@ LIB1TARGET = $(SLB)$/$(TARGET).lib LIB1OBJFILES = \ $(SLO)$/appendunixshellword.obj \ $(SLO)$/extendapplicationenvironment.obj \ + $(SLO)$/solarmutex.obj \ $(SLO)$/getprocessworkingdir.obj OBJFILES = $(OBJ)$/pathutils.obj -SLOFILES = $(SLO)$/pathutils.obj $(LIB1OBJFILES) +SLOFILES = $(SLO)$/pathutils.obj $(LIB1OBJFILES) $(SLO)$/solarmutex.obj .INCLUDE: target.mk diff --git a/svtools/source/misc/iniprop.cxx b/tools/source/misc/solarmutex.cxx index 16e0e5bc48a7..9049c13997a9 100644 --- a/svtools/source/misc/iniprop.cxx +++ b/tools/source/misc/solarmutex.cxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: iniprop.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -29,19 +26,35 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - - -#include "iniprop.hxx" - -//------------------------------------------------------------------------- +#include "precompiled_tools.hxx" +#include <tools/solarmutex.hxx> -TYPEINIT1(SfxAppIniManagerProperty, ApplicationProperty); - -//------------------------------------------------------------------------- - -SfxAppIniManagerProperty::~SfxAppIniManagerProperty() +namespace tools { + static ::vos::IMutex* pSolarMutex = 0; + + ::vos::IMutex* SolarMutex::GetSolarMutex() + { + return pSolarMutex; + } + + void SolarMutex::SetSolarMutex( ::vos::IMutex* pMutex ) + { + pSolarMutex = pMutex; + } + + bool SolarMutex::Acquire() + { + if ( pSolarMutex ) + pSolarMutex->acquire(); + else + return false; + return true; + } + + void SolarMutex::Release() + { + if ( pSolarMutex ) + pSolarMutex->release(); + } } - - diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx index 538c02e78fde..d27fe1f7f2c0 100644 --- a/tools/source/stream/strmunx.cxx +++ b/tools/source/stream/strmunx.cxx @@ -745,7 +745,7 @@ void SvFileStream::Open( const String& rFilename, StreamMode nOpenMode ) aFileCopier.Execute(); } } - delete pBuf; + delete [] pBuf; } } } diff --git a/tools/test/makefile.mk b/tools/test/makefile.mk index 63108677829c..22796f47d72f 100644 --- a/tools/test/makefile.mk +++ b/tools/test/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # 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 @@ -48,19 +48,20 @@ SHL1OBJS= \ SHL1TARGET= tests SHL1STDLIBS= $(SALLIB) \ $(TOOLSLIB) \ + $(TESTSHL2LIB) \ $(CPPUNITLIB) SHL1IMPLIB= i$(SHL1TARGET) DEF1NAME =$(SHL1TARGET) -SHL1VERSIONMAP = export.map +SHL1VERSIONMAP = export.map #------------------------------- All object files ---------------------------- # do this here, so we get right dependencies -SLOFILES=$(SHL1OBJS) +SLOFILES=$(SHL1OBJS) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk -.INCLUDE : _cppunit.mk +.INCLUDE : _cppunit.mk diff --git a/tools/test/tests.cxx b/tools/test/tests.cxx index 913bd444f145..a2bfb63d4c5f 100644 --- a/tools/test/tests.cxx +++ b/tools/test/tests.cxx @@ -33,7 +33,7 @@ #include "precompiled_tools.hxx" // autogenerated file with codegen.pl -#include <cppunit/simpleheader.hxx> +#include <testshl/simpleheader.hxx> #include <rtl/math.hxx> #include <tools/fract.hxx> diff --git a/tools/workben/urltest.cxx b/tools/workben/urltest.cxx index a232f8ebdd93..0e9d22081cb4 100644 --- a/tools/workben/urltest.cxx +++ b/tools/workben/urltest.cxx @@ -1629,6 +1629,20 @@ main() rtl::OUString(urlobj.GetMainURL(INetURLObject::NO_DECODE))); } + if (true) { // #i53184# + rtl::OUString url(RTL_CONSTASCII_USTRINGPARAM("file://comp_name/path")); + bSuccess &= assertEqual( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("#i53184# smart INET_PROT_FILE")), + INetURLObject(url, INET_PROT_FILE).GetMainURL( + INetURLObject::NO_DECODE), + url); + bSuccess &= assertEqual( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("#i53184# strict")), + INetURLObject(url).GetMainURL(INetURLObject::NO_DECODE), url); + } + if (true) { rtl::OUString path; path = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/a/b/c")); diff --git a/transex3/inc/export.hxx b/transex3/inc/export.hxx index 3d7eee8e1eaf..ec5195034e91 100644 --- a/transex3/inc/export.hxx +++ b/transex3/inc/export.hxx @@ -51,6 +51,12 @@ #include <set> /* std::set*/ #include <vector> /* std::vector*/ #include <queue> +#include <string> + +#include <unistd.h> +#ifdef WNT +#include <direct.h> +#endif #define NO_TRANSLATE_ISO "x-no-translate" @@ -326,7 +332,6 @@ public: static bool skipProject( ByteString sPrj ) ; - static ByteString sIsoCode99; static void InitLanguages( bool bMergeMode = false ); static void InitForcedLanguages( bool bMergeMode = false ); static std::vector<ByteString> GetLanguages(); @@ -349,12 +354,12 @@ public: static bool isSourceLanguage( const ByteString &sLanguage ); static bool isAllowed( const ByteString &sLanguage ); - //static bool isMergingGermanAllowed( const ByteString& rPrj ); static bool LanguageAllowed( const ByteString &nLanguage ); static void Languages( std::vector<ByteString>::const_iterator& begin , std::vector<ByteString>::const_iterator& end ); static void getRandomName( const ByteString& sPrefix , ByteString& sRandStr , const ByteString& sPostfix ); static void getRandomName( ByteString& sRandStr ); + static void getCurrentDir( std::string& dir ); static void replaceEncoding( ByteString& rString ); @@ -517,8 +522,6 @@ private: public: MergeDataFile( const ByteString &rFileName, const ByteString& rFile , BOOL bErrLog, CharSet aCharSet, bool bCaseSensitive = false ); -// MergeDataFile( const ByteString &rFileName, const ByteString& rFile , BOOL bErrLog, CharSet aCharSet -// ); ~MergeDataFile(); @@ -538,7 +541,6 @@ public: static ByteString CreateKey( const ByteString& rTYP , const ByteString& rGID , const ByteString& rLID , const ByteString& rFilename , bool bCaseSensitive = false ); ByteString Dump(); -// void WriteErrorLog( const ByteString &rFileName ); void WriteError( const ByteString &rLine ); }; diff --git a/transex3/source/gsicheck.hxx b/transex3/inc/gsicheck.hxx index 13debcfc7106..13debcfc7106 100644 --- a/transex3/source/gsicheck.hxx +++ b/transex3/inc/gsicheck.hxx diff --git a/transex3/inc/inireader.hxx b/transex3/inc/inireader.hxx new file mode 100644 index 000000000000..0861290adf9f --- /dev/null +++ b/transex3/inc/inireader.hxx @@ -0,0 +1,52 @@ +#include <string> +#include <hash_map> +#include <unicode/regex.h> + +using namespace std; + +namespace transex3 +{ + +struct eqstr +{ + bool operator()( const string s1 , const string s2) const + { + return s1.compare( s2 ) == 0; + } +}; + +typedef std::hash_map< string , string > stringmap; +typedef std::hash_map< string, stringmap* > INImap; + +class INIreader +{ + private: + UErrorCode section_status; + UErrorCode parameter_status; + RegexMatcher* section_match; + RegexMatcher* parameter_match; + + public: + INIreader(): section_status ( U_ZERO_ERROR ) , + parameter_status ( U_ZERO_ERROR ) + { + section_match = new RegexMatcher ( "^\\s*\\[([a-zA-Z0-9]*)\\].*" , 0 , section_status ); + parameter_match = new RegexMatcher ( "^\\s*([a-zA-Z0-9]*)\\s*=\\s*([a-zA-Z0-9 ]*).*" , 0 , parameter_status ) ; + } + ~INIreader() + { + delete section_match; + delete parameter_match; + } + // open "filename", fill hash_map with sections / paramaters + bool read( INImap& myMap , string& filename ); + + private: + bool is_section( string& line , string& section_str ); + bool is_parameter( string& line , string& parameter_key , string& parameter_value ); + inline void check_status( UErrorCode status ); + inline void toStlString ( const UnicodeString& str, string& stl_str ); + inline void trim( string& str ); +}; + +} diff --git a/transex3/inc/treeconfig.hxx b/transex3/inc/treeconfig.hxx new file mode 100644 index 000000000000..96d693b0d376 --- /dev/null +++ b/transex3/inc/treeconfig.hxx @@ -0,0 +1,28 @@ +#include <vector> +#include <string> + +#include "inireader.hxx" + +namespace transex3{ + +class Treeconfig +{ + + private: + INIreader inireader; + INImap map; + bool has_config_file; + void getCurrentDir( string& dir ); + bool isConfigFilePresent(); + + public: + + Treeconfig() : has_config_file( false ) { parseConfig(); } + // read the config file, returns true in case a config file had been found + bool parseConfig(); + // returns a string vector containing all active repositories, returns true in case we are deep inside + // of a source tree. This could affect the behavour of the tool + bool getActiveRepositories( vector<string>& active_repos); +}; + +} diff --git a/transex3/inc/xmlparse.hxx b/transex3/inc/xmlparse.hxx index a497355d6201..18b047ef75c1 100644 --- a/transex3/inc/xmlparse.hxx +++ b/transex3/inc/xmlparse.hxx @@ -32,11 +32,7 @@ #define BOOTSTRP_XMLPARSE_HXX #include <signal.h> -#ifdef SYSTEM_EXPAT #include <expat.h> -#else -#include <external/expat/xmlparse.h> -#endif #include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> #include "tools/string.hxx" diff --git a/transex3/prj/d.lst b/transex3/prj/d.lst index 39bafa4694c6..a469837275ed 100644 --- a/transex3/prj/d.lst +++ b/transex3/prj/d.lst @@ -41,8 +41,10 @@ mkdir: %_DEST%\bin%_EXT%\help\com\sun\star\help ..\%__SRC%\class\receditor\receditor.jar %_DEST%\bin%_EXT%\receditor.jar ..\scripts\localize.pl %_DEST%\bin%_EXT%\localize.pl +..\scripts\localize_old.pl %_DEST%\bin%_EXT%\localize_old.pl ..\scripts\localize %_DEST%\bin%_EXT%\localize ..\scripts\fast_merge.pl %_DEST%\bin%_EXT%\fast_merge.pl +..\scripts\keyidGen.pl %_DEST%\bin%_EXT%\keyidGen.pl ..\inc\export.hxx %_DEST%\inc%_EXT%\transex3\export.hxx ..\inc\transex3\directory.hxx %_DEST%\inc%_EXT%\transex3\directory.hxx diff --git a/transex3/scripts/fast_merge.pl b/transex3/scripts/fast_merge.pl index 266c1c0801e8..7321a9a42911 100644 --- a/transex3/scripts/fast_merge.pl +++ b/transex3/scripts/fast_merge.pl @@ -179,7 +179,7 @@ sub getNextSdfObj } else { - $line =~ /^(([^\t]*)\t([^\t]*).*)/o ; + $line =~ /^(([^\t]*)\t([^\t]*)[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t*)/o ; if( defined $1 && defined $2 && defined $3 ) { $obj->line ( $1 ); diff --git a/transex3/scripts/localize_old.pl b/transex3/scripts/localize_old.pl new file mode 100755 index 000000000000..151399d22002 --- /dev/null +++ b/transex3/scripts/localize_old.pl @@ -0,0 +1,1130 @@ +: +eval 'exec perl -wS $0 ${1+"$@"}' + if 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: localize.pl,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. +# +#************************************************************************* + +use strict; +use Getopt::Long; +use IO::Handle; +use File::Find; +use File::Temp; +use File::Copy; +use File::Glob qw(:glob csh_glob); +use Cwd; + +# ver 1.1 +# +#### module lookup +#use lib ("$ENV{SOLARENV}/bin/modules", "$ENV{COMMON_ENV_TOOLS}/modules"); + +#### module lookup +# OOo conform +my @lib_dirs; +BEGIN { + if ( !defined($ENV{SOLARENV}) ) { + die "No environment found (environment variable SOLARENV is undefined)"; + } + push(@lib_dirs, "$ENV{SOLARENV}/bin/modules"); + push(@lib_dirs, "$ENV{COMMON_ENV_TOOLS}/modules") if defined($ENV{COMMON_ENV_TOOLS}); +} +use lib (@lib_dirs); + +#### globals #### +my $sdffile = ''; +my $no_sort = ''; +my $outputfile = ''; +my $mode = ''; +my $bVerbose="0"; +my $srcpath = ''; +my $WIN; +my $languages; +#my %sl_modules; # Contains all modules where en-US and de is source language +my $use_default_date = '0'; + + # ( leftpart ) ( rightpart ) + # prj file dummy type gid lid helpid pform width lang text helptext qhelptext title timestamp +my $sdf_regex = "((([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*))\t([^\t]*)\t(([^\t]*)\t([^\t]*)\t([^\t]*)\t([^\t]*)\t)([^\t]*))"; +my $file_types = "(src|hrc|xcs|xcu|lng|ulf|xrm|xhp|xcd|xgf|xxl|xrb)"; +# Always use this date to prevent cvs conflicts +my $default_date = "2002-02-02 02:02:02"; + +#### main #### +parse_options(); + +if ( defined $ENV{USE_SHELL} && $ENV{USE_SHELL} eq '4nt' ) { + $WIN = 'TRUE'; +} + else { + $WIN = ''; +} + +#%sl_modules = fetch_sourcelanguage_dirlist(); + + +if ( $mode eq "merge" ) { + merge_gsicheck(); + splitfile( $sdffile ); + unlink $sdffile; # remove temp file! +} +elsif( $mode eq "extract" ) { + collectfiles( $outputfile ); +} +else { + usage(); +} + +exit(0); + +######################################################### +sub splitfile{ + + my $lastFile = ''; + my $currentFile = ''; + my $cur_sdffile = ''; + my $last_sdffile = ''; + my $delim; + my $badDelim; + my $start = 'TRUE'; + my %index = (); + my %block; + + STDOUT->autoflush( 1 ); + + #print STDOUT "Open File $sdffile\n"; + open MYFILE , "< $sdffile" + or die "Can't open '$sdffile'\n"; + + while( <MYFILE>){ + if( /$sdf_regex/ ){ + my $line = defined $_ ? $_ : ''; + my $prj = defined $3 ? $3 : ''; + my $file = defined $4 ? $4 : ''; + my $type = defined $6 ? $6 : ''; + my $gid = defined $7 ? $7 : ''; + my $lid = defined $8 ? $8 : ''; + my $lang = defined $12 ? $12 : ''; + my $plattform = defined $10 ? $10 : ''; + my $helpid = defined $9 ? $9 : ''; + + next if( $prj eq "binfilter" ); # Don't merge strings into binfilter module + chomp( $line ); + $currentFile = $srcpath . '\\' . $prj . '\\' . $file; + if ( $WIN ) { $currentFile =~ s/\//\\/g; } + else { $currentFile =~ s/\\/\//g; } + + $cur_sdffile = $currentFile; + #if( $cur_sdffile =~ /\.$file_types[\s]*$/ ){ + if( $WIN ) { $cur_sdffile =~ s/\\[^\\]*\.$file_types[\s]*$/\\localize.sdf/; } + else { $cur_sdffile =~ s/\/[^\/]*\.$file_types[\s]*$/\/localize.sdf/; } + #} + + # Set default date + if( $line =~ /(.*)\t[^\t\$]*$/ ){ + $line = $1."\t".$default_date; + } + + if( $start ){ + $start=''; + $lastFile = $currentFile; # ? + $last_sdffile = $cur_sdffile; + } + + if( $lang eq "en-US" ){} + elsif( $cur_sdffile eq $last_sdffile ) + { + $block{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line ; + } + else + { + writesdf( $lastFile , \%block ); + $lastFile = $currentFile; #? + $last_sdffile = $cur_sdffile; + %block = (); + #if( ! $lang eq "en-US" ) { + $block{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line ; + #} + + } + } #else { print STDOUT "splitfile REGEX kaputt\n";} + + } + writesdf( $lastFile , \%block ); + %block = (); + close( MYFILE ); + +} +######################################################### + +#sub fetch_sourcelanguage_dirlist +#{ +# +# my $working_path = getcwd(); +# my %sl_dirlist; +# +# chdir $srcpath; +# my @all_dirs = csh_glob( "*" ); +# +# foreach my $file ( @all_dirs ) +# { +# if( -d $file ) +# { +# my $module = $file; +# $file .= "/prj/l10n"; +# $file =~ s/\//\\/ , if( $WIN ) ; +# +# if( -f $file ) # Test file <module>/prj/l10n +# { +# $sl_dirlist{ $module } = 1; +# if( $bVerbose eq "1" ) { print STDOUT "$module: de and en-US source language detected\n"; } +# } +# } +# } +# +# chdir $working_path; +# +# return %sl_dirlist; +#} + +#sub has_two_sourcelanguages +#{ +# my $module = shift; +# return defined $sl_modules{ $module } ; +#} +sub writesdf{ + + my $lastFile = shift; + my $blockhash_ref = shift; + my $localizeFile = $lastFile; + my %index=(); + + if( $localizeFile =~ /\.$file_types[\s]*$/ ){ + if( $WIN ) { $localizeFile =~ s/\\[^\\]*\.$file_types[\s]*$/\\localize.sdf/; } + else { $localizeFile =~ s/\/[^\/]*\.$file_types[\s]*$/\/localize.sdf/; } + }else { + print STDERR "Strange filetype found '$localizeFile'\n"; + return; + } + if( open DESTFILE , "< $localizeFile" ){ + + #or die "Can't open/create '\$localizeFile'"; + + #### Build hash + while(<DESTFILE>){ + if( /$sdf_regex/ ){ + my $line = defined $_ ? $_ : ''; + my $prj = defined $3 ? $3 : ''; + my $file = defined $4 ? $4 : ''; + my $type = defined $6 ? $6 : ''; + my $gid = defined $7 ? $7 : ''; + my $lid = defined $8 ? $8 : ''; + my $lang = defined $12 ? $12 : ''; + my $plattform = defined $10 ? $10 : ''; + my $helpid = defined $9 ? $9 : ''; + + chomp( $line ); + $index{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line ; + + } #else { print STDOUT "writesdf REGEX kaputt $_\n";} + + } + close( DESTFILE ); + } + #### Copy new strings + my @mykeys = keys( %{ $blockhash_ref } ); + my $isDirty = "FALSE"; + foreach my $key( @mykeys ){ + if( ! defined $index{ $key } ){ + # Add new entry + $index{ $key } = $blockhash_ref->{ $key} ; + $isDirty = "TRUE"; + }elsif( $index{ $key } ne $blockhash_ref->{ $key } ){ + # Overwrite old entry + $index{ $key } = $blockhash_ref->{ $key }; + $isDirty = "TRUE"; + }else { + } + } + + #### Write file + + if( !$bVerbose ){ print STDOUT "."; } + if( $isDirty eq "TRUE" ){ + if( $bVerbose ){ print STDOUT "$localizeFile\n"; } + if( open DESTFILE , "+> $localizeFile" ){ + print DESTFILE get_license_header(); + @mykeys = sort keys( %index ); + foreach my $key( @mykeys ){ + print DESTFILE ( $index{ $key } , "\n" ); + } + close DESTFILE; + }else { + print STDOUT "WARNING: File $localizeFile is not writable , try to merge ...\n"; + my ( $TMPFILE , $tmpfile ) = File::Temp::tempfile(); + if( open DESTFILE , "+> $tmpfile " ){ + @mykeys = keys( %index ); + foreach my $key( @mykeys ){ + print DESTFILE ( $index{ $key } , "\n" ); + } + close DESTFILE; + if( move( $localizeFile , $localizeFile.".backup" ) ){ + if( copy( $tmpfile , $localizeFile ) ){ + unlink $localizeFile.".backup"; + } else { print STDERR "Can't open/create '$localizeFile', original file is renamed to $localizeFile.backup\n"; } + } else { print STDERR "Can't open/create '$localizeFile'\n"; } + }else{ + print STDERR "WARNING: Can't open/create '$localizeFile'\n"; + } + unlink $tmpfile; + } + } +# if( $no_sort eq '' ){ +# sort_outfile( $localizeFile ); +# } +} + +sub get_license_header{ + return +"#\n". +"# #### ### # # ### ##### ##### #### ##### ##### \n". +"# # # # # ## # # # # # # # # # \n". +"# # # # # # # # # # # ### # # # # \n". +"# # # # # # ## # # # # # # # # \n". +"# #### ### # # ### # ##### #### ##### # \n". +"#\n". +"# DO NOT EDIT! This file will be overwritten by localisation process\n". +"#\n". +"#*************************************************************************\n". +"#\n". +"# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n". +"# \n". +"# Copyright 2008 by Sun Microsystems, Inc.\n". +"#\n". +"# OpenOffice.org - a multi-platform office productivity suite\n". +"#\n". +"# \$RCSfile:". +"localize.pl,v \$\n". +"#\n". +"# \$Revision: ". +"1.17.4.1 \$\n". +"#\n". +"# This file is part of OpenOffice.org.\n". +"#\n". +"# OpenOffice.org is free software: you can redistribute it and/or modify\n". +"# it under the terms of the GNU Lesser General Public License version 3\n". +"# only, as published by the Free Software Foundation.\n". +"#\n". +"# OpenOffice.org is distributed in the hope that it will be useful,\n". +"# but WITHOUT ANY WARRANTY; without even the implied warranty of\n". +"# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n". +"# GNU Lesser General Public License version 3 for more details\n". +"# (a copy is included in the LICENSE file that accompanied this code).\n". +"#\n". +"# You should have received a copy of the GNU Lesser General Public License\n". +"# version 3 along with OpenOffice.org. If not, see\n". +"# <http://www.openoffice.org/license.html>\n". +"# for a copy of the LGPLv3 License.\n". +"#\n". +"#*************************************************************************\n"; +} +######## Check input sdf file and use only the correct part +sub merge_gsicheck{ + my $command = ''; + my ( $TMPHANDLE , $tmpfile ) = File::Temp::tempfile(); + my ( $TMPHANDLE2 , $tmpfile2 ) = File::Temp::tempfile(); + close ( $TMPHANDLE ); + close ( $TMPHANDLE2 ); + + unlink $tmpfile2; + my $output2 = `cat $sdffile | sort > $tmpfile2`; + my $rc2 = $? << 8; + if( $rc2 ne 0 ){ + printf("ERROR: Failed -> cat $sdffile | sort > $tmpfile2\n$output2\n"); + exit( -1 ); + } + +# if( $ENV{WRAPCMD} ){ +# $command = "$ENV{WRAPCMD} gsicheck"; +# }else{ +# $command = "gsicheck"; +# } +# my $errfile = $tmpfile.".err"; +# $command .= " -k -c -wcf $tmpfile -wef $errfile -l \"\" $tmpfile2"; +# my $output = `$command`; +# my $rc = $? << 8; +# if ( $output ne "" ){ +# print STDOUT "### gsicheck ###\n"; +# print STDOUT "### The file $errfile have been written containing the errors in your sdf file. Those lines will not be merged: ###\n\n"; +# print STDOUT "$output\n"; +# print STDOUT "################\n"; +# +# }else{ +# # Remove the 0 Byte file +# unlink $errfile; +# } + $sdffile = $tmpfile2; +# unlink $tmpfile2; +} +######################################################### +sub collectfiles{ + print STDOUT "### Localize\n"; + my @sdfparticles; + my $localizehash_ref; + my ( $bAll , $bUseLocalize, $langhash_ref , $bHasSourceLanguage , $bFakeEnglish ) = parseLanguages(); + + # Enable autoflush on STDOUT + # $| = 1; + STDOUT->autoflush( 1 ); + + ### Search sdf particles + print STDOUT "### Searching sdf particles\n"; + my $working_path = getcwd(); + chdir $srcpath; + find sub { + my $file = $File::Find::name; + if( -f && $file =~ /.*localize.sdf$/ ) { + push @sdfparticles , $file; + if( $bVerbose eq "1" ) { print STDOUT "$file\n"; } + else { print "."; } + + } + } , getcwd() ;#"."; #$srcpath; + chdir $working_path; + + my $nFound = $#sdfparticles +1; + print "\n $nFound files found !\n"; + + my ( $LOCALIZEPARTICLE , $localizeSDF ) = File::Temp::tempfile(); + close( $LOCALIZEPARTICLE ); + + my ( $ALLPARTICLES_MERGED , $particleSDF_merged ) = File::Temp::tempfile(); + close( $ALLPARTICLES_MERGED ); + my ( $LOCALIZE_LOG , $my_localize_log ) = File::Temp::tempfile(); + close( $LOCALIZE_LOG ); + + ## Get the localize de,en-US extract + if( $bAll || $bUseLocalize ){ + print "### Fetching source language strings\n"; + my $command = ""; + my $args = ""; + + if( $ENV{WRAPCMD} ){ + $command = "$ENV{WRAPCMD} localize_sl"; + }else{ + $command = "localize_sl"; + } + + # -e + # if ( -x $command ){ + if( $command ){ + if( !$bVerbose ){ $args .= " -QQ -skip_links "; } + $args .= " -e -f $localizeSDF -l "; + my $bFlag=""; + if( $bAll ) {$args .= " en-US";} + else{ + my @list; + foreach my $isokey ( keys( %{ $langhash_ref } ) ){ + push @list , $isokey; + if( $langhash_ref->{ $isokey } ne "" ){ + push @list , $langhash_ref->{ $isokey }; + } + } + remove_duplicates( \@list ); + foreach my $isokey ( @list ){ + switch :{ + #( $isokey=~ /^de$/i ) + # && do{ + # if( $bFlag eq "TRUE" ){ $args .= ",de"; } + # else { + # $args .= "de"; $bFlag = "TRUE"; + # } + # }; + ( $isokey=~ /^en-US$/i ) + && do{ + if( $bFlag eq "TRUE" ){ $args .= ",en-US"; } + else { + $args .= "en-US"; $bFlag = "TRUE"; + } + }; + + } #switch + } #foreach + } # if + } # if +# if ( !$bVerbose ){ +# if ( $WIN eq "TRUE" ) { $args .= " > $my_localize_log"; } +# else { $args .= " >& $my_localize_log"; } +# } + if ( $bVerbose ) { print STDOUT $command.$args."\n"; } + + my $rc = system( $command.$args ); + + #my $output = `$command.$args`; + #my $rc = $? << 8; + + if( $rc < 0 ){ print STDERR "ERROR: localize rc = $rc\n"; exit( -1 ); } + ( $localizehash_ref ) = read_file( $localizeSDF , $langhash_ref ); + + } + ## Get sdf particles + open ALLPARTICLES_MERGED , "+>> $particleSDF_merged" + or die "Can't open $particleSDF_merged"; + + ## Fill fackback hash + my( $fallbackhashhash_ref ) = fetch_fallback( \@sdfparticles , $localizeSDF , $langhash_ref ); +# my( $fallbackhashhash_ref ) = fetch_fallback( \@sdfparticles , $localizeSDF , $langhash_ref ); + my %block; + my $cur_fallback; + if( !$bAll) { + foreach my $cur_lang ( keys( %{ $langhash_ref } ) ){ + #print STDOUT "DBG: G1 cur_lang=$cur_lang\n"; + $cur_fallback = $langhash_ref->{ $cur_lang }; + if( $cur_fallback ne "" ){ + # Insert fallback strings + #print STDOUT "DBG: Renaming $cur_fallback to $cur_lang in fallbackhash\n"; + rename_language( $fallbackhashhash_ref , $cur_fallback , $cur_lang ); + } + foreach my $currentfile ( @sdfparticles ){ + if ( open MYFILE , "< $currentfile" ) { + while(<MYFILE>){ + if( /$sdf_regex/ ){ + my $line = defined $_ ? $_ : ''; + my $prj = defined $3 ? $3 : ''; + my $file = defined $4 ? $4 : ''; + my $type = defined $6 ? $6 : ''; + my $gid = defined $7 ? $7 : ''; + my $lid = defined $8 ? $8 : ''; + my $lang = defined $12 ? $12 : ''; + my $plattform = defined $10 ? $10 : ''; + my $helpid = defined $9 ? $9 : ''; + + chomp( $line ); + + if ( $lang eq $cur_lang ){ + # Overwrite fallback strings with collected strings + #if( ( !has_two_sourcelanguages( $cur_lang) && $cur_lang eq "de" ) || $cur_lang ne "en-US" ){ + $fallbackhashhash_ref->{ $cur_lang }{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } = $line ; + #} + + } + } + } + }else { print STDERR "WARNING: Can't open file $currentfile"; } + } + + foreach my $line ( keys( %{$fallbackhashhash_ref->{ $cur_lang } } )) { + if( #$cur_lang ne "de" && + $cur_lang ne "en-US" ){ + print ALLPARTICLES_MERGED ( $fallbackhashhash_ref->{ $cur_lang }{ $line }, "\n" ); + } + } + } + } else { + foreach my $currentfile ( @sdfparticles ){ + if ( open MYFILE , "< $currentfile" ) { + while( <MYFILE> ){ + print ALLPARTICLES_MERGED ( $_, "\n" ); # recheck de / en-US ! + } + } + else { print STDERR "WARNING: Can't open file $currentfile"; } + } + } + close ALLPARTICLES_MERGED; + + + # Hash of array + my %output; + my @order; + + ## Join both + if( $outputfile ){ + if( open DESTFILE , "+> $outputfile" ){ + if( !open LOCALIZEPARTICLE , "< $localizeSDF" ) { print STDERR "ERROR: Can't open file $localizeSDF\n"; } + if( !open ALLPARTICLES_MERGED , "< $particleSDF_merged" ) { print STDERR "ERROR: Can't open file $particleSDF_merged\n"; } + + # Insert localize + my $extract_date=""; + while ( <LOCALIZEPARTICLE> ){ + if( /$sdf_regex/ ){ + my $leftpart = defined $2 ? $2 : ''; + my $lang = defined $12 ? $12 : ''; + my $rightpart = defined $13 ? $13 : ''; + my $timestamp = defined $18 ? $18 : ''; + + my $prj = defined $3 ? $3 : ''; + my $file = defined $4 ? $4 : ''; + my $type = defined $6 ? $6 : ''; + my $gid = defined $7 ? $7 : ''; + my $lid = defined $8 ? $8 : ''; + #my $lang = defined $12 ? $12 : ''; + my $plattform = defined $10 ? $10 : ''; + my $helpid = defined $9 ? $9 : ''; + + + if( $use_default_date ) + { + $extract_date = "$default_date\n" ; + } + elsif( $extract_date eq "" ) { + $extract_date = $timestamp ; + $extract_date =~ tr/\r\n//d; + $extract_date .= "\n"; + } + + if( $bAll ){ print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date ; } + else { + foreach my $sLang ( keys( %{ $langhash_ref } ) ){ + if( $sLang=~ /all/i ) { + push @{ $output{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ; + #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date; + } + #if( $sLang eq "de" && $lang eq "de" ) { + # push @{ $output{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ; + #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date; + #} + if( $sLang eq "en-US" && $lang eq "en-US" ) { + push @order , $prj.$gid.$lid.$file.$type.$plattform.$helpid; + if( !$bFakeEnglish ){ push @{ $output{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ; } + #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date; + } + + } + } + } + } + # Insert particles + while ( <ALLPARTICLES_MERGED> ){ + if( /$sdf_regex/ ){ + my $leftpart = defined $2 ? $2 : ''; + my $prj = defined $3 ? $3 : ''; + my $lang = defined $12 ? $12 : ''; + my $rightpart = defined $13 ? $13 : ''; + my $timestamp = defined $18 ? $18 : ''; + + #my $prj = defined $3 ? $3 : ''; + my $file = defined $4 ? $4 : ''; + my $type = defined $6 ? $6 : ''; + my $gid = defined $7 ? $7 : ''; + my $lid = defined $8 ? $8 : ''; + #my $lang = defined $12 ? $12 : ''; + my $plattform = defined $10 ? $10 : ''; + my $helpid = defined $9 ? $9 : ''; + + + if( $use_default_date ) + { + $extract_date = "$default_date\n" ; + } + elsif( $extract_date eq "" ) + { + $extract_date = $timestamp; + } + + if( ! ( $prj =~ /binfilter/i ) ) { + push @{ $output{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } } , $leftpart."\t".$lang."\t".$rightpart.$extract_date ; + #print DESTFILE $leftpart."\t".$lang."\t".$rightpart.$extract_date ; + } + } + } + + # Write! + foreach my $curkey ( @order ){ + foreach my $curlist ( $output{ $curkey } ){ + foreach my $line ( @{$curlist} ){ + print DESTFILE $line; + } + } + } + + }else { print STDERR "Can't open $outputfile";} + } + close DESTFILE; + close LOCALIZEPARTICLE; + close ALLPARTICLES_MERGED; + + #print STDOUT "DBG: \$localizeSDF $localizeSDF \$particleSDF_merged $particleSDF_merged\n"; + unlink $localizeSDF , $particleSDF_merged , $my_localize_log; + + #sort_outfile( $outputfile ); + #remove_obsolete( $outputfile ) , if $bHasSourceLanguage ne ""; + } + +######################################################### +sub remove_obsolete{ + my $outfile = shift; + my @lines; + my $enusleftpart; + my @good_lines; + + print STDOUT "### Removing obsolete strings\n"; + + # Kick out all strings without en-US reference + if ( open ( SORTEDFILE , "< $outfile" ) ){ + while( <SORTEDFILE> ){ + if( /$sdf_regex/ ){ + my $line = defined $_ ? $_ : ''; + my $language = defined $12 ? $12 : ''; + my $prj = defined $3 ? $3 : ''; + my $file = defined $4 ? $4 : ''; + my $type = defined $6 ? $6 : ''; + my $gid = defined $7 ? $7 : ''; + my $lid = defined $8 ? $8 : ''; + my $plattform = defined $10 ? $10 : ''; + my $helpid = defined $9 ? $9 : ''; + + my $leftpart = $prj.$gid.$lid.$file.$type.$plattform.$helpid; + + if( $language eq "en-US" ){ # source string found, 1. entry + $enusleftpart = $leftpart; + push @good_lines , $line; + }else{ + if( !defined $enusleftpart or !defined $leftpart ){ + print STDERR "BADLINE: $line\n"; + print STDERR "\$enusleftpart = $enusleftpart\n"; + print STDERR "\$leftpart = $leftpart\n"; + } + if( $enusleftpart eq $leftpart ){ # matching language + push @good_lines , $line; + } + #else{ + # print STDERR "OUT: \$enusleftpart=$enusleftpart \$leftpart=$leftpart \$line=$line\n"; + #} + } + } + } + close SORTEDFILE; + } else { print STDERR "ERROR: Can't open file $outfile\n";} + + # Write file + if ( open ( SORTEDFILE , "> $outfile" ) ){ + foreach my $newline ( @good_lines ) { + print SORTEDFILE $newline; + } + close SORTEDFILE; + } else { print STDERR "ERROR: Can't open file $outfile\n";} + +} +######################################################### +sub sort_outfile{ + my $outfile = shift; + print STDOUT "### Sorting ... $outfile ..."; + my @lines; + my @sorted_lines; + + + #if ( open ( SORTEDFILE , "< $outputfile" ) ){ + if ( open ( SORTEDFILE , "< $outfile" ) ){ + my $line; + while ( <SORTEDFILE> ){ + $line = $_; + if( $line =~ /^[^\#]/ ){ + push @lines , $line; + } + } + close SORTEDFILE; + @sorted_lines = sort { + my $xa_lang = ""; + my $xa_left_part = ""; + my $xa_right_part = ""; + my $xa_timestamp = ""; + my $xb_lang = ""; + my $xb_left_part = ""; + my $xb_right_part = ""; + my $xb_timestamp = ""; + my $xa = ""; + my $xb = ""; + my @alist; + my @blist; + + if( $a=~ /$sdf_regex/ ){ + $xa_left_part = defined $2 ? $2 : ''; + $xa_lang = defined $12 ? $12 : ''; + $xa_right_part = defined $13 ? $13 : ''; + $xa_left_part = remove_last_column( $xa_left_part ); + + } + if( $b=~ /$sdf_regex/ ){ + $xb_left_part = defined $2 ? $2 : ''; + $xb_lang = defined $12 ? $12 : ''; + $xb_right_part = defined $13 ? $13 : ''; + $xb_left_part = remove_last_column( $xb_left_part ); + + + } + if( ( $xa_left_part cmp $xb_left_part ) == 0 ){ # Left part equal + if( ( $xa_lang cmp $xb_lang ) == 0 ){ # Lang equal + return ( $xa_right_part cmp $xb_right_part ); # Right part compare + } + elsif( $xa_lang eq "en-US" ) { return -1; } # en-US wins + elsif( $xb_lang eq "en-US" ) { return 1; } # en-US wins + else { return $xa_lang cmp $xb_lang; } # lang compare + } + else { + return $xa_left_part cmp $xb_left_part; # Left part compare + } + } @lines; + + if ( open ( SORTEDFILE , "> $outfile" ) ){ + print SORTEDFILE get_license_header(); + foreach my $newline ( @sorted_lines ) { + print SORTEDFILE $newline; + #print STDOUT $newline; + } + } + close SORTEDFILE; + } else { print STDERR "WARNING: Can't open file $outfile\n";} + print "done\n"; + +} +######################################################### +sub remove_last_column{ + my $string = shift; + my @alist = split ( "\t" , $string ); + pop @alist; + return join( "\t" , @alist ); +} + +######################################################### +sub rename_language{ + my $fallbackhashhash_ref = shift; + my $cur_fallback = shift; + my $cur_lang = shift; + my $line; + + foreach my $key( keys ( %{ $fallbackhashhash_ref->{ $cur_fallback } } ) ){ + $line = $fallbackhashhash_ref->{ $cur_fallback }{ $key }; + if( $line =~ /$sdf_regex/ ){ + my $leftpart = defined $2 ? $2 : ''; + my $lang = defined $12 ? $12 : ''; + my $rightpart = defined $13 ? $13 : ''; + + $fallbackhashhash_ref->{ $cur_lang }{ $key } = $leftpart."\t".$cur_lang."\t".$rightpart; + } + } +} + +############################################################ +sub remove_duplicates{ + my $list_ref = shift; + my %tmphash; + foreach my $key ( @{ $list_ref } ){ $tmphash{ $key } = '' ; } + @{$list_ref} = keys( %tmphash ); +} + +############################################################## +sub fetch_fallback{ + my $sdfparticleslist_ref = shift; + my $localizeSDF = shift; + my $langhash_ref = shift; + my %fallbackhashhash; + my $cur_lang; + my @langlist; + + foreach my $key ( keys ( %{ $langhash_ref } ) ){ + $cur_lang = $langhash_ref->{ $key }; + if ( $cur_lang ne "" ) { + push @langlist , $cur_lang; + } + } + remove_duplicates( \@langlist ); + foreach $cur_lang ( @langlist ){ + if( $cur_lang eq "en-US" ){ + read_fallbacks_from_source( $localizeSDF , $cur_lang , \%fallbackhashhash ); + } + } + + # remove de / en-US + my @tmplist; + foreach $cur_lang( @langlist ){ + if( $cur_lang ne "en-US" ){ + push @tmplist , $cur_lang; + + } + } + @langlist = @tmplist; + if ( $#langlist +1 ){ + read_fallbacks_from_particles( $sdfparticleslist_ref , \@langlist , \%fallbackhashhash ); + + } + return (\%fallbackhashhash); +} + +######################################################### +sub write_file{ + + my $localizeFile = shift; + my $index_ref = shift; + + if( open DESTFILE , "+> $localizeFile" ){ + foreach my $key( %{ $index_ref } ){ + print DESTFILE ($index_ref->{ $key }, "\n" ); + } + close DESTFILE; + }else { + print STDERR "Can't open/create '$localizeFile'"; + } +} + +######################################################### +sub read_file{ + + my $sdffile = shift; + my $langhash_ref = shift; + my %block = (); + + open MYFILE , "< $sdffile" + or die "Can't open '$sdffile'\n"; + while( <MYFILE>){ + if( /$sdf_regex/ ){ + my $line = defined $_ ? $_ : ''; + my $prj = defined $3 ? $3 : ''; + my $file = defined $4 ? $4 : ''; + my $type = defined $6 ? $6 : ''; + my $gid = defined $7 ? $7 : ''; + my $lid = defined $8 ? $8 : ''; + my $plattform = defined $10 ? $10 : ''; + my $lang = defined $12 ? $12 : ''; + my $helpid = defined $9 ? $9 : ''; + + foreach my $isolang ( keys ( %{ $langhash_ref } ) ){ + if( $isolang=~ /$lang/i || $isolang=~ /all/i ) { $block{$prj.$gid.$lid.$file.$type.$plattform.$helpid } = $line ; } + } + } + } + return (\%block); +} + +######################################################### +sub read_fallbacks_from_particles{ + + my $sdfparticleslist_ref = shift; + my $isolanglist_ref = shift; + my $fallbackhashhash_ref = shift; + my $block_ref; + foreach my $currentfile ( @{ $sdfparticleslist_ref } ){ + if ( open MYFILE , "< $currentfile" ) { + while(<MYFILE>){ + if( /$sdf_regex/ ){ + my $line = defined $_ ? $_ : ''; + my $prj = defined $3 ? $3 : ''; + my $file = defined $4 ? $4 : ''; + my $type = defined $6 ? $6 : ''; + my $gid = defined $7 ? $7 : ''; + my $lid = defined $8 ? $8 : ''; + my $lang = defined $12 ? $12 : ''; + my $plattform = defined $10 ? $10 : ''; + my $helpid = defined $9 ? $9 : ''; + + chomp( $line ); + + foreach my $isolang ( @{$isolanglist_ref} ){ + if( $isolang=~ /$lang/i ) { + $fallbackhashhash_ref->{ $isolang }{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } = $line ; + } + } + } + } + }else { print STDERR "WARNING: Can't open file $currentfile"; } + } +} + +######################################################### +sub read_fallbacks_from_source{ + + my $sdffile = shift; + my $isolang = shift; + my $fallbackhashhash_ref = shift; + my $block_ref; + # read fallback for single file + open MYFILE , "< $sdffile" + or die "Can't open '$sdffile'\n"; + + while( <MYFILE>){ + if( /$sdf_regex/ ){ + my $line = defined $_ ? $_ : ''; + my $prj = defined $3 ? $3 : ''; + my $file = defined $4 ? $4 : ''; + my $type = defined $6 ? $6 : ''; + my $gid = defined $7 ? $7 : ''; + my $lid = defined $8 ? $8 : ''; + my $helpid = defined $9 ? $9 : ''; + my $lang = defined $12 ? $12 : ''; + my $plattform = defined $10 ? $10 : ''; + + chomp( $line ); + if( $isolang=~ /$lang/i ) { $fallbackhashhash_ref->{ $isolang }{ $prj.$gid.$lid.$file.$type.$plattform.$helpid } = $line ; + } + } + } +} + +######################################################### +sub parseLanguages{ + + my $bAll; + my $bUseLocalize; + my $bHasSourceLanguage=""; + my $bFakeEnglish=""; + my %langhash; + my $iso=""; + my $fallback=""; + + #### -l all + if( $languages=~ /all/ ){ + $bAll = "TRUE"; + $bHasSourceLanguage = "TRUE"; + } + ### -l fr=de,de + elsif( $languages=~ /.*,.*/ ){ + my @tmpstr = split "," , $languages; + for my $lang ( @tmpstr ){ + if( $lang=~ /([a-zA-Z]{2,3}(-[a-zA-Z\-]*)*)(=([a-zA-Z]{2,3}(-[a-zA-Z\-]*)*))?/ ){ + $iso = $1; + $fallback = $4; + + if( ( $iso && $iso=~ /(en-US)/i ) || ( $fallback && $fallback=~ /(en-US)/i ) ) { + $bUseLocalize = "TRUE"; + } + if( ( $iso && $iso=~ /(en-US)/i ) ) { + $bHasSourceLanguage = "TRUE"; + } + if( $fallback ) { $langhash{ $iso } = $fallback; } + else { $langhash{ $iso } = ""; } + } + } + } + ### -l de + else{ + if( $languages=~ /([a-zA-Z]{2,3}(-[a-zA-Z\-]*)*)(=([a-zA-Z]{2,3}(-[a-zA-Z\-]*)*))?/ ){ + $iso = $1; + $fallback = $4; + + if( ( $iso && $iso=~ /(en-US)/i ) || ( $fallback && $fallback=~ /(en-US)/i ) ) { + $bUseLocalize = "TRUE"; + + } + if( ( $iso && $iso=~ /(en-US)/i ) ) { + $bHasSourceLanguage = "TRUE"; + } + + if( $fallback ) { $langhash{ $iso } = $fallback; } + else { $langhash{ $iso } = ""; } + } + } + # HACK en-US always needed! + if( !$bHasSourceLanguage ){ + #$bHasSourceLanguage = "TRUE"; + $bUseLocalize = "TRUE"; + $bFakeEnglish = "TRUE"; + $langhash{ "en-US" } = ""; + } + return ( $bAll , $bUseLocalize , \%langhash , $bHasSourceLanguage, $bFakeEnglish); +} + +######################################################### +sub parse_options{ + + my $help; + my $merge; + my $extract; + my $success = GetOptions('f=s' => \$sdffile , 'l=s' => \$languages , 's=s' => \$srcpath , 'h' => \$help , 'v' => \$bVerbose , + 'm' => \$merge , 'e' => \$extract , 'x' => \$no_sort , 'd' => \$use_default_date ); + $outputfile = $sdffile; + + #print STDOUT "DBG: lang = $languages\n"; + if( !$srcpath ){ + #$srcpath = "$ENV{SRC_ROOT}"; + if( !$srcpath ){ + print STDERR "No path to the source root found!\n\n"; + usage(); + exit(1); + } + } + if( $help || !$success || $#ARGV > 1 || ( !$sdffile ) ){ + usage(); + exit(1); + } + if( $merge && $sdffile && ! ( -r $sdffile)){ + print STDERR "Can't open file '$sdffile'\n"; + exit(1); + } + if( !( $languages=~ /[a-zA-Z]{2,3}(-[a-zA-Z\-]*)*(=[a-zA-Z]{2,3}(-[a-zA-Z\-]*)*)?(,[a-zA-Z]{2,3}(-[a-zA-Z\-]*)*(=[a-zA-Z]{2,3}(-[a-zA-Z\-]*)*)?)*/ ) ){ + print STDERR "Please check the -l iso code\n"; + exit(1); + } + if( ( !$merge && !$extract ) || ( $merge && $extract ) ){ usage();exit( -1 );} + if( $extract ){ $mode = "extract"; } + else { $mode = "merge"; } +} + +######################################################### +sub usage{ + + print STDERR "Usage: localize.pl\n"; + print STDERR "Split or collect SDF files\n"; + print STDERR " merge: -m -f <sdffile> -l l1[=f1][,l2[=f2]][...] [ -s <sourceroot> ]\n"; + print STDERR " extract: -e -f <outputfile> -l <lang> [ -s <sourceroot> ] [-d]\n"; + print STDERR "Options:\n"; + print STDERR " -h help\n"; + print STDERR " -m Merge mode\n"; + print STDERR " -e Extract mode\n"; + print STDERR " -f <sdffile> To split a big SDF file into particles\n"; + print STDERR " <outputfile> To collect and join all particles to one big file\n"; + print STDERR " -s <sourceroot> Path to the modules, if no \$SRC_ROOT is set\n"; + print STDERR " -l ( all | <isocode> | <isocode>=fallback ) comma seperated languages\n"; + print STDERR " -d Use default date in extracted sdf file\n"; + print STDERR " -v Verbose\n"; + print STDERR "\nExample:\n"; + print STDERR "\nlocalize -e -l en-US,pt-BR=en-US -f my.sdf\n( Extract en-US and pt-BR with en-US fallback )\n"; + print STDERR "\nlocalize -m -l cs -f my.sdf\n( Merge cs translation into the sourcecode ) \n"; +} + +# my $line = defined $_ ? $_ : ''; +# my $leftpart = defined $2 ? $2 : ''; +# my $prj = defined $3 ? $3 : ''; +# my $file = defined $4 ? $4 : ''; +# my $dummy = defined $5 ? $5 : ''; +# my $type = defined $6 ? $6 : ''; +# my $gid = defined $7 ? $7 : ''; +# my $lid = defined $8 ? $8 : ''; +# my $helpid = defined $9 ? $9 : ''; +# my $plattform = defined $10 ? $10 : ''; +# my $width = defined $11 ? $11 : ''; +# my $lang = defined $12 ? $12 : ''; +# my $rightpart = defined $13 ? $13 : ''; +# my $text = defined $14 ? $14 : ''; +# my $helptext = defined $15 ? $15 : ''; +# my $quickhelptext = defined $16 ? $16 : ''; +# my $title = defined $17 ? $17 : ''; +# my $timestamp = defined $18 ? $18 : ''; + diff --git a/transex3/source/cfgmerge.cxx b/transex3/source/cfgmerge.cxx index 21b4aeff185d..0607c9e9bb06 100644 --- a/transex3/source/cfgmerge.cxx +++ b/transex3/source/cfgmerge.cxx @@ -172,10 +172,6 @@ extern char *GetOutputFile( int argc, char* argv[]) Export::sLanguages = ByteString( argv[ i ]); } break; - case STATE_ISOCODE99: { - Export::sIsoCode99 = ByteString( argv[ i ]); - } - break; } } } diff --git a/transex3/source/directory.cxx b/transex3/source/directory.cxx index a4a2abc70e0f..ed0fe27d22c2 100644 --- a/transex3/source/directory.cxx +++ b/transex3/source/directory.cxx @@ -174,6 +174,16 @@ void Directory::readDirectory ( const rtl::OUString& sFullpath ) #else +class dirholder +{ +private: + DIR *mpDir; +public: + dirholder(DIR *pDir) : mpDir(pDir) {} + int close() { int nRet = mpDir ? closedir(mpDir) : 0; mpDir = NULL; return nRet; } + ~dirholder() { close(); } +}; + void Directory::readDirectory( const rtl::OUString& sFullpath ) { struct stat statbuf; @@ -195,13 +205,14 @@ void Directory::readDirectory( const rtl::OUString& sFullpath ) if( S_ISDIR(statbuf.st_mode ) == 0 ) { return; }// error } return; // not dir if( (dir = opendir( path ) ) == NULL ) {printf("readerror 2 in %s \n",path); return; } // error } return; // error + dirholder aHolder(dir); sFullpathext += rtl::OString( "/" ); const rtl::OString sDot ( "." ) ; const rtl::OString sDDot( ".." ); - chdir( path ); + if ( chdir( path ) == -1 ) { printf("chdir error in %s \n",path); return; } // error while( ( dirp = readdir( dir ) ) != NULL ) { @@ -253,8 +264,8 @@ void Directory::readDirectory( const rtl::OUString& sFullpath ) } } } - chdir( ".." ); - if( closedir( dir ) < 0 ) return ; // error + if ( chdir( ".." ) == -1 ) { printf("chdir error in .. \n"); return; } // error + if( aHolder.close() < 0 ) return ; // error std::sort( aFileVec.begin() , aFileVec.end() , File::lessFile ); std::sort( aDirVec.begin() , aDirVec.end() , Directory::lessDir ); diff --git a/transex3/source/export2.cxx b/transex3/source/export2.cxx index 5db1067a7afb..7815e80e033f 100644 --- a/transex3/source/export2.cxx +++ b/transex3/source/export2.cxx @@ -42,6 +42,7 @@ #include <iomanip> #include <tools/urlobj.hxx> #include <time.h> +#include <stdlib.h> using namespace std; // @@ -93,7 +94,7 @@ ResData::~ResData() /*****************************************************************************/ ByteString Export::sLanguages; ByteString Export::sForcedLanguages; -ByteString Export::sIsoCode99; +//ByteString Export::sIsoCode99; /*****************************************************************************/ void Export::DumpExportList( ByteString& sListName , ExportList& aList ){ @@ -648,6 +649,16 @@ int Export::getCurrentDirectory( rtl::OUString& base_fqurl_out, rtl::OUString& b return osl::File::getFileURLFromSystemPath( base_out , base_fqurl_out ); } +void Export::getCurrentDir( string& dir ) +{ + char buffer[64000]; + if( getcwd( buffer , sizeof( buffer ) ) == 0 ){ + cerr << "Error: getcwd failed!\n"; + exit( -1 ); + } + dir = string( buffer ); +} + // Stolen from sal/osl/unx/tempfile.c diff --git a/transex3/source/help/HelpLinker.cxx b/transex3/source/help/HelpLinker.cxx index 67049df439e1..7dfe4ee4a2a2 100644 --- a/transex3/source/help/HelpLinker.cxx +++ b/transex3/source/help/HelpLinker.cxx @@ -45,11 +45,7 @@ #include <osl/time.h> #include <rtl/bootstrap.hxx> -#ifdef SYSTEM_EXPAT #include <expat.h> -#else -#include <expat/xmlparse.h> -#endif #define DBHELP_ONLY @@ -118,35 +114,41 @@ void IndexerPreProcessor::processDocument { std::string aStdStr_EncodedDocPathURL = getEncodedPath( EncodedDocPath ); - xmlDocPtr resCaption = xsltApplyStylesheet( m_xsltStylesheetPtrCaption, doc, NULL ); - xmlNodePtr pResNodeCaption = resCaption->xmlChildrenNode; - if( pResNodeCaption ) + if( m_xsltStylesheetPtrCaption ) { - fs::path fsCaptionPureTextFile_docURL = m_fsCaptionFilesDirName / aStdStr_EncodedDocPathURL; - std::string aCaptionPureTextFileStr_docURL = fsCaptionPureTextFile_docURL.native_file_string(); - FILE* pFile_docURL = fopen( aCaptionPureTextFileStr_docURL.c_str(), "w" ); - if( pFile_docURL ) + xmlDocPtr resCaption = xsltApplyStylesheet( m_xsltStylesheetPtrCaption, doc, NULL ); + xmlNodePtr pResNodeCaption = resCaption->xmlChildrenNode; + if( pResNodeCaption ) { - fprintf( pFile_docURL, "%s\n", pResNodeCaption->content ); - fclose( pFile_docURL ); + fs::path fsCaptionPureTextFile_docURL = m_fsCaptionFilesDirName / aStdStr_EncodedDocPathURL; + std::string aCaptionPureTextFileStr_docURL = fsCaptionPureTextFile_docURL.native_file_string(); + FILE* pFile_docURL = fopen( aCaptionPureTextFileStr_docURL.c_str(), "w" ); + if( pFile_docURL ) + { + fprintf( pFile_docURL, "%s\n", pResNodeCaption->content ); + fclose( pFile_docURL ); + } } + xmlFreeDoc(resCaption); } - xmlFreeDoc(resCaption); - xmlDocPtr resContent = xsltApplyStylesheet( m_xsltStylesheetPtrContent, doc, NULL ); - xmlNodePtr pResNodeContent = resContent->xmlChildrenNode; - if( pResNodeContent ) + if( m_xsltStylesheetPtrContent ) { - fs::path fsContentPureTextFile_docURL = m_fsContentFilesDirName / aStdStr_EncodedDocPathURL; - std::string aContentPureTextFileStr_docURL = fsContentPureTextFile_docURL.native_file_string(); - FILE* pFile_docURL = fopen( aContentPureTextFileStr_docURL.c_str(), "w" ); - if( pFile_docURL ) + xmlDocPtr resContent = xsltApplyStylesheet( m_xsltStylesheetPtrContent, doc, NULL ); + xmlNodePtr pResNodeContent = resContent->xmlChildrenNode; + if( pResNodeContent ) { - fprintf( pFile_docURL, "%s\n", pResNodeContent->content ); - fclose( pFile_docURL ); + fs::path fsContentPureTextFile_docURL = m_fsContentFilesDirName / aStdStr_EncodedDocPathURL; + std::string aContentPureTextFileStr_docURL = fsContentPureTextFile_docURL.native_file_string(); + FILE* pFile_docURL = fopen( aContentPureTextFileStr_docURL.c_str(), "w" ); + if( pFile_docURL ) + { + fprintf( pFile_docURL, "%s\n", pResNodeContent->content ); + fclose( pFile_docURL ); + } } + xmlFreeDoc(resContent); } - xmlFreeDoc(resContent); } struct Data @@ -174,15 +176,23 @@ void writeKeyValue_DBHelp( FILE* pFile, const std::string& aKeyStr, const std::s if( pFile == NULL ) return; char cLF = 10; - int nKeyLen = aKeyStr.length(); - int nValueLen = aValueStr.length(); + unsigned int nKeyLen = aKeyStr.length(); + unsigned int nValueLen = aValueStr.length(); fprintf( pFile, "%x ", nKeyLen ); if( nKeyLen > 0 ) - fwrite( aKeyStr.c_str(), 1, nKeyLen, pFile );
- fprintf( pFile, " %x ", nValueLen ); + { + if (fwrite( aKeyStr.c_str(), 1, nKeyLen, pFile ) != nKeyLen) + fprintf(stderr, "fwrite to db failed\n"); + } + if (fprintf( pFile, " %x ", nValueLen ) < 0) + fprintf(stderr, "fwrite to db failed\n"); if( nValueLen > 0 ) - fwrite( aValueStr.c_str(), 1, nValueLen, pFile );
- fprintf( pFile, "%c", cLF ); + { + if (fwrite( aValueStr.c_str(), 1, nValueLen, pFile ) != nValueLen) + fprintf(stderr, "fwrite to db failed\n"); + } + if (fprintf( pFile, "%c", cLF ) < 0) + fprintf(stderr, "fwrite to db failed\n"); } class HelpKeyword @@ -237,8 +247,9 @@ public: class HelpLinker { public: - void main(std::vector<std::string> &args, std::string* pExtensionPath = NULL ) - throw( HelpProcessingException ); + void main(std::vector<std::string> &args, + std::string* pExtensionPath = NULL, const rtl::OUString* pOfficeHelpPath = NULL ) + throw( HelpProcessingException ); HelpLinker() : init(true) @@ -384,8 +395,8 @@ void HelpLinker::initIndexerPreProcessor() */ void HelpLinker::link() throw( HelpProcessingException ) { - bool bIndexForExtension = true;
-
+ bool bIndexForExtension = true; + if( bExtensionMode ) { indexDirParentName = sourceRoot; @@ -476,8 +487,10 @@ void HelpLinker::link() throw( HelpProcessingException ) if( !bExtensionMode ) { +#ifndef OS2 // YD @TODO@ crashes libc runtime :-( std::cout << "Making " << outputFile.native_file_string() << " from " << helpFiles.size() << " input files" << std::endl; +#endif } // here we start our loop over the hzip files. @@ -741,21 +754,21 @@ void HelpLinker::link() throw( HelpProcessingException ) } -void HelpLinker::main(std::vector<std::string> &args, std::string* pExtensionPath) - throw( HelpProcessingException ) +void HelpLinker::main( std::vector<std::string> &args, + std::string* pExtensionPath, const rtl::OUString* pOfficeHelpPath ) + throw( HelpProcessingException ) { rtl::OUString aOfficeHelpPath; bExtensionMode = false; - if( pExtensionPath && pExtensionPath->length() > 0 ) + if( pExtensionPath && pExtensionPath->length() > 0 && pOfficeHelpPath ) { helpFiles.clear(); bExtensionMode = true; extensionPath = *pExtensionPath; sourceRoot = fs::path(extensionPath); - aOfficeHelpPath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$OOO_BASE_DIR/help") ); - rtl::Bootstrap::expandMacros( aOfficeHelpPath ); + aOfficeHelpPath = *pOfficeHelpPath; } if (args.size() > 0 && args[0][0] == '@') { @@ -928,34 +941,34 @@ void HelpLinker::main(std::vector<std::string> &args, std::string* pExtensionPat aStrStream << "no index caption stylesheet given" << std::endl; throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); } - else if ( bExtensionMode )
- {
- rtl::OUString aIdxCaptionPathFileURL( aOfficeHelpPath );
- aIdxCaptionPathFileURL += rtl::OUString::createFromAscii( "/idxcaption.xsl" );
-
+ else if ( bExtensionMode ) + { + rtl::OUString aIdxCaptionPathFileURL( aOfficeHelpPath ); + aIdxCaptionPathFileURL += rtl::OUString::createFromAscii( "/idxcaption.xsl" ); + rtl::OString aOStr_IdxCaptionPathFileURL( rtl::OUStringToOString ( aIdxCaptionPathFileURL, fs::getThreadTextEncoding() ) ); std::string aStdStr_IdxCaptionPathFileURL( aOStr_IdxCaptionPathFileURL.getStr() ); -
- idxCaptionStylesheet = fs::path( aStdStr_IdxCaptionPathFileURL );
- }
+ + idxCaptionStylesheet = fs::path( aStdStr_IdxCaptionPathFileURL ); + } if (!bExtensionMode && idxContentStylesheet.empty()) { std::stringstream aStrStream; aStrStream << "no index content stylesheet given" << std::endl; throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); } - else if ( bExtensionMode )
- {
- rtl::OUString aIdxContentPathFileURL( aOfficeHelpPath );
- aIdxContentPathFileURL += rtl::OUString::createFromAscii( "/idxcontent.xsl" );
-
+ else if ( bExtensionMode ) + { + rtl::OUString aIdxContentPathFileURL( aOfficeHelpPath ); + aIdxContentPathFileURL += rtl::OUString::createFromAscii( "/idxcontent.xsl" ); + rtl::OString aOStr_IdxContentPathFileURL( rtl::OUStringToOString ( aIdxContentPathFileURL, fs::getThreadTextEncoding() ) ); std::string aStdStr_IdxContentPathFileURL( aOStr_IdxContentPathFileURL.getStr() ); -
- idxContentStylesheet = fs::path( aStdStr_IdxContentPathFileURL );
- }
+ + idxContentStylesheet = fs::path( aStdStr_IdxContentPathFileURL ); + } if (!bExtensionMode && embeddStylesheet.empty()) { std::stringstream aStrStream; @@ -1014,7 +1027,9 @@ int main(int argc, char**argv) exit(1); } sal_uInt32 endtime = osl_getGlobalTimer(); +#ifndef OS2 // YD @TODO@ crashes libc runtime :-( std::cout << "time taken was " << (endtime-starttime)/1000.0 << " seconds" << std::endl; +#endif return 0; } @@ -1053,6 +1068,7 @@ HelpProcessingErrorInfo& HelpProcessingErrorInfo::operator=( const struct HelpPr // Returns true in case of success, false in case of error HELPLINKER_DLLPUBLIC bool compileExtensionHelp ( + const rtl::OUString& aOfficeHelpPath, const rtl::OUString& aExtensionName, const rtl::OUString& aExtensionLanguageRoot, sal_Int32 nXhpFileCount, const rtl::OUString* pXhpFiles, @@ -1095,7 +1111,7 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp try { HelpLinker* pHelpLinker = new HelpLinker(); - pHelpLinker->main( args,&aStdStrExtensionPath ); + pHelpLinker->main( args, &aStdStrExtensionPath, &aOfficeHelpPath ); delete pHelpLinker; } catch( const HelpProcessingException& e ) diff --git a/transex3/source/help/MANIFEST.MF b/transex3/source/help/MANIFEST.MF deleted file mode 100644 index bf0e4ab46cb2..000000000000 --- a/transex3/source/help/MANIFEST.MF +++ /dev/null @@ -1,2 +0,0 @@ -RegistrationClassName: com.sun.star.help.HelpComponent -Class-Path: lucene-core-2.3.jar lucene-analyzers-2.3.jar diff --git a/transex3/source/help/compilehelp.hxx b/transex3/source/help/compilehelp.hxx index 1e9a1c8604b8..d123d628be27 100644 --- a/transex3/source/help/compilehelp.hxx +++ b/transex3/source/help/compilehelp.hxx @@ -71,6 +71,7 @@ struct HelpProcessingErrorInfo // Returns true in case of success, false in case of error HELPLINKER_DLLPUBLIC bool compileExtensionHelp ( + const rtl::OUString& aOfficeHelpPath, const rtl::OUString& aExtensionName, const rtl::OUString& aExtensionLanguageRoot, sal_Int32 nXhpFileCount, const rtl::OUString* pXhpFiles, diff --git a/transex3/source/help/makefile.mk b/transex3/source/help/makefile.mk index edf68d906133..6fc823a1b59a 100644 --- a/transex3/source/help/makefile.mk +++ b/transex3/source/help/makefile.mk @@ -104,36 +104,17 @@ JAVACLASSFILES = \ $(CLASSDIR)$/$(PACKAGE)$/HelpIndexerTool.class \ $(CLASSDIR)$/$(PACKAGE)$/HelpFileDocument.class - -# $(CLASSDIR)$/$(PACKAGE)$/HelpSearch.class \ -# $(CLASSDIR)$/$(PACKAGE)$/HelpIndexer.class \ -# $(CLASSDIR)$/$(PACKAGE)$/HelpComponent.class \ -# $(CLASSDIR)$/$(PACKAGE)$/HelpFileDocument.class - -#JARFILES = ridl.jar jurt.jar unoil.jar juh.jar .IF "$(SYSTEM_LUCENE)" == "YES" CLASSPATH!:=$(CLASSPATH)$(PATH_SEPERATOR)$(LUCENE_CORE_JAR)$(PATH_SEPERATOR)$(LUCENE_ANALYZERS_JAR) -COMP=fix_system_lucene .ELSE JARFILES += lucene-core-2.3.jar lucene-analyzers-2.3.jar .ENDIF JAVAFILES = $(subst,$(CLASSDIR)$/$(PACKAGE)$/, $(subst,.class,.java $(JAVACLASSFILES))) -#JAVAFILES = $(JAVACLASSFILES) JARCLASSDIRS = $(PACKAGE)/* JARTARGET = HelpIndexerTool.jar JARCOMPRESS = TRUE -#CUSTOMMANIFESTFILE = MANIFEST.MF # --- Targets ------------------------------------------------------ .INCLUDE : target.mk - -.IF "$(JARTARGETN)"!="" -$(JARTARGETN) : $(COMP) -.ENDIF - -fix_system_lucene: - @echo "Fix Java Class-Path entry for Lucene libraries from system." - @$(SED) -r -e "s#^(Class-Path:).*#\1 file://$(LUCENE_CORE_JAR) file://$(LUCENE_ANALYZERS_JAR)#" \ - -i ../../$(INPATH)/class/HelpLinker/META-INF/MANIFEST.MF diff --git a/transex3/source/hw2fw.cxx b/transex3/source/hw2fw.cxx deleted file mode 100644 index dd77b8d9210c..000000000000 --- a/transex3/source/hw2fw.cxx +++ /dev/null @@ -1,202 +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: hw2fw.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. - * - ************************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_transex3.hxx" -#include <tools/string.hxx> - -struct hw_pair -{ - sal_Unicode nFrom; - sal_Unicode nTo; -}; - -#define MAKE_PAIR(a,b) { a, b } - -static struct hw_pair aHWPairs[] = -{ - MAKE_PAIR( 0xFF65, 0x30FB ), // HALFWIDTH KATAKANA MIDDLE DOT --> KATAKANA MIDDLE DOT - MAKE_PAIR( 0xFF66, 0x30F2 ), // HALFWIDTH KATAKANA LETTER WO --> KATAKANA LETTER WO - MAKE_PAIR( 0xFF67, 0x30A1 ), // HALFWIDTH KATAKANA LETTER SMALL A --> KATAKANA LETTER SMALL A - MAKE_PAIR( 0xFF68, 0x30A3 ), // HALFWIDTH KATAKANA LETTER SMALL I --> KATAKANA LETTER SMALL I - MAKE_PAIR( 0xFF69, 0x30A5 ), // HALFWIDTH KATAKANA LETTER SMALL U --> KATAKANA LETTER SMALL U - MAKE_PAIR( 0xFF6A, 0x30A7 ), // HALFWIDTH KATAKANA LETTER SMALL E --> KATAKANA LETTER SMALL E - MAKE_PAIR( 0xFF6B, 0x30A9 ), // HALFWIDTH KATAKANA LETTER SMALL O --> KATAKANA LETTER SMALL O - MAKE_PAIR( 0xFF6C, 0x30E3 ), // HALFWIDTH KATAKANA LETTER SMALL YA --> KATAKANA LETTER SMALL YA - MAKE_PAIR( 0xFF6D, 0x30E5 ), // HALFWIDTH KATAKANA LETTER SMALL YU --> KATAKANA LETTER SMALL YU - MAKE_PAIR( 0xFF6E, 0x30E7 ), // HALFWIDTH KATAKANA LETTER SMALL YO --> KATAKANA LETTER SMALL YO - MAKE_PAIR( 0xFF6F, 0x30C3 ), // HALFWIDTH KATAKANA LETTER SMALL TU --> KATAKANA LETTER SMALL TU - MAKE_PAIR( 0xFF70, 0x30FC ), // HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK --> KATAKANA-HIRAGANA PROLONGED SOUND MARK - MAKE_PAIR( 0xFF71, 0x30A2 ), // HALFWIDTH KATAKANA LETTER A --> KATAKANA LETTER A - MAKE_PAIR( 0xFF72, 0x30A4 ), // HALFWIDTH KATAKANA LETTER I --> KATAKANA LETTER I - MAKE_PAIR( 0xFF73, 0x30A6 ), // HALFWIDTH KATAKANA LETTER U --> KATAKANA LETTER U - MAKE_PAIR( 0xFF74, 0x30A8 ), // HALFWIDTH KATAKANA LETTER E --> KATAKANA LETTER E - MAKE_PAIR( 0xFF75, 0x30AA ), // HALFWIDTH KATAKANA LETTER O --> KATAKANA LETTER O - MAKE_PAIR( 0xFF76, 0x30AB ), // HALFWIDTH KATAKANA LETTER KA --> KATAKANA LETTER KA - MAKE_PAIR( 0xFF77, 0x30AD ), // HALFWIDTH KATAKANA LETTER KI --> KATAKANA LETTER KI - MAKE_PAIR( 0xFF78, 0x30AF ), // HALFWIDTH KATAKANA LETTER KU --> KATAKANA LETTER KU - MAKE_PAIR( 0xFF79, 0x30B1 ), // HALFWIDTH KATAKANA LETTER KE --> KATAKANA LETTER KE - MAKE_PAIR( 0xFF7A, 0x30B3 ), // HALFWIDTH KATAKANA LETTER KO --> KATAKANA LETTER KO - MAKE_PAIR( 0xFF7B, 0x30B5 ), // HALFWIDTH KATAKANA LETTER SA --> KATAKANA LETTER SA - MAKE_PAIR( 0xFF7C, 0x30B7 ), // HALFWIDTH KATAKANA LETTER SI --> KATAKANA LETTER SI - MAKE_PAIR( 0xFF7D, 0x30B9 ), // HALFWIDTH KATAKANA LETTER SU --> KATAKANA LETTER SU - MAKE_PAIR( 0xFF7E, 0x30BB ), // HALFWIDTH KATAKANA LETTER SE --> KATAKANA LETTER SE - MAKE_PAIR( 0xFF7F, 0x30BD ), // HALFWIDTH KATAKANA LETTER SO --> KATAKANA LETTER SO - MAKE_PAIR( 0xFF80, 0x30BF ), // HALFWIDTH KATAKANA LETTER TA --> KATAKANA LETTER TA - MAKE_PAIR( 0xFF81, 0x30C1 ), // HALFWIDTH KATAKANA LETTER TI --> KATAKANA LETTER TI - MAKE_PAIR( 0xFF82, 0x30C4 ), // HALFWIDTH KATAKANA LETTER TU --> KATAKANA LETTER TU - MAKE_PAIR( 0xFF83, 0x30C6 ), // HALFWIDTH KATAKANA LETTER TE --> KATAKANA LETTER TE - MAKE_PAIR( 0xFF84, 0x30C8 ), // HALFWIDTH KATAKANA LETTER TO --> KATAKANA LETTER TO - MAKE_PAIR( 0xFF85, 0x30CA ), // HALFWIDTH KATAKANA LETTER NA --> KATAKANA LETTER NA - MAKE_PAIR( 0xFF86, 0x30CB ), // HALFWIDTH KATAKANA LETTER NI --> KATAKANA LETTER NI - MAKE_PAIR( 0xFF87, 0x30CC ), // HALFWIDTH KATAKANA LETTER NU --> KATAKANA LETTER NU - MAKE_PAIR( 0xFF88, 0x30CD ), // HALFWIDTH KATAKANA LETTER NE --> KATAKANA LETTER NE - MAKE_PAIR( 0xFF89, 0x30CE ), // HALFWIDTH KATAKANA LETTER NO --> KATAKANA LETTER NO - MAKE_PAIR( 0xFF8A, 0x30CF ), // HALFWIDTH KATAKANA LETTER HA --> KATAKANA LETTER HA - MAKE_PAIR( 0xFF8B, 0x30D2 ), // HALFWIDTH KATAKANA LETTER HI --> KATAKANA LETTER HI - MAKE_PAIR( 0xFF8C, 0x30D5 ), // HALFWIDTH KATAKANA LETTER HU --> KATAKANA LETTER HU - MAKE_PAIR( 0xFF8D, 0x30D8 ), // HALFWIDTH KATAKANA LETTER HE --> KATAKANA LETTER HE - MAKE_PAIR( 0xFF8E, 0x30DB ), // HALFWIDTH KATAKANA LETTER HO --> KATAKANA LETTER HO - MAKE_PAIR( 0xFF8F, 0x30DE ), // HALFWIDTH KATAKANA LETTER MA --> KATAKANA LETTER MA - MAKE_PAIR( 0xFF90, 0x30DF ), // HALFWIDTH KATAKANA LETTER MI --> KATAKANA LETTER MI - MAKE_PAIR( 0xFF91, 0x30E0 ), // HALFWIDTH KATAKANA LETTER MU --> KATAKANA LETTER MU - MAKE_PAIR( 0xFF92, 0x30E1 ), // HALFWIDTH KATAKANA LETTER ME --> KATAKANA LETTER ME - MAKE_PAIR( 0xFF93, 0x30E2 ), // HALFWIDTH KATAKANA LETTER MO --> KATAKANA LETTER MO - MAKE_PAIR( 0xFF94, 0x30E4 ), // HALFWIDTH KATAKANA LETTER YA --> KATAKANA LETTER YA - MAKE_PAIR( 0xFF95, 0x30E6 ), // HALFWIDTH KATAKANA LETTER YU --> KATAKANA LETTER YU - MAKE_PAIR( 0xFF96, 0x30E8 ), // HALFWIDTH KATAKANA LETTER YO --> KATAKANA LETTER YO - MAKE_PAIR( 0xFF97, 0x30E9 ), // HALFWIDTH KATAKANA LETTER RA --> KATAKANA LETTER RA - MAKE_PAIR( 0xFF98, 0x30EA ), // HALFWIDTH KATAKANA LETTER RI --> KATAKANA LETTER RI - MAKE_PAIR( 0xFF99, 0x30EB ), // HALFWIDTH KATAKANA LETTER RU --> KATAKANA LETTER RU - MAKE_PAIR( 0xFF9A, 0x30EC ), // HALFWIDTH KATAKANA LETTER RE --> KATAKANA LETTER RE - MAKE_PAIR( 0xFF9B, 0x30ED ), // HALFWIDTH KATAKANA LETTER RO --> KATAKANA LETTER RO - MAKE_PAIR( 0xFF9C, 0x30EF ), // HALFWIDTH KATAKANA LETTER WA --> KATAKANA LETTER WA - MAKE_PAIR( 0xFF9D, 0x30F3 ), // HALFWIDTH KATAKANA LETTER N --> KATAKANA LETTER N - MAKE_PAIR( 0xFF9E, 0x3099 ), // HALFWIDTH KATAKANA VOICED SOUND MARK --> COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK - MAKE_PAIR( 0xFF9F, 0x309A ) // HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK --> COMBINING KATAKANA- -}; - - -static struct hw_pair aCombine3099[] = -{ - { 0x30a6, 0x30f4 }, - { 0x30ab, 0x30ac }, - { 0x30ad, 0x30ae }, - { 0x30af, 0x30b0 }, - { 0x30b1, 0x30b2 }, - { 0x30b3, 0x30b4 }, - { 0x30b5, 0x30b6 }, - { 0x30b7, 0x30b8 }, - { 0x30b9, 0x30ba }, - { 0x30bb, 0x30bc }, - { 0x30bd, 0x30be }, - { 0x30bf, 0x30c0 }, - { 0x30c1, 0x30c2 }, - { 0x30c4, 0x30c5 }, - { 0x30c6, 0x30c7 }, - { 0x30c8, 0x30c9 }, - { 0x30cf, 0x30d0 }, - { 0x30d2, 0x30d3 }, - { 0x30d5, 0x30d6 }, - { 0x30d8, 0x30d9 }, - { 0x30db, 0x30dc }, - { 0x30ef, 0x30f7 }, - { 0x30f0, 0x30f8 }, - { 0x30f1, 0x30f9 }, - { 0x30f2, 0x30fa }, - { 0x30fd, 0x30fe } -}; - -static struct hw_pair aCombine309A[] = -{ - { 0x30cf, 0x30d1 }, - { 0x30d2, 0x30d4 }, - { 0x30d5, 0x30d7 }, - { 0x30d8, 0x30da }, - { 0x30db, 0x30dd } -}; - -USHORT ImplReplaceFullWidth( sal_Unicode* pString, USHORT nLen ) -{ - sal_Unicode* pRead = pString; - sal_Unicode* pWrite = pRead; - USHORT nNewLen = nLen; - - while( (pRead - pString) < nLen ) - { - if( pWrite != pRead ) - *pWrite = *pRead; - - if( *pRead >= 0xff65 && *pRead <= 0xff9f ) - { - *pWrite = aHWPairs[ *pRead - 0xff65 ].nTo; - - struct hw_pair* pTable = NULL; - int nTableEntries = 0; - if( *pWrite == 0x3099 ) - { - // replace 0x3099 combinations - pTable = aCombine3099; - nTableEntries = sizeof(aCombine3099)/sizeof(aCombine3099[0]); - } - else if( *pWrite == 0x309a ) - { - // replace 0x309a combinations - pTable = aCombine309A; - nTableEntries = sizeof(aCombine309A)/sizeof(aCombine309A[0]); - } - if( pTable ) - { - sal_Unicode c = pWrite[-1]; - for( int i = 0; i < nTableEntries; i++ ) - if( c == pTable[i].nFrom ) - { - pWrite--; - *pWrite = pTable[i].nTo; - nNewLen--; - break; - } - } - } - pRead++; - pWrite++; - } - if( pWrite < pRead ) - *pWrite = 0; - - return nNewLen; -} - -void ConvertHalfwitdhToFullwidth( String& rString ) -{ - USHORT nNewLen = ImplReplaceFullWidth( rString.GetBufferAccess(), rString.Len() ); - rString.ReleaseBufferAccess( nNewLen ); -} diff --git a/transex3/source/inireader.cxx b/transex3/source/inireader.cxx new file mode 100644 index 000000000000..1ff34fad8e95 --- /dev/null +++ b/transex3/source/inireader.cxx @@ -0,0 +1,132 @@ +#include <unicode/regex.h> +#include <unicode/unistr.h> +#include <string> +#include <fstream> +#include <iostream> +#include "inireader.hxx" + +using namespace std; +namespace transex3 +{ + +bool INIreader::read( INImap& myMap , string& filename ) +{ + ifstream aFStream( filename.c_str() ); + if( aFStream && aFStream.is_open()) + { + string line; + string section; + string param_key; + string param_value; + stringmap* myvalues = 0; + + while( std::getline( aFStream , line ) ) + { + trim( line ); + if( line.empty() ){ + } + else if( is_section( line , section ) ) + { + //cerr << "[" << section << "]\n"; + myvalues = new stringmap(); + myMap[ section ] = myvalues ; + } + else if ( is_parameter( line , param_key , param_value ) ) + { + //cerr << "" << param_key << " = " << param_value << "\n"; + if( myvalues ) + { + (*myvalues)[ param_key ] = param_value ; + } + else + { + cerr << "ERROR: The INI file " << filename << " appears to be broken ... parameters without a section?!?\n"; + if( aFStream.is_open() ) aFStream.close(); + return false; + } + } + } + + if( aFStream.is_open() ) + aFStream.close(); + + return true; + } + else + { + cerr << "ERROR: Can't open file '" << filename << "'\n"; + } + return false; +} + +bool INIreader::is_section( string& line , string& section_str ) +{ + // Error in regex ? + check_status( section_status ); + UnicodeString target( line.c_str() , line.length() ); + + section_match->reset( target ); + check_status( section_status ); + + if( section_match->find() ) + { + check_status( section_status ); + UnicodeString result( section_match->group( 1 , section_status) ); + check_status( section_status ); + toStlString( result , section_str ); + + return true; + } + return false; +} + +bool INIreader::is_parameter( string& line , string& parameter_key , string& parameter_value ) +{ + // Error in regex ? + check_status( parameter_status ); + UnicodeString target( line.c_str() , line.length() ); + + parameter_match->reset( target ); + check_status( parameter_status ); + + if( parameter_match->find() ) + { + check_status( parameter_status ); + + UnicodeString result1( parameter_match->group( 1 , parameter_status) ); + check_status( parameter_status ); + toStlString( result1 , parameter_key ); + UnicodeString result2( parameter_match->group( 2 , parameter_status) ); + check_status( parameter_status ); + toStlString( result2 , parameter_value ); + + return true; + } + return false; +} + +void INIreader::check_status( UErrorCode status ) +{ + if( U_FAILURE( status) ) + { + cerr << "Error in or while using regex: " << u_errorName( status ) << "\n"; + exit(-1); + } +} + +void INIreader::toStlString( const UnicodeString& str , string& stl_str) +{ + // convert to string + char* buffer = new char[ str.length()*3 ]; + str.extract( 0 , str.length() , buffer ); + stl_str = string( buffer ); + delete[] buffer; +} + +void INIreader::trim( string& str ) +{ + string str1 = str.substr( 0 , str.find_last_not_of(' ') + 1 ); + str = str1.empty() ? str1 : str1.substr( str1.find_first_not_of(' ') ); +} + +} diff --git a/transex3/source/localize.cxx b/transex3/source/localize.cxx index bcd45d7027a4..c82d152cac7e 100644 --- a/transex3/source/localize.cxx +++ b/transex3/source/localize.cxx @@ -33,7 +33,11 @@ #include "srciter.hxx" #include "export.hxx" +#include "treeconfig.hxx" +#include <string> +#include <vector> #include <stdio.h> +#include <iostream> #include "tools/errcode.hxx" #include "tools/fsys.hxx" @@ -42,6 +46,8 @@ #include <transex3/file.hxx> #endif +namespace transex3 +{ // // SourceTreeLocalizer @@ -131,7 +137,6 @@ private: ByteString sLanguageRestriction; - ByteString sIsoCode99; ByteString sOutputFile; bool bQuiet2; @@ -147,8 +152,7 @@ private: void WorkOnFile( const ByteString &rFileName, const ByteString &rExecutable, - const ByteString &rParameter, - const ByteString &rIso + const ByteString &rParameter ); void WorkOnFileType( @@ -156,8 +160,7 @@ private: const ByteString &rExtension, const ByteString &rExecutable, const ByteString &rParameter, - const ByteString &rCollectMode, - const ByteString &rIso + const ByteString &rCollectMode ); void WorkOnDirectory( const ByteString &rDirectory ); BOOL ExecuteMerge(); @@ -175,8 +178,6 @@ public: void SetLanguageRestriction( const ByteString& rRestrictions ) { sLanguageRestriction = rRestrictions; } - void SetIsoCode99( const ByteString& rIsoCode ) - { sIsoCode99 = rIsoCode; } int getFileCnt(); BOOL Extract( const ByteString &rDestinationFile ); BOOL Merge( const ByteString &rSourceFile , const ByteString &rOutput ); @@ -215,16 +216,6 @@ const ByteString SourceTreeLocalizer::GetProjectName( BOOL bAbs ) DirEntry aTest = aCur + DirEntry(PRJ_DIR_NAME) + DirEntry(DLIST_NAME); if ( aTest.Exists() ) { - // HACK !!!!!!!!!!!!!!!!!!!!!!!!!!!!! - if (( ByteString( aCur.GetName(), RTL_TEXTENCODING_ASCII_US ).Equals("webinstall") ) || - ( ByteString( aCur.GetName(), RTL_TEXTENCODING_ASCII_US ).Equals("portal") ) || - ( ByteString( aCur.GetName(), RTL_TEXTENCODING_ASCII_US ).Equals("xulclient") ) || - ( ByteString( aCur.GetName(), RTL_TEXTENCODING_ASCII_US ).Search( "wdk_" ) == 0 )) - return ""; - // end HACK !!!!!!!!!!!!!!!!!!!!!!!!! - - - if ( bAbs ) return ByteString( aCur.GetFull(), RTL_TEXTENCODING_ASCII_US ); else @@ -280,10 +271,9 @@ bool skipProject( ByteString sPrj ) /*****************************************************************************/ void SourceTreeLocalizer::WorkOnFile( const ByteString &rFileName, const ByteString &rExecutable, - const ByteString &rParameter, const ByteString &rIso ) + const ByteString &rParameter ) /*****************************************************************************/ { - (void) rIso; // Remove me ;) String sFull( rFileName, RTL_TEXTENCODING_ASCII_US ); DirEntry aEntry( sFull ); ByteString sFileName( aEntry.GetName(), RTL_TEXTENCODING_ASCII_US ); @@ -294,14 +284,10 @@ void SourceTreeLocalizer::WorkOnFile( aPath.SetCWD(); ByteString sPrj( GetProjectName()); - //printf ("prj = %s , exe = %s\n", sPrj.GetBuffer() , rExecutable.GetBuffer() ); -// printf("Skip %s = %d \n",sPrj.GetBuffer() , skipProject( sPrj ) ); - //printf("prj = %s\n",sPrj.GetBuffer()); if ( sPrj.Len() && !skipProject( sPrj ) ) { ByteString sRoot( GetProjectRootRel()); - // get temp file DirEntry aTemp( Export::GetTempFile()); ByteString sTempFile( aTemp.GetFull(), RTL_TEXTENCODING_ASCII_US ); @@ -345,7 +331,8 @@ void SourceTreeLocalizer::WorkOnFile( sCommand +=" -QQ "; } //printf("DBG: %s\n",sCommand.GetBuffer()); - system( sCommand.GetBuffer()); + if (system(sCommand.GetBuffer()) == -1) + fprintf(stderr, "%s failed\n", sCommand.GetBuffer()); nFileCnt++; printf("."); fflush( stdout ); @@ -441,7 +428,7 @@ BOOL SourceTreeLocalizer::CheckPositiveList( const ByteString &rFileName ) void SourceTreeLocalizer::WorkOnFileType( const ByteString &rDirectory, const ByteString &rExtension, const ByteString &rExecutable, const ByteString &rParameter, - const ByteString &rCollectMode, const ByteString &rIso + const ByteString &rCollectMode ) /*****************************************************************************/ { @@ -465,7 +452,7 @@ void SourceTreeLocalizer::WorkOnFileType( bAllowed = CheckPositiveList( sFile ); if ( bAllowed ) - WorkOnFile( sFile, rExecutable, rParameter, rIso ); + WorkOnFile( sFile, rExecutable, rParameter ); } } @@ -479,7 +466,6 @@ void SourceTreeLocalizer::WorkOnDirectory( const ByteString &rDirectory ) ByteString sExecutable( ExeTable[ nIndex ][ 1 ] ); ByteString sParameter( ExeTable[ nIndex ][ 2 ] ); ByteString sCollectMode( ExeTable[ nIndex ][ 3 ] ); - ByteString sIso( ExeTable[ nIndex ][ 4 ] ); while( !sExtension.Equals( "NULL" )) { WorkOnFileType( @@ -487,8 +473,7 @@ void SourceTreeLocalizer::WorkOnDirectory( const ByteString &rDirectory ) sExtension, sExecutable, sParameter, - sCollectMode, - sIso + sCollectMode ); nIndex++; @@ -497,7 +482,6 @@ void SourceTreeLocalizer::WorkOnDirectory( const ByteString &rDirectory ) sExecutable = ExeTable[ nIndex ][ 1 ]; sParameter = ExeTable[ nIndex ][ 2 ]; sCollectMode = ExeTable[ nIndex ][ 3 ]; - sIso = ExeTable[ nIndex ][ 4 ]; } } @@ -516,12 +500,13 @@ BOOL SourceTreeLocalizer::Extract( const ByteString &rDestinationFile ) /*****************************************************************************/ { nMode = LOCALIZE_EXTRACT; - aSDF.Open( String( rDestinationFile, RTL_TEXTENCODING_ASCII_US ), - STREAM_STD_WRITE | STREAM_TRUNC ); + + aSDF.Open( String( rDestinationFile , RTL_TEXTENCODING_ASCII_US ) , STREAM_STD_WRITE ); aSDF.SetLineDelimiter( LINEEND_CRLF ); BOOL bReturn = aSDF.IsOpen(); if ( bReturn ) { + aSDF.Seek( STREAM_SEEK_TO_END ); bReturn = StartExecute(); aSDF.Close(); } @@ -529,6 +514,7 @@ BOOL SourceTreeLocalizer::Extract( const ByteString &rDestinationFile ) printf("ERROR: Can't create file %s\n", rDestinationFile.GetBuffer() ); } nMode = LOCALIZE_NONE; + aSDF.Close(); return bReturn; } @@ -568,8 +554,6 @@ BOOL SourceTreeLocalizer::MergeSingleFile( while( !sCandidate.Equals ("NULL") && !sCandidate.Equals(sExtension) ) sCandidate = ExeTable[ ++nIndex ][ 0 ]; - ByteString sIso( ExeTable[ nIndex ][ 4 ] ); - if ( !sCandidate.Equals( "NULL" ) ) { if( !aEntry.Exists()) { DirEntryKind theDir=FSYS_KIND_FILE; @@ -605,10 +589,6 @@ BOOL SourceTreeLocalizer::MergeSingleFile( sCommand += sOutput; sCommand += " "; sCommand += ByteString( ExeTable[ nIndex ][ 2 ] ); - if ( sIso.Equals( "iso" ) && sIsoCode99.Len()) { - sCommand += " -ISO99 "; - sCommand += sIsoCode99; - } if ( sLanguageRestriction.Len()) { sCommand += " -l "; sCommand += sLanguageRestriction; @@ -621,7 +601,8 @@ BOOL SourceTreeLocalizer::MergeSingleFile( DirEntry aOldCWD; aPath.SetCWD(); - system( sCommand.GetBuffer()); + if (system(sCommand.GetBuffer()) == -1) + fprintf(stderr, "%s failed\n", sCommand.GetBuffer()); nFileCnt++; printf("."); //if( bQuiet2 ){ printf("."); } @@ -705,7 +686,6 @@ BOOL SourceTreeLocalizer::ExecuteMerge( ) ByteString sBDel( sDel.GetBuffer() , sDel.Len() , RTL_TEXTENCODING_UTF8 ); if( bLocal ){ xub_StrLen nPos = sOutputFileName.SearchBackward( sBDel.GetChar(0) ); - //if( nPos >= 0 ) sOutputFileName = sOutputFileName.Copy( nPos+1 , sOutputFileName.Len()-nPos-1 ); } ByteStringBoolHashMap aFileHM; @@ -718,7 +698,6 @@ BOOL SourceTreeLocalizer::ExecuteMerge( ) aFileHM[sFileName]=true; } - // RECODE THIS !!!!!!!!!!!!!!!!!!!!! for( ByteStringBoolHashMap::iterator iter = aFileHM.begin(); iter != aFileHM.end(); ++iter ){ sFileKey = iter->first; aSDF.Seek( 0 ); @@ -755,7 +734,6 @@ BOOL SourceTreeLocalizer::ExecuteMerge( ) bMerged = true; if ( !MergeSingleFile( sPrj, sFile, sSDFFile )) bReturn = FALSE; - //} }else{ bMerged = true; //printf("MergeSingleFile('%s','%s','%s')\n",sPrj.GetBuffer(),sFile.GetBuffer(),sSDFFile.GetBuffer()); @@ -764,7 +742,6 @@ BOOL SourceTreeLocalizer::ExecuteMerge( ) } } } - //} aEntry.Kill(); // If Outputfile not included in the SDF file copy it without merge @@ -791,13 +768,15 @@ BOOL SourceTreeLocalizer::Merge( const ByteString &rSourceFile , const ByteStrin BOOL bReturn = aSDF.IsOpen(); if ( bReturn ) { bReturn = ExecuteMerge(); - aSDF.Close(); +// aSDF.Close(); } - + aSDF.Close(); nMode = LOCALIZE_NONE; return bReturn; } +} +using namespace transex3; #define STATE_NONE 0x0000 #define STATE_EXPORT 0x0001 @@ -817,13 +796,11 @@ void Help() fprintf( stdout, "As part of the L10N framework, localize extracts and merges translations\n" "out of and into the whole source tree.\n\n" - "Syntax: localize -e|-m -l l1[=f1][,l2[=f2]][...] -f FileName [-QQ][-skip_links]\n" + "Syntax: localize -e -l en-US -f FileName [-QQ]\n" "Parameter:\n" "\t-e: Extract mode\n" - "\t-m: Merge mode\n" "\tFileName: Output file when extract mode, input file when merge mode\n" "\tl1...ln: supported languages (\"all\" for all languages).\n" - "\tf1...fn: fallback languages for supported languages\n" "\tQQ: quiet output)" ); @@ -832,16 +809,9 @@ void Help() fprintf( stdout, "\nExample 1:\n" "==========\n" - "localize -e -l en-US,de -f MyFile\n\n" + "localize -e -l en-US -f MyFile\n\n" "All strings will be extracted for language de and language en-US.\n" ); - fprintf( stdout, - "\nExample 2:\n" - "==========\n" - "localize -m -l es -f MyFile\n\n" - "All strings in MyFile will be merged into language es in the\n" - "source code.\n" - ); } /*****************************************************************************/ @@ -878,11 +848,13 @@ int _cdecl main( int argc, char *argv[] ) bool bQuiet2 = false; bool bSkipLinks = false; - ByteString sIsoCode; ByteString sLanguages; ByteString sFileName; ByteString sOutput; + bQuiet2 = true; + bExport = TRUE; + for( int i = 1; i < argc; i++ ) { ByteString sSwitch( argv[ i ] ); sSwitch.ToUpperAscii(); @@ -893,12 +865,6 @@ int _cdecl main( int argc, char *argv[] ) return Error(); bExport = TRUE; } - else if ( sSwitch.Equals( "-M" )) { - nState = STATE_MERGE; - if ( bExport ) - return Error(); - bMerge = TRUE; - } else if( sSwitch.Equals( "-Q" )) { bQuiet = true; } @@ -910,20 +876,12 @@ int _cdecl main( int argc, char *argv[] ) nState = STATE_FILENAME; else if ( sSwitch.Equals( "-QQ" )) bQuiet2 = true; - // else if ( ByteString( argv[ i ]).ToUpperAscii().Equals( "-SKIP_LINKS" )) - // bSkipLinks = true; else if ( ByteString( argv[ i ]).ToUpperAscii().Equals( "-O" ) ) nState = STATE_OUTPUT; else { switch ( nState ) { case STATE_NONE: return Error(); - case STATE_ISOCODE: - if ( sIsoCode.Len()) - return Error(); - sIsoCode = ByteString( argv[ i ] ); - nState = STATE_NONE; - break; case STATE_OUTPUT: if ( sOutput.Len()) return Error(); @@ -952,12 +910,10 @@ int _cdecl main( int argc, char *argv[] ) return 1; } - ByteString sRoot( Export::GetEnv( "SRC_ROOT" )); - DirEntry aRoot( String( sRoot, RTL_TEXTENCODING_ASCII_US )); - sRoot = ByteString( aRoot.GetFull(), RTL_TEXTENCODING_ASCII_US ); + ByteString sSolarVer( Export::GetEnv( "WORK_STAMP" )); ByteString sVersion( Export::GetEnv( "WORK_STAMP" )); - if ( !sRoot.Len() || !sVersion.Len()) { + if ( !sSolarVer.Len() || !sVersion.Len()) { fprintf( stderr, "ERROR: No environment set!\n" ); return 1; } @@ -970,55 +926,46 @@ int _cdecl main( int argc, char *argv[] ) return 3; } - ByteString sMode( "merge" ); - if ( bExport ) - sMode = "extract"; - - ByteString sICode( sIsoCode ); - if ( !sICode.Len()) - sICode = "not given, support for language 99 disabled"; - if(!bQuiet && !bQuiet2 ){ - fprintf( stdout, - "\n" - "============================================================\n" - "Current settings:\n" - "============================================================\n" - "Mode: %s\n" - "Workspace: %s\n" - "Source tree: %s\n" - "Languages: %s\n" - "ISO code (99): %s\n" - "Filename: %s\n" - "Outputfile %s\n" - "============================================================\n" - "\n" - , - sMode.GetBuffer(), - sVersion.GetBuffer(), - sRoot.GetBuffer(), - sLanguages.GetBuffer(), - sICode.GetBuffer(), - sFileName.GetBuffer(), - sOutput.GetBuffer() - ); - } - SourceTreeLocalizer aIter( sRoot, sVersion , (sOutput.Len() > 0) , bQuiet2 , bSkipLinks ); - - aIter.SetLanguageRestriction( sLanguages ); - aIter.SetIsoCode99( sIsoCode ); - if ( bExport ){ - if( bQuiet2 ){ /*printf("");*/fflush( stdout );} - aIter.Extract( sFileName ); - if( bQuiet2 ){ printf("\n %d files found!\n",aIter.GetFileCnt());} + DirEntry aEntry( String( sFileName , RTL_TEXTENCODING_ASCII_US )); + aEntry.ToAbs(); + String sFullEntry = aEntry.GetFull(); + ByteString sFileABS( aEntry.GetFull(), gsl_getSystemTextEncoding()); + //printf("B %s\nA %s\n",rDestinationFile.GetBuffer(), sFile.GetBuffer()); + sFileName = sFileABS; + + Treeconfig treeconfig; + vector<string> repos; + bool hasPwd = treeconfig.getActiveRepositories( repos ); + if( hasPwd ) cout << "Found special path!\n"; + + // localize through all repositories + for( vector<string>::iterator iter = repos.begin(); iter != repos.end() ; ++iter ) + { + string curRepository = string( Export::GetEnv("SOURCE_ROOT_DIR") ) + "/" + *iter; + cout << "Localizing repository " << curRepository << "\n"; + SourceTreeLocalizer aIter( ByteString( curRepository.c_str() ) , sVersion , (sOutput.Len() > 0) , bQuiet2 , bSkipLinks ); + aIter.SetLanguageRestriction( sLanguages ); + if ( bExport ){ + if( bQuiet2 ){ /*printf("");*/fflush( stdout );} + aIter.Extract( sFileName ); + if( bQuiet2 ){ printf("\n %d files found!\n",aIter.GetFileCnt());} + } } - else { + if( hasPwd ) + { + string pwd; + Export::getCurrentDir( pwd ); + cout << "Localizing repository " << pwd << "\n"; + SourceTreeLocalizer aIter( ByteString( pwd.c_str() ) , sVersion , (sOutput.Len() > 0) , bQuiet2 , bSkipLinks ); + aIter.SetLanguageRestriction( sLanguages ); + if ( bExport ){ + if( bQuiet2 ){ /*printf("");*/fflush( stdout );} + aIter.Extract( sFileName ); + if( bQuiet2 ){ printf("\n %d files found!\n",aIter.GetFileCnt());} + } - DirEntry aEntry( String( sFileName, RTL_TEXTENCODING_ASCII_US )); - if ( !aEntry.Exists()) - return FALSE; - printf("%s\n",sFileName.GetBuffer()); - aIter.Merge( sFileName , sOutput ); } return 0; } + diff --git a/transex3/source/makefile.mk b/transex3/source/makefile.mk index 68b94a5b58fa..a557b210aad0 100644 --- a/transex3/source/makefile.mk +++ b/transex3/source/makefile.mk @@ -61,8 +61,8 @@ OBJFILES= \ $(OBJ)$/helpmerge.obj \ $(OBJ)$/helpex.obj \ $(OBJ)$/file.obj \ - $(OBJ)$/directory.obj \ - $(OBJ)$/hw2fw.obj + $(OBJ)$/directory.obj + LIB1TARGET= $(LB)$/$(TARGET).lib LIB1ARCHIV= $(LB)$/libtransex.a @@ -73,8 +73,8 @@ LIB1OBJFILES= $(OBJ)$/export.obj \ $(OBJ)$/srciter.obj \ $(OBJ)$/file.obj \ $(OBJ)$/directory.obj \ - $(OBJ)$/utf8conv.obj \ - $(OBJ)$/hw2fw.obj + $(OBJ)$/utf8conv.obj + APP1VERSIONMAP=exports.map @@ -96,7 +96,7 @@ APP1LIBS+= $(LB)$/$(TARGET).lib APP1DEPN= $(OBJ)$/src_yy_wrapper.obj $(LB)$/$(TARGET).lib APP2TARGET= helpex -APP2OBJS= $(OBJ)$/helpmerge.obj $(OBJ)$/xmlparse.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj $(OBJ)$/merge.obj $(OBJ)$/helpex.obj $(OBJ)$/hw2fw.obj +APP2OBJS= $(OBJ)$/helpmerge.obj $(OBJ)$/xmlparse.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj $(OBJ)$/merge.obj $(OBJ)$/helpex.obj APP2RPATH= NONE .IF "$(OS)"!="MACOSX" @@ -110,7 +110,7 @@ APP2STDLIBS+=$(SALLIB) $(EXPATASCII3RDLIB) $(TOOLSLIB) $(VOSLIB) # extractor and merger for *.lng and *.lng APP3TARGET= ulfex -APP3OBJS= $(OBJ)$/lngmerge.obj $(OBJ)$/hw2fw.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/lngex.obj $(OBJ)$/utf8conv.obj +APP3OBJS= $(OBJ)$/lngmerge.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/lngex.obj $(OBJ)$/utf8conv.obj APP3RPATH= NONE .IF "$(OS)"!="MACOSX" @@ -142,7 +142,7 @@ APP5STDLIBS+= \ # extractor and merger for *.cfg APP6TARGET= cfgex -APP6OBJS= $(OBJ)$/cfgmerge.obj $(OBJ)$/cfg_yy_wrapper.obj $(OBJ)$/hw2fw.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj +APP6OBJS= $(OBJ)$/cfgmerge.obj $(OBJ)$/cfg_yy_wrapper.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj .IF "$(OS)"!="MACOSX" #APP6STDLIBS+= $(BTSTRPLIB) @@ -159,7 +159,7 @@ APP6STDLIBS+= \ # extractor and merger for *.xrm APP7TARGET= xrmex -APP7OBJS= $(OBJ)$/xrmmerge.obj $(OBJ)$/xrm_yy_wrapper.obj $(OBJ)$/hw2fw.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj +APP7OBJS= $(OBJ)$/xrmmerge.obj $(OBJ)$/xrm_yy_wrapper.obj $(OBJ)$/merge.obj $(OBJ)$/export2.obj $(OBJ)$/utf8conv.obj APP7RPATH= NONE .IF "$(OS)"!="MACOSX" @@ -174,21 +174,23 @@ APP7STDLIBS+= \ # static libs at end for OS X .ENDIF -# encoding converter for text files -APP8TARGET= txtconv -#APP8STACK= 16000 -APP8OBJS= $(OBJ)$/utf8conv.obj $(OBJ)$/txtconv.obj $(OBJ)$/hw2fw.obj -APP8STDLIBS=$(TOOLSLIB) $(SALLIB) +# +#APP8TARGET= treeconfig +#APP8OBJS= $(OBJ)$/treeconfig.obj $(OBJ)$/inireader.obj $(OBJ)$/export2.obj +#APP8STDLIBS=$(TOOLSLIB) $(SALLIB) $(VOSLIB) $(ICUINLIB) $(STLPORT) # localizer for l10n framework APP9TARGET= localize_sl EXCEPTIONSFILES= \ $(OBJ)$/localize.obj -APP9OBJS= $(OBJ)$/localize.obj $(OBJ)$/utf8conv.obj $(OBJ)$/srciter.obj $(OBJ)$/export2.obj $(OBJ)$/file.obj $(OBJ)$/directory.obj +APP9OBJS= $(OBJ)$/localize.obj $(OBJ)$/utf8conv.obj $(OBJ)$/srciter.obj $(OBJ)$/export2.obj $(OBJ)$/file.obj $(OBJ)$/directory.obj $(OBJ)$/treeconfig.obj $(OBJ)$/inireader.obj APP9STDLIBS+= \ $(TOOLSLIB) \ $(VOSLIB) \ + $(ICUINLIB) \ + $(ICUUCLIB) \ + $(STLPORTLIB) \ $(SALLIB) DEPOBJFILES=$(APP1OBJS) $(APP2OBJS) $(APP3OBJS) $(APP4OBJS) $(APP5OBJS) $(APP6OBJS) $(APP7OBJS) $(APP8OBJS) $(APP9OBJS) diff --git a/transex3/source/treeconfig.cxx b/transex3/source/treeconfig.cxx new file mode 100644 index 000000000000..137492c39a50 --- /dev/null +++ b/transex3/source/treeconfig.cxx @@ -0,0 +1,128 @@ +#include <vector> +#include <string> +#include <iostream> +#include "treeconfig.hxx" +#include "export.hxx" +#ifdef WNT +#include <direct.h> +#include <io.h> +#else +#include <dirent.h> +#endif +#include <sys/stat.h> +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> + +using namespace std; + +namespace transex3 +{ + +bool Treeconfig::parseConfig(){ + + string source_config_file = string( static_cast<ByteString>( Export::GetEnv("SOURCE_ROOT_DIR") ).GetBuffer() ); + if( source_config_file.empty() ) + { + cerr << "Error: no suitable environment set?!?"; + exit( -1 ); + } + source_config_file += string("/source_config"); + if( isConfigFilePresent() ) + { + inireader.read( map , source_config_file ); + return true; + } + else return false; +} + +// ALWAYS add all repositories from source_config file to the container active_repos +// if a config_file is present ALWAYS return false +// if you are in the root of a repository also add it to the container active_repos +// if you are far inside a repository /my/path/ooo/sw/source then don't add it to the container but return true +// if you are in some misc place like /tmp then return true +// => the application can decide what to do in case the function returns true thus how to handle pwd() path +bool Treeconfig::getActiveRepositories( vector<string>& active_repos ){ + + bool isPresent = isConfigFilePresent(); + bool hasPath = false; + string pwd; + string guessedRepo; + Export::getCurrentDir( pwd ); + string source_root = Export::GetEnv( "SOURCE_ROOT_DIR" ); + string solarsrc = Export::GetEnv( "SOLARSRC" ); + string partial; + + // if we are inside of a repository root then active it otherwise let the app handle the return! + string::size_type pos = pwd.find_first_of( source_root ); + if( pos != string::npos && ( pos + source_root.length() +1 ) < pwd.length()){ // I am within SOURCE_ROOT_DIR + partial = pwd.substr( pos + source_root.length() +1 , pwd.length()); + string::size_type nextPart = partial.find_first_of( "/" ); + if( nextPart != string::npos ) + hasPath = true; + else + guessedRepo = partial; + } + else // I am NOT within SOURCE_ROOT_DIR + hasPath = true; + + if( isPresent ) + { + hasPath = false; // if config_file is present don't care about pwd + stringmap* repos = static_cast<stringmap*>( map[ string("repositories") ] ); + if( repos != 0 ) + { + for( stringmap::iterator iter = repos->begin() ; iter != repos->end() ; ++iter ) + { + if( static_cast<string>( iter->second ) == string( "active" ) ) + { + active_repos.push_back( iter->first ); + if( static_cast<string>( iter->first ) == guessedRepo ) + { + guessedRepo.clear(); // don't add double in case it is present in config_file + } + } + } + } + else + { + cerr << "Error: source_config files doesn't contain a 'repositories' section ?!?"; + exit( -1 ); + } + } + if( !guessedRepo.empty() ){ + active_repos.push_back( guessedRepo ); // add myrepo + } + return hasPath; // are we deep inside of a source tree or outside of SOURCE_ROOT_DIR? +} + +void Treeconfig::getCurrentDir( string& dir ) +{ + char buffer[64000]; + if( getcwd( buffer , sizeof( buffer ) ) == 0 ){ + cerr << "Error: getcwd failed!\n"; + exit( -1 ); + } + dir = string( buffer ); +} + +bool Treeconfig::isConfigFilePresent() +{ + string config_file = Export::GetEnv( "SOURCE_ROOT_DIR" ); + config_file += "/source_config"; + + struct stat status; + if( stat( config_file.c_str() , &status ) < 0 ) + { + return false; + } +#ifdef WNT + return ( status.st_mode & _S_IFREG ) && ( _access( config_file.c_str() , 4 ) >= 0 ) ; +#else + return ( status.st_mode & S_IFREG ) && ( access( config_file.c_str() , R_OK ) >= 0 ) ; +#endif +} + + + +} diff --git a/transex3/source/txtconv.cxx b/transex3/source/txtconv.cxx deleted file mode 100644 index 2f442b80a83d..000000000000 --- a/transex3/source/txtconv.cxx +++ /dev/null @@ -1,168 +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: txtconv.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_transex3.hxx" -#include <stdio.h> -#include <tools/fsys.hxx> -#include <tools/stream.hxx> - -// local includes -#include "utf8conv.hxx" - -extern void ConvertHalfwitdhToFullwidth( String& rString ); - -/*****************************************************************************/ -void Help() -/*****************************************************************************/ -{ - fprintf( stdout, "\n" ); - fprintf( stdout, "txtconv (c)2001 by StarOffice Entwicklungs GmbH\n" ); - fprintf( stdout, "===============================================\n" ); - fprintf( stdout, "\n" ); - fprintf( stdout, "txtconv converts textfiles from or to UTF-8\n" ); - fprintf( stdout, "\n" ); - fprintf( stdout, "Syntax: txtconv -t|-f charset filename (destinationfile)\n" ); - fprintf( stdout, "Switches: -t => conversion from charset to UTF-8\n" ); - fprintf( stdout, " -f => conversion from UTF-8 to charset\n" ); - fprintf( stdout, "\n" ); - fprintf( stdout, "Allowed charsets:\n" ); - fprintf( stdout, " MS_932 => Japanese\n" ); - fprintf( stdout, " MS_936 => Chinese Simplified\n" ); - fprintf( stdout, " MS_949 => Korean\n" ); - fprintf( stdout, " MS_950 => Chinese Traditional\n" ); - fprintf( stdout, " MS_1250 => East Europe\n" ); - fprintf( stdout, " MS_1251 => Cyrillic\n" ); - fprintf( stdout, " MS_1252 => West Europe\n" ); - fprintf( stdout, " MS_1253 => Greek\n" ); - fprintf( stdout, " MS_1254 => Turkish\n" ); - fprintf( stdout, " MS_1255 => Hebrew\n" ); - fprintf( stdout, " MS_1256 => Arabic\n" ); - fprintf( stdout, " HW2FW => Only with -t, converts half to full width katakana" ); - fprintf( stdout, "\n" ); -} - -/*****************************************************************************/ -#if defined(UNX) || defined(OS2) -int main( int argc, char *argv[] ) -#else -int _cdecl main( int argc, char *argv[] ) -#endif -/*****************************************************************************/ -{ - if (( argc != 4 ) && ( argc != 5 )) { - Help(); - exit ( 0 ); - } - - if ( ByteString( argv[ 1 ] ) == "-t" || ByteString( argv[ 1 ] ) == "-f" ) { - rtl_TextEncoding nEncoding = RTL_TEXTENCODING_MS_1252; - - BOOL bHW2FW = FALSE; - - ByteString sCharset( argv[ 2 ] ); - sCharset.ToUpperAscii(); - - if ( sCharset == "MS_932" ) nEncoding = RTL_TEXTENCODING_MS_932; - else if ( sCharset == "MS_936" ) nEncoding = RTL_TEXTENCODING_MS_936; - else if ( sCharset == "MS_949" ) nEncoding = RTL_TEXTENCODING_MS_949; - else if ( sCharset == "MS_950" ) nEncoding = RTL_TEXTENCODING_MS_950; - else if ( sCharset == "MS_1250" ) nEncoding = RTL_TEXTENCODING_MS_1250; - else if ( sCharset == "MS_1251" ) nEncoding = RTL_TEXTENCODING_MS_1251; - else if ( sCharset == "MS_1252" ) nEncoding = RTL_TEXTENCODING_MS_1252; - else if ( sCharset == "MS_1253" ) nEncoding = RTL_TEXTENCODING_MS_1253; - else if ( sCharset == "MS_1254" ) nEncoding = RTL_TEXTENCODING_MS_1254; - else if ( sCharset == "MS_1255" ) nEncoding = RTL_TEXTENCODING_MS_1255; - else if ( sCharset == "MS_1256" ) nEncoding = RTL_TEXTENCODING_MS_1256; - else if ( sCharset == "MS_1257" ) nEncoding = RTL_TEXTENCODING_MS_1257; - else if (( sCharset == "HW2FW" ) && ( ByteString( argv[ 1 ] ) == "-t" )) bHW2FW = TRUE; - - else { - Help(); - exit ( 1 ); - } - - DirEntry aSource = DirEntry( String( argv[ 3 ], RTL_TEXTENCODING_ASCII_US )); - if ( !aSource.Exists()) { - fprintf( stderr, "\nERROR: File %s not found!\n\n", ByteString( argv[ 3 ] ).GetBuffer()); - exit ( 2 ); - } - - String sOutput; - SvFileStream aOutput; - if ( argc == 5 ) { - sOutput= String( argv[ 4 ], RTL_TEXTENCODING_ASCII_US ); - aOutput.Open( sOutput, STREAM_STD_WRITE | STREAM_TRUNC ); - if ( !aOutput.IsOpen()) { - fprintf( stderr, "\nERROR: Could not open output file %s!\n\n", argv[ 4 ]); - exit ( 3 ); - } - } - - String sGSI( argv[ 3 ], RTL_TEXTENCODING_ASCII_US ); - SvFileStream aGSI( sGSI, STREAM_STD_READ ); - if ( !aGSI.IsOpen()) { - fprintf( stderr, "\nERROR: Could not open input file %s!\n\n", argv[ 3 ]); - exit ( 3 ); - } - - ByteString sGSILine; - while ( !aGSI.IsEof()) { - - aGSI.ReadLine( sGSILine ); - if ( bHW2FW ) { - String sConverter( sGSILine, RTL_TEXTENCODING_UTF8 ); - ConvertHalfwitdhToFullwidth( sConverter ); - sGSILine = ByteString( sConverter, RTL_TEXTENCODING_UTF8 ); - } - else { - if ( ByteString( argv[ 1 ] ) == "-t" ) - sGSILine = UTF8Converter::ConvertToUTF8( sGSILine, nEncoding ); - else - sGSILine = UTF8Converter::ConvertFromUTF8( sGSILine, nEncoding ); - } - - if ( aOutput.IsOpen()) - aOutput.WriteLine( sGSILine ); - else - fprintf( stdout, "%s\n", sGSILine.GetBuffer()); - } - - aGSI.Close(); - if ( aOutput.IsOpen()) - aOutput.Close(); - } - else { - Help(); - exit( 1 ); - } - - return 0; -} diff --git a/transex3/source/xrmmerge.cxx b/transex3/source/xrmmerge.cxx index 4daf94e2357a..f1b3d4d6cb5a 100644 --- a/transex3/source/xrmmerge.cxx +++ b/transex3/source/xrmmerge.cxx @@ -163,10 +163,6 @@ extern char *GetOutputFile( int argc, char* argv[]) Export::sLanguages = ByteString( argv[ i ]); } break; - case STATE_ISOCODE99: { - Export::sIsoCode99 = ByteString( argv[ i ]); - } - break; } } } diff --git a/svtools/inc/svtools/accelcfg.hxx b/unotools/inc/unotools/accelcfg.hxx index 24894c46c535..70a0d26545f5 100644 --- a/svtools/inc/svtools/accelcfg.hxx +++ b/unotools/inc/unotools/accelcfg.hxx @@ -27,11 +27,11 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_ACCELCFG_HXX -#define INCLUDED_SVTOOLS_ACCELCFG_HXX +#ifndef INCLUDED_unotools_ACCELCFG_HXX +#define INCLUDED_unotools_ACCELCFG_HXX #include <com/sun/star/awt/KeyEvent.hpp> -#include <svtools/options.hxx> +#include <unotools/options.hxx> #include <rtl/ustring.hxx> #include <tools/stream.hxx> @@ -51,7 +51,7 @@ class KeyEvent; class String; class SvtAcceleratorConfig_Impl; -class SvtAcceleratorConfiguration: public svt::detail::Options +class SvtAcceleratorConfiguration: public utl::detail::Options { SvtAcceleratorConfig_Impl* pImp; diff --git a/svtools/inc/cacheoptions.hxx b/unotools/inc/unotools/cacheoptions.hxx index 0dd1d2eaaf6d..a9adf9a14467 100644 --- a/svtools/inc/cacheoptions.hxx +++ b/unotools/inc/unotools/cacheoptions.hxx @@ -28,14 +28,14 @@ * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_CACHEOPTIONS_HXX -#define INCLUDED_SVTOOLS_CACHEOPTIONS_HXX +#ifndef INCLUDED_unotools_CACHEOPTIONS_HXX +#define INCLUDED_unotools_CACHEOPTIONS_HXX //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <sal/types.h> #include <osl/mutex.hxx> #include <rtl/ustring.hxx> @@ -67,7 +67,7 @@ class SvtCacheOptions_Impl; @devstatus ready to use *//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtCacheOptions +class UNOTOOLS_DLLPUBLIC SvtCacheOptions { //------------------------------------------------------------------------------------------------------------- // public methods @@ -152,7 +152,7 @@ class SVL_DLLPUBLIC SvtCacheOptions @onerror - *//*-*****************************************************************************************************/ - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); //------------------------------------------------------------------------------------------------------------- // private member @@ -173,4 +173,4 @@ class SVL_DLLPUBLIC SvtCacheOptions }; -#endif // #ifndef INCLUDED_SVTOOLS_CACHEOPTIONS_HXX +#endif // #ifndef INCLUDED_unotools_CACHEOPTIONS_HXX diff --git a/svtools/inc/svtools/cmdoptions.hxx b/unotools/inc/unotools/cmdoptions.hxx index 9feb2508982b..85d8a0725f3c 100644 --- a/svtools/inc/svtools/cmdoptions.hxx +++ b/unotools/inc/unotools/cmdoptions.hxx @@ -27,20 +27,20 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_CMDOPTIONS_HXX -#define INCLUDED_SVTOOLS_CMDOPTIONS_HXX +#ifndef INCLUDED_unotools_CMDOPTIONS_HXX +#define INCLUDED_unotools_CMDOPTIONS_HXX //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <sal/types.h> #include <osl/mutex.hxx> #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/frame/XFrame.hpp> #include <rtl/ustring.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> //_________________________________________________________________________________________________________________ // types, enums, ... @@ -79,7 +79,7 @@ class SvtCommandOptions_Impl; @devstatus ready to use *//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtCommandOptions: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtCommandOptions: public utl::detail::Options { friend class SvtCommandOptions_Impl; @@ -234,7 +234,7 @@ class SVL_DLLPUBLIC SvtCommandOptions: public svt::detail::Options @onerror - *//*-*****************************************************************************************************/ - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); //------------------------------------------------------------------------------------------------------------- // private member @@ -255,4 +255,4 @@ class SVL_DLLPUBLIC SvtCommandOptions: public svt::detail::Options }; // class SvtCmdOptions -#endif // #ifndef INCLUDED_SVTOOLS_CMDOPTIONS_HXX +#endif // #ifndef INCLUDED_unotools_CMDOPTIONS_HXX diff --git a/svtools/inc/svtools/compatibility.hxx b/unotools/inc/unotools/compatibility.hxx index 2337980d3707..0c7c41882c09 100644 --- a/svtools/inc/svtools/compatibility.hxx +++ b/unotools/inc/unotools/compatibility.hxx @@ -27,19 +27,19 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_COMPATIBILITY_HXX -#define INCLUDED_SVTOOLS_COMPATIBILITY_HXX +#ifndef INCLUDED_unotools_COMPATIBILITY_HXX +#define INCLUDED_unotools_COMPATIBILITY_HXX //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <sal/types.h> #include <osl/mutex.hxx> #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/beans/PropertyValue.hpp> -#include <svtools/options.hxx> +#include <unotools/options.hxx> //_________________________________________________________________________________________________________________ // types, enums, ... @@ -107,7 +107,7 @@ class SvtCompatibilityOptions_Impl; @devstatus ready to use *//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtCompatibilityOptions: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtCompatibilityOptions: public utl::detail::Options { //------------------------------------------------------------------------------------------------------------- // public methods @@ -231,7 +231,7 @@ class SVL_DLLPUBLIC SvtCompatibilityOptions: public svt::detail::Options @onerror - *//*-*****************************************************************************************************/ - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); //------------------------------------------------------------------------------------------------------------- // private member @@ -252,5 +252,5 @@ class SVL_DLLPUBLIC SvtCompatibilityOptions: public svt::detail::Options }; // class SvtCompatibilityOptions -#endif // #ifndef INCLUDED_SVTOOLS_COMPATIBILITY_HXX +#endif // #ifndef INCLUDED_unotools_COMPATIBILITY_HXX diff --git a/unotools/inc/unotools/configitem.hxx b/unotools/inc/unotools/configitem.hxx index f3b9db2da452..3cc0dc1b079e 100644 --- a/unotools/inc/unotools/configitem.hxx +++ b/unotools/inc/unotools/configitem.hxx @@ -36,6 +36,7 @@ #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/uno/Reference.h> #include "unotools/unotoolsdllapi.h" +#include "unotools/options.hxx" //----------------------------------------------------------------------------- namespace com{ namespace sun{ namespace star{ @@ -76,7 +77,7 @@ namespace utl class ConfigManager; struct ConfigItem_Impl; - class UNOTOOLS_DLLPUBLIC ConfigItem + class UNOTOOLS_DLLPUBLIC ConfigItem : public ConfigurationBroadcaster { friend class ConfigChangeListener_Impl; friend class ConfigManager; @@ -185,7 +186,7 @@ namespace utl /** is called from the ConfigManager before application ends of from the PropertyChangeListener if the sub tree broadcasts changes. */ - virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames); + virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames)=0; /** is called from the ConfigManager if it is destroyed before the ConfigItem. */ void ReleaseConfigMgr(); @@ -200,7 +201,7 @@ namespace utl sal_Bool IsModified() const; /** writes the changed values into the sub tree. Always called in the Dtor of the derived class. */ - virtual void Commit(); + virtual void Commit()=0; sal_Bool IsInValueChange() const; diff --git a/unotools/inc/unotools/confignode.hxx b/unotools/inc/unotools/confignode.hxx index 580274004e1a..2e305030fa2b 100644 --- a/unotools/inc/unotools/confignode.hxx +++ b/unotools/inc/unotools/confignode.hxx @@ -88,6 +88,9 @@ namespace utl /// dtor ~OConfigurationNode() {} + /// returns the local name of the node + ::rtl::OUString getLocalName() const; + /** open a sub node @param _rPath access path of the to-be-opened sub node. May be a hierarchical path. */ diff --git a/svtools/inc/svtools/defaultoptions.hxx b/unotools/inc/unotools/defaultoptions.hxx index 03408ac1ed35..603d7fd6d22a 100644 --- a/svtools/inc/svtools/defaultoptions.hxx +++ b/unotools/inc/unotools/defaultoptions.hxx @@ -27,12 +27,12 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_DEFAULTOPTIONS_HXX -#define INCLUDED_SVTOOLS_DEFAULTOPTIONS_HXX +#ifndef INCLUDED_unotools_DEFAULTOPTIONS_HXX +#define INCLUDED_unotools_DEFAULTOPTIONS_HXX -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include "tools/solar.h" -#include <svtools/options.hxx> +#include <unotools/options.hxx> class String; class SvtDefaultOptions_Impl; @@ -40,7 +40,7 @@ class SvtDefaultOptions_Impl; // class SvtDefaultOptions ----------------------------------------------- class SvtDefaultOptions_Impl; -class SVL_DLLPUBLIC SvtDefaultOptions: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtDefaultOptions: public utl::detail::Options { private: SvtDefaultOptions_Impl* pImp; @@ -53,5 +53,5 @@ public: String GetDefaultPath( USHORT nId ) const; }; -#endif // #ifndef INCLUDED_SVTOOLS_DEFAULTOPTIONS_HXX +#endif // #ifndef INCLUDED_unotools_DEFAULTOPTIONS_HXX diff --git a/svtools/inc/svtools/dynamicmenuoptions.hxx b/unotools/inc/unotools/dynamicmenuoptions.hxx index 4a6b7a44d13f..2841970c5a84 100644 --- a/svtools/inc/svtools/dynamicmenuoptions.hxx +++ b/unotools/inc/unotools/dynamicmenuoptions.hxx @@ -27,19 +27,19 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_DYNAMICMENUOPTIONS_HXX -#define INCLUDED_SVTOOLS_DYNAMICMENUOPTIONS_HXX +#ifndef INCLUDED_unotools_DYNAMICMENUOPTIONS_HXX +#define INCLUDED_unotools_DYNAMICMENUOPTIONS_HXX //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <sal/types.h> #include <osl/mutex.hxx> #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/beans/PropertyValue.hpp> -#include <svtools/options.hxx> +#include <unotools/options.hxx> //_________________________________________________________________________________________________________________ // types, enums, ... @@ -90,7 +90,7 @@ class SvtDynamicMenuOptions_Impl; @devstatus ready to use *//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtDynamicMenuOptions: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtDynamicMenuOptions: public utl::detail::Options { //------------------------------------------------------------------------------------------------------------- // public methods @@ -198,7 +198,7 @@ class SVL_DLLPUBLIC SvtDynamicMenuOptions: public svt::detail::Options @onerror - *//*-*****************************************************************************************************/ - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); //------------------------------------------------------------------------------------------------------------- // private member @@ -219,4 +219,4 @@ class SVL_DLLPUBLIC SvtDynamicMenuOptions: public svt::detail::Options }; // class SvtDynamicMenuOptions -#endif // #ifndef INCLUDED_SVTOOLS_DYNAMICMENUOPTIONS_HXX +#endif // #ifndef INCLUDED_unotools_DYNAMICMENUOPTIONS_HXX diff --git a/svtools/inc/eventcfg.hxx b/unotools/inc/unotools/eventcfg.hxx index 4ee175f5b7e0..0cee43e59dc5 100644 --- a/svtools/inc/eventcfg.hxx +++ b/unotools/inc/unotools/eventcfg.hxx @@ -30,7 +30,7 @@ #ifndef _EVENTCFG_HXX #define _EVENTCFG_HXX -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <unotools/configitem.hxx> #include <com/sun/star/document/XEventsSupplier.hpp> #include <com/sun/star/container/XNameReplace.hpp> @@ -99,7 +99,7 @@ public: ::rtl::OUString GetEventName( sal_Int32 nID ); }; -class SVL_DLLPUBLIC GlobalEventConfig: +class UNOTOOLS_DLLPUBLIC GlobalEventConfig: public ::cppu::WeakImplHelper2 < ::com::sun::star::document::XEventsSupplier, ::com::sun::star::container::XNameReplace > { public: diff --git a/svtools/inc/svtools/extendedsecurityoptions.hxx b/unotools/inc/unotools/extendedsecurityoptions.hxx index 700f707c00fe..114cf81d6ced 100644 --- a/svtools/inc/svtools/extendedsecurityoptions.hxx +++ b/unotools/inc/unotools/extendedsecurityoptions.hxx @@ -27,19 +27,19 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_EXTENDEDSECURITYOPTIONS_HXX -#define INCLUDED_SVTOOLS_EXTENDEDSECURITYOPTIONS_HXX +#ifndef INCLUDED_unotools_EXTENDEDSECURITYOPTIONS_HXX +#define INCLUDED_unotools_EXTENDEDSECURITYOPTIONS_HXX //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <sal/types.h> #include <osl/mutex.hxx> #include <com/sun/star/uno/Sequence.h> #include <rtl/ustring.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> //_________________________________________________________________________________________________________________ // forward declarations @@ -70,7 +70,7 @@ class SvtExtendedSecurityOptions_Impl; @devstatus ready to use *//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtExtendedSecurityOptions: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtExtendedSecurityOptions: public utl::detail::Options { //------------------------------------------------------------------------------------------------------------- // public methods @@ -139,7 +139,7 @@ class SVL_DLLPUBLIC SvtExtendedSecurityOptions: public svt::detail::Options @onerror - *//*-*****************************************************************************************************/ - SVL_DLLPRIVATE static ::osl::Mutex& GetInitMutex(); + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetInitMutex(); //------------------------------------------------------------------------------------------------------------- // private member @@ -160,4 +160,4 @@ class SVL_DLLPUBLIC SvtExtendedSecurityOptions: public svt::detail::Options }; // class SvtExtendedSecurityOptions -#endif // #ifndef INCLUDED_SVTOOLS_EXTENDEDSECURITYOPTIONS_HXX +#endif // #ifndef INCLUDED_unotools_EXTENDEDSECURITYOPTIONS_HXX diff --git a/svtools/inc/fltrcfg.hxx b/unotools/inc/unotools/fltrcfg.hxx index 480ebc28b29f..1422ba1a7a8f 100644 --- a/svtools/inc/fltrcfg.hxx +++ b/unotools/inc/unotools/fltrcfg.hxx @@ -32,11 +32,11 @@ // ----------------------------------------------------------------------- -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <unotools/configitem.hxx> struct SvtFilterOptions_Impl; -class SVL_DLLPUBLIC SvtFilterOptions : public utl::ConfigItem +class UNOTOOLS_DLLPUBLIC SvtFilterOptions : public utl::ConfigItem { SvtFilterOptions_Impl* pImp; diff --git a/vcl/inc/vcl/fontcfg.hxx b/unotools/inc/unotools/fontcfg.hxx index 76864f0cb40a..4d0ed4036328 100644 --- a/vcl/inc/vcl/fontcfg.hxx +++ b/unotools/inc/unotools/fontcfg.hxx @@ -27,14 +27,12 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _VCL_FONTCFG_HXX -#define _VCL_FONTCFG_HXX +#ifndef _UNOTOOLS_FONTCFG_HXX +#define _UNOTOOLS_FONTCFG_HXX -#include "dllapi.h" +#include <unotools/unotoolsdllapi.h> #include <tools/string.hxx> -#ifndef _VCL_ENUM_HXX -#include <vcl/vclenum.hxx> -#endif +#include <tools/fontenum.hxx> #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -60,7 +58,7 @@ inline bool operator==( const com::sun::star::lang::Locale& rLeft, const com::su } }}}} -namespace vcl +namespace utl { struct LocaleHash @@ -74,7 +72,7 @@ struct LocaleHash } }; -class DefaultFontConfiguration +class UNOTOOLS_DLLPUBLIC DefaultFontConfiguration { com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider; @@ -92,7 +90,7 @@ class DefaultFontConfiguration std::hash_map< com::sun::star::lang::Locale, LocaleAccess, - vcl::LocaleHash > + utl::LocaleHash > m_aConfig; rtl::OUString tryLocale( const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rType ) const; @@ -165,7 +163,7 @@ class DefaultFontConfiguration IMPL_FONT_ATTR_GOTHIC | IMPL_FONT_ATTR_SCHOOLBOOK |\ IMPL_FONT_ATTR_SHADOW | IMPL_FONT_ATTR_OUTLINE) -struct FontNameAttr +struct UNOTOOLS_DLLPUBLIC FontNameAttr { String Name; ::std::vector< String > Substitutions; @@ -177,7 +175,7 @@ struct FontNameAttr unsigned long Type; // bitfield of IMPL_FONT_ATTR_* }; -class VCL_DLLPUBLIC FontSubstConfiguration +class UNOTOOLS_DLLPUBLIC FontSubstConfiguration { private: com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > @@ -196,7 +194,7 @@ private: LocaleSubst() : bConfigRead( false ) {} }; - std::hash_map< com::sun::star::lang::Locale, LocaleSubst, vcl::LocaleHash > m_aSubst; + std::hash_map< com::sun::star::lang::Locale, LocaleSubst, utl::LocaleHash > m_aSubst; typedef std::hash_set< rtl::OUString, rtl::OUStringHash > UniqueSubstHash; mutable UniqueSubstHash maSubstHash; @@ -227,6 +225,6 @@ public: static void getMapName( const String& rOrgName, String& rShortName, String& rFamilyName, FontWeight& rWeight, FontWidth& rWidth, ULONG& rType ); }; -} // namespace vcl +} // namespace utl -#endif // _VCL_FONTCFG_HXX +#endif // _UNOTOOLS_FONTCFG_HXX diff --git a/vcl/inc/vcl/fontcvt.hxx b/unotools/inc/unotools/fontcvt.hxx index 8269928dc730..679a2dc5a6d9 100644 --- a/vcl/inc/vcl/fontcvt.hxx +++ b/unotools/inc/unotools/fontcvt.hxx @@ -28,10 +28,10 @@ * ************************************************************************/ -#ifndef _SV_FONTCVT_HXX -#define _SV_FONTCVT_HXX +#ifndef _UNOTOOLS_FONTCVT_HXX +#define _UNOTOOLS_FONTCVT_HXX -#include <vcl/dllapi.h> +#include <unotools/unotoolsdllapi.h> #include <tools/string.hxx> // ------------------ @@ -43,37 +43,16 @@ #define FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS ((ULONG)0x00000004) typedef void* FontToSubsFontConverter; -VCL_DLLPUBLIC FontToSubsFontConverter CreateFontToSubsFontConverter( const String& rFontName, ULONG nFlags ); -VCL_DLLPUBLIC void DestroyFontToSubsFontConverter( FontToSubsFontConverter hConverter ); -VCL_DLLPUBLIC sal_Unicode ConvertFontToSubsFontChar( FontToSubsFontConverter hConverter, sal_Unicode c ); -VCL_DLLPUBLIC String GetFontToSubsFontName( FontToSubsFontConverter hConverter ); - -// ---------------- -// - SubsFontName - -// ---------------- - -#define SUBSFONT_ONLYONE ((ULONG)0x00000001) -#define SUBSFONT_MS ((ULONG)0x00000002) -#define SUBSFONT_PS ((ULONG)0x00000004) -#define SUBSFONT_HTML ((ULONG)0x00000008) -VCL_DLLPUBLIC String GetSubsFontName( const String& rName, ULONG nFlags ); - -// ----------------- -// - FontTokenName - -// ----------------- - -VCL_DLLPUBLIC String GetFontToken( const String& rName, xub_StrLen nToken, xub_StrLen& rIndex ); -inline String GetFontToken( const String& rName, xub_StrLen nToken ) -{ - xub_StrLen nTempIndex = 0; - return GetFontToken( rName, nToken, nTempIndex ); -} +UNOTOOLS_DLLPUBLIC FontToSubsFontConverter CreateFontToSubsFontConverter( const String& rFontName, ULONG nFlags ); +UNOTOOLS_DLLPUBLIC void DestroyFontToSubsFontConverter( FontToSubsFontConverter hConverter ); +UNOTOOLS_DLLPUBLIC sal_Unicode ConvertFontToSubsFontChar( FontToSubsFontConverter hConverter, sal_Unicode c ); +UNOTOOLS_DLLPUBLIC String GetFontToSubsFontName( FontToSubsFontConverter hConverter ); // --------------------------- // - StarSymbolToMSMultiFont - // --------------------------- -class VCL_DLLPUBLIC StarSymbolToMSMultiFont +class UNOTOOLS_DLLPUBLIC StarSymbolToMSMultiFont { public: //Returns the name of the best windows symbol font which this char can be @@ -99,5 +78,5 @@ public: //recognizably similiar. Even in this mode there will be characters that fail. //The users of this might want to make a distinction between failed characters //which were inside and those outside the unicode private area. -VCL_DLLPUBLIC StarSymbolToMSMultiFont *CreateStarSymbolToMSMultiFont(bool bPerfectOnly=false); -#endif // _SV_FONTCVT_HXX +UNOTOOLS_DLLPUBLIC StarSymbolToMSMultiFont *CreateStarSymbolToMSMultiFont(bool bPerfectOnly=false); +#endif // _UNOTOOLS_FONTCVT_HXX diff --git a/unotools/inc/unotools/fontdefs.hxx b/unotools/inc/unotools/fontdefs.hxx new file mode 100644 index 000000000000..ef4f68bb9e8a --- /dev/null +++ b/unotools/inc/unotools/fontdefs.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * 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 + * + * 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_FONTDEFS_HXX +#define _UNOTOOLS_FONTDEFS_HXX + +#include <unotools/unotoolsdllapi.h> +#include <sal/types.h> +#include <tools/string.hxx> + +namespace utl { + class FontSubstConfiguration; + struct FontNameAttr; +} + +// ---------------- +// - SubsFontName - +// ---------------- + +#define SUBSFONT_ONLYONE ((ULONG)0x00000001) +#define SUBSFONT_MS ((ULONG)0x00000002) +#define SUBSFONT_PS ((ULONG)0x00000004) +#define SUBSFONT_HTML ((ULONG)0x00000008) + +UNOTOOLS_DLLPUBLIC String GetSubsFontName( const String& rName, ULONG nFlags ); + +// ----------------- +// - FontTokenName - +// ----------------- + +UNOTOOLS_DLLPUBLIC String GetFontToken( const String& rName, xub_StrLen nToken, xub_StrLen& rIndex ); +inline String GetFontToken( const String& rName, xub_StrLen nToken ) +{ + xub_StrLen nTempIndex = 0; + return GetFontToken( rName, nToken, nTempIndex ); +} + +UNOTOOLS_DLLPUBLIC void AddTokenFontName( String& rName, const String& rNewToken ); + +struct UNOTOOLS_DLLPUBLIC FontNameHash { int operator()(const String&) const; }; + +// --------------- +// - ConvertChar - +// --------------- + +class UNOTOOLS_DLLPUBLIC ConvertChar +{ +public: + const sal_Unicode* mpCvtTab; + const char* mpSubsFontName; + sal_Unicode (*mpCvtFunc)( sal_Unicode ); + sal_Unicode RecodeChar( sal_Unicode c ) const; + void RecodeString( String& rStra, xub_StrLen nIndex, xub_StrLen nLen ) const; + static const ConvertChar* GetRecodeData( const String& rOrgFontName, const String& rMapFontName ); +}; + + +// Default-Font +#define DEFAULTFONT_SANS_UNICODE ((USHORT)1) +#define DEFAULTFONT_SANS ((USHORT)2) +#define DEFAULTFONT_SERIF ((USHORT)3) +#define DEFAULTFONT_FIXED ((USHORT)4) +#define DEFAULTFONT_SYMBOL ((USHORT)5) +#define DEFAULTFONT_UI_SANS ((USHORT)1000) +#define DEFAULTFONT_UI_FIXED ((USHORT)1001) +#define DEFAULTFONT_LATIN_TEXT ((USHORT)2000) +#define DEFAULTFONT_LATIN_PRESENTATION ((USHORT)2001) +#define DEFAULTFONT_LATIN_SPREADSHEET ((USHORT)2002) +#define DEFAULTFONT_LATIN_HEADING ((USHORT)2003) +#define DEFAULTFONT_LATIN_DISPLAY ((USHORT)2004) +#define DEFAULTFONT_LATIN_FIXED ((USHORT)2005) +#define DEFAULTFONT_CJK_TEXT ((USHORT)3000) +#define DEFAULTFONT_CJK_PRESENTATION ((USHORT)3001) +#define DEFAULTFONT_CJK_SPREADSHEET ((USHORT)3002) +#define DEFAULTFONT_CJK_HEADING ((USHORT)3003) +#define DEFAULTFONT_CJK_DISPLAY ((USHORT)3004) +#define DEFAULTFONT_CTL_TEXT ((USHORT)4000) +#define DEFAULTFONT_CTL_PRESENTATION ((USHORT)4001) +#define DEFAULTFONT_CTL_SPREADSHEET ((USHORT)4002) +#define DEFAULTFONT_CTL_HEADING ((USHORT)4003) +#define DEFAULTFONT_CTL_DISPLAY ((USHORT)4004) + +UNOTOOLS_DLLPUBLIC String GetNextFontToken( const String& rTokenStr, xub_StrLen& rIndex ); + +UNOTOOLS_DLLPUBLIC void GetEnglishSearchFontName( String& rName ); + +#endif diff --git a/svtools/inc/svtools/fontoptions.hxx b/unotools/inc/unotools/fontoptions.hxx index 4689cb6ad91b..644670711595 100644 --- a/svtools/inc/svtools/fontoptions.hxx +++ b/unotools/inc/unotools/fontoptions.hxx @@ -27,18 +27,18 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_FONTOPTIONS_HXX -#define INCLUDED_SVTOOLS_FONTOPTIONS_HXX +#ifndef INCLUDED_unotools_FONTOPTIONS_HXX +#define INCLUDED_unotools_FONTOPTIONS_HXX //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <sal/types.h> #include <osl/mutex.hxx> #include <rtl/ustring.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> //_________________________________________________________________________________________________________________ // forward declarations @@ -67,7 +67,7 @@ class SvtFontOptions_Impl; @devstatus ready to use *//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtFontOptions: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtFontOptions: public utl::detail::Options { //------------------------------------------------------------------------------------------------------------- // public methods @@ -152,7 +152,7 @@ class SVL_DLLPUBLIC SvtFontOptions: public svt::detail::Options @onerror - *//*-*****************************************************************************************************/ - SVL_DLLPRIVATE static ::osl::Mutex& impl_GetOwnStaticMutex(); + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& impl_GetOwnStaticMutex(); //------------------------------------------------------------------------------------------------------------- // private member @@ -173,4 +173,4 @@ class SVL_DLLPUBLIC SvtFontOptions: public svt::detail::Options }; // class SvtFontOptions -#endif // #ifndef INCLUDED_SVTOOLS_FONTOPTIONS_HXX +#endif // #ifndef INCLUDED_unotools_FONTOPTIONS_HXX diff --git a/svtools/inc/svtools/historyoptions.hxx b/unotools/inc/unotools/historyoptions.hxx index d688da08ae76..c1bd8f62fca1 100644 --- a/svtools/inc/svtools/historyoptions.hxx +++ b/unotools/inc/unotools/historyoptions.hxx @@ -34,13 +34,13 @@ // includes //_________________________________________________________________________________________________________________ -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <sal/types.h> #include <osl/mutex.hxx> #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/beans/PropertyValue.hpp> #include <rtl/ustring.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> //_________________________________________________________________________________________________________________ // types, enums, ... @@ -94,7 +94,7 @@ class SvtHistoryOptions_Impl; @devstatus ready to use *//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtHistoryOptions: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtHistoryOptions: public utl::detail::Options { //------------------------------------------------------------------------------------------------------------- // public methods @@ -227,7 +227,7 @@ class SVL_DLLPUBLIC SvtHistoryOptions: public svt::detail::Options @onerror - *//*-*****************************************************************************************************/ - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); //------------------------------------------------------------------------------------------------------------- // private member diff --git a/svtools/source/inc/configitems/historyoptions_const.hxx b/unotools/inc/unotools/historyoptions_const.hxx index c9148aeb26f8..48632b66b018 100644 --- a/svtools/source/inc/configitems/historyoptions_const.hxx +++ b/unotools/inc/unotools/historyoptions_const.hxx @@ -34,7 +34,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #ifndef INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX #define INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX diff --git a/svtools/inc/svtools/inetoptions.hxx b/unotools/inc/unotools/inetoptions.hxx index 367ea9bb3f52..42f01f40b7c2 100644 --- a/svtools/inc/svtools/inetoptions.hxx +++ b/unotools/inc/unotools/inetoptions.hxx @@ -28,14 +28,14 @@ * ************************************************************************/ -#ifndef _SVTOOLS_INETOPTIONS_HXX_ -#define _SVTOOLS_INETOPTIONS_HXX_ +#ifndef _unotools_INETOPTIONS_HXX_ +#define _unotools_INETOPTIONS_HXX_ -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <sal/types.h> -#include <svtools/options.hxx> +#include <unotools/options.hxx> namespace com { namespace sun { namespace star { namespace beans { class XPropertiesChangeListener; @@ -68,7 +68,7 @@ namespace rtl { class OUString; } true is passed, the new value is instantly written back to the configuration database. */ -class SVL_DLLPUBLIC SvtInetOptions: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtInetOptions: public utl::detail::Options { public: SvtInetOptions(); @@ -143,4 +143,4 @@ private: static Impl * m_pImpl; }; -#endif // _SVTOOLS_INETOPTIONS_HXX_ +#endif // _unotools_INETOPTIONS_HXX_ diff --git a/svtools/inc/svtools/internaloptions.hxx b/unotools/inc/unotools/internaloptions.hxx index 6a491480c143..d5c9adaa7b92 100644 --- a/svtools/inc/svtools/internaloptions.hxx +++ b/unotools/inc/unotools/internaloptions.hxx @@ -27,18 +27,18 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_INTERNALOPTIONS_HXX -#define INCLUDED_SVTOOLS_INTERNALOPTIONS_HXX +#ifndef INCLUDED_unotools_INTERNALOPTIONS_HXX +#define INCLUDED_unotools_INTERNALOPTIONS_HXX //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <sal/types.h> #include <osl/mutex.hxx> #include <rtl/ustring.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> //_________________________________________________________________________________________________________________ // namespaces! @@ -76,7 +76,7 @@ class SvtInternalOptions_Impl; @devstatus ready to use *//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtInternalOptions: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtInternalOptions: public utl::detail::Options { //------------------------------------------------------------------------------------------------------------- // public methods @@ -159,7 +159,7 @@ class SVL_DLLPUBLIC SvtInternalOptions: public svt::detail::Options @onerror - *//*-*****************************************************************************************************/ - SVL_DLLPRIVATE static MUTEX& GetOwnStaticMutex(); + UNOTOOLS_DLLPRIVATE static MUTEX& GetOwnStaticMutex(); //------------------------------------------------------------------------------------------------------------- // private member @@ -180,4 +180,4 @@ class SVL_DLLPUBLIC SvtInternalOptions: public svt::detail::Options }; // class SvtInternalOptions -#endif // #ifndef INCLUDED_SVTOOLS_INTERNALOPTIONS_HXX +#endif // #ifndef INCLUDED_unotools_INTERNALOPTIONS_HXX diff --git a/svtools/source/config/itemholderbase.hxx b/unotools/inc/unotools/itemholderbase.hxx index b5c1dd5d57d0..3b8bbccb3549 100644 --- a/svtools/source/config/itemholderbase.hxx +++ b/unotools/inc/unotools/itemholderbase.hxx @@ -28,8 +28,8 @@ * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_ITEMHOLDERBASE_HXX_ -#define INCLUDED_SVTOOLS_ITEMHOLDERBASE_HXX_ +#ifndef INCLUDED_unotools_ITEMHOLDERBASE_HXX_ +#define INCLUDED_unotools_ITEMHOLDERBASE_HXX_ //----------------------------------------------- // includes @@ -37,7 +37,7 @@ #include <vector> #include <osl/mutex.hxx> -namespace svt { namespace detail { class Options; } } +namespace utl { namespace detail { class Options; } } //----------------------------------------------- // definitions @@ -122,10 +122,10 @@ struct TItemInfo : pItem(0) {} - svt::detail::Options * pItem; + utl::detail::Options * pItem; EItem eItem; }; typedef ::std::vector< TItemInfo > TItems; -#endif // INCLUDED_SVTOOLS_ITEMHOLDERBASE_HXX_ +#endif // INCLUDED_unotools_ITEMHOLDERBASE_HXX_ diff --git a/svtools/inc/javaoptions.hxx b/unotools/inc/unotools/javaoptions.hxx index 4e1f23376407..9996a496bf31 100644 --- a/svtools/inc/javaoptions.hxx +++ b/unotools/inc/unotools/javaoptions.hxx @@ -27,10 +27,10 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _SVTOOLS_JAVAOPTIONS_HXX -#define _SVTOOLS_JAVAOPTIONS_HXX +#ifndef _unotools_JAVAOPTIONS_HXX +#define _unotools_JAVAOPTIONS_HXX -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <sal/types.h> #include <unotools/configitem.hxx> @@ -39,7 +39,7 @@ struct SvtJavaOptions_Impl; -class SVL_DLLPUBLIC SvtJavaOptions : public utl::ConfigItem +class UNOTOOLS_DLLPUBLIC SvtJavaOptions : public utl::ConfigItem { SvtJavaOptions_Impl* pImpl; public: diff --git a/svtools/inc/svtools/lingucfg.hxx b/unotools/inc/unotools/lingucfg.hxx index dd3dbdef811f..49500db964c2 100644 --- a/svtools/inc/svtools/lingucfg.hxx +++ b/unotools/inc/unotools/lingucfg.hxx @@ -28,10 +28,10 @@ * ************************************************************************/ -#ifndef _SVTOOLS_LINGUCFG_HXX_ -#define _SVTOOLS_LINGUCFG_HXX_ +#ifndef _unotools_LINGUCFG_HXX_ +#define _unotools_LINGUCFG_HXX_ -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <com/sun/star/beans/PropertyValues.hpp> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/uno/Any.h> @@ -41,7 +41,7 @@ #include <rtl/ustring.hxx> #include <unotools/configitem.hxx> #include <osl/mutex.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> #include <i18npool/lang.h> #include <vector> @@ -50,7 +50,7 @@ class SvtLinguConfigItem; ////////////////////////////////////////////////////////////////////// -struct SVL_DLLPUBLIC SvtLinguOptions +struct UNOTOOLS_DLLPUBLIC SvtLinguOptions { ::com::sun::star::uno::Sequence< rtl::OUString > aActiveDics; ::com::sun::star::uno::Sequence< rtl::OUString > aActiveConvDics; @@ -144,7 +144,7 @@ struct SVL_DLLPUBLIC SvtLinguOptions ////////////////////////////////////////////////////////////////////// -struct SVL_DLLPUBLIC SvtLinguConfigDictionaryEntry +struct UNOTOOLS_DLLPUBLIC SvtLinguConfigDictionaryEntry { // the URL's pointing to the location of the files the dictionary consists of com::sun::star::uno::Sequence< rtl::OUString > aLocations; @@ -156,10 +156,10 @@ struct SVL_DLLPUBLIC SvtLinguConfigDictionaryEntry ////////////////////////////////////////////////////////////////////// -class SVL_DLLPUBLIC SvtLinguConfig: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtLinguConfig: public utl::detail::Options { // returns static object - SVL_DLLPRIVATE SvtLinguConfigItem & GetConfigItem(); + UNOTOOLS_DLLPRIVATE SvtLinguConfigItem & GetConfigItem(); SvtLinguConfigItem & GetConfigItem() const { return const_cast< SvtLinguConfig * >( this )->GetConfigItem(); } diff --git a/svtools/inc/linguprops.hxx b/unotools/inc/unotools/linguprops.hxx index 883d5069f7a8..3edd1004bec0 100644 --- a/svtools/inc/linguprops.hxx +++ b/unotools/inc/unotools/linguprops.hxx @@ -28,8 +28,8 @@ * ************************************************************************/ -#ifndef _SVTOOLS_LINGUPROPS_HXX_ -#define _SVTOOLS_LINGUPROPS_HXX_ +#ifndef _unotools_LINGUPROPS_HXX_ +#define _unotools_LINGUPROPS_HXX_ // UNO property names for general options diff --git a/svtools/inc/svtools/localisationoptions.hxx b/unotools/inc/unotools/localisationoptions.hxx index c19bf0e9fbba..d401eccee51a 100644 --- a/svtools/inc/svtools/localisationoptions.hxx +++ b/unotools/inc/unotools/localisationoptions.hxx @@ -27,17 +27,17 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_LOCALISATIONOPTIONS_HXX -#define INCLUDED_SVTOOLS_LOCALISATIONOPTIONS_HXX +#ifndef INCLUDED_unotools_LOCALISATIONOPTIONS_HXX +#define INCLUDED_unotools_LOCALISATIONOPTIONS_HXX //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ #include <sal/types.h> -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <osl/mutex.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> //_________________________________________________________________________________________________________________ // forward declarations @@ -66,7 +66,7 @@ class SvtLocalisationOptions_Impl; @devstatus ready to use *//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtLocalisationOptions: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtLocalisationOptions: public utl::detail::Options { //------------------------------------------------------------------------------------------------------------- // public methods @@ -157,7 +157,7 @@ class SVL_DLLPUBLIC SvtLocalisationOptions: public svt::detail::Options @onerror - *//*-*****************************************************************************************************/ - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); //------------------------------------------------------------------------------------------------------------- // private member @@ -178,4 +178,4 @@ class SVL_DLLPUBLIC SvtLocalisationOptions: public svt::detail::Options }; // class SvtLocalisationOptions -#endif // #ifndef INCLUDED_SVTOOLS_LOCALISATIONOPTIONS_HXX +#endif // #ifndef INCLUDED_unotools_LOCALISATIONOPTIONS_HXX diff --git a/svtools/source/config/loghelper.hxx b/unotools/inc/unotools/loghelper.hxx index 22efd5cff46d..22efd5cff46d 100644 --- a/svtools/source/config/loghelper.hxx +++ b/unotools/inc/unotools/loghelper.hxx diff --git a/svtools/inc/misccfg.hxx b/unotools/inc/unotools/misccfg.hxx index 3f897e1cecc3..14ecb12b388a 100644 --- a/svtools/inc/misccfg.hxx +++ b/unotools/inc/unotools/misccfg.hxx @@ -27,49 +27,44 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _SFX_MISCCFG_HXX -#define _SFX_MISCCFG_HXX +#ifndef _UTL_MISCCFG_HXX +#define _UTL_MISCCFG_HXX -#include "svtools/svtdllapi.h" +#include "unotools/unotoolsdllapi.h" #include "tools/solar.h" -#include "unotools/configitem.hxx" +#include "unotools/options.hxx" /*-------------------------------------------------------------------- Beschreibung: --------------------------------------------------------------------*/ - -class SVT_DLLPUBLIC SfxMiscCfg : public utl::ConfigItem +namespace utl { - BOOL bPaperSize; // printer warnings - BOOL bPaperOrientation; - BOOL bNotFound; - sal_Int32 nYear2000; // two digit year representation + class SfxMiscCfg; - const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames(); - void Load(); +class UNOTOOLS_DLLPUBLIC MiscCfg : public detail::Options +{ + SfxMiscCfg* pImpl; public: - SfxMiscCfg( ); - ~SfxMiscCfg( ); - - virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames); - virtual void Commit(); + MiscCfg( ); + virtual ~MiscCfg( ); - BOOL IsNotFoundWarning() const {return bNotFound;} + BOOL IsNotFoundWarning() const; void SetNotFoundWarning( BOOL bSet); - BOOL IsPaperSizeWarning() const {return bPaperSize;} + BOOL IsPaperSizeWarning() const; void SetPaperSizeWarning(BOOL bSet); - BOOL IsPaperOrientationWarning() const {return bPaperOrientation;} + BOOL IsPaperOrientationWarning() const; void SetPaperOrientationWarning( BOOL bSet); // 0 ... 99 - sal_Int32 GetYear2000() const { return nYear2000; } + sal_Int32 GetYear2000() const; void SetYear2000( sal_Int32 nSet ); - }; +} + #endif // _MISCCFG_HXX diff --git a/svtools/inc/svtools/moduleoptions.hxx b/unotools/inc/unotools/moduleoptions.hxx index fc28ce1f399e..8b759a0834cf 100644 --- a/svtools/inc/svtools/moduleoptions.hxx +++ b/unotools/inc/unotools/moduleoptions.hxx @@ -35,14 +35,14 @@ // includes //_________________________________________________________________________________________________________________ -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <salhelper/singletonref.hxx> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/uno/Sequence.hxx> #include <rtl/ustring.hxx> #include <sal/types.h> #include <osl/mutex.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> //_________________________________________________________________________________________________________________ // const @@ -85,7 +85,7 @@ class SvtModuleOptions_Impl; @devstatus ready to use @threadsafe yes *//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtModuleOptions: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtModuleOptions: public utl::detail::Options { //------------------------------------------------------------------------------------------------------------- // public const declarations! @@ -237,7 +237,7 @@ class SVL_DLLPUBLIC SvtModuleOptions: public svt::detail::Options // private methods //------------------------------------------------------------------------------------------------------------- private: - SVL_DLLPRIVATE static ::osl::Mutex& impl_GetOwnStaticMutex(); + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& impl_GetOwnStaticMutex(); //------------------------------------------------------------------------------------------------------------- // private member diff --git a/unotools/inc/unotools/options.hxx b/unotools/inc/unotools/options.hxx new file mode 100644 index 000000000000..b5664edac2d1 --- /dev/null +++ b/unotools/inc/unotools/options.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * 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: options.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_unotools_OPTIONS_HXX +#define INCLUDED_unotools_OPTIONS_HXX + +#include "sal/config.h" +#include "unotools/unotoolsdllapi.h" + +/* + The class utl::detail::Options provides a kind of multiplexer. It implements a ConfigurationListener + that is usually registered at a ConfigItem class. At the same time it implements a ConfigurationBroadcaster + that allows further ("external") listeners to register. + Once the class deriving from Options is notified about + configuration changes by the ConfigItem if its content has been changed by calling some of its methods, + a call of the Options::NotifyListeners() method will send out notifications to all external listeners. +*/ + +namespace utl { + + class ConfigurationBroadcaster; + class IMPL_ConfigurationListenerList; + + // interface for configuration listener + class UNOTOOLS_DLLPUBLIC ConfigurationListener + { + public: + virtual void ConfigurationChanged( ConfigurationBroadcaster* p, sal_uInt32 nHint=0 ) = 0; + }; + + // complete broadcasting implementation + class UNOTOOLS_DLLPUBLIC ConfigurationBroadcaster + { + IMPL_ConfigurationListenerList* mpList; + sal_Int32 m_nBroadcastBlocked; // broadcast only if this is 0 + sal_uInt32 m_nBlockedHint; + + public: + void AddListener( utl::ConfigurationListener* pListener ); + void RemoveListener( utl::ConfigurationListener* pListener ); + + // notify listeners; nHint is an implementation detail of the particular class deriving from ConfigurationBroadcaster + void NotifyListeners( sal_uInt32 nHint ); + ConfigurationBroadcaster(); + virtual ~ConfigurationBroadcaster(); + virtual void BlockBroadcasts( bool bBlock ); + }; + +namespace detail { + +// A base class for the various option classes supported by +// unotools/source/config/itemholderbase.hxx (which must be public, as it is +// shared between unotools, svl and svt) +// It also provides an implementation for a Configuration Listener and inherits a broadcaster implementation + +class UNOTOOLS_DLLPUBLIC Options : public utl::ConfigurationBroadcaster, public utl::ConfigurationListener +{ +public: + Options(); + + virtual ~Options() = 0; + +private: + UNOTOOLS_DLLPRIVATE Options(Options &); // not defined + UNOTOOLS_DLLPRIVATE void operator =(Options &); // not defined + +protected: + virtual void ConfigurationChanged( ::utl::ConfigurationBroadcaster* p, sal_uInt32 nHint=0 ); +}; + +} } + +#endif diff --git a/svtools/inc/svtools/optionsdlg.hxx b/unotools/inc/unotools/optionsdlg.hxx index 0ebfd1ab357d..87649a82358c 100644 --- a/svtools/inc/svtools/optionsdlg.hxx +++ b/unotools/inc/unotools/optionsdlg.hxx @@ -27,18 +27,18 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_OPTIONSDLG_HXX -#define INCLUDED_SVTOOLS_OPTIONSDLG_HXX +#ifndef INCLUDED_unotools_OPTIONSDLG_HXX +#define INCLUDED_unotools_OPTIONSDLG_HXX -#ifndef INCLUDED_SVTDLLAPI_H -#include "svtools/svldllapi.h" +#ifndef INCLUDED_unotoolsdllapi_H +#include "unotools/unotoolsdllapi.h" #endif #include <tools/string.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> class SvtOptionsDlgOptions_Impl; -class SVL_DLLPUBLIC SvtOptionsDialogOptions: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtOptionsDialogOptions: public utl::detail::Options { private: SvtOptionsDlgOptions_Impl* m_pImp; diff --git a/svtools/inc/svtools/pathoptions.hxx b/unotools/inc/unotools/pathoptions.hxx index 20185e79c886..e606180c25de 100644 --- a/svtools/inc/svtools/pathoptions.hxx +++ b/unotools/inc/unotools/pathoptions.hxx @@ -27,20 +27,20 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX -#define INCLUDED_SVTOOLS_PATHOPTIONS_HXX +#ifndef INCLUDED_unotools_PATHOPTIONS_HXX +#define INCLUDED_unotools_PATHOPTIONS_HXX -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <tools/string.hxx> #include <com/sun/star/lang/Locale.hpp> -#include <svtools/options.hxx> +#include <unotools/options.hxx> #define SVT_SEARCHPATH_DELIMITER ';' // class SvtPathOptions -------------------------------------------------- class SvtPathOptions_Impl; -class SVL_DLLPUBLIC SvtPathOptions: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtPathOptions: public utl::detail::Options { private: SvtPathOptions_Impl* pImp; @@ -139,5 +139,5 @@ public: sal_Bool IsReadonly() const; }; -#endif // #ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX +#endif // #ifndef INCLUDED_unotools_PATHOPTIONS_HXX diff --git a/svtools/inc/svtools/printwarningoptions.hxx b/unotools/inc/unotools/printwarningoptions.hxx index 863d407f221e..3663fb8c63d0 100644 --- a/svtools/inc/svtools/printwarningoptions.hxx +++ b/unotools/inc/unotools/printwarningoptions.hxx @@ -28,18 +28,18 @@ * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_PRINTWARNINGOPTIONS_HXX -#define INCLUDED_SVTOOLS_PRINTWARNINGOPTIONS_HXX +#ifndef INCLUDED_unotools_PRINTWARNINGOPTIONS_HXX +#define INCLUDED_unotools_PRINTWARNINGOPTIONS_HXX //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <sal/types.h> #include <osl/mutex.hxx> #include <rtl/ustring.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> //_________________________________________________________________________________________________________________ // forward declarations @@ -68,7 +68,7 @@ class SvtPrintWarningOptions_Impl; @devstatus ready to use *//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtPrintWarningOptions: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtPrintWarningOptions: public utl::detail::Options { //------------------------------------------------------------------------------------------------------------- // public methods @@ -141,7 +141,7 @@ class SVL_DLLPUBLIC SvtPrintWarningOptions: public svt::detail::Options @onerror - *//*-*****************************************************************************************************/ - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); //------------------------------------------------------------------------------------------------------------- // private member @@ -161,4 +161,4 @@ class SVL_DLLPUBLIC SvtPrintWarningOptions: public svt::detail::Options }; // class SvtPrintWarningOptions -#endif // #ifndef INCLUDED_SVTOOLS_PRINTWARNINGOPTIONS_HXX +#endif // #ifndef INCLUDED_unotools_PRINTWARNINGOPTIONS_HXX diff --git a/svtools/inc/regoptions.hxx b/unotools/inc/unotools/regoptions.hxx index 109cc6dd7754..3b0f6c760b1f 100644 --- a/svtools/inc/regoptions.hxx +++ b/unotools/inc/unotools/regoptions.hxx @@ -28,14 +28,14 @@ * ************************************************************************/ -#ifndef SVTOOLS_REGOPTIONS_HXX -#define SVTOOLS_REGOPTIONS_HXX +#ifndef unotools_REGOPTIONS_HXX +#define unotools_REGOPTIONS_HXX -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <tools/string.hxx> //........................................................................ -namespace svt +namespace utl { //........................................................................ @@ -45,13 +45,13 @@ namespace svt class RegOptionsImpl; /** encapsulates access to the configuration settings for registering the product */ - class SVL_DLLPUBLIC RegOptions + class UNOTOOLS_DLLPUBLIC RegOptions { private: RegOptionsImpl* m_pImpl; // the impl class is constructed upon need only (as this is expensive) - SVL_DLLPRIVATE void ensureImpl( ); + UNOTOOLS_DLLPRIVATE void ensureImpl( ); public: RegOptions( ); @@ -122,8 +122,8 @@ namespace svt }; //........................................................................ -} // namespace svt +} // namespace utl //........................................................................ -#endif // SVTOOLS_REGOPTIONS_HXX +#endif // unotools_REGOPTIONS_HXX diff --git a/svtools/inc/svtools/saveopt.hxx b/unotools/inc/unotools/saveopt.hxx index 2966e2f24aba..bb50cadafb1d 100644 --- a/svtools/inc/svtools/saveopt.hxx +++ b/unotools/inc/unotools/saveopt.hxx @@ -27,14 +27,14 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_SAVEOPT_HXX -#define INCLUDED_SVTOOLS_SAVEOPT_HXX +#ifndef INCLUDED_unotools_SAVEOPT_HXX +#define INCLUDED_unotools_SAVEOPT_HXX -#include "svtools/svldllapi.h" -#include <svtools/options.hxx> +#include "unotools/unotoolsdllapi.h" +#include <unotools/options.hxx> struct SvtLoadSaveOptions_Impl; -class SVL_DLLPUBLIC SvtSaveOptions: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtSaveOptions: public utl::detail::Options { SvtLoadSaveOptions_Impl* pImp; diff --git a/svtools/inc/searchopt.hxx b/unotools/inc/unotools/searchopt.hxx index 4475f406805d..4f53a1e050b0 100644 --- a/svtools/inc/searchopt.hxx +++ b/unotools/inc/unotools/searchopt.hxx @@ -31,12 +31,12 @@ #ifndef _SVT_SEARCHOPT_HXX_ #define _SVT_SEARCHOPT_HXX_ -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include "tools/solar.h" class SvtSearchOptions_Impl; -class SVL_DLLPUBLIC SvtSearchOptions +class UNOTOOLS_DLLPUBLIC SvtSearchOptions { SvtSearchOptions_Impl *pImpl; diff --git a/svtools/inc/svtools/securityoptions.hxx b/unotools/inc/unotools/securityoptions.hxx index 36ba2af9668a..bbca1770b836 100644 --- a/svtools/inc/svtools/securityoptions.hxx +++ b/unotools/inc/unotools/securityoptions.hxx @@ -27,19 +27,19 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_SECURITYOPTIONS_HXX -#define INCLUDED_SVTOOLS_SECURITYOPTIONS_HXX +#ifndef INCLUDED_unotools_SECURITYOPTIONS_HXX +#define INCLUDED_unotools_SECURITYOPTIONS_HXX //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <sal/types.h> #include <osl/mutex.hxx> #include <com/sun/star/uno/Sequence.h> #include <rtl/ustring.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> //_________________________________________________________________________________________________________________ // forward declarations @@ -82,7 +82,7 @@ enum EBasicSecurityMode @devstatus ready to use *//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtSecurityOptions: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtSecurityOptions: public utl::detail::Options { //------------------------------------------------------------------------------------------------------------- // public types @@ -275,7 +275,7 @@ class SVL_DLLPUBLIC SvtSecurityOptions: public svt::detail::Options @onerror - *//*-*****************************************************************************************************/ - SVL_DLLPRIVATE static ::osl::Mutex& GetInitMutex(); + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetInitMutex(); //------------------------------------------------------------------------------------------------------------- // private member @@ -296,4 +296,4 @@ class SVL_DLLPUBLIC SvtSecurityOptions: public svt::detail::Options }; // class SvtSecurityOptions -#endif // #ifndef INCLUDED_SVTOOLS_SECURITYOPTIONS_HXX +#endif // #ifndef INCLUDED_unotools_SECURITYOPTIONS_HXX diff --git a/svtools/inc/svtools/sourceviewconfig.hxx b/unotools/inc/unotools/sourceviewconfig.hxx index 0e3f6a34e3c1..cc28bd3dae61 100644 --- a/svtools/inc/svtools/sourceviewconfig.hxx +++ b/unotools/inc/unotools/sourceviewconfig.hxx @@ -27,26 +27,23 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _SVTOOLS_SOURCEVIEWCONFIG_HXX -#define _SVTOOLS_SOURCEVIEWCONFIG_HXX +#ifndef _unotools_SOURCEVIEWCONFIG_HXX +#define _unotools_SOURCEVIEWCONFIG_HXX // include --------------------------------------------------------------- -#include "svtools/svldllapi.h" -#include <svtools/brdcst.hxx> -#include <svtools/lstner.hxx> +#include "unotools/unotoolsdllapi.h" #include <osl/mutex.hxx> #include <rtl/ustring.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> /* -----------------------------12.10.00 11:40-------------------------------- ---------------------------------------------------------------------------*/ -namespace svt +namespace utl { class SourceViewConfig_Impl; - class SVL_DLLPUBLIC SourceViewConfig: - public svt::detail::Options, public SfxBroadcaster, private SfxListener + class UNOTOOLS_DLLPUBLIC SourceViewConfig: public utl::detail::Options { static SourceViewConfig_Impl* m_pImplConfig; static sal_Int32 m_nRefCount; @@ -63,9 +60,6 @@ namespace svt sal_Bool IsShowProportionalFontsOnly() const; void SetShowProportionalFontsOnly(sal_Bool bSet); - - //SfxListener: - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); }; } #endif diff --git a/svtools/inc/svtools/startoptions.hxx b/unotools/inc/unotools/startoptions.hxx index 82a3c761965e..a23fb08fce6b 100644 --- a/svtools/inc/svtools/startoptions.hxx +++ b/unotools/inc/unotools/startoptions.hxx @@ -27,18 +27,18 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_STARTOPTIONS_HXX -#define INCLUDED_SVTOOLS_STARTOPTIONS_HXX +#ifndef INCLUDED_unotools_STARTOPTIONS_HXX +#define INCLUDED_unotools_STARTOPTIONS_HXX //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <sal/types.h> #include <osl/mutex.hxx> #include <rtl/ustring.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> //_________________________________________________________________________________________________________________ // forward declarations @@ -67,7 +67,7 @@ class SvtStartOptions_Impl; @devstatus ready to use *//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtStartOptions: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtStartOptions: public utl::detail::Options { //------------------------------------------------------------------------------------------------------------- // public methods @@ -149,7 +149,7 @@ class SVL_DLLPUBLIC SvtStartOptions: public svt::detail::Options @onerror - *//*-*****************************************************************************************************/ - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); //------------------------------------------------------------------------------------------------------------- // private member @@ -170,4 +170,4 @@ class SVL_DLLPUBLIC SvtStartOptions: public svt::detail::Options }; // class SvtStartOptions -#endif // #ifndef INCLUDED_SVTOOLS_STARTOPTIONS_HXX +#endif // #ifndef INCLUDED_unotools_STARTOPTIONS_HXX diff --git a/svtools/inc/svtools/syslocale.hxx b/unotools/inc/unotools/syslocale.hxx index bd853d0d4eeb..adce66b7e84a 100644 --- a/svtools/inc/svtools/syslocale.hxx +++ b/unotools/inc/unotools/syslocale.hxx @@ -28,16 +28,18 @@ * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX -#define INCLUDED_SVTOOLS_SYSLOCALE_HXX +#ifndef INCLUDED_UNOTOOLS_SYSLOCALE_HXX +#define INCLUDED_UNOTOOLS_SYSLOCALE_HXX -#include "svtools/svtdllapi.h" +#include "unotools/unotoolsdllapi.h" #include <unotools/localedatawrapper.hxx> #include <unotools/charclass.hxx> #include <sal/types.h> - +#include <i18npool/lang.h> class SvtSysLocale_Impl; +class SvtSysLocaleOptions; + namespace osl { class Mutex; } class LocaleDataWrapper; @@ -50,14 +52,14 @@ class LocaleDataWrapper; SvtSysLocale is not expensive as long as there is at least one instance left. */ -class SVT_DLLPUBLIC SvtSysLocale +class UNOTOOLS_DLLPUBLIC SvtSysLocale { friend class SvtSysLocale_Impl; // access to mutex static SvtSysLocale_Impl* pImpl; static sal_Int32 nRefCount; - SVT_DLLPRIVATE static ::osl::Mutex& GetMutex(); + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetMutex(); public: SvtSysLocale(); @@ -72,7 +74,11 @@ public: */ const LocaleDataWrapper* GetLocaleDataPtr() const; const CharClass* GetCharClassPtr() const; - + SvtSysLocaleOptions& GetOptions() const; + com::sun::star::lang::Locale GetLocale() const; + LanguageType GetLanguage() const; + com::sun::star::lang::Locale GetUILocale() const; + LanguageType GetUILanguage() const; }; #endif // INCLUDED_SVTOOLS_SYSLOCALE_HXX diff --git a/svtools/inc/svtools/syslocaleoptions.hxx b/unotools/inc/unotools/syslocaleoptions.hxx index 19e130fea45b..b417e00eec12 100644 --- a/svtools/inc/svtools/syslocaleoptions.hxx +++ b/unotools/inc/unotools/syslocaleoptions.hxx @@ -31,35 +31,39 @@ #ifndef INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX #define INCLUDED_SVTOOLS_SYSLOCALEOPTIONS_HXX -#include "svtools/svtdllapi.h" +#include "unotools/unotoolsdllapi.h" #include <sal/types.h> #include <rtl/ustring.hxx> #include <tools/solar.h> #include <tools/link.hxx> #include <i18npool/lang.h> #include <tools/string.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> // bits for broadcasting hints of changes in a SfxSimpleHint, may be combined const ULONG SYSLOCALEOPTIONS_HINT_LOCALE = 0x00000001; const ULONG SYSLOCALEOPTIONS_HINT_CURRENCY = 0x00000002; +const ULONG SYSLOCALEOPTIONS_HINT_UILOCALE = 0x00000004; +const ULONG SYSLOCALEOPTIONS_HINT_DECSEP = 0x00000008; class SvtSysLocaleOptions_Impl; class SvtListener; namespace osl { class Mutex; } -class SVT_DLLPUBLIC SvtSysLocaleOptions: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtSysLocaleOptions: public utl::detail::Options { static SvtSysLocaleOptions_Impl* pOptions; static sal_Int32 nRefCount; - SVT_DLLPRIVATE static ::osl::Mutex& GetMutex(); + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetMutex(); + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster* p, sal_uInt32 nHint ); public: enum EOption { E_LOCALE, + E_UILOCALE, E_CURRENCY }; SvtSysLocaleOptions(); @@ -76,8 +80,6 @@ public: <TRUE/> if added <FALSE/> if not added */ - BOOL AddListener( SvtListener& ); - BOOL RemoveListener( SvtListener& ); /** Block broadcasts and accumulate hints. This may be useful if, for example, the locale and currency are changed and the currency was @@ -97,13 +99,23 @@ public: BlockBroadcasts(FALSE) or otherwise pending hints would never be broadcasted again. */ - void BlockBroadcasts( BOOL bBlock ); + virtual void BlockBroadcasts( bool bBlock ); // config value access methods /// The config string may be empty to denote the SYSTEM locale const ::rtl::OUString& GetLocaleConfigString() const; void SetLocaleConfigString( const ::rtl::OUString& rStr ); + com::sun::star::lang::Locale GetLocale() const; + com::sun::star::lang::Locale GetRealLocale() const; + LanguageType GetRealLanguage() const; + + /// The config string may be empty to denote the SYSTEM locale + const ::rtl::OUString& GetUILocaleConfigString() const; + void SetUILocaleConfigString( const ::rtl::OUString& rStr ); + com::sun::star::lang::Locale GetUILocale() const; + com::sun::star::lang::Locale GetRealUILocale() const; + LanguageType GetRealUILanguage() const; /// The config string may be empty to denote the default currency of the locale const ::rtl::OUString& GetCurrencyConfigString() const; @@ -115,11 +127,6 @@ public: // convenience methods - /** Get the LanguageType of the current locale, may be LANGUAGE_SYSTEM if - LocaleConfigString is empty. If you need the real locale used in the - application, call Application::GetSettings().GetLanguage() instead */ - LanguageType GetLocaleLanguageType() const; - /// Get currency abbreviation and locale from an USD-en-US or EUR-de-DE string static void GetCurrencyAbbrevAndLanguage( String& rAbbrev, diff --git a/svtools/inc/svtools/undoopt.hxx b/unotools/inc/unotools/undoopt.hxx index 7fa63c104eec..288ec3c6b5de 100644 --- a/svtools/inc/svtools/undoopt.hxx +++ b/unotools/inc/unotools/undoopt.hxx @@ -27,19 +27,16 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_UNDOOPT_HXX -#define INCLUDED_SVTOOLS_UNDOOPT_HXX +#ifndef INCLUDED_unotools_UNDOOPT_HXX +#define INCLUDED_unotools_UNDOOPT_HXX -#include "svtools/svtdllapi.h" +#include "unotools/unotoolsdllapi.h" #include <sal/types.h> -#include <svtools/brdcst.hxx> -#include <svtools/lstner.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> class SvtUndoOptions_Impl; -class SVT_DLLPUBLIC SvtUndoOptions: - public svt::detail::Options, public SfxBroadcaster, public SfxListener +class UNOTOOLS_DLLPUBLIC SvtUndoOptions: public utl::detail::Options { SvtUndoOptions_Impl* pImp; @@ -47,8 +44,6 @@ public: SvtUndoOptions(); virtual ~SvtUndoOptions(); - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - void SetUndoCount( sal_Int32 n ); sal_Int32 GetUndoCount() const; }; diff --git a/svtools/inc/svtools/useroptions.hxx b/unotools/inc/unotools/useroptions.hxx index f5a07a2e4e79..67fd3e5bbf35 100644 --- a/svtools/inc/svtools/useroptions.hxx +++ b/unotools/inc/unotools/useroptions.hxx @@ -27,16 +27,14 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_USEROPTIONS_HXX -#define INCLUDED_SVTOOLS_USEROPTIONS_HXX +#ifndef INCLUDED_unotools_USEROPTIONS_HXX +#define INCLUDED_unotools_USEROPTIONS_HXX -#include "svtools/svtdllapi.h" +#include "unotools/unotoolsdllapi.h" #include <unotools/configitem.hxx> #include <tools/string.hxx> #include <osl/mutex.hxx> -#include <svtools/brdcst.hxx> -#include <svtools/lstner.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> // define ---------------------------------------------------------------- @@ -62,8 +60,7 @@ class SvtUserOptions_Impl; -class SVT_DLLPUBLIC SvtUserOptions: - public svt::detail::Options, public SfxBroadcaster, public SfxListener +class UNOTOOLS_DLLPUBLIC SvtUserOptions: public utl::detail::Options { private: SvtUserOptions_Impl* pImp; @@ -74,8 +71,6 @@ public: static ::osl::Mutex& GetInitMutex(); - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - // get the address token ::rtl::OUString GetCompany() const; ::rtl::OUString GetFirstName() const; @@ -123,4 +118,4 @@ public: ::rtl::OUString GetToken(USHORT nToken) const; }; -#endif // #ifndef INCLUDED_SVTOOLS_USEROPTIONS_HXX +#endif // #ifndef INCLUDED_unotools_USEROPTIONS_HXX diff --git a/svtools/source/inc/configitems/useroptions_const.hxx b/unotools/inc/unotools/useroptions_const.hxx index 4dbd6da8bba3..4dbd6da8bba3 100644 --- a/svtools/source/inc/configitems/useroptions_const.hxx +++ b/unotools/inc/unotools/useroptions_const.hxx diff --git a/svtools/inc/svtools/viewoptions.hxx b/unotools/inc/unotools/viewoptions.hxx index e95af38cb322..07f4da9e3159 100644 --- a/svtools/inc/svtools/viewoptions.hxx +++ b/unotools/inc/unotools/viewoptions.hxx @@ -27,14 +27,14 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_VIEWOPTIONS_HXX -#define INCLUDED_SVTOOLS_VIEWOPTIONS_HXX +#ifndef INCLUDED_unotools_VIEWOPTIONS_HXX +#define INCLUDED_unotools_VIEWOPTIONS_HXX //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ -#include "svtools/svldllapi.h" +#include "unotools/unotoolsdllapi.h" #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/NamedValue.hpp> #include <unotools/configmgr.hxx> @@ -42,7 +42,7 @@ #include <sal/types.h> #include <osl/mutex.hxx> #include <rtl/ustring.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> //_________________________________________________________________________________________________________________ // forward declarations @@ -122,7 +122,7 @@ enum EViewType @devstatus ready to use *//*-*************************************************************************************************************/ -class SVL_DLLPUBLIC SvtViewOptions: public svt::detail::Options +class UNOTOOLS_DLLPUBLIC SvtViewOptions: public utl::detail::Options { /* #ifdef TF_OLDVIEW @@ -318,7 +318,7 @@ class SVL_DLLPUBLIC SvtViewOptions: public svt::detail::Options @onerror - *//*-*****************************************************************************************************/ - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); + UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); //------------------------------------------------------------------------------------------------------------- // private member @@ -353,4 +353,4 @@ class SVL_DLLPUBLIC SvtViewOptions: public svt::detail::Options }; // class SvtViewOptions -#endif // #ifndef INCLUDED_SVTOOLS_VIEWOPTIONS_HXX +#endif // #ifndef INCLUDED_unotools_VIEWOPTIONS_HXX diff --git a/svtools/inc/svtools/workingsetoptions.hxx b/unotools/inc/unotools/workingsetoptions.hxx index b66f71512e7e..9a422e25cc32 100644 --- a/svtools/inc/svtools/workingsetoptions.hxx +++ b/unotools/inc/unotools/workingsetoptions.hxx @@ -27,8 +27,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_WORKINGSETOPTIONS_HXX -#define INCLUDED_SVTOOLS_WORKINGSETOPTIONS_HXX +#ifndef INCLUDED_unotools_WORKINGSETOPTIONS_HXX +#define INCLUDED_unotools_WORKINGSETOPTIONS_HXX //_________________________________________________________________________________________________________________ // includes @@ -38,7 +38,7 @@ #include <osl/mutex.hxx> #include <com/sun/star/uno/Sequence.h> #include <rtl/ustring.hxx> -#include <svtools/options.hxx> +#include <unotools/options.hxx> //_________________________________________________________________________________________________________________ // forward declarations @@ -67,7 +67,7 @@ class SvtWorkingSetOptions_Impl; @devstatus ready to use *//*-*************************************************************************************************************/ -class SvtWorkingSetOptions: public svt::detail::Options +class SvtWorkingSetOptions: public utl::detail::Options { //------------------------------------------------------------------------------------------------------------- // public methods @@ -156,4 +156,4 @@ class SvtWorkingSetOptions: public svt::detail::Options }; // class SvtWorkingSetOptions -#endif // #ifndef INCLUDED_SVTOOLS_WORKINGSETOPTIONS_HXX +#endif // #ifndef INCLUDED_unotools_WORKINGSETOPTIONS_HXX diff --git a/svtools/inc/xmlaccelcfg.hxx b/unotools/inc/unotools/xmlaccelcfg.hxx index 00967b234111..8b975f2a26ff 100644 --- a/svtools/inc/xmlaccelcfg.hxx +++ b/unotools/inc/unotools/xmlaccelcfg.hxx @@ -28,15 +28,15 @@ * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_XMLACCELCFG_HXX -#define INCLUDED_SVTOOLS_XMLACCELCFG_HXX +#ifndef INCLUDED_unotools_XMLACCELCFG_HXX +#define INCLUDED_unotools_XMLACCELCFG_HXX #ifndef __COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_ #include <com/sun/star/xml/sax/XDocumentHandler.hpp> #endif #include <cppuhelper/weak.hxx> -#include <svtools/accelcfg.hxx> +#include <unotools/accelcfg.hxx> class OReadAccelatorDocumentHandler : public ::com::sun::star::xml::sax::XDocumentHandler, public ::cppu::OWeakObject @@ -109,4 +109,4 @@ class OWriteAccelatorDocumentHandler const SvtAcceleratorItemList& m_aWriteAcceleratorList; }; -#endif // INCLUDED_SVTOOLS_XMLACCELCFG_HXX +#endif // INCLUDED_unotools_XMLACCELCFG_HXX diff --git a/svtools/source/config/accelcfg.cxx b/unotools/source/config/accelcfg.cxx index 6daa1a9491a2..f911b36e83fe 100644 --- a/svtools/source/config/accelcfg.cxx +++ b/unotools/source/config/accelcfg.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #ifndef GCC #endif #include "rtl/instance.hxx" @@ -50,9 +50,9 @@ #include <unotools/ucbstreamhelper.hxx> #include <comphelper/processfactory.hxx> -#include <svtools/accelcfg.hxx> -#include "xmlaccelcfg.hxx" -#include <svtools/pathoptions.hxx> +#include <unotools/accelcfg.hxx> +#include <unotools/xmlaccelcfg.hxx> +#include <unotools/pathoptions.hxx> #include "itemholder1.hxx" diff --git a/svtools/source/config/cacheoptions.cxx b/unotools/source/config/cacheoptions.cxx index 39b2b2c74085..dc8031ea0078 100644 --- a/svtools/source/config/cacheoptions.cxx +++ b/unotools/source/config/cacheoptions.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #ifndef GCC #endif @@ -37,7 +37,7 @@ // includes //_________________________________________________________________________________________________________________ -#include "cacheoptions.hxx" +#include <unotools/cacheoptions.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> #include <tools/debug.hxx> @@ -94,6 +94,7 @@ public: //--------------------------------------------------------------------------------------------------------- virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); //--------------------------------------------------------------------------------------------------------- // public interface @@ -247,6 +248,10 @@ void SvtCacheOptions_Impl::Commit() PutProperties( aSeqNames, aSeqValues ); } +void SvtCacheOptions_Impl::Notify( const Sequence< rtl::OUString >& ) +{ +} + //***************************************************************************************************************** // public method //***************************************************************************************************************** diff --git a/svtools/source/config/cmdoptions.cxx b/unotools/source/config/cmdoptions.cxx index 356b6782b892..421b201d98c0 100644 --- a/svtools/source/config/cmdoptions.cxx +++ b/unotools/source/config/cmdoptions.cxx @@ -29,13 +29,13 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ -#include <svtools/cmdoptions.hxx> +#include <unotools/cmdoptions.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> #include <tools/debug.hxx> diff --git a/svtools/source/config/compatibility.cxx b/unotools/source/config/compatibility.cxx index a55aff0c90f8..46967eb7b43d 100644 --- a/svtools/source/config/compatibility.cxx +++ b/unotools/source/config/compatibility.cxx @@ -29,13 +29,13 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ -#include <svtools/compatibility.hxx> +#include <unotools/compatibility.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> #include <tools/debug.hxx> diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx index a6b3bbaa1e2f..3d70f99f4ec0 100644 --- a/unotools/source/config/configitem.cxx +++ b/unotools/source/config/configitem.cxx @@ -33,6 +33,7 @@ #include "unotools/configitem.hxx" #include "unotools/configmgr.hxx" #include "unotools/configpathes.hxx" +#include <comphelper/processfactory.hxx> #include <com/sun/star/beans/XMultiPropertySet.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/util/XChangesListener.hpp> @@ -43,12 +44,13 @@ #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/awt/XRequestCallback.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/util/XStringEscape.hpp> #include <com/sun/star/util/XChangesBatch.hpp> #include <osl/diagnose.h> - +#include <tools/solarmutex.hxx> #include <rtl/ustrbuf.hxx> using namespace utl; @@ -81,15 +83,22 @@ catch(Exception& rEx) \ #define CATCH_INFO(a) catch(Exception& ){} #endif +/* + The ConfigChangeListener_Impl receives notifications from the configuration about changes that + have happened. It forwards this notification to the ConfigItem it knows a pParent by calling its + "CallNotify" method. As ConfigItems are most probably not thread safe, the SolarMutex is acquired + before doing so. +*/ + namespace utl{ class ConfigChangeListener_Impl : public cppu::WeakImplHelper1 < com::sun::star::util::XChangesListener > { + public: ConfigItem* pParent; const Sequence< OUString > aPropertyNames; - public: ConfigChangeListener_Impl(ConfigItem& rItem, const Sequence< OUString >& rNames); ~ConfigChangeListener_Impl(); @@ -98,7 +107,6 @@ namespace utl{ //XEventListener virtual void SAL_CALL disposing( const EventObject& Source ) throw(RuntimeException); - }; /* -----------------------------12.02.01 11:38-------------------------------- @@ -208,12 +216,17 @@ void ConfigChangeListener_Impl::changesOccurred( const ChangesEvent& rEvent ) th if(lcl_Find(sTemp, pCheckPropertyNames, aPropertyNames.getLength())) pNames[nNotify++] = sTemp; } - if(nNotify) + if( nNotify ) { - aChangedNames.realloc(nNotify); - pParent->CallNotify(aChangedNames); + if ( ::tools::SolarMutex::Acquire() ) + { + aChangedNames.realloc(nNotify); + pParent->CallNotify(aChangedNames); + ::tools::SolarMutex::Release(); + } } } + /* -----------------------------29.08.00 16:34-------------------------------- ---------------------------------------------------------------------------*/ @@ -274,13 +287,6 @@ ConfigItem::~ConfigItem() /* -----------------------------29.08.00 12:52-------------------------------- ---------------------------------------------------------------------------*/ -void ConfigItem::Commit() -{ - OSL_ENSURE(sal_False, "Base class called"); -} -/* -----------------------------29.08.00 12:52-------------------------------- - - ---------------------------------------------------------------------------*/ void ConfigItem::ReleaseConfigMgr() { Reference<XHierarchicalNameAccess> xHierarchyAccess = GetTree(); @@ -302,16 +308,13 @@ void ConfigItem::ReleaseConfigMgr() ---------------------------------------------------------------------------*/ void ConfigItem::CallNotify( const com::sun::star::uno::Sequence<OUString>& rPropertyNames ) { + // the call is forwarded to the virtual Notify() method + // it is pure virtual, so all classes deriving from ConfigItem have to decide how they + // want to notify listeners if(!IsInValueChange() || pImpl->bEnableInternalNotification) Notify(rPropertyNames); } -/* -----------------------------29.08.00 12:52-------------------------------- - ---------------------------------------------------------------------------*/ -void ConfigItem::Notify( const com::sun::star::uno::Sequence<OUString>& /*rPropertyNames*/) -{ - OSL_ENSURE(sal_False, "Base class called"); -} /* -----------------------------12.12.00 17:09-------------------------------- ---------------------------------------------------------------------------*/ @@ -1420,4 +1423,3 @@ void ConfigItem::UnlockTree() } - diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx index 4b1b9fe272db..56d258461e95 100644 --- a/unotools/source/config/confignode.cxx +++ b/unotools/source/config/confignode.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/util/XStringEscape.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XNamed.hpp> #include <comphelper/extract.hxx> #include <rtl/string.hxx> #if OSL_DEBUG_LEVEL > 0 @@ -139,6 +140,22 @@ namespace utl } //------------------------------------------------------------------------ + ::rtl::OUString OConfigurationNode::getLocalName() const + { + ::rtl::OUString sLocalName; + try + { + Reference< XNamed > xNamed( m_xDirectAccess, UNO_QUERY_THROW ); + sLocalName = xNamed->getName(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return sLocalName; + } + + //------------------------------------------------------------------------ ::rtl::OUString OConfigurationNode::normalizeName(const ::rtl::OUString& _rName, NAMEORIGIN _eOrigin) const { ::rtl::OUString sName(_rName); @@ -155,13 +172,9 @@ namespace utl else sName = xEscaper->unescapeString(sName); } - catch(IllegalArgumentException&) - { - OSL_ENSURE(sal_False, "OConfigurationNode::normalizeName: illegal argument (caught an exception saying so)!"); - } catch(Exception&) { - OSL_ENSURE(sal_False, "OConfigurationNode::normalizeName: caught an exception!"); + DBG_UNHANDLED_EXCEPTION(); } } } diff --git a/svtools/source/config/defaultoptions.cxx b/unotools/source/config/defaultoptions.cxx index fbbcf60a11a6..baaa4a220a93 100644 --- a/svtools/source/config/defaultoptions.cxx +++ b/unotools/source/config/defaultoptions.cxx @@ -29,10 +29,10 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" -#include <svtools/defaultoptions.hxx> -#include <svtools/pathoptions.hxx> +#include <unotools/defaultoptions.hxx> +#include <unotools/pathoptions.hxx> #include <unotools/configitem.hxx> #include <unotools/configmgr.hxx> #include <tools/debug.hxx> @@ -111,6 +111,8 @@ public: SvtDefaultOptions_Impl(); String GetDefaultPath( USHORT nId ) const; + virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames); }; // global ---------------------------------------------------------------- @@ -189,6 +191,16 @@ Sequence< OUString > GetDefaultPropertyNames() return aNames; } +void SvtDefaultOptions_Impl::Notify( const Sequence< rtl::OUString >& ) +{ + // no notification, will never be changed +} + +void SvtDefaultOptions_Impl::Commit() +{ + // will never be changed +} + // class SvtDefaultOptions_Impl ------------------------------------------ String SvtDefaultOptions_Impl::GetDefaultPath( USHORT nId ) const diff --git a/svtools/source/config/dynamicmenuoptions.cxx b/unotools/source/config/dynamicmenuoptions.cxx index 7b60a1c3716c..d3fca4350a67 100644 --- a/svtools/source/config/dynamicmenuoptions.cxx +++ b/unotools/source/config/dynamicmenuoptions.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #ifndef GCC #endif @@ -37,8 +37,8 @@ // includes //_________________________________________________________________________________________________________________ -#include <svtools/dynamicmenuoptions.hxx> -#include <svtools/moduleoptions.hxx> +#include <unotools/dynamicmenuoptions.hxx> +#include <unotools/moduleoptions.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> #include <tools/debug.hxx> diff --git a/svtools/source/config/eventcfg.cxx b/unotools/source/config/eventcfg.cxx index 6026c3d4a3a0..3155f4ac2fa7 100644 --- a/svtools/source/config/eventcfg.cxx +++ b/unotools/source/config/eventcfg.cxx @@ -29,9 +29,9 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" -#include "eventcfg.hxx" +#include <unotools/eventcfg.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> #include <tools/debug.hxx> diff --git a/svtools/source/config/extendedsecurityoptions.cxx b/unotools/source/config/extendedsecurityoptions.cxx index 2f3c57ea4748..b4d21f79246b 100644 --- a/svtools/source/config/extendedsecurityoptions.cxx +++ b/unotools/source/config/extendedsecurityoptions.cxx @@ -29,13 +29,13 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ -#include <svtools/extendedsecurityoptions.hxx> +#include <unotools/extendedsecurityoptions.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> #include <tools/debug.hxx> @@ -45,7 +45,7 @@ #include <tools/wldcrd.hxx> #include <rtl/ustrbuf.hxx> -#include <svtools/pathoptions.hxx> +#include <unotools/pathoptions.hxx> #include <hash_map> @@ -447,7 +447,7 @@ SvtExtendedSecurityOptions::SvtExtendedSecurityOptions() // ... and initialize ouer data container only if it not already exist! if( m_pDataContainer == NULL ) { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtExtendedSecurityOptions_Impl::ctor()"); + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtExtendedSecurityOptions_Impl::ctor()"); m_pDataContainer = new SvtExtendedSecurityOptions_Impl; ItemHolder1::holdConfigItem(E_EXTENDEDSECURITYOPTIONS); diff --git a/svtools/source/config/fltrcfg.cxx b/unotools/source/config/fltrcfg.cxx index 056826bf62ba..a0870ff6a8a5 100644 --- a/svtools/source/config/fltrcfg.cxx +++ b/unotools/source/config/fltrcfg.cxx @@ -29,9 +29,9 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" -#include "fltrcfg.hxx" +#include <unotools/fltrcfg.hxx> #include <tools/debug.hxx> #include <rtl/logfile.hxx> @@ -81,6 +81,7 @@ public: bSaveVBA(sal_False) {} ~SvtAppFilterOptions_Impl(); virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames); void Load(); sal_Bool IsLoad() const {return bLoadVBA;} @@ -125,6 +126,13 @@ void SvtAppFilterOptions_Impl::Commit() PutProperties(aNames, aValues); } + +void SvtAppFilterOptions_Impl::Notify( const Sequence< rtl::OUString >& ) +{ + // no listeners supported yet +} + + /* -----------------------------22.01.01 10:38-------------------------------- ---------------------------------------------------------------------------*/ @@ -280,7 +288,7 @@ SvtFilterOptions::SvtFilterOptions() : ConfigItem( C2U("Office.Common/Filter/Microsoft") ), pImp(new SvtFilterOptions_Impl) { - RTL_LOGFILE_CONTEXT(aLog, "svtools SvtFilterOptions::SvtFilterOptions()"); + RTL_LOGFILE_CONTEXT(aLog, "unotools SvtFilterOptions::SvtFilterOptions()"); EnableNotification(GetPropertyNames()); Load(); } diff --git a/vcl/source/gdi/fontcfg.cxx b/unotools/source/config/fontcfg.cxx index 68d3b499341d..3ee556f372c7 100644 --- a/vcl/source/gdi/fontcfg.cxx +++ b/unotools/source/config/fontcfg.cxx @@ -29,18 +29,17 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_vcl.hxx" -#include <vcl/fontcfg.hxx> -#include <vcl/configsettings.hxx> -#include <vcl/outdev.hxx> -#include <vcl/svdata.hxx> -#include <vcl/svapp.hxx> -#include <vcl/unohelp.hxx> +#include "precompiled_unotools.hxx" +#include <unotools/fontcfg.hxx> +#include <unotools/fontdefs.hxx> +#include <comphelper/processfactory.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <unotools/configpathes.hxx> +#include <unotools/syslocale.hxx> #include <rtl/ustrbuf.hxx> +#include <tools/debug.hxx> #if OSL_DEBUG_LEVEL > 1 #include <stdio.h> @@ -52,9 +51,7 @@ #define DEFAULTFONT_CONFIGNODE "VCL/DefaultFonts" #define SUBSTFONT_CONFIGNODE "VCL/FontSubstitutions" -#define SETTINGS_CONFIGNODE "VCL/Settings" -using namespace vcl; using namespace rtl; using namespace utl; using namespace com::sun::star::uno; @@ -62,6 +59,9 @@ using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::container; +static DefaultFontConfiguration* mpDefaultFontConfiguration = 0; + +static FontSubstConfiguration* mpFontSubstConfiguration = 0; /* * DefaultFontConfiguration @@ -102,10 +102,9 @@ static const char* getKeyType( int nKeyType ) DefaultFontConfiguration* DefaultFontConfiguration::get() { - ImplSVData* pSVData = ImplGetSVData(); - if( ! pSVData->maGDIData.mpDefaultFontConfiguration ) - pSVData->maGDIData.mpDefaultFontConfiguration = new DefaultFontConfiguration(); - return pSVData->maGDIData.mpDefaultFontConfiguration; + if( !mpDefaultFontConfiguration ) + mpDefaultFontConfiguration = new DefaultFontConfiguration(); + return mpDefaultFontConfiguration; } DefaultFontConfiguration::DefaultFontConfiguration() @@ -113,7 +112,7 @@ DefaultFontConfiguration::DefaultFontConfiguration() try { // get service provider - Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() ); + Reference< XMultiServiceFactory > xSMgr( comphelper::getProcessServiceFactory() ); // create configuration hierachical access name if( xSMgr.is() ) { @@ -271,7 +270,7 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( const Locale& rLocale ) { Locale aLocale = rLocale; if( ! aLocale.Language.getLength() ) - aLocale = Application::GetSettings().GetUILocale(); + aLocale = SvtSysLocale().GetUILocale(); OUString aUIFont = getDefaultFont( aLocale, DEFAULTFONT_UI_SANS ); @@ -378,10 +377,9 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( const Locale& rLocale ) FontSubstConfiguration* FontSubstConfiguration::get() { - ImplSVData* pSVData = ImplGetSVData(); - if( ! pSVData->maGDIData.mpFontSubstConfiguration ) - pSVData->maGDIData.mpFontSubstConfiguration = new FontSubstConfiguration(); - return pSVData->maGDIData.mpFontSubstConfiguration; + if( !mpFontSubstConfiguration ) + mpFontSubstConfiguration = new FontSubstConfiguration(); + return mpFontSubstConfiguration; } /* @@ -394,7 +392,7 @@ FontSubstConfiguration::FontSubstConfiguration() : try { // get service provider - Reference< XMultiServiceFactory > xSMgr( unohelper::GetMultiServiceFactory() ); + Reference< XMultiServiceFactory > xSMgr( comphelper::getProcessServiceFactory() ); // create configuration hierachical access name if( xSMgr.is() ) { @@ -1192,7 +1190,7 @@ const FontNameAttr* FontSubstConfiguration::getSubstInfo( const String& rFontNam aLocale.Variant = rLocale.Variant.toAsciiUpperCase(); if( ! aLocale.Language.getLength() ) - aLocale = Application::GetSettings().GetUILocale(); + aLocale = SvtSysLocale().GetUILocale(); while( aLocale.Language.getLength() ) { @@ -1220,162 +1218,3 @@ const FontNameAttr* FontSubstConfiguration::getSubstInfo( const String& rFontNam return NULL; } -/* - * SettingsConfigItem::get - */ - -SettingsConfigItem* SettingsConfigItem::get() -{ - ImplSVData* pSVData = ImplGetSVData(); - if( ! pSVData->mpSettingsConfigItem ) - pSVData->mpSettingsConfigItem = new SettingsConfigItem(); - return pSVData->mpSettingsConfigItem; -} - -/* - * SettignsConfigItem constructor - */ - -SettingsConfigItem::SettingsConfigItem() - : - ConfigItem( OUString( RTL_CONSTASCII_USTRINGPARAM( SETTINGS_CONFIGNODE ) ), - CONFIG_MODE_DELAYED_UPDATE ), - m_aSettings( 0 ) -{ - getValues(); -} - -/* - * SettingsConfigItem destructor - */ - -SettingsConfigItem::~SettingsConfigItem() -{ - if( IsModified() ) - Commit(); -} - -/* - * SettingsConfigItem::Commit - */ - -void SettingsConfigItem::Commit() -{ - if( ! IsValidConfigMgr() ) - return; - - std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group; - - for( group = m_aSettings.begin(); group != m_aSettings.end(); ++group ) - { - String aKeyName( group->first ); - /*sal_Bool bAdded =*/ AddNode( OUString(), aKeyName ); - Sequence< PropertyValue > aValues( group->second.size() ); - PropertyValue* pValues = aValues.getArray(); - int nIndex = 0; - SmallOUStrMap::const_iterator it; - for( it = group->second.begin(); it != group->second.end(); ++it ) - { - String aName( aKeyName ); - aName.Append( '/' ); - aName.Append( String( it->first ) ); - pValues[nIndex].Name = aName; - pValues[nIndex].Handle = 0; - pValues[nIndex].Value <<= it->second; - pValues[nIndex].State = PropertyState_DIRECT_VALUE; - nIndex++; - } - ReplaceSetProperties( aKeyName, aValues ); - } -} - -/* - * SettingsConfigItem::Notify - */ - -void SettingsConfigItem::Notify( const Sequence< OUString >& ) -{ - getValues(); -} - -/* - * SettingsConfigItem::getValues - */ -void SettingsConfigItem::getValues() -{ - if( ! IsValidConfigMgr() ) - return; - - m_aSettings.clear(); - - Sequence< OUString > aNames( GetNodeNames( OUString() ) ); - m_aSettings.resize( aNames.getLength() ); - - for( int j = 0; j < aNames.getLength(); j++ ) - { -#if OSL_DEBUG_LEVEL > 2 - fprintf( stderr, "found settings data for \"%s\"\n", - OUStringToOString( aNames.getConstArray()[j], RTL_TEXTENCODING_ASCII_US ).getStr() - ); -#endif - String aKeyName( aNames.getConstArray()[j] ); - Sequence< OUString > aKeys( GetNodeNames( aKeyName ) ); - Sequence< OUString > aSettingsKeys( aKeys.getLength() ); - const OUString* pFrom = aKeys.getConstArray(); - OUString* pTo = aSettingsKeys.getArray(); - for( int m = 0; m < aKeys.getLength(); m++ ) - { - String aName( aKeyName ); - aName.Append( '/' ); - aName.Append( String( pFrom[m] ) ); - pTo[m] = aName; - } - Sequence< Any > aValues( GetProperties( aSettingsKeys ) ); - const Any* pValue = aValues.getConstArray(); - for( int i = 0; i < aValues.getLength(); i++, pValue++ ) - { - if( pValue->getValueTypeClass() == TypeClass_STRING ) - { - const OUString* pLine = (const OUString*)pValue->getValue(); - if( pLine->getLength() ) - m_aSettings[ aKeyName ][ pFrom[i] ] = *pLine; -#if OSL_DEBUG_LEVEL > 2 - fprintf( stderr, " \"%s\"=\"%.30s\"\n", - OUStringToOString( aKeys.getConstArray()[i], RTL_TEXTENCODING_ASCII_US ).getStr(), - OUStringToOString( *pLine, RTL_TEXTENCODING_ASCII_US ).getStr() - ); -#endif - } - } - } -} - -/* - * SettingsConfigItem::getDefaultFont - */ - -const OUString& SettingsConfigItem::getValue( const OUString& rGroup, const OUString& rKey ) const -{ - ::std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group = m_aSettings.find( rGroup ); - if( group == m_aSettings.end() || group->second.find( rKey ) == group->second.end() ) - { - static OUString aEmpty; - return aEmpty; - } - return group->second.find(rKey)->second; -} - -/* - * SettingsConfigItem::setDefaultFont - */ - -void SettingsConfigItem::setValue( const OUString& rGroup, const OUString& rKey, const OUString& rValue ) -{ - bool bModified = m_aSettings[ rGroup ][ rKey ] != rValue; - if( bModified ) - { - m_aSettings[ rGroup ][ rKey ] = rValue; - SetModified(); - } -} - diff --git a/svtools/source/config/fontoptions.cxx b/unotools/source/config/fontoptions.cxx index 1044344ff567..ac7fd2a94b62 100644 --- a/svtools/source/config/fontoptions.cxx +++ b/unotools/source/config/fontoptions.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #ifndef GCC #endif @@ -37,7 +37,7 @@ // includes //_________________________________________________________________________________________________________________ -#include <svtools/fontoptions.hxx> +#include <unotools/fontoptions.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> #include <tools/debug.hxx> @@ -409,7 +409,7 @@ SvtFontOptions::SvtFontOptions() // ... and initialize ouer data container only if it not already exist! if( m_pDataContainer == NULL ) { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtFontOptions_Impl::ctor()"); + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtFontOptions_Impl::ctor()"); m_pDataContainer = new SvtFontOptions_Impl; ItemHolder1::holdConfigItem(E_FONTOPTIONS); diff --git a/svtools/source/config/historyoptions.cxx b/unotools/source/config/historyoptions.cxx index 758753df0e4e..0a28884e24c2 100644 --- a/svtools/source/config/historyoptions.cxx +++ b/unotools/source/config/historyoptions.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #ifndef GCC #endif @@ -37,8 +37,8 @@ // includes //_________________________________________________________________________________________________________________ -#include <svtools/historyoptions.hxx> -#include "configitems/historyoptions_const.hxx" +#include <unotools/historyoptions.hxx> +#include <unotools/historyoptions_const.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> #include <tools/debug.hxx> @@ -81,7 +81,7 @@ #endif #ifndef _SVT_LOGHELPER_HXX -#include "loghelper.hxx" +#include <unotools/loghelper.hxx> #endif //_________________________________________________________________________________________________________________ @@ -648,7 +648,7 @@ SvtHistoryOptions::SvtHistoryOptions() // ... and initialize ouer data container only if it not already exist! if( m_pDataContainer == NULL ) { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtHistoryOptions_Impl::ctor()"); + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtHistoryOptions_Impl::ctor()"); m_pDataContainer = new SvtHistoryOptions_Impl; ItemHolder1::holdConfigItem(E_HISTORYOPTIONS); diff --git a/svtools/source/config/inetoptions.cxx b/unotools/source/config/inetoptions.cxx index 109c2d94ada7..13c72d73152d 100644 --- a/svtools/source/config/inetoptions.cxx +++ b/unotools/source/config/inetoptions.cxx @@ -29,8 +29,8 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include <svtools/inetoptions.hxx> +#include "precompiled_unotools.hxx" +#include <unotools/inetoptions.hxx> #include "rtl/instance.hxx" #include <tools/urlobj.hxx> #ifndef _WILDCARD_HXX @@ -419,7 +419,7 @@ SvtInetOptions::SvtInetOptions() osl::MutexGuard aGuard(LocalSingleton::get()); if (!m_pImpl) { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtInetOptions_Impl::ctor()"); + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtInetOptions_Impl::ctor()"); m_pImpl = new Impl; ItemHolder1::holdConfigItem(E_INETOPTIONS); diff --git a/svtools/source/config/internaloptions.cxx b/unotools/source/config/internaloptions.cxx index dc8cc7c34772..54dce3d7094b 100644 --- a/svtools/source/config/internaloptions.cxx +++ b/unotools/source/config/internaloptions.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #ifndef GCC #endif @@ -39,7 +39,7 @@ #include <deque> -#include <svtools/internaloptions.hxx> +#include <unotools/internaloptions.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> #include <tools/debug.hxx> @@ -514,7 +514,7 @@ SvtInternalOptions::SvtInternalOptions() // ... and initialize ouer data container only if it not already! if( m_pDataContainer == NULL ) { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtInternalOptions_Impl::ctor()"); + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtInternalOptions_Impl::ctor()"); m_pDataContainer = new SvtInternalOptions_Impl(); ItemHolder1::holdConfigItem(E_INTERNALOPTIONS); diff --git a/svtools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx index 37a57259c807..214b5a9b4276 100644 --- a/svtools/source/config/itemholder1.cxx +++ b/unotools/source/config/itemholder1.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #include "itemholder1.hxx" @@ -38,38 +38,40 @@ #include <comphelper/processfactory.hxx> #include <com/sun/star/lang/XComponent.hpp> -#include <svtools/accelcfg.hxx> -#include <svtools/addxmltostorageoptions.hxx> -#include <cacheoptions.hxx> -#include <svtools/cmdoptions.hxx> -#include <svtools/compatibility.hxx> -#include <svtools/defaultoptions.hxx> -#include <svtools/dynamicmenuoptions.hxx> -#include <eventcfg.hxx> -#include <svtools/extendedsecurityoptions.hxx> -#include <fltrcfg.hxx> -#include <svtools/fontoptions.hxx> -#include <svtools/historyoptions.hxx> -#include <svtools/inetoptions.hxx> -#include <svtools/internaloptions.hxx> -#include <javaoptions.hxx> -#include <svtools/lingucfg.hxx> -#include <svtools/localisationoptions.hxx> -#include <svtools/menuoptions.hxx> -#include <svtools/moduleoptions.hxx> -#include <svtools/pathoptions.hxx> -#include <svtools/printwarningoptions.hxx> -#include <regoptions.hxx> -#include <svtools/optionsdlg.hxx> -#include <svtools/saveopt.hxx> -#include <searchopt.hxx> -#include <svtools/securityoptions.hxx> -#include <svtools/sourceviewconfig.hxx> -#include <svtools/startoptions.hxx> -#include <svtools/viewoptions.hxx> -#include <svtools/workingsetoptions.hxx> -#include <xmlaccelcfg.hxx> -#include <svtools/options.hxx> +#include <unotools/misccfg.hxx> +#include <unotools/undoopt.hxx> +#include <unotools/useroptions.hxx> +#include <unotools/accelcfg.hxx> +#include <unotools/cacheoptions.hxx> +#include <unotools/cmdoptions.hxx> +#include <unotools/compatibility.hxx> +#include <unotools/defaultoptions.hxx> +#include <unotools/dynamicmenuoptions.hxx> +#include <unotools/eventcfg.hxx> +#include <unotools/extendedsecurityoptions.hxx> +#include <unotools/fltrcfg.hxx> +#include <unotools/fontoptions.hxx> +#include <unotools/historyoptions.hxx> +#include <unotools/inetoptions.hxx> +#include <unotools/internaloptions.hxx> +#include <unotools/javaoptions.hxx> +#include <unotools/lingucfg.hxx> +#include <unotools/localisationoptions.hxx> +#include <unotools/moduleoptions.hxx> +#include <unotools/pathoptions.hxx> +#include <unotools/printwarningoptions.hxx> +#include <unotools/regoptions.hxx> +#include <unotools/optionsdlg.hxx> +#include <unotools/saveopt.hxx> +#include <unotools/searchopt.hxx> +#include <unotools/securityoptions.hxx> +#include <unotools/sourceviewconfig.hxx> +#include <unotools/startoptions.hxx> +#include <unotools/viewoptions.hxx> +#include <unotools/workingsetoptions.hxx> +#include <unotools/xmlaccelcfg.hxx> +#include <unotools/options.hxx> +#include <unotools/syslocaleoptions.hxx> //----------------------------------------------- // namespaces @@ -180,10 +182,6 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem) rItem.pItem = new SvtAcceleratorConfiguration(); break; - case E_ADDXMLTOSTORAGEOPTIONS : - rItem.pItem = new SvtAddXMLToStorageOptions(); - break; - case E_CMDOPTIONS : rItem.pItem = new SvtCommandOptions(); break; @@ -240,10 +238,6 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem) rItem.pItem = new SvtLocalisationOptions(); break; - case E_MENUOPTIONS : - rItem.pItem = new SvtMenuOptions(); - break; - case E_MODULEOPTIONS : rItem.pItem = new SvtModuleOptions(); break; @@ -260,8 +254,8 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem) rItem.pItem = new SvtPrintWarningOptions(); break; - case E_REGOPTIONS : -// no ref count rItem.pItem = new ::svt::RegOptions(); + case E_MISCCFG : + rItem.pItem = new ::utl::MiscCfg(); break; case E_SAVEOPTIONS : @@ -277,7 +271,7 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem) break; case E_SOURCEVIEWCONFIG : - rItem.pItem = new ::svt::SourceViewConfig(); + rItem.pItem = new ::utl::SourceViewConfig(); break; case E_STARTOPTIONS : @@ -307,6 +301,19 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem) case E_XMLACCELCFG : // ??? TODO break; + + case E_UNDOOPTIONS : + rItem.pItem = new SvtUndoOptions(); + break; + + case E_USEROPTIONS : + rItem.pItem = new SvtUserOptions(); + break; + + case E_SYSLOCALEOPTIONS : + rItem.pItem = new SvtSysLocaleOptions(); + break; + default: OSL_ASSERT( "unknown item type" ); break; diff --git a/svtools/source/config/itemholder1.hxx b/unotools/source/config/itemholder1.hxx index b040292ab5c6..89a5bc3da299 100644 --- a/svtools/source/config/itemholder1.hxx +++ b/unotools/source/config/itemholder1.hxx @@ -28,13 +28,13 @@ * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_ITEMHOLDER1_HXX_ -#define INCLUDED_SVTOOLS_ITEMHOLDER1_HXX_ +#ifndef INCLUDED_unotools_ITEMHOLDER1_HXX_ +#define INCLUDED_unotools_ITEMHOLDER1_HXX_ //----------------------------------------------- // includes -#include "itemholderbase.hxx" +#include <unotools/itemholderbase.hxx> #include <cppuhelper/implbase1.hxx> #include <com/sun/star/lang/XEventListener.hpp> @@ -89,4 +89,4 @@ class ItemHolder1 : private ItemHolderMutexBase #undef css -#endif // INCLUDED_SVTOOLS_ITEMHOLDER1_HXX_ +#endif // INCLUDED_unotools_ITEMHOLDER1_HXX_ diff --git a/svtools/source/config/javaoptions.cxx b/unotools/source/config/javaoptions.cxx index 7915f0042614..0eec89a31782 100644 --- a/svtools/source/config/javaoptions.cxx +++ b/unotools/source/config/javaoptions.cxx @@ -29,12 +29,12 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #ifndef GCC #endif -#ifndef _SVTOOLS_JAVAPTIONS_HXX -#include <javaoptions.hxx> +#ifndef _unotools_JAVAPTIONS_HXX +#include <unotools/javaoptions.hxx> #endif #include <com/sun/star/uno/Any.h> #include <com/sun/star/uno/Sequence.hxx> @@ -57,6 +57,7 @@ public: SvtExecAppletsItem_Impl(); virtual void Commit(); + void Notify( const Sequence< rtl::OUString >& ); sal_Bool IsExecuteApplets() const {return bExecute;} void SetExecuteApplets(sal_Bool bSet); @@ -82,7 +83,7 @@ SvtExecAppletsItem_Impl::SvtExecAppletsItem_Impl() : bExecute (sal_False ), bRO (CFG_READONLY_DEFAULT ) { - RTL_LOGFILE_CONTEXT(aLog, "svtools SvtExecAppletsItem_Impl::SvtExecAppletsItem_Impl()"); + RTL_LOGFILE_CONTEXT(aLog, "unotools SvtExecAppletsItem_Impl::SvtExecAppletsItem_Impl()"); Sequence< OUString > aNames(1); aNames.getArray()[0] = C2U("Enable"); @@ -108,6 +109,10 @@ void SvtExecAppletsItem_Impl::Commit() PutProperties(aNames, aValues); } +void SvtExecAppletsItem_Impl::Notify( const Sequence< rtl::OUString >& ) +{ + // no listeners supported yet +} struct SvtJavaOptions_Impl { @@ -147,7 +152,7 @@ SvtJavaOptions::SvtJavaOptions() : utl::ConfigItem(C2U("Office.Java/VirtualMachine")), pImpl(new SvtJavaOptions_Impl) { - RTL_LOGFILE_CONTEXT(aLog, "svtools SvtJavaOptions::SvtJavaOptions()"); + RTL_LOGFILE_CONTEXT(aLog, "unotools SvtJavaOptions::SvtJavaOptions()"); Sequence< Any > aValues = GetProperties(pImpl->aPropertyNames); Sequence< sal_Bool > aROStates = GetReadOnlyStates(pImpl->aPropertyNames); diff --git a/svtools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index 2b4e4d482c3f..d4eff83efec6 100644 --- a/svtools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #include <com/sun/star/lang/Locale.hpp> @@ -44,9 +44,9 @@ #include <vos/mutex.hxx> #include <i18npool/mslangid.hxx> #include <tools/debug.hxx> -#include <vcl/svapp.hxx> -#include <svtools/lingucfg.hxx> -#include <linguprops.hxx> +#include <tools/string.hxx> +#include <unotools/lingucfg.hxx> +#include <unotools/linguprops.hxx> #include <comphelper/processfactory.hxx> @@ -229,6 +229,7 @@ SvtLinguConfigItem::~SvtLinguConfigItem() void SvtLinguConfigItem::Notify( const uno::Sequence< OUString > &rPropertyNames ) { LoadOptions( rPropertyNames ); + NotifyListeners(0); } @@ -573,6 +574,7 @@ BOOL SvtLinguConfigItem::SetProperty( INT32 nPropertyHandle, const uno::Any &rVa if (bMod) SetModified(); + NotifyListeners(0); return bSucc; } @@ -592,6 +594,7 @@ BOOL SvtLinguConfigItem::SetOptions( const SvtLinguOptions &rOptions ) aOpt = rOptions; SetModified(); + NotifyListeners(0); return TRUE; } @@ -1055,8 +1058,6 @@ static uno::Reference< util::XMacroExpander > lcl_GetMacroExpander() uno::Reference< util::XMacroExpander > xMacroExpander( aG_xMacroExpander ); if ( !xMacroExpander.is() ) { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - if ( !xMacroExpander.is() ) { uno::Reference< uno::XComponentContext > xContext; diff --git a/svtools/source/config/localisationoptions.cxx b/unotools/source/config/localisationoptions.cxx index aab7ab17b1ea..2ac2524e7d08 100644 --- a/svtools/source/config/localisationoptions.cxx +++ b/unotools/source/config/localisationoptions.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #ifndef GCC #endif @@ -37,7 +37,7 @@ // includes //_________________________________________________________________________________________________________________ -#include <svtools/localisationoptions.hxx> +#include <unotools/localisationoptions.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> #include <tools/debug.hxx> @@ -271,6 +271,8 @@ void SvtLocalisationOptions_Impl::Notify( const Sequence< OUString >& seqPropert else DBG_ASSERT( sal_False, "SvtLocalisationOptions_Impl::Notify()\nUnkown property detected ... I can't handle these!\n" ); #endif } + + NotifyListeners(0); } //***************************************************************************************************************** @@ -372,7 +374,7 @@ SvtLocalisationOptions::SvtLocalisationOptions() // ... and initialize ouer data container only if it not already exist! if( m_pDataContainer == NULL ) { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtLocalisationOptions_Impl::ctor()"); + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtLocalisationOptions_Impl::ctor()"); m_pDataContainer = new SvtLocalisationOptions_Impl; ItemHolder1::holdConfigItem(E_LOCALISATIONOPTIONS); diff --git a/unotools/source/config/makefile.mk b/unotools/source/config/makefile.mk index bd5a1b16512f..de87d9503339 100644 --- a/unotools/source/config/makefile.mk +++ b/unotools/source/config/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # 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 @@ -45,13 +45,49 @@ ENABLE_EXCEPTIONS=TRUE # --- Files ------------------------------------- SLOFILES=\ + $(SLO)$/syslocaleoptions.obj \ $(SLO)$/configvaluecontainer.obj \ $(SLO)$/confignode.obj \ $(SLO)$/configitem.obj \ $(SLO)$/configmgr.obj \ $(SLO)$/configpathes.obj \ $(SLO)$/docinfohelper.obj \ - $(SLO)$/bootstrap.obj + $(SLO)$/bootstrap.obj \ + $(SLO)$/accelcfg.obj \ + $(SLO)$/cacheoptions.obj \ + $(SLO)$/cmdoptions.obj \ + $(SLO)$/compatibility.obj \ + $(SLO)$/defaultoptions.obj \ + $(SLO)$/dynamicmenuoptions.obj \ + $(SLO)$/eventcfg.obj \ + $(SLO)$/extendedsecurityoptions.obj \ + $(SLO)$/fltrcfg.obj \ + $(SLO)$/fontcfg.obj \ + $(SLO)$/fontoptions.obj \ + $(SLO)$/historyoptions.obj \ + $(SLO)$/inetoptions.obj \ + $(SLO)$/internaloptions.obj \ + $(SLO)$/itemholder1.obj \ + $(SLO)$/javaoptions.obj \ + $(SLO)$/lingucfg.obj \ + $(SLO)$/localisationoptions.obj \ + $(SLO)$/misccfg.obj \ + $(SLO)$/moduleoptions.obj \ + $(SLO)$/options.obj \ + $(SLO)$/optionsdlg.obj \ + $(SLO)$/pathoptions.obj \ + $(SLO)$/printwarningoptions.obj \ + $(SLO)$/regoptions.obj \ + $(SLO)$/saveopt.obj \ + $(SLO)$/searchopt.obj \ + $(SLO)$/securityoptions.obj \ + $(SLO)$/sourceviewconfig.obj \ + $(SLO)$/startoptions.obj \ + $(SLO)$/undoopt.obj \ + $(SLO)$/useroptions.obj \ + $(SLO)$/viewoptions.obj \ + $(SLO)$/workingsetoptions.obj \ + $(SLO)$/xmlaccelcfg.obj # --- Targets ---------------------------------- diff --git a/unotools/source/config/menuoptions.cxx b/unotools/source/config/menuoptions.cxx new file mode 100644 index 000000000000..c885d5a1e81c --- /dev/null +++ b/unotools/source/config/menuoptions.cxx @@ -0,0 +1,564 @@ +/************************************************************************* + * + * 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: menuoptions.cxx,v $ + * $Revision: 1.14 $ + * + * 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_unotools.hxx" +#ifndef GCC +#endif + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include <unotools/menuoptions.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 <vcl/svapp.hxx> + +#include <rtl/logfile.hxx> +#include "itemholder1.hxx" + +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +using namespace ::utl ; +using namespace ::rtl ; +using namespace ::osl ; +using namespace ::com::sun::star::uno ; + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +#define ROOTNODE_MENU OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/View/Menu" )) +#define DEFAULT_DONTHIDEDISABLEDENTRIES sal_False +#define DEFAULT_FOLLOWMOUSE sal_True +#define DEFAULT_MENUICONS 2 + +#define PROPERTYNAME_DONTHIDEDISABLEDENTRIES OUString(RTL_CONSTASCII_USTRINGPARAM("DontHideDisabledEntry" )) +#define PROPERTYNAME_FOLLOWMOUSE OUString(RTL_CONSTASCII_USTRINGPARAM("FollowMouse" )) +#define PROPERTYNAME_SHOWICONSINMENUES OUString(RTL_CONSTASCII_USTRINGPARAM("ShowIconsInMenues" )) +#define PROPERTYNAME_SYSTEMICONSINMENUES OUString(RTL_CONSTASCII_USTRINGPARAM("IsSystemIconsInMenus" )) + +#define PROPERTYHANDLE_DONTHIDEDISABLEDENTRIES 0 +#define PROPERTYHANDLE_FOLLOWMOUSE 1 +#define PROPERTYHANDLE_SHOWICONSINMENUES 2 +#define PROPERTYHANDLE_SYSTEMICONSINMENUES 3 + +#define PROPERTYCOUNT 4 + +#include <tools/link.hxx> +#include <tools/list.hxx> +DECLARE_LIST( LinkList, Link * ) + +//_________________________________________________________________________________________________________________ +// private declarations! +//_________________________________________________________________________________________________________________ + +class SvtMenuOptions_Impl : public ConfigItem +{ + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + LinkList aList; + sal_Bool m_bDontHideDisabledEntries ; /// cache "DontHideDisabledEntries" of Menu section + sal_Bool m_bFollowMouse ; /// cache "FollowMouse" of Menu section + sal_Int16 m_nMenuIcons ; /// cache "MenuIcons" of Menu section + + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + SvtMenuOptions_Impl(); + ~SvtMenuOptions_Impl(); + + void AddListener( const Link& rLink ); + void RemoveListener( const Link& rLink ); + + //--------------------------------------------------------------------------------------------------------- + // 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 access method to get internal values + @descr These method give us a chance to regulate acces to ouer internal values. + It's not used in the moment - but it's possible for the feature! + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + sal_Bool IsEntryHidingEnabled() const + { return m_bDontHideDisabledEntries; } + + sal_Bool IsFollowMouseEnabled() const + { return m_bFollowMouse; } + + sal_Int16 GetMenuIconsState() const + { return m_nMenuIcons; } + + void SetEntryHidingState ( sal_Bool bState ) + { + m_bDontHideDisabledEntries = bState; + SetModified(); + for ( USHORT n=0; n<aList.Count(); n++ ) + aList.GetObject(n)->Call( this ); + Commit(); + } + + void SetFollowMouseState ( sal_Bool bState ) + { + m_bFollowMouse = bState; + SetModified(); + for ( USHORT n=0; n<aList.Count(); n++ ) + aList.GetObject(n)->Call( this ); + Commit(); + } + + void SetMenuIconsState ( sal_Int16 bState ) + { + m_nMenuIcons = bState; + SetModified(); + for ( USHORT n=0; n<aList.Count(); n++ ) + aList.GetObject(n)->Call( this ); + Commit(); + } + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return list of fix key names of ouer configuration management which represent oue module tree + @descr These methods return a static const list of key names. We need it to get needed values from our + configuration management. + + @seealso - + + @param - + @return A list of needed configuration keys is returned. + + @onerror - + *//*-*****************************************************************************************************/ + + static Sequence< OUString > impl_GetPropertyNames(); +}; + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtMenuOptions_Impl::SvtMenuOptions_Impl() + // Init baseclasses first + : ConfigItem ( ROOTNODE_MENU ) + // Init member then. + , m_bDontHideDisabledEntries ( DEFAULT_DONTHIDEDISABLEDENTRIES ) + , m_bFollowMouse ( DEFAULT_FOLLOWMOUSE ) + , m_nMenuIcons ( DEFAULT_MENUICONS ) +{ + // Use our static list of configuration keys to get his values. + Sequence< OUString > seqNames = impl_GetPropertyNames(); + 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()), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nI miss some values of configuration keys!\n" ); + + sal_Bool bMenuIcons = true; + sal_Bool bSystemMenuIcons = true; + + // 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 ) + { + // Safe impossible cases. + // Check any for valid value. + DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nInvalid property value for property detected!\n" ); + switch( nProperty ) + { + case PROPERTYHANDLE_DONTHIDEDISABLEDENTRIES : { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\DontHideDisabledEntry\"?" ); + seqValues[nProperty] >>= m_bDontHideDisabledEntries; + } + break; + + case PROPERTYHANDLE_FOLLOWMOUSE : { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\FollowMouse\"?" ); + seqValues[nProperty] >>= m_bFollowMouse; + } + break; + case PROPERTYHANDLE_SHOWICONSINMENUES : { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\ShowIconsInMenues\"?" ); + seqValues[nProperty] >>= bMenuIcons; + } + break; + case PROPERTYHANDLE_SYSTEMICONSINMENUES : { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\IsSystemIconsInMenus\"?" ); + seqValues[nProperty] >>= bSystemMenuIcons; + } + break; + } + } + + m_nMenuIcons = bSystemMenuIcons ? 2 : bMenuIcons; + + EnableNotification( seqNames ); +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtMenuOptions_Impl::~SvtMenuOptions_Impl() +{ + // Flush data to configuration! + // User has no chance to do that. + if( IsModified() == sal_True ) + { + Commit(); + } + + for ( USHORT n=0; n<aList.Count(); ) + delete aList.Remove(n); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtMenuOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames ) +{ + // Use given list of updated properties to get his values from configuration directly! + Sequence< Any > seqValues = GetProperties( seqPropertyNames ); + // Safe impossible cases. + // We need values from ALL notified configuration keys. + DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtMenuOptions_Impl::Notify()\nI miss some values of configuration keys!\n" ); + + sal_Bool bMenuIcons = true; + sal_Bool bSystemMenuIcons = true; + + // Step over list of property names and get right value from coreesponding value list to set it on internal members! + sal_Int32 nCount = seqPropertyNames.getLength(); + for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty ) + { + if( seqPropertyNames[nProperty] == PROPERTYNAME_DONTHIDEDISABLEDENTRIES ) + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\View\\Menu\\DontHideDisabledEntry\"?" ); + seqValues[nProperty] >>= m_bDontHideDisabledEntries; + } + else if( seqPropertyNames[nProperty] == PROPERTYNAME_FOLLOWMOUSE ) + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\View\\Menu\\FollowMouse\"?" ); + seqValues[nProperty] >>= m_bFollowMouse; + } + else if( seqPropertyNames[nProperty] == PROPERTYNAME_SHOWICONSINMENUES ) + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\ShowIconsInMenues\"?" ); + seqValues[nProperty] >>= bMenuIcons; + } + else if( seqPropertyNames[nProperty] == PROPERTYNAME_SYSTEMICONSINMENUES ) + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtMenuOptions_Impl::SvtMenuOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Menu\\IsSystemIconsInMenus\"?" ); + seqValues[nProperty] >>= bSystemMenuIcons; + } + + #if OSL_DEBUG_LEVEL > 1 + else DBG_ASSERT( sal_False, "SvtMenuOptions_Impl::Notify()\nUnkown property detected ... I can't handle these!\n" ); + #endif + } + + m_nMenuIcons = bSystemMenuIcons ? 2 : bMenuIcons; + + for ( USHORT n=0; n<aList.Count(); n++ ) + aList.GetObject(n)->Call( this ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtMenuOptions_Impl::Commit() +{ + // Get names of supported properties, create a list for values and copy current values to it. + Sequence< OUString > seqNames = impl_GetPropertyNames(); + sal_Int32 nCount = seqNames.getLength(); + Sequence< Any > seqValues ( nCount ); + for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty ) + { + switch( nProperty ) + { + case PROPERTYHANDLE_DONTHIDEDISABLEDENTRIES : { + seqValues[nProperty] <<= m_bDontHideDisabledEntries; + } + break; + + case PROPERTYHANDLE_FOLLOWMOUSE : { + seqValues[nProperty] <<= m_bFollowMouse; + } + break; + //Output cache of current setting as possibly modified by System Theme for older version + case PROPERTYHANDLE_SHOWICONSINMENUES : { + seqValues[nProperty] <<=(sal_Bool)(Application::GetSettings().GetStyleSettings().GetUseImagesInMenus()); + } + break; + case PROPERTYHANDLE_SYSTEMICONSINMENUES : { + seqValues[nProperty] <<= (m_nMenuIcons == 2 ? sal_True : sal_False) ; + } + break; + } + } + // Set properties in configuration. + PutProperties( seqNames, seqValues ); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Sequence< OUString > SvtMenuOptions_Impl::impl_GetPropertyNames() +{ + // Build static list of configuration key names. + static const OUString pProperties[] = + { + PROPERTYNAME_DONTHIDEDISABLEDENTRIES , + PROPERTYNAME_FOLLOWMOUSE , + PROPERTYNAME_SHOWICONSINMENUES , + PROPERTYNAME_SYSTEMICONSINMENUES + }; + // Initialize return sequence with these list ... + static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); + // ... and return it. + return seqPropertyNames; +} + +void SvtMenuOptions_Impl::AddListener( const Link& rLink ) +{ + aList.Insert( new Link( rLink ) ); +} + +void SvtMenuOptions_Impl::RemoveListener( const Link& rLink ) +{ + for ( USHORT n=0; n<aList.Count(); n++ ) + { + if ( (*aList.GetObject(n) ) == rLink ) + { + delete aList.Remove(n); + break; + } + } +} + +//***************************************************************************************************************** +// initialize static member +// DON'T DO IT IN YOUR HEADER! +// see definition for further informations +//***************************************************************************************************************** +SvtMenuOptions_Impl* SvtMenuOptions::m_pDataContainer = NULL ; +sal_Int32 SvtMenuOptions::m_nRefCount = 0 ; + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtMenuOptions::SvtMenuOptions() +{ + // 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 ) + { + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtMenuOptions_Impl::ctor()"); + m_pDataContainer = new SvtMenuOptions_Impl(); + + ItemHolder1::holdConfigItem(E_MENUOPTIONS); + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtMenuOptions::~SvtMenuOptions() +{ + // 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 SvtMenuOptions::IsEntryHidingEnabled() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsEntryHidingEnabled(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtMenuOptions::IsFollowMouseEnabled() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsFollowMouseEnabled(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtMenuOptions::SetEntryHidingState( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetEntryHidingState( bState ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtMenuOptions::SetFollowMouseState( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetFollowMouseState( bState ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Int16 SvtMenuOptions::GetMenuIconsState() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetMenuIconsState(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtMenuOptions::SetMenuIconsState( sal_Int16 bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetMenuIconsState( bState ); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Mutex& SvtMenuOptions::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; +} + +void SvtMenuOptions::AddListener( const Link& rLink ) +{ + m_pDataContainer->AddListener( rLink ); +} + +void SvtMenuOptions::RemoveListener( const Link& rLink ) +{ + m_pDataContainer->RemoveListener( rLink ); +} diff --git a/svtools/source/config/misccfg.cxx b/unotools/source/config/misccfg.cxx index 06cc9b7446c0..a1c905d292f3 100644 --- a/svtools/source/config/misccfg.cxx +++ b/unotools/source/config/misccfg.cxx @@ -29,19 +29,19 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - -#include "misccfg.hxx" -#include <svtools/zforlist.hxx> +#include <unotools/misccfg.hxx> +#include "rtl/instance.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 <vos/mutex.hxx> +#include <osl/mutex.hxx> #include <rtl/logfile.hxx> - +#include "itemholder1.hxx" #define DEFAULT_TAB 2000 @@ -52,6 +52,45 @@ using namespace rtl; using namespace com::sun::star::uno; #define C2U(cChar) OUString::createFromAscii(cChar) + +namespace utl +{ + +static SfxMiscCfg* pOptions = NULL; +static sal_Int32 nRefCount = 0; + +class SfxMiscCfg : public utl::ConfigItem +{ + BOOL bPaperSize; // printer warnings + BOOL bPaperOrientation; + BOOL bNotFound; + sal_Int32 nYear2000; // two digit year representation + + const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames(); + void Load(); + +public: + SfxMiscCfg( ); + ~SfxMiscCfg( ); + + virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames); + virtual void Commit(); + + BOOL IsNotFoundWarning() const {return bNotFound;} + void SetNotFoundWarning( BOOL bSet); + + BOOL IsPaperSizeWarning() const {return bPaperSize;} + void SetPaperSizeWarning(BOOL bSet); + + BOOL IsPaperOrientationWarning() const {return bPaperOrientation;} + void SetPaperOrientationWarning( BOOL bSet); + + // 0 ... 99 + sal_Int32 GetYear2000() const { return nYear2000; } + void SetYear2000( sal_Int32 nSet ); + +}; + /*-------------------------------------------------------------------- Beschreibung: --------------------------------------------------------------------*/ @@ -60,9 +99,9 @@ SfxMiscCfg::SfxMiscCfg() : bPaperSize(FALSE), bPaperOrientation (FALSE), bNotFound (FALSE), - nYear2000( SvNumberFormatter::GetYear2000Default() ) + nYear2000( 1930 ) { - RTL_LOGFILE_CONTEXT(aLog, "svtools SfxMiscCfg::SfxMiscCfg()"); + RTL_LOGFILE_CONTEXT(aLog, "svl SfxMiscCfg::SfxMiscCfg()"); Load(); } @@ -192,4 +231,83 @@ void SfxMiscCfg::Commit() } PutProperties(aNames, aValues); } +// ----------------------------------------------------------------------- +namespace +{ + class LocalSingleton : public rtl::Static< osl::Mutex, LocalSingleton > + { + }; +} + +MiscCfg::MiscCfg( ) +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( LocalSingleton::get() ); + if ( !pOptions ) + { + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) SfxMiscCfg::ctor()"); + pOptions = new SfxMiscCfg; + + ItemHolder1::holdConfigItem(E_MISCCFG); + } + + ++nRefCount; + pImpl = pOptions; + pImpl->AddListener(this); +} + +MiscCfg::~MiscCfg( ) +{ + // Global access, must be guarded (multithreading) + ::osl::MutexGuard aGuard( LocalSingleton::get() ); + pImpl->RemoveListener(this); + if ( !--nRefCount ) + { + if ( pOptions->IsModified() ) + pOptions->Commit(); + DELETEZ( pOptions ); + } +} + +BOOL MiscCfg::IsNotFoundWarning() const +{ + return pImpl->IsNotFoundWarning(); +} + +void MiscCfg::SetNotFoundWarning( BOOL bSet) +{ + pImpl->SetNotFoundWarning( bSet ); +} + +BOOL MiscCfg::IsPaperSizeWarning() const +{ + return pImpl->IsPaperSizeWarning(); +} + +void MiscCfg::SetPaperSizeWarning(BOOL bSet) +{ + pImpl->SetPaperSizeWarning( bSet ); +} + +BOOL MiscCfg::IsPaperOrientationWarning() const +{ + return pImpl->IsPaperOrientationWarning(); +} + +void MiscCfg::SetPaperOrientationWarning( BOOL bSet) +{ + pImpl->SetPaperOrientationWarning( bSet ); +} + +sal_Int32 MiscCfg::GetYear2000() const +{ + return pImpl->GetYear2000(); +} + +void MiscCfg::SetYear2000( sal_Int32 nSet ) +{ + pImpl->SetYear2000( nSet ); +} + +} diff --git a/svtools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx index fda0967d65ed..f966d4415558 100644 --- a/svtools/source/config/moduleoptions.cxx +++ b/unotools/source/config/moduleoptions.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #ifndef GCC #endif @@ -37,7 +37,7 @@ // includes //_________________________________________________________________________________________________________________ -#include <svtools/moduleoptions.hxx> +#include <unotools/moduleoptions.hxx> #include <comphelper/sequenceashashmap.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> @@ -1120,7 +1120,7 @@ SvtModuleOptions::SvtModuleOptions() ++m_nRefCount; if( m_nRefCount == 1 ) { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtModuleOptions_Impl::ctor()"); + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtModuleOptions_Impl::ctor()"); m_pDataContainer = new SvtModuleOptions_Impl(this); ItemHolder1::holdConfigItem(E_MODULEOPTIONS); diff --git a/unotools/source/config/options.cxx b/unotools/source/config/options.cxx new file mode 100644 index 000000000000..7c004e1475a6 --- /dev/null +++ b/unotools/source/config/options.cxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * 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: options.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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_unotools.hxx" + +#include "sal/config.h" +#include <tools/list.hxx> +#include <unotools/options.hxx> + +namespace utl +{ + DECLARE_LIST( IMPL_ConfigurationListenerList, ConfigurationListener* ) +} + +using utl::detail::Options; +using utl::ConfigurationBroadcaster; + +ConfigurationBroadcaster::ConfigurationBroadcaster() +: mpList(0) +, m_nBroadcastBlocked( 0 ) +, m_nBlockedHint( 0 ) +{ +} + +ConfigurationBroadcaster::~ConfigurationBroadcaster() +{ + delete mpList; +} + +void ConfigurationBroadcaster::AddListener( utl::ConfigurationListener* pListener ) +{ + if ( !mpList ) + mpList = new IMPL_ConfigurationListenerList; + mpList->Insert( pListener ); +} + +void ConfigurationBroadcaster::RemoveListener( utl::ConfigurationListener* pListener ) +{ + if ( mpList ) + mpList->Remove( pListener ); +} + +void ConfigurationBroadcaster::NotifyListeners( sal_uInt32 nHint ) +{ + if ( m_nBroadcastBlocked ) + m_nBlockedHint |= nHint; + else + { + nHint |= m_nBlockedHint; + m_nBlockedHint = 0; + if ( mpList ) + for ( sal_uInt32 n=0; n<mpList->Count(); n++ ) + mpList->GetObject(n)->ConfigurationChanged( this, nHint ); + } +} + +void ConfigurationBroadcaster::BlockBroadcasts( bool bBlock ) +{ + if ( bBlock ) + ++m_nBroadcastBlocked; + else if ( m_nBroadcastBlocked ) + { + if ( --m_nBroadcastBlocked == 0 ) + NotifyListeners( 0 ); + } +} + +Options::Options() +{ +} + +Options::~Options() +{ +} + +void Options::ConfigurationChanged( ConfigurationBroadcaster*, sal_uInt32 nHint ) +{ + NotifyListeners( nHint ); +} + + diff --git a/svtools/source/config/optionsdlg.cxx b/unotools/source/config/optionsdlg.cxx index 87878b0302bc..5ac76af8efd7 100644 --- a/svtools/source/config/optionsdlg.cxx +++ b/unotools/source/config/optionsdlg.cxx @@ -29,9 +29,9 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" -#include <svtools/optionsdlg.hxx> +#include <unotools/optionsdlg.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> #include <tools/debug.hxx> diff --git a/unotools/source/config/optionsdrawinglayer.cxx b/unotools/source/config/optionsdrawinglayer.cxx new file mode 100644 index 000000000000..7bfefdcbef09 --- /dev/null +++ b/unotools/source/config/optionsdrawinglayer.cxx @@ -0,0 +1,1708 @@ +/************************************************************************* + * + * 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: optionsdrawinglayer.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. + * + ************************************************************************/ +#ifdef _MSC_VER +#pragma hdrstop +#endif + +//_________________________________________________________________________________________________________________ +// includes +//_________________________________________________________________________________________________________________ + +#include <unotools/optionsdrawinglayer.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 <vcl/svapp.hxx> +#include <vcl/outdev.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/Drawinglayer" )) +#define DEFAULT_OVERLAYBUFFER sal_True +#define DEFAULT_PAINTBUFFER sal_True +#define DEFAULT_STRIPE_COLOR_A 0 +#define DEFAULT_STRIPE_COLOR_B 16581375 +#define DEFAULT_STRIPE_LENGTH 4 + +// #i73602# +// #i74769#, #i75172# : Change default for Calc and Writer to True +#define DEFAULT_OVERLAYBUFFER_CALC sal_True +#define DEFAULT_OVERLAYBUFFER_WRITER sal_True +#define DEFAULT_OVERLAYBUFFER_DRAWIMPRESS sal_True + +// #i74769#, #i75172# +#define DEFAULT_PAINTBUFFER_CALC sal_True +#define DEFAULT_PAINTBUFFER_WRITER sal_True +#define DEFAULT_PAINTBUFFER_DRAWIMPRESS sal_True + +// #i4219# +#define DEFAULT_MAXIMUMPAPERWIDTH 300 +#define DEFAULT_MAXIMUMPAPERHEIGHT 300 +#define DEFAULT_MAXIMUMPAPERLEFTMARGIN 9999 +#define DEFAULT_MAXIMUMPAPERRIGHTMARGIN 9999 +#define DEFAULT_MAXIMUMPAPERTOPMARGIN 9999 +#define DEFAULT_MAXIMUMPAPERBOTTOMMARGIN 9999 + +// primitives +#define DEFAULT_ANTIALIASING sal_True +#define DEFAULT_SNAPHORVERLINESTODISCRETE sal_True +#define DEFAULT_SOLIDDRAGCREATE sal_True +#define DEFAULT_RENDERDECORATEDTEXTDIRECT sal_True +#define DEFAULT_RENDERSIMPLETEXTDIRECT sal_True +#define DEFAULT_QUADRATIC3DRENDERLIMIT 1000000 +#define DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT 45000 + +// #i97672# selection settings +#define DEFAULT_TRANSPARENTSELECTION sal_True +#define DEFAULT_TRANSPARENTSELECTIONPERCENT 75 +#define DEFAULT_SELECTIONMAXIMUMLUMINANCEPERCENT 70 + +#define PROPERTYNAME_OVERLAYBUFFER OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer" )) +#define PROPERTYNAME_PAINTBUFFER OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer" )) +#define PROPERTYNAME_STRIPE_COLOR_A OUString(RTL_CONSTASCII_USTRINGPARAM("StripeColorA" )) +#define PROPERTYNAME_STRIPE_COLOR_B OUString(RTL_CONSTASCII_USTRINGPARAM("StripeColorB" )) +#define PROPERTYNAME_STRIPE_LENGTH OUString(RTL_CONSTASCII_USTRINGPARAM("StripeLength" )) + +// #i73602# +#define PROPERTYNAME_OVERLAYBUFFER_CALC OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer_Calc")) +#define PROPERTYNAME_OVERLAYBUFFER_WRITER OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer_Writer")) +#define PROPERTYNAME_OVERLAYBUFFER_DRAWIMPRESS OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer_DrawImpress")) + +// #i74769#, #i75172# +#define PROPERTYNAME_PAINTBUFFER_CALC OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer_Calc")) +#define PROPERTYNAME_PAINTBUFFER_WRITER OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer_Writer")) +#define PROPERTYNAME_PAINTBUFFER_DRAWIMPRESS OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer_DrawImpress")) + +// #i4219# +#define PROPERTYNAME_MAXIMUMPAPERWIDTH OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperWidth")) +#define PROPERTYNAME_MAXIMUMPAPERHEIGHT OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperHeight")) +#define PROPERTYNAME_MAXIMUMPAPERLEFTMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperLeftMargin")) +#define PROPERTYNAME_MAXIMUMPAPERRIGHTMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperRightMargin")) +#define PROPERTYNAME_MAXIMUMPAPERTOPMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperTopMargin")) +#define PROPERTYNAME_MAXIMUMPAPERBOTTOMMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperBottomMargin")) + +// primitives +#define PROPERTYNAME_ANTIALIASING OUString(RTL_CONSTASCII_USTRINGPARAM("AntiAliasing")) +#define PROPERTYNAME_SNAPHORVERLINESTODISCRETE OUString(RTL_CONSTASCII_USTRINGPARAM("SnapHorVerLinesToDiscrete")) +#define PROPERTYNAME_SOLIDDRAGCREATE OUString(RTL_CONSTASCII_USTRINGPARAM("SolidDragCreate")) +#define PROPERTYNAME_RENDERDECORATEDTEXTDIRECT OUString(RTL_CONSTASCII_USTRINGPARAM("RenderDecoratedTextDirect")) +#define PROPERTYNAME_RENDERSIMPLETEXTDIRECT OUString(RTL_CONSTASCII_USTRINGPARAM("RenderSimpleTextDirect")) +#define PROPERTYNAME_QUADRATIC3DRENDERLIMIT OUString(RTL_CONSTASCII_USTRINGPARAM("Quadratic3DRenderLimit")) +#define PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT OUString(RTL_CONSTASCII_USTRINGPARAM("QuadraticFormControlRenderLimit")) + +// #i97672# selection settings +#define PROPERTYNAME_TRANSPARENTSELECTION OUString(RTL_CONSTASCII_USTRINGPARAM("TransparentSelection")) +#define PROPERTYNAME_TRANSPARENTSELECTIONPERCENT OUString(RTL_CONSTASCII_USTRINGPARAM("TransparentSelectionPercent")) +#define PROPERTYNAME_SELECTIONMAXIMUMLUMINANCEPERCENT OUString(RTL_CONSTASCII_USTRINGPARAM("SelectionMaximumLuminancePercent")) + +#define PROPERTYHANDLE_OVERLAYBUFFER 0 +#define PROPERTYHANDLE_PAINTBUFFER 1 +#define PROPERTYHANDLE_STRIPE_COLOR_A 2 +#define PROPERTYHANDLE_STRIPE_COLOR_B 3 +#define PROPERTYHANDLE_STRIPE_LENGTH 4 + +// #i73602# +#define PROPERTYHANDLE_OVERLAYBUFFER_CALC 5 +#define PROPERTYHANDLE_OVERLAYBUFFER_WRITER 6 +#define PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS 7 + +// #i74769#, #i75172# +#define PROPERTYHANDLE_PAINTBUFFER_CALC 8 +#define PROPERTYHANDLE_PAINTBUFFER_WRITER 9 +#define PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS 10 + +// #i4219# +#define PROPERTYHANDLE_MAXIMUMPAPERWIDTH 11 +#define PROPERTYHANDLE_MAXIMUMPAPERHEIGHT 12 +#define PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN 13 +#define PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN 14 +#define PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN 15 +#define PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN 16 + +// primitives +#define PROPERTYHANDLE_ANTIALIASING 17 +#define PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE 18 +#define PROPERTYHANDLE_SOLIDDRAGCREATE 19 +#define PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT 20 +#define PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT 21 +#define PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT 22 +#define PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT 23 + +// #i97672# selection settings +#define PROPERTYHANDLE_TRANSPARENTSELECTION 24 +#define PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT 25 +#define PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT 26 + +#define PROPERTYCOUNT 27 + +class SvtOptionsDrawinglayer_Impl : public ConfigItem +{ +public: + +//--------------------------------------------------------------------------------------------------------- +// constructor / destructor +//--------------------------------------------------------------------------------------------------------- + + SvtOptionsDrawinglayer_Impl(); + ~SvtOptionsDrawinglayer_Impl(); + +//--------------------------------------------------------------------------------------------------------- +// overloaded methods of baseclass +//--------------------------------------------------------------------------------------------------------- + + virtual void Commit(); + +//--------------------------------------------------------------------------------------------------------- +// public interface +//--------------------------------------------------------------------------------------------------------- + + sal_Bool IsOverlayBuffer() const; + sal_Bool IsPaintBuffer() const; + Color GetStripeColorA() const; + Color GetStripeColorB() const; + sal_uInt16 GetStripeLength() const; + + // #i73602# + sal_Bool IsOverlayBuffer_Calc() const; + sal_Bool IsOverlayBuffer_Writer() const; + sal_Bool IsOverlayBuffer_DrawImpress() const; + + // #i74769#, #i75172# + sal_Bool IsPaintBuffer_Calc() const; + sal_Bool IsPaintBuffer_Writer() const; + sal_Bool IsPaintBuffer_DrawImpress() const; + + void SetOverlayBuffer( sal_Bool bState ); + void SetPaintBuffer( sal_Bool bState ); + void SetStripeColorA( Color aColor ); + void SetStripeColorB( Color aColor ); + void SetStripeLength( sal_uInt16 nLength ); + + // #i73602# + void SetOverlayBuffer_Calc( sal_Bool bState ); + void SetOverlayBuffer_Writer( sal_Bool bState ); + void SetOverlayBuffer_DrawImpress( sal_Bool bState ); + + // #i74769#, #i75172# + void SetPaintBuffer_Calc( sal_Bool bState ); + void SetPaintBuffer_Writer( sal_Bool bState ); + void SetPaintBuffer_DrawImpress( sal_Bool bState ); + + // #i4219# + sal_uInt32 GetMaximumPaperWidth() const; + sal_uInt32 GetMaximumPaperHeight() const; + sal_uInt32 GetMaximumPaperLeftMargin() const; + sal_uInt32 GetMaximumPaperRightMargin() const; + sal_uInt32 GetMaximumPaperTopMargin() const; + sal_uInt32 GetMaximumPaperBottomMargin() const; + + void SetMaximumPaperWidth(sal_uInt32 nNew); + void SetMaximumPaperHeight(sal_uInt32 nNew); + void SetMaximumPaperLeftMargin(sal_uInt32 nNew); + void SetMaximumPaperRightMargin(sal_uInt32 nNew); + void SetMaximumPaperTopMargin(sal_uInt32 nNew); + void SetMaximumPaperBottomMargin(sal_uInt32 nNew); + + // helper + sal_Bool IsAAPossibleOnThisSystem() const; + + // primitives + sal_Bool IsAntiAliasing() const; + sal_Bool IsSnapHorVerLinesToDiscrete() const; + sal_Bool IsSolidDragCreate() const; + sal_Bool IsRenderDecoratedTextDirect() const; + sal_Bool IsRenderSimpleTextDirect() const; + sal_uInt32 GetQuadratic3DRenderLimit() const; + sal_uInt32 GetQuadraticFormControlRenderLimit() const; + + void SetAntiAliasing( sal_Bool bState ); + void SetSnapHorVerLinesToDiscrete( sal_Bool bState ); + void SetSolidDragCreate( sal_Bool bState ); + void SetRenderDecoratedTextDirect( sal_Bool bState ); + void SetRenderSimpleTextDirect( sal_Bool bState ); + void SetQuadratic3DRenderLimit(sal_uInt32 nNew); + void SetQuadraticFormControlRenderLimit(sal_uInt32 nNew); + + // #i97672# selection settings + sal_Bool IsTransparentSelection() const; + sal_uInt16 GetTransparentSelectionPercent() const; + sal_uInt16 GetSelectionMaximumLuminancePercent() const; + + void SetTransparentSelection( sal_Bool bState ); + void SetTransparentSelectionPercent( sal_uInt16 nPercent ); + void SetSelectionMaximumLuminancePercent( sal_uInt16 nPercent ); + +//------------------------------------------------------------------------------------------------------------- +// private methods +//------------------------------------------------------------------------------------------------------------- + +private: + + static Sequence< OUString > impl_GetPropertyNames(); + +//------------------------------------------------------------------------------------------------------------- +// private member +//------------------------------------------------------------------------------------------------------------- + +private: + + sal_Bool m_bOverlayBuffer; + sal_Bool m_bPaintBuffer; + Color m_bStripeColorA; + Color m_bStripeColorB; + sal_uInt16 m_nStripeLength; + + // #i73602# + sal_Bool m_bOverlayBuffer_Calc; + sal_Bool m_bOverlayBuffer_Writer; + sal_Bool m_bOverlayBuffer_DrawImpress; + + // #i74769#, #i75172# + sal_Bool m_bPaintBuffer_Calc; + sal_Bool m_bPaintBuffer_Writer; + sal_Bool m_bPaintBuffer_DrawImpress; + + // #i4219# + sal_uInt32 m_nMaximumPaperWidth; + sal_uInt32 m_nMaximumPaperHeight; + sal_uInt32 m_nMaximumPaperLeftMargin; + sal_uInt32 m_nMaximumPaperRightMargin; + sal_uInt32 m_nMaximumPaperTopMargin; + sal_uInt32 m_nMaximumPaperBottomMargin; + + // primitives + sal_Bool m_bAntiAliasing; + sal_Bool m_bSnapHorVerLinesToDiscrete; + sal_Bool m_bSolidDragCreate; + sal_Bool m_bRenderDecoratedTextDirect; + sal_Bool m_bRenderSimpleTextDirect; + sal_uInt32 m_nQuadratic3DRenderLimit; + sal_uInt32 m_nQuadraticFormControlRenderLimit; + + // #i97672# selection settings + sal_uInt16 m_nTransparentSelectionPercent; + sal_uInt16 m_nSelectionMaximumLuminancePercent; + sal_Bool m_bTransparentSelection; + + // local values + bool m_bAllowAA : 1; + bool m_bAllowAAChecked : 1; +}; + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() : + ConfigItem( ROOTNODE_START ), + m_bOverlayBuffer( DEFAULT_OVERLAYBUFFER ), + m_bPaintBuffer( DEFAULT_PAINTBUFFER ), + m_bStripeColorA(Color(DEFAULT_STRIPE_COLOR_A)), + m_bStripeColorB(Color(DEFAULT_STRIPE_COLOR_B)), + m_nStripeLength(DEFAULT_STRIPE_LENGTH), + + // #i73602# + m_bOverlayBuffer_Calc( DEFAULT_OVERLAYBUFFER_CALC ), + m_bOverlayBuffer_Writer( DEFAULT_OVERLAYBUFFER_WRITER ), + m_bOverlayBuffer_DrawImpress( DEFAULT_OVERLAYBUFFER_DRAWIMPRESS ), + + // #i74769#, #i75172# + m_bPaintBuffer_Calc( DEFAULT_PAINTBUFFER_CALC ), + m_bPaintBuffer_Writer( DEFAULT_PAINTBUFFER_WRITER ), + m_bPaintBuffer_DrawImpress( DEFAULT_PAINTBUFFER_DRAWIMPRESS ), + + // #i4219# + m_nMaximumPaperWidth(DEFAULT_MAXIMUMPAPERWIDTH), + m_nMaximumPaperHeight(DEFAULT_MAXIMUMPAPERHEIGHT), + m_nMaximumPaperLeftMargin(DEFAULT_MAXIMUMPAPERLEFTMARGIN), + m_nMaximumPaperRightMargin(DEFAULT_MAXIMUMPAPERRIGHTMARGIN), + m_nMaximumPaperTopMargin(DEFAULT_MAXIMUMPAPERTOPMARGIN), + m_nMaximumPaperBottomMargin(DEFAULT_MAXIMUMPAPERBOTTOMMARGIN), + + // primitives + m_bAntiAliasing(DEFAULT_ANTIALIASING), + m_bSnapHorVerLinesToDiscrete(DEFAULT_SNAPHORVERLINESTODISCRETE), + m_bSolidDragCreate(DEFAULT_SOLIDDRAGCREATE), + m_bRenderDecoratedTextDirect(DEFAULT_RENDERDECORATEDTEXTDIRECT), + m_bRenderSimpleTextDirect(DEFAULT_RENDERSIMPLETEXTDIRECT), + m_nQuadratic3DRenderLimit(DEFAULT_QUADRATIC3DRENDERLIMIT), + m_nQuadraticFormControlRenderLimit(DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT), + + // #i97672# selection settings + m_nTransparentSelectionPercent(DEFAULT_TRANSPARENTSELECTIONPERCENT), + m_nSelectionMaximumLuminancePercent(DEFAULT_SELECTIONMAXIMUMLUMINANCEPERCENT), + m_bTransparentSelection(DEFAULT_TRANSPARENTSELECTION), + + // local values + m_bAllowAA(true), + m_bAllowAAChecked(false) +{ + Sequence< OUString > seqNames( impl_GetPropertyNames() ); + Sequence< Any > seqValues = GetProperties( seqNames ) ; + + DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nI miss some values of configuration keys!\n" ); + + // Copy values from list in right order to ouer internal member. + sal_Int32 nPropertyCount = seqValues.getLength(); + sal_Int32 nProperty = 0; + + for( nProperty=0; nProperty<nPropertyCount; ++nProperty ) + { + DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nInvalid property value for property detected!\n" ); + + switch( nProperty ) + { + case PROPERTYHANDLE_OVERLAYBUFFER: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer\"?" ); + seqValues[nProperty] >>= m_bOverlayBuffer; + } + break; + + case PROPERTYHANDLE_PAINTBUFFER: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer\"?" ); + seqValues[nProperty] >>= m_bPaintBuffer; + } + break; + + case PROPERTYHANDLE_STRIPE_COLOR_A: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorA\"?" ); + sal_Int32 nValue = 0; + seqValues[nProperty] >>= nValue; + m_bStripeColorA = nValue; + } + break; + + case PROPERTYHANDLE_STRIPE_COLOR_B: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorB\"?" ); + sal_Int32 nValue = 0; + seqValues[nProperty] >>= nValue; + m_bStripeColorB = nValue; + } + break; + + case PROPERTYHANDLE_STRIPE_LENGTH: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeLength\"?" ); + seqValues[nProperty] >>= m_nStripeLength; + } + break; + + // #i73602# + case PROPERTYHANDLE_OVERLAYBUFFER_CALC: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_Calc\"?" ); + seqValues[nProperty] >>= m_bOverlayBuffer_Calc; + } + break; + + case PROPERTYHANDLE_OVERLAYBUFFER_WRITER: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_Writer\"?" ); + seqValues[nProperty] >>= m_bOverlayBuffer_Writer; + } + break; + + case PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_DrawImpress\"?" ); + seqValues[nProperty] >>= m_bOverlayBuffer_DrawImpress; + } + break; + + // #i74769#, #i75172# + case PROPERTYHANDLE_PAINTBUFFER_CALC: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_Calc\"?" ); + seqValues[nProperty] >>= m_bPaintBuffer_Calc; + } + break; + + case PROPERTYHANDLE_PAINTBUFFER_WRITER: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_Writer\"?" ); + seqValues[nProperty] >>= m_bPaintBuffer_Writer; + } + break; + + case PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_DrawImpress\"?" ); + seqValues[nProperty] >>= m_bPaintBuffer_DrawImpress; + } + break; + + // #i4219# + case PROPERTYHANDLE_MAXIMUMPAPERWIDTH: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperWidth\"?" ); + seqValues[nProperty] >>= m_nMaximumPaperWidth; + } + break; + + case PROPERTYHANDLE_MAXIMUMPAPERHEIGHT: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperHeight\"?" ); + seqValues[nProperty] >>= m_nMaximumPaperHeight; + } + break; + + case PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperLeftMargin\"?" ); + seqValues[nProperty] >>= m_nMaximumPaperLeftMargin; + } + break; + + case PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperRightMargin\"?" ); + seqValues[nProperty] >>= m_nMaximumPaperRightMargin; + } + break; + + case PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperTopMargin\"?" ); + seqValues[nProperty] >>= m_nMaximumPaperTopMargin; + } + break; + + case PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperBottomMargin\"?" ); + seqValues[nProperty] >>= m_nMaximumPaperBottomMargin; + } + break; + + // primitives + case PROPERTYHANDLE_ANTIALIASING: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\AntiAliasing\"?" ); + seqValues[nProperty] >>= m_bAntiAliasing; + } + break; + + // primitives + case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SnapHorVerLinesToDiscrete\"?" ); + seqValues[nProperty] >>= m_bSnapHorVerLinesToDiscrete; + } + 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_RENDERDECORATEDTEXTDIRECT: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderDecoratedTextDirect\"?" ); + seqValues[nProperty] >>= m_bRenderDecoratedTextDirect; + } + break; + + case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderSimpleTextDirect\"?" ); + seqValues[nProperty] >>= m_bRenderSimpleTextDirect; + } + 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\"?" ); + seqValues[nProperty] >>= m_nQuadratic3DRenderLimit; + } + break; + + case PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\QuadraticFormControlRenderLimit\"?" ); + seqValues[nProperty] >>= m_nQuadraticFormControlRenderLimit; + } + break; + + // #i97672# selection settings + case PROPERTYHANDLE_TRANSPARENTSELECTION: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\TransparentSelection\"?" ); + seqValues[nProperty] >>= m_bTransparentSelection; + } + break; + + case PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\TransparentSelectionPercent\"?" ); + seqValues[nProperty] >>= m_nTransparentSelectionPercent; + } + + case PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SelectionMaximumLuminancePercent\"?" ); + seqValues[nProperty] >>= m_nSelectionMaximumLuminancePercent; + } + break; + } + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtOptionsDrawinglayer_Impl::~SvtOptionsDrawinglayer_Impl() +{ + if( IsModified() ) + Commit(); +} + +//***************************************************************************************************************** +// Commit +//***************************************************************************************************************** +void SvtOptionsDrawinglayer_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_OVERLAYBUFFER: + aSeqValues[nProperty] <<= m_bOverlayBuffer; + break; + + case PROPERTYHANDLE_PAINTBUFFER: + aSeqValues[nProperty] <<= m_bPaintBuffer; + break; + + case PROPERTYHANDLE_STRIPE_COLOR_A: + aSeqValues[nProperty] <<= m_bStripeColorA.GetColor(); + break; + + case PROPERTYHANDLE_STRIPE_COLOR_B: + aSeqValues[nProperty] <<= m_bStripeColorB.GetColor(); + break; + + case PROPERTYHANDLE_STRIPE_LENGTH: + aSeqValues[nProperty] <<= m_nStripeLength; + break; + + // #i73602# + case PROPERTYHANDLE_OVERLAYBUFFER_CALC: + aSeqValues[nProperty] <<= m_bOverlayBuffer_Calc; + break; + + case PROPERTYHANDLE_OVERLAYBUFFER_WRITER: + aSeqValues[nProperty] <<= m_bOverlayBuffer_Writer; + break; + + case PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS: + aSeqValues[nProperty] <<= m_bOverlayBuffer_DrawImpress; + break; + + // #i74769#, #i75172# + case PROPERTYHANDLE_PAINTBUFFER_CALC: + aSeqValues[nProperty] <<= m_bPaintBuffer_Calc; + break; + + case PROPERTYHANDLE_PAINTBUFFER_WRITER: + aSeqValues[nProperty] <<= m_bPaintBuffer_Writer; + break; + + case PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS: + aSeqValues[nProperty] <<= m_bPaintBuffer_DrawImpress; + break; + + // #i4219# + case PROPERTYHANDLE_MAXIMUMPAPERWIDTH: + aSeqValues[nProperty] <<= m_nMaximumPaperWidth; + break; + + case PROPERTYHANDLE_MAXIMUMPAPERHEIGHT: + aSeqValues[nProperty] <<= m_nMaximumPaperHeight; + break; + + case PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN: + aSeqValues[nProperty] <<= m_nMaximumPaperLeftMargin; + break; + + case PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN: + aSeqValues[nProperty] <<= m_nMaximumPaperRightMargin; + break; + + case PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN: + aSeqValues[nProperty] <<= m_nMaximumPaperTopMargin; + break; + + case PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN: + aSeqValues[nProperty] <<= m_nMaximumPaperBottomMargin; + break; + + // primitives + case PROPERTYHANDLE_ANTIALIASING: + aSeqValues[nProperty] <<= m_bAntiAliasing; + break; + + case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE: + aSeqValues[nProperty] <<= m_bSnapHorVerLinesToDiscrete; + break; + + case PROPERTYHANDLE_SOLIDDRAGCREATE: + aSeqValues[nProperty] <<= m_bSolidDragCreate; + break; + + case PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT: + aSeqValues[nProperty] <<= m_bRenderDecoratedTextDirect; + break; + + case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT: + aSeqValues[nProperty] <<= m_bRenderSimpleTextDirect; + break; + + case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT: + aSeqValues[nProperty] <<= m_nQuadratic3DRenderLimit; + break; + + case PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT: + aSeqValues[nProperty] <<= m_nQuadraticFormControlRenderLimit; + break; + + // #i97672# selection settings + case PROPERTYHANDLE_TRANSPARENTSELECTION: + aSeqValues[nProperty] <<= m_bTransparentSelection; + break; + + case PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT: + aSeqValues[nProperty] <<= m_nTransparentSelectionPercent; + break; + + case PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT: + aSeqValues[nProperty] <<= m_nSelectionMaximumLuminancePercent; + break; + } + } + + PutProperties( aSeqNames, aSeqValues ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer() const +{ + return m_bOverlayBuffer; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer() const +{ + return m_bPaintBuffer; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Color SvtOptionsDrawinglayer_Impl::GetStripeColorA() const +{ + return m_bStripeColorA; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Color SvtOptionsDrawinglayer_Impl::GetStripeColorB() const +{ + return m_bStripeColorB; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_uInt16 SvtOptionsDrawinglayer_Impl::GetStripeLength() const +{ + return m_nStripeLength; +} + +// #i73602# +sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer_Calc() const +{ + return m_bOverlayBuffer_Calc; +} + +sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer_Writer() const +{ + return m_bOverlayBuffer_Writer; +} + +sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer_DrawImpress() const +{ + return m_bOverlayBuffer_DrawImpress; +} + +// #i74769#, #i75172# +sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer_Calc() const +{ + return m_bPaintBuffer_Calc; +} + +sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer_Writer() const +{ + return m_bPaintBuffer_Writer; +} + +sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer_DrawImpress() const +{ + return m_bPaintBuffer_DrawImpress; +} + +// #i4219# +sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperWidth() const +{ + return m_nMaximumPaperWidth; +} + +sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperHeight() const +{ + return m_nMaximumPaperHeight; +} + +sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperLeftMargin() const +{ + return m_nMaximumPaperLeftMargin; +} + +sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperRightMargin() const +{ + return m_nMaximumPaperRightMargin; +} + +sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperTopMargin() const +{ + return m_nMaximumPaperTopMargin; +} + +sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperBottomMargin() const +{ + return m_nMaximumPaperBottomMargin; +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer_Impl::SetOverlayBuffer( sal_Bool bState ) +{ + if(m_bOverlayBuffer != bState) + { + m_bOverlayBuffer = bState; + SetModified(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer_Impl::SetPaintBuffer( sal_Bool bState ) +{ + if(m_bPaintBuffer != bState) + { + m_bPaintBuffer = bState; + SetModified(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer_Impl::SetStripeColorA( Color aColor ) +{ + if(m_bStripeColorA != aColor) + { + m_bStripeColorA = aColor; + SetModified(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer_Impl::SetStripeColorB( Color aColor ) +{ + if(m_bStripeColorB != aColor) + { + m_bStripeColorB = aColor; + SetModified(); + } +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer_Impl::SetStripeLength( sal_uInt16 nLength ) +{ + if(m_nStripeLength != nLength) + { + m_nStripeLength = nLength; + SetModified(); + } +} + +// #i73602# +void SvtOptionsDrawinglayer_Impl::SetOverlayBuffer_Calc( sal_Bool bState ) +{ + if(m_bOverlayBuffer_Calc != bState) + { + m_bOverlayBuffer_Calc = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetOverlayBuffer_Writer( sal_Bool bState ) +{ + if(m_bOverlayBuffer_Writer != bState) + { + m_bOverlayBuffer_Writer = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetOverlayBuffer_DrawImpress( sal_Bool bState ) +{ + if(m_bOverlayBuffer_DrawImpress != bState) + { + m_bOverlayBuffer_DrawImpress = bState; + SetModified(); + } +} + +// #i74769#, #i75172# +void SvtOptionsDrawinglayer_Impl::SetPaintBuffer_Calc( sal_Bool bState ) +{ + if(m_bPaintBuffer_Calc != bState) + { + m_bPaintBuffer_Calc = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetPaintBuffer_Writer( sal_Bool bState ) +{ + if(m_bPaintBuffer_Writer != bState) + { + m_bPaintBuffer_Writer = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetPaintBuffer_DrawImpress( sal_Bool bState ) +{ + if(m_bPaintBuffer_DrawImpress != bState) + { + m_bPaintBuffer_DrawImpress = bState; + SetModified(); + } +} + +// #i4219# +void SvtOptionsDrawinglayer_Impl::SetMaximumPaperWidth( sal_uInt32 nNew ) +{ + if(m_nMaximumPaperWidth != nNew) + { + m_nMaximumPaperWidth = nNew; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetMaximumPaperHeight( sal_uInt32 nNew ) +{ + if(m_nMaximumPaperHeight != nNew) + { + m_nMaximumPaperHeight = nNew; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetMaximumPaperLeftMargin( sal_uInt32 nNew ) +{ + if(m_nMaximumPaperLeftMargin != nNew) + { + m_nMaximumPaperLeftMargin = nNew; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetMaximumPaperRightMargin( sal_uInt32 nNew ) +{ + if(m_nMaximumPaperRightMargin != nNew) + { + m_nMaximumPaperRightMargin = nNew; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetMaximumPaperTopMargin( sal_uInt32 nNew ) +{ + if(m_nMaximumPaperTopMargin != nNew) + { + m_nMaximumPaperTopMargin = nNew; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetMaximumPaperBottomMargin( sal_uInt32 nNew ) +{ + if(m_nMaximumPaperBottomMargin != nNew) + { + m_nMaximumPaperBottomMargin = nNew; + SetModified(); + } +} + +// 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::IsSnapHorVerLinesToDiscrete() const +{ + return m_bSnapHorVerLinesToDiscrete; +} + +sal_Bool SvtOptionsDrawinglayer_Impl::IsSolidDragCreate() const +{ + return m_bSolidDragCreate; +} + +sal_Bool SvtOptionsDrawinglayer_Impl::IsRenderDecoratedTextDirect() const +{ + return m_bRenderDecoratedTextDirect; +} + +sal_Bool SvtOptionsDrawinglayer_Impl::IsRenderSimpleTextDirect() const +{ + return m_bRenderSimpleTextDirect; +} + +sal_uInt32 SvtOptionsDrawinglayer_Impl::GetQuadratic3DRenderLimit() const +{ + return m_nQuadratic3DRenderLimit; +} + +sal_uInt32 SvtOptionsDrawinglayer_Impl::GetQuadraticFormControlRenderLimit() const +{ + return m_nQuadraticFormControlRenderLimit; +} + +void SvtOptionsDrawinglayer_Impl::SetAntiAliasing( sal_Bool bState ) +{ + if(m_bAntiAliasing != bState) + { + m_bAntiAliasing = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetSnapHorVerLinesToDiscrete( sal_Bool bState ) +{ + if(m_bSnapHorVerLinesToDiscrete != bState) + { + m_bSnapHorVerLinesToDiscrete = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetSolidDragCreate( sal_Bool bState ) +{ + if(m_bSolidDragCreate != bState) + { + m_bSolidDragCreate = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetRenderDecoratedTextDirect( sal_Bool bState ) +{ + if(m_bRenderDecoratedTextDirect != bState) + { + m_bRenderDecoratedTextDirect = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetRenderSimpleTextDirect( sal_Bool bState ) +{ + if(m_bRenderSimpleTextDirect != bState) + { + m_bRenderSimpleTextDirect = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetQuadratic3DRenderLimit(sal_uInt32 nNew) +{ + if(m_nQuadratic3DRenderLimit != nNew) + { + m_nQuadratic3DRenderLimit = nNew; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetQuadraticFormControlRenderLimit(sal_uInt32 nNew) +{ + if(m_nQuadraticFormControlRenderLimit != nNew) + { + m_nQuadraticFormControlRenderLimit = nNew; + SetModified(); + } +} + +// #i97672# selection settings +sal_Bool SvtOptionsDrawinglayer_Impl::IsTransparentSelection() const +{ + return m_bTransparentSelection; +} + +void SvtOptionsDrawinglayer_Impl::SetTransparentSelection( sal_Bool bState ) +{ + if(m_bTransparentSelection != bState) + { + m_bTransparentSelection = bState; + SetModified(); + } +} + +void SvtOptionsDrawinglayer_Impl::SetTransparentSelectionPercent( sal_uInt16 nPercent ) +{ + if(m_nTransparentSelectionPercent != nPercent) + { + m_nTransparentSelectionPercent = nPercent; + SetModified(); + } +} + +sal_uInt16 SvtOptionsDrawinglayer_Impl::GetTransparentSelectionPercent() const +{ + return m_nTransparentSelectionPercent; +} + +void SvtOptionsDrawinglayer_Impl::SetSelectionMaximumLuminancePercent( sal_uInt16 nPercent ) +{ + if(m_nSelectionMaximumLuminancePercent != nPercent) + { + m_nSelectionMaximumLuminancePercent = nPercent; + SetModified(); + } +} + +sal_uInt16 SvtOptionsDrawinglayer_Impl::GetSelectionMaximumLuminancePercent() const +{ + return m_nSelectionMaximumLuminancePercent; +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Sequence< OUString > SvtOptionsDrawinglayer_Impl::impl_GetPropertyNames() +{ + // Build static list of configuration key names. + static const OUString pProperties[] = + { + PROPERTYNAME_OVERLAYBUFFER , + PROPERTYNAME_PAINTBUFFER , + PROPERTYNAME_STRIPE_COLOR_A , + PROPERTYNAME_STRIPE_COLOR_B , + PROPERTYNAME_STRIPE_LENGTH , + + // #i73602# + PROPERTYNAME_OVERLAYBUFFER_CALC, + PROPERTYNAME_OVERLAYBUFFER_WRITER, + PROPERTYNAME_OVERLAYBUFFER_DRAWIMPRESS, + + // #i74769#, #i75172# + PROPERTYNAME_PAINTBUFFER_CALC, + PROPERTYNAME_PAINTBUFFER_WRITER, + PROPERTYNAME_PAINTBUFFER_DRAWIMPRESS, + + // #i4219# + PROPERTYNAME_MAXIMUMPAPERWIDTH, + PROPERTYNAME_MAXIMUMPAPERHEIGHT, + PROPERTYNAME_MAXIMUMPAPERLEFTMARGIN, + PROPERTYNAME_MAXIMUMPAPERRIGHTMARGIN, + PROPERTYNAME_MAXIMUMPAPERTOPMARGIN, + PROPERTYNAME_MAXIMUMPAPERBOTTOMMARGIN, + + // primitives + PROPERTYNAME_ANTIALIASING, + PROPERTYNAME_SNAPHORVERLINESTODISCRETE, + PROPERTYNAME_SOLIDDRAGCREATE, + PROPERTYNAME_RENDERDECORATEDTEXTDIRECT, + PROPERTYNAME_RENDERSIMPLETEXTDIRECT, + PROPERTYNAME_QUADRATIC3DRENDERLIMIT, + PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT, + + // #i97672# selection settings + PROPERTYNAME_TRANSPARENTSELECTION, + PROPERTYNAME_TRANSPARENTSELECTIONPERCENT, + PROPERTYNAME_SELECTIONMAXIMUMLUMINANCEPERCENT + }; + + // 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 +//***************************************************************************************************************** +SvtOptionsDrawinglayer_Impl* SvtOptionsDrawinglayer::m_pDataContainer = NULL; +sal_Int32 SvtOptionsDrawinglayer::m_nRefCount = 0; + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +SvtOptionsDrawinglayer::SvtOptionsDrawinglayer() +{ + // 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 SvtOptionsDrawinglayer_Impl(); + } +} + +//***************************************************************************************************************** +// destructor +//***************************************************************************************************************** +SvtOptionsDrawinglayer::~SvtOptionsDrawinglayer() +{ + // 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 SvtOptionsDrawinglayer::IsOverlayBuffer() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsOverlayBuffer(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsPaintBuffer(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Color SvtOptionsDrawinglayer::GetStripeColorA() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetStripeColorA(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +Color SvtOptionsDrawinglayer::GetStripeColorB() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetStripeColorB(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +sal_uInt16 SvtOptionsDrawinglayer::GetStripeLength() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetStripeLength(); +} + +// #i73602# +sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer_Calc() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsOverlayBuffer_Calc(); +} + +sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer_Writer() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsOverlayBuffer_Writer(); +} + +sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer_DrawImpress() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsOverlayBuffer_DrawImpress(); +} + +// #i74769#, #i75172# +sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer_Calc() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsPaintBuffer_Calc(); +} + +sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer_Writer() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsPaintBuffer_Writer(); +} + +sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer_DrawImpress() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsPaintBuffer_DrawImpress(); +} + +// #i4219# +sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperWidth() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetMaximumPaperWidth(); +} + +sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperHeight() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetMaximumPaperHeight(); +} + +sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperLeftMargin() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetMaximumPaperLeftMargin(); +} + +sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperRightMargin() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetMaximumPaperRightMargin(); +} + +sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperTopMargin() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetMaximumPaperTopMargin(); +} + +sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperBottomMargin() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetMaximumPaperBottomMargin(); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer::SetOverlayBuffer( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetOverlayBuffer( bState ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer::SetPaintBuffer( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetPaintBuffer( bState ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer::SetStripeColorA( Color aColor ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetStripeColorA( aColor ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer::SetStripeColorB( Color aColor ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetStripeColorB( aColor ); +} + +//***************************************************************************************************************** +// public method +//***************************************************************************************************************** +void SvtOptionsDrawinglayer::SetStripeLength( sal_uInt16 nLength ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetStripeLength( nLength ); +} + +// #i73602# +void SvtOptionsDrawinglayer::SetOverlayBuffer_Calc( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetOverlayBuffer_Calc( bState ); +} + +void SvtOptionsDrawinglayer::SetOverlayBuffer_Writer( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetOverlayBuffer_Writer( bState ); +} + +void SvtOptionsDrawinglayer::SetOverlayBuffer_DrawImpress( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetOverlayBuffer_DrawImpress( bState ); +} + +// #i74769#, #i75172# +void SvtOptionsDrawinglayer::SetPaintBuffer_Calc( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetPaintBuffer_Calc( bState ); +} + +void SvtOptionsDrawinglayer::SetPaintBuffer_Writer( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetPaintBuffer_Writer( bState ); +} + +void SvtOptionsDrawinglayer::SetPaintBuffer_DrawImpress( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetPaintBuffer_DrawImpress( bState ); +} + +// #i4219# +void SvtOptionsDrawinglayer::SetMaximumPaperWidth( sal_uInt32 nNew ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetMaximumPaperWidth( nNew ); +} + +void SvtOptionsDrawinglayer::SetMaximumPaperHeight( sal_uInt32 nNew ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetMaximumPaperHeight( nNew ); +} + +void SvtOptionsDrawinglayer::SetMaximumPaperLeftMargin( sal_uInt32 nNew ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetMaximumPaperLeftMargin( nNew ); +} + +void SvtOptionsDrawinglayer::SetMaximumPaperRightMargin( sal_uInt32 nNew ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetMaximumPaperRightMargin( nNew ); +} + +void SvtOptionsDrawinglayer::SetMaximumPaperTopMargin( sal_uInt32 nNew ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetMaximumPaperTopMargin( nNew ); +} + +void SvtOptionsDrawinglayer::SetMaximumPaperBottomMargin( sal_uInt32 nNew ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + 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() && IsAAPossibleOnThisSystem(); +} + +sal_Bool SvtOptionsDrawinglayer::IsSnapHorVerLinesToDiscrete() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsAntiAliasing() && m_pDataContainer->IsSnapHorVerLinesToDiscrete(); +} + +sal_Bool SvtOptionsDrawinglayer::IsSolidDragCreate() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsSolidDragCreate(); +} + +sal_Bool SvtOptionsDrawinglayer::IsRenderDecoratedTextDirect() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsRenderDecoratedTextDirect(); +} + +sal_Bool SvtOptionsDrawinglayer::IsRenderSimpleTextDirect() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsRenderSimpleTextDirect(); +} + +sal_uInt32 SvtOptionsDrawinglayer::GetQuadratic3DRenderLimit() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetQuadratic3DRenderLimit(); +} + +sal_uInt32 SvtOptionsDrawinglayer::GetQuadraticFormControlRenderLimit() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->GetQuadraticFormControlRenderLimit(); +} + +void SvtOptionsDrawinglayer::SetAntiAliasing( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetAntiAliasing( bState ); +} + +void SvtOptionsDrawinglayer::SetSnapHorVerLinesToDiscrete( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetSnapHorVerLinesToDiscrete( bState ); +} + +void SvtOptionsDrawinglayer::SetSolidDragCreate( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetSolidDragCreate( bState ); +} + +void SvtOptionsDrawinglayer::SetRenderDecoratedTextDirect( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetRenderDecoratedTextDirect( bState ); +} + +void SvtOptionsDrawinglayer::SetRenderSimpleTextDirect( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetRenderSimpleTextDirect( bState ); +} + +void SvtOptionsDrawinglayer::SetQuadratic3DRenderLimit(sal_uInt32 nNew) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetQuadratic3DRenderLimit( nNew ); +} + +void SvtOptionsDrawinglayer::SetQuadraticFormControlRenderLimit(sal_uInt32 nNew) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetQuadraticFormControlRenderLimit( nNew ); +} + +// #i97672# selection settings +sal_Bool SvtOptionsDrawinglayer::IsTransparentSelection() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsTransparentSelection(); +} + +void SvtOptionsDrawinglayer::SetTransparentSelection( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetTransparentSelection( bState ); +} + +sal_uInt16 SvtOptionsDrawinglayer::GetTransparentSelectionPercent() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + sal_uInt16 aRetval(m_pDataContainer->GetTransparentSelectionPercent()); + + // crop to range [10% .. 90%] + if(aRetval < 10) + { + aRetval = 10; + } + + if(aRetval > 90) + { + aRetval = 90; + } + + return aRetval; +} + +void SvtOptionsDrawinglayer::SetTransparentSelectionPercent( sal_uInt16 nPercent ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + + // crop to range [10% .. 90%] + if(nPercent < 10) + { + nPercent = 10; + } + + if(nPercent > 90) + { + nPercent = 90; + } + + m_pDataContainer->SetTransparentSelectionPercent( nPercent ); +} + +sal_uInt16 SvtOptionsDrawinglayer::GetSelectionMaximumLuminancePercent() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + sal_uInt16 aRetval(m_pDataContainer->GetSelectionMaximumLuminancePercent()); + + // crop to range [0% .. 100%] + if(aRetval > 90) + { + aRetval = 90; + } + + return aRetval; +} + +void SvtOptionsDrawinglayer::SetSelectionMaximumLuminancePercent( sal_uInt16 nPercent ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + + // crop to range [0% .. 100%] + if(nPercent > 90) + { + nPercent = 90; + } + + m_pDataContainer->SetSelectionMaximumLuminancePercent( nPercent ); +} + +//***************************************************************************************************************** +// private method +//***************************************************************************************************************** +Mutex& SvtOptionsDrawinglayer::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; +} + +// eof + diff --git a/svtools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx index 8c561b299d46..5b74ec1db879 100644 --- a/svtools/source/config/pathoptions.cxx +++ b/unotools/source/config/pathoptions.cxx @@ -29,11 +29,11 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #ifndef GCC #endif -#include <svtools/pathoptions.hxx> +#include <unotools/pathoptions.hxx> #include <unotools/configitem.hxx> #include <unotools/configmgr.hxx> #include <tools/debug.hxx> @@ -1075,7 +1075,7 @@ void SAL_CALL PathService::flush( ) throw(::com::sun::star::uno::RuntimeExcepti ::rtl::OUString SAL_CALL PathService::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) { - return OUString::createFromAscii("com.sun.star.comp.svtools.PathService"); + return OUString::createFromAscii("com.sun.star.comp.unotools.PathService"); } sal_Bool SAL_CALL PathService::supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException) diff --git a/svtools/source/config/printwarningoptions.cxx b/unotools/source/config/printwarningoptions.cxx index c2dfe94b0a2b..29dfabd45ea7 100644 --- a/svtools/source/config/printwarningoptions.cxx +++ b/unotools/source/config/printwarningoptions.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #ifndef GCC #endif @@ -37,7 +37,7 @@ // includes //_________________________________________________________________________________________________________________ -#include <svtools/printwarningoptions.hxx> +#include <unotools/printwarningoptions.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> #include <tools/debug.hxx> @@ -91,6 +91,7 @@ public: //--------------------------------------------------------------------------------------------------------- virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); //--------------------------------------------------------------------------------------------------------- // public interface @@ -242,6 +243,10 @@ void SvtPrintWarningOptions_Impl::Commit() PutProperties( aSeqNames, aSeqValues ); } +void SvtPrintWarningOptions_Impl::Notify( const Sequence< rtl::OUString >& ) +{ +} + //***************************************************************************************************************** // private method //***************************************************************************************************************** diff --git a/svtools/source/config/regoptions.cxx b/unotools/source/config/regoptions.cxx index 7c94807f2c25..b0f41602da2e 100644 --- a/svtools/source/config/regoptions.cxx +++ b/unotools/source/config/regoptions.cxx @@ -29,8 +29,8 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include "regoptions.hxx" +#include "precompiled_unotools.hxx" +#include <unotools/regoptions.hxx> #include <unotools/confignode.hxx> #include <tools/date.hxx> #include <comphelper/processfactory.hxx> @@ -39,11 +39,10 @@ #include <rtl/ustring.hxx> //........................................................................ -namespace svt +namespace utl { //........................................................................ - using namespace ::utl; using namespace ::com::sun::star::uno; //==================================================================== @@ -549,6 +548,6 @@ namespace svt } //........................................................................ -} // namespace svt +} // namespace utl //........................................................................ diff --git a/svtools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx index 2b18d1bf4767..49e01c0457e9 100644 --- a/svtools/source/config/saveopt.cxx +++ b/unotools/source/config/saveopt.cxx @@ -29,12 +29,12 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #ifndef GCC #endif -#include <svtools/saveopt.hxx> +#include <unotools/saveopt.hxx> #include "rtl/instance.hxx" #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> @@ -840,7 +840,7 @@ SvtSaveOptions::SvtSaveOptions() ::osl::MutexGuard aGuard( LocalSingleton::get() ); if ( !pOptions ) { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtSaveOptions_Impl::ctor()"); + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtSaveOptions_Impl::ctor()"); pOptions = new SvtLoadSaveOptions_Impl; pOptions->pSaveOpt = new SvtSaveOptions_Impl; pOptions->pLoadOpt = new SvtLoadOptions_Impl; diff --git a/svtools/source/config/searchopt.cxx b/unotools/source/config/searchopt.cxx index 261edf4d0f1e..01fbd9a3216d 100644 --- a/svtools/source/config/searchopt.cxx +++ b/unotools/source/config/searchopt.cxx @@ -29,9 +29,9 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" -#include "searchopt.hxx" +#include <unotools/searchopt.hxx> #include <tools/solar.h> #include <tools/debug.hxx> #include <unotools/configitem.hxx> @@ -75,6 +75,7 @@ public: // ConfigItem virtual void Commit(); + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); BOOL GetFlag( USHORT nOffset ) const; void SetFlag( USHORT nOffset, BOOL bVal ); @@ -85,7 +86,7 @@ public: SvtSearchOptions_Impl::SvtSearchOptions_Impl() : ConfigItem( OUString::createFromAscii( "Office.Common/SearchOptions" ) ) { - RTL_LOGFILE_CONTEXT(aLog, "svtools SvtSearchOptions_Impl::SvtSearchOptions_Impl()"); + RTL_LOGFILE_CONTEXT(aLog, "unotools SvtSearchOptions_Impl::SvtSearchOptions_Impl()"); nFlags = 0x0003FFFF; // set all options values to 'true' Load(); SetModified( FALSE ); @@ -104,6 +105,10 @@ void SvtSearchOptions_Impl::Commit() Save(); } +void SvtSearchOptions_Impl::Notify( const Sequence< rtl::OUString >& ) +{ +} + BOOL SvtSearchOptions_Impl::GetFlag( USHORT nOffset ) const { diff --git a/svtools/source/config/securityoptions.cxx b/unotools/source/config/securityoptions.cxx index 8fbc9008d51e..ca2968d3a807 100644 --- a/svtools/source/config/securityoptions.cxx +++ b/unotools/source/config/securityoptions.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #ifndef GCC #endif @@ -37,7 +37,7 @@ // includes //_________________________________________________________________________________________________________________ -#include <svtools/securityoptions.hxx> +#include <unotools/securityoptions.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> #include <tools/debug.hxx> @@ -48,7 +48,7 @@ #include <tools/urlobj.hxx> #include <tools/wldcrd.hxx> -#include <svtools/pathoptions.hxx> +#include <unotools/pathoptions.hxx> #include <rtl/logfile.hxx> #include "itemholder1.hxx" @@ -1073,7 +1073,7 @@ SvtSecurityOptions::SvtSecurityOptions() // ... and initialize ouer data container only if it not already exist! if( m_pDataContainer == NULL ) { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtSecurityOptions_Impl::ctor()"); + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtSecurityOptions_Impl::ctor()"); m_pDataContainer = new SvtSecurityOptions_Impl; ItemHolder1::holdConfigItem(E_SECURITYOPTIONS); diff --git a/svtools/source/config/sourceviewconfig.cxx b/unotools/source/config/sourceviewconfig.cxx index 40b41d571751..3de0276643bf 100644 --- a/svtools/source/config/sourceviewconfig.cxx +++ b/unotools/source/config/sourceviewconfig.cxx @@ -29,23 +29,22 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include <svtools/sourceviewconfig.hxx> +#include "precompiled_unotools.hxx" +#include <unotools/sourceviewconfig.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <unotools/configitem.hxx> #include <tools/debug.hxx> #include <rtl/instance.hxx> -#include <svtools/smplhint.hxx> #include <itemholder1.hxx> using namespace utl; using namespace rtl; using namespace com::sun::star::uno; -namespace svt +namespace utl { -class SourceViewConfig_Impl : public utl::ConfigItem, public SfxBroadcaster +class SourceViewConfig_Impl : public utl::ConfigItem { private: OUString m_sFontName; @@ -192,11 +191,7 @@ void SourceViewConfig_Impl::Commit() } PutProperties( aNames, aValues ); - //notify SfxListener - { - SfxSimpleHint aHint = SfxSimpleHint( SFX_HINT_DATACHANGED ); - Broadcast(aHint); - } + NotifyListeners(0); } /*-- 28.08.2002 16:32:19--------------------------------------------------- @@ -213,14 +208,15 @@ SourceViewConfig::SourceViewConfig() ++m_nRefCount; } - StartListening( *m_pImplConfig, TRUE ); + + m_pImplConfig->AddListener( this ); } /*-- 28.08.2002 16:32:19--------------------------------------------------- -----------------------------------------------------------------------*/ SourceViewConfig::~SourceViewConfig() { - EndListening( *m_pImplConfig, TRUE ); + m_pImplConfig->RemoveListener( this ); ::osl::MutexGuard aGuard( lclMutex::get() ); if( !--m_nRefCount ) { @@ -271,11 +267,5 @@ void SourceViewConfig::SetShowProportionalFontsOnly(sal_Bool bSet) { m_pImplConfig->SetShowProportionalFontsOnly(bSet); } -/* -----------------------------30.08.2002 10:40------------------------------ - - ---------------------------------------------------------------------------*/ -void SourceViewConfig::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - Broadcast( rHint ); } -}//namespace svt +// namespace utl diff --git a/svtools/source/config/startoptions.cxx b/unotools/source/config/startoptions.cxx index 08f4a7e0500e..172a931231fe 100644 --- a/svtools/source/config/startoptions.cxx +++ b/unotools/source/config/startoptions.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #ifndef GCC #endif @@ -37,7 +37,7 @@ // includes //_________________________________________________________________________________________________________________ -#include <svtools/startoptions.hxx> +#include <unotools/startoptions.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> #include <tools/debug.hxx> @@ -374,7 +374,7 @@ SvtStartOptions::SvtStartOptions() // ... and initialize ouer data container only if it not already! if( m_pDataContainer == NULL ) { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtStartOptions_Impl::ctor()"); + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtStartOptions_Impl::ctor()"); m_pDataContainer = new SvtStartOptions_Impl(); ItemHolder1::holdConfigItem(E_STARTOPTIONS); diff --git a/svtools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx index a75c63e34af0..7b14c9cb8c2f 100644 --- a/svtools/source/config/syslocaleoptions.cxx +++ b/unotools/source/config/syslocaleoptions.cxx @@ -29,33 +29,21 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION - -#include <svtools/syslocaleoptions.hxx> -#include <broadcast.hxx> -#include <listener.hxx> -#include <svtools/smplhint.hxx> -#include <i18npool/mslangid.hxx> -#include <tools/string.hxx> +#include <com/sun/star/uno/Sequence.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/instance.hxx> +#include <rtl/logfile.hxx> +#include <i18npool/mslangid.hxx> +#include <tools/string.hxx> +#include <tools/debug.hxx> +#include <unotools/syslocaleoptions.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 <vcl/settings.hxx> -#include <vcl/svapp.hxx> - -#include <rtl/logfile.hxx> - -#include "itemholder2.hxx" +#include "itemholder1.hxx" #define CFG_READONLY_DEFAULT sal_False @@ -74,27 +62,46 @@ namespace : public rtl::Static<Link, CurrencyChangeLink> {}; } +com::sun::star::lang::Locale lcl_str_to_locale( const ::rtl::OUString rStr ) +{ + com::sun::star::lang::Locale aRet; + if ( rStr.getLength() ) + { + aRet = com::sun::star::lang::Locale(); + sal_Int32 nSep = rStr.indexOf('-'); + if (nSep < 0) + aRet.Language = rStr; + else + { + aRet.Language = rStr.copy(0, nSep); + if (nSep < rStr.getLength()) + aRet.Country = rStr.copy(nSep+1, rStr.getLength() - (nSep+1)); + } + } + + return aRet; +} + class SvtSysLocaleOptions_Impl : public utl::ConfigItem { + Locale m_aRealLocale; + Locale m_aRealUILocale; + LanguageType m_eRealLanguage; + LanguageType m_eRealUILanguage; OUString m_aLocaleString; // en-US or de-DE or empty for SYSTEM - LanguageType m_eLocaleLanguageType; // same for convenience access + OUString m_aUILocaleString; // en-US or de-DE or empty for SYSTEM OUString m_aCurrencyString; // USD-en-US or EUR-de-DE - SvtBroadcaster m_aBroadcaster; ULONG m_nBlockedHint; // pending hints - sal_Int32 m_nBroadcastBlocked; // broadcast only if this is 0 sal_Bool m_bDecimalSeparator; //use decimal separator same as locale - sal_Bool m_bROLocale; + sal_Bool m_bROUILocale; sal_Bool m_bROCurrency; sal_Bool m_bRODecimalSeparator; - static const Sequence< /* const */ OUString > GetPropertyNames(); - - void UpdateMiscSettings_Impl(); - ULONG ChangeLocaleSettings(); - void ChangeDefaultCurrency() const; - void Broadcast( ULONG nHint ); + static const Sequence< /* const */ OUString > GetPropertyNames(); + void MakeRealLocale(); + void MakeRealUILocale(); public: SvtSysLocaleOptions_Impl(); @@ -106,8 +113,10 @@ public: const OUString& GetLocaleString() const { return m_aLocaleString; } void SetLocaleString( const OUString& rStr ); - LanguageType GetLocaleLanguageType() const - { return m_eLocaleLanguageType; } + + const OUString& GetUILocaleString() const + { return m_aUILocaleString; } + void SetUILocaleString( const OUString& rStr ); const OUString& GetCurrencyString() const { return m_aCurrencyString; } @@ -116,30 +125,34 @@ public: sal_Bool IsDecimalSeparatorAsLocale() const { return m_bDecimalSeparator;} void SetDecimalSeparatorAsLocale( sal_Bool bSet); - SvtBroadcaster& GetBroadcaster() - { return m_aBroadcaster; } - void BlockBroadcasts( BOOL bBlock ); sal_Bool IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const; + const Locale& GetRealLocale() { return m_aRealLocale; } + const Locale& GetRealUILocale() { return m_aRealUILocale; } + LanguageType GetRealLanguage() { return m_eRealLanguage; } + LanguageType GetRealUILanguage() { return m_eRealUILanguage; } }; -#define ROOTNODE_SYSLOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("Setup/L10N")) +#define ROOTNODE_SYSLOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("Setup/L10N")) -#define PROPERTYNAME_LOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupSystemLocale")) -#define PROPERTYNAME_CURRENCY OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupCurrency")) -#define PROPERTYNAME_DECIMALSEPARATOR OUString(RTL_CONSTASCII_USTRINGPARAM("DecimalSeparatorAsLocale")) +#define PROPERTYNAME_LOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupSystemLocale")) +#define PROPERTYNAME_UILOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("ooLocale")) +#define PROPERTYNAME_CURRENCY OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupCurrency")) +#define PROPERTYNAME_DECIMALSEPARATOR OUString(RTL_CONSTASCII_USTRINGPARAM("DecimalSeparatorAsLocale")) -#define PROPERTYHANDLE_LOCALE 0 -#define PROPERTYHANDLE_CURRENCY 1 -#define PROPERTYHANDLE_DECIMALSEPARATOR 2 +#define PROPERTYHANDLE_LOCALE 0 +#define PROPERTYHANDLE_UILOCALE 1 +#define PROPERTYHANDLE_CURRENCY 2 +#define PROPERTYHANDLE_DECIMALSEPARATOR 3 -#define PROPERTYCOUNT 3 +#define PROPERTYCOUNT 4 const Sequence< OUString > SvtSysLocaleOptions_Impl::GetPropertyNames() { static const OUString pProperties[] = { PROPERTYNAME_LOCALE, + PROPERTYNAME_UILOCALE, PROPERTYNAME_CURRENCY, PROPERTYNAME_DECIMALSEPARATOR }; @@ -147,22 +160,19 @@ const Sequence< OUString > SvtSysLocaleOptions_Impl::GetPropertyNames() return seqPropertyNames; } - // ----------------------------------------------------------------------- SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl() : ConfigItem( ROOTNODE_SYSLOCALE ) , m_nBlockedHint( 0 ) - , m_nBroadcastBlocked( 0 ) , m_bDecimalSeparator( sal_True ) , m_bROLocale(CFG_READONLY_DEFAULT) + , m_bROUILocale(CFG_READONLY_DEFAULT) , m_bROCurrency(CFG_READONLY_DEFAULT) , m_bRODecimalSeparator(sal_False) { - if ( !IsValidConfigMgr() ) - ChangeLocaleSettings(); // assume SYSTEM defaults during Setup - else + if ( IsValidConfigMgr() ) { const Sequence< OUString > aNames = GetPropertyNames(); Sequence< Any > aValues = GetProperties( aNames ); @@ -192,6 +202,18 @@ SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl() m_bROLocale = pROStates[nProp]; } break; + case PROPERTYHANDLE_UILOCALE : + { + OUString aStr; + if ( pValues[nProp] >>= aStr ) + m_aUILocaleString = aStr; + else + { + DBG_ERRORFILE( "Wrong property type!" ); + } + m_bROUILocale = pROStates[nProp]; + } + break; case PROPERTYHANDLE_CURRENCY : { OUString aStr; @@ -222,10 +244,12 @@ SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl() } } } - UpdateMiscSettings_Impl(); - ChangeLocaleSettings(); +// UpdateMiscSettings_Impl(); EnableNotification( aNames ); } + + MakeRealLocale(); + MakeRealUILocale(); } @@ -235,15 +259,35 @@ SvtSysLocaleOptions_Impl::~SvtSysLocaleOptions_Impl() Commit(); } +void SvtSysLocaleOptions_Impl::MakeRealLocale() +{ + m_aRealLocale = lcl_str_to_locale( m_aLocaleString ); + if ( m_aRealLocale.Language.getLength() ) + { + m_eRealLanguage = MsLangId::convertLocaleToLanguage( m_aRealLocale ); + } + else + { + m_eRealLanguage = MsLangId::getSystemLanguage(); + MsLangId::convertLanguageToLocale( m_eRealLanguage, m_aRealLocale ); + } +} -void SvtSysLocaleOptions_Impl::BlockBroadcasts( BOOL bBlock ) +void SvtSysLocaleOptions_Impl::MakeRealUILocale() { - if ( bBlock ) - ++m_nBroadcastBlocked; - else if ( m_nBroadcastBlocked ) + if ( !m_aRealUILocale.Language.getLength() ) { - if ( --m_nBroadcastBlocked == 0 ) - Broadcast( 0 ); + // as we can't switch UILocale at runtime, we only store changes in the configuration + m_aRealUILocale = lcl_str_to_locale( m_aUILocaleString ); + if ( m_aRealUILocale.Language.getLength() ) + { + m_eRealUILanguage = MsLangId::convertLocaleToLanguage( m_aRealUILocale ); + } + else + { + m_eRealUILanguage = MsLangId::getSystemUILanguage(); + MsLangId::convertLanguageToLocale( m_eRealUILanguage, m_aRealUILocale ); + } } } @@ -257,6 +301,11 @@ sal_Bool SvtSysLocaleOptions_Impl::IsReadOnly( SvtSysLocaleOptions::EOption eOpt bReadOnly = m_bROLocale; break; } + case SvtSysLocaleOptions::E_UILOCALE : + { + bReadOnly = m_bROUILocale; + break; + } case SvtSysLocaleOptions::E_CURRENCY : { bReadOnly = m_bROCurrency; @@ -267,25 +316,6 @@ sal_Bool SvtSysLocaleOptions_Impl::IsReadOnly( SvtSysLocaleOptions::EOption eOpt } -void SvtSysLocaleOptions_Impl::Broadcast( ULONG nHint ) -{ - if ( m_nBroadcastBlocked ) - m_nBlockedHint |= nHint; - else - { - nHint |= m_nBlockedHint; - m_nBlockedHint = 0; - if ( nHint ) - { - if ( nHint & SYSLOCALEOPTIONS_HINT_CURRENCY ) - ChangeDefaultCurrency(); - SfxSimpleHint aHint( nHint ); - GetBroadcaster().Broadcast( aHint ); - } - } -} - - void SvtSysLocaleOptions_Impl::Commit() { const Sequence< OUString > aOrgNames = GetPropertyNames(); @@ -312,9 +342,19 @@ void SvtSysLocaleOptions_Impl::Commit() } } break; + case PROPERTYHANDLE_UILOCALE : + { + if (!m_bROUILocale) + { + pNames[nRealCount] = aOrgNames[nProp]; + pValues[nRealCount] <<= m_aUILocaleString; + ++nRealCount; + } + } + break; case PROPERTYHANDLE_CURRENCY : { - if (!m_bROLocale) + if (!m_bROCurrency) { pNames[nRealCount] = aOrgNames[nProp]; pValues[nRealCount] <<= m_aCurrencyString; @@ -346,36 +386,38 @@ void SvtSysLocaleOptions_Impl::SetLocaleString( const OUString& rStr ) if (!m_bROLocale && rStr != m_aLocaleString ) { m_aLocaleString = rStr; + MakeRealLocale(); + MsLangId::setConfiguredSystemLanguage( m_eRealLanguage ); SetModified(); ULONG nHint = SYSLOCALEOPTIONS_HINT_LOCALE; - nHint |= ChangeLocaleSettings(); - Broadcast( nHint ); + if ( !m_aCurrencyString.getLength() ) + nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY; + NotifyListeners( nHint ); } } - -ULONG SvtSysLocaleOptions_Impl::ChangeLocaleSettings() +void SvtSysLocaleOptions_Impl::SetUILocaleString( const OUString& rStr ) { - // An empty config value denotes SYSTEM locale - if ( m_aLocaleString.getLength() ) - m_eLocaleLanguageType = MsLangId::convertIsoStringToLanguage( m_aLocaleString ); - else - m_eLocaleLanguageType = LANGUAGE_SYSTEM; - ULONG nHint = 0; - // new locale and no fixed currency => locale default currency might change - if ( !m_aCurrencyString.getLength() ) - nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY; - return nHint; + if (!m_bROUILocale && rStr != m_aUILocaleString ) + { + m_aUILocaleString = rStr; +/* + // as we can't switch UILocale at runtime, we only store changes in the configuration + MakeRealUILocale(); + MsLangId::setConfiguredSystemLanguage( m_eRealUILanguage ); + SetModified(); + NotifyListeners( SYSLOCALEOPTIONS_HINT_UILOCALE ); +*/ + } } - void SvtSysLocaleOptions_Impl::SetCurrencyString( const OUString& rStr ) { if (!m_bROCurrency && rStr != m_aCurrencyString ) { m_aCurrencyString = rStr; SetModified(); - Broadcast( SYSLOCALEOPTIONS_HINT_CURRENCY ); + NotifyListeners( SYSLOCALEOPTIONS_HINT_CURRENCY ); } } @@ -385,19 +427,10 @@ void SvtSysLocaleOptions_Impl::SetDecimalSeparatorAsLocale( sal_Bool bSet) { m_bDecimalSeparator = bSet; SetModified(); - UpdateMiscSettings_Impl(); + NotifyListeners( SYSLOCALEOPTIONS_HINT_DECSEP ); } } - -void SvtSysLocaleOptions_Impl::ChangeDefaultCurrency() const -{ - const Link& rLink = SvtSysLocaleOptions::GetCurrencyChangeLink(); - if ( rLink.IsSet() ) - rLink.Call( NULL ); -} - - void SvtSysLocaleOptions_Impl::Notify( const Sequence< rtl::OUString >& seqPropertyNames ) { ULONG nHint = 0; @@ -412,7 +445,17 @@ void SvtSysLocaleOptions_Impl::Notify( const Sequence< rtl::OUString >& seqPrope seqValues[nProp] >>= m_aLocaleString; m_bROLocale = seqROStates[nProp]; nHint |= SYSLOCALEOPTIONS_HINT_LOCALE; - nHint |= ChangeLocaleSettings(); + if ( !m_aCurrencyString.getLength() ) + nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY; + MakeRealLocale(); + } + if( seqPropertyNames[nProp] == PROPERTYNAME_UILOCALE ) + { + DBG_ASSERT( seqValues[nProp].getValueTypeClass() == TypeClass_STRING, "Locale property type" ); + seqValues[nProp] >>= m_aUILocaleString; + m_bROUILocale = seqROStates[nProp]; + nHint |= SYSLOCALEOPTIONS_HINT_UILOCALE; + MakeRealUILocale(); } else if( seqPropertyNames[nProp] == PROPERTYNAME_CURRENCY ) { @@ -425,22 +468,10 @@ void SvtSysLocaleOptions_Impl::Notify( const Sequence< rtl::OUString >& seqPrope { seqValues[nProp] >>= m_bDecimalSeparator; m_bRODecimalSeparator = seqROStates[nProp]; - UpdateMiscSettings_Impl(); } } if ( nHint ) - Broadcast( nHint ); -} -/* -----------------10.02.2004 15:25----------------- - - --------------------------------------------------*/ -void SvtSysLocaleOptions_Impl::UpdateMiscSettings_Impl() -{ - AllSettings aAllSettings( Application::GetSettings() ); - MiscSettings aMiscSettings = aAllSettings.GetMiscSettings(); - aMiscSettings.SetEnableLocalizedDecimalSep(m_bDecimalSeparator); - aAllSettings.SetMiscSettings( aMiscSettings ); - Application::SetSettings( aAllSettings ); + NotifyListeners( nHint ); } // ==================================================================== @@ -450,18 +481,20 @@ SvtSysLocaleOptions::SvtSysLocaleOptions() MutexGuard aGuard( GetMutex() ); if ( !pOptions ) { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtSysLocaleOptions_Impl::ctor()"); + RTL_LOGFILE_CONTEXT(aLog, "svl ( ??? ) ::SvtSysLocaleOptions_Impl::ctor()"); pOptions = new SvtSysLocaleOptions_Impl; - ItemHolder2::holdConfigItem(E_SYSLOCALEOPTIONS); + ItemHolder1::holdConfigItem(E_SYSLOCALEOPTIONS); } ++nRefCount; + pOptions->AddListener(this); } SvtSysLocaleOptions::~SvtSysLocaleOptions() { MutexGuard aGuard( GetMutex() ); + pOptions->RemoveListener(this); if ( !--nRefCount ) { delete pOptions; @@ -480,7 +513,7 @@ Mutex& SvtSysLocaleOptions::GetMutex() if( !pMutex ) { // #i77768# Due to a static reference in the toolkit lib - // we need a mutex that lives longer than the svtools library. + // we need a mutex that lives longer than the svl library. // Otherwise the dtor would use a destructed mutex!! pMutex = new Mutex; } @@ -503,41 +536,37 @@ void SvtSysLocaleOptions::Commit() } -BOOL SvtSysLocaleOptions::AddListener( SvtListener& rLst ) +void SvtSysLocaleOptions::BlockBroadcasts( bool bBlock ) { MutexGuard aGuard( GetMutex() ); - return rLst.StartListening( pOptions->GetBroadcaster() ); + pOptions->BlockBroadcasts( bBlock ); } -BOOL SvtSysLocaleOptions::RemoveListener( SvtListener& rLst ) +const OUString& SvtSysLocaleOptions::GetLocaleConfigString() const { MutexGuard aGuard( GetMutex() ); - return rLst.EndListening( pOptions->GetBroadcaster() ); + return pOptions->GetLocaleString(); } - -void SvtSysLocaleOptions::BlockBroadcasts( BOOL bBlock ) +void SvtSysLocaleOptions::SetLocaleConfigString( const OUString& rStr ) { MutexGuard aGuard( GetMutex() ); - pOptions->BlockBroadcasts( bBlock ); + pOptions->SetLocaleString( rStr ); } - -const OUString& SvtSysLocaleOptions::GetLocaleConfigString() const +const OUString& SvtSysLocaleOptions::GetUILocaleConfigString() const { MutexGuard aGuard( GetMutex() ); - return pOptions->GetLocaleString(); + return pOptions->GetUILocaleString(); } - -void SvtSysLocaleOptions::SetLocaleConfigString( const OUString& rStr ) +void SvtSysLocaleOptions::SetUILocaleConfigString( const OUString& rStr ) { MutexGuard aGuard( GetMutex() ); - pOptions->SetLocaleString( rStr ); + pOptions->SetUILocaleString( rStr ); } - const OUString& SvtSysLocaleOptions::GetCurrencyConfigString() const { MutexGuard aGuard( GetMutex() ); @@ -552,11 +581,6 @@ void SvtSysLocaleOptions::SetCurrencyConfigString( const OUString& rStr ) } -LanguageType SvtSysLocaleOptions::GetLocaleLanguageType() const -{ - MutexGuard aGuard( GetMutex() ); - return pOptions->GetLocaleLanguageType(); -} /*-- 11.02.2004 13:31:41--------------------------------------------------- @@ -635,3 +659,47 @@ const Link& SvtSysLocaleOptions::GetCurrencyChangeLink() return CurrencyChangeLink::get(); } + +void SvtSysLocaleOptions::ConfigurationChanged( utl::ConfigurationBroadcaster* p, sal_uInt32 nHint ) +{ + if ( nHint & SYSLOCALEOPTIONS_HINT_CURRENCY ) + { + const Link& rLink = GetCurrencyChangeLink(); + if ( rLink.IsSet() ) + rLink.Call( NULL ); + } + + ::utl::detail::Options::ConfigurationChanged( p, nHint ); +} + +com::sun::star::lang::Locale SvtSysLocaleOptions::GetLocale() const +{ + return lcl_str_to_locale( GetLocaleConfigString() ); +} + +com::sun::star::lang::Locale SvtSysLocaleOptions::GetUILocale() const +{ + return lcl_str_to_locale( GetUILocaleConfigString() ); +} + +com::sun::star::lang::Locale SvtSysLocaleOptions::GetRealLocale() const +{ + return pOptions->GetRealLocale(); +} + +com::sun::star::lang::Locale SvtSysLocaleOptions::GetRealUILocale() const +{ + return pOptions->GetRealUILocale(); +} + +LanguageType SvtSysLocaleOptions::GetRealLanguage() const +{ + return pOptions->GetRealLanguage(); +} + +LanguageType SvtSysLocaleOptions::GetRealUILanguage() const +{ + return pOptions->GetRealUILanguage(); +} + + diff --git a/svtools/source/config/undoopt.cxx b/unotools/source/config/undoopt.cxx index a0c74ef84aac..c2c79120995f 100644 --- a/svtools/source/config/undoopt.cxx +++ b/unotools/source/config/undoopt.cxx @@ -29,13 +29,9 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION +#include "precompiled_unotools.hxx" -#include <svtools/undoopt.hxx> +#include <unotools/undoopt.hxx> #include "rtl/instance.hxx" #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> @@ -43,11 +39,9 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <vos/mutex.hxx> -#include <svtools/smplhint.hxx> -#include <vcl/svapp.hxx> #include <osl/mutex.hxx> #include <rtl/logfile.hxx> -#include "itemholder2.hxx" +#include "itemholder1.hxx" using namespace utl; using namespace rtl; @@ -58,7 +52,7 @@ static sal_Int32 nRefCount = 0; #define STEPS 0 -class SvtUndoOptions_Impl : public utl::ConfigItem, public SfxBroadcaster +class SvtUndoOptions_Impl : public utl::ConfigItem { sal_Int32 nUndoCount; Sequence< rtl::OUString > m_aPropertyNames; @@ -100,8 +94,7 @@ void SvtUndoOptions_Impl::Commit() } PutProperties( m_aPropertyNames, aValues ); - //broadcast changes - Broadcast(SfxSimpleHint(SFX_HINT_UNDO_OPTIONS_CHANGED)); + NotifyListeners(0); } // ----------------------------------------------------------------------- @@ -158,8 +151,6 @@ void SvtUndoOptions_Impl::Load() void SvtUndoOptions_Impl::Notify( const Sequence<rtl::OUString>& ) { Load(); - //broadcast changes - Broadcast(SfxSimpleHint(SFX_HINT_UNDO_OPTIONS_CHANGED)); } // ----------------------------------------------------------------------- @@ -177,14 +168,14 @@ SvtUndoOptions::SvtUndoOptions() ::osl::MutexGuard aGuard( LocalSingleton::get() ); if ( !pOptions ) { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtUndoOptions_Impl::ctor()"); + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtUndoOptions_Impl::ctor()"); pOptions = new SvtUndoOptions_Impl; - ItemHolder2::holdConfigItem(E_UNDOOPTIONS); + ItemHolder1::holdConfigItem(E_UNDOOPTIONS); } ++nRefCount; pImp = pOptions; - StartListening(*pImp); + pImp->AddListener(this); } // ----------------------------------------------------------------------- @@ -193,7 +184,7 @@ SvtUndoOptions::~SvtUndoOptions() { // Global access, must be guarded (multithreading) ::osl::MutexGuard aGuard( LocalSingleton::get() ); - EndListening(*pImp); + pImp->RemoveListener(this); if ( !--nRefCount ) { if ( pOptions->IsModified() ) @@ -211,10 +202,3 @@ sal_Int32 SvtUndoOptions::GetUndoCount() const { return pImp->GetUndoCount(); } - -void SvtUndoOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - vos::OGuard aVclGuard( Application::GetSolarMutex() ); - Broadcast( rHint ); -} - diff --git a/svtools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx index 4eafbefe54a3..e06d6a794e20 100644 --- a/svtools/source/config/useroptions.cxx +++ b/unotools/source/config/useroptions.cxx @@ -29,25 +29,19 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifdef SVL_DLLIMPLEMENTATION -#undef SVL_DLLIMPLEMENTATION -#endif -#define SVT_DLLIMPLEMENTATION +#include "precompiled_unotools.hxx" -#include <svtools/useroptions.hxx> -#include "configitems/useroptions_const.hxx" +#include <unotools/useroptions.hxx> +#include <unotools/useroptions_const.hxx> #include <unotools/configmgr.hxx> #include <tools/debug.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> -#include <svtools/smplhint.hxx> #include <vos/mutex.hxx> -#include <vcl/svapp.hxx> #include <rtl/instance.hxx> #include <rtl/logfile.hxx> -#include "itemholder2.hxx" +#include "itemholder1.hxx" #include <com/sun/star/beans/Property.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -60,7 +54,7 @@ #include <com/sun/star/util/ChangesEvent.hpp> #include <comphelper/configurationhelper.hxx> #include <unotools/processfactory.hxx> -#include <loghelper.hxx> +#include <unotools/loghelper.hxx> using namespace utl; using namespace rtl; @@ -87,7 +81,7 @@ class SvtUserConfigChangeListener_Impl : public cppu::WeakImplHelper1 virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw(RuntimeException); }; -class SvtUserOptions_Impl : public SfxBroadcaster +class SvtUserOptions_Impl : public utl::ConfigurationBroadcaster { public: SvtUserOptions_Impl(); @@ -778,8 +772,9 @@ void SvtUserOptions_Impl::SetApartment( const ::rtl::OUString& sApartment ) void SvtUserOptions_Impl::Notify() { - Broadcast( SfxSimpleHint( SFX_HINT_USER_OPTIONS_CHANGED ) ); + NotifyListeners(0); } + // ----------------------------------------------------------------------- sal_Bool SvtUserOptions_Impl::IsTokenReadonly( USHORT nToken ) const @@ -938,14 +933,14 @@ SvtUserOptions::SvtUserOptions() if ( !pOptions ) { - RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtUserOptions_Impl::ctor()"); + RTL_LOGFILE_CONTEXT(aLog, "unotools ( ??? ) ::SvtUserOptions_Impl::ctor()"); pOptions = new SvtUserOptions_Impl; - ItemHolder2::holdConfigItem(E_USEROPTIONS); + ItemHolder1::holdConfigItem(E_USEROPTIONS); } ++nRefCount; pImp = pOptions; - StartListening( *pImp); + pImp->AddListener(this); } // ----------------------------------------------------------------------- @@ -954,7 +949,7 @@ SvtUserOptions::~SvtUserOptions() { // Global access, must be guarded (multithreading) ::osl::MutexGuard aGuard( GetInitMutex() ); - + pImp->RemoveListener(this); if ( !--nRefCount ) { //if ( pOptions->IsModified() ) @@ -1303,11 +1298,3 @@ sal_Bool SvtUserOptions::IsTokenReadonly( USHORT nToken ) const ::osl::MutexGuard aGuard( GetInitMutex() ); return pImp->GetToken( nToken ); } -/* -----------------07.07.2003 09:30----------------- - - --------------------------------------------------*/ -void SvtUserOptions::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - vos::OGuard aVclGuard( Application::GetSolarMutex() ); - Broadcast( rHint ); -} diff --git a/svtools/source/config/viewoptions.cxx b/unotools/source/config/viewoptions.cxx index d4c8d65dbe04..9ef8fc45d570 100644 --- a/svtools/source/config/viewoptions.cxx +++ b/unotools/source/config/viewoptions.cxx @@ -29,12 +29,12 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" //_________________________________________________________________________________________________________________ // includes //_________________________________________________________________________________________________________________ -#include <svtools/viewoptions.hxx> +#include <unotools/viewoptions.hxx> #include <com/sun/star/uno/Any.hxx> #include <hash_map> diff --git a/svtools/source/config/workingsetoptions.cxx b/unotools/source/config/workingsetoptions.cxx index d2c1007a70de..6b17a63dad4d 100644 --- a/svtools/source/config/workingsetoptions.cxx +++ b/unotools/source/config/workingsetoptions.cxx @@ -29,7 +29,7 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #ifndef GCC #endif @@ -37,7 +37,7 @@ // includes //_________________________________________________________________________________________________________________ -#include <svtools/workingsetoptions.hxx> +#include <unotools/workingsetoptions.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> #include <tools/debug.hxx> diff --git a/svtools/source/config/xmlaccelcfg.cxx b/unotools/source/config/xmlaccelcfg.cxx index 36886a533413..b1c3f1e31e2d 100644 --- a/svtools/source/config/xmlaccelcfg.cxx +++ b/unotools/source/config/xmlaccelcfg.cxx @@ -29,17 +29,11 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" -#include "xmlaccelcfg.hxx" +#include <unotools/xmlaccelcfg.hxx> #include <vector> -#if OSL_DEBUG_LEVEL == 0 -# ifndef NDEBUG -# define NDEBUG -# endif -#endif -#include <assert.h> #include <com/sun/star/xml/sax/XAttributeList.hpp> #include <cppuhelper/implbase1.hxx> @@ -200,7 +194,7 @@ void AttributeListImpl::clear() ::std::vector<struct TagAttribute> dummy; m_pImpl->vecAttribute.swap( dummy ); - assert( ! getLength() ); + OSL_ASSERT( ! getLength() ); } // ------------------------------------------------------------------ diff --git a/unotools/source/i18n/calendarwrapper.cxx b/unotools/source/i18n/calendarwrapper.cxx index 1d83761b5cea..b56175af7e41 100644 --- a/unotools/source/i18n/calendarwrapper.cxx +++ b/unotools/source/i18n/calendarwrapper.cxx @@ -71,7 +71,7 @@ CalendarWrapper::CalendarWrapper( } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "CalendarWrapper ctor: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -96,7 +96,7 @@ CalendarWrapper::CalendarWrapper( } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getComponentInstance: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -122,7 +122,7 @@ void CalendarWrapper::loadDefaultCalendar( const ::com::sun::star::lang::Locale& } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "loadDefaultCalendar: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -142,7 +142,7 @@ void CalendarWrapper::loadCalendar( const ::rtl::OUString& rUniqueID, const ::co } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "loadCalendar: Exception caught\nrequested: " ); aMsg += ByteString( String( rUniqueID ), RTL_TEXTENCODING_UTF8 ); aMsg += " Locale: "; @@ -167,7 +167,7 @@ void CalendarWrapper::loadCalendar( const ::rtl::OUString& rUniqueID, const ::co } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getLoadedCalendar: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -188,7 +188,7 @@ void CalendarWrapper::loadCalendar( const ::rtl::OUString& rUniqueID, const ::co } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getAllCalendars: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -209,7 +209,7 @@ void CalendarWrapper::loadCalendar( const ::rtl::OUString& rUniqueID, const ::co } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getUniqueID: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -230,7 +230,7 @@ void CalendarWrapper::setDateTime( double nTimeInDays ) } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "setDateTime: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -250,7 +250,7 @@ double CalendarWrapper::getDateTime() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getDateTime: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -280,7 +280,7 @@ sal_Int32 CalendarWrapper::getCombinedOffsetInMillis( } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "setLocalDateTime: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -352,7 +352,7 @@ void CalendarWrapper::setLocalDateTime( double nTimeInDays ) } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "setLocalDateTime: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -378,7 +378,7 @@ double CalendarWrapper::getLocalDateTime() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getLocalDateTime: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -399,7 +399,7 @@ void CalendarWrapper::setValue( sal_Int16 nFieldIndex, sal_Int16 nValue ) } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "setValue: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -419,7 +419,7 @@ sal_Bool CalendarWrapper::isValid() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "isValid: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -440,7 +440,7 @@ sal_Int16 CalendarWrapper::getValue( sal_Int16 nFieldIndex ) const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getValue: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -461,7 +461,7 @@ void CalendarWrapper::addValue( sal_Int16 nFieldIndex, sal_Int32 nAmount ) } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "addValue: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -481,7 +481,7 @@ sal_Int16 CalendarWrapper::getFirstDayOfWeek() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getFirstDayOfWeek: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -502,7 +502,7 @@ void CalendarWrapper::setFirstDayOfWeek( sal_Int16 nDay ) } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "setFirstDayOfWeek: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -522,7 +522,7 @@ void CalendarWrapper::setMinimumNumberOfDaysForFirstWeek( sal_Int16 nDays ) } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "setMinimumNumberOfDaysForFirstWeek: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -542,7 +542,7 @@ sal_Int16 CalendarWrapper::getMinimumNumberOfDaysForFirstWeek() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getMinimumNumberOfDaysForFirstWeek: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -563,7 +563,7 @@ sal_Int16 CalendarWrapper::getNumberOfMonthsInYear() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getNumberOfMonthsInYear: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -584,7 +584,7 @@ sal_Int16 CalendarWrapper::getNumberOfDaysInWeek() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getNumberOfDaysInWeek: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -605,7 +605,7 @@ sal_Int16 CalendarWrapper::getNumberOfDaysInWeek() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getMonths: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -626,7 +626,7 @@ sal_Int16 CalendarWrapper::getNumberOfDaysInWeek() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getDays: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -647,7 +647,7 @@ String CalendarWrapper::getDisplayName( sal_Int16 nCalendarDisplayIndex, sal_Int } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getDisplayName: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -670,7 +670,7 @@ String CalendarWrapper::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_In } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "getDisplayString: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); diff --git a/unotools/source/i18n/charclass.cxx b/unotools/source/i18n/charclass.cxx index c1b6b4bc155c..5b411d1bb519 100644 --- a/unotools/source/i18n/charclass.cxx +++ b/unotools/source/i18n/charclass.cxx @@ -538,7 +538,7 @@ sal_Int32 CharClass::getStringType( const String& rStr, xub_StrLen nPos, xub_Str } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "parseAnyToken: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -570,7 +570,7 @@ sal_Int32 CharClass::getStringType( const String& rStr, xub_StrLen nPos, xub_Str } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "parsePredefinedToken: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx index 074ff7af716a..fa70cc3dda81 100644 --- a/unotools/source/i18n/localedatawrapper.cxx +++ b/unotools/source/i18n/localedatawrapper.cxx @@ -1991,7 +1991,7 @@ void LocaleDataWrapper::evaluateLocaleDataChecking() nCheck = nLocaleDataChecking; if (!nCheck) { -#ifndef PRODUCT +#ifdef DBG_UTIL nCheck = 1; #else const char* pEnv = getenv( "OOO_ENABLE_LOCALE_DATA_CHECKS"); diff --git a/unotools/source/i18n/transliterationwrapper.cxx b/unotools/source/i18n/transliterationwrapper.cxx index bd33e447471f..7647a6abc345 100644 --- a/unotools/source/i18n/transliterationwrapper.cxx +++ b/unotools/source/i18n/transliterationwrapper.cxx @@ -191,7 +191,7 @@ void TransliterationWrapper::loadModuleImpl() const } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "loadModuleImpl: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -218,7 +218,7 @@ void TransliterationWrapper::loadModuleByImplName( } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "loadModuleByImplName: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -244,7 +244,7 @@ sal_Bool TransliterationWrapper::equals( } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "equals: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -269,7 +269,7 @@ sal_Int32 TransliterationWrapper::compareSubstring( } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "compareSubstring: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); @@ -292,7 +292,7 @@ sal_Int32 TransliterationWrapper::compareString( const String& rStr1, const Stri } catch ( Exception& e ) { -#ifndef PRODUCT +#ifdef DBG_UTIL ByteString aMsg( "compareString: Exception caught\n" ); aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 ); DBG_ERRORFILE( aMsg.GetBuffer() ); diff --git a/vcl/source/gdi/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx index 565c92740dad..5c4f902fbd55 100644 --- a/vcl/source/gdi/fontcvt.cxx +++ b/unotools/source/misc/fontcvt.cxx @@ -29,9 +29,9 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_vcl.hxx" -#include <vcl/fontcvt.hxx> -#include <vcl/outdev.h> +#include "precompiled_unotools.hxx" +#include <unotools/fontcvt.hxx> +#include <unotools/fontdefs.hxx> #ifndef _STLP_MAP #include <map> @@ -1350,13 +1350,13 @@ StarSymbolToMSMultiFont *CreateStarSymbolToMSMultiFont(bool bPerfectOnly) //======================================================================= -sal_Unicode ImplRecodeChar( const ImplCvtChar* pConversion, sal_Unicode cChar ) +sal_Unicode ConvertChar::RecodeChar( sal_Unicode cChar ) const { sal_Unicode cRetVal = 0; - if( pConversion->mpCvtFunc ) + if( mpCvtFunc ) { // use a conversion function for recoding - cRetVal = pConversion->mpCvtFunc( cChar ); + cRetVal = mpCvtFunc( cChar ); } else { @@ -1367,7 +1367,7 @@ sal_Unicode ImplRecodeChar( const ImplCvtChar* pConversion, sal_Unicode cChar ) cIndex -= 0xF000; // recode the symbol if( cIndex>=0x0020 && cIndex<=0x00FF ) - cRetVal = pConversion->mpCvtTab[ cIndex - 0x0020 ]; + cRetVal = mpCvtTab[ cIndex - 0x0020 ]; } return cRetVal ? cRetVal : cChar; @@ -1377,8 +1377,7 @@ sal_Unicode ImplRecodeChar( const ImplCvtChar* pConversion, sal_Unicode cChar ) // recode the string assuming the character codes are symbol codes // from an traditional symbol font (i.e. U+F020..U+F0FF) -void ImplRecodeString( const ImplCvtChar* pConversion, String& rStr, - xub_StrLen nIndex, xub_StrLen nLen ) +void ConvertChar::RecodeString( String& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const { ULONG nLastIndex = (ULONG)nIndex + nLen; if( nLastIndex > rStr.Len() ) @@ -1393,7 +1392,7 @@ void ImplRecodeString( const ImplCvtChar* pConversion, String& rStr, continue; // recode a symbol - sal_Unicode cNew = ImplRecodeChar( pConversion, cOrig ); + sal_Unicode cNew = RecodeChar( cOrig ); if( cOrig != cNew ) rStr.SetChar( nIndex, cNew ); } @@ -1401,7 +1400,7 @@ void ImplRecodeString( const ImplCvtChar* pConversion, String& rStr, //======================================================================= -struct RecodeTable { const char* pOrgName; ImplCvtChar aCvt;}; +struct RecodeTable { const char* pOrgName; ConvertChar aCvt;}; static RecodeTable aRecodeTable[] = { @@ -1427,22 +1426,17 @@ static RecodeTable aRecodeTable[] = {"mtextra", {aMTExtraTab, "StarSymbol", NULL}} }; -static ImplCvtChar aImplStarSymbolCvt = { NULL, "StarBats", ImplStarSymbolToStarBats }; -#if 0 -// not used -static ImplCvtChar aImplDingBatsCvt = { aMonotypeSortsTab, "StarSymbol", NULL }; -#endif +static ConvertChar aImplStarSymbolCvt = { NULL, "StarBats", ImplStarSymbolToStarBats }; // ----------------------------------------------------------------------- -const ImplCvtChar* ImplGetRecodeData( const String& rOrgFontName, - const String& rMapFontName ) +const ConvertChar* ConvertChar::GetRecodeData( const String& rOrgFontName, const String& rMapFontName ) { - const ImplCvtChar* pCvt = NULL; + const ConvertChar* pCvt = NULL; String aOrgName( rOrgFontName ); - ImplGetEnglishSearchFontName( aOrgName ); + GetEnglishSearchFontName( aOrgName ); String aMapName( rMapFontName ); - ImplGetEnglishSearchFontName( aMapName ); + GetEnglishSearchFontName( aMapName ); if( aMapName.EqualsAscii( "starsymbol" ) || aMapName.EqualsAscii( "opensymbol" ) ) @@ -1471,10 +1465,10 @@ const ImplCvtChar* ImplGetRecodeData( const String& rOrgFontName, FontToSubsFontConverter CreateFontToSubsFontConverter( const String& rOrgName, ULONG nFlags ) { - const ImplCvtChar* pCvt = NULL; + const ConvertChar* pCvt = NULL; String aName = rOrgName; - ImplGetEnglishSearchFontName( aName ); + GetEnglishSearchFontName( aName ); if ( nFlags & FONTTOSUBSFONT_IMPORT ) { @@ -1511,7 +1505,7 @@ sal_Unicode ConvertFontToSubsFontChar( FontToSubsFontConverter hConverter, sal_Unicode cChar ) { if ( hConverter ) - return ImplRecodeChar( (ImplCvtChar*)hConverter, cChar ); + return ((ConvertChar*)hConverter)->RecodeChar( cChar ); else return cChar; } @@ -1523,6 +1517,7 @@ String GetFontToSubsFontName( FontToSubsFontConverter hConverter ) if ( !hConverter ) return String(); - const char* pName = ((ImplCvtChar*)hConverter)->mpSubsFontName; + const char* pName = ((ConvertChar*)hConverter)->mpSubsFontName; return String::CreateFromAscii( pName ); } + diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx new file mode 100644 index 000000000000..15e67c44f001 --- /dev/null +++ b/unotools/source/misc/fontdefs.cxx @@ -0,0 +1,596 @@ +/************************************************************************* + * + * 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 + * + * 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_unotools.hxx" +#include <unotools/fontdefs.hxx> +#include <unotools/fontcfg.hxx> +#include <hash_map> + +struct ImplLocalizedFontName +{ + const char* mpEnglishName; + const sal_Unicode* mpLocalizedNames; +}; + +static sal_Unicode const aBatang[] = { 0xBC14, 0xD0D5, 0, 0 }; +static sal_Unicode const aBatangChe[] = { 0xBC14, 0xD0D5, 0xCCB4, 0, 0 }; +static sal_Unicode const aGungsuh[] = { 0xAD81, 0xC11C, 0, 0 }; +static sal_Unicode const aGungsuhChe[] = { 0xAD81, 0xC11C, 0xCCB4, 0, 0 }; +static sal_Unicode const aGulim[] = { 0xAD74, 0xB9BC, 0, 0 }; +static sal_Unicode const aGulimChe[] = { 0xAD74, 0xB9BC, 0xCCB4, 0, 0 }; +static sal_Unicode const aDotum[] = { 0xB3CB, 0xC6C0, 0, 0 }; +static sal_Unicode const aDotumChe[] = { 0xB3CB, 0xC6C0, 0xCCB4, 0, 0 }; +static sal_Unicode const aSimSun[] = { 0x5B8B, 0x4F53, 0, 0 }; +static sal_Unicode const aNSimSun[] = { 0x65B0, 0x5B8B, 0x4F53, 0, 0 }; +static sal_Unicode const aSimHei[] = { 0x9ED1, 0x4F53, 0, 0 }; +static sal_Unicode const aSimKai[] = { 0x6977, 0x4F53, 0, 0 }; +static sal_Unicode const azycjkSun[] = { 0x4E2D, 0x6613, 0x5B8B, 0x4F53, 0, 0 }; +static sal_Unicode const azycjkHei[] = { 0x4E2D, 0x6613, 0x9ED1, 0x4F53, 0, 0 }; +static sal_Unicode const azycjkKai[] = { 0x4E2D, 0x6613, 0x6977, 0x4F53, 0, 0 }; +static sal_Unicode const aFZHei[] = { 0x65B9, 0x6B63, 0x9ED1, 0x4F53, 0, 0 }; +static sal_Unicode const aFZKai[] = { 0x65B9, 0x6B63, 0x6977, 0x4F53, 0, 0 }; +static sal_Unicode const aFZSongYI[] = { 0x65B9, 0x6B63, 0x5B8B, 0x4E00, 0, 0 }; +static sal_Unicode const aFZShuSong[] = { 0x65B9, 0x6B63, 0x4E66, 0x5B8B, 0, 0 }; +static sal_Unicode const aFZFangSong[] = { 0x65B9, 0x6B63, 0x4EFF, 0x5B8B, 0, 0 }; +// Attention: this fonts includes the wrong encoding vector - so we double the names with correct and wrong encoding +// First one is the GB-Encoding (we think the correct one), second is the big5 encoded name +static sal_Unicode const aMHei[] = { 'm', 0x7B80, 0x9ED1, 0, 'm', 0x6F60, 0x7AAA, 0, 0 }; +static sal_Unicode const aMKai[] = { 'm', 0x7B80, 0x6977, 0x566C, 0, 'm', 0x6F60, 0x7FF1, 0x628E, 0, 0 }; +static sal_Unicode const aMSong[] = { 'm', 0x7B80, 0x5B8B, 0, 'm', 0x6F60, 0x51BC, 0, 0 }; +static sal_Unicode const aCFangSong[] = { 'm', 0x7B80, 0x592B, 0x5B8B, 0, 'm', 0x6F60, 0x6E98, 0x51BC, 0, 0 }; +static sal_Unicode const aMingLiU[] = { 0x7D30, 0x660E, 0x9AD4, 0, 0 }; +static sal_Unicode const aPMingLiU[] = { 0x65B0, 0x7D30, 0x660E, 0x9AD4, 0, 0 }; +static sal_Unicode const aHei[] = { 0x6865, 0, 0 }; +static sal_Unicode const aKai[] = { 0x6B61, 0, 0 }; +static sal_Unicode const aMing[] = { 0x6D69, 0x6E67, 0, 0 }; +static sal_Unicode const aMSGothic[] = { 'm','s', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; +static sal_Unicode const aMSPGothic[] = { 'm','s','p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; +static sal_Unicode const aMSMincho[] = { 'm', 's', 0x660E, 0x671D, 0 }; +static sal_Unicode const aMSPMincho[] = { 'm','s','p', 0x660E, 0x671D, 0 }; +static sal_Unicode const aMeiryo[] = { 0x30e1, 0x30a4, 0x30ea, 0x30aa, 0 }; +static sal_Unicode const aHGMinchoL[] = { 'h','g', 0x660E, 0x671D, 'l', 0, 0 }; +static sal_Unicode const aHGGothicB[] = { 'h','g', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 0 }; +static sal_Unicode const aHGPMinchoL[] = { 'h','g','p', 0x660E, 0x671D, 'l', 0 }; +static sal_Unicode const aHGPGothicB[] = { 'h','g','p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 0 }; +static sal_Unicode const aHGMinchoLSun[] = { 'h','g', 0x660E, 0x671D, 'l', 's', 'u', 'n', 0 }; +static sal_Unicode const aHGPMinchoLSun[] = { 'h','g','p', 0x660E, 0x671D, 'l', 's', 'u', 'n', 0 }; +static sal_Unicode const aHGGothicBSun[] = { 'h', 'g', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 's', 'u', 'n', 0 }; +static sal_Unicode const aHGPGothicBSun[] = { 'h', 'g', 'p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 's', 'u', 'n', 0 }; +static sal_Unicode const aHGHeiseiMin[] = { 'h', 'g', 0x5E73, 0x6210, 0x660E, 0x671D, 0x4F53, 0, 'h', 'g', 0x5E73, 0x6210, 0x660E, 0x671D, 0x4F53, 'w', '3', 'x', '1', '2', 0, 0 }; +static sal_Unicode const aIPAMincho[] = { 'i', 'p', 'a', 0x660E, 0x671D, 0 }; +static sal_Unicode const aIPAPMincho[] = { 'i', 'p', 'a', 'p', 0x660E, 0x671D, 0 }; +static sal_Unicode const aIPAGothic[] = { 'i', 'p', 'a', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 }; +static sal_Unicode const aIPAPGothic[] = { 'i', 'p', 'a', 'p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 }; +static sal_Unicode const aIPAUIGothic[] = { 'i', 'p', 'a', 'u', 'i', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 }; +static sal_Unicode const aSazanamiMincho[] = { 0x3055, 0x3056, 0x306A, 0x307F, 0x660E, 0x671D, 0, 0 }; +static sal_Unicode const aSazanamiGothic[] = { 0x3055, 0x3056, 0x306A, 0x307F, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; +static sal_Unicode const aKochiMincho[] = { 0x6771, 0x98A8, 0x660E, 0x671D, 0, 0 }; +static sal_Unicode const aKochiGothic[] = { 0x6771, 0x98A8, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; +static sal_Unicode const aSunDotum[] = { 0xC36C, 0xB3CB, 0xC6C0, 0, 0 }; +static sal_Unicode const aSunGulim[] = { 0xC36C, 0xAD74, 0xB9BC, 0, 0 }; +static sal_Unicode const aSunBatang[] = { 0xC36C, 0xBC14, 0xD0D5, 0, 0 }; +static sal_Unicode const aBaekmukDotum[] = { 0xBC31, 0xBB35, 0xB3CB, 0xC6C0, 0, 0 }; +static sal_Unicode const aBaekmukGulim[] = { 0xBC31, 0xBB35, 0xAD74, 0xB9BC, 0, 0 }; +static sal_Unicode const aBaekmukBatang[] = { 0xBC31, 0xBB35, 0xBC14, 0xD0D5, 0, 0 }; +static sal_Unicode const aFzMingTi[] = { 0x65B9, 0x6B63, 0x660E, 0x9AD4, 0, 0 }; +static sal_Unicode const aFzHeiTiTW[]= { 0x65B9, 0x6B63, 0x9ED1, 0x9AD4, 0, 0 }; +static sal_Unicode const aFzKaiTiTW[]= { 0x65B9, 0x6B63, 0x6977, 0x9AD4, 0, 0 }; +static sal_Unicode const aFzHeiTiCN[]= { 0x65B9, 0x6B63, 0x9ED1, 0x4F53, 0, 0 }; +static sal_Unicode const aFzKaiTiCN[]= { 0x65B9, 0x6B63, 0x6977, 0x4F53, 0, 0 }; +static sal_Unicode const aFzSongTi[] = { 0x65B9, 0x6B63, 0x5B8B, 0x4F53, 0, 0 }; +static sal_Unicode const aHYMyeongJoExtra[] = { 'h', 'y', 0xACAC, 0xBA85, 0xC870, 0, 0 }; +static sal_Unicode const aHYSinMyeongJoMedium[] = { 'h', 'y', 0xC2E0, 0xBA85, 0xC870, 0, 0 }; +static sal_Unicode const aHYGothicMedium[] = { 'h', 'y', 0xC911, 0xACE0, 0xB515, 0, 0 }; +static sal_Unicode const aHYGraphicMedium[] = { 'h', 'y', 0xADF8, 0xB798, 0xD53D, 'm', 0, 0 }; +static sal_Unicode const aHYGraphic[] = { 'h', 'y', 0xADF8, 0xB798, 0xD53D, 0, 0 }; +static sal_Unicode const aNewGulim[] = { 0xC0C8, 0xAD74, 0xB9BC, 0, 0 }; +static sal_Unicode const aSunGungseo[] = { 0xC36C, 0xAD81, 0xC11C, 0, 0 }; +static sal_Unicode const aHYGungSoBold[] = { 'h','y', 0xAD81, 0xC11C, 'b', 0, 0 }; +static sal_Unicode const aHYGungSo[] = { 'h','y', 0xAD81, 0xC11C, 0, 0 }; +static sal_Unicode const aSunHeadLine[] = { 0xC36C, 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 0, 0 }; +static sal_Unicode const aHYHeadLineMedium[] = { 'h', 'y', 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 'm', 0, 0 }; +static sal_Unicode const aHYHeadLine[] = { 'h', 'y', 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 0, 0 }; +static sal_Unicode const aYetR[] = { 0xD734, 0xBA3C, 0xC61B, 0xCCB4, 0, 0 }; +static sal_Unicode const aHYGothicExtra[] = { 'h', 'y', 0xACAC, 0xACE0, 0xB515, 0, 0 }; +static sal_Unicode const aSunMokPan[] = { 0xC36C, 0xBAA9, 0xD310, 0, 0 }; +static sal_Unicode const aSunYeopseo[] = { 0xC36C, 0xC5FD, 0xC11C, 0, 0 }; +static sal_Unicode const aSunBaekSong[] = { 0xC36C, 0xBC31, 0xC1A1, 0, 0 }; +static sal_Unicode const aHYPostLight[] = { 'h', 'y', 0xC5FD, 0xC11C, 'l', 0, 0 }; +static sal_Unicode const aHYPost[] = { 'h', 'y', 0xC5FD, 0xC11C, 0, 0 }; +static sal_Unicode const aMagicR[] = { 0xD734, 0xBA3C, 0xB9E4, 0xC9C1, 0xCCB4, 0, 0 }; +static sal_Unicode const aSunCrystal[] = { 0xC36C, 0xD06C, 0xB9AC, 0xC2A4, 0xD0C8, 0, 0 }; +static sal_Unicode const aSunSaemmul[] = { 0xC36C, 0xC0D8, 0xBB3C, 0, 0 }; +static sal_Unicode const aHaansoftBatang[] = { 0xD55C, 0xCEF4, 0xBC14, 0xD0D5, 0, 0 }; +static sal_Unicode const aHaansoftDotum[] = { 0xD55C, 0xCEF4, 0xB3CB, 0xC6C0, 0, 0 }; +static sal_Unicode const aHyhaeseo[] = { 0xD55C, 0xC591, 0xD574, 0xC11C, 0, 0 }; +static sal_Unicode const aMDSol[] = { 'm', 'd', 0xC194, 0xCCB4, 0, 0 }; +static sal_Unicode const aMDGaesung[] = { 'm', 'd', 0xAC1C, 0xC131, 0xCCB4, 0, 0 }; +static sal_Unicode const aMDArt[] = { 'm', 'd', 0xC544, 0xD2B8, 0xCCB4, 0, 0 }; +static sal_Unicode const aMDAlong[] = { 'm', 'd', 0xC544, 0xB871, 0xCCB4, 0, 0 }; +static sal_Unicode const aMDEasop[] = { 'm', 'd', 0xC774, 0xC19D, 0xCCB4, 0, 0 }; +static sal_Unicode const aHYShortSamulMedium[] = { 'h', 'y', 0xC595, 0xC740, 0xC0D8, 0xBB3C, 'm', 0 }; +static sal_Unicode const aHYShortSamul[] = { 'h', 'y', 0xC595, 0xC740, 0xC0D8, 0xBB3C, 0 }; +static sal_Unicode const aHGGothicE[] = { 'h','g', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 }; +static sal_Unicode const aHGPGothicE[] = { 'h','g','p', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 }; +static sal_Unicode const aHGSGothicE[] = { 'h','g','s', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 }; +static sal_Unicode const aHGGothicM[] = { 'h','g', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 }; +static sal_Unicode const aHGPGothicM[] = { 'h','g','p', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 }; +static sal_Unicode const aHGSGothicM[] = { 'h','g','s', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 }; +static sal_Unicode const aHGGyoshotai[] = { 'h','g', 0x884C, 0x66F8, 0x4F53, 0 }; +static sal_Unicode const aHGPGyoshotai[] = { 'h','g','p', 0x884C, 0x66F8, 0x4F53, 0 }; +static sal_Unicode const aHGSGyoshotai[] = { 'h','g','s', 0x884C, 0x66F8, 0x4F53, 0 }; +static sal_Unicode const aHGKyokashotai[] = { 'h','g', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 }; +static sal_Unicode const aHGPKyokashotai[] = { 'h','g','p', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 }; +static sal_Unicode const aHGSKyokashotai[] = { 'h','g','s', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 }; +static sal_Unicode const aHGMinchoB[] = { 'h','g', 0x660E, 0x671D, 'b', 0 }; +static sal_Unicode const aHGPMinchoB[] = { 'h','g','p', 0x660E, 0x671D, 'b', 0 }; +static sal_Unicode const aHGSMinchoB[] = { 'h','g','s', 0x660E, 0x671D, 'b', 0 }; +static sal_Unicode const aHGMinchoE[] = { 'h','g', 0x660E, 0x671D, 'e', 0 }; +static sal_Unicode const aHGPMinchoE[] = { 'h','g','p', 0x660E, 0x671D, 'e', 0 }; +static sal_Unicode const aHGSMinchoE[] = { 'h','g','s', 0x660E, 0x671D, 'e', 0 }; +static sal_Unicode const aHGSoeiKakupoptai[] = { 'h','g', 0x5275,0x82F1,0x89D2,0xFF8E, + 0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0}; +static sal_Unicode const aHGPSoeiKakupoptai[] = { 'h','g', 'p', 0x5275,0x82F1,0x89D2,0xFF8E, + 0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0}; +static sal_Unicode const aHGSSoeiKakupoptai[] = { 'h','g', 's', 0x5275,0x82F1,0x89D2,0xFF8E, + 0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0}; +static sal_Unicode const aHGSoeiPresenceEB[] = { 'h','g', 0x5275,0x82F1,0xFF8C,0xFF9F, + 0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0}; +static sal_Unicode const aHGPSoeiPresenceEB[] = { 'h','g','p', 0x5275,0x82F1,0xFF8C,0xFF9F, + 0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0}; +static sal_Unicode const aHGSSoeiPresenceEB[] = { 'h','g','s', 0x5275,0x82F1,0xFF8C,0xFF9F, + 0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0}; +static sal_Unicode const aHGSoeiKakugothicUB[] = { 'h','g', 0x5275,0x82F1,0x89D2,0xFF7A, + 0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0}; +static sal_Unicode const aHGPSoeiKakugothicUB[] = { 'h','g','p', 0x5275,0x82F1,0x89D2,0xFF7A, + 0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0}; +static sal_Unicode const aHGSSoeiKakugothicUB[] = { 'h','g','s', 0x5275,0x82F1,0x89D2,0xFF7A, + 0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0}; +static sal_Unicode const aHGSeikaishotaiPRO[] = { 'h','g', 0x6B63,0x6977,0x66F8,0x4F53, '-','p','r','o',0}; +static sal_Unicode const aHGMaruGothicMPRO[] = { 'h','g', 0x4E38,0xFF7A,0xFF9E,0xFF7C,0xFF6F,0xFF78, '-','p','r','o',0}; +static sal_Unicode const aHiraginoMinchoPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x660E, 0x671D, 'p','r','o',0}; +static sal_Unicode const aHiraginoMinchoProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x660E, 0x671D, 'p','r','o','n',0}; +static sal_Unicode const aHiraginoKakuGothicPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x89D2, 0x30B4, 'p','r','o',0}; +static sal_Unicode const aHiraginoKakuGothicProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x89D2, 0x30B4, 'p','r','o','n',0}; +static sal_Unicode const aHiraginoMaruGothicPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o',0}; +static sal_Unicode const aHiraginoMaruGothicProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o','n',0}; + + +static ImplLocalizedFontName aImplLocalizedNamesList[] = +{ +{ "batang", aBatang }, +{ "batangche", aBatangChe }, +{ "gungshu", aGungsuh }, +{ "gungshuche", aGungsuhChe }, +{ "gulim", aGulim }, +{ "gulimche", aGulimChe }, +{ "dotum", aDotum }, +{ "dotumche", aDotumChe }, +{ "simsun", aSimSun }, +{ "nsimsun", aNSimSun }, +{ "simhei", aSimHei }, +{ "simkai", aSimKai }, +{ "zycjksun", azycjkSun }, +{ "zycjkhei", azycjkHei }, +{ "zycjkkai", azycjkKai }, +{ "fzhei", aFZHei }, +{ "fzkai", aFZKai }, +{ "fzsong", aFZSongYI }, +{ "fzshusong", aFZShuSong }, +{ "fzfangsong", aFZFangSong }, +{ "mhei", aMHei }, +{ "mkai", aMKai }, +{ "msong", aMSong }, +{ "cfangsong", aCFangSong }, +{ "mingliu", aMingLiU }, +{ "pmingliu", aPMingLiU }, +{ "hei", aHei }, +{ "kai", aKai }, +{ "ming", aMing }, +{ "msgothic", aMSGothic }, +{ "mspgothic", aMSPGothic }, +{ "msmincho", aMSMincho }, +{ "mspmincho", aMSPMincho }, +{ "meiryo", aMeiryo }, +{ "hgminchol", aHGMinchoL }, +{ "hggothicb", aHGGothicB }, +{ "hgpminchol", aHGPMinchoL }, +{ "hgpgothicb", aHGPGothicB }, +{ "hgmincholsun", aHGMinchoLSun }, +{ "hggothicbsun", aHGGothicBSun }, +{ "hgpmincholsun", aHGPMinchoLSun }, +{ "hgpgothicbsun", aHGPGothicBSun }, +{ "hgheiseimin", aHGHeiseiMin }, +{ "ipamincho", aIPAMincho }, +{ "ipapmincho", aIPAPMincho }, +{ "ipagothic", aIPAGothic }, +{ "ipapgothic", aIPAPGothic }, +{ "ipauigothic", aIPAUIGothic }, +{ "sazanamimincho", aSazanamiMincho }, +{ "sazanamigothic", aSazanamiGothic }, +{ "kochimincho", aKochiMincho }, +{ "kochigothic", aKochiGothic }, +{ "sundotum", aSunDotum }, +{ "sungulim", aSunGulim }, +{ "sunbatang", aSunBatang }, +{ "baekmukdotum", aBaekmukDotum }, +{ "baekmukgulim", aBaekmukGulim }, +{ "baekmukbatang", aBaekmukBatang }, +{ "fzheiti", aFzHeiTiCN }, +{ "fzheiti", aFzHeiTiTW }, +{ "fzkaiti", aFzKaiTiCN }, +{ "fzkaitib", aFzKaiTiTW }, +{ "fzmingtib", aFzMingTi }, +{ "fzsongti", aFzSongTi }, +{ "hymyeongjoextra", aHYMyeongJoExtra }, +{ "hysinmyeongjomedium", aHYSinMyeongJoMedium }, +{ "hygothicmedium", aHYGothicMedium }, +{ "hygraphicmedium", aHYGraphicMedium }, +{ "hygraphic", aHYGraphic }, +{ "newgulim", aNewGulim }, +{ "sungungseo", aSunGungseo }, +{ "hygungsobold", aHYGungSoBold }, +{ "hygungso", aHYGungSo }, +{ "sunheadline", aSunHeadLine }, +{ "hyheadlinemedium", aHYHeadLineMedium }, +{ "hyheadline", aHYHeadLine }, +{ "yetr", aYetR }, +{ "hygothicextra", aHYGothicExtra }, +{ "sunmokpan", aSunMokPan }, +{ "sunyeopseo", aSunYeopseo }, +{ "sunbaeksong", aSunBaekSong }, +{ "hypostlight", aHYPostLight }, +{ "hypost", aHYPost }, +{ "magicr", aMagicR }, +{ "suncrystal", aSunCrystal }, +{ "sunsaemmul", aSunSaemmul }, +{ "hyshortsamulmedium", aHYShortSamulMedium }, +{ "hyshortsamul", aHYShortSamul }, +{ "haansoftbatang", aHaansoftBatang }, +{ "haansoftdotum", aHaansoftDotum }, +{ "hyhaeseo", aHyhaeseo }, +{ "mdsol", aMDSol }, +{ "mdgaesung", aMDGaesung }, +{ "mdart", aMDArt }, +{ "mdalong", aMDAlong }, +{ "mdeasop", aMDEasop }, +{ "hggothice", aHGGothicE }, +{ "hgpgothice", aHGPGothicE }, +{ "hgpothice", aHGSGothicE }, +{ "hggothicm", aHGGothicM }, +{ "hgpgothicm", aHGPGothicM }, +{ "hgpgothicm", aHGSGothicM }, +{ "hggyoshotai", aHGGyoshotai }, +{ "hgpgyoshotai", aHGPGyoshotai }, +{ "hgsgyoshotai", aHGSGyoshotai }, +{ "hgkyokashotai", aHGKyokashotai }, +{ "hgpkyokashotai", aHGPKyokashotai }, +{ "hgskyokashotai", aHGSKyokashotai }, +{ "hgminchob", aHGMinchoB }, +{ "hgpminchob", aHGPMinchoB }, +{ "hgsminchob", aHGSMinchoB }, +{ "hgminchoe", aHGMinchoE }, +{ "hgpminchoe", aHGPMinchoE }, +{ "hgsminchoe", aHGSMinchoE }, +{ "hgsoeikakupoptai", aHGSoeiKakupoptai }, +{ "hgpsoeikakupopta", aHGPSoeiKakupoptai }, +{ "hgssoeikakupopta", aHGSSoeiKakupoptai }, +{ "hgsoeipresenceeb", aHGSoeiPresenceEB }, +{ "hgpsoeipresenceeb", aHGPSoeiPresenceEB }, +{ "hgssoeipresenceeb", aHGSSoeiPresenceEB }, +{ "hgsoeikakugothicub", aHGSoeiKakugothicUB }, +{ "hgpsoeikakugothicub", aHGPSoeiKakugothicUB }, +{ "hgssoeikakugothicub", aHGSSoeiKakugothicUB }, +{ "hgseikaishotaipro", aHGSeikaishotaiPRO }, +{ "hgmarugothicmpro", aHGMaruGothicMPRO }, +{ "hiraginominchopro", aHiraginoMinchoPro }, +{ "hiraginominchopron", aHiraginoMinchoProN }, +{ "hiraginokakugothicpro", aHiraginoKakuGothicPro }, +{ "hiraginokakugothicpron", aHiraginoKakuGothicProN }, +{ "hiraginomarugothicpro", aHiraginoMaruGothicPro }, +{ "hiraginomarugothicpron", aHiraginoMaruGothicProN }, +{ NULL, NULL }, +}; + +// ----------------------------------------------------------------------- + +void GetEnglishSearchFontName( String& rName ) +{ + bool bNeedTranslation = false; + xub_StrLen nLen = rName.Len(); + + // Remove trailing whitespaces + xub_StrLen i = nLen; + while ( i && (rName.GetChar( i-1 ) < 32) ) + i--; + if ( i != nLen ) + rName.Erase( i ); + + // Remove Script at the end + // Scriptname must be the last part of the fontname and + // looks like "fontname (scriptname)". So there can only be a + // script name at the and of the fontname, when the last char is ')' + if ( (nLen >= 3) && rName.GetChar( nLen-1 ) == ')' ) + { + int nOpen = 1; + xub_StrLen nTempLen = nLen-2; + while ( nTempLen ) + { + if ( rName.GetChar( nTempLen ) == '(' ) + { + nOpen--; + if ( !nOpen ) + { + // Remove Space at the end + if ( nTempLen && (rName.GetChar( nTempLen-1 ) == ' ') ) + nTempLen--; + rName.Erase( nTempLen ); + nLen = nTempLen; + break; + } + } + if ( rName.GetChar( nTempLen ) == ')' ) + nOpen++; + nTempLen--; + } + } + + // remove all whitespaces and converts to lower case ASCII + // TODO: better transliteration to ASCII e.g. all digits + i = 0; + while ( i < nLen ) + { + sal_Unicode c = rName.GetChar( i ); + if ( c > 127 ) + { + // Translate to Lowercase-ASCII + // FullWidth-ASCII to half ASCII + if ( (c >= 0xFF00) && (c <= 0xFF5E) ) + { + c -= 0xFF00-0x0020; + // Upper to Lower + if ( (c >= 'A') && (c <= 'Z') ) + c += 'a' - 'A'; + rName.SetChar( i, c ); + } + else + { + // Only Fontnames with None-Ascii-Characters must be translated + bNeedTranslation = true; + } + } + // not lowercase Ascii + else if ( !((c >= 'a') && (c <= 'z')) ) + { + // To Lowercase-Ascii + if ( (c >= 'A') && (c <= 'Z') ) + { + c += 'a' - 'A'; + rName.SetChar( i, c ); + } + else if( ((c < '0') || (c > '9')) && (c != ';') ) // not 0-9 or semicolon + { + // Remove white spaces and special characters + rName.Erase( i, 1 ); + nLen--; + continue; + } + } + + i++; + } + + // translate normalized localized name to its normalized English ASCII name + if( bNeedTranslation ) + { + typedef std::hash_map<const String, const char*,FontNameHash> FontNameDictionary; + static FontNameDictionary aDictionary( sizeof(aImplLocalizedNamesList) / sizeof(*aImplLocalizedNamesList) ); + // the font name dictionary needs to be intialized once + if( aDictionary.empty() ) + { + // TODO: check if all dictionary entries are already normalized? + const ImplLocalizedFontName* pList = aImplLocalizedNamesList; + for(; pList->mpEnglishName; ++pList ) + aDictionary[ pList->mpLocalizedNames ] = pList->mpEnglishName; + } + + FontNameDictionary::const_iterator it = aDictionary.find( rName ); + if( it != aDictionary.end() ) + rName.AssignAscii( it->second ); + } +} + +// ----------------------------------------------------------------------- + +String GetNextFontToken( const String& rTokenStr, xub_StrLen& rIndex ) +{ + // check for valid start index + int nStringLen = rTokenStr.Len(); + if( rIndex >= nStringLen ) + { + rIndex = STRING_NOTFOUND; + return String(); + } + + // find the next token delimiter and return the token substring + const sal_Unicode* pStr = rTokenStr.GetBuffer() + rIndex; + const sal_Unicode* pEnd = rTokenStr.GetBuffer() + nStringLen; + for(; pStr < pEnd; ++pStr ) + if( (*pStr == ';') || (*pStr == ',') ) + break; + + xub_StrLen nTokenStart = rIndex; + xub_StrLen nTokenLen; + if( pStr < pEnd ) + { + rIndex = sal::static_int_cast<xub_StrLen>(pStr - rTokenStr.GetBuffer()); + nTokenLen = rIndex - nTokenStart; + ++rIndex; // skip over token separator + } + else + { + // no token delimiter found => handle last token + rIndex = STRING_NOTFOUND; + nTokenLen = STRING_LEN; + + // optimize if the token string consists of just one token + if( !nTokenStart ) + return rTokenStr; + } + + return String( rTokenStr, nTokenStart, nTokenLen ); +} + +// TODO: get rid of this in another incompatible build with SW project. +// SW's WW8 and RTF filters still use this (from fontcvt.hxx) +String GetFontToken( const String& rTokenStr, xub_StrLen nToken, xub_StrLen& rIndex ) +{ + // skip nToken Tokens + for( xub_StrLen i = 0; (i < nToken) && (rIndex != STRING_NOTFOUND); ++i ) + GetNextFontToken( rTokenStr, rIndex ); + + return GetNextFontToken( rTokenStr, rIndex ); +} + +// ======================================================================= + +static bool ImplIsFontToken( const String& rName, const String& rToken ) +{ + String aTempName; + xub_StrLen nIndex = 0; + do + { + aTempName = GetNextFontToken( rName, nIndex ); + if ( rToken == aTempName ) + return true; + } + while ( nIndex != STRING_NOTFOUND ); + + return false; +} + +// ----------------------------------------------------------------------- + +static void ImplAppendFontToken( String& rName, const String& rNewToken ) +{ + if ( rName.Len() ) + { + rName.Append( ';' ); + rName.Append( rNewToken ); + } + else + rName = rNewToken; +} + +void AddTokenFontName( String& rName, const String& rNewToken ) +{ + if ( !ImplIsFontToken( rName, rNewToken ) ) + ImplAppendFontToken( rName, rNewToken ); +} + + + +// ======================================================================= + +String GetSubsFontName( const String& rName, ULONG nFlags ) +{ + String aName; + + xub_StrLen nIndex = 0; + String aOrgName = GetNextFontToken( rName, nIndex ); + GetEnglishSearchFontName( aOrgName ); + + // #93662# do not try to replace StarSymbol with MS only font + if( nFlags == (SUBSFONT_MS|SUBSFONT_ONLYONE) + && ( aOrgName.EqualsAscii( "starsymbol" ) + || aOrgName.EqualsAscii( "opensymbol" ) ) ) + return aName; + + const utl::FontNameAttr* pAttr = utl::FontSubstConfiguration::get()->getSubstInfo( aOrgName ); + if ( pAttr ) + { + for( int i = 0; i < 3; i++ ) + { + const ::std::vector< String >* pVector = NULL; + switch( i ) + { + case 0: + if( nFlags & SUBSFONT_MS && pAttr->MSSubstitutions.size() ) + pVector = &pAttr->MSSubstitutions; + break; + case 1: + if( nFlags & SUBSFONT_PS && pAttr->PSSubstitutions.size() ) + pVector = &pAttr->PSSubstitutions; + break; + case 2: + if( nFlags & SUBSFONT_HTML && pAttr->HTMLSubstitutions.size() ) + pVector = &pAttr->HTMLSubstitutions; + break; + } + if( ! pVector ) + continue; + for( ::std::vector< String >::const_iterator it = pVector->begin(); it != pVector->end(); ++it ) + if( ! ImplIsFontToken( rName, *it ) ) + { + ImplAppendFontToken( aName, *it ); + if( nFlags & SUBSFONT_ONLYONE ) + { + i = 4; + break; + } + } + } + } + + return aName; +} + +// ----------------------------------------------------------------------- + +// TODO: use a more generic String hash +int FontNameHash::operator()( const String& rStr ) const +{ + // this simple hash just has to be good enough for font names + int nHash = 0; + const int nLen = rStr.Len(); + const sal_Unicode* p = rStr.GetBuffer(); + switch( nLen ) + { + default: nHash = (p[0]<<16) - (p[1]<<8) + p[2]; + nHash += nLen; + p += nLen - 3; + // fall through + case 3: nHash += (p[2]<<16); // fall through + case 2: nHash += (p[1]<<8); // fall through + case 1: nHash += p[0]; // fall through + case 0: break; + }; + + return nHash; +} + diff --git a/unotools/source/misc/makefile.mk b/unotools/source/misc/makefile.mk index 8e505e41aaac..d588a216c159 100644 --- a/unotools/source/misc/makefile.mk +++ b/unotools/source/misc/makefile.mk @@ -45,7 +45,10 @@ ENABLE_EXCEPTIONS=TRUE SLOFILES= $(SLO)$/atom.obj \ $(SLO)$/datetime.obj \ + $(SLO)$/syslocale.obj \ $(SLO)$/eventlisteneradapter.obj \ + $(SLO)$/fontcvt.obj \ + $(SLO)$/fontdefs.obj \ $(SLO)$/desktopterminationobserver.obj \ $(SLO)$/sharedunocomponent.obj \ $(SLO)$/componentresmodule.obj diff --git a/svtools/source/syslocale/syslocale.cxx b/unotools/source/misc/syslocale.cxx index 9811d97fd964..8e9d75c6ce0c 100644 --- a/svtools/source/syslocale/syslocale.cxx +++ b/unotools/source/misc/syslocale.cxx @@ -29,20 +29,16 @@ ************************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "precompiled_unotools.hxx" #ifndef GCC #endif -#include <svtools/syslocale.hxx> -#include <broadcast.hxx> -#include <listener.hxx> -#include <svtools/smplhint.hxx> -#include <vcl/svapp.hxx> +#include <unotools/syslocale.hxx> #include <tools/string.hxx> -#include <svtools/syslocaleoptions.hxx> +#include <unotools/syslocaleoptions.hxx> #include <unotools/localedatawrapper.hxx> #include <comphelper/processfactory.hxx> - +#include <i18npool/mslangid.hxx> using namespace osl; using namespace com::sun::star; @@ -52,39 +48,34 @@ SvtSysLocale_Impl* SvtSysLocale::pImpl = NULL; sal_Int32 SvtSysLocale::nRefCount = 0; -class SvtSysLocale_Impl : public SvtListener +class SvtSysLocale_Impl : public utl::ConfigurationListener { - friend class SvtSysLocale; - +public: SvtSysLocaleOptions aSysLocaleOptions; LocaleDataWrapper* pLocaleData; CharClass* pCharClass; -public: - SvtSysLocale_Impl(); - virtual ~SvtSysLocale_Impl(); - - virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint ); - - CharClass* GetCharClass(); + SvtSysLocale_Impl(); + virtual ~SvtSysLocale_Impl(); + CharClass* GetCharClass(); + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); }; - // ----------------------------------------------------------------------- SvtSysLocale_Impl::SvtSysLocale_Impl() : pCharClass(NULL) { - const lang::Locale& rLocale = Application::GetSettings().GetLocale(); - pLocaleData = new LocaleDataWrapper( - ::comphelper::getProcessServiceFactory(), rLocale ); - aSysLocaleOptions.AddListener( *this ); + pLocaleData = new LocaleDataWrapper( ::comphelper::getProcessServiceFactory(), aSysLocaleOptions.GetRealLocale() ); + + // listen for further changes + aSysLocaleOptions.AddListener( this ); } SvtSysLocale_Impl::~SvtSysLocale_Impl() { - aSysLocaleOptions.RemoveListener( *this ); + aSysLocaleOptions.RemoveListener( this ); delete pCharClass; delete pLocaleData; } @@ -92,25 +83,21 @@ SvtSysLocale_Impl::~SvtSysLocale_Impl() CharClass* SvtSysLocale_Impl::GetCharClass() { if ( !pCharClass ) - { - const lang::Locale& rLocale = Application::GetSettings().GetLocale(); - pCharClass = new CharClass(::comphelper::getProcessServiceFactory(), rLocale ); - } + pCharClass = new CharClass(::comphelper::getProcessServiceFactory(), aSysLocaleOptions.GetRealLocale() ); return pCharClass; } -void SvtSysLocale_Impl::Notify( SvtBroadcaster&, const SfxHint& rHint ) + +void SvtSysLocale_Impl::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 nHint ) { - const SfxSimpleHint* p = PTR_CAST( SfxSimpleHint, &rHint ); - if( p && (p->GetId() & SYSLOCALEOPTIONS_HINT_LOCALE) ) + MutexGuard aGuard( SvtSysLocale::GetMutex() ); + if ( nHint & SYSLOCALEOPTIONS_HINT_LOCALE ) { - MutexGuard aGuard( SvtSysLocale::GetMutex() ); - const lang::Locale& rLocale = Application::GetSettings().GetLocale(); - pLocaleData->setLocale( rLocale ); - GetCharClass()->setLocale( rLocale ); + com::sun::star::lang::Locale aLocale( aSysLocaleOptions.GetRealLocale() ); + pLocaleData->setLocale( aLocale ); + GetCharClass()->setLocale( aLocale ); } } - // ==================================================================== SvtSysLocale::SvtSysLocale() @@ -143,7 +130,7 @@ Mutex& SvtSysLocale::GetMutex() if( !pMutex ) { // #i77768# Due to a static reference in the toolkit lib - // we need a mutex that lives longer than the svtools library. + // we need a mutex that lives longer than the svl library. // Otherwise the dtor would use a destructed mutex!! pMutex = new Mutex; } @@ -174,3 +161,30 @@ const CharClass* SvtSysLocale::GetCharClassPtr() const { return pImpl->GetCharClass(); } + +SvtSysLocaleOptions& SvtSysLocale::GetOptions() const +{ + return pImpl->aSysLocaleOptions; +} + +com::sun::star::lang::Locale SvtSysLocale::GetLocale() const +{ + return pImpl->aSysLocaleOptions.GetRealLocale(); +} + +LanguageType SvtSysLocale::GetLanguage() const +{ + return pImpl->aSysLocaleOptions.GetRealLanguage(); +} + +com::sun::star::lang::Locale SvtSysLocale::GetUILocale() const +{ + return pImpl->aSysLocaleOptions.GetRealUILocale(); +} + +LanguageType SvtSysLocale::GetUILanguage() const +{ + return pImpl->aSysLocaleOptions.GetRealUILanguage(); +} + + diff --git a/unotools/source/property/propertysetinfo.cxx b/unotools/source/property/propertysetinfo.cxx index b8b5f8bb5125..ced5ae10a9d7 100644 --- a/unotools/source/property/propertysetinfo.cxx +++ b/unotools/source/property/propertysetinfo.cxx @@ -79,7 +79,7 @@ void PropertyMapImpl::add( PropertyMapEntry* pMap ) throw() { OUString aName( pMap->mpName, pMap->mnNameLen, RTL_TEXTENCODING_ASCII_US ); -#ifndef PRODUCT +#ifdef DBG_UTIL PropertyMap::iterator aIter = maPropertyMap.find( aName ); if( aIter != maPropertyMap.end() ) { diff --git a/vcl/aqua/inc/aquaprintview.h b/vcl/aqua/inc/aquaprintview.h index c5ce20c17425..55a85678cd50 100755 --- a/vcl/aqua/inc/aquaprintview.h +++ b/vcl/aqua/inc/aquaprintview.h @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: aquaprintview.h,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.114.1 $ * * This file is part of OpenOffice.org. * @@ -35,20 +35,36 @@ #include <Cocoa/Cocoa.h> #include "postmac.h" -class ImplQPrinter; +#include "vcl/print.hxx" + class AquaSalInfoPrinter; +struct PrintAccessoryViewState +{ + bool bNeedRestart; + sal_Int32 nLastPage; + + PrintAccessoryViewState() + : bNeedRestart( false ), nLastPage( 0 ) {} +}; + @interface AquaPrintView : NSView { - ImplQPrinter* mpQPrinter; - AquaSalInfoPrinter* mpInfoPrinter; + vcl::PrinterController* mpController; + AquaSalInfoPrinter* mpInfoPrinter; } --(id)initWithQPrinter: (ImplQPrinter*)pPrinter withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter; +-(id)initWithController: (vcl::PrinterController*)pController withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter; -(MacOSBOOL)knowsPageRange: (NSRangePointer)range; -(NSRect)rectForPage: (int)page; -(NSPoint)locationOfPrintRect: (NSRect)aRect; -(void)drawRect: (NSRect)rect; @end +@interface AquaPrintAccessoryView : NSObject +{ +} ++(NSObject*)setupPrinterPanel: (NSPrintOperation*)pOp withController: (vcl::PrinterController*)pController withState: (PrintAccessoryViewState*)pState; +@end + #endif diff --git a/vcl/aqua/inc/salframe.h b/vcl/aqua/inc/salframe.h index 1d1eb3cb6bd3..5ddd96dae34d 100644 --- a/vcl/aqua/inc/salframe.h +++ b/vcl/aqua/inc/salframe.h @@ -121,6 +121,7 @@ public: virtual BOOL PostEvent( void* pData ); virtual void SetTitle( const XubString& rTitle ); virtual void SetIcon( USHORT nIcon ); + virtual void SetRepresentedURL( const rtl::OUString& ); virtual void SetMenu( SalMenu* pSalMenu ); virtual void DrawMenuBar(); virtual void Show( BOOL bVisible, BOOL bNoActivate = FALSE ); @@ -140,7 +141,7 @@ public: virtual void SetPointer( PointerStyle ePointerStyle ); virtual void CaptureMouse( BOOL bMouse ); virtual void SetPointerPos( long nX, long nY ); - virtual void Flush( void); + virtual void Flush( void ); virtual void Flush( const Rectangle& ); virtual void Sync(); virtual void SetInputContext( SalInputContext* pContext ); diff --git a/vcl/aqua/inc/salframeview.h b/vcl/aqua/inc/salframeview.h index 7fd4d96c4a45..e823837e7af6 100755 --- a/vcl/aqua/inc/salframeview.h +++ b/vcl/aqua/inc/salframeview.h @@ -132,7 +132,11 @@ -(void)moveWordForwardAndModifySelection: (id)aSender; -(void)moveWordRightAndModifySelection: (id)aSender; -(void)moveToEndOfLine: (id)aSender; +-(void)moveToRightEndOfLine: (id)aSender; +-(void)moveToLeftEndOfLine: (id)aSender; -(void)moveToEndOfLineAndModifySelection: (id)aSender; +-(void)moveToRightEndOfLineAndModifySelection: (id)aSender; +-(void)moveToLeftEndOfLineAndModifySelection: (id)aSender; -(void)moveToBeginningOfLine: (id)aSender; -(void)moveToBeginningOfLineAndModifySelection: (id)aSender; -(void)moveToEndOfParagraph: (id)aSender; @@ -144,8 +148,10 @@ -(void)moveParagraphBackward: (id)aSender; -(void)moveParagraphBackwardAndModifySelection: (id)aSender; -(void)moveToEndOfDocument: (id)aSender; +-(void)scrollToEndOfDocument: (id)aSender; -(void)moveToEndOfDocumentAndModifySelection: (id)aSender; -(void)moveToBeginningOfDocument: (id)aSender; +-(void)scrollToBeginningOfDocument: (id)aSender; -(void)moveToBeginningOfDocumentAndModifySelection: (id)aSender; -(void)insertNewline: (id)aSender; -(void)deleteBackward: (id)aSender; diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h index 11abd6086ce7..e835ac773a50 100644 --- a/vcl/aqua/inc/salgdi.h +++ b/vcl/aqua/inc/salgdi.h @@ -175,6 +175,9 @@ public: void RefreshRect(float lX, float lY, float lWidth, float lHeight); void SetState(); + void UnsetState(); + // InvalidateContext does an UnsetState and sets mrContext to 0 + void InvalidateContext(); virtual BOOL unionClipRegion( long nX, long nY, long nWidth, long nHeight ); virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& ); @@ -358,6 +361,7 @@ private: void ApplyXorContext(); void Pattern50Fill(); + UInt32 getState( ControlState nState ); }; class XorEmulation diff --git a/vcl/aqua/inc/salprn.h b/vcl/aqua/inc/salprn.h index ec08261e8321..bf9c3c25bc87 100644 --- a/vcl/aqua/inc/salprn.h +++ b/vcl/aqua/inc/salprn.h @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: salprn.h,v $ - * $Revision: 1.12 $ + * $Revision: 1.12.56.1 $ * * This file is part of OpenOffice.org. * @@ -73,8 +73,8 @@ class AquaSalInfoPrinter : public SalInfoPrinter int mnStartPageOffsetX; int mnStartPageOffsetY; - ULONG mnCurPageRangeStart; - ULONG mnCurPageRangeCount; + sal_Int32 mnCurPageRangeStart; + sal_Int32 mnCurPageRangeCount; public: AquaSalInfoPrinter( const SalPrinterQueueInfo& pInfo ); @@ -96,19 +96,17 @@ class AquaSalInfoPrinter : public SalInfoPrinter virtual String GetPaperBinName( const ImplJobSetup* i_pSetupData, ULONG i_nPaperBin ); virtual void InitPaperFormats( const ImplJobSetup* i_pSetupData ); virtual int GetLandscapeAngle( const ImplJobSetup* i_pSetupData ); - virtual DuplexMode GetDuplexMode( const ImplJobSetup* i_pSetupData ); - // the artificial separation between InfoPrinter and Printer // is not really useful for us // so let's make AquaSalPrinter just a forwarder to AquaSalInfoPrinter // and concentrate the real work in one class // implement pull model print system - BOOL StartJob( const String* pFileName, - const String& rAppName, - ImplJobSetup* pSetupData, - ImplQPrinter* pQPrinter, - bool bIsQuickJob ); + BOOL StartJob( const String* i_pFileName, + const String& rJobName, + const String& i_rAppName, + ImplJobSetup* i_pSetupData, + vcl::PrinterController& i_rController ); BOOL EndJob(); BOOL AbortJob(); SalGraphics* StartPage( ImplJobSetup* i_pSetupData, BOOL i_bNewJobData ); @@ -117,8 +115,12 @@ class AquaSalInfoPrinter : public SalInfoPrinter NSPrintInfo* getPrintInfo() const { return mpPrintInfo; } void setStartPageOffset( int nOffsetX, int nOffsetY ) { mnStartPageOffsetX = nOffsetX; mnStartPageOffsetY = nOffsetY; } - ULONG getCurPageRangeStart() const { return mnCurPageRangeStart; } - ULONG getCurPageRangeCount() const { return mnCurPageRangeCount; } + sal_Int32 getCurPageRangeStart() const { return mnCurPageRangeStart; } + sal_Int32 getCurPageRangeCount() const { return mnCurPageRangeCount; } + + // match width/height against known paper formats, possibly switching orientation + const PaperInfo* matchPaper( long i_nWidth, long i_nHeight, Orientation& o_rOrientation ) const; + void setPaperSize( long i_nWidth, long i_nHeight, Orientation i_eSetOrientation ); private: AquaSalInfoPrinter( const AquaSalInfoPrinter& ); @@ -139,13 +141,16 @@ class AquaSalPrinter : public SalPrinter virtual BOOL StartJob( const XubString* i_pFileName, const XubString& i_rJobName, const XubString& i_rAppName, - ULONG i_nCopies, BOOL i_bCollate, + ULONG i_nCopies, + bool i_bCollate, + bool i_bDirect, ImplJobSetup* i_pSetupData ); // implement pull model print system - virtual BOOL StartJob( const String* pFileName, - const String& rAppName, - ImplJobSetup* pSetupData, - ImplQPrinter* pQPrinter ); + virtual BOOL StartJob( const String* i_pFileName, + const String& rJobName, + const String& i_rAppName, + ImplJobSetup* i_pSetupData, + vcl::PrinterController& i_rListener ); virtual BOOL EndJob(); virtual BOOL AbortJob(); @@ -162,7 +167,7 @@ const double fPtTo100thMM = 35.27777778; inline int PtTo10Mu( double nPoints ) { return (int)(((nPoints)*fPtTo100thMM)+0.5); } -inline double TenMuToPt( double nUnits ) { return (((nUnits)/fPtTo100thMM)+0.5); } +inline double TenMuToPt( double nUnits ) { return floor(((nUnits)/fPtTo100thMM)+0.5); } diff --git a/vcl/aqua/source/a11y/documentfocuslistener.cxx b/vcl/aqua/source/a11y/documentfocuslistener.cxx index 2bb1429bc9fe..f20a67a85f29 100644 --- a/vcl/aqua/source/a11y/documentfocuslistener.cxx +++ b/vcl/aqua/source/a11y/documentfocuslistener.cxx @@ -102,12 +102,12 @@ DocumentFocusListener::notifyEvent( const AccessibleEventObject& aEvent ) break; case AccessibleEventId::INVALIDATE_ALL_CHILDREN: -/* { + { Reference< XAccessible > xAccessible( getAccessible(aEvent) ); detachRecursive(xAccessible); attachRecursive(xAccessible); } -*/ + OSL_TRACE( "Invalidate all children called\n" ); break; default: diff --git a/vcl/aqua/source/app/salinst.cxx b/vcl/aqua/source/app/salinst.cxx index e4037df0c4aa..4ec3339d5372 100644 --- a/vcl/aqua/source/app/salinst.cxx +++ b/vcl/aqua/source/app/salinst.cxx @@ -69,7 +69,7 @@ #import "apple_remote/RemoteMainController.h" #include "apple_remote/RemoteControl.h" #include "postmac.h" - +#include <tools/solarmutex.hxx> using namespace std; using namespace ::com::sun::star; @@ -472,6 +472,7 @@ AquaSalInstance::AquaSalInstance() { mpSalYieldMutex = new SalYieldMutex; mpSalYieldMutex->acquire(); + ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex ); maMainThread = vos::OThread::getCurrentIdentifier(); mbWaitingYield = false; maUserEventListMutex = osl_createMutex(); @@ -482,6 +483,7 @@ AquaSalInstance::AquaSalInstance() AquaSalInstance::~AquaSalInstance() { + ::tools::SolarMutex::SetSolarMutex( 0 ); mpSalYieldMutex->release(); delete mpSalYieldMutex; osl_destroyMutex( maUserEventListMutex ); diff --git a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm new file mode 100644 index 000000000000..798fefef1b25 --- /dev/null +++ b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm @@ -0,0 +1,1237 @@ +/************************************************************************ + * + * 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: aquaprintview.mm,v $ + * $Revision: 1.5.56.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_vcl.hxx" + +#include "aquaprintview.h" +#include "salinst.h" +#include "vcl/print.hxx" +#include "vcl/image.hxx" +#include "vcl/virdev.hxx" +#include "vcl/svdata.hxx" +#include "vcl/svapp.hxx" +#include "vcl/unohelp.hxx" + +#include "vcl/svids.hrc" + +#include "tools/resary.hxx" + +#include "com/sun/star/i18n/XBreakIterator.hpp" +#include "com/sun/star/i18n/WordType.hpp" + +#include <map> + +using namespace vcl; +using namespace com::sun::star; +using namespace com::sun::star::beans; +using namespace com::sun::star::uno; + +/* Note: the accesory view as implemented here is already deprecated in Leopard. Unfortunately + as long as our baseline is Tiger we cannot gain the advantages over multiple accessory views + as well havs having accessory views AND a preview (as long as you are linked vs. 10.4 libraries + the preview insists on not being present. This is unfortunate. +*/ + +class ControllerProperties; + +@interface ControlTarget : NSObject +{ + ControllerProperties* mpController; +} +-(id)initWithControllerMap: (ControllerProperties*)pController; +-(void)triggered:(id)pSender; +-(void)triggeredNumeric:(id)pSender; +-(void)triggeredPreview:(id)pSender; +-(void)dealloc; +@end + + +class ControllerProperties +{ + vcl::PrinterController* mpController; + std::map< int, rtl::OUString > maTagToPropertyName; + std::map< int, sal_Int32 > maTagToValueInt; + std::map< NSView*, NSView* > maViewPairMap; + std::vector< NSObject* > maViews; + int mnNextTag; + sal_Int32 mnLastPageCount; + PrintAccessoryViewState* mpState; + NSPrintOperation* mpOp; + NSView* mpAccessoryView; + NSTabView* mpTabView; + NSBox* mpPreviewBox; + NSImageView* mpPreview; + NSTextField* mpPageEdit; + NSStepper* mpStepper; + NSTextView* mpPagesLabel; + ResStringArray maLocalizedStrings; + + public: + ControllerProperties( vcl::PrinterController* i_pController, + NSPrintOperation* i_pOp, + NSView* i_pAccessoryView, + NSTabView* i_pTabView, + PrintAccessoryViewState* i_pState ) + : mpController( i_pController ), + mnNextTag( 0 ), + mnLastPageCount( i_pController->getFilteredPageCount() ), + mpState( i_pState ), + mpOp( i_pOp ), + mpAccessoryView( i_pAccessoryView ), + mpTabView( i_pTabView ), + mpPreviewBox( nil ), + mpPreview( nil ), + mpPageEdit( nil ), + mpStepper( nil ), + mpPagesLabel( nil ), + maLocalizedStrings( VclResId( SV_PRINT_NATIVE_STRINGS ) ) + { + mpState->bNeedRestart = false; + DBG_ASSERT( maLocalizedStrings.Count() >= 4, "resources not found !" ); + } + + rtl::OUString getMoreString() + { + return maLocalizedStrings.Count() >= 4 + ? rtl::OUString( maLocalizedStrings.GetString( 3 ) ) + : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "More" ) ); + } + + void updatePrintJob() + { + // TODO: refresh page count etc from mpController + + // page range may have changed depending on options + sal_Int32 nPages = mpController->getFilteredPageCount(); + #if OSL_DEBUG_LEVEL > 1 + if( nPages != mnLastPageCount ) + fprintf( stderr, "trouble: number of pages changed from %ld to %ld !\n", mnLastPageCount, nPages ); + #endif + mpState->bNeedRestart = (nPages != mnLastPageCount); + NSTabViewItem* pItem = [mpTabView selectedTabViewItem]; + if( pItem ) + mpState->nLastPage = [mpTabView indexOfTabViewItem: pItem]; + else + mpState->nLastPage = 0; + mnLastPageCount = nPages; + if( mpState->bNeedRestart ) + { + #if 0 + // Warning: bad hack ahead + // Apple does not give us a chance of changing the page count, + // and they don't let us cancel the dialog either + // hack: send a cancel message to the window displaying our views. + // this is ugly. + for( std::vector< NSObject* >::iterator it = maViews.begin(); it != maViews.end(); ++it ) + { + if( [*it isKindOfClass: [NSView class]] ) + { + NSView* pView = (NSView*)*it; + NSWindow* pWindow = [pView window]; + if( pWindow ) + { + [pWindow cancelOperation: nil]; + break; + } + } + } + #else + NSWindow* pWindow = [NSApp modalWindow]; + if( pWindow ) + [pWindow cancelOperation: nil]; + #endif + [[mpOp printInfo] setJobDisposition: NSPrintCancelJob]; + } + else + { + sal_Int32 nPage = [mpStepper intValue]; + updatePreviewImage( nPage-1 ); + } + } + + int addNameTag( const rtl::OUString& i_rPropertyName ) + { + int nNewTag = mnNextTag++; + maTagToPropertyName[ nNewTag ] = i_rPropertyName; + return nNewTag; + } + + int addNameAndValueTag( const rtl::OUString& i_rPropertyName, sal_Int32 i_nValue ) + { + int nNewTag = mnNextTag++; + maTagToPropertyName[ nNewTag ] = i_rPropertyName; + maTagToValueInt[ nNewTag ] = i_nValue; + return nNewTag; + } + + void addObservedControl( NSObject* i_pView ) + { + maViews.push_back( i_pView ); + } + + void addViewPair( NSView* i_pLeft, NSView* i_pRight ) + { + maViewPairMap[ i_pLeft ] = i_pRight; + maViewPairMap[ i_pRight ] = i_pLeft; + } + + NSView* getPair( NSView* i_pLeft ) const + { + NSView* pRight = nil; + std::map< NSView*, NSView* >::const_iterator it = maViewPairMap.find( i_pLeft ); + if( it != maViewPairMap.end() ) + pRight = it->second; + return pRight; + } + + void changePropertyWithIntValue( int i_nTag ) + { + std::map< int, rtl::OUString >::const_iterator name_it = maTagToPropertyName.find( i_nTag ); + std::map< int, sal_Int32 >::const_iterator value_it = maTagToValueInt.find( i_nTag ); + if( name_it != maTagToPropertyName.end() && value_it != maTagToValueInt.end() ) + { + PropertyValue* pVal = mpController->getValue( name_it->second ); + if( pVal ) + { + pVal->Value <<= value_it->second; + updatePrintJob(); + } + } + } + + void changePropertyWithIntValue( int i_nTag, sal_Int64 i_nValue ) + { + std::map< int, rtl::OUString >::const_iterator name_it = maTagToPropertyName.find( i_nTag ); + if( name_it != maTagToPropertyName.end() ) + { + PropertyValue* pVal = mpController->getValue( name_it->second ); + if( pVal ) + { + pVal->Value <<= i_nValue; + updatePrintJob(); + } + } + } + + void changePropertyWithBoolValue( int i_nTag, sal_Bool i_bValue ) + { + std::map< int, rtl::OUString >::const_iterator name_it = maTagToPropertyName.find( i_nTag ); + if( name_it != maTagToPropertyName.end() ) + { + PropertyValue* pVal = mpController->getValue( name_it->second ); + if( pVal ) + { + pVal->Value <<= i_bValue; + updatePrintJob(); + } + } + } + + void changePropertyWithStringValue( int i_nTag, const rtl::OUString& i_rValue ) + { + std::map< int, rtl::OUString >::const_iterator name_it = maTagToPropertyName.find( i_nTag ); + if( name_it != maTagToPropertyName.end() ) + { + PropertyValue* pVal = mpController->getValue( name_it->second ); + if( pVal ) + { + pVal->Value <<= i_rValue; + updatePrintJob(); + } + } + } + + void updateEnableState() + { + for( std::vector< NSObject* >::iterator it = maViews.begin(); it != maViews.end(); ++it ) + { + NSObject* pObj = *it; + NSControl* pCtrl = nil; + NSCell* pCell = nil; + if( [pObj isKindOfClass: [NSControl class]] ) + pCtrl = (NSControl*)pObj; + else if( [pObj isKindOfClass: [NSCell class]] ) + pCell = (NSCell*)pObj; + + int nTag = pCtrl ? [pCtrl tag] : + pCell ? [pCell tag] : + -1; + + std::map< int, rtl::OUString >::const_iterator name_it = maTagToPropertyName.find( nTag ); + if( name_it != maTagToPropertyName.end() ) + { + MacOSBOOL bEnabled = mpController->isUIOptionEnabled( name_it->second ) ? YES : NO; + if( pCtrl ) + { + [pCtrl setEnabled: bEnabled]; + NSView* pOther = getPair( pCtrl ); + if( pOther && [pOther isKindOfClass: [NSControl class]] ) + [(NSControl*)pOther setEnabled: bEnabled]; + } + else if( pCell ) + [pCell setEnabled: bEnabled]; + + } + } + } + + void updatePreviewImage( sal_Int32 i_nPage ) + { + sal_Int32 nPages = mpController->getFilteredPageCount(); + NSRect aViewFrame = [mpPreview frame]; + Size aPixelSize( static_cast<long>(aViewFrame.size.width), + static_cast<long>(aViewFrame.size.height) ); + if( i_nPage >= 0 && nPages > i_nPage ) + { + GDIMetaFile aMtf; + PrinterController::PageSize aPageSize( mpController->getFilteredPageFile( i_nPage, aMtf, false ) ); + VirtualDevice aDev; + // see salprn.cxx, currently we pretend to be a 720dpi device on printers + aDev.SetReferenceDevice( 720, 720 ); + aDev.EnableOutput( TRUE ); + Size aLogicSize( aDev.PixelToLogic( aPixelSize, MapMode( MAP_100TH_MM ) ) ); + double fScaleX = double(aLogicSize.Width())/double(aPageSize.aSize.Width()); + double fScaleY = double(aLogicSize.Height())/double(aPageSize.aSize.Height()); + double fScale = (fScaleX < fScaleY) ? fScaleX : fScaleY; + aMtf.WindStart(); + aMtf.Scale( fScale, fScale ); + aMtf.WindStart(); + aLogicSize.Width() = long(double(aPageSize.aSize.Width()) * fScale); + aLogicSize.Height() = long(double(aPageSize.aSize.Height()) * fScale); + aPixelSize = aDev.LogicToPixel( aLogicSize, MapMode( MAP_100TH_MM ) ); + aDev.SetOutputSizePixel( aPixelSize ); + aMtf.WindStart(); + aDev.SetMapMode( MapMode( MAP_100TH_MM ) ); + aMtf.Play( &aDev, Point( 0, 0 ), aLogicSize ); + aDev.EnableMapMode( FALSE ); + Image aImage( aDev.GetBitmap( Point( 0, 0 ), aPixelSize ) ); + NSImage* pImage = CreateNSImage( aImage ); + [mpPreview setImage: [pImage autorelease]]; + } + else + [mpPreview setImage: nil]; + } + + void setupPreview( ControlTarget* i_pCtrlTarget ) + { + if( maLocalizedStrings.Count() < 3 ) + return; + + // get the preview control + NSRect aPreviewFrame = [mpAccessoryView frame]; + aPreviewFrame.origin.x = 0; + aPreviewFrame.origin.y = 5; + aPreviewFrame.size.width = 190; + aPreviewFrame.size.height -= 7; + + // create a box to put the preview controls in + mpPreviewBox = [[NSBox alloc] initWithFrame: aPreviewFrame]; + [mpPreviewBox setTitle: [CreateNSString( maLocalizedStrings.GetString( 0 ) ) autorelease]]; + [mpAccessoryView addSubview: [mpPreviewBox autorelease]]; + + // now create the image view of the preview + NSSize aMargins = [mpPreviewBox contentViewMargins]; + aPreviewFrame.origin.x = 0; + aPreviewFrame.origin.y = 34; + aPreviewFrame.size.height -= 61; + mpPreview = [[NSImageView alloc] initWithFrame: aPreviewFrame]; + [mpPreview setImageScaling: NSScaleNone]; + [mpPreview setImageAlignment: NSImageAlignCenter]; + [mpPreview setImageFrameStyle: NSImageFrameNone]; + [mpPreviewBox addSubview: [mpPreview autorelease]]; + + // add a label + sal_Int32 nPages = mpController->getFilteredPageCount(); + rtl::OUStringBuffer aBuf( 16 ); + aBuf.appendAscii( "/ " ); + aBuf.append( rtl::OUString::valueOf( nPages ) ); + + NSString* pText = CreateNSString( aBuf.makeStringAndClear() ); + NSRect aTextRect = { { 100, 5 }, { 100, 22 } }; + mpPagesLabel = [[NSTextView alloc] initWithFrame: aTextRect]; + [mpPagesLabel setFont: [NSFont controlContentFontOfSize: 0]]; + [mpPagesLabel setEditable: NO]; + [mpPagesLabel setSelectable: NO]; + [mpPagesLabel setDrawsBackground: NO]; + [mpPagesLabel setString: [pText autorelease]]; + [mpPagesLabel setToolTip: [CreateNSString( maLocalizedStrings.GetString( 2 ) ) autorelease]]; + [mpPreviewBox addSubview: [mpPagesLabel autorelease]]; + + NSRect aFieldRect = { { 45, 5 }, { 35, 25 } }; + mpPageEdit = [[NSTextField alloc] initWithFrame: aFieldRect]; + [mpPageEdit setEditable: YES]; + [mpPageEdit setSelectable: YES]; + [mpPageEdit setDrawsBackground: YES]; + [mpPageEdit setToolTip: [CreateNSString( maLocalizedStrings.GetString( 1 ) ) autorelease]]; + [mpPreviewBox addSubview: [mpPageEdit autorelease]]; + + // add a stepper control + NSRect aStepFrame = { { 85, 5 }, { 15, 25 } }; + mpStepper = [[NSStepper alloc] initWithFrame: aStepFrame]; + [mpStepper setIncrement: 1]; + [mpStepper setValueWraps: NO]; + [mpPreviewBox addSubview: [mpStepper autorelease]]; + + // constrain the text field to decimal numbers + NSNumberFormatter* pFormatter = [[NSNumberFormatter alloc] init]; + [pFormatter setFormatterBehavior: NSNumberFormatterBehavior10_4]; + [pFormatter setMinimum: [[NSNumber numberWithInt: 1] autorelease]]; + [pFormatter setMaximum: [[NSNumber numberWithInt: nPages] autorelease]]; + [pFormatter setNumberStyle: NSNumberFormatterDecimalStyle]; + [pFormatter setAllowsFloats: NO]; + [pFormatter setMaximumFractionDigits: 0]; + [mpPageEdit setFormatter: pFormatter]; + [mpStepper setMinValue: 1]; + [mpStepper setMaxValue: nPages]; + + [mpPageEdit setIntValue: 1]; + [mpStepper setIntValue: 1]; + + // connect target and action + [mpStepper setTarget: i_pCtrlTarget]; + [mpStepper setAction: @selector(triggeredPreview:)]; + [mpPageEdit setTarget: i_pCtrlTarget]; + [mpPageEdit setAction: @selector(triggeredPreview:)]; + + // set first preview image + updatePreviewImage( 0 ); + } + + void changePreview( NSObject* i_pSender ) + { + if( [i_pSender isMemberOfClass: [NSTextField class]] ) + { + NSTextField* pField = (NSTextField*)i_pSender; + if( pField == mpPageEdit ) // sanity check + { + sal_Int32 nPage = [pField intValue]; + [mpStepper setIntValue: nPage]; + updatePreviewImage( nPage-1 ); + } + } + else if( [i_pSender isMemberOfClass: [NSStepper class]] ) + { + NSStepper* pStepper = (NSStepper*)i_pSender; + if( pStepper == mpStepper ) // sanity check + { + sal_Int32 nPage = [pStepper intValue]; + [mpPageEdit setIntValue: nPage]; + updatePreviewImage( nPage-1 ); + } + } + } +}; + +static void filterAccelerator( rtl::OUString& io_rText ) +{ + rtl::OUStringBuffer aBuf( io_rText.getLength() ); + for( sal_Int32 nIndex = 0; nIndex != -1; ) + aBuf.append( io_rText.getToken( 0, '~', nIndex ) ); + io_rText = aBuf.makeStringAndClear(); +} + +@implementation ControlTarget +-(id)initWithControllerMap: (ControllerProperties*)pController +{ + if( (self = [super init]) ) + { + mpController = pController; + } + return self; +} +-(void)triggered:(id)pSender; +{ + if( [pSender isMemberOfClass: [NSPopUpButton class]] ) + { + NSPopUpButton* pBtn = (NSPopUpButton*)pSender; + NSMenuItem* pSelected = [pBtn selectedItem]; + if( pSelected ) + { + int nTag = [pSelected tag]; + mpController->changePropertyWithIntValue( nTag ); + } + } + else if( [pSender isMemberOfClass: [NSButton class]] ) + { + NSButton* pBtn = (NSButton*)pSender; + int nTag = [pBtn tag]; + mpController->changePropertyWithBoolValue( nTag, [pBtn state] == NSOnState ); + } + else if( [pSender isMemberOfClass: [NSMatrix class]] ) + { + NSObject* pObj = [(NSMatrix*)pSender selectedCell]; + if( [pObj isMemberOfClass: [NSButtonCell class]] ) + { + NSButtonCell* pCell = (NSButtonCell*)pObj; + int nTag = [pCell tag]; + mpController->changePropertyWithIntValue( nTag ); + } + } + else if( [pSender isMemberOfClass: [NSTextField class]] ) + { + NSTextField* pField = (NSTextField*)pSender; + int nTag = [pField tag]; + rtl::OUString aValue = GetOUString( [pSender stringValue] ); + mpController->changePropertyWithStringValue( nTag, aValue ); + } + else + { + DBG_ERROR( "unsupported class" ); + } + mpController->updateEnableState(); +} +-(void)triggeredNumeric:(id)pSender; +{ + if( [pSender isMemberOfClass: [NSTextField class]] ) + { + NSTextField* pField = (NSTextField*)pSender; + int nTag = [pField tag]; + sal_Int64 nValue = [pField intValue]; + + NSView* pOther = mpController->getPair( pField ); + if( pOther ) + [(NSControl*)pOther setIntValue: nValue]; + + mpController->changePropertyWithIntValue( nTag, nValue ); + } + else if( [pSender isMemberOfClass: [NSStepper class]] ) + { + NSStepper* pStep = (NSStepper*)pSender; + int nTag = [pStep tag]; + sal_Int64 nValue = [pStep intValue]; + + NSView* pOther = mpController->getPair( pStep ); + if( pOther ) + [(NSControl*)pOther setIntValue: nValue]; + + mpController->changePropertyWithIntValue( nTag, nValue ); + } + else + { + DBG_ERROR( "unsupported class" ); + } + mpController->updateEnableState(); +} +-(void)triggeredPreview:(id)pSender +{ + mpController->changePreview( pSender ); +} +-(void)dealloc +{ + delete mpController; + [super dealloc]; +} +@end + +struct ColumnItem +{ + NSControl* pControl; + long nOffset; + NSControl* pSubControl; + + ColumnItem( NSControl* i_pControl = nil, long i_nOffset = 0, NSControl* i_pSub = nil ) + : pControl( i_pControl ) + , nOffset( i_nOffset ) + , pSubControl( i_pSub ) + {} + + long getWidth() const + { + long nWidth = 0; + if( pControl ) + { + NSRect aCtrlRect = [pControl frame]; + nWidth = aCtrlRect.size.width; + nWidth += nOffset; + if( pSubControl ) + { + NSRect aSubRect = [pSubControl frame]; + nWidth += aSubRect.size.width; + nWidth += aSubRect.origin.x - (aCtrlRect.origin.x + aCtrlRect.size.width); + } + } + return nWidth; + } +}; + +static void adjustViewAndChildren( NSView* pView, NSSize& rMaxSize, + std::vector< ColumnItem >& rLeftColumn, + std::vector< ColumnItem >& rRightColumn + ) +{ + // balance columns + + // first get overall column widths + long nLeftWidth = 0; + long nRightWidth = 0; + for( size_t i = 0; i < rLeftColumn.size(); i++ ) + { + long nW = rLeftColumn[i].getWidth(); + if( nW > nLeftWidth ) + nLeftWidth = nW; + } + for( size_t i = 0; i < rRightColumn.size(); i++ ) + { + long nW = rRightColumn[i].getWidth(); + if( nW > nRightWidth ) + nRightWidth = nW; + } + + // right align left column + for( size_t i = 0; i < rLeftColumn.size(); i++ ) + { + if( rLeftColumn[i].pControl ) + { + NSRect aCtrlRect = [rLeftColumn[i].pControl frame]; + long nX = nLeftWidth - aCtrlRect.size.width; + if( rLeftColumn[i].pSubControl ) + { + NSRect aSubRect = [rLeftColumn[i].pSubControl frame]; + nX -= aSubRect.size.width + (aSubRect.origin.x - (aCtrlRect.origin.x + aCtrlRect.size.width)); + aSubRect.origin.x = nLeftWidth - aSubRect.size.width; + [rLeftColumn[i].pSubControl setFrame: aSubRect]; + } + aCtrlRect.origin.x = nX; + [rLeftColumn[i].pControl setFrame: aCtrlRect]; + } + } + + // left align right column + for( size_t i = 0; i < rRightColumn.size(); i++ ) + { + if( rRightColumn[i].pControl ) + { + NSRect aCtrlRect = [rRightColumn[i].pControl frame]; + long nX = nLeftWidth + 3; + if( rRightColumn[i].pSubControl ) + { + NSRect aSubRect = [rRightColumn[i].pSubControl frame]; + aSubRect.origin.x = nX + aSubRect.origin.x - aCtrlRect.origin.x; + [rRightColumn[i].pSubControl setFrame: aSubRect]; + } + aCtrlRect.origin.x = nX; + [rRightColumn[i].pControl setFrame: aCtrlRect]; + } + } + + NSArray* pSubViews = [pView subviews]; + unsigned int nViews = [pSubViews count]; + NSRect aUnion = { { 0, 0 }, { 0, 0 } }; + + // get the combined frame of all subviews + for( unsigned int n = 0; n < nViews; n++ ) + { + aUnion = NSUnionRect( aUnion, [[pSubViews objectAtIndex: n] frame] ); + } + + // move everything so it will fit + for( unsigned int n = 0; n < nViews; n++ ) + { + NSView* pCurSubView = [pSubViews objectAtIndex: n]; + NSRect aFrame = [pCurSubView frame]; + aFrame.origin.x -= aUnion.origin.x - 5; + aFrame.origin.y -= aUnion.origin.y - 5; + [pCurSubView setFrame: aFrame]; + } + + // resize the view itself + aUnion.size.height += 10; + aUnion.size.width += 20; + [pView setFrameSize: aUnion.size]; + + if( aUnion.size.width > rMaxSize.width ) + rMaxSize.width = aUnion.size.width; + if( aUnion.size.height > rMaxSize.height ) + rMaxSize.height = aUnion.size.height; +} + +static void adjustTabViews( NSTabView* pTabView, NSSize aTabSize ) +{ + // loop over all contained tab pages + NSArray* pTabbedViews = [pTabView tabViewItems]; + int nViews = [pTabbedViews count]; + for( int i = 0; i < nViews; i++ ) + { + NSTabViewItem* pItem = (NSTabViewItem*)[pTabbedViews objectAtIndex: i]; + NSView* pView = [pItem view]; + if( pView ) + { + NSRect aRect = [pView frame]; + double nDiff = aTabSize.height - aRect.size.height; + aRect.size = aTabSize; + [pView setFrame: aRect]; + + NSArray* pSubViews = [pView subviews]; + unsigned int nSubViews = [pSubViews count]; + + // move everything up + for( unsigned int n = 0; n < nSubViews; n++ ) + { + NSView* pCurSubView = [pSubViews objectAtIndex: n]; + NSRect aFrame = [pCurSubView frame]; + aFrame.origin.y += nDiff; + // give separators the correct width + // separators are currently the only NSBoxes we use + if( [pCurSubView isMemberOfClass: [NSBox class]] ) + { + aFrame.size.width = aTabSize.width - aFrame.origin.x - 10; + } + [pCurSubView setFrame: aFrame]; + } + } + } +} + +static NSControl* createLabel( const rtl::OUString& i_rText ) +{ + NSString* pText = CreateNSString( i_rText ); + NSRect aTextRect = { { 0, 0 }, {20, 15} }; + NSTextField* pTextView = [[NSTextField alloc] initWithFrame: aTextRect]; + [pTextView setFont: [NSFont controlContentFontOfSize: 0]]; + [pTextView setEditable: NO]; + [pTextView setSelectable: NO]; + [pTextView setDrawsBackground: NO]; + [pTextView setBordered: NO]; + [pTextView setStringValue: pText]; + [pTextView sizeToFit]; + [pText release]; + return pTextView; +} + +static sal_Int32 findBreak( const rtl::OUString& i_rText, sal_Int32 i_nPos ) +{ + sal_Int32 nRet = i_rText.getLength(); + Reference< i18n::XBreakIterator > xBI( vcl::unohelper::CreateBreakIterator() ); + if( xBI.is() ) + { + i18n::Boundary aBoundary = xBI->getWordBoundary( i_rText, i_nPos, + Application::GetSettings().GetLocale(), + i18n::WordType::ANYWORD_IGNOREWHITESPACES, + sal_True ); + nRet = aBoundary.endPos; + } + return nRet; +} + +static void linebreakCell( NSCell* pBtn, const rtl::OUString& i_rText ) +{ + NSString* pText = CreateNSString( i_rText ); + [pBtn setTitle: pText]; + [pText release]; + NSSize aSize = [pBtn cellSize]; + if( aSize.width > 280 ) + { + // need two lines + sal_Int32 nLen = i_rText.getLength(); + sal_Int32 nIndex = nLen / 2; + nIndex = findBreak( i_rText, nIndex ); + if( nIndex < nLen ) + { + rtl::OUStringBuffer aBuf( i_rText ); + aBuf.setCharAt( nIndex, '\n' ); + pText = CreateNSString( aBuf.makeStringAndClear() ); + [pBtn setTitle: pText]; + [pText release]; + } + } +} + + +@implementation AquaPrintAccessoryView ++(NSObject*)setupPrinterPanel: (NSPrintOperation*)pOp withController: (vcl::PrinterController*)pController withState: (PrintAccessoryViewState*)pState; +{ + const Sequence< PropertyValue >& rOptions( pController->getUIOptions() ); + if( rOptions.getLength() == 0 ) + return nil; + + NSView* pCurParent = 0; + long nCurY = 0; + long nCurX = 0; + NSRect aViewFrame = { { 0, 0 }, {600, 400 } }; + NSRect aTabViewFrame = { { 190, 0 }, {410, 400 } }; + NSSize aMaxTabSize = { 0, 0 }; + NSView* pAccessoryView = [[NSView alloc] initWithFrame: aViewFrame]; + NSTabView* pTabView = [[NSTabView alloc] initWithFrame: aTabViewFrame]; + [pAccessoryView addSubview: [pTabView autorelease]]; + + sal_Bool bIgnoreSubgroup = sal_False; + + ControllerProperties* pControllerProperties = new ControllerProperties( pController, pOp, pAccessoryView, pTabView, pState ); + ControlTarget* pCtrlTarget = [[ControlTarget alloc] initWithControllerMap: pControllerProperties]; + + std::vector< ColumnItem > aLeftColumn, aRightColumn; + + for( int i = 0; i < rOptions.getLength(); i++ ) + { + Sequence< beans::PropertyValue > aOptProp; + rOptions[i].Value >>= aOptProp; + + // extract ui element + bool bEnabled = true; + rtl::OUString aCtrlType; + rtl::OUString aText; + rtl::OUString aPropertyName; + Sequence< rtl::OUString > aChoices; + sal_Int64 nMinValue = 0, nMaxValue = 0; + long nAttachOffset = 0; + sal_Bool bIgnore = sal_False; + + for( int n = 0; n < aOptProp.getLength(); n++ ) + { + const beans::PropertyValue& rEntry( aOptProp[ n ] ); + if( rEntry.Name.equalsAscii( "Text" ) ) + { + rEntry.Value >>= aText; + filterAccelerator( aText ); + } + else if( rEntry.Name.equalsAscii( "ControlType" ) ) + { + rEntry.Value >>= aCtrlType; + } + else if( rEntry.Name.equalsAscii( "Choices" ) ) + { + rEntry.Value >>= aChoices; + } + else if( rEntry.Name.equalsAscii( "Property" ) ) + { + PropertyValue aVal; + rEntry.Value >>= aVal; + aPropertyName = aVal.Name; + } + else if( rEntry.Name.equalsAscii( "Enabled" ) ) + { + sal_Bool bValue = sal_True; + rEntry.Value >>= bValue; + bEnabled = bValue; + } + else if( rEntry.Name.equalsAscii( "MinValue" ) ) + { + rEntry.Value >>= nMinValue; + } + else if( rEntry.Name.equalsAscii( "MaxValue" ) ) + { + rEntry.Value >>= nMaxValue; + } + else if( rEntry.Name.equalsAscii( "AttachToDependency" ) ) + { + nAttachOffset = 20; + } + else if( rEntry.Name.equalsAscii( "InternalUIOnly" ) ) + { + rEntry.Value >>= bIgnore; + } + } + + if( aCtrlType.equalsAscii( "Group" ) || + aCtrlType.equalsAscii( "Subgroup" ) || + aCtrlType.equalsAscii( "Radio" ) || + aCtrlType.equalsAscii( "List" ) || + aCtrlType.equalsAscii( "Edit" ) || + aCtrlType.equalsAscii( "Range" ) || + aCtrlType.equalsAscii( "Bool" ) ) + { + // since our build target is MacOSX 10.4 we can have only one accessory view + // so we have a single accessory view that is tabbed for grouping + if( aCtrlType.equalsAscii( "Group" ) + || ! pCurParent + || ( aCtrlType.equalsAscii( "Subgroup" ) && nCurY < -250 && ! bIgnore ) + ) + { + rtl::OUString aGroupTitle( aText ); + if( aCtrlType.equalsAscii( "Subgroup" ) ) + aGroupTitle = pControllerProperties->getMoreString(); + // set size of current parent + if( pCurParent ) + adjustViewAndChildren( pCurParent, aMaxTabSize, aLeftColumn, aRightColumn ); + + // new tab item + if( ! aText.getLength() ) + aText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OOo" ) ); + NSString* pLabel = CreateNSString( aGroupTitle ); + NSTabViewItem* pItem = [[NSTabViewItem alloc] initWithIdentifier: pLabel ]; + [pItem setLabel: pLabel]; + [pTabView addTabViewItem: pItem]; + pCurParent = [[NSView alloc] initWithFrame: aTabViewFrame]; + [pItem setView: pCurParent]; + [pLabel release]; + + // reset indent + nCurX = 20; + // reset Y + nCurY = 0; + // clear columns + aLeftColumn.clear(); + aRightColumn.clear(); + } + + if( aCtrlType.equalsAscii( "Subgroup" ) && pCurParent ) + { + bIgnoreSubgroup = bIgnore; + if( bIgnore ) + continue; + + NSControl* pTextView = createLabel( aText ); + [pCurParent addSubview: [pTextView autorelease]]; + NSRect aTextRect = [pTextView frame]; + // move to nCurY + aTextRect.origin.y = nCurY - aTextRect.size.height; + [pTextView setFrame: aTextRect]; + + NSRect aSepRect = { { aTextRect.size.width + 1, aTextRect.origin.y }, { 100, 6 } }; + NSBox* pBox = [[NSBox alloc] initWithFrame: aSepRect]; + [pBox setBoxType: NSBoxSeparator]; + [pCurParent addSubview: [pBox autorelease]]; + + // update nCurY + nCurY = aTextRect.origin.y - 5; + } + else if( bIgnoreSubgroup || bIgnore ) + continue; + else if( aCtrlType.equalsAscii( "Bool" ) && pCurParent ) + { + NSRect aCheckRect = { { nCurX + nAttachOffset, 0 }, { 0, 15 } }; + NSButton* pBtn = [[NSButton alloc] initWithFrame: aCheckRect]; + [pBtn setButtonType: NSSwitchButton]; + sal_Bool bVal = sal_False; + PropertyValue* pVal = pController->getValue( aPropertyName ); + if( pVal ) + pVal->Value >>= bVal; + [pBtn setState: bVal ? NSOnState : NSOffState]; + linebreakCell( [pBtn cell], aText ); + [pBtn sizeToFit]; + [pCurParent addSubview: [pBtn autorelease]]; + + aRightColumn.push_back( ColumnItem( pBtn ) ); + + // connect target + [pBtn setTarget: pCtrlTarget]; + [pBtn setAction: @selector(triggered:)]; + int nTag = pControllerProperties->addNameTag( aPropertyName ); + pControllerProperties->addObservedControl( pBtn ); + [pBtn setTag: nTag]; + + aCheckRect = [pBtn frame]; + + // move to nCurY + aCheckRect.origin.y = nCurY - aCheckRect.size.height; + [pBtn setFrame: aCheckRect]; + + // update nCurY + nCurY = aCheckRect.origin.y - 5; + } + else if( aCtrlType.equalsAscii( "Radio" ) && pCurParent ) + { + sal_Int32 nOff = 0; + if( aText.getLength() ) + { + // add a label + NSControl* pTextView = createLabel( aText ); + NSRect aTextRect = [pTextView frame]; + aTextRect.origin.x = nCurX + nAttachOffset; + [pCurParent addSubview: [pTextView autorelease]]; + + aLeftColumn.push_back( ColumnItem( pTextView ) ); + + // move to nCurY + aTextRect.origin.y = nCurY - aTextRect.size.height; + [pTextView setFrame: aTextRect]; + + // update nCurY + nCurY = aTextRect.origin.y - 5; + + // indent the radio group relative to the text + // nOff = 20; + } + + // setup radio matrix + NSButtonCell* pProto = [[NSButtonCell alloc] init]; + + NSRect aRadioRect = { { nCurX + nOff, 0 }, { 280 - nCurX, 5*aChoices.getLength() } }; + [pProto setTitle: @"RadioButtonGroup"]; + [pProto setButtonType: NSRadioButton]; + NSMatrix* pMatrix = [[NSMatrix alloc] initWithFrame: aRadioRect + mode: NSRadioModeMatrix + prototype: (NSCell*)pProto + numberOfRows: aChoices.getLength() + numberOfColumns: 1]; + // get currently selected value + sal_Int32 nSelectVal = 0; + PropertyValue* pVal = pController->getValue( aPropertyName ); + if( pVal && pVal->Value.hasValue() ) + pVal->Value >>= nSelectVal; + // set individual titles + NSArray* pCells = [pMatrix cells]; + for( sal_Int32 m = 0; m < aChoices.getLength(); m++ ) + { + NSCell* pCell = [pCells objectAtIndex: m]; + filterAccelerator( aChoices[m] ); + linebreakCell( pCell, aChoices[m] ); + //NSString* pTitle = CreateNSString( aChoices[m] ); + //[pCell setTitle: pTitle]; + // connect target and action + [pCell setTarget: pCtrlTarget]; + [pCell setAction: @selector(triggered:)]; + int nTag = pControllerProperties->addNameAndValueTag( aPropertyName, m ); + pControllerProperties->addObservedControl( pCell ); + [pCell setTag: nTag]; + //[pTitle release]; + // set current selection + if( nSelectVal == m ) + [pMatrix selectCellAtRow: m column: 0]; + } + [pMatrix sizeToFit]; + aRadioRect = [pMatrix frame]; + + // move it down, so it comes to the correct position + aRadioRect.origin.y = nCurY - aRadioRect.size.height; + [pMatrix setFrame: aRadioRect]; + [pCurParent addSubview: [pMatrix autorelease]]; + + aRightColumn.push_back( ColumnItem( pMatrix ) ); + + // update nCurY + nCurY = aRadioRect.origin.y - 5; + + [pProto release]; + } + else if( aCtrlType.equalsAscii( "List" ) && pCurParent ) + { + // don't indent attached lists, looks bad in the existing cases + NSControl* pTextView = createLabel( aText ); + [pCurParent addSubview: [pTextView autorelease]]; + aLeftColumn.push_back( ColumnItem( pTextView ) ); + NSRect aTextRect = [pTextView frame]; + aTextRect.origin.x = nCurX /* + nAttachOffset*/; + + // don't indent attached lists, looks bad in the existing cases + NSRect aBtnRect = { { nCurX /*+ nAttachOffset*/ + aTextRect.size.width, 0 }, { 0, 15 } }; + NSPopUpButton* pBtn = [[NSPopUpButton alloc] initWithFrame: aBtnRect pullsDown: NO]; + + // iterate options + for( sal_Int32 m = 0; m < aChoices.getLength(); m++ ) + { + NSString* pItemText = CreateNSString( aChoices[m] ); + [pBtn addItemWithTitle: pItemText]; + NSMenuItem* pItem = [pBtn itemWithTitle: pItemText]; + int nTag = pControllerProperties->addNameAndValueTag( aPropertyName, m ); + [pItem setTag: nTag]; + [pItemText release]; + } + + PropertyValue* pVal = pController->getValue( aPropertyName ); + sal_Int32 aSelectVal = 0; + if( pVal && pVal->Value.hasValue() ) + pVal->Value >>= aSelectVal; + [pBtn selectItemAtIndex: aSelectVal]; + + // add the button to observed controls for enabled state changes + // also add a tag just for this purpose + pControllerProperties->addObservedControl( pBtn ); + [pBtn setTag: pControllerProperties->addNameTag( aPropertyName )]; + + [pBtn sizeToFit]; + [pCurParent addSubview: [pBtn autorelease]]; + + aRightColumn.push_back( ColumnItem( pBtn ) ); + + // connect target and action + [pBtn setTarget: pCtrlTarget]; + [pBtn setAction: @selector(triggered:)]; + + // move to nCurY + aBtnRect = [pBtn frame]; + aBtnRect.origin.y = nCurY - aBtnRect.size.height; + [pBtn setFrame: aBtnRect]; + + // align label + aTextRect.origin.y = aBtnRect.origin.y + (aBtnRect.size.height - aTextRect.size.height)/2; + [pTextView setFrame: aTextRect]; + + // update nCurY + nCurY = aBtnRect.origin.y - 5; + } + else if( (aCtrlType.equalsAscii( "Edit" ) || aCtrlType.equalsAscii( "Range" )) && pCurParent ) + { + sal_Int32 nOff = 0; + if( aText.getLength() ) + { + // add a label + NSControl* pTextView = createLabel( aText ); + [pCurParent addSubview: [pTextView autorelease]]; + + aLeftColumn.push_back( ColumnItem( pTextView ) ); + + // move to nCurY + NSRect aTextRect = [pTextView frame]; + aTextRect.origin.x = nCurX + nAttachOffset; + aTextRect.origin.y = nCurY - aTextRect.size.height; + [pTextView setFrame: aTextRect]; + + // update nCurY + nCurY = aTextRect.origin.y - 5; + + // and set the offset for the real edit field + nOff = aTextRect.size.width + 5; + } + + NSRect aFieldRect = { { nCurX + nOff + nAttachOffset, 0 }, { 100, 25 } }; + NSTextField* pFieldView = [[NSTextField alloc] initWithFrame: aFieldRect]; + [pFieldView setEditable: YES]; + [pFieldView setSelectable: YES]; + [pFieldView setDrawsBackground: YES]; + [pFieldView sizeToFit]; // FIXME: this does nothing + [pCurParent addSubview: [pFieldView autorelease]]; + + aRightColumn.push_back( ColumnItem( pFieldView ) ); + + // add the field to observed controls for enabled state changes + // also add a tag just for this purpose + pControllerProperties->addObservedControl( pFieldView ); + int nTag = pControllerProperties->addNameTag( aPropertyName ); + [pFieldView setTag: nTag]; + // pControllerProperties->addNamedView( pFieldView, aPropertyName ); + + // move to nCurY + aFieldRect.origin.y = nCurY - aFieldRect.size.height; + [pFieldView setFrame: aFieldRect]; + + // current value + PropertyValue* pVal = pController->getValue( aPropertyName ); + if( aCtrlType.equalsAscii( "Range" ) ) + { + // add a stepper control + NSRect aStepFrame = { { aFieldRect.origin.x + aFieldRect.size.width + 5, + aFieldRect.origin.y }, + { 15, aFieldRect.size.height } }; + NSStepper* pStep = [[NSStepper alloc] initWithFrame: aStepFrame]; + [pStep setIncrement: 1]; + [pStep setValueWraps: NO]; + [pStep setTag: nTag]; + [pCurParent addSubview: [pStep autorelease]]; + + aRightColumn.back().pSubControl = pStep; + + pControllerProperties->addObservedControl( pStep ); + [pStep setTarget: pCtrlTarget]; + [pStep setAction: @selector(triggered:)]; + + // constrain the text field to decimal numbers + NSNumberFormatter* pFormatter = [[NSNumberFormatter alloc] init]; + [pFormatter setFormatterBehavior: NSNumberFormatterBehavior10_4]; + [pFormatter setNumberStyle: NSNumberFormatterDecimalStyle]; + [pFormatter setAllowsFloats: NO]; + [pFormatter setMaximumFractionDigits: 0]; + if( nMinValue != nMaxValue ) + { + [pFormatter setMinimum: [[NSNumber numberWithInt: nMinValue] autorelease]]; + [pStep setMinValue: nMinValue]; + [pFormatter setMaximum: [[NSNumber numberWithInt: nMaxValue] autorelease]]; + [pStep setMaxValue: nMaxValue]; + } + [pFieldView setFormatter: pFormatter]; + + sal_Int64 nSelectVal = 0; + if( pVal && pVal->Value.hasValue() ) + pVal->Value >>= nSelectVal; + + [pFieldView setIntValue: nSelectVal]; + [pStep setIntValue: nSelectVal]; + + pControllerProperties->addViewPair( pFieldView, pStep ); + // connect target and action + [pFieldView setTarget: pCtrlTarget]; + [pFieldView setAction: @selector(triggeredNumeric:)]; + [pStep setTarget: pCtrlTarget]; + [pStep setAction: @selector(triggeredNumeric:)]; + } + else + { + // connect target and action + [pFieldView setTarget: pCtrlTarget]; + [pFieldView setAction: @selector(triggered:)]; + + if( pVal && pVal->Value.hasValue() ) + { + rtl::OUString aValue; + pVal->Value >>= aValue; + if( aValue.getLength() ) + { + NSString* pText = CreateNSString( aValue ); + [pFieldView setStringValue: pText]; + [pText release]; + } + } + } + + // update nCurY + nCurY = aFieldRect.origin.y - 5; + + } + } + else + { + DBG_ERROR( "Unsupported UI option" ); + } + } + + pControllerProperties->updateEnableState(); + adjustViewAndChildren( pCurParent, aMaxTabSize, aLeftColumn, aRightColumn ); + + // leave some space for the preview + if( aMaxTabSize.height < 200 ) + aMaxTabSize.height = 200; + + // now reposition everything again so it is upper bound + adjustTabViews( pTabView, aMaxTabSize ); + + // find the minimum needed tab size + NSSize aTabCtrlSize = [pTabView minimumSize]; + aTabCtrlSize.height += aMaxTabSize.height + 10; + if( aTabCtrlSize.width < aMaxTabSize.width + 10 ) + aTabCtrlSize.width = aMaxTabSize.width + 10; + [pTabView setFrameSize: aTabCtrlSize]; + aViewFrame.size.width = aTabCtrlSize.width + aTabViewFrame.origin.x; + aViewFrame.size.height = aTabCtrlSize.height + aTabViewFrame.origin.y; + [pAccessoryView setFrameSize: aViewFrame.size]; + + pControllerProperties->setupPreview( pCtrlTarget ); + + // set the accessory view + [pOp setAccessoryView: [pAccessoryView autorelease]]; + + // set the current selecte tab item + if( pState->nLastPage >= 0 && pState->nLastPage < [pTabView numberOfTabViewItems] ) + [pTabView selectTabViewItemAtIndex: pState->nLastPage]; + + return pCtrlTarget; +} + +@end diff --git a/vcl/aqua/source/gdi/aquaprintview.mm b/vcl/aqua/source/gdi/aquaprintview.mm index ba139da5f5a4..870b7cbab6f0 100755 --- a/vcl/aqua/source/gdi/aquaprintview.mm +++ b/vcl/aqua/source/gdi/aquaprintview.mm @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: aquaprintview.mm,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.56.1 $ * * This file is part of OpenOffice.org. * @@ -33,15 +33,15 @@ #include "aquaprintview.h" #include "salprn.h" -#include "vcl/impprn.hxx" +#include "vcl/print.hxx" @implementation AquaPrintView --(id)initWithQPrinter: (ImplQPrinter*)pPrinter withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter +-(id)initWithController: (vcl::PrinterController*)pController withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter { NSRect aRect = { { 0, 0 }, [pInfoPrinter->getPrintInfo() paperSize] }; if( (self = [super initWithFrame: aRect]) != nil ) { - mpQPrinter = pPrinter; + mpController = pController; mpInfoPrinter = pInfoPrinter; } return self; @@ -79,6 +79,7 @@ int nPage = (int)(aPaperSize.width * rect.origin.y + rect.origin.x); // page count is 1 based - mpQPrinter->PrintPage( nPage-1 + mpInfoPrinter->getCurPageRangeStart() ); + if( nPage - 1 < (mpInfoPrinter->getCurPageRangeStart() + mpInfoPrinter->getCurPageRangeCount() ) ) + mpController->printFilteredPage( nPage-1 ); } @end diff --git a/vcl/aqua/source/gdi/makefile.mk b/vcl/aqua/source/gdi/makefile.mk index deb6832a5525..90b5e55b82db 100644 --- a/vcl/aqua/source/gdi/makefile.mk +++ b/vcl/aqua/source/gdi/makefile.mk @@ -62,6 +62,7 @@ SLOFILES= $(SLO)$/salmathutils.obj \ $(SLO)$/salvd.obj \ $(SLO)$/salprn.obj \ $(SLO)$/aquaprintview.obj \ + $(SLO)$/aquaprintaccessoryview.obj \ $(SLO)$/salbmp.obj .IF "$(ENABLE_CAIRO)" == "TRUE" diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx index 7ecef01cf0d5..1387a46c6345 100755 --- a/vcl/aqua/source/gdi/salatslayout.cxx +++ b/vcl/aqua/source/gdi/salatslayout.cxx @@ -70,12 +70,13 @@ private: // to prevent ATS overflowing the Fixed16.16 values // ATS font requests get size limited by downscaling huge fonts // in these cases the font scale becomes something bigger than 1.0 - float mfFontScale; + float mfFontScale; private: bool InitGIA( ImplLayoutArgs* pArgs = NULL ) const; bool GetIdealX() const; bool GetDeltaY() const; + void InvalidateMeasurements(); int Fixed2Vcl( Fixed ) const; // convert ATSU-Fixed units to VCL units int AtsuPix2Vcl( int ) const; // convert ATSU-Pixel units to VCL units @@ -302,17 +303,15 @@ void ATSLayout::AdjustLayout( ImplLayoutArgs& rArgs ) nPixelWidth = rArgs.mpDXArray[ mnCharCount - 1 ]; // workaround for ATSUI not using trailing spaces for justification - mnTrailingSpaceWidth = 0; int i = mnCharCount; - while( (--i > 0) && IsSpacingGlyph( rArgs.mpStr[mnMinCharPos+i]|GF_ISCHAR ) ) - mnTrailingSpaceWidth += rArgs.mpDXArray[i] - rArgs.mpDXArray[i-1]; - if( i <= 0 ) + while( (--i >= 0) && IsSpacingGlyph( rArgs.mpStr[mnMinCharPos+i]|GF_ISCHAR ) ) {} + if( i < 0 ) // nothing to do if the text is all spaces return; // #i91685# trailing letters are left aligned (right aligned for RTL) - mnTrailingSpaceWidth += rArgs.mpDXArray[i]; + mnTrailingSpaceWidth = rArgs.mpDXArray[ mnCharCount-1 ]; if( i > 0 ) - mnTrailingSpaceWidth -= rArgs.mpDXArray[i-1]; - InitGIA(); // ensure valid mpCharWidths[] + mnTrailingSpaceWidth -= rArgs.mpDXArray[ i-1 ]; + InitGIA(); // ensure valid mpCharWidths[], TODO: use GetIdealX() instead? mnTrailingSpaceWidth -= Fixed2Vcl( mpCharWidths[i] ); // ignore trailing space for calculating the available width nOrigWidth -= mnTrailingSpaceWidth; @@ -326,11 +325,15 @@ void ATSLayout::AdjustLayout( ImplLayoutArgs& rArgs ) if( !nPixelWidth ) return; - // HACK: justification requests which change the width by just one pixel are probably + // HACK: justification requests which change the width by just one pixel were probably // #i86038# introduced by lossy conversions between integer based coordinate system + // => ignoring such requests has many more benefits than eventual drawbacks if( (nOrigWidth >= nPixelWidth-1) && (nOrigWidth <= nPixelWidth+1) ) return; + // changing the layout will make all previous measurements invalid + InvalidateMeasurements(); + ATSUAttributeTag nTags[3]; ATSUAttributeValuePtr nVals[3]; ByteCount nBytes[3]; @@ -354,7 +357,7 @@ void ATSLayout::AdjustLayout( ImplLayoutArgs& rArgs ) if( eStatus != noErr ) return; - // check result of the justied layout + // update the measurements of the justified layout to match the justification request if( rArgs.mpDXArray ) InitGIA( &rArgs ); } @@ -1071,6 +1074,23 @@ bool ATSLayout::GetDeltaY() const return true; } +// ----------------------------------------------------------------------- + +#define DELETEAZ( X ) { delete[] X; X = NULL; } + +void ATSLayout::InvalidateMeasurements() +{ + mnGlyphCount = -1; + DELETEAZ( mpGlyphIds ); + DELETEAZ( mpCharWidths ); + DELETEAZ( mpChars2Glyphs ); + DELETEAZ( mpGlyphs2Chars ); + DELETEAZ( mpGlyphRTLFlags ); + DELETEAZ( mpGlyphAdvances ); + DELETEAZ( mpGlyphOrigAdvs ); + DELETEAZ( mpDeltaY ); +} + // ======================================================================= #if 0 diff --git a/vcl/aqua/source/gdi/salatsuifontutils.cxx b/vcl/aqua/source/gdi/salatsuifontutils.cxx index 8e38981a3c7c..23755ae2f571 100644 --- a/vcl/aqua/source/gdi/salatsuifontutils.cxx +++ b/vcl/aqua/source/gdi/salatsuifontutils.cxx @@ -207,6 +207,13 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF rDFA.meItalic = ITALIC_NONE; rDFA.mbSymbolFlag = false; + // ignore bitmap fonts + ATSFontRef rATSFontRef = FMGetATSFontRefFromFont( nFontID ); + ByteCount nHeadLen = 0; + OSStatus rc = ATSFontGetTable( rATSFontRef, 0x68656164/*head*/, 0, 0, NULL, &nHeadLen ); + if( (rc != noErr) || (nHeadLen <= 0) ) + return false; + // all scalable fonts on this platform are subsettable rDFA.mbSubsettable = true; rDFA.mbEmbeddable = false; @@ -216,7 +223,7 @@ static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDF // prepare iterating over all name strings of the font ItemCount nFontNameCount = 0; - OSStatus rc = ATSUCountFontNames( nFontID, &nFontNameCount ); + rc = ATSUCountFontNames( nFontID, &nFontNameCount ); if( rc != noErr ) return false; int nBestNameValue = 0; diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index e0905fe1d377..dedae3ac7cfc 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -54,6 +54,7 @@ #include "basegfx/polygon/b2dpolygon.hxx" #include "basegfx/polygon/b2dpolygontools.hxx" #include "basegfx/matrix/b2dhommatrix.hxx" +#include <basegfx/matrix/b2dhommatrixtools.hxx> using namespace vcl; @@ -404,6 +405,16 @@ void AquaSalGraphics::initResolution( NSWindow* pWin ) DBG_ERROR( "no screen found" ); } + // #i107076# maintaining size-WYSIWYG-ness causes many problems for + // low-DPI, high-DPI or for mis-reporting devices + // => it is better to limit the calculation result then + static const int nMinDPI = 72; + if( (mnRealDPIX < nMinDPI) || (mnRealDPIY < nMinDPI) ) + mnRealDPIX = mnRealDPIY = nMinDPI; + static const int nMaxDPI = 200; + if( (mnRealDPIX > nMaxDPI) || (mnRealDPIY > nMaxDPI) ) + mnRealDPIX = mnRealDPIY = nMaxDPI; + // for OSX any anisotropy reported for the display resolution is best ignored (e.g. TripleHead2Go) mnRealDPIX = mnRealDPIY = (mnRealDPIX + mnRealDPIY + 1) / 2; @@ -593,7 +604,8 @@ void AquaSalGraphics::EndSetClipRegion() void AquaSalGraphics::SetLineColor() { maLineColor.SetAlpha( 0.0 ); // transparent - CGContextSetStrokeColor( mrContext, maLineColor.AsArray() ); + if( CheckContext() ) + CGContextSetStrokeColor( mrContext, maLineColor.AsArray() ); } // ----------------------------------------------------------------------- @@ -601,7 +613,8 @@ void AquaSalGraphics::SetLineColor() void AquaSalGraphics::SetLineColor( SalColor nSalColor ) { maLineColor = RGBAColor( nSalColor ); - CGContextSetStrokeColor( mrContext, maLineColor.AsArray() ); + if( CheckContext() ) + CGContextSetStrokeColor( mrContext, maLineColor.AsArray() ); } // ----------------------------------------------------------------------- @@ -609,7 +622,8 @@ void AquaSalGraphics::SetLineColor( SalColor nSalColor ) void AquaSalGraphics::SetFillColor() { maFillColor.SetAlpha( 0.0 ); // transparent - CGContextSetFillColor( mrContext, maFillColor.AsArray() ); + if( CheckContext() ) + CGContextSetFillColor( mrContext, maFillColor.AsArray() ); } // ----------------------------------------------------------------------- @@ -617,7 +631,8 @@ void AquaSalGraphics::SetFillColor() void AquaSalGraphics::SetFillColor( SalColor nSalColor ) { maFillColor = RGBAColor( nSalColor ); - CGContextSetFillColor( mrContext, maFillColor.AsArray() ); + if( CheckContext() ) + CGContextSetFillColor( mrContext, maFillColor.AsArray() ); } // ----------------------------------------------------------------------- @@ -931,27 +946,29 @@ bool AquaSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPol AddPolygonToPath( xPath, rPolygon, true, !getAntiAliasB2DDraw(), IsPenVisible() ); } - // use the path to prepare the graphics context - CGContextSaveGState( mrContext ); - CGContextBeginPath( mrContext ); - CGContextAddPath( mrContext, xPath ); const CGRect aRefreshRect = CGPathGetBoundingBox( xPath ); - CGPathRelease( xPath ); - #ifndef NO_I97317_WORKAROUND // #i97317# workaround for Quartz having problems with drawing small polygons - if( (aRefreshRect.size.width <= 0.125) && (aRefreshRect.size.height <= 0.125) ) - return true; + if( ! ((aRefreshRect.size.width <= 0.125) && (aRefreshRect.size.height <= 0.125)) ) #endif + { + // use the path to prepare the graphics context + CGContextSaveGState( mrContext ); + CGContextBeginPath( mrContext ); + CGContextAddPath( mrContext, xPath ); + + // draw path with antialiased polygon + CGContextSetShouldAntialias( mrContext, true ); + CGContextSetAlpha( mrContext, 1.0 - fTransparency ); + CGContextDrawPath( mrContext, kCGPathEOFillStroke ); + CGContextRestoreGState( mrContext ); + + // mark modified rectangle as updated + RefreshRect( aRefreshRect ); + } - // draw path with antialiased polygon - CGContextSetShouldAntialias( mrContext, true ); - CGContextSetAlpha( mrContext, 1.0 - fTransparency ); - CGContextDrawPath( mrContext, kCGPathEOFillStroke ); - CGContextRestoreGState( mrContext ); + CGPathRelease( xPath ); - // mark modified rectangle as updated - RefreshRect( aRefreshRect ); return true; } @@ -966,13 +983,15 @@ bool AquaSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon& rPolyLine, if( nPointCount <= 0 ) return true; - // reject strange requests + // reject requests that cannot be handled yet if( rLineWidths.getX() != rLineWidths.getY() ) return false; // #i101491# Aqua does not support B2DLINEJOIN_NONE; return false to use // the fallback (own geometry preparation) - if(basegfx::B2DLINEJOIN_NONE == eLineJoin) + // #i104886# linejoin-mode and thus the above only applies to "fat" lines + if( (basegfx::B2DLINEJOIN_NONE == eLineJoin) + && (rLineWidths.getX() > 1.3) ) return false; // setup line attributes @@ -989,27 +1008,28 @@ bool AquaSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon& rPolyLine, CGMutablePathRef xPath = CGPathCreateMutable(); AddPolygonToPath( xPath, rPolyLine, rPolyLine.isClosed(), !getAntiAliasB2DDraw(), true ); - // use the path to prepare the graphics context - CGContextSaveGState( mrContext ); - CGContextAddPath( mrContext, xPath ); const CGRect aRefreshRect = CGPathGetBoundingBox( xPath ); - CGPathRelease( xPath ); - #ifndef NO_I97317_WORKAROUND // #i97317# workaround for Quartz having problems with drawing small polygons - if( (aRefreshRect.size.width <= 0.125) && (aRefreshRect.size.height <= 0.125) ) - return true; + if( ! ((aRefreshRect.size.width <= 0.125) && (aRefreshRect.size.height <= 0.125)) ) #endif + { + // use the path to prepare the graphics context + CGContextSaveGState( mrContext ); + CGContextAddPath( mrContext, xPath ); + // draw path with antialiased line + CGContextSetShouldAntialias( mrContext, true ); + CGContextSetLineJoin( mrContext, aCGLineJoin ); + CGContextSetLineWidth( mrContext, rLineWidths.getX() ); + CGContextDrawPath( mrContext, kCGPathStroke ); + CGContextRestoreGState( mrContext ); + + // mark modified rectangle as updated + RefreshRect( aRefreshRect ); + } - // draw path with antialiased line - CGContextSetShouldAntialias( mrContext, true ); - CGContextSetLineJoin( mrContext, aCGLineJoin ); - CGContextSetLineWidth( mrContext, rLineWidths.getX() ); - CGContextDrawPath( mrContext, kCGPathStroke ); - CGContextRestoreGState( mrContext ); + CGPathRelease( xPath ); - // mark modified rectangle as updated - RefreshRect( aRefreshRect ); return true; } @@ -1753,9 +1773,7 @@ BOOL AquaSalGraphics::GetGlyphOutline( long nGlyphId, basegfx::B2DPolyPolygon& r GgoClosePathProc( &aGgoData ); if( mfFontScale != 1.0 ) { - basegfx::B2DHomMatrix aScale; - aScale.scale( +mfFontScale, +mfFontScale ); - rPolyPoly.transform( aScale ); + rPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix(+mfFontScale, +mfFontScale)); } return true; } diff --git a/vcl/aqua/source/gdi/salgdiutils.cxx b/vcl/aqua/source/gdi/salgdiutils.cxx index 99a1629006d2..6df50f79e9d0 100755 --- a/vcl/aqua/source/gdi/salgdiutils.cxx +++ b/vcl/aqua/source/gdi/salgdiutils.cxx @@ -68,6 +68,13 @@ void AquaSalGraphics::SetPrinterGraphics( CGContextRef xContext, long nDPIX, lon mnRealDPIX = nDPIX; mnRealDPIY = nDPIY; + // a previously set clip path is now invalid + if( mxClipPath ) + { + CGPathRelease( mxClipPath ); + mxClipPath = NULL; + } + if( mrContext ) { CGContextSetFillColorSpace( mrContext, GetSalData()->mxRGBSpace ); @@ -126,6 +133,28 @@ void AquaSalGraphics::SetVirDevGraphics( CGLayerRef xLayer, CGContextRef xContex // ---------------------------------------------------------------------- +void AquaSalGraphics::InvalidateContext() +{ + UnsetState(); + mrContext = 0; +} + +// ---------------------------------------------------------------------- + +void AquaSalGraphics::UnsetState() +{ + if( mrContext ) + { + CGContextRestoreGState( mrContext ); + mrContext = 0; + } + if( mxClipPath ) + { + CGPathRelease( mxClipPath ); + mxClipPath = NULL; + } +} + void AquaSalGraphics::SetState() { CGContextRestoreGState( mrContext ); @@ -134,9 +163,9 @@ void AquaSalGraphics::SetState() // setup clipping if( mxClipPath ) { - CGContextBeginPath( mrContext ); // discard any existing path + CGContextBeginPath( mrContext ); // discard any existing path CGContextAddPath( mrContext, mxClipPath ); // set the current path to the clipping path - CGContextClip( mrContext ); // use it for clipping + CGContextClip( mrContext ); // use it for clipping } // set RGB colorspace and line and fill colors @@ -205,7 +234,7 @@ bool AquaSalGraphics::CheckContext() CGContextRelease( rReleaseContext ); } - DBG_ASSERT( mrContext, "<<<WARNING>>> AquaSalGraphics::CheckContext() FAILED!!!!\n" ); + DBG_ASSERT( mrContext || mbPrinter, "<<<WARNING>>> AquaSalGraphics::CheckContext() FAILED!!!!\n" ); return (mrContext != NULL); } diff --git a/vcl/aqua/source/gdi/salnativewidgets.cxx b/vcl/aqua/source/gdi/salnativewidgets.cxx index 6cd4e78a2d1a..754358823a93 100644 --- a/vcl/aqua/source/gdi/salnativewidgets.cxx +++ b/vcl/aqua/source/gdi/salnativewidgets.cxx @@ -430,9 +430,10 @@ BOOL AquaSalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart #define CTRL_STATE_SELECTED 0x0040 #define CTRL_CACHING_ALLOWED 0x8000 // set when the control is completely visible (i.e. not clipped) */ -static ThemeDrawState getState( ControlState nState ) +UInt32 AquaSalGraphics::getState( ControlState nState ) { - if( (nState & CTRL_STATE_ENABLED) == 0 ) + bool bDrawActive = mpFrame ? ([mpFrame->getWindow() isKeyWindow] ? true : false) : true; + if( (nState & CTRL_STATE_ENABLED) == 0 || ! bDrawActive ) { if( (nState & CTRL_STATE_HIDDEN) == 0 ) return kThemeStateInactive; diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx index b9a1f4ef7748..47c027a033aa 100644 --- a/vcl/aqua/source/gdi/salprn.cxx +++ b/vcl/aqua/source/gdi/salprn.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: salprn.cxx,v $ - * $Revision: 1.16 $ + * $Revision: 1.16.56.2 $ * * This file is part of OpenOffice.org. * @@ -38,7 +38,6 @@ #include "saldata.hxx" #include "vcl/jobset.h" #include "vcl/salptype.hxx" -#include "vcl/impprn.hxx" #include "vcl/print.hxx" #include "vcl/unohelp.hxx" @@ -47,11 +46,13 @@ #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/container/XNameAccess.hpp" #include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/awt/Size.hpp" #include <algorithm> using namespace rtl; using namespace vcl; +using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; @@ -67,7 +68,9 @@ AquaSalInfoPrinter::AquaSalInfoPrinter( const SalPrinterQueueInfo& i_rQueue ) : mpPrintInfo( nil ), mePageOrientation( ORIENTATION_PORTRAIT ), mnStartPageOffsetX( 0 ), - mnStartPageOffsetY( 0 ) + mnStartPageOffsetY( 0 ), + mnCurPageRangeStart( 0 ), + mnCurPageRangeCount( 0 ) { NSString* pStr = CreateNSString( i_rQueue.maPrinterName ); mpPrinter = [NSPrinter printerWithName: pStr]; @@ -87,6 +90,7 @@ AquaSalInfoPrinter::AquaSalInfoPrinter( const SalPrinterQueueInfo& i_rQueue ) : const int nWidth = 100, nHeight = 100; maContextMemory.reset( reinterpret_cast<sal_uInt8*>( rtl_allocateMemory( nWidth * 4 * nHeight ) ), boost::bind( rtl_freeMemory, _1 ) ); + if( maContextMemory ) { mrContext = CGBitmapContextCreate( maContextMemory.get(), nWidth, nHeight, 8, nWidth * 4, GetSalData()->mxRGBSpace, kCGImageAlphaNoneSkipFirst ); @@ -134,7 +138,7 @@ void AquaSalInfoPrinter::SetupPrinterGraphics( CGContextRef i_rContext ) const dY -= aPaperSize.height - aImageRect.size.height - aImageRect.origin.y; CGContextTranslateCTM( i_rContext, dX + mnStartPageOffsetX, dY - mnStartPageOffsetY ); // scale to be top/down and reflect our "virtual" DPI - CGContextScaleCTM( i_rContext, 0.1, -0.1 ); + CGContextScaleCTM( i_rContext, 72.0/double(nDPIX), -(72.0/double(nDPIY)) ); } else { @@ -148,7 +152,7 @@ void AquaSalInfoPrinter::SetupPrinterGraphics( CGContextRef i_rContext ) const dY = -aPaperSize.width; CGContextTranslateCTM( i_rContext, dX + mnStartPageOffsetY, dY - mnStartPageOffsetX ); // scale to be top/down and reflect our "virtual" DPI - CGContextScaleCTM( i_rContext, -0.1, 0.1 ); + CGContextScaleCTM( i_rContext, -(72.0/double(nDPIY)), (72.0/double(nDPIX)) ); } mpGraphics->SetPrinterGraphics( i_rContext, nDPIX, nDPIY, 1.0 ); } @@ -296,6 +300,28 @@ BOOL AquaSalInfoPrinter::SetPrinterData( ImplJobSetup* io_pSetupData ) // ----------------------------------------------------------------------- +void AquaSalInfoPrinter::setPaperSize( long i_nWidth, long i_nHeight, Orientation i_eSetOrientation ) +{ + + Orientation ePaperOrientation = ORIENTATION_PORTRAIT; + const PaperInfo* pPaper = matchPaper( i_nWidth, i_nHeight, ePaperOrientation ); + + if( pPaper ) + { + NSString* pPaperName = [CreateNSString( rtl::OStringToOUString(PaperInfo::toPSName(pPaper->getPaper()), RTL_TEXTENCODING_ASCII_US) ) autorelease]; + [mpPrintInfo setPaperName: pPaperName]; + } + else if( i_nWidth > 0 && i_nHeight > 0 ) + { + NSSize aPaperSize = { TenMuToPt(i_nWidth), TenMuToPt(i_nHeight) }; + [mpPrintInfo setPaperSize: aPaperSize]; + } + // this seems counterintuitive + mePageOrientation = i_eSetOrientation; +} + +// ----------------------------------------------------------------------- + BOOL AquaSalInfoPrinter::SetData( ULONG i_nFlags, ImplJobSetup* io_pSetupData ) { if( ! io_pSetupData || io_pSetupData->mnSystem != JOBSETUP_SYSTEM_MAC ) @@ -304,31 +330,32 @@ BOOL AquaSalInfoPrinter::SetData( ULONG i_nFlags, ImplJobSetup* io_pSetupData ) if( mpPrintInfo ) { + if( (i_nFlags & SAL_JOBSET_ORIENTATION) != 0 ) + mePageOrientation = io_pSetupData->meOrientation; + if( (i_nFlags & SAL_JOBSET_PAPERSIZE) != 0) { // set paper format - double width = 0, height = 0; + long width = 21000, height = 29700; if( io_pSetupData->mePaperFormat == PAPER_USER ) { // #i101108# sanity check if( io_pSetupData->mnPaperWidth && io_pSetupData->mnPaperHeight ) { - width = TenMuToPt( io_pSetupData->mnPaperWidth ); - height = TenMuToPt( io_pSetupData->mnPaperHeight ); + width = io_pSetupData->mnPaperWidth; + height = io_pSetupData->mnPaperHeight; } } else - getPaperSize( width, height, io_pSetupData->mePaperFormat ); - - if( width > 0 && height > 0 ) { - NSSize aPaperSize = { width, height }; - [mpPrintInfo setPaperSize: aPaperSize]; + double w = 595, h = 842; + getPaperSize( w, h, io_pSetupData->mePaperFormat ); + width = static_cast<long>(PtTo10Mu( w )); + height = static_cast<long>(PtTo10Mu( h )); } - } - if( (i_nFlags & SAL_JOBSET_ORIENTATION) != 0 ) - mePageOrientation = io_pSetupData->meOrientation; + setPaperSize( width, height, mePageOrientation ); + } } return mpPrintInfo != nil; @@ -424,6 +451,8 @@ ULONG AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup* i_pSetupData, USH return 0; case PRINTER_CAPABILITIES_SETORIENTATION: return 1; + case PRINTER_CAPABILITIES_SETDUPLEX: + return 0; case PRINTER_CAPABILITIES_SETPAPERBIN: return 0; case PRINTER_CAPABILITIES_SETPAPERSIZE: @@ -432,6 +461,8 @@ ULONG AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup* i_pSetupData, USH return 1; case PRINTER_CAPABILITIES_EXTERNALDIALOG: return getUseNativeDialog() ? 1 : 0; + case PRINTER_CAPABILITIES_PDF: + return 1; default: break; }; return 0; @@ -470,58 +501,129 @@ void AquaSalInfoPrinter::GetPageInfo( const ImplJobSetup*, } } -BOOL AquaSalInfoPrinter::StartJob( const String* pFileName, - const String& rAppName, - ImplJobSetup* pSetupData, - ImplQPrinter* pQPrinter, - bool bIsQuickJob ) +static Size getPageSize( vcl::PrinterController& i_rController, sal_Int32 i_nPage ) +{ + Size aPageSize; + Sequence< PropertyValue > aPageParms( i_rController.getPageParameters( i_nPage ) ); + for( sal_Int32 nProperty = 0, nPropertyCount = aPageParms.getLength(); nProperty < nPropertyCount; ++nProperty ) + { + if( aPageParms[ nProperty ].Name.equalsAscii( "PageSize" ) ) + { + awt::Size aSize; + aPageParms[ nProperty].Value >>= aSize; + aPageSize.Width() = aSize.Width; + aPageSize.Height() = aSize.Height; + break; + } + } + return aPageSize; +} + +BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, + const String& i_rJobName, + const String& i_rAppName, + ImplJobSetup* i_pSetupData, + vcl::PrinterController& i_rController + ) { if( mbJob ) return FALSE; BOOL bSuccess = FALSE; - std::vector<ULONG> aPaperRanges; - if( ! pQPrinter->GetPaperRanges( aPaperRanges, true ) ) - return FALSE; - - size_t nRanges = aPaperRanges.size(); + bool bWasAborted = false; AquaSalInstance* pInst = GetSalData()->mpFirstInstance; - - for( ULONG nCurRange = 0; nCurRange < nRanges-1; nCurRange++ ) + PrintAccessoryViewState aAccViewState; + sal_Int32 nAllPages = 0; + + aAccViewState.bNeedRestart = true; + + // reset IsLastPage + i_rController.setLastPage( sal_False ); + + // update job data + if( i_pSetupData ) + SetData( ~0, i_pSetupData ); + + // do we want a progress panel ? + sal_Bool bShowProgressPanel = sal_True; + beans::PropertyValue* pMonitor = i_rController.getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MonitorVisible" ) ) ); + if( pMonitor ) + pMonitor->Value >>= bShowProgressPanel; + if( ! i_rController.isShowDialogs() ) + bShowProgressPanel = sal_False; + + // FIXME: jobStarted() should be done after the print dialog has ended (if there is one) + // how do I know when that might be ? + i_rController.jobStarted(); + do { - mnStartPageOffsetX = mnStartPageOffsetY = 0; + if( aAccViewState.bNeedRestart ) + { + mnCurPageRangeStart = 0; + mnCurPageRangeCount = 0; + nAllPages = i_rController.getFilteredPageCount(); + } - // update job data - ImplJobSetup* pSetup = pQPrinter->GetPageSetup( aPaperRanges[ nCurRange ] ); - if( pSetup ) - SetData( ~0, pSetup ); - DBG_ASSERT( pSetup, "no job setup for range" ); + aAccViewState.bNeedRestart = false; + + Size aCurSize( 21000, 29700 ); + if( nAllPages > 0 ) + { + mnCurPageRangeCount = 1; + aCurSize = getPageSize( i_rController, mnCurPageRangeStart ); + Size aNextSize( aCurSize ); + + // print pages up to a different size + while( mnCurPageRangeCount + mnCurPageRangeStart < nAllPages ) + { + aNextSize = getPageSize( i_rController, mnCurPageRangeStart + mnCurPageRangeCount ); + if( aCurSize == aNextSize // same page size + || + (aCurSize.Width() == aNextSize.Height() && aCurSize.Height() == aNextSize.Width()) // same size, but different orientation + ) + { + mnCurPageRangeCount++; + } + else + break; + } + } + else + mnCurPageRangeCount = 0; + + // now for the current run + mnStartPageOffsetX = mnStartPageOffsetY = 0; + // setup the paper size and orientation + // do this on our associated Printer object, since that is + // out interface to the applications which occasionally rely on the paper + // information (e.g. brochure printing scales to the found paper size) + // also SetPaperSizeUser has the advantage that we can share a + // platform independent paper matching algorithm + boost::shared_ptr<Printer> pPrinter( i_rController.getPrinter() ); + pPrinter->SetMapMode( MapMode( MAP_100TH_MM ) ); + pPrinter->SetPaperSizeUser( aCurSize, true ); - mnCurPageRangeStart = aPaperRanges[nCurRange]; - mnCurPageRangeCount = aPaperRanges[nCurRange+1] - aPaperRanges[nCurRange]; // create view - NSView* pPrintView = [[AquaPrintView alloc] initWithQPrinter: pQPrinter withInfoPrinter: this]; + NSView* pPrintView = [[AquaPrintView alloc] initWithController: &i_rController withInfoPrinter: this]; NSMutableDictionary* pPrintDict = [mpPrintInfo dictionary]; // set filename - if( pFileName ) + if( i_pFileName ) { [mpPrintInfo setJobDisposition: NSPrintSaveJob]; - NSString* pPath = CreateNSString( *pFileName ); + NSString* pPath = CreateNSString( *i_pFileName ); [pPrintDict setObject: pPath forKey: NSPrintSavePath]; [pPath release]; - - // in this case we can only deliver the print job in one file - mnCurPageRangeStart = 0; - mnCurPageRangeCount = aPaperRanges.back(); - nCurRange = nRanges; } - [pPrintDict setObject: [[NSNumber numberWithInt: (int)pQPrinter->GetCopyCount()] autorelease] forKey: NSPrintCopies]; + [pPrintDict setObject: [[NSNumber numberWithInt: (int)i_rController.getPrinter()->GetCopyCount()] autorelease] forKey: NSPrintCopies]; [pPrintDict setObject: [[NSNumber numberWithBool: YES] autorelease] forKey: NSPrintDetailedErrorReporting]; [pPrintDict setObject: [[NSNumber numberWithInt: 1] autorelease] forKey: NSPrintFirstPage]; - [pPrintDict setObject: [[NSNumber numberWithInt: (int)mnCurPageRangeCount] autorelease] forKey: NSPrintLastPage]; + // #i103253# weird: for some reason, autoreleasing the value below like the others above + // leads do a double free malloc error. Why this value should behave differently from all the others + // is a mystery. + [pPrintDict setObject: [NSNumber numberWithInt: mnCurPageRangeCount] forKey: NSPrintLastPage]; // create print operation @@ -529,17 +631,47 @@ BOOL AquaSalInfoPrinter::StartJob( const String* pFileName, if( pPrintOperation ) { - bool bShowPanel = (! bIsQuickJob && getUseNativeDialog() ); + NSObject* pReleaseAfterUse = nil; + bool bShowPanel = (! i_rController.isDirectPrint() && getUseNativeDialog() && i_rController.isShowDialogs() ); [pPrintOperation setShowsPrintPanel: bShowPanel ? YES : NO ]; - // [pPrintOperation setShowsProgressPanel: NO]; + [pPrintOperation setShowsProgressPanel: bShowProgressPanel ? YES : NO]; + + // set job title (since MacOSX 10.5) + if( [pPrintOperation respondsToSelector: @selector(setJobTitle:)] ) + [pPrintOperation performSelector: @selector(setJobTitle:) withObject: [CreateNSString( i_rJobName ) autorelease]]; + + if( bShowPanel && mnCurPageRangeStart == 0 ) // only the first range of pages gets the accesory view + pReleaseAfterUse = [AquaPrintAccessoryView setupPrinterPanel: pPrintOperation withController: &i_rController withState: &aAccViewState]; + bSuccess = TRUE; mbJob = true; pInst->startedPrintJob(); [pPrintOperation runOperation]; pInst->endedPrintJob(); + bWasAborted = [[[pPrintOperation printInfo] jobDisposition] compare: NSPrintCancelJob] == NSOrderedSame; mbJob = false; + if( pReleaseAfterUse ) + [pReleaseAfterUse release]; } - } + + mnCurPageRangeStart += mnCurPageRangeCount; + mnCurPageRangeCount = 1; + } while( aAccViewState.bNeedRestart || mnCurPageRangeStart + mnCurPageRangeCount < nAllPages ); + + // inform application that it can release its data + // this is awkward, but the XRenderable interface has no method for this, + // so we need to call XRenderadble::render one last time with IsLastPage = TRUE + i_rController.setLastPage( sal_True ); + GDIMetaFile aPageFile; + if( mrContext ) + SetupPrinterGraphics( mrContext ); + i_rController.getFilteredPageFile( 0, aPageFile ); + + i_rController.setJobState( bWasAborted + ? view::PrintableState_JOB_ABORTED + : view::PrintableState_JOB_SPOOLED ); + + mnCurPageRangeStart = mnCurPageRangeCount = 0; return bSuccess; } @@ -581,6 +713,7 @@ SalGraphics* AquaSalInfoPrinter::StartPage( ImplJobSetup* i_pSetupData, BOOL i_b BOOL AquaSalInfoPrinter::EndPage() { + mpGraphics->InvalidateContext(); return TRUE; } @@ -606,31 +739,24 @@ AquaSalPrinter::~AquaSalPrinter() // ----------------------------------------------------------------------- -BOOL AquaSalPrinter::StartJob( const String* pFileName, - const String& rAppName, - ImplJobSetup* pSetupData, - ImplQPrinter* pQPrinter ) +BOOL AquaSalPrinter::StartJob( const String* i_pFileName, + const String& i_rJobName, + const String& i_rAppName, + ImplJobSetup* i_pSetupData, + vcl::PrinterController& i_rController ) { - bool bIsQuickJob = false; - std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator quick_it = - pSetupData->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) ) ); - - if( quick_it != pSetupData->maValueMap.end() ) - { - if( quick_it->second.equalsIgnoreAsciiCaseAscii( "true" ) ) - bIsQuickJob = true; - } - - return mpInfoPrinter->StartJob( pFileName, rAppName, pSetupData, pQPrinter, bIsQuickJob ); + return mpInfoPrinter->StartJob( i_pFileName, i_rJobName, i_rAppName, i_pSetupData, i_rController ); } // ----------------------------------------------------------------------- BOOL AquaSalPrinter::StartJob( const XubString* i_pFileName, - const XubString& i_rJobName, - const XubString& i_rAppName, - ULONG i_nCopies, BOOL i_bCollate, - ImplJobSetup* i_pSetupData ) + const XubString& i_rJobName, + const XubString& i_rAppName, + ULONG i_nCopies, + bool i_bCollate, + bool i_bDirect, + ImplJobSetup* i_pSetupData ) { DBG_ERROR( "should never be called" ); return FALSE; @@ -671,20 +797,62 @@ ULONG AquaSalPrinter::GetErrorCode() return mpInfoPrinter->GetErrorCode(); } -//////////////////////////// -////// IMPLEMENT US ///// -//////////////////////////// - -DuplexMode AquaSalInfoPrinter::GetDuplexMode( const ImplJobSetup* i_pSetupData ) +void AquaSalInfoPrinter::InitPaperFormats( const ImplJobSetup* i_pSetupData ) { - return DUPLEX_UNKNOWN; + m_aPaperFormats.clear(); + m_bPapersInit = true; + + if( mpPrinter ) + { + if( [mpPrinter statusForTable: @"PPD"] == NSPrinterTableOK ) + { + NSArray* pPaperNames = [mpPrinter stringListForKey: @"PageSize" inTable: @"PPD"]; + if( pPaperNames ) + { + unsigned int nPapers = [pPaperNames count]; + for( unsigned int i = 0; i < nPapers; i++ ) + { + NSString* pPaper = [pPaperNames objectAtIndex: i]; + NSSize aPaperSize = [mpPrinter pageSizeForPaper: pPaper]; + if( aPaperSize.width > 0 && aPaperSize.height > 0 ) + { + PaperInfo aInfo( PtTo10Mu( aPaperSize.width ), + PtTo10Mu( aPaperSize.height ) ); + m_aPaperFormats.push_back( aInfo ); + } + } + } + } + } } -void AquaSalInfoPrinter::InitPaperFormats( const ImplJobSetup* i_pSetupData ) +const PaperInfo* AquaSalInfoPrinter::matchPaper( long i_nWidth, long i_nHeight, Orientation& o_rOrientation ) const { + if( ! m_bPapersInit ) + const_cast<AquaSalInfoPrinter*>(this)->InitPaperFormats( NULL ); + + const PaperInfo* pMatch = NULL; + o_rOrientation = ORIENTATION_PORTRAIT; + for( int n = 0; n < 2 ; n++ ) + { + for( size_t i = 0; i < m_aPaperFormats.size(); i++ ) + { + if( abs( m_aPaperFormats[i].getWidth() - i_nWidth ) < 50 && + abs( m_aPaperFormats[i].getHeight() - i_nHeight ) < 50 ) + { + pMatch = &m_aPaperFormats[i]; + return pMatch; + } + } + o_rOrientation = ORIENTATION_LANDSCAPE; + std::swap( i_nWidth, i_nHeight ); + } + return pMatch; } int AquaSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* i_pSetupData ) { - return 0; + return 900; } + + diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx index b942c97cead1..7fe3b93ef2e8 100644 --- a/vcl/aqua/source/window/salframe.cxx +++ b/vcl/aqua/source/window/salframe.cxx @@ -54,10 +54,7 @@ #include "boost/assert.hpp" #include "vcl/svapp.hxx" #include "rtl/ustrbuf.hxx" - -#include <premac.h> -#include <CoreFoundation/CoreFoundation.h> -#include <postmac.h> +#include "osl/file.h" using namespace std; @@ -329,8 +326,25 @@ void AquaSalFrame::SetTitle(const XubString& rTitle) // ----------------------------------------------------------------------- -void AquaSalFrame::SetIcon( USHORT nIcon ) +void AquaSalFrame::SetIcon( USHORT ) +{ +} + +// ----------------------------------------------------------------------- + +void AquaSalFrame::SetRepresentedURL( const rtl::OUString& i_rDocURL ) { + if( i_rDocURL.indexOfAsciiL( "file:", 5 ) == 0 ) + { + rtl::OUString aSysPath; + osl_getSystemPathFromFileURL( i_rDocURL.pData, &aSysPath.pData ); + NSString* pStr = CreateNSString( aSysPath ); + if( pStr ) + { + [pStr autorelease]; + [mpWindow setRepresentedFilename: pStr]; + } + } } // ----------------------------------------------------------------------- diff --git a/vcl/aqua/source/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index 68ea2c2062f2..51f1b1a3b63c 100755 --- a/vcl/aqua/source/window/salframeview.mm +++ b/vcl/aqua/source/window/salframeview.mm @@ -215,6 +215,7 @@ static AquaSalFrame* getMouseContainerFrame() AquaSalMenu::enableMainMenu( false ); #endif mpFrame->CallCallback( SALEVENT_GETFOCUS, 0 ); + mpFrame->SendPaintEvent(); // repaint controls as active } } @@ -223,7 +224,10 @@ static AquaSalFrame* getMouseContainerFrame() YIELD_GUARD; if( mpFrame && AquaSalFrame::isAlive( mpFrame ) ) + { mpFrame->CallCallback(SALEVENT_LOSEFOCUS, 0); + mpFrame->SendPaintEvent(); // repaint controls as inactive + } } -(void)windowDidChangeScreen: (NSNotification*)pNotification @@ -1061,21 +1065,41 @@ private: [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_END_OF_LINE character: 0 modifiers: 0]; } +-(void)moveToRightEndOfLine: (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)moveToRightEndOfLineAndModifySelection: (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)moveToLeftEndOfLine: (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)moveToLeftEndOfLineAndModifySelection: (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]; @@ -1121,6 +1145,12 @@ private: [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT character: 0 modifiers: 0]; } +-(void)scrollToEndOfDocument: (id)aSender +{ + // this is not exactly what we should do, but it makes "End" and "Shift-End" behave consistent + [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]; @@ -1131,6 +1161,12 @@ private: [self sendKeyInputAndReleaseToFrame: com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT character: 0 modifiers: 0]; } +-(void)scrollToBeginningOfDocument: (id)aSender +{ + // this is not exactly what we should do, but it makes "Home" and "Shift-Home" behave consistent + [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]; @@ -1328,11 +1364,32 @@ private: { mbNeedSpecialKeyHandle = true; } + + // FIXME: + // #i106901# + // if we come here outside of mbInKeyInput, this is likely to be because + // of the keyboard viewer. For unknown reasons having no marked range + // in this case causes a crash. So we say we have a marked range anyway + // This is a hack, since it is not understood what a) causes that crash + // and b) why we should have a marked range at this point. + if( ! mbInKeyInput ) + bHasMarkedText = YES; + return bHasMarkedText; } - (NSRange)markedRange { + // FIXME: + // #i106901# + // if we come here outside of mbInKeyInput, this is likely to be because + // of the keyboard viewer. For unknown reasons having no marked range + // in this case causes a crash. So we say we have a marked range anyway + // This is a hack, since it is not understood what a) causes that crash + // and b) why we should have a marked range at this point. + if( ! mbInKeyInput ) + return NSMakeRange( 0, 0 ); + return [self hasMarkedText] ? mMarkedRange : NSMakeRange( NSNotFound, 0 ); } @@ -1437,6 +1494,9 @@ private: { if( AquaSalFrame::isAlive( mpFrame ) ) { + #if OSL_DEBUG_LEVEL > 1 + // fprintf( stderr, "SalFrameView: doCommandBySelector %s\n", (char*)aSelector ); + #endif if( (mpFrame->mnICOptions & SAL_INPUTCONTEXT_TEXT) != 0 && aSelector != NULL && [self respondsToSelector: aSelector] ) { diff --git a/vcl/inc/vcl/arrange.hxx b/vcl/inc/vcl/arrange.hxx new file mode 100644 index 000000000000..309d0bf930ea --- /dev/null +++ b/vcl/inc/vcl/arrange.hxx @@ -0,0 +1,425 @@ +/************************************************************************* + * + * 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: accel.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 _VCL_ARRANGE_HXX +#define _VCL_ARRANGE_HXX + +#include "vcl/window.hxx" + +#include <vector> +#include <map> +#include <boost/shared_ptr.hpp> + +namespace vcl +{ + /* some helper classes for simple window layouting + guidelines: + - a WindowArranger is not a Window + - a WindowArranger hierarchy manages exactly one level of child windows inside a common parent + this is to keep the vcl Window hierarchy flat, as some code like accelerators depend on such behavior + - a WindowArranger never becomes owner of a Window, windows need to be destroyed separately + - a WindowArranger however always is owner of its child WindowArrangers, that is the + WindowArranger hierarchy will keep track of its objects and delete them + - a managed element of a WindowArranger can either be a Window (a leaf in the hierarchy) + or a child WindowArranger (a node in the hierarchy), but never both + */ + + class WindowArranger + { + protected: + struct Element + { + Window* m_pElement; + boost::shared_ptr<WindowArranger> m_pChild; + sal_Int32 m_nExpandPriority; + Size m_aMinSize; + bool m_bHidden; + long m_nLeftBorder; + long m_nTopBorder; + long m_nRightBorder; + long m_nBottomBorder; + + Element() + : m_pElement( NULL ) + , m_pChild() + , m_nExpandPriority( 0 ) + , m_bHidden( false ) + , m_nLeftBorder( 0 ) + , m_nTopBorder( 0 ) + , m_nRightBorder( 0 ) + , m_nBottomBorder( 0 ) + {} + + Element( Window* i_pWin, + boost::shared_ptr<WindowArranger> const & i_pChild = boost::shared_ptr<WindowArranger>(), + sal_Int32 i_nExpandPriority = 0 + ) + : m_pElement( i_pWin ) + , m_pChild( i_pChild ) + , m_nExpandPriority( i_nExpandPriority ) + , m_bHidden( false ) + , m_nLeftBorder( 0 ) + , m_nTopBorder( 0 ) + , m_nRightBorder( 0 ) + , m_nBottomBorder( 0 ) + {} + + void deleteChild() { m_pChild.reset(); } + + sal_Int32 getExpandPriority() const; + Size getOptimalSize( WindowSizeType ) const; + bool isVisible() const; + void setPosSize( const Point&, const Size& ); + }; + + Window* m_pParentWindow; + WindowArranger* m_pParentArranger; + Rectangle m_aManagedArea; + long m_nOuterBorder; + + virtual Element* getElement( size_t i_nIndex ) = 0; + const Element* getConstElement( size_t i_nIndex ) const + { return const_cast<WindowArranger*>(this)->getElement( i_nIndex ); } + + + public: + WindowArranger( WindowArranger* i_pParent = NULL ) + : m_pParentWindow( i_pParent ? i_pParent->m_pParentWindow : NULL ) + , m_pParentArranger( i_pParent ) + , m_nOuterBorder( 0 ) + {} + virtual ~WindowArranger(); + + // ask what would be the optimal size + virtual Size getOptimalSize( WindowSizeType ) const = 0; + // call Resize to trigger layouting inside the managed area + // without function while parent window is unset + virtual void resize() = 0; + // avoid this if possible, using the constructor instead + // there can be only one parent window and all managed windows MUST + // be direct children of that window + // violating that condition will result in undefined behavior + virtual void setParentWindow( Window* ); + + virtual void setParent( WindowArranger* ); + + virtual size_t countElements() const = 0; + boost::shared_ptr<WindowArranger> getChild( size_t i_nIndex ) const + { + const Element* pEle = getConstElement( i_nIndex ); + return pEle ? pEle->m_pChild : boost::shared_ptr<WindowArranger>(); + } + Window* getWindow( size_t i_nIndex ) const + { + const Element* pEle = getConstElement( i_nIndex ); + return pEle ? pEle->m_pElement : NULL; + } + + virtual bool isVisible() const; // true if any element is visible + + sal_Int32 getExpandPriority( size_t i_nIndex ) const + { + const Element* pEle = getConstElement( i_nIndex ); + return pEle ? pEle->getExpandPriority() : 0; + } + + Size getMinimumSize( size_t i_nIndex ) const + { + const Element* pEle = getConstElement( i_nIndex ); + return pEle ? pEle->m_aMinSize : Size(); + } + + bool setMinimumSize( size_t i_nIndex, const Size& i_rMinSize ) + { + Element* pEle = getElement( i_nIndex ); + if( pEle ) + pEle->m_aMinSize = i_rMinSize; + return pEle != NULL; + } + + void setBorders( size_t i_nIndex, long i_nLeft, long i_nTop, long i_nRight, long i_nBottom ) + { + Element* pEle = getElement( i_nIndex ); + if( pEle ) + { + pEle->m_nLeftBorder = i_nLeft; + pEle->m_nRightBorder = i_nRight; + pEle->m_nTopBorder = i_nTop; + pEle->m_nBottomBorder = i_nBottom; + } + } + + void show( bool i_bShow = true, bool i_bImmediateUpdate = true ); + + void setManagedArea( const Rectangle& i_rArea ) + { + m_aManagedArea = i_rArea; + resize(); + } + const Rectangle& getManagedArea() const { return m_aManagedArea; } + + void setOuterBorder( long i_nBorder ) + { + m_nOuterBorder = i_nBorder; + resize(); + } + }; + + class RowOrColumn : public WindowArranger + { + long m_nBorderWidth; + bool m_bColumn; + + std::vector< WindowArranger::Element > m_aElements; + + void distributeRowWidth( std::vector< Size >& io_rSizes, long i_nUsedWidth, long i_nExtraWidth ); + void distributeColumnHeight( std::vector< Size >& io_rSizes, long i_nUsedHeight, long i_nExtraHeight ); + protected: + virtual Element* getElement( size_t i_nIndex ) + { return i_nIndex < m_aElements.size() ? &m_aElements[ i_nIndex ] : 0; } + + public: + RowOrColumn( WindowArranger* i_pParent = NULL, + bool bColumn = true, long i_nBorderWidth = 5 ) + : WindowArranger( i_pParent ) + , m_nBorderWidth( i_nBorderWidth ) + , m_bColumn( bColumn ) + {} + + virtual ~RowOrColumn(); + + virtual Size getOptimalSize( WindowSizeType ) const; + virtual void resize(); + virtual size_t countElements() const { return m_aElements.size(); } + + // add a managed window at the given index + // an index smaller than zero means add the window at the end + size_t addWindow( Window*, sal_Int32 i_nExpandPrio = 0, size_t i_nIndex = ~0 ); + void remove( Window* ); + + size_t addChild( boost::shared_ptr<WindowArranger> const &, sal_Int32 i_nExpandPrio = 0, size_t i_nIndex = ~0 ); + // convenience: use for addChild( new WindowArranger( ... ) ) constructs + size_t addChild( WindowArranger* i_pNewChild, sal_Int32 i_nExpandPrio = 0, size_t i_nIndex = ~0 ) + { return addChild( boost::shared_ptr<WindowArranger>( i_pNewChild ), i_nExpandPrio, i_nIndex ); } + void remove( boost::shared_ptr<WindowArranger> const & ); + + long getBorderWidth() const { return m_nBorderWidth; } + }; + + class LabeledElement : public WindowArranger + { + WindowArranger::Element m_aLabel; + WindowArranger::Element m_aElement; + long m_nDistance; + long m_nLabelColumnWidth; + int m_nLabelStyle; + protected: + virtual Element* getElement( size_t i_nIndex ) + { + if( i_nIndex == 0 ) + return &m_aLabel; + else if( i_nIndex == 1 ) + return &m_aElement; + return 0; + } + + public: + LabeledElement( WindowArranger* i_pParent = NULL, int i_nLabelStyle = 0, long i_nDistance = 5 ) + : WindowArranger( i_pParent ) + , m_nDistance( i_nDistance ) + , m_nLabelColumnWidth( 0 ) + , m_nLabelStyle( i_nLabelStyle ) + {} + + virtual ~LabeledElement(); + + virtual Size getOptimalSize( WindowSizeType ) const; + virtual void resize(); + virtual size_t countElements() const { return 2; } + + void setLabel( Window* ); + void setLabel( boost::shared_ptr<WindowArranger> const & ); + void setElement( Window* ); + void setElement( boost::shared_ptr<WindowArranger> const & ); + void setLabelColumnWidth( long i_nWidth ) + { m_nLabelColumnWidth = i_nWidth; } + + Size getLabelSize( WindowSizeType i_eType ) const + { return m_aLabel.getOptimalSize( i_eType ); } + Size getElementSize( WindowSizeType i_eType ) const + { return m_aElement.getOptimalSize( i_eType ); } + }; + + class LabelColumn : public RowOrColumn + { + long getLabelWidth() const; + public: + LabelColumn( WindowArranger* i_pParent = NULL, long i_nBorderWidth = 5 ) + : RowOrColumn( i_pParent, true, i_nBorderWidth ) + {} + virtual ~LabelColumn(); + + virtual Size getOptimalSize( WindowSizeType ) const; + virtual void resize(); + + // returns the index of the added label + size_t addRow( Window* i_pLabel, boost::shared_ptr<WindowArranger> const& i_rElement, long i_nIndent = 0 ); + size_t addRow( Window* i_pLabel, Window* i_pElement, long i_nIndent = 0 ); + }; + + class Indenter : public WindowArranger + { + long m_nIndent; + WindowArranger::Element m_aElement; + + protected: + virtual Element* getElement( size_t i_nIndex ) + { return i_nIndex == 0 ? &m_aElement : NULL; } + + public: + Indenter( WindowArranger* i_pParent = NULL, long i_nIndent = 15 ) + : WindowArranger( i_pParent ) + , m_nIndent( i_nIndent ) + {} + + virtual ~Indenter(); + + virtual Size getOptimalSize( WindowSizeType ) const; + virtual void resize(); + virtual size_t countElements() const { return (m_aElement.m_pElement != 0 || m_aElement.m_pChild != 0) ? 1 : 0; } + + void setIndent( long i_nIndent ) + { + m_nIndent = i_nIndent; + resize(); + } + + void setWindow( Window*, sal_Int32 i_nExpandPrio = 0 ); + void setChild( boost::shared_ptr<WindowArranger> const &, sal_Int32 i_nExpandPrio = 0 ); + // convenience: use for setChild( new WindowArranger( ... ) ) constructs + void setChild( WindowArranger* i_pChild, sal_Int32 i_nExpandPrio = 0 ) + { setChild( boost::shared_ptr<WindowArranger>( i_pChild ), i_nExpandPrio ); } + }; + + class Spacer : public WindowArranger + { + WindowArranger::Element m_aElement; + Size m_aSize; + + protected: + virtual Element* getElement( size_t i_nIndex ) + { return i_nIndex == 0 ? &m_aElement : NULL; } + + public: + Spacer( WindowArranger* i_pParent = NULL, sal_Int32 i_nPrio = 20, const Size& i_rSize = Size( 0, 0 ) ) + : WindowArranger( i_pParent ) + , m_aElement( NULL, boost::shared_ptr<WindowArranger>(), i_nPrio ) + , m_aSize( i_rSize ) + {} + + virtual ~Spacer() {} + + virtual Size getOptimalSize( WindowSizeType ) const + { return m_aSize; } + virtual void resize() {} + virtual void setParentWindow( Window* ) {} + virtual size_t countElements() const { return 1; } + virtual bool isVisible() const { return true; } + }; + + class MatrixArranger : public WindowArranger + { + long m_nBorderX; + long m_nBorderY; + + struct MatrixElement : public WindowArranger::Element + { + sal_uInt32 m_nX; + sal_uInt32 m_nY; + + MatrixElement() + : WindowArranger::Element() + , m_nX( 0 ) + , m_nY( 0 ) + {} + + MatrixElement( Window* i_pWin, + sal_uInt32 i_nX, sal_uInt32 i_nY, + boost::shared_ptr<WindowArranger> const & i_pChild = boost::shared_ptr<WindowArranger>(), + sal_Int32 i_nExpandPriority = 0 + ) + : WindowArranger::Element( i_pWin, i_pChild, i_nExpandPriority ) + , m_nX( i_nX ) + , m_nY( i_nY ) + { + } + }; + + std::vector< MatrixElement > m_aElements; + std::map< sal_uInt64, size_t > m_aMatrixMap; // maps (x | (y << 32)) to index in m_aElements + + sal_uInt64 getMap( sal_uInt32 i_nX, sal_uInt32 i_nY ) + { return static_cast< sal_uInt64 >(i_nX) | (static_cast< sal_uInt64>(i_nY) << 32 ); } + + Size getOptimalSize( WindowSizeType, std::vector<long>& o_rColumnWidths, std::vector<long>& o_rRowHeights ) const; + protected: + virtual Element* getElement( size_t i_nIndex ) + { return i_nIndex < m_aElements.size() ? &m_aElements[ i_nIndex ] : 0; } + + public: + MatrixArranger( WindowArranger* i_pParent = NULL, + long i_nBorderX = 5, + long i_nBorderY = 5 ) + : WindowArranger( i_pParent ) + , m_nBorderX( i_nBorderX ) + , m_nBorderY( i_nBorderY ) + {} + + virtual ~MatrixArranger(); + + virtual Size getOptimalSize( WindowSizeType ) const; + virtual void resize(); + virtual size_t countElements() const { return m_aElements.size(); } + + // add a managed window at the given matrix position + size_t addWindow( Window*, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio = 0 ); + void remove( Window* ); + + size_t addChild( boost::shared_ptr<WindowArranger> const &, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio = 0 ); + // convenience: use for addChild( new WindowArranger( ... ) ) constructs + size_t addChild( WindowArranger* i_pNewChild, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio = 0 ) + { return addChild( boost::shared_ptr<WindowArranger>( i_pNewChild ), i_nX, i_nY, i_nExpandPrio ); } + void remove( boost::shared_ptr<WindowArranger> const & ); + }; + +} + +#endif + diff --git a/vcl/inc/vcl/bitmapex.hxx b/vcl/inc/vcl/bitmapex.hxx index 3da80ce8c2f1..e5ddf50f1efa 100644 --- a/vcl/inc/vcl/bitmapex.hxx +++ b/vcl/inc/vcl/bitmapex.hxx @@ -381,6 +381,19 @@ public: const BmpFilterParam* pFilterParam = NULL, const Link* pProgress = NULL ); + /** Get transparency at given position + + @param nX + integer X-Position in Bitmap + + @param nY + integer Y-Position in Bitmap + + @return transparency value in the range of [0 .. 255] where + 0 is not transparent, 255 is fully transparent + */ + sal_uInt8 GetTransparency(sal_Int32 nX, sal_Int32 nY) const; + public: friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx ); diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx index 94df24a9cea7..b5f70217e149 100644 --- a/vcl/inc/vcl/button.hxx +++ b/vcl/inc/vcl/button.hxx @@ -144,10 +144,10 @@ protected: SAL_DLLPRIVATE PushButton( const PushButton & ); SAL_DLLPRIVATE PushButton& operator=( const PushButton & ); -protected: - using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); + using Control::ImplInitSettings; + using Window::ImplInit; public: SAL_DLLPRIVATE void ImplSetDefButton( BOOL bSet ); SAL_DLLPRIVATE static void ImplDrawPushButtonFrame( Window* pDev, Rectangle& rRect, USHORT nStyle ); @@ -158,6 +158,10 @@ protected: PushButton( WindowType nType ); virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; public: PushButton( Window* pParent, WinBits nStyle = 0 ); PushButton( Window* pParent, const ResId& rResId ); @@ -307,19 +311,20 @@ private: SAL_DLLPRIVATE void ImplDrawRadioButtonState(); SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, const Point& rPos, const Size& rSize, - const Size& rImageSize, long nImageSep, - Rectangle& rStateRect, Rectangle& rMouseRect, - bool bLayout = false ); + const Size& rImageSize, Rectangle& rStateRect, + Rectangle& rMouseRect, bool bLayout = false ); SAL_DLLPRIVATE void ImplDrawRadioButton( bool bLayout = false ); SAL_DLLPRIVATE void ImplInvalidateOrDrawRadioButtonState(); SAL_DLLPRIVATE void ImplUncheckAllOther(); SAL_DLLPRIVATE Size ImplGetRadioImageSize() const; + SAL_DLLPRIVATE long ImplGetImageToTextDistance() const; // Copy assignment is forbidden and not implemented. SAL_DLLPRIVATE RadioButton(const RadioButton &); SAL_DLLPRIVATE RadioButton& operator= (const RadioButton &); protected: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); @@ -330,6 +335,10 @@ public: protected: virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; inline void SetMouseRect( const Rectangle& _rMouseRect ) { maMouseRect = _rMouseRect; } inline const Rectangle& GetMouseRect( ) const { return maMouseRect; } @@ -416,14 +425,13 @@ private: SAL_DLLPRIVATE void ImplInitCheckBoxData(); SAL_DLLPRIVATE WinBits ImplInitStyle( const Window* pPrevWindow, WinBits nStyle ); SAL_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); - SAL_DLLPRIVATE void ImplDrawCheckBoxState(); SAL_DLLPRIVATE void ImplInvalidateOrDrawCheckBoxState(); SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, const Point& rPos, const Size& rSize, - const Size& rImageSize, long nImageSep, - Rectangle& rStateRect, + const Size& rImageSize, Rectangle& rStateRect, Rectangle& rMouseRect, bool bLayout ); SAL_DLLPRIVATE void ImplDrawCheckBox( bool bLayout = false ); + SAL_DLLPRIVATE long ImplGetImageToTextDistance() const; SAL_DLLPRIVATE Size ImplGetCheckImageSize() const; // Copy assignment is forbidden and not implemented. @@ -431,15 +439,22 @@ private: SAL_DLLPRIVATE CheckBox& operator= (const CheckBox &); protected: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); SAL_DLLPRIVATE virtual void FillLayoutData() const; - + SAL_DLLPRIVATE virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + SAL_DLLPRIVATE virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; + + SAL_DLLPRIVATE virtual void ImplDrawCheckBoxState(); + SAL_DLLPRIVATE const Rectangle& GetStateRect() const { return maStateRect; } + SAL_DLLPRIVATE const Rectangle& GetMouseRect() const { return maMouseRect; } public: SAL_DLLPRIVATE void ImplCheck(); SAL_DLLPRIVATE void ImplSetMinimumNWFSize(); - public: CheckBox( Window* pParent, WinBits nStyle = 0 ); CheckBox( Window* pParent, const ResId& rResId ); @@ -538,4 +553,15 @@ public: ~TriStateBox(); }; +class VCL_DLLPUBLIC DisclosureButton : public CheckBox +{ +protected: + SAL_DLLPRIVATE virtual void ImplDrawCheckBoxState(); +public: + DisclosureButton( Window* pParent, WinBits nStyle = 0 ); + DisclosureButton( Window* pParent, const ResId& rResId ); + + virtual void KeyInput( const KeyEvent& rKEvt ); +}; + #endif // _SV_BUTTON_HXX diff --git a/vcl/inc/vcl/configsettings.hxx b/vcl/inc/vcl/configsettings.hxx index aee684a84ca4..211ea3f0892b 100644 --- a/vcl/inc/vcl/configsettings.hxx +++ b/vcl/inc/vcl/configsettings.hxx @@ -54,7 +54,6 @@ namespace vcl std::hash_map< rtl::OUString, SmallOUStrMap, rtl::OUStringHash > m_aSettings; virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames ); - virtual void Commit(); void getValues(); SettingsConfigItem(); @@ -65,6 +64,8 @@ namespace vcl const rtl::OUString& getValue( const rtl::OUString& rGroup, const rtl::OUString& rKey ) const; void setValue( const rtl::OUString& rGroup, const rtl::OUString& rKey, const rtl::OUString& rValue ); + + virtual void Commit(); }; //........................................................................ diff --git a/vcl/inc/vcl/controldata.hxx b/vcl/inc/vcl/controldata.hxx new file mode 100644 index 000000000000..9ea698e792bd --- /dev/null +++ b/vcl/inc/vcl/controldata.hxx @@ -0,0 +1,60 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ +
+#ifndef VCL_CONTROLDATA_HXX +#define VCL_CONTROLDATA_HXX + +#include <vcl/controllayout.hxx> + +//........................................................................ +namespace vcl +{ +//........................................................................ + + //==================================================================== + //= ImplControlData + //==================================================================== + struct ImplControlData + { + mutable ControlLayoutData* mpLayoutData; + OutputDevice* mpReferenceDevice; + + ImplControlData() + :mpLayoutData( NULL ) + ,mpReferenceDevice( NULL ) + { + } + + ~ImplControlData() + { + delete mpLayoutData; + } + }; + +//........................................................................ +} // namespace vcl +//........................................................................ + +#endif // VCL_CONTROLDATA_HXX diff --git a/vcl/inc/vcl/ctrl.hxx b/vcl/inc/vcl/ctrl.hxx index 7bb5620ef93f..535f75549991 100644 --- a/vcl/inc/vcl/ctrl.hxx +++ b/vcl/inc/vcl/ctrl.hxx @@ -38,7 +38,7 @@ #include <vcl/salnativewidgets.hxx> // forward -namespace vcl { struct ControlLayoutData; } +namespace vcl { struct ImplControlData; struct ControlLayoutData; } // ----------- // - Control - @@ -47,11 +47,12 @@ namespace vcl { struct ControlLayoutData; } class VCL_DLLPUBLIC Control : public Window { protected: - mutable vcl::ControlLayoutData* mpLayoutData; + ::vcl::ImplControlData* mpControlData; + private: - BOOL mbHasFocus; - Link maGetFocusHdl; - Link maLoseFocusHdl; + BOOL mbHasFocus; + Link maGetFocusHdl; + Link maLoseFocusHdl; SAL_DLLPRIVATE void ImplInitControlData(); @@ -66,6 +67,14 @@ protected: // helper method for composite controls void AppendLayoutData( const Control& rSubControl ) const; + /// creates the mpData->mpLayoutData structure + void CreateLayoutData() const; + /// determines whether we currently have layout data + bool HasLayoutData() const; + /// returns the current layout data + ::vcl::ControlLayoutData* + GetLayoutData() const; + /** this calls both our event listeners, and a specified handler If the Control instance is destroyed during any of those calls, the @@ -84,6 +93,25 @@ protected: ULONG nEvent, const Link& rHandler, void* pCaller ); + /** draws the given text onto the given device + + If no reference device is set, the draw request will simply be forwarded to OutputDevice::DrawText. Otherwise, + the text will be rendered according to the metrics at the reference device. + + Note that the given rectangle might be modified, it will contain the result of a GetTextRect call (either + directly at the target device, or taking the reference device into account) when returning. + */ + void DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, + const XubString& _rStr, USHORT _nStyle, + MetricVector* _pVector, String* _pDisplayText ) const; + + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; + + void ImplInitSettings( const BOOL _bFont, const BOOL _bForeground ); + //#if 0 // _SOLAR__PRIVATE public: SAL_DLLPRIVATE void ImplClearLayoutData() const; @@ -157,6 +185,20 @@ public: void SetLayoutDataParent( const Control* pParent ) const; virtual Size GetOptimalSize(WindowSizeType eType) const; + + /** sets a reference device used for rendering control text + @seealso DrawControlText + */ + void SetReferenceDevice( OutputDevice* _referenceDevice ); + OutputDevice* GetReferenceDevice() const; + + Font GetUnzoomedControlPointFont() const + { + Font aFont( GetCanonicalFont( GetSettings().GetStyleSettings() ) ); + if ( IsControlFont() ) + aFont.Merge( GetControlFont() ); + return aFont; + } }; #endif // _SV_CTRL_HXX diff --git a/vcl/inc/vcl/cvtsvm.hxx b/vcl/inc/vcl/cvtsvm.hxx index 8a17015d99cf..c6f4f2c9a126 100644 --- a/vcl/inc/vcl/cvtsvm.hxx +++ b/vcl/inc/vcl/cvtsvm.hxx @@ -85,6 +85,10 @@ #define GDI_COMMENT_COMMENT 1031 #define GDI_UNICODE_COMMENT 1032 +#define GDI_LINEJOIN_ACTION 1033 +#define GDI_EXTENDEDPOLYGON_ACTION 1034 +#define GDI_LINEDASHDOT_ACTION 1035 + // ---------------- // - SVMConverter - // ---------------- diff --git a/vcl/inc/vcl/dialog.hxx b/vcl/inc/vcl/dialog.hxx index f34db3a2a5db..c5f032dfff82 100644 --- a/vcl/inc/vcl/dialog.hxx +++ b/vcl/inc/vcl/dialog.hxx @@ -65,6 +65,7 @@ private: SAL_DLLPRIVATE Dialog (const Dialog &); SAL_DLLPRIVATE Dialog & operator= (const Dialog &); + DECL_DLLPRIVATE_LINK( ImplAsyncCloseHdl, void* ); protected: using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); diff --git a/vcl/inc/vcl/edit.hxx b/vcl/inc/vcl/edit.hxx index 534d63b3427c..ad6a4ee017d9 100644 --- a/vcl/inc/vcl/edit.hxx +++ b/vcl/inc/vcl/edit.hxx @@ -120,10 +120,12 @@ private: SAL_DLLPRIVATE void ImplCopy( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard ); SAL_DLLPRIVATE void ImplPaste( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard ); SAL_DLLPRIVATE long ImplGetExtraOffset() const; + SAL_DLLPRIVATE long ImplGetTextYPosition() const; SAL_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XExtendedInputSequenceChecker > ImplGetInputSequenceChecker() const; SAL_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > ImplGetBreakIterator() const; protected: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); diff --git a/vcl/inc/vcl/fixbrd.hxx b/vcl/inc/vcl/fixbrd.hxx index 52de68d1c71f..68e1e69b9054 100644 --- a/vcl/inc/vcl/fixbrd.hxx +++ b/vcl/inc/vcl/fixbrd.hxx @@ -57,6 +57,7 @@ private: BOOL mbTransparent; private: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); diff --git a/vcl/inc/vcl/fixed.hxx b/vcl/inc/vcl/fixed.hxx index ba576f280b83..d6ffc1625afe 100644 --- a/vcl/inc/vcl/fixed.hxx +++ b/vcl/inc/vcl/fixed.hxx @@ -47,6 +47,7 @@ class VCL_DLLPUBLIC FixedText : public Control { //#if 0 // _SOLAR__PRIVATE private: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); @@ -58,6 +59,11 @@ public: //#endif protected: virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; + public: FixedText( Window* pParent, WinBits nStyle = 0 ); FixedText( Window* pParent, const ResId& rResId ); @@ -81,6 +87,7 @@ public: class VCL_DLLPUBLIC FixedLine : public Control { private: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); @@ -89,6 +96,10 @@ private: protected: virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; public: FixedLine( Window* pParent, WinBits nStyle = WB_HORZ ); @@ -113,6 +124,7 @@ private: Bitmap maBitmap; Bitmap maBitmapHC; + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); @@ -153,6 +165,7 @@ private: BOOL mbInUserDraw; private: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); @@ -174,6 +187,7 @@ public: virtual void StateChanged( StateChangedType nType ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); virtual void UserDraw( const UserDrawEvent& rUDEvt ); + virtual Size GetOptimalSize(WindowSizeType eType) const; void SetImage( const Image& rImage ); const Image& GetImage() const { return maImage; } diff --git a/vcl/inc/vcl/fldunit.hxx b/vcl/inc/vcl/fldunit.hxx index 98bc27cbadba..7417342d95be 100644 --- a/vcl/inc/vcl/fldunit.hxx +++ b/vcl/inc/vcl/fldunit.hxx @@ -31,14 +31,6 @@ #ifndef _VCL_FLDUNIT_HXX #define _VCL_FLDUNIT_HXX -// -------------- -// - FieldTypes - -// -------------- - -// By changes you must also change: rsc/vclrsc.hxx -enum FieldUnit { FUNIT_NONE, FUNIT_MM, FUNIT_CM, FUNIT_M, FUNIT_KM, - FUNIT_TWIP, FUNIT_POINT, FUNIT_PICA, - FUNIT_INCH, FUNIT_FOOT, FUNIT_MILE, FUNIT_CUSTOM, - FUNIT_PERCENT, FUNIT_100TH_MM }; +#include <tools/fldunit.hxx> #endif // _VCL_FLDUNIT_HXX diff --git a/vcl/inc/vcl/gdimtf.hxx b/vcl/inc/vcl/gdimtf.hxx index c53460d35584..e4acd55439cc 100644 --- a/vcl/inc/vcl/gdimtf.hxx +++ b/vcl/inc/vcl/gdimtf.hxx @@ -164,6 +164,7 @@ public: void Scale( double fScaleX, double fScaleY ); void Scale( const Fraction& rScaleX, const Fraction& rScaleY ); void Rotate( long nAngle10 ); + void Clip( const Rectangle& ); /* get the bound rect of the contained actions * caveats: * - clip actions will limit the contained actions, diff --git a/vcl/inc/vcl/group.hxx b/vcl/inc/vcl/group.hxx index 0e84344587c7..7d5dd43fbee3 100644 --- a/vcl/inc/vcl/group.hxx +++ b/vcl/inc/vcl/group.hxx @@ -42,6 +42,7 @@ class VCL_DLLPUBLIC GroupBox : public Control { private: + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE WinBits ImplInitStyle( WinBits nStyle ); @@ -50,6 +51,10 @@ private: const Point& rPos, const Size& rSize, bool bLayout = false ); virtual void FillLayoutData() const; + virtual const Font& + GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& + GetCanonicalTextColor( const StyleSettings& _rStyle ) const; public: GroupBox( Window* pParent, WinBits nStyle = 0 ); diff --git a/vcl/inc/vcl/ilstbox.hxx b/vcl/inc/vcl/ilstbox.hxx index e5f6696005fa..81dd32ef2705 100644 --- a/vcl/inc/vcl/ilstbox.hxx +++ b/vcl/inc/vcl/ilstbox.hxx @@ -369,6 +369,7 @@ public: void SetReadOnly( BOOL bReadOnly ) { mbReadOnly = bReadOnly; } BOOL IsReadOnly() const { return mbReadOnly; } + using Control::ImplInitSettings; void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); USHORT ImplGetTextStyle() const; diff --git a/vcl/inc/vcl/impimagetree.hxx b/vcl/inc/vcl/impimagetree.hxx index dfbcb366fe6a..92761eabdf3c 100644 --- a/vcl/inc/vcl/impimagetree.hxx +++ b/vcl/inc/vcl/impimagetree.hxx @@ -54,14 +54,17 @@ public: ~ImplImageTree(); + // check whether the icon style is installed + bool checkStyle(rtl::OUString const & style); + bool loadImage( rtl::OUString const & name, rtl::OUString const & style, - BitmapEx & bitmap, bool localized = false); + BitmapEx & bitmap, bool localized = false ); void shutDown(); // a crude form of life cycle control (called from DeInitVCL; otherwise, // if the ImplImageTree singleton were destroyed during exit that would - // be too late for the destructors of the bitmaps in m_cache) + // be too late for the destructors of the bitmaps in m_iconCache) private: typedef std::list< @@ -71,20 +74,23 @@ private: com::sun::star::container::XNameAccess > > > Zips; typedef std::hash_map< - rtl::OUString, std::pair< bool, BitmapEx >, rtl::OUStringHash > Cache; + rtl::OUString, bool, rtl::OUStringHash > CheckStyleCache; + typedef std::hash_map< + rtl::OUString, std::pair< bool, BitmapEx >, rtl::OUStringHash > IconCache; rtl::OUString m_style; Zips m_zips; - Cache m_cache; + CheckStyleCache m_checkStyleCache; + IconCache m_iconCache; - void setStyle(rtl::OUString const & style); + void setStyle(rtl::OUString const & style ); void resetZips(); - bool cacheLookup( - rtl::OUString const & name, bool localized, BitmapEx & bitmap); + bool checkStyleCacheLookup( rtl::OUString const & style, bool &exists ); + bool iconCacheLookup( rtl::OUString const & name, bool localized, BitmapEx & bitmap ); - bool find(std::vector< rtl::OUString > const & paths, BitmapEx & bitmap); + bool find(std::vector< rtl::OUString > const & paths, BitmapEx & bitmap ); }; typedef salhelper::SingletonRef< ImplImageTree > ImplImageTreeSingletonRef; diff --git a/vcl/inc/vcl/impprn.hxx b/vcl/inc/vcl/impprn.hxx index c86090e8b49f..0cd6e9688201 100644 --- a/vcl/inc/vcl/impprn.hxx +++ b/vcl/inc/vcl/impprn.hxx @@ -28,7 +28,7 @@ * ************************************************************************/ -#ifndef _SV_IMPPRN_HXX +#if 0 #define _SV_IMPPRN_HXX #include <vcl/print.hxx> @@ -107,7 +107,6 @@ public: /** used by pull implementation to emit the next page */ - using Printer::PrintPage; void PrintPage( unsigned int nPage ); /** used by pull implementation to get the number of physical pages diff --git a/vcl/inc/vcl/jobdata.hxx b/vcl/inc/vcl/jobdata.hxx index 4451c566b5bf..d328f41f5b5b 100644 --- a/vcl/inc/vcl/jobdata.hxx +++ b/vcl/inc/vcl/jobdata.hxx @@ -74,6 +74,8 @@ struct JobData JobData( const JobData& rData ) { *this = rData; } + void setCollate( bool bCollate ); + // creates a new buffer using new // it is up to the user to delete it again bool getStreamBuffer( void*& pData, int& bytes ); diff --git a/vcl/inc/vcl/jobset.h b/vcl/inc/vcl/jobset.h index 9f3eefd507d5..fd15d0c076da 100644 --- a/vcl/inc/vcl/jobset.h +++ b/vcl/inc/vcl/jobset.h @@ -60,12 +60,13 @@ struct ImplJobSetup String maPrinterName; // Printer-Name String maDriver; // Driver-Name Orientation meOrientation; // Orientation - USHORT mnPaperBin; // Papierschacht - Paper mePaperFormat; // Papierformat - long mnPaperWidth; // Papierbreite in 100tel mm - long mnPaperHeight; // Papierhoehe in 100tel mm - ULONG mnDriverDataLen; // Laenge der systemabhaengigen Daten - BYTE* mpDriverData; // Systemabhaengige Daten die als Byte-Block rausgeschrieben werden + DuplexMode meDuplexMode; // Duplex + USHORT mnPaperBin; // paper bin / in tray + Paper mePaperFormat; // paper format + long mnPaperWidth; // paper width (100th mm) + long mnPaperHeight; // paper height (100th mm) + ULONG mnDriverDataLen; // length of system specific data + BYTE* mpDriverData; // system specific data (will be streamed a byte block) ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > maValueMap; ImplJobSetup(); diff --git a/vcl/inc/vcl/lineinfo.hxx b/vcl/inc/vcl/lineinfo.hxx index 60fdc3a3a0b0..33758046c41e 100644 --- a/vcl/inc/vcl/lineinfo.hxx +++ b/vcl/inc/vcl/lineinfo.hxx @@ -32,26 +32,29 @@ #define _SV_LINEINFO_HXX #include <vcl/dllapi.h> - #include <tools/gen.hxx> #include <vcl/vclenum.hxx> +#include <basegfx/vector/b2enums.hxx> // ---------------- // - ImplLineInfo - // ---------------- class SvStream; +namespace basegfx { class B2DPolyPolygon; } struct ImplLineInfo { - ULONG mnRefCount; - LineStyle meStyle; - long mnWidth; - USHORT mnDashCount; - long mnDashLen; - USHORT mnDotCount; - long mnDotLen; - long mnDistance; + ULONG mnRefCount; + LineStyle meStyle; + long mnWidth; + USHORT mnDashCount; + long mnDashLen; + USHORT mnDotCount; + long mnDotLen; + long mnDistance; + + basegfx::B2DLineJoin meLineJoin; ImplLineInfo(); ImplLineInfo( const ImplLineInfo& rImplLineInfo ); @@ -107,10 +110,26 @@ public: void SetDistance( long nDistance ); long GetDistance() const { return mpImplLineInfo->mnDistance; } + void SetLineJoin(basegfx::B2DLineJoin eLineJoin); + basegfx::B2DLineJoin GetLineJoin() const { return mpImplLineInfo->meLineJoin; } + BOOL IsDefault() const { return( !mpImplLineInfo->mnWidth && ( LINE_SOLID == mpImplLineInfo->meStyle ) ); } friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, LineInfo& rLineInfo ); friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const LineInfo& rLineInfo ); + + // helper to check if line width or DashDot is used + bool isDashDotOrFatLineUsed() const; + + // helper to get decomposed polygon data with the LineInfo applied. The source + // hairline polygon is given in io_rLinePolyPolygon. Both given polygons may + // contain results; e.g. when no fat line but DasDot is defined, the resut will + // be in io_rLinePolyPolygon while o_rFillPolyPolygon will be empty. When fat line + // is defined, it will be vice-versa. If none is defined, io_rLinePolyPolygon will + // not be changed (but o_rFillPolyPolygon will be freed) + void applyToB2DPolyPolygon( + basegfx::B2DPolyPolygon& io_rLinePolyPolygon, + basegfx::B2DPolyPolygon& o_rFillPolyPolygon) const; }; #endif // _SV_LINEINFO_HXX diff --git a/vcl/inc/vcl/lstbox.h b/vcl/inc/vcl/lstbox.h index 6097422b556b..9b95b9526d58 100644 --- a/vcl/inc/vcl/lstbox.h +++ b/vcl/inc/vcl/lstbox.h @@ -60,4 +60,9 @@ */ #define LISTBOX_ENTRY_FLAG_MULTILINE 0x0000002 +/** this flags lets the item be drawn disabled (e.g. in grey text) + usage only guaranteed with LISTBOX_ENTRY_FLAG_DISABLE_SELECTION +*/ +#define LISTBOX_ENTRY_FLAG_DRAW_DISABLED 0x0000004 + #endif // _SV_LSTBOX_H diff --git a/vcl/inc/vcl/mapunit.hxx b/vcl/inc/vcl/mapunit.hxx index 6ba500f4fdb7..c50ba49c17bb 100644 --- a/vcl/inc/vcl/mapunit.hxx +++ b/vcl/inc/vcl/mapunit.hxx @@ -31,14 +31,6 @@ #ifndef _VCL_MAPUNIT_HXX #define _VCL_MAPUNIT_HXX -// ----------------- -// - MapMode-Types - -// ----------------- - -// By changes you must also change: rsc/vclrsc.hxx -enum MapUnit { MAP_100TH_MM, MAP_10TH_MM, MAP_MM, MAP_CM, - MAP_1000TH_INCH, MAP_100TH_INCH, MAP_10TH_INCH, MAP_INCH, - MAP_POINT, MAP_TWIP, MAP_PIXEL, MAP_SYSFONT, MAP_APPFONT, - MAP_RELATIVE, MAP_REALAPPFONT, MAP_LASTENUMDUMMY }; +#include <tools/mapunit.hxx> #endif // _VCL_MAPUNIT_HXX diff --git a/vcl/inc/vcl/menu.hxx b/vcl/inc/vcl/menu.hxx index 8d3ac4e8b505..66f35823b06a 100644 --- a/vcl/inc/vcl/menu.hxx +++ b/vcl/inc/vcl/menu.hxx @@ -93,6 +93,8 @@ typedef USHORT MenuItemBits; #define MIB_POPUPSELECT ((MenuItemBits)0x0020) // not in rsc/vclsrc.hxx because only a prelimitary solution #define MIB_NOSELECT ((MenuItemBits)0x0040) +#define MIB_ICON ((MenuItemBits)0x0080) +#define MIB_TEXT ((MenuItemBits)0x0100) #define MENU_FLAG_NOAUTOMNEMONICS 0x0001 #define MENU_FLAG_HIDEDISABLEDENTRIES 0x0002 diff --git a/svtools/inc/svtools/options.hxx b/vcl/inc/vcl/oldprintadaptor.hxx index 33ba515af67d..d8b26433af94 100644 --- a/svtools/inc/svtools/options.hxx +++ b/vcl/inc/vcl/oldprintadaptor.hxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: options.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -28,28 +25,28 @@ * ************************************************************************/ -#ifndef INCLUDED_SVTOOLS_OPTIONS_HXX -#define INCLUDED_SVTOOLS_OPTIONS_HXX - -#include "sal/config.h" -#include "svtools/svldllapi.h" - -namespace svt { namespace detail { - -// A base class for the various option classes supported by -// svtools/source/config/itemholderbase.hxx (which must be public, as it is -// shared between svl and svt): -class SVL_DLLPUBLIC Options { -public: - Options(); - - virtual ~Options() = 0; - -private: - SVL_DLLPRIVATE Options(Options &); // not defined - SVL_DLLPRIVATE void operator =(Options &); // not defined -}; - -} } +#ifndef _VCL_OLDPRINTADAPTOR +#define _VCL_OLDPRINTADAPTOR + +#include "vcl/print.hxx" + +namespace vcl +{ + struct ImplOldStyleAdaptorData; + class VCL_DLLPUBLIC OldStylePrintAdaptor : public PrinterController + { + ImplOldStyleAdaptorData* mpData; + public: + OldStylePrintAdaptor( const boost::shared_ptr< Printer >& ); + virtual ~OldStylePrintAdaptor(); + + void StartPage(); + void EndPage(); + + virtual int getPageCount() const; + virtual com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > getPageParameters( int i_nPage ) const; + virtual void printPage( int i_nPage ) const; + }; +} #endif diff --git a/vcl/inc/vcl/outdev.h b/vcl/inc/vcl/outdev.h index af671e24ee0a..67dc256ce11c 100644 --- a/vcl/inc/vcl/outdev.h +++ b/vcl/inc/vcl/outdev.h @@ -31,7 +31,7 @@ #ifndef _SV_OUTDEV_H #define _SV_OUTDEV_H -#include <vcl/sv.h> +#include <tools/solar.h> #include <vcl/outfont.hxx> #include <vector> @@ -44,13 +44,6 @@ class VirtualDevice; class ImplServerGraphics; class ImplGetDevFontList; class GetDevSizeList; -namespace vcl { -class FontSubstConfiguration; -} - -// ----------------------------------------------------------------------- - -void ImplGetEnglishSearchFontName( String& rName ); // ----------------------- // - ImplDevFontListData - @@ -80,7 +73,7 @@ public: int GetMinQuality() const { return mnMinQuality; } bool AddFontFace( ImplFontData* ); - void InitMatchData( const vcl::FontSubstConfiguration&, + void InitMatchData( const utl::FontSubstConfiguration&, const String& rSearchName ); ImplFontData* FindBestFontFace( const ImplFontSelectData& rFSD ) const; @@ -106,24 +99,6 @@ friend class ImplDevFontList; // TODO: remove soon }; -// --------------- -// - ImplCvtChar - -// --------------- - -class ImplCvtChar -{ -public: - const sal_Unicode* mpCvtTab; - const char* mpSubsFontName; - sal_Unicode (*mpCvtFunc)( sal_Unicode ); -}; - -sal_Unicode ImplRecodeChar( const ImplCvtChar* pCvtData, sal_Unicode c ); -void ImplRecodeString( const ImplCvtChar* pCvtData, String& rStr, - xub_StrLen nIndex, xub_StrLen nLen ); -const ImplCvtChar* ImplGetRecodeData( const String& rOrgFontName, - const String& rMapFontName ); - // ---------------------- // - ImplGetDevFontList - // ---------------------- diff --git a/vcl/inc/vcl/outdev.hxx b/vcl/inc/vcl/outdev.hxx index f4e42846dd5e..0c03652d9300 100644 --- a/vcl/inc/vcl/outdev.hxx +++ b/vcl/inc/vcl/outdev.hxx @@ -45,6 +45,7 @@ #include <tools/poly.hxx> #include <basegfx/vector/b2enums.hxx> #include <com/sun/star/uno/Reference.h> +#include <unotools/fontdefs.hxx> #include <vector> @@ -103,8 +104,12 @@ namespace awt { typedef std::vector< Rectangle > MetricVector; -namespace vcl { class PDFWriterImpl; } -namespace vcl { class ExtOutDevData; } +namespace vcl +{ + class PDFWriterImpl; + class ExtOutDevData; + class ITextLayout; +} #define OUTDEV_BUFFER_SIZE 128 @@ -260,31 +265,6 @@ struct KerningPair #define FONT_SUBSTITUTE_ALWAYS ((USHORT)0x0001) #define FONT_SUBSTITUTE_SCREENONLY ((USHORT)0x0002) -// Default-Font -#define DEFAULTFONT_SANS_UNICODE ((USHORT)1) -#define DEFAULTFONT_SANS ((USHORT)2) -#define DEFAULTFONT_SERIF ((USHORT)3) -#define DEFAULTFONT_FIXED ((USHORT)4) -#define DEFAULTFONT_SYMBOL ((USHORT)5) -#define DEFAULTFONT_UI_SANS ((USHORT)1000) -#define DEFAULTFONT_UI_FIXED ((USHORT)1001) -#define DEFAULTFONT_LATIN_TEXT ((USHORT)2000) -#define DEFAULTFONT_LATIN_PRESENTATION ((USHORT)2001) -#define DEFAULTFONT_LATIN_SPREADSHEET ((USHORT)2002) -#define DEFAULTFONT_LATIN_HEADING ((USHORT)2003) -#define DEFAULTFONT_LATIN_DISPLAY ((USHORT)2004) -#define DEFAULTFONT_LATIN_FIXED ((USHORT)2005) -#define DEFAULTFONT_CJK_TEXT ((USHORT)3000) -#define DEFAULTFONT_CJK_PRESENTATION ((USHORT)3001) -#define DEFAULTFONT_CJK_SPREADSHEET ((USHORT)3002) -#define DEFAULTFONT_CJK_HEADING ((USHORT)3003) -#define DEFAULTFONT_CJK_DISPLAY ((USHORT)3004) -#define DEFAULTFONT_CTL_TEXT ((USHORT)4000) -#define DEFAULTFONT_CTL_PRESENTATION ((USHORT)4001) -#define DEFAULTFONT_CTL_SPREADSHEET ((USHORT)4002) -#define DEFAULTFONT_CTL_HEADING ((USHORT)4003) -#define DEFAULTFONT_CTL_DISPLAY ((USHORT)4004) - #define DEFAULTFONT_FLAGS_ONLYONE ((ULONG)0x00000001) enum OutDevType { OUTDEV_DONTKNOW, OUTDEV_WINDOW, OUTDEV_PRINTER, OUTDEV_VIRDEV }; @@ -431,9 +411,13 @@ public: SAL_DLLPRIVATE SalLayout* ImplGlyphFallbackLayout( SalLayout*, ImplLayoutArgs& ) const; SAL_DLLPRIVATE long ImplGetTextWidth( const SalLayout& ) const; - SAL_DLLPRIVATE void ImplDrawText( const Rectangle& rRect, + static + SAL_DLLPRIVATE XubString ImplGetEllipsisString( const OutputDevice& rTargetDevice, const XubString& rStr, + long nMaxWidth, USHORT nStyle, const ::vcl::ITextLayout& _rLayout ); + static + SAL_DLLPRIVATE void ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, - MetricVector* pVector, String* pDisplayText ); + MetricVector* pVector, String* pDisplayText, ::vcl::ITextLayout& _rLayout ); SAL_DLLPRIVATE void ImplDrawTextBackground( const SalLayout& ); SAL_DLLPRIVATE void ImplDrawTextLines( SalLayout&, FontStrikeout eStrikeout, FontUnderline eUnderline, FontUnderline eOverline, BOOL bWordLine, BOOL bUnderlineAbove ); SAL_DLLPRIVATE bool ImplDrawRotateText( SalLayout& ); @@ -456,7 +440,8 @@ public: 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 ); - SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, USHORT nStyle ) const; + static + SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, USHORT nStyle, const ::vcl::ITextLayout& _rLayout ); SAL_DLLPRIVATE void ImplInitFontList() const; SAL_DLLPRIVATE void ImplUpdateFontData( bool bNewFontLists ); SAL_DLLPRIVATE static void ImplUpdateAllFontData( bool bNewFontLists ); @@ -577,6 +562,9 @@ public: // Helper who tries to use SalGDI's DrawPolyLine direct and returns it's bool. Contains no AA check. SAL_DLLPRIVATE bool ImpTryDrawPolyLineDirect(const basegfx::B2DPolygon& rB2DPolygon, double fLineWidth, basegfx::B2DLineJoin eLineJoin); + // Helper for line geometry paint with support for graphic expansion (pattern and fat_to_area) + void impPaintLineGeometryWithEvtlExpand(const LineInfo& rInfo, basegfx::B2DPolyPolygon aLinePolyPolygon); + protected: OutputDevice(); @@ -649,10 +637,12 @@ public: GDIMetaFile& rMtf ); void DrawText( const Rectangle& rRect, const XubString& rStr, USHORT nStyle = 0, - MetricVector* pVector = NULL, String* pDisplayText = NULL ); + MetricVector* pVector = NULL, String* pDisplayText = NULL, + ::vcl::ITextLayout* _pTextLayout = NULL ); Rectangle GetTextRect( const Rectangle& rRect, const XubString& rStr, USHORT nStyle = TEXT_DRAW_WORDBREAK, - TextRectInfo* pInfo = NULL ) const; + TextRectInfo* pInfo = NULL, + const ::vcl::ITextLayout* _pTextLayout = NULL ) const; XubString GetEllipsisString( const XubString& rStr, long nMaxWidth, USHORT nStyle = TEXT_DRAW_ENDELLIPSIS ) const; void DrawCtrlText( const Point& rPos, const XubString& rStr, @@ -1101,7 +1091,12 @@ public: */ BOOL HasAlpha(); - void DrawEPS( const Point& rPt, const Size& rSz, + /** Added return value to see if EPS could be painted directly. + Theoreticaly, handing over a matrix would be needed to handle + painting rotated EPS files (e.g. contained mn Metafiles). This + would then need to be supported for Mac and PS printers, but + that's too much for now, wrote #i107046# for this */ + bool DrawEPS( const Point& rPt, const Size& rSz, const GfxLink& rGfxLink, GDIMetaFile* pSubst = NULL ); /// request XCanvas render interface for this OutputDevice @@ -1136,12 +1131,15 @@ public: false: output metafile is unchanged input metafile @attention this is a member method, so current state can influence the result ! + @attention the output metafile is prepared in pixel mode for the currentOutputDevice + state. It can not be moved or rotated reliably anymore. */ bool RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf, long nMaxBmpDPIX, long nMaxBmpDPIY, bool bReduceTransparency, bool bTransparencyAutoMode, - bool bDownsampleBitmaps + bool bDownsampleBitmaps, + const Color& rBackground = Color( COL_TRANSPARENT ) ); /** Retrieve downsampled and cropped bitmap diff --git a/vcl/inc/vcl/outfont.hxx b/vcl/inc/vcl/outfont.hxx index 88316130cc3a..b72e78994a75 100644 --- a/vcl/inc/vcl/outfont.hxx +++ b/vcl/inc/vcl/outfont.hxx @@ -32,9 +32,9 @@ #include <tools/list.hxx> #include <i18npool/lang.h> #include <tools/gen.hxx> -#include <vcl/sv.h> +#include <tools/solar.h> #include <vcl/dllapi.h> - +#include <unotools/fontdefs.hxx> #include <vcl/vclenum.hxx> #include <hash_map> @@ -48,14 +48,10 @@ class ImplPreMatchFontSubstitution; class ImplGlyphFallbackFontSubstitution; class ImplFontSelectData; class Font; -class ImplCvtChar; +class ConvertChar; struct FontMatchStatus; class OutputDevice; -namespace vcl { - struct FontNameAttr; -} - // ---------------------- // - ImplFontAttributes - // ---------------------- @@ -185,8 +181,6 @@ public: // TODO: change to private ImplFontEntry* mpFontEntry; // pointer to the resulting FontCache entry }; -struct FontNameHash { int operator()(const String&) const; }; - // ------------------- // - ImplDevFontList - // ------------------- @@ -238,7 +232,7 @@ protected: ImplDevFontListData* ImplFindByTokenNames( const String& ) const; ImplDevFontListData* ImplFindByAliasName( const String& rSearchName, const String& rShortName ) const; - ImplDevFontListData* ImplFindBySubstFontAttr( const vcl::FontNameAttr& ) const; + ImplDevFontListData* ImplFindBySubstFontAttr( const utl::FontNameAttr& ) const; ImplDevFontListData* ImplFindByAttributes( ULONG nSearchType, FontWeight, FontWidth, FontFamily, FontItalic, const String& rSearchFamily ) const; ImplDevFontListData* FindDefaultFont() const; @@ -337,7 +331,7 @@ public: public: // TODO: make data members private ImplFontSelectData maFontSelData; // FontSelectionData ImplFontMetricData maMetric; // Font Metric - const ImplCvtChar* mpConversion; // used e.g. for StarBats->StarSymbol + const ConvertChar* mpConversion; // used e.g. for StarBats->StarSymbol long mnLineHeight; ULONG mnRefCount; USHORT mnSetFontFlags; // Flags returned by SalGraphics::SetFont() diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx index bdf636754c77..dbfaf9eda18d 100644 --- a/vcl/inc/vcl/pdfwriter.hxx +++ b/vcl/inc/vcl/pdfwriter.hxx @@ -546,6 +546,8 @@ The following structure describes the permissions used in PDF security will be submitted. */ PDFWriter::ExportDataFormat SubmitFormat; + bool AllowDuplicateFieldNames; + bool FieldsUseSystemFonts; /* the following data members are used to customize the PDF viewer preferences */ @@ -590,6 +592,8 @@ The following structure describes the permissions used in PDF security Tagged( false ), EmbedStandardFonts( false ), SubmitFormat( PDFWriter::FDF ), + AllowDuplicateFieldNames( false ), + FieldsUseSystemFonts( true ), PDFDocumentMode( PDFWriter::ModeDefault ), PDFDocumentAction( PDFWriter::ActionDefault ), Zoom( 100 ), diff --git a/vcl/inc/vcl/print.h b/vcl/inc/vcl/print.h index 51cbb5dee0cf..12c7439aa5b3 100644 --- a/vcl/inc/vcl/print.h +++ b/vcl/inc/vcl/print.h @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: print.h,v $ - * $Revision: 1.4 $ + * $Revision: 1.4.114.2 $ * * This file is part of OpenOffice.org. * @@ -31,27 +31,18 @@ #ifndef _SV_PRINT_H #define _SV_PRINT_H -#include <tools/list.hxx> -#include <vcl/sv.h> -#include <vcl/dllapi.h> +#include "vcl/sv.h" +#include "vcl/dllapi.h" #include <vector> #include <hash_map> struct SalPrinterQueueInfo; class QueueInfo; +class JobSetup; -// ------------------------ -// - private printer data - -// ------------------------ -struct ImplPrivatePrinterData -{ - bool mbNextJobIsQuick; - - ImplPrivatePrinterData() : - mbNextJobIsQuick( false ) - {} -}; +namespace vcl +{ class PrinterListener; } // -------------------- // - ImplPrnQueueData - @@ -87,5 +78,7 @@ public: // -------------- void ImplDeletePrnQueueList(); +void SAL_DLLPRIVATE ImplUpdateJobSetupPaper( JobSetup& rJobSetup ); + #endif // _SV_PRINT_H diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx index b9176f4106dc..daea0c941dd0 100644 --- a/vcl/inc/vcl/print.hxx +++ b/vcl/inc/vcl/print.hxx @@ -31,14 +31,22 @@ #ifndef _SV_PRINT_HXX #define _SV_PRINT_HXX -#include <tools/errcode.hxx> -#include <vcl/sv.h> -#include <vcl/dllapi.h> -#include <vcl/outdev.hxx> -#include <vcl/prntypes.hxx> -#include <vcl/jobset.hxx> -#include <vcl/gdimtf.hxx> -#include <tools/stream.hxx> +#include "tools/errcode.hxx" +#include "vcl/sv.h" +#include "vcl/dllapi.h" +#include "vcl/outdev.hxx" +#include "vcl/prntypes.hxx" +#include "vcl/jobset.hxx" +#include "vcl/gdimtf.hxx" +#include "tools/stream.hxx" +#include "tools/multisel.hxx" + +#include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/view/PrintableState.hpp" + +#include <boost/shared_ptr.hpp> +#include <hash_map> +#include <set> struct SalPrinterInfoQueue; class SalInfoPrinter; @@ -46,12 +54,11 @@ struct SalPrinterQueueInfo; class SalPrinter; class VirtualDevice; class Window; -class ImplQPrinter; -struct ImplPrivatePrinterData; -namespace com { namespace sun { namespace star { namespace uno { - class Any; -} } } } +namespace vcl { + class PrinterController; + class PrintDialog; +} // ----------------- // - Printer-Types - @@ -216,16 +223,12 @@ class VCL_DLLPUBLIC Printer : public OutputDevice friend class ImplQPrinter; private: - ImplPrivatePrinterData* mpPrinterData; SalInfoPrinter* mpInfoPrinter; SalPrinter* mpPrinter; - Printer* mpJobPrinter; SalGraphics* mpJobGraphics; Printer* mpPrev; Printer* mpNext; VirtualDevice* mpDisplayDev; - ImplQPrinter* mpQPrinter; - GDIMetaFile* mpQMtf; PrinterOptions* mpPrinterOptions; XubString maPrinterName; XubString maDriver; @@ -250,9 +253,6 @@ private: BOOL mbUserSetupCompleted; BOOL mbUserSetupResult; Link maErrorHdl; - Link maStartPrintHdl; - Link maEndPrintHdl; - Link maPrintPageHdl; SAL_DLLPRIVATE void ImplInitData(); SAL_DLLPRIVATE void ImplInit( SalPrinterQueueInfo* pInfo ); @@ -261,22 +261,25 @@ private: const XubString* pDriver ); SAL_DLLPRIVATE void ImplUpdatePageData(); SAL_DLLPRIVATE void ImplUpdateFontList(); - SAL_DLLPRIVATE void ImplFindPaperFormatForUserSize( JobSetup& ); + SAL_DLLPRIVATE void ImplFindPaperFormatForUserSize( JobSetup&, bool bMatchNearest ); DECL_DLLPRIVATE_LINK( ImplDestroyPrinterAsync, void* ); -public: - SAL_DLLPRIVATE void ImplEndPrint(); - SAL_DLLPRIVATE void ImplUpdateQuickStatus(); + + SAL_DLLPRIVATE bool StartJob( const rtl::OUString& rJobName, boost::shared_ptr<vcl::PrinterController>& ); + + static SAL_DLLPRIVATE ULONG ImplSalPrinterErrorCodeToVCL( ULONG nError ); + private: + SAL_DLLPRIVATE void ImplEndPrint(); + SAL_DLLPRIVATE BOOL EndJob(); SAL_DLLPRIVATE Printer( const Printer& rPrinter ); SAL_DLLPRIVATE Printer& operator =( const Printer& rPrinter ); - -#ifdef _SPOOLPRINTER_EXT +public: + SAL_DLLPRIVATE void ImplStartPage(); + SAL_DLLPRIVATE void ImplEndPage(); public: void DrawGradientEx( OutputDevice* pOut, const Rectangle& rRect, const Gradient& rGradient ); void DrawGradientEx( OutputDevice* pOut, const PolyPolygon& rPolyPoly, const Gradient& rGradient ); -#endif // _SPOOLPRINTER_EXT - protected: void SetSelfAsQueuePrinter( BOOL bQueuePrinter ) { mbIsQueuePrinter = bQueuePrinter; } @@ -295,9 +298,6 @@ public: static XubString GetDefaultPrinterName(); virtual void Error(); - virtual void StartPrint(); - virtual void EndPrint(); - virtual void PrintPage(); const XubString& GetName() const { return maPrinterName; } const XubString& GetDriverName() const { return maDriver; } @@ -322,6 +322,7 @@ public: BOOL SetOrientation( Orientation eOrient ); Orientation GetOrientation() const; DuplexMode GetDuplexMode() const; + BOOL SetDuplexMode( DuplexMode ); // returns the angle that a landscape page will be turned counterclockwise // wrt to portrait. The return value may be only valid for // the current paper @@ -330,6 +331,7 @@ public: USHORT GetPaperBin() const; BOOL SetPaper( Paper ePaper ); BOOL SetPaperSizeUser( const Size& rSize ); + BOOL SetPaperSizeUser( const Size& rSize, bool bMatchNearest ); Paper GetPaper() const; // returns number of available paper formats @@ -348,58 +350,333 @@ public: USHORT GetCopyCount() const { return mnCopyCount; } BOOL IsCollateCopy() const { return mbCollateCopy; } - USHORT GetCurPrintPage() const { return mnCurPrintPage; } BOOL IsPrinting() const { return mbPrinting; } void SetPrintFile( const XubString& rFileName ) { maPrintFile = rFileName; } const XubString& GetPrintFile() const { return maPrintFile; } void EnablePrintFile( BOOL bEnable ) { mbPrintFile = bEnable; } BOOL IsPrintFileEnabled() const { return mbPrintFile; } - BOOL StartJob( const XubString& rJobName ); - BOOL EndJob(); BOOL AbortJob(); const XubString& GetCurJobName() const { return maJobName; } USHORT GetCurPage() const { return mnCurPage; } BOOL IsJobActive() const { return mbJobActive; } - BOOL StartPage(); - BOOL EndPage(); - - void SetPageQueueSize( USHORT nPages ) { mnPageQueueSize = nPages; } - USHORT GetPageQueueSize() const { return mnPageQueueSize; } ULONG GetError() const { return ERRCODE_TOERROR(mnError); } ULONG GetErrorCode() const { return mnError; } void SetErrorHdl( const Link& rLink ) { maErrorHdl = rLink; } const Link& GetErrorHdl() const { return maErrorHdl; } - void SetStartPrintHdl( const Link& rLink ) { maStartPrintHdl = rLink; } - const Link& GetStartPrintHdl() const { return maStartPrintHdl; } - void SetEndPrintHdl( const Link& rLink ) { maEndPrintHdl = rLink; } - const Link& GetEndPrintHdl() const { return maEndPrintHdl; } - void SetPrintPageHdl( const Link& rLink ) { maPrintPageHdl = rLink; } - const Link& GetPrintPageHdl() const { return maPrintPageHdl; } void Compat_OldPrinterMetrics( bool bSet ); - /** Notify that the next StartJob belongs to a UI less "direct print" job - * - * deprecated: the canonical way to notify a UI less job is to set the - * JobSetup value "IsQuickJob" to "true". If set at all, the "IsQuickJob" value - * on JobSetup will be preferred. However if no "IsQuickJob" value is set, - * setting SetNextJobIsQuick will cause the following StartJob to set this value - * to "true" in the current JobSetup. - * - * the paramter can be set to "false" again in case a job was not started and the - * printer is to be reused. - */ - void SetNextJobIsQuick( bool bQuick = true ); - /** checks the printer list and updates it necessary * * sends a DataChanged event of type DATACHANGED_PRINTER * if the printer list changed */ static void updatePrinters(); + + /** execute a print job + + starts a print job asynchronously (that is will return + + */ + static void PrintJob( const boost::shared_ptr<vcl::PrinterController>& i_pController, + const JobSetup& i_rInitSetup + ); + + // implementation detail of PrintJob being asynchronous + // not exported, not usable outside vcl + static void SAL_DLLPRIVATE ImplPrintJob( const boost::shared_ptr<vcl::PrinterController>& i_pController, + const JobSetup& i_rInitSetup + ); +}; + +namespace vcl +{ +class ImplPrinterControllerData; + +class VCL_DLLPUBLIC PrinterController +{ + ImplPrinterControllerData* mpImplData; +protected: + PrinterController( const boost::shared_ptr<Printer>& ); +public: + enum NupOrderType + { LRTB, TBLR }; + struct MultiPageSetup + { + // all metrics in 100th mm + int nRows; + int nColumns; + int nRepeat; + Size aPaperSize; + long nLeftMargin; + long nTopMargin; + long nRightMargin; + long nBottomMargin; + long nHorizontalSpacing; + long nVerticalSpacing; + bool bDrawBorder; + PrinterController::NupOrderType nOrder; + + MultiPageSetup() + : nRows( 1 ), nColumns( 1 ), nRepeat( 1 ), aPaperSize( 21000, 29700 ) + , nLeftMargin( 0 ), nTopMargin( 0 ) + , nRightMargin( 0 ), nBottomMargin( 0 ) + , nHorizontalSpacing( 0 ), nVerticalSpacing( 0 ) + , bDrawBorder( false ) + , nOrder( LRTB ) + { + } + }; + + struct PageSize + { + Size aSize; // in 100th mm + bool bFullPaper; // full paper, not only imageable area is printed + + PageSize( const Size& i_rSize = Size( 21000, 29700 ), + bool i_bFullPaper = false + ) : aSize( i_rSize ), bFullPaper( i_bFullPaper ) {} + }; + + PrinterController(); + virtual ~PrinterController(); + + const boost::shared_ptr<Printer>& getPrinter() const; + /* for implementations: get current job properties as changed by e.g. print dialog + this gets the current set of properties initially told to Printer::PrintJob + + For convenience a second sequence will be merged in to get a combined sequence. + In case of duplicate property names, the value of i_MergeList wins. + */ + com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > + getJobProperties( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rMergeList ) const; + + /* get the PropertyValue of a Property + */ + com::sun::star::beans::PropertyValue* getValue( const rtl::OUString& i_rPropertyName ); + const com::sun::star::beans::PropertyValue* getValue( const rtl::OUString& i_rPropertyName ) const; + // get a sequence of properties + com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > getValues( const com::sun::star::uno::Sequence< rtl::OUString >& ) const; + /* get a bool property + in case the property is unknown or not convertible to bool, i_bFallback is returned + */ + sal_Bool getBoolProperty( const rtl::OUString& i_rPropertyName, sal_Bool i_bFallback ) const; + + /* set a property value - can also be used to add another UI property + */ + void setValue( const rtl::OUString& i_rPropertyName, const com::sun::star::uno::Any& i_rValue ); + void setValue( const com::sun::star::beans::PropertyValue& i_rValue ); + + /* return the currently active UI options. These are the same that were passed to setUIOptions. + */ + const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& getUIOptions() const; + /* set possible UI options. should only be done once before passing the PrinterListener + to Printer::PrintJob + */ + void setUIOptions( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& ); + /* enable/disable an option; this can be used to implement dialog logic. + */ + void enableUIOption( const rtl::OUString& rPropName, bool bEnable ); + bool isUIOptionEnabled( const rtl::OUString& rPropName ) const; + /* returns the property name rPropName depends on or an empty string + if no dependency exists. + */ + rtl::OUString getDependency( const rtl::OUString& rPropName ) const; + /* makeEnabled will chage the property rPropName depends on to the value + that makes rPropName enabled. If the dependency itself is also disabled, + no action will be performed. + + returns the property name rPropName depends on or an empty string + if no change was made. + */ + rtl::OUString makeEnabled( const rtl::OUString& rPropName ); + + virtual int getPageCount() const = 0; // must be overloaded by the app + /* get the page parameters, namely the jobsetup that should be active for the page + (describing among others the physical page size) and the "page size". In writer + case this would probably be the same as the JobSetup since writer sets the page size + draw/impress for example print their page on the paper set on the printer, + possibly adjusting the page size to fit. That means the page size can be different from + the paper size. + */ + // must be overloaded by the app, return page size in 1/100th mm + virtual com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > getPageParameters( int i_nPage ) const = 0; + virtual void printPage( int i_nPage ) const = 0; // must be overloaded by the app + virtual void jobStarted(); // will be called after a possible dialog has been shown and the real printjob starts + virtual void jobFinished( com::sun::star::view::PrintableState ); + + com::sun::star::view::PrintableState getJobState() const; + + void abortJob(); + + bool isShowDialogs() const; + bool isDirectPrint() const; + + // implementation details, not usable outside vcl + SAL_DLLPRIVATE int getFilteredPageCount(); + SAL_DLLPRIVATE PageSize getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf, bool i_bMayUseCache = false ); + SAL_DLLPRIVATE PageSize getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache = false ); + SAL_DLLPRIVATE void printFilteredPage( int i_nPage ); + SAL_DLLPRIVATE void setPrinter( const boost::shared_ptr<Printer>& ); + SAL_DLLPRIVATE void setOptionChangeHdl( const Link& ); + SAL_DLLPRIVATE void createProgressDialog(); + SAL_DLLPRIVATE void setMultipage( const MultiPageSetup& ); + SAL_DLLPRIVATE const MultiPageSetup& getMultipage() const; + SAL_DLLPRIVATE void setLastPage( sal_Bool i_bLastPage ); + SAL_DLLPRIVATE void setReversePrint( sal_Bool i_bReverse ); + SAL_DLLPRIVATE bool getReversePrint() const; + SAL_DLLPRIVATE void pushPropertiesToPrinter(); + SAL_DLLPRIVATE void setJobState( com::sun::star::view::PrintableState ); + SAL_DLLPRIVATE bool setupPrinter( Window* i_pDlgParent ); + + SAL_DLLPRIVATE int getPageCountProtected() const; + SAL_DLLPRIVATE com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > getPageParametersProtected( int i_nPage ) const; + + SAL_DLLPRIVATE ULONG removeTransparencies( GDIMetaFile& i_rIn, GDIMetaFile& o_rOut ); }; +class VCL_DLLPUBLIC PrinterOptionsHelper +{ + protected: + std::hash_map< rtl::OUString, com::sun::star::uno::Any, rtl::OUStringHash > m_aPropertyMap; + com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > m_aUIProperties; + + public: + PrinterOptionsHelper() {} // create without ui properties + PrinterOptionsHelper( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rUIProperties ) + : m_aUIProperties( i_rUIProperties ) + {} + ~PrinterOptionsHelper() + {} + + /* process a new set of properties + * merges changed properties and returns "true" if any occured + * if the optional output set is not NULL then the names of the changed properties are returned + **/ + bool processProperties( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp, + std::set< rtl::OUString >* o_pChangeProp = NULL ); + /* append to a sequence of property values the ui property sequence passed at creation + * as the "ExtraPrintUIOptions" property. if that sequence was empty, no "ExtraPrintUIOptions" property + * will be appended. + **/ + void appendPrintUIOptions( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& io_rProps ) const; + + // check if a property exists + bool hasProperty( const rtl::OUString& i_rPropertyName ) const; + bool hasProperty( const char* i_pPropertyName ) const + { return hasProperty( rtl::OUString::createFromAscii( i_pPropertyName ) ); } + + // returns an empty Any for not existing properties + com::sun::star::uno::Any getValue( const rtl::OUString& i_rPropertyName ) const; + // change a value in the property set; this will not have an effect to an eventual PrinterController + // the user of setValue must decide whether it is necessary to set the value there also + void setValue( const rtl::OUString& i_rPropertyName, const com::sun::star::uno::Any& i_rValue ); + void setValue( const char* i_pPropertyName, const com::sun::star::uno::Any& i_rValue ) + { setValue( rtl::OUString::createFromAscii( i_pPropertyName ), i_rValue ); } + + sal_Bool getBoolValue( const rtl::OUString& i_rPropertyName, sal_Bool i_bDefault = sal_False ) const; + // convenience for fixed strings + sal_Bool getBoolValue( const char* i_pPropName, sal_Bool i_bDefault = sal_False ) const + { return getBoolValue( rtl::OUString::createFromAscii( i_pPropName ), i_bDefault ); } + + sal_Int64 getIntValue( const rtl::OUString& i_rPropertyName, sal_Int64 i_nDefault = 0 ) const; + // convenience for fixed strings + sal_Int64 getIntValue( const char* i_pPropName, sal_Int64 i_nDefault = 0 ) const + { return getIntValue( rtl::OUString::createFromAscii( i_pPropName ), i_nDefault ); } + + rtl::OUString getStringValue( const rtl::OUString& i_rPropertyName, const rtl::OUString& i_rDefault = rtl::OUString() ) const; + // convenience for fixed strings + rtl::OUString getStringValue( const char* i_pPropName, const rtl::OUString& i_rDefault = rtl::OUString() ) const + { return getStringValue( rtl::OUString::createFromAscii( i_pPropName ), i_rDefault ); } + + // helper functions for user to create a single control + struct UIControlOptions + { + rtl::OUString maDependsOnName; + sal_Int32 mnDependsOnEntry; + sal_Bool mbAttachToDependency; + rtl::OUString maGroupHint; + sal_Bool mbInternalOnly; + sal_Bool mbEnabled; + com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > maAddProps; + + UIControlOptions( const rtl::OUString& i_rDependsOnName = rtl::OUString(), + sal_Int32 i_nDependsOnEntry = -1, + sal_Bool i_bAttachToDependency = sal_False, + const rtl::OUString& i_rGroupHint = rtl::OUString(), + sal_Bool i_bInternalOnly = sal_False, + sal_Bool i_bEnabled = sal_True + ) + : maDependsOnName( i_rDependsOnName ) + , mnDependsOnEntry( i_nDependsOnEntry ) + , mbAttachToDependency( i_bAttachToDependency ) + , maGroupHint( i_rGroupHint ) + , mbInternalOnly( i_bInternalOnly ) + , mbEnabled( i_bEnabled ) {} + }; + + // general control + static com::sun::star::uno::Any getUIControlOpt( const rtl::OUString& i_rTitle, + const com::sun::star::uno::Sequence< rtl::OUString >& i_rHelpText, + const rtl::OUString& i_rType, + const com::sun::star::beans::PropertyValue* i_pValue = NULL, + const UIControlOptions& i_rControlOptions = UIControlOptions() + ); + // create a group (e.g. a TabPage); following controls will be grouped in it until the next + // group begins + static com::sun::star::uno::Any getGroupControlOpt( const rtl::OUString& i_rTitle, const rtl::OUString& i_rHelpText ); + + // create a subgroup (e.g. a FixedLine); following controls will be grouped in it until the next + // subgroup or group begins + // setting bJobPage = true will make the subgroup appear on the first page of the print dialog + static com::sun::star::uno::Any getSubgroupControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rHelpText, + const UIControlOptions& i_rControlOptions = UIControlOptions() + ); + + // create a bool option (usually a checkbox) + static com::sun::star::uno::Any getBoolControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rHelpText, + const rtl::OUString& i_rProperty, + sal_Bool i_bValue, + const UIControlOptions& i_rControlOptions = UIControlOptions() + ); + + // create a set of choices (either a radio button group or a list box) + static com::sun::star::uno::Any getChoiceControlOpt( const rtl::OUString& i_rTitle, + const com::sun::star::uno::Sequence< rtl::OUString >& i_rHelpText, + const rtl::OUString& i_rProperty, + const com::sun::star::uno::Sequence< rtl::OUString >& i_rChoices, + sal_Int32 i_nValue, + const rtl::OUString& i_rType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Radio" ) ), + const UIControlOptions& i_rControlOptions = UIControlOptions() + ); + + // create an integer range (e.g. a spin field) + // note: max value < min value means do not apply min/max values + static com::sun::star::uno::Any getRangeControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rHelpText, + const rtl::OUString& i_rProperty, + sal_Int32 i_nValue, + sal_Int32 i_nMinValue = -1, + sal_Int32 i_nMaxValue = -2, + const UIControlOptions& i_rControlOptions = UIControlOptions() + ); + + // create a string field + // note: max value < min value means do not apply min/max values + static com::sun::star::uno::Any getEditControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rHelpText, + const rtl::OUString& i_rProperty, + const rtl::OUString& i_rValue, + const UIControlOptions& i_rControlOptions = UIControlOptions() + ); +}; + +} + + #endif // _SV_PRINT_HXX diff --git a/vcl/inc/vcl/printerjob.hxx b/vcl/inc/vcl/printerjob.hxx index 9880700d4008..e445a81d54c8 100644 --- a/vcl/inc/vcl/printerjob.hxx +++ b/vcl/inc/vcl/printerjob.hxx @@ -91,7 +91,7 @@ private: // private methods bool writeFeatureList( osl::File* pFile, const JobData&, bool bDocumentSetup ); bool writeSetup( osl::File* pFile, const JobData& ); - bool writePageSetup( osl::File* pFile, const JobData& ); + bool writePageSetup( osl::File* pFile, const JobData&, bool bWriteFeatures = true ); void writeJobPatch( osl::File* File, const JobData& ); bool writeProlog (osl::File* pFile, const JobData& ); diff --git a/vcl/inc/vcl/prndlg.hxx b/vcl/inc/vcl/prndlg.hxx index 4fd6eaa999da..f1b69e1ca3aa 100644 --- a/vcl/inc/vcl/prndlg.hxx +++ b/vcl/inc/vcl/prndlg.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: prndlg.hxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.3.114.5 $ * * This file is part of OpenOffice.org. * @@ -33,19 +33,301 @@ #include <vcl/dllapi.h> -#include <vcl/dialog.hxx> +#include "vcl/print.hxx" +#include "vcl/print.h" -class Printer; +#include "vcl/dialog.hxx" +#include "vcl/fixed.hxx" +#include "vcl/button.hxx" +#include "vcl/gdimtf.hxx" +#include "vcl/lstbox.hxx" +#include "vcl/field.hxx" +#include "vcl/tabctrl.hxx" +#include "vcl/tabpage.hxx" +#include "vcl/arrange.hxx" +#include "vcl/virdev.hxx" -class VCL_DLLPUBLIC SystemDialog : public ModalDialog +#include <boost/shared_ptr.hpp> +#include <map> + +namespace vcl { -public: - SystemDialog( Window* pParent, WinBits nWinStyle ) : - ModalDialog( pParent, nWinStyle ) {} - SystemDialog( Window* pParent, const ResId& rResId ) : - ModalDialog( pParent, rResId ) {} - - virtual short Execute() { return 0; } -}; + class PrintDialog : public ModalDialog + { + class PrintPreviewWindow : public Window + { + GDIMetaFile maMtf; + Size maOrigSize; + VirtualDevice maPageVDev; + rtl::OUString maReplacementString; + rtl::OUString maToolTipString; + public: + PrintPreviewWindow( Window* pParent, const ResId& ); + virtual ~PrintPreviewWindow(); + + virtual void Paint( const Rectangle& rRect ); + virtual void Command( const CommandEvent& ); + virtual void Resize(); + virtual void DataChanged( const DataChangedEvent& ); + + void setPreview( const GDIMetaFile&, const Size&, const rtl::OUString&, + sal_Int32 i_nDPIX, sal_Int32 i_nDPIY + ); + }; + + class ShowNupOrderWindow : public Window + { + int mnOrderMode; + int mnRows; + int mnColumns; + void ImplInitSettings(); + public: + ShowNupOrderWindow( Window* pParent ); + virtual ~ShowNupOrderWindow(); + + virtual void Paint( const Rectangle& ); + + void setValues( int i_nOrderMode, int i_nColumns, int i_nRows ) + { + mnOrderMode = i_nOrderMode; + mnRows = i_nRows; + mnColumns = i_nColumns; + Invalidate(); + } + }; + + class NUpTabPage : public TabPage + { + public: + FixedLine maNupLine; + RadioButton maPagesBtn; + RadioButton maBrochureBtn; + FixedText maPagesBoxTitleTxt; + ListBox maNupPagesBox; + + // controls for "Custom" page mode + FixedText maNupNumPagesTxt; + NumericField maNupColEdt; + FixedText maNupTimesTxt; + NumericField maNupRowsEdt; + FixedText maPageMarginTxt1; + MetricField maPageMarginEdt; + FixedText maPageMarginTxt2; + FixedText maSheetMarginTxt1; + MetricField maSheetMarginEdt; + FixedText maSheetMarginTxt2; + FixedText maNupOrientationTxt; + ListBox maNupOrientationBox; + + // page order ("left to right, then down") + FixedText maNupOrderTxt; + ListBox maNupOrderBox; + ShowNupOrderWindow maNupOrderWin; + // border around each page + CheckBox maBorderCB; + + vcl::RowOrColumn maLayout; + boost::shared_ptr< vcl::RowOrColumn > mxBrochureDep; + boost::shared_ptr< vcl::LabeledElement >mxPagesBtnLabel; + + void setupLayout(); + + NUpTabPage( Window*, const ResId& ); + virtual ~NUpTabPage(); + + void readFromSettings(); + void storeToSettings(); + void initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup& ); + void enableNupControls( bool bEnable ); + + void showAdvancedControls( bool ); + + virtual void Resize(); + }; + + class JobTabPage : public TabPage + { + public: + FixedLine maPrinterFL; + ListBox maPrinters; + DisclosureButton maDetailsBtn; + FixedText maStatusLabel; + FixedText maStatusTxt; + FixedText maLocationLabel; + FixedText maLocationTxt; + FixedText maCommentLabel; + FixedText maCommentTxt; + + PushButton maSetupButton; + + FixedLine maCopies; + FixedLine maCopySpacer; + FixedText maCopyCount; + NumericField maCopyCountField; + CheckBox maCollateBox; + FixedImage maCollateImage; + + Image maCollateImg; + Image maCollateHCImg; + Image maNoCollateImg; + Image maNoCollateHCImg; + + long mnCollateUIMode; + + vcl::RowOrColumn maLayout; + boost::shared_ptr<vcl::RowOrColumn> mxPrintRange; + boost::shared_ptr<vcl::WindowArranger> mxDetails; + + JobTabPage( Window*, const ResId& ); + virtual ~JobTabPage(); + + void readFromSettings(); + void storeToSettings(); + + virtual void Resize(); + + void setupLayout(); + }; + + class OutputOptPage : public TabPage + { + public: + FixedLine maOptionsLine; + CheckBox maToFileBox; + CheckBox maCollateSingleJobsBox; + CheckBox maReverseOrderBox; + + vcl::RowOrColumn maLayout; + boost::shared_ptr<vcl::RowOrColumn> mxOptGroup; + + OutputOptPage( Window*, const ResId& ); + virtual ~OutputOptPage(); + + void readFromSettings(); + void storeToSettings(); + + virtual void Resize(); + + void setupLayout(); + }; + + OKButton maOKButton; + CancelButton maCancelButton; + HelpButton maHelpButton; + PrintPreviewWindow maPreviewWindow; + NumericField maPageEdit; + FixedText maNumPagesText; + PushButton maBackwardBtn; + PushButton maForwardBtn; + + TabControl maTabCtrl; + NUpTabPage maNUpPage; + JobTabPage maJobPage; + OutputOptPage maOptionsPage; + + FixedLine maButtonLine; + + boost::shared_ptr< PrinterController > maPController; + + rtl::OUString maPageStr; + rtl::OUString maNoPageStr; + sal_Int32 mnCurPage; + sal_Int32 mnCachedPages; + + std::list< Window* > maControls; + std::map< Window*, rtl::OUString > maControlToPropertyMap; + std::map< rtl::OUString, std::vector< Window* > > + maPropertyToWindowMap; + std::map< Window*, sal_Int32 > maControlToNumValMap; + std::set< rtl::OUString > maReverseDependencySet; + + Size maNupPortraitSize; + Size maNupLandscapeSize; + + // internal, used for automatic Nup-Portrait/landscape + Size maFirstPageSize; + + rtl::OUString maPrintToFileText; + rtl::OUString maPrintText; + rtl::OUString maDefPrtText; + + vcl::RowOrColumn maLayout; + boost::shared_ptr<vcl::RowOrColumn> mxPreviewCtrls; + + Size maDetailsCollapsedSize; + Size maDetailsExpandedSize; + + sal_Bool mbShowLayoutPage; + + Size getJobPageSize(); + void updateNup(); + void updateNupFromPages(); + void preparePreview( bool i_bPrintChanged = true, bool i_bMayUseCache = false ); + void setPreviewText( sal_Int32 ); + void updatePrinterText(); + void checkControlDependencies(); + void checkOptionalControlDependencies(); + void makeEnabled( Window* ); + void updateWindowFromProperty( const rtl::OUString& ); + void setupOptionalUI(); + void readFromSettings(); + void storeToSettings(); + com::sun::star::beans::PropertyValue* getValueForWindow( Window* ) const; + + virtual void Resize(); + virtual void Command( const CommandEvent& ); + virtual void DataChanged( const DataChangedEvent& ); + + DECL_LINK( SelectHdl, ListBox* ); + DECL_LINK( ClickHdl, Button* ); + DECL_LINK( ModifyHdl, Edit* ); + DECL_LINK( UIOptionsChanged, void* ); + + DECL_LINK( UIOption_CheckHdl, CheckBox* ); + DECL_LINK( UIOption_RadioHdl, RadioButton* ); + DECL_LINK( UIOption_SelectHdl, ListBox* ); + DECL_LINK( UIOption_ModifyHdl, Edit* ); + + void setupLayout(); + public: + PrintDialog( Window*, const boost::shared_ptr< PrinterController >& ); + virtual ~PrintDialog(); + + bool isPrintToFile(); + int getCopyCount(); + bool isCollate(); + + void previewForward(); + void previewBackward(); + }; + + class PrintProgressDialog : public ModelessDialog + { + String maStr; + FixedText maText; + CancelButton maButton; + + bool mbCanceled; + sal_Int32 mnCur; + sal_Int32 mnMax; + long mnProgressHeight; + Rectangle maProgressRect; + bool mbNativeProgress; + + DECL_LINK( ClickHdl, Button* ); + + void implCalcProgressRect(); + public: + PrintProgressDialog( Window* i_pParent, int i_nMax ); + ~PrintProgressDialog(); + + bool isCanceled() const { return mbCanceled; } + void setProgress( int i_nCurrent, int i_nMax = -1 ); + void tick(); + + virtual void Paint( const Rectangle& ); + }; +} + #endif // _SV_PRNDLG_HXX diff --git a/vcl/inc/vcl/prntypes.hxx b/vcl/inc/vcl/prntypes.hxx index 681f4f972a7c..a61c1a275474 100644 --- a/vcl/inc/vcl/prntypes.hxx +++ b/vcl/inc/vcl/prntypes.hxx @@ -39,7 +39,7 @@ // - Duplex Mode - // --------------- -enum DuplexMode { DUPLEX_UNKNOWN, DUPLEX_OFF, DUPLEX_ON }; +enum DuplexMode { DUPLEX_UNKNOWN, DUPLEX_OFF, DUPLEX_LONGEDGE, DUPLEX_SHORTEDGE }; // --------------- // - Orientation - @@ -93,5 +93,6 @@ enum Orientation { ORIENTATION_PORTRAIT, ORIENTATION_LANDSCAPE }; #define PRINTER_CAPABILITIES_FAX ((USHORT)8) #define PRINTER_CAPABILITIES_PDF ((USHORT)9) #define PRINTER_CAPABILITIES_EXTERNALDIALOG ((USHORT)10) +#define PRINTER_CAPABILITIES_SETDUPLEX ((USHORT)11) #endif // _SV_PRNTYPES_HXX diff --git a/vcl/inc/vcl/salbtype.hxx b/vcl/inc/vcl/salbtype.hxx index 2a10353bee94..d9be75369a5d 100644 --- a/vcl/inc/vcl/salbtype.hxx +++ b/vcl/inc/vcl/salbtype.hxx @@ -37,6 +37,7 @@ #include <tools/debug.hxx> #include <vcl/salgtype.hxx> #include <tools/color.hxx> +#include <tools/gen.hxx> #include <vcl/sv.h> #include <vcl/dllapi.h> @@ -49,14 +50,6 @@ typedef HPBYTE Scanline; typedef const BYTE* ConstHPBYTE; typedef ConstHPBYTE ConstScanline; -// -------------------- -// - Helper functions - -// -------------------- - -inline long MinMax( long nVal, long nMin, long nMax ); -inline long AlignedWidth4Bytes( long nWidthBits ); -inline long FRound( double fVal ); - // ------------------ // - Bitmap formats - // ------------------ @@ -292,29 +285,6 @@ struct VCL_DLLPUBLIC BitmapBuffer VCL_DLLPUBLIC BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRect& rTwoRect, ULONG nDstBitmapFormat, BitmapPalette* pDstPal = NULL, ColorMask* pDstMask = NULL ); -// --------------- -// - Inlines - -// --------------- - -inline long MinMax( long nVal, long nMin, long nMax ) -{ - return( nVal >= nMin ? ( nVal <= nMax ? nVal : nMax ) : nMin ); -} - -// ------------------------------------------------------------------ - -inline long AlignedWidth4Bytes( long nWidthBits ) -{ - return( ( ( nWidthBits + 31 ) >> 5 ) << 2 ); -} - -// ------------------------------------------------------------------ - -inline long FRound( double fVal ) -{ - return( fVal > 0.0 ? (long) ( fVal + 0.5 ) : -(long) ( -fVal + 0.5 ) ); -} - // ------------------------------------------------------------------ inline BitmapColor::BitmapColor() : diff --git a/vcl/inc/vcl/salframe.hxx b/vcl/inc/vcl/salframe.hxx index 0e3f4e94a0b3..b95f7036ad19 100644 --- a/vcl/inc/vcl/salframe.hxx +++ b/vcl/inc/vcl/salframe.hxx @@ -170,6 +170,7 @@ public: virtual void SetTitle( const XubString& rTitle ) = 0; virtual void SetIcon( USHORT nIcon ) = 0; + virtual void SetRepresentedURL( const rtl::OUString& ); virtual void SetMenu( SalMenu *pSalMenu ) = 0; virtual void DrawMenuBar() = 0; diff --git a/vcl/inc/vcl/salprn.hxx b/vcl/inc/vcl/salprn.hxx index 2927215034b5..73f5454457cf 100644 --- a/vcl/inc/vcl/salprn.hxx +++ b/vcl/inc/vcl/salprn.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: salprn.hxx,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.114.1 $ * * This file is part of OpenOffice.org. * @@ -41,7 +41,7 @@ class SalGraphics; class SalFrame; struct ImplJobSetup; -class ImplQPrinter; +namespace vcl { class PrinterController; } // ----------------------- // - SalPrinterQueueInfo - @@ -101,7 +101,6 @@ public: virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) = 0; // returns angle that a landscape page will be turned counterclockwise wrt to portrait virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ) = 0; - virtual DuplexMode GetDuplexMode( const ImplJobSetup* pSetupData ) = 0; }; // -------------- @@ -114,18 +113,21 @@ public: // public for Sal Implementation SalPrinter() {} virtual ~SalPrinter(); - virtual BOOL StartJob( const XubString* pFileName, - const XubString& rJobName, - const XubString& rAppName, - ULONG nCopies, BOOL bCollate, + virtual BOOL StartJob( const String* pFileName, + const String& rJobName, + const String& rAppName, + ULONG nCopies, + bool bCollate, + bool bDirect, ImplJobSetup* pSetupData ) = 0; // implement for pull model print systems only, // default implementations (see salvtables.cxx) just returns FALSE virtual BOOL StartJob( const String* pFileName, + const String& rJobName, const String& rAppName, ImplJobSetup* pSetupData, - ImplQPrinter* pQPrinter ); + vcl::PrinterController& rController ); virtual BOOL EndJob() = 0; virtual BOOL AbortJob() = 0; diff --git a/vcl/inc/vcl/salptype.hxx b/vcl/inc/vcl/salptype.hxx index 7f1c82079f38..bc9883757432 100644 --- a/vcl/inc/vcl/salptype.hxx +++ b/vcl/inc/vcl/salptype.hxx @@ -40,7 +40,11 @@ #define SAL_JOBSET_ORIENTATION ((ULONG)0x00000001) #define SAL_JOBSET_PAPERBIN ((ULONG)0x00000002) #define SAL_JOBSET_PAPERSIZE ((ULONG)0x00000004) -#define SAL_JOBSET_ALL (SAL_JOBSET_ORIENTATION | SAL_JOBSET_PAPERBIN | SAL_JOBSET_PAPERSIZE) +#define SAL_JOBSET_DUPLEXMODE ((ULONG)0x00000008) +#define SAL_JOBSET_ALL (SAL_JOBSET_ORIENTATION |\ + SAL_JOBSET_PAPERBIN |\ + SAL_JOBSET_PAPERSIZE |\ + SAL_JOBSET_DUPLEXMODE) // ------------------- // - SalPrinterError - diff --git a/vcl/inc/vcl/salsession.hxx b/vcl/inc/vcl/salsession.hxx index 05aa76cb0f56..bdc698fc63fd 100644 --- a/vcl/inc/vcl/salsession.hxx +++ b/vcl/inc/vcl/salsession.hxx @@ -37,7 +37,8 @@ enum SalSessionEventType { Interaction, SaveRequest, - ShutdownCancel + ShutdownCancel, + Quit }; struct SalSessionEvent @@ -78,6 +79,13 @@ struct SalSessionShutdownCancelEvent : public SalSessionEvent {} }; +struct SalSessionQuitEvent : public SalSessionEvent +{ + SalSessionQuitEvent() + : SalSessionEvent( Quit ) + {} +}; + typedef void(*SessionProc)( SalSessionEvent *pEvent); class VCL_DLLPUBLIC SalSession diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx index decb7d01b2d4..61a970b738e0 100644 --- a/vcl/inc/vcl/settings.hxx +++ b/vcl/inc/vcl/settings.hxx @@ -38,6 +38,7 @@ #include "vcl/accel.hxx" #include "vcl/wall.hxx" #include "com/sun/star/lang/Locale.hpp" +#include <unotools/syslocale.hxx> class CollatorWrapper; class LocaleDataWrapper; @@ -521,9 +522,10 @@ private: #define STYLE_SYMBOLS_HICONTRAST ((ULONG)2) #define STYLE_SYMBOLS_INDUSTRIAL ((ULONG)3) #define STYLE_SYMBOLS_CRYSTAL ((ULONG)4) -#define STYLE_SYMBOLS_TANGO ((ULONG)5) -#define STYLE_SYMBOLS_CLASSIC ((ULONG)6) -#define STYLE_SYMBOLS_THEMES_MAX ((ULONG)6) +#define STYLE_SYMBOLS_TANGO ((ULONG)5) +#define STYLE_SYMBOLS_OXYGEN ((ULONG)6) +#define STYLE_SYMBOLS_CLASSIC ((ULONG)7) +#define STYLE_SYMBOLS_THEMES_MAX ((ULONG)8) #define STYLE_CURSOR_NOBLINKTIME ((ULONG)0xFFFFFFFF) @@ -947,6 +949,8 @@ public: void SetPreferredSymbolsStyleName( const ::rtl::OUString &rName ); ULONG GetPreferredSymbolsStyle() const { return mpData->mnPreferredSymbolsStyle; } + // check whether the symbols style is supported (icons are installed) + bool CheckSymbolStyle( ULONG nStyle ) const; ULONG GetAutoSymbolsStyle() const; ULONG GetCurrentSymbolsStyle() const; @@ -993,7 +997,6 @@ class ImplMiscData private: ULONG mnRefCount; - USHORT mnTwoDigitYearStart; USHORT mnEnableATT; BOOL mbEnableLocalizedDecimalSep; USHORT mnDisablePrinting; @@ -1015,10 +1018,6 @@ public: MiscSettings( const MiscSettings& rSet ); ~MiscSettings(); - void SetTwoDigitYearStart( USHORT nYearStart ) - { CopyData(); mpData->mnTwoDigitYearStart = nYearStart; } - USHORT GetTwoDigitYearStart() const - { return mpData->mnTwoDigitYearStart; } void SetEnableATToolSupport( BOOL bEnable ); BOOL GetEnableATToolSupport() const; void SetDisablePrinting( BOOL bEnable ); @@ -1141,7 +1140,7 @@ public: // ----------------------- // - ImplAllSettingsData - // ----------------------- - +class LocaleConfigurationListener; class ImplAllSettingsData { friend class AllSettings; @@ -1171,6 +1170,8 @@ private: CollatorWrapper* mpUICollatorWrapper; vcl::I18nHelper* mpI18nHelper; vcl::I18nHelper* mpUII18nHelper; + LocaleConfigurationListener* mpLocaleCfgListener; + SvtSysLocale maSysLocale; }; // --------------- @@ -1287,6 +1288,8 @@ public: BOOL operator ==( const AllSettings& rSet ) const; BOOL operator !=( const AllSettings& rSet ) const { return !(*this == rSet); } + static void LocaleSettingsChanged( sal_uInt32 nHint ); + SvtSysLocale& GetSysLocale() { return mpData->maSysLocale; } }; #endif // _SV_SETTINGS_HXX diff --git a/vcl/inc/vcl/slider.hxx b/vcl/inc/vcl/slider.hxx index 396ed0ca83cb..c3dfcfd42608 100644 --- a/vcl/inc/vcl/slider.hxx +++ b/vcl/inc/vcl/slider.hxx @@ -70,6 +70,7 @@ private: Link maSlideHdl; Link maEndSlideHdl; + using Control::ImplInitSettings; using Window::ImplInit; SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx index 1e0c5218d1c5..3e9a1cc55019 100644 --- a/vcl/inc/vcl/svapp.hxx +++ b/vcl/inc/vcl/svapp.hxx @@ -287,6 +287,9 @@ public: static vos::OThread::TThreadIdentifier GetMainThreadIdentifier(); static ULONG ReleaseSolarMutex(); static void AcquireSolarMutex( ULONG nCount ); + static void EnableNoYieldMode( bool i_bNoYield ); + static void AddPostYieldListener( const Link& i_rListener ); + static void RemovePostYieldListener( const Link& i_rListener ); static BOOL IsInMain(); static BOOL IsInExecute(); diff --git a/vcl/inc/vcl/svdata.hxx b/vcl/inc/vcl/svdata.hxx index c044364f2064..081b2fffca0b 100644 --- a/vcl/inc/vcl/svdata.hxx +++ b/vcl/inc/vcl/svdata.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: svdata.hxx,v $ - * $Revision: 1.13 $ + * $Revision: 1.13.16.1 $ * * This file is part of OpenOffice.org. * @@ -44,6 +44,7 @@ #include <tools/debug.hxx> #include <vcl/dllapi.h> #include <com/sun/star/uno/Reference.hxx> +#include <unotools/options.hxx> namespace com { namespace sun { @@ -86,6 +87,7 @@ class Timer; class AutoTimer; class Help; class ImageList; +class Image; class PopupMenu; class Application; class OutputDevice; @@ -110,14 +112,21 @@ class ImplWheelWindow; class SalTimer; class SalI18NImeStatus; class DockingManager; +class VclEventListeners2; namespace vos { class OMutex; } namespace vos { class OCondition; } -namespace vcl { class DisplayConnection; class FontSubstConfiguration; class SettingsConfigItem; class DefaultFontConfiguration; class DeleteOnDeinitBase; } +namespace vcl { class DisplayConnection; class SettingsConfigItem; class DeleteOnDeinitBase; } +namespace utl { class DefaultFontConfiguration; class FontSubstConfiguration; } // ----------------- // - ImplSVAppData - // ----------------- +class LocaleConfigurationListener : public utl::ConfigurationListener +{ +public: + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); +}; struct ImplSVAppData { @@ -131,6 +140,7 @@ struct ImplSVAppData ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF; String* mpMSFTempFileName; AllSettings* mpSettings; // Application settings + LocaleConfigurationListener* mpCfgListener; VclEventListeners* mpEventListeners; // listeners for vcl events (eg, extended toolkit) VclEventListeners* mpKeyListeners; // listeners for key events only (eg, extended toolkit) ImplAccelManager* mpAccelMgr; // Accelerator Manager @@ -145,19 +155,22 @@ struct ImplSVAppData ImplWheelWindow* mpWheelWindow; // WheelWindow ImplHotKey* mpFirstHotKey; // HotKey-Verwaltung ImplEventHook* mpFirstEventHook; // Event-Hooks - ULONG mnLastInputTime; // GetLastInputTime() - USHORT mnDispatchLevel; // DispatchLevel - USHORT mnModalMode; // ModalMode Count - USHORT mnModalDialog; // ModalDialog Count - USHORT mnAccessCount; // AccessHdl Count - USHORT mnSysWinMode; // Modus, wann SystemWindows erzeugt werden sollen - USHORT mnLayout; // --- RTL-Flags --- currently not used, only for testing - short mnDialogScaleX; // Scale X-Positions and sizes in Dialogs - BOOL mbInAppMain; // is Application::Main() on stack - BOOL mbInAppExecute; // is Application::Execute() on stack - BOOL mbAppQuit; // is Application::Quit() called - BOOL mbSettingsInit; // TRUE: Settings are init - BOOL mbDialogCancel; // TRUE: Alle Dialog::Execute()-Aufrufe werden mit return FALSE sofort beendet + VclEventListeners2* mpPostYieldListeners; // post yield listeners + ULONG mnLastInputTime; // GetLastInputTime() + USHORT mnDispatchLevel; // DispatchLevel + USHORT mnModalMode; // ModalMode Count + USHORT mnModalDialog; // ModalDialog Count + USHORT mnAccessCount; // AccessHdl Count + USHORT mnSysWinMode; // Modus, wann SystemWindows erzeugt werden sollen + USHORT mnLayout; // --- RTL-Flags --- currently not used, only for testing + short mnDialogScaleX; // Scale X-Positions and sizes in Dialogs + BOOL mbInAppMain; // is Application::Main() on stack + BOOL mbInAppExecute; // is Application::Execute() on stack + BOOL mbAppQuit; // is Application::Quit() called + BOOL mbSettingsInit; // TRUE: Settings are initialized + BOOL mbDialogCancel; // TRUE: Alle Dialog::Execute()-Aufrufe werden mit return FALSE sofort beendet + BOOL mbNoYield; // Application::Yield will not wait for events if the queue is empty + // essentially that makes it the same as Application::Reschedule /** Controls whether showing any IME status window is toggled on or off. @@ -196,8 +209,8 @@ struct ImplSVGDIData long mnAppFontX; // AppFont X-Numenator for 40/tel Width + DialogScaleX long mnAppFontY; // AppFont Y-Numenator for 80/tel Height BOOL mbFontSubChanged; // TRUE: FontSubstitution wurde zwischen Begin/End geaendert - vcl::DefaultFontConfiguration* mpDefaultFontConfiguration; - vcl::FontSubstConfiguration* mpFontSubstConfiguration; + utl::DefaultFontConfiguration* mpDefaultFontConfiguration; + utl::FontSubstConfiguration* mpFontSubstConfiguration; bool mbPrinterPullModel; // true: use pull model instead of normal push model when printing bool mbNativeFontConfig; // true: do not override UI font bool mbNoXORClipping; // true: do not use XOR to achieve clipping effects @@ -247,6 +260,10 @@ struct ImplSVCtrlData ImageList* mpSplitVPinImgList; // ImageList for Vertikale SplitWindows (PIN's) ImageList* mpSplitHArwImgList; // ImageList for Horizontale SplitWindows (Arrows) ImageList* mpSplitVArwImgList; // ImageList for Vertikale SplitWindows (Arrows) + Image* mpDisclosurePlus; + Image* mpDisclosurePlusHC; + Image* mpDisclosureMinus; + Image* mpDisclosureMinusHC; ImplTBDragMgr* mpTBDragMgr; // DragMgr for ToolBox USHORT mnCheckStyle; // CheckBox-Style for ImageList-Update USHORT mnRadioStyle; // Radio-Style for ImageList-Update @@ -355,6 +372,7 @@ void ImplDeInitSVData(); void ImplDestroySVData(); Window* ImplGetDefaultWindow(); VCL_DLLPUBLIC ResMgr* ImplGetResMgr(); +VCL_DLLPUBLIC ResId VclResId( sal_Int32 nId ); // throws std::bad_alloc if no res mgr DockingManager* ImplGetDockingManager(); void ImplWindowAutoMnemonic( Window* pWindow ); diff --git a/vcl/inc/vcl/svids.hrc b/vcl/inc/vcl/svids.hrc index 48297a04ea0e..e2a8226ac878 100644 --- a/vcl/inc/vcl/svids.hrc +++ b/vcl/inc/vcl/svids.hrc @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: svids.hrc,v $ - * $Revision: 1.8 $ + * $Revision: 1.8.84.3 $ * * This file is part of OpenOffice.org. * @@ -31,6 +31,8 @@ #ifndef _SV_SVIDS_HRC #define _SV_SVIDS_HRC +#include "svl/solar.hrc" + #define SV_RESID_STDOFFSET 0 #define SV_RESID_WINOFFSET 1 #define SV_RESID_OS2OFFSET 2 @@ -58,6 +60,11 @@ #define SV_RESID_BITMAP_CLOSEDOC 1052 #define SV_RESID_BITMAP_CLOSEDOCHC 1053 +#define SV_DISCLOSURE_PLUS 1060 +#define SV_DISCLOSURE_MINUS 1061 +#define SV_DISCLOSURE_PLUS_HC 1062 +#define SV_DISCLOSURE_MINUS_HC 1063 + #define SV_RESID_MENU_EDIT 2000 #define SV_MENU_EDIT_UNDO 1 #define SV_MENU_EDIT_CUT 2 @@ -74,6 +81,92 @@ #define SV_MENU_MAC_SHOWALL 2005 #define SV_MENU_MAC_QUITAPP 2006 +#define SV_DLG_PRINT 2048 +#define SV_PRINT_OK 1 +#define SV_PRINT_CANCEL 2 +#define SV_PRINT_HELP 3 +#define SV_PRINT_PAGE_PREVIEW 4 +#define SV_PRINT_PAGE_TXT 5 +#define SV_PRINT_PAGE_FORWARD 6 +#define SV_PRINT_PAGE_BACKWARD 7 +#define SV_PRINT_PAGE_EDIT 8 +#define SV_PRINT_TABCTRL 9 +#define SV_PRINT_PRT_TYPE 10 +#define SV_PRINT_PRT_STATUS 11 +#define SV_PRINT_PRT_LOCATION 12 +#define SV_PRINT_PRT_COMMENT 13 +#define SV_PRINT_TOFILE_TXT 14 +#define SV_PRINT_DEFPRT_TXT 15 +#define SV_PRINT_PRINTPREVIEW_TXT 16 + +#define SV_PRINT_TAB_NUP 1 +#define SV_PRINT_PRT_NUP_LAYOUT_FL 1 +#define SV_PRINT_PRT_NUP_DEFAULT_BTN 2 +#define SV_PRINT_PRT_NUP_BROCHURE_BTN 3 +#define SV_PRINT_PRT_NUP_PAGES_BTN 4 +#define SV_PRINT_PRT_NUP_PAGES_BOX 5 +#define SV_PRINT_PRT_NUP_NUM_PAGES_TXT 6 +#define SV_PRINT_PRT_NUP_COLS_EDT 7 +#define SV_PRINT_PRT_NUP_TIMES_TXT 8 +#define SV_PRINT_PRT_NUP_ROWS_EDT 9 +#define SV_PRINT_PRT_NUP_MARGINS_PAGES_1_TXT 10 +#define SV_PRINT_PRT_NUP_MARGINS_PAGES_EDT 11 +#define SV_PRINT_PRT_NUP_MARGINS_PAGES_2_TXT 12 +#define SV_PRINT_PRT_NUP_MARGINS_SHEET_1_TXT 13 +#define SV_PRINT_PRT_NUP_MARGINS_SHEET_EDT 14 +#define SV_PRINT_PRT_NUP_MARGINS_SHEET_2_TXT 15 +#define SV_PRINT_PRT_NUP_ORIENTATION_TXT 16 +#define SV_PRINT_PRT_NUP_ORIENTATION_BOX 17 +#define SV_PRINT_PRT_NUP_ORDER_TXT 18 +#define SV_PRINT_PRT_NUP_ORDER_BOX 19 +#define SV_PRINT_PRT_NUP_BORDER_CB 20 + +#define SV_PRINT_PRT_NUP_ORIENTATION_AUTOMATIC 0 +#define SV_PRINT_PRT_NUP_ORIENTATION_PORTRAIT 1 +#define SV_PRINT_PRT_NUP_ORIENTATION_LANDSCAPE 2 + +#define SV_PRINT_PRT_NUP_ORDER_LRTD 0 +#define SV_PRINT_PRT_NUP_ORDER_TDLR 1 + +#define SV_PRINT_TAB_JOB 2 +#define SV_PRINT_PRINTERS_FL 1 +#define SV_PRINT_PRINTERS 2 +#define SV_PRINT_PRT_SETUP 3 +#define SV_PRINT_RANGE 4 +#define SV_PRINT_ALL 5 +#define SV_PRINT_PAGERANGE 6 +#define SV_PRINT_SELECTION 7 +#define SV_PRINT_PAGERANGE_EDIT 8 +#define SV_PRINT_COPIES 9 +#define SV_PRINT_COPYCOUNT 10 +#define SV_PRINT_COPYCOUNT_FIELD 11 +#define SV_PRINT_COLLATE 12 +#define SV_PRINT_COLLATE_IMAGE 13 +#define SV_PRINT_BUTTONLINE 14 +#define SV_PRINT_COLLATE_IMG 15 +#define SV_PRINT_NOCOLLATE_IMG 16 +#define SV_PRINT_COLLATE_HC_IMG 17 +#define SV_PRINT_NOCOLLATE_HC_IMG 18 +#define SV_PRINT_NOPAGES 19 +#define SV_PRINT_STATUS_TXT 20 +#define SV_PRINT_LOCATION_TXT 21 +#define SV_PRINT_COMMENT_TXT 22 +#define SV_PRINT_DETAILS_BTN 23 + +#define SV_PRINT_TAB_OPT 3 +#define SV_PRINT_OPT_PRINT_FL 1 +#define SV_PRINT_OPT_TOFILE 2 +#define SV_PRINT_OPT_SINGLEJOBS 3 +#define SV_PRINT_OPT_REVERSE 4 + +#define SV_DLG_PRINT_PROGRESS 2049 +#define SV_PRINT_PROGRESS_CANCEL 1 +#define SV_PRINT_PROGRESS_TEXT 2 + +#define SV_PRINT_NATIVE_STRINGS 2050 +#define SV_PRINT_NOPRINTERWARNING 2051 +#define SV_PRINT_NOCONTENT 2052 + #define SV_HELPTEXT_CLOSE 10000 #define SV_HELPTEXT_MINIMIZE 10001 #define SV_HELPTEXT_MAXIMIZE 10002 @@ -108,7 +201,8 @@ #define SV_STDTEXT_ABOUT 10204 #define SV_STDTEXT_PREFERENCES 10205 #define SV_MAC_SCREENNNAME 10206 -#define SV_STDTEXT_LAST SV_MAC_SCREENNNAME +#define SV_STDTEXT_ALLFILETYPES 10207 +#define SV_STDTEXT_LAST SV_STDTEXT_ALLFILETYPES #define SV_ACCESSERROR_FIRST SV_ACCESSERROR_WRONG_VERSION #define SV_ACCESSERROR_WRONG_VERSION 10500 @@ -165,4 +259,6 @@ #define SV_ICON_ID_MACRO 17 #define SV_ICON_ID_PRINTERADMIN 501 +#define HID_PRINTDLG HID_VCL_START + #endif // _SV_SVIDS_HRC diff --git a/vcl/inc/vcl/syswin.hxx b/vcl/inc/vcl/syswin.hxx index 99a340ae4a58..d590cfe0a37e 100644 --- a/vcl/inc/vcl/syswin.hxx +++ b/vcl/inc/vcl/syswin.hxx @@ -201,6 +201,10 @@ public: void SetIcon( USHORT nIcon ); USHORT GetIcon() const { return mnIcon; } + // for systems like MacOSX which can display the URL a document is loaded from + // separately from the window title + void SetRepresentedURL( const rtl::OUString& ); + const rtl::OUString& GetRepresentedURL() const; void SetZLevel( BYTE nLevel ); BYTE GetZLevel() const; diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx index 378459b9eadb..f6646426b2e7 100644 --- a/vcl/inc/vcl/tabctrl.hxx +++ b/vcl/inc/vcl/tabctrl.hxx @@ -31,15 +31,16 @@ #ifndef _SV_TABCTRL_HXX #define _SV_TABCTRL_HXX -#include <vcl/sv.h> -#include <vcl/dllapi.h> -#include <vcl/ctrl.hxx> +#include "vcl/sv.h" +#include "vcl/dllapi.h" +#include "vcl/ctrl.hxx" struct ImplTabItem; struct ImplTabCtrlData; class ImplTabItemList; class TabPage; class PushButton; +class ListBox; // -------------------- // - TabControl-Types - @@ -72,12 +73,13 @@ private: BOOL mbRestoreUnqId; BOOL mbSingleLine; BOOL mbScroll; - BOOL mbColored; + BOOL mbRestoreSmartId; BOOL mbSmallInvalidate; BOOL mbExtraSpace; Link maActivateHdl; Link maDeactivateHdl; + using Control::ImplInitSettings; SAL_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ); SAL_DLLPRIVATE ImplTabItem* ImplGetItem( USHORT nId ) const; SAL_DLLPRIVATE void ImplScrollBtnsColor(); @@ -94,6 +96,7 @@ private: SAL_DLLPRIVATE void ImplPaint( const Rectangle& rRect, bool bLayout = false ); SAL_DLLPRIVATE void ImplFreeLayoutData(); DECL_DLLPRIVATE_LINK( ImplScrollBtnHdl, PushButton* pBtn ); + DECL_DLLPRIVATE_LINK( ImplListBoxSelectHdl, ListBox* ); protected: using Window::ImplInit; @@ -101,6 +104,8 @@ protected: SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); virtual void FillLayoutData() const; + virtual const Font& GetCanonicalFont( const StyleSettings& _rStyle ) const; + virtual const Color& GetCanonicalTextColor( const StyleSettings& _rStyle ) const; SAL_DLLPRIVATE Rectangle* ImplFindPartRect( const Point& rPt ); public: @@ -125,6 +130,9 @@ public: virtual void ActivatePage(); virtual long DeactivatePage(); + virtual Size GetOptimalSize(WindowSizeType eType) const; + void SetMinimumSizePixel( const Size& ); + void SetTabPageSizePixel( const Size& rSize ); Size GetTabPageSizePixel() const; diff --git a/vcl/inc/vcl/textlayout.hxx b/vcl/inc/vcl/textlayout.hxx new file mode 100755 index 000000000000..4c290452e2ad --- /dev/null +++ b/vcl/inc/vcl/textlayout.hxx @@ -0,0 +1,134 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ +
+#ifndef VCL_TEXTLAYOUT_HXX +#define VCL_TEXTLAYOUT_HXX + +#include "vcl/outdev.hxx" + +#include <tools/solar.h> +#include <tools/string.hxx> + +#include <memory> + +class Control; + +//........................................................................ +namespace vcl +{ +//........................................................................ + + //==================================================================== + //= ITextLayout + //==================================================================== + class SAL_NO_VTABLE ITextLayout + { + public: + virtual long GetTextWidth( const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; + virtual void DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength, + MetricVector* _pVector, String* _pDisplayText ) = 0; + virtual bool GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; + virtual xub_StrLen GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const = 0; + virtual bool DecomposeTextRectAction() const = 0; + }; + + //==================================================================== + //= DefaultTextLayout + //==================================================================== + /** is an implementation of the ITextLayout interface which simply delegates its calls to the respective + methods of an OutputDevice instance, without any inbetween magic. + */ + class DefaultTextLayout : public ITextLayout + { + public: + DefaultTextLayout( OutputDevice& _rTargetDevice ) + :m_rTargetDevice( _rTargetDevice ) + { + } + virtual ~DefaultTextLayout(); + + // ITextLayout overridables + virtual long GetTextWidth( + const XubString& _rText, + xub_StrLen _nStartIndex, + xub_StrLen _nLength + ) const; + virtual void DrawText( + const Point& _rStartPoint, + const XubString& _rText, + xub_StrLen _nStartIndex, + xub_StrLen _nLength, + MetricVector* _pVector, + String* _pDisplayText + ); + virtual bool GetCaretPositions( + const XubString& _rText, + sal_Int32* _pCaretXArray, + xub_StrLen _nStartIndex, + xub_StrLen _nLength + ) const; + virtual xub_StrLen GetTextBreak( + const XubString& _rText, + long _nMaxTextWidth, + xub_StrLen _nStartIndex, + xub_StrLen _nLength + ) const; + virtual bool DecomposeTextRectAction() const; + + private: + OutputDevice& m_rTargetDevice; + }; + + //==================================================================== + //= ControlTextRenderer + //==================================================================== + class ReferenceDeviceTextLayout; + /** a class which allows rendering text of a Control onto a device, by taking into account the metrics of + a reference device. + */ + class ControlTextRenderer + { + public: + ControlTextRenderer( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice ); + virtual ~ControlTextRenderer(); + + Rectangle DrawText( const Rectangle& _rRect, + const XubString& _rText, USHORT _nStyle = 0, + MetricVector* _pVector = NULL, String* _pDisplayText = NULL ); + + private: + ControlTextRenderer(); // never implemented + ControlTextRenderer( const ControlTextRenderer& ); // never implemented + ControlTextRenderer& operator=( const ControlTextRenderer& ); // never implemented + + private: + ::std::auto_ptr< ReferenceDeviceTextLayout > m_pImpl; + }; + +//........................................................................ +} // namespace vcl +//........................................................................ + +#endif // VCL_TEXTLAYOUT_HXX diff --git a/vcl/inc/vcl/toolbox.h b/vcl/inc/vcl/toolbox.h index 52a0db40b226..2dee85ab6b82 100644 --- a/vcl/inc/vcl/toolbox.h +++ b/vcl/inc/vcl/toolbox.h @@ -51,6 +51,7 @@ #define TB_LARGEIMAGESIZE 26 #define TB_LARGEIMAGESIZE_INDUSTRIAL 24 #define TB_LARGEIMAGESIZE_CRYSTAL 22 +#define TB_LARGEIMAGESIZE_OXYGEN 22 class Window; diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx index 6e4c300ccc40..c2547e4b01ba 100644 --- a/vcl/inc/vcl/toolbox.hxx +++ b/vcl/inc/vcl/toolbox.hxx @@ -124,6 +124,9 @@ typedef USHORT ToolBoxItemBits; #define TIB_DROPDOWN ((ToolBoxItemBits)0x0020) #define TIB_REPEAT ((ToolBoxItemBits)0x0040) #define TIB_DROPDOWNONLY ((ToolBoxItemBits)0x0080 | TIB_DROPDOWN) // this button has only drop down functionality +#define TIB_TEXT_ONLY ((ToolBoxItemBits)0x0100) +#define TIB_ICON_ONLY ((ToolBoxItemBits)0x0200) +#define TIB_TEXTICON ((ToolBoxItemBits) TIB_TEXT_ONLY | TIB_ICON_ONLY ) // ----------------- // - ToolBox-Types - diff --git a/vcl/inc/vcl/vclevent.hxx b/vcl/inc/vcl/vclevent.hxx index ff0639d70e82..74971f62c5a6 100644 --- a/vcl/inc/vcl/vclevent.hxx +++ b/vcl/inc/vcl/vclevent.hxx @@ -31,11 +31,13 @@ #ifndef _VCL_VCLEVENT_HXX #define _VCL_VCLEVENT_HXX -#include <tools/link.hxx> -#include <tools/rtti.hxx> -#include <vcl/dllapi.h> +#include "tools/link.hxx" +#include "tools/rtti.hxx" +#include "vcl/dllapi.h" +#include "vcl/impdel.hxx" #include <list> +#include <vector> class Window; class Menu; @@ -251,4 +253,29 @@ public: BOOL Process( VclSimpleEvent* pEvent ) const; }; +class VCL_DLLPUBLIC VclEventListeners2 : public vcl::DeletionNotifier +{ + std::list< Link > m_aListeners; + + struct ListenerIt + { + std::list< Link >::iterator m_aIt; + bool m_bWasInvalidated; + + ListenerIt() : m_bWasInvalidated( false ) {} + }; + + std::vector< ListenerIt > m_aIterators; + + +public: + VclEventListeners2(); + ~VclEventListeners2(); + + void addListener( const Link& ); + void removeListener( const Link& ); + + void callListeners( VclSimpleEvent* ); +}; + #endif // _VCL_VCLEVENT_HXX diff --git a/vcl/inc/vcl/virdev.hxx b/vcl/inc/vcl/virdev.hxx index bc21dde6f4ac..ea2b49eb8290 100644 --- a/vcl/inc/vcl/virdev.hxx +++ b/vcl/inc/vcl/virdev.hxx @@ -74,7 +74,6 @@ private: #define REFDEV_FORCE_ZERO_EXTLEAD 0x80 SAL_DLLPRIVATE bool ForceZeroExtleadBug() const { return ((meRefDevMode & REFDEV_FORCE_ZERO_EXTLEAD) != 0); } - public: VirtualDevice( USHORT nBitCount = 0 ); VirtualDevice( const OutputDevice& rCompDev, @@ -115,11 +114,19 @@ public: REFDEV_MODE06 = 1, // 600 dpi REFDEV_MODE48 = 2, // 4800 dpi REFDEV_MODE_MSO1 = 3, - REFDEV_MODE_PDF1 = 4 }; + REFDEV_MODE_PDF1 = 4, + REFDEV_CUSTOM = 5 + }; void SetReferenceDevice( RefDevMode ); void Compat_ZeroExtleadBug(); // enable workaround for #i60495# + + void SetReferenceDevice( sal_Int32 i_nDPIX, sal_Int32 i_nDPIY ); + +private: + SAL_DLLPRIVATE void ImplSetReferenceDevice( RefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY ); + }; #endif // _SV_VIRDEV_HXX diff --git a/vcl/inc/vcl/window.h b/vcl/inc/vcl/window.h index d745f3dcf081..563849873e3b 100644 --- a/vcl/inc/vcl/window.h +++ b/vcl/inc/vcl/window.h @@ -358,7 +358,8 @@ public: mbToolbarFloatingWindow:1, mbCallHandlersDuringInputDisabled:1, mbDisableAccessibleLabelForRelation:1, - mbDisableAccessibleLabeledByRelation:1; + mbDisableAccessibleLabeledByRelation:1, + mbHelpTextDynamic:1; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer; }; diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index eba46362d94e..56fdb22ddc57 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -321,7 +321,6 @@ typedef USHORT StateChangedType; #define IMPL_MSGBOX_OFFSET_EXTRA_X 0 #define IMPL_MSGBOX_OFFSET_EXTRA_Y 2 #define IMPL_SEP_MSGBOX_IMAGE 8 -#define IMPL_SEP_BUTTON_IMAGE 4 #define DLGWINDOW_PREV 0 #define DLGWINDOW_NEXT 1 diff --git a/vcl/inc/vcl/wintypes.hxx b/vcl/inc/vcl/wintypes.hxx index 968f0e1d255f..9e84648fb6a8 100644 --- a/vcl/inc/vcl/wintypes.hxx +++ b/vcl/inc/vcl/wintypes.hxx @@ -30,308 +30,7 @@ #ifndef _SV_WINTYPES_HXX #define _SV_WINTYPES_HXX -#include <vcl/sv.h> -#include <sal/types.h> - -// ---------------- -// - Window-Types - -// ---------------- - -typedef USHORT WindowType; -#define WINDOW_BASE 0x0100 -#define WINDOW_FIRST (WINDOW_BASE + 0x30) -#define WINDOW_MESSBOX (WINDOW_FIRST) -#define WINDOW_INFOBOX (WINDOW_FIRST + 0x01) -#define WINDOW_WARNINGBOX (WINDOW_FIRST + 0x02) -#define WINDOW_ERRORBOX (WINDOW_FIRST + 0x03) -#define WINDOW_QUERYBOX (WINDOW_FIRST + 0x04) -#define WINDOW_WINDOW (WINDOW_FIRST + 0x05) -#define WINDOW_SYSWINDOW (WINDOW_FIRST + 0x06) -#define WINDOW_WORKWINDOW (WINDOW_FIRST + 0x07) -// #define WINDOW_MDIWINDOW (WINDOW_FIRST + 0x08) -#define WINDOW_FLOATINGWINDOW (WINDOW_FIRST + 0x09) -#define WINDOW_DIALOG (WINDOW_FIRST + 0x0a) -#define WINDOW_MODELESSDIALOG (WINDOW_FIRST + 0x0b) -#define WINDOW_MODALDIALOG (WINDOW_FIRST + 0x0c) -#define WINDOW_SYSTEMDIALOG (WINDOW_FIRST + 0x0d) -#define WINDOW_PATHDIALOG (WINDOW_FIRST + 0x0e) -#define WINDOW_FILEDIALOG (WINDOW_FIRST + 0x0f) -#define WINDOW_PRINTERSETUPDIALOG (WINDOW_FIRST + 0x10) -#define WINDOW_PRINTDIALOG (WINDOW_FIRST + 0x11) -#define WINDOW_COLORDIALOG (WINDOW_FIRST + 0x12) -#define WINDOW_FONTDIALOG (WINDOW_FIRST + 0x13) -#define WINDOW_CONTROL (WINDOW_FIRST + 0x14) -#define WINDOW_BUTTON (WINDOW_FIRST + 0x15) -#define WINDOW_PUSHBUTTON (WINDOW_FIRST + 0x16) -#define WINDOW_OKBUTTON (WINDOW_FIRST + 0x17) -#define WINDOW_CANCELBUTTON (WINDOW_FIRST + 0x18) -#define WINDOW_HELPBUTTON (WINDOW_FIRST + 0x19) -#define WINDOW_IMAGEBUTTON (WINDOW_FIRST + 0x1a) -#define WINDOW_MENUBUTTON (WINDOW_FIRST + 0x1b) -#define WINDOW_MOREBUTTON (WINDOW_FIRST + 0x1c) -#define WINDOW_SPINBUTTON (WINDOW_FIRST + 0x1d) -#define WINDOW_RADIOBUTTON (WINDOW_FIRST + 0x1e) -#define WINDOW_IMAGERADIOBUTTON (WINDOW_FIRST + 0x1f) -#define WINDOW_CHECKBOX (WINDOW_FIRST + 0x20) -#define WINDOW_TRISTATEBOX (WINDOW_FIRST + 0x21) -#define WINDOW_EDIT (WINDOW_FIRST + 0x22) -#define WINDOW_MULTILINEEDIT (WINDOW_FIRST + 0x23) -#define WINDOW_COMBOBOX (WINDOW_FIRST + 0x24) -#define WINDOW_LISTBOX (WINDOW_FIRST + 0x25) -#define WINDOW_MULTILISTBOX (WINDOW_FIRST + 0x26) -#define WINDOW_FIXEDTEXT (WINDOW_FIRST + 0x27) -#define WINDOW_FIXEDLINE (WINDOW_FIRST + 0x28) -#define WINDOW_FIXEDBITMAP (WINDOW_FIRST + 0x29) -#define WINDOW_FIXEDIMAGE (WINDOW_FIRST + 0x2a) -#define WINDOW_GROUPBOX (WINDOW_FIRST + 0x2c) -#define WINDOW_SCROLLBAR (WINDOW_FIRST + 0x2d) -#define WINDOW_SCROLLBARBOX (WINDOW_FIRST + 0x2e) -#define WINDOW_SPLITTER (WINDOW_FIRST + 0x2f) -#define WINDOW_SPLITWINDOW (WINDOW_FIRST + 0x30) -#define WINDOW_SPINFIELD (WINDOW_FIRST + 0x31) -#define WINDOW_PATTERNFIELD (WINDOW_FIRST + 0x32) -#define WINDOW_NUMERICFIELD (WINDOW_FIRST + 0x33) -#define WINDOW_METRICFIELD (WINDOW_FIRST + 0x34) -#define WINDOW_CURRENCYFIELD (WINDOW_FIRST + 0x35) -#define WINDOW_DATEFIELD (WINDOW_FIRST + 0x36) -#define WINDOW_TIMEFIELD (WINDOW_FIRST + 0x37) -#define WINDOW_PATTERNBOX (WINDOW_FIRST + 0x38) -#define WINDOW_NUMERICBOX (WINDOW_FIRST + 0x39) -#define WINDOW_METRICBOX (WINDOW_FIRST + 0x3a) -#define WINDOW_CURRENCYBOX (WINDOW_FIRST + 0x3b) -#define WINDOW_DATEBOX (WINDOW_FIRST + 0x3c) -#define WINDOW_TIMEBOX (WINDOW_FIRST + 0x3d) -#define WINDOW_LONGCURRENCYFIELD (WINDOW_FIRST + 0x3e) -#define WINDOW_LONGCURRENCYBOX (WINDOW_FIRST + 0x3f) -#define WINDOW_TOOLBOX (WINDOW_FIRST + 0x41) -#define WINDOW_DOCKINGWINDOW (WINDOW_FIRST + 0x42) -#define WINDOW_STATUSBAR (WINDOW_FIRST + 0x43) -#define WINDOW_TABPAGE (WINDOW_FIRST + 0x44) -#define WINDOW_TABCONTROL (WINDOW_FIRST + 0x45) -#define WINDOW_TABDIALOG (WINDOW_FIRST + 0x46) -#define WINDOW_BORDERWINDOW (WINDOW_FIRST + 0x47) -#define WINDOW_BUTTONDIALOG (WINDOW_FIRST + 0x48) -#define WINDOW_SYSTEMCHILDWINDOW (WINDOW_FIRST + 0x49) -#define WINDOW_FIXEDBORDER (WINDOW_FIRST + 0x4a) -#define WINDOW_SLIDER (WINDOW_FIRST + 0x4b) -#define WINDOW_MENUBARWINDOW (WINDOW_FIRST + 0x4c) -#define WINDOW_TREELISTBOX (WINDOW_FIRST + 0x4d) -#define WINDOW_HELPTEXTWINDOW (WINDOW_FIRST + 0x4e) -#define WINDOW_INTROWINDOW (WINDOW_FIRST + 0x4f) -#define WINDOW_LISTBOXWINDOW (WINDOW_FIRST + 0x50) -#define WINDOW_DOCKINGAREA (WINDOW_FIRST + 0x51) -#define WINDOW_LAST (WINDOW_DOCKINGAREA) - - -// --------------- -// - Window-Bits - -// --------------- - -// By changes you must also change: rsc/vclrsc.hxx -typedef sal_Int64 WinBits; - -// Window-Bits fuer Window -#define WB_CLIPCHILDREN ((WinBits)0x00000001) -#define WB_DIALOGCONTROL ((WinBits)0x00000002) -#define WB_NODIALOGCONTROL ((WinBits)0x00000004) -#define WB_BORDER ((WinBits)0x00000008) -#define WB_NOBORDER ((WinBits)0x00000010) -#define WB_SIZEABLE ((WinBits)0x00000020) -#define WB_3DLOOK ((WinBits)0x00000040) -#define WB_AUTOSIZE ((WinBits)0x00000080) - -// Window-Bits fuer SystemWindows -#define WB_MOVEABLE ((WinBits)0x00000100) -#define WB_ROLLABLE ((WinBits)0x00000200) -#define WB_CLOSEABLE ((WinBits)0x00000400) -#define WB_STANDALONE ((WinBits)0x00000800) -#define WB_APP ((WinBits)0x00001000) -#define WB_PINABLE ((WinBits)0x00002000) -#define WB_SYSTEMWINDOW ((WinBits)SAL_CONST_INT64(0x40000000)) -// warning: do not confuse WB_SYSTEMCHILDWINDOW with the SystemChildWindow class - -// the SystemChildWindow class was there first and is a very specialized -// sytem child window type for plugged applications. The SystemChildWindow class -// explicitly should never use the WB_SYSTEMCHILDWINDOW WinBit - -// WB_SYSTEMCHILDWINDOW on the other hand is to be used on system windows -// which should be created as system child windows with (more or less) -// normal event handling -#define WB_SYSTEMCHILDWINDOW ((WinBits)SAL_CONST_INT64(0x8000000000)) -#define WB_SIZEMOVE (WB_SIZEABLE | WB_MOVEABLE) - -// Standard-Window-Bits fuer ChildWindows -#define WB_TABSTOP ((WinBits)0x00000100) -#define WB_NOTABSTOP ((WinBits)0x00000200) -#define WB_GROUP ((WinBits)0x00000400) -#define WB_NOGROUP ((WinBits)0x00000800) -#define WB_HORZ ((WinBits)0x00001000) -#define WB_VERT ((WinBits)0x00002000) -#define WB_LEFT ((WinBits)0x00004000) -#define WB_CENTER ((WinBits)0x00008000) -#define WB_RIGHT ((WinBits)0x00010000) -#define WB_TOP ((WinBits)0x00020000) -#define WB_VCENTER ((WinBits)0x00040000) -#define WB_BOTTOM ((WinBits)0x00080000) -#define WB_DRAG ((WinBits)0x00100000) -#define WB_SPIN ((WinBits)0x00200000) -#define WB_REPEAT ((WinBits)0x00400000) -#define WB_NOPOINTERFOCUS ((WinBits)0x00800000) -#define WB_WORDBREAK ((WinBits)0x01000000) -#define WB_NOLABEL ((WinBits)0x02000000) -#define WB_SORT ((WinBits)0x04000000) -#define WB_DROPDOWN ((WinBits)0x08000000) -#define WB_AUTOHSCROLL ((WinBits)SAL_CONST_INT64(0x10000000)) -#define WB_DOCKABLE ((WinBits)SAL_CONST_INT64(0x20000000)) -#define WB_AUTOVSCROLL ((WinBits)SAL_CONST_INT64(0x40000000)) -#define WB_HYPHENATION (((WinBits)SAL_CONST_INT64(0x80000000)) | WB_WORDBREAK) -#define WB_CHILDDLGCTRL ((WinBits)SAL_CONST_INT64(0x100000000000)) - -// system floating window -#define WB_SYSTEMFLOATWIN ((WinBits)SAL_CONST_INT64(0x100000000)) -#define WB_INTROWIN ((WinBits)SAL_CONST_INT64(0x200000000)) -#define WB_NOSHADOW ((WinBits)SAL_CONST_INT64(0x400000000)) -#define WB_TOOLTIPWIN ((WinBits)SAL_CONST_INT64(0x800000000)) -#define WB_OWNERDRAWDECORATION ((WinBits)SAL_CONST_INT64(0x2000000000)) -#define WB_DEFAULTWIN ((WinBits)SAL_CONST_INT64(0x4000000000)) -#define WB_NEEDSFOCUS ((WinBits)SAL_CONST_INT64(0x1000000000)) - -#define WB_HIDE ((WinBits)SAL_CONST_INT64(0x80000000)) -#define WB_HSCROLL WB_HORZ -#define WB_VSCROLL WB_VERT -#define WB_TOPIMAGE WB_TOP - -// Window-Bits for PushButtons -#define WB_DEFBUTTON ((WinBits)0x10000000) -#define WB_NOLIGHTBORDER ((WinBits)0x20000000) -#define WB_RECTSTYLE ((WinBits)0x08000000) -#define WB_SMALLSTYLE ((WinBits)0x04000000) -#define WB_TOGGLE ((WinBits)SAL_CONST_INT64(0x1000000000)) -#define WB_BEVELBUTTON ((WinBits)SAL_CONST_INT64(0x2000000000)) - -// Window-Bits for FixedText -#define WB_PATHELLIPSIS ((WinBits)0x00100000) -#define WB_EXTRAOFFSET ((WinBits)0x02000000) -#define WB_NOMULTILINE ((WinBits)0x10000000) -#define WB_INFO ((WinBits)0x20000000) - -// Window-Bits for CheckBox -#define WB_CBLINESTYLE ((WinBits)SAL_CONST_INT64(0x2000000000)) - -// Window-Bits for Edit -#define WB_PASSWORD ((WinBits)0x01000000) -#define WB_READONLY ((WinBits)0x02000000) -#define WB_NOHIDESELECTION ((WinBits)SAL_CONST_INT64(0x1000000000)) -#define WB_FORCECTRLBACKGROUND ((WinBits)0x80000000) - -// Window-Bits for MultiLineEdit -#define WB_IGNORETAB ((WinBits)0x20000000) - -// Window-Bits for ListBox and MultiListBox -#define WB_SIMPLEMODE ((WinBits)0x20000000) - -// Window-Bits for FixedBitmap -#define WB_FAST ((WinBits)0x04000000) -#define WB_SCALE ((WinBits)0x08000000) -#define WB_TOPLEFTVISIBLE ((WinBits)0x10000000) - -// Window-Bits for ToolBox -#define WB_LINESPACING ((WinBits)0x01000000) -#define WB_SCROLL ((WinBits)0x02000000) -#define WB_FORCETABCYCLE ((WinBits)0x04000000) - -// Window-Bits for TabControl -#define WB_SINGLELINE ((WinBits)0x02000000) - -// Window-Bits for DockingWindows -#define WB_DOCKBORDER ((WinBits)0x00001000) - -// Window-Bits for SplitWindow -#define WB_NOSPLITDRAW ((WinBits)0x01000000) -#define WB_FLATSPLITDRAW ((WinBits)0x02000000) - -// Window-Bits for MessageBoxen -#define WB_OK ((WinBits)0x00100000) -#define WB_OK_CANCEL ((WinBits)0x00200000) -#define WB_YES_NO ((WinBits)0x00400000) -#define WB_YES_NO_CANCEL ((WinBits)0x00800000) -#define WB_RETRY_CANCEL ((WinBits)0x01000000) -#define WB_DEF_OK ((WinBits)0x02000000) -#define WB_DEF_CANCEL ((WinBits)0x04000000) -#define WB_DEF_RETRY ((WinBits)0x08000000) -#define WB_DEF_YES ((WinBits)SAL_CONST_INT64(0x10000000)) -#define WB_DEF_NO ((WinBits)SAL_CONST_INT64(0x20000000)) -#define WB_ABORT_RETRY_IGNORE ((WinBits)SAL_CONST_INT64(0x1000000000)) -#define WB_DEF_IGNORE ((WinBits)SAL_CONST_INT64(0x2000000000)) - -// Standard-WinBits -#define WB_STDWORK (WB_SIZEMOVE | WB_CLOSEABLE) -#define WB_STDDOCKWIN (WB_DOCKABLE | WB_MOVEABLE | WB_CLOSEABLE) -#define WB_STDFLOATWIN (WB_SIZEMOVE | WB_CLOSEABLE | WB_ROLLABLE) -#define WB_STDDIALOG (WB_MOVEABLE | WB_CLOSEABLE) -#define WB_STDMODELESS (WB_STDDIALOG) -#define WB_STDMODAL (WB_STDDIALOG) -#define WB_STDTABDIALOG (WB_STDDIALOG) -#define WB_STDTABCONTROL 0 - -// For TreeListBox -#define WB_HASBUTTONS ((WinBits)0x00800000) -#define WB_HASLINES ((WinBits)0x01000000) -#define WB_HASLINESATROOT ((WinBits)0x02000000) - -// For FileOpen Dialog -#define WB_PATH ((WinBits)0x00100000) -#define WB_OPEN ((WinBits)0x00200000) -#define WB_SAVEAS ((WinBits)0x00400000) - -// For Slider -// Window-Bits for TabControl -#define WB_SLIDERSET ((WinBits)0x02000000) - - -// -------------------- -// - extended WinBits - -// -------------------- -#define WB_EXT_DOCUMENT ((WinBits)0x00000001) -#define WB_EXT_DOCMODIFIED ((WinBits)0x00000002) - -// --------------- -// - WindowAlign - -// --------------- - -// By changes you must also change: rsc/vclrsc.hxx -enum WindowAlign { WINDOWALIGN_LEFT, WINDOWALIGN_TOP, WINDOWALIGN_RIGHT, WINDOWALIGN_BOTTOM }; -enum ImageAlign { IMAGEALIGN_LEFT, IMAGEALIGN_TOP, IMAGEALIGN_RIGHT, IMAGEALIGN_BOTTOM, - IMAGEALIGN_LEFT_TOP, IMAGEALIGN_LEFT_BOTTOM, IMAGEALIGN_TOP_LEFT, - IMAGEALIGN_TOP_RIGHT, IMAGEALIGN_RIGHT_TOP, IMAGEALIGN_RIGHT_BOTTOM, - IMAGEALIGN_BOTTOM_LEFT, IMAGEALIGN_BOTTOM_RIGHT, IMAGEALIGN_CENTER }; -enum SymbolAlign { SYMBOLALIGN_LEFT, SYMBOLALIGN_RIGHT }; - -// ------------ -// - TriState - -// ------------ - -// By changes you must also change: rsc/vclrsc.hxx -enum TriState { STATE_NOCHECK, STATE_CHECK, STATE_DONTKNOW }; - - -// ---------------------- -// - ButtonDialog-Types - -// ---------------------- - -typedef USHORT StandardButtonType; -#define BUTTON_OK ((StandardButtonType)0) -#define BUTTON_CANCEL ((StandardButtonType)1) -#define BUTTON_YES ((StandardButtonType)2) -#define BUTTON_NO ((StandardButtonType)3) -#define BUTTON_RETRY ((StandardButtonType)4) -#define BUTTON_HELP ((StandardButtonType)5) -#define BUTTON_CLOSE ((StandardButtonType)6) -#define BUTTON_MORE ((StandardButtonType)7) -#define BUTTON_IGNORE ((StandardButtonType)8) -#define BUTTON_ABORT ((StandardButtonType)9) -#define BUTTON_LESS ((StandardButtonType)10) -#define BUTTON_COUNT 11 +#include <tools/wintypes.hxx> #endif // _SV_WINTYPES_HXX diff --git a/vcl/inc/vcl/wrkwin.hxx b/vcl/inc/vcl/wrkwin.hxx index 8b2701420a2f..1dd46d8debe5 100644 --- a/vcl/inc/vcl/wrkwin.hxx +++ b/vcl/inc/vcl/wrkwin.hxx @@ -105,7 +105,7 @@ public: void Restore(); void Maximize( BOOL bMaximize = TRUE ); - BOOL IsMaximized(); + BOOL IsMaximized() const; }; #endif // _SV_WRKWIN_HXX diff --git a/vcl/os2/inc/salprn.h b/vcl/os2/inc/salprn.h index 25ecfe87ed89..2c95965bc609 100644 --- a/vcl/os2/inc/salprn.h +++ b/vcl/os2/inc/salprn.h @@ -83,7 +83,6 @@ public: virtual String GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin ); virtual void InitPaperFormats( const ImplJobSetup* pSetupData ); virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ); - virtual DuplexMode GetDuplexMode( const ImplJobSetup* pSetupData ); }; // ------------------ @@ -136,7 +135,9 @@ public: virtual BOOL StartJob( const XubString* pFileName, const XubString& rJobName, const XubString& rAppName, - ULONG nCopies, BOOL bCollate, + ULONG nCopies, + bool bCollate, + bool bDirect, ImplJobSetup* pSetupData ); virtual BOOL EndJob(); virtual BOOL AbortJob(); diff --git a/vcl/os2/source/app/salinst.cxx b/vcl/os2/source/app/salinst.cxx index d4d324ad469c..633ad4137aff 100644 --- a/vcl/os2/source/app/salinst.cxx +++ b/vcl/os2/source/app/salinst.cxx @@ -55,6 +55,7 @@ #include <salbmp.h> #include <vcl/salimestatus.hxx> #include <vcl/timer.hxx> +#include <tools/solarmutex.hxx> // ======================================================================= @@ -501,12 +502,14 @@ Os2SalInstance::Os2SalInstance() mpSalWaitMutex = new vos::OMutex; mnYieldWaitCount = 0; mpSalYieldMutex->acquire(); + ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex ); } // ----------------------------------------------------------------------- Os2SalInstance::~Os2SalInstance() { + ::tools::SolarMutex::SetSolarMutex( 0 ); mpSalYieldMutex->release(); delete mpSalYieldMutex; delete mpSalWaitMutex; diff --git a/vcl/os2/source/gdi/salgdi.cxx b/vcl/os2/source/gdi/salgdi.cxx index b6616eb3a24b..082e690c09e7 100644 --- a/vcl/os2/source/gdi/salgdi.cxx +++ b/vcl/os2/source/gdi/salgdi.cxx @@ -1016,7 +1016,7 @@ BOOL Os2SalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* } } - delete pBuf; + delete [] pBuf; return bRet; } diff --git a/vcl/os2/source/gdi/salgdi3.cxx b/vcl/os2/source/gdi/salgdi3.cxx index 573fa7336fb0..b25feee266e4 100644 --- a/vcl/os2/source/gdi/salgdi3.cxx +++ b/vcl/os2/source/gdi/salgdi3.cxx @@ -1361,10 +1361,8 @@ BOOL Os2SalGraphics::GetGlyphOutline( long nIndex, ::basegfx::B2DPolyPolygon& rB // rescaling needed for the PolyPolygon conversion if( rB2DPolyPoly.count() ) { - ::basegfx::B2DHomMatrix aMatrix; - aMatrix.scale( 1.0/256, 1.0/256 ); - aMatrix.scale( mfFontScale, mfFontScale ); - rB2DPolyPoly.transform( aMatrix ); + const double fFactor((1.0/256) * mfFontScale); + rB2DPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix(fFactor, fFactor)); } return bRet; diff --git a/vcl/os2/source/gdi/salprn.cxx b/vcl/os2/source/gdi/salprn.cxx index 0c254e2f6e62..a31a4bb779f8 100644 --- a/vcl/os2/source/gdi/salprn.cxx +++ b/vcl/os2/source/gdi/salprn.cxx @@ -1559,7 +1559,9 @@ Os2SalPrinter::~Os2SalPrinter() BOOL Os2SalPrinter::StartJob( const XubString* pFileName, const XubString& rJobName, const XubString& rAppName, - ULONG nCopies, BOOL bCollate, + ULONG nCopies, + bool bCollate, + bool bDirect, ImplJobSetup* pSetupData ) { DEVOPENSTRUC aDevOpenStruc; @@ -1831,9 +1833,4 @@ int Os2SalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* pSetupData ) printf("Os2SalInfoPrinter::GetLandscapeAngle\n"); return 0; } -DuplexMode Os2SalInfoPrinter::GetDuplexMode( const ImplJobSetup* pSetupData ) -{ - DuplexMode nRet = DUPLEX_UNKNOWN; - printf("Os2SalInfoPrinter::GetDuplexMode\n"); - return nRet; -} + diff --git a/vcl/os2/source/window/salframe.cxx b/vcl/os2/source/window/salframe.cxx index 345573b268c3..5e4b843c7cff 100644 --- a/vcl/os2/source/window/salframe.cxx +++ b/vcl/os2/source/window/salframe.cxx @@ -3320,7 +3320,7 @@ static long ImplHandleIMEConversion( Os2SalFrame* pFrame, MPARAM nMP2Param ) if ( pBuf ) { aEvt.maText = XubString( pBuf, (USHORT)nBufLen ); - delete pBuf; + delete [] pBuf; if ( pAttrBuf ) { USHORT nTextLen = aEvt.maText.Len(); @@ -3346,7 +3346,7 @@ static long ImplHandleIMEConversion( Os2SalFrame* pFrame, MPARAM nMP2Param ) } aEvt.mpTextAttr = pSalAttrAry; } - delete pAttrBuf; + delete [] pAttrBuf; } if ( bLastCursor ) aEvt.mnCursorPos = aEvt.maText.Len(); @@ -3358,7 +3358,7 @@ static long ImplHandleIMEConversion( Os2SalFrame* pFrame, MPARAM nMP2Param ) // wieder zerstoeren pFrame->CallCallback( SALEVENT_EXTTEXTINPUT, (void*)&aEvt ); if ( pSalAttrAry ) - delete pSalAttrAry; + delete [] pSalAttrAry; } else pIMEData->mpReleaseIME( hWnd, hIMI ); diff --git a/vcl/prj/build.lst b/vcl/prj/build.lst index 908dd1eafd72..cf2824f72942 100644 --- a/vcl/prj/build.lst +++ b/vcl/prj/build.lst @@ -1,4 +1,4 @@ -vc vcl : l10n apple_remote BOOST:boost rsc sot ucbhelper unotools ICU:icu GRAPHITE:graphite i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools transex3 icc SO:print_header cpputools NULL +vc vcl : l10n apple_remote BOOST:boost rsc sot ucbhelper unotools ICU:icu GRAPHITE:graphite i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools transex3 icc SO:print_header cpputools shell svl NULL vc vcl usr1 - all vc_mkout NULL vc vcl\inc nmake - all vc_inc NULL vc vcl\source\glyphs nmake - all vc_glyphs vc_inc NULL diff --git a/vcl/prj/d.lst b/vcl/prj/d.lst index 983628184177..b106ff73729e 100644 --- a/vcl/prj/d.lst +++ b/vcl/prj/d.lst @@ -58,6 +58,7 @@ mkdir: %_DEST%\inc%_EXT%\vcl ..\inc\vcl\imagerepository.hxx %_DEST%\inc%_EXT%\vcl\imagerepository.hxx ..\inc\vcl\imgcons.hxx %_DEST%\inc%_EXT%\vcl\imgcons.hxx ..\inc\vcl\imgctrl.hxx %_DEST%\inc%_EXT%\vcl\imgctrl.hxx +..\inc\vcl\impdel.hxx %_DEST%\inc%_EXT%\vcl\impdel.hxx ..\inc\vcl\inputctx.hxx %_DEST%\inc%_EXT%\vcl\inputctx.hxx ..\inc\vcl\javachild.hxx %_DEST%\inc%_EXT%\vcl\javachild.hxx ..\inc\vcl\jobset.hxx %_DEST%\inc%_EXT%\vcl\jobset.hxx @@ -80,10 +81,10 @@ mkdir: %_DEST%\inc%_EXT%\vcl ..\inc\vcl\morebtn.hxx %_DEST%\inc%_EXT%\vcl\morebtn.hxx ..\inc\vcl\msgbox.hxx %_DEST%\inc%_EXT%\vcl\msgbox.hxx ..\inc\vcl\octree.hxx %_DEST%\inc%_EXT%\vcl\octree.hxx +..\inc\vcl\oldprintadaptor.hxx %_DEST%\inc%_EXT%\vcl\oldprintadaptor.hxx ..\inc\vcl\outdev.hxx %_DEST%\inc%_EXT%\vcl\outdev.hxx ..\inc\vcl\pointr.hxx %_DEST%\inc%_EXT%\vcl\pointr.hxx ..\inc\vcl\print.hxx %_DEST%\inc%_EXT%\vcl\print.hxx -..\inc\vcl\prndlg.hxx %_DEST%\inc%_EXT%\vcl\prndlg.hxx ..\inc\vcl\prntypes.hxx %_DEST%\inc%_EXT%\vcl\prntypes.hxx ..\inc\vcl\ptrstyle.hxx %_DEST%\inc%_EXT%\vcl\ptrstyle.hxx ..\inc\vcl\regband.hxx %_DEST%\inc%_EXT%\vcl\regband.hxx diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 9d398aef10cd..31971468d9c6 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -61,6 +61,13 @@ void SalFrame::Flush( const Rectangle& ) // ----------------------------------------------------------------------- +void SalFrame::SetRepresentedURL( const rtl::OUString& ) +{ + // currently this is Mac only functionality +} + +// ----------------------------------------------------------------------- + SalInstance::~SalInstance() { } @@ -90,8 +97,8 @@ SalPrinter::~SalPrinter() { } -BOOL SalPrinter::StartJob( const String*, const String&, - ImplJobSetup*, ImplQPrinter* ) +BOOL SalPrinter::StartJob( const String*, const String&, const String&, + ImplJobSetup*, vcl::PrinterController& ) { return FALSE; } diff --git a/vcl/source/app/session.cxx b/vcl/source/app/session.cxx index ed8e355c2071..e82e93a9ccca 100644 --- a/vcl/source/app/session.cxx +++ b/vcl/source/app/session.cxx @@ -38,6 +38,7 @@ #include <tools/debug.hxx> #include <com/sun/star/frame/XSessionManagerClient.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XSessionManagerListener2.hpp> #include <list> @@ -81,6 +82,7 @@ class VCLSession : public cppu::WeakComponentImplHelper1 < XSessionManagerClient void callSaveRequested( bool bShutdown, bool bCancelable ); void callShutdownCancelled(); void callInteractionGranted( bool bGranted ); + void callQuit(); public: VCLSession(); virtual ~VCLSession(); @@ -199,6 +201,27 @@ void VCLSession::callShutdownCancelled() Application::AcquireSolarMutex( nAcquireCount ); } +void VCLSession::callQuit() +{ + std::list< Listener > aListeners; + { + osl::MutexGuard aGuard( m_aMutex ); + // copy listener list since calling a listener may remove it. + aListeners = m_aListeners; + // set back interaction state + m_bInteractionRequested = m_bInteractionDone = m_bInteractionGranted = false; + } + + ULONG nAcquireCount = Application::ReleaseSolarMutex(); + for( std::list< Listener >::const_iterator it = aListeners.begin(); it != aListeners.end(); ++it ) + { + Reference< XSessionManagerListener2 > xListener2( it->m_xListener, UNO_QUERY ); + if( xListener2.is() ) + xListener2->doQuit(); + } + Application::AcquireSolarMutex( nAcquireCount ); +} + void VCLSession::SalSessionEventProc( SalSessionEvent* pEvent ) { switch( pEvent->m_eType ) @@ -218,6 +241,9 @@ void VCLSession::SalSessionEventProc( SalSessionEvent* pEvent ) case ShutdownCancel: pOneInstance->callShutdownCancelled(); break; + case Quit: + pOneInstance->callQuit(); + break; } } diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 6aa453563596..bd90d8824d91 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -37,14 +37,17 @@ #include "vcl/event.hxx" #include "vcl/settings.hxx" #include "vcl/i18nhelp.hxx" -#include "vcl/fontcfg.hxx" +#include "unotools/fontcfg.hxx" #include "vcl/configsettings.hxx" #include "vcl/gradient.hxx" #include "vcl/unohelp.hxx" +#include "vcl/bitmapex.hxx" +#include "vcl/impimagetree.hxx" #include "unotools/localedatawrapper.hxx" #include "unotools/collatorwrapper.hxx" #include "unotools/configmgr.hxx" #include "unotools/confignode.hxx" +#include <unotools/syslocaleoptions.hxx> #ifdef WNT #include "tools/prewin.h" @@ -66,7 +69,6 @@ DBG_NAME( AllSettings ) STYLE_OPTION_NOMNEMONICS) // ======================================================================= - ImplMachineData::ImplMachineData() { mnRefCount = 1; @@ -549,7 +551,7 @@ void ImplStyleData::SetStandardStyles() Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) ); aStdFont.SetCharSet( gsl_getSystemTextEncoding() ); aStdFont.SetWeight( WEIGHT_NORMAL ); - aStdFont.SetName( vcl::DefaultFontConfiguration::get()->getUserInterfaceFont(com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString(), rtl::OUString() ) ) ); + aStdFont.SetName( utl::DefaultFontConfiguration::get()->getUserInterfaceFont(com::sun::star::lang::Locale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString(), rtl::OUString() ) ) ); maAppFont = aStdFont; maHelpFont = aStdFont; maMenuFont = aStdFont; @@ -706,6 +708,7 @@ void StyleSettings::Set3DColors( const Color& rColor ) case STYLE_SYMBOLS_INDUSTRIAL: return ::rtl::OUString::createFromAscii( "industrial" ); case STYLE_SYMBOLS_CRYSTAL: return ::rtl::OUString::createFromAscii( "crystal" ); case STYLE_SYMBOLS_TANGO: return ::rtl::OUString::createFromAscii( "tango" ); + case STYLE_SYMBOLS_OXYGEN: return ::rtl::OUString::createFromAscii( "oxygen" ); case STYLE_SYMBOLS_CLASSIC: return ::rtl::OUString::createFromAscii( "classic" ); } @@ -726,6 +729,8 @@ ULONG StyleSettings::ImplNameToSymbolsStyle( const ::rtl::OUString &rName ) cons return STYLE_SYMBOLS_CRYSTAL; else if ( rName == ::rtl::OUString::createFromAscii( "tango" ) ) return STYLE_SYMBOLS_TANGO; + else if ( rName == ::rtl::OUString::createFromAscii( "oxygen" ) ) + return STYLE_SYMBOLS_OXYGEN; else if ( rName == ::rtl::OUString::createFromAscii( "classic" ) ) return STYLE_SYMBOLS_CLASSIC; @@ -759,12 +764,12 @@ ULONG StyleSettings::GetCurrentSymbolsStyle() const // style selected in Tools -> Options... -> OpenOffice.org -> View ULONG nStyle = GetSymbolsStyle(); - if ( nStyle == STYLE_SYMBOLS_AUTO ) + if ( nStyle == STYLE_SYMBOLS_AUTO || ( !CheckSymbolStyle (nStyle) ) ) { // the preferred style can be read from the desktop setting by the desktop native widgets modules ULONG nPreferredStyle = GetPreferredSymbolsStyle(); - if ( nPreferredStyle == STYLE_SYMBOLS_AUTO ) + if ( nPreferredStyle == STYLE_SYMBOLS_AUTO || ( !CheckSymbolStyle (nPreferredStyle) ) ) { // use a hardcoded desktop-specific fallback if no preferred style has been detected @@ -780,7 +785,10 @@ ULONG StyleSettings::GetCurrentSymbolsStyle() const nPreferredStyle = snFallbackDesktopStyle; } - nStyle = GetHighContrastMode()? STYLE_SYMBOLS_HICONTRAST: nPreferredStyle; + if (GetHighContrastMode() && CheckSymbolStyle (STYLE_SYMBOLS_HICONTRAST) ) + nStyle = STYLE_SYMBOLS_HICONTRAST; + else + nStyle = nPreferredStyle; } return nStyle; @@ -814,6 +822,33 @@ ULONG StyleSettings::GetAutoSymbolsStyle() const nRet = STYLE_SYMBOLS_TANGO; else if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde" ) ) nRet = STYLE_SYMBOLS_CRYSTAL; + else if( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde4" ) ) + nRet = STYLE_SYMBOLS_OXYGEN; + } + + // falback to any existing style + if ( ! CheckSymbolStyle (nRet) ) + { + for ( ULONG n = 0 ; n <= STYLE_SYMBOLS_THEMES_MAX ; n++ ) + { + ULONG nStyleToCheck = n; + + // auto is not a real theme => can't be fallback + if ( nStyleToCheck == STYLE_SYMBOLS_AUTO ) + continue; + + // will check hicontrast in the end + if ( nStyleToCheck == STYLE_SYMBOLS_HICONTRAST ) + continue; + if ( nStyleToCheck == STYLE_SYMBOLS_THEMES_MAX ) + nStyleToCheck = STYLE_SYMBOLS_HICONTRAST; + + if ( CheckSymbolStyle ( nStyleToCheck ) ) + { + nRet = nStyleToCheck; + n = STYLE_SYMBOLS_THEMES_MAX; + } + } } return nRet; @@ -821,6 +856,14 @@ ULONG StyleSettings::GetAutoSymbolsStyle() const // ----------------------------------------------------------------------- +bool StyleSettings::CheckSymbolStyle( ULONG nStyle ) const +{ + static ImplImageTreeSingletonRef aImageTree; + return aImageTree->checkStyle( ImplSymbolsStyleToName( nStyle ) ); +} + +// ----------------------------------------------------------------------- + void StyleSettings::SetStandardStyles() { CopyData(); @@ -1069,7 +1112,6 @@ BOOL StyleSettings::operator ==( const StyleSettings& rSet ) const ImplMiscData::ImplMiscData() { mnRefCount = 1; - mnTwoDigitYearStart = 1930; mnEnableATT = sal::static_int_cast<USHORT>(~0U); mnDisablePrinting = sal::static_int_cast<USHORT>(~0U); static const char* pEnv = getenv("SAL_DECIMALSEP_ENABLED" ); // set default without UI @@ -1081,7 +1123,6 @@ ImplMiscData::ImplMiscData() ImplMiscData::ImplMiscData( const ImplMiscData& rData ) { mnRefCount = 1; - mnTwoDigitYearStart = rData.mnTwoDigitYearStart; mnEnableATT = rData.mnEnableATT; mnDisablePrinting = rData.mnDisablePrinting; mbEnableLocalizedDecimalSep = rData.mbEnableLocalizedDecimalSep; @@ -1155,8 +1196,7 @@ BOOL MiscSettings::operator ==( const MiscSettings& rSet ) const if ( mpData == rSet.mpData ) return TRUE; - if ( (mpData->mnTwoDigitYearStart == rSet.mpData->mnTwoDigitYearStart ) && - (mpData->mnEnableATT == rSet.mpData->mnEnableATT ) && + if ( (mpData->mnEnableATT == rSet.mpData->mnEnableATT ) && (mpData->mnDisablePrinting == rSet.mpData->mnDisablePrinting ) && (mpData->mbEnableLocalizedDecimalSep == rSet.mpData->mbEnableLocalizedDecimalSep ) ) return TRUE; @@ -1513,28 +1553,20 @@ BOOL HelpSettings::operator ==( const HelpSettings& rSet ) const // ======================================================================= -static BOOL ImplCompareLocales( const ::com::sun::star::lang::Locale& L1, const ::com::sun::star::lang::Locale& L2 ) -{ - return ( ( L1.Language == L2.Language ) && - ( L1.Country == L2.Country ) && - ( L1.Variant == L2.Variant ) ); -} - -// ======================================================================= - ImplAllSettingsData::ImplAllSettingsData() { mnRefCount = 1; mnSystemUpdate = SETTINGS_ALLSETTINGS; mnWindowUpdate = SETTINGS_ALLSETTINGS; meLanguage = LANGUAGE_SYSTEM; - meUILanguage = LANGUAGE_SYSTEM; + meUILanguage = LANGUAGE_SYSTEM; mpLocaleDataWrapper = NULL; mpUILocaleDataWrapper = NULL; mpCollatorWrapper = NULL; mpUICollatorWrapper = NULL; mpI18nHelper = NULL; mpUII18nHelper = NULL; + maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() ); } // ----------------------------------------------------------------------- @@ -1546,15 +1578,12 @@ ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) : maMiscSettings( rData.maMiscSettings ), maNotificationSettings( rData.maNotificationSettings ), maHelpSettings( rData.maHelpSettings ), - maLocale( rData.maLocale ), - maUILocale( rData.maUILocale ) - + maLocale( rData.maLocale ) { mnRefCount = 1; mnSystemUpdate = rData.mnSystemUpdate; mnWindowUpdate = rData.mnWindowUpdate; meLanguage = rData.meLanguage; - meUILanguage = rData.meUILanguage; // Pointer couldn't shared and objects haven't a copy ctor // So we create the cache objects new, if the GetFunction is // called @@ -1750,11 +1779,7 @@ ULONG AllSettings::Update( ULONG nFlags, const AllSettings& rSet ) if ( nFlags & SETTINGS_UILOCALE ) { - if ( mpData->meUILanguage || rSet.mpData->meUILanguage ) - { - SetUILanguage( rSet.mpData->meUILanguage ); - nChangeFlags |= SETTINGS_UILOCALE; - } + // UILocale can't be changed } return nChangeFlags; @@ -1793,9 +1818,6 @@ ULONG AllSettings::GetChangeFlags( const AllSettings& rSet ) const if ( mpData->meLanguage || rSet.mpData->meLanguage ) nChangeFlags |= SETTINGS_LOCALE; - if ( mpData->meUILanguage || rSet.mpData->meUILanguage ) - nChangeFlags |= SETTINGS_UILOCALE; - return nChangeFlags; } @@ -1817,18 +1839,13 @@ BOOL AllSettings::operator ==( const AllSettings& rSet ) const (mpData->maNotificationSettings == rSet.mpData->maNotificationSettings) && (mpData->maHelpSettings == rSet.mpData->maHelpSettings) && (mpData->mnSystemUpdate == rSet.mpData->mnSystemUpdate) && + (mpData->maLocale == rSet.mpData->maLocale) && (mpData->mnWindowUpdate == rSet.mpData->mnWindowUpdate) ) { - // special treatment for Locale, because maLocale is only - // initialized after first call of GetLocale(). - ::com::sun::star::lang::Locale aEmptyLocale; - if ( ( ImplCompareLocales( mpData->maLocale, aEmptyLocale ) && ImplCompareLocales( rSet.mpData->maLocale, aEmptyLocale ) ) - || ImplCompareLocales( GetLocale(), rSet.GetLocale() ) ) - { - return TRUE; - } + return TRUE; } - return FALSE; + else + return FALSE; } // ----------------------------------------------------------------------- @@ -1857,70 +1874,39 @@ void AllSettings::SetLocale( const ::com::sun::star::lang::Locale& rLocale ) // ----------------------------------------------------------------------- -void AllSettings::SetUILocale( const ::com::sun::star::lang::Locale& rLocale ) +void AllSettings::SetUILocale( const ::com::sun::star::lang::Locale& ) { - CopyData(); - - mpData->maUILocale = rLocale; - - if ( !rLocale.Language.getLength() ) - mpData->meUILanguage = LANGUAGE_SYSTEM; - else - mpData->meUILanguage = MsLangId::convertLocaleToLanguage( rLocale ); - if ( mpData->mpUILocaleDataWrapper ) - { - delete mpData->mpUILocaleDataWrapper; - mpData->mpUILocaleDataWrapper = NULL; - } - if ( mpData->mpUII18nHelper ) - { - delete mpData->mpUII18nHelper; - mpData->mpUII18nHelper = NULL; - } + // there is only one UILocale per process } // ----------------------------------------------------------------------- void AllSettings::SetLanguage( LanguageType eLang ) { - CopyData(); - - mpData->meLanguage = eLang; - - // Will be calculated in GetLocale() - mpData->maLocale = ::com::sun::star::lang::Locale(); - if ( mpData->mpLocaleDataWrapper ) - { - delete mpData->mpLocaleDataWrapper; - mpData->mpLocaleDataWrapper = NULL; - } - if ( mpData->mpI18nHelper ) + if ( eLang != mpData->meLanguage ) { - delete mpData->mpI18nHelper; - mpData->mpI18nHelper = NULL; + CopyData(); + + mpData->meLanguage = eLang; + MsLangId::convertLanguageToLocale( GetLanguage(), ((AllSettings*)this)->mpData->maLocale ); + if ( mpData->mpLocaleDataWrapper ) + { + delete mpData->mpLocaleDataWrapper; + mpData->mpLocaleDataWrapper = NULL; + } + if ( mpData->mpI18nHelper ) + { + delete mpData->mpI18nHelper; + mpData->mpI18nHelper = NULL; + } } } // ----------------------------------------------------------------------- -void AllSettings::SetUILanguage( LanguageType eLang ) +void AllSettings::SetUILanguage( LanguageType ) { - CopyData(); - - mpData->meUILanguage = eLang; - - // Will be calculated in GetUILocale() - mpData->maUILocale = ::com::sun::star::lang::Locale(); - if ( mpData->mpUILocaleDataWrapper ) - { - delete mpData->mpUILocaleDataWrapper; - mpData->mpUILocaleDataWrapper = NULL; - } - if ( mpData->mpUII18nHelper ) - { - delete mpData->mpUII18nHelper; - mpData->mpUII18nHelper = NULL; - } + // there is only one UILanguage per process } // ----------------------------------------------------------------------- @@ -1973,8 +1959,7 @@ BOOL AllSettings::GetLayoutRTL() const const ::com::sun::star::lang::Locale& AllSettings::GetLocale() const { if ( !mpData->maLocale.Language.getLength() ) - MsLangId::convertLanguageToLocale( GetLanguage(), - ((AllSettings*)this)->mpData->maLocale ); + mpData->maLocale = mpData->maSysLocale.GetLocale(); return mpData->maLocale; } @@ -1983,9 +1968,9 @@ const ::com::sun::star::lang::Locale& AllSettings::GetLocale() const const ::com::sun::star::lang::Locale& AllSettings::GetUILocale() const { + // the UILocale is never changed if ( !mpData->maUILocale.Language.getLength() ) - MsLangId::convertLanguageToLocale( GetUILanguage(), - ((AllSettings*)this)->mpData->maUILocale ); + mpData->maUILocale = mpData->maSysLocale.GetUILocale(); return mpData->maUILocale; } @@ -1994,8 +1979,9 @@ const ::com::sun::star::lang::Locale& AllSettings::GetUILocale() const LanguageType AllSettings::GetLanguage() const { + // meLanguage == LANGUAGE_SYSTEM means: use settings from SvtSysLocale if ( mpData->meLanguage == LANGUAGE_SYSTEM ) - return MsLangId::getSystemLanguage(); + return mpData->maSysLocale.GetLanguage(); return mpData->meLanguage; } @@ -2004,10 +1990,8 @@ LanguageType AllSettings::GetLanguage() const LanguageType AllSettings::GetUILanguage() const { - if ( mpData->meUILanguage == LANGUAGE_SYSTEM ) - return MsLangId::getSystemUILanguage(); - - return mpData->meUILanguage; + // the UILanguage is never changed + return mpData->maSysLocale.GetUILanguage(); } // ----------------------------------------------------------------------- @@ -2076,3 +2060,22 @@ const CollatorWrapper& AllSettings::GetUICollatorWrapper() const } */ +void AllSettings::LocaleSettingsChanged( sal_uInt32 nHint ) +{ + AllSettings aAllSettings( Application::GetSettings() ); + if ( nHint & SYSLOCALEOPTIONS_HINT_DECSEP ) + { + MiscSettings aMiscSettings = aAllSettings.GetMiscSettings(); + BOOL bIsDecSepAsLocale = aAllSettings.mpData->maSysLocale.GetOptions().IsDecimalSeparatorAsLocale(); + if ( aMiscSettings.GetEnableLocalizedDecimalSep() != bIsDecSepAsLocale ) + { + aMiscSettings.SetEnableLocalizedDecimalSep( bIsDecSepAsLocale ); + aAllSettings.SetMiscSettings( aMiscSettings ); + } + } + + if ( (nHint & SYSLOCALEOPTIONS_HINT_LOCALE) ) + aAllSettings.SetLocale( aAllSettings.mpData->maSysLocale.GetOptions().GetLocale() ); + + Application::SetSettings( aAllSettings ); +} diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 6057409baa14..7f329f2d24d5 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -31,63 +31,53 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#ifndef _SV_SVSYS_HXX -#include <svsys.h> -#endif -#include <vcl/salinst.hxx> -#include <vcl/salframe.hxx> -#include <vcl/salsys.hxx> -#ifndef _VOS_PROCESS_HXX -#include <vos/process.hxx> -#endif -#ifndef _VOS_MUTEX_HXX -#include <vos/mutex.hxx> -#endif -#include <tools/tools.h> -#include <tools/debug.hxx> -#include <tools/time.hxx> -#include <i18npool/mslangid.hxx> -#include <vcl/svdata.hxx> -#include <vcl/settings.hxx> -#ifndef _ACCMGR_HXX -#include <vcl/accmgr.hxx> -#endif -#ifndef _SV_KEYCOD_HXX -#include <vcl/keycod.hxx> -#endif -#include <vcl/event.hxx> -#include <vcl/virdev.hxx> -#include <vcl/windata.hxx> -#include <vcl/window.h> -#include <vcl/wrkwin.hxx> -#include <vcl/idlemgr.hxx> -#include <vcl/svapp.hxx> -#include <vcl/cvtgrf.hxx> -#include <vcl/unowrap.hxx> -#include <vcl/xconnection.hxx> -#ifndef _SV_SVIDS_HRC -#include <vcl/svids.hrc> -#endif -#include <vcl/timer.hxx> - -#include <vcl/unohelp.hxx> - -#include <com/sun/star/uno/Reference.h> -#include <com/sun/star/awt/XToolkit.hpp> -#include <com/sun/star/uno/XNamingService.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <comphelper/processfactory.hxx> - -#include <osl/module.h> -#include <osl/file.hxx> +#include "svsys.h" +#include "vcl/salinst.hxx" +#include "vcl/salframe.hxx" +#include "vcl/salsys.hxx" +#include "vos/process.hxx" +#include "vos/mutex.hxx" +#include "tools/tools.h" +#include "tools/debug.hxx" +#include "tools/time.hxx" +#include "i18npool/mslangid.hxx" +#include "vcl/svdata.hxx" +#include "vcl/settings.hxx" +#include "vcl/accmgr.hxx" +#include "vcl/keycod.hxx" +#include "vcl/event.hxx" +#include "vcl/vclevent.hxx" +#include "vcl/virdev.hxx" +#include "vcl/windata.hxx" +#include "vcl/window.h" +#include "vcl/wrkwin.hxx" +#include "vcl/idlemgr.hxx" +#include "vcl/svapp.hxx" +#include "vcl/cvtgrf.hxx" +#include "vcl/unowrap.hxx" +#include "vcl/xconnection.hxx" +#include "vcl/svids.hrc" +#include "vcl/timer.hxx" + +#include "vcl/unohelp.hxx" + +#include "com/sun/star/uno/Reference.h" +#include "com/sun/star/awt/XToolkit.hpp" +#include "com/sun/star/uno/XNamingService.hpp" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "comphelper/processfactory.hxx" + +#include "osl/module.h" +#include "osl/file.hxx" #include "osl/thread.h" #include "rtl/tencinfo.h" -#include <rtl/instance.hxx> -#include <vcl/salimestatus.hxx> +#include "rtl/instance.hxx" +#include "vcl/salimestatus.hxx" #include <utility> #include <vcl/lazydelete.hxx> +#include <unotools/syslocaleoptions.hxx> using namespace ::com::sun::star::uno; @@ -467,7 +457,7 @@ void Application::Execute() // ----------------------------------------------------------------------- -void Application::Reschedule( bool bAllEvents ) +inline void ImplYield( bool i_bWait, bool i_bAllEvents ) { ImplSVData* pSVData = ImplGetSVData(); @@ -477,34 +467,45 @@ void Application::Reschedule( bool bAllEvents ) Timer::ImplTimerCallbackProc(); pSVData->maAppData.mnDispatchLevel++; - pSVData->mpDefInst->Yield( false, bAllEvents ); + // do not wait for events if application was already quit; in that + // case only dispatch events already available + // do not wait for events either if the app decided that it is too busy for timers + // (feature added for the slideshow) + pSVData->mpDefInst->Yield( i_bWait && !pSVData->maAppData.mbAppQuit && !pSVData->maAppData.mbNoYield, i_bAllEvents ); pSVData->maAppData.mnDispatchLevel--; // flush lazy deleted objects if( pSVData->maAppData.mnDispatchLevel == 0 ) vcl::LazyDelete::flush(); + + // the system timer events will not necesseraly come in in non waiting mode + // e.g. on aqua; need to trigger timer checks manually + if( pSVData->maAppData.mbNoYield && !pSVData->mbNoCallTimer ) + { + do + { + Timer::ImplTimerCallbackProc(); + } + while( pSVData->mbNotAllTimerCalled ); + } + + // call post yield listeners + if( pSVData->maAppData.mpPostYieldListeners ) + pSVData->maAppData.mpPostYieldListeners->callListeners( NULL ); } // ----------------------------------------------------------------------- -void Application::Yield( bool bAllEvents ) +void Application::Reschedule( bool i_bAllEvents ) { - ImplSVData* pSVData = ImplGetSVData(); - - // run timers that have timed out - if ( !pSVData->mbNoCallTimer ) - while ( pSVData->mbNotAllTimerCalled ) - Timer::ImplTimerCallbackProc(); + ImplYield( false, i_bAllEvents ); +} - // do not wait for events if application was already quit; in that - // case only dispatch events already available - pSVData->maAppData.mnDispatchLevel++; - pSVData->mpDefInst->Yield( !pSVData->maAppData.mbAppQuit, bAllEvents ); - pSVData->maAppData.mnDispatchLevel--; +// ----------------------------------------------------------------------- - // flush lazy deleted objects - if( pSVData->maAppData.mnDispatchLevel == 0 ) - vcl::LazyDelete::flush(); +void Application::Yield( bool i_bAllEvents ) +{ + ImplYield( true, i_bAllEvents ); } // ----------------------------------------------------------------------- @@ -704,12 +705,10 @@ bool Application::ValidateSystemFont() void Application::SetSettings( const AllSettings& rSettings ) { - MsLangId::setConfiguredSystemLanguage( rSettings.GetLanguage()); - MsLangId::setConfiguredSystemUILanguage( rSettings.GetUILanguage()); ImplSVData* pSVData = ImplGetSVData(); if ( !pSVData->maAppData.mpSettings ) { - pSVData->maAppData.mpSettings = new AllSettings(); + GetSettings(); *pSVData->maAppData.mpSettings = rSettings; ResMgr::SetDefaultLocale( rSettings.GetUILocale() ); } @@ -811,7 +810,12 @@ const AllSettings& Application::GetSettings() { ImplSVData* pSVData = ImplGetSVData(); if ( !pSVData->maAppData.mpSettings ) + { + pSVData->maAppData.mpCfgListener = new LocaleConfigurationListener; pSVData->maAppData.mpSettings = new AllSettings(); + pSVData->maAppData.mpSettings->GetSysLocale().GetOptions().AddListener( pSVData->maAppData.mpCfgListener ); + } + return *(pSVData->maAppData.mpSettings); } @@ -1193,6 +1197,33 @@ void Application::RemoveIdleHdl( const Link& rLink ) // ----------------------------------------------------------------------- +void Application::EnableNoYieldMode( bool i_bNoYield ) +{ + ImplSVData* pSVData = ImplGetSVData(); + pSVData->maAppData.mbNoYield = i_bNoYield; +} + +// ----------------------------------------------------------------------- + +void Application::AddPostYieldListener( const Link& i_rListener ) +{ + ImplSVData* pSVData = ImplGetSVData(); + if( ! pSVData->maAppData.mpPostYieldListeners ) + pSVData->maAppData.mpPostYieldListeners = new VclEventListeners2(); + pSVData->maAppData.mpPostYieldListeners->addListener( i_rListener ); +} + +// ----------------------------------------------------------------------- + +void Application::RemovePostYieldListener( const Link& i_rListener ) +{ + ImplSVData* pSVData = ImplGetSVData(); + if( pSVData->maAppData.mpPostYieldListeners ) + pSVData->maAppData.mpPostYieldListeners->removeListener( i_rListener ); +} + +// ----------------------------------------------------------------------- + WorkWindow* Application::GetAppWindow() { return ImplGetSVData()->maWinData.mpAppWin; diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index 21e1f34c1ef5..e8e56c6ee5a8 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: svdata.cxx,v $ - * $Revision: 1.56 $ + * $Revision: 1.56.114.1 $ * * This file is part of OpenOffice.org. * @@ -47,7 +47,7 @@ #include <uno/current_context.hxx> #include <cppuhelper/implbase1.hxx> #include <tools/debug.hxx> -#include <vcl/fontcfg.hxx> +#include <unotools/fontcfg.hxx> #include <vcl/configsettings.hxx> #include <vcl/svdata.hxx> #include <vcl/window.h> @@ -234,6 +234,15 @@ ResMgr* ImplGetResMgr() return pSVData->mpResMgr; } +ResId VclResId( sal_Int32 nId ) +{ + ResMgr* pMgr = ImplGetResMgr(); + if( ! pMgr ) + throw std::bad_alloc(); + + return ResId( nId, *pMgr ); +} + DockingManager* ImplGetDockingManager() { ImplSVData* pSVData = ImplGetSVData(); @@ -523,3 +532,9 @@ Window* ImplFindWindow( const SalFrame* pFrame, Point& rSalFramePos ) return NULL; } + +void LocaleConfigurationListener::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 nHint ) +{ + AllSettings::LocaleSettingsChanged( nHint ); +} + diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index 6c09978e37b1..f1af78662813 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -79,8 +79,8 @@ #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/lang/XComponent.hpp" #include "rtl/logfile.hxx" - -#include "vcl/fontcfg.hxx" +#include <unotools/syslocaleoptions.hxx> +#include "unotools/fontcfg.hxx" #include "vcl/configsettings.hxx" #include "vcl/lazydelete.hxx" @@ -444,6 +444,26 @@ void DeInitVCL() delete pSVData->maCtrlData.mpSplitVArwImgList; pSVData->maCtrlData.mpSplitVArwImgList = NULL; } + if ( pSVData->maCtrlData.mpDisclosurePlus ) + { + delete pSVData->maCtrlData.mpDisclosurePlus; + pSVData->maCtrlData.mpDisclosurePlus = NULL; + } + if ( pSVData->maCtrlData.mpDisclosurePlusHC ) + { + delete pSVData->maCtrlData.mpDisclosurePlusHC; + pSVData->maCtrlData.mpDisclosurePlusHC = NULL; + } + if ( pSVData->maCtrlData.mpDisclosureMinus ) + { + delete pSVData->maCtrlData.mpDisclosureMinus; + pSVData->maCtrlData.mpDisclosureMinus = NULL; + } + if ( pSVData->maCtrlData.mpDisclosureMinusHC ) + { + delete pSVData->maCtrlData.mpDisclosureMinusHC; + pSVData->maCtrlData.mpDisclosureMinusHC = NULL; + } if ( pSVData->mpDefaultWin ) { delete pSVData->mpDefaultWin; @@ -467,6 +487,12 @@ void DeInitVCL() if ( pSVData->maAppData.mpSettings ) { + if ( pSVData->maAppData.mpCfgListener ) + { + pSVData->maAppData.mpSettings->GetSysLocale().GetOptions().RemoveListener( pSVData->maAppData.mpCfgListener ); + delete pSVData->maAppData.mpCfgListener; + } + delete pSVData->maAppData.mpSettings; pSVData->maAppData.mpSettings = NULL; } diff --git a/vcl/source/app/vclevent.cxx b/vcl/source/app/vclevent.cxx index 8ebc65c8a3f6..704d68c5bc7f 100644 --- a/vcl/source/app/vclevent.cxx +++ b/vcl/source/app/vclevent.cxx @@ -80,3 +80,56 @@ BOOL VclEventListeners::Process( VclSimpleEvent* pEvent ) const } return bProcessed; } + +VclEventListeners2::VclEventListeners2() +{ +} + +VclEventListeners2::~VclEventListeners2() +{ +} + +void VclEventListeners2::addListener( const Link& i_rLink ) +{ + // ensure uniqueness + for( std::list< Link >::const_iterator it = m_aListeners.begin(); it != m_aListeners.end(); ++it ) + { + if( *it == i_rLink ) + return; + } + m_aListeners.push_back( i_rLink ); +} + +void VclEventListeners2::removeListener( const Link& i_rLink ) +{ + size_t n = m_aIterators.size(); + for( size_t i = 0; i < n; i++ ) + { + if( m_aIterators[i].m_aIt != m_aListeners.end() && *m_aIterators[i].m_aIt == i_rLink ) + { + m_aIterators[i].m_bWasInvalidated = true; + ++m_aIterators[i].m_aIt; + } + } + m_aListeners.remove( i_rLink ); +} + +void VclEventListeners2::callListeners( VclSimpleEvent* i_pEvent ) +{ + vcl::DeletionListener aDel( this ); + + m_aIterators.push_back( ListenerIt() ); + size_t nIndex = m_aIterators.size() - 1; + m_aIterators[ nIndex ].m_aIt = m_aListeners.begin(); + while( ! aDel.isDeleted() && m_aIterators[ nIndex ].m_aIt != m_aListeners.end() ) + { + m_aIterators[ nIndex ].m_aIt->Call( i_pEvent ); + if( m_aIterators[ nIndex ].m_bWasInvalidated ) + // check if the current element was removed and the iterator increased in the meantime + m_aIterators[ nIndex ].m_bWasInvalidated = false; + else + ++m_aIterators[ nIndex ].m_aIt; + } + m_aIterators.pop_back(); +} + diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index e7a4aadb8694..b5915cc35daf 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -50,7 +50,7 @@ #include <tools/poly.hxx> #include <vcl/button.hxx> #include <vcl/window.h> -#include <vcl/controllayout.hxx> +#include <vcl/controldata.hxx> #ifndef _SV_NATIVEWIDGET_HXX #include <vcl/salnativewidgets.hxx> #endif @@ -383,8 +383,8 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, WinBits nWinStyle = GetStyle(); Rectangle aOutRect( rPos, rSize ); - MetricVector *pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; - String *pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL; + MetricVector *pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; + String *pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; ImageAlign eImageAlign = mpButtonData->meImageAlign; Size aImageSize = mpButtonData->maImage.GetSizePixel(); @@ -406,13 +406,12 @@ void Button::ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, } else if ( bDrawText && !bDrawImage && !bHasSymbol ) { - aOutRect = pDev->GetTextRect( aOutRect, aText, nTextStyle ); - rSize = aOutRect.GetSize(); - rPos = aOutRect.TopLeft(); + DrawControlText( *pDev, aOutRect, aText, nTextStyle, pVector, pDisplayText ); ImplSetFocusRect( aOutRect ); + rSize = aOutRect.GetSize(); + rPos = aOutRect.TopLeft(); - pDev->DrawText( aOutRect, aText, nTextStyle, pVector, pDisplayText ); return; } @@ -853,31 +852,25 @@ WinBits PushButton::ImplInitStyle( const Window* pPrevWindow, WinBits nStyle ) return nStyle; } +// ----------------------------------------------------------------- + +const Font& PushButton::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetPushButtonFont(); +} + +// ----------------------------------------------------------------- +const Color& PushButton::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetButtonTextColor(); +} + // ----------------------------------------------------------------------- void PushButton::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont = rStyleSettings.GetPushButtonFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetButtonTextColor(); - SetTextColor( aColor ); - SetTextFillColor(); - } + Button::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -1659,7 +1652,7 @@ void PushButton::KeyUp( const KeyEvent& rKEvt ) void PushButton::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast<PushButton*>(this)->ImplDrawPushButton( true ); } @@ -1990,8 +1983,11 @@ Size PushButton::CalcMinimumSize( long nMaxWidth ) const } // cf. ImplDrawPushButton ... - aSize.Width() += 8; - aSize.Height() += 8; + if( (GetStyle() & WB_SMALLSTYLE) == 0 ) + { + aSize.Width() += 8; + aSize.Height() += 8; + } return CalcWindowSize( aSize ); } @@ -2225,31 +2221,25 @@ WinBits RadioButton::ImplInitStyle( const Window* pPrevWindow, WinBits nStyle ) return nStyle; } +// ----------------------------------------------------------------- + +const Font& RadioButton::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetRadioCheckFont(); +} + +// ----------------------------------------------------------------- +const Color& RadioButton::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetRadioCheckTextColor(); +} + // ----------------------------------------------------------------------- void RadioButton::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont = rStyleSettings.GetRadioCheckFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetRadioCheckTextColor(); - SetTextColor( aColor ); - SetTextFillColor(); - } + Button::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -2424,16 +2414,14 @@ if ( bNativeOK == FALSE ) void RadioButton::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, const Point& rPos, const Size& rSize, - const Size& rImageSize, long nImageSep, - Rectangle& rStateRect, - Rectangle& rMouseRect, - bool bLayout ) + const Size& rImageSize, Rectangle& rStateRect, + Rectangle& rMouseRect, bool bLayout ) { WinBits nWinStyle = GetStyle(); XubString aText( GetText() ); Rectangle aRect( rPos, rSize ); - MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; - String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL; + MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; + String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; pDev->Push( PUSH_CLIPREGION ); pDev->IntersectClipRegion( Rectangle( rPos, rSize ) ); @@ -2446,9 +2434,9 @@ void RadioButton::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, { USHORT nTextStyle = Button::ImplGetTextStyle( aText, nWinStyle, nDrawFlags ); + const long nImageSep = GetDrawPixel( pDev, ImplGetImageToTextDistance() ); Size aSize( rSize ); Point aPos( rPos ); - aPos.X() += rImageSize.Width() + nImageSep; aSize.Width() -= rImageSize.Width() + nImageSep; @@ -2578,7 +2566,7 @@ void RadioButton::ImplDrawRadioButton( bool bLayout ) // Draw control text ImplDraw( this, 0, Point(), GetOutputSizePixel(), - aImageSize, IMPL_SEP_BUTTON_IMAGE, maStateRect, maMouseRect, bLayout ); + aImageSize, maStateRect, maMouseRect, bLayout ); if( !bLayout || (IsNativeControlSupported(CTRL_RADIOBUTTON, PART_ENTIRE_CONTROL)==TRUE) ) { @@ -2854,7 +2842,7 @@ void RadioButton::KeyUp( const KeyEvent& rKEvt ) void RadioButton::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast<RadioButton*>(this)->ImplDrawRadioButton( true ); } @@ -2909,8 +2897,7 @@ void RadioButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize pDev->SetTextFillColor(); ImplDraw( pDev, nFlags, aPos, aSize, - aImageSize, GetDrawPixel( pDev, IMPL_SEP_BUTTON_IMAGE ), - aStateRect, aMouseRect ); + aImageSize, aStateRect, aMouseRect ); Point aCenterPos = aStateRect.Center(); long nRadX = aImageSize.Width()/2; @@ -3158,6 +3145,15 @@ void RadioButton::Check( BOOL bCheck ) // ----------------------------------------------------------------------- +long RadioButton::ImplGetImageToTextDistance() const +{ + // 4 pixels, but take zoom into account, so the text doesn't "jump" relative to surrounding elements, + // which might have been aligned with the text of the check box + return CalcZoom( 4 ); +} + +// ----------------------------------------------------------------------- + Size RadioButton::ImplGetRadioImageSize() const { Size aSize; @@ -3331,12 +3327,12 @@ Size RadioButton::CalcMinimumSize( long nMaxWidth ) const { // subtract what will be added later nMaxWidth-=2; - nMaxWidth -= IMPL_SEP_BUTTON_IMAGE; + nMaxWidth -= ImplGetImageToTextDistance(); Size aTextSize = GetTextRect( Rectangle( Point(), Size( nMaxWidth > 0 ? nMaxWidth : 0x7fffffff, 0x7fffffff ) ), aText, FixedText::ImplGetTextStyle( GetStyle() ) ).GetSize(); aSize.Width()+=2; // for focus rect - aSize.Width() += IMPL_SEP_BUTTON_IMAGE; + aSize.Width() += ImplGetImageToTextDistance(); aSize.Width() += aTextSize.Width(); if ( aSize.Height() < aTextSize.Height() ) aSize.Height() = aTextSize.Height(); @@ -3395,31 +3391,25 @@ WinBits CheckBox::ImplInitStyle( const Window* pPrevWindow, WinBits nStyle ) return nStyle; } +// ----------------------------------------------------------------- + +const Font& CheckBox::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetRadioCheckFont(); +} + +// ----------------------------------------------------------------- +const Color& CheckBox::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetRadioCheckTextColor(); +} + // ----------------------------------------------------------------------- void CheckBox::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont = rStyleSettings.GetRadioCheckFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetRadioCheckTextColor(); - SetTextColor( aColor ); - SetTextFillColor(); - } + Button::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -3527,9 +3517,8 @@ void CheckBox::ImplDrawCheckBoxState() void CheckBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, const Point& rPos, const Size& rSize, - const Size& rImageSize, long nImageSep, - Rectangle& rStateRect, Rectangle& rMouseRect, - bool bLayout ) + const Size& rImageSize, Rectangle& rStateRect, + Rectangle& rMouseRect, bool bLayout ) { WinBits nWinStyle = GetStyle(); XubString aText( GetText() ); @@ -3543,6 +3532,7 @@ void CheckBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, { USHORT nTextStyle = Button::ImplGetTextStyle( aText, nWinStyle, nDrawFlags ); + const long nImageSep = GetDrawPixel( pDev, ImplGetImageToTextDistance() ); Size aSize( rSize ); Point aPos( rPos ); aPos.X() += rImageSize.Width() + nImageSep; @@ -3640,7 +3630,7 @@ void CheckBox::ImplDrawCheckBox( bool bLayout ) HideFocus(); ImplDraw( this, 0, Point(), GetOutputSizePixel(), aImageSize, - IMPL_SEP_BUTTON_IMAGE, maStateRect, maMouseRect, bLayout ); + maStateRect, maMouseRect, bLayout ); if( !bLayout ) { @@ -3797,7 +3787,7 @@ void CheckBox::KeyUp( const KeyEvent& rKEvt ) void CheckBox::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast<CheckBox*>(this)->ImplDrawCheckBox( true ); } @@ -3852,8 +3842,7 @@ void CheckBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, pDev->SetTextFillColor(); ImplDraw( pDev, nFlags, aPos, aSize, - aImageSize, GetDrawPixel( pDev, IMPL_SEP_BUTTON_IMAGE ), - aStateRect, aMouseRect, false ); + aImageSize, aStateRect, aMouseRect, false ); pDev->SetLineColor(); pDev->SetFillColor( Color( COL_BLACK ) ); @@ -4099,6 +4088,15 @@ void CheckBox::EnableTriState( BOOL bTriState ) // ----------------------------------------------------------------------- +long CheckBox::ImplGetImageToTextDistance() const +{ + // 4 pixels, but take zoom into account, so the text doesn't "jump" relative to surrounding elements, + // which might have been aligned with the text of the check box + return CalcZoom( 4 ); +} + +// ----------------------------------------------------------------------- + Size CheckBox::ImplGetCheckImageSize() const { Size aSize; @@ -4232,12 +4230,12 @@ Size CheckBox::CalcMinimumSize( long nMaxWidth ) const { // subtract what will be added later nMaxWidth-=2; - nMaxWidth -= IMPL_SEP_BUTTON_IMAGE; + nMaxWidth -= ImplGetImageToTextDistance(); Size aTextSize = GetTextRect( Rectangle( Point(), Size( nMaxWidth > 0 ? nMaxWidth : 0x7fffffff, 0x7fffffff ) ), aText, FixedText::ImplGetTextStyle( GetStyle() ) ).GetSize(); aSize.Width()+=2; // for focus rect - aSize.Width() += IMPL_SEP_BUTTON_IMAGE; + aSize.Width() += ImplGetImageToTextDistance(); aSize.Width() += aTextSize.Width(); if ( aSize.Height() < aTextSize.Height() ) aSize.Height() = aTextSize.Height(); @@ -4381,3 +4379,95 @@ TriStateBox::TriStateBox( Window* pParent, const ResId& rResId ) : TriStateBox::~TriStateBox() { } + +// ======================================================================= + +DisclosureButton::DisclosureButton( Window* pParent, WinBits ) : + CheckBox( pParent, WB_NOBORDER ) +{ +} + +// ----------------------------------------------------------------------- + +DisclosureButton::DisclosureButton( Window* pParent, const ResId& rResId ) : + CheckBox( pParent, rResId.SetRT( RSC_CHECKBOX ) ) +{ +} + +// ----------------------------------------------------------------------- + +void DisclosureButton::ImplDrawCheckBoxState() +{ + /* HACK: DisclosureButton is currently assuming, that the disclosure sign + will fit into the rectangle occupied by a normal checkbox on all themes. + If this does not hold true for some theme, ImplGetCheckImageSize + would have to be overloaded for DisclosureButton; also GetNativeControlRegion + for CTRL_LISTNODE would have to be implemented and taken into account + */ + + Rectangle aStateRect( GetStateRect() ); + + ImplControlValue aControlValue( GetState() == STATE_CHECK ? BUTTONVALUE_ON : BUTTONVALUE_OFF, rtl::OUString(), 0 ); + Region aCtrlRegion( aStateRect ); + ControlState nState = 0; + + if ( HasFocus() ) nState |= CTRL_STATE_FOCUSED; + if ( ImplGetButtonState() & BUTTON_DRAW_DEFAULT ) nState |= CTRL_STATE_DEFAULT; + if ( Window::IsEnabled() ) nState |= CTRL_STATE_ENABLED; + if ( IsMouseOver() && GetMouseRect().IsInside( GetPointerPosPixel() ) ) + nState |= CTRL_STATE_ROLLOVER; + + if( ! DrawNativeControl( CTRL_LISTNODE, PART_ENTIRE_CONTROL, aCtrlRegion, nState, + aControlValue, rtl::OUString() ) ) + { + ImplSVCtrlData& rCtrlData( ImplGetSVData()->maCtrlData ); + if( ! rCtrlData.mpDisclosurePlus ) + rCtrlData.mpDisclosurePlus = new Image( BitmapEx( VclResId( SV_DISCLOSURE_PLUS ) ) ); + if( ! rCtrlData.mpDisclosurePlusHC ) + rCtrlData.mpDisclosurePlusHC = new Image( BitmapEx( VclResId( SV_DISCLOSURE_PLUS_HC ) ) ); + if( ! rCtrlData.mpDisclosureMinus ) + rCtrlData.mpDisclosureMinus = new Image( BitmapEx( VclResId( SV_DISCLOSURE_MINUS ) ) ); + if( ! rCtrlData.mpDisclosureMinusHC ) + rCtrlData.mpDisclosureMinusHC = new Image( BitmapEx( VclResId( SV_DISCLOSURE_MINUS_HC ) ) ); + + Image* pImg = NULL; + if( GetSettings().GetStyleSettings().GetHighContrastMode() ) + pImg = IsChecked() ? rCtrlData.mpDisclosureMinusHC : rCtrlData.mpDisclosurePlusHC; + else + pImg = IsChecked() ? rCtrlData.mpDisclosureMinus : rCtrlData.mpDisclosurePlus; + + DBG_ASSERT( pImg, "no disclosure image" ); + if( ! pImg ) + return; + + USHORT nStyle = 0; + if( ! IsEnabled() ) + nStyle |= IMAGE_DRAW_DISABLE; + + Size aSize( aStateRect.GetSize() ); + Size aImgSize( pImg->GetSizePixel() ); + Point aOff( (aSize.Width() - aImgSize.Width())/2, + (aSize.Height() - aImgSize.Height())/2 ); + aOff += aStateRect.TopLeft(); + DrawImage( aOff, *pImg, nStyle ); + } +} + +// ----------------------------------------------------------------------- + +void DisclosureButton::KeyInput( const KeyEvent& rKEvt ) +{ + KeyCode aKeyCode = rKEvt.GetKeyCode(); + + if( !aKeyCode.GetModifier() && + ( ( aKeyCode.GetCode() == KEY_ADD ) || + ( aKeyCode.GetCode() == KEY_SUBTRACT ) ) + ) + { + Check( aKeyCode.GetCode() == KEY_ADD ); + } + else + Button::KeyInput( rKEvt ); +} + + diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index f83e46e38302..21707d0182f5 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -44,7 +44,7 @@ #include <vcl/subedit.hxx> #include <vcl/event.hxx> #include <vcl/combobox.hxx> -#include <vcl/controllayout.hxx> +#include <vcl/controldata.hxx> @@ -689,7 +689,7 @@ void ComboBox::Resize() void ComboBox::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); AppendLayoutData( *mpSubEdit ); mpSubEdit->SetLayoutDataParent( this ); Control* pMainWindow = mpImplLB->GetMainWindow(); @@ -1534,7 +1534,7 @@ void ComboBox::SetBorderStyle( USHORT nBorderStyle ) long ComboBox::GetIndexForPoint( const Point& rPoint, USHORT& rPos ) const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); // check whether rPoint fits at all diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 55c979fbd69f..1800327df33c 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -39,10 +39,12 @@ #include <vcl/event.hxx> #include <vcl/ctrl.hxx> #include <vcl/decoview.hxx> -#include <vcl/controllayout.hxx> +#include <vcl/controldata.hxx> #include <vcl/salnativewidgets.hxx> +#include <vcl/textlayout.hxx> - +#include <comphelper/processfactory.hxx> +#include <tools/diagnose_ex.h> using namespace vcl; @@ -51,7 +53,7 @@ using namespace vcl; void Control::ImplInitControlData() { mbHasFocus = FALSE; - mpLayoutData = NULL; + mpControlData = new ImplControlData; } // ----------------------------------------------------------------------- @@ -90,7 +92,7 @@ Control::Control( Window* pParent, const ResId& rResId ) : Control::~Control() { - delete mpLayoutData, mpLayoutData = NULL; + delete mpControlData, mpControlData = NULL; } // ----------------------------------------------------------------------- @@ -111,7 +113,7 @@ void Control::LoseFocus() void Control::Resize() { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); Window::Resize(); } @@ -123,10 +125,31 @@ void Control::FillLayoutData() const // ----------------------------------------------------------------------- +void Control::CreateLayoutData() const +{ + DBG_ASSERT( !mpControlData->mpLayoutData, "Control::CreateLayoutData: should be called with non-existent layout data only!" ); + mpControlData->mpLayoutData = new ::vcl::ControlLayoutData(); +} + +// ----------------------------------------------------------------------- + +bool Control::HasLayoutData() const +{ + return mpControlData->mpLayoutData != NULL; +} + +// ----------------------------------------------------------------------- + +::vcl::ControlLayoutData* Control::GetLayoutData() const +{ + return mpControlData->mpLayoutData; +} + +// ----------------------------------------------------------------------- + void Control::SetText( const String& rStr ) { - delete mpLayoutData; - mpLayoutData = NULL; + ImplClearLayoutData(); Window::SetText( rStr ); } @@ -142,9 +165,9 @@ Rectangle ControlLayoutData::GetCharacterBounds( long nIndex ) const Rectangle Control::GetCharacterBounds( long nIndex ) const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); - return mpLayoutData ? mpLayoutData->GetCharacterBounds( nIndex ) : Rectangle(); + return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->GetCharacterBounds( nIndex ) : Rectangle(); } // ----------------------------------------------------------------------- @@ -167,9 +190,9 @@ long ControlLayoutData::GetIndexForPoint( const Point& rPoint ) const long Control::GetIndexForPoint( const Point& rPoint ) const { - if( ! mpLayoutData ) + if( ! HasLayoutData() ) FillLayoutData(); - return mpLayoutData ? mpLayoutData->GetIndexForPoint( rPoint ) : -1; + return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->GetIndexForPoint( rPoint ) : -1; } // ----------------------------------------------------------------------- @@ -186,9 +209,9 @@ long ControlLayoutData::GetLineCount() const long Control::GetLineCount() const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); - return mpLayoutData ? mpLayoutData->GetLineCount() : 0; + return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->GetLineCount() : 0; } // ----------------------------------------------------------------------- @@ -220,9 +243,9 @@ Pair ControlLayoutData::GetLineStartEnd( long nLine ) const Pair Control::GetLineStartEnd( long nLine ) const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); - return mpLayoutData ? mpLayoutData->GetLineStartEnd( nLine ) : Pair( -1, -1 ); + return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->GetLineStartEnd( nLine ) : Pair( -1, -1 ); } // ----------------------------------------------------------------------- @@ -263,18 +286,18 @@ long ControlLayoutData::ToRelativeLineIndex( long nIndex ) const long Control::ToRelativeLineIndex( long nIndex ) const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); - return mpLayoutData ? mpLayoutData->ToRelativeLineIndex( nIndex ) : -1; + return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->ToRelativeLineIndex( nIndex ) : -1; } // ----------------------------------------------------------------------- String Control::GetDisplayText() const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); - return mpLayoutData ? mpLayoutData->m_aDisplayText : GetText(); + return mpControlData->mpLayoutData ? mpControlData->mpLayoutData->m_aDisplayText : GetText(); } // ----------------------------------------------------------------------- @@ -321,8 +344,7 @@ void Control::StateChanged( StateChangedType nStateChange ) nStateChange == STATE_CHANGE_CONTROLFONT ) { - delete mpLayoutData; - mpLayoutData = NULL; + ImplClearLayoutData(); } Window::StateChanged( nStateChange ); } @@ -331,25 +353,25 @@ void Control::StateChanged( StateChangedType nStateChange ) void Control::AppendLayoutData( const Control& rSubControl ) const { - if( ! rSubControl.mpLayoutData ) + if( !rSubControl.HasLayoutData() ) rSubControl.FillLayoutData(); - if( ! rSubControl.mpLayoutData || ! rSubControl.mpLayoutData->m_aDisplayText.Len() ) + if( !rSubControl.HasLayoutData() || !rSubControl.mpControlData->mpLayoutData->m_aDisplayText.Len() ) return; - long nCurrentIndex = mpLayoutData->m_aDisplayText.Len(); - mpLayoutData->m_aDisplayText.Append( rSubControl.mpLayoutData->m_aDisplayText ); - int nLines = rSubControl.mpLayoutData->m_aLineIndices.size(); + long nCurrentIndex = mpControlData->mpLayoutData->m_aDisplayText.Len(); + mpControlData->mpLayoutData->m_aDisplayText.Append( rSubControl.mpControlData->mpLayoutData->m_aDisplayText ); + int nLines = rSubControl.mpControlData->mpLayoutData->m_aLineIndices.size(); int n; - mpLayoutData->m_aLineIndices.push_back( nCurrentIndex ); + mpControlData->mpLayoutData->m_aLineIndices.push_back( nCurrentIndex ); for( n = 1; n < nLines; n++ ) - mpLayoutData->m_aLineIndices.push_back( rSubControl.mpLayoutData->m_aLineIndices[n] + nCurrentIndex ); - int nRectangles = rSubControl.mpLayoutData->m_aUnicodeBoundRects.size(); + mpControlData->mpLayoutData->m_aLineIndices.push_back( rSubControl.mpControlData->mpLayoutData->m_aLineIndices[n] + nCurrentIndex ); + int nRectangles = rSubControl.mpControlData->mpLayoutData->m_aUnicodeBoundRects.size(); Rectangle aRel = const_cast<Control&>(rSubControl).GetWindowExtentsRelative( const_cast<Control*>(this) ); for( n = 0; n < nRectangles; n++ ) { - Rectangle aRect = rSubControl.mpLayoutData->m_aUnicodeBoundRects[n]; + Rectangle aRect = rSubControl.mpControlData->mpLayoutData->m_aUnicodeBoundRects[n]; aRect.Move( aRel.Left(), aRel.Top() ); - mpLayoutData->m_aUnicodeBoundRects.push_back( aRect ); + mpControlData->mpLayoutData->m_aUnicodeBoundRects.push_back( aRect ); } } @@ -378,15 +400,15 @@ BOOL Control::ImplCallEventListenersAndHandler( ULONG nEvent, const Link& rHand void Control::SetLayoutDataParent( const Control* pParent ) const { - if( mpLayoutData ) - mpLayoutData->m_pParent = pParent; + if( HasLayoutData() ) + mpControlData->mpLayoutData->m_pParent = pParent; } // ----------------------------------------------------------------- void Control::ImplClearLayoutData() const { - delete mpLayoutData, mpLayoutData = NULL; + delete mpControlData->mpLayoutData, mpControlData->mpLayoutData = NULL; } // ----------------------------------------------------------------------- @@ -467,3 +489,102 @@ Size Control::GetOptimalSize(WindowSizeType eType) const return Size( LONG_MAX, LONG_MAX ); } } + +// ----------------------------------------------------------------- + +void Control::SetReferenceDevice( OutputDevice* _referenceDevice ) +{ + if ( mpControlData->mpReferenceDevice == _referenceDevice ) + return; + + mpControlData->mpReferenceDevice = _referenceDevice; + Invalidate(); +} + +// ----------------------------------------------------------------- + +OutputDevice* Control::GetReferenceDevice() const +{ + return mpControlData->mpReferenceDevice; +} + +// ----------------------------------------------------------------- + +const Font& Control::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetLabelFont(); +} + +// ----------------------------------------------------------------- +const Color& Control::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetLabelTextColor(); +} + +// ----------------------------------------------------------------- +void Control::ImplInitSettings( const BOOL _bFont, const BOOL _bForeground ) +{ + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + + if ( _bFont ) + { + Font aFont( GetCanonicalFont( rStyleSettings ) ); + if ( IsControlFont() ) + aFont.Merge( GetControlFont() ); + SetZoomedPointFont( aFont ); + } + + if ( _bForeground || _bFont ) + { + Color aColor; + if ( IsControlForeground() ) + aColor = GetControlForeground(); + else + aColor = GetCanonicalTextColor( rStyleSettings ); + SetTextColor( aColor ); + SetTextFillColor(); + } +} + +// ----------------------------------------------------------------- + +void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, const XubString& _rStr, + USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText ) const +{ +#ifdef FS_DEBUG + if ( !_pVector ) + { + static MetricVector aCharRects; + static String sDisplayText; + aCharRects.clear(); + sDisplayText = String(); + _pVector = &aCharRects; + _pDisplayText = &sDisplayText; + } +#endif + + if ( !mpControlData->mpReferenceDevice || ( mpControlData->mpReferenceDevice == &_rTargetDevice ) ) + { + _io_rRect = _rTargetDevice.GetTextRect( _io_rRect, _rStr, _nStyle ); + _rTargetDevice.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText ); + } + else + { + ControlTextRenderer aRenderer( *this, _rTargetDevice, *mpControlData->mpReferenceDevice ); + _io_rRect = aRenderer.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText ); + } + +#ifdef FS_DEBUG + _rTargetDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); + _rTargetDevice.SetLineColor( COL_LIGHTRED ); + _rTargetDevice.SetFillColor(); + for ( MetricVector::const_iterator cr = _pVector->begin(); + cr != _pVector->end(); + ++cr + ) + { + _rTargetDevice.DrawRect( *cr ); + } + _rTargetDevice.Pop(); +#endif +} diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 5f41a441c6a1..320f235a8c30 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -47,7 +47,7 @@ #include <vcl/subedit.hxx> #include <vcl/edit.hxx> #include <vcl/svapp.hxx> -#include <vcl/controllayout.hxx> +#include <vcl/controldata.hxx> #include <vcl/msgbox.hxx> #include <vcl/window.h> @@ -409,7 +409,7 @@ void Edit::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) if ( IsControlFont() ) aFont.Merge( GetControlFont() ); SetZoomedPointFont( aFont ); - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); } if ( bFont || bForeground ) @@ -492,6 +492,17 @@ void Edit::ImplInvalidateOrRepaint( xub_StrLen nStart, xub_StrLen nEnd ) // ----------------------------------------------------------------------- +long Edit::ImplGetTextYPosition() const +{ + if ( GetStyle() & WB_TOP ) + return ImplGetExtraOffset(); + else if ( GetStyle() & WB_BOTTOM ) + return GetOutputSizePixel().Height() - GetTextHeight() - ImplGetExtraOffset(); + return ( GetOutputSizePixel().Height() - GetTextHeight() ) / 2; +} + +// ----------------------------------------------------------------------- + void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout ) { if ( !IsReallyVisible() ) @@ -516,18 +527,16 @@ void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout ) GetCaretPositions( aText, pDX, nStart, nEnd ); } - // center vertically - long nH = GetOutputSize().Height(); long nTH = GetTextHeight(); - Point aPos( mnXOffset, (nH-nTH)/2 ); + Point aPos( mnXOffset, ImplGetTextYPosition() ); if( bLayout ) { long nPos = nStart ? pDX[2*nStart] : 0; aPos.X() = nPos + mnXOffset + ImplGetExtraOffset(); - MetricVector* pVector = &mpLayoutData->m_aUnicodeBoundRects; - String* pDisplayText = &mpLayoutData->m_aDisplayText; + MetricVector* pVector = &mpControlData->mpLayoutData->m_aUnicodeBoundRects; + String* pDisplayText = &mpControlData->mpLayoutData->m_aDisplayText; DrawText( aPos, aText, nStart, nEnd - nStart, pVector, pDisplayText ); @@ -722,7 +731,7 @@ void Edit::ImplDelete( const Selection& rSelection, BYTE nDirection, BYTE nMode ((rSelection.Max() == aText.Len()) && (nDirection == EDIT_DEL_RIGHT))) ) return; - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); Selection aSelection( rSelection ); aSelection.Justify(); @@ -864,7 +873,7 @@ void Edit::ImplInsertText( const XubString& rStr, const Selection* pNewSel, sal_ rtl::OUString aNewText( ImplGetValidString( rStr ) ); ImplTruncateToMaxLen( aNewText, aSelection.Len() ); - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); if ( aSelection.Len() ) maText.Erase( (xub_StrLen)aSelection.Min(), (xub_StrLen)aSelection.Len() ); @@ -1006,7 +1015,7 @@ void Edit::ImplSetText( const XubString& rText, const Selection* pNewSelection ) // wird, dann InsertText, damit flackerfrei. if ( ( rText.Len() <= mnMaxTextLen ) && ( (rText != maText) || (pNewSelection && (*pNewSelection != maSelection)) ) ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); maSelection.Min() = 0; maSelection.Max() = maText.Len(); if ( mnXOffset || HasPaintEvent() ) @@ -1193,7 +1202,7 @@ void Edit::ImplShowCursor( BOOL bOnlyIfVisible ) long nCursorPosX = nTextPos + mnXOffset + ImplGetExtraOffset(); // Cursor muss im sichtbaren Bereich landen: - Size aOutSize = GetOutputSizePixel(); + const Size aOutSize = GetOutputSizePixel(); if ( (nCursorPosX < 0) || (nCursorPosX >= aOutSize.Width()) ) { long nOldXOffset = mnXOffset; @@ -1227,8 +1236,8 @@ void Edit::ImplShowCursor( BOOL bOnlyIfVisible ) ImplInvalidateOrRepaint(); } - long nTextHeight = GetTextHeight(); - long nCursorPosY = (aOutSize.Height()-nTextHeight) / 2; + const long nTextHeight = GetTextHeight(); + const long nCursorPosY = ImplGetTextYPosition(); pCursor->SetPos( Point( nCursorPosX, nCursorPosY ) ); pCursor->SetSize( Size( nCursorWidth, nTextHeight ) ); pCursor->Show(); @@ -1637,7 +1646,7 @@ BOOL Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) { if ( !rKEvt.GetKeyCode().IsMod2() ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); uno::Reference < i18n::XBreakIterator > xBI = ImplGetBreakIterator(); Selection aSel( maSelection ); @@ -1858,7 +1867,7 @@ void Edit::KeyInput( const KeyEvent& rKEvt ) void Edit::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast<Edit*>(this)->ImplRepaint( 0, STRING_LEN, true ); } @@ -2648,7 +2657,7 @@ void Edit::ImplSetSelection( const Selection& rSelection, BOOL bPaint ) if ( aNew != maSelection ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); maSelection = aNew; if ( bPaint && ( aOld.Len() || aNew.Len() || IsPaintTransparent() ) ) @@ -2831,7 +2840,29 @@ void Edit::SetSubEdit( Edit* pEdit ) Size Edit::CalcMinimumSize() const { Size aSize ( GetTextWidth( GetText() ), GetTextHeight() ); - return CalcWindowSize( aSize ); + // do not create edit fields in which one cannot enter anything + // a default minimum width should exist for at least 3 characters + Size aMinSize ( CalcSize( 3 ) ); + if( aSize.Width() < aMinSize.Width() ) + aSize.Width() = aMinSize.Width(); + // add some space between text entry an border + aSize.Height() += 4; + + aSize = CalcWindowSize( aSize ); + + // ask NWF what if it has an opinion, too + ImplControlValue aControlValue; + Rectangle aRect( Point( 0, 0 ), aSize ); + Region aContent, aBound; + if( const_cast<Edit*>(this)->GetNativeControlRegion( + CTRL_EDITBOX, PART_ENTIRE_CONTROL, + aRect, 0, aControlValue, rtl::OUString(), aBound, aContent) ) + { + Rectangle aBoundRect( aContent.GetBoundRect() ); + if( aBoundRect.GetHeight() > aSize.Height() ) + aSize.Height() = aBoundRect.GetHeight(); + } + return aSize; } // ----------------------------------------------------------------------- diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index b417774142d3..a7729f4ace24 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -55,6 +55,7 @@ #include <unotools/localedatawrapper.hxx> #include <unotools/calendarwrapper.hxx> #include <unotools/charclass.hxx> +#include <unotools/misccfg.hxx> using namespace ::com::sun::star; @@ -1214,7 +1215,7 @@ static BOOL ImplDateProcessKeyInput( Edit*, const KeyEvent& rKEvt, ExtDateFieldF static BOOL ImplDateGetValue( const XubString& rStr, Date& rDate, ExtDateFieldFormat eDateFormat, const LocaleDataWrapper& rLocaleDataWrapper, const CalendarWrapper& rCalendarWrapper, - const AllSettings& rSettings ) + const AllSettings& ) { USHORT nDay = 0; USHORT nMonth = 0; @@ -1312,7 +1313,7 @@ static BOOL ImplDateGetValue( const XubString& rStr, Date& rDate, ExtDateFieldFo return FALSE; Date aNewDate( nDay, nMonth, nYear ); - DateFormatter::ExpandCentury( aNewDate, rSettings.GetMiscSettings().GetTwoDigitYearStart() ); + DateFormatter::ExpandCentury( aNewDate, utl::MiscCfg().GetYear2000() ); if ( aNewDate.IsValid() ) { rDate = aNewDate; @@ -1355,7 +1356,7 @@ BOOL DateFormatter::ImplDateReformat( const XubString& rStr, XubString& rOutStr, // ----------------------------------------------------------------------- XubString DateFormatter::ImplGetDateAsText( const Date& rDate, - const AllSettings& rSettings ) const + const AllSettings& ) const { BOOL bShowCentury = FALSE; switch ( GetExtDateFormat() ) @@ -1379,7 +1380,7 @@ XubString DateFormatter::ImplGetDateAsText( const Date& rDate, if ( !bShowCentury ) { // Check if I have to use force showing the century - USHORT nTwoDigitYearStart = rSettings.GetMiscSettings().GetTwoDigitYearStart(); + USHORT nTwoDigitYearStart = utl::MiscCfg().GetYear2000(); USHORT nYear = rDate.GetYear(); // Wenn Jahr nicht im 2stelligen Grenzbereich liegt, @@ -2033,7 +2034,7 @@ void DateFormatter::Reformat() void DateFormatter::ExpandCentury( Date& rDate ) { - ExpandCentury( rDate, Application::GetSettings().GetMiscSettings().GetTwoDigitYearStart() ); + ExpandCentury( rDate, utl::MiscCfg().GetYear2000() ); } // ----------------------------------------------------------------------- diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index ecb066d107ce..df2673ede10c 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -33,7 +33,7 @@ #include <vcl/decoview.hxx> #include <vcl/event.hxx> #include <vcl/fixed.hxx> -#include <vcl/controllayout.hxx> +#include <vcl/controldata.hxx> #include <vcl/window.h> #include <tools/rc.h> @@ -109,40 +109,25 @@ WinBits FixedText::ImplInitStyle( WinBits nStyle ) return nStyle; } +// ----------------------------------------------------------------- + +const Font& FixedText::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return ( GetStyle() & WB_INFO ) ? _rStyle.GetInfoFont() : _rStyle.GetLabelFont(); +} + +// ----------------------------------------------------------------- +const Color& FixedText::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return ( GetStyle() & WB_INFO ) ? _rStyle.GetInfoTextColor() : _rStyle.GetLabelTextColor(); +} + // ----------------------------------------------------------------------- void FixedText::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont; - if ( GetStyle() & WB_INFO ) - aFont = rStyleSettings.GetInfoFont(); - else - aFont = rStyleSettings.GetLabelFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - { - if ( GetStyle() & WB_INFO ) - aColor = rStyleSettings.GetInfoTextColor(); - else - aColor = rStyleSettings.GetLabelTextColor(); - } - SetTextColor( aColor ); - SetTextFillColor(); - } + Control::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -278,17 +263,13 @@ void FixedText::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, nTextStyle |= TEXT_DRAW_MONO; if( bFillLayout ) - { - mpLayoutData->m_aDisplayText = String(); - pDev->DrawText( Rectangle( aPos, rSize ), - aText, - nTextStyle, - &mpLayoutData->m_aUnicodeBoundRects, - &mpLayoutData->m_aDisplayText - ); - } - else - pDev->DrawText( Rectangle( aPos, rSize ), aText, nTextStyle ); + mpControlData->mpLayoutData->m_aDisplayText = String(); + + Rectangle aRect( Rectangle( aPos, rSize ) ); + DrawControlText( *pDev, aRect, aText, nTextStyle, + bFillLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL, + bFillLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL + ); } // ----------------------------------------------------------------------- @@ -446,7 +427,7 @@ Size FixedText::GetOptimalSize(WindowSizeType eType) const void FixedText::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); ImplDraw( const_cast<FixedText*>(this), 0, Point(), GetOutputSizePixel(), true ); } @@ -468,31 +449,25 @@ WinBits FixedLine::ImplInitStyle( WinBits nStyle ) return nStyle; } +// ----------------------------------------------------------------- + +const Font& FixedLine::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetGroupFont(); +} + +// ----------------------------------------------------------------- +const Color& FixedLine::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetGroupTextColor(); +} + // ----------------------------------------------------------------------- void FixedLine::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont = rStyleSettings.GetGroupFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetGroupTextColor(); - SetTextColor( aColor ); - SetTextFillColor(); - } + Control::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -526,8 +501,8 @@ void FixedLine::ImplDraw( bool bLayout ) String aText = GetText(); const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); WinBits nWinStyle = GetStyle(); - MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; - String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL; + MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; + String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO ) SetLineColor( Color( COL_BLACK ) ); @@ -574,8 +549,7 @@ void FixedLine::ImplDraw( bool bLayout ) if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO ) nStyle |= TEXT_DRAW_MONO; - aRect = GetTextRect( aRect, aText, nStyle ); - DrawText( aRect, aText, nStyle, pVector, pDisplayText ); + DrawControlText( *this, aRect, aText, nStyle, pVector, pDisplayText ); if( !pVector ) { @@ -617,7 +591,7 @@ FixedLine::FixedLine( Window* pParent, const ResId& rResId ) : void FixedLine::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast<FixedLine*>(this)->ImplDraw( true ); } @@ -1088,6 +1062,14 @@ void FixedImage::Paint( const Rectangle& ) // ----------------------------------------------------------------------- +Size FixedImage::GetOptimalSize( WindowSizeType ) const +{ + const Image* pImage = GetSettings().GetStyleSettings().GetHighContrastMode() ? &maImageHC : &maImage; + return pImage->GetSizePixel(); +} + +// ----------------------------------------------------------------------- + void FixedImage::UserDraw( const UserDrawEvent& ) { } diff --git a/vcl/source/control/group.cxx b/vcl/source/control/group.cxx index a844c2f2eb93..4adc91f88d84 100644 --- a/vcl/source/control/group.cxx +++ b/vcl/source/control/group.cxx @@ -32,7 +32,7 @@ #include "precompiled_vcl.hxx" #include <vcl/event.hxx> #include <vcl/group.hxx> -#include <vcl/controllayout.hxx> +#include <vcl/controldata.hxx> #ifndef _SV_RC_H #include <tools/rc.h> @@ -66,31 +66,25 @@ WinBits GroupBox::ImplInitStyle( WinBits nStyle ) return nStyle; } +// ----------------------------------------------------------------- + +const Font& GroupBox::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetGroupFont(); +} + +// ----------------------------------------------------------------- +const Color& GroupBox::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetGroupTextColor(); +} + // ----------------------------------------------------------------------- void GroupBox::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont = rStyleSettings.GetGroupFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetGroupTextColor(); - SetTextColor( aColor ); - SetTextFillColor(); - } + Control::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -227,16 +221,16 @@ void GroupBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags, } } - MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; - String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL; - pDev->DrawText( aRect, aText, nTextStyle, pVector, pDisplayText ); + MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; + String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; + DrawControlText( *pDev, aRect, aText, nTextStyle, pVector, pDisplayText ); } // ----------------------------------------------------------------------- void GroupBox::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast<GroupBox*>(this)-> ImplDraw( const_cast<GroupBox*>(this), 0, Point(), GetOutputSizePixel(), true ); } diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index c0a28c8b03fd..fd5cd7ae4dac 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -40,7 +40,7 @@ #include <vcl/lstbox.h> #include <vcl/ilstbox.hxx> #include <vcl/i18nhelp.hxx> -#include <vcl/controllayout.hxx> +#include <vcl/controldata.hxx> #include <vcl/unohelp.hxx> #ifndef _COM_SUN_STAR_UTIL_XCOLLATOR_HPP_ #include <com/sun/star/i18n/XCollator.hpp> @@ -647,7 +647,7 @@ void ImplListBoxWindow::Clear() mnTop = 0; mnLeft = 0; mbImgsDiffSz = FALSE; - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; @@ -656,7 +656,7 @@ void ImplListBoxWindow::Clear() void ImplListBoxWindow::SetUserItemSize( const Size& rSz ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); maUserItemSize = rSz; ImplCalcMetrics(); } @@ -778,7 +778,7 @@ void ImplListBoxWindow::ImplCallSelect() nMRUCount--; } - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); ImplEntryType* pNewEntry = new ImplEntryType( aSelected ); pNewEntry->mbIsSelected = bSelectNewEntry; @@ -798,7 +798,7 @@ void ImplListBoxWindow::ImplCallSelect() USHORT ImplListBoxWindow::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); USHORT nNewPos = mpEntryList->InsertEntry( nPos, pNewEntry, mbSort ); if( (GetStyle() & WB_WORDBREAK) ) @@ -812,7 +812,7 @@ USHORT ImplListBoxWindow::InsertEntry( USHORT nPos, ImplEntryType* pNewEntry ) void ImplListBoxWindow::RemoveEntry( USHORT nPos ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); mpEntryList->RemoveEntry( nPos ); if( mnCurrentPos >= mpEntryList->GetEntryCount() ) mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; @@ -1062,7 +1062,7 @@ void ImplListBoxWindow::SelectEntry( USHORT nPos, BOOL bSelect ) ImplPaint( nPos ); if ( !IsVisible( nPos ) ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); USHORT nVisibleEntries = GetLastVisibleEntry()-mnTop; if ( !nVisibleEntries || !IsReallyVisible() || ( nPos < GetTopEntry() ) ) { @@ -1233,7 +1233,7 @@ BOOL ImplListBoxWindow::SelectEntries( USHORT nSelect, LB_EVENT_TYPE eLET, BOOL if( HasFocus() ) ImplShowFocusRect(); } - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); } return bSelectionChanged; } @@ -1838,8 +1838,8 @@ void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, if( bDrawText ) { - MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; - String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL; + MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; + String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; XubString aStr( mpEntryList->GetEntryText( nPos ) ); if ( aStr.Len() ) { @@ -1859,7 +1859,7 @@ void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, } if( bLayout ) - mpLayoutData->m_aLineIndices.push_back( mpLayoutData->m_aDisplayText.Len() ); + mpControlData->mpLayoutData->m_aLineIndices.push_back( mpControlData->mpLayoutData->m_aDisplayText.Len() ); // pb: #106948# explicit mirroring for calc if ( mbMirroring ) @@ -1873,6 +1873,8 @@ void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, USHORT nDrawStyle = ImplGetTextStyle(); if( (pEntry->mnFlags & LISTBOX_ENTRY_FLAG_MULTILINE) ) nDrawStyle |= MULTILINE_ENTRY_DRAW_FLAGS; + if( (pEntry->mnFlags & LISTBOX_ENTRY_FLAG_DRAW_DISABLED) ) + nDrawStyle |= TEXT_DRAW_DISABLE; DrawText( aTextRect, aStr, nDrawStyle, pVector, pDisplayText ); } @@ -1900,7 +1902,7 @@ void ImplListBoxWindow::DrawEntry( USHORT nPos, BOOL bDrawImage, BOOL bDrawText, void ImplListBoxWindow::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast<ImplListBoxWindow*>(this)-> ImplDoPaint( Rectangle( Point( 0, 0 ), GetOutputSize() ), true ); } @@ -1978,7 +1980,7 @@ void ImplListBoxWindow::Resize() if ( bShowFocusRect ) ImplShowFocusRect(); - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); } // ----------------------------------------------------------------------- @@ -2034,7 +2036,7 @@ void ImplListBoxWindow::SetTopEntry( USHORT nTop ) if ( nTop != mnTop ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); long nDiff = mpEntryList->GetAddedHeight( mnTop, nTop, 0 ); Update(); ImplHideFocusRect(); @@ -2078,7 +2080,7 @@ void ImplListBoxWindow::ScrollHorz( long n ) if ( nDiff ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); mnLeft = sal::static_int_cast<USHORT>(mnLeft + nDiff); Update(); ImplHideFocusRect(); @@ -2148,7 +2150,7 @@ void ImplListBoxWindow::StateChanged( StateChangedType nType ) ImplInitSettings( FALSE, FALSE, TRUE ); Invalidate(); } - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); } // ----------------------------------------------------------------------- @@ -2162,7 +2164,7 @@ void ImplListBoxWindow::DataChanged( const DataChangedEvent& rDCEvt ) ((rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE)) ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); ImplInitSettings( TRUE, TRUE, TRUE ); ImplCalcMetrics(); Invalidate(); @@ -2743,7 +2745,7 @@ void ImplWin::MouseButtonDown( const MouseEvent& ) void ImplWin::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const_cast<ImplWin*>(this)->ImplDraw( true ); } @@ -2936,8 +2938,8 @@ void ImplWin::DrawEntry( BOOL bDrawImage, BOOL bDrawText, BOOL bDrawTextAtImageP aTextRect.Left() += nMaxWidth + IMG_TXT_DISTANCE; } - MetricVector* pVector = bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL; - String* pDisplayText = bLayout ? &mpLayoutData->m_aDisplayText : NULL; + MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; + String* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; DrawText( aTextRect, maString, nTextStyle, pVector, pDisplayText ); } diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index a4d3cbc22544..81a8dc0e8242 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -43,7 +43,7 @@ #include "vcl/ilstbox.hxx" #include "vcl/lstbox.hxx" #include "vcl/combobox.hxx" -#include "vcl/controllayout.hxx" +#include "vcl/controldata.hxx" #include "tools/debug.hxx" @@ -108,6 +108,7 @@ void ListBox::ImplInitListBoxData() mnDDHeight = 0; mbDDAutoSize = TRUE; mnSaveValue = LISTBOX_ENTRY_NOTFOUND; + mnLineCount = 0; } // ----------------------------------------------------------------------- @@ -719,7 +720,7 @@ void ListBox::Resize() void ListBox::FillLayoutData() const { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); const Control* pMainWin = mpImplLB->GetMainWindow(); if( mpFloatWin ) { @@ -743,7 +744,7 @@ void ListBox::FillLayoutData() const long ListBox::GetIndexForPoint( const Point& rPoint, USHORT& rPos ) const { - if( ! mpLayoutData ) + if( !HasLayoutData() ) FillLayoutData(); // check whether rPoint fits at all @@ -1286,31 +1287,47 @@ Size ListBox::CalcMinimumSize() const else { aSz.Height() = mpImplLB->CalcSize( 1 ).Height(); - if( aSz.Height() < mnDDHeight ) + aSz.Height() += 4; // add a space between entry and border + // size to maxmimum entry width and add a little breathing space + aSz.Width() = mpImplLB->GetMaxEntryWidth() + 4; + // do not create ultrathin ListBoxes, it doesn't look good + if( aSz.Width() < GetSettings().GetStyleSettings().GetScrollBarSize() ) + aSz.Width() = GetSettings().GetStyleSettings().GetScrollBarSize(); + + // try native borders; scrollbar size may not be a good indicator + // see how large the edit area inside is to estimate what is needed for the dropdown + ImplControlValue aControlValue; + Point aPoint; + Region aContent, aBound; + Size aTestSize( 100, 20 ); + Region aArea( Rectangle( aPoint, aTestSize ) ); + if( const_cast<ListBox*>(this)->GetNativeControlRegion( + CTRL_LISTBOX, PART_SUB_EDIT, aArea, 0, aControlValue, rtl::OUString(), aBound, aContent) ) { - aSz.Height() = mnDDHeight; - // FIXME: this is currently only on mac/aqua - if( ImplGetSVData()->maNWFData.mbNoFocusRects && - IsNativeWidgetEnabled() && - const_cast<ListBox*>(this)->IsNativeControlSupported( CTRL_LISTBOX, PART_ENTIRE_CONTROL ) ) - { - ImplControlValue aControlValue; - Region aCtrlRegion( Rectangle( (const Point&)Point(), Size( 20, mnDDHeight ) ) ); - Region aBoundingRgn( aCtrlRegion ); - Region aContentRgn( aCtrlRegion ); - // adjust the size of the edit field - if( const_cast<ListBox*>(this)->GetNativeControlRegion( CTRL_LISTBOX, PART_ENTIRE_CONTROL, - aCtrlRegion, 0, aControlValue, rtl::OUString(), aBoundingRgn, aContentRgn) ) - { - aSz.Height() = aContentRgn.GetBoundRect().GetHeight(); - } - } + // use the themes drop down size + Rectangle aContentRect = aContent.GetBoundRect(); + aSz.Width() += aTestSize.Width() - aContentRect.GetWidth(); } - aSz.Width() = mpImplLB->GetMaxEntryWidth(); - aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize(); + else + aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize(); } aSz = CalcWindowSize( aSz ); + + if ( IsDropDownBox() ) // check minimum height of dropdown box + { + ImplControlValue aControlValue; + Rectangle aRect( Point( 0, 0 ), aSz ); + Region aContent, aBound; + if( const_cast<ListBox*>(this)->GetNativeControlRegion( + CTRL_LISTBOX, PART_ENTIRE_CONTROL, aRect, 0, aControlValue, rtl::OUString(), aBound, aContent) ) + { + Rectangle aBoundRect( aBound.GetBoundRect() ); + if( aBoundRect.GetHeight() > aSz.Height() ) + aSz.Height() = aBoundRect.GetHeight(); + } + } + return aSz; } diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 0d656da40ba7..1cdaa39298df 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -36,7 +36,7 @@ #include "vcl/decoview.hxx" #include "vcl/spin.h" #include "vcl/spinfld.hxx" -#include "vcl/controllayout.hxx" +#include "vcl/controldata.hxx" #include "vcl/svdata.hxx" // ======================================================================= @@ -637,7 +637,7 @@ void SpinField::FillLayoutData() const { if( mbSpin ) { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); AppendLayoutData( *GetSubEdit() ); GetSubEdit()->SetLayoutDataParent( this ); } diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 561d550b1168..56cc2c3fb012 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -30,25 +30,24 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <tools/debug.hxx> - -#ifndef _SV_RC_H -#include <tools/rc.h> -#endif -#include <vcl/svdata.hxx> -#ifndef _SV_APP_HXX -#include <vcl/svapp.hxx> -#endif -#include <vcl/help.hxx> -#include <vcl/event.hxx> -#include <vcl/menu.hxx> -#include <vcl/button.hxx> -#include <vcl/tabpage.hxx> -#include <vcl/tabctrl.hxx> -#include <vcl/controllayout.hxx> -#include <vcl/sound.hxx> - -#include <vcl/window.h> +#include "tools/debug.hxx" + +#include "tools/rc.h" +#include "vcl/svdata.hxx" +#include "vcl/svapp.hxx" +#include "vcl/help.hxx" +#include "vcl/event.hxx" +#include "vcl/menu.hxx" +#include "vcl/button.hxx" +#include "vcl/tabpage.hxx" +#include "vcl/tabctrl.hxx" +#include "vcl/controllayout.hxx" +#include "vcl/controldata.hxx" +#include "vcl/sound.hxx" +#include "vcl/lstbox.hxx" +#include "vcl/smartid.hxx" + +#include "vcl/window.h" #include <hash_map> #include <vector> @@ -87,6 +86,8 @@ struct ImplTabCtrlData std::vector< Rectangle > maTabRectangles; Point maItemsOffset; // offset of the tabitems std::vector< ImplTabItem > maItemList; + ListBox* mpListBox; + Size maMinSize; }; // ----------------------------------------------------------------------- @@ -153,47 +154,50 @@ void TabControl::ImplInit( Window* pParent, WinBits nStyle ) mbRestoreUnqId = FALSE; mbSingleLine = FALSE; mbScroll = FALSE; - mbColored = FALSE; + mbRestoreSmartId = FALSE; mbSmallInvalidate = FALSE; mbExtraSpace = FALSE; mpTabCtrlData = new ImplTabCtrlData; mpTabCtrlData->mpLeftBtn = NULL; mpTabCtrlData->mpRightBtn = NULL; + mpTabCtrlData->mpListBox = NULL; ImplInitSettings( TRUE, TRUE, TRUE ); + if( (nStyle & WB_DROPDOWN) ) + { + mpTabCtrlData->mpListBox = new ListBox( this, WB_DROPDOWN ); + mpTabCtrlData->mpListBox->SetPosSizePixel( Point( 0, 0 ), Size( 200, 20 ) ); + mpTabCtrlData->mpListBox->SetSelectHdl( LINK( this, TabControl, ImplListBoxSelectHdl ) ); + mpTabCtrlData->mpListBox->Show(); + } + // if the tabcontrol is drawn (ie filled) by a native widget, make sure all contols will have transparent background // otherwise they will paint with a wrong background if( IsNativeControlSupported(CTRL_TAB_PANE, PART_ENTIRE_CONTROL) ) EnableChildTransparentMode( TRUE ); } +// ----------------------------------------------------------------- + +const Font& TabControl::GetCanonicalFont( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetAppFont(); +} + +// ----------------------------------------------------------------- +const Color& TabControl::GetCanonicalTextColor( const StyleSettings& _rStyle ) const +{ + return _rStyle.GetButtonTextColor(); +} + // ----------------------------------------------------------------------- void TabControl::ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if ( bFont ) - { - Font aFont = rStyleSettings.GetAppFont(); - if ( IsControlFont() ) - aFont.Merge( GetControlFont() ); - SetZoomedPointFont( aFont ); - } - - if ( bForeground || bFont ) - { - Color aColor; - if ( IsControlForeground() ) - aColor = GetControlForeground(); - else - aColor = rStyleSettings.GetButtonTextColor(); - SetTextColor( aColor ); - SetTextFillColor(); - } + Control::ImplInitSettings( bFont, bForeground ); if ( bBackground ) { @@ -232,9 +236,9 @@ void TabControl::ImplInitSettings( BOOL bFont, void TabControl::ImplFreeLayoutData() { - if( mpLayoutData ) + if( HasLayoutData() ) { - delete mpLayoutData, mpLayoutData = NULL; + ImplClearLayoutData(); mpTabCtrlData->maLayoutPageIdToLine.clear(); mpTabCtrlData->maLayoutLineToPageId.clear(); } @@ -292,6 +296,8 @@ TabControl::~TabControl() // TabCtrl-Daten loeschen if ( mpTabCtrlData ) { + if( mpTabCtrlData->mpListBox ) + delete mpTabCtrlData->mpListBox; if ( mpTabCtrlData->mpLeftBtn ) delete mpTabCtrlData->mpLeftBtn; if ( mpTabCtrlData->mpRightBtn ) @@ -699,6 +705,8 @@ void TabControl::ImplChangeTabPage( USHORT nId, USHORT nOldId ) pCtrlParent->SetHelpId( 0 ); if ( mbRestoreUnqId ) pCtrlParent->SetUniqueId( 0 ); + if( mbRestoreSmartId ) + pCtrlParent->SetSmartHelpId( SmartId() ); pOldPage->DeactivatePage(); } @@ -706,8 +714,8 @@ void TabControl::ImplChangeTabPage( USHORT nId, USHORT nOldId ) { pPage->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() ); - // Hier Page aktivieren, damit die Controls entsprechend umgeschaltet - // werden koennen und HilfeId gegebenenfalls beim Parent umsetzen + // activate page here so the conbtrols can be switched + // also set the help id of the parent window to that of the tab page if ( !GetHelpId() ) { mbRestoreHelpId = TRUE; @@ -718,6 +726,11 @@ void TabControl::ImplChangeTabPage( USHORT nId, USHORT nOldId ) mbRestoreUnqId = TRUE; pCtrlParent->SetUniqueId( pPage->GetUniqueId() ); } + if( ! GetSmartHelpId().HasAny() ) + { + mbRestoreSmartId = TRUE; + pCtrlParent->SetSmartHelpId( pPage->GetSmartHelpId() ); + } pPage->ActivatePage(); @@ -797,7 +810,7 @@ void TabControl::ImplSetFirstPagePos( USHORT ) void TabControl::ImplShowFocus() { - if ( !GetPageCount() ) + if ( !GetPageCount() || mpTabCtrlData->mpListBox ) return; // make sure the focussed item rect is computed using a bold font @@ -864,9 +877,9 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo if( bLayout ) { - if( ! mpLayoutData ) + if( !HasLayoutData() ) { - mpLayoutData = new vcl::ControlLayoutData(); + mpControlData->mpLayoutData = new vcl::ControlLayoutData(); mpTabCtrlData->maLayoutLineToPageId.clear(); mpTabCtrlData->maLayoutPageIdToLine.clear(); mpTabCtrlData->maTabRectangles.clear(); @@ -1010,8 +1023,8 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo if( bLayout ) { - int nLine = mpLayoutData->m_aLineIndices.size(); - mpLayoutData->m_aLineIndices.push_back( mpLayoutData->m_aDisplayText.Len() ); + int nLine = mpControlData->mpLayoutData->m_aLineIndices.size(); + mpControlData->mpLayoutData->m_aLineIndices.push_back( mpControlData->mpLayoutData->m_aDisplayText.Len() ); mpTabCtrlData->maLayoutPageIdToLine[ (int)pItem->mnId ] = nLine; mpTabCtrlData->maLayoutLineToPageId[ nLine ] = (int)pItem->mnId; mpTabCtrlData->maTabRectangles.push_back( aRect ); @@ -1044,8 +1057,8 @@ void TabControl::ImplDrawItem( ImplTabItem* pItem, const Rectangle& rCurRect, bo DrawCtrlText( Point( nXPos + aImageSize.Width(), nYPos ), pItem->maFormatText, 0, STRING_LEN, nStyle, - bLayout ? &mpLayoutData->m_aUnicodeBoundRects : NULL, - bLayout ? &mpLayoutData->m_aDisplayText : NULL + bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL, + bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL ); } @@ -1068,16 +1081,27 @@ IMPL_LINK( TabControl, ImplScrollBtnHdl, PushButton*, EMPTYARG ) // ----------------------------------------------------------------------- +IMPL_LINK( TabControl, ImplListBoxSelectHdl, ListBox*, EMPTYARG ) +{ + SelectTabPage( GetPageId( mpTabCtrlData->mpListBox->GetSelectEntryPos() ) ); + return 0; +} + +// ----------------------------------------------------------------------- + void TabControl::MouseButtonDown( const MouseEvent& rMEvt ) { - if ( rMEvt.IsLeft() ) + if( mpTabCtrlData->mpListBox == NULL ) { - USHORT nPageId = GetPageId( rMEvt.GetPosPixel() ); - ImplTabItem* pItem = ImplGetItem( nPageId ); - if( pItem && pItem->mbEnabled ) - SelectTabPage( nPageId ); - else - Sound::Beep( SOUND_ERROR, this ); + if( rMEvt.IsLeft() ) + { + USHORT nPageId = GetPageId( rMEvt.GetPosPixel() ); + ImplTabItem* pItem = ImplGetItem( nPageId ); + if( pItem && pItem->mbEnabled ) + SelectTabPage( nPageId ); + else + Sound::Beep( SOUND_ERROR, this ); + } } } @@ -1085,7 +1109,9 @@ void TabControl::MouseButtonDown( const MouseEvent& rMEvt ) void TabControl::KeyInput( const KeyEvent& rKEvt ) { - if ( GetPageCount() > 1 ) + if( mpTabCtrlData->mpListBox ) + mpTabCtrlData->mpListBox->KeyInput( rKEvt ); + else if ( GetPageCount() > 1 ) { KeyCode aKeyCode = rKEvt.GetKeyCode(); USHORT nKeyCode = aKeyCode.GetCode(); @@ -1230,7 +1256,7 @@ void TabControl::ImplPaint( const Rectangle& rRect, bool bLayout ) } } - if ( !mpTabCtrlData->maItemList.empty() ) + if ( !mpTabCtrlData->maItemList.empty() && mpTabCtrlData->mpListBox == NULL ) { // Some native toolkits (GTK+) draw tabs right-to-left, with an // overlap between adjacent tabs @@ -1300,6 +1326,18 @@ void TabControl::Resize() if ( !IsReallyShown() ) return; + if( mpTabCtrlData->mpListBox ) + { + // get the listbox' preferred size + Size aTabCtrlSize( GetSizePixel() ); + long nPrefWidth = mpTabCtrlData->mpListBox->GetOptimalSize( WINDOWSIZE_PREFERRED ).Width(); + if( nPrefWidth > aTabCtrlSize.Width() ) + nPrefWidth = aTabCtrlSize.Width(); + Size aNewSize( nPrefWidth, LogicToPixel( Size( 12, 12 ), MapMode( MAP_APPFONT ) ).Height() ); + Point aNewPos( (aTabCtrlSize.Width() - nPrefWidth) / 2, 0 ); + mpTabCtrlData->mpListBox->SetPosSizePixel( aNewPos, aNewSize ); + } + mbFormat = TRUE; // Aktuelle TabPage resizen/positionieren @@ -1349,8 +1387,16 @@ void TabControl::Resize() void TabControl::GetFocus() { - ImplShowFocus(); - SetInputContext( InputContext( GetFont() ) ); + if( ! mpTabCtrlData->mpListBox ) + { + ImplShowFocus(); + SetInputContext( InputContext( GetFont() ) ); + } + else + { + if( mpTabCtrlData->mpListBox->IsReallyVisible() ) + mpTabCtrlData->mpListBox->GrabFocus(); + } Control::GetFocus(); } @@ -1358,7 +1404,8 @@ void TabControl::GetFocus() void TabControl::LoseFocus() { - HideFocus(); + if( ! mpTabCtrlData->mpListBox ) + HideFocus(); Control::LoseFocus(); } @@ -1452,7 +1499,7 @@ void TabControl::RequestHelp( const HelpEvent& rHEvt ) void TabControl::Command( const CommandEvent& rCEvt ) { - if ( (rCEvt.GetCommand() == COMMAND_CONTEXTMENU) && (GetPageCount() > 1) ) + if( (mpTabCtrlData->mpListBox == NULL) && (rCEvt.GetCommand() == COMMAND_CONTEXTMENU) && (GetPageCount() > 1) ) { Point aMenuPos; BOOL bMenu; @@ -1496,7 +1543,11 @@ void TabControl::StateChanged( StateChangedType nType ) Control::StateChanged( nType ); if ( nType == STATE_CHANGE_INITSHOW ) + { ImplPosCurTabPage(); + if( mpTabCtrlData->mpListBox ) + Resize(); + } else if ( nType == STATE_CHANGE_UPDATEMODE ) { if ( IsUpdateMode() ) @@ -1714,24 +1765,34 @@ void TabControl::InsertPage( USHORT nPageId, const XubString& rText, DBG_ASSERT( GetPagePos( nPageId ) == TAB_PAGE_NOTFOUND, "TabControl::InsertPage(): PageId already exists" ); - // set current page id - if ( !mnCurPageId ) - mnCurPageId = nPageId; - // 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(); + if( mpTabCtrlData->mpListBox ) + mpTabCtrlData->mpListBox->InsertEntry( rText ); } else { std::vector< ImplTabItem >::iterator new_it = mpTabCtrlData->maItemList.insert( mpTabCtrlData->maItemList.begin() + nPos, ImplTabItem() ); pItem = &(*new_it); + if( mpTabCtrlData->mpListBox ) + mpTabCtrlData->mpListBox->InsertEntry( rText, nPos); + } + if( mpTabCtrlData->mpListBox ) + { + if( ! mnCurPageId ) + mpTabCtrlData->mpListBox->SelectEntryPos( 0 ); + mpTabCtrlData->mpListBox->SetDropDownLineCount( mpTabCtrlData->mpListBox->GetEntryCount() ); } + // set current page id + if ( !mnCurPageId ) + mnCurPageId = nPageId; + // init new page item pItem->mnId = nPageId; pItem->mpTabPage = NULL; @@ -1745,6 +1806,8 @@ void TabControl::InsertPage( USHORT nPageId, const XubString& rText, Invalidate(); ImplFreeLayoutData(); + if( mpTabCtrlData->mpListBox ) // reposition/resize listbox + Resize(); ImplCallEventListeners( VCLEVENT_TABPAGE_INSERTED, (void*) (ULONG)nPageId ); } @@ -1762,6 +1825,11 @@ void TabControl::RemovePage( USHORT nPageId ) std::vector< ImplTabItem >::iterator it = mpTabCtrlData->maItemList.begin() + nPos; bool bIsCurrentPage = (it->mnId == mnCurPageId); mpTabCtrlData->maItemList.erase( it ); + if( mpTabCtrlData->mpListBox ) + { + mpTabCtrlData->mpListBox->RemoveEntry( nPos ); + mpTabCtrlData->mpListBox->SetDropDownLineCount( mpTabCtrlData->mpListBox->GetEntryCount() ); + } // If current page is removed, than first page gets the current page if ( bIsCurrentPage ) @@ -1799,6 +1867,8 @@ void TabControl::Clear() // clear item list mpTabCtrlData->maItemList.clear(); mnCurPageId = 0; + if( mpTabCtrlData->mpListBox ) + mpTabCtrlData->mpListBox->Clear(); ImplFreeLayoutData(); @@ -1819,6 +1889,9 @@ void TabControl::EnablePage( USHORT i_nPageId, bool i_bEnable ) { pItem->mbEnabled = i_bEnable; mbFormat = TRUE; + if( mpTabCtrlData->mpListBox ) + mpTabCtrlData->mpListBox->SetEntryFlags( GetPagePos( i_nPageId ), + i_bEnable ? 0 : (LISTBOX_ENTRY_FLAG_DISABLE_SELECTION | LISTBOX_ENTRY_FLAG_DRAW_DISABLED) ); if( pItem->mnId == mnCurPageId ) { // SetCurPageId will change to an enabled page @@ -1943,6 +2016,8 @@ void TabControl::SelectTabPage( USHORT nPageId ) nPageId = mnActPageId; mnActPageId = 0; SetCurPageId( nPageId ); + if( mpTabCtrlData->mpListBox ) + mpTabCtrlData->mpListBox->SelectEntryPos( GetPagePos( nPageId ) ); ImplCallEventListeners( VCLEVENT_TABPAGE_ACTIVATE, (void*) (ULONG) nPageId ); } } @@ -2007,6 +2082,12 @@ void TabControl::SetPageText( USHORT nPageId, const XubString& rText ) { pItem->maText = rText; mbFormat = TRUE; + if( mpTabCtrlData->mpListBox ) + { + USHORT nPos = GetPagePos( nPageId ); + mpTabCtrlData->mpListBox->RemoveEntry( nPos ); + mpTabCtrlData->mpListBox->InsertEntry( rText, nPos ); + } if ( IsUpdateMode() ) Invalidate(); ImplFreeLayoutData(); @@ -2108,17 +2189,17 @@ Rectangle TabControl::GetCharacterBounds( USHORT nPageId, long nIndex ) const { Rectangle aRet; - if( ! mpLayoutData || ! mpTabCtrlData->maLayoutPageIdToLine.size() ) + if( !HasLayoutData() || ! mpTabCtrlData->maLayoutPageIdToLine.size() ) FillLayoutData(); - if( mpLayoutData ) + if( HasLayoutData() ) { std::hash_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( (int)nPageId ); if( it != mpTabCtrlData->maLayoutPageIdToLine.end() ) { - Pair aPair = mpLayoutData->GetLineStartEnd( it->second ); + Pair aPair = mpControlData->mpLayoutData->GetLineStartEnd( it->second ); if( (aPair.B() - aPair.A()) >= nIndex ) - aRet = mpLayoutData->GetCharacterBounds( aPair.A() + nIndex ); + aRet = mpControlData->mpLayoutData->GetCharacterBounds( aPair.A() + nIndex ); } } @@ -2131,20 +2212,20 @@ long TabControl::GetIndexForPoint( const Point& rPoint, USHORT& rPageId ) const { long nRet = -1; - if( ! mpLayoutData || ! mpTabCtrlData->maLayoutPageIdToLine.size() ) + if( !HasLayoutData() || ! mpTabCtrlData->maLayoutPageIdToLine.size() ) FillLayoutData(); - if( mpLayoutData ) + if( HasLayoutData() ) { - int nIndex = mpLayoutData->GetIndexForPoint( rPoint ); + int nIndex = mpControlData->mpLayoutData->GetIndexForPoint( rPoint ); if( nIndex != -1 ) { // what line (->pageid) is this index in ? - int nLines = mpLayoutData->GetLineCount(); + int nLines = mpControlData->mpLayoutData->GetLineCount(); int nLine = -1; while( ++nLine < nLines ) { - Pair aPair = mpLayoutData->GetLineStartEnd( nLine ); + Pair aPair = mpControlData->mpLayoutData->GetLineStartEnd( nLine ); if( aPair.A() <= nIndex && aPair.B() >= nIndex ) { nRet = nIndex - aPair.A(); @@ -2173,10 +2254,10 @@ Rectangle TabControl::GetTabPageBounds( USHORT nPage ) const { Rectangle aRet; - if( ! mpLayoutData || ! mpTabCtrlData->maLayoutPageIdToLine.size() ) + if( !HasLayoutData() || ! mpTabCtrlData->maLayoutPageIdToLine.size() ) FillLayoutData(); - if( mpLayoutData ) + if( HasLayoutData() ) { std::hash_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( (int)nPage ); if( it != mpTabCtrlData->maLayoutPageIdToLine.end() ) @@ -2222,3 +2303,25 @@ Point TabControl::GetItemsOffset() const } // ----------------------------------------------------------------------- + +Size TabControl::GetOptimalSize(WindowSizeType eType) const +{ + switch (eType) { + case WINDOWSIZE_MINIMUM: + return mpTabCtrlData ? mpTabCtrlData->maMinSize : Size(); + default: + return Control::GetOptimalSize( eType ); + } +} + +// ----------------------------------------------------------------------- + +void TabControl::SetMinimumSizePixel( const Size& i_rSize ) +{ + if( mpTabCtrlData ) + mpTabCtrlData->maMinSize = i_rSize; +} + +// ----------------------------------------------------------------------- + + diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index e5d83dc0733a..dd198ff521db 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -332,12 +332,13 @@ struct CffLocal int mnLocalSubrBase; int mnLocalSubrCount; int mnLocalSubrBias; - int mnNominalWidth; - int mnDefaultWidth; + + ValType maNominalWidth; + ValType maDefaultWidth; // ATM hinting related values - int mnStemStdHW; - int mnStemStdVW; + ValType maStemStdHW; + ValType maStemStdVW; ValVector maStemSnapH; ValVector maStemSnapV; ValVector maBlueValues; @@ -461,10 +462,10 @@ public: // TODO: is public really needed? void getHintPair( int nIndex, ValType* nMin, ValType* nEnd) const; // accessing other charstring specifics - bool hasCharWidth( void) const { return (mnCharWidth != -1);} - int getCharWidth( void) const { return mnCharWidth;} - void setNominalWidth( int nWidth) { mpCffLocal->mnNominalWidth = nWidth;} - void setDefaultWidth( int nWidth) { mpCffLocal->mnDefaultWidth = nWidth;} + bool hasCharWidth( void) const { return (maCharWidth > 0);} + ValType getCharWidth( void) const { return maCharWidth;} + void setNominalWidth( ValType aWidth) { mpCffLocal->maNominalWidth = aWidth;} + void setDefaultWidth( ValType aWidth) { mpCffLocal->maDefaultWidth = aWidth;} void updateWidth( bool bUseFirstVal); private: @@ -477,7 +478,7 @@ private: int mnHorzHintSize; ValType mnHintStack[ NMAXHINTS]; - int mnCharWidth; + ValType maCharWidth; }; // -------------------------------------------------------------------- @@ -488,7 +489,7 @@ CffSubsetterContext::CffSubsetterContext( const U8* pBasePtr, int nBaseLen) , mnStackIdx(0) , mnHintSize(0) , mnHorzHintSize(0) -, mnCharWidth(-1) +, maCharWidth(-1) { // setCharStringType( 1); // TODO: new CffLocal[ mnFDAryCount]; @@ -542,13 +543,13 @@ inline void CffSubsetterContext::updateWidth( bool bUseFirstVal) return; #endif if( bUseFirstVal) { - mnCharWidth = static_cast<int>(mpCffLocal->mnNominalWidth + mnValStack[0]); + maCharWidth = mpCffLocal->maNominalWidth + mnValStack[0]; // remove bottom stack entry --mnStackIdx; for( int i = 0; i < mnStackIdx; ++i) mnValStack[ i] = mnValStack[ i+1]; } else { - mnCharWidth = mpCffLocal->mnDefaultWidth; + maCharWidth = mpCffLocal->maDefaultWidth; } } @@ -615,7 +616,7 @@ void CffSubsetterContext::readCharString( const U8* pTypeOps, int nTypeLen) mnStackIdx = 0; mnHintSize = 0; mnHorzHintSize = 0; - mnCharWidth = -1; + maCharWidth = -1; assert( nTypeLen >= 0); // assert( nEnd <= getLength()); @@ -659,14 +660,14 @@ void CffSubsetterContext::readDictOp( void) nVal = popVal(); nInt = static_cast<int>(nVal); switch( nOpId) { - case 10: mpCffLocal->mnStemStdHW = nInt; break; // "StdHW" - case 11: mpCffLocal->mnStemStdVW = nInt; break; // "StdVW" + case 10: mpCffLocal->maStemStdHW = nVal; break; // "StdHW" + case 11: mpCffLocal->maStemStdVW = nVal; break; // "StdVW" case 15: mnCharsetBase = nInt; break; // "charset" case 16: mnEncodingBase = nInt; break; // "nEncoding" case 17: mnCharStrBase = nInt; break; // "nCharStrings" case 19: mpCffLocal->mnLocalSubrOffs = nInt; break;// "nSubrs" - case 20: setDefaultWidth( nInt ); break; // "defaultWidthX" - case 21: setNominalWidth( nInt ); break; // "nominalWidthX" + case 20: setDefaultWidth( nVal ); break; // "defaultWidthX" + case 21: setNominalWidth( nVal ); break; // "nominalWidthX" case 909: mpCffLocal->mfBlueScale = nVal; break; // "BlueScale" case 910: mpCffLocal->mfBlueShift = nVal; break; // "BlueShift" case 911: mpCffLocal->mfBlueFuzz = nVal; break; // "BlueFuzz" @@ -1477,7 +1478,7 @@ int CffSubsetterContext::convert2Type1Ops( CffLocal* pCffLocal, const U8* const mbSawError = false; mbNeedClose = false; mbIgnoreHints = false; -mnHintSize=mnHorzHintSize=mnStackIdx=0; mnCharWidth=-1;//####### +mnHintSize=mnHorzHintSize=mnStackIdx=0; maCharWidth=-1;//####### mnCntrMask = 0; while( mpReadPtr < mpReadEnd) convertOneTypeOp(); @@ -1673,10 +1674,10 @@ CffLocal::CffLocal( void) , mnLocalSubrBase( 0) , mnLocalSubrCount( 0) , mnLocalSubrBias( 0) -, mnNominalWidth( 0) -, mnDefaultWidth( 0) -, mnStemStdHW( 0) -, mnStemStdVW( 0) +, maNominalWidth( 0) +, maDefaultWidth( 0) +, maStemStdHW( 0) +, maStemStdVW( 0) , mfBlueScale( 0.0) , mfBlueShift( 0.0) , mfBlueFuzz( 0.0) @@ -2296,8 +2297,8 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, nPrivEntryCount += (mpCffLocal->mfBlueShift != 0.0); nPrivEntryCount += (mpCffLocal->mfBlueFuzz != 0.0); // emit stem hints only if non-default values - nPrivEntryCount += (mpCffLocal->mnStemStdHW != 0); - nPrivEntryCount += (mpCffLocal->mnStemStdVW != 0); + nPrivEntryCount += (mpCffLocal->maStemStdHW != 0); + nPrivEntryCount += (mpCffLocal->maStemStdVW != 0); nPrivEntryCount += !mpCffLocal->maStemSnapH.empty(); nPrivEntryCount += !mpCffLocal->maStemSnapV.empty(); // emit other hints only if non-default values @@ -2337,10 +2338,10 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, pOut += sprintf( pOut, "/BlueFuzz %.1f def\n", mpCffLocal->mfBlueFuzz); // emit stem hint related privdict entries - if( mpCffLocal->mnStemStdHW) - pOut += sprintf( pOut, "/StdHW [%d] def\n", mpCffLocal->mnStemStdHW); - if( mpCffLocal->mnStemStdVW) - pOut += sprintf( pOut, "/StdVW [%d] def\n", mpCffLocal->mnStemStdVW); + if( mpCffLocal->maStemStdHW) + pOut += sprintf( pOut, "/StdHW [%g] def\n", mpCffLocal->maStemStdHW); + if( mpCffLocal->maStemStdVW) + pOut += sprintf( pOut, "/StdVW [%g] def\n", mpCffLocal->maStemStdVW); rEmitter.emitValVector( "/StemSnapH [", "]ND\n", mpCffLocal->maStemSnapH); rEmitter.emitValVector( "/StemSnapV [", "]ND\n", mpCffLocal->maStemSnapV); @@ -2413,8 +2414,12 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, pOut += sprintf( pOut, " ND\n"); rEmitter.emitAllCrypted(); // provide individual glyphwidths if requested - if( pGlyphWidths ) - pGlyphWidths[i] = getCharWidth(); + if( pGlyphWidths ) { + ValType aCharWidth = getCharWidth(); + if( maFontMatrix.size() >= 4) + aCharWidth *= 1000.0F * maFontMatrix[0]; + pGlyphWidths[i] = static_cast<GlyphWidth>(aCharWidth); + } } pOut += sprintf( pOut, "end end\nreadonly put\nput\n"); pOut += sprintf( pOut, "dup/FontName get exch definefont pop\n"); @@ -2446,8 +2451,17 @@ bool CffSubsetterContext::emitAsType1( Type1Emitter& rEmitter, // provide details to the subset requesters, TODO: move into own method? // note: Top and Bottom are flipped between Type1 and VCL - rFSInfo.m_aFontBBox = Rectangle( Point( static_cast<long>(maFontBBox[0]), static_cast<long>(maFontBBox[1]) ), - Point( static_cast<long>(maFontBBox[2]), static_cast<long>(maFontBBox[3]) ) ); + // note: the rest of VCL expects the details below to be scaled like for an emUnits==1000 font + ValType fXFactor = 1.0; + ValType fYFactor = 1.0; + if( maFontMatrix.size() >= 4) { + fXFactor = 1000.0F * maFontMatrix[0]; + fYFactor = 1000.0F * maFontMatrix[3]; + } + rFSInfo.m_aFontBBox = Rectangle( Point( static_cast<long>(maFontBBox[0] * fXFactor), + static_cast<long>(maFontBBox[1] * fYFactor) ), + Point( static_cast<long>(maFontBBox[2] * fXFactor), + static_cast<long>(maFontBBox[3] * fYFactor) ) ); // PDF-Spec says the values below mean the ink bounds! // TODO: use better approximations for these ink bounds rFSInfo.m_nAscent = +rFSInfo.m_aFontBBox.Bottom(); // for capital letters diff --git a/vcl/source/fontsubset/gsub.cxx b/vcl/source/fontsubset/gsub.cxx index 9715e7fc8585..600c03194210 100644 --- a/vcl/source/fontsubset/gsub.cxx +++ b/vcl/source/fontsubset/gsub.cxx @@ -32,6 +32,8 @@ #include "gsub.h" +#include <osl/diagnose.h> + #include <vector> #include <map> #include <algorithm> @@ -280,9 +282,11 @@ int ReadGSUB( struct _TrueTypeFont* pTTFile, { const USHORT nGlyph0 = NEXT_UShort( pCoverage ); const USHORT nGlyph1 = NEXT_UShort( pCoverage ); - const USHORT nCovIdx = NEXT_UShort( pCoverage ); + const USHORT nStartCoverageIndex = NEXT_UShort( pCoverage ); + OSL_ENSURE( aSubstVector.size() == nStartCoverageIndex, "coverage index mismatch"); + (void)nStartCoverageIndex; for( USHORT j = nGlyph0; j <= nGlyph1; ++j ) - aSubstVector.push_back( GlyphSubst( j + nCovIdx, 0 ) ); + aSubstVector.push_back( GlyphSubst( j, 0 ) ); } } break; diff --git a/vcl/source/gdi/base14.cxx b/vcl/source/gdi/base14.cxx index 17e616d196b4..56d1c3ff5eba 100644 --- a/vcl/source/gdi/base14.cxx +++ b/vcl/source/gdi/base14.cxx @@ -601,7 +601,7 @@ const PDFWriterImpl::BuiltinFont PDFWriterImpl::m_aBuiltinFonts[ 14 ] = { "Symbol", // PSName 1010, -293, // ascend, descend FAMILY_DONTKNOW, // family style - RTL_TEXTENCODING_SYMBOL, // charset + RTL_TEXTENCODING_ADOBE_SYMBOL, // charset PITCH_VARIABLE, // pitch WIDTH_NORMAL, // width type WEIGHT_NORMAL, // weight type diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index cfcac8851089..4e2ed20a7966 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -47,6 +47,7 @@ #include <tools/rc.h> #endif #include <vcl/svapp.hxx> +#include <vcl/bmpacc.hxx> // ------------ // - BitmapEx - @@ -761,6 +762,78 @@ void BitmapEx::Draw( OutputDevice* pOutDev, // ------------------------------------------------------------------ +sal_uInt8 BitmapEx::GetTransparency(sal_Int32 nX, sal_Int32 nY) const +{ + sal_uInt8 nTransparency(0xff); + + if(!aBitmap.IsEmpty()) + { + if(nX >= 0 && nX < aBitmapSize.Width() && nY >= 0 && nY < aBitmapSize.Height()) + { + switch(eTransparent) + { + case TRANSPARENT_NONE: + { + // not transparent, ergo all covered + nTransparency = 0x00; + break; + } + case TRANSPARENT_COLOR: + { + Bitmap aTestBitmap(aBitmap); + BitmapReadAccess* pRead = aTestBitmap.AcquireReadAccess(); + + if(pRead) + { + const Color aColor = pRead->GetColor(nY, nX); + + // if color is not equal to TransparentColor, we are not transparent + if(aColor != aTransparentColor) + { + nTransparency = 0x00; + } + + aTestBitmap.ReleaseAccess(pRead); + } + break; + } + case TRANSPARENT_BITMAP: + { + if(!aMask.IsEmpty()) + { + Bitmap aTestBitmap(aMask); + BitmapReadAccess* pRead = aTestBitmap.AcquireReadAccess(); + + if(pRead) + { + const BitmapColor aBitmapColor(pRead->GetPixel(nY, nX)); + + if(bAlpha) + { + nTransparency = aBitmapColor.GetIndex(); + } + else + { + if(0x00 != aBitmapColor.GetIndex()) + { + nTransparency = 0x00; + } + } + + aTestBitmap.ReleaseAccess(pRead); + } + } + break; + } + } + } + } + + return nTransparency; +} + +// ------------------------------------------------------------------ + SvStream& operator<<( SvStream& rOStm, const BitmapEx& rBitmapEx ) { rBitmapEx.aBitmap.Write( rOStm ); diff --git a/vcl/source/gdi/bmpconv.cxx b/vcl/source/gdi/bmpconv.cxx index 9d9b81ba50d4..03d85acb0159 100644 --- a/vcl/source/gdi/bmpconv.cxx +++ b/vcl/source/gdi/bmpconv.cxx @@ -192,7 +192,8 @@ BmpTransporter::BmpTransporter( const Bitmap& rBM ) m_aSize.Height = rBM.GetSizePixel().Height(); SvMemoryStream aStream; rBM.Write( aStream, FALSE, TRUE ); - m_aBM = Sequence<sal_Int8>((const sal_Int8*)aStream.GetData(), aStream.GetSize() ); + m_aBM = Sequence<sal_Int8>(static_cast<const sal_Int8*>(aStream.GetData()), + aStream.GetEndOfData()); } BmpTransporter::~BmpTransporter() diff --git a/vcl/source/gdi/configsettings.cxx b/vcl/source/gdi/configsettings.cxx new file mode 100644 index 000000000000..b601caef301a --- /dev/null +++ b/vcl/source/gdi/configsettings.cxx @@ -0,0 +1,205 @@ +/************************************************************************* + * + * 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 + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + +#include <vcl/configsettings.hxx> +#include <vcl/svdata.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> + +using namespace rtl; +using namespace utl; +using namespace vcl; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::container; + +#define SETTINGS_CONFIGNODE "VCL/Settings" + +/* + * SettingsConfigItem::get + */ + +SettingsConfigItem* SettingsConfigItem::get() +{ + ImplSVData* pSVData = ImplGetSVData(); + if( ! pSVData->mpSettingsConfigItem ) + pSVData->mpSettingsConfigItem = new SettingsConfigItem(); + return pSVData->mpSettingsConfigItem; +} + +/* + * SettignsConfigItem constructor + */ + +SettingsConfigItem::SettingsConfigItem() + : + ConfigItem( OUString( RTL_CONSTASCII_USTRINGPARAM( SETTINGS_CONFIGNODE ) ), + CONFIG_MODE_DELAYED_UPDATE ), + m_aSettings( 0 ) +{ + getValues(); +} + +/* + * SettingsConfigItem destructor + */ + +SettingsConfigItem::~SettingsConfigItem() +{ + if( IsModified() ) + Commit(); +} + +/* + * SettingsConfigItem::Commit + */ + +void SettingsConfigItem::Commit() +{ + if( ! IsValidConfigMgr() ) + return; + + std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group; + + for( group = m_aSettings.begin(); group != m_aSettings.end(); ++group ) + { + String aKeyName( group->first ); + /*sal_Bool bAdded =*/ AddNode( OUString(), aKeyName ); + Sequence< PropertyValue > aValues( group->second.size() ); + PropertyValue* pValues = aValues.getArray(); + int nIndex = 0; + SmallOUStrMap::const_iterator it; + for( it = group->second.begin(); it != group->second.end(); ++it ) + { + String aName( aKeyName ); + aName.Append( '/' ); + aName.Append( String( it->first ) ); + pValues[nIndex].Name = aName; + pValues[nIndex].Handle = 0; + pValues[nIndex].Value <<= it->second; + pValues[nIndex].State = PropertyState_DIRECT_VALUE; + nIndex++; + } + ReplaceSetProperties( aKeyName, aValues ); + } +} + +/* + * SettingsConfigItem::Notify + */ + +void SettingsConfigItem::Notify( const Sequence< OUString >& ) +{ + getValues(); +} + +/* + * SettingsConfigItem::getValues + */ +void SettingsConfigItem::getValues() +{ + if( ! IsValidConfigMgr() ) + return; + + m_aSettings.clear(); + + Sequence< OUString > aNames( GetNodeNames( OUString() ) ); + m_aSettings.resize( aNames.getLength() ); + + for( int j = 0; j < aNames.getLength(); j++ ) + { +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, "found settings data for \"%s\"\n", + OUStringToOString( aNames.getConstArray()[j], RTL_TEXTENCODING_ASCII_US ).getStr() + ); +#endif + String aKeyName( aNames.getConstArray()[j] ); + Sequence< OUString > aKeys( GetNodeNames( aKeyName ) ); + Sequence< OUString > aSettingsKeys( aKeys.getLength() ); + const OUString* pFrom = aKeys.getConstArray(); + OUString* pTo = aSettingsKeys.getArray(); + for( int m = 0; m < aKeys.getLength(); m++ ) + { + String aName( aKeyName ); + aName.Append( '/' ); + aName.Append( String( pFrom[m] ) ); + pTo[m] = aName; + } + Sequence< Any > aValues( GetProperties( aSettingsKeys ) ); + const Any* pValue = aValues.getConstArray(); + for( int i = 0; i < aValues.getLength(); i++, pValue++ ) + { + if( pValue->getValueTypeClass() == TypeClass_STRING ) + { + const OUString* pLine = (const OUString*)pValue->getValue(); + if( pLine->getLength() ) + m_aSettings[ aKeyName ][ pFrom[i] ] = *pLine; +#if OSL_DEBUG_LEVEL > 2 + fprintf( stderr, " \"%s\"=\"%.30s\"\n", + OUStringToOString( aKeys.getConstArray()[i], RTL_TEXTENCODING_ASCII_US ).getStr(), + OUStringToOString( *pLine, RTL_TEXTENCODING_ASCII_US ).getStr() + ); +#endif + } + } + } +} + +/* + * SettingsConfigItem::getDefaultFont + */ + +const OUString& SettingsConfigItem::getValue( const OUString& rGroup, const OUString& rKey ) const +{ + ::std::hash_map< OUString, SmallOUStrMap, rtl::OUStringHash >::const_iterator group = m_aSettings.find( rGroup ); + if( group == m_aSettings.end() || group->second.find( rKey ) == group->second.end() ) + { + static OUString aEmpty; + return aEmpty; + } + return group->second.find(rKey)->second; +} + +/* + * SettingsConfigItem::setDefaultFont + */ + +void SettingsConfigItem::setValue( const OUString& rGroup, const OUString& rKey, const OUString& rValue ) +{ + bool bModified = m_aSettings[ rGroup ][ rKey ] != rValue; + if( bModified ) + { + m_aSettings[ rGroup ][ rKey ] = rValue; + SetModified(); + } +} + diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index c1c02b673658..8c4b6f1a2cb2 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -88,18 +88,6 @@ void ImplReadPoly( SvStream& rIStm, Polygon& rPoly ) // ------------------------------------------------------------------------ -void ImplWritePoly( SvStream& rOStm, const Polygon& rPoly ) -{ - INT32 nSize = rPoly.GetSize(); - - rOStm << nSize; - - for( INT32 i = 0; i < nSize; i++ ) - rOStm << rPoly[ (USHORT) i ]; -} - -// ------------------------------------------------------------------------ - void ImplReadPolyPoly( SvStream& rIStm, PolyPolygon& rPolyPoly ) { Polygon aPoly; @@ -131,13 +119,17 @@ void ImplWritePolyPolyAction( SvStream& rOStm, const PolyPolygon& rPolyPoly ) for( n = 0; n < nPoly; n++ ) { - const Polygon& rPoly = rPolyPoly[ n ]; - const USHORT nSize = rPoly.GetSize(); + // #i102224# Here the evtl. curved nature of Polygon was + // ignored (for all those Years). Adapted to at least write + // a polygon representing the curve as good as possible + Polygon aSimplePoly; + rPolyPoly[n].AdaptiveSubdivide(aSimplePoly); + const USHORT nSize(aSimplePoly.GetSize()); rOStm << (INT32) nSize; for( USHORT j = 0; j < nSize; j++ ) - rOStm << rPoly[ j ]; + rOStm << aSimplePoly[ j ]; } } @@ -378,6 +370,128 @@ void ImplSkipActions( SvStream& rIStm, ULONG nSkipCount ) } } +// ------------------------------------------------------------------------ + +bool ImplWriteExtendedPolyPolygonAction(SvStream& rOStm, const PolyPolygon& rPolyPolygon, bool bOnlyWhenCurve) +{ + const sal_uInt16 nPolygonCount(rPolyPolygon.Count()); + + if(nPolygonCount) + { + sal_uInt32 nAllPolygonCount(0); + sal_uInt32 nAllPointCount(0); + sal_uInt32 nAllFlagCount(0); + sal_uInt16 a(0); + + for(a = 0; a < nPolygonCount; a++) + { + const Polygon& rCandidate = rPolyPolygon.GetObject(a); + const sal_uInt16 nPointCount(rCandidate.GetSize()); + + if(nPointCount) + { + nAllPolygonCount++; + nAllPointCount += nPointCount; + + if(rCandidate.HasFlags()) + { + nAllFlagCount += nPointCount; + } + } + } + + if((bOnlyWhenCurve && nAllFlagCount) || (!bOnlyWhenCurve && nAllPointCount)) + { + rOStm << (INT16) GDI_EXTENDEDPOLYGON_ACTION; + + const sal_Int32 nActionSize( + 4 + // Action size + 2 + // PolygonCount + (nAllPolygonCount * 2) + // Points per polygon + (nAllPointCount << 3) + // Points themselves + nAllPolygonCount + // Bool if (when poly has points) it has flags, too + nAllFlagCount); // Flags themselves + + rOStm << nActionSize; + rOStm << (sal_uInt16)nAllPolygonCount; + + for(a = 0; a < nPolygonCount; a++) + { + const Polygon& rCandidate = rPolyPolygon.GetObject(a); + const sal_uInt16 nPointCount(rCandidate.GetSize()); + + if(nPointCount) + { + rOStm << nPointCount; + + for(sal_uInt16 b(0); b < nPointCount; b++) + { + rOStm << rCandidate[b]; + } + + if(rCandidate.HasFlags()) + { + rOStm << (BYTE)true; + + for(sal_uInt16 c(0); c < nPointCount; c++) + { + rOStm << (BYTE)rCandidate.GetFlags(c); + } + } + else + { + rOStm << (BYTE)false; + } + } + } + + return true; + } + } + + return false; +} + +// ------------------------------------------------------------------------ + +void ImplReadExtendedPolyPolygonAction(SvStream& rIStm, PolyPolygon& rPolyPoly) +{ + rPolyPoly.Clear(); + sal_uInt16 nPolygonCount(0); + rIStm >> nPolygonCount; + + for(sal_uInt16 a(0); a < nPolygonCount; a++) + { + sal_uInt16 nPointCount(0); + rIStm >> nPointCount; + Polygon aCandidate(nPointCount); + + if(nPointCount) + { + for(sal_uInt16 b(0); b < nPointCount; b++) + { + rIStm >> aCandidate[b]; + } + + BYTE bHasFlags(false); + rIStm >> bHasFlags; + + if(bHasFlags) + { + BYTE aPolyFlags(0); + + for(sal_uInt16 c(0); c < nPointCount; c++) + { + rIStm >> aPolyFlags; + aCandidate.SetFlags(c, (PolyFlags)aPolyFlags); + } + } + } + + rPolyPoly.Insert(aCandidate); + } +} + // ---------------- // - SVMConverter - // ---------------- @@ -450,6 +564,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) rMtf.SetPrefSize( aPrefSz ); rMtf.SetPrefMapMode( aMapMode ); + sal_uInt32 nLastPolygonAction(0); for( INT32 i = 0L; i < nActions; i++ ) { @@ -483,6 +598,99 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) } break; + case (GDI_LINEJOIN_ACTION) : + { + INT16 nLineJoin(0); + rIStm >> nLineJoin; + aLineInfo.SetLineJoin((basegfx::B2DLineJoin)nLineJoin); + } + break; + + case (GDI_LINEDASHDOT_ACTION) : + { + INT16 a(0); + INT32 b(0); + + rIStm >> a; aLineInfo.SetDashCount(a); + rIStm >> b; aLineInfo.SetDashLen(b); + rIStm >> a; aLineInfo.SetDotCount(a); + rIStm >> b; aLineInfo.SetDotLen(b); + rIStm >> b; aLineInfo.SetDistance(b); + + if(((aLineInfo.GetDashCount() && aLineInfo.GetDashLen()) + || (aLineInfo.GetDotCount() && aLineInfo.GetDotLen())) + && aLineInfo.GetDistance()) + { + aLineInfo.SetStyle(LINE_DASH); + } + } + break; + + case (GDI_EXTENDEDPOLYGON_ACTION) : + { + // read the PolyPolygon in every case + PolyPolygon aInputPolyPolygon; + ImplReadExtendedPolyPolygonAction(rIStm, aInputPolyPolygon); + + // now check if it can be set somewhere + if(nLastPolygonAction < rMtf.GetActionCount()) + { + MetaPolyLineAction* pPolyLineAction = dynamic_cast< MetaPolyLineAction* >(rMtf.GetAction(nLastPolygonAction)); + + if(pPolyLineAction) + { + // replace MetaPolyLineAction when we have a single polygon. Do not rely on the + // same point count; the originally written GDI_POLYLINE_ACTION may have been + // Subdivided for better quality for older usages + if(1 == aInputPolyPolygon.Count()) + { + rMtf.ReplaceAction( + new MetaPolyLineAction( + aInputPolyPolygon.GetObject(0), + pPolyLineAction->GetLineInfo()), + nLastPolygonAction); + pPolyLineAction->Delete(); + } + } + else + { + MetaPolyPolygonAction* pPolyPolygonAction = dynamic_cast< MetaPolyPolygonAction* >(rMtf.GetAction(nLastPolygonAction)); + + if(pPolyPolygonAction) + { + // replace MetaPolyPolygonAction when we have a curved polygon. Do rely on the + // same sub-polygon count + if(pPolyPolygonAction->GetPolyPolygon().Count() == aInputPolyPolygon.Count()) + { + rMtf.ReplaceAction( + new MetaPolyPolygonAction( + aInputPolyPolygon), + nLastPolygonAction); + pPolyPolygonAction->Delete(); + } + } + else + { + MetaPolygonAction* pPolygonAction = dynamic_cast< MetaPolygonAction* >(rMtf.GetAction(nLastPolygonAction)); + + if(pPolygonAction) + { + // replace MetaPolygonAction + if(1 == aInputPolyPolygon.Count()) + { + rMtf.ReplaceAction( + new MetaPolygonAction( + aInputPolyPolygon.GetObject(0)), + nLastPolygonAction); + pPolygonAction->Delete(); + } + } + } + } + } + } + break; + case( GDI_RECT_ACTION ): { ImplReadRect( rIStm, aRect ); @@ -573,6 +781,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) case( GDI_POLYLINE_ACTION ): { ImplReadPoly( rIStm, aActionPoly ); + nLastPolygonAction = rMtf.GetActionCount(); if( bFatLine ) rMtf.AddAction( new MetaPolyLineAction( aActionPoly, aLineInfo ) ); @@ -594,7 +803,10 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) rMtf.AddAction( new MetaPolyLineAction( aActionPoly, aLineInfo ) ); } else + { + nLastPolygonAction = rMtf.GetActionCount(); rMtf.AddAction( new MetaPolygonAction( aActionPoly ) ); + } } break; @@ -615,7 +827,10 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf ) rMtf.AddAction( new MetaPolyLineAction( aPolyPoly[ nPoly ], aLineInfo ) ); } else + { + nLastPolygonAction = rMtf.GetActionCount(); rMtf.AddAction( new MetaPolyPolygonAction( aPolyPoly ) ); + } } break; @@ -1247,12 +1462,32 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaLineAction* pAct = (MetaLineAction*) pAction; const LineInfo& rInfo = pAct->GetLineInfo(); - const BOOL bFatLine = ( !rInfo.IsDefault() && ( LINE_NONE != rInfo.GetStyle() ) ); + const bool bFatLine(!rInfo.IsDefault() && (LINE_NONE != rInfo.GetStyle())); + const bool bLineJoin(bFatLine && basegfx::B2DLINEJOIN_ROUND != rInfo.GetLineJoin()); + const bool bLineDashDot(LINE_DASH == rInfo.GetStyle()); if( bFatLine ) { ImplWritePushAction( rOStm ); ImplWriteLineColor( rOStm, rLineCol, 1, rInfo.GetWidth() ); + + if(bLineJoin) + { + rOStm << (INT16) GDI_LINEJOIN_ACTION; + rOStm << (INT32) 6; + rOStm << (INT16) rInfo.GetLineJoin(); + } + + if(bLineDashDot) + { + rOStm << (INT16) GDI_LINEDASHDOT_ACTION; + rOStm << (INT32) 4 + 16; + rOStm << (INT16)rInfo.GetDashCount(); + rOStm << (INT32)rInfo.GetDashLen(); + rOStm << (INT16)rInfo.GetDotCount(); + rOStm << (INT32)rInfo.GetDotLen(); + rOStm << (INT32)rInfo.GetDistance(); + } } rOStm << (INT16) GDI_LINE_ACTION; @@ -1265,6 +1500,16 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { ImplWritePopAction( rOStm ); nCount += 3; + + if(bLineJoin) + { + nCount += 1; + } + + if(bLineDashDot) + { + nCount += 1; + } } } break; @@ -1345,23 +1590,47 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, for( USHORT n = 0; n < nPoints; n++ ) rOStm << aChordPoly[ n ]; - nCount++; } break; case( META_POLYLINE_ACTION ): { + // #i102224# MetaPolyLineAction* pAct = (MetaPolyLineAction*) pAction; - const Polygon& rPoly = pAct->GetPolygon(); - const LineInfo& rInfo = pAct->GetLineInfo(); - const USHORT nPoints = rPoly.GetSize(); - const BOOL bFatLine = ( !rInfo.IsDefault() && ( LINE_NONE != rInfo.GetStyle() ) ); + // #i102224# Here the evtl. curved nature of Polygon was + // ignored (for all those Years). Adapted to at least write + // a polygon representing the curve as good as possible + Polygon aSimplePoly; + pAct->GetPolygon().AdaptiveSubdivide(aSimplePoly); + const LineInfo& rInfo = pAct->GetLineInfo(); + const USHORT nPoints(aSimplePoly.GetSize()); + const bool bFatLine(!rInfo.IsDefault() && (LINE_NONE != rInfo.GetStyle())); + const bool bLineJoin(bFatLine && basegfx::B2DLINEJOIN_ROUND != rInfo.GetLineJoin()); + const bool bLineDashDot(LINE_DASH == rInfo.GetStyle()); if( bFatLine ) { ImplWritePushAction( rOStm ); ImplWriteLineColor( rOStm, rLineCol, 1, rInfo.GetWidth() ); + + if(bLineJoin) + { + rOStm << (INT16) GDI_LINEJOIN_ACTION; + rOStm << (INT32) 6; + rOStm << (INT16) rInfo.GetLineJoin(); + } + } + + if(bLineDashDot) + { + rOStm << (INT16) GDI_LINEDASHDOT_ACTION; + rOStm << (INT32) 4 + 16; + rOStm << (INT16)rInfo.GetDashCount(); + rOStm << (INT32)rInfo.GetDashLen(); + rOStm << (INT16)rInfo.GetDotCount(); + rOStm << (INT32)rInfo.GetDotLen(); + rOStm << (INT32)rInfo.GetDistance(); } rOStm << (INT16) GDI_POLYLINE_ACTION; @@ -1369,32 +1638,60 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, rOStm << (INT32) nPoints; for( USHORT n = 0; n < nPoints; n++ ) - rOStm << rPoly[ n ]; + { + rOStm << aSimplePoly[ n ]; + } nCount++; + const PolyPolygon aPolyPolygon(pAct->GetPolygon()); + if(ImplWriteExtendedPolyPolygonAction(rOStm, aPolyPolygon, true)) + { + nCount++; + } + if( bFatLine ) { ImplWritePopAction( rOStm ); nCount += 3; + + if(bLineJoin) + { + nCount += 1; + } + } + + if(bLineDashDot) + { + nCount += 1; } } break; case( META_POLYGON_ACTION ): { - MetaPolygonAction* pAct = (MetaPolygonAction*) pAction; - const Polygon& rPoly = pAct->GetPolygon(); - const USHORT nPoints = rPoly.GetSize(); + MetaPolygonAction* pAct = (MetaPolygonAction*)pAction; + // #i102224# Here the evtl. curved nature of Polygon was + // ignored (for all those Years). Adapted to at least write + // a polygon representing the curve as good as possible + Polygon aSimplePoly; + pAct->GetPolygon().AdaptiveSubdivide(aSimplePoly); + const USHORT nPoints(aSimplePoly.GetSize()); rOStm << (INT16) GDI_POLYGON_ACTION; rOStm << (INT32) ( 8 + ( nPoints << 3 ) ); rOStm << (INT32) nPoints; for( USHORT n = 0; n < nPoints; n++ ) - rOStm << rPoly[ n ]; + rOStm << aSimplePoly[ n ]; nCount++; + + const PolyPolygon aPolyPolygon(pAct->GetPolygon()); + if(ImplWriteExtendedPolyPolygonAction(rOStm, aPolyPolygon, true)) + { + nCount++; + } } break; @@ -1403,6 +1700,11 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, MetaPolyPolygonAction* pAct = (MetaPolyPolygonAction*) pAction; ImplWritePolyPolyAction( rOStm, pAct->GetPolyPolygon() ); nCount++; + + if(ImplWriteExtendedPolyPolygonAction(rOStm, pAct->GetPolyPolygon(), true)) + { + nCount++; + } } break; diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx index 3bbdba5dad5f..afd6181351b4 100644 --- a/vcl/source/gdi/font.cxx +++ b/vcl/source/gdi/font.cxx @@ -38,8 +38,8 @@ #include "tools/debug.hxx" #include "vcl/font.hxx" #include "vcl/impfont.hxx" -#include "vcl/fontcfg.hxx" -#include "vcl/outdev.h" // just for ImplGetEnglishSearchFontName! TODO: move it +#include "vcl/outfont.hxx" +#include "unotools/fontcfg.hxx" #include <algorithm> @@ -169,7 +169,7 @@ void Impl_Font::AskConfig() mbConfigLookup = true; // prepare the FontSubst configuration lookup - const vcl::FontSubstConfiguration* pFontSubst = vcl::FontSubstConfiguration::get(); + const utl::FontSubstConfiguration* pFontSubst = utl::FontSubstConfiguration::get(); String aShortName; String aFamilyName; @@ -177,12 +177,12 @@ void Impl_Font::AskConfig() FontWeight eWeight = WEIGHT_DONTKNOW; FontWidth eWidthType = WIDTH_DONTKNOW; String aMapName = maFamilyName; - ImplGetEnglishSearchFontName( aMapName ); - vcl::FontSubstConfiguration::getMapName( aMapName, + GetEnglishSearchFontName( aMapName ); + utl::FontSubstConfiguration::getMapName( aMapName, aShortName, aFamilyName, eWeight, eWidthType, nType ); // lookup the font name in the configuration - const vcl::FontNameAttr* pFontAttr = pFontSubst->getSubstInfo( aMapName ); + const utl::FontNameAttr* pFontAttr = pFontSubst->getSubstInfo( aMapName ); // if the direct lookup failed try again with an alias name if ( !pFontAttr && (aShortName != aMapName) ) diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 6483c8292df7..951d80f9af9d 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -876,6 +876,40 @@ void GDIMetaFile::Scale( const Fraction& rScaleX, const Fraction& rScaleY ) // ------------------------------------------------------------------------ +void GDIMetaFile::Clip( const Rectangle& i_rClipRect ) +{ + Rectangle aCurRect( i_rClipRect ); + VirtualDevice aMapVDev; + + aMapVDev.EnableOutput( FALSE ); + aMapVDev.SetMapMode( GetPrefMapMode() ); + + for( MetaAction* pAct = (MetaAction*) First(); pAct; pAct = (MetaAction*) Next() ) + { + const long nType = pAct->GetType(); + + if( ( META_MAPMODE_ACTION == nType ) || + ( META_PUSH_ACTION == nType ) || + ( META_POP_ACTION == nType ) ) + { + pAct->Execute( &aMapVDev ); + aCurRect = aMapVDev.LogicToLogic( i_rClipRect, GetPrefMapMode(), aMapVDev.GetMapMode() ); + } + else if( nType == META_CLIPREGION_ACTION ) + { + MetaClipRegionAction* pOldAct = (MetaClipRegionAction*)pAct; + Region aNewReg( aCurRect ); + if( pOldAct->IsClipping() ) + aNewReg.Intersect( pOldAct->GetRegion() ); + MetaClipRegionAction* pNewAct = new MetaClipRegionAction( aNewReg, TRUE ); + Replace( pNewAct, GetCurPos() ); + pOldAct->Delete(); + } + } +} + +// ------------------------------------------------------------------------ + Point GDIMetaFile::ImplGetRotatedPoint( const Point& rPt, const Point& rRotatePt, const Size& rOffset, double fSin, double fCos ) { diff --git a/vcl/source/gdi/impimagetree.cxx b/vcl/source/gdi/impimagetree.cxx index 039041826124..8178204a4ffd 100644 --- a/vcl/source/gdi/impimagetree.cxx +++ b/vcl/source/gdi/impimagetree.cxx @@ -46,6 +46,7 @@ #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/Sequence.hxx" #include "comphelper/processfactory.hxx" +#include "osl/file.hxx" #include "osl/diagnose.h" #include "rtl/bootstrap.hxx" #include "rtl/string.h" @@ -118,12 +119,43 @@ ImplImageTree::ImplImageTree() {} ImplImageTree::~ImplImageTree() {} +bool ImplImageTree::checkStyle(rtl::OUString const & style) +{ + bool exists; + + // using cache because setStyle is an expensive operation + // setStyle calls resetZips => closes any opened zip files with icons, cleans the icon cache, ... + if (checkStyleCacheLookup(style, exists)) { + return exists; + } + + setStyle(style); + + exists = false; + const rtl::OUString sBrandURLSuffix(RTL_CONSTASCII_USTRINGPARAM("_brand.zip")); + for (Zips::iterator i(m_zips.begin()); i != m_zips.end() && !exists;) { + ::rtl::OUString aZipURL = i->first; + sal_Int32 nFromIndex = aZipURL.getLength() - sBrandURLSuffix.getLength(); + // skip brand-specific icon themes; they are incomplete and thus not useful for this check + if (nFromIndex < 0 || !aZipURL.match(sBrandURLSuffix, nFromIndex)) { + osl::File aZip(aZipURL); + if (aZip.open(OpenFlag_Read) == ::osl::FileBase::E_None) { + aZip.close(); + exists = true; + } + } + ++i; + } + m_checkStyleCache[style] = exists; + return exists; +} + bool ImplImageTree::loadImage( rtl::OUString const & name, rtl::OUString const & style, BitmapEx & bitmap, bool localized) { setStyle(style); - if (cacheLookup(name, localized, bitmap)) { + if (iconCacheLookup(name, localized, bitmap)) { return true; } if (!bitmap.IsEmpty()) { @@ -164,7 +196,7 @@ bool ImplImageTree::loadImage( rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); } if (found) { - m_cache[name.intern()] = std::make_pair(localized, bitmap); + m_iconCache[name.intern()] = std::make_pair(localized, bitmap); } return found; } @@ -173,7 +205,8 @@ void ImplImageTree::shutDown() { m_style = rtl::OUString(); // for safety; empty m_style means "not initialized" m_zips.clear(); - m_cache.clear(); + m_iconCache.clear(); + m_checkStyleCache.clear(); } void ImplImageTree::setStyle(rtl::OUString const & style) { @@ -181,7 +214,7 @@ void ImplImageTree::setStyle(rtl::OUString const & style) { if (style != m_style) { m_style = style; resetZips(); - m_cache.clear(); + m_iconCache.clear(); } } @@ -241,6 +274,7 @@ void ImplImageTree::resetZips() { u.GetMainURL(INetURLObject::NO_DECODE), css::uno::Reference< css::container::XNameAccess >())); } + if ( m_style.equals(::rtl::OUString::createFromAscii("default")) ) { rtl::OUString url( RTL_CONSTASCII_USTRINGPARAM( @@ -252,11 +286,23 @@ void ImplImageTree::resetZips() { } } -bool ImplImageTree::cacheLookup( +bool ImplImageTree::checkStyleCacheLookup( + rtl::OUString const & style, bool &exists) +{ + CheckStyleCache::iterator i(m_checkStyleCache.find(style)); + if (i != m_checkStyleCache.end()) { + exists = i->second; + return true; + } else { + return false; + } +} + +bool ImplImageTree::iconCacheLookup( rtl::OUString const & name, bool localized, BitmapEx & bitmap) { - Cache::iterator i(m_cache.find(name)); - if (i != m_cache.end() && i->second.first == localized) { + IconCache::iterator i(m_iconCache.find(name)); + if (i != m_iconCache.end() && i->second.first == localized) { bitmap = i->second.second; return true; } else { diff --git a/vcl/source/gdi/implncvt.cxx b/vcl/source/gdi/implncvt.cxx deleted file mode 100644 index e59fde15b5be..000000000000 --- a/vcl/source/gdi/implncvt.cxx +++ /dev/null @@ -1,577 +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: implncvt.cxx,v $ - * $Revision: 1.10.136.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_vcl.hxx" -#include <vcl/salbtype.hxx> -#ifndef _SV_IMPLNCVT_HXX -#include "implncvt.hxx" -#endif - -// ----------- -// - Defines - -// ----------- - -#define CURVE_LEFT 1 -#define CURVE_RIGHT 2 -#define CURVE_STRAIGHTON 3 - -// ----------------- -// - ImplFloatPoint -// ----------------- - -struct ImplFloatPoint -{ - double fX; - double fY; - - inline ImplFloatPoint() {} - inline ImplFloatPoint( const Point& rPoint ) { fX = rPoint.X(); fY = rPoint.Y(); } - inline ImplFloatPoint( double _fX, double _fY ) { fX = _fX; fY = _fY; } - inline ImplFloatPoint( const ImplFloatPoint& rPoint ) { fX = rPoint.fX; fY = rPoint.fY; } - inline ~ImplFloatPoint() {} - - void operator+=( const ImplFloatPoint& rPoint ) { fX += rPoint.fX; fY += rPoint.fY; } - void operator-=( const ImplFloatPoint& rPoint ) { fX -= rPoint.fX; fY -= rPoint.fY; } - void operator*=( const double& rD ) { fX *= rD; fY *= rD; } - BOOL operator==( const ImplFloatPoint& rPoint ) const { return ( ( rPoint.fX == fX ) && ( rPoint.fY == fY ) ); } - void operator=( const Point& rPoint ) { fX = rPoint.X(); fY = rPoint.Y(); } - - ImplFloatPoint GetOVec( const ImplFloatPoint& rPoint ) const; - ImplFloatPoint GetNVec( const ImplFloatPoint& rPoint ) const; -}; - -// ----------------------------------------------------------------------------- - -ImplFloatPoint ImplFloatPoint::GetOVec( const ImplFloatPoint& rPoint ) const -{ - double fxt = rPoint.fX - fX; - double fyt = rPoint.fY - fY; - double fL; - - if( fyt != 0.0 ) - { - fyt = -fxt / fyt; - fL = sqrt( 1 + fyt * fyt ); - - return ImplFloatPoint( 1.0 / fL, fyt / fL ); - } - else - return ImplFloatPoint( fyt, ( fxt > 0.0 ) ? 1.0 : -1.0 ); -}; - -// ----------------------------------------------------------------------------- - -ImplFloatPoint ImplFloatPoint::GetNVec( const ImplFloatPoint& rPoint ) const -{ - const double fxt = rPoint.fX - fX; - const double fyt = rPoint.fY - fY; - const double fL = hypot( fxt, fyt ); - - return ImplFloatPoint( fxt / fL, fyt / fL ); -}; - -// -------------------- -// - ImplLineConverter -// -------------------- - -ImplLineConverter::ImplLineConverter( const Polygon& rPolygon, const LineInfo& rLineInfo, const Point* pRefPoint ) : - mbRefPoint ( FALSE ), - mfWidthHalf ( rLineInfo.GetWidth() >> 1 ), - maLineInfo ( rLineInfo ), - mpFloat0 ( new ImplFloatPoint[ 6 ] ), - mpFloat1 ( new ImplFloatPoint[ 6 ] ), - mnLines ( 0 ), - mpFloatPoint ( NULL ) -{ - UINT16 nIndex, nPolySize = rPolygon.GetSize(); - if ( nPolySize ) - { - if( rPolygon.GetFlags( 0 ) == POLY_NORMAL ) - { - mpFloatPoint = new ImplFloatPoint[ nPolySize ]; - mpFloatPoint[ 0 ] = rPolygon[ 0 ]; - - nIndex = 0; - - while( ++nIndex < nPolySize ) // doppelte Punkte eliminieren und ein FloatPointArray anlegen - { - if( rPolygon.GetFlags( nIndex ) == POLY_NORMAL ) - { - double nxt = mpFloatPoint[ mnLines ].fX; - double nyt = mpFloatPoint[ mnLines ].fY; - - if ( ( nxt == rPolygon[ nIndex ].X() ) && ( nyt == rPolygon[ nIndex ].Y() ) ) - continue; - - mpFloatPoint[ ++mnLines ] = rPolygon[ nIndex ]; - } - else - { - DBG_ERROR( "Bezier points not supported!" ); - } - } - mbClosed = ( mpFloatPoint[ 0 ] == mpFloatPoint[ mnLines ] ) ; - - if ( ( mnLines == 1 ) && ( maLineInfo.GetStyle() == LINE_DASH ) ) - { - BOOL bX = mpFloatPoint[ 0 ].fY == mpFloatPoint[ 1 ].fY; - BOOL bY = mpFloatPoint[ 0 ].fX == mpFloatPoint[ 1 ].fX; - mbRefPoint = pRefPoint && ( bX || bY ); - if ( mbRefPoint ) - { - if ( !maLineInfo.GetDashCount() ) - { - maLineInfo.SetDashCount( maLineInfo.GetDotCount() ); - maLineInfo.SetDashLen( maLineInfo.GetDotLen() ); - maLineInfo.SetDotCount( 0 ); - } - INT32 nDistance = maLineInfo.GetDistance(); - INT32 nDashLen = maLineInfo.GetDashCount() * ( maLineInfo.GetDashLen() + nDistance ); - INT32 nDotLen = maLineInfo.GetDotCount() * ( maLineInfo.GetDotLen() + nDistance ); - if ( bX ) - { - if ( mpFloatPoint[ 1 ].fX > mpFloatPoint[ 0 ].fX ) - { - ImplFloatPoint aFloat = mpFloatPoint[ 0 ]; - mpFloatPoint[ 0 ] = mpFloatPoint[ 1 ]; - mpFloatPoint[ 1 ] = aFloat; - } - mnRefDistance = (INT32)mpFloatPoint[ mnLines ].fX - pRefPoint->X(); - } - else - { - if ( mpFloatPoint[ 1 ].fY > mpFloatPoint[ 0 ].fY ) - { - ImplFloatPoint aFloat = mpFloatPoint[ 0 ]; - mpFloatPoint[ 0 ] = mpFloatPoint[ 1 ]; - mpFloatPoint[ 1 ] = aFloat; - } - mnRefDistance = (INT32)mpFloatPoint[ mnLines ].fY - pRefPoint->Y(); - } - -// mnRefDistance = ( (INT32)mpFloatPoint[ mnLines ].fX - pRefPoint->X() ) + -// ( (INT32)mpFloatPoint[ mnLines ].fY - pRefPoint->Y() ); - - mnRefDistance = mnRefDistance % ( nDashLen + nDotLen ); - if ( mnRefDistance < 0 ) - mnRefDistance = ( nDashLen + nDotLen ) + mnRefDistance; - } - } - } - } -}; - -//------------------------------------------------------------------------ - -ImplLineConverter::~ImplLineConverter() -{ - delete[] mpFloat0; - delete[] mpFloat1; - delete[] mpFloatPoint; -}; - -//------------------------------------------------------------------------ - -const Polygon* ImplLineConverter::ImplGetFirst() -{ - mnFloat1Points = 0; - mnLinesAvailable = mnLines; - - if ( mnLines ) - { - if ( maLineInfo.GetStyle() == LINE_DASH ) - { - mnDashCount = maLineInfo.GetDashCount(); - mnDotCount = maLineInfo.GetDotCount(); - mfDashDotLenght = mnDashCount ? maLineInfo.GetDashLen() : maLineInfo.GetDotLen(); - - if ( mbRefPoint ) - { - INT32 nDistance = maLineInfo.GetDistance(); - INT32 nDashLen = maLineInfo.GetDashLen() + nDistance; - INT32 nDashesLen = maLineInfo.GetDashCount() * nDashLen; - INT32 nDotLen = maLineInfo.GetDotLen() + nDistance; - - if ( mnRefDistance >= nDashesLen ) - { - // get dotcount - if ( nDotLen ) - { - INT32 nLen = ( mnRefDistance - nDashesLen ) % nDotLen; - if ( nLen >= maLineInfo.GetDotLen() ) - { - mnDotCount -= 1 + ( mnRefDistance - nDashesLen ) / nDotLen; - if ( mnDotCount ) - mnDashCount = 0; - else - mnDotCount = maLineInfo.GetDotCount(); - mfDashDotLenght = 0.0; - mfDistanceLenght = ( maLineInfo.GetDotLen() + nDistance ) - nLen; - } - else - { - mnDashCount = 0; - mfDashDotLenght = maLineInfo.GetDotLen() - nLen; - mnDotCount -= ( mnRefDistance - nDashesLen ) / nDotLen; - } - } - } - else - { - if ( nDashLen ) - { - // get dashcount - INT32 nLen = mnRefDistance % nDashLen; - if ( nLen >= maLineInfo.GetDashLen() ) - { - mfDashDotLenght = 0.0; - mfDistanceLenght = ( maLineInfo.GetDashLen() + nDistance ) - nLen; - mnDashCount -= 1 + ( mnRefDistance / nDashLen ); - } - else - { - mfDashDotLenght = maLineInfo.GetDashLen() - nLen; - mnDashCount -= ( mnRefDistance / nDashLen ); - } - } - } - if ( ! ( mnDashCount | mnDotCount ) ) - { - mnDashCount = maLineInfo.GetDashCount(); - mnDotCount = maLineInfo.GetDotCount(); - } - if ( ( mfDashDotLenght == 0.0 ) && ( mfDistanceLenght == 0.0 ) ) - mfDistanceLenght = maLineInfo.GetDistance(); - } - } - } - return ImplGetNext(); -}; - -//------------------------------------------------------------------------ - -const Polygon* ImplLineConverter::ImplGetNext() -{ - while( mnFloat1Points || mnLinesAvailable ) - { - if ( maLineInfo.GetWidth() > 1 ) - { - if ( !mnFloat1Points ) - { - ImplFloatPoint aPointA( mpFloatPoint[ mnLinesAvailable-- ] ); - ImplFloatPoint aPointB( mpFloatPoint[ mnLinesAvailable ] ); - ImplFloatPoint aOVecAB( aPointA.GetOVec( aPointB ) ); - ImplFloatPoint aN1Vec( aPointA.GetNVec( aPointB ) ); - aN1Vec *= mfWidthHalf; - - if ( !mbClosed && ( ( mnLinesAvailable + 1 ) == mnLines ) ) - aPointA -= aN1Vec; - - aOVecAB *= mfWidthHalf; - mpFloat0[ 0 ] = aPointA; - mpFloat0[ 0 ] -= aOVecAB; - mpFloat0[ 3 ] = aPointA; - mpFloat0[ 3 ] += aOVecAB; - mpFloat0[ 1 ] = aPointB; - mpFloat0[ 1 ] -= aOVecAB; - mpFloat0[ 2 ] = aPointB; - mpFloat0[ 2 ] += aOVecAB; - - double f1D = ( aN1Vec.fX == 0 ) ? 1 : ( aN1Vec.fY / aN1Vec.fX ); - double f2D = -f1D; - - mnFloat0Points = 4; - - int nDirection; - - BOOL bContinues = ( mnLinesAvailable || mbClosed ); - if ( bContinues ) - { - ImplFloatPoint aPointC; - - if ( mnLinesAvailable ) - aPointC = mpFloatPoint[ mnLinesAvailable - 1 ]; - else - aPointC = mpFloatPoint[ mnLines - 1 ]; - - ImplFloatPoint aOVecBC( aPointB.GetOVec( aPointC ) ); - aOVecBC *= mfWidthHalf; - ImplFloatPoint aPointR0( aPointB ); - aPointR0 -= aOVecBC; - ImplFloatPoint aPointR1( aPointB ); - aPointR1 += aOVecBC; - ImplFloatPoint aN2Vec( aPointB.GetNVec( aPointC ) ); - aN2Vec *= mfWidthHalf; - - f2D = ( fabs( aN2Vec.fX ) < 0.00000001 ) ? 1 : ( aN2Vec.fY / aN2Vec.fX ); - if ( fabs( f1D - f2D ) < 0.00000001 ) - nDirection = CURVE_STRAIGHTON; - else - { - if ( ( aN1Vec.fX * aN2Vec.fY - aN1Vec.fY * aN2Vec.fX ) > 0 ) - nDirection = CURVE_LEFT; - else - nDirection = CURVE_RIGHT; - } - if ( nDirection != CURVE_STRAIGHTON ) - { - double fWidth; - ImplFloatPoint aDestPoint; - if ( hypot( aPointR0.fX - aPointA.fX, aPointR0.fY - aPointA.fY ) > hypot( aPointR1.fX - aPointA.fX, aPointR1.fY - aPointA.fY ) ) - aDestPoint = aPointR0; - else - aDestPoint = aPointR1; - - UINT16 nFirst = 0; - if ( aN1Vec.fY > 0 ) - { - if ( nDirection != CURVE_RIGHT ) - nFirst++; - } - else - { - if ( nDirection == CURVE_RIGHT ) - nFirst++; - } - fWidth = hypot( mpFloat0[ 1 + nFirst ].fX - aDestPoint.fX, mpFloat0[ 1 + nFirst ].fY - aDestPoint.fY ); - fWidth = sqrt( fWidth * fWidth / 2 ); - if ( fWidth > mfWidthHalf ) - { - // Spitzer Winkel : - mnFloat0Points = 6; - mpFloat0[ (4 + nFirst) ^ 1 ] = aDestPoint; - aDestPoint -= aN2Vec; - mpFloat0[ 4 + nFirst ] = aDestPoint; - mpFloat0[ 1 + nFirst ] += aN1Vec; - } - else - { - // Stumpferwinkel : Schnittpunkt wird berechnet - mnFloat0Points = 5; - ImplFloatPoint aSourcePoint; - double fX = 0; - double fY; - double fBDest = 0; - double fBSource = 0; - aSourcePoint = mpFloat0[ 1 + nFirst ]; - - int nValid = 0; - - if ( fabs( aN2Vec.fX ) < 0.00000001 ) - { - fX = aDestPoint.fX; - nValid = 1; - } - else - fBDest = aDestPoint.fY - ( aN2Vec.fY / aN2Vec.fX * aDestPoint.fX ); - - if ( fabs( aN1Vec.fX ) < 0.000000001 ) - { - fX = aSourcePoint.fX; - nValid = 2; - } - else - fBSource = aSourcePoint.fY - ( aN1Vec.fY / aN1Vec.fX * aSourcePoint.fX ); - - if ( !nValid ) - fX = ( fBSource - fBDest ) / ( aN2Vec.fY / aN2Vec.fX - aN1Vec.fY / aN1Vec.fX ); - if ( nValid < 2 ) - fY = aN1Vec.fY / aN1Vec.fX * fX + fBSource; - else - fY = aN2Vec.fY / aN2Vec.fX * fX + fBDest; - - mpFloat0[ 1 + nFirst ].fX = fX; - mpFloat0[ 1 + nFirst ].fY = fY; - mpFloat0[ 4 ] = aDestPoint; - } - } - else if ( ( aN1Vec.fX - aN2Vec.fX + aN1Vec.fY - aN2Vec.fY ) != 0 ) // besitzt zweiter Richtungsvektor die gleiche Steigung aber andere - bContinues = FALSE; // Richtung, dann wird hinten noch eine halbe Linienbreite angehaengt - } - if ( !bContinues ) - { - mpFloat0[ 1 ] += aN1Vec; - mpFloat0[ 2 ] += aN1Vec; - } - } - else - { - mnFloat0Points = mnFloat1Points; - ImplFloatPoint* pTemp = mpFloat1; - mpFloat1 = mpFloat0; - mpFloat0 = pTemp; - } - if ( maLineInfo.GetStyle() == LINE_DASH ) - { - double fLenghtDone = 0; - double fLenght = ( mfDashDotLenght > 0.0 ) ? mfDashDotLenght : mfDistanceLenght; - - double fDistance; - - fDistance = hypot( mpFloat0[ 0 ].fX - mpFloat0[ 1 ].fX, mpFloat0[ 0 ].fY - mpFloat0[ 1 ].fY ); - if ( mnFloat0Points == 5 ) - { - double fDist = hypot( mpFloat0[ 2 ].fX - mpFloat0[ 3 ].fX, mpFloat0[ 2 ].fY - mpFloat0[ 3 ].fY ); - if ( fDist < fDistance ) - fDistance = fDist; - } - - if ( fDistance > fLenght ) - { - fLenghtDone = fLenght; - - ImplFloatPoint aNVec( mpFloat0[ 0 ].GetNVec( mpFloat0[ 1 ] ) ); - aNVec *= fLenght; - mnFloat1Points = mnFloat0Points; - ImplFloatPoint* pTemp = mpFloat1; - mpFloat1 = mpFloat0; - mpFloat0 = pTemp; - mnFloat0Points = 4; - mpFloat0[ 0 ] = mpFloat0[ 1 ] = mpFloat1[ 0 ]; - mpFloat0[ 1 ] += aNVec; - mpFloat0[ 2 ] = mpFloat0[ 3 ] = mpFloat1[ 3 ]; - mpFloat0[ 2 ] += aNVec; - - mpFloat1[ 0 ] = mpFloat0[ 1 ]; - mpFloat1[ 3 ] = mpFloat0[ 2 ]; - } - else - { - mnFloat1Points = 0; - fLenghtDone = fDistance; - } - - if ( mfDashDotLenght > 0.0 ) - { // Ein Dash oder Dot wurde erzeugt - mfDashDotLenght -= fLenghtDone; - if ( mfDashDotLenght == 0.0 ) - { // Komplett erzeugt - if ( mnDashCount ) - mnDashCount--; - else - mnDotCount--; - - if ( ! ( mnDashCount | mnDotCount ) ) - { - mnDashCount = maLineInfo.GetDashCount(); - mnDotCount = maLineInfo.GetDotCount(); - } - mfDistanceLenght = maLineInfo.GetDistance(); - } - } - else - { // Das erzeugte Polygon muessen wir ignorieren - mfDistanceLenght -= fLenghtDone; - if ( mfDistanceLenght == 0.0 ) - mfDashDotLenght = ( mnDashCount ) ? maLineInfo.GetDashLen() : maLineInfo.GetDotLen(); - continue; - } - } - maPolygon.SetSize( (UINT16)mnFloat0Points ); - UINT16 i = 0; - maPolygon[ i++ ] = Point( FRound( mpFloat0[ 0 ].fX ), FRound( mpFloat0[ 0 ].fY ) ); - maPolygon[ i++ ] = Point( FRound( mpFloat0[ 1 ].fX ), FRound( mpFloat0[ 1 ].fY ) ); - if ( mnFloat0Points > 4 ) - maPolygon[ i++ ] = Point( FRound( mpFloat0[ 4 ].fX ), FRound( mpFloat0[ 4 ].fY ) ); - if ( mnFloat0Points > 5 ) - maPolygon[ i++ ] = Point( FRound( mpFloat0[ 5 ].fX ), FRound( mpFloat0[ 5 ].fY ) ); - maPolygon[ i++ ] = Point( FRound( mpFloat0[ 2 ].fX ), FRound( mpFloat0[ 2 ].fY ) ); - maPolygon[ i ] = Point( FRound( mpFloat0[ 3 ].fX ), FRound( mpFloat0[ 3 ].fY ) ); - - } - else - { - if ( !mnFloat1Points ) - { - mpFloat0[ 0 ] = mpFloatPoint[ mnLinesAvailable-- ]; - mpFloat0[ 1 ] = mpFloatPoint[ mnLinesAvailable ]; - } - else - { - mpFloat0[ 0 ] = mpFloat1[ 0 ]; - mpFloat0[ 1 ] = mpFloat1[ 1 ]; - } - if ( maLineInfo.GetStyle() == LINE_DASH ) - { - double fLenghtDone = 0; - double fLenght = ( mfDashDotLenght > 0.0 ) ? mfDashDotLenght : mfDistanceLenght; - double fDistance; - fDistance = hypot( mpFloat0[ 0 ].fX - mpFloat0[ 1 ].fX, mpFloat0[ 0 ].fY - mpFloat0[ 1 ].fY ); - if ( fDistance > fLenght ) - { - fLenghtDone = fLenght; - ImplFloatPoint aNVec( mpFloat0[ 0 ].GetNVec( mpFloat0[ 1 ] ) ); - aNVec *= fLenght; - mpFloat1[ 1 ] = mpFloat0[ 1 ]; - mpFloat0[ 1 ] = mpFloat0[ 0 ]; - mpFloat0[ 1 ] += aNVec; - mpFloat1[ 0 ] = mpFloat0[ 1 ]; - mnFloat1Points = 2; - } - else - { - mnFloat1Points = 0; - fLenghtDone = fDistance; - } - if ( mfDashDotLenght > 0.0 ) - { // Ein Dash oder Dot wurde erzeugt - mfDashDotLenght -= fLenghtDone; - if ( mfDashDotLenght == 0.0 ) - { // Komplett erzeugt - if ( mnDashCount ) - mnDashCount--; - else - mnDotCount--; - - if ( ! ( mnDashCount | mnDotCount ) ) - { - mnDashCount = maLineInfo.GetDashCount(); - mnDotCount = maLineInfo.GetDotCount(); - } - mfDistanceLenght = maLineInfo.GetDistance(); - } - } - else - { // Das erzeugte Polygon muessen wir ignorieren - mfDistanceLenght -= fLenghtDone; - if ( mfDistanceLenght == 0.0 ) - mfDashDotLenght = ( mnDashCount ) ? maLineInfo.GetDashLen() : maLineInfo.GetDotLen(); - continue; - } - } - maPolygon.SetSize( 2 ); - maPolygon[ 0 ] = Point( (long)mpFloat0[ 0 ].fX, (long)mpFloat0[ 0 ].fY ); - maPolygon[ 1 ] = Point( (long)mpFloat0[ 1 ].fX, (long)mpFloat0[ 1 ].fY ); - } - return &maPolygon; - } - return NULL; -}; diff --git a/vcl/source/gdi/implncvt.hxx b/vcl/source/gdi/implncvt.hxx deleted file mode 100644 index 2d369d12f253..000000000000 --- a/vcl/source/gdi/implncvt.hxx +++ /dev/null @@ -1,78 +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: implncvt.hxx,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. - * - ************************************************************************/ - -#ifndef _SV_LINECONV_HXX -#define _SV_LINECONV_HXX - -#include <tools/poly.hxx> -#include <vcl/lineinfo.hxx> - -// -------------------- -// - ImplLineConverter -// -------------------- - -struct ImplFloatPoint; - -class ImplLineConverter -{ - BOOL mbClosed; - BOOL mbRefPoint; - INT32 mnRefDistance; - - double mfWidthHalf; - LineInfo maLineInfo; - - double mfDashDotLenght; - double mfDistanceLenght; - - UINT32 mnDashCount; - UINT32 mnDotCount; - - Polygon maPolygon; - UINT32 mnFloat0Points; - ImplFloatPoint* mpFloat0; - UINT32 mnFloat1Points; - ImplFloatPoint* mpFloat1; - - UINT32 mnLinesAvailable; - UINT32 mnLines; - - ImplFloatPoint* mpFloatPoint; - - public: - - ImplLineConverter( const Polygon& rPoly, const LineInfo& rLineInfo, const Point* pRefPoint ); - ~ImplLineConverter(); - - const Polygon* ImplGetFirst(); - const Polygon* ImplGetNext(); -}; - -#endif diff --git a/vcl/source/gdi/impprn.cxx b/vcl/source/gdi/impprn.cxx index 539c879c89ea..28d92a0b3832 100644 --- a/vcl/source/gdi/impprn.cxx +++ b/vcl/source/gdi/impprn.cxx @@ -478,10 +478,12 @@ void ImplQPrinter::EndQueuePrint() DBG_ASSERT( mpPrinter, "no SalPrinter in ImplQPrinter" ); if( mpPrinter ) { + #if 0 mpPrinter->StartJob( mbPrintFile ? &maPrintFile : NULL, Application::GetDisplayName(), maJobSetup.ImplGetConstData(), this ); + #endif EndJob(); mpParent->ImplEndPrint(); } diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx index 686d33593466..4823a5492ded 100644 --- a/vcl/source/gdi/jobset.cxx +++ b/vcl/source/gdi/jobset.cxx @@ -73,6 +73,7 @@ ImplJobSetup::ImplJobSetup() mnRefCount = 1; mnSystem = 0; meOrientation = ORIENTATION_PORTRAIT; + meDuplexMode = DUPLEX_UNKNOWN; mnPaperBin = 0; mePaperFormat = PAPER_USER; mnPaperWidth = 0; @@ -90,6 +91,7 @@ ImplJobSetup::ImplJobSetup( const ImplJobSetup& rJobSetup ) : mnRefCount = 1; mnSystem = rJobSetup.mnSystem; meOrientation = rJobSetup.meOrientation; + meDuplexMode = rJobSetup.meDuplexMode; mnPaperBin = rJobSetup.mnPaperBin; mePaperFormat = rJobSetup.mePaperFormat; mnPaperWidth = rJobSetup.mnPaperWidth; @@ -277,6 +279,7 @@ BOOL JobSetup::operator==( const JobSetup& rJobSetup ) const (pData1->maPrinterName == pData2->maPrinterName) && (pData1->maDriver == pData2->maDriver) && (pData1->meOrientation == pData2->meOrientation) && + (pData1->meDuplexMode == pData2->meDuplexMode) && (pData1->mnPaperBin == pData2->mnPaperBin) && (pData1->mePaperFormat == pData2->mePaperFormat) && (pData1->mnPaperWidth == pData2->mnPaperWidth) && @@ -337,6 +340,7 @@ SvStream& operator>>( SvStream& rIStream, JobSetup& rJobSetup ) pJobData->mnSystem = SVBT16ToShort( pOldJobData->nSystem ); pJobData->mnDriverDataLen = SVBT32ToUInt32( pOldJobData->nDriverDataLen ); pJobData->meOrientation = (Orientation)SVBT16ToShort( pOldJobData->nOrientation ); + pJobData->meDuplexMode = DUPLEX_UNKNOWN; pJobData->mnPaperBin = SVBT16ToShort( pOldJobData->nPaperBin ); pJobData->mePaperFormat = (Paper)SVBT16ToShort( pOldJobData->nPaperFormat ); pJobData->mnPaperWidth = (long)SVBT32ToUInt32( pOldJobData->nPaperWidth ); @@ -355,7 +359,19 @@ SvStream& operator>>( SvStream& rIStream, JobSetup& rJobSetup ) String aKey, aValue; rIStream.ReadByteString( aKey, RTL_TEXTENCODING_UTF8 ); rIStream.ReadByteString( aValue, RTL_TEXTENCODING_UTF8 ); - pJobData->maValueMap[ aKey ] = aValue; + if( aKey.EqualsAscii( "COMPAT_DUPLEX_MODE" ) ) + { + if( aValue.EqualsAscii( "DUPLEX_UNKNOWN" ) ) + pJobData->meDuplexMode = DUPLEX_UNKNOWN; + else if( aValue.EqualsAscii( "DUPLEX_OFF" ) ) + pJobData->meDuplexMode = DUPLEX_OFF; + else if( aValue.EqualsAscii( "DUPLEX_SHORTEDGE" ) ) + pJobData->meDuplexMode = DUPLEX_SHORTEDGE; + else if( aValue.EqualsAscii( "DUPLEX_LONGEDGE" ) ) + pJobData->meDuplexMode = DUPLEX_LONGEDGE; + } + else + pJobData->maValueMap[ aKey ] = aValue; } DBG_ASSERT( rIStream.Tell() == nFirstPos+nLen, "corrupted job setup" ); // ensure correct stream position @@ -421,6 +437,14 @@ SvStream& operator<<( SvStream& rOStream, const JobSetup& rJobSetup ) rOStream.WriteByteString( it->first, RTL_TEXTENCODING_UTF8 ); rOStream.WriteByteString( it->second, RTL_TEXTENCODING_UTF8 ); } + rOStream.WriteByteString( "COMPAT_DUPLEX_MODE" ) ; + switch( pJobData->meDuplexMode ) + { + case DUPLEX_UNKNOWN: rOStream.WriteByteString( "DUPLEX_UNKNOWN" );break; + case DUPLEX_OFF: rOStream.WriteByteString( "DUPLEX_OFF" );break; + case DUPLEX_SHORTEDGE: rOStream.WriteByteString( "DUPLEX_SHORTEDGE" );break; + case DUPLEX_LONGEDGE: rOStream.WriteByteString( "DUPLEX_LONGEDGE" );break; + } nLen = sal::static_int_cast<USHORT>(rOStream.Tell() - nPos); rOStream.Seek( nPos ); rOStream << nLen; diff --git a/vcl/source/gdi/lineinfo.cxx b/vcl/source/gdi/lineinfo.cxx index 98f16713a145..7aa50811106b 100644 --- a/vcl/source/gdi/lineinfo.cxx +++ b/vcl/source/gdi/lineinfo.cxx @@ -34,6 +34,10 @@ #include <tools/vcompat.hxx> #include <tools/debug.hxx> #include <vcl/lineinfo.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/polygon/b2dlinegeometry.hxx> +#include <numeric> DBG_NAME( LineInfo ) @@ -49,7 +53,8 @@ ImplLineInfo::ImplLineInfo() : mnDashLen ( 0 ), mnDotCount ( 0 ), mnDotLen ( 0 ), - mnDistance ( 0 ) + mnDistance ( 0 ), + meLineJoin ( basegfx::B2DLINEJOIN_ROUND ) { } @@ -63,7 +68,8 @@ ImplLineInfo::ImplLineInfo( const ImplLineInfo& rImplLineInfo ) : mnDashLen ( rImplLineInfo.mnDashLen ), mnDotCount ( rImplLineInfo.mnDotCount ), mnDotLen ( rImplLineInfo.mnDotLen ), - mnDistance ( rImplLineInfo.mnDistance ) + mnDistance ( rImplLineInfo.mnDistance ), + meLineJoin ( rImplLineInfo.meLineJoin ) { } @@ -209,6 +215,19 @@ void LineInfo::SetDistance( long nDistance ) // ----------------------------------------------------------------------- +void LineInfo::SetLineJoin(basegfx::B2DLineJoin eLineJoin) +{ + DBG_CHKTHIS( LineInfo, NULL ); + + if(eLineJoin != mpImplLineInfo->meLineJoin) + { + ImplMakeUnique(); + mpImplLineInfo->meLineJoin = eLineJoin; + } +} + +// ----------------------------------------------------------------------- + SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo ) { VersionCompat aCompat( rIStm, STREAM_READ ); @@ -225,6 +244,12 @@ SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo ) rIStm >> rImplLineInfo.mnDistance; } + if( aCompat.GetVersion() >= 3 ) + { + // version 3 + rIStm >> nTmp16; rImplLineInfo.meLineJoin = (basegfx::B2DLineJoin) nTmp16; + } + return rIStm; } @@ -232,7 +257,7 @@ SvStream& operator>>( SvStream& rIStm, ImplLineInfo& rImplLineInfo ) SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo ) { - VersionCompat aCompat( rOStm, STREAM_WRITE, 2 ); + VersionCompat aCompat( rOStm, STREAM_WRITE, 3 ); // version 1 rOStm << (UINT16) rImplLineInfo.meStyle << rImplLineInfo.mnWidth; @@ -242,6 +267,9 @@ SvStream& operator<<( SvStream& rOStm, const ImplLineInfo& rImplLineInfo ) rOStm << rImplLineInfo.mnDotCount << rImplLineInfo.mnDotLen; rOStm << rImplLineInfo.mnDistance; + // since version3 + rOStm << (UINT16) rImplLineInfo.meLineJoin; + return rOStm; } @@ -259,3 +287,78 @@ SvStream& operator<<( SvStream& rOStm, const LineInfo& rLineInfo ) { return( rOStm << *rLineInfo.mpImplLineInfo ); } + +// ----------------------------------------------------------------------- + +bool LineInfo::isDashDotOrFatLineUsed() const +{ + return (LINE_DASH == GetStyle() || GetWidth() > 1); +} + +// ----------------------------------------------------------------------- + +void LineInfo::applyToB2DPolyPolygon( + basegfx::B2DPolyPolygon& io_rLinePolyPolygon, + basegfx::B2DPolyPolygon& o_rFillPolyPolygon) const +{ + o_rFillPolyPolygon.clear(); + + if(io_rLinePolyPolygon.count()) + { + if(LINE_DASH == GetStyle()) + { + ::std::vector< double > fDotDashArray; + const double fDashLen(GetDashLen()); + const double fDotLen(GetDotLen()); + const double fDistance(GetDistance()); + + for(sal_uInt16 a(0); a < GetDashCount(); a++) + { + fDotDashArray.push_back(fDashLen); + fDotDashArray.push_back(fDistance); + } + + for(sal_uInt16 b(0); b < GetDotCount(); b++) + { + fDotDashArray.push_back(fDotLen); + fDotDashArray.push_back(fDistance); + } + + const double fAccumulated(::std::accumulate(fDotDashArray.begin(), fDotDashArray.end(), 0.0)); + + if(fAccumulated > 0.0) + { + basegfx::B2DPolyPolygon aResult; + + for(sal_uInt32 c(0); c < io_rLinePolyPolygon.count(); c++) + { + basegfx::B2DPolyPolygon aLineTraget; + basegfx::tools::applyLineDashing( + io_rLinePolyPolygon.getB2DPolygon(c), + fDotDashArray, + &aLineTraget); + aResult.append(aLineTraget); + } + + io_rLinePolyPolygon = aResult; + } + } + + if(GetWidth() > 1 && io_rLinePolyPolygon.count()) + { + const double fHalfLineWidth((GetWidth() * 0.5) + 0.5); + + for(sal_uInt32 a(0); a < io_rLinePolyPolygon.count(); a++) + { + o_rFillPolyPolygon.append(basegfx::tools::createAreaGeometry( + io_rLinePolyPolygon.getB2DPolygon(a), + fHalfLineWidth, + GetLineJoin())); + } + + io_rLinePolyPolygon.clear(); + } + } +} + +// ----------------------------------------------------------------------- diff --git a/vcl/source/gdi/makefile.mk b/vcl/source/gdi/makefile.mk index a09ae92dcb5e..ed2a9b2ba1e1 100644 --- a/vcl/source/gdi/makefile.mk +++ b/vcl/source/gdi/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # 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 @@ -51,7 +51,35 @@ CDEFS+=-DENABLE_GRAPHITE # --- Files -------------------------------------------------------- -SLOFILES= $(SLO)$/salmisc.obj \ +EXCEPTIONSFILES= $(SLO)$/salmisc.obj \ + $(SLO)$/outdev.obj \ + $(SLO)$/outdev3.obj \ + $(SLO)$/gfxlink.obj \ + $(SLO)$/print.obj \ + $(SLO)$/print2.obj \ + $(SLO)$/print3.obj \ + $(SLO)$/oldprintadaptor.obj \ + $(SLO)$/configsettings.obj \ + $(SLO)$/sallayout.obj \ + $(SLO)$/image.obj \ + $(SLO)$/impimage.obj \ + $(SLO)$/impgraph.obj \ + $(SLO)$/metric.obj \ + $(SLO)$/pdfwriter_impl.obj \ + $(SLO)$/pdffontcache.obj\ + $(SLO)$/bmpconv.obj \ + $(SLO)$/pdfextoutdevdata.obj \ + $(SLO)$/jobset.obj \ + $(SLO)$/impimagetree.obj \ + $(SLO)$/pngread.obj \ + $(SLO)$/pngwrite.obj \ + $(SLO)$/virdev.obj \ + $(SLO)$/gdimtf.obj \ + $(SLO)$/graphictools.obj \ + $(SLO)$/textlayout.obj \ + $(SLO)$/lineinfo.obj + +SLOFILES= $(EXCEPTIONSFILES) \ $(SLO)$/animate.obj \ $(SLO)$/impanmvw.obj \ $(SLO)$/bitmap.obj \ @@ -68,80 +96,28 @@ SLOFILES= $(SLO)$/salmisc.obj \ $(SLO)$/cvtsvm.obj \ $(SLO)$/cvtgrf.obj \ $(SLO)$/font.obj \ - $(SLO)$/gdimtf.obj \ - $(SLO)$/gfxlink.obj \ $(SLO)$/gradient.obj \ $(SLO)$/hatch.obj \ $(SLO)$/graph.obj \ - $(SLO)$/image.obj \ - $(SLO)$/impimage.obj \ $(SLO)$/impbmp.obj \ - $(SLO)$/impgraph.obj \ - $(SLO)$/impimagetree.obj \ $(SLO)$/imagerepository.obj \ - $(SLO)$/impprn.obj \ $(SLO)$/impvect.obj \ - $(SLO)$/implncvt.obj \ - $(SLO)$/jobset.obj \ - $(SLO)$/lineinfo.obj \ $(SLO)$/mapmod.obj \ $(SLO)$/metaact.obj \ - $(SLO)$/metric.obj \ $(SLO)$/octree.obj \ $(SLO)$/outmap.obj \ - $(SLO)$/outdev.obj \ $(SLO)$/outdev2.obj \ - $(SLO)$/outdev3.obj \ $(SLO)$/outdev4.obj \ $(SLO)$/outdev5.obj \ $(SLO)$/outdev6.obj \ - $(SLO)$/virdev.obj \ - $(SLO)$/fontcvt.obj \ - $(SLO)$/print.obj \ - $(SLO)$/print2.obj \ $(SLO)$/regband.obj \ $(SLO)$/region.obj \ $(SLO)$/wall.obj \ - $(SLO)$/fontcfg.obj \ $(SLO)$/base14.obj \ $(SLO)$/pdfwriter.obj \ - $(SLO)$/pdfwriter_impl.obj \ - $(SLO)$/pdffontcache.obj\ - $(SLO)$/sallayout.obj \ $(SLO)$/salgdilayout.obj \ $(SLO)$/extoutdevdata.obj \ - $(SLO)$/pdfextoutdevdata.obj \ - $(SLO)$/salnativewidgets-none.obj \ - $(SLO)$/bmpconv.obj \ - $(SLO)$/pngread.obj \ - $(SLO)$/pngwrite.obj \ - $(SLO)$/graphictools.obj - -EXCEPTIONSFILES= $(SLO)$/salmisc.obj \ - $(SLO)$/outdev.obj \ - $(SLO)$/outdev3.obj \ - $(SLO)$/gfxlink.obj \ - $(SLO)$/print.obj \ - $(SLO)$/print2.obj \ - $(SLO)$/sallayout.obj \ - $(SLO)$/image.obj \ - $(SLO)$/impimage.obj \ - $(SLO)$/impgraph.obj \ - $(SLO)$/metric.obj \ - $(SLO)$/pdfwriter_impl.obj \ - $(SLO)$/pdffontcache.obj\ - $(SLO)$/fontcfg.obj \ - $(SLO)$/bmpconv.obj \ - $(SLO)$/pdfextoutdevdata.obj \ - $(SLO)$/fontcvt.obj \ - $(SLO)$/jobset.obj \ - $(SLO)$/impimagetree.obj \ - $(SLO)$/pngread.obj \ - $(SLO)$/pngwrite.obj \ - $(SLO)$/virdev.obj \ - $(SLO)$/impprn.obj \ - $(SLO)$/gdimtf.obj \ - $(SLO)$/graphictools.obj + $(SLO)$/salnativewidgets-none.obj # --- Targets ------------------------------------------------------ diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 4fe9a41be797..1f27ad2afe7d 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -52,14 +52,6 @@ inline void ImplScalePoint( Point& rPt, double fScaleX, double fScaleY ) // ------------------------------------------------------------------------ -inline void ImplScaleSize( Size& rSz, double fScaleX, double fScaleY ) -{ - rSz.Width() = FRound( fScaleX * rSz.Width() ); - rSz.Height() = FRound( fScaleY * rSz.Height() ); -} - -// ------------------------------------------------------------------------ - inline void ImplScaleRect( Rectangle& rRect, double fScaleX, double fScaleY ) { Point aTL( rRect.TopLeft() ); @@ -69,6 +61,7 @@ inline void ImplScaleRect( Rectangle& rRect, double fScaleX, double fScaleY ) ImplScalePoint( aBR, fScaleX, fScaleY ); rRect = Rectangle( aTL, aBR ); + rRect.Justify(); } // ------------------------------------------------------------------------ @@ -85,7 +78,7 @@ inline void ImplScaleLineInfo( LineInfo& rLineInfo, double fScaleX, double fScal { if( !rLineInfo.IsDefault() ) { - const double fScale = ( fScaleX + fScaleY ) * 0.5; + const double fScale = ( fabs(fScaleX) + fabs(fScaleY) ) * 0.5; rLineInfo.SetWidth( FRound( fScale * rLineInfo.GetWidth() ) ); rLineInfo.SetDashLen( FRound( fScale * rLineInfo.GetDashLen() ) ); @@ -598,8 +591,8 @@ void MetaRoundRectAction::Move( long nHorzMove, long nVertMove ) void MetaRoundRectAction::Scale( double fScaleX, double fScaleY ) { ImplScaleRect( maRect, fScaleX, fScaleY ); - mnHorzRound = FRound( mnHorzRound * fScaleX ); - mnVertRound = FRound( mnVertRound * fScaleY ); + mnHorzRound = FRound( mnHorzRound * fabs(fScaleX) ); + mnVertRound = FRound( mnVertRound * fabs(fScaleY) ); } // ------------------------------------------------------------------------ @@ -989,7 +982,7 @@ void MetaPolyLineAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) WRITE_BASE_COMPAT( rOStm, 3, pData ); Polygon aSimplePoly; - maPoly.GetSimple( aSimplePoly ); + maPoly.AdaptiveSubdivide( aSimplePoly ); rOStm << aSimplePoly; // Version 1 rOStm << maLineInfo; // Version 2 @@ -1077,7 +1070,7 @@ void MetaPolygonAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) WRITE_BASE_COMPAT( rOStm, 2, pData ); Polygon aSimplePoly; // Version 1 - maPoly.GetSimple( aSimplePoly ); + maPoly.AdaptiveSubdivide( aSimplePoly ); rOStm << aSimplePoly; sal_uInt8 bHasPolyFlags = maPoly.HasFlags(); // Version 2 @@ -1169,7 +1162,7 @@ void MetaPolyPolygonAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) const Polygon& rPoly = maPolyPoly.GetObject( i ); if ( rPoly.HasFlags() ) nNumberOfComplexPolygons++; - rPoly.GetSimple( aSimplePoly ); + rPoly.AdaptiveSubdivide( aSimplePoly ); rOStm << aSimplePoly; } @@ -1396,7 +1389,7 @@ void MetaTextArrayAction::Scale( double fScaleX, double fScaleY ) if ( mpDXAry && mnLen ) { for ( USHORT i = 0, nCount = mnLen; i < nCount; i++ ) - mpDXAry[ i ] = FRound( mpDXAry[ i ] * fScaleX ); + mpDXAry[ i ] = FRound( mpDXAry[ i ] * fabs(fScaleX) ); } } @@ -1524,7 +1517,7 @@ void MetaStretchTextAction::Move( long nHorzMove, long nVertMove ) void MetaStretchTextAction::Scale( double fScaleX, double fScaleY ) { ImplScalePoint( maPt, fScaleX, fScaleY ); - mnWidth = (ULONG)FRound( mnWidth * fScaleX ); + mnWidth = (ULONG)FRound( mnWidth * fabs(fScaleX) ); } // ------------------------------------------------------------------------ @@ -1717,7 +1710,7 @@ void MetaTextLineAction::Move( long nHorzMove, long nVertMove ) void MetaTextLineAction::Scale( double fScaleX, double fScaleY ) { ImplScalePoint( maPos, fScaleX, fScaleY ); - mnWidth = FRound( mnWidth * fScaleX ); + mnWidth = FRound( mnWidth * fabs(fScaleX) ); } // ------------------------------------------------------------------------ @@ -1876,8 +1869,10 @@ void MetaBmpScaleAction::Move( long nHorzMove, long nVertMove ) void MetaBmpScaleAction::Scale( double fScaleX, double fScaleY ) { - ImplScalePoint( maPt, fScaleX, fScaleY ); - ImplScaleSize( maSz, fScaleX, fScaleY ); + Rectangle aRectangle(maPt, maSz); + ImplScaleRect( aRectangle, fScaleX, fScaleY ); + maPt = aRectangle.TopLeft(); + maSz = aRectangle.GetSize(); } // ------------------------------------------------------------------------ @@ -1953,8 +1948,10 @@ void MetaBmpScalePartAction::Move( long nHorzMove, long nVertMove ) void MetaBmpScalePartAction::Scale( double fScaleX, double fScaleY ) { - ImplScalePoint( maDstPt, fScaleX, fScaleY ); - ImplScaleSize( maDstSz, fScaleX, fScaleY ); + Rectangle aRectangle(maDstPt, maDstSz); + ImplScaleRect( aRectangle, fScaleX, fScaleY ); + maDstPt = aRectangle.TopLeft(); + maDstSz = aRectangle.GetSize(); } // ------------------------------------------------------------------------ @@ -2099,8 +2096,10 @@ void MetaBmpExScaleAction::Move( long nHorzMove, long nVertMove ) void MetaBmpExScaleAction::Scale( double fScaleX, double fScaleY ) { - ImplScalePoint( maPt, fScaleX, fScaleY ); - ImplScaleSize( maSz, fScaleX, fScaleY ); + Rectangle aRectangle(maPt, maSz); + ImplScaleRect( aRectangle, fScaleX, fScaleY ); + maPt = aRectangle.TopLeft(); + maSz = aRectangle.GetSize(); } // ------------------------------------------------------------------------ @@ -2176,8 +2175,10 @@ void MetaBmpExScalePartAction::Move( long nHorzMove, long nVertMove ) void MetaBmpExScalePartAction::Scale( double fScaleX, double fScaleY ) { - ImplScalePoint( maDstPt, fScaleX, fScaleY ); - ImplScaleSize( maDstSz, fScaleX, fScaleY ); + Rectangle aRectangle(maDstPt, maDstSz); + ImplScaleRect( aRectangle, fScaleX, fScaleY ); + maDstPt = aRectangle.TopLeft(); + maDstSz = aRectangle.GetSize(); } // ------------------------------------------------------------------------ @@ -2328,8 +2329,10 @@ void MetaMaskScaleAction::Move( long nHorzMove, long nVertMove ) void MetaMaskScaleAction::Scale( double fScaleX, double fScaleY ) { - ImplScalePoint( maPt, fScaleX, fScaleY ); - ImplScaleSize( maSz, fScaleX, fScaleY ); + Rectangle aRectangle(maPt, maSz); + ImplScaleRect( aRectangle, fScaleX, fScaleY ); + maPt = aRectangle.TopLeft(); + maSz = aRectangle.GetSize(); } // ------------------------------------------------------------------------ @@ -2408,8 +2411,10 @@ void MetaMaskScalePartAction::Move( long nHorzMove, long nVertMove ) void MetaMaskScalePartAction::Scale( double fScaleX, double fScaleY ) { - ImplScalePoint( maDstPt, fScaleX, fScaleY ); - ImplScaleSize( maDstSz, fScaleX, fScaleY ); + Rectangle aRectangle(maDstPt, maDstSz); + ImplScaleRect( aRectangle, fScaleX, fScaleY ); + maDstPt = aRectangle.TopLeft(); + maDstSz = aRectangle.GetSize(); } // ------------------------------------------------------------------------ @@ -2581,7 +2586,13 @@ sal_Bool MetaGradientExAction::Compare( const MetaAction& rMetaAction ) const void MetaGradientExAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - rOStm << maPolyPoly << maGradient; + + // #i105373# see comment at MetaTransparentAction::Write + PolyPolygon aNoCurvePolyPolygon; + maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon); + + rOStm << aNoCurvePolyPolygon; + rOStm << maGradient; } // ------------------------------------------------------------------------ @@ -2649,7 +2660,13 @@ sal_Bool MetaHatchAction::Compare( const MetaAction& rMetaAction ) const void MetaHatchAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - rOStm << maPolyPoly << maHatch; + + // #i105373# see comment at MetaTransparentAction::Write + PolyPolygon aNoCurvePolyPolygon; + maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon); + + rOStm << aNoCurvePolyPolygon; + rOStm << maHatch; } // ------------------------------------------------------------------------ @@ -3486,9 +3503,9 @@ MetaAction* MetaFontAction::Clone() void MetaFontAction::Scale( double fScaleX, double fScaleY ) { - Size aSize( maFont.GetSize() ); - - ImplScaleSize( aSize, fScaleX, fScaleY ); + const Size aSize( + FRound(maFont.GetSize().Width() * fabs(fScaleX)), + FRound(maFont.GetSize().Height() * fabs(fScaleY))); maFont.SetSize( aSize ); } @@ -3716,7 +3733,20 @@ sal_Bool MetaTransparentAction::Compare( const MetaAction& rMetaAction ) const void MetaTransparentAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - rOStm << maPolyPoly; + + // #i105373# The PolyPolygon in this action may be a curve; this + // was ignored until now what is an error. To make older office + // versions work with MetaFiles, i opt for applying AdaptiveSubdivide + // to the PolyPoylgon. + // The alternative would be to really write the curve information + // like in MetaPolyPolygonAction::Write (where someone extended it + // correctly, but not here :-( ). + // The golden solution would be to combine both, but i think it's + // not necessary; a good subdivision will be sufficient. + PolyPolygon aNoCurvePolyPolygon; + maPolyPoly.AdaptiveSubdivide(aNoCurvePolyPolygon); + + rOStm << aNoCurvePolyPolygon; rOStm << mnTransPercent; } @@ -3766,14 +3796,18 @@ MetaAction* MetaFloatTransparentAction::Clone() void MetaFloatTransparentAction::Move( long nHorzMove, long nVertMove ) { maPoint.Move( nHorzMove, nVertMove ); + maMtf.Move(nHorzMove, nVertMove); } // ------------------------------------------------------------------------ void MetaFloatTransparentAction::Scale( double fScaleX, double fScaleY ) { - ImplScalePoint( maPoint, fScaleX, fScaleY ); - ImplScaleSize( maSize, fScaleX, fScaleY ); + Rectangle aRectangle(maPoint, maSize); + ImplScaleRect( aRectangle, fScaleX, fScaleY ); + maPoint = aRectangle.TopLeft(); + maSize = aRectangle.GetSize(); + maMtf.Scale(fScaleX, fScaleY); } // ------------------------------------------------------------------------ @@ -3847,8 +3881,10 @@ void MetaEPSAction::Move( long nHorzMove, long nVertMove ) void MetaEPSAction::Scale( double fScaleX, double fScaleY ) { - ImplScalePoint( maPoint, fScaleX, fScaleY ); - ImplScaleSize( maSize, fScaleX, fScaleY ); + Rectangle aRectangle(maPoint, maSize); + ImplScaleRect( aRectangle, fScaleX, fScaleY ); + maPoint = aRectangle.TopLeft(); + maSize = aRectangle.GetSize(); } // ------------------------------------------------------------------------ diff --git a/vcl/source/gdi/oldprintadaptor.cxx b/vcl/source/gdi/oldprintadaptor.cxx new file mode 100644 index 000000000000..cffd11daaad6 --- /dev/null +++ b/vcl/source/gdi/oldprintadaptor.cxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * 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 + * + * 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 "precompiled_vcl.hxx" + +#include "vcl/oldprintadaptor.hxx" +#include "vcl/gdimtf.hxx" + +#include "com/sun/star/awt/Size.hpp" + +#include <vector> + +namespace vcl +{ + struct AdaptorPage + { + GDIMetaFile maPage; + com::sun::star::awt::Size maPageSize; + }; + + struct ImplOldStyleAdaptorData + { + std::vector< AdaptorPage > maPages; + }; +} + +using namespace vcl; +using namespace cppu; +using namespace com::sun::star; +using namespace com::sun::star::uno; +using namespace com::sun::star::beans; + +OldStylePrintAdaptor::OldStylePrintAdaptor( const boost::shared_ptr< Printer >& i_pPrinter ) + : PrinterController( i_pPrinter ) + , mpData( new ImplOldStyleAdaptorData() ) +{ +} + +OldStylePrintAdaptor::~OldStylePrintAdaptor() +{ +} + +void OldStylePrintAdaptor::StartPage() +{ + Size aPaperSize( getPrinter()->PixelToLogic( getPrinter()->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) ); + mpData->maPages.push_back( AdaptorPage() ); + mpData->maPages.back().maPageSize.Width = aPaperSize.getWidth(); + mpData->maPages.back().maPageSize.Height = aPaperSize.getHeight(); + getPrinter()->SetConnectMetaFile( &mpData->maPages.back().maPage ); + + // copy state into metafile + boost::shared_ptr<Printer> pPrinter( getPrinter() ); + pPrinter->SetMapMode( pPrinter->GetMapMode() ); + pPrinter->SetFont( pPrinter->GetFont() ); + pPrinter->SetDrawMode( pPrinter->GetDrawMode() ); + pPrinter->SetLineColor( pPrinter->GetLineColor() ); + pPrinter->SetFillColor( pPrinter->GetFillColor() ); +} + +void OldStylePrintAdaptor::EndPage() +{ + getPrinter()->SetConnectMetaFile( NULL ); + mpData->maPages.back().maPage.WindStart(); +} + +int OldStylePrintAdaptor::getPageCount() const +{ + return int(mpData->maPages.size()); +} + +Sequence< PropertyValue > OldStylePrintAdaptor::getPageParameters( int i_nPage ) const +{ + Sequence< PropertyValue > aRet( 1 ); + aRet[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageSize") ); + if( i_nPage < int(mpData->maPages.size() ) ) + aRet[0].Value = makeAny( mpData->maPages[i_nPage].maPageSize ); + else + { + awt::Size aEmpty( 0, 0 ); + aRet[0].Value = makeAny( aEmpty ); + } + return aRet; +} + +void OldStylePrintAdaptor::printPage( int i_nPage ) const +{ + if( i_nPage < int(mpData->maPages.size()) ) + { + mpData->maPages[ i_nPage ].maPage.WindStart(); + mpData->maPages[ i_nPage ].maPage.Play( getPrinter().get() ); + } +} + diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index 5b543258cb0b..91ea8419cba9 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -56,7 +56,6 @@ #include <vcl/gdimtf.hxx> #include <vcl/outdata.hxx> #include <vcl/print.hxx> -#include <implncvt.hxx> #include <vcl/outdev.h> #include <vcl/outdev.hxx> #include <vcl/unowrap.hxx> @@ -77,6 +76,8 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <vcl/unohelp.hxx> +#include <numeric> + using namespace ::com::sun::star; DBG_NAME( OutputDevice ) @@ -1128,11 +1129,16 @@ namespace { inline int iround( float x ) { - sal_Int32 a = *reinterpret_cast<const sal_Int32 *>(&x); - sal_Int32 exponent = (127 + 31) - ((a >> 23) & 0xFF); - sal_Int32 r = ((sal_Int32(a) << 8) | (1U << 31)) >> exponent; + union + { + float f; + sal_Int32 i; + }; + f = x; + sal_Int32 exponent = (127 + 31) - ((i >> 23) & 0xFF); + sal_Int32 r = ((sal_Int32(i) << 8) | (1U << 31)) >> exponent; r &= ((exponent - 32) >> 31); - sal_Int32 sign = a >> 31; + sal_Int32 sign = i >> 31; return r = (r ^ sign) - sign; } @@ -2325,6 +2331,130 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt ) // ----------------------------------------------------------------------- +void OutputDevice::impPaintLineGeometryWithEvtlExpand( + const LineInfo& rInfo, + basegfx::B2DPolyPolygon aLinePolyPolygon) +{ + const bool bTryAA((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) + && mpGraphics->supportsOperation(OutDevSupport_B2DDraw) + && ROP_OVERPAINT == GetRasterOp() + && IsLineColor()); + basegfx::B2DPolyPolygon aFillPolyPolygon; + const bool bDashUsed(LINE_DASH == rInfo.GetStyle()); + const bool bLineWidthUsed(rInfo.GetWidth() > 1); + + if(bDashUsed && aLinePolyPolygon.count()) + { + ::std::vector< double > fDotDashArray; + const double fDashLen(rInfo.GetDashLen()); + const double fDotLen(rInfo.GetDotLen()); + const double fDistance(rInfo.GetDistance()); + + for(sal_uInt16 a(0); a < rInfo.GetDashCount(); a++) + { + fDotDashArray.push_back(fDashLen); + fDotDashArray.push_back(fDistance); + } + + for(sal_uInt16 b(0); b < rInfo.GetDotCount(); b++) + { + fDotDashArray.push_back(fDotLen); + fDotDashArray.push_back(fDistance); + } + + const double fAccumulated(::std::accumulate(fDotDashArray.begin(), fDotDashArray.end(), 0.0)); + + if(fAccumulated > 0.0) + { + basegfx::B2DPolyPolygon aResult; + + for(sal_uInt32 c(0); c < aLinePolyPolygon.count(); c++) + { + basegfx::B2DPolyPolygon aLineTraget; + basegfx::tools::applyLineDashing( + aLinePolyPolygon.getB2DPolygon(c), + fDotDashArray, + &aLineTraget); + aResult.append(aLineTraget); + } + + aLinePolyPolygon = aResult; + } + } + + if(bLineWidthUsed && aLinePolyPolygon.count()) + { + const double fHalfLineWidth((rInfo.GetWidth() * 0.5) + 0.5); + + for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++) + { + aFillPolyPolygon.append(basegfx::tools::createAreaGeometry( + aLinePolyPolygon.getB2DPolygon(a), + fHalfLineWidth, + rInfo.GetLineJoin())); + } + + aLinePolyPolygon.clear(); + } + + GDIMetaFile* pOldMetaFile = mpMetaFile; + mpMetaFile = NULL; + + if(aLinePolyPolygon.count()) + { + for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++) + { + const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a)); + bool bDone(false); + + if(bTryAA) + { + bDone = mpGraphics->DrawPolyLine(aCandidate, basegfx::B2DVector(1.0, 1.0), basegfx::B2DLINEJOIN_NONE, this); + } + + if(!bDone) + { + const Polygon aPolygon(aCandidate); + mpGraphics->DrawPolyLine(aPolygon.GetSize(), (const SalPoint*)aPolygon.GetConstPointAry(), this); + } + } + } + + if(aFillPolyPolygon.count()) + { + const Color aOldLineColor( maLineColor ); + const Color aOldFillColor( maFillColor ); + + SetLineColor(); + ImplInitLineColor(); + SetFillColor( aOldLineColor ); + ImplInitFillColor(); + + bool bDone(false); + + if(bTryAA) + { + bDone = mpGraphics->DrawPolyPolygon(aFillPolyPolygon, 0.0, this); + } + + if(!bDone) + { + for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++) + { + const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a)); + mpGraphics->DrawPolygon(aPolygon.GetSize(), (const SalPoint*)aPolygon.GetConstPointAry(), this); + } + } + + SetFillColor( aOldFillColor ); + SetLineColor( aOldLineColor ); + } + + mpMetaFile = pOldMetaFile; +} + +// ----------------------------------------------------------------------- + void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt, const LineInfo& rLineInfo ) { @@ -2352,47 +2482,22 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt, if ( mbOutputClipped ) return; + const Point aStartPt( ImplLogicToDevicePixel( rStartPt ) ); + const Point aEndPt( ImplLogicToDevicePixel( rEndPt ) ); const LineInfo aInfo( ImplLogicToDevicePixel( rLineInfo ) ); + const bool bDashUsed(LINE_DASH == aInfo.GetStyle()); + const bool bLineWidthUsed(aInfo.GetWidth() > 1); - if( ( aInfo.GetWidth() > 1L ) || ( LINE_DASH == aInfo.GetStyle() ) ) + if(bDashUsed || bLineWidthUsed) { - Polygon aPoly( 2 ); aPoly[ 0 ] = rStartPt; aPoly[ 1 ] = rEndPt; - GDIMetaFile* pOldMetaFile = mpMetaFile; - ImplLineConverter aLineCvt( ImplLogicToDevicePixel( aPoly ), aInfo, ( mbRefPoint ) ? &maRefPoint : NULL ); - - mpMetaFile = NULL; + basegfx::B2DPolygon aLinePolygon; + aLinePolygon.append(basegfx::B2DPoint(aStartPt.X(), aStartPt.Y())); + aLinePolygon.append(basegfx::B2DPoint(aEndPt.X(), aEndPt.Y())); - if ( aInfo.GetWidth() > 1 ) - { - const Color aOldLineColor( maLineColor ); - const Color aOldFillColor( maFillColor ); - - SetLineColor(); - ImplInitLineColor(); - SetFillColor( aOldLineColor ); - ImplInitFillColor(); - - for( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() ) - mpGraphics->DrawPolygon( pPoly->GetSize(), (const SalPoint*) pPoly->GetConstPointAry(), this ); - - SetFillColor( aOldFillColor ); - SetLineColor( aOldLineColor ); - } - else - { - if ( mbInitLineColor ) - ImplInitLineColor(); - - for ( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() ) - mpGraphics->DrawLine( (*pPoly)[ 0 ].X(), (*pPoly)[ 0 ].Y(), (*pPoly)[ 1 ].X(), (*pPoly)[ 1 ].Y(), this ); - } - mpMetaFile = pOldMetaFile; + impPaintLineGeometryWithEvtlExpand(aInfo, basegfx::B2DPolyPolygon(aLinePolygon)); } else { - const Point aStartPt( ImplLogicToDevicePixel( rStartPt ) ); - const Point aEndPt( ImplLogicToDevicePixel( rEndPt ) ); - if ( mbInitLineColor ) ImplInitLineColor(); @@ -2541,7 +2646,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo if((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) && LINE_SOLID == rLineInfo.GetStyle()) { - DrawPolyLine(rPoly.getB2DPolygon(), (double)rLineInfo.GetWidth(), basegfx::B2DLINEJOIN_ROUND); + DrawPolyLine(rPoly.getB2DPolygon(), (double)rLineInfo.GetWidth(), rLineInfo.GetLineJoin()); return; } @@ -2553,7 +2658,7 @@ void OutputDevice::DrawPolyLine( const Polygon& rPoly, const LineInfo& rLineInfo void OutputDevice::ImpDrawPolyLineWithLineInfo(const Polygon& rPoly, const LineInfo& rLineInfo) { - USHORT nPoints = rPoly.GetSize(); + USHORT nPoints(rPoly.GetSize()); if ( !IsDeviceOutputNecessary() || !mbLineColor || ( nPoints < 2 ) || ( LINE_NONE == rLineInfo.GetStyle() ) || ImplIsRecordLayout() ) return; @@ -2561,11 +2666,19 @@ void OutputDevice::ImpDrawPolyLineWithLineInfo(const Polygon& rPoly, const LineI Polygon aPoly = ImplLogicToDevicePixel( rPoly ); // #100127# LineInfo is not curve-safe, subdivide always - if( aPoly.HasFlags() ) - { - aPoly = ImplSubdivideBezier( aPoly ); - nPoints = aPoly.GetSize(); - } + // + // What shall this mean? It's wrong to subdivide here when the + // polygon is a fat line. In that case, the painted geometry + // WILL be much different. + // I also have no idea how this could be related to the given ID + // which reads 'consolidate boost versions' in the task description. + // Removing. + // + //if( aPoly.HasFlags() ) + //{ + // aPoly = ImplSubdivideBezier( aPoly ); + // nPoints = aPoly.GetSize(); + //} // we need a graphics if ( !mpGraphics && !ImplGetGraphics() ) @@ -2577,67 +2690,29 @@ void OutputDevice::ImpDrawPolyLineWithLineInfo(const Polygon& rPoly, const LineI if ( mbOutputClipped ) return; - const LineInfo aInfo( ImplLogicToDevicePixel( rLineInfo ) ); - const bool bTryAA((mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) - && mpGraphics->supportsOperation(OutDevSupport_B2DDraw) - && ROP_OVERPAINT == GetRasterOp() - && IsLineColor()); - - if( aInfo.GetWidth() > 1L ) - { - const Color aOldLineColor( maLineColor ); - const Color aOldFillColor( maFillColor ); - GDIMetaFile* pOldMetaFile = mpMetaFile; - ImplLineConverter aLineCvt( aPoly, aInfo, ( mbRefPoint ) ? &maRefPoint : NULL ); - - mpMetaFile = NULL; - SetLineColor(); + if ( mbInitLineColor ) ImplInitLineColor(); - SetFillColor( aOldLineColor ); - ImplInitFillColor(); - bool bDone(false); - if(bTryAA) - { - // #i101491# try AAed version - // Use old on-the-fly geometry preparation, combine with AA - bool bSuccess(true); - - for(const Polygon* pPoly = aLineCvt.ImplGetFirst(); bSuccess && pPoly; pPoly = aLineCvt.ImplGetNext()) - { - bSuccess = mpGraphics->DrawPolyPolygon(basegfx::B2DPolyPolygon(pPoly->getB2DPolygon()), 0.0, this); - } - - if(bSuccess) - { - bDone = true; - } - } - - if(!bDone) - { - for( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() ) - { - mpGraphics->DrawPolygon( pPoly->GetSize(), (const SalPoint*) pPoly->GetConstPointAry(), this ); - } - } + const LineInfo aInfo( ImplLogicToDevicePixel( rLineInfo ) ); + const bool bDashUsed(LINE_DASH == aInfo.GetStyle()); + const bool bLineWidthUsed(aInfo.GetWidth() > 1); - SetLineColor( aOldLineColor ); - SetFillColor( aOldFillColor ); - mpMetaFile = pOldMetaFile; + if(bDashUsed || bLineWidthUsed) + { + impPaintLineGeometryWithEvtlExpand(aInfo, basegfx::B2DPolyPolygon(aPoly.getB2DPolygon())); } else { - if ( mbInitLineColor ) - ImplInitLineColor(); - if ( LINE_DASH == aInfo.GetStyle() ) + // #100127# the subdivision HAS to be done here since only a pointer + // to an array of points is given to the DrawPolyLine method, there is + // NO way to find out there that it's a curve. + if( aPoly.HasFlags() ) { - ImplLineConverter aLineCvt( aPoly, aInfo, ( mbRefPoint ) ? &maRefPoint : NULL ); - for( const Polygon* pPoly = aLineCvt.ImplGetFirst(); pPoly; pPoly = aLineCvt.ImplGetNext() ) - mpGraphics->DrawPolyLine( pPoly->GetSize(), (const SalPoint*)pPoly->GetConstPointAry(), this ); + aPoly = ImplSubdivideBezier( aPoly ); + nPoints = aPoly.GetSize(); } - else - mpGraphics->DrawPolyLine( nPoints, (const SalPoint*) aPoly.GetConstPointAry(), this ); + + mpGraphics->DrawPolyLine(nPoints, (const SalPoint*)aPoly.GetConstPointAry(), this); } if( mpAlphaVDev ) @@ -3042,7 +3117,12 @@ void OutputDevice::DrawPolyLine( SetFillColor(aOldLineColor); ImplInitFillColor(); - ImpDrawPolyPolygonWithB2DPolyPolygon(aAreaPolyPolygon); + // draw usig a loop; else the topology will paint a PolyPolygon + for(sal_uInt32 a(0); a < aAreaPolyPolygon.count(); a++) + { + ImpDrawPolyPolygonWithB2DPolyPolygon( + basegfx::B2DPolyPolygon(aAreaPolyPolygon.getB2DPolygon(a))); + } SetLineColor(aOldLineColor); ImplInitLineColor(); @@ -3059,14 +3139,15 @@ void OutputDevice::DrawPolyLine( } } } - - // fallback to old polygon drawing if needed. This will really - // use ImplLineConverter, but still try to AA lines - const Polygon aToolsPolygon( rB2DPolygon ); - LineInfo aLineInfo; - if( fLineWidth != 0.0 ) - aLineInfo.SetWidth( static_cast<long>(fLineWidth+0.5) ); - ImpDrawPolyLineWithLineInfo( aToolsPolygon, aLineInfo ); + else + { + // fallback to old polygon drawing if needed + const Polygon aToolsPolygon( rB2DPolygon ); + LineInfo aLineInfo; + if( fLineWidth != 0.0 ) + aLineInfo.SetWidth( static_cast<long>(fLineWidth+0.5) ); + ImpDrawPolyLineWithLineInfo( aToolsPolygon, aLineInfo ); + } } // ----------------------------------------------------------------------- diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 0a7a8b765b6b..51aad0790a26 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -56,11 +56,12 @@ #include <vcl/window.hxx> #include <vcl/svapp.hxx> #include <vcl/bmpacc.hxx> -#include <vcl/fontcvt.hxx> +#include <unotools/fontcvt.hxx> #include <vcl/outdev.hxx> #include <vcl/edit.hxx> -#include <vcl/fontcfg.hxx> +#include <unotools/fontcfg.hxx> #include <vcl/sysdata.hxx> +#include <vcl/textlayout.hxx> #ifndef _OSL_FILE_H #include <osl/file.h> #endif @@ -96,6 +97,7 @@ #include <memory> #include <algorithm> + // ======================================================================= DBG_NAMEEX( OutputDevice ) @@ -107,6 +109,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::rtl; using namespace ::vcl; +using namespace ::utl; // ======================================================================= @@ -304,451 +307,6 @@ void OutputDevice::ImplUpdateAllFontData( bool bNewFontLists ) // ======================================================================= -struct ImplLocalizedFontName -{ - const char* mpEnglishName; - const sal_Unicode* mpLocalizedNames; -}; - -static sal_Unicode const aBatang[] = { 0xBC14, 0xD0D5, 0, 0 }; -static sal_Unicode const aBatangChe[] = { 0xBC14, 0xD0D5, 0xCCB4, 0, 0 }; -static sal_Unicode const aGungsuh[] = { 0xAD81, 0xC11C, 0, 0 }; -static sal_Unicode const aGungsuhChe[] = { 0xAD81, 0xC11C, 0xCCB4, 0, 0 }; -static sal_Unicode const aGulim[] = { 0xAD74, 0xB9BC, 0, 0 }; -static sal_Unicode const aGulimChe[] = { 0xAD74, 0xB9BC, 0xCCB4, 0, 0 }; -static sal_Unicode const aDotum[] = { 0xB3CB, 0xC6C0, 0, 0 }; -static sal_Unicode const aDotumChe[] = { 0xB3CB, 0xC6C0, 0xCCB4, 0, 0 }; -static sal_Unicode const aSimSun[] = { 0x5B8B, 0x4F53, 0, 0 }; -static sal_Unicode const aNSimSun[] = { 0x65B0, 0x5B8B, 0x4F53, 0, 0 }; -static sal_Unicode const aSimHei[] = { 0x9ED1, 0x4F53, 0, 0 }; -static sal_Unicode const aSimKai[] = { 0x6977, 0x4F53, 0, 0 }; -static sal_Unicode const azycjkSun[] = { 0x4E2D, 0x6613, 0x5B8B, 0x4F53, 0, 0 }; -static sal_Unicode const azycjkHei[] = { 0x4E2D, 0x6613, 0x9ED1, 0x4F53, 0, 0 }; -static sal_Unicode const azycjkKai[] = { 0x4E2D, 0x6613, 0x6977, 0x4F53, 0, 0 }; -static sal_Unicode const aFZHei[] = { 0x65B9, 0x6B63, 0x9ED1, 0x4F53, 0, 0 }; -static sal_Unicode const aFZKai[] = { 0x65B9, 0x6B63, 0x6977, 0x4F53, 0, 0 }; -static sal_Unicode const aFZSongYI[] = { 0x65B9, 0x6B63, 0x5B8B, 0x4E00, 0, 0 }; -static sal_Unicode const aFZShuSong[] = { 0x65B9, 0x6B63, 0x4E66, 0x5B8B, 0, 0 }; -static sal_Unicode const aFZFangSong[] = { 0x65B9, 0x6B63, 0x4EFF, 0x5B8B, 0, 0 }; -// Attention: this fonts includes the wrong encoding vector - so we double the names with correct and wrong encoding -// First one is the GB-Encoding (we think the correct one), second is the big5 encoded name -static sal_Unicode const aMHei[] = { 'm', 0x7B80, 0x9ED1, 0, 'm', 0x6F60, 0x7AAA, 0, 0 }; -static sal_Unicode const aMKai[] = { 'm', 0x7B80, 0x6977, 0x566C, 0, 'm', 0x6F60, 0x7FF1, 0x628E, 0, 0 }; -static sal_Unicode const aMSong[] = { 'm', 0x7B80, 0x5B8B, 0, 'm', 0x6F60, 0x51BC, 0, 0 }; -static sal_Unicode const aCFangSong[] = { 'm', 0x7B80, 0x592B, 0x5B8B, 0, 'm', 0x6F60, 0x6E98, 0x51BC, 0, 0 }; -static sal_Unicode const aMingLiU[] = { 0x7D30, 0x660E, 0x9AD4, 0, 0 }; -static sal_Unicode const aPMingLiU[] = { 0x65B0, 0x7D30, 0x660E, 0x9AD4, 0, 0 }; -static sal_Unicode const aHei[] = { 0x6865, 0, 0 }; -static sal_Unicode const aKai[] = { 0x6B61, 0, 0 }; -static sal_Unicode const aMing[] = { 0x6D69, 0x6E67, 0, 0 }; -static sal_Unicode const aMSGothic[] = { 'm','s', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; -static sal_Unicode const aMSPGothic[] = { 'm','s','p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; -static sal_Unicode const aMSMincho[] = { 'm', 's', 0x660E, 0x671D, 0 }; -static sal_Unicode const aMSPMincho[] = { 'm','s','p', 0x660E, 0x671D, 0 }; -static sal_Unicode const aMeiryo[] = { 0x30e1, 0x30a4, 0x30ea, 0x30aa, 0 }; -static sal_Unicode const aHGMinchoL[] = { 'h','g', 0x660E, 0x671D, 'l', 0, 0 }; -static sal_Unicode const aHGGothicB[] = { 'h','g', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 0 }; -static sal_Unicode const aHGPMinchoL[] = { 'h','g','p', 0x660E, 0x671D, 'l', 0 }; -static sal_Unicode const aHGPGothicB[] = { 'h','g','p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 0 }; -static sal_Unicode const aHGMinchoLSun[] = { 'h','g', 0x660E, 0x671D, 'l', 's', 'u', 'n', 0 }; -static sal_Unicode const aHGPMinchoLSun[] = { 'h','g','p', 0x660E, 0x671D, 'l', 's', 'u', 'n', 0 }; -static sal_Unicode const aHGGothicBSun[] = { 'h', 'g', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 's', 'u', 'n', 0 }; -static sal_Unicode const aHGPGothicBSun[] = { 'h', 'g', 'p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 'b', 's', 'u', 'n', 0 }; -static sal_Unicode const aHGHeiseiMin[] = { 'h', 'g', 0x5E73, 0x6210, 0x660E, 0x671D, 0x4F53, 0, 'h', 'g', 0x5E73, 0x6210, 0x660E, 0x671D, 0x4F53, 'w', '3', 'x', '1', '2', 0, 0 }; -static sal_Unicode const aIPAMincho[] = { 'i', 'p', 'a', 0x660E, 0x671D, 0 }; -static sal_Unicode const aIPAPMincho[] = { 'i', 'p', 'a', 'p', 0x660E, 0x671D, 0 }; -static sal_Unicode const aIPAGothic[] = { 'i', 'p', 'a', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 }; -static sal_Unicode const aIPAPGothic[] = { 'i', 'p', 'a', 'p', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 }; -static sal_Unicode const aIPAUIGothic[] = { 'i', 'p', 'a', 'u', 'i', 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0 }; -static sal_Unicode const aSazanamiMincho[] = { 0x3055, 0x3056, 0x306A, 0x307F, 0x660E, 0x671D, 0, 0 }; -static sal_Unicode const aSazanamiGothic[] = { 0x3055, 0x3056, 0x306A, 0x307F, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; -static sal_Unicode const aKochiMincho[] = { 0x6771, 0x98A8, 0x660E, 0x671D, 0, 0 }; -static sal_Unicode const aKochiGothic[] = { 0x6771, 0x98A8, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0, 0 }; -static sal_Unicode const aSunDotum[] = { 0xC36C, 0xB3CB, 0xC6C0, 0, 0 }; -static sal_Unicode const aSunGulim[] = { 0xC36C, 0xAD74, 0xB9BC, 0, 0 }; -static sal_Unicode const aSunBatang[] = { 0xC36C, 0xBC14, 0xD0D5, 0, 0 }; -static sal_Unicode const aBaekmukDotum[] = { 0xBC31, 0xBB35, 0xB3CB, 0xC6C0, 0, 0 }; -static sal_Unicode const aBaekmukGulim[] = { 0xBC31, 0xBB35, 0xAD74, 0xB9BC, 0, 0 }; -static sal_Unicode const aBaekmukBatang[] = { 0xBC31, 0xBB35, 0xBC14, 0xD0D5, 0, 0 }; -static sal_Unicode const aFzMingTi[] = { 0x65B9, 0x6B63, 0x660E, 0x9AD4, 0, 0 }; -static sal_Unicode const aFzHeiTiTW[]= { 0x65B9, 0x6B63, 0x9ED1, 0x9AD4, 0, 0 }; -static sal_Unicode const aFzKaiTiTW[]= { 0x65B9, 0x6B63, 0x6977, 0x9AD4, 0, 0 }; -static sal_Unicode const aFzHeiTiCN[]= { 0x65B9, 0x6B63, 0x9ED1, 0x4F53, 0, 0 }; -static sal_Unicode const aFzKaiTiCN[]= { 0x65B9, 0x6B63, 0x6977, 0x4F53, 0, 0 }; -static sal_Unicode const aFzSongTi[] = { 0x65B9, 0x6B63, 0x5B8B, 0x4F53, 0, 0 }; -static sal_Unicode const aHYMyeongJoExtra[] = { 'h', 'y', 0xACAC, 0xBA85, 0xC870, 0, 0 }; -static sal_Unicode const aHYSinMyeongJoMedium[] = { 'h', 'y', 0xC2E0, 0xBA85, 0xC870, 0, 0 }; -static sal_Unicode const aHYGothicMedium[] = { 'h', 'y', 0xC911, 0xACE0, 0xB515, 0, 0 }; -static sal_Unicode const aHYGraphicMedium[] = { 'h', 'y', 0xADF8, 0xB798, 0xD53D, 'm', 0, 0 }; -static sal_Unicode const aHYGraphic[] = { 'h', 'y', 0xADF8, 0xB798, 0xD53D, 0, 0 }; -static sal_Unicode const aNewGulim[] = { 0xC0C8, 0xAD74, 0xB9BC, 0, 0 }; -static sal_Unicode const aSunGungseo[] = { 0xC36C, 0xAD81, 0xC11C, 0, 0 }; -static sal_Unicode const aHYGungSoBold[] = { 'h','y', 0xAD81, 0xC11C, 'b', 0, 0 }; -static sal_Unicode const aHYGungSo[] = { 'h','y', 0xAD81, 0xC11C, 0, 0 }; -static sal_Unicode const aSunHeadLine[] = { 0xC36C, 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 0, 0 }; -static sal_Unicode const aHYHeadLineMedium[] = { 'h', 'y', 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 'm', 0, 0 }; -static sal_Unicode const aHYHeadLine[] = { 'h', 'y', 0xD5E4, 0xB4DC, 0xB77C, 0xC778, 0, 0 }; -static sal_Unicode const aYetR[] = { 0xD734, 0xBA3C, 0xC61B, 0xCCB4, 0, 0 }; -static sal_Unicode const aHYGothicExtra[] = { 'h', 'y', 0xACAC, 0xACE0, 0xB515, 0, 0 }; -static sal_Unicode const aSunMokPan[] = { 0xC36C, 0xBAA9, 0xD310, 0, 0 }; -static sal_Unicode const aSunYeopseo[] = { 0xC36C, 0xC5FD, 0xC11C, 0, 0 }; -static sal_Unicode const aSunBaekSong[] = { 0xC36C, 0xBC31, 0xC1A1, 0, 0 }; -static sal_Unicode const aHYPostLight[] = { 'h', 'y', 0xC5FD, 0xC11C, 'l', 0, 0 }; -static sal_Unicode const aHYPost[] = { 'h', 'y', 0xC5FD, 0xC11C, 0, 0 }; -static sal_Unicode const aMagicR[] = { 0xD734, 0xBA3C, 0xB9E4, 0xC9C1, 0xCCB4, 0, 0 }; -static sal_Unicode const aSunCrystal[] = { 0xC36C, 0xD06C, 0xB9AC, 0xC2A4, 0xD0C8, 0, 0 }; -static sal_Unicode const aSunSaemmul[] = { 0xC36C, 0xC0D8, 0xBB3C, 0, 0 }; -static sal_Unicode const aHaansoftBatang[] = { 0xD55C, 0xCEF4, 0xBC14, 0xD0D5, 0, 0 }; -static sal_Unicode const aHaansoftDotum[] = { 0xD55C, 0xCEF4, 0xB3CB, 0xC6C0, 0, 0 }; -static sal_Unicode const aHyhaeseo[] = { 0xD55C, 0xC591, 0xD574, 0xC11C, 0, 0 }; -static sal_Unicode const aMDSol[] = { 'm', 'd', 0xC194, 0xCCB4, 0, 0 }; -static sal_Unicode const aMDGaesung[] = { 'm', 'd', 0xAC1C, 0xC131, 0xCCB4, 0, 0 }; -static sal_Unicode const aMDArt[] = { 'm', 'd', 0xC544, 0xD2B8, 0xCCB4, 0, 0 }; -static sal_Unicode const aMDAlong[] = { 'm', 'd', 0xC544, 0xB871, 0xCCB4, 0, 0 }; -static sal_Unicode const aMDEasop[] = { 'm', 'd', 0xC774, 0xC19D, 0xCCB4, 0, 0 }; -static sal_Unicode const aHYShortSamulMedium[] = { 'h', 'y', 0xC595, 0xC740, 0xC0D8, 0xBB3C, 'm', 0 }; -static sal_Unicode const aHYShortSamul[] = { 'h', 'y', 0xC595, 0xC740, 0xC0D8, 0xBB3C, 0 }; -static sal_Unicode const aHGGothicE[] = { 'h','g', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 }; -static sal_Unicode const aHGPGothicE[] = { 'h','g','p', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 }; -static sal_Unicode const aHGSGothicE[] = { 'h','g','s', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'e', 0 }; -static sal_Unicode const aHGGothicM[] = { 'h','g', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 }; -static sal_Unicode const aHGPGothicM[] = { 'h','g','p', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 }; -static sal_Unicode const aHGSGothicM[] = { 'h','g','s', 0xFF7A, 0xFF9E, 0xFF7C, 0xFF6F, 0xFF78, 'm', 0 }; -static sal_Unicode const aHGGyoshotai[] = { 'h','g', 0x884C, 0x66F8, 0x4F53, 0 }; -static sal_Unicode const aHGPGyoshotai[] = { 'h','g','p', 0x884C, 0x66F8, 0x4F53, 0 }; -static sal_Unicode const aHGSGyoshotai[] = { 'h','g','s', 0x884C, 0x66F8, 0x4F53, 0 }; -static sal_Unicode const aHGKyokashotai[] = { 'h','g', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 }; -static sal_Unicode const aHGPKyokashotai[] = { 'h','g','p', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 }; -static sal_Unicode const aHGSKyokashotai[] = { 'h','g','s', 0x6559, 0x79D1, 0x66F8, 0x4F53, 0 }; -static sal_Unicode const aHGMinchoB[] = { 'h','g', 0x660E, 0x671D, 'b', 0 }; -static sal_Unicode const aHGPMinchoB[] = { 'h','g','p', 0x660E, 0x671D, 'b', 0 }; -static sal_Unicode const aHGSMinchoB[] = { 'h','g','s', 0x660E, 0x671D, 'b', 0 }; -static sal_Unicode const aHGMinchoE[] = { 'h','g', 0x660E, 0x671D, 'e', 0 }; -static sal_Unicode const aHGPMinchoE[] = { 'h','g','p', 0x660E, 0x671D, 'e', 0 }; -static sal_Unicode const aHGSMinchoE[] = { 'h','g','s', 0x660E, 0x671D, 'e', 0 }; -static sal_Unicode const aHGSoeiKakupoptai[] = { 'h','g', 0x5275,0x82F1,0x89D2,0xFF8E, - 0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0}; -static sal_Unicode const aHGPSoeiKakupoptai[] = { 'h','g', 'p', 0x5275,0x82F1,0x89D2,0xFF8E, - 0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0}; -static sal_Unicode const aHGSSoeiKakupoptai[] = { 'h','g', 's', 0x5275,0x82F1,0x89D2,0xFF8E, - 0xFF9F,0xFF6F,0xFF8C,0xFF9F,0x4F53,0}; -static sal_Unicode const aHGSoeiPresenceEB[] = { 'h','g', 0x5275,0x82F1,0xFF8C,0xFF9F, - 0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0}; -static sal_Unicode const aHGPSoeiPresenceEB[] = { 'h','g','p', 0x5275,0x82F1,0xFF8C,0xFF9F, - 0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0}; -static sal_Unicode const aHGSSoeiPresenceEB[] = { 'h','g','s', 0x5275,0x82F1,0xFF8C,0xFF9F, - 0xFF9A,0xFF7E,0xFF9E,0xFF9D,0xFF7D, 'e','b',0}; -static sal_Unicode const aHGSoeiKakugothicUB[] = { 'h','g', 0x5275,0x82F1,0x89D2,0xFF7A, - 0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0}; -static sal_Unicode const aHGPSoeiKakugothicUB[] = { 'h','g','p', 0x5275,0x82F1,0x89D2,0xFF7A, - 0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0}; -static sal_Unicode const aHGSSoeiKakugothicUB[] = { 'h','g','s', 0x5275,0x82F1,0x89D2,0xFF7A, - 0xFF9E,0xFF7C,0xFF6F,0xFF78,'u','b',0}; -static sal_Unicode const aHGSeikaishotaiPRO[] = { 'h','g', 0x6B63,0x6977,0x66F8,0x4F53, '-','p','r','o',0}; -static sal_Unicode const aHGMaruGothicMPRO[] = { 'h','g', 0x4E38,0xFF7A,0xFF9E,0xFF7C,0xFF6F,0xFF78, '-','p','r','o',0}; -static sal_Unicode const aHiraginoMinchoPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x660E, 0x671D, 'p','r','o',0}; -static sal_Unicode const aHiraginoMinchoProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x660E, 0x671D, 'p','r','o','n',0}; -static sal_Unicode const aHiraginoKakuGothicPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x89D2, 0x30B4, 'p','r','o',0}; -static sal_Unicode const aHiraginoKakuGothicProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x89D2, 0x30B4, 'p','r','o','n',0}; -static sal_Unicode const aHiraginoMaruGothicPro[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o',0}; -static sal_Unicode const aHiraginoMaruGothicProN[] = { 0x30D2, 0x30E9, 0x30AE, 0x30CE, 0x4E38, 0x30B4, 'p','r','o','n',0}; - - -static ImplLocalizedFontName aImplLocalizedNamesList[] = -{ -{ "batang", aBatang }, -{ "batangche", aBatangChe }, -{ "gungshu", aGungsuh }, -{ "gungshuche", aGungsuhChe }, -{ "gulim", aGulim }, -{ "gulimche", aGulimChe }, -{ "dotum", aDotum }, -{ "dotumche", aDotumChe }, -{ "simsun", aSimSun }, -{ "nsimsun", aNSimSun }, -{ "simhei", aSimHei }, -{ "simkai", aSimKai }, -{ "zycjksun", azycjkSun }, -{ "zycjkhei", azycjkHei }, -{ "zycjkkai", azycjkKai }, -{ "fzhei", aFZHei }, -{ "fzkai", aFZKai }, -{ "fzsong", aFZSongYI }, -{ "fzshusong", aFZShuSong }, -{ "fzfangsong", aFZFangSong }, -{ "mhei", aMHei }, -{ "mkai", aMKai }, -{ "msong", aMSong }, -{ "cfangsong", aCFangSong }, -{ "mingliu", aMingLiU }, -{ "pmingliu", aPMingLiU }, -{ "hei", aHei }, -{ "kai", aKai }, -{ "ming", aMing }, -{ "msgothic", aMSGothic }, -{ "mspgothic", aMSPGothic }, -{ "msmincho", aMSMincho }, -{ "mspmincho", aMSPMincho }, -{ "meiryo", aMeiryo }, -{ "hgminchol", aHGMinchoL }, -{ "hggothicb", aHGGothicB }, -{ "hgpminchol", aHGPMinchoL }, -{ "hgpgothicb", aHGPGothicB }, -{ "hgmincholsun", aHGMinchoLSun }, -{ "hggothicbsun", aHGGothicBSun }, -{ "hgpmincholsun", aHGPMinchoLSun }, -{ "hgpgothicbsun", aHGPGothicBSun }, -{ "hgheiseimin", aHGHeiseiMin }, -{ "ipamincho", aIPAMincho }, -{ "ipapmincho", aIPAPMincho }, -{ "ipagothic", aIPAGothic }, -{ "ipapgothic", aIPAPGothic }, -{ "ipauigothic", aIPAUIGothic }, -{ "sazanamimincho", aSazanamiMincho }, -{ "sazanamigothic", aSazanamiGothic }, -{ "kochimincho", aKochiMincho }, -{ "kochigothic", aKochiGothic }, -{ "sundotum", aSunDotum }, -{ "sungulim", aSunGulim }, -{ "sunbatang", aSunBatang }, -{ "baekmukdotum", aBaekmukDotum }, -{ "baekmukgulim", aBaekmukGulim }, -{ "baekmukbatang", aBaekmukBatang }, -{ "fzheiti", aFzHeiTiCN }, -{ "fzheiti", aFzHeiTiTW }, -{ "fzkaiti", aFzKaiTiCN }, -{ "fzkaitib", aFzKaiTiTW }, -{ "fzmingtib", aFzMingTi }, -{ "fzsongti", aFzSongTi }, -{ "hymyeongjoextra", aHYMyeongJoExtra }, -{ "hysinmyeongjomedium", aHYSinMyeongJoMedium }, -{ "hygothicmedium", aHYGothicMedium }, -{ "hygraphicmedium", aHYGraphicMedium }, -{ "hygraphic", aHYGraphic }, -{ "newgulim", aNewGulim }, -{ "sungungseo", aSunGungseo }, -{ "hygungsobold", aHYGungSoBold }, -{ "hygungso", aHYGungSo }, -{ "sunheadline", aSunHeadLine }, -{ "hyheadlinemedium", aHYHeadLineMedium }, -{ "hyheadline", aHYHeadLine }, -{ "yetr", aYetR }, -{ "hygothicextra", aHYGothicExtra }, -{ "sunmokpan", aSunMokPan }, -{ "sunyeopseo", aSunYeopseo }, -{ "sunbaeksong", aSunBaekSong }, -{ "hypostlight", aHYPostLight }, -{ "hypost", aHYPost }, -{ "magicr", aMagicR }, -{ "suncrystal", aSunCrystal }, -{ "sunsaemmul", aSunSaemmul }, -{ "hyshortsamulmedium", aHYShortSamulMedium }, -{ "hyshortsamul", aHYShortSamul }, -{ "haansoftbatang", aHaansoftBatang }, -{ "haansoftdotum", aHaansoftDotum }, -{ "hyhaeseo", aHyhaeseo }, -{ "mdsol", aMDSol }, -{ "mdgaesung", aMDGaesung }, -{ "mdart", aMDArt }, -{ "mdalong", aMDAlong }, -{ "mdeasop", aMDEasop }, -{ "hggothice", aHGGothicE }, -{ "hgpgothice", aHGPGothicE }, -{ "hgpothice", aHGSGothicE }, -{ "hggothicm", aHGGothicM }, -{ "hgpgothicm", aHGPGothicM }, -{ "hgpgothicm", aHGSGothicM }, -{ "hggyoshotai", aHGGyoshotai }, -{ "hgpgyoshotai", aHGPGyoshotai }, -{ "hgsgyoshotai", aHGSGyoshotai }, -{ "hgkyokashotai", aHGKyokashotai }, -{ "hgpkyokashotai", aHGPKyokashotai }, -{ "hgskyokashotai", aHGSKyokashotai }, -{ "hgminchob", aHGMinchoB }, -{ "hgpminchob", aHGPMinchoB }, -{ "hgsminchob", aHGSMinchoB }, -{ "hgminchoe", aHGMinchoE }, -{ "hgpminchoe", aHGPMinchoE }, -{ "hgsminchoe", aHGSMinchoE }, -{ "hgsoeikakupoptai", aHGSoeiKakupoptai }, -{ "hgpsoeikakupopta", aHGPSoeiKakupoptai }, -{ "hgssoeikakupopta", aHGSSoeiKakupoptai }, -{ "hgsoeipresenceeb", aHGSoeiPresenceEB }, -{ "hgpsoeipresenceeb", aHGPSoeiPresenceEB }, -{ "hgssoeipresenceeb", aHGSSoeiPresenceEB }, -{ "hgsoeikakugothicub", aHGSoeiKakugothicUB }, -{ "hgpsoeikakugothicub", aHGPSoeiKakugothicUB }, -{ "hgssoeikakugothicub", aHGSSoeiKakugothicUB }, -{ "hgseikaishotaipro", aHGSeikaishotaiPRO }, -{ "hgmarugothicmpro", aHGMaruGothicMPRO }, -{ "hiraginominchopro", aHiraginoMinchoPro }, -{ "hiraginominchopron", aHiraginoMinchoProN }, -{ "hiraginokakugothicpro", aHiraginoKakuGothicPro }, -{ "hiraginokakugothicpron", aHiraginoKakuGothicProN }, -{ "hiraginomarugothicpro", aHiraginoMaruGothicPro }, -{ "hiraginomarugothicpron", aHiraginoMaruGothicProN }, -{ NULL, NULL }, -}; - -// ----------------------------------------------------------------------- - -void ImplGetEnglishSearchFontName( String& rName ) -{ - bool bNeedTranslation = false; - xub_StrLen nLen = rName.Len(); - - // Remove trailing whitespaces - xub_StrLen i = nLen; - while ( i && (rName.GetChar( i-1 ) < 32) ) - i--; - if ( i != nLen ) - rName.Erase( i ); - - // Remove Script at the end - // Scriptname must be the last part of the fontname and - // looks like "fontname (scriptname)". So there can only be a - // script name at the and of the fontname, when the last char is ')' - if ( (nLen >= 3) && rName.GetChar( nLen-1 ) == ')' ) - { - int nOpen = 1; - xub_StrLen nTempLen = nLen-2; - while ( nTempLen ) - { - if ( rName.GetChar( nTempLen ) == '(' ) - { - nOpen--; - if ( !nOpen ) - { - // Remove Space at the end - if ( nTempLen && (rName.GetChar( nTempLen-1 ) == ' ') ) - nTempLen--; - rName.Erase( nTempLen ); - nLen = nTempLen; - break; - } - } - if ( rName.GetChar( nTempLen ) == ')' ) - nOpen++; - nTempLen--; - } - } - - // remove all whitespaces and converts to lower case ASCII - // TODO: better transliteration to ASCII e.g. all digits - i = 0; - while ( i < nLen ) - { - sal_Unicode c = rName.GetChar( i ); - if ( c > 127 ) - { - // Translate to Lowercase-ASCII - // FullWidth-ASCII to half ASCII - if ( (c >= 0xFF00) && (c <= 0xFF5E) ) - { - c -= 0xFF00-0x0020; - // Upper to Lower - if ( (c >= 'A') && (c <= 'Z') ) - c += 'a' - 'A'; - rName.SetChar( i, c ); - } - else - { - // Only Fontnames with None-Ascii-Characters must be translated - bNeedTranslation = true; - } - } - // not lowercase Ascii - else if ( !((c >= 'a') && (c <= 'z')) ) - { - // To Lowercase-Ascii - if ( (c >= 'A') && (c <= 'Z') ) - { - c += 'a' - 'A'; - rName.SetChar( i, c ); - } - else if( ((c < '0') || (c > '9')) && (c != ';') ) // not 0-9 or semicolon - { - // Remove white spaces and special characters - rName.Erase( i, 1 ); - nLen--; - continue; - } - } - - i++; - } - - // translate normalized localized name to its normalized English ASCII name - if( bNeedTranslation ) - { - typedef std::hash_map<const String, const char*,FontNameHash> FontNameDictionary; - static FontNameDictionary aDictionary( sizeof(aImplLocalizedNamesList) / sizeof(*aImplLocalizedNamesList) ); - // the font name dictionary needs to be intialized once - if( aDictionary.empty() ) - { - // TODO: check if all dictionary entries are already normalized? - const ImplLocalizedFontName* pList = aImplLocalizedNamesList; - for(; pList->mpEnglishName; ++pList ) - aDictionary[ pList->mpLocalizedNames ] = pList->mpEnglishName; - } - - FontNameDictionary::const_iterator it = aDictionary.find( rName ); - if( it != aDictionary.end() ) - rName.AssignAscii( it->second ); - } -} - -// ----------------------------------------------------------------------- - -static String GetNextFontToken( const String& rTokenStr, xub_StrLen& rIndex ) -{ - // check for valid start index - int nStringLen = rTokenStr.Len(); - if( rIndex >= nStringLen ) - { - rIndex = STRING_NOTFOUND; - return String(); - } - - // find the next token delimiter and return the token substring - const sal_Unicode* pStr = rTokenStr.GetBuffer() + rIndex; - const sal_Unicode* pEnd = rTokenStr.GetBuffer() + nStringLen; - for(; pStr < pEnd; ++pStr ) - if( (*pStr == ';') || (*pStr == ',') ) - break; - - xub_StrLen nTokenStart = rIndex; - xub_StrLen nTokenLen; - if( pStr < pEnd ) - { - rIndex = sal::static_int_cast<xub_StrLen>(pStr - rTokenStr.GetBuffer()); - nTokenLen = rIndex - nTokenStart; - ++rIndex; // skip over token separator - } - else - { - // no token delimiter found => handle last token - rIndex = STRING_NOTFOUND; - nTokenLen = STRING_LEN; - - // optimize if the token string consists of just one token - if( !nTokenStart ) - return rTokenStr; - } - - return String( rTokenStr, nTokenStart, nTokenLen ); -} - -// TODO: get rid of this in another incompatible build with SW project. -// SW's WW8 and RTF filters still use this (from fontcvt.hxx) -String GetFontToken( const String& rTokenStr, xub_StrLen nToken, xub_StrLen& rIndex ) -{ - // skip nToken Tokens - for( xub_StrLen i = 0; (i < nToken) && (rIndex != STRING_NOTFOUND); ++i ) - GetNextFontToken( rTokenStr, rIndex ); - - return GetNextFontToken( rTokenStr, rIndex ); -} // ======================================================================= @@ -812,8 +370,8 @@ ImplFontSubstEntry::ImplFontSubstEntry( const String& rFontName, { maSearchName = rFontName; maSearchReplaceName = rSubstFontName; - ImplGetEnglishSearchFontName( maSearchName ); - ImplGetEnglishSearchFontName( maSearchReplaceName ); + GetEnglishSearchFontName( maSearchName ); + GetEnglishSearchFontName( maSearchReplaceName ); } // ----------------------------------------------------------------------- @@ -913,7 +471,7 @@ static void ImplFontSubstitute( String& rFontName, { #ifdef DBG_UTIL String aTempName = rFontName; - ImplGetEnglishSearchFontName( aTempName ); + GetEnglishSearchFontName( aTempName ); DBG_ASSERT( aTempName == rFontName, "ImplFontSubstitute() called without a searchname" ); #endif @@ -938,44 +496,6 @@ static void ImplFontSubstitute( String& rFontName, } } -// ======================================================================= - -static bool ImplIsFontToken( const String& rName, const String& rToken ) -{ - String aTempName; - xub_StrLen nIndex = 0; - do - { - aTempName = GetNextFontToken( rName, nIndex ); - if ( rToken == aTempName ) - return true; - } - while ( nIndex != STRING_NOTFOUND ); - - return false; -} - -// ----------------------------------------------------------------------- - -static void ImplAppendFontToken( String& rName, const String& rNewToken ) -{ - if ( rName.Len() ) - { - rName.Append( ';' ); - rName.Append( rNewToken ); - } - else - rName = rNewToken; -} - -// ----------------------------------------------------------------------- - -static void ImplAddTokenFontName( String& rName, const String& rNewToken ) -{ - if ( !ImplIsFontToken( rName, rNewToken ) ) - ImplAppendFontToken( rName, rNewToken ); -} - // ----------------------------------------------------------------------- Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang, @@ -993,7 +513,7 @@ Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang, MsLangId::convertLanguageToLocale( eLang, aLocale ); } - DefaultFontConfiguration& rDefaults = *DefaultFontConfiguration::get(); + utl::DefaultFontConfiguration& rDefaults = *utl::DefaultFontConfiguration::get(); String aSearch = rDefaults.getUserInterfaceFont( aLocale ); // ensure a fallback String aDefault = rDefaults.getDefaultFont( aLocale, nType ); if( aDefault.Len() ) @@ -1072,11 +592,11 @@ Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang, do { aSearchName = GetNextFontToken( aSearch, nIndex ); - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); ImplDevFontListData* pFontFamily = pOutDev->mpFontList->ImplFindBySearchName( aSearchName ); if( pFontFamily ) { - ImplAddTokenFontName( aName, pFontFamily->GetFamilyName() ); + AddTokenFontName( aName, pFontFamily->GetFamilyName() ); if( nFlags & DEFAULTFONT_FLAGS_ONLYONE ) break; } @@ -1176,61 +696,6 @@ Font OutputDevice::GetDefaultFont( USHORT nType, LanguageType eLang, // ======================================================================= -String GetSubsFontName( const String& rName, ULONG nFlags ) -{ - String aName; - - xub_StrLen nIndex = 0; - String aOrgName = GetNextFontToken( rName, nIndex ); - ImplGetEnglishSearchFontName( aOrgName ); - - // #93662# do not try to replace StarSymbol with MS only font - if( nFlags == (SUBSFONT_MS|SUBSFONT_ONLYONE) - && ( aOrgName.EqualsAscii( "starsymbol" ) - || aOrgName.EqualsAscii( "opensymbol" ) ) ) - return aName; - - const FontNameAttr* pAttr = FontSubstConfiguration::get()->getSubstInfo( aOrgName ); - if ( pAttr ) - { - for( int i = 0; i < 3; i++ ) - { - const ::std::vector< String >* pVector = NULL; - switch( i ) - { - case 0: - if( nFlags & SUBSFONT_MS && pAttr->MSSubstitutions.size() ) - pVector = &pAttr->MSSubstitutions; - break; - case 1: - if( nFlags & SUBSFONT_PS && pAttr->PSSubstitutions.size() ) - pVector = &pAttr->PSSubstitutions; - break; - case 2: - if( nFlags & SUBSFONT_HTML && pAttr->HTMLSubstitutions.size() ) - pVector = &pAttr->HTMLSubstitutions; - break; - } - if( ! pVector ) - continue; - for( ::std::vector< String >::const_iterator it = pVector->begin(); it != pVector->end(); ++it ) - if( ! ImplIsFontToken( rName, *it ) ) - { - ImplAppendFontToken( aName, *it ); - if( nFlags & SUBSFONT_ONLYONE ) - { - i = 4; - break; - } - } - } - } - - return aName; -} - -// ======================================================================= - static unsigned ImplIsCJKFont( const String& rFontName ) { // Test, if Fontname includes CJK characters --> In this case we @@ -1695,7 +1160,7 @@ bool ImplDevFontListData::AddFontFace( ImplFontData* pNewData ) // ----------------------------------------------------------------------- // get font attributes using the normalized font family name -void ImplDevFontListData::InitMatchData( const vcl::FontSubstConfiguration& rFontSubst, +void ImplDevFontListData::InitMatchData( const utl::FontSubstConfiguration& rFontSubst, const String& rSearchName ) { String aShortName; @@ -1834,29 +1299,6 @@ void ImplDevFontList::Clear() mbMatchData = false; } -// ----------------------------------------------------------------------- - -// TODO: use a more generic String hash -int FontNameHash::operator()( const String& rStr ) const -{ - // this simple hash just has to be good enough for font names - int nHash = 0; - const int nLen = rStr.Len(); - const sal_Unicode* p = rStr.GetBuffer(); - switch( nLen ) - { - default: nHash = (p[0]<<16) - (p[1]<<8) + p[2]; - nHash += nLen; - p += nLen - 3; - // fall through - case 3: nHash += (p[2]<<16); // fall through - case 2: nHash += (p[1]<<8); // fall through - case 1: nHash += p[0]; // fall through - case 0: break; - }; - - return nHash; -} // ----------------------------------------------------------------------- @@ -2003,7 +1445,7 @@ ImplDevFontListData* ImplDevFontList::GetGlyphFallbackFont( ImplFontSelectData& // call the hook to query the best matching glyph fallback font if( mpFallbackHook->FindFontSubstitute( rFontSelData, rMissingCodes ) ) // apply outdev3.cxx specific fontname normalization - ImplGetEnglishSearchFontName( rFontSelData.maSearchName ); + GetEnglishSearchFontName( rFontSelData.maSearchName ); else rFontSelData.maSearchName = String(); @@ -2058,7 +1500,7 @@ void ImplDevFontList::Add( ImplFontData* pNewData ) for( xub_StrLen nMapNameIndex = 0; nMapNameIndex != STRING_NOTFOUND; ) { String aSearchName = pNewData->maName; - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); DevFontList::const_iterator it = maDevFontList.find( aSearchName ); ImplDevFontListData* pFoundData = NULL; @@ -2095,7 +1537,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindBySearchName( const String& rSearc { #ifdef DEBUG String aTempName = rSearchName; - ImplGetEnglishSearchFontName( aTempName ); + GetEnglishSearchFontName( aTempName ); DBG_ASSERT( aTempName == rSearchName, "ImplDevFontList::ImplFindBySearchName() called with non-normalized name" ); #endif @@ -2150,7 +1592,7 @@ ImplDevFontListData* ImplDevFontList::FindFontFamily( const String& rFontName ) { // normalize the font fomily name and String aName = rFontName; - ImplGetEnglishSearchFontName( aName ); + GetEnglishSearchFontName( aName ); ImplDevFontListData* pFound = ImplFindBySearchName( aName ); return pFound; } @@ -2167,7 +1609,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByTokenNames( const String& rToken String aSearchName = GetNextFontToken( rTokenStr, nTokenPos ); if( !aSearchName.Len() ) continue; - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); pFoundData = ImplFindBySearchName( aSearchName ); if( pFoundData ) break; @@ -2178,7 +1620,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByTokenNames( const String& rToken // ----------------------------------------------------------------------- -ImplDevFontListData* ImplDevFontList::ImplFindBySubstFontAttr( const vcl::FontNameAttr& rFontAttr ) const +ImplDevFontListData* ImplDevFontList::ImplFindBySubstFontAttr( const utl::FontNameAttr& rFontAttr ) const { ImplDevFontListData* pFoundData = NULL; @@ -2187,7 +1629,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindBySubstFontAttr( const vcl::FontNa for(; it != rFontAttr.Substitutions.end(); ++it ) { String aSearchName( *it ); - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); pFoundData = ImplFindBySearchName( aSearchName ); if( pFoundData ) @@ -2933,7 +2375,7 @@ ImplFontEntry* ImplFontCache::GetFontEntry( ImplDevFontList* pFontList, // if we found a different symbol font we need a symbol conversion table if( pFontData->IsSymbolFont() ) if( aFontSelData.maTargetName != aFontSelData.maSearchName ) - pEntry->mpConversion = ImplGetRecodeData( aFontSelData.maTargetName, aFontSelData.maSearchName ); + pEntry->mpConversion = ConvertChar::GetRecodeData( aFontSelData.maTargetName, aFontSelData.maSearchName ); // add the new entry to the cache maFontInstanceList[ aFontSelData ] = pEntry; @@ -2981,7 +2423,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, #endif - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); ImplFontSubstitute( aSearchName, nSubstFlags, pDevSpecific ); // #114999# special emboldening for Ricoh fonts // TODO: smarter check for special cases by using PreMatch infrastructure? @@ -3029,7 +2471,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, #endif if( mpPreMatchHook ) if( mpPreMatchHook->FindFontSubstitute( rFSD ) ) - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); #ifdef ENABLE_GRAPHITE // the prematch hook uses the target name to search, but we now need // to restore the features to make the font selection data unique @@ -3056,13 +2498,13 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, { rFSD.maTargetName = GetNextFontToken( rFSD.maName, nTokenPos ); aSearchName = rFSD.maTargetName; - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); } else nTokenPos = STRING_NOTFOUND; if( mpPreMatchHook ) if( mpPreMatchHook->FindFontSubstitute( rFSD ) ) - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); ImplFontSubstitute( aSearchName, nSubstFlags, pDevSpecific ); ImplDevFontListData* pFoundData = ImplFindBySearchName( aSearchName ); if( pFoundData ) @@ -3076,7 +2518,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, nTokenPos = 0; rFSD.maTargetName = GetNextFontToken( rFSD.maName, nTokenPos ); aSearchName = rFSD.maTargetName; - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); } String aSearchShortName; @@ -3151,7 +2593,7 @@ ImplDevFontListData* ImplDevFontList::ImplFindByFont( ImplFontSelectData& rFSD, continue; aSearchName = rFSD.maTargetName; - ImplGetEnglishSearchFontName( aSearchName ); + GetEnglishSearchFontName( aSearchName ); String aTempShortName; String aTempFamilyName; @@ -4835,7 +4277,7 @@ void OutputDevice::ImplGetEmphasisMark( PolyPolygon& rPolyPoly, BOOL& rPolyLine, double dScale = ((double)nDotSize)/1000.0; aPoly.Scale( dScale, dScale ); Polygon aTemp; - aPoly.GetSimple( aTemp ); + aPoly.AdaptiveSubdivide( aTemp ); Rectangle aBoundRect = aTemp.GetBoundRect(); rWidth = aBoundRect.GetWidth(); nDotSize = aBoundRect.GetHeight(); @@ -5257,7 +4699,7 @@ void OutputDevice::ImplDrawText( SalLayout& rSalLayout ) long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const XubString& rStr, - USHORT nStyle ) const + USHORT nStyle, const ::vcl::ITextLayout& _rLayout ) { DBG_ASSERTWARNING( nWidth >= 0, "ImplGetTextLines: nWidth <= 0!" ); @@ -5295,7 +4737,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, while ( ( nBreakPos < nLen ) && ( rStr.GetChar( nBreakPos ) != _CR ) && ( rStr.GetChar( nBreakPos ) != _LF ) ) nBreakPos++; - long nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos ); + long nLineWidth = _rLayout.GetTextWidth( rStr, nPos, nBreakPos-nPos ); if ( ( nLineWidth > nWidth ) && ( nStyle & TEXT_DRAW_WORDBREAK ) ) { if ( !xBI.is() ) @@ -5304,7 +4746,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, if ( xBI.is() ) { const com::sun::star::lang::Locale& rDefLocale(Application::GetSettings().GetUILocale()); - xub_StrLen nSoftBreak = GetTextBreak( rStr, nWidth, nPos, nBreakPos - nPos ); + xub_StrLen nSoftBreak = _rLayout.GetTextBreak( rStr, nWidth, nPos, nBreakPos - nPos ); DBG_ASSERT( nSoftBreak < nBreakPos, "Break?!" ); //aHyphOptions.hyphenIndex = nSoftBreak; i18n::LineBreakResults aLBR = xBI->getLineBreak( aText, nSoftBreak, rDefLocale, nPos, aHyphOptions, aUserOptions ); @@ -5408,7 +4850,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, } // if ( xHyph.is() ) } // if ( (nStyle & TEXT_DRAW_WORDBREAK_HYPHENATION) == TEXT_DRAW_WORDBREAK_HYPHENATION ) } - nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos ); + nLineWidth = _rLayout.GetTextWidth( rStr, nPos, nBreakPos-nPos ); } else { @@ -5422,14 +4864,14 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, { if( nSpacePos > nPos ) nSpacePos--; - nW = GetTextWidth( rStr, nPos, nSpacePos-nPos ); + nW = _rLayout.GetTextWidth( rStr, nPos, nSpacePos-nPos ); } } while( nW > nWidth ); if( nSpacePos != STRING_NOTFOUND ) { nBreakPos = nSpacePos; - nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos ); + nLineWidth = _rLayout.GetTextWidth( rStr, nPos, nBreakPos-nPos ); if( nBreakPos < rStr.Len()-1 ) nBreakPos++; } @@ -6159,6 +5601,10 @@ void OutputDevice::DrawTextArray( const Point& rStartPt, const String& rStr, if ( !IsDeviceOutputNecessary() ) return; + if( mbInitClipRegion ) + ImplInitClipRegion(); + if( mbOutputClipped ) + return; SalLayout* pSalLayout = ImplLayout( rStr, nIndex, nLen, rStartPt, 0, pDXAry, true ); if( pSalLayout ) @@ -6483,7 +5929,7 @@ SalLayout* OutputDevice::ImplLayout( const String& rOrigStr, // convert from logical units to physical units // recode string if needed if( mpFontEntry->mpConversion ) - ImplRecodeString( mpFontEntry->mpConversion, aStr, 0, aStr.Len() ); + mpFontEntry->mpConversion->RecodeString( aStr, 0, aStr.Len() ); long nPixelWidth = nLogicalWidth; if( nLogicalWidth && mbMap ) @@ -6771,9 +6217,10 @@ xub_StrLen OutputDevice::GetTextBreak( const String& rStr, long nTextWidth, // ----------------------------------------------------------------------- -void OutputDevice::ImplDrawText( const Rectangle& rRect, +void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, - MetricVector* pVector, String* pDisplayText ) + MetricVector* pVector, String* pDisplayText, + ::vcl::ITextLayout& _rLayout ) { Color aOldTextColor; Color aOldTextFillColor; @@ -6782,12 +6229,12 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, { BOOL bHighContrastBlack = FALSE; BOOL bHighContrastWhite = FALSE; - const StyleSettings& rStyleSettings( GetSettings().GetStyleSettings() ); + const StyleSettings& rStyleSettings( rTargetDevice.GetSettings().GetStyleSettings() ); if( rStyleSettings.GetHighContrastMode() ) { Color aCol; - if( IsBackground() ) - aCol = GetBackground().GetColor(); + if( rTargetDevice.IsBackground() ) + aCol = rTargetDevice.GetBackground().GetColor(); else // best guess is the face color here // but it may be totally wrong. the background color @@ -6798,16 +6245,16 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, bHighContrastWhite = aCol.IsBright(); } - aOldTextColor = GetTextColor(); - if ( IsTextFillColor() ) + aOldTextColor = rTargetDevice.GetTextColor(); + if ( rTargetDevice.IsTextFillColor() ) { bRestoreFillColor = TRUE; - aOldTextFillColor = GetTextFillColor(); + aOldTextFillColor = rTargetDevice.GetTextFillColor(); } if( bHighContrastBlack ) - SetTextColor( COL_GREEN ); + rTargetDevice.SetTextColor( COL_GREEN ); else if( bHighContrastWhite ) - SetTextColor( COL_LIGHTGREEN ); + rTargetDevice.SetTextColor( COL_LIGHTGREEN ); else { // draw disabled text always without shadow @@ -6818,7 +6265,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, aRect.Move( 1, 1 ); DrawText( aRect, rOrigStr, nStyle & ~TEXT_DRAW_DISABLE ); */ - SetTextColor( GetSettings().GetStyleSettings().GetDisableColor() ); + rTargetDevice.SetTextColor( rTargetDevice.GetSettings().GetStyleSettings().GetDisableColor() ); } } @@ -6830,14 +6277,16 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, Point aPos = rRect.TopLeft(); - long nTextHeight = GetTextHeight(); - TextAlign eAlign = GetTextAlign(); + long nTextHeight = rTargetDevice.GetTextHeight(); + TextAlign eAlign = rTargetDevice.GetTextAlign(); xub_StrLen nMnemonicPos = STRING_NOTFOUND; String aStr = rOrigStr; if ( nStyle & TEXT_DRAW_MNEMONIC ) aStr = GetNonMnemonicString( aStr, nMnemonicPos ); + const bool bDrawMnemonics = !(rTargetDevice.GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector; + // Mehrzeiligen Text behandeln wir anders if ( nStyle & TEXT_DRAW_MULTILINE ) { @@ -6852,7 +6301,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, if ( nTextHeight ) { - nMaxTextWidth = ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle ); + nMaxTextWidth = ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, _rLayout ); nLines = (xub_StrLen)(nHeight/nTextHeight); nFormatLines = aMultiLineInfo.Count(); if ( !nLines ) @@ -6874,7 +6323,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, if ( aLastLine.GetChar( i ) == _LF ) aLastLine.SetChar( i, ' ' ); } - aLastLine = GetEllipsisString( aLastLine, nWidth, nStyle ); + aLastLine = ImplGetEllipsisString( rTargetDevice, aLastLine, nWidth, nStyle, _rLayout ); nStyle &= ~(TEXT_DRAW_VCENTER | TEXT_DRAW_BOTTOM); nStyle |= TEXT_DRAW_TOP; } @@ -6892,8 +6341,8 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, // Clipping setzen if ( nStyle & TEXT_DRAW_CLIP ) { - Push( PUSH_CLIPREGION ); - IntersectClipRegion( rRect ); + rTargetDevice.Push( PUSH_CLIPREGION ); + rTargetDevice.IntersectClipRegion( rRect ); } // Vertikales Alignment @@ -6906,7 +6355,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, if ( eAlign == ALIGN_BOTTOM ) aPos.Y() += nTextHeight; else if ( eAlign == ALIGN_BASELINE ) - aPos.Y() += GetFontMetric().GetAscent(); + aPos.Y() += rTargetDevice.GetFontMetric().GetAscent(); // Alle Zeilen ausgeben, bis auf die letzte for ( i = 0; i < nFormatLines; i++ ) @@ -6918,8 +6367,8 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, aPos.X() += (nWidth-pLineInfo->GetWidth())/2; xub_StrLen nIndex = pLineInfo->GetIndex(); xub_StrLen nLineLen = pLineInfo->GetLen(); - DrawText( aPos, aStr, nIndex, nLineLen, pVector, pDisplayText ); - if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector ) + _rLayout.DrawText( aPos, aStr, nIndex, nLineLen, pVector, pDisplayText ); + if ( bDrawMnemonics ) { if ( (nMnemonicPos >= nIndex) && (nMnemonicPos < nIndex+nLineLen) ) { @@ -6928,16 +6377,16 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, long nMnemonicWidth; sal_Int32* pCaretXArray = (sal_Int32*) alloca( 2 * sizeof(sal_Int32) * nLineLen ); - /*BOOL bRet =*/ GetCaretPositions( aStr, pCaretXArray, - nIndex, nLineLen); + /*BOOL bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray, + nIndex, nLineLen ); long lc_x1 = pCaretXArray[2*(nMnemonicPos - nIndex)]; long lc_x2 = pCaretXArray[2*(nMnemonicPos - nIndex)+1]; - nMnemonicWidth = ::abs((int)(lc_x1 - lc_x2)); + nMnemonicWidth = rTargetDevice.ImplLogicWidthToDevicePixel( ::abs((int)(lc_x1 - lc_x2)) ); - Point aTempPos = LogicToPixel( aPos ); - nMnemonicX = mnOutOffX + aTempPos.X() + ImplLogicWidthToDevicePixel( Min( lc_x1, lc_x2 ) ); - nMnemonicY = mnOutOffY + aTempPos.Y() + ImplLogicWidthToDevicePixel( GetFontMetric().GetAscent() ); - ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth ); + Point aTempPos = rTargetDevice.LogicToPixel( aPos ); + nMnemonicX = rTargetDevice.GetOutOffXPixel() + aTempPos.X() + rTargetDevice.ImplLogicWidthToDevicePixel( Min( lc_x1, lc_x2 ) ); + nMnemonicY = rTargetDevice.GetOutOffYPixel() + aTempPos.Y() + rTargetDevice.ImplLogicWidthToDevicePixel( rTargetDevice.GetFontMetric().GetAscent() ); + rTargetDevice.ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth ); } } aPos.Y() += nTextHeight; @@ -6948,26 +6397,26 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, // Gibt es noch eine letzte Zeile, dann diese linksbuendig ausgeben, // da die Zeile gekuerzt wurde if ( aLastLine.Len() ) - DrawText( aPos, aLastLine, 0, STRING_LEN, pVector, pDisplayText ); + _rLayout.DrawText( aPos, aLastLine, 0, STRING_LEN, pVector, pDisplayText ); // Clipping zuruecksetzen if ( nStyle & TEXT_DRAW_CLIP ) - Pop(); + rTargetDevice.Pop(); } } else { - long nTextWidth = GetTextWidth( aStr ); + long nTextWidth = _rLayout.GetTextWidth( aStr, 0, STRING_LEN ); // Evt. Text kuerzen if ( nTextWidth > nWidth ) { if ( nStyle & TEXT_DRAW_ELLIPSIS ) { - aStr = GetEllipsisString( aStr, nWidth, nStyle ); + aStr = ImplGetEllipsisString( rTargetDevice, aStr, nWidth, nStyle, _rLayout ); nStyle &= ~(TEXT_DRAW_CENTER | TEXT_DRAW_RIGHT); nStyle |= TEXT_DRAW_LEFT; - nTextWidth = GetTextWidth( aStr ); + nTextWidth = _rLayout.GetTextWidth( aStr, 0, aStr.Len() ); } } else @@ -6986,7 +6435,7 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, if ( eAlign == ALIGN_BOTTOM ) aPos.Y() += nTextHeight; else if ( eAlign == ALIGN_BASELINE ) - aPos.Y() += GetFontMetric().GetAscent(); + aPos.Y() += rTargetDevice.GetFontMetric().GetAscent(); if ( nStyle & TEXT_DRAW_BOTTOM ) aPos.Y() += nHeight-nTextHeight; @@ -6999,44 +6448,44 @@ void OutputDevice::ImplDrawText( const Rectangle& rRect, if ( nMnemonicPos != STRING_NOTFOUND ) { sal_Int32* pCaretXArray = (sal_Int32*) alloca( 2 * sizeof(sal_Int32) * aStr.Len() ); - /*BOOL bRet =*/ GetCaretPositions( aStr, pCaretXArray, 0, aStr.Len() ); + /*BOOL bRet =*/ _rLayout.GetCaretPositions( aStr, pCaretXArray, 0, aStr.Len() ); long lc_x1 = pCaretXArray[2*(nMnemonicPos)]; long lc_x2 = pCaretXArray[2*(nMnemonicPos)+1]; - nMnemonicWidth = ::abs((int)(lc_x1 - lc_x2)); + nMnemonicWidth = rTargetDevice.ImplLogicWidthToDevicePixel( ::abs((int)(lc_x1 - lc_x2)) ); - Point aTempPos = LogicToPixel( aPos ); - nMnemonicX = mnOutOffX + aTempPos.X() + ImplLogicWidthToDevicePixel( Min(lc_x1, lc_x2) ); - nMnemonicY = mnOutOffY + aTempPos.Y() + ImplLogicWidthToDevicePixel( GetFontMetric().GetAscent() ); + Point aTempPos = rTargetDevice.LogicToPixel( aPos ); + nMnemonicX = rTargetDevice.GetOutOffXPixel() + aTempPos.X() + rTargetDevice.ImplLogicWidthToDevicePixel( Min(lc_x1, lc_x2) ); + nMnemonicY = rTargetDevice.GetOutOffYPixel() + aTempPos.Y() + rTargetDevice.ImplLogicWidthToDevicePixel( rTargetDevice.GetFontMetric().GetAscent() ); } if ( nStyle & TEXT_DRAW_CLIP ) { - Push( PUSH_CLIPREGION ); - IntersectClipRegion( rRect ); - DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); - if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector ) + rTargetDevice.Push( PUSH_CLIPREGION ); + rTargetDevice.IntersectClipRegion( rRect ); + _rLayout.DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); + if ( bDrawMnemonics ) { if ( nMnemonicPos != STRING_NOTFOUND ) - ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth ); + rTargetDevice.ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth ); } - Pop(); + rTargetDevice.Pop(); } else { - DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); - if ( !(GetSettings().GetStyleSettings().GetOptions() & STYLE_OPTION_NOMNEMONICS) && !pVector ) + _rLayout.DrawText( aPos, aStr, 0, STRING_LEN, pVector, pDisplayText ); + if ( bDrawMnemonics ) { if ( nMnemonicPos != STRING_NOTFOUND ) - ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth ); + rTargetDevice.ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth ); } } } if ( nStyle & TEXT_DRAW_DISABLE && !pVector ) { - SetTextColor( aOldTextColor ); + rTargetDevice.SetTextColor( aOldTextColor ); if ( bRestoreFillColor ) - SetTextFillColor( aOldTextFillColor ); + rTargetDevice.SetTextFillColor( aOldTextFillColor ); } } @@ -7069,7 +6518,8 @@ void OutputDevice::AddTextRectActions( const Rectangle& rRect, // #i47157# Factored out to ImplDrawTextRect(), to be shared // between us and DrawText() - ImplDrawText( rRect, rOrigStr, nStyle, NULL, NULL ); + DefaultTextLayout aLayout( *this ); + ImplDrawText( *this, rRect, rOrigStr, nStyle, NULL, NULL, aLayout ); // and restore again EnableOutput( bOutputEnabled ); @@ -7078,10 +6528,9 @@ void OutputDevice::AddTextRectActions( const Rectangle& rRect, // ----------------------------------------------------------------------- -void OutputDevice::DrawText( const Rectangle& rRect, - const String& rOrigStr, USHORT nStyle, - MetricVector* pVector, String* pDisplayText ) - +void OutputDevice::DrawText( const Rectangle& rRect, const String& rOrigStr, USHORT nStyle, + MetricVector* pVector, String* pDisplayText, + ::vcl::ITextLayout* _pTextLayout ) { if( mpOutDevData && mpOutDevData->mpRecordLayout ) { @@ -7092,10 +6541,11 @@ void OutputDevice::DrawText( const Rectangle& rRect, DBG_TRACE( "OutputDevice::DrawText( const Rectangle& )" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); - if ( mpMetaFile ) + bool bDecomposeTextRectAction = ( _pTextLayout != NULL ) && _pTextLayout->DecomposeTextRectAction(); + if ( mpMetaFile && !bDecomposeTextRectAction ) mpMetaFile->AddAction( new MetaTextRectAction( rRect, rOrigStr, nStyle ) ); - if ( ( !IsDeviceOutputNecessary() && ! pVector ) || !rOrigStr.Len() || rRect.IsEmpty() ) + if ( ( !IsDeviceOutputNecessary() && !pVector && !bDecomposeTextRectAction ) || !rOrigStr.Len() || rRect.IsEmpty() ) return; // we need a graphics @@ -7103,17 +6553,19 @@ void OutputDevice::DrawText( const Rectangle& rRect, return; if( mbInitClipRegion ) ImplInitClipRegion(); - if( mbOutputClipped ) + if( mbOutputClipped && !bDecomposeTextRectAction ) return; // temporarily disable mtf action generation (ImplDrawText _does_ // create META_TEXT_ACTIONs otherwise) GDIMetaFile* pMtf = mpMetaFile; - mpMetaFile = NULL; + if ( !bDecomposeTextRectAction ) + mpMetaFile = NULL; - // #i47157# Factored out to ImplDrawTextRect(), to be used also + // #i47157# Factored out to ImplDrawText(), to be used also // from AddTextRectActions() - ImplDrawText( rRect, rOrigStr, nStyle, pVector, pDisplayText ); + DefaultTextLayout aDefaultLayout( *this ); + ImplDrawText( *this, rRect, rOrigStr, nStyle, pVector, pDisplayText, _pTextLayout ? *_pTextLayout : aDefaultLayout ); // and enable again mpMetaFile = pMtf; @@ -7125,8 +6577,9 @@ void OutputDevice::DrawText( const Rectangle& rRect, // ----------------------------------------------------------------------- Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, - const String& rOrigStr, USHORT nStyle, - TextRectInfo* pInfo ) const + const XubString& rStr, USHORT nStyle, + TextRectInfo* pInfo, + const ::vcl::ITextLayout* _pTextLayout ) const { DBG_TRACE( "OutputDevice::GetTextRect()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); @@ -7137,7 +6590,7 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, long nMaxWidth; long nTextHeight = GetTextHeight(); - String aStr = rOrigStr; + String aStr = rStr; if ( nStyle & TEXT_DRAW_MNEMONIC ) aStr = GetNonMnemonicString( aStr ); @@ -7149,7 +6602,8 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, xub_StrLen i; nMaxWidth = 0; - ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle ); + DefaultTextLayout aDefaultLayout( *const_cast< OutputDevice* >( this ) ); + ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, _pTextLayout ? *_pTextLayout : aDefaultLayout ); nFormatLines = aMultiLineInfo.Count(); if ( !nTextHeight ) nTextHeight = 1; @@ -7197,7 +6651,7 @@ Rectangle OutputDevice::GetTextRect( const Rectangle& rRect, else { nLines = 1; - nMaxWidth = GetTextWidth( aStr ); + nMaxWidth = _pTextLayout ? _pTextLayout->GetTextWidth( aStr, 0, aStr.Len() ) : GetTextWidth( aStr ); if ( pInfo ) { @@ -7256,11 +6710,20 @@ static BOOL ImplIsCharIn( xub_Unicode c, const sal_Char* pStr ) String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, USHORT nStyle ) const { - DBG_TRACE( "OutputDevice::GetEllipsisString()" ); DBG_CHKTHIS( OutputDevice, ImplDbgCheckOutputDevice ); + DefaultTextLayout aTextLayout( *const_cast< OutputDevice* >( this ) ); + return ImplGetEllipsisString( *this, rOrigStr, nMaxWidth, nStyle, aTextLayout ); +} + +// ----------------------------------------------------------------------- + +String OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, const XubString& rOrigStr, long nMaxWidth, + USHORT nStyle, const ::vcl::ITextLayout& _rLayout ) +{ + DBG_TRACE( "OutputDevice::ImplGetEllipsisString()" ); String aStr = rOrigStr; - xub_StrLen nIndex = GetTextBreak( aStr, nMaxWidth ); + xub_StrLen nIndex = _rLayout.GetTextBreak( aStr, nMaxWidth, 0, aStr.Len() ); if ( nIndex != STRING_LEN ) @@ -7271,7 +6734,7 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, if ( nIndex > 1 ) { aStr.AppendAscii( "..." ); - while ( aStr.Len() && (GetTextWidth( aStr ) > nMaxWidth) ) + while ( aStr.Len() && (_rLayout.GetTextWidth( aStr, 0, aStr.Len() ) > nMaxWidth) ) { if ( (nIndex > 1) || (nIndex == aStr.Len()) ) nIndex--; @@ -7307,8 +6770,8 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, XubString aLastStr( aStr, nLastContent, aStr.Len() ); XubString aTempLastStr1( RTL_CONSTASCII_USTRINGPARAM( "..." ) ); aTempLastStr1 += aLastStr; - if ( GetTextWidth( aTempLastStr1 ) > nMaxWidth ) - aStr = GetEllipsisString( aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS ); + if ( _rLayout.GetTextWidth( aTempLastStr1, 0, aTempLastStr1.Len() ) > nMaxWidth ) + aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS, _rLayout ); else { USHORT nFirstContent = 0; @@ -7323,7 +6786,7 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, nFirstContent++; if ( nFirstContent >= nLastContent ) - aStr = GetEllipsisString( aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS ); + aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS, _rLayout ); else { if ( nFirstContent > 4 ) @@ -7332,8 +6795,8 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, aFirstStr.AppendAscii( "..." ); XubString aTempStr = aFirstStr; aTempStr += aLastStr; - if ( GetTextWidth( aTempStr ) > nMaxWidth ) - aStr = GetEllipsisString( aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS ); + if ( _rLayout.GetTextWidth( aTempStr, 0, aTempStr.Len() ) > nMaxWidth ) + aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, aStr, nMaxWidth, nStyle | TEXT_DRAW_ENDELLIPSIS, _rLayout ); else { do @@ -7357,7 +6820,7 @@ String OutputDevice::GetEllipsisString( const String& rOrigStr, long nMaxWidth, XubString aTempLastStr( aStr, nLastContent, aStr.Len() ); aTempStr = aFirstStr; aTempStr += aTempLastStr; - if ( GetTextWidth( aTempStr ) > nMaxWidth ) + if ( _rLayout.GetTextWidth( aTempStr, 0, aTempStr.Len() ) > nMaxWidth ) break; } } diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx index 79986988afd7..2d436ea43659 100644 --- a/vcl/source/gdi/outdev6.cxx +++ b/vcl/source/gdi/outdev6.cxx @@ -1158,9 +1158,11 @@ void OutputDevice::ImplDraw2ColorFrame( const Rectangle& rRect, // ----------------------------------------------------------------------- -void OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize, +bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize, const GfxLink& rGfxLink, GDIMetaFile* pSubst ) { + bool bDrawn(true); + if ( mpMetaFile ) { GDIMetaFile aSubst; @@ -1172,20 +1174,20 @@ void OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize, } if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() ) - return; + return bDrawn; if( mbOutputClipped ) - return; + return bDrawn; Rectangle aRect( ImplLogicToDevicePixel( Rectangle( rPoint, rSize ) ) ); + if( !aRect.IsEmpty() ) { // draw the real EPS graphics - bool bDrawn = FALSE; if( rGfxLink.GetData() && rGfxLink.GetDataSize() ) { if( !mpGraphics && !ImplGetGraphics() ) - return; + return bDrawn; if( mbInitClipRegion ) ImplInitClipRegion(); @@ -1208,4 +1210,6 @@ void OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize, if( mpAlphaVDev ) mpAlphaVDev->DrawEPS( rPoint, rSize, rGfxLink, pSubst ); + + return bDrawn; } diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index a7d91abcbd5f..9c8c1ec1bf5e 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -283,8 +283,6 @@ struct PageSyncData std::deque< Graphic > mGraphics; std::deque< ::boost::shared_ptr< PDFWriter::AnyWidget > > mControls; - std::set< ::rtl::OUString > mControlNames; - GlobalSyncData* mpGlobalData; sal_Bool mbGroupIgnoreGDIMtfActions; @@ -375,7 +373,6 @@ sal_Bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIM if ( pControl.get() ) rWriter.CreateControl( *pControl ); mControls.pop_front(); - mControlNames.erase( pControl->Name ); } break; case PDFExtOutDevDataSync::BeginGroup : @@ -772,16 +769,6 @@ void PDFExtOutDevData::CreateControl( const PDFWriter::AnyWidget& rControlType, mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::CreateControl ); ::boost::shared_ptr< PDFWriter::AnyWidget > pClone( rControlType.Clone() ); - // ensure a unique name - ::rtl::OUString sUniqueName( pClone->Name ); - sal_Int32 nUniqueNumber( 0 ); - while ( mpPageSyncData->mControlNames.find( sUniqueName ) != mpPageSyncData->mControlNames.end() ) - { - sUniqueName = pClone->Name + ::rtl::OUString::valueOf( ++nUniqueNumber ); - } - pClone->Name = sUniqueName; - mpPageSyncData->mControlNames.insert( pClone->Name ); - mpPageSyncData->mControls.push_back( pClone ); } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index e7ee18ec7705..c0205f1f325d 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -41,7 +41,6 @@ #include <tools/debug.hxx> #include <tools/zcodec.hxx> #include <tools/stream.hxx> -#include <tools/urlobj.hxx> //for relative url #include <i18npool/mslangid.hxx> #include <vcl/virdev.hxx> #include <vcl/bmpacc.hxx> @@ -51,6 +50,7 @@ #include <vcl/sallayout.hxx> #include <vcl/metric.hxx> #include <vcl/fontsubset.hxx> +#include <vcl/textlayout.hxx> #include <svsys.h> #include <vcl/salgdi.hxx> #include <vcl/svapp.hxx> @@ -61,11 +61,9 @@ #include <comphelper/processfactory.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/util/URL.hpp> - -#include "implncvt.hxx" - #include "cppuhelper/implbase1.hxx" #include <icc/sRGB-IEC61966-2.1.hxx> +#include <vcl/lineinfo.hxx> using namespace vcl; using namespace rtl; @@ -667,26 +665,29 @@ OString PDFWriterImpl::convertWidgetFieldName( const rtl::OUString& rString ) } OString aRet = aBuffer.makeStringAndClear(); - std::hash_map<OString, sal_Int32, OStringHash>::iterator it = m_aFieldNameMap.find( aRet ); - - if( it != m_aFieldNameMap.end() ) // not unique + if( ! m_aContext.AllowDuplicateFieldNames ) { - std::hash_map< OString, sal_Int32, OStringHash >::const_iterator check_it; - OString aTry; - do + std::hash_map<OString, sal_Int32, OStringHash>::iterator it = m_aFieldNameMap.find( aRet ); + + if( it != m_aFieldNameMap.end() ) // not unique { - OStringBuffer aUnique( aRet.getLength() + 16 ); - aUnique.append( aRet ); - aUnique.append( '_' ); - aUnique.append( it->second ); - it->second++; - aTry = aUnique.makeStringAndClear(); - check_it = m_aFieldNameMap.find( aTry ); - } while( check_it != m_aFieldNameMap.end() ); - aRet = aTry; + std::hash_map< OString, sal_Int32, OStringHash >::const_iterator check_it; + OString aTry; + do + { + OStringBuffer aUnique( aRet.getLength() + 16 ); + aUnique.append( aRet ); + aUnique.append( '_' ); + aUnique.append( it->second ); + it->second++; + aTry = aUnique.makeStringAndClear(); + check_it = m_aFieldNameMap.find( aTry ); + } while( check_it != m_aFieldNameMap.end() ); + aRet = aTry; + } + else + m_aFieldNameMap[ aRet ] = 2; } - else - m_aFieldNameMap[ aRet ] = 2; return aRet; } @@ -2844,6 +2845,121 @@ static bool getPfbSegmentLengths( const unsigned char* pFontBytes, int nByteLen, return true; } +std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const ImplFontData* pFont, EmbedFont& rEmbed ) +{ + std::map< sal_Int32, sal_Int32 > aRet; + if( isBuiltinFont( pFont ) ) + { + aRet[ rEmbed.m_nNormalFontID ] = emitBuiltinFont( pFont ); + return aRet; + } + + sal_Int32 nFontObject = 0; + sal_Int32 nFontDescriptor = 0; + rtl::OString aSubType( "/Type1" ); + FontSubsetInfo aInfo; + // fill in dummy values + aInfo.m_nAscent = 1000; + aInfo.m_nDescent = 200; + aInfo.m_nCapHeight = 1000; + aInfo.m_aFontBBox = Rectangle( Point( -200, -200 ), Size( 1700, 1700 ) ); + aInfo.m_aPSName = pFont->maName; + sal_Int32 pWidths[256]; + rtl_zeroMemory( pWidths, sizeof(pWidths) ); + if( pFont->IsEmbeddable() ) + { + const unsigned char* pFontData = NULL; + long nFontLen = 0; + sal_Ucs nEncodedCodes[256]; + sal_Int32 pEncWidths[256]; + if( (pFontData = (const unsigned char*)m_pReferenceDevice->mpGraphics->GetEmbedFontData( pFont, nEncodedCodes, pEncWidths, aInfo, &nFontLen )) != NULL ) + { + m_pReferenceDevice->mpGraphics->FreeEmbedFontData( pFontData, nFontLen ); + for( int i = 0; i < 256; i++ ) + { + if( nEncodedCodes[i] >= 32 && nEncodedCodes[i] < 256 ) + { + pWidths[i] = pEncWidths[ i ]; + } + } + } + } + else if( pFont->mbSubsettable ) + { + aSubType = rtl::OString( "/TrueType" ); + Int32Vector aGlyphWidths; + Ucs2UIntMap aUnicodeMap; + m_pReferenceDevice->mpGraphics->GetGlyphWidths( pFont, false, aGlyphWidths, aUnicodeMap ); + + OUString aTmpName; + osl_createTempFile( NULL, NULL, &aTmpName.pData ); + sal_Int32 pGlyphIDs[ 256 ]; + sal_uInt8 pEncoding[ 256 ]; + sal_Ucs pUnicodes[ 256 ]; + sal_Int32 pDuWidths[ 256 ]; + + memset( pGlyphIDs, 0, sizeof( pGlyphIDs ) ); + memset( pEncoding, 0, sizeof( pEncoding ) ); + memset( pUnicodes, 0, sizeof( pUnicodes ) ); + memset( pDuWidths, 0, sizeof( pDuWidths ) ); + + for( sal_Ucs c = 32; c < 256; c++ ) + { + pUnicodes[c] = c; + pEncoding[c] = c; + pGlyphIDs[c] = 0; + if( aUnicodeMap.find( c ) != aUnicodeMap.end() ) + pWidths[ c ] = aGlyphWidths[ aUnicodeMap[ c ] ]; + } + + m_pReferenceDevice->mpGraphics->CreateFontSubset( aTmpName, pFont, pGlyphIDs, pEncoding, pDuWidths, 256, aInfo ); + osl_removeFile( aTmpName.pData ); + } + else + { + DBG_ERROR( "system font neither embeddable nor subsettable" ); + } + + // write font descriptor + nFontDescriptor = emitFontDescriptor( pFont, aInfo, 0, 0 ); + if( nFontDescriptor ) + { + // write font object + sal_Int32 nObject = createObject(); + if( updateObject( nObject ) ) + { + OStringBuffer aLine( 1024 ); + aLine.append( nObject ); + aLine.append( " 0 obj\n" + "<</Type/Font/Subtype" ); + aLine.append( aSubType ); + aLine.append( "/BaseFont/" ); + appendName( aInfo.m_aPSName, aLine ); + aLine.append( "\n" ); + if( !pFont->mbSymbolFlag ) + aLine.append( "/Encoding/WinAnsiEncoding\n" ); + aLine.append( "/FirstChar 32 /LastChar 255\n" + "/Widths[" ); + for( int i = 32; i < 256; i++ ) + { + aLine.append( pWidths[i] ); + aLine.append( ((i&15) == 15) ? "\n" : " " ); + } + aLine.append( "]\n" + "/FontDescriptor " ); + aLine.append( nFontDescriptor ); + aLine.append( " 0 R>>\n" + "endobj\n\n" ); + writeBuffer( aLine.getStr(), aLine.getLength() ); + + nFontObject = nObject; + aRet[ rEmbed.m_nNormalFontID ] = nObject; + } + } + + return aRet; +} + // TODO: always subset instead of embedding the full font => this method becomes obsolete then std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFontData* pFont, EmbedFont& rEmbed ) { @@ -3603,23 +3719,28 @@ sal_Int32 PDFWriterImpl::emitFontDescriptor( const ImplFontData* pFont, FontSubs // According to PDF reference 1.4 StemV is required // seems a tad strange to me, but well ... aLine.append( "\n" - "/StemV 80\n" - "/FontFile" ); - switch( rInfo.m_nFontType ) + "/StemV 80\n" ); + if( nFontStream ) { - case FontSubsetInfo::SFNT_TTF: - aLine.append( '2' ); - break; - case FontSubsetInfo::TYPE1_PFA: - case FontSubsetInfo::TYPE1_PFB: - break; - default: - DBG_ERROR( "unknown fonttype in PDF font descriptor" ); - return 0; + aLine.append( "/FontFile" ); + switch( rInfo.m_nFontType ) + { + case FontSubsetInfo::SFNT_TTF: + aLine.append( '2' ); + break; + case FontSubsetInfo::TYPE1_PFA: + case FontSubsetInfo::TYPE1_PFB: + case FontSubsetInfo::ANY_TYPE1: + break; + default: + DBG_ERROR( "unknown fonttype in PDF font descriptor" ); + return 0; + } + aLine.append( ' ' ); + aLine.append( nFontStream ); + aLine.append( " 0 R\n" ); } - aLine.append( ' ' ); - aLine.append( nFontStream ); - aLine.append( " 0 R>>\n" + aLine.append( ">>\n" "endobj\n\n" ); CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) ); @@ -3876,6 +3997,17 @@ bool PDFWriterImpl::emitFonts() } } + // emit system fonts + for( FontEmbedData::iterator sit = m_aSystemFonts.begin(); sit != m_aSystemFonts.end(); ++sit ) + { + std::map< sal_Int32, sal_Int32 > aObjects = emitSystemFont( sit->first, sit->second ); + for( std::map< sal_Int32, sal_Int32 >::iterator fit = aObjects.begin(); fit != aObjects.end(); ++fit ) + { + CHECK_RETURN( fit->second ); + aFontIDToObject[ fit->first ] = fit->second; + } + } + OStringBuffer aFontDict( 1024 ); aFontDict.append( getFontDictObject() ); aFontDict.append( " 0 obj\n" @@ -4576,13 +4708,25 @@ void PDFWriterImpl::createDefaultEditAppearance( PDFWidget& rEdit, const PDFWrit // prepare font to use, draw field border Font aFont = drawFieldBorder( rEdit, rWidget, rSettings ); - sal_Int32 nBest = getBestBuiltinFont( aFont ); + sal_Int32 nBest = m_aContext.FieldsUseSystemFonts ? getSystemFont( aFont ): getBestBuiltinFont( aFont ); // prepare DA string OStringBuffer aDA( 32 ); appendNonStrokingColor( replaceColor( rWidget.TextColor, rSettings.GetFieldTextColor() ), aDA ); aDA.append( ' ' ); - aDA.append( m_aBuiltinFonts[nBest].getNameObject() ); + if( m_aContext.FieldsUseSystemFonts ) + { + aDA.append( "/F" ); + aDA.append( nBest ); + + OStringBuffer aDR( 32 ); + aDR.append( "/Font " ); + aDR.append( getFontDictObject() ); + aDR.append( " 0 R" ); + rEdit.m_aDRDict = aDR.makeStringAndClear(); + } + else + aDA.append( m_aBuiltinFonts[nBest].getNameObject() ); aDA.append( ' ' ); m_aPages[ m_nCurrentPage ].appendMappedLength( sal_Int32( aFont.GetHeight() ), aDA ); aDA.append( " Tf" ); @@ -4616,7 +4760,7 @@ void PDFWriterImpl::createDefaultListBoxAppearance( PDFWidget& rBox, const PDFWr // prepare font to use, draw field border Font aFont = drawFieldBorder( rBox, rWidget, rSettings ); - sal_Int32 nBest = getBestBuiltinFont( aFont ); + sal_Int32 nBest = m_aContext.FieldsUseSystemFonts ? getSystemFont( aFont ): getBestBuiltinFont( aFont ); beginRedirect( pListBoxStream, rBox.m_aRect ); OStringBuffer aAppearance( 64 ); @@ -4664,9 +4808,22 @@ void PDFWriterImpl::createDefaultListBoxAppearance( PDFWidget& rBox, const PDFWr aDA.append( " 2 Tr " ); } #endif + // prepare DA string appendNonStrokingColor( replaceColor( rWidget.TextColor, rSettings.GetFieldTextColor() ), aDA ); aDA.append( ' ' ); - aDA.append( m_aBuiltinFonts[nBest].getNameObject() ); + if( m_aContext.FieldsUseSystemFonts ) + { + aDA.append( "/F" ); + aDA.append( nBest ); + + OStringBuffer aDR( 32 ); + aDR.append( "/Font " ); + aDR.append( getFontDictObject() ); + aDR.append( " 0 R" ); + rBox.m_aDRDict = aDR.makeStringAndClear(); + } + else + aDA.append( m_aBuiltinFonts[nBest].getNameObject() ); aDA.append( ' ' ); m_aPages[ m_nCurrentPage ].appendMappedLength( sal_Int32( aFont.GetHeight() ), aDA ); aDA.append( " Tf" ); @@ -5243,9 +5400,18 @@ bool PDFWriterImpl::emitWidgetAnnotations() } if( rWidget.m_aDAString.getLength() ) { - aLine.append( "/DR<</Font<<" ); - appendBuiltinFontsToDict( aLine ); - aLine.append( ">>>>\n" ); + if( rWidget.m_aDRDict.getLength() ) + { + aLine.append( "/DR<<" ); + aLine.append( rWidget.m_aDRDict ); + aLine.append( ">>\n" ); + } + else + { + aLine.append( "/DR<</Font<<" ); + appendBuiltinFontsToDict( aLine ); + aLine.append( ">>>>\n" ); + } aLine.append( "/DA" ); appendLiteralStringEncrypt( rWidget.m_aDAString, rWidget.m_nObject, aLine ); aLine.append( "\n" ); @@ -6386,6 +6552,29 @@ std::set< PDFWriter::ErrorCode > PDFWriterImpl::getErrors() return m_aErrors; } +sal_Int32 PDFWriterImpl::getSystemFont( const Font& i_rFont ) +{ + getReferenceDevice()->Push(); + getReferenceDevice()->SetFont( i_rFont ); + getReferenceDevice()->ImplNewFont(); + + const ImplFontData* pDevFont = m_pReferenceDevice->mpFontEntry->maFontSelData.mpFontData; + sal_Int32 nFontID = 0; + FontEmbedData::iterator it = m_aSystemFonts.find( pDevFont ); + if( it != m_aSystemFonts.end() ) + nFontID = it->second.m_nNormalFontID; + else + { + nFontID = m_nNextFID++; + m_aSystemFonts[ pDevFont ] = EmbedFont(); + m_aSystemFonts[ pDevFont ].m_nNormalFontID = nFontID; + } + + getReferenceDevice()->Pop(); + getReferenceDevice()->ImplNewFont(); + + return nFontID; +} void PDFWriterImpl::registerGlyphs( int nGlyphs, sal_GlyphId* pGlyphs, @@ -7307,7 +7496,8 @@ void PDFWriterImpl::drawText( const Rectangle& rRect, const String& rOrigStr, US if ( nTextHeight ) { - nMaxTextWidth = m_pReferenceDevice->ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle ); + ::vcl::DefaultTextLayout aLayout( *m_pReferenceDevice ); + nMaxTextWidth = OutputDevice::ImplGetTextLines( aMultiLineInfo, nWidth, aStr, nStyle, aLayout ); nLines = (xub_StrLen)(nHeight/nTextHeight); nFormatLines = aMultiLineInfo.Count(); if ( !nLines ) @@ -8792,6 +8982,13 @@ bool PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject ) aLine.append( ' ' ); appendFixedInt( rObject.m_aBoundRect.Bottom()+1, aLine ); aLine.append( " ]\n" ); + if( ! rObject.m_pSoftMaskStream ) + { + if( ! m_bIsPDF_A1 ) + { + aLine.append( "/Group<</S/Transparency/CS/DeviceRGB/K true>>\n" ); + } + } /* #i42884# the PDF reference recommends that each Form XObject * should have a resource dict; alas if that is the same object * as the one of the page it triggers an endless recursion in @@ -10133,12 +10330,17 @@ void PDFWriterImpl::setFont( const Font& rFont ) void PDFWriterImpl::push( sal_uInt16 nFlags ) { + OSL_ENSURE( m_aGraphicsStack.size() > 0, "invalid graphics stack" ); m_aGraphicsStack.push_front( m_aGraphicsStack.front() ); m_aGraphicsStack.front().m_nFlags = nFlags; } void PDFWriterImpl::pop() { + OSL_ENSURE( m_aGraphicsStack.size() > 1, "pop without push" ); + if( m_aGraphicsStack.size() < 2 ) + return; + GraphicsState aState = m_aGraphicsStack.front(); m_aGraphicsStack.pop_front(); GraphicsState& rOld = m_aGraphicsStack.front(); diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 7d5ec2bf4f61..e058cfa487db 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -311,6 +311,8 @@ public: { sal_Int32 m_nNormalFontID; std::list< EmbedEncoding > m_aExtendedEncodings; + + EmbedFont() : m_nNormalFontID( 0 ) {} }; typedef std::map< const ImplFontData*, EmbedFont > FontEmbedData; @@ -396,6 +398,7 @@ public: USHORT m_nTextStyle; rtl::OUString m_aValue; rtl::OString m_aDAString; + rtl::OString m_aDRDict; rtl::OString m_aMKDict; rtl::OString m_aMKDictCAString; // i12626, added to be able to encrypt the /CA text string // since the object number is not known at the moment @@ -612,6 +615,7 @@ private: FontSubsetData m_aSubsets; bool m_bEmbedStandardFonts; FontEmbedData m_aEmbeddedFonts; + FontEmbedData m_aSystemFonts; sal_Int32 m_nNextFID; PDFFontCache m_aFontCache; @@ -679,6 +683,7 @@ private: m_aOverlineColor( COL_TRANSPARENT ), m_nAntiAlias( 1 ), m_nLayoutMode( 0 ), + m_aDigitLanguage( 0 ), m_nTransparentPercent( 0 ), m_nFlags( 0xffff ), m_nUpdateFlags( 0xffff ) @@ -693,6 +698,7 @@ private: m_aClipRegion( rState.m_aClipRegion ), m_nAntiAlias( rState.m_nAntiAlias ), m_nLayoutMode( rState.m_nLayoutMode ), + m_aDigitLanguage( rState.m_aDigitLanguage ), m_nTransparentPercent( rState.m_nTransparentPercent ), m_nFlags( rState.m_nFlags ), m_nUpdateFlags( rState.m_nUpdateFlags ) @@ -710,6 +716,7 @@ private: m_aClipRegion = rState.m_aClipRegion; m_nAntiAlias = rState.m_nAntiAlias; m_nLayoutMode = rState.m_nLayoutMode; + m_aDigitLanguage = rState.m_aDigitLanguage; m_nTransparentPercent = rState.m_nTransparentPercent; m_nFlags = rState.m_nFlags; m_nUpdateFlags = rState.m_nUpdateFlags; @@ -897,6 +904,8 @@ i12626 sal_Int32 emitBuiltinFont( const ImplFontData*, sal_Int32 nObject = -1 ); /* writes a type1 embedded font object and returns its mapping from font ids to object ids (or 0 in case of failure ) */ std::map< sal_Int32, sal_Int32 > emitEmbeddedFont( const ImplFontData*, EmbedFont& ); + /* writes a type1 system font object and returns its mapping from font ids to object ids (or 0 in case of failure ) */ + std::map< sal_Int32, sal_Int32 > emitSystemFont( const ImplFontData*, EmbedFont& ); /* writes a font descriptor and returns its object id (or 0) */ sal_Int32 emitFontDescriptor( const ImplFontData*, FontSubsetInfo&, sal_Int32 nSubsetID, sal_Int32 nStream ); /* writes a ToUnicode cmap, returns the corresponding stream object */ @@ -983,6 +992,7 @@ i12626 sal_Int32 findRadioGroupWidget( const PDFWriter::RadioButtonWidget& rRadio ); Font replaceFont( const Font& rControlFont, const Font& rAppSetFont ); sal_Int32 getBestBuiltinFont( const Font& rFont ); + sal_Int32 getSystemFont( const Font& i_rFont ); // used for edit and listbox Font drawFieldBorder( PDFWidget&, const PDFWriter::AnyWidget&, const StyleSettings& ); diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 937d966b3978..16f6b53af7a8 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: print.cxx,v $ - * $Revision: 1.65 $ + * $Revision: 1.65.114.1 $ * * This file is part of OpenOffice.org. * @@ -31,8 +31,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#define _SPOOLPRINTER_EXT -#define _RMPRINTER_EXT #define ENABLE_BYTESTRING_STREAM_OPERATORS #include <list> @@ -58,7 +56,6 @@ #include <vcl/print.h> #include <vcl/gdimtf.hxx> #include <vcl/metaact.hxx> -#include <vcl/impprn.hxx> #include <vcl/print.hxx> #include <comphelper/processfactory.hxx> @@ -280,7 +277,9 @@ static void ImplInitPrnQueueList() pSVData->maGDIData.mpPrinterQueueList = new ImplPrnQueueList; - pSVData->mpDefInst->GetPrinterQueueInfo( pSVData->maGDIData.mpPrinterQueueList ); + static const char* pEnv = getenv( "SAL_DISABLE_PRINTERLIST" ); + if( !pEnv || !*pEnv ) + pSVData->mpDefInst->GetPrinterQueueInfo( pSVData->maGDIData.mpPrinterQueueList ); } // ----------------------------------------------------------------------- @@ -339,16 +338,20 @@ const QueueInfo* Printer::GetQueueInfo( const String& rPrinterName, bool bStatus XubString Printer::GetDefaultPrinterName() { - ImplSVData* pSVData = ImplGetSVData(); + static const char* pEnv = getenv( "SAL_DISABLE_DEFAULTPRINTER" ); + if( !pEnv || !*pEnv ) + { + ImplSVData* pSVData = ImplGetSVData(); - return pSVData->mpDefInst->GetDefaultPrinter(); + return pSVData->mpDefInst->GetDefaultPrinter(); + } + return XubString(); } // ======================================================================= void Printer::ImplInitData() { - mpPrinterData = new ImplPrivatePrinterData(); mbDevOutput = FALSE; meOutDevType = OUTDEV_PRINTER; mbDefPrinter = FALSE; @@ -366,8 +369,6 @@ void Printer::ImplInitData() mpInfoPrinter = NULL; mpPrinter = NULL; mpDisplayDev = NULL; - mpQPrinter = NULL; - mpQMtf = NULL; mbIsQueuePrinter = FALSE; mpPrinterOptions = new PrinterOptions; @@ -414,7 +415,6 @@ void Printer::ImplInit( SalPrinterQueueInfo* pInfo ) mpInfoPrinter = pSVData->mpDefInst->CreateInfoPrinter( pInfo, pJobSetup ); mpPrinter = NULL; - mpJobPrinter = NULL; mpJobGraphics = NULL; ImplUpdateJobSetupPaper( maJobSetup ); @@ -446,7 +446,6 @@ void Printer::ImplInitDisplay( const Window* pWindow ) mpInfoPrinter = NULL; mpPrinter = NULL; - mpJobPrinter = NULL; mpJobGraphics = NULL; if ( pWindow ) @@ -518,6 +517,26 @@ void Printer::ImplUpdatePageData() mnOutWidth, mnOutHeight, maPageOffset.X(), maPageOffset.Y(), maPaperSize.Width(), maPaperSize.Height() ); + static const char* pDebugOffset = getenv( "SAL_DBG_PAGEOFFSET" ); + if( pDebugOffset ) + { + rtl::OString aLine( pDebugOffset ); + sal_Int32 nIndex = 0; + rtl::OString aToken( aLine.getToken( 0, ',', nIndex ) ); + sal_Int32 nLeft = aToken.toInt32(); + sal_Int32 nTop = nLeft; + if( nIndex > 0 ) + { + aToken = aLine.getToken( 0, ',', nIndex ); + nTop = aToken.toInt32(); + } + maPageOffset = LogicToPixel( Point( static_cast<long>(nLeft), + static_cast<long>(nTop) ), + MapMode( MAP_100TH_MM ) + ); + mnOutWidth = maPaperSize.Width() - 2*maPageOffset.X(); + mnOutWidth = maPaperSize.Width() - 2*maPageOffset.Y(); + } } // ----------------------------------------------------------------------- @@ -602,11 +621,6 @@ Printer::~Printer() { DBG_ASSERT( !IsPrinting(), "Printer::~Printer() - Job is printing" ); DBG_ASSERT( !IsJobActive(), "Printer::~Printer() - Job is active" ); - DBG_ASSERT( !mpQPrinter, "Printer::~Printer() - QueuePrinter not destroyed" ); - DBG_ASSERT( !mpQMtf, "Printer::~Printer() - QueueMetafile not destroyed" ); - - delete mpPrinterData; - mpPrinterData = NULL; delete mpPrinterOptions; @@ -653,21 +667,11 @@ Printer::~Printer() } // ----------------------------------------------------------------------- -void Printer::SetNextJobIsQuick( bool bQuick ) -{ - mpPrinterData->mbNextJobIsQuick = bQuick; - if( mpQPrinter ) - mpQPrinter->SetNextJobIsQuick( bQuick ); -} - -// ----------------------------------------------------------------------- void Printer::Compat_OldPrinterMetrics( bool bSet ) { // propagate flag if( mpInfoPrinter ) mpInfoPrinter->m_bCompatMetrics = bSet; - if( mpQPrinter ) - mpQPrinter->Compat_OldPrinterMetrics( bSet ); // get new font data ImplUpdateFontData( TRUE ); @@ -977,12 +981,13 @@ USHORT Printer::GetPaperBin() const // ----------------------------------------------------------------------- // Map user paper format to a available printer paper formats -void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup ) +void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup, bool bMatchNearest ) { ImplJobSetup* pSetupData = aJobSetup.ImplGetData(); int nLandscapeAngle = GetLandscapeAngle(); int nPaperCount = GetPaperInfoCount(); + bool bFound = false; PaperInfo aInfo(pSetupData->mnPaperWidth, pSetupData->mnPaperHeight); @@ -995,6 +1000,8 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup ) { pSetupData->mePaperFormat = ImplGetPaperFormat( rPaperInfo.getWidth(), rPaperInfo.getHeight() ); + pSetupData->meOrientation = ORIENTATION_PORTRAIT; + bFound = true; break; } } @@ -1017,10 +1024,49 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup ) { pSetupData->mePaperFormat = ImplGetPaperFormat( rPaperInfo.getWidth(), rPaperInfo.getHeight() ); + pSetupData->meOrientation = ORIENTATION_LANDSCAPE; + bFound = true; break; } } } + + if( ! bFound && bMatchNearest ) + { + sal_Int64 nBestMatch = SAL_MAX_INT64; + int nBestIndex = 0; + Orientation eBestOrientation = ORIENTATION_PORTRAIT; + for( int i = 0; i < nPaperCount; i++ ) + { + const PaperInfo& rPaperInfo = GetPaperInfo( i ); + + // check protrait match + sal_Int64 nDX = pSetupData->mnPaperWidth - rPaperInfo.getWidth(); + sal_Int64 nDY = pSetupData->mnPaperHeight - rPaperInfo.getHeight(); + sal_Int64 nMatch = nDX*nDX + nDY*nDY; + if( nMatch < nBestMatch ) + { + nBestMatch = nMatch; + nBestIndex = i; + eBestOrientation = ORIENTATION_PORTRAIT; + } + + // check landscape match + nDX = pSetupData->mnPaperWidth - rPaperInfo.getHeight(); + nDY = pSetupData->mnPaperHeight - rPaperInfo.getWidth(); + nMatch = nDX*nDX + nDY*nDY; + if( nMatch < nBestMatch ) + { + nBestMatch = nMatch; + nBestIndex = i; + eBestOrientation = ORIENTATION_LANDSCAPE; + } + } + const PaperInfo& rBestInfo = GetPaperInfo( nBestIndex ); + pSetupData->mePaperFormat = ImplGetPaperFormat( rBestInfo.getWidth(), + rBestInfo.getHeight() ); + pSetupData->meOrientation = eBestOrientation; + } } // ----------------------------------------------------------------------- @@ -1051,7 +1097,7 @@ BOOL Printer::SetPaper( Paper ePaper ) ImplReleaseGraphics(); if ( ePaper == PAPER_USER ) - ImplFindPaperFormatForUserSize( aJobSetup ); + ImplFindPaperFormatForUserSize( aJobSetup, false ); if ( mpInfoPrinter->SetData( SAL_JOBSET_PAPERSIZE|SAL_JOBSET_ORIENTATION, pSetupData ) ) { ImplUpdateJobSetupPaper( aJobSetup ); @@ -1072,6 +1118,11 @@ BOOL Printer::SetPaper( Paper ePaper ) BOOL Printer::SetPaperSizeUser( const Size& rSize ) { + return SetPaperSizeUser( rSize, false ); +} + +BOOL Printer::SetPaperSizeUser( const Size& rSize, bool bMatchNearest ) +{ if ( mbInPrintPage ) return FALSE; @@ -1095,7 +1146,7 @@ BOOL Printer::SetPaperSizeUser( const Size& rSize ) } ImplReleaseGraphics(); - ImplFindPaperFormatForUserSize( aJobSetup ); + ImplFindPaperFormatForUserSize( aJobSetup, bMatchNearest ); // Changing the paper size can also change the orientation! if ( mpInfoPrinter->SetData( SAL_JOBSET_PAPERSIZE|SAL_JOBSET_ORIENTATION, pSetupData ) ) @@ -1142,7 +1193,44 @@ const PaperInfo& Printer::GetPaperInfo( int nPaper ) const DuplexMode Printer::GetDuplexMode() const { - return mpInfoPrinter ? mpInfoPrinter->GetDuplexMode( maJobSetup.ImplGetConstData() ) : DUPLEX_UNKNOWN; + return maJobSetup.ImplGetConstData()->meDuplexMode; +} + +// ----------------------------------------------------------------------- + +BOOL Printer::SetDuplexMode( DuplexMode eDuplex ) +{ + if ( mbInPrintPage ) + return FALSE; + + if ( maJobSetup.ImplGetConstData()->meDuplexMode != eDuplex ) + { + JobSetup aJobSetup = maJobSetup; + ImplJobSetup* pSetupData = aJobSetup.ImplGetData(); + pSetupData->meDuplexMode = eDuplex; + + if ( IsDisplayPrinter() ) + { + mbNewJobSetup = TRUE; + maJobSetup = aJobSetup; + return TRUE; + } + + ImplReleaseGraphics(); + if ( mpInfoPrinter->SetData( SAL_JOBSET_DUPLEXMODE, pSetupData ) ) + { + ImplUpdateJobSetupPaper( aJobSetup ); + mbNewJobSetup = TRUE; + maJobSetup = aJobSetup; + ImplUpdatePageData(); + ImplUpdateFontList(); + return TRUE; + } + else + return FALSE; + } + + return TRUE; } // ----------------------------------------------------------------------- @@ -1184,9 +1272,10 @@ XubString Printer::GetPaperBinName( USHORT nPaperBin ) const // ----------------------------------------------------------------------- -BOOL Printer::SetCopyCount( USHORT nCopy, BOOL /*bCollate*/ ) +BOOL Printer::SetCopyCount( USHORT nCopy, BOOL bCollate ) { mnCopyCount = nCopy; + mbCollateCopy = bCollate; return TRUE; } @@ -1199,29 +1288,8 @@ void Printer::Error() // ----------------------------------------------------------------------- -void Printer::StartPrint() -{ - maStartPrintHdl.Call( this ); -} - -// ----------------------------------------------------------------------- - -void Printer::EndPrint() -{ - maEndPrintHdl.Call( this ); -} - -// ----------------------------------------------------------------------- - -void Printer::PrintPage() -{ - maPrintPageHdl.Call( this ); -} - -// ----------------------------------------------------------------------- - -ULONG ImplSalPrinterErrorCodeToVCL( ULONG nError ) +ULONG Printer::ImplSalPrinterErrorCodeToVCL( ULONG nError ) { ULONG nVCLError; switch ( nError ) @@ -1247,12 +1315,6 @@ void Printer::ImplEndPrint() mbPrinting = FALSE; mnCurPrintPage = 0; maJobName.Erase(); - if( mpQPrinter ) // not necessarily filled e.g. after AbortJob - { - mpQPrinter->Destroy(); - mpQPrinter = NULL; - } - EndPrint(); } // ----------------------------------------------------------------------- @@ -1267,180 +1329,6 @@ IMPL_LINK( Printer, ImplDestroyPrinterAsync, void*, pSalPrinter ) // ----------------------------------------------------------------------- -void Printer::ImplUpdateQuickStatus() -{ - // remove possibly added "IsQuickJob" - if( mpPrinterData->mbNextJobIsQuick ) - { - rtl::OUString aKey( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) ); - // const data means not really const, but change all references - // to refcounted job setup - ImplJobSetup* pImpSetup = maJobSetup.ImplGetConstData(); - pImpSetup->maValueMap.erase( aKey ); - mpPrinterData->mbNextJobIsQuick = false; - } -} - -class QuickGuard -{ - Printer* mpPrinter; - public: - QuickGuard( Printer* pPrn ) : mpPrinter( pPrn ) {} - ~QuickGuard() - { - mpPrinter->ImplUpdateQuickStatus(); - } -}; - -BOOL Printer::StartJob( const XubString& rJobName ) -{ - mnError = PRINTER_OK; - - if ( IsDisplayPrinter() ) - return FALSE; - - if ( IsJobActive() || IsPrinting() ) - return FALSE; - - if( mpPrinterData->mbNextJobIsQuick ) - { - String aKey( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) ); - if( maJobSetup.GetValue( aKey ).Len() == 0 ) - maJobSetup.SetValue( aKey, String( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) ); - } - - QuickGuard aQGuard( this ); - - ULONG nCopies = mnCopyCount; - BOOL bCollateCopy = mbCollateCopy; - BOOL bUserCopy = FALSE; - if ( IsQueuePrinter() ) - { - if ( ((ImplQPrinter*)this)->IsUserCopy() ) - { - nCopies = 1; - bCollateCopy = FALSE; - } - } - else - { - if ( nCopies > 1 ) - { - ULONG nDevCopy; - - if ( bCollateCopy ) - nDevCopy = GetCapabilities( PRINTER_CAPABILITIES_COLLATECOPIES ); - else - nDevCopy = GetCapabilities( PRINTER_CAPABILITIES_COPIES ); - - // Muessen Kopien selber gemacht werden? - if ( nCopies > nDevCopy ) - { - bUserCopy = TRUE; - nCopies = 1; - bCollateCopy = FALSE; - } - } - else - bCollateCopy = FALSE; - - // we need queue printing - if( !mnPageQueueSize ) - mnPageQueueSize = 1; - } - - if ( !mnPageQueueSize ) - { - ImplSVData* pSVData = ImplGetSVData(); - mpPrinter = pSVData->mpDefInst->CreatePrinter( mpInfoPrinter ); - - if ( !mpPrinter ) - return FALSE; - - XubString* pPrintFile; - if ( mbPrintFile ) - pPrintFile = &maPrintFile; - else - pPrintFile = NULL; - - // #125075# StartJob can Reschedule on Windows, sfx - // depends on IsPrinting() in case of closing a document - BOOL bSaveNewJobSetup = mbNewJobSetup; - mbNewJobSetup = FALSE; - String aSaveJobName = maJobName; - maJobName = rJobName; - mnCurPage = 1; - mnCurPrintPage = 1; - mbPrinting = TRUE; - - if( ! ImplGetSVData()->maGDIData.mbPrinterPullModel ) - { - // in the pull model the job can only be started when - // we have collected all pages to be printed - if ( !mpPrinter->StartJob( pPrintFile, rJobName, Application::GetDisplayName(), - nCopies, bCollateCopy, - maJobSetup.ImplGetConstData() ) ) - { - mnError = ImplSalPrinterErrorCodeToVCL( mpPrinter->GetErrorCode() ); - if ( !mnError ) - mnError = PRINTER_GENERALERROR; - pSVData->mpDefInst->DestroyPrinter( mpPrinter ); - mbNewJobSetup = bSaveNewJobSetup; - maJobName = aSaveJobName; - mnCurPage = 0; - mnCurPrintPage = 0; - mbPrinting = FALSE; - mpPrinter = NULL; - return FALSE; - } - } - - mbJobActive = TRUE; - StartPrint(); - } - else - { - mpQPrinter = new ImplQPrinter( this ); - if( mpInfoPrinter ) - mpQPrinter->Compat_OldPrinterMetrics( mpInfoPrinter->m_bCompatMetrics ); - mpQPrinter->SetDigitLanguage( GetDigitLanguage() ); - mpQPrinter->SetUserCopy( bUserCopy ); - mpQPrinter->SetPrinterOptions( *mpPrinterOptions ); - - // #125075# StartJob can Reschedule on Windows, sfx - // depends on IsPrinting() in case of closing a document - BOOL bSaveNewJobSetup = mbNewJobSetup; - mbNewJobSetup = FALSE; - String aSaveJobName = maJobName; - maJobName = rJobName; - mnCurPage = 1; - mbPrinting = TRUE; - - if ( mpQPrinter->StartJob( rJobName ) ) - { - mbJobActive = TRUE; - StartPrint(); - mpQPrinter->StartQueuePrint(); - } - else - { - mbNewJobSetup = bSaveNewJobSetup; - maJobName = aSaveJobName; - mnCurPage = 0; - mbPrinting = FALSE; - mnError = mpQPrinter->GetErrorCode(); - mpQPrinter->Destroy(); - mpQPrinter = NULL; - return FALSE; - } - } - - - return TRUE; -} - -// ----------------------------------------------------------------------- - BOOL Printer::EndJob() { BOOL bRet = FALSE; @@ -1451,7 +1339,7 @@ BOOL Printer::EndJob() mbJobActive = FALSE; - if ( mpPrinter || mpQPrinter ) + if ( mpPrinter ) { ImplReleaseGraphics(); @@ -1459,23 +1347,17 @@ BOOL Printer::EndJob() bRet = TRUE; - if ( mpPrinter ) - { - mbPrinting = FALSE; - mnCurPrintPage = 0; - maJobName.Erase(); - - mbDevOutput = FALSE; - bRet = mpPrinter->EndJob(); - // Hier den Drucker nicht asyncron zerstoeren, da es - // W95 nicht verkraftet, wenn gleichzeitig gedruckt wird - // und ein Druckerobjekt zerstoert wird - ImplGetSVData()->mpDefInst->DestroyPrinter( mpPrinter ); - mpPrinter = NULL; - EndPrint(); - } - else - mpQPrinter->EndQueuePrint(); + mbPrinting = FALSE; + mnCurPrintPage = 0; + maJobName.Erase(); + + mbDevOutput = FALSE; + bRet = mpPrinter->EndJob(); + // Hier den Drucker nicht asyncron zerstoeren, da es + // W95 nicht verkraftet, wenn gleichzeitig gedruckt wird + // und ein Druckerobjekt zerstoert wird + ImplGetSVData()->mpDefInst->DestroyPrinter( mpPrinter ); + mpPrinter = NULL; } return bRet; @@ -1494,35 +1376,18 @@ BOOL Printer::AbortJob() mbInPrintPage = FALSE; mpJobGraphics = NULL; - if ( mpPrinter || mpQPrinter ) + if ( mpPrinter ) { mbPrinting = FALSE; mnCurPage = 0; mnCurPrintPage = 0; maJobName.Erase(); - if ( mpPrinter ) - { - ImplReleaseGraphics(); - mbDevOutput = FALSE; - mpPrinter->AbortJob(); - Application::PostUserEvent( LINK( this, Printer, ImplDestroyPrinterAsync ), mpPrinter ); - mpPrinter = NULL; - EndPrint(); - } - else - { - mpQPrinter->AbortQueuePrint(); - mpQPrinter->Destroy(); - mpQPrinter = NULL; - if ( mpQMtf ) - { - mpQMtf->Clear(); - delete mpQMtf; - mpQMtf = NULL; - } - EndPrint(); - } + ImplReleaseGraphics(); + mbDevOutput = FALSE; + mpPrinter->AbortJob(); + Application::PostUserEvent( LINK( this, Printer, ImplDestroyPrinterAsync ), mpPrinter ); + mpPrinter = NULL; return TRUE; } @@ -1532,88 +1397,49 @@ BOOL Printer::AbortJob() // ----------------------------------------------------------------------- -BOOL Printer::StartPage() +void Printer::ImplStartPage() { if ( !IsJobActive() ) - return FALSE; + return; - if ( mpPrinter || mpQPrinter ) + if ( mpPrinter ) { - if ( mpPrinter ) - { - SalGraphics* pGraphics = mpPrinter->StartPage( maJobSetup.ImplGetConstData(), mbNewJobSetup ); - if ( pGraphics ) - { - ImplReleaseGraphics(); - mpJobGraphics = pGraphics; - } - mbDevOutput = TRUE; - } - else + SalGraphics* pGraphics = mpPrinter->StartPage( maJobSetup.ImplGetConstData(), mbNewJobSetup ); + if ( pGraphics ) { - ImplGetGraphics(); - mpJobGraphics = mpGraphics; + ImplReleaseGraphics(); + mpJobGraphics = pGraphics; } + mbDevOutput = TRUE; // PrintJob not aborted ??? if ( IsJobActive() ) { mbInPrintPage = TRUE; mnCurPage++; - if ( mpQPrinter ) - { - mpQPrinter->SetPrinterOptions( *mpPrinterOptions ); - mpQMtf = new GDIMetaFile; - mpQMtf->Record( this ); - mpQMtf->SaveStatus(); - } - else - { - mnCurPrintPage++; - PrintPage(); - } + mnCurPrintPage++; } - - return TRUE; } - - return FALSE; } // ----------------------------------------------------------------------- -BOOL Printer::EndPage() +void Printer::ImplEndPage() { if ( !IsJobActive() ) - return FALSE; + return; mbInPrintPage = FALSE; - if ( mpPrinter || mpQPrinter ) + if ( mpPrinter ) { - if ( mpPrinter ) - { - mpPrinter->EndPage(); - ImplReleaseGraphics(); - mbDevOutput = FALSE; - } - else if ( mpQPrinter ) - { - // Eigentuemeruebergang an QPrinter - mpQMtf->Stop(); - mpQMtf->WindStart(); - GDIMetaFile* pPage = mpQMtf; - mpQMtf = NULL; - mpQPrinter->AddQueuePage( pPage, mnCurPage, mbNewJobSetup ); - } + mpPrinter->EndPage(); + ImplReleaseGraphics(); + mbDevOutput = FALSE; mpJobGraphics = NULL; mbNewJobSetup = FALSE; - - return TRUE; } - - return FALSE; } // ----------------------------------------------------------------------- diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index 685f68fe7af3..9d435af5f4b1 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -31,8 +31,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#define _SPOOLPRINTER_EXT - #include <functional> #include <algorithm> #include <utility> @@ -648,7 +646,9 @@ static bool ImplIsActionHandlingTransparency( const MetaAction& rAct ) bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf, long nMaxBmpDPIX, long nMaxBmpDPIY, bool bReduceTransparency, bool bTransparencyAutoMode, - bool bDownsampleBitmaps ) + bool bDownsampleBitmaps, + const Color& rBackground + ) { MetaAction* pCurrAct; bool bTransparent( false ); @@ -737,6 +737,20 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, bool bStillBackground=true; // true until first non-bg action nActionNum=0; nLastBgAction=-1; pCurrAct=const_cast<GDIMetaFile&>(rInMtf).FirstAction(); + if( rBackground != Color( COL_TRANSPARENT ) ) + { + aBackgroundComponent.aBgColor = rBackground; + if( meOutDevType == OUTDEV_PRINTER ) + { + Printer* pThis = dynamic_cast<Printer*>(this); + Point aPageOffset = pThis->GetPageOffsetPixel(); + aPageOffset = Point( 0, 0 ) - aPageOffset; + Size aSize = pThis->GetPaperSizePixel(); + aBackgroundComponent.aBounds = Rectangle( aPageOffset, aSize ); + } + else + aBackgroundComponent.aBounds = Rectangle( Point( 0, 0 ), GetOutputSizePixel() ); + } while( pCurrAct && bStillBackground ) { switch( pCurrAct->GetType() ) @@ -880,7 +894,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, // // if aBBCurrAct is empty, it will intersect with no - // aCCList member. Thus, we can safe us the check. + // aCCList member. Thus, we can save the check. // Furthermore, this ensures that non-output-generating // actions get their own aCCList entry, which is necessary // when copying them to the output metafile (see stage 4 @@ -1110,7 +1124,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, // ==================================================== // - Point aTmpPoint; + Point aPageOffset; Size aTmpSize( GetOutputSizePixel() ); if( mpPDFWriter ) { @@ -1120,7 +1134,14 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, // also add error code to PDFWriter mpPDFWriter->insertError( vcl::PDFWriter::Warning_Transparency_Converted ); } - const Rectangle aOutputRect( aTmpPoint, aTmpSize ); + else if( meOutDevType == OUTDEV_PRINTER ) + { + Printer* pThis = dynamic_cast<Printer*>(this); + aPageOffset = pThis->GetPageOffsetPixel(); + aPageOffset = Point( 0, 0 ) - aPageOffset; + aTmpSize = pThis->GetPaperSizePixel(); + } + const Rectangle aOutputRect( aPageOffset, aTmpSize ); bool bTiling = dynamic_cast<Printer*>(this) != NULL; // iterate over all aCCList members and generate bitmaps for the special ones @@ -1228,7 +1249,7 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, pCurrAct->Execute( &aPaintVDev ); } - if( !( nActionNum % 4 ) ) + if( !( nActionNum % 8 ) ) Application::Reschedule(); } diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx new file mode 100644 index 000000000000..6778cfbc867e --- /dev/null +++ b/vcl/source/gdi/print3.cxx @@ -0,0 +1,1765 @@ +/************************************************************************* + * + * 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: print3.cxx,v $ + * $Revision: 1.1.2.11 $ + * + * 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 "precompiled_vcl.hxx" + +#include "vcl/print.hxx" +#include "vcl/prndlg.hxx" +#include "vcl/svapp.hxx" +#include "vcl/svdata.hxx" +#include "vcl/salinst.hxx" +#include "vcl/salprn.hxx" +#include "vcl/svids.hrc" +#include "vcl/metaact.hxx" +#include "vcl/msgbox.hxx" + +#include "tools/urlobj.hxx" + +#include "com/sun/star/ui/dialogs/XFilePicker.hpp" +#include "com/sun/star/ui/dialogs/XFilterManager.hpp" +#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" +#include "com/sun/star/ui/dialogs/ExecutableDialogResults.hpp" +#include "com/sun/star/view/DuplexMode.hpp" +#include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/awt/Size.hpp" +#include "comphelper/processfactory.hxx" + +#include <hash_map> +#include <hash_set> + +using namespace com::sun::star; +using namespace com::sun::star::uno; +using namespace com::sun::star::beans; +using namespace vcl; + +class ImplPageCache +{ + struct CacheEntry + { + GDIMetaFile aPage; + PrinterController::PageSize aSize; + }; + + std::vector< CacheEntry > maPages; + std::vector< sal_Int32 > maPageNumbers; + std::vector< sal_Int32 > maCacheRanking; + + static const sal_Int32 nCacheSize = 6; + + void updateRanking( sal_Int32 nLastHit ) + { + if( maCacheRanking[0] != nLastHit ) + { + bool bMove = false; + for( sal_Int32 i = nCacheSize-1; i > 0; i-- ) + { + if( maCacheRanking[i] == nLastHit ) + bMove = true; + maCacheRanking[i] = maCacheRanking[i-1]; + } + maCacheRanking[0] = nLastHit; + } + } + +public: + ImplPageCache() + : maPages( nCacheSize ) + , maPageNumbers( nCacheSize, -1 ) + , maCacheRanking( nCacheSize ) + { + for( sal_Int32 i = 0; i < nCacheSize; i++ ) + maCacheRanking[i] = nCacheSize - i - 1; + } + + // caution: does not ensure uniqueness + void insert( sal_Int32 i_nPageNo, const GDIMetaFile& i_rPage, const PrinterController::PageSize& i_rSize ) + { + sal_Int32 nReplacePage = maCacheRanking.back(); + maPages[ nReplacePage ].aPage = i_rPage; + maPages[ nReplacePage ].aSize = i_rSize; + maPageNumbers[ nReplacePage ] = i_nPageNo; + // cache insertion means in our case, the page was just queried + // so update the ranking + updateRanking( nReplacePage ); + } + + // caution: bad algorithm; should there ever be reason to increase the cache size beyond 6 + // this needs to be urgently rewritten. However do NOT increase the cache size lightly, + // whole pages can be rather memory intensive + bool get( sal_Int32 i_nPageNo, GDIMetaFile& o_rPageFile, PrinterController::PageSize& o_rSize ) + { + for( sal_Int32 i = 0; i < nCacheSize; ++i ) + { + if( maPageNumbers[i] == i_nPageNo ) + { + updateRanking( i ); + o_rPageFile = maPages[i].aPage; + o_rSize = maPages[i].aSize; + return true; + } + } + return false; + } + + void invalidate() + { + for( sal_Int32 i = 0; i < nCacheSize; ++i ) + { + maPageNumbers[i] = -1; + maPages[i].aPage.Clear(); + maCacheRanking[i] = nCacheSize - i - 1; + } + } +}; + +class vcl::ImplPrinterControllerData +{ +public: + struct ControlDependency + { + rtl::OUString maDependsOnName; + sal_Int32 mnDependsOnEntry; + + ControlDependency() : mnDependsOnEntry( -1 ) {} + }; + + typedef std::hash_map< rtl::OUString, size_t, rtl::OUStringHash > PropertyToIndexMap; + typedef std::hash_map< rtl::OUString, ControlDependency, rtl::OUStringHash > ControlDependencyMap; + + boost::shared_ptr<Printer> mpPrinter; + Sequence< PropertyValue > maUIOptions; + std::vector< PropertyValue > maUIProperties; + std::vector< bool > maUIPropertyEnabled; + PropertyToIndexMap maPropertyToIndex; + Link maOptionChangeHdl; + ControlDependencyMap maControlDependencies; + sal_Bool mbFirstPage; + sal_Bool mbLastPage; + sal_Bool mbReversePageOrder; + view::PrintableState meJobState; + + vcl::PrinterController::MultiPageSetup maMultiPage; + + vcl::PrintProgressDialog* mpProgress; + + ImplPageCache maPageCache; + + // set by user through printer config dialog + // if set, pages are centered and trimmed onto the fixed page + Size maFixedPageSize; + + ImplPrinterControllerData() : + mbFirstPage( sal_True ), + mbLastPage( sal_False ), + mbReversePageOrder( sal_False ), + meJobState( view::PrintableState_JOB_STARTED ), + mpProgress( NULL ) + {} + ~ImplPrinterControllerData() { delete mpProgress; } + + Size getRealPaperSize( const Size& i_rPageSize ) const + { + if( maFixedPageSize.Width() > 0 && maFixedPageSize.Height() > 0 ) + return maFixedPageSize; + if( maMultiPage.nRows * maMultiPage.nColumns > 1 ) + return maMultiPage.aPaperSize; + return i_rPageSize; + } + bool isFixedPageSize() const + { return maFixedPageSize.Width() != 0 && maFixedPageSize.Height() != 0; } + PrinterController::PageSize modifyJobSetup( const Sequence< PropertyValue >& i_rProps ); +}; + +PrinterController::PrinterController() + : mpImplData( new ImplPrinterControllerData ) +{ +} + +PrinterController::PrinterController( const boost::shared_ptr<Printer>& i_pPrinter ) + : mpImplData( new ImplPrinterControllerData ) +{ + mpImplData->mpPrinter = i_pPrinter; +} + +static rtl::OUString queryFile( Printer* pPrinter ) +{ + rtl::OUString aResult; + + uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); + if( xFactory.is() ) + { + uno::Sequence< uno::Any > aTempl( 1 ); + aTempl.getArray()[0] <<= ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION; + uno::Reference< ui::dialogs::XFilePicker > xFilePicker( + xFactory->createInstanceWithArguments( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), + aTempl ), uno::UNO_QUERY ); + DBG_ASSERT( xFilePicker.is(), "could not get FilePicker service" ); + + uno::Reference< ui::dialogs::XFilterManager > xFilterMgr( xFilePicker, uno::UNO_QUERY ); + if( xFilePicker.is() && xFilterMgr.is() ) + { + try + { +#ifdef UNX + // add PostScript and PDF + bool bPS = true, bPDF = true; + if( pPrinter ) + { + if( pPrinter->GetCapabilities( PRINTER_CAPABILITIES_PDF ) ) + bPS = false; + else + bPDF = false; + } + if( bPS ) + xFilterMgr->appendFilter( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PostScript" ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.ps" ) ) ); + if( bPDF ) + xFilterMgr->appendFilter( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Portable Document Format" ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.pdf" ) ) ); +#elif defined WNT + (void)pPrinter; + xFilterMgr->appendFilter( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.PRN" ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.prn" ) ) ); +#endif + // add arbitrary files + xFilterMgr->appendFilter( String( VclResId( SV_STDTEXT_ALLFILETYPES ) ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.*" ) ) ); + } + catch( lang::IllegalArgumentException rExc ) + { + DBG_ERRORFILE( "caught IllegalArgumentException when registering filter\n" ); + } + + if( xFilePicker->execute() == ui::dialogs::ExecutableDialogResults::OK ) + { + uno::Sequence< ::rtl::OUString > aPathSeq( xFilePicker->getFiles() ); + INetURLObject aObj( aPathSeq[0] ); + aResult = aObj.PathToFileName(); + } + } + } + return aResult; +} + +struct PrintJobAsync +{ + boost::shared_ptr<PrinterController> mpController; + JobSetup maInitSetup; + + PrintJobAsync( const boost::shared_ptr<PrinterController>& i_pController, + const JobSetup& i_rInitSetup + ) + : mpController( i_pController ), maInitSetup( i_rInitSetup ) + {} + + DECL_LINK( ExecJob, void* ); +}; + +IMPL_LINK( PrintJobAsync, ExecJob, void*, EMPTYARG ) +{ + Printer::ImplPrintJob( mpController, maInitSetup ); + + // clean up, do not access members after this + delete this; + + return 0; +} + +void Printer::PrintJob( const boost::shared_ptr<PrinterController>& i_pController, + const JobSetup& i_rInitSetup + ) +{ + sal_Bool bSynchronous = sal_False; + beans::PropertyValue* pVal = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Wait" ) ) ); + if( pVal ) + pVal->Value >>= bSynchronous; + + if( bSynchronous ) + ImplPrintJob( i_pController, i_rInitSetup ); + else + { + PrintJobAsync* pAsync = new PrintJobAsync( i_pController, i_rInitSetup ); + Application::PostUserEvent( LINK( pAsync, PrintJobAsync, ExecJob ) ); + } +} + +void Printer::ImplPrintJob( const boost::shared_ptr<PrinterController>& i_pController, + const JobSetup& i_rInitSetup + ) +{ + boost::shared_ptr<PrinterController> pController( i_pController ); + + // check if there is a default printer; if not, show an error box (if appropriate) + if( GetDefaultPrinterName().Len() == 0 ) + { + if( pController->isShowDialogs() + // && ! pController->isDirectPrint() + ) + { + ErrorBox aBox( NULL, VclResId( SV_PRINT_NOPRINTERWARNING ) ); + aBox.Execute(); + } + pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDirect" ) ), + makeAny( sal_False ) ); + } + + // setup printer + + // if no specific printer is already set, create one + if( ! pController->getPrinter() ) + { + boost::shared_ptr<Printer> pPrinter( new Printer( i_rInitSetup.GetPrinterName() ) ); + pController->setPrinter( pPrinter ); + } + + // reset last page property + i_pController->setLastPage( sal_False ); + + // update "PageRange" property inferring from other properties: + // case 1: "Pages" set from UNO API -> + // setup "Print Selection" and insert "PageRange" attribute + // case 2: "All pages" is selected + // update "Page range" attribute to have a sensible default, + // but leave "All" as selected + + // "Pages" attribute from API is now equivalent to "PageRange" + // AND "PrintContent" = 1 except calc where it is "PrintRange" = 1 + // Argh ! That sure needs cleaning up + beans::PropertyValue* pContentVal = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ) ); + if( ! pContentVal ) + pContentVal = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ) ); + + // case 1: UNO API has set "Pages" + beans::PropertyValue* pPagesVal = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Pages" ) ) ); + if( pPagesVal ) + { + rtl::OUString aPagesVal; + pPagesVal->Value >>= aPagesVal; + if( aPagesVal.getLength() ) + { + // "Pages" attribute from API is now equivalent to "PageRange" + // AND "PrintContent" = 1 except calc where it is "PrintRange" = 1 + // Argh ! That sure needs cleaning up + if( pContentVal ) + { + pContentVal->Value = makeAny( sal_Int32( 1 ) ); + i_pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), pPagesVal->Value ); + } + } + } + // case 2: is "All" selected ? + else if( pContentVal ) + { + sal_Int32 nContent = -1; + if( pContentVal->Value >>= nContent ) + { + if( nContent == 0 ) + { + sal_Int32 nPages = i_pController->getPageCount(); + if( nPages > 0 ) + { + rtl::OUStringBuffer aBuf( 32 ); + aBuf.appendAscii( "1" ); + if( nPages > 1 ) + { + aBuf.appendAscii( "-" ); + aBuf.append( nPages ); + } + i_pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), makeAny( aBuf.makeStringAndClear() ) ); + } + } + } + } + + beans::PropertyValue* pReverseVal = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintReverse" ) ) ); + if( pReverseVal ) + { + sal_Bool bReverse = sal_False; + pReverseVal->Value >>= bReverse; + pController->setReversePrint( bReverse ); + } + + // in direct print case check whether there is anything to print. + // if not, show an errorbox (if appropriate) + if( pController->isShowDialogs() && pController->isDirectPrint() ) + { + if( pController->getFilteredPageCount() == 0 ) + { + ErrorBox aBox( NULL, VclResId( SV_PRINT_NOCONTENT ) ); + aBox.Execute(); + return; + } + } + + // check if the printer brings up its own dialog + // in that case leave the work to that dialog + if( ! pController->getPrinter()->GetCapabilities( PRINTER_CAPABILITIES_EXTERNALDIALOG ) && + ! pController->isDirectPrint() && + pController->isShowDialogs() + ) + { + try + { + PrintDialog aDlg( NULL, i_pController ); + if( ! aDlg.Execute() ) + { + GDIMetaFile aPageFile; + i_pController->setLastPage( sal_True ); + i_pController->getFilteredPageFile( 0, aPageFile ); + return; + } + if( aDlg.isPrintToFile() ) + { + rtl::OUString aFile = queryFile( pController->getPrinter().get() ); + if( ! aFile.getLength() ) + { + GDIMetaFile aPageFile; + i_pController->setLastPage( sal_True ); + i_pController->getFilteredPageFile( 0, aPageFile ); + return; + } + pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LocalFileName" ) ), + makeAny( aFile ) ); + } + } + catch( std::bad_alloc& ) + { + } + } + + pController->pushPropertiesToPrinter(); + + rtl::OUString aJobName; + beans::PropertyValue* pJobNameVal = pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobName" ) ) ); + if( pJobNameVal ) + pJobNameVal->Value >>= aJobName; + + pController->getPrinter()->StartJob( String( aJobName ), pController ); + + pController->jobFinished( pController->getJobState() ); +} + +bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl::PrinterController>& i_pController ) +{ + mnError = PRINTER_OK; + + if ( IsDisplayPrinter() ) + return FALSE; + + if ( IsJobActive() || IsPrinting() ) + return FALSE; + + ULONG nCopies = mnCopyCount; + bool bCollateCopy = mbCollateCopy; + bool bUserCopy = FALSE; + + if ( nCopies > 1 ) + { + ULONG nDevCopy; + + if ( bCollateCopy ) + nDevCopy = GetCapabilities( PRINTER_CAPABILITIES_COLLATECOPIES ); + else + nDevCopy = GetCapabilities( PRINTER_CAPABILITIES_COPIES ); + + // need to do copies by hand ? + if ( nCopies > nDevCopy ) + { + bUserCopy = TRUE; + nCopies = 1; + bCollateCopy = FALSE; + } + } + else + bCollateCopy = FALSE; + + + ImplSVData* pSVData = ImplGetSVData(); + mpPrinter = pSVData->mpDefInst->CreatePrinter( mpInfoPrinter ); + + if ( !mpPrinter ) + return FALSE; + + // remark: currently it is still possible to use EnablePrintFile and + // SetPrintFileName to redirect printout into file + // it can be argued that those methods should be removed in favor + // of only using the LocalFileName property + beans::PropertyValue* pFileValue = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LocalFileName" ) ) ); + if( pFileValue ) + { + rtl::OUString aFile; + pFileValue->Value >>= aFile; + if( aFile.getLength() ) + { + mbPrintFile = TRUE; + maPrintFile = aFile; + } + } + + XubString* pPrintFile = NULL; + if ( mbPrintFile ) + pPrintFile = &maPrintFile; + + maJobName = i_rJobName; + mnCurPage = 1; + mnCurPrintPage = 1; + mbPrinting = TRUE; + if( ImplGetSVData()->maGDIData.mbPrinterPullModel ) + { + mbJobActive = TRUE; + // sallayer does all necessary page printing + // and also handles showing a dialog + // that also means it must call jobStarted when the dialog is finished + // it also must set the JobState of the Controller + if( mpPrinter->StartJob( pPrintFile, + i_rJobName, + Application::GetDisplayName(), + maJobSetup.ImplGetConstData(), + *i_pController ) ) + { + EndJob(); + } + else + { + mnError = ImplSalPrinterErrorCodeToVCL( mpPrinter->GetErrorCode() ); + if ( !mnError ) + mnError = PRINTER_GENERALERROR; + pSVData->mpDefInst->DestroyPrinter( mpPrinter ); + mnCurPage = 0; + mnCurPrintPage = 0; + mbPrinting = FALSE; + mpPrinter = NULL; + + return false; + } + } + else + { + // possibly a dialog has been shown + // now the real job starts + i_pController->setJobState( view::PrintableState_JOB_STARTED ); + i_pController->jobStarted(); + + if( mpPrinter->StartJob( pPrintFile, + i_rJobName, + Application::GetDisplayName(), + nCopies, + bCollateCopy, + i_pController->isDirectPrint(), + maJobSetup.ImplGetConstData() ) ) + { + mbJobActive = TRUE; + i_pController->createProgressDialog(); + int nPages = i_pController->getFilteredPageCount(); + int nRepeatCount = bUserCopy ? mnCopyCount : 1; + for( int nIteration = 0; nIteration < nRepeatCount; nIteration++ ) + { + for( int nPage = 0; nPage < nPages; nPage++ ) + { + if( nPage == nPages-1 && nIteration == nRepeatCount-1 ) + i_pController->setLastPage( sal_True ); + i_pController->printFilteredPage( nPage ); + } + // FIXME: duplex ? + } + EndJob(); + + if( i_pController->getJobState() == view::PrintableState_JOB_STARTED ) + i_pController->setJobState( view::PrintableState_JOB_SPOOLED ); + } + else + { + mnError = ImplSalPrinterErrorCodeToVCL( mpPrinter->GetErrorCode() ); + if ( !mnError ) + mnError = PRINTER_GENERALERROR; + i_pController->setJobState( mnError == PRINTER_ABORT + ? view::PrintableState_JOB_ABORTED + : view::PrintableState_JOB_FAILED ); + pSVData->mpDefInst->DestroyPrinter( mpPrinter ); + mnCurPage = 0; + mnCurPrintPage = 0; + mbPrinting = FALSE; + mpPrinter = NULL; + + return false; + } + } + + return true; +} + +PrinterController::~PrinterController() +{ + delete mpImplData; +} + +view::PrintableState PrinterController::getJobState() const +{ + return mpImplData->meJobState; +} + +void PrinterController::setJobState( view::PrintableState i_eState ) +{ + mpImplData->meJobState = i_eState; +} + +const boost::shared_ptr<Printer>& PrinterController::getPrinter() const +{ + return mpImplData->mpPrinter; +} + +void PrinterController::setPrinter( const boost::shared_ptr<Printer>& i_rPrinter ) +{ + mpImplData->mpPrinter = i_rPrinter; + setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), + makeAny( rtl::OUString( i_rPrinter->GetName() ) ) ); +} + +bool PrinterController::setupPrinter( Window* i_pParent ) +{ + bool bRet = false; + if( mpImplData->mpPrinter.get() ) + { + Size aPaperSize( mpImplData->mpPrinter->PixelToLogic( + mpImplData->mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) ); + bRet = mpImplData->mpPrinter->Setup( i_pParent ); + if( bRet ) + { + // was the papersize overridden ? if so we need to take action + Size aNewPaperSize( mpImplData->mpPrinter->PixelToLogic( + mpImplData->mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) ); + if( aNewPaperSize != aPaperSize ) + { + mpImplData->maFixedPageSize = aNewPaperSize; + mpImplData->maPageCache.invalidate(); + awt::Size aOverrideSize; + aOverrideSize.Width = aNewPaperSize.Width(); + aOverrideSize.Height = aNewPaperSize.Height(); + setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OverridePageSize" ) ), + makeAny( aOverrideSize ) ); + } + } + } + return bRet; +} + +PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( const Sequence< PropertyValue >& i_rProps ) +{ + PrinterController::PageSize aPageSize; + aPageSize.aSize = mpPrinter->GetPaperSize(); + for( sal_Int32 nProperty = 0, nPropertyCount = i_rProps.getLength(); nProperty < nPropertyCount; ++nProperty ) + { + if( i_rProps[ nProperty ].Name.equalsAscii( "PageSize" ) ) + { + awt::Size aSize; + i_rProps[ nProperty].Value >>= aSize; + aPageSize.aSize.Width() = aSize.Width; + aPageSize.aSize.Height() = aSize.Height; + + Size aCurSize( mpPrinter->GetPaperSize() ); + Size aRealPaperSize( getRealPaperSize( aPageSize.aSize ) ); + if( aRealPaperSize != aCurSize ) + mpPrinter->SetPaperSizeUser( aRealPaperSize, ! isFixedPageSize() ); + } + if( i_rProps[ nProperty ].Name.equalsAscii( "PageIncludesNonprintableArea" ) ) + { + sal_Bool bVal = sal_False; + i_rProps[ nProperty].Value >>= bVal; + aPageSize.bFullPaper = static_cast<bool>(bVal); + } + } + return aPageSize; +} + +int PrinterController::getPageCountProtected() const +{ + const MapMode aMapMode( MAP_100TH_MM ); + + mpImplData->mpPrinter->Push(); + mpImplData->mpPrinter->SetMapMode( aMapMode ); + int nPages = getPageCount(); + mpImplData->mpPrinter->Pop(); + return nPages; +} + +Sequence< beans::PropertyValue > PrinterController::getPageParametersProtected( int i_nPage ) const +{ + const MapMode aMapMode( MAP_100TH_MM ); + + mpImplData->mpPrinter->Push(); + mpImplData->mpPrinter->SetMapMode( aMapMode ); + Sequence< beans::PropertyValue > aResult( getPageParameters( i_nPage ) ); + mpImplData->mpPrinter->Pop(); + return aResult; +} + +PrinterController::PageSize PrinterController::getPageFile( int i_nUnfilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache ) +{ + // update progress if necessary + if( mpImplData->mpProgress ) + { + // do nothing if printing is canceled + if( mpImplData->mpProgress->isCanceled() ) + return PrinterController::PageSize(); + mpImplData->mpProgress->tick(); + Application::Reschedule( true ); + } + + if( i_bMayUseCache ) + { + PrinterController::PageSize aPageSize; + if( mpImplData->maPageCache.get( i_nUnfilteredPage, o_rMtf, aPageSize ) ) + { + return aPageSize; + } + } + else + mpImplData->maPageCache.invalidate(); + + o_rMtf.Clear(); + + // get page parameters + Sequence< PropertyValue > aPageParm( getPageParametersProtected( i_nUnfilteredPage ) ); + const MapMode aMapMode( MAP_100TH_MM ); + + mpImplData->mpPrinter->Push(); + mpImplData->mpPrinter->SetMapMode( aMapMode ); + + // modify job setup if necessary + PrinterController::PageSize aPageSize = mpImplData->modifyJobSetup( aPageParm ); + + o_rMtf.SetPrefSize( aPageSize.aSize ); + o_rMtf.SetPrefMapMode( aMapMode ); + + mpImplData->mpPrinter->EnableOutput( FALSE ); + + o_rMtf.Record( mpImplData->mpPrinter.get() ); + + printPage( i_nUnfilteredPage ); + + o_rMtf.Stop(); + o_rMtf.WindStart(); + mpImplData->mpPrinter->Pop(); + + if( i_bMayUseCache ) + mpImplData->maPageCache.insert( i_nUnfilteredPage, o_rMtf, aPageSize ); + + // reset "FirstPage" property to false now we've gotten at least our first one + mpImplData->mbFirstPage = sal_False; + + return aPageSize; +} + +static void appendSubPage( GDIMetaFile& o_rMtf, const Rectangle& i_rClipRect, GDIMetaFile& io_rSubPage, bool i_bDrawBorder ) +{ + // intersect all clipregion actions with our clip rect + io_rSubPage.WindStart(); + io_rSubPage.Clip( i_rClipRect ); + + // save gstate + o_rMtf.AddAction( new MetaPushAction( PUSH_ALL ) ); + + // clip to page rect + o_rMtf.AddAction( new MetaClipRegionAction( Region( i_rClipRect ), TRUE ) ); + + // append the subpage + io_rSubPage.WindStart(); + io_rSubPage.Play( o_rMtf ); + + // restore gstate + o_rMtf.AddAction( new MetaPopAction() ); + + // draw a border + if( i_bDrawBorder ) + { + // save gstate + o_rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR | PUSH_FILLCOLOR | PUSH_CLIPREGION | PUSH_MAPMODE ) ); + o_rMtf.AddAction( new MetaMapModeAction( MapMode( MAP_100TH_MM ) ) ); + + Rectangle aBorderRect( i_rClipRect ); + o_rMtf.AddAction( new MetaLineColorAction( Color( COL_BLACK ), TRUE ) ); + o_rMtf.AddAction( new MetaFillColorAction( Color( COL_TRANSPARENT ), FALSE ) ); + o_rMtf.AddAction( new MetaRectAction( aBorderRect ) ); + + // restore gstate + o_rMtf.AddAction( new MetaPopAction() ); + } +} + +PrinterController::PageSize PrinterController::getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache ) +{ + const MultiPageSetup& rMPS( mpImplData->maMultiPage ); + int nSubPages = rMPS.nRows * rMPS.nColumns; + if( nSubPages < 1 ) + nSubPages = 1; + + // reverse sheet order + if( mpImplData->mbReversePageOrder ) + { + int nDocPages = getFilteredPageCount(); + i_nFilteredPage = nDocPages - 1 - i_nFilteredPage; + } + + // there is no filtering to be done (and possibly the page size of the + // original page is to be set), when N-Up is "neutral" that is there is + // only one subpage and the margins are 0 + if( nSubPages == 1 && + rMPS.nLeftMargin == 0 && rMPS.nRightMargin == 0 && + rMPS.nTopMargin == 0 && rMPS.nBottomMargin == 0 ) + { + PrinterController::PageSize aPageSize = getPageFile( i_nFilteredPage, o_rMtf, i_bMayUseCache ); + Size aPaperSize = mpImplData->getRealPaperSize( aPageSize.aSize ); + mpImplData->mpPrinter->SetMapMode( MapMode( MAP_100TH_MM ) ); + mpImplData->mpPrinter->SetPaperSizeUser( aPaperSize, ! mpImplData->isFixedPageSize() ); + if( aPaperSize != aPageSize.aSize ) + { + // user overridden page size, center Metafile + o_rMtf.WindStart(); + long nDX = (aPaperSize.Width() - aPageSize.aSize.Width()) / 2; + long nDY = (aPaperSize.Height() - aPageSize.aSize.Height()) / 2; + o_rMtf.Move( nDX, nDY ); + o_rMtf.WindStart(); + o_rMtf.SetPrefSize( aPaperSize ); + aPageSize.aSize = aPaperSize; + } + return aPageSize; + } + + // set last page property really only on the very last page to be rendered + // that is on the last subpage of a NUp run + sal_Bool bIsLastPage = mpImplData->mbLastPage; + mpImplData->mbLastPage = sal_False; + + Size aPaperSize( mpImplData->getRealPaperSize( mpImplData->maMultiPage.aPaperSize ) ); + + // multi page area: page size minus margins + one time spacing right and down + // the added spacing is so each subpage can be calculated including its spacing + Size aMPArea( aPaperSize ); + aMPArea.Width() -= rMPS.nLeftMargin + rMPS.nRightMargin; + aMPArea.Width() += rMPS.nHorizontalSpacing; + aMPArea.Height() -= rMPS.nTopMargin + rMPS.nBottomMargin; + aMPArea.Height() += rMPS.nVerticalSpacing; + + // determine offsets + long nAdvX = aMPArea.Width() / rMPS.nColumns; + long nAdvY = aMPArea.Height() / rMPS.nRows; + + // determine size of a "cell" subpage, leave a little space around pages + Size aSubPageSize( nAdvX - rMPS.nHorizontalSpacing, nAdvY - rMPS.nVerticalSpacing ); + + o_rMtf.Clear(); + o_rMtf.SetPrefSize( aPaperSize ); + o_rMtf.SetPrefMapMode( MapMode( MAP_100TH_MM ) ); + o_rMtf.AddAction( new MetaMapModeAction( MapMode( MAP_100TH_MM ) ) ); + + int nDocPages = getPageCountProtected(); + for( int nSubPage = 0; nSubPage < nSubPages; nSubPage++ ) + { + // map current sub page to real page + int nPage = (i_nFilteredPage * nSubPages + nSubPage) / rMPS.nRepeat; + if( nSubPage == nSubPages-1 || + nPage == nDocPages-1 ) + { + mpImplData->mbLastPage = bIsLastPage; + } + if( nPage >= 0 && nPage < nDocPages ) + { + GDIMetaFile aPageFile; + PrinterController::PageSize aPageSize = getPageFile( nPage, aPageFile, i_bMayUseCache ); + if( aPageSize.aSize.Width() && aPageSize.aSize.Height() ) + { + long nCellX = 0, nCellY = 0; + switch( rMPS.nOrder ) + { + case PrinterController::LRTB: + nCellX = (nSubPage % rMPS.nColumns); + nCellY = (nSubPage / rMPS.nColumns); + break; + case PrinterController::TBLR: + nCellX = (nSubPage / rMPS.nRows); + nCellY = (nSubPage % rMPS.nRows); + break; + } + // scale the metafile down to a sub page size + double fScaleX = double(aSubPageSize.Width())/double(aPageSize.aSize.Width()); + double fScaleY = double(aSubPageSize.Height())/double(aPageSize.aSize.Height()); + double fScale = std::min( fScaleX, fScaleY ); + aPageFile.Scale( fScale, fScale ); + aPageFile.WindStart(); + + // move the subpage so it is centered in its "cell" + long nOffX = (aSubPageSize.Width() - long(double(aPageSize.aSize.Width()) * fScale)) / 2; + long nOffY = (aSubPageSize.Height() - long(double(aPageSize.aSize.Height()) * fScale)) / 2; + long nX = rMPS.nLeftMargin + nOffX + nAdvX * nCellX; + long nY = rMPS.nTopMargin + nOffY + nAdvY * nCellY; + aPageFile.Move( nX, nY ); + aPageFile.WindStart(); + // calculate border rectangle + Rectangle aSubPageRect( Point( nX, nY ), + Size( long(double(aPageSize.aSize.Width())*fScale), + long(double(aPageSize.aSize.Height())*fScale) ) ); + + // append subpage to page + appendSubPage( o_rMtf, aSubPageRect, aPageFile, rMPS.bDrawBorder ); + } + } + } + o_rMtf.WindStart(); + + // subsequent getPageFile calls have changed the paper, reset it to current value + mpImplData->mpPrinter->SetMapMode( MapMode( MAP_100TH_MM ) ); + mpImplData->mpPrinter->SetPaperSizeUser( aPaperSize, ! mpImplData->isFixedPageSize() ); + + return PrinterController::PageSize( aPaperSize, true ); +} + +int PrinterController::getFilteredPageCount() +{ + int nDiv = mpImplData->maMultiPage.nRows * mpImplData->maMultiPage.nColumns; + if( nDiv < 1 ) + nDiv = 1; + return (getPageCountProtected() * mpImplData->maMultiPage.nRepeat + (nDiv-1)) / nDiv; +} + +ULONG PrinterController::removeTransparencies( GDIMetaFile& i_rIn, GDIMetaFile& o_rOut ) +{ + ULONG nRestoreDrawMode = mpImplData->mpPrinter->GetDrawMode(); + sal_Int32 nMaxBmpDPIX = mpImplData->mpPrinter->ImplGetDPIX(); + sal_Int32 nMaxBmpDPIY = mpImplData->mpPrinter->ImplGetDPIY(); + + const PrinterOptions& rPrinterOptions = mpImplData->mpPrinter->GetPrinterOptions(); + + static const sal_Int32 OPTIMAL_BMP_RESOLUTION = 300; + static const sal_Int32 NORMAL_BMP_RESOLUTION = 200; + + + if( rPrinterOptions.IsReduceBitmaps() ) + { + // calculate maximum resolution for bitmap graphics + if( PRINTER_BITMAP_OPTIMAL == rPrinterOptions.GetReducedBitmapMode() ) + { + nMaxBmpDPIX = std::min( sal_Int32(OPTIMAL_BMP_RESOLUTION), nMaxBmpDPIX ); + nMaxBmpDPIY = std::min( sal_Int32(OPTIMAL_BMP_RESOLUTION), nMaxBmpDPIY ); + } + else if( PRINTER_BITMAP_NORMAL == rPrinterOptions.GetReducedBitmapMode() ) + { + nMaxBmpDPIX = std::min( sal_Int32(NORMAL_BMP_RESOLUTION), nMaxBmpDPIX ); + nMaxBmpDPIY = std::min( sal_Int32(NORMAL_BMP_RESOLUTION), nMaxBmpDPIY ); + } + else + { + nMaxBmpDPIX = std::min( sal_Int32(rPrinterOptions.GetReducedBitmapResolution()), nMaxBmpDPIX ); + nMaxBmpDPIY = std::min( sal_Int32(rPrinterOptions.GetReducedBitmapResolution()), nMaxBmpDPIY ); + } + } + + // convert to greysacles + if( rPrinterOptions.IsConvertToGreyscales() ) + { + mpImplData->mpPrinter->SetDrawMode( mpImplData->mpPrinter->GetDrawMode() | + ( DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_GRAYTEXT | + DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT ) ); + } + + // disable transparency output + if( rPrinterOptions.IsReduceTransparency() && ( PRINTER_TRANSPARENCY_NONE == rPrinterOptions.GetReducedTransparencyMode() ) ) + { + mpImplData->mpPrinter->SetDrawMode( mpImplData->mpPrinter->GetDrawMode() | DRAWMODE_NOTRANSPARENCY ); + } + + Color aBg( COL_TRANSPARENT ); // default: let RemoveTransparenciesFromMetaFile do its own background logic + if( mpImplData->maMultiPage.nRows * mpImplData->maMultiPage.nColumns > 1 ) + { + // in N-Up printing we have no "page" background operation + // we also have no way to determine the paper color + // so let's go for white, which will kill 99.9% of the real cases + aBg = Color( COL_WHITE ); + } + mpImplData->mpPrinter->RemoveTransparenciesFromMetaFile( i_rIn, o_rOut, nMaxBmpDPIX, nMaxBmpDPIY, + rPrinterOptions.IsReduceTransparency(), + rPrinterOptions.GetReducedTransparencyMode() == PRINTER_TRANSPARENCY_AUTO, + rPrinterOptions.IsReduceBitmaps() && rPrinterOptions.IsReducedBitmapIncludesTransparency(), + aBg + ); + return nRestoreDrawMode; +} + +void PrinterController::printFilteredPage( int i_nPage ) +{ + if( mpImplData->meJobState != view::PrintableState_JOB_STARTED ) + return; + + GDIMetaFile aPageFile; + PrinterController::PageSize aPageSize = getFilteredPageFile( i_nPage, aPageFile ); + + if( mpImplData->mpProgress ) + { + // do nothing if printing is canceled + if( mpImplData->mpProgress->isCanceled() ) + { + setJobState( view::PrintableState_JOB_ABORTED ); + return; + } + } + + // in N-Up printing set the correct page size + mpImplData->mpPrinter->SetMapMode( MAP_100TH_MM ); + // aPageSize was filtered through mpImplData->getRealPaperSize already by getFilteredPageFile() + mpImplData->mpPrinter->SetPaperSizeUser( aPageSize.aSize, ! mpImplData->isFixedPageSize() ); + + // if full paper are is meant, move the output to accomodate for pageoffset + if( aPageSize.bFullPaper ) + { + Point aPageOffset( mpImplData->mpPrinter->GetPageOffset() ); + aPageFile.WindStart(); + aPageFile.Move( -aPageOffset.X(), -aPageOffset.Y() ); + } + + GDIMetaFile aCleanedFile; + ULONG nRestoreDrawMode = removeTransparencies( aPageFile, aCleanedFile ); + + mpImplData->mpPrinter->EnableOutput( TRUE ); + + // actually print the page + mpImplData->mpPrinter->ImplStartPage(); + + mpImplData->mpPrinter->Push(); + aCleanedFile.WindStart(); + aCleanedFile.Play( mpImplData->mpPrinter.get() ); + mpImplData->mpPrinter->Pop(); + + mpImplData->mpPrinter->ImplEndPage(); + + mpImplData->mpPrinter->SetDrawMode( nRestoreDrawMode ); +} + +void PrinterController::jobStarted() +{ +} + +void PrinterController::jobFinished( view::PrintableState ) +{ +} + +void PrinterController::abortJob() +{ + setJobState( view::PrintableState_JOB_ABORTED ); +} + +void PrinterController::setLastPage( sal_Bool i_bLastPage ) +{ + mpImplData->mbLastPage = i_bLastPage; +} + +void PrinterController::setReversePrint( sal_Bool i_bReverse ) +{ + mpImplData->mbReversePageOrder = i_bReverse; +} + +bool PrinterController::getReversePrint() const +{ + return mpImplData->mbReversePageOrder; +} + +Sequence< PropertyValue > PrinterController::getJobProperties( const Sequence< PropertyValue >& i_rMergeList ) const +{ + std::hash_set< rtl::OUString, rtl::OUStringHash > aMergeSet; + size_t nResultLen = size_t(i_rMergeList.getLength()) + mpImplData->maUIProperties.size() + 3; + for( int i = 0; i < i_rMergeList.getLength(); i++ ) + aMergeSet.insert( i_rMergeList[i].Name ); + + Sequence< PropertyValue > aResult( nResultLen ); + for( int i = 0; i < i_rMergeList.getLength(); i++ ) + aResult[i] = i_rMergeList[i]; + int nCur = i_rMergeList.getLength(); + for( size_t i = 0; i < mpImplData->maUIProperties.size(); i++ ) + { + if( aMergeSet.find( mpImplData->maUIProperties[i].Name ) == aMergeSet.end() ) + aResult[nCur++] = mpImplData->maUIProperties[i]; + } + // append IsFirstPage + if( aMergeSet.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFirstPage" ) ) ) == aMergeSet.end() ) + { + PropertyValue aVal; + aVal.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsFirstPage" ) ); + aVal.Value <<= mpImplData->mbFirstPage; + aResult[nCur++] = aVal; + } + // append IsLastPage + if( aMergeSet.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsLastPage" ) ) ) == aMergeSet.end() ) + { + PropertyValue aVal; + aVal.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsLastPage" ) ); + aVal.Value <<= mpImplData->mbLastPage; + aResult[nCur++] = aVal; + } + // append IsPrinter + if( aMergeSet.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrinter" ) ) ) == aMergeSet.end() ) + { + PropertyValue aVal; + aVal.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrinter" ) ); + aVal.Value <<= sal_True; + aResult[nCur++] = aVal; + } + aResult.realloc( nCur ); + return aResult; +} + +const Sequence< beans::PropertyValue >& PrinterController::getUIOptions() const +{ + return mpImplData->maUIOptions; +} + +beans::PropertyValue* PrinterController::getValue( const rtl::OUString& i_rProperty ) +{ + std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = + mpImplData->maPropertyToIndex.find( i_rProperty ); + return it != mpImplData->maPropertyToIndex.end() ? &mpImplData->maUIProperties[it->second] : NULL; +} + +const beans::PropertyValue* PrinterController::getValue( const rtl::OUString& i_rProperty ) const +{ + std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = + mpImplData->maPropertyToIndex.find( i_rProperty ); + return it != mpImplData->maPropertyToIndex.end() ? &mpImplData->maUIProperties[it->second] : NULL; +} + +Sequence< beans::PropertyValue > PrinterController::getValues( const Sequence< rtl::OUString >& i_rNames ) const +{ + Sequence< beans::PropertyValue > aRet( i_rNames.getLength() ); + sal_Int32 nFound = 0; + for( sal_Int32 i = 0; i < i_rNames.getLength(); i++ ) + { + const beans::PropertyValue* pVal = getValue( i_rNames[i] ); + if( pVal ) + aRet[ nFound++ ] = *pVal; + } + aRet.realloc( nFound ); + return aRet; +} + +void PrinterController::setValue( const rtl::OUString& i_rName, const Any& i_rValue ) +{ + beans::PropertyValue aVal; + aVal.Name = i_rName; + aVal.Value = i_rValue; + + setValue( aVal ); +} + +void PrinterController::setValue( const beans::PropertyValue& i_rValue ) +{ + std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = + mpImplData->maPropertyToIndex.find( i_rValue.Name ); + if( it != mpImplData->maPropertyToIndex.end() ) + mpImplData->maUIProperties[ it->second ] = i_rValue; + else + { + // insert correct index into property map + mpImplData->maPropertyToIndex[ i_rValue.Name ] = mpImplData->maUIProperties.size(); + mpImplData->maUIProperties.push_back( i_rValue ); + mpImplData->maUIPropertyEnabled.push_back( true ); + } +} + +void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_rOptions ) +{ + DBG_ASSERT( mpImplData->maUIOptions.getLength() == 0, "setUIOptions called twice !" ); + + mpImplData->maUIOptions = i_rOptions; + + for( int i = 0; i < i_rOptions.getLength(); i++ ) + { + Sequence< beans::PropertyValue > aOptProp; + i_rOptions[i].Value >>= aOptProp; + bool bIsEnabled = true; + bool bHaveProperty = false; + rtl::OUString aPropName; + vcl::ImplPrinterControllerData::ControlDependency aDep; + for( int n = 0; n < aOptProp.getLength(); n++ ) + { + const beans::PropertyValue& rEntry( aOptProp[ n ] ); + if( rEntry.Name.equalsAscii( "Property" ) ) + { + PropertyValue aVal; + rEntry.Value >>= aVal; + DBG_ASSERT( mpImplData->maPropertyToIndex.find( aVal.Name ) + == mpImplData->maPropertyToIndex.end(), "duplicate property entry" ); + setValue( aVal ); + aPropName = aVal.Name; + bHaveProperty = true; + } + else if( rEntry.Name.equalsAscii( "Enabled" ) ) + { + sal_Bool bValue = sal_True; + rEntry.Value >>= bValue; + bIsEnabled = bValue; + } + else if( rEntry.Name.equalsAscii( "DependsOnName" ) ) + { + rEntry.Value >>= aDep.maDependsOnName; + } + else if( rEntry.Name.equalsAscii( "DependsOnEntry" ) ) + { + rEntry.Value >>= aDep.mnDependsOnEntry; + } + } + if( bHaveProperty ) + { + vcl::ImplPrinterControllerData::PropertyToIndexMap::const_iterator it = + mpImplData->maPropertyToIndex.find( aPropName ); + // sanity check + if( it != mpImplData->maPropertyToIndex.end() ) + { + mpImplData->maUIPropertyEnabled[ it->second ] = bIsEnabled; + } + if( aDep.maDependsOnName.getLength() > 0 ) + mpImplData->maControlDependencies[ aPropName ] = aDep; + } + } +} + +void PrinterController::enableUIOption( const rtl::OUString& i_rProperty, bool i_bEnable ) +{ + std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = + mpImplData->maPropertyToIndex.find( i_rProperty ); + if( it != mpImplData->maPropertyToIndex.end() ) + { + // call handler only for actual changes + if( ( mpImplData->maUIPropertyEnabled[ it->second ] && ! i_bEnable ) || + ( ! mpImplData->maUIPropertyEnabled[ it->second ] && i_bEnable ) ) + { + mpImplData->maUIPropertyEnabled[ it->second ] = i_bEnable; + rtl::OUString aPropName( i_rProperty ); + mpImplData->maOptionChangeHdl.Call( &aPropName ); + } + } +} + +bool PrinterController::isUIOptionEnabled( const rtl::OUString& i_rProperty ) const +{ + bool bEnabled = false; + std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator prop_it = + mpImplData->maPropertyToIndex.find( i_rProperty ); + if( prop_it != mpImplData->maPropertyToIndex.end() ) + { + bEnabled = mpImplData->maUIPropertyEnabled[prop_it->second]; + + if( bEnabled ) + { + // check control dependencies + vcl::ImplPrinterControllerData::ControlDependencyMap::const_iterator it = + mpImplData->maControlDependencies.find( i_rProperty ); + if( it != mpImplData->maControlDependencies.end() ) + { + // check if the dependency is enabled + // if the dependency is disabled, we are too + bEnabled = isUIOptionEnabled( it->second.maDependsOnName ); + + if( bEnabled ) + { + // does the dependency have the correct value ? + const com::sun::star::beans::PropertyValue* pVal = getValue( it->second.maDependsOnName ); + OSL_ENSURE( pVal, "unknown property in dependency" ); + if( pVal ) + { + sal_Int32 nDepVal = 0; + sal_Bool bDepVal = sal_False; + if( pVal->Value >>= nDepVal ) + { + bEnabled = (nDepVal == it->second.mnDependsOnEntry) || (it->second.mnDependsOnEntry == -1); + } + else if( pVal->Value >>= bDepVal ) + { + // could be a dependency on a checked boolean + // in this case the dependency is on a non zero for checked value + bEnabled = ( bDepVal && it->second.mnDependsOnEntry != 0) || + ( ! bDepVal && it->second.mnDependsOnEntry == 0); + } + else + { + // if the type does not match something is awry + OSL_ENSURE( 0, "strange type in control dependency" ); + bEnabled = false; + } + } + } + } + } + } + return bEnabled; +} + +rtl::OUString PrinterController::getDependency( const rtl::OUString& i_rProperty ) const +{ + rtl::OUString aDependency; + + vcl::ImplPrinterControllerData::ControlDependencyMap::const_iterator it = + mpImplData->maControlDependencies.find( i_rProperty ); + if( it != mpImplData->maControlDependencies.end() ) + aDependency = it->second.maDependsOnName; + + return aDependency; +} + +rtl::OUString PrinterController::makeEnabled( const rtl::OUString& i_rProperty ) +{ + rtl::OUString aDependency; + + vcl::ImplPrinterControllerData::ControlDependencyMap::const_iterator it = + mpImplData->maControlDependencies.find( i_rProperty ); + if( it != mpImplData->maControlDependencies.end() ) + { + if( isUIOptionEnabled( it->second.maDependsOnName ) ) + { + aDependency = it->second.maDependsOnName; + const com::sun::star::beans::PropertyValue* pVal = getValue( aDependency ); + OSL_ENSURE( pVal, "unknown property in dependency" ); + if( pVal ) + { + sal_Int32 nDepVal = 0; + sal_Bool bDepVal = sal_False; + if( pVal->Value >>= nDepVal ) + { + if( it->second.mnDependsOnEntry != -1 ) + { + setValue( aDependency, makeAny( sal_Int32( it->second.mnDependsOnEntry ) ) ); + } + } + else if( pVal->Value >>= bDepVal ) + { + setValue( aDependency, makeAny( sal_Bool( it->second.mnDependsOnEntry != 0 ) ) ); + } + else + { + // if the type does not match something is awry + OSL_ENSURE( 0, "strange type in control dependency" ); + } + } + } + } + + return aDependency; +} + +void PrinterController::setOptionChangeHdl( const Link& i_rHdl ) +{ + mpImplData->maOptionChangeHdl = i_rHdl; +} + +void PrinterController::createProgressDialog() +{ + if( ! mpImplData->mpProgress ) + { + sal_Bool bShow = sal_True; + beans::PropertyValue* pMonitor = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MonitorVisible" ) ) ); + if( pMonitor ) + pMonitor->Value >>= bShow; + else + { + const com::sun::star::beans::PropertyValue* pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsApi" ) ) ); + if( pVal ) + { + sal_Bool bApi = sal_False; + pVal->Value >>= bApi; + bShow = ! bApi; + } + } + + if( bShow && ! Application::IsHeadlessModeEnabled() ) + { + mpImplData->mpProgress = new PrintProgressDialog( NULL, getPageCountProtected() ); + mpImplData->mpProgress->Show(); + } + } +} + +void PrinterController::setMultipage( const MultiPageSetup& i_rMPS ) +{ + mpImplData->maMultiPage = i_rMPS; +} + +const PrinterController::MultiPageSetup& PrinterController::getMultipage() const +{ + return mpImplData->maMultiPage; +} + +void PrinterController::pushPropertiesToPrinter() +{ + sal_Int32 nCopyCount = 1; + // set copycount and collate + const beans::PropertyValue* pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CopyCount" ) ) ); + if( pVal ) + pVal->Value >>= nCopyCount; + sal_Bool bCollate = sal_False; + pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ) ); + if( pVal ) + pVal->Value >>= bCollate; + mpImplData->mpPrinter->SetCopyCount( static_cast<USHORT>(nCopyCount), bCollate ); + + // duplex mode + pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DuplexMode" ) ) ); + if( pVal ) + { + sal_Int16 nDuplex = view::DuplexMode::UNKNOWN; + pVal->Value >>= nDuplex; + switch( nDuplex ) + { + case view::DuplexMode::OFF: mpImplData->mpPrinter->SetDuplexMode( DUPLEX_OFF ); break; + case view::DuplexMode::LONGEDGE: mpImplData->mpPrinter->SetDuplexMode( DUPLEX_LONGEDGE ); break; + case view::DuplexMode::SHORTEDGE: mpImplData->mpPrinter->SetDuplexMode( DUPLEX_SHORTEDGE ); break; + } + } +} + +bool PrinterController::isShowDialogs() const +{ + sal_Bool bApi = getBoolProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsApi" ) ), sal_False ); + return ! bApi && ! Application::IsHeadlessModeEnabled(); +} + +bool PrinterController::isDirectPrint() const +{ + sal_Bool bDirect = getBoolProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDirect" ) ), sal_False ); + return bDirect == sal_True; +} + +sal_Bool PrinterController::getBoolProperty( const rtl::OUString& i_rProperty, sal_Bool i_bFallback ) const +{ + sal_Bool bRet = i_bFallback; + const com::sun::star::beans::PropertyValue* pVal = getValue( i_rProperty ); + if( pVal ) + pVal->Value >>= bRet; + return bRet; +} + +/* + * PrinterOptionsHelper +**/ +Any PrinterOptionsHelper::getValue( const rtl::OUString& i_rPropertyName ) const +{ + Any aRet; + std::hash_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it = + m_aPropertyMap.find( i_rPropertyName ); + if( it != m_aPropertyMap.end() ) + aRet = it->second; + return aRet; +} + +void PrinterOptionsHelper::setValue( const rtl::OUString& i_rPropertyName, const Any& i_rValue ) +{ + m_aPropertyMap[ i_rPropertyName ] = i_rValue; +} + +bool PrinterOptionsHelper::hasProperty( const rtl::OUString& i_rPropertyName ) const +{ + Any aRet; + std::hash_map< rtl::OUString, Any, rtl::OUStringHash >::const_iterator it = + m_aPropertyMap.find( i_rPropertyName ); + return it != m_aPropertyMap.end(); +} + +sal_Bool PrinterOptionsHelper::getBoolValue( const rtl::OUString& i_rPropertyName, sal_Bool i_bDefault ) const +{ + sal_Bool bRet = sal_False; + Any aVal( getValue( i_rPropertyName ) ); + return (aVal >>= bRet) ? bRet : i_bDefault; +} + +sal_Int64 PrinterOptionsHelper::getIntValue( const rtl::OUString& i_rPropertyName, sal_Int64 i_nDefault ) const +{ + sal_Int64 nRet = 0; + Any aVal( getValue( i_rPropertyName ) ); + return (aVal >>= nRet) ? nRet : i_nDefault; +} + +rtl::OUString PrinterOptionsHelper::getStringValue( const rtl::OUString& i_rPropertyName, const rtl::OUString& i_rDefault ) const +{ + rtl::OUString aRet; + Any aVal( getValue( i_rPropertyName ) ); + return (aVal >>= aRet) ? aRet : i_rDefault; +} + +bool PrinterOptionsHelper::processProperties( const Sequence< PropertyValue >& i_rNewProp, + std::set< rtl::OUString >* o_pChangeProp ) +{ + bool bChanged = false; + + // clear the changed set + if( o_pChangeProp ) + o_pChangeProp->clear(); + + sal_Int32 nElements = i_rNewProp.getLength(); + const PropertyValue* pVals = i_rNewProp.getConstArray(); + for( sal_Int32 i = 0; i < nElements; i++ ) + { + bool bElementChanged = false; + std::hash_map< rtl::OUString, Any, rtl::OUStringHash >::iterator it = + m_aPropertyMap.find( pVals[ i ].Name ); + if( it != m_aPropertyMap.end() ) + { + if( it->second != pVals[ i ].Value ) + bElementChanged = true; + } + else + bElementChanged = true; + + if( bElementChanged ) + { + if( o_pChangeProp ) + o_pChangeProp->insert( pVals[ i ].Name ); + m_aPropertyMap[ pVals[i].Name ] = pVals[i].Value; + bChanged = true; + } + } + return bChanged; +} + +void PrinterOptionsHelper::appendPrintUIOptions( uno::Sequence< beans::PropertyValue >& io_rProps ) const +{ + if( m_aUIProperties.getLength() > 0 ) + { + sal_Int32 nIndex = io_rProps.getLength(); + io_rProps.realloc( nIndex+1 ); + PropertyValue aVal; + aVal.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ExtraPrintUIOptions" ) ); + aVal.Value = makeAny( m_aUIProperties ); + io_rProps[ nIndex ] = aVal; + } +} + +Any PrinterOptionsHelper::getUIControlOpt( const rtl::OUString& i_rTitle, + const Sequence< rtl::OUString >& i_rHelpTexts, + const rtl::OUString& i_rType, + const PropertyValue* i_pVal, + const PrinterOptionsHelper::UIControlOptions& i_rControlOptions + ) +{ + sal_Int32 nElements = + 1 // ControlType + + (i_rTitle.getLength() ? 1 : 0) // Text + + (i_rHelpTexts.getLength() ? 1 : 0) // HelpText + + (i_pVal ? 1 : 0) // Property + + i_rControlOptions.maAddProps.getLength() // additional props + + (i_rControlOptions.maGroupHint.getLength() ? 1 : 0) // grouping + + (i_rControlOptions.mbInternalOnly ? 1 : 0) // internal hint + + (i_rControlOptions.mbEnabled ? 0 : 1) // enabled + ; + if( i_rControlOptions.maDependsOnName.getLength() ) + { + nElements += 1; + if( i_rControlOptions.mnDependsOnEntry != -1 ) + nElements += 1; + if( i_rControlOptions.mbAttachToDependency ) + nElements += 1; + } + + Sequence< PropertyValue > aCtrl( nElements ); + sal_Int32 nUsed = 0; + if( i_rTitle.getLength() ) + { + aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ); + aCtrl[nUsed++].Value = makeAny( i_rTitle ); + } + if( i_rHelpTexts.getLength() ) + { + aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) ); + aCtrl[nUsed++].Value = makeAny( i_rHelpTexts ); + } + aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ControlType" ) ); + aCtrl[nUsed++].Value = makeAny( i_rType ); + if( i_pVal ) + { + aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Property" ) ); + aCtrl[nUsed++].Value = makeAny( *i_pVal ); + } + if( i_rControlOptions.maDependsOnName.getLength() ) + { + aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DependsOnName" ) ); + aCtrl[nUsed++].Value = makeAny( i_rControlOptions.maDependsOnName ); + if( i_rControlOptions.mnDependsOnEntry != -1 ) + { + aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DependsOnEntry" ) ); + aCtrl[nUsed++].Value = makeAny( i_rControlOptions.mnDependsOnEntry ); + } + if( i_rControlOptions.mbAttachToDependency ) + { + aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AttachToDependency" ) ); + aCtrl[nUsed++].Value = makeAny( i_rControlOptions.mbAttachToDependency ); + } + } + if( i_rControlOptions.maGroupHint.getLength() ) + { + aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GroupingHint" ) ); + aCtrl[nUsed++].Value <<= i_rControlOptions.maGroupHint; + } + if( i_rControlOptions.mbInternalOnly ) + { + aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InternalUIOnly" ) ); + aCtrl[nUsed++].Value <<= sal_True; + } + if( ! i_rControlOptions.mbEnabled ) + { + aCtrl[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Enabled" ) ); + aCtrl[nUsed++].Value <<= sal_False; + } + + sal_Int32 nAddProps = i_rControlOptions.maAddProps.getLength(); + for( sal_Int32 i = 0; i < nAddProps; i++ ) + aCtrl[ nUsed++ ] = i_rControlOptions.maAddProps[i]; + + DBG_ASSERT( nUsed == nElements, "nUsed != nElements, probable heap corruption" ); + + return makeAny( aCtrl ); +} + +Any PrinterOptionsHelper::getGroupControlOpt( const rtl::OUString& i_rTitle, const rtl::OUString& i_rHelpText ) +{ + Sequence< rtl::OUString > aHelpText; + if( i_rHelpText.getLength() > 0 ) + { + aHelpText.realloc( 1 ); + *aHelpText.getArray() = i_rHelpText; + } + return getUIControlOpt( i_rTitle, aHelpText, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Group" ) ) ); +} + +Any PrinterOptionsHelper::getSubgroupControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rHelpText, + const PrinterOptionsHelper::UIControlOptions& i_rControlOptions + ) +{ + Sequence< rtl::OUString > aHelpText; + if( i_rHelpText.getLength() > 0 ) + { + aHelpText.realloc( 1 ); + *aHelpText.getArray() = i_rHelpText; + } + return getUIControlOpt( i_rTitle, aHelpText, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Subgroup" ) ), + NULL, i_rControlOptions ); +} + +Any PrinterOptionsHelper::getBoolControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rHelpText, + const rtl::OUString& i_rProperty, + sal_Bool i_bValue, + const PrinterOptionsHelper::UIControlOptions& i_rControlOptions + ) +{ + Sequence< rtl::OUString > aHelpText; + if( i_rHelpText.getLength() > 0 ) + { + aHelpText.realloc( 1 ); + *aHelpText.getArray() = i_rHelpText; + } + PropertyValue aVal; + aVal.Name = i_rProperty; + aVal.Value = makeAny( i_bValue ); + return getUIControlOpt( i_rTitle, aHelpText, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Bool" ) ), &aVal, i_rControlOptions ); +} + +Any PrinterOptionsHelper::getChoiceControlOpt( const rtl::OUString& i_rTitle, + const Sequence< rtl::OUString >& i_rHelpText, + const rtl::OUString& i_rProperty, + const Sequence< rtl::OUString >& i_rChoices, + sal_Int32 i_nValue, + const rtl::OUString& i_rType, + const PrinterOptionsHelper::UIControlOptions& i_rControlOptions + ) +{ + UIControlOptions aOpt( i_rControlOptions ); + sal_Int32 nUsed = aOpt.maAddProps.getLength(); + aOpt.maAddProps.realloc( nUsed + 1 ); + aOpt.maAddProps[nUsed].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Choices" ) ); + aOpt.maAddProps[nUsed].Value = makeAny( i_rChoices ); + + PropertyValue aVal; + aVal.Name = i_rProperty; + aVal.Value = makeAny( i_nValue ); + return getUIControlOpt( i_rTitle, i_rHelpText, i_rType, &aVal, aOpt ); +} + +Any PrinterOptionsHelper::getRangeControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rHelpText, + const rtl::OUString& i_rProperty, + sal_Int32 i_nValue, + sal_Int32 i_nMinValue, + sal_Int32 i_nMaxValue, + const PrinterOptionsHelper::UIControlOptions& i_rControlOptions + ) +{ + UIControlOptions aOpt( i_rControlOptions ); + if( i_nMaxValue >= i_nMinValue ) + { + sal_Int32 nUsed = aOpt.maAddProps.getLength(); + aOpt.maAddProps.realloc( nUsed + 2 ); + aOpt.maAddProps[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MinValue" ) ); + aOpt.maAddProps[nUsed++].Value = makeAny( i_nMinValue ); + aOpt.maAddProps[nUsed ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxValue" ) ); + aOpt.maAddProps[nUsed++].Value = makeAny( i_nMaxValue ); + } + + Sequence< rtl::OUString > aHelpText; + if( i_rHelpText.getLength() > 0 ) + { + aHelpText.realloc( 1 ); + *aHelpText.getArray() = i_rHelpText; + } + PropertyValue aVal; + aVal.Name = i_rProperty; + aVal.Value = makeAny( i_nValue ); + return getUIControlOpt( i_rTitle, + aHelpText, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Range" ) ), + &aVal, + aOpt + ); +} + +Any PrinterOptionsHelper::getEditControlOpt( const rtl::OUString& i_rTitle, + const rtl::OUString& i_rHelpText, + const rtl::OUString& i_rProperty, + const rtl::OUString& i_rValue, + const PrinterOptionsHelper::UIControlOptions& i_rControlOptions + ) +{ + Sequence< rtl::OUString > aHelpText; + if( i_rHelpText.getLength() > 0 ) + { + aHelpText.realloc( 1 ); + *aHelpText.getArray() = i_rHelpText; + } + PropertyValue aVal; + aVal.Name = i_rProperty; + aVal.Value = makeAny( i_rValue ); + return getUIControlOpt( i_rTitle, + aHelpText, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Edit" ) ), + &aVal, + i_rControlOptions + ); +} diff --git a/vcl/source/gdi/regband.cxx b/vcl/source/gdi/regband.cxx index 938a30351f9a..09c97ef7cd2b 100644 --- a/vcl/source/gdi/regband.cxx +++ b/vcl/source/gdi/regband.cxx @@ -110,7 +110,7 @@ ImplRegionBand::ImplRegionBand( if ( ! bIgnorePoints) { // Copy points. - ImplRegionBandPoint* pPoint = mpFirstBandPoint; + ImplRegionBandPoint* pPoint = rRegionBand.mpFirstBandPoint; ImplRegionBandPoint* pPrevPointCopy = NULL; while (pPoint != NULL) { diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index 43bb224aaa94..fefbf8cdcb08 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -49,6 +49,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/range/b2drange.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> // ======================================================================= // @@ -1303,9 +1304,7 @@ void Region::Move( long nHorzMove, long nVertMove ) mpImplRegion->mpPolyPoly->Move( nHorzMove, nVertMove ); else if( mpImplRegion->mpB2DPolyPoly ) { - ::basegfx::B2DHomMatrix aTransform; - aTransform.translate( nHorzMove, nVertMove ); - mpImplRegion->mpB2DPolyPoly->transform( aTransform ); + mpImplRegion->mpB2DPolyPoly->transform(basegfx::tools::createTranslateB2DHomMatrix(nHorzMove, nVertMove)); } else { @@ -1346,9 +1345,7 @@ void Region::Scale( double fScaleX, double fScaleY ) mpImplRegion->mpPolyPoly->Scale( fScaleX, fScaleY ); else if( mpImplRegion->mpB2DPolyPoly ) { - ::basegfx::B2DHomMatrix aTransform; - aTransform.scale( fScaleX, fScaleY ); - mpImplRegion->mpB2DPolyPoly->transform( aTransform ); + mpImplRegion->mpB2DPolyPoly->transform(basegfx::tools::createScaleB2DHomMatrix(fScaleX, fScaleY)); } else { @@ -2459,6 +2456,14 @@ SvStream& operator>>( SvStream& rIStrm, Region& rRegion ) } } + if( rIStrm.IsEof() ) + { + DBG_ERROR( "premature end of region stream" ); + delete rRegion.mpImplRegion; + rRegion.mpImplRegion = (ImplRegion*)&aImplEmptyRegion; + return rIStrm; + } + // get next header rIStrm >> nTmp16; } @@ -2537,7 +2542,13 @@ SvStream& operator<<( SvStream& rOStrm, const Region& rRegion ) rOStrm << bHasPolyPolygon; if( bHasPolyPolygon ) - rOStrm << rRegion.GetPolyPolygon(); + { + // #i105373# + PolyPolygon aNoCurvePolyPolygon; + rRegion.GetPolyPolygon().AdaptiveSubdivide(aNoCurvePolyPolygon); + + rOStrm << aNoCurvePolyPolygon; + } } return rOStrm; diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 1e9572887e0b..c1f987377c67 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -52,7 +52,6 @@ #include <vcl/gdimtf.hxx> #include <vcl/outdata.hxx> #include <vcl/print.hxx> -#include <implncvt.hxx> #include <vcl/outdev.h> #include <vcl/outdev.hxx> #include <vcl/unowrap.hxx> diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 21ac05a498fc..c8748c65e2d3 100755 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -44,6 +44,7 @@ #include <vcl/sallayout.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include <i18npool/lang.h> #ifndef _TL_DEBUG_HXX @@ -95,11 +96,12 @@ bool IsDiacritic( sal_UCS4 nChar ) if( nChar >= 0x2100 ) return false; + // TODO: #i105058# use icu uchar.h's character classification instead of the handcrafted table struct DiaRange { sal_UCS4 mnMin, mnEnd;}; static const DiaRange aRanges[] = { {0x0300, 0x0370}, - {0x0590, 0x05C0}, {0x05C1, 0x05C3}, {0x05C3, 0x05C6}, {0x05C7, 0x05C8}, - {0x0610, 0x061B}, {0x064B, 0x0660}, {0x0670, 0x0671}, {0x06D6, 0x06DC}, {0x06DF, 0x06EE}, + {0x0590, 0x05BE}, {0x05BF, 0x05C0}, {0x05C1, 0x05C3}, {0x05C4, 0x05C6}, {0x05C7, 0x05C8}, + {0x0610, 0x061B}, {0x064B, 0x0660}, {0x0670, 0x0671}, {0x06D6, 0x06DD}, {0x06DF, 0x06E5}, {0x06E7, 0x06E9}, {0x06EA,0x06EF}, {0x0730, 0x074D}, {0x07A6, 0x07B1}, {0x07EB, 0x07F4}, #if 0 // all known fonts have zero-width diacritics already, so no need to query it {0x0900, 0x0904}, {0x093C, 0x093D}, {0x0941, 0x0948}, {0x094D, 0x0950}, {0x0951, 0x0958}, @@ -107,7 +109,8 @@ bool IsDiacritic( sal_UCS4 nChar ) {0x0A00, 0x0A05}, {0x0A3C, 0x0A59}, //... #endif {0x1DC0, 0x1E00}, - {0x205F, 0x2070}, {0x20D0, 0x2100} + {0x205F, 0x2070}, {0x20D0, 0x2100}, + {0xFB1E, 0xFB1F} }; // TODO: almost anything is faster than an O(n) search @@ -891,10 +894,8 @@ bool SalLayout::GetOutline( SalGraphics& rSalGraphics, { if( aPos.X() || aPos.Y() ) { - ::basegfx::B2DHomMatrix aMatrix; - aMatrix.translate( aPos.X(), aPos.Y() ); - aGlyphOutline.transform( aMatrix ); - } + aGlyphOutline.transform(basegfx::tools::createTranslateB2DHomMatrix(aPos.X(), aPos.Y())); + } // insert outline at correct position rVector.push_back( aGlyphOutline ); diff --git a/vcl/source/gdi/salmisc.cxx b/vcl/source/gdi/salmisc.cxx index fc24c0289b50..8b442086eabf 100644 --- a/vcl/source/gdi/salmisc.cxx +++ b/vcl/source/gdi/salmisc.cxx @@ -426,10 +426,10 @@ BitmapBuffer* StretchAndConvert( const BitmapBuffer& rSrcBuffer, const SalTwoRec // memory exception, clean up // remark: the buffer ptr causing the exception // is still NULL here - delete pSrcScan; - delete pDstScan; - delete pMapX; - delete pMapY; + delete[] pSrcScan; + delete[] pDstScan; + delete[] pMapX; + delete[] pMapY; delete pDstBuffer; return NULL; } diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx new file mode 100755 index 000000000000..67a30c351b7a --- /dev/null +++ b/vcl/source/gdi/textlayout.cxx @@ -0,0 +1,384 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + +#include "vcl/ctrl.hxx" +#include "vcl/outdev.hxx" +#include "vcl/outfont.hxx" +#include "vcl/textlayout.hxx" + +#include <com/sun/star/i18n/ScriptDirection.hpp> + +#include <tools/diagnose_ex.h> + +#if OSL_DEBUG_LEVEL > 1 +#include <rtl/strbuf.hxx> +#endif + +//........................................................................ +namespace vcl +{ +//........................................................................ + + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::Exception; + namespace ScriptDirection = ::com::sun::star::i18n::ScriptDirection; + + //==================================================================== + //= DefaultTextLayout + //==================================================================== + //-------------------------------------------------------------------- + DefaultTextLayout::~DefaultTextLayout() + { + } + + //-------------------------------------------------------------------- + long DefaultTextLayout::GetTextWidth( const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + { + return m_rTargetDevice.GetTextWidth( _rText, _nStartIndex, _nLength ); + } + + //-------------------------------------------------------------------- + void DefaultTextLayout::DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, + xub_StrLen _nLength, MetricVector* _pVector, String* _pDisplayText ) + { + m_rTargetDevice.DrawText( _rStartPoint, _rText, _nStartIndex, _nLength, _pVector, _pDisplayText ); + } + + //-------------------------------------------------------------------- + bool DefaultTextLayout::GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, + xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + { + return m_rTargetDevice.GetCaretPositions( _rText, _pCaretXArray, _nStartIndex, _nLength ); + } + + //-------------------------------------------------------------------- + xub_StrLen DefaultTextLayout::GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + { + return m_rTargetDevice.GetTextBreak( _rText, _nMaxTextWidth, _nStartIndex, _nLength ); + } + + //-------------------------------------------------------------------- + bool DefaultTextLayout::DecomposeTextRectAction() const + { + return false; + } + + //==================================================================== + //= ReferenceDeviceTextLayout + //==================================================================== + class ReferenceDeviceTextLayout : public ITextLayout + { + public: + ReferenceDeviceTextLayout( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice ); + virtual ~ReferenceDeviceTextLayout(); + + // ITextLayout + virtual long GetTextWidth( const XubString& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const; + virtual void DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength, MetricVector* _pVector, String* _pDisplayText ); + virtual bool GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; + virtual xub_StrLen GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; + virtual bool DecomposeTextRectAction() const; + + public: + // equivalents to the respective OutputDevice methods, which take the reference device into account + long GetTextArray( const XubString& _rText, sal_Int32* _pDXAry, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const; + Rectangle DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText ); + + protected: + void onBeginDrawText() + { + m_aCompleteTextRect.SetEmpty(); + } + Rectangle onEndDrawText() + { + return m_aCompleteTextRect; + } + + private: + OutputDevice& m_rTargetDevice; + OutputDevice& m_rReferenceDevice; + Font m_aUnzoomedPointFont; + const Fraction m_aZoom; + const bool m_bRTLEnabled; + + Rectangle m_aCompleteTextRect; + }; + + //==================================================================== + //= ControlTextRenderer + //==================================================================== + ReferenceDeviceTextLayout::ReferenceDeviceTextLayout( const Control& _rControl, OutputDevice& _rTargetDevice, + OutputDevice& _rReferenceDevice ) + :m_rTargetDevice( _rTargetDevice ) + ,m_rReferenceDevice( _rReferenceDevice ) + ,m_aUnzoomedPointFont( _rControl.GetUnzoomedControlPointFont() ) + ,m_aZoom( _rControl.GetZoom() ) + ,m_bRTLEnabled( _rControl.IsRTLEnabled() ) + { + m_rTargetDevice.Push( PUSH_MAPMODE | PUSH_FONT | PUSH_TEXTLAYOUTMODE ); + + MapMode aTargetMapMode( m_rTargetDevice.GetMapMode() ); + OSL_ENSURE( aTargetMapMode.GetOrigin() == Point(), "ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: uhm, the code below won't work here ..." ); + + // normally, controls simulate "zoom" by "zooming" the font. This is responsible for (part of) the discrepancies + // between text in Writer and text in controls in Writer, though both have the same font. + // So, if we have a zoom set at the control, then we do not scale the font, but instead modify the map mode + // to accomodate for the zoom. + aTargetMapMode.SetScaleX( m_aZoom ); // TODO: shouldn't this be "current_scale * zoom"? + aTargetMapMode.SetScaleY( m_aZoom ); + + // also, use a higher-resolution map unit than "pixels", which should save us some rounding errors when + // translating coordinates between the reference device and the target device. + OSL_ENSURE( aTargetMapMode.GetMapUnit() == MAP_PIXEL, + "ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: this class is not expected to work with such target devices!" ); + // we *could* adjust all the code in this class to handle this case, but at the moment, it's not necessary + const MapUnit eTargetMapUnit = m_rReferenceDevice.GetMapMode().GetMapUnit(); + aTargetMapMode.SetMapUnit( eTargetMapUnit ); + OSL_ENSURE( aTargetMapMode.GetMapUnit() != MAP_PIXEL, + "ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: a reference device which has map mode PIXEL?!" ); + + m_rTargetDevice.SetMapMode( aTargetMapMode ); + + // now that the Zoom is part of the map mode, reset the target device's font to the "unzoomed" version + Font aDrawFont( m_aUnzoomedPointFont ); + aDrawFont.SetSize( m_rTargetDevice.LogicToLogic( aDrawFont.GetSize(), MAP_POINT, eTargetMapUnit ) ); + _rTargetDevice.SetFont( aDrawFont ); + + // transfer font to the reference device + m_rReferenceDevice.Push( PUSH_FONT | PUSH_TEXTLAYOUTMODE ); + Font aRefFont( m_aUnzoomedPointFont ); + aRefFont.SetSize( OutputDevice::LogicToLogic( + aRefFont.GetSize(), MAP_POINT, m_rReferenceDevice.GetMapMode().GetMapUnit() ) ); + m_rReferenceDevice.SetFont( aRefFont ); + } + + //-------------------------------------------------------------------- + ReferenceDeviceTextLayout::~ReferenceDeviceTextLayout() + { + m_rReferenceDevice.Pop(); + m_rTargetDevice.Pop(); + } + + //-------------------------------------------------------------------- + namespace + { + //................................................................ + bool lcl_normalizeLength( const XubString& _rText, const xub_StrLen _nStartIndex, xub_StrLen& _io_nLength ) + { + xub_StrLen nTextLength = _rText.Len(); + if ( _nStartIndex > nTextLength ) + return false; + if ( _nStartIndex + _io_nLength > nTextLength ) + _io_nLength = nTextLength - _nStartIndex; + return true; + } + } + + //-------------------------------------------------------------------- + long ReferenceDeviceTextLayout::GetTextArray( const XubString& _rText, sal_Int32* _pDXAry, xub_StrLen _nStartIndex, + xub_StrLen _nLength ) const + { + if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) + return 0; + + // retrieve the character widths from the reference device + long nTextWidth = m_rReferenceDevice.GetTextArray( _rText, _pDXAry, _nStartIndex, _nLength ); +#if OSL_DEBUG_LEVEL > 1 + if ( _pDXAry ) + { + ::rtl::OStringBuffer aTrace; + aTrace.append( "ReferenceDeviceTextLayout::GetTextArray( " ); + aTrace.append( ::rtl::OUStringToOString( _rText, RTL_TEXTENCODING_UTF8 ) ); + aTrace.append( " ): " ); + aTrace.append( nTextWidth ); + aTrace.append( " = ( " ); + for ( size_t i=0; i<_nLength; ) + { + aTrace.append( _pDXAry[i] ); + if ( ++i < _nLength ) + aTrace.append( ", " ); + } + aTrace.append( ")" ); + OSL_TRACE( aTrace.makeStringAndClear().getStr() ); + } +#endif + return nTextWidth; + } + + //-------------------------------------------------------------------- + long ReferenceDeviceTextLayout::GetTextWidth( const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + { + return GetTextArray( _rText, NULL, _nStartIndex, _nLength ); + } + + //-------------------------------------------------------------------- + void ReferenceDeviceTextLayout::DrawText( const Point& _rStartPoint, const XubString& _rText, xub_StrLen _nStartIndex, xub_StrLen _nLength, MetricVector* _pVector, String* _pDisplayText ) + { + if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) + return; + + if ( _pVector && _pDisplayText ) + { + MetricVector aGlyphBounds; + m_rReferenceDevice.GetGlyphBoundRects( _rStartPoint, _rText, _nStartIndex, _nLength, _nStartIndex, aGlyphBounds ); + ::std::copy( + aGlyphBounds.begin(), aGlyphBounds.end(), + ::std::insert_iterator< MetricVector > ( *_pVector, _pVector->end() ) ); + _pDisplayText->Append( _rText.Copy( _nStartIndex, _nLength ) ); + return; + } + + sal_Int32* pCharWidths = new sal_Int32[ _nLength ]; + long nTextWidth = GetTextArray( _rText, pCharWidths, _nStartIndex, _nLength ); + m_rTargetDevice.DrawTextArray( _rStartPoint, _rText, pCharWidths, _nStartIndex, _nLength ); + delete[] pCharWidths; + + m_aCompleteTextRect.Union( Rectangle( _rStartPoint, Size( nTextWidth, m_rTargetDevice.GetTextHeight() ) ) ); + } + + //-------------------------------------------------------------------- + bool ReferenceDeviceTextLayout::GetCaretPositions( const XubString& _rText, sal_Int32* _pCaretXArray, + xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + { + if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) + return false; + + // retrieve the caret positions from the reference device + if ( !m_rReferenceDevice.GetCaretPositions( _rText, _pCaretXArray, _nStartIndex, _nLength ) ) + return false; + + return true; + } + + //-------------------------------------------------------------------- + xub_StrLen ReferenceDeviceTextLayout::GetTextBreak( const XubString& _rText, long _nMaxTextWidth, xub_StrLen _nStartIndex, xub_StrLen _nLength ) const + { + if ( !lcl_normalizeLength( _rText, _nStartIndex, _nLength ) ) + return 0; + + return m_rReferenceDevice.GetTextBreak( _rText, _nMaxTextWidth, _nStartIndex, _nLength ); + } + + //-------------------------------------------------------------------- + bool ReferenceDeviceTextLayout::DecomposeTextRectAction() const + { + return true; + } + + //-------------------------------------------------------------------- + namespace + { + long zoomBy( long _value, const Fraction& _zoom ) + { + double n = (double)_value; + n *= (double)_zoom.GetNumerator(); + n /= (double)_zoom.GetDenominator(); + return (long)::rtl::math::round( n ); + } + long unzoomBy( long _value, const Fraction& _zoom ) + { + return zoomBy( _value, Fraction( _zoom.GetDenominator(), _zoom.GetNumerator() ) ); + } + } + + //-------------------------------------------------------------------- + Rectangle ReferenceDeviceTextLayout::DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, MetricVector* _pVector, String* _pDisplayText ) + { + if ( !_rText.Len() ) + return Rectangle(); + + // determine text layout mode from the RTL-ness of the control whose text we render + ULONG nTextLayoutMode = m_bRTLEnabled ? TEXT_LAYOUT_BIDI_RTL : TEXT_LAYOUT_BIDI_LTR; + m_rReferenceDevice.SetLayoutMode( nTextLayoutMode ); + m_rTargetDevice.SetLayoutMode( nTextLayoutMode | TEXT_LAYOUT_TEXTORIGIN_LEFT ); + // TEXT_LAYOUT_TEXTORIGIN_LEFT is because when we do actually draw the text (in DrawText( Point, ... )), then + // our caller gives us the left border of the draw position, regardless of script type, text layout, + // and the like + + // in our ctor, we set the map mode of the target device from pixel to twip, but our caller doesn't know this, + // but passed pixel coordinates. So, adjust the rect. + Rectangle aRect( m_rTargetDevice.PixelToLogic( _rRect ) ); + + onBeginDrawText(); + m_rTargetDevice.DrawText( aRect, _rText, _nStyle, _pVector, _pDisplayText, this ); + Rectangle aTextRect = onEndDrawText(); + + if ( aTextRect.IsEmpty() && !aRect.IsEmpty() ) + { + // this happens for instance if we're in a PaintToDevice call, where only a MetaFile is recorded, + // but no actual painting happens, so our "DrawText( Point, ... )" is never called + // In this case, calculate the rect from what OutputDevice::GetTextRect would give us. This has + // the disadvantage of less accuracy, compared with the approach to calculate the rect from the + // single "DrawText( Point, ... )" calls, since more intermediate arithmetics will translate + // from ref- to target-units. + aTextRect = m_rTargetDevice.GetTextRect( aRect, _rText, _nStyle, NULL, this ); + } + + // similar to above, the text rect now contains TWIPs (or whatever unit the ref device has), but the caller + // expects pixel coordinates + aTextRect = m_rTargetDevice.LogicToPixel( aTextRect ); + + // convert the metric vector + if ( _pVector ) + { + for ( MetricVector::iterator charRect = _pVector->begin(); + charRect != _pVector->end(); + ++charRect + ) + { + *charRect = m_rTargetDevice.LogicToPixel( *charRect ); + } + } + + return aTextRect; + } + + //==================================================================== + //= ControlTextRenderer + //==================================================================== + //-------------------------------------------------------------------- + ControlTextRenderer::ControlTextRenderer( const Control& _rControl, OutputDevice& _rTargetDevice, OutputDevice& _rReferenceDevice ) + :m_pImpl( new ReferenceDeviceTextLayout( _rControl, _rTargetDevice, _rReferenceDevice ) ) + { + } + + //-------------------------------------------------------------------- + ControlTextRenderer::~ControlTextRenderer() + { + } + + //-------------------------------------------------------------------- + Rectangle ControlTextRenderer::DrawText( const Rectangle& _rRect, const XubString& _rText, USHORT _nStyle, + MetricVector* _pVector, String* _pDisplayText ) + { + return m_pImpl->DrawText( _rRect, _rText, _nStyle, _pVector, _pDisplayText ); + } + +//........................................................................ +} // namespace vcl +//........................................................................ diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index f1c532a9295f..a13e272e368b 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -359,27 +359,40 @@ BOOL VirtualDevice::SetOutputSizePixel( const Size& rNewSize, BOOL bErase ) // ----------------------------------------------------------------------- -void VirtualDevice::SetReferenceDevice( RefDevMode eRefDevMode ) +void VirtualDevice::SetReferenceDevice( RefDevMode i_eRefDevMode ) { - switch( eRefDevMode ) + sal_Int32 nDPIX = 600, nDPIY = 600; + switch( i_eRefDevMode ) { case REFDEV_NONE: default: DBG_ASSERT( FALSE, "VDev::SetRefDev illegal argument!" ); - // fall through + break; case REFDEV_MODE06: - mnDPIX = mnDPIY = 600; + nDPIX = nDPIY = 600; break; case REFDEV_MODE48: - mnDPIX = mnDPIY = 4800; + nDPIX = nDPIY = 4800; break; case REFDEV_MODE_MSO1: - mnDPIX = mnDPIY = 6*1440; + nDPIX = nDPIY = 6*1440; break; case REFDEV_MODE_PDF1: - mnDPIX = mnDPIY = 720; + nDPIX = nDPIY = 720; break; } + ImplSetReferenceDevice( i_eRefDevMode, nDPIX, nDPIY ); +} + +void VirtualDevice::SetReferenceDevice( sal_Int32 i_nDPIX, sal_Int32 i_nDPIY ) +{ + ImplSetReferenceDevice( REFDEV_CUSTOM, i_nDPIX, i_nDPIY ); +} + +void VirtualDevice::ImplSetReferenceDevice( RefDevMode i_eRefDevMode, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY ) +{ + mnDPIX = i_nDPIX; + mnDPIY = i_nDPIY; EnableOutput( FALSE ); // prevent output on reference device mbScreenComp = FALSE; @@ -391,7 +404,7 @@ void VirtualDevice::SetReferenceDevice( RefDevMode eRefDevMode ) // avoid adjusting font lists when already in refdev mode BYTE nOldRefDevMode = meRefDevMode; BYTE nOldCompatFlag = (BYTE)meRefDevMode & REFDEV_FORCE_ZERO_EXTLEAD; - meRefDevMode = (BYTE)(eRefDevMode | nOldCompatFlag); + meRefDevMode = (BYTE)(i_eRefDevMode | nOldCompatFlag); if( (nOldRefDevMode ^ nOldCompatFlag) != REFDEV_NONE ) return; diff --git a/vcl/source/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx index 712c2334b35c..b92bea929c51 100644 --- a/vcl/source/glyphs/gcach_ftyp.cxx +++ b/vcl/source/glyphs/gcach_ftyp.cxx @@ -43,6 +43,7 @@ #include "tools/poly.hxx" #include "basegfx/matrix/b2dhommatrix.hxx" +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "basegfx/polygon/b2dpolypolygon.hxx" #include "osl/file.hxx" @@ -135,7 +136,8 @@ static int nFTVERSION = 0; static FT_Error (*pFTNewSize)(FT_Face,FT_Size*); static FT_Error (*pFTActivateSize)(FT_Size); static FT_Error (*pFTDoneSize)(FT_Size); -static FT_Error (*pFTEmbolden)(FT_GlyphSlot); +FT_Error (*pFTEmbolden)(FT_GlyphSlot); +FT_Error (*pFTOblique)(FT_GlyphSlot); static bool bEnableSizeFT = false; struct EqStr{ bool operator()(const char* a, const char* b) const { return !strcmp(a,b); } }; @@ -472,6 +474,7 @@ FreetypeManager::FreetypeManager() pFTActivateSize = (FT_Error(*)(FT_Size))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_Activate_Size" ); pFTDoneSize = (FT_Error(*)(FT_Size))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_Done_Size" ); pFTEmbolden = (FT_Error(*)(FT_GlyphSlot))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_GlyphSlot_Embolden" ); + pFTOblique = (FT_Error(*)(FT_GlyphSlot))(sal_IntPtr)dlsym( RTLD_DEFAULT, "FT_GlyphSlot_Oblique" ); bEnableSizeFT = (pFTNewSize!=NULL) && (pFTActivateSize!=NULL) && (pFTDoneSize!=NULL); @@ -2280,9 +2283,7 @@ bool FreetypeServerFont::GetGlyphOutline( int nGlyphIndex, // convert to basegfx polypolygon // TODO: get rid of the intermediate tools polypolygon rB2DPolyPoly = aToolPolyPolygon.getB2DPolyPolygon(); - ::basegfx::B2DHomMatrix aMatrix; - aMatrix.scale( +1.0/(1<<6), -1.0/(1<<6) ); - rB2DPolyPoly.transform( aMatrix ); + rB2DPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix( +1.0/(1<<6), -1.0/(1<<6) )); return true; } @@ -2487,10 +2488,12 @@ bool FreetypeServerFont::ApplyGSUB( const ImplFontSelectData& rFSD ) { const USHORT nGlyph0 = GetUShort( pCoverage+0 ); const USHORT nGlyph1 = GetUShort( pCoverage+2 ); - const USHORT nCovIdx = GetUShort( pCoverage+4 ); + const USHORT nStartCoverageIndex = GetUShort( pCoverage+4 ); + DBG_ASSERT( aSubstVector.size() == nStartCoverageIndex, "coverage index mismatch"); + (void)nStartCoverageIndex; pCoverage += 6; for( USHORT j = nGlyph0; j <= nGlyph1; ++j ) - aSubstVector.push_back( GlyphSubst( j + nCovIdx, 0 ) ); + aSubstVector.push_back( GlyphSubst( j, 0 ) ); } } break; diff --git a/vcl/source/glyphs/glyphcache.cxx b/vcl/source/glyphs/glyphcache.cxx index e3e840e40730..17e70c539254 100644 --- a/vcl/source/glyphs/glyphcache.cxx +++ b/vcl/source/glyphs/glyphcache.cxx @@ -79,9 +79,7 @@ GlyphCache::~GlyphCache() // ----------------------------------------------------------------------- -#ifndef IRIX inline -#endif size_t GlyphCache::IFSD_Hash::operator()( const ImplFontSelectData& rFontSelData ) const { // TODO: is it worth to improve this hash function? diff --git a/vcl/source/glyphs/graphite_adaptors.cxx b/vcl/source/glyphs/graphite_adaptors.cxx index 9b16318fdc40..34e2f5f5bbe3 100644 --- a/vcl/source/glyphs/graphite_adaptors.cxx +++ b/vcl/source/glyphs/graphite_adaptors.cxx @@ -71,6 +71,8 @@ namespace typedef std::hash_map<long,bool> SilfMap; SilfMap sSilfMap; } +extern FT_Error (*pFTEmbolden)(FT_GlyphSlot); +extern FT_Error (*pFTOblique)(FT_GlyphSlot); // class CharacterRenderProperties implentation. // @@ -303,11 +305,11 @@ void GraphiteFontAdaptor::getGlyphMetrics(gr::gid16 nGlyphId, gr::Rect & aBoundi return; } // check whether we need synthetic bold/italic otherwise metric is wrong - if (mrFont.NeedsArtificialBold()) - FT_GlyphSlot_Embolden(aFace->glyph); + if (mrFont.NeedsArtificialBold() && pFTEmbolden) + (*pFTEmbolden)(aFace->glyph); - if (mrFont.NeedsArtificialItalic()) - FT_GlyphSlot_Oblique(aFace->glyph); + if (mrFont.NeedsArtificialItalic() && pFTOblique) + (*pFTOblique)(aFace->glyph); const FT_Glyph_Metrics &gm = aFace->glyph->metrics; diff --git a/vcl/source/glyphs/makefile.mk b/vcl/source/glyphs/makefile.mk index 3e79cdc63da2..e43daaeac2ee 100644 --- a/vcl/source/glyphs/makefile.mk +++ b/vcl/source/glyphs/makefile.mk @@ -42,9 +42,6 @@ ENABLE_EXCEPTIONS=true .INCLUDE : $(PRJ)$/util$/makefile2.pmk CFLAGS+= $(FREETYPE_CFLAGS) -.IF "$(USE_FT_EMBOLDEN)" == "YES" -CFLAGS+=-DUSE_FT_EMBOLDEN -.ENDIF # --- Files -------------------------------------------------------- diff --git a/vcl/source/helper/xconnection.cxx b/vcl/source/helper/xconnection.cxx index 477ff5fb9902..489e3cf9340e 100644 --- a/vcl/source/helper/xconnection.cxx +++ b/vcl/source/helper/xconnection.cxx @@ -30,10 +30,31 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_vcl.hxx" -#include <svsys.h> -#include <vcl/xconnection.hxx> -#include <vcl/svdata.hxx> -#include <vcl/salinst.hxx> + +#include "svsys.h" +#include "vcl/xconnection.hxx" +#include "vcl/svdata.hxx" +#include "vcl/salinst.hxx" +#include "vcl/svapp.hxx" + +namespace vcl +{ + class SolarMutexReleaser + { + ULONG mnReleased; + public: + SolarMutexReleaser() + { + mnReleased = Application::ReleaseSolarMutex(); + } + + ~SolarMutexReleaser() + { + if( mnReleased ) + Application::AcquireSolarMutex( mnReleased ); + } + }; +} using namespace rtl; using namespace osl; @@ -41,6 +62,7 @@ using namespace vcl; using namespace com::sun::star::uno; using namespace com::sun::star::awt; + DisplayConnection::DisplayConnection() { ImplSVData* pSVData = ImplGetSVData(); @@ -108,6 +130,8 @@ Any SAL_CALL DisplayConnection::getIdentifier() throw() void DisplayConnection::dispatchDowningEvent() { + SolarMutexReleaser aRel; + MutexGuard aGuard( m_aMutex ); Any aEvent; std::list< Reference< XEventHandler > > aLocalList( m_aHandlers ); @@ -117,6 +141,8 @@ void DisplayConnection::dispatchDowningEvent() bool DisplayConnection::dispatchEvent( void* pThis, void* pData, int nBytes ) { + SolarMutexReleaser aRel; + DisplayConnection* This = (DisplayConnection*)pThis; MutexGuard aGuard( This->m_aMutex ); @@ -131,6 +157,8 @@ bool DisplayConnection::dispatchEvent( void* pThis, void* pData, int nBytes ) bool DisplayConnection::dispatchErrorEvent( void* pThis, void* pData, int nBytes ) { + SolarMutexReleaser aRel; + DisplayConnection* This = (DisplayConnection*)pThis; MutexGuard aGuard( This->m_aMutex ); diff --git a/vcl/source/src/images.src b/vcl/source/src/images.src index a2b057c8d234..5a0e7b412a58 100644 --- a/vcl/source/src/images.src +++ b/vcl/source/src/images.src @@ -833,3 +833,23 @@ Bitmap (SV_ICON_SMALL_HC_START + SV_ICON_ID_PRINTERADMIN) File = "printeradmin_16_h.png" ; }; +Bitmap SV_DISCLOSURE_PLUS +{ + File = "plus.png"; +}; + +Bitmap SV_DISCLOSURE_PLUS_HC +{ + File = "plus_sch.png"; +}; + +Bitmap SV_DISCLOSURE_MINUS +{ + File = "minus.png"; +}; + +Bitmap SV_DISCLOSURE_MINUS_HC +{ + File = "minus_sch.png"; +}; + diff --git a/vcl/source/src/makefile.mk b/vcl/source/src/makefile.mk index cf01c74b977d..7772af5a0978 100644 --- a/vcl/source/src/makefile.mk +++ b/vcl/source/src/makefile.mk @@ -8,7 +8,7 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.8 $ +# $Revision: 1.8.114.1 $ # # This file is part of OpenOffice.org. # @@ -47,7 +47,8 @@ SRC1FILES= images.src \ stdtext.src \ helptext.src \ units.src \ - btntext.src + btntext.src \ + print.src RESLIB1NAME= $(RESTARGET) RESLIB1IMAGES= $(PRJ)$/source/src diff --git a/vcl/source/src/print.src b/vcl/source/src/print.src new file mode 100644 index 000000000000..0125c0dfbeb3 --- /dev/null +++ b/vcl/source/src/print.src @@ -0,0 +1,495 @@ +/************************************************************************* + * + * 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: print.src,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. + * + ************************************************************************/ + +#include "vcl/svids.hrc" + +ModalDialog SV_DLG_PRINT +{ + Text [en-US] = "Print"; + Closeable = TRUE; + Sizeable = TRUE; + Moveable = TRUE; + Maxable = TRUE; + SVLook = TRUE; + + Size = MAP_APPFONT( 350, 215 ); + + OKButton SV_PRINT_OK + { + DefButton = TRUE; + Pos = MAP_APPFONT( 240, 195 ); + Size = MAP_APPFONT( 50, 15 ); + Text [en-US] = "~Print"; + }; + CancelButton SV_PRINT_CANCEL + { + Pos = MAP_APPFONT( 295, 195 ); + Size = MAP_APPFONT( 50, 15 ); + }; + HelpButton SV_PRINT_HELP + { + Pos = MAP_APPFONT( 5, 5 ); + Size = MAP_APPFONT( 50, 15 ); + }; + + Window SV_PRINT_PAGE_PREVIEW + { + Pos = MAP_APPFONT( 5, 5 ); + Size = MAP_APPFONT( 130, 130 ); + Border = FALSE; + }; + NumericField SV_PRINT_PAGE_EDIT + { + Pos = MAP_APPFONT( 5, 140 ); + Size = MAP_APPFONT( 30, 12 ); + SVLook = TRUE; + Spin = FALSE; + Border = TRUE; + HelpText [en-US] = "Select page to display in preview."; + }; + FixedText SV_PRINT_PAGE_TXT + { + Pos = MAP_APPFONT( 40,142 ); + Size = MAP_APPFONT( 30, 12 ); + Text [ en-US ] = "/ %n"; + VCenter = TRUE; + }; + PushButton SV_PRINT_PAGE_FORWARD + { + Pos = MAP_APPFONT( 95, 140 ); + Size = MAP_APPFONT( 15, 12 ); + HelpText [en-US] = "Scroll one page forward."; + }; + PushButton SV_PRINT_PAGE_BACKWARD + { + Pos = MAP_APPFONT( 80, 140 ); + Size = MAP_APPFONT( 15, 12 ); + HelpText [en-US] = "Scroll one page backward."; + }; + TabControl SV_PRINT_TABCTRL + { + Pos = MAP_APPFONT( 140, 5 ); + Size = MAP_APPFONT( 205, 175 ); + }; + FixedLine SV_PRINT_BUTTONLINE + { + Pos = MAP_APPFONT( 0, 185 ); + Size = MAP_APPFONT( 350, 8 ); + }; + String SV_PRINT_NOPAGES + { + Text [en-US] = "No pages"; + }; + + String SV_PRINT_TOFILE_TXT + { + Text [en-US] = "Print to File..."; + }; + + String SV_PRINT_DEFPRT_TXT + { + Text [en-US] = "Default printer"; + }; + + + String SV_PRINT_PRINTPREVIEW_TXT + { + Text [en-US] = "Print preview"; + }; + + TabPage SV_PRINT_TAB_NUP + { + Text [en-US] = "Page Layout"; + Hide = TRUE; + + FixedLine SV_PRINT_PRT_NUP_LAYOUT_FL + { + Pos = MAP_APPFONT( 5, 5 ); + Size = MAP_APPFONT( 150, 10 ); + Text [en-US] = "Layout"; + }; + RadioButton SV_PRINT_PRT_NUP_DEFAULT_BTN + { + Pos = MAP_APPFONT( 0, 0 ); + Size = MAP_APPFONT( 10, 10 ); + Text [en-US] = "~Default"; + HelpText [en-US] = "Print one page per sheet of paper."; + }; + RadioButton SV_PRINT_PRT_NUP_BROCHURE_BTN + { + Pos = MAP_APPFONT( 0, 0 ); + Size = MAP_APPFONT( 10, 10 ); + Text = ""; + }; + RadioButton SV_PRINT_PRT_NUP_PAGES_BTN + { + Pos = MAP_APPFONT( 0, 0 ); + Size = MAP_APPFONT( 10, 10 ); + Text [en-US] = "Pa~ges per sheet"; + HelpText [en-US] = "Print multiple pages per sheet of paper."; + }; + ListBox SV_PRINT_PRT_NUP_PAGES_BOX + { + Pos = MAP_APPFONT( 0, 0 ); + Size = MAP_APPFONT( 10, 80 ); + Border = TRUE; + DropDown = TRUE; + CurPos = 0; + HelpText [en-US] = "Select how many pages to print per sheet of paper."; + StringList [en-US] = + { + < "1"; 1; >; + < "2"; 2; >; + < "4"; 4; >; + < "6"; 6; >; + < "9"; 9; >; + < "16"; 16; >; + < "Custom"; 0xffff; >; + }; + }; + FixedText SV_PRINT_PRT_NUP_NUM_PAGES_TXT + { + Pos = MAP_APPFONT( 0, 0 ); + Size = MAP_APPFONT( 10, 10 ); + Text [en-US] = "P~ages"; + VCenter = TRUE; + }; + NumericField SV_PRINT_PRT_NUP_COLS_EDT + { + Pos = MAP_APPFONT( 55, 20 ); + Size = MAP_APPFONT( 40, 12 ); + Border = TRUE; + Spin = TRUE; + Minimum = 1; + Maximum = 32; + Value = 1; + HelpText [en-US] = "Select number of columns."; + }; + FixedText SV_PRINT_PRT_NUP_TIMES_TXT + { + Pos = MAP_APPFONT( 10, 35 ); + Size = MAP_APPFONT( 40, 10 ); + Text [en-US] = "b~y"; + VCenter = TRUE; + }; + NumericField SV_PRINT_PRT_NUP_ROWS_EDT + { + Pos = MAP_APPFONT( 55, 35 ); + Size = MAP_APPFONT( 40, 12 ); + Border = TRUE; + Spin = TRUE; + Minimum = 1; + Maximum = 32; + Value = 1; + HelpText [en-US] = "Select number of rows."; + }; + FixedText SV_PRINT_PRT_NUP_MARGINS_PAGES_1_TXT + { + Pos = MAP_APPFONT( 10, 95 ); + Size = MAP_APPFONT( 40, 10 ); + Text [en-US] = "~Distance"; + }; + MetricField SV_PRINT_PRT_NUP_MARGINS_PAGES_EDT + { + Pos = MAP_APPFONT( 55, 95 ); + Size = MAP_APPFONT( 40, 12 ); + Spin = TRUE; + Border = TRUE; + Value = 0; + Unit = FUNIT_MM; + HelpText [en-US] = "Select margin between individual pages on each sheet of paper."; + }; + FixedText SV_PRINT_PRT_NUP_MARGINS_PAGES_2_TXT + { + Pos = MAP_APPFONT( 10, 95 ); + Size = MAP_APPFONT( 40, 10 ); + Text [en-US] = "between pages"; + }; + FixedText SV_PRINT_PRT_NUP_MARGINS_SHEET_1_TXT + { + Pos = MAP_APPFONT( 110, 95 ); + Size = MAP_APPFONT( 40, 10 ); + Text [en-US] = "~Margin"; + }; + MetricField SV_PRINT_PRT_NUP_MARGINS_SHEET_EDT + { + Pos = MAP_APPFONT( 155, 95 ); + Size = MAP_APPFONT( 40, 12 ); + Spin = TRUE; + Border = TRUE; + Value = 0; + Unit = FUNIT_MM; + HelpText [en-US] = "Select margin between the printed pages and paper edge."; + }; + FixedText SV_PRINT_PRT_NUP_MARGINS_SHEET_2_TXT + { + Pos = MAP_APPFONT( 110, 95 ); + Size = MAP_APPFONT( 40, 10 ); + Text [en-US] = "to sheet border"; + }; + FixedText SV_PRINT_PRT_NUP_ORIENTATION_TXT + { + Pos = MAP_APPFONT( 0, 0 ); + Size = MAP_APPFONT( 10, 10 ); + Text [en-US] = "~Orientation"; + }; + ListBox SV_PRINT_PRT_NUP_ORIENTATION_BOX + { + Pos = MAP_APPFONT( 0, 0 ); + Size = MAP_APPFONT( 10, 40 ); + Border = TRUE; + DropDown = TRUE; + CurPos = 0; + StringList [en-US] = + { + < "Automatic"; SV_PRINT_PRT_NUP_ORIENTATION_AUTOMATIC; >; + < "Portrait"; SV_PRINT_PRT_NUP_ORIENTATION_PORTRAIT; >; + < "Landscape"; SV_PRINT_PRT_NUP_ORIENTATION_LANDSCAPE; >; + }; + HelpText [en-US] = "Select the orientation of the paper."; + }; + FixedText SV_PRINT_PRT_NUP_ORDER_TXT + { + Pos = MAP_APPFONT( 0, 0 ); + Size = MAP_APPFONT( 10, 10 ); + Text [en-US] = "Order"; + }; + ListBox SV_PRINT_PRT_NUP_ORDER_BOX + { + Pos = MAP_APPFONT( 0, 0 ); + Size = MAP_APPFONT( 10, 20 ); + DropDown = TRUE; + Border = TRUE; + CurPos = 0; + StringList [en-US] = + { + < "left to right, then down"; SV_PRINT_PRT_NUP_ORDER_LRTD; >; + < "top to bottom, then right"; SV_PRINT_PRT_NUP_ORDER_TDLR; >; + }; + HelpText [en-US] = "Select order in which pages are to be printed."; + }; + CheckBox SV_PRINT_PRT_NUP_BORDER_CB + { + Pos = MAP_APPFONT( 10, 65 ); + Size = MAP_APPFONT( 150, 12 ); + Text [en-US] = "Draw a border around each page"; + HelpText [en-US] = "Check to draw a border around each page."; + }; + }; + + TabPage SV_PRINT_TAB_JOB + { + Text [en-US] = "General"; + Hide = TRUE; + + FixedLine SV_PRINT_PRINTERS_FL + { + Pos = MAP_APPFONT( 5, 5 ); + Size = MAP_APPFONT( 100, 10 ); + Text [ en-US ] = "Prin~ter"; + }; + ListBox SV_PRINT_PRINTERS + { + Pos = MAP_APPFONT( 5, 5 ); + Size = MAP_APPFONT( 100, 80 ); + Border = TRUE; + Sort = TRUE; + HelpText [en-US] = "Select the printer to print on."; + }; + CheckBox SV_PRINT_DETAILS_BTN + { + Pos = MAP_APPFONT( 5, 5 ); + Size = MAP_APPFONT( 5, 5 ); + Text [en-US] = "Details"; + HelpText [en-US] = "Show/Hide detailed information of the selected printer."; + }; + FixedText SV_PRINT_STATUS_TXT + { + Pos = MAP_APPFONT( 5, 5 ); + Size = MAP_APPFONT( 100, 10 ); + Text [en-US] = "Status:"; + }; + FixedText SV_PRINT_LOCATION_TXT + { + Pos = MAP_APPFONT( 5, 5 ); + Size = MAP_APPFONT( 100, 10 ); + Text [en-US] = "Location:"; + }; + FixedText SV_PRINT_COMMENT_TXT + { + Pos = MAP_APPFONT( 5, 5 ); + Size = MAP_APPFONT( 100, 10 ); + Text [en-US] = "Comment:"; + }; + PushButton SV_PRINT_PRT_SETUP + { + Pos = MAP_APPFONT( 115, 5 ); + Size = MAP_APPFONT( 50, 15 ); + Text [en-US] = "Properties..."; + HelpText [en-US] = "Call the setup dialog of the selected printer."; + }; + FixedLine SV_PRINT_COPIES + { + Pos = MAP_APPFONT( 5, 35 ); + Size = MAP_APPFONT( 150, 10 ); + Text [en-US] = "Range and Copies"; + }; + FixedText SV_PRINT_COPYCOUNT + { + Pos = MAP_APPFONT( 10, 45 ); + Size = MAP_APPFONT( 80, 10 ); + Text [en-US] = "Number of copies"; + }; + NumericField SV_PRINT_COPYCOUNT_FIELD + { + Pos = MAP_APPFONT( 10, 56 ); + Size = MAP_APPFONT( 40, 12 ); + Border = TRUE; + Spin = TRUE; + Minimum = 1; + Maximum = 16384; + Value = 1; + HelpText [en-US] = "Select the number of copies to be produced."; + }; + FixedImage SV_PRINT_COLLATE_IMAGE + { + Pos = MAP_APPFONT( 95, 60 ); + Size = MAP_PIXEL( 80, 30 ); + }; + CheckBox SV_PRINT_COLLATE + { + Pos = MAP_APPFONT( 95, 45 ); + Size = MAP_APPFONT( 70, 10 ); + Text [en-US] = "Collate"; + HelpText [en-US] = "Select whether copies should be collated or not."; + }; + + Image SV_PRINT_COLLATE_IMG + { + ImageBitmap = Bitmap { File = "collate.png" ; }; + }; + + Image SV_PRINT_NOCOLLATE_IMG + { + ImageBitmap = Bitmap { File = "ncollate.png" ; }; + }; + + Image SV_PRINT_COLLATE_HC_IMG + { + ImageBitmap = Bitmap { File = "collate_h.png" ; }; + }; + + Image SV_PRINT_NOCOLLATE_HC_IMG + { + ImageBitmap = Bitmap { File = "ncollate_h.png" ; }; + }; + }; + + TabPage SV_PRINT_TAB_OPT + { + Text [en-US] = "Options"; + Hide = TRUE; + + FixedLine SV_PRINT_OPT_PRINT_FL + { + Pos = MAP_APPFONT( 5, 5 ); + Size = MAP_APPFONT( 150, 10 ); + Text [en-US] = "Options"; + }; + CheckBox SV_PRINT_OPT_TOFILE + { + Pos = MAP_APPFONT( 10, 20 ); + Size = MAP_APPFONT( 200, 12 ); + Text [en-US] = "Print to ~file"; + HelpText [en-US] = "Check to send output to a file instead of the actual printer."; + }; + CheckBox SV_PRINT_OPT_SINGLEJOBS + { + Pos = MAP_APPFONT( 10, 35 ); + Size = MAP_APPFONT( 200, 12 ); + Text [en-US] = "~Create single print jobs for collated output"; + HelpText [en-US] = "Check to not rely on the printer to create collated copies but create a print job for each copy instead."; + }; + CheckBox SV_PRINT_OPT_REVERSE + { + Pos = MAP_APPFONT( 10, 50 ); + Size = MAP_APPFONT( 200, 12 ); + Text [en-US] = "Print in ~reverse page order"; + HelpText [en-US] = "Check to print pages in reverse order."; + }; + }; +}; + +ModelessDialog SV_DLG_PRINT_PROGRESS +{ + Text [en-US] = "Printing"; + Closeable = FALSE; + Sizeable = FALSE; + Moveable = TRUE; + SVLook = TRUE; + + Size = MAP_APPFONT( 120, 70 ); + + CancelButton SV_PRINT_PROGRESS_CANCEL + { + Pos = MAP_APPFONT( 35, 50 ); + Size = MAP_APPFONT( 50, 15 ); + }; + FixedText SV_PRINT_PROGRESS_TEXT + { + Pos = MAP_APPFONT( 5,10 ); + Size = MAP_APPFONT( 110, 10 ); + Text [ en-US ] = "Page %p of %n"; + Center = TRUE; + }; +}; + +ErrorBox SV_PRINT_NOPRINTERWARNING +{ + Title = "%PRODUCTNAME"; + Message [en-US] = "No default printer found.\nPlease choose a printer and try again."; +}; + +ErrorBox SV_PRINT_NOCONTENT +{ + Title = "%PRODUCTNAME"; + Message [en-US] = "There are no pages to be printed. Please check your document for ranges relevant to printing."; +}; + +StringArray SV_PRINT_NATIVE_STRINGS +{ + ItemList [en-US] = + { + < "Preview"; >; + < "Page number"; >; + < "Number of pages"; >; + < "More"; >; + }; +}; diff --git a/vcl/source/src/stdtext.src b/vcl/source/src/stdtext.src index 5ad1cdceeb61..d4dca4915b6b 100644 --- a/vcl/source/src/stdtext.src +++ b/vcl/source/src/stdtext.src @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: stdtext.src,v $ - * $Revision: 1.53 $ + * $Revision: 1.53.84.1 $ * * This file is part of OpenOffice.org. * @@ -123,3 +123,8 @@ String SV_MAC_SCREENNNAME { Text [en-US] = "Screen %d"; }; + +String SV_STDTEXT_ALLFILETYPES +{ + Text [en-US] = "Any type"; +}; diff --git a/vcl/source/window/accmgr.cxx b/vcl/source/window/accmgr.cxx index 71373bbabee5..36064fc8bc6b 100644 --- a/vcl/source/window/accmgr.cxx +++ b/vcl/source/window/accmgr.cxx @@ -83,6 +83,23 @@ void ImplAccelManager::RemoveAccel( Accelerator* pAccel ) if ( !mpAccelList ) return; + //e.g. #i90599#. Someone starts typing a sequence in a dialog, but doesn't + //end it, and then closes the dialog, deleting the accelerators. So if + //we're removing an accelerator that a sub-accelerator which is in the + //sequence list, throw away the entire sequence + if ( mpSequenceList ) + { + for (USHORT i = 0; i < pAccel->GetItemCount(); ++i) + { + Accelerator* pSubAccel = pAccel->GetAccel(pAccel->GetItemId(i)); + if ( mpSequenceList->GetPos( pSubAccel ) != LIST_ENTRY_NOTFOUND ) + { + EndSequence( true ); + break; + } + } + } + // Raus damit mpAccelList->Remove( pAccel ); } diff --git a/vcl/source/window/arrange.cxx b/vcl/source/window/arrange.cxx new file mode 100644 index 000000000000..0199af7ed50d --- /dev/null +++ b/vcl/source/window/arrange.cxx @@ -0,0 +1,906 @@ +/************************************************************************* + * + * 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: accel.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. + * + ************************************************************************/ + +#include "precompiled_vcl.hxx" + +#include "vcl/arrange.hxx" +#include "vcl/edit.hxx" + +#include "osl/diagnose.h" + +using namespace vcl; + +// ---------------------------------------- +// vcl::WindowArranger +//----------------------------------------- + +WindowArranger::~WindowArranger() +{} + +void WindowArranger::setParent( WindowArranger* i_pParent ) +{ + OSL_VERIFY( i_pParent->m_pParentWindow == m_pParentWindow || m_pParentWindow == NULL ); + + m_pParentArranger = i_pParent; + m_pParentWindow = i_pParent->m_pParentWindow; + setParentWindow( m_pParentWindow ); +} + +void WindowArranger::setParentWindow( Window* i_pNewParent ) +{ + m_pParentWindow = i_pNewParent; + + size_t nEle = countElements(); + for( size_t i = 0; i < nEle; i++ ) + { + Element* pEle = getElement( i ); + if( pEle ) // sanity check + { + #if OSL_DEBUG_LEVEL > 0 + if( pEle->m_pElement ) + { + OSL_VERIFY( pEle->m_pElement->GetParent() == i_pNewParent ); + } + #endif + if( pEle->m_pChild ) + pEle->m_pChild->setParentWindow( i_pNewParent ); + } + } +} + +void WindowArranger::show( bool i_bShow, bool i_bImmediateUpdate ) +{ + size_t nEle = countElements(); + for( size_t i = 0; i < nEle; i++ ) + { + Element* pEle = getElement( i ); + if( pEle ) // sanity check + { + pEle->m_bHidden = ! i_bShow; + if( pEle->m_pElement ) + pEle->m_pElement->Show( i_bShow ); + if( pEle->m_pChild.get() ) + pEle->m_pChild->show( i_bShow, false ); + } + } + if( m_pParentArranger ) + { + nEle = m_pParentArranger->countElements(); + for( size_t i = 0; i < nEle; i++ ) + { + Element* pEle = m_pParentArranger->getElement( i ); + if( pEle && pEle->m_pChild.get() == this ) + { + pEle->m_bHidden = ! i_bShow; + break; + } + } + } + if( i_bImmediateUpdate ) + { + // find the topmost parent + WindowArranger* pResize = this; + while( pResize->m_pParentArranger ) + pResize = pResize->m_pParentArranger; + pResize->resize(); + } +} + +bool WindowArranger::isVisible() const +{ + size_t nEle = countElements(); + for( size_t i = 0; i < nEle; i++ ) + { + const Element* pEle = getConstElement( i ); + if( pEle->isVisible() ) + return true; + } + return false; +} + +bool WindowArranger::Element::isVisible() const +{ + bool bVisible = false; + if( ! m_bHidden ) + { + if( m_pElement ) + bVisible = m_pElement->IsVisible(); + else if( m_pChild ) + bVisible = m_pChild->isVisible(); + } + return bVisible; +} + +sal_Int32 WindowArranger::Element::getExpandPriority() const +{ + sal_Int32 nPrio = m_nExpandPriority; + if( m_pChild && m_nExpandPriority >= 0 ) + { + size_t nElements = m_pChild->countElements(); + for( size_t i = 0; i < nElements; i++ ) + { + sal_Int32 nCPrio = m_pChild->getExpandPriority( i ); + if( nCPrio > nPrio ) + nPrio = nCPrio; + } + } + return nPrio; +} + +Size WindowArranger::Element::getOptimalSize( WindowSizeType i_eType ) const +{ + Size aResult; + if( ! m_bHidden ) + { + if( m_pElement && m_pElement->IsVisible() ) + aResult = m_pElement->GetOptimalSize( i_eType ); + else if( m_pChild ) + aResult = m_pChild->getOptimalSize( i_eType ); + if( aResult.Width() < m_aMinSize.Width() ) + aResult.Width() = m_aMinSize.Width(); + if( aResult.Height() < m_aMinSize.Height() ) + aResult.Height() = m_aMinSize.Height(); + aResult.Width() += m_nLeftBorder + m_nRightBorder; + aResult.Height() += m_nTopBorder + m_nBottomBorder; + } + + return aResult; +} + +void WindowArranger::Element::setPosSize( const Point& i_rPos, const Size& i_rSize ) +{ + Point aPoint( i_rPos ); + Size aSize( i_rSize ); + aPoint.X() += m_nLeftBorder; + aPoint.Y() += m_nTopBorder; + aSize.Width() -= m_nLeftBorder + m_nRightBorder; + aSize.Height() -= m_nTopBorder + m_nBottomBorder; + if( m_pElement ) + m_pElement->SetPosSizePixel( aPoint, aSize ); + else if( m_pChild ) + m_pChild->setManagedArea( Rectangle( aPoint, aSize ) ); +} + +// ---------------------------------------- +// vcl::RowOrColumn +//----------------------------------------- + +RowOrColumn::~RowOrColumn() +{ + for( std::vector< WindowArranger::Element >::iterator it = m_aElements.begin(); + it != m_aElements.end(); ++it ) + { + it->deleteChild(); + } +} + +Size RowOrColumn::getOptimalSize( WindowSizeType i_eType ) const +{ + Size aRet( 0, 0 ); + for( std::vector< WindowArranger::Element >::const_iterator it = m_aElements.begin(); + it != m_aElements.end(); ++it ) + { + if( it->isVisible() ) + { + // get the size of type of the managed element + Size aElementSize( it->getOptimalSize( i_eType ) ); + if( m_bColumn ) + { + // add the distance between elements + aRet.Height() += m_nBorderWidth; + // check if the width needs adjustment + if( aRet.Width() < aElementSize.Width() ) + aRet.Width() = aElementSize.Width(); + aRet.Height() += aElementSize.Height(); + } + else + { + // add the distance between elements + aRet.Width() += m_nBorderWidth; + // check if the height needs adjustment + if( aRet.Height() < aElementSize.Height() ) + aRet.Height() = aElementSize.Height(); + aRet.Width() += aElementSize.Width(); + } + } + } + + if( aRet.Width() != 0 || aRet.Height() != 0 ) + { + // subtract the border for the first element + if( m_bColumn ) + aRet.Height() -= m_nBorderWidth; + else + aRet.Width() -= m_nBorderWidth; + + // add the outer border + aRet.Width() += 2*m_nOuterBorder; + aRet.Height() += 2*m_nOuterBorder; + } + + return aRet; +} + +void RowOrColumn::distributeRowWidth( std::vector<Size>& io_rSizes, long /*i_nUsedWidth*/, long i_nExtraWidth ) +{ + if( ! io_rSizes.empty() && io_rSizes.size() == m_aElements.size() ) + { + // find all elements with the highest expand priority + size_t nElements = m_aElements.size(); + std::vector< size_t > aIndices; + sal_Int32 nHighPrio = 0; + for( size_t i = 0; i < nElements; i++ ) + { + if( m_aElements[ i ].isVisible() ) + { + sal_Int32 nCurPrio = m_aElements[ i ].getExpandPriority(); + if( nCurPrio > nHighPrio ) + { + aIndices.clear(); + nHighPrio = nCurPrio; + } + if( nCurPrio == nHighPrio ) + aIndices.push_back( i ); + } + } + + // distribute extra space evenly among collected elements + nElements = aIndices.size(); + if( nElements > 0 ) + { + long nDelta = i_nExtraWidth / nElements; + for( size_t i = 0; i < nElements; i++ ) + { + io_rSizes[ aIndices[i] ].Width() += nDelta; + i_nExtraWidth -= nDelta; + } + // add the last pixels to the last row element + if( i_nExtraWidth > 0 && nElements > 0 ) + io_rSizes[aIndices.back()].Width() += i_nExtraWidth; + } + } +} + +void RowOrColumn::distributeColumnHeight( std::vector<Size>& io_rSizes, long /*i_nUsedHeight*/, long i_nExtraHeight ) +{ + if( ! io_rSizes.empty() && io_rSizes.size() == m_aElements.size() ) + { + // find all elements with the highest expand priority + size_t nElements = m_aElements.size(); + std::vector< size_t > aIndices; + sal_Int32 nHighPrio = 3; + for( size_t i = 0; i < nElements; i++ ) + { + if( m_aElements[ i ].isVisible() ) + { + sal_Int32 nCurPrio = m_aElements[ i ].getExpandPriority(); + if( nCurPrio > nHighPrio ) + { + aIndices.clear(); + nHighPrio = nCurPrio; + } + if( nCurPrio == nHighPrio ) + aIndices.push_back( i ); + } + } + + // distribute extra space evenly among collected elements + nElements = aIndices.size(); + if( nElements > 0 ) + { + long nDelta = i_nExtraHeight / nElements; + for( size_t i = 0; i < nElements; i++ ) + { + io_rSizes[ aIndices[i] ].Height() += nDelta; + i_nExtraHeight -= nDelta; + } + // add the last pixels to the last row element + if( i_nExtraHeight > 0 && nElements > 0 ) + io_rSizes[aIndices.back()].Height() += i_nExtraHeight; + } + } +} + +void RowOrColumn::resize() +{ + // check if we can get optimal size, else fallback to minimal size + Size aOptSize( getOptimalSize( WINDOWSIZE_PREFERRED ) ); + WindowSizeType eType = WINDOWSIZE_PREFERRED; + if( m_bColumn ) + { + if( aOptSize.Height() > m_aManagedArea.GetHeight() ) + eType = WINDOWSIZE_MINIMUM; + } + else + { + if( aOptSize.Width() > m_aManagedArea.GetWidth() ) + eType = WINDOWSIZE_MINIMUM; + } + + size_t nElements = m_aElements.size(); + // get all element sizes for sizing + std::vector<Size> aElementSizes( nElements ); + long nUsedWidth = 2*m_nOuterBorder - (nElements ? m_nBorderWidth : 0); + for( size_t i = 0; i < nElements; i++ ) + { + if( m_aElements[i].isVisible() ) + { + aElementSizes[i] = m_aElements[i].getOptimalSize( eType ); + if( m_bColumn ) + { + aElementSizes[i].Width() = m_aManagedArea.GetWidth() - 2* m_nOuterBorder; + nUsedWidth += aElementSizes[i].Height() + m_nBorderWidth; + } + else + { + aElementSizes[i].Height() = m_aManagedArea.GetHeight() - 2* m_nOuterBorder; + nUsedWidth += aElementSizes[i].Width() + m_nBorderWidth; + } + } + } + + long nExtraWidth = (m_bColumn ? m_aManagedArea.GetHeight() : m_aManagedArea.GetWidth()) - nUsedWidth; + if( nExtraWidth > 0 ) + { + if( m_bColumn ) + distributeColumnHeight( aElementSizes, nUsedWidth, nExtraWidth ); + else + distributeRowWidth( aElementSizes, nUsedWidth, nExtraWidth ); + } + + // get starting position + Point aElementPos( m_aManagedArea.TopLeft() ); + // outer border + aElementPos.X() += m_nOuterBorder; + aElementPos.Y() += m_nOuterBorder; + + // position managed windows + for( size_t i = 0; i < nElements; i++ ) + { + // get the size of type of the managed element + if( m_aElements[i].isVisible() ) + { + m_aElements[i].setPosSize( aElementPos, aElementSizes[i] ); + if( m_bColumn ) + aElementPos.Y() += m_nBorderWidth + aElementSizes[i].Height(); + else + aElementPos.X() += m_nBorderWidth + aElementSizes[i].Width(); + } + } +} + +size_t RowOrColumn::addWindow( Window* i_pWindow, sal_Int32 i_nExpandPrio, size_t i_nIndex ) +{ + size_t nIndex = i_nIndex; + if( i_nIndex >= m_aElements.size() ) + { + nIndex = m_aElements.size(); + m_aElements.push_back( WindowArranger::Element( i_pWindow, boost::shared_ptr<WindowArranger>(), i_nExpandPrio ) ); + } + else + { + std::vector< WindowArranger::Element >::iterator it = m_aElements.begin(); + while( i_nIndex-- ) + ++it; + m_aElements.insert( it, WindowArranger::Element( i_pWindow, boost::shared_ptr<WindowArranger>(), i_nExpandPrio ) ); + } + return nIndex; +} + +size_t RowOrColumn::addChild( boost::shared_ptr<WindowArranger> const & i_pChild, sal_Int32 i_nExpandPrio, size_t i_nIndex ) +{ + size_t nIndex = i_nIndex; + if( i_nIndex >= m_aElements.size() ) + { + nIndex = m_aElements.size(); + m_aElements.push_back( WindowArranger::Element( NULL, i_pChild, i_nExpandPrio ) ); + } + else + { + std::vector< WindowArranger::Element >::iterator it = m_aElements.begin(); + while( i_nIndex-- ) + ++it; + m_aElements.insert( it, WindowArranger::Element( NULL, i_pChild, i_nExpandPrio ) ); + } + return nIndex; +} + +void RowOrColumn::remove( Window* i_pWindow ) +{ + if( i_pWindow ) + { + for( std::vector< WindowArranger::Element >::iterator it = m_aElements.begin(); + it != m_aElements.end(); ++it ) + { + if( it->m_pElement == i_pWindow ) + { + m_aElements.erase( it ); + return; + } + } + } +} + +void RowOrColumn::remove( boost::shared_ptr<WindowArranger> const & i_pChild ) +{ + if( i_pChild ) + { + for( std::vector< WindowArranger::Element >::iterator it = m_aElements.begin(); + it != m_aElements.end(); ++it ) + { + if( it->m_pChild == i_pChild ) + { + m_aElements.erase( it ); + return; + } + } + } +} + +// ---------------------------------------- +// vcl::LabeledElement +//----------------------------------------- + +LabeledElement::~LabeledElement() +{ + m_aLabel.deleteChild(); + m_aElement.deleteChild(); +} + +Size LabeledElement::getOptimalSize( WindowSizeType i_eType ) const +{ + Size aRet( m_aLabel.getOptimalSize( WINDOWSIZE_MINIMUM ) ); + if( aRet.Width() != 0 ) + { + if( m_nLabelColumnWidth != 0 ) + aRet.Width() = m_nLabelColumnWidth; + else + aRet.Width() += m_nDistance; + } + Size aElementSize( m_aElement.getOptimalSize( i_eType ) ); + aRet.Width() += aElementSize.Width(); + if( aElementSize.Height() > aRet.Height() ) + aRet.Height() = aElementSize.Height(); + if( aRet.Height() != 0 ) + aRet.Height() += 2*m_nOuterBorder; + + return aRet; +} + +void LabeledElement::resize() +{ + Size aLabelSize( m_aLabel.getOptimalSize( WINDOWSIZE_MINIMUM ) ); + Size aElementSize( m_aElement.getOptimalSize( WINDOWSIZE_PREFERRED ) ); + if( m_nDistance + aLabelSize.Width() + aElementSize.Width() > m_aManagedArea.GetWidth() ) + aElementSize = m_aElement.getOptimalSize( WINDOWSIZE_MINIMUM ); + + // align label and element vertically in LabeledElement + long nYOff = (m_aManagedArea.GetHeight() - 2*m_nOuterBorder - aLabelSize.Height()) / 2; + Point aPos( m_aManagedArea.Left(), + m_aManagedArea.Top() + m_nOuterBorder + nYOff ); + Size aSize( aLabelSize ); + if( m_nLabelColumnWidth != 0 ) + aSize.Width() = m_nLabelColumnWidth; + m_aLabel.setPosSize( aPos, aSize ); + + aPos.X() += aSize.Width() + m_nDistance; + nYOff = (m_aManagedArea.GetHeight() - 2*m_nOuterBorder - aElementSize.Height()) / 2; + aPos.Y() = m_aManagedArea.Top() + m_nOuterBorder + nYOff; + aSize.Width() = aElementSize.Width(); + aSize.Height() = m_aManagedArea.GetHeight() - 2*m_nOuterBorder; + + // label style + // 0: position left and right + // 1: keep the element close to label and grow it + // 2: keep the element close and don't grow it + if( m_nLabelStyle == 0) + { + if( aPos.X() + aSize.Width() < m_aManagedArea.Right() ) + aPos.X() = m_aManagedArea.Right() - aSize.Width(); + } + else if( m_nLabelStyle == 1 ) + { + if( aPos.X() + aSize.Width() < m_aManagedArea.Right() ) + aSize.Width() = m_aManagedArea.Right() - aPos.X(); + } + m_aElement.setPosSize( aPos, aSize ); +} + +void LabeledElement::setLabel( Window* i_pLabel ) +{ + m_aLabel.m_pElement = i_pLabel; + m_aLabel.m_pChild.reset(); +} + +void LabeledElement::setLabel( boost::shared_ptr<WindowArranger> const & i_pLabel ) +{ + m_aLabel.m_pElement = NULL; + m_aLabel.m_pChild = i_pLabel; +} + +void LabeledElement::setElement( Window* i_pElement ) +{ + m_aElement.m_pElement = i_pElement; + m_aElement.m_pChild.reset(); +} + +void LabeledElement::setElement( boost::shared_ptr<WindowArranger> const & i_pElement ) +{ + m_aElement.m_pElement = NULL; + m_aElement.m_pChild = i_pElement; +} + +// ---------------------------------------- +// vcl::LabelColumn +//----------------------------------------- +LabelColumn::~LabelColumn() +{ +} + +long LabelColumn::getLabelWidth() const +{ + long nWidth = 0; + + size_t nEle = countElements(); + for( size_t i = 0; i < nEle; i++ ) + { + const Element* pEle = getConstElement( i ); + if( pEle && pEle->m_pChild.get() ) + { + const LabeledElement* pLabel = dynamic_cast< const LabeledElement* >(pEle->m_pChild.get()); + if( pLabel ) + { + Window* pLW = pLabel->getWindow( 0 ); + if( pLW ) + { + Size aLabSize( pLW->GetOptimalSize( WINDOWSIZE_MINIMUM ) ); + if( aLabSize.Width() > nWidth ) + nWidth = aLabSize.Width(); + } + } + } + } + return nWidth + getBorderWidth(); +} + +Size LabelColumn::getOptimalSize( WindowSizeType i_eType ) const +{ + long nWidth = getLabelWidth(); + Size aColumnSize; + + // every child is a LabeledElement + size_t nEle = countElements(); + for( size_t i = 0; i < nEle; i++ ) + { + Size aElementSize; + const Element* pEle = getConstElement( i ); + if( pEle && pEle->m_pChild.get() ) + { + const LabeledElement* pLabel = dynamic_cast< const LabeledElement* >(pEle->m_pChild.get()); + if( pLabel ) // we have a label + { + aElementSize = pLabel->getLabelSize( WINDOWSIZE_MINIMUM ); + if( aElementSize.Width() ) + aElementSize.Width() = nWidth; + Size aSize( pLabel->getElementSize( i_eType ) ); + aElementSize.Width() += aSize.Width(); + if( aSize.Height() > aElementSize.Height() ) + aElementSize.Height() = aSize.Height(); + } + else // a non label, just treat it as a row + { + aElementSize = pEle->getOptimalSize( i_eType ); + } + } + else if( pEle && pEle->m_pElement ) // a general window, treat is as a row + { + aElementSize = pEle->getOptimalSize( i_eType ); + } + if( aElementSize.Width() ) + { + aElementSize.Width() += 2*m_nOuterBorder; + if( aElementSize.Width() > aColumnSize.Width() ) + aColumnSize.Width() = aElementSize.Width(); + } + if( aElementSize.Height() ) + { + aColumnSize.Height() += getBorderWidth() + aElementSize.Height(); + } + } + if( nEle > 0 && aColumnSize.Height() ) + { + aColumnSize.Height() -= getBorderWidth(); // for the first element + aColumnSize.Height() += 2*m_nOuterBorder; + } + return aColumnSize; +} + +void LabelColumn::resize() +{ + long nWidth = getLabelWidth(); + size_t nEle = countElements(); + for( size_t i = 0; i < nEle; i++ ) + { + Element* pEle = getElement( i ); + if( pEle && pEle->m_pChild.get() ) + { + LabeledElement* pLabel = dynamic_cast< LabeledElement* >(pEle->m_pChild.get()); + if( pLabel ) + pLabel->setLabelColumnWidth( nWidth ); + } + } + RowOrColumn::resize(); +} + +size_t LabelColumn::addRow( Window* i_pLabel, boost::shared_ptr<WindowArranger> const& i_rElement, long i_nIndent ) +{ + boost::shared_ptr< LabeledElement > xLabel( new LabeledElement( this, 1 ) ); + xLabel->setLabel( i_pLabel ); + xLabel->setBorders( 0, i_nIndent, 0, 0, 0 ); + xLabel->setElement( i_rElement ); + size_t nIndex = addChild( xLabel ); + resize(); + return nIndex; +} + +size_t LabelColumn::addRow( Window* i_pLabel, Window* i_pElement, long i_nIndent ) +{ + boost::shared_ptr< LabeledElement > xLabel( new LabeledElement( this, 1 ) ); + xLabel->setLabel( i_pLabel ); + xLabel->setBorders( 0, i_nIndent, 0, 0, 0 ); + xLabel->setElement( i_pElement ); + size_t nIndex = addChild( xLabel ); + resize(); + return nIndex; +} + +// ---------------------------------------- +// vcl::Indenter +//----------------------------------------- + +Indenter::~Indenter() +{ + m_aElement.deleteChild(); +} + +Size Indenter::getOptimalSize( WindowSizeType i_eType ) const +{ + Size aSize( m_aElement.getOptimalSize( i_eType ) ); + aSize.Width() += 2*m_nOuterBorder + m_nIndent; + aSize.Height() += 2*m_nOuterBorder; + return aSize; +} + +void Indenter::resize() +{ + Point aPt( m_aManagedArea.TopLeft() ); + aPt.X() += m_nOuterBorder + m_nIndent; + aPt.Y() += m_nOuterBorder; + Size aSz( m_aManagedArea.GetSize() ); + aSz.Width() -= 2*m_nOuterBorder + m_nIndent; + aSz.Height() -= 2*m_nOuterBorder; + m_aElement.setPosSize( aPt, aSz ); +} + +void Indenter::setWindow( Window* i_pWindow, sal_Int32 i_nExpandPrio ) +{ + OSL_VERIFY( (m_aElement.m_pElement == 0 && m_aElement.m_pChild == 0) || i_pWindow == 0 ); + OSL_VERIFY( i_pWindow == 0 || i_pWindow->GetParent() == m_pParentWindow ); + m_aElement.m_pElement = i_pWindow; + m_aElement.m_nExpandPriority = i_nExpandPrio; +} + +void Indenter::setChild( boost::shared_ptr<WindowArranger> const & i_pChild, sal_Int32 i_nExpandPrio ) +{ + OSL_VERIFY( (m_aElement.m_pElement == 0 && m_aElement.m_pChild == 0 ) || i_pChild == 0 ); + m_aElement.m_pChild = i_pChild; + m_aElement.m_nExpandPriority = i_nExpandPrio; +} + +// ---------------------------------------- +// vcl::MatrixArranger +//----------------------------------------- +MatrixArranger::~MatrixArranger() +{ +} + +Size MatrixArranger::getOptimalSize( WindowSizeType i_eType, std::vector<long>& o_rColumnWidths, std::vector<long>& o_rRowHeights ) const +{ + Size aMatrixSize( 2*m_nOuterBorder, 2*m_nOuterBorder ); + + // first find out the current number of rows and columns + sal_uInt32 nRows = 0, nColumns = 0; + for( std::vector< MatrixElement >::const_iterator it = m_aElements.begin(); + it != m_aElements.end(); ++it ) + { + if( it->m_nX >= nColumns ) + nColumns = it->m_nX+1; + if( it->m_nY >= nRows ) + nRows = it->m_nY+1; + } + + // now allocate row and column depth vectors + o_rColumnWidths = std::vector< long >( nColumns, 0 ); + o_rRowHeights = std::vector< long >( nRows, 0 ); + + // get sizes an allocate them into rows/columns + for( std::vector< MatrixElement >::const_iterator it = m_aElements.begin(); + it != m_aElements.end(); ++it ) + { + Size aSize( it->getOptimalSize( i_eType ) ); + if( aSize.Width() > o_rColumnWidths[ it->m_nX ] ) + o_rColumnWidths[ it->m_nX ] = aSize.Width(); + if( aSize.Height() > o_rRowHeights[ it->m_nY ] ) + o_rRowHeights[ it->m_nY ] = aSize.Height(); + } + + // add up sizes + for( sal_uInt32 i = 0; i < nColumns; i++ ) + aMatrixSize.Width() += o_rColumnWidths[i] + m_nBorderX; + if( nColumns > 0 ) + aMatrixSize.Width() -= m_nBorderX; + + for( sal_uInt32 i = 0; i < nRows; i++ ) + aMatrixSize.Height() += o_rRowHeights[i] + m_nBorderY; + if( nRows > 0 ) + aMatrixSize.Height() -= m_nBorderY; + + return aMatrixSize; +} + +Size MatrixArranger::getOptimalSize( WindowSizeType i_eType ) const +{ + std::vector<long> aColumnWidths, aRowHeights; + return getOptimalSize( i_eType, aColumnWidths, aRowHeights ); +} + +void MatrixArranger::resize() +{ + // assure that we have at least one row and column + if( m_aElements.empty() ) + return; + + // check if we can get optimal size, else fallback to minimal size + std::vector<long> aColumnWidths, aRowHeights; + Size aOptSize( getOptimalSize( WINDOWSIZE_PREFERRED, aColumnWidths, aRowHeights ) ); + if( aOptSize.Height() > m_aManagedArea.GetHeight() || + aOptSize.Width() > m_aManagedArea.GetWidth() ) + { + std::vector<long> aMinColumnWidths, aMinRowHeights; + getOptimalSize( WINDOWSIZE_MINIMUM, aMinColumnWidths, aMinRowHeights ); + if( aOptSize.Height() > m_aManagedArea.GetHeight() ) + aRowHeights = aMinRowHeights; + if( aOptSize.Width() > m_aManagedArea.GetWidth() ) + aColumnWidths = aMinColumnWidths; + } + + // FIXME: distribute extra space available + + // prepare offsets + std::vector<long> aColumnX( aColumnWidths.size() ); + aColumnX[0] = m_aManagedArea.Left() + m_nOuterBorder; + for( size_t i = 1; i < aColumnX.size(); i++ ) + aColumnX[i] = aColumnX[i-1] + aColumnWidths[i-1] + m_nBorderX; + + std::vector<long> aRowY( aRowHeights.size() ); + aRowY[0] = m_aManagedArea.Top() + m_nOuterBorder; + for( size_t i = 1; i < aRowY.size(); i++ ) + aRowY[i] = aRowY[i-1] + aRowHeights[i-1] + m_nBorderY; + + // now iterate over the elements and assign their positions + for( std::vector< MatrixElement >::iterator it = m_aElements.begin(); + it != m_aElements.end(); ++it ) + { + Point aCellPos( aColumnX[it->m_nX], aRowY[it->m_nY] ); + Size aCellSize( aColumnWidths[it->m_nX], aRowHeights[it->m_nY] ); + it->setPosSize( aCellPos, aCellSize ); + } +} + +size_t MatrixArranger::addWindow( Window* i_pWindow, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio ) +{ + sal_uInt64 nMapValue = getMap( i_nX, i_nY ); + std::map< sal_uInt64, size_t >::const_iterator it = m_aMatrixMap.find( nMapValue ); + size_t nIndex = 0; + if( it == m_aMatrixMap.end() ) + { + m_aMatrixMap[ nMapValue ] = nIndex = m_aElements.size(); + m_aElements.push_back( MatrixElement( i_pWindow, i_nX, i_nY, boost::shared_ptr<WindowArranger>(), i_nExpandPrio ) ); + } + else + { + MatrixElement& rEle( m_aElements[ it->second ] ); + rEle.m_pElement = i_pWindow; + rEle.m_pChild.reset(); + rEle.m_nExpandPriority = i_nExpandPrio; + rEle.m_nX = i_nX; + rEle.m_nY = i_nY; + nIndex = it->second; + } + return nIndex; +} + +void MatrixArranger::remove( Window* i_pWindow ) +{ + if( i_pWindow ) + { + for( std::vector< MatrixElement >::iterator it = m_aElements.begin(); + it != m_aElements.end(); ++it ) + { + if( it->m_pElement == i_pWindow ) + { + m_aMatrixMap.erase( getMap( it->m_nX, it->m_nY ) ); + m_aElements.erase( it ); + return; + } + } + } +} + +size_t MatrixArranger::addChild( boost::shared_ptr<WindowArranger> const &i_pChild, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio ) +{ + sal_uInt64 nMapValue = getMap( i_nX, i_nY ); + std::map< sal_uInt64, size_t >::const_iterator it = m_aMatrixMap.find( nMapValue ); + size_t nIndex = 0; + if( it == m_aMatrixMap.end() ) + { + m_aMatrixMap[ nMapValue ] = nIndex = m_aElements.size(); + m_aElements.push_back( MatrixElement( NULL, i_nX, i_nY, i_pChild, i_nExpandPrio ) ); + } + else + { + MatrixElement& rEle( m_aElements[ it->second ] ); + rEle.m_pElement = 0; + rEle.m_pChild = i_pChild; + rEle.m_nExpandPriority = i_nExpandPrio; + rEle.m_nX = i_nX; + rEle.m_nY = i_nY; + nIndex = it->second; + } + return nIndex; +} + +void MatrixArranger::remove( boost::shared_ptr<WindowArranger> const &i_pChild ) +{ + if( i_pChild ) + { + for( std::vector< MatrixElement >::iterator it = m_aElements.begin(); + it != m_aElements.end(); ++it ) + { + if( it->m_pChild == i_pChild ) + { + m_aMatrixMap.erase( getMap( it->m_nX, it->m_nY ) ); + m_aElements.erase( it ); + return; + } + } + } +} + diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 1fc2b9be703a..997e63d8b22e 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -453,6 +453,14 @@ Dialog::~Dialog() // ----------------------------------------------------------------------- +IMPL_LINK( Dialog, ImplAsyncCloseHdl, void*, EMPTYARG ) +{ + Close(); + return 0; +} + +// ----------------------------------------------------------------------- + long Dialog::Notify( NotifyEvent& rNEvt ) { // Zuerst Basisklasse rufen wegen TabSteuerung @@ -468,7 +476,11 @@ long Dialog::Notify( NotifyEvent& rNEvt ) if ( (nKeyCode == KEY_ESCAPE) && ((GetStyle() & WB_CLOSEABLE) || ImplGetCancelButton( this ) || ImplGetOKButton( this )) ) { - Close(); + // #i89505# for the benefit of slightly mentally challenged implementations + // like e.g. SfxModelessDialog which destroy themselves inside Close() + // post this Close asynchronous so we can leave our key handler before + // we get destroyed + PostUserEvent( LINK( this, Dialog, ImplAsyncCloseHdl ), this ); return TRUE; } } diff --git a/vcl/source/window/makefile.mk b/vcl/source/window/makefile.mk index 169cf44b2b13..21b8efe4c586 100644 --- a/vcl/source/window/makefile.mk +++ b/vcl/source/window/makefile.mk @@ -8,7 +8,7 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.25 $ +# $Revision: 1.25.114.1 $ # # This file is part of OpenOffice.org. # @@ -45,6 +45,7 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- SLOFILES= \ + $(SLO)$/arrange.obj \ $(SLO)$/abstdlg.obj \ $(SLO)$/accel.obj \ $(SLO)$/accmgr.obj \ @@ -70,6 +71,7 @@ SLOFILES= \ $(SLO)$/mnemonicengine.obj \ $(SLO)$/msgbox.obj \ $(SLO)$/scrwnd.obj \ + $(SLO)$/printdlg.obj \ $(SLO)$/seleng.obj \ $(SLO)$/split.obj \ $(SLO)$/splitwin.obj \ diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index ebd4475a80fc..c9e0c23e7f16 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -5136,15 +5136,23 @@ IMPL_LINK( MenuBarWindow, CloserHdl, PushButton*, EMPTYARG ) return 0; if( aCloser.GetCurItemId() == IID_DOCUMENTCLOSE ) - return ((MenuBar*)pMenu)->GetCloserHdl().Call( pMenu ); - std::map<USHORT,AddButtonEntry>::iterator it = m_aAddButtons.find( aCloser.GetCurItemId() ); - if( it != m_aAddButtons.end() ) { - MenuBar::MenuBarButtonCallbackArg aArg; - aArg.nId = it->first; - aArg.bHighlight = (aCloser.GetHighlightItemId() == it->first); - aArg.pMenuBar = dynamic_cast<MenuBar*>(pMenu); - return it->second.m_aSelectLink.Call( &aArg ); + // #i106052# call close hdl asynchronously to ease handler implementation + // this avoids still being in the handler while the DecoToolBox already + // gets destroyed + Application::PostUserEvent( ((MenuBar*)pMenu)->GetCloserHdl(), pMenu ); + } + else + { + std::map<USHORT,AddButtonEntry>::iterator it = m_aAddButtons.find( aCloser.GetCurItemId() ); + if( it != m_aAddButtons.end() ) + { + MenuBar::MenuBarButtonCallbackArg aArg; + aArg.nId = it->first; + aArg.bHighlight = (aCloser.GetHighlightItemId() == it->first); + aArg.pMenuBar = dynamic_cast<MenuBar*>(pMenu); + return it->second.m_aSelectLink.Call( &aArg ); + } } return 0; } diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx new file mode 100644 index 000000000000..649ca21a32b8 --- /dev/null +++ b/vcl/source/window/printdlg.cxx @@ -0,0 +1,2489 @@ +/************************************************************************* + * + * 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: printdlg.cxx,v $ + * $Revision: 1.1.2.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. + * + ************************************************************************/ + +#include "precompiled_vcl.hxx" + +#include "vcl/print.hxx" +#include "vcl/prndlg.hxx" +#include "vcl/dialog.hxx" +#include "vcl/button.hxx" +#include "vcl/svdata.hxx" +#include "vcl/svids.hrc" +#include "vcl/wall.hxx" +#include "vcl/jobset.h" +#include "vcl/status.hxx" +#include "vcl/decoview.hxx" +#include "vcl/arrange.hxx" +#include "vcl/configsettings.hxx" +#include "vcl/help.hxx" +#include "vcl/decoview.hxx" +#include "vcl/svapp.hxx" + +#include "unotools/localedatawrapper.hxx" + +#include "rtl/ustrbuf.hxx" + +#include "com/sun/star/awt/Size.hpp" + +using namespace vcl; +using namespace com::sun::star; +using namespace com::sun::star::uno; +using namespace com::sun::star::beans; + +#define HELPID_PREFIX ".HelpId:vcl:PrintDialog" +#define SMHID2( a, b ) SetSmartHelpId( SmartId( String( RTL_CONSTASCII_USTRINGPARAM( HELPID_PREFIX ":" a ":" b ) ), HID_PRINTDLG ) ) +#define SMHID1( a ) SetSmartHelpId( SmartId( String( RTL_CONSTASCII_USTRINGPARAM( HELPID_PREFIX ":" a ) ), HID_PRINTDLG ) ) + +PrintDialog::PrintPreviewWindow::PrintPreviewWindow( Window* i_pParent, const ResId& i_rId ) + : Window( i_pParent, i_rId ) + , maOrigSize( 10, 10 ) + , maPageVDev( *this ) + , maToolTipString( String( VclResId( SV_PRINT_PRINTPREVIEW_TXT ) ) ) +{ + SetPaintTransparent( TRUE ); + SetBackground(); + if( GetSettings().GetStyleSettings().GetHighContrastMode() ) + maPageVDev.SetBackground( GetSettings().GetStyleSettings().GetWindowColor() ); + else + maPageVDev.SetBackground( Color( COL_WHITE ) ); +} + +PrintDialog::PrintPreviewWindow::~PrintPreviewWindow() +{ +} + +void PrintDialog::PrintPreviewWindow::DataChanged( const DataChangedEvent& i_rDCEvt ) +{ + // react on settings changed + if( i_rDCEvt.GetType() == DATACHANGED_SETTINGS ) + { + if( GetSettings().GetStyleSettings().GetHighContrastMode() ) + maPageVDev.SetBackground( GetSettings().GetStyleSettings().GetWindowColor() ); + else + maPageVDev.SetBackground( Color( COL_WHITE ) ); + } + Window::DataChanged( i_rDCEvt ); +} + +void PrintDialog::PrintPreviewWindow::Resize() +{ + Size aNewSize( GetSizePixel() ); + // leave small space for decoration + aNewSize.Width() -= 2; + aNewSize.Height() -= 2; + Size aScaledSize; + double fScale = 1.0; + + // #i106435# catch corner case of Size(0,0) + Size aOrigSize( maOrigSize ); + if( aOrigSize.Width() < 1 ) + aOrigSize.Width() = aNewSize.Width(); + if( aOrigSize.Height() < 1 ) + aOrigSize.Height() = aNewSize.Height(); + if( aOrigSize.Width() > aOrigSize.Height() ) + { + aScaledSize = Size( aNewSize.Width(), aNewSize.Width() * aOrigSize.Height() / aOrigSize.Width() ); + if( aScaledSize.Height() > aNewSize.Height() ) + fScale = double(aNewSize.Height())/double(aScaledSize.Height()); + } + else + { + aScaledSize = Size( aNewSize.Height() * aOrigSize.Width() / aOrigSize.Height(), aNewSize.Height() ); + if( aScaledSize.Width() > aNewSize.Width() ) + fScale = double(aNewSize.Width())/double(aScaledSize.Width()); + } + aScaledSize.Width() = long(aScaledSize.Width()*fScale); + aScaledSize.Height() = long(aScaledSize.Height()*fScale); + maPageVDev.SetOutputSizePixel( aScaledSize, FALSE ); +} + +void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& ) +{ + Size aSize( GetSizePixel() ); + if( maReplacementString.getLength() != 0 ) + { + // replacement is active + Push(); + Rectangle aTextRect( Point( 0, 0 ), aSize ); + Font aFont( GetSettings().GetStyleSettings().GetFieldFont() ); + aFont.SetSize( Size( 0, aSize.Height()/12 ) ); + SetFont( aFont ); + DrawText( aTextRect, maReplacementString, + TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER | TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE + ); + Pop(); + } + else + { + GDIMetaFile aMtf( maMtf ); + + Size aPreviewSize = maPageVDev.GetOutputSizePixel(); + Point aOffset( (aSize.Width() - aPreviewSize.Width()) / 2, + (aSize.Height() - aPreviewSize.Height()) / 2 ); + + const Size aLogicSize( maPageVDev.PixelToLogic( aPreviewSize, MapMode( MAP_100TH_MM ) ) ); + Size aOrigSize( maOrigSize ); + if( aOrigSize.Width() < 1 ) + aOrigSize.Width() = aLogicSize.Width(); + if( aOrigSize.Height() < 1 ) + aOrigSize.Height() = aLogicSize.Height(); + double fScale = double(aLogicSize.Width())/double(aOrigSize.Width()); + + + maPageVDev.Erase(); + maPageVDev.Push(); + maPageVDev.SetMapMode( MAP_100TH_MM ); + aMtf.WindStart(); + aMtf.Scale( fScale, fScale ); + aMtf.WindStart(); + aMtf.Play( &maPageVDev, Point( 0, 0 ), aLogicSize ); + maPageVDev.Pop(); + + SetMapMode( MAP_PIXEL ); + maPageVDev.SetMapMode( MAP_PIXEL ); + DrawOutDev( aOffset, aPreviewSize, Point( 0, 0 ), aPreviewSize, maPageVDev ); + + DecorationView aVw( this ); + aOffset.X() -= 1; aOffset.Y() -=1; aPreviewSize.Width() += 2; aPreviewSize.Height() += 2; + aVw.DrawFrame( Rectangle( aOffset, aPreviewSize ), FRAME_DRAW_GROUP ); + } +} + +void PrintDialog::PrintPreviewWindow::Command( const CommandEvent& rEvt ) +{ + if( rEvt.GetCommand() == COMMAND_WHEEL ) + { + const CommandWheelData* pWheelData = rEvt.GetWheelData(); + PrintDialog* pDlg = dynamic_cast<PrintDialog*>(GetParent()); + if( pDlg ) + { + if( pWheelData->GetDelta() > 0 ) + pDlg->previewForward(); + else if( pWheelData->GetDelta() < 0 ) + pDlg->previewBackward(); + /* + else + huh ? + */ + } + } +} + +void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPreview, + const Size& i_rOrigSize, + const rtl::OUString& i_rReplacement, + sal_Int32 i_nDPIX, + sal_Int32 i_nDPIY + ) +{ + rtl::OUStringBuffer aBuf( 256 ); + aBuf.append( maToolTipString ); + #if OSL_DEBUG_LEVEL > 0 + aBuf.appendAscii( "\n---\nPageSize: " ); + aBuf.append( sal_Int32( i_rOrigSize.Width()/100) ); + aBuf.appendAscii( "mm x " ); + aBuf.append( sal_Int32( i_rOrigSize.Height()/100) ); + aBuf.appendAscii( "mm" ); + #endif + SetQuickHelpText( aBuf.makeStringAndClear() ); + maMtf = i_rNewPreview; + if( GetSettings().GetStyleSettings().GetHighContrastMode() && + GetSettings().GetStyleSettings().GetWindowColor().IsDark() + ) + { + maMtf.ReplaceColors( Color( COL_BLACK ), Color( COL_WHITE ), 30 ); + } + + maOrigSize = i_rOrigSize; + maReplacementString = i_rReplacement; + maPageVDev.SetReferenceDevice( i_nDPIX, i_nDPIY ); + maPageVDev.EnableOutput( TRUE ); + Resize(); + Invalidate(); +} + +PrintDialog::ShowNupOrderWindow::ShowNupOrderWindow( Window* i_pParent ) + : Window( i_pParent, WB_NOBORDER ) + , mnOrderMode( 0 ) + , mnRows( 1 ) + , mnColumns( 1 ) +{ + ImplInitSettings(); +} + +PrintDialog::ShowNupOrderWindow::~ShowNupOrderWindow() +{ +} + +void PrintDialog::ShowNupOrderWindow::ImplInitSettings() +{ + SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) ); +} + +void PrintDialog::ShowNupOrderWindow::Paint( const Rectangle& i_rRect ) +{ + Window::Paint( i_rRect ); + SetMapMode( MAP_PIXEL ); + SetTextColor( GetSettings().GetStyleSettings().GetFieldTextColor() ); + + int nPages = mnRows * mnColumns; + Font aFont( GetSettings().GetStyleSettings().GetFieldFont() ); + aFont.SetSize( Size( 0, 24 ) ); + SetFont( aFont ); + Size aSampleTextSize( GetTextWidth( rtl::OUString::valueOf( sal_Int32(nPages+1) ) ), GetTextHeight() ); + + Size aOutSize( GetOutputSizePixel() ); + Size aSubSize( aOutSize.Width() / mnColumns, aOutSize.Height() / mnRows ); + // calculate font size: shrink the sample text so it fits + double fX = double(aSubSize.Width())/double(aSampleTextSize.Width()); + double fY = double(aSubSize.Height())/double(aSampleTextSize.Height()); + double fScale = (fX < fY) ? fX : fY; + long nFontHeight = long(24.0*fScale) - 3; + if( nFontHeight < 5 ) + nFontHeight = 5; + aFont.SetSize( Size( 0, nFontHeight ) ); + SetFont( aFont ); + long nTextHeight = GetTextHeight(); + for( int i = 0; i < nPages; i++ ) + { + rtl::OUString aPageText( rtl::OUString::valueOf( sal_Int32(i+1) ) ); + int nX = 0, nY = 0; + switch( mnOrderMode ) + { + case SV_PRINT_PRT_NUP_ORDER_LRTD: + nX = (i % mnColumns); nY = (i / mnColumns); + break; + case SV_PRINT_PRT_NUP_ORDER_TDLR: + nX = (i / mnRows); nY = (i % mnRows); + break; + } + Size aTextSize( GetTextWidth( aPageText ), nTextHeight ); + int nDeltaX = (aSubSize.Width() - aTextSize.Width()) / 2; + int nDeltaY = (aSubSize.Height() - aTextSize.Height()) / 2; + DrawText( Point( nX * aSubSize.Width() + nDeltaX, + nY * aSubSize.Height() + nDeltaY ), + aPageText ); + } + DecorationView aVw( this ); + aVw.DrawFrame( Rectangle( Point( 0, 0), aOutSize ), FRAME_DRAW_GROUP ); +} + +PrintDialog::NUpTabPage::NUpTabPage( Window* i_pParent, const ResId& rResId ) + : TabPage( i_pParent, rResId ) + , maNupLine( this, VclResId( SV_PRINT_PRT_NUP_LAYOUT_FL ) ) + , maPagesBtn( this, VclResId( SV_PRINT_PRT_NUP_PAGES_BTN ) ) + , maBrochureBtn( this, VclResId( SV_PRINT_PRT_NUP_BROCHURE_BTN ) ) + , maPagesBoxTitleTxt( this, 0 ) + , maNupPagesBox( this, VclResId( SV_PRINT_PRT_NUP_PAGES_BOX ) ) + , maNupNumPagesTxt( this, VclResId( SV_PRINT_PRT_NUP_NUM_PAGES_TXT ) ) + , maNupColEdt( this, VclResId( SV_PRINT_PRT_NUP_COLS_EDT ) ) + , maNupTimesTxt( this, VclResId( SV_PRINT_PRT_NUP_TIMES_TXT ) ) + , maNupRowsEdt( this, VclResId( SV_PRINT_PRT_NUP_ROWS_EDT ) ) + , maPageMarginTxt1( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_PAGES_1_TXT ) ) + , maPageMarginEdt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_PAGES_EDT ) ) + , maPageMarginTxt2( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_PAGES_2_TXT ) ) + , maSheetMarginTxt1( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_SHEET_1_TXT ) ) + , maSheetMarginEdt( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_SHEET_EDT ) ) + , maSheetMarginTxt2( this, VclResId( SV_PRINT_PRT_NUP_MARGINS_SHEET_2_TXT ) ) + , maNupOrientationTxt( this, VclResId( SV_PRINT_PRT_NUP_ORIENTATION_TXT ) ) + , maNupOrientationBox( this, VclResId( SV_PRINT_PRT_NUP_ORIENTATION_BOX ) ) + , maNupOrderTxt( this, VclResId( SV_PRINT_PRT_NUP_ORDER_TXT ) ) + , maNupOrderBox( this, VclResId( SV_PRINT_PRT_NUP_ORDER_BOX ) ) + , maNupOrderWin( this ) + , maBorderCB( this, VclResId( SV_PRINT_PRT_NUP_BORDER_CB ) ) +{ + FreeResource(); + + maNupOrderWin.Show(); + maPagesBtn.Check( TRUE ); + maBrochureBtn.Show( FALSE ); + + // setup field units for metric fields + const LocaleDataWrapper& rLocWrap( maPageMarginEdt.GetLocaleDataWrapper() ); + FieldUnit eUnit = FUNIT_MM; + USHORT nDigits = 0; + if( rLocWrap.getMeasurementSystemEnum() == MEASURE_US ) + { + eUnit = FUNIT_INCH; + nDigits = 2; + } + // set units + maPageMarginEdt.SetUnit( eUnit ); + maSheetMarginEdt.SetUnit( eUnit ); + + // set precision + maPageMarginEdt.SetDecimalDigits( nDigits ); + maSheetMarginEdt.SetDecimalDigits( nDigits ); + + SMHID1( "NUpPage" ); + maNupLine.SMHID2("NUpPage", "Layout"); + maBrochureBtn.SMHID2("NUpPage", "Brochure" ); + maPagesBtn.SMHID2( "NUpPage", "PagesPerSheet" ); + maPagesBoxTitleTxt.SMHID2( "NUpPage", "PagesPerSheetLabel" ); + maNupPagesBox.SMHID2( "NUpPage", "PagesPerSheetBox" ); + maNupNumPagesTxt.SMHID2( "NUpPage", "Columns" ); + maNupColEdt.SMHID2( "NUpPage", "ColumnsBox" ); + maNupTimesTxt.SMHID2( "NUpPage", "Rows" ); + maNupRowsEdt.SMHID2( "NUpPage", "RowsBox" ); + maPageMarginTxt1.SMHID2( "NUpPage", "PageMargin" ); + maPageMarginEdt.SMHID2( "NUpPage", "PageMarginBox" ); + maPageMarginTxt2.SMHID2( "NUpPage", "PageMarginCont" ); + maSheetMarginTxt1.SMHID2( "NUpPage", "SheetMargin" ); + maSheetMarginEdt.SMHID2( "NUpPage", "SheetMarginBox" ); + maSheetMarginTxt2.SMHID2( "NUpPage", "SheetMarginCont" ); + maNupOrientationTxt.SMHID2( "NUpPage", "Orientation" ); + maNupOrientationBox.SMHID2( "NUpPage", "OrientationBox" ); + maNupOrderTxt.SMHID2( "NUpPage", "Order" ); + maNupOrderBox.SMHID2( "NUpPage", "OrderBox" ); + maBorderCB.SMHID2( "NUpPage", "BorderBox" ); + + setupLayout(); +} + +PrintDialog::NUpTabPage::~NUpTabPage() +{ +} + +void PrintDialog::NUpTabPage::enableNupControls( bool bEnable ) +{ + maNupPagesBox.Enable( TRUE ); + maNupNumPagesTxt.Enable( bEnable ); + maNupColEdt.Enable( bEnable ); + maNupTimesTxt.Enable( bEnable ); + maNupRowsEdt.Enable( bEnable ); + maPageMarginTxt1.Enable( bEnable ); + maPageMarginEdt.Enable( bEnable ); + maPageMarginTxt2.Enable( bEnable ); + maSheetMarginTxt1.Enable( bEnable ); + maSheetMarginEdt.Enable( bEnable ); + maSheetMarginTxt2.Enable( bEnable ); + maNupOrientationTxt.Enable( bEnable ); + maNupOrientationBox.Enable( bEnable ); + maNupOrderTxt.Enable( bEnable ); + maNupOrderBox.Enable( bEnable ); + maNupOrderWin.Enable( bEnable ); + maBorderCB.Enable( bEnable ); +} + +void PrintDialog::NUpTabPage::showAdvancedControls( bool i_bShow ) +{ + maNupNumPagesTxt.Show( i_bShow ); + maNupColEdt.Show( i_bShow ); + maNupTimesTxt.Show( i_bShow ); + maNupRowsEdt.Show( i_bShow ); + maPageMarginTxt1.Show( i_bShow ); + maPageMarginEdt.Show( i_bShow ); + maPageMarginTxt2.Show( i_bShow ); + maSheetMarginTxt1.Show( i_bShow ); + maSheetMarginEdt.Show( i_bShow ); + maSheetMarginTxt2.Show( i_bShow ); + maNupOrientationTxt.Show( i_bShow ); + maNupOrientationBox.Show( i_bShow ); + maLayout.resize(); +} + +void PrintDialog::NUpTabPage::setupLayout() +{ + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + long nIndent = 3*aBorder.Width(); + + maLayout.setParentWindow( this ); + maLayout.setOuterBorder( aBorder.Width() ); + + maLayout.addWindow( &maNupLine ); + boost::shared_ptr< vcl::RowOrColumn > xRow( new vcl::RowOrColumn( &maLayout, false ) ); + maLayout.addChild( xRow ); + boost::shared_ptr< vcl::Indenter > xIndent( new vcl::Indenter( xRow.get() ) ); + xRow->addChild( xIndent ); + + boost::shared_ptr< vcl::RowOrColumn > xShowNupCol( new vcl::RowOrColumn( xRow.get() ) ); + xRow->addChild( xShowNupCol, -1 ); + xShowNupCol->setMinimumSize( xShowNupCol->addWindow( &maNupOrderWin ), Size( 70, 70 ) ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( xShowNupCol.get() ) ); + xShowNupCol->addChild( xSpacer ); + + boost::shared_ptr< vcl::LabelColumn > xMainCol( new vcl::LabelColumn( xIndent.get() ) ); + xIndent->setChild( xMainCol ); + + size_t nPagesIndex = xMainCol->addRow( &maPagesBtn, &maNupPagesBox ); + mxPagesBtnLabel = boost::dynamic_pointer_cast<vcl::LabeledElement>( xMainCol->getChild( nPagesIndex ) ); + + xRow.reset( new vcl::RowOrColumn( xMainCol.get(), false ) ); + xMainCol->addRow( &maNupNumPagesTxt, xRow, nIndent ); + xRow->addWindow( &maNupColEdt ); + xRow->addWindow( &maNupTimesTxt ); + xRow->addWindow( &maNupRowsEdt ); + + boost::shared_ptr< vcl::LabeledElement > xLab( new vcl::LabeledElement( xMainCol.get(), 2 ) ); + xLab->setLabel( &maPageMarginEdt ); + xLab->setElement( &maPageMarginTxt2 ); + xMainCol->addRow( &maPageMarginTxt1, xLab, nIndent ); + + xLab.reset( new vcl::LabeledElement( xMainCol.get(), 2 ) ); + xLab->setLabel( &maSheetMarginEdt ); + xLab->setElement( &maSheetMarginTxt2 ); + xMainCol->addRow( &maSheetMarginTxt1, xLab, nIndent ); + + xMainCol->addRow( &maNupOrientationTxt, &maNupOrientationBox, nIndent ); + xMainCol->addRow( &maNupOrderTxt, &maNupOrderBox, nIndent ); + xMainCol->setBorders( xMainCol->addWindow( &maBorderCB ), nIndent, 0, 0, 0 ); + + xSpacer.reset( new vcl::Spacer( xMainCol.get(), 0, Size( 10, aBorder.Width() ) ) ); + xMainCol->addChild( xSpacer ); + + xRow.reset( new vcl::RowOrColumn( xMainCol.get(), false ) ); + xMainCol->addRow( &maBrochureBtn, xRow ); + // remember brochure row for dependencies + mxBrochureDep = xRow; + + // initially advanced controls are not shown, rows=columns=1 + showAdvancedControls( false ); +} + +void PrintDialog::NUpTabPage::Resize() +{ + maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetOutputSizePixel() ) ); +} + +void PrintDialog::NUpTabPage::initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup& i_rMPS ) +{ + maSheetMarginEdt.SetValue( maSheetMarginEdt.Normalize( i_rMPS.nLeftMargin ), FUNIT_100TH_MM ); + maPageMarginEdt.SetValue( maPageMarginEdt.Normalize( i_rMPS.nHorizontalSpacing ), FUNIT_100TH_MM ); + maBorderCB.Check( i_rMPS.bDrawBorder ); + maNupRowsEdt.SetValue( i_rMPS.nRows ); + maNupColEdt.SetValue( i_rMPS.nColumns ); +} + +void PrintDialog::NUpTabPage::readFromSettings() +{ +} + +void PrintDialog::NUpTabPage::storeToSettings() +{ +} + +PrintDialog::JobTabPage::JobTabPage( Window* i_pParent, const ResId& rResId ) + : TabPage( i_pParent, rResId ) + , maPrinterFL( this, VclResId( SV_PRINT_PRINTERS_FL ) ) + , maPrinters( this, VclResId( SV_PRINT_PRINTERS ) ) + , maDetailsBtn( this, VclResId( SV_PRINT_DETAILS_BTN ) ) + , maStatusLabel( this, VclResId( SV_PRINT_STATUS_TXT ) ) + , maStatusTxt( this, 0 ) + , maLocationLabel( this, VclResId( SV_PRINT_LOCATION_TXT ) ) + , maLocationTxt( this, 0 ) + , maCommentLabel( this, VclResId( SV_PRINT_COMMENT_TXT ) ) + , maCommentTxt( this, 0 ) + , maSetupButton( this, VclResId( SV_PRINT_PRT_SETUP ) ) + , maCopies( this, VclResId( SV_PRINT_COPIES ) ) + , maCopySpacer( this, WB_VERT ) + , maCopyCount( this, VclResId( SV_PRINT_COPYCOUNT ) ) + , maCopyCountField( this, VclResId( SV_PRINT_COPYCOUNT_FIELD ) ) + , maCollateBox( this, VclResId( SV_PRINT_COLLATE ) ) + , maCollateImage( this, VclResId( SV_PRINT_COLLATE_IMAGE ) ) + , maCollateImg( VclResId( SV_PRINT_COLLATE_IMG ) ) + , maCollateHCImg( VclResId( SV_PRINT_COLLATE_HC_IMG ) ) + , maNoCollateImg( VclResId( SV_PRINT_NOCOLLATE_IMG ) ) + , maNoCollateHCImg( VclResId( SV_PRINT_NOCOLLATE_HC_IMG ) ) + , mnCollateUIMode( 0 ) + , maLayout( NULL, true ) +{ + FreeResource(); + + SMHID1( "JobPage" ); + maPrinterFL.SMHID2( "JobPage", "Printer" ); + maPrinters.SMHID2( "JobPage", "PrinterList" ); + maDetailsBtn.SMHID2( "JobPage", "DetailsBtn" ); + maStatusLabel.SMHID2( "JobPage", "StatusLabel" ); + maStatusTxt.SMHID2( "JobPage", "StatusText" ); + maLocationLabel.SMHID2( "JobPage", "LocationLabel" ); + maLocationTxt.SMHID2( "JobPage", "LocationText" ); + maCommentLabel.SMHID2( "JobPage", "CommentLabel" ); + maCommentTxt.SMHID2( "JobPage", "CommentText" ); + maSetupButton.SMHID2( "JobPage", "Properties" ); + maCopies.SMHID2( "JobPage", "CopiesLine" ); + maCopySpacer.SMHID2( "JobPage", "CopySpacer" ); + maCopyCount.SMHID2( "JobPage", "CopiesText" ); + maCopyCountField.SMHID2( "JobPage", "Copies" ); + maCollateBox.SMHID2( "JobPage", "Collate" ); + maCollateImage.SMHID2( "JobPage", "CollateImage" ); + + maCopySpacer.Show(); + maStatusTxt.Show(); + maCommentTxt.Show(); + maLocationTxt.Show(); + + setupLayout(); +} + +PrintDialog::JobTabPage::~JobTabPage() +{ +} + +void PrintDialog::JobTabPage::setupLayout() +{ + // HACK: this is not a dropdown box, but the dropdown line count + // sets the results of GetOptimalSize in a normal ListBox + maPrinters.SetDropDownLineCount( 4 ); + + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + + maLayout.setParentWindow( this ); + maLayout.setOuterBorder( aBorder.Width() ); + + // add printer fixed line + maLayout.addWindow( &maPrinterFL ); + // add print LB + maLayout.addWindow( &maPrinters ); + + // create a row for details button/text and properties button + boost::shared_ptr< vcl::RowOrColumn > xDetRow( new vcl::RowOrColumn( &maLayout, false ) ); + maLayout.addChild( xDetRow ); + xDetRow->addWindow( &maDetailsBtn ); + xDetRow->addChild( new vcl::Spacer( xDetRow.get(), 2 ) ); + xDetRow->addWindow( &maSetupButton ); + + // create an indent for details + boost::shared_ptr< vcl::Indenter > xIndent( new vcl::Indenter( &maLayout ) ); + maLayout.addChild( xIndent ); + // remember details controls + mxDetails = xIndent; + // create a column for the details + boost::shared_ptr< vcl::LabelColumn > xLabelCol( new vcl::LabelColumn( xIndent.get(), aBorder.Height() ) ); + xIndent->setChild( xLabelCol ); + xLabelCol->addRow( &maStatusLabel, &maStatusTxt ); + xLabelCol->addRow( &maLocationLabel, &maLocationTxt ); + xLabelCol->addRow( &maCommentLabel, &maCommentTxt ); + + // add print range and copies columns + maLayout.addWindow( &maCopies ); + boost::shared_ptr< vcl::RowOrColumn > xRangeRow( new vcl::RowOrColumn( &maLayout, false, aBorder.Width() ) ); + maLayout.addChild( xRangeRow ); + + // create print range and add to range row + mxPrintRange.reset( new vcl::RowOrColumn( xRangeRow.get() ) ); + xRangeRow->addChild( mxPrintRange ); + xRangeRow->addWindow( &maCopySpacer ); + + boost::shared_ptr< vcl::RowOrColumn > xCopyCollateCol( new vcl::RowOrColumn( xRangeRow.get() ) ); + xRangeRow->addChild( xCopyCollateCol ); + + // add copies row to copy/collate column + boost::shared_ptr< vcl::LabeledElement > xCopiesRow( new vcl::LabeledElement( xCopyCollateCol.get(), 2 ) ); + xCopyCollateCol->addChild( xCopiesRow ); + xCopiesRow->setLabel( &maCopyCount ); + xCopiesRow->setElement( &maCopyCountField ); + boost::shared_ptr< vcl::LabeledElement > xCollateRow( new vcl::LabeledElement( xCopyCollateCol.get(), 2 ) ); + xCopyCollateCol->addChild( xCollateRow ); + xCollateRow->setLabel( &maCollateBox ); + xCollateRow->setElement( &maCollateImage ); + + // maDetailsBtn.SetStyle( maDetailsBtn.GetStyle() | (WB_SMALLSTYLE | WB_BEVELBUTTON) ); + mxDetails->show( false, false ); +} + +void PrintDialog::JobTabPage::readFromSettings() +{ + SettingsConfigItem* pItem = SettingsConfigItem::get(); + rtl::OUString aValue; + + #if 0 + // do not actually make copy count persistent + // the assumption is that this would lead to a lot of unwanted copies + aValue = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CopyCount" ) ) ); + sal_Int32 nVal = aValue.toInt32(); + maCopyCountField.SetValue( sal_Int64(nVal > 1 ? nVal : 1) ); + #endif + + aValue = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CollateBox" ) ) ); + if( aValue.equalsIgnoreAsciiCaseAscii( "alwaysoff" ) ) + { + mnCollateUIMode = 1; + maCollateBox.Check( FALSE ); + maCollateBox.Enable( FALSE ); + } + else + { + mnCollateUIMode = 0; + aValue = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ) ); + maCollateBox.Check( aValue.equalsIgnoreAsciiCaseAscii( "true" ) ); + } + Resize(); +} + +void PrintDialog::JobTabPage::storeToSettings() +{ + SettingsConfigItem* pItem = SettingsConfigItem::get(); + pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CopyCount" ) ), + maCopyCountField.GetText() ); + pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ), + rtl::OUString::createFromAscii( maCollateBox.IsChecked() ? "true" : "false" ) ); +} + +void PrintDialog::JobTabPage::Resize() +{ + maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetSizePixel() ) ); +} + +PrintDialog::OutputOptPage::OutputOptPage( Window* i_pParent, const ResId& i_rResId ) + : TabPage( i_pParent, i_rResId ) + , maOptionsLine( this, VclResId( SV_PRINT_OPT_PRINT_FL ) ) + , maToFileBox( this, VclResId( SV_PRINT_OPT_TOFILE ) ) + , maCollateSingleJobsBox( this, VclResId( SV_PRINT_OPT_SINGLEJOBS ) ) + , maReverseOrderBox( this, VclResId( SV_PRINT_OPT_REVERSE ) ) +{ + FreeResource(); + SMHID1( "OptPage" ); + maOptionsLine.SMHID2( "OptPage", "Options" ); + maToFileBox.SMHID2( "OptPage", "ToFile" ); + maCollateSingleJobsBox.SMHID2( "OptPage", "SingleJobs" ); + maReverseOrderBox.SMHID2( "OptPage", "Reverse" ); + + setupLayout(); +} + +PrintDialog::OutputOptPage::~OutputOptPage() +{ +} + +void PrintDialog::OutputOptPage::setupLayout() +{ + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + + maLayout.setParentWindow( this ); + maLayout.setOuterBorder( aBorder.Width() ); + + maLayout.addWindow( &maOptionsLine ); + boost::shared_ptr<vcl::Indenter> xIndent( new vcl::Indenter( &maLayout, aBorder.Width() ) ); + maLayout.addChild( xIndent ); + boost::shared_ptr<vcl::RowOrColumn> xCol( new vcl::RowOrColumn( xIndent.get(), aBorder.Height() ) ); + xIndent->setChild( xCol ); + mxOptGroup = xCol; + xCol->addWindow( &maToFileBox ); + xCol->addWindow( &maCollateSingleJobsBox ); + xCol->addWindow( &maReverseOrderBox ); +} + +void PrintDialog::OutputOptPage::readFromSettings() +{ + #if 0 + SettingsConfigItem* pItem = SettingsConfigItem::get(); + rtl::OUString aValue; + + aValue = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ToFile" ) ) ); + maToFileBox.Check( aValue.equalsIgnoreAsciiCaseAscii( "true" ) ); + #endif +} + +void PrintDialog::OutputOptPage::storeToSettings() +{ + SettingsConfigItem* pItem = SettingsConfigItem::get(); + pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ToFile" ) ), + rtl::OUString::createFromAscii( maToFileBox.IsChecked() ? "true" : "false" ) ); +} + +void PrintDialog::OutputOptPage::Resize() +{ + maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetSizePixel() ) ); +} + + +PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterController>& i_rController ) + : ModalDialog( i_pParent, VclResId( SV_DLG_PRINT ) ) + , maOKButton( this, VclResId( SV_PRINT_OK ) ) + , maCancelButton( this, VclResId( SV_PRINT_CANCEL ) ) + , maHelpButton( this, VclResId( SV_PRINT_HELP ) ) + , maPreviewWindow( this, VclResId( SV_PRINT_PAGE_PREVIEW ) ) + , maPageEdit( this, VclResId( SV_PRINT_PAGE_EDIT ) ) + , maNumPagesText( this, VclResId( SV_PRINT_PAGE_TXT ) ) + , maBackwardBtn( this, VclResId( SV_PRINT_PAGE_BACKWARD ) ) + , maForwardBtn( this, VclResId( SV_PRINT_PAGE_FORWARD ) ) + , maTabCtrl( this, VclResId( SV_PRINT_TABCTRL ) ) + , maNUpPage( &maTabCtrl, VclResId( SV_PRINT_TAB_NUP ) ) + , maJobPage( &maTabCtrl, VclResId( SV_PRINT_TAB_JOB ) ) + , maOptionsPage( &maTabCtrl, VclResId( SV_PRINT_TAB_OPT ) ) + , maButtonLine( this, VclResId( SV_PRINT_BUTTONLINE ) ) + , maPController( i_rController ) + , maNoPageStr( String( VclResId( SV_PRINT_NOPAGES ) ) ) + , mnCurPage( 0 ) + , mnCachedPages( 0 ) + , maPrintToFileText( String( VclResId( SV_PRINT_TOFILE_TXT ) ) ) + , maDefPrtText( String( VclResId( SV_PRINT_DEFPRT_TXT ) ) ) + , mbShowLayoutPage( sal_True ) +{ + FreeResource(); + + // save printbutton text, gets exchanged occasionally with print to file + maPrintText = maOKButton.GetText(); + + // setup preview controls + maForwardBtn.SetStyle( maForwardBtn.GetStyle() | WB_BEVELBUTTON ); + maBackwardBtn.SetStyle( maBackwardBtn.GetStyle() | WB_BEVELBUTTON ); + + // insert the job (general) tab page first + maTabCtrl.InsertPage( SV_PRINT_TAB_JOB, maJobPage.GetText() ); + maTabCtrl.SetTabPage( SV_PRINT_TAB_JOB, &maJobPage ); + + // set symbols on forward and backward button + maBackwardBtn.SetSymbol( SYMBOL_PREV ); + maForwardBtn.SetSymbol( SYMBOL_NEXT ); + maBackwardBtn.ImplSetSmallSymbol( TRUE ); + maForwardBtn.ImplSetSmallSymbol( TRUE ); + + maPageStr = maNumPagesText.GetText(); + + // init reverse print + maOptionsPage.maReverseOrderBox.Check( maPController->getReversePrint() ); + + // get the first page + preparePreview( true, true ); + + // fill printer listbox + const std::vector< rtl::OUString >& rQueues( Printer::GetPrinterQueues() ); + for( std::vector< rtl::OUString >::const_iterator it = rQueues.begin(); + it != rQueues.end(); ++it ) + { + maJobPage.maPrinters.InsertEntry( *it ); + } + // select current printer + if( maJobPage.maPrinters.GetEntryPos( maPController->getPrinter()->GetName() ) != LISTBOX_ENTRY_NOTFOUND ) + { + maJobPage.maPrinters.SelectEntry( maPController->getPrinter()->GetName() ); + } + else + { + // fall back to last printer + SettingsConfigItem* pItem = SettingsConfigItem::get(); + String aValue( pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LastPrinter" ) ) ) ); + if( maJobPage.maPrinters.GetEntryPos( aValue ) != LISTBOX_ENTRY_NOTFOUND ) + { + maJobPage.maPrinters.SelectEntry( aValue ); + maPController->setPrinter( boost::shared_ptr<Printer>( new Printer( aValue ) ) ); + } + else + { + // fall back to default printer + maJobPage.maPrinters.SelectEntry( Printer::GetDefaultPrinterName() ); + maPController->setPrinter( boost::shared_ptr<Printer>( new Printer( Printer::GetDefaultPrinterName() ) ) ); + } + } + // update the text fields for the printer + updatePrinterText(); + + // set a select handler + maJobPage.maPrinters.SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) ); + + // setup sizes for N-Up + Size aNupSize( maPController->getPrinter()->PixelToLogic( + maPController->getPrinter()->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) ); + if( maPController->getPrinter()->GetOrientation() == ORIENTATION_LANDSCAPE ) + { + maNupLandscapeSize = aNupSize; + maNupPortraitSize = Size( aNupSize.Height(), aNupSize.Width() ); + } + else + { + maNupPortraitSize = aNupSize; + maNupLandscapeSize = Size( aNupSize.Height(), aNupSize.Width() ); + } + maNUpPage.initFromMultiPageSetup( maPController->getMultipage() ); + + + // setup click handler on the various buttons + maOKButton.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); + #if OSL_DEBUG_LEVEL > 1 + maCancelButton.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); + #endif + maHelpButton.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); + maForwardBtn.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); + maBackwardBtn.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); + maJobPage.maCollateBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) ); + maJobPage.maSetupButton.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); + maJobPage.maDetailsBtn.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) ); + maNUpPage.maBorderCB.SetClickHdl( LINK( this, PrintDialog, ClickHdl ) ); + maOptionsPage.maToFileBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) ); + maOptionsPage.maReverseOrderBox.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) ); + maNUpPage.maPagesBtn.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) ); + + // setup modify hdl + maPageEdit.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); + maJobPage.maCopyCountField.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); + maNUpPage.maNupRowsEdt.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); + maNUpPage.maNupColEdt.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); + maNUpPage.maPageMarginEdt.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); + maNUpPage.maSheetMarginEdt.SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) ); + + // setup select hdl + maNUpPage.maNupPagesBox.SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) ); + maNUpPage.maNupOrientationBox.SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) ); + maNUpPage.maNupOrderBox.SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) ); + + // setup the layout + setupLayout(); + + // setup optional UI options set by application + setupOptionalUI(); + + // set change handler for UI options + maPController->setOptionChangeHdl( LINK( this, PrintDialog, UIOptionsChanged ) ); + + // set min size pixel to current size + Size aOutSize( GetOutputSizePixel() ); + SetMinOutputSizePixel( aOutSize ); + + // if there is space enough, enlarge the preview so it gets roughly as + // high as the tab control + if( aOutSize.Width() < 768 ) + { + Size aJobPageSize( getJobPageSize() ); + Size aTabSize( maTabCtrl.GetSizePixel() ); + if( aJobPageSize.Width() < 1 ) + aJobPageSize.Width() = aTabSize.Width(); + if( aJobPageSize.Height() < 1 ) + aJobPageSize.Height() = aTabSize.Height(); + long nOptPreviewWidth = aTabSize.Height() * aJobPageSize.Width() / aJobPageSize.Height(); + // add space for borders + nOptPreviewWidth += 15; + if( aOutSize.Width() - aTabSize.Width() < nOptPreviewWidth ) + { + aOutSize.Width() = aTabSize.Width() + nOptPreviewWidth; + if( aOutSize.Width() > 768 ) // don't enlarge the dialog too much + aOutSize.Width() = 768; + SetOutputSizePixel( aOutSize ); + } + } + + // set HelpIDs + SMHID1( "Dialog" ); + maOKButton.SMHID1( "OK" ); + maCancelButton.SMHID1( "Cancel" ); + maHelpButton.SMHID1( "Help" ); + maPreviewWindow.SMHID1( "Preview" ); + maNumPagesText.SMHID1( "NumPagesText" ); + maPageEdit.SMHID1( "PageEdit" ); + maForwardBtn.SMHID1( "ForwardBtn" ); + maBackwardBtn.SMHID1( "BackwardBtn" ); + maTabCtrl.SMHID1( "TabPages" ); + + // append further tab pages + if( mbShowLayoutPage ) + { + maTabCtrl.InsertPage( SV_PRINT_TAB_NUP, maNUpPage.GetText() ); + maTabCtrl.SetTabPage( SV_PRINT_TAB_NUP, &maNUpPage ); + } + maTabCtrl.InsertPage( SV_PRINT_TAB_OPT, maOptionsPage.GetText() ); + maTabCtrl.SetTabPage( SV_PRINT_TAB_OPT, &maOptionsPage ); + + // restore settings from last run + readFromSettings(); + + // setup dependencies + checkControlDependencies(); + +} + +PrintDialog::~PrintDialog() +{ + while( ! maControls.empty() ) + { + delete maControls.front(); + maControls.pop_front(); + } +} + +void PrintDialog::setupLayout() +{ + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + + maLayout.setParentWindow( this ); + + boost::shared_ptr< vcl::RowOrColumn > xPreviewAndTab( new vcl::RowOrColumn( &maLayout, false ) ); + size_t nIndex = maLayout.addChild( xPreviewAndTab, 5 ); + maLayout.setBorders( nIndex, aBorder.Width(), aBorder.Width(), aBorder.Width(), 0 ); + + // setup column for preview and sub controls + boost::shared_ptr< vcl::RowOrColumn > xPreview( new vcl::RowOrColumn( xPreviewAndTab.get() ) ); + xPreviewAndTab->addChild( xPreview, 5 ); + xPreview->addWindow( &maPreviewWindow, 5 ); + // get a row for the preview controls + mxPreviewCtrls.reset( new vcl::RowOrColumn( xPreview.get(), false ) ); + nIndex = xPreview->addChild( mxPreviewCtrls ); + boost::shared_ptr< vcl::Spacer > xSpacer( new vcl::Spacer( mxPreviewCtrls.get(), 2 ) ); + mxPreviewCtrls->addChild( xSpacer ); + mxPreviewCtrls->addWindow( &maPageEdit ); + mxPreviewCtrls->addWindow( &maNumPagesText ); + xSpacer.reset( new vcl::Spacer( mxPreviewCtrls.get(), 2 ) ); + mxPreviewCtrls->addChild( xSpacer ); + mxPreviewCtrls->addWindow( &maBackwardBtn ); + mxPreviewCtrls->addWindow( &maForwardBtn ); + xSpacer.reset( new vcl::Spacer( mxPreviewCtrls.get(), 2 ) ); + mxPreviewCtrls->addChild( xSpacer ); + + // continue with the tab ctrl + xPreviewAndTab->addWindow( &maTabCtrl ); + + // add the button line + maLayout.addWindow( &maButtonLine ); + + // add the row for the buttons + boost::shared_ptr< vcl::RowOrColumn > xButtons( new vcl::RowOrColumn( &maLayout, false ) ); + nIndex = maLayout.addChild( xButtons ); + maLayout.setBorders( nIndex, aBorder.Width(), 0, aBorder.Width(), aBorder.Width() ); + + Size aMinSize( maCancelButton.GetSizePixel() ); + // insert help button + xButtons->setMinimumSize( xButtons->addWindow( &maHelpButton ), aMinSize ); + // insert a spacer, cancel and OK buttons are right aligned + xSpacer.reset( new vcl::Spacer( xButtons.get(), 2 ) ); + xButtons->addChild( xSpacer ); + xButtons->setMinimumSize( xButtons->addWindow( &maOKButton ), aMinSize ); + xButtons->setMinimumSize( xButtons->addWindow( &maCancelButton ), aMinSize ); +} + +void PrintDialog::readFromSettings() +{ + maJobPage.readFromSettings(); + maNUpPage.readFromSettings(); + maOptionsPage.readFromSettings(); + + // read last selected tab page; if it exists, actiavte it + SettingsConfigItem* pItem = SettingsConfigItem::get(); + rtl::OUString aValue = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LastPage" ) ) ); + USHORT nCount = maTabCtrl.GetPageCount(); + for( USHORT i = 0; i < nCount; i++ ) + { + USHORT nPageId = maTabCtrl.GetPageId( i ); + if( aValue.equals( maTabCtrl.GetPageText( nPageId ) ) ) + { + maTabCtrl.SelectTabPage( nPageId ); + break; + } + } + maOKButton.SetText( maOptionsPage.maToFileBox.IsChecked() ? maPrintToFileText : maPrintText ); +} + +void PrintDialog::storeToSettings() +{ + maJobPage.storeToSettings(); + maNUpPage.storeToSettings(); + maOptionsPage.storeToSettings(); + + // store last selected printer + SettingsConfigItem* pItem = SettingsConfigItem::get(); + pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LastPrinter" ) ), + maJobPage.maPrinters.GetSelectEntry() ); + + pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LastPage" ) ), + maTabCtrl.GetPageText( maTabCtrl.GetCurPageId() ) ); + pItem->Commit(); +} + +bool PrintDialog::isPrintToFile() +{ + return maOptionsPage.maToFileBox.IsChecked(); +} + +int PrintDialog::getCopyCount() +{ + return static_cast<int>(maJobPage.maCopyCountField.GetValue()); +} + +bool PrintDialog::isCollate() +{ + return maJobPage.maCopyCountField.GetValue() > 1 ? maJobPage.maCollateBox.IsChecked() : FALSE; +} + +static void setSmartId( Window* i_pWindow, const char* i_pType, sal_Int32 i_nId = -1, const rtl::OUString& i_rPropName = rtl::OUString() ) +{ + rtl::OUStringBuffer aBuf( 256 ); + aBuf.appendAscii( HELPID_PREFIX ); + if( i_rPropName.getLength() ) + { + aBuf.append( sal_Unicode( ':' ) ); + aBuf.append( i_rPropName ); + } + if( i_pType ) + { + aBuf.append( sal_Unicode( ':' ) ); + aBuf.appendAscii( i_pType ); + } + if( i_nId >= 0 ) + { + aBuf.append( sal_Unicode( ':' ) ); + aBuf.append( i_nId ); + } + i_pWindow->SetSmartHelpId( SmartId( aBuf.makeStringAndClear(), HID_PRINTDLG ) ); +} + +static void setHelpText( Window* i_pWindow, const Sequence< rtl::OUString >& i_rHelpTexts, sal_Int32 i_nIndex ) +{ + if( i_nIndex >= 0 && i_nIndex < i_rHelpTexts.getLength() ) + i_pWindow->SetHelpText( i_rHelpTexts.getConstArray()[i_nIndex] ); +} + +void updateMaxSize( const Size& i_rCheckSize, Size& o_rMaxSize ) +{ + if( i_rCheckSize.Width() > o_rMaxSize.Width() ) + o_rMaxSize.Width() = i_rCheckSize.Width(); + if( i_rCheckSize.Height() > o_rMaxSize.Height() ) + o_rMaxSize.Height() = i_rCheckSize.Height(); +} + +void PrintDialog::setupOptionalUI() +{ + Size aBorder( LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ) ); + + std::vector<vcl::RowOrColumn*> aDynamicColumns; + vcl::RowOrColumn* pCurColumn = 0; + + Window* pCurParent = 0, *pDynamicPageParent = 0; + USHORT nOptPageId = 9, nCurSubGroup = 0; + bool bOnStaticPage = false; + bool bSubgroupOnStaticPage = false; + + std::multimap< rtl::OUString, vcl::RowOrColumn* > aPropertyToDependencyRowMap; + + const Sequence< PropertyValue >& rOptions( maPController->getUIOptions() ); + for( int i = 0; i < rOptions.getLength(); i++ ) + { + Sequence< beans::PropertyValue > aOptProp; + rOptions[i].Value >>= aOptProp; + + // extract ui element + bool bEnabled = true; + rtl::OUString aCtrlType; + rtl::OUString aText; + rtl::OUString aPropertyName; + Sequence< rtl::OUString > aChoices; + Sequence< rtl::OUString > aHelpTexts; + sal_Int64 nMinValue = 0, nMaxValue = 0; + sal_Int32 nCurHelpText = 0; + rtl::OUString aGroupingHint; + rtl::OUString aDependsOnName; + sal_Int32 nDependsOnValue = 0; + sal_Bool bUseDependencyRow = sal_False; + + for( int n = 0; n < aOptProp.getLength(); n++ ) + { + const beans::PropertyValue& rEntry( aOptProp[ n ] ); + if( rEntry.Name.equalsAscii( "Text" ) ) + { + rEntry.Value >>= aText; + } + else if( rEntry.Name.equalsAscii( "ControlType" ) ) + { + rEntry.Value >>= aCtrlType; + } + else if( rEntry.Name.equalsAscii( "Choices" ) ) + { + rEntry.Value >>= aChoices; + } + else if( rEntry.Name.equalsAscii( "Property" ) ) + { + PropertyValue aVal; + rEntry.Value >>= aVal; + aPropertyName = aVal.Name; + } + else if( rEntry.Name.equalsAscii( "Enabled" ) ) + { + sal_Bool bValue = sal_True; + rEntry.Value >>= bValue; + bEnabled = bValue; + } + else if( rEntry.Name.equalsAscii( "GroupingHint" ) ) + { + rEntry.Value >>= aGroupingHint; + } + else if( rEntry.Name.equalsAscii( "DependsOnName" ) ) + { + rEntry.Value >>= aDependsOnName; + } + else if( rEntry.Name.equalsAscii( "DependsOnEntry" ) ) + { + rEntry.Value >>= nDependsOnValue; + } + else if( rEntry.Name.equalsAscii( "AttachToDependency" ) ) + { + rEntry.Value >>= bUseDependencyRow; + } + else if( rEntry.Name.equalsAscii( "MinValue" ) ) + { + rEntry.Value >>= nMinValue; + } + else if( rEntry.Name.equalsAscii( "MaxValue" ) ) + { + rEntry.Value >>= nMaxValue; + } + else if( rEntry.Name.equalsAscii( "HelpText" ) ) + { + if( ! (rEntry.Value >>= aHelpTexts) ) + { + rtl::OUString aHelpText; + if( (rEntry.Value >>= aHelpText) ) + { + aHelpTexts.realloc( 1 ); + *aHelpTexts.getArray() = aHelpText; + } + } + } + else if( rEntry.Name.equalsAscii( "HintNoLayoutPage" ) ) + { + sal_Bool bNoLayoutPage = sal_False; + rEntry.Value >>= bNoLayoutPage; + mbShowLayoutPage = ! bNoLayoutPage; + } + } + + // bUseDependencyRow should only be true if a dependency exists + bUseDependencyRow = bUseDependencyRow && (aDependsOnName.getLength() != 0); + + // is it necessary to switch between static and dynamic pages ? + bool bSwitchPage = false; + if( aGroupingHint.getLength() ) + bSwitchPage = true; + else if( aCtrlType.equalsAscii( "Subgroup" ) || (bOnStaticPage && ! bSubgroupOnStaticPage ) ) + bSwitchPage = true; + if( bSwitchPage ) + { + // restore to dynamic + pCurParent = pDynamicPageParent; + pCurColumn = aDynamicColumns.empty() ? NULL : aDynamicColumns.back(); + bOnStaticPage = false; + bSubgroupOnStaticPage = false; + + if( aGroupingHint.equalsAscii( "PrintRange" ) ) + { + pCurColumn = maJobPage.mxPrintRange.get(); + pCurParent = &maJobPage; // set job page as current parent + bOnStaticPage = true; + } + else if( aGroupingHint.equalsAscii( "OptionsPage" ) ) + { + pCurColumn = &maOptionsPage.maLayout; + pCurParent = &maOptionsPage; // set options page as current parent + bOnStaticPage = true; + } + else if( aGroupingHint.equalsAscii( "OptionsPageOptGroup" ) ) + { + pCurColumn = maOptionsPage.mxOptGroup.get(); + pCurParent = &maOptionsPage; // set options page as current parent + bOnStaticPage = true; + } + else if( aGroupingHint.equalsAscii( "LayoutPage" ) ) + { + pCurColumn = &maNUpPage.maLayout; + pCurParent = &maNUpPage; // set layout page as current parent + bOnStaticPage = true; + } + else if( aGroupingHint.getLength() ) + { + pCurColumn = &maJobPage.maLayout; + pCurParent = &maJobPage; // set job page as current parent + bOnStaticPage = true; + } + } + + if( aCtrlType.equalsAscii( "Group" ) || + ( ! pCurParent && ! (bOnStaticPage || aGroupingHint.getLength() ) ) ) + { + // add new tab page + TabPage* pNewGroup = new TabPage( &maTabCtrl ); + maControls.push_front( pNewGroup ); + pDynamicPageParent = pCurParent = pNewGroup; + pNewGroup->SetText( aText ); + maTabCtrl.InsertPage( ++nOptPageId, aText ); + maTabCtrl.SetTabPage( nOptPageId, pNewGroup ); + + // set help id + setSmartId( pNewGroup, "TabPage", nOptPageId ); + // set help text + setHelpText( pNewGroup, aHelpTexts, 0 ); + + // reset subgroup counter + nCurSubGroup = 0; + + aDynamicColumns.push_back( new vcl::RowOrColumn( NULL, true, aBorder.Width() ) ); + pCurColumn = aDynamicColumns.back(); + pCurColumn->setParentWindow( pNewGroup ); + pCurColumn->setOuterBorder( aBorder.Width() ); + bSubgroupOnStaticPage = false; + bOnStaticPage = false; + } + else if( aCtrlType.equalsAscii( "Subgroup" ) && (pCurParent || aGroupingHint.getLength() ) ) + { + bSubgroupOnStaticPage = (aGroupingHint.getLength() != 0); + // create group FixedLine + if( ! aGroupingHint.equalsAscii( "PrintRange" ) || + ! pCurColumn->countElements() == 0 + ) + { + Window* pNewSub = NULL; + if( aGroupingHint.equalsAscii( "PrintRange" ) ) + pNewSub = new FixedText( pCurParent, WB_VCENTER ); + else + pNewSub = new FixedLine( pCurParent ); + maControls.push_front( pNewSub ); + pNewSub->SetText( aText ); + pNewSub->Show(); + + // set help id + setSmartId( pNewSub, "FixedLine", sal_Int32( nCurSubGroup++ ) ); + // set help text + setHelpText( pNewSub, aHelpTexts, 0 ); + // add group to current column + pCurColumn->addWindow( pNewSub ); + } + + // add an indent to the current column + vcl::Indenter* pIndent = new vcl::Indenter( pCurColumn, aBorder.Width() ); + pCurColumn->addChild( pIndent ); + // and create a column inside the indent + pCurColumn = new vcl::RowOrColumn( pIndent ); + pIndent->setChild( pCurColumn ); + } + // EVIL + else if( aCtrlType.equalsAscii( "Bool" ) && + aGroupingHint.equalsAscii( "LayoutPage" ) && + aPropertyName.equalsAscii( "PrintProspect" ) + ) + { + maNUpPage.maBrochureBtn.SetText( aText ); + maNUpPage.maBrochureBtn.Show(); + setHelpText( &maNUpPage.maBrochureBtn, aHelpTexts, 0 ); + + sal_Bool bVal = sal_False; + PropertyValue* pVal = maPController->getValue( aPropertyName ); + if( pVal ) + pVal->Value >>= bVal; + maNUpPage.maBrochureBtn.Check( bVal ); + maNUpPage.maBrochureBtn.Enable( maPController->isUIOptionEnabled( aPropertyName ) && pVal != NULL ); + maNUpPage.maBrochureBtn.SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) ); + + maPropertyToWindowMap[ aPropertyName ].push_back( &maNUpPage.maBrochureBtn ); + maControlToPropertyMap[&maNUpPage.maBrochureBtn] = aPropertyName; + + aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, vcl::RowOrColumn* >( aPropertyName, maNUpPage.mxBrochureDep.get() ) ); + } + else + { + vcl::RowOrColumn* pSaveCurColumn = pCurColumn; + + if( bUseDependencyRow ) + { + // find the correct dependency row (if any) + std::pair< std::multimap< rtl::OUString, vcl::RowOrColumn* >::iterator, + std::multimap< rtl::OUString, vcl::RowOrColumn* >::iterator > aDepRange; + aDepRange = aPropertyToDependencyRowMap.equal_range( aDependsOnName ); + if( aDepRange.first != aDepRange.second ) + { + while( nDependsOnValue && aDepRange.first != aDepRange.second ) + { + nDependsOnValue--; + ++aDepRange.first; + } + if( aDepRange.first != aPropertyToDependencyRowMap.end() ) + { + pCurColumn = aDepRange.first->second; + maReverseDependencySet.insert( aPropertyName ); + } + } + } + if( aCtrlType.equalsAscii( "Bool" ) && pCurParent ) + { + // add a check box + CheckBox* pNewBox = new CheckBox( pCurParent ); + maControls.push_front( pNewBox ); + pNewBox->SetText( aText ); + pNewBox->Show(); + + sal_Bool bVal = sal_False; + PropertyValue* pVal = maPController->getValue( aPropertyName ); + if( pVal ) + pVal->Value >>= bVal; + pNewBox->Check( bVal ); + pNewBox->SetToggleHdl( LINK( this, PrintDialog, UIOption_CheckHdl ) ); + + maPropertyToWindowMap[ aPropertyName ].push_back( pNewBox ); + maControlToPropertyMap[pNewBox] = aPropertyName; + + // set help id + setSmartId( pNewBox, "CheckBox", -1, aPropertyName ); + // set help text + setHelpText( pNewBox, aHelpTexts, 0 ); + + vcl::RowOrColumn* pDependencyRow = new vcl::RowOrColumn( pCurColumn, false ); + pCurColumn->addChild( pDependencyRow ); + aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, vcl::RowOrColumn* >( aPropertyName, pDependencyRow ) ); + + // add checkbox to current column + pDependencyRow->addWindow( pNewBox ); + } + else if( aCtrlType.equalsAscii( "Radio" ) && pCurParent ) + { + vcl::RowOrColumn* pRadioColumn = pCurColumn; + if( aText.getLength() ) + { + // add a FixedText: + FixedText* pHeading = new FixedText( pCurParent ); + maControls.push_front( pHeading ); + pHeading->SetText( aText ); + pHeading->Show(); + + // set help id + setSmartId( pHeading, "FixedText", -1, aPropertyName ); + // set help text + setHelpText( pHeading, aHelpTexts, nCurHelpText++ ); + // add fixed text to current column + pCurColumn->addWindow( pHeading ); + // add an indent to the current column + vcl::Indenter* pIndent = new vcl::Indenter( pCurColumn, 15 ); + pCurColumn->addChild( pIndent ); + // and create a column inside the indent + pRadioColumn = new vcl::RowOrColumn( pIndent ); + pIndent->setChild( pRadioColumn ); + } + // iterate options + sal_Int32 nSelectVal = 0; + PropertyValue* pVal = maPController->getValue( aPropertyName ); + if( pVal && pVal->Value.hasValue() ) + pVal->Value >>= nSelectVal; + for( sal_Int32 m = 0; m < aChoices.getLength(); m++ ) + { + boost::shared_ptr<vcl::LabeledElement> pLabel( new vcl::LabeledElement( pRadioColumn, 1 ) ); + pRadioColumn->addChild( pLabel ); + boost::shared_ptr<vcl::RowOrColumn> pDependencyRow( new vcl::RowOrColumn( pLabel.get(), false ) ); + pLabel->setElement( pDependencyRow ); + aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, vcl::RowOrColumn* >( aPropertyName, pDependencyRow.get() ) ); + + RadioButton* pBtn = new RadioButton( pCurParent, m == 0 ? WB_GROUP : 0 ); + maControls.push_front( pBtn ); + pBtn->SetText( aChoices[m] ); + pBtn->Check( m == nSelectVal ); + pBtn->SetToggleHdl( LINK( this, PrintDialog, UIOption_RadioHdl ) ); + pBtn->Show(); + maPropertyToWindowMap[ aPropertyName ].push_back( pBtn ); + maControlToPropertyMap[pBtn] = aPropertyName; + maControlToNumValMap[pBtn] = m; + + // set help id + setSmartId( pBtn, "RadioButton", m, aPropertyName ); + // set help text + setHelpText( pBtn, aHelpTexts, nCurHelpText++ ); + // add the radio button to the column + pLabel->setLabel( pBtn ); + } + } + else if( ( aCtrlType.equalsAscii( "List" ) || + aCtrlType.equalsAscii( "Range" ) || + aCtrlType.equalsAscii( "Edit" ) + ) && pCurParent ) + { + // create a row in the current column + vcl::RowOrColumn* pFieldColumn = new vcl::RowOrColumn( pCurColumn, false ); + pCurColumn->addChild( pFieldColumn ); + aPropertyToDependencyRowMap.insert( std::pair< rtl::OUString, vcl::RowOrColumn* >( aPropertyName, pFieldColumn ) ); + + vcl::LabeledElement* pLabel = NULL; + if( aText.getLength() ) + { + // add a FixedText: + FixedText* pHeading = new FixedText( pCurParent, WB_VCENTER ); + maControls.push_front( pHeading ); + pHeading->SetText( aText ); + pHeading->Show(); + + // set help id + setSmartId( pHeading, "FixedText", -1, aPropertyName ); + + // add to row + pLabel = new vcl::LabeledElement( pFieldColumn, 2 ); + pFieldColumn->addChild( pLabel ); + pLabel->setLabel( pHeading ); + } + + if( aCtrlType.equalsAscii( "List" ) ) + { + ListBox* pList = new ListBox( pCurParent, WB_DROPDOWN | WB_BORDER ); + maControls.push_front( pList ); + + // iterate options + for( sal_Int32 m = 0; m < aChoices.getLength(); m++ ) + { + pList->InsertEntry( aChoices[m] ); + } + sal_Int32 nSelectVal = 0; + PropertyValue* pVal = maPController->getValue( aPropertyName ); + if( pVal && pVal->Value.hasValue() ) + pVal->Value >>= nSelectVal; + pList->SelectEntryPos( static_cast<USHORT>(nSelectVal) ); + pList->SetSelectHdl( LINK( this, PrintDialog, UIOption_SelectHdl ) ); + pList->SetDropDownLineCount( static_cast<USHORT>(aChoices.getLength()) ); + pList->Show(); + + // set help id + setSmartId( pList, "ListBox", -1, aPropertyName ); + // set help text + setHelpText( pList, aHelpTexts, 0 ); + + maPropertyToWindowMap[ aPropertyName ].push_back( pList ); + maControlToPropertyMap[pList] = aPropertyName; + + // finish the pair + if( pLabel ) + pLabel->setElement( pList ); + else + pFieldColumn->addWindow( pList ); + } + else if( aCtrlType.equalsAscii( "Range" ) ) + { + NumericField* pField = new NumericField( pCurParent, WB_BORDER | WB_SPIN ); + maControls.push_front( pField ); + + // set min/max and current value + if( nMinValue != nMaxValue ) + { + pField->SetMin( nMinValue ); + pField->SetMax( nMaxValue ); + } + sal_Int64 nCurVal = 0; + PropertyValue* pVal = maPController->getValue( aPropertyName ); + if( pVal && pVal->Value.hasValue() ) + pVal->Value >>= nCurVal; + pField->SetValue( nCurVal ); + pField->SetModifyHdl( LINK( this, PrintDialog, UIOption_ModifyHdl ) ); + pField->Show(); + + // set help id + setSmartId( pField, "NumericField", -1, aPropertyName ); + // set help text + setHelpText( pField, aHelpTexts, 0 ); + + maPropertyToWindowMap[ aPropertyName ].push_back( pField ); + maControlToPropertyMap[pField] = aPropertyName; + + // add to row + if( pLabel ) + pLabel->setElement( pField ); + else + pFieldColumn->addWindow( pField ); + } + else if( aCtrlType.equalsAscii( "Edit" ) ) + { + Edit* pField = new Edit( pCurParent, WB_BORDER ); + maControls.push_front( pField ); + + rtl::OUString aCurVal; + PropertyValue* pVal = maPController->getValue( aPropertyName ); + if( pVal && pVal->Value.hasValue() ) + pVal->Value >>= aCurVal; + pField->SetText( aCurVal ); + pField->SetModifyHdl( LINK( this, PrintDialog, UIOption_ModifyHdl ) ); + pField->Show(); + + // set help id + setSmartId( pField, "Edit", -1, aPropertyName ); + // set help text + setHelpText( pField, aHelpTexts, 0 ); + + maPropertyToWindowMap[ aPropertyName ].push_back( pField ); + maControlToPropertyMap[pField] = aPropertyName; + + // add to row + if( pLabel ) + pLabel->setElement( pField ); + else + pFieldColumn->addWindow( pField, 2 ); + } + } + else + { + DBG_ERROR( "Unsupported UI option" ); + } + + pCurColumn = pSaveCurColumn; + } + } + + // #i106506# if no brochure button, then the singular Pages radio button + // makes no sense, so replace it by a FixedText label + if( ! maNUpPage.maBrochureBtn.IsVisible() ) + { + if( maNUpPage.mxPagesBtnLabel.get() ) + { + maNUpPage.maPagesBoxTitleTxt.SetText( maNUpPage.maPagesBtn.GetText() ); + maNUpPage.maPagesBoxTitleTxt.Show( TRUE ); + maNUpPage.mxPagesBtnLabel->setLabel( &maNUpPage.maPagesBoxTitleTxt ); + maNUpPage.maPagesBtn.Show( FALSE ); + } + } + + // update enable states + checkOptionalControlDependencies(); + + // print range empty (currently math only) -> hide print range and spacer line + if( maJobPage.mxPrintRange->countElements() == 0 ) + { + maJobPage.mxPrintRange->show( false, false ); + maJobPage.maCopySpacer.Show( FALSE ); + } + +#ifdef WNT + // FIXME: the GetNativeControlRegion call on Windows has some issues + // (which skew the results of GetOptimalSize()) + // however fixing this thoroughly needs to take interaction with paint into + // acoount, making the right fix less simple. Fix this the right way + // at some point. For now simply add some space at the lowest element + size_t nIndex = maJobPage.maLayout.countElements(); + if( nIndex > 0 ) // sanity check + maJobPage.maLayout.setBorders( nIndex-1, 0, 0, 0, aBorder.Width() ); +#endif + + // calculate job page + Size aMaxSize = maJobPage.maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ); + // and layout page + updateMaxSize( maNUpPage.maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ), aMaxSize ); + // and options page + updateMaxSize( maOptionsPage.maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ), aMaxSize ); + + for( std::vector< vcl::RowOrColumn* >::iterator it = aDynamicColumns.begin(); + it != aDynamicColumns.end(); ++it ) + { + Size aPageSize( (*it)->getOptimalSize( WINDOWSIZE_PREFERRED ) ); + updateMaxSize( aPageSize, aMaxSize ); + } + + // resize dialog if necessary + Size aTabSize = maTabCtrl.GetTabPageSizePixel(); + maTabCtrl.SetMinimumSizePixel( maTabCtrl.GetSizePixel() ); + if( aMaxSize.Height() > aTabSize.Height() || aMaxSize.Width() > aTabSize.Width() ) + { + Size aCurSize( GetOutputSizePixel() ); + if( aMaxSize.Height() > aTabSize.Height() ) + { + aCurSize.Height() += aMaxSize.Height() - aTabSize.Height(); + aTabSize.Height() = aMaxSize.Height(); + } + if( aMaxSize.Width() > aTabSize.Width() ) + { + aCurSize.Width() += aMaxSize.Width() - aTabSize.Width(); + // and the tab ctrl needs more space, too + aTabSize.Width() = aMaxSize.Width(); + } + maTabCtrl.SetTabPageSizePixel( aTabSize ); + maTabCtrl.SetMinimumSizePixel( maTabCtrl.GetSizePixel() ); + } + + // and finally arrange controls + for( std::vector< vcl::RowOrColumn* >::iterator it = aDynamicColumns.begin(); + it != aDynamicColumns.end(); ++it ) + { + (*it)->setManagedArea( Rectangle( Point(), aTabSize ) ); + delete *it; + *it = NULL; + } + maJobPage.Resize(); + maNUpPage.Resize(); + maOptionsPage.Resize(); + + Size aSz = maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ); + SetOutputSizePixel( aSz ); +} + +void PrintDialog::DataChanged( const DataChangedEvent& i_rDCEvt ) +{ + // react on settings changed + if( i_rDCEvt.GetType() == DATACHANGED_SETTINGS ) + checkControlDependencies(); + ModalDialog::DataChanged( i_rDCEvt ); +} + +void PrintDialog::checkControlDependencies() +{ + if( maJobPage.maCopyCountField.GetValue() > 1 ) + maJobPage.maCollateBox.Enable( maJobPage.mnCollateUIMode == 0 ); + else + maJobPage.maCollateBox.Enable( FALSE ); + + Image aImg( maJobPage.maCollateBox.IsChecked() ? maJobPage.maCollateImg : maJobPage.maNoCollateImg ); + Image aHCImg( maJobPage.maCollateBox.IsChecked() ? maJobPage.maCollateHCImg : maJobPage.maNoCollateHCImg ); + bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); + + Size aImgSize( aImg.GetSizePixel() ); + Size aHCImgSize( aHCImg.GetSizePixel() ); + + if( aHCImgSize.Width() > aImgSize.Width() ) + aImgSize.Width() = aHCImgSize.Width(); + if( aHCImgSize.Height() > aImgSize.Height() ) + aImgSize.Height() = aHCImgSize.Height(); + + // adjust size of image + maJobPage.maCollateImage.SetSizePixel( aImgSize ); + maJobPage.maCollateImage.SetImage( bHC ? aHCImg : aImg ); + maJobPage.maCollateImage.SetModeImage( aHCImg, BMP_COLOR_HIGHCONTRAST ); + + // enable setup button only for printers that can be setup + bool bHaveSetup = maPController->getPrinter()->HasSupport( SUPPORT_SETUPDIALOG ); + maJobPage.maSetupButton.Enable( bHaveSetup ); + if( bHaveSetup ) + { + if( ! maJobPage.maSetupButton.IsVisible() ) + { + Point aPrinterPos( maJobPage.maPrinters.GetPosPixel() ); + Point aSetupPos( maJobPage.maSetupButton.GetPosPixel() ); + Size aPrinterSize( maJobPage.maPrinters.GetSizePixel() ); + aPrinterSize.Width() = aSetupPos.X() - aPrinterPos.X() - LogicToPixel( Size( 5, 5 ), MapMode( MAP_APPFONT ) ).Width(); + maJobPage.maPrinters.SetSizePixel( aPrinterSize ); + maJobPage.maSetupButton.Show(); + maLayout.resize(); + } + } + else + { + if( maJobPage.maSetupButton.IsVisible() ) + { + Point aPrinterPos( maJobPage.maPrinters.GetPosPixel() ); + Point aSetupPos( maJobPage.maSetupButton.GetPosPixel() ); + Size aPrinterSize( maJobPage.maPrinters.GetSizePixel() ); + Size aSetupSize( maJobPage.maSetupButton.GetSizePixel() ); + aPrinterSize.Width() = aSetupPos.X() + aSetupSize.Width() - aPrinterPos.X(); + maJobPage.maPrinters.SetSizePixel( aPrinterSize ); + maJobPage.maSetupButton.Hide(); + maLayout.resize(); + } + } +} + +void PrintDialog::checkOptionalControlDependencies() +{ + for( std::map< Window*, rtl::OUString >::iterator it = maControlToPropertyMap.begin(); + it != maControlToPropertyMap.end(); ++it ) + { + bool bShouldbeEnabled = maPController->isUIOptionEnabled( it->second ); + if( ! bShouldbeEnabled ) + { + // enable controls that are directly attached to a dependency anyway + // if the normally disabled controls get modified, change the dependency + // so the control would be enabled + // example: in print range "Print All" is selected, "Page Range" is then of course + // not selected and the Edit for the Page Range would be disabled + // as a convenience we should enable the Edit anyway and automatically select + // "Page Range" instead of "Print All" if the Edit gets modified + if( maReverseDependencySet.find( it->second ) != maReverseDependencySet.end() ) + { + rtl::OUString aDep( maPController->getDependency( it->second ) ); + // if the dependency is at least enabled, then enable this control anyway + if( aDep.getLength() && maPController->isUIOptionEnabled( aDep ) ) + bShouldbeEnabled = true; + } + } + + bool bIsEnabled = it->first->IsEnabled(); + // Enable does not do a change check first, so can be less cheap than expected + if( bShouldbeEnabled != bIsEnabled ) + it->first->Enable( bShouldbeEnabled ); + } +} + +static rtl::OUString searchAndReplace( const rtl::OUString& i_rOrig, const char* i_pRepl, sal_Int32 i_nReplLen, const rtl::OUString& i_rRepl ) +{ + sal_Int32 nPos = i_rOrig.indexOfAsciiL( i_pRepl, i_nReplLen ); + if( nPos != -1 ) + { + rtl::OUStringBuffer aBuf( i_rOrig.getLength() ); + aBuf.append( i_rOrig.getStr(), nPos ); + aBuf.append( i_rRepl ); + if( nPos + i_nReplLen < i_rOrig.getLength() ) + aBuf.append( i_rOrig.getStr() + nPos + i_nReplLen ); + return aBuf.makeStringAndClear(); + } + return i_rOrig; +} + +void PrintDialog::updatePrinterText() +{ + String aDefPrt( Printer::GetDefaultPrinterName() ); + const QueueInfo* pInfo = Printer::GetQueueInfo( maJobPage.maPrinters.GetSelectEntry(), true ); + if( pInfo ) + { + maJobPage.maLocationTxt.SetText( pInfo->GetLocation() ); + maJobPage.maCommentTxt.SetText( pInfo->GetComment() ); + // FIXME: status text + rtl::OUString aStatus; + if( aDefPrt == pInfo->GetPrinterName() ) + aStatus = maDefPrtText; + maJobPage.maStatusTxt.SetText( aStatus ); + } + else + { + maJobPage.maLocationTxt.SetText( String() ); + maJobPage.maCommentTxt.SetText( String() ); + maJobPage.maStatusTxt.SetText( String() ); + } +} + +void PrintDialog::setPreviewText( sal_Int32 ) +{ + rtl::OUString aNewText( searchAndReplace( maPageStr, "%n", 2, rtl::OUString::valueOf( mnCachedPages ) ) ); + maNumPagesText.SetText( aNewText ); + + // if layout is already established the refresh layout of + // preview controls since text length may have changes + if( mxPreviewCtrls.get() ) + mxPreviewCtrls->setManagedArea( mxPreviewCtrls->getManagedArea() ); +} + +void PrintDialog::preparePreview( bool i_bNewPage, bool i_bMayUseCache ) +{ + // page range may have changed depending on options + sal_Int32 nPages = maPController->getFilteredPageCount(); + mnCachedPages = nPages; + + if( mnCurPage >= nPages ) + mnCurPage = nPages-1; + if( mnCurPage < 0 ) + mnCurPage = 0; + + setPreviewText( mnCurPage ); + + maPageEdit.SetMin( 1 ); + maPageEdit.SetMax( nPages ); + + if( i_bNewPage ) + { + const MapMode aMapMode( MAP_100TH_MM ); + GDIMetaFile aMtf; + boost::shared_ptr<Printer> aPrt( maPController->getPrinter() ); + if( nPages > 0 ) + { + PrinterController::PageSize aPageSize = + maPController->getFilteredPageFile( mnCurPage, aMtf, i_bMayUseCache ); + if( ! aPageSize.bFullPaper ) + { + Point aOff( aPrt->PixelToLogic( aPrt->GetPageOffsetPixel(), aMapMode ) ); + aMtf.Move( aOff.X(), aOff.Y() ); + } + } + + Size aCurPageSize = aPrt->PixelToLogic( aPrt->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ); + maPreviewWindow.setPreview( aMtf, aCurPageSize, nPages > 0 ? rtl::OUString() : maNoPageStr, + aPrt->ImplGetDPIX(), aPrt->ImplGetDPIY() + ); + + maForwardBtn.Enable( mnCurPage < nPages-1 ); + maBackwardBtn.Enable( mnCurPage != 0 ); + maPageEdit.Enable( nPages > 1 ); + } +} + +Size PrintDialog::getJobPageSize() +{ + if( maFirstPageSize.Width() == 0 && maFirstPageSize.Height() == 0) + { + maFirstPageSize = maNupPortraitSize; + GDIMetaFile aMtf; + if( maPController->getPageCountProtected() > 0 ) + { + PrinterController::PageSize aPageSize = maPController->getPageFile( 0, aMtf, true ); + maFirstPageSize = aPageSize.aSize; + } + } + return maFirstPageSize; +} + +void PrintDialog::updateNupFromPages() +{ + long nPages = long(maNUpPage.maNupPagesBox.GetEntryData(maNUpPage.maNupPagesBox.GetSelectEntryPos())); + int nRows = int(maNUpPage.maNupRowsEdt.GetValue()); + int nCols = int(maNUpPage.maNupColEdt.GetValue()); + long nPageMargin = long(maNUpPage.maPageMarginEdt.Denormalize(maNUpPage.maPageMarginEdt.GetValue( FUNIT_100TH_MM ))); + long nSheetMargin = long(maNUpPage.maSheetMarginEdt.Denormalize(maNUpPage.maSheetMarginEdt.GetValue( FUNIT_100TH_MM ))); + bool bCustom = false; + + if( nPages == 1 ) + { + nRows = nCols = 1; + nSheetMargin = 0; + nPageMargin = 0; + } + else if( nPages == 2 || nPages == 4 || nPages == 6 || nPages == 9 || nPages == 16 ) + { + Size aJobPageSize( getJobPageSize() ); + bool bPortrait = aJobPageSize.Width() < aJobPageSize.Height(); + if( nPages == 2 ) + { + if( bPortrait ) + nRows = 1, nCols = 2; + else + nRows = 2, nCols = 1; + } + else if( nPages == 4 ) + nRows = nCols = 2; + else if( nPages == 6 ) + { + if( bPortrait ) + nRows = 2, nCols = 3; + else + nRows = 3, nCols = 2; + } + else if( nPages == 9 ) + nRows = nCols = 3; + else if( nPages == 16 ) + nRows = nCols = 4; + nPageMargin = 0; + nSheetMargin = 0; + } + else + bCustom = true; + + if( nPages > 1 ) + { + // set upper limits for margins based on job page size and rows/columns + Size aSize( getJobPageSize() ); + + // maximum sheet distance: 1/2 sheet + long nHorzMax = aSize.Width()/2; + long nVertMax = aSize.Height()/2; + if( nSheetMargin > nHorzMax ) + nSheetMargin = nHorzMax; + if( nSheetMargin > nVertMax ) + nSheetMargin = nVertMax; + + maNUpPage.maSheetMarginEdt.SetMax( + maNUpPage.maSheetMarginEdt.Normalize( + nHorzMax > nVertMax ? nVertMax : nHorzMax ), FUNIT_100TH_MM ); + + // maximum page distance + nHorzMax = (aSize.Width() - 2*nSheetMargin); + if( nCols > 1 ) + nHorzMax /= (nCols-1); + nVertMax = (aSize.Height() - 2*nSheetMargin); + if( nRows > 1 ) + nHorzMax /= (nRows-1); + + if( nPageMargin > nHorzMax ) + nPageMargin = nHorzMax; + if( nPageMargin > nVertMax ) + nPageMargin = nVertMax; + + maNUpPage.maPageMarginEdt.SetMax( + maNUpPage.maSheetMarginEdt.Normalize( + nHorzMax > nVertMax ? nVertMax : nHorzMax ), FUNIT_100TH_MM ); + } + + maNUpPage.maNupRowsEdt.SetValue( nRows ); + maNUpPage.maNupColEdt.SetValue( nCols ); + maNUpPage.maPageMarginEdt.SetValue( maNUpPage.maPageMarginEdt.Normalize( nPageMargin ), FUNIT_100TH_MM ); + maNUpPage.maSheetMarginEdt.SetValue( maNUpPage.maSheetMarginEdt.Normalize( nSheetMargin ), FUNIT_100TH_MM ); + + maNUpPage.showAdvancedControls( bCustom ); + if( bCustom ) + { + // see if we have to enlarge the dialog to make the tab page fit + Size aCurSize( maNUpPage.maLayout.getOptimalSize( WINDOWSIZE_PREFERRED ) ); + Size aTabSize( maTabCtrl.GetTabPageSizePixel() ); + if( aTabSize.Height() < aCurSize.Height() ) + { + Size aDlgSize( GetSizePixel() ); + aDlgSize.Height() += aCurSize.Height() - aTabSize.Height(); + SetSizePixel( aDlgSize ); + } + } + + updateNup(); +} + +void PrintDialog::updateNup() +{ + int nRows = int(maNUpPage.maNupRowsEdt.GetValue()); + int nCols = int(maNUpPage.maNupColEdt.GetValue()); + long nPageMargin = long(maNUpPage.maPageMarginEdt.Denormalize(maNUpPage.maPageMarginEdt.GetValue( FUNIT_100TH_MM ))); + long nSheetMargin = long(maNUpPage.maSheetMarginEdt.Denormalize(maNUpPage.maSheetMarginEdt.GetValue( FUNIT_100TH_MM ))); + + PrinterController::MultiPageSetup aMPS; + aMPS.nRows = nRows; + aMPS.nColumns = nCols; + aMPS.nRepeat = 1; + aMPS.nLeftMargin = + aMPS.nTopMargin = + aMPS.nRightMargin = + aMPS.nBottomMargin = nSheetMargin; + + aMPS.nHorizontalSpacing = + aMPS.nVerticalSpacing = nPageMargin; + + aMPS.bDrawBorder = maNUpPage.maBorderCB.IsChecked(); + + int nOrderMode = int(sal_IntPtr(maNUpPage.maNupOrderBox.GetEntryData( + maNUpPage.maNupOrderBox.GetSelectEntryPos() ))); + if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_LRTD ) + aMPS.nOrder = PrinterController::LRTB; + else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_TDLR ) + aMPS.nOrder = PrinterController::TBLR; + + int nOrientationMode = int(sal_IntPtr(maNUpPage.maNupOrientationBox.GetEntryData( + maNUpPage.maNupOrientationBox.GetSelectEntryPos() ))); + if( nOrientationMode == SV_PRINT_PRT_NUP_ORIENTATION_LANDSCAPE ) + aMPS.aPaperSize = maNupLandscapeSize; + else if( nOrientationMode == SV_PRINT_PRT_NUP_ORIENTATION_PORTRAIT ) + aMPS.aPaperSize = maNupPortraitSize; + else // automatic mode + { + // get size of first real page to see if it is portrait or landscape + // we assume same page sizes for all the pages for this + Size aPageSize = getJobPageSize(); + + Size aMultiSize( aPageSize.Width() * nCols, aPageSize.Height() * nRows ); + if( aMultiSize.Width() > aMultiSize.Height() ) // fits better on landscape + aMPS.aPaperSize = maNupLandscapeSize; + else + aMPS.aPaperSize = maNupPortraitSize; + } + + maPController->setMultipage( aMPS ); + + maNUpPage.maNupOrderWin.setValues( nOrderMode, nCols, nRows ); + + preparePreview( true, true ); +} + +IMPL_LINK( PrintDialog, SelectHdl, ListBox*, pBox ) +{ + if( pBox == &maJobPage.maPrinters ) + { + String aNewPrinter( pBox->GetSelectEntry() ); + // set new printer + maPController->setPrinter( boost::shared_ptr<Printer>( new Printer( aNewPrinter ) ) ); + // update text fields + updatePrinterText(); + } + else if( pBox == &maNUpPage.maNupOrientationBox || pBox == &maNUpPage.maNupOrderBox ) + { + updateNup(); + } + else if( pBox == &maNUpPage.maNupPagesBox ) + { + if( !maNUpPage.maPagesBtn.IsChecked() ) + maNUpPage.maPagesBtn.Check(); + updateNupFromPages(); + } + + return 0; +} + +IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton ) +{ + if( pButton == &maOKButton || pButton == &maCancelButton ) + { + storeToSettings(); + EndDialog( pButton == &maOKButton ); + } + else if( pButton == &maHelpButton ) + { + // start help system + Help* pHelp = Application::GetHelp(); + if( pHelp ) + { + // FIXME: find out proper help URL and use here + pHelp->Start( HID_PRINTDLG, GetParent() ); + } + } + else if( pButton == &maForwardBtn ) + { + previewForward(); + } + else if( pButton == &maBackwardBtn ) + { + previewBackward(); + } + else if( pButton == &maOptionsPage.maToFileBox ) + { + maOKButton.SetText( maOptionsPage.maToFileBox.IsChecked() ? maPrintToFileText : maPrintText ); + maLayout.resize(); + } + else if( pButton == &maNUpPage.maBrochureBtn ) + { + PropertyValue* pVal = getValueForWindow( pButton ); + if( pVal ) + { + sal_Bool bVal = maNUpPage.maBrochureBtn.IsChecked(); + pVal->Value <<= bVal; + + checkOptionalControlDependencies(); + + // update preview and page settings + preparePreview(); + } + if( maNUpPage.maBrochureBtn.IsChecked() ) + { + maNUpPage.maNupPagesBox.SelectEntryPos( 0 ); + updateNupFromPages(); + maNUpPage.showAdvancedControls( false ); + maNUpPage.enableNupControls( false ); + } + } + else if( pButton == &maNUpPage.maPagesBtn ) + { + maNUpPage.enableNupControls( true ); + updateNupFromPages(); + } + else if( pButton == &maJobPage.maDetailsBtn ) + { + bool bShow = maJobPage.maDetailsBtn.IsChecked(); + maJobPage.mxDetails->show( bShow ); + if( bShow ) + { + maDetailsCollapsedSize = GetOutputSizePixel(); + // enlarge dialog if necessary + Size aMinSize( maJobPage.maLayout.getOptimalSize( WINDOWSIZE_MINIMUM ) ); + Size aCurSize( maJobPage.GetSizePixel() ); + if( aCurSize.Height() < aMinSize.Height() ) + { + Size aDlgSize( GetOutputSizePixel() ); + aDlgSize.Height() += aMinSize.Height() - aCurSize.Height(); + SetOutputSizePixel( aDlgSize ); + } + maDetailsExpandedSize = GetOutputSizePixel(); + } + else if( maDetailsCollapsedSize.Width() > 0 && + maDetailsCollapsedSize.Height() > 0 ) + { + // if the user did not resize the dialog + // make it smaller again on collapsing the details + Size aDlgSize( GetOutputSizePixel() ); + if( aDlgSize == maDetailsExpandedSize && + aDlgSize.Height() > maDetailsCollapsedSize.Height() ) + { + SetOutputSizePixel( maDetailsCollapsedSize ); + } + } + } + else if( pButton == &maJobPage.maCollateBox ) + { + maPController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ), + makeAny( sal_Bool(isCollate()) ) ); + checkControlDependencies(); + } + else if( pButton == &maOptionsPage.maReverseOrderBox ) + { + sal_Bool bChecked = maOptionsPage.maReverseOrderBox.IsChecked(); + maPController->setReversePrint( bChecked ); + maPController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintReverse" ) ), + makeAny( bChecked ) ); + preparePreview( true, true ); + } + else if( pButton == &maNUpPage.maBorderCB ) + { + updateNup(); + } + else + { + if( pButton == &maJobPage.maSetupButton ) + { + maPController->setupPrinter( this ); + preparePreview( true, true ); + } + checkControlDependencies(); + } + return 0; +} + +IMPL_LINK( PrintDialog, ModifyHdl, Edit*, pEdit ) +{ + checkControlDependencies(); + if( pEdit == &maNUpPage.maNupRowsEdt || pEdit == &maNUpPage.maNupColEdt || + pEdit == &maNUpPage.maSheetMarginEdt || pEdit == &maNUpPage.maPageMarginEdt + ) + { + updateNupFromPages(); + } + else if( pEdit == &maPageEdit ) + { + mnCurPage = sal_Int32( maPageEdit.GetValue() - 1 ); + preparePreview( true, true ); + } + else if( pEdit == &maJobPage.maCopyCountField ) + { + maPController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CopyCount" ) ), + makeAny( sal_Int32(maJobPage.maCopyCountField.GetValue()) ) ); + maPController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ), + makeAny( sal_Bool(isCollate()) ) ); + } + return 0; +} + +IMPL_LINK( PrintDialog, UIOptionsChanged, void*, EMPTYARG ) +{ + checkOptionalControlDependencies(); + return 0; +} + +PropertyValue* PrintDialog::getValueForWindow( Window* i_pWindow ) const +{ + PropertyValue* pVal = NULL; + std::map< Window*, rtl::OUString >::const_iterator it = maControlToPropertyMap.find( i_pWindow ); + if( it != maControlToPropertyMap.end() ) + { + pVal = maPController->getValue( it->second ); + DBG_ASSERT( pVal, "property value not found" ); + } + else + { + DBG_ERROR( "changed control not in property map" ); + } + return pVal; +} + +void PrintDialog::updateWindowFromProperty( const rtl::OUString& i_rProperty ) +{ + beans::PropertyValue* pValue = maPController->getValue( i_rProperty ); + std::map< rtl::OUString, std::vector< Window* > >::const_iterator it = maPropertyToWindowMap.find( i_rProperty ); + if( pValue && it != maPropertyToWindowMap.end() ) + { + const std::vector< Window* >& rWindows( it->second ); + if( ! rWindows.empty() ) + { + sal_Bool bVal = sal_False; + sal_Int32 nVal = -1; + if( pValue->Value >>= bVal ) + { + // we should have a CheckBox for this one + CheckBox* pBox = dynamic_cast< CheckBox* >( rWindows.front() ); + if( pBox ) + { + pBox->Check( bVal ); + } + else if( i_rProperty.equalsAscii( "PrintProspect" ) ) + { + // EVIL special case + if( bVal ) + maNUpPage.maBrochureBtn.Check(); + else + maNUpPage.maPagesBtn.Check(); + } + else + { + DBG_ASSERT( 0, "missing a checkbox" ); + } + } + else if( pValue->Value >>= nVal ) + { + // this could be a ListBox or a RadioButtonGroup + ListBox* pList = dynamic_cast< ListBox* >( rWindows.front() ); + if( pList ) + { + pList->SelectEntryPos( static_cast< USHORT >(nVal) ); + } + else if( nVal >= 0 && nVal < sal_Int32(rWindows.size() ) ) + { + RadioButton* pBtn = dynamic_cast< RadioButton* >( rWindows[nVal] ); + DBG_ASSERT( pBtn, "unexpected control for property" ); + if( pBtn ) + pBtn->Check(); + } + } + } + } +} + +void PrintDialog::makeEnabled( Window* i_pWindow ) +{ + std::map< Window*, rtl::OUString >::const_iterator it = maControlToPropertyMap.find( i_pWindow ); + if( it != maControlToPropertyMap.end() ) + { + rtl::OUString aDependency( maPController->makeEnabled( it->second ) ); + if( aDependency.getLength() ) + updateWindowFromProperty( aDependency ); + } +} + +IMPL_LINK( PrintDialog, UIOption_CheckHdl, CheckBox*, i_pBox ) +{ + PropertyValue* pVal = getValueForWindow( i_pBox ); + if( pVal ) + { + makeEnabled( i_pBox ); + + sal_Bool bVal = i_pBox->IsChecked(); + pVal->Value <<= bVal; + + checkOptionalControlDependencies(); + + // update preview and page settings + preparePreview(); + } + return 0; +} + +IMPL_LINK( PrintDialog, UIOption_RadioHdl, RadioButton*, i_pBtn ) +{ + // this handler gets called for all radiobuttons that get unchecked, too + // however we only want one notificaction for the new value (that is for + // the button that gets checked) + if( i_pBtn->IsChecked() ) + { + PropertyValue* pVal = getValueForWindow( i_pBtn ); + std::map< Window*, sal_Int32 >::const_iterator it = maControlToNumValMap.find( i_pBtn ); + if( pVal && it != maControlToNumValMap.end() ) + { + makeEnabled( i_pBtn ); + + sal_Int32 nVal = it->second; + pVal->Value <<= nVal; + + checkOptionalControlDependencies(); + + // update preview and page settings + preparePreview(); + } + } + return 0; +} + +IMPL_LINK( PrintDialog, UIOption_SelectHdl, ListBox*, i_pBox ) +{ + PropertyValue* pVal = getValueForWindow( i_pBox ); + if( pVal ) + { + makeEnabled( i_pBox ); + + sal_Int32 nVal( i_pBox->GetSelectEntryPos() ); + pVal->Value <<= nVal; + + checkOptionalControlDependencies(); + + // update preview and page settings + preparePreview(); + } + return 0; +} + +IMPL_LINK( PrintDialog, UIOption_ModifyHdl, Edit*, i_pBox ) +{ + PropertyValue* pVal = getValueForWindow( i_pBox ); + if( pVal ) + { + makeEnabled( i_pBox ); + + NumericField* pNum = dynamic_cast<NumericField*>(i_pBox); + MetricField* pMetric = dynamic_cast<MetricField*>(i_pBox); + if( pNum ) + { + sal_Int64 nVal = pNum->GetValue(); + pVal->Value <<= nVal; + } + else if( pMetric ) + { + sal_Int64 nVal = pMetric->GetValue(); + pVal->Value <<= nVal; + } + else + { + rtl::OUString aVal( i_pBox->GetText() ); + pVal->Value <<= aVal; + } + + checkOptionalControlDependencies(); + + // update preview and page settings + preparePreview(); + } + return 0; +} + +void PrintDialog::Command( const CommandEvent& rEvt ) +{ + if( rEvt.GetCommand() == COMMAND_WHEEL ) + { + const CommandWheelData* pWheelData = rEvt.GetWheelData(); + if( pWheelData->GetDelta() > 0 ) + previewForward(); + else if( pWheelData->GetDelta() < 0 ) + previewBackward(); + /* + else + huh ? + */ + } +} + +void PrintDialog::Resize() +{ + maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetSizePixel() ) ); + // and do the preview; however the metafile does not need to be gotten anew + preparePreview( false ); + + // do an invalidate for the benefit of the grouping elements + Invalidate(); +} + +void PrintDialog::previewForward() +{ + maPageEdit.Up(); +} + +void PrintDialog::previewBackward() +{ + maPageEdit.Down(); +} + +// ----------------------------------------------------------------------------- +// +// PrintProgressDialog +// +// ----------------------------------------------------------------------------- + +PrintProgressDialog::PrintProgressDialog( Window* i_pParent, int i_nMax ) : + ModelessDialog( i_pParent, VclResId( SV_DLG_PRINT_PROGRESS ) ), + maText( this, VclResId( SV_PRINT_PROGRESS_TEXT ) ), + maButton( this, VclResId( SV_PRINT_PROGRESS_CANCEL ) ), + mbCanceled( false ), + mnCur( 0 ), + mnMax( i_nMax ), + mnProgressHeight( 15 ), + mbNativeProgress( false ) +{ + FreeResource(); + + if( mnMax < 1 ) + mnMax = 1; + + maStr = maText.GetText(); + + maButton.SetClickHdl( LINK( this, PrintProgressDialog, ClickHdl ) ); + +} + +PrintProgressDialog::~PrintProgressDialog() +{ +} + +IMPL_LINK( PrintProgressDialog, ClickHdl, Button*, pButton ) +{ + if( pButton == &maButton ) + mbCanceled = true; + + return 0; +} + +void PrintProgressDialog::implCalcProgressRect() +{ + if( IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL ) ) + { + ImplControlValue aValue; + Region aControlRegion( Rectangle( Point(), Size( 100, mnProgressHeight ) ) ); + Region aNativeControlRegion, aNativeContentRegion; + if( GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion, + CTRL_STATE_ENABLED, aValue, rtl::OUString(), + aNativeControlRegion, aNativeContentRegion ) ) + { + mnProgressHeight = aNativeControlRegion.GetBoundRect().GetHeight(); + } + mbNativeProgress = true; + } + maProgressRect = Rectangle( Point( 10, maText.GetPosPixel().Y() + maText.GetSizePixel().Height() + 8 ), + Size( GetSizePixel().Width() - 20, mnProgressHeight ) ); +} + +void PrintProgressDialog::setProgress( int i_nCurrent, int i_nMax ) +{ + if( maProgressRect.IsEmpty() ) + implCalcProgressRect(); + + mnCur = i_nCurrent; + if( i_nMax != -1 ) + mnMax = i_nMax; + + if( mnMax < 1 ) + mnMax = 1; + + rtl::OUString aNewText( searchAndReplace( maStr, "%p", 2, rtl::OUString::valueOf( mnCur ) ) ); + aNewText = searchAndReplace( aNewText, "%n", 2, rtl::OUString::valueOf( mnMax ) ); + maText.SetText( aNewText ); + + // update progress + Invalidate( maProgressRect, INVALIDATE_UPDATE ); +} + +void PrintProgressDialog::tick() +{ + if( mnCur < mnMax ) + setProgress( ++mnCur ); +} + +void PrintProgressDialog::Paint( const Rectangle& ) +{ + if( maProgressRect.IsEmpty() ) + implCalcProgressRect(); + + Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + Color aPrgsColor = rStyleSettings.GetHighlightColor(); + if ( aPrgsColor == rStyleSettings.GetFaceColor() ) + aPrgsColor = rStyleSettings.GetDarkShadowColor(); + SetLineColor(); + SetFillColor( aPrgsColor ); + + const long nOffset = 3; + const long nWidth = 3*mnProgressHeight/2; + const long nFullWidth = nWidth + nOffset; + const long nMaxCount = maProgressRect.GetWidth() / nFullWidth; + DrawProgress( this, maProgressRect.TopLeft(), + nOffset, + nWidth, + mnProgressHeight, + static_cast<USHORT>(0), + static_cast<USHORT>(10000*mnCur/mnMax), + static_cast<USHORT>(10000/nMaxCount), + maProgressRect + ); + Pop(); + + if( ! mbNativeProgress ) + { + DecorationView aDecoView( this ); + Rectangle aFrameRect( maProgressRect ); + aFrameRect.Left() -= nOffset; + aFrameRect.Right() += nOffset; + aFrameRect.Top() -= nOffset; + aFrameRect.Bottom() += nOffset; + aDecoView.DrawFrame( aFrameRect ); + } +} + diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index 4aaef6a707b1..ede3bcc107aa 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -1320,8 +1320,13 @@ void StatusBar::SetItemText( USHORT nItemId, const XubString& rText ) // adjust item width - see also DataChanged() long nFudge = GetTextHeight()/4; long nWidth = GetTextWidth( pItem->maText ) + nFudge; - if( nWidth > pItem->mnWidth + STATUSBAR_OFFSET ) + if( (nWidth > pItem->mnWidth + STATUSBAR_OFFSET) || + ((nWidth < pItem->mnWidth) && (mnDX - STATUSBAR_OFFSET) < mnItemsWidth )) + { pItem->mnWidth = nWidth + STATUSBAR_OFFSET; + ImplFormat(); + Invalidate(); + } // Item neu Zeichen, wenn StatusBar sichtbar und // UpdateMode gesetzt ist diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index f3ce8b2d05ea..2d99fbb20b65 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -62,6 +62,7 @@ public: TaskPaneList* mpTaskPaneList; Size maMaxOutSize; + rtl::OUString maRepresentedURL; }; SystemWindow::ImplData::ImplData() @@ -277,6 +278,29 @@ void SystemWindow::SetZLevel( BYTE nLevel ) // ----------------------------------------------------------------------- +void SystemWindow::SetRepresentedURL( const rtl::OUString& i_rURL ) +{ + bool bChanged = (i_rURL != mpImplData->maRepresentedURL); + mpImplData->maRepresentedURL = i_rURL; + if ( !mbSysChild && bChanged ) + { + const Window* pWindow = this; + while ( pWindow->mpWindowImpl->mpBorderWindow ) + pWindow = pWindow->mpWindowImpl->mpBorderWindow; + + if ( pWindow->mpWindowImpl->mbFrame ) + pWindow->mpWindowImpl->mpFrame->SetRepresentedURL( i_rURL ); + } +} +// ----------------------------------------------------------------------- + +const rtl::OUString& SystemWindow::GetRepresentedURL() const +{ + return mpImplData->maRepresentedURL; +} + +// ----------------------------------------------------------------------- + void SystemWindow::SetIcon( USHORT nIcon ) { if ( mnIcon == nIcon ) diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 8aa4926f5e1a..ef58ea9e6bc6 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -229,6 +229,22 @@ int ToolBox::ImplGetDragWidth( ToolBox* pThis ) } return width; } + +ButtonType determineButtonType( ImplToolItem* pItem, ButtonType defaultType ) +{ + ButtonType tmpButtonType = defaultType; + ToolBoxItemBits nBits( pItem->mnBits & 0x300 ); + if ( nBits & TIB_TEXTICON ) // item has custom setting + { + tmpButtonType = BUTTON_SYMBOLTEXT; + if ( nBits == TIB_TEXT_ONLY ) + tmpButtonType = BUTTON_TEXT; + else if ( nBits == TIB_ICON_ONLY ) + tmpButtonType = BUTTON_SYMBOL; + } + return tmpButtonType; +} + // ----------------------------------------------------------------------- void ToolBox::ImplUpdateDragArea( ToolBox *pThis ) @@ -1992,12 +2008,13 @@ BOOL ToolBox::ImplCalcItem() bText = FALSE; else bText = TRUE; - + ButtonType tmpButtonType = determineButtonType( &(*it), meButtonType ); // default to toolbox setting if ( bImage || bText ) { + it->mbEmptyBtn = FALSE; - if ( meButtonType == BUTTON_SYMBOL ) + if ( tmpButtonType == BUTTON_SYMBOL ) { // we're drawing images only if ( bImage || !bText ) @@ -2011,7 +2028,7 @@ BOOL ToolBox::ImplCalcItem() it->mbVisibleText = TRUE; } } - else if ( meButtonType == BUTTON_TEXT ) + else if ( tmpButtonType == BUTTON_TEXT ) { // we're drawing text only if ( bText || !bImage ) @@ -3625,7 +3642,8 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay // determine what has to be drawn on the button: image, text or both BOOL bImage; BOOL bText; - pItem->DetermineButtonDrawStyle( meButtonType, bImage, bText ); + ButtonType tmpButtonType = determineButtonType( pItem, meButtonType ); // default to toolbox setting + pItem->DetermineButtonDrawStyle( tmpButtonType, bImage, bText ); // compute output values long nBtnWidth = aBtnSize.Width()-SMALLBUTTON_HSIZE; diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 9ec86fab20de..ecc335420f18 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -1002,6 +1002,9 @@ const Size& ToolBox::GetDefaultImageSize() const case STYLE_SYMBOLS_CRYSTAL: aLargeButtonSize = Size( TB_LARGEIMAGESIZE_CRYSTAL, TB_LARGEIMAGESIZE_CRYSTAL ); break; + case STYLE_SYMBOLS_OXYGEN: + aLargeButtonSize = Size( TB_LARGEIMAGESIZE_OXYGEN, TB_LARGEIMAGESIZE_OXYGEN ); + break; default: aLargeButtonSize = Size( TB_LARGEIMAGESIZE, TB_LARGEIMAGESIZE ); } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 63bf407ce49f..ca0ebb10a4e9 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -68,7 +68,7 @@ #include "vcl/wall.hxx" #include "vcl/gradient.hxx" #include "vcl/toolbox.h" -#include "vcl/fontcfg.hxx" +#include "unotools/fontcfg.hxx" #include "vcl/sysdata.hxx" #include "vcl/sallayout.hxx" #include "vcl/button.hxx" // Button::GetStandardText @@ -310,7 +310,7 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, BOOL bCallHdl ) if ( !bUseSystemFont ) { ImplInitFontList(); - String aConfigFont = vcl::DefaultFontConfiguration::get()->getUserInterfaceFont( rSettings.GetUILocale() ); + String aConfigFont = utl::DefaultFontConfiguration::get()->getUserInterfaceFont( rSettings.GetUILocale() ); xub_StrLen nIndex = 0; while( nIndex != STRING_NOTFOUND ) { @@ -698,6 +698,7 @@ void Window::ImplInitWindowData( WindowType nType ) mpWindowImpl->mbCallHandlersDuringInputDisabled = FALSE; // TRUE: call event handlers even if input is disabled mpWindowImpl->mbDisableAccessibleLabelForRelation = FALSE; // TRUE: do not set LabelFor relation on accessible objects mpWindowImpl->mbDisableAccessibleLabeledByRelation = FALSE; // TRUE: do not set LabeledBy relation on accessible objects + mpWindowImpl->mbHelpTextDynamic = FALSE; // TRUE: append help id in HELP_DEBUG case mbEnableRTL = Application::GetSettings().GetLayoutRTL(); // TRUE: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active } @@ -1279,7 +1280,10 @@ void Window::ImplLoadRes( const ResId& rResId ) if ( nObjMask & WINDOW_TEXT ) SetText( ReadStringRes() ); if ( nObjMask & WINDOW_HELPTEXT ) + { SetHelpText( ReadStringRes() ); + mpWindowImpl->mbHelpTextDynamic = TRUE; + } if ( nObjMask & WINDOW_QUICKTEXT ) SetQuickHelpText( ReadStringRes() ); if ( nObjMask & WINDOW_EXTRALONG ) @@ -8109,9 +8113,26 @@ const XubString& Window::GetHelpText() const ((Window*)this)->mpWindowImpl->maHelpText = pHelp->GetHelpText( aStrHelpId, this ); else ((Window*)this)->mpWindowImpl->maHelpText = pHelp->GetHelpText( nNumHelpId, this ); + mpWindowImpl->mbHelpTextDynamic = FALSE; } } } + else if( mpWindowImpl->mbHelpTextDynamic && (nNumHelpId || bStrHelpId) ) + { + static const char* pEnv = getenv( "HELP_DEBUG" ); + if( pEnv && *pEnv ) + { + rtl::OUStringBuffer aTxt( 64+mpWindowImpl->maHelpText.Len() ); + aTxt.append( mpWindowImpl->maHelpText ); + aTxt.appendAscii( "\n+++++++++++++++\n" ); + if( bStrHelpId ) + aTxt.append( rtl::OUString( aStrHelpId ) ); + else + aTxt.append( sal_Int32( nNumHelpId ) ); + mpWindowImpl->maHelpText = aTxt.makeStringAndClear(); + } + mpWindowImpl->mbHelpTextDynamic = FALSE; + } return mpWindowImpl->maHelpText; } @@ -9752,6 +9773,8 @@ void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rP EnableOutput(); DBG_ASSERT( GetMapMode().GetMapUnit() == MAP_PIXEL, "MapMode must be PIXEL based" ); + if ( GetMapMode().GetMapUnit() != MAP_PIXEL ) + return; // preserve graphicsstate Push(); diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index d70f607a6cc6..a9bc93863829 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -1459,7 +1459,6 @@ ULONG Window::GetHelpId() const 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() ) ) { @@ -2000,6 +1999,7 @@ BOOL Window::IsZoom() const void Window::SetHelpText( const XubString& rHelpText ) { mpWindowImpl->maHelpText = rHelpText; + mpWindowImpl->mbHelpTextDynamic = TRUE; } void Window::SetQuickHelpText( const XubString& rHelpText ) diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx index 0c19c5c5ee4f..c1f80bb061e5 100644 --- a/vcl/source/window/wrkwin.cxx +++ b/vcl/source/window/wrkwin.cxx @@ -310,7 +310,7 @@ void WorkWindow::Maximize( BOOL bMaximize ) ImplSetFrameState( bMaximize ? SAL_FRAMESTATE_MAXIMIZED : SAL_FRAMESTATE_NORMAL ); } -BOOL WorkWindow::IsMaximized() +BOOL WorkWindow::IsMaximized() const { BOOL bRet = FALSE; diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx index 8d83ca008e4a..0a97e5ba1ca6 100644 --- a/vcl/unx/gtk/a11y/atktext.cxx +++ b/vcl/unx/gtk/a11y/atktext.cxx @@ -187,8 +187,16 @@ static accessibility::XAccessibleTextMarkup* if( !pWrap->mpTextMarkup && pWrap->mpContext ) { uno::Any any = pWrap->mpContext->queryInterface( accessibility::XAccessibleTextMarkup::static_type(NULL) ); - pWrap->mpTextMarkup = reinterpret_cast< accessibility::XAccessibleTextMarkup * > (any.pReserved); - pWrap->mpTextMarkup->acquire(); + /* Since this not a dedicated interface in Atk and thus has not + * been queried during wrapper initialization, we need to check + * the return value here. + */ + if( typelib_TypeClass_INTERFACE == any.pType->eTypeClass ) + { + pWrap->mpTextMarkup = reinterpret_cast< accessibility::XAccessibleTextMarkup * > (any.pReserved); + if( pWrap->mpTextMarkup ) + pWrap->mpTextMarkup->acquire(); + } } return pWrap->mpTextMarkup; diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx index 5206c8ce87ca..c92a69d3fb49 100644 --- a/vcl/unx/gtk/a11y/atkutil.cxx +++ b/vcl/unx/gtk/a11y/atkutil.cxx @@ -221,7 +221,7 @@ void DocumentFocusListener::notifyEvent( const accessibility::AccessibleEventObj if( accessibility::AccessibleStateType::FOCUSED == nState ) atk_wrapper_focus_tracker_notify_when_idle( getAccessible(aEvent) ); } - catch(lang::IndexOutOfBoundsException e) + catch(const lang::IndexOutOfBoundsException &e) { g_warning("Focused object has invalid index in parent"); } @@ -577,7 +577,14 @@ static void handle_get_focus(::VclWindowEvent const * pEvent) if( g_aWindowList.find(pWindow) == g_aWindowList.end() ) { g_aWindowList.insert(pWindow); - aDocumentFocusListener->attachRecursive(xAccessible, xContext, xStateSet); + try + { + aDocumentFocusListener->attachRecursive(xAccessible, xContext, xStateSet); + } + catch( const uno::Exception &e ) + { + g_warning( "Exception caught processing focus events" ); + } } #ifdef ENABLE_TRACING else @@ -608,7 +615,7 @@ static void handle_menu_highlighted(::VclMenuEvent const * pEvent) } } } - catch( uno::Exception e ) + catch( const uno::Exception& e ) { g_warning( "Exception caught processing menu highlight events" ); } diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index f922552ce923..654f39c51a92 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -1091,6 +1091,19 @@ BOOL GtkSalGraphics::getNativeControlRegion( ControlType nType, rNativeContentRegion = Region( aIndicatorRect ); returnVal = TRUE; } + if( (nType == CTRL_EDITBOX || nType == CTRL_SPINBOX) && nPart == PART_ENTIRE_CONTROL ) + { + NWEnsureGTKEditBox( m_nScreen ); + GtkWidget* widget = gWidgetData[m_nScreen].gEditBoxWidget; + GtkRequisition aReq; + gtk_widget_size_request( widget, &aReq ); + Rectangle aEditRect = rControlRegion.GetBoundRect(); + aEditRect = Rectangle( aEditRect.TopLeft(), + Size( aEditRect.GetWidth(), aReq.height+1 ) ); + rNativeBoundingRegion = Region( aEditRect ); + rNativeContentRegion = rNativeBoundingRegion; + returnVal = TRUE; + } return( returnVal ); } diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index eff7319d6efc..92ff2d3b8d8e 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -772,7 +772,10 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) m_aForeignTopLevelWindow = None; m_nStyle = nStyle; - GtkWindowType eWinType = ((nStyle & SAL_FRAME_STYLE_FLOAT) && ! (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION)) + GtkWindowType eWinType = ( (nStyle & SAL_FRAME_STYLE_FLOAT) && + ! (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION| + SAL_FRAME_STYLE_FLOAT_FOCUSABLE)) + ) ? GTK_WINDOW_POPUP : GTK_WINDOW_TOPLEVEL; if( nStyle & SAL_FRAME_STYLE_SYSTEMCHILD ) @@ -801,7 +804,7 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) bool bDecoHandling = ! isChild() && ( ! (nStyle & SAL_FRAME_STYLE_FLOAT) || - (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ); + (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION|SAL_FRAME_STYLE_FLOAT_FOCUSABLE) ) ); /* #i100116# metacity has a peculiar behavior regarding WM_HINT accept focus and _NET_WM_USER_TIME at some point that may be fixed in metacity and we will have to revisit this @@ -832,6 +835,11 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, true ); bNoDecor = true; } + else if( (nStyle & SAL_FRAME_STYLE_FLOAT_FOCUSABLE) ) + { + eType = GDK_WINDOW_TYPE_HINT_UTILITY; + } + if( (nStyle & SAL_FRAME_STYLE_PARTIAL_FULLSCREEN ) ) { eType = GDK_WINDOW_TYPE_HINT_TOOLBAR; @@ -869,7 +877,7 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle ) if( bDecoHandling ) { gtk_window_set_resizable( GTK_WINDOW(m_pWindow), (nStyle & SAL_FRAME_STYLE_SIZEABLE) ? TRUE : FALSE ); - if( ( (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ) || bMetaCityToolWindowHack ) + if( ( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) ) || bMetaCityToolWindowHack ) lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, false ); } @@ -2075,7 +2083,7 @@ void GtkSalFrame::ToTop( USHORT nFlags ) * to our window - which it of course won't since our input hint * is set to false. */ - if( (m_nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ) + if( (m_nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION|SAL_FRAME_STYLE_FLOAT_FOCUSABLE)) ) XSetInputFocus( getDisplay()->GetDisplay(), GDK_WINDOW_XWINDOW( m_pWindow->window ), RevertToParent, CurrentTime ); } else @@ -2369,6 +2377,11 @@ void GtkSalFrame::createNewWindow( XLIB_Window aNewParent, bool bXEmbed, int nSc } } + // free xrender resources + for( unsigned int i = 0; i < sizeof(m_aGraphics)/sizeof(m_aGraphics[0]); i++ ) + if( m_aGraphics[i].bInUse ) + m_aGraphics[i].pGraphics->SetDrawable( None, m_nScreen ); + // first deinit frame if( m_pIMHandler ) { diff --git a/vcl/unx/headless/svpprn.cxx b/vcl/unx/headless/svpprn.cxx index 1882b50e6ad7..75d86959b2b5 100644 --- a/vcl/unx/headless/svpprn.cxx +++ b/vcl/unx/headless/svpprn.cxx @@ -123,6 +123,32 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData ) pJobSetup->mnPaperBin = 0xffff; } + // copy duplex + pKey = NULL; + pValue = NULL; + + pJobSetup->meDuplexMode = DUPLEX_UNKNOWN; + if( rData.m_pParser ) + pKey = rData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) ); + if( pKey ) + pValue = rData.m_aContext.getValue( pKey ); + if( pKey && pValue ) + { + if( pValue->m_aOption.EqualsIgnoreCaseAscii( "None" ) || + pValue->m_aOption.EqualsIgnoreCaseAscii( "Simplex", 0, 7 ) + ) + { + pJobSetup->meDuplexMode = DUPLEX_OFF; + } + else if( pValue->m_aOption.EqualsIgnoreCaseAscii( "DuplexNoTumble" ) ) + { + pJobSetup->meDuplexMode = DUPLEX_LONGEDGE; + } + else if( pValue->m_aOption.EqualsIgnoreCaseAscii( "DuplexTumble" ) ) + { + pJobSetup->meDuplexMode = DUPLEX_SHORTEDGE; + } + } // copy the whole context if( pJobSetup->mpDriverData ) @@ -455,34 +481,6 @@ void PspSalInfoPrinter::InitPaperFormats( const ImplJobSetup* ) // ----------------------------------------------------------------------- -DuplexMode PspSalInfoPrinter::GetDuplexMode( const ImplJobSetup* pJobSetup ) -{ - DuplexMode aRet = DUPLEX_UNKNOWN; - PrinterInfo aInfo( PrinterInfoManager::get().getPrinterInfo( pJobSetup->maPrinterName ) ); - if ( pJobSetup->mpDriverData ) - JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aInfo ); - if( aInfo.m_pParser ) - { - const PPDKey * pKey = aInfo.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) ); - if( pKey ) - { - const PPDValue* pVal = aInfo.m_aContext.getValue( pKey ); - if( pVal && ( - pVal->m_aOption.EqualsIgnoreCaseAscii( "None" ) || - pVal->m_aOption.EqualsIgnoreCaseAscii( "Simplex", 0, 7 ) - ) ) - { - aRet = DUPLEX_OFF; - } - else - aRet = DUPLEX_ON; - } - } - return aRet; -} - -// ----------------------------------------------------------------------- - int PspSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* ) { return 900; @@ -624,6 +622,37 @@ BOOL PspSalInfoPrinter::SetData( if( nSetDataFlags & SAL_JOBSET_ORIENTATION ) aData.m_eOrientation = pJobSetup->meOrientation == ORIENTATION_LANDSCAPE ? orientation::Landscape : orientation::Portrait; + // merge duplex if necessary + if( nSetDataFlags & SAL_JOBSET_DUPLEXMODE ) + { + pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) ); + if( pKey ) + { + pValue = NULL; + switch( pJobSetup->meDuplexMode ) + { + case DUPLEX_OFF: + pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) ); + if( pValue == NULL ) + pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "SimplexNoTumble" ) ) ); + break; + case DUPLEX_SHORTEDGE: + pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "DuplexTumble" ) ) ); + break; + case DUPLEX_LONGEDGE: + pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "DuplexNoTumble" ) ) ); + break; + case DUPLEX_UNKNOWN: + default: + pValue = 0; + break; + } + if( ! pValue ) + pValue = pKey->getDefaultValue(); + aData.m_aContext.setValue( pKey, pValue ); + } + } + m_aJobData = aData; copyJobDataToJobSetup( pJobSetup, aData ); return TRUE; @@ -725,9 +754,22 @@ ULONG PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, USHORT case PRINTER_CAPABILITIES_COPIES: return 0xffff; case PRINTER_CAPABILITIES_COLLATECOPIES: - return 0; + { + // see if the PPD contains a value to set Collate to True + JobData aData; + JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData ); + + const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ) ) : NULL; + const PPDValue* pVal = pKey ? pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "True" ) ) ) : NULL; + + // PPDs don't mention the number of possible collated copies. + // so let's guess as many as we want ? + return pVal ? 0xffff : 0; + } case PRINTER_CAPABILITIES_SETORIENTATION: return 1; + case PRINTER_CAPABILITIES_SETDUPLEX: + return 1; case PRINTER_CAPABILITIES_SETPAPERBIN: return 1; case PRINTER_CAPABILITIES_SETPAPERSIZE: @@ -777,6 +819,7 @@ PspSalPrinter::PspSalPrinter( SalInfoPrinter* pInfoPrinter ) m_bSwallowFaxNo( false ), m_pGraphics( NULL ), m_nCopies( 1 ), + m_bCollate( false ), m_pInfoPrinter( pInfoPrinter ) { } @@ -802,7 +845,9 @@ BOOL PspSalPrinter::StartJob( const XubString* pFileName, const XubString& rJobName, const XubString& rAppName, - ULONG nCopies, BOOL /*bCollate*/, + ULONG nCopies, + bool bCollate, + bool /*bDirect*/, ImplJobSetup* pJobSetup ) { vcl_sal::PrinterUpdate::jobStarted(); @@ -811,13 +856,17 @@ BOOL PspSalPrinter::StartJob( m_bPdf = false; m_aFileName = pFileName ? *pFileName : String(); m_aTmpFile = String(); - m_nCopies = nCopies; + m_nCopies = nCopies; + m_bCollate = bCollate; JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, m_aJobData ); if( m_nCopies > 1 ) + { // in case user did not do anything (m_nCopies=1) // take the default from jobsetup m_aJobData.m_nCopies = m_nCopies; + m_aJobData.setCollate( bCollate ); + } // check wether this printer is configured as fax int nMode = 0; @@ -917,9 +966,12 @@ SalGraphics* PspSalPrinter::StartPage( ImplJobSetup* pJobSetup, BOOL ) m_pGraphics = new PspGraphics( &m_aJobData, &m_aPrinterGfx, m_bFax ? &m_aFaxNr : NULL, m_bSwallowFaxNo, m_pInfoPrinter ); m_pGraphics->SetLayout( 0 ); if( m_nCopies > 1 ) + { // in case user did not do anything (m_nCopies=1) // take the default from jobsetup m_aJobData.m_nCopies = m_nCopies; + m_aJobData.setCollate( m_nCopies > 1 && m_bCollate ); + } m_aPrintJob.StartPage( m_aJobData ); m_aPrinterGfx.Init( m_aPrintJob ); diff --git a/vcl/unx/headless/svpprn.hxx b/vcl/unx/headless/svpprn.hxx index c2d85c054fce..8f5a47fed118 100644 --- a/vcl/unx/headless/svpprn.hxx +++ b/vcl/unx/headless/svpprn.hxx @@ -63,7 +63,6 @@ public: virtual String GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin ); virtual void InitPaperFormats( const ImplJobSetup* pSetupData ); virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ); - virtual DuplexMode GetDuplexMode( const ImplJobSetup* pSetupData ); }; class PspSalPrinter : public SalPrinter @@ -80,6 +79,7 @@ public: psp::JobData m_aJobData; psp::PrinterGfx m_aPrinterGfx; ULONG m_nCopies; + bool m_bCollate; SalInfoPrinter* m_pInfoPrinter; PspSalPrinter( SalInfoPrinter* ); @@ -90,7 +90,9 @@ public: virtual BOOL StartJob( const XubString* pFileName, const XubString& rJobName, const XubString& rAppName, - ULONG nCopies, BOOL bCollate, + ULONG nCopies, + bool bCollate, + bool bDirect, ImplJobSetup* pSetupData ); virtual BOOL EndJob(); virtual BOOL AbortJob(); diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx index 3e9d67bcbbe9..1311aaed4ee4 100644 --- a/vcl/unx/headless/svppspgraphics.cxx +++ b/vcl/unx/headless/svppspgraphics.cxx @@ -986,13 +986,6 @@ const void* PspGraphics::DoGetEmbedFontData( fontID aFont, const sal_Ucs* pUnico return NULL; // fill in font info - switch( aFontInfo.m_eType ) - { - case psp::fonttype::TrueType: rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF; break; - case psp::fonttype::Type1: rInfo.m_nFontType = FontSubsetInfo::ANY_TYPE1; break; - default: - return NULL; - } rInfo.m_nAscent = aFontInfo.m_nAscend; rInfo.m_nDescent = aFontInfo.m_nDescend; rInfo.m_aPSName = rMgr.getPSName( aFont ); @@ -1029,9 +1022,22 @@ const void* PspGraphics::DoGetEmbedFontData( fontID aFont, const sal_Ucs* pUnico rInfo.m_nCapHeight = yMax; // Well ... for( int i = 0; i < 256; i++ ) - pWidths[i] = (aMetrics[i].width > 0 ? aMetrics[i].width : 0); + switch( aFontInfo.m_eType ) + { + case psp::fonttype::TrueType: + rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF; + break; + case psp::fonttype::Type1: { + const bool bPFA = ((*(unsigned char*)pFile) < 0x80); + rInfo.m_nFontType = bPFA ? FontSubsetInfo::TYPE1_PFA : FontSubsetInfo::TYPE1_PFB; + } + break; + default: + return NULL; + } + return pFile; } diff --git a/vcl/unx/inc/kde_headers.h b/vcl/unx/inc/kde_headers.h deleted file mode 100644 index ccbffc99cb99..000000000000 --- a/vcl/unx/inc/kde_headers.h +++ /dev/null @@ -1,97 +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: kde_headers.h,v $ - * $Revision: 1.6 $ - * - * 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_VCL_KDE_HEADERS_H -#define INCLUDED_VCL_KDE_HEADERS_H - -/* ********* Suppress warnings if needed */ -#include "sal/config.h" - -#if defined __GNUC__ -#pragma GCC system_header -#endif - - -/* ********* Hack, but needed because of conflicting types... */ -#define Region QtXRegion - - -/* ********* Qt headers */ -#include <qaccessible.h> -#include <qcheckbox.h> -#include <qcombobox.h> -#include <qfont.h> -#include <qframe.h> -#include <qlineedit.h> -#include <qlistview.h> -#include <qmainwindow.h> -#include <qmenudata.h> -#include <qpaintdevice.h> -#include <qpainter.h> -#include <qpushbutton.h> -#include <qradiobutton.h> -#include <qrangecontrol.h> -#include <qstring.h> -#include <qtabbar.h> -#include <qtabwidget.h> -#include <qtoolbar.h> -#include <qtoolbutton.h> -#include <qwidget.h> -#include <qprogressbar.h> - -/* ********* See hack on top of this file */ -#undef Region - - -/* ********* KDE base headers */ -#include <kaboutdata.h> -#include <kapplication.h> -#include <kcmdlineargs.h> -#include <kconfig.h> -#include <kdeversion.h> -#include <kemailsettings.h> -#include <kglobal.h> -#include <kglobalsettings.h> -#include <klocale.h> -#include <kmainwindow.h> -#include <kmenubar.h> -#include <kprotocolmanager.h> -#include <kstartupinfo.h> -#include <kstyle.h> - - -/* ********* KDE address book connectivity headers */ -#include <kabc/addressbook.h> -#include <kabc/addressee.h> -#include <kabc/field.h> -#include <kabc/stdaddressbook.h> - - -#endif diff --git a/vcl/unx/inc/plugins/gtk/gtkframe.hxx b/vcl/unx/inc/plugins/gtk/gtkframe.hxx index a8fc6f65d4ee..c2a147517ac8 100644 --- a/vcl/unx/inc/plugins/gtk/gtkframe.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkframe.hxx @@ -242,9 +242,10 @@ class GtkSalFrame : public SalFrame bool isFloatGrabWindow() const { return - (m_nStyle & SAL_FRAME_STYLE_FLOAT) && // only a float can be floatgrab - !(m_nStyle & SAL_FRAME_STYLE_TOOLTIP) && // tool tips are not - !(m_nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION); // toolbars are also not + (m_nStyle & SAL_FRAME_STYLE_FLOAT) && // only a float can be floatgrab + !(m_nStyle & SAL_FRAME_STYLE_TOOLTIP) && // tool tips are not + !(m_nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) && // toolbars are also not + !(m_nStyle & SAL_FRAME_STYLE_FLOAT_FOCUSABLE); // focusable floats are not } bool isChild( bool bPlug = true, bool bSysChild = true ) diff --git a/vcl/unx/inc/plugins/kde/kdedata.hxx b/vcl/unx/inc/plugins/kde/kdedata.hxx index 831621e38cc1..04730b39fad2 100644 --- a/vcl/unx/inc/plugins/kde/kdedata.hxx +++ b/vcl/unx/inc/plugins/kde/kdedata.hxx @@ -75,7 +75,7 @@ public: virtual SalGraphics* GetGraphics(); virtual void ReleaseGraphics( SalGraphics *pGraphics ); - virtual void updateGraphics(); + virtual void updateGraphics( bool bClear ); virtual void UpdateSettings( AllSettings& rSettings ); virtual void Show( BOOL bVisible, BOOL bNoActivate ); }; diff --git a/vcl/unx/inc/salframe.h b/vcl/unx/inc/salframe.h index 848f2250d31c..8dad0350a937 100644 --- a/vcl/unx/inc/salframe.h +++ b/vcl/unx/inc/salframe.h @@ -212,7 +212,9 @@ public: virtual SalGraphics* GetGraphics(); virtual void ReleaseGraphics( SalGraphics* pGraphics ); - virtual void updateGraphics(); + // call with true to clear graphics (setting None as drawable) + // call with false to setup graphics with window (GetWindow()) + virtual void updateGraphics( bool bClear ); virtual BOOL PostEvent( void* pData ); diff --git a/vcl/unx/inc/salprn.h b/vcl/unx/inc/salprn.h index 452fa5a89387..59a5c3eef56a 100644 --- a/vcl/unx/inc/salprn.h +++ b/vcl/unx/inc/salprn.h @@ -63,7 +63,6 @@ public: virtual String GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin ); virtual void InitPaperFormats( const ImplJobSetup* pSetupData ); virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ); - virtual DuplexMode GetDuplexMode( const ImplJobSetup* pSetupData ); }; class PspSalPrinter : public SalPrinter @@ -80,6 +79,7 @@ public: psp::JobData m_aJobData; psp::PrinterGfx m_aPrinterGfx; ULONG m_nCopies; + bool m_bCollate; SalInfoPrinter* m_pInfoPrinter; PspSalPrinter( SalInfoPrinter* ); @@ -90,7 +90,9 @@ public: virtual BOOL StartJob( const XubString* pFileName, const XubString& rJobName, const XubString& rAppName, - ULONG nCopies, BOOL bCollate, + ULONG nCopies, + bool bCollate, + bool bDirect, ImplJobSetup* pSetupData ); virtual BOOL EndJob(); virtual BOOL AbortJob(); diff --git a/vcl/unx/inc/salunx.h b/vcl/unx/inc/salunx.h index cdf45fd30867..c1fee6c68d94 100644 --- a/vcl/unx/inc/salunx.h +++ b/vcl/unx/inc/salunx.h @@ -38,12 +38,6 @@ #include <time.h> #include <sys/time.h> #include <strings.h> -#elif defined IRIX -#ifdef __cplusplus -#include <ctime> -#endif -#include <sys/time.h> -#include <unistd.h> #endif #include <svunx.h> #include <salstd.hxx> diff --git a/vcl/unx/inc/sm.hxx b/vcl/unx/inc/sm.hxx index 17bb40e2106a..09d2f5557e1d 100644 --- a/vcl/unx/inc/sm.hxx +++ b/vcl/unx/inc/sm.hxx @@ -69,7 +69,7 @@ public: static bool checkDocumentsSaved(); static bool queryInteraction(); static void saveDone(); - static void interactionDone(); + static void interactionDone( bool bCancelShutdown ); static String getExecName(); static VCL_DLLPUBLIC const ByteString& getSessionID(); diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx index 1b5a2f86dcee..9da57b6e790d 100644 --- a/vcl/unx/kde/kdedata.cxx +++ b/vcl/unx/kde/kdedata.cxx @@ -29,7 +29,7 @@ #include "precompiled_vcl.hxx" #define _SV_SALDATA_CXX -#include "kde_headers.h" +#include <shell/kde_headers.h> #include <unistd.h> #include <fcntl.h> diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx index 8046d22d75d3..cd461fc36c8f 100644 --- a/vcl/unx/kde/salnativewidgets-kde.cxx +++ b/vcl/unx/kde/salnativewidgets-kde.cxx @@ -32,7 +32,7 @@ #include "precompiled_vcl.hxx" #define _SV_SALNATIVEWIDGETS_KDE_CXX -#include "kde_headers.h" +#include <shell/kde_headers.h> #include <salunx.h> #include <saldata.hxx> @@ -2073,12 +2073,13 @@ void KDESalFrame::ReleaseGraphics( SalGraphics *pGraphics ) } } -void KDESalFrame::updateGraphics() +void KDESalFrame::updateGraphics( bool bClear ) { + Drawable aDrawable = bClear ? None : GetWindow(); for( int i = 0; i < nMaxGraphics; i++ ) { if( m_aGraphics[i].bInUse ) - m_aGraphics[i].pGraphics->SetDrawable( GetWindow(), GetScreenNumber() ); + m_aGraphics[i].pGraphics->SetDrawable( aDrawable, GetScreenNumber() ); } } diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index 796350a63d50..6177c4b2896a 100644 --- a/vcl/unx/kde4/KDESalFrame.cxx +++ b/vcl/unx/kde4/KDESalFrame.cxx @@ -181,7 +181,6 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) StyleSettings style( rSettings.GetStyleSettings() ); BOOL bSetTitleFont = false; - // General settings QPalette pal = kapp->palette(); @@ -214,6 +213,14 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) pKey = "Theme"; if ( aGroup.hasKey( pKey ) ) style.SetPreferredSymbolsStyleName( readEntryUntranslated( &aGroup, pKey ) ); + + //toolbar + pKey = "toolbarFont"; + if ( aGroup.hasKey( pKey ) ) + { + Font aFont = toFont( aGroup.readEntry( pKey, QFont() ), rSettings.GetUILocale() ); + style.SetToolFont( aFont ); + } } Color aFore = toColor( pal.color( QPalette::Active, QPalette::WindowText ) ); @@ -288,7 +295,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) style.SetFloatTitleFont( aFont ); style.SetMenuFont( aFont ); // will be changed according to pMenuBar - style.SetToolFont( aFont ); // will be changed according to pToolBar + //style.SetToolFont( aFont ); //already set above style.SetLabelFont( aFont ); style.SetInfoFont( aFont ); style.SetRadioCheckFont( aFont ); @@ -300,11 +307,9 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) int flash_time = QApplication::cursorFlashTime(); style.SetCursorBlinkTime( flash_time != 0 ? flash_time/2 : STYLE_CURSOR_NOBLINKTIME ); - KMainWindow qMainWindow; - // Menu style.SetSkipDisabledInMenus( TRUE ); - KMenuBar *pMenuBar = qMainWindow.menuBar(); + KMenuBar* pMenuBar = new KMenuBar(); if ( pMenuBar ) { // Color @@ -337,22 +342,11 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings ) style.SetMenuFont( aFont ); } - // Tool bar - KToolBar *pToolBar = qMainWindow.toolBar(); - if ( pToolBar ) - { - aFont = toFont( pToolBar->font(), rSettings.GetUILocale() ); - style.SetToolFont( aFont ); - } + delete pMenuBar; // Scroll bar size style.SetScrollBarSize( kapp->style()->pixelMetric( QStyle::PM_ScrollBarExtent ) ); - // #i59364# high contrast mode - BOOL bHC = ( style.GetFaceColor().IsDark() || - style.GetWindowColor().IsDark() ); - style.SetHighContrastMode( bHC ); - rSettings.SetStyleSettings( style ); } @@ -369,12 +363,13 @@ void KDESalFrame::ReleaseGraphics( SalGraphics *pGraphics ) } } -void KDESalFrame::updateGraphics() +void KDESalFrame::updateGraphics( bool bClear ) { + Drawable aDrawable = bClear ? None : GetWindow(); for( int i = 0; i < nMaxGraphics; i++ ) { if( m_aGraphics[i].bInUse ) - m_aGraphics[i].pGraphics->SetDrawable( GetWindow(), GetScreenNumber() ); + m_aGraphics[i].pGraphics->SetDrawable( aDrawable, GetScreenNumber() ); } } diff --git a/vcl/unx/kde4/KDESalFrame.hxx b/vcl/unx/kde4/KDESalFrame.hxx index 11a22bd93ba5..de3a5af189ee 100644 --- a/vcl/unx/kde4/KDESalFrame.hxx +++ b/vcl/unx/kde4/KDESalFrame.hxx @@ -52,7 +52,7 @@ class KDESalFrame : public X11SalFrame virtual SalGraphics* GetGraphics(); virtual void ReleaseGraphics( SalGraphics *pGraphics ); - virtual void updateGraphics(); + virtual void updateGraphics( bool bClear ); virtual void UpdateSettings( AllSettings& rSettings ); virtual void Show( BOOL bVisible, BOOL bNoActivate ); };
\ No newline at end of file diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx index 2e8f0dcad96b..1c9882923b43 100644 --- a/vcl/unx/kde4/KDESalGraphics.cxx +++ b/vcl/unx/kde4/KDESalGraphics.cxx @@ -513,10 +513,12 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part, } else if (type == CTRL_FRAME) { + pixmap.fill(KApplication::palette().color(QPalette::Window)); lcl_drawFrame( widgetRect, painter, QStyle::PE_Frame, nControlState, value ); } else if (type == CTRL_FIXEDBORDER) { + pixmap.fill(KApplication::palette().color(QPalette::Window)); lcl_drawFrame( widgetRect, painter, QStyle::PE_FrameWindow, nControlState, value ); } else if (type == CTRL_WINDOW_BACKGROUND) diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx index 70b1796df7f0..dedda64d157e 100644 --- a/vcl/unx/kde4/KDEXLib.cxx +++ b/vcl/unx/kde4/KDEXLib.cxx @@ -77,24 +77,30 @@ void KDEXLib::Init() pInputMethod->SetLocale(); XrmInitialize(); - KAboutData *kAboutData = new KAboutData( "OpenOffice.org", - "OpenOffice.org", + KAboutData *kAboutData = new KAboutData("OpenOffice.org", + "kdelibs4", ki18n( "OpenOffice.org" ), "3.0.0", ki18n( "OpenOffice.org with KDE Native Widget Support." ), KAboutData::License_LGPL, - ki18n( "Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008 Novell, Inc"), + ki18n( "Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Novell, Inc"), ki18n( "OpenOffice.org is an office suite.\n" ), "http://kde.openoffice.org/index.html", "dev@kde.openoffice.org" ); + kAboutData->addAuthor( ki18n( "Jan Holesovsky" ), ki18n( "Original author and maintainer of the KDE NWF." ), "kendy@artax.karlin.mff.cuni.cz", "http://artax.karlin.mff.cuni.cz/~kendy" ); + kAboutData->addAuthor( ki18n("Roman Shtylman"), + ki18n( "Porting to KDE 4." ), + "shtylman@gmail.com", "http://shtylman.com" ); kAboutData->addAuthor( ki18n("Eric Bischoff"), ki18n( "Accessibility fixes, porting to KDE 4." ), "bischoff@kde.org" ); + //kAboutData->setProgramIconName("OpenOffice"); + m_nFakeCmdLineArgs = 1; USHORT nIdx; vos::OExtCommandLine aCommandLine; @@ -135,6 +141,7 @@ void KDEXLib::Init() m_pApplication = new VCLKDEApplication(); kapp->disableSessionManagement(); + KApplication::setQuitOnLastWindowClosed(false); Display* pDisp = QX11Info::display(); SalKDEDisplay *pSalDisplay = new SalKDEDisplay(pDisp); diff --git a/vcl/unx/source/app/i18n_ic.cxx b/vcl/unx/source/app/i18n_ic.cxx index cacffbcfdbb1..bb8f86d93e01 100644 --- a/vcl/unx/source/app/i18n_ic.cxx +++ b/vcl/unx/source/app/i18n_ic.cxx @@ -340,7 +340,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : if ( mnPreeditStyle != XIMPreeditNone ) { -#if defined LINUX || defined FREEBSD || defined NETBSD || defined IRIX +#if defined LINUX || defined FREEBSD || defined NETBSD if ( mpPreeditAttributes != NULL ) #endif mpAttributes = XVaAddToNestedList( mpAttributes, @@ -348,7 +348,7 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : } if ( mnStatusStyle != XIMStatusNone ) { -#if defined LINUX || defined FREEBSD || defined NETBSD || defined IRIX +#if defined LINUX || defined FREEBSD || defined NETBSD if ( mpStatusAttributes != NULL ) #endif mpAttributes = XVaAddToNestedList( mpAttributes, diff --git a/vcl/unx/source/app/i18n_im.cxx b/vcl/unx/source/app/i18n_im.cxx index ae472d6323f4..0a48c054167f 100644 --- a/vcl/unx/source/app/i18n_im.cxx +++ b/vcl/unx/source/app/i18n_im.cxx @@ -59,7 +59,7 @@ using namespace vcl; #include "i18n_cb.hxx" -#if defined(SOLARIS) || defined(LINUX) || defined(IRIX) +#if defined(SOLARIS) || defined(LINUX) extern "C" char * XSetIMValues(XIM im, ...); #endif diff --git a/vcl/unx/source/app/randrwrapper.cxx b/vcl/unx/source/app/randrwrapper.cxx index 8d01b64d4680..4fbe5db97ab9 100644 --- a/vcl/unx/source/app/randrwrapper.cxx +++ b/vcl/unx/source/app/randrwrapper.cxx @@ -161,7 +161,13 @@ RandRWrapper::RandRWrapper( Display* pDisplay ) : if( ! m_bValid ) { rtl::OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( "libXrandr.so.2" ) ); - m_pRandRLib = osl_loadModule( aLibName.pData, SAL_LOADMODULE_DEFAULT ); + // load and resolve dependencies immediately + // rationale: there are older distributions where libXrandr.so.2 is not linked + // with libXext.so, resulting in a missing symbol and terminating the office + // obviously they expected libXext to be linked in global symbolspace (that is + // linked by the application), which is not the case with us (because we want + // to be able to run in headless mode even without an installed X11 library) + m_pRandRLib = osl_loadModule( aLibName.pData, SAL_LOADMODULE_DEFAULT | SAL_LOADMODULE_NOW ); initFromModule(); } if( m_bValid ) diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx index 07955d426b8c..558ae3714358 100644 --- a/vcl/unx/source/app/saldisp.cxx +++ b/vcl/unx/source/app/saldisp.cxx @@ -38,16 +38,13 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#if defined(IRIX) -#include <ctime> -#endif #include <sys/time.h> #include <pthread.h> #include <unistd.h> #include <ctype.h> #include <string.h> -#if defined(SOLARIS) || defined(IRIX) +#if defined(SOLARIS) #include <sal/alloca.h> #include <osl/module.h> #endif @@ -898,7 +895,7 @@ void SalDisplay::Init() sscanf( pProperties, "%li", &nProperties_ ); else { -#if defined DBG_UTIL || defined SUN || defined LINUX || defined FREEBSD || defined IRIX +#if defined DBG_UTIL || defined SUN || defined LINUX || defined FREEBSD nProperties_ |= PROPERTY_FEATURE_Maximize; #endif // Server Bugs & Properties @@ -2307,11 +2304,7 @@ long SalX11Display::Dispatch( XEvent *pEvent ) return 0; SalInstance* pInstance = GetSalData()->m_pInstance; - if( pInstance->GetEventCallback() ) - { - YieldMutexReleaser aReleaser; - pInstance->CallEventCallback( pEvent, sizeof( XEvent ) ); - } + pInstance->CallEventCallback( pEvent, sizeof( XEvent ) ); switch( pEvent->type ) { diff --git a/vcl/unx/source/app/salinst.cxx b/vcl/unx/source/app/salinst.cxx index 1dc2d1404009..6b7753960290 100644 --- a/vcl/unx/source/app/salinst.cxx +++ b/vcl/unx/source/app/salinst.cxx @@ -50,7 +50,7 @@ #include "vcl/salwtype.hxx" #include "vcl/salatype.hxx" #include "vcl/helper.hxx" - +#include <tools/solarmutex.hxx> #include "vos/mutex.hxx" // ------------------------------------------------------------------------- @@ -63,6 +63,7 @@ SalYieldMutex::SalYieldMutex() { mnCount = 0; mnThreadId = 0; + ::tools::SolarMutex::SetSolarMutex( this ); } void SalYieldMutex::acquire() @@ -141,6 +142,7 @@ X11SalInstance::~X11SalInstance() delete pSalData; SetSalData( NULL ); + ::tools::SolarMutex::SetSolarMutex( 0 ); delete mpSalYieldMutex; } diff --git a/vcl/unx/source/app/saltimer.cxx b/vcl/unx/source/app/saltimer.cxx index bf8aa202b066..afcecc0d0667 100644 --- a/vcl/unx/source/app/saltimer.cxx +++ b/vcl/unx/source/app/saltimer.cxx @@ -32,9 +32,6 @@ #include "precompiled_vcl.hxx" #include <stdio.h> -#if defined(IRIX) -#include <ctime> -#endif #include <sys/time.h> #include <sys/times.h> #include <time.h> diff --git a/vcl/unx/source/app/sm.cxx b/vcl/unx/source/app/sm.cxx index ff981b04259b..c5605cec1dfb 100644 --- a/vcl/unx/source/app/sm.cxx +++ b/vcl/unx/source/app/sm.cxx @@ -114,7 +114,7 @@ void IceSalSession::queryInteraction() void IceSalSession::interactionDone() { - SessionManagerClient::interactionDone(); + SessionManagerClient::interactionDone( false ); } void IceSalSession::saveDone() @@ -129,6 +129,7 @@ void IceSalSession::saveDone() bool IceSalSession::cancelShutdown() { + SessionManagerClient::interactionDone( true ); return false; } @@ -368,6 +369,12 @@ void SessionManagerClient::SaveYourselfProc( IMPL_STATIC_LINK_NOINSTANCE( SessionManagerClient, ShutDownHdl, void*, EMPTYARG ) { + if( pOneInstance ) + { + SalSessionQuitEvent aEvent; + pOneInstance->CallCallback( &aEvent ); + } + const std::list< SalFrame* >& rFrames = GetX11SalData()->GetDisplay()->getFrames(); SMprintf( rFrames.begin() != rFrames.end() ? "shutdown on first frame\n" : "shutdown event but no frame\n" ); if( rFrames.begin() != rFrames.end() ) @@ -526,12 +533,12 @@ bool SessionManagerClient::queryInteraction() return bRet; } -void SessionManagerClient::interactionDone() +void SessionManagerClient::interactionDone( bool bCancelShutdown ) { if( aSmcConnection ) { ICEConnectionObserver::lock(); - SmcInteractDone( aSmcConnection, False ); + SmcInteractDone( aSmcConnection, bCancelShutdown ? True : False ); ICEConnectionObserver::unlock(); } } diff --git a/vcl/unx/source/dtrans/X11_selection.cxx b/vcl/unx/source/dtrans/X11_selection.cxx index 3f7dfc2df709..c6036ae4f78e 100644 --- a/vcl/unx/source/dtrans/X11_selection.cxx +++ b/vcl/unx/source/dtrans/X11_selection.cxx @@ -219,28 +219,64 @@ SelectionManager::SelectionManager() : m_aWindow( None ), m_nSelectionTimeout( 0 ), m_nSelectionTimestamp( CurrentTime ), + m_bDropEnterSent( true ), m_aCurrentDropWindow( None ), + m_nDropTime( None ), + m_nLastDropAction( 0 ), + m_nLastX( 0 ), + m_nLastY( 0 ), + m_nDropTimestamp( 0 ), m_bDropWaitingForCompletion( false ), m_aDropWindow( None ), m_aDropProxy( None ), m_aDragSourceWindow( None ), + m_nLastDragX( 0 ), + m_nLastDragY( 0 ), m_nNoPosX( 0 ), m_nNoPosY( 0 ), m_nNoPosWidth( 0 ), m_nNoPosHeight( 0 ), + m_nDragButton( 0 ), + m_nUserDragAction( 0 ), + m_nTargetAcceptAction( 0 ), + m_nSourceActions( 0 ), m_bLastDropAccepted( false ), m_bDropSuccess( false ), m_bDropSent( false ), m_bWaitingForPrimaryConversion( false ), + m_nDragTimestamp( None ), m_aMoveCursor( None ), m_aCopyCursor( None ), m_aLinkCursor( None ), m_aNoneCursor( None ), m_aCurrentCursor( None ), - m_nCurrentProtocolVersion( nXdndProtocolRevision ) + m_nCurrentProtocolVersion( nXdndProtocolRevision ), + m_nCLIPBOARDAtom( None ), + m_nTARGETSAtom( None ), + m_nTIMESTAMPAtom( None ), + m_nTEXTAtom( None ), + m_nINCRAtom( None ), + m_nCOMPOUNDAtom( None ), + m_nMULTIPLEAtom( None ), + m_nUTF16Atom( None ), + m_nImageBmpAtom( None ), + m_nXdndAware( None ), + m_nXdndEnter( None ), + m_nXdndLeave( None ), + m_nXdndPosition( None ), + m_nXdndStatus( None ), + m_nXdndDrop( None ), + m_nXdndFinished( None ), + m_nXdndSelection( None ), + m_nXdndTypeList( None ), + m_nXdndProxy( None ), + m_nXdndActionCopy( None ), + m_nXdndActionMove( None ), + m_nXdndActionLink( None ), + m_nXdndActionAsk( None ), + m_nXdndActionPrivate( None ) { m_aDropEnterEvent.data.l[0] = None; - m_bDropEnterSent = true; m_aDragRunning.reset(); } diff --git a/vcl/unx/source/gdi/pspgraphics.cxx b/vcl/unx/source/gdi/pspgraphics.cxx index 009b14c56062..227d6cd7e9b2 100644 --- a/vcl/unx/source/gdi/pspgraphics.cxx +++ b/vcl/unx/source/gdi/pspgraphics.cxx @@ -1094,13 +1094,6 @@ const void* PspGraphics::DoGetEmbedFontData( fontID aFont, const sal_Ucs* pUnico return NULL; // fill in font info - switch( aFontInfo.m_eType ) - { - case psp::fonttype::TrueType: rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF; break; - case psp::fonttype::Type1: rInfo.m_nFontType = FontSubsetInfo::ANY_TYPE1; break; - default: - return NULL; - } rInfo.m_nAscent = aFontInfo.m_nAscend; rInfo.m_nDescent = aFontInfo.m_nDescend; rInfo.m_aPSName = rMgr.getPSName( aFont ); @@ -1137,9 +1130,22 @@ const void* PspGraphics::DoGetEmbedFontData( fontID aFont, const sal_Ucs* pUnico rInfo.m_nCapHeight = yMax; // Well ... for( int i = 0; i < 256; i++ ) - pWidths[i] = (aMetrics[i].width > 0 ? aMetrics[i].width : 0); + switch( aFontInfo.m_eType ) + { + case psp::fonttype::TrueType: + rInfo.m_nFontType = FontSubsetInfo::SFNT_TTF; + break; + case psp::fonttype::Type1: { + const bool bPFA = ((*(unsigned char*)pFile) < 0x80); + rInfo.m_nFontType = bPFA ? FontSubsetInfo::TYPE1_PFA : FontSubsetInfo::TYPE1_PFB; + } + break; + default: + return NULL; + } + return pFile; } diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index 34f2dfd4b935..5fe2295a8fed 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -50,6 +50,7 @@ #include "basegfx/polygon/b2dpolygonclipper.hxx" #include "basegfx/polygon/b2dlinegeometry.hxx" #include "basegfx/matrix/b2dhommatrix.hxx" +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "basegfx/polygon/b2dpolypolygoncutter.hxx" #include <vector> @@ -1028,11 +1029,12 @@ BOOL X11SalGraphics::drawEPS( long,long,long,long,void*,ULONG ) XID X11SalGraphics::GetXRenderPicture() { + XRenderPeer& rRenderPeer = XRenderPeer::GetInstance(); + if( !m_aRenderPicture ) { // check xrender support for matching visual // find a XRenderPictFormat compatible with the Drawable - XRenderPeer& rRenderPeer = XRenderPeer::GetInstance(); XRenderPictFormat* pVisualFormat = static_cast<XRenderPictFormat*>(GetXRenderFormat()); if( !pVisualFormat ) { @@ -1053,7 +1055,15 @@ XID X11SalGraphics::GetXRenderPicture() // TODO: avoid clipping if already set correctly if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) ) rRenderPeer.SetPictureClipRegion( aDstPic, pClipRegion_ ); + else #endif + { + // reset clip region + // TODO: avoid clip reset if already done + XRenderPictureAttributes aAttr; + aAttr.clip_mask = None; + rRenderPeer.ChangePicture( m_aRenderPicture, CPClipMask, &aAttr ); + } return m_aRenderPicture; } @@ -1096,6 +1106,7 @@ bool IsLeftOf( const XLineFixed& rA, const XLineFixed& rB ) const XFixed aXDiff = rU.p2.x - rU.p1.x; const XFixed aYDiff = rU.p2.y - rU.p1.y; + // compare upper point of lower segment with line through upper segment if( (rU.p1.y != rL.p1.y) || (rU.p1.x != rL.p1.x) ) { const sal_Int64 n1 = (sal_Int64)aXDiff * (rL.p1.y - rU.p1.y); @@ -1104,6 +1115,7 @@ bool IsLeftOf( const XLineFixed& rA, const XLineFixed& rB ) return ((n1 < n2) == bAbove); } + // compare lower point of lower segment with line through upper segment if( (rU.p2.y != rL.p2.y) || (rU.p2.x != rL.p2.x) ) { const sal_Int64 n3 = (sal_Int64)aXDiff * (rL.p2.y - rU.p1.y); @@ -1122,10 +1134,14 @@ struct HalfTrapezoid // maLine.p1.y <= mnY < maLine.p2.y XLineFixed maLine; XFixed mnY; + + XFixed getXMin() const { return std::min( maLine.p1.x, maLine.p2.x); } + XFixed getXMax() const { return std::max( maLine.p1.x, maLine.p2.x); } }; -struct HalfTrapCompare +class HalfTrapCompare { +public: bool operator()( const HalfTrapezoid& rA, const HalfTrapezoid& rB ) const { bool bIsTopLeft = false; @@ -1138,14 +1154,15 @@ struct HalfTrapCompare } }; -typedef std::priority_queue< HalfTrapezoid, std::vector<HalfTrapezoid>, HalfTrapCompare > HTQueueBase; +typedef std::vector< HalfTrapezoid > HTVector; +typedef std::priority_queue< HalfTrapezoid, HTVector, HalfTrapCompare > HTQueueBase; // we need a priority queue with a reserve() to prevent countless reallocations class HTQueue : public HTQueueBase { public: void reserve( size_t n ) { c.reserve( n ); } - int capacity() { return c.capacity(); } + void swapvec( HTVector& v ) { c.swap( v ); } }; typedef std::vector<XTrapezoid> TrapezoidVector; @@ -1173,6 +1190,10 @@ public: }; typedef std::multiset< int, TrapezoidYCompare > VerticalTrapSet; + +#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND +void splitIntersectingSegments( HTVector&); +#endif // DISABLE_SOLVECROSSOVER_WORKAROUND } // end of anonymous namespace // draw a poly-polygon @@ -1210,7 +1231,7 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly // don't bother with polygons outside of visible area const basegfx::B2DRange aViewRange( 0, 0, GetGraphicsWidth(), GetGraphicsHeight() ); const basegfx::B2DRange aPolyRange = basegfx::tools::getRange( rOrigPolyPoly ); - const bool bNeedViewClip = !aPolyRange.isInside( aViewRange ); + const bool bNeedViewClip = aPolyRange.isInside( aViewRange ); if( !aPolyRange.overlaps( aViewRange ) ) return true; @@ -1237,6 +1258,15 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly if( !nClippedPolyCount ) continue; +#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND + for( int nClippedPolyIdx = 0; nClippedPolyIdx < nClippedPolyCount; ++nClippedPolyIdx ) + { + const ::basegfx::B2DPolygon aSolvedPolygon = aClippedPolygon.getB2DPolygon( nClippedPolyIdx ); + const int nPointCount = aSolvedPolygon.count(); + aGoodPolyPoly.append( aSolvedPolygon ); + nHTQueueReserve += aSolvedPolygon.areControlPointsUsed() ? 8 * nPointCount : nPointCount; + } +#else // DISABLE_SOLVECROSSOVER_WORKAROUND // #i103259# polypoly.solveCrossover() fails to remove self-intersections // but polygon.solveCrossover() works. Use it to build the intersection-free polypolygon // TODO: if the self-intersection prevention is too expensive make the trap-algorithm tolerate intersections @@ -1255,11 +1285,12 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly nHTQueueReserve += aSolvedPolygon.areControlPointsUsed() ? 8 * nPointCount : nPointCount; } } +#endif // DISABLE_SOLVECROSSOVER_WORKAROUND } // #i100922# try to prevent priority-queue reallocations by reservering enough nHTQueueReserve = ((4*nHTQueueReserve) | 0x1FFF) + 1; - HTQueue aHTQueue; - aHTQueue.reserve( nHTQueueReserve ); + HTVector aHTVector; + aHTVector.reserve( nHTQueueReserve ); // first convert the B2DPolyPolygon to HalfTrapezoids const int nGoodPolyCount = aGoodPolyPoly.count(); @@ -1299,9 +1330,6 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly // check if enough data is available for a new HalfTrapezoid if( nPointIdx == 0 ) continue; - // ignore vertical segments - if( aNewXPF.y == aOldXPF.y ) - continue; // construct HalfTrapezoid as topdown segment HalfTrapezoid aHT; @@ -1326,14 +1354,33 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly #endif // queue up the HalfTrapezoid - aHTQueue.push( aHT ); + aHTVector.push_back( aHT ); } } } - if( aHTQueue.empty() ) + if( aHTVector.empty() ) return TRUE; +#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND + // find intersecting halftraps and split them up + // TODO: remove when solveCrossOvers gets fast enough so its use can be enabled above + // FAQ: why should segment intersection be handled before adaptiveSubdivide()? + // Answer: because it is conceptually much faster + // Example: consider two intersecting circles with a diameter of 1000 pixels + // before subdivision: eight bezier segments + // after subdivision: more than a thousand line segments + // since even the best generic intersection finders have a complexity of O((n+k)*log(n+k)) + // it shows that testing while the segment count is still low is a much better approach. + splitIntersectingSegments( aHTVector); +#endif // DISABLE_SOLVECROSSOVER_WORKAROUND + + // build queue from vector of intersection-free segments + // TODO: is replacing the priority-queue by a sorted vector worth it? + std::make_heap( aHTVector.begin(), aHTVector.end(), HalfTrapCompare()); + HTQueue aHTQueue; + aHTQueue.swapvec( aHTVector); + // then convert the HalfTrapezoids into full Trapezoids TrapezoidVector aTrapVector; aTrapVector.reserve( aHTQueue.size() * 2 ); // just a guess @@ -1349,24 +1396,28 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly XTrapezoid aTrapezoid; // convert a HalfTrapezoid pair + // get the left side of the trapezoid const HalfTrapezoid& rLeft = aHTQueue.top(); aTrapezoid.top = rLeft.mnY; - aTrapezoid.bottom = rLeft.maLine.p2.y; aTrapezoid.left = rLeft.maLine; + aHTQueue.pop(); -#if 0 - // ignore empty trapezoids - if( aTrapezoid.bottom <= aTrapezoid.top ) + // ignore left segment that would result in an empty trapezoid + if( aTrapezoid.left.p2.y <= aTrapezoid.top ) continue; -#endif - aHTQueue.pop(); - if( aHTQueue.empty() ) // TODO: assert - break; - const HalfTrapezoid& rRight = aHTQueue.top(); - aTrapezoid.right = rRight.maLine; - aHTQueue.pop(); + // get the right side of the trapezoid + aTrapezoid.right.p2.y = aTrapezoid.bottom; + while( !aHTQueue.empty() ) { + const HalfTrapezoid& rRight = aHTQueue.top(); + aTrapezoid.right = rRight.maLine; + aHTQueue.pop(); + // ignore right segment that would result in an empty trapezoid + if( aTrapezoid.right.p2.y > aTrapezoid.top ) + break; + } + // the topmost endpoint determines the trapezoid bottom aTrapezoid.bottom = aTrapezoid.left.p2.y; if( aTrapezoid.bottom > aTrapezoid.right.p2.y ) aTrapezoid.bottom = aTrapezoid.right.p2.y; @@ -1374,44 +1425,49 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly // keep the full Trapezoid candidate aTrapVector.push_back( aTrapezoid ); - // unless it splits an older trapezoid + // unless it splits another trapezoid that is still active bool bSplit = false; - for(;;) + ActiveTrapSet::iterator aActiveTrapsIt = aActiveTraps.begin(); + for(; aActiveTrapsIt != aActiveTraps.end(); ++aActiveTrapsIt ) { - // check if the new trapezoid overlaps with an old trapezoid - ActiveTrapSet::iterator aActiveTrapsIt - = aActiveTraps.upper_bound( aTrapVector.size()-1 ); - if( aActiveTrapsIt == aActiveTraps.begin() ) - break; - --aActiveTrapsIt; - XTrapezoid& rLeftTrap = aTrapVector[ *aActiveTrapsIt ]; + // skip until first overlap candidate + // TODO: use stl::*er_bound() instead + if( IsLeftOf( aTrapezoid.left, rLeftTrap.left) ) + continue; + // in the ActiveTrapSet there are still trapezoids where // a vertical overlap with new trapezoids is no longer possible // they could have been removed in the verticaltraps loop below - // but this would have been expensive and is not needed as we can - // simply ignore them now and remove them from the ActiveTrapSet - // so they won't bother us in the future + // but this would be expensive and is not needed as we can + // simply ignore them until we stumble upon them here. if( rLeftTrap.bottom <= aTrapezoid.top ) { - aActiveTraps.erase( aActiveTrapsIt ); + ActiveTrapSet::iterator it = aActiveTrapsIt; + if( aActiveTrapsIt != aActiveTraps.begin() ) + --aActiveTrapsIt; + aActiveTraps.erase( it ); continue; } // check if there is horizontal overlap // aTrapezoid.left==rLeftTrap.right is allowed though if( !IsLeftOf( aTrapezoid.left, rLeftTrap.right ) ) - break; + continue; - // split the old trapezoid and keep its upper part + // prepare to split the old trapezoid and keep its upper part // find the old trapezoids entry in the VerticalTrapSet and remove it typedef std::pair<VerticalTrapSet::iterator, VerticalTrapSet::iterator> VTSPair; VTSPair aVTSPair = aVerticalTraps.equal_range( *aActiveTrapsIt ); VerticalTrapSet::iterator aVTSit = aVTSPair.first; - for(; (aVTSit != aVTSPair.second) && (*aVTSit != *aActiveTrapsIt); ++aVTSit ) ; - if( aVTSit != aVTSPair.second ) + for(; aVTSit != aVTSPair.second; ++aVTSit ) + { + if( *aVTSit != *aActiveTrapsIt ) + continue; aVerticalTraps.erase( aVTSit ); + break; + } // then update the old trapezoid's bottom rLeftTrap.bottom = aTrapezoid.top; // enter the updated old trapzoid in VerticalTrapSet @@ -1444,24 +1500,26 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rOrigPoly // mark trapezoids that can no longer be split as inactive // and recycle their sides which were not fully resolved static const XFixed nMaxTop = +0x7FFFFFFF; - XFixed nNewTop = aHTQueue.empty() ? nMaxTop : aHTQueue.top().mnY; + const XFixed nNewTop = aHTQueue.empty() ? nMaxTop : aHTQueue.top().mnY; while( !aVerticalTraps.empty() ) { + // check the next trapezoid to be retired const XTrapezoid& rOldTrap = aTrapVector[ *aVerticalTraps.begin() ]; if( nNewTop < rOldTrap.bottom ) break; - // the reference Trapezoid can no longer be split + // this trapezoid can no longer be split aVerticalTraps.erase( aVerticalTraps.begin() ); // recycle its sides that were not fully resolved HalfTrapezoid aHT; aHT.mnY = rOldTrap.bottom; - if( rOldTrap.left.p2.y > rOldTrap.bottom ) + + if( rOldTrap.left.p2.y > aHT.mnY ) { aHT.maLine = rOldTrap.left; aHTQueue.push( aHT ); } - if( rOldTrap.right.p2.y > rOldTrap.bottom ) + if( rOldTrap.right.p2.y > aHT.mnY ) { aHT.maLine = rOldTrap.right; aHTQueue.push( aHT ); @@ -1510,6 +1568,9 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : // the used basegfx::tools::createAreaGeometry is simply too // expensive with very big polygons; fallback to caller (who // should use ImplLineConverter normally) + // AW: ImplLineConverter had to be removed since it does not even + // know LineJoins, so the fallback will now prepare the line geometry + // the same way. return false; } const XRenderPeer& rRenderPeer = XRenderPeer::GetInstance(); @@ -1522,26 +1583,29 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : && !basegfx::fTools::equalZero( rLineWidth.getY() ) ) { // prepare for createAreaGeometry() with anisotropic linewidth - basegfx::B2DHomMatrix aAnisoMatrix; - aAnisoMatrix.scale( 1.0, rLineWidth.getX() / rLineWidth.getY() ); - aPolygon.transform( aAnisoMatrix ); + aPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(1.0, rLineWidth.getX() / rLineWidth.getY())); + } + + // special handling for hairlines to improve the drawing performance + // TODO: revisit after basegfx performance related changes + const bool bIsHairline = (rLineWidth.getX() < 1.2) && (rLineWidth.getY() < 1.2); + if( bIsHairline ) + { + // for hairlines the linejoin style becomes irrelevant + eLineJoin = basegfx::B2DLINEJOIN_NONE; + // createAreaGeometry is still too expensive when beziers are involved + if( aPolygon.areControlPointsUsed() ) + aPolygon = ::basegfx::tools::adaptiveSubdivideByDistance( aPolygon, 0.125 ); } - // AW: reSegment no longer needed; new createAreaGeometry will remove exteme positions - // and create bezier polygons - //if( aPolygon.areControlPointsUsed() ) - // aPolygon = basegfx::tools::reSegmentPolygonEdges( aPolygon, 8, true, false ); - //const basegfx::B2DPolyPolygon aAreaPolyPoly = basegfx::tools::createAreaGeometryForSimplePolygon( - // aPolygon, 0.5*rLineWidth.getX(), eLineJoin ); - const basegfx::B2DPolyPolygon aAreaPolyPoly(basegfx::tools::createAreaGeometry(aPolygon, 0.5*rLineWidth.getX(), eLineJoin)); + // create the area-polygon for the line + const basegfx::B2DPolyPolygon aAreaPolyPoly( basegfx::tools::createAreaGeometry(aPolygon, 0.5*rLineWidth.getX(), eLineJoin) ); if( (rLineWidth.getX() != rLineWidth.getY()) && !basegfx::fTools::equalZero( rLineWidth.getX() ) ) { // postprocess createAreaGeometry() for anisotropic linewidth - basegfx::B2DHomMatrix aAnisoMatrix; - aAnisoMatrix.scale( 1.0, rLineWidth.getY() / rLineWidth.getX() ); - aPolygon.transform( aAnisoMatrix ); + aPolygon.transform(basegfx::tools::createScaleB2DHomMatrix(1.0, rLineWidth.getY() / rLineWidth.getX())); } // temporarily adjust brush color to pen color @@ -1568,3 +1632,259 @@ bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const : // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +#ifndef DISABLE_SOLVECROSSOVER_WORKAROUND +// TODO: move the intersection solver into basegfx +// and then support bezier-intersection finding too + +namespace { // anonymous namespace to prevent export + +typedef HalfTrapezoid LineSeg; +typedef HTVector LSVector; + +inline bool operator==( const LineSeg& r1, const LineSeg& r2) +{ + if( r1.maLine.p2.y != r2.maLine.p2.y) return false; + if( r1.maLine.p2.x != r2.maLine.p2.x) return false; + if( r1.maLine.p1.y != r2.maLine.p1.y) return false; + if( r1.maLine.p1.x != r2.maLine.p1.x) return false; + return true; +} + +struct LSYMinCmp +{ + bool operator()( const LineSeg& r1, const LineSeg& r2) const + { return r2.maLine.p1.y < r1.maLine.p1.y; } +}; + +struct LSYMaxCmp +{ + bool operator()( const LineSeg& r1, const LineSeg& r2) const + { return r2.maLine.p2.y < r1.maLine.p2.y; } +}; + +struct LSXMinCmp +{ + bool operator()( const LineSeg& r1, const LineSeg& r2) const + { return( r1.getXMin() < r2.getXMin()); } +}; + +struct CutPoint +{ + XFixed mnSegmentId; + float mfCutParam; + XPointFixed maPoint; +}; + +struct CutPointCmp +{ + bool operator()( const CutPoint& r1, const CutPoint& r2) const + { + if( r1.mnSegmentId != r2.mnSegmentId) + return (r1.mnSegmentId < r2.mnSegmentId); + return (r1.mfCutParam < r2.mfCutParam); + } +}; + +bool findIntersection( const LineSeg& rLS1, const LineSeg& rLS2, CutPoint aCutPoints[2]) +{ + // segments intersect at r1.p1 + s*(r1.p2-r1.p1) == r2.p1 + t*(r2.p2-r2.p1) + // when both segment-parameters are ((0 <s<1) && (0<t<1)) + // (r1.p1 - r2.p1) == s * (r1.p1 - r1.p2) + t * (r2.p2 - r2.p1) + // => + // (r1.p1x - r2.p1x) == s * (r1.p1x - r1.p2x) + t * (r2.p2x - r2.p1x) + // (r1.p1y - r2.p1y) == s * (r1.p1y - r1.p2y) + t * (r2.p2y - r2.p1y) + // check if lines are identical or parallel => not intersecting + const XLineFixed& r1 = rLS1.maLine; + const XLineFixed& r2 = rLS2.maLine; + const double fDet = (double)(r1.p1.x - r1.p2.x) * (r2.p2.y - r2.p1.y) + - (double)(r2.p2.x - r2.p1.x) * (r1.p1.y - r1.p2.y); + static const double fEps = 1e-8; + if( fabs(fDet) < fEps) + return false; + // check if intersecting with first segment + const double fS1 = (double)(r2.p2.y - r2.p1.y) * (r1.p1.x - r2.p1.x); + const double fS2 = (double)(r2.p2.x - r2.p1.x) * (r2.p1.y - r1.p1.y); + const double fS = (fS1 + fS2) / fDet; + if( (fS <= +fEps) || (fS >= 1-fEps)) + return false; + // check if intersecting with second segment + const double fT1 = (double)(r1.p2.y - r1.p1.y) * (r1.p1.x - r2.p1.x); + const double fT2 = (double)(r1.p2.x - r1.p1.x) * (r2.p1.y - r1.p1.y); + const double fT = (fT1 + fT2) / fDet; + if( (fT <= +fEps) || (fT >= 1-fEps)) + return false; + // force the intersection point to be exactly identical on both segments + aCutPoints[0].maPoint.x = (XFixed)(r1.p1.x + fS * (r1.p2.x - r1.p1.x)); + aCutPoints[0].maPoint.y = (XFixed)(r1.p1.y + fS * (r1.p2.y - r1.p1.y)); + aCutPoints[1].maPoint.x = aCutPoints[0].maPoint.x; + aCutPoints[1].maPoint.y = aCutPoints[0].maPoint.y; + aCutPoints[0].mnSegmentId = rLS1.mnY; + aCutPoints[0].mfCutParam = (float)fS; + aCutPoints[1].mnSegmentId = rLS2.mnY; + aCutPoints[1].mfCutParam = (float)fT; + return true; +} + +typedef std::priority_queue< LineSeg, LSVector, LSYMinCmp> LSYMinQueueBase; +typedef std::priority_queue< LineSeg, LSVector, LSYMaxCmp> LSYMaxQueueBase; +typedef std::multiset< LineSeg, LSXMinCmp> LSXMinSet; +typedef std::set< CutPoint, CutPointCmp> CutPointSet; + +class LSYMinQueue : public LSYMinQueueBase +{ +public: + void reserve( size_t n) { c.reserve(n);} + void swapvec( LSVector& v) { c.swap(v);} +}; + +class LSYMaxQueue : public LSYMaxQueueBase +{ +public: + void reserve( size_t n) { c.reserve(n);} +}; + +void addAndCutSegment( LSVector& rLSVector, const LineSeg& rLS, CutPointSet& rCutPointSet) +{ + // short circuit when no segment was cut + if( rCutPointSet.empty()) { + rLSVector.push_back( rLS); + return; + } + + // find the first cut point for this segment + LineSeg aCS = rLS; + CutPoint aMinCutPoint; + aMinCutPoint.mnSegmentId = rLS.mnY; + aMinCutPoint.mfCutParam = 0.0; + CutPointSet::iterator itFirst = rCutPointSet.lower_bound( aMinCutPoint); + CutPointSet::iterator it = itFirst; + // iterate through all cut points of this segment + for(; it != rCutPointSet.end(); ++it) { + const CutPoint rCutPoint = (*it); + if( rCutPoint.mnSegmentId != rLS.mnY) + break; + // cut segment at the cutpoint + aCS.maLine.p2 = rCutPoint.maPoint; + rLSVector.push_back( aCS); + // prepare for next segment cut + aCS.maLine.p1 = aCS.maLine.p2; + } + // remove cutparams that will no longer be needed + // TODO: is it worth it or should we just keep the cutparams? + rCutPointSet.erase( itFirst, it); + + // add segment part remaining after last cut + aCS.maLine.p2 = rLS.maLine.p2; + rLSVector.push_back( aCS); +} + +void splitIntersectingSegments( LSVector& rLSVector) +{ + // get a unique id for each lineseg, temporarily abuse the mnY member + LSVector::iterator aLSit = rLSVector.begin(); + for( int i = 0; aLSit != rLSVector.end(); ++aLSit) { + LineSeg& rLS = *aLSit; + rLS.mnY = i++; + } + // get an y-sorted queue from the input vector + LSYMinQueue aYMinQueue; + std::make_heap( rLSVector.begin(), rLSVector.end(), LSYMinCmp()); + aYMinQueue.swapvec( rLSVector); + + // prepare the result vector + // try to avoid reallocations by guessing a reasonable result size + rLSVector.reserve( aYMinQueue.size() * 3/2 ); + + // find all intersections + CutPointSet aCutPointSet; + LSXMinSet aXMinSet; + LSYMaxQueue aYMaxQueue; + aYMaxQueue.reserve( aYMinQueue.size()); + // sweep-down and check all segment-pairs that overlap + while( !aYMinQueue.empty()) { + // get next input-segment + const LineSeg& rLS = aYMinQueue.top(); + // retire obsoleted segments + const XFixed fYCur = rLS.maLine.p1.y; + while( !aYMaxQueue.empty()) { + // check next segment to be retired + const LineSeg& rOS = aYMaxQueue.top(); + if( fYCur < rOS.maLine.p2.y) + break; + // emit resolved segment into result + addAndCutSegment( rLSVector, rOS, aCutPointSet); + // find segment to be retired in xmin-compare-set + LSXMinSet::iterator itR = aXMinSet.lower_bound( rOS); + while( !(*itR == rOS)) ++itR; + // retire segment from xmin-compare-set + aXMinSet.erase( itR); + // this segment is pining for the fjords + aYMaxQueue.pop(); + } + + // iterate over all segments that might overlap + // skip over the leftmost segments that cannot overlap + const XFixed fXMax = rLS.getXMax(); + LSXMinSet::const_iterator itC = aXMinSet.begin(); + for(; itC != aXMinSet.end(); ++itC) + if( (*itC).getXMin() <= fXMax) + break; + // TODO: if the linear search becomes too expensive + // then use an XMaxQueue based approach to replace it + const XFixed fXMin = rLS.getXMin(); + for(; itC != aXMinSet.end(); ++itC) { + const LineSeg& rOS = *itC; + if( fXMin >= rOS.getXMax()) + continue; + if( fXMax < rOS.getXMin()) + break; + CutPoint aCutPoints[2]; + if( !findIntersection( rLS, rOS, aCutPoints)) + continue; + // remember cut parameters + // TODO: std::set seems to use individual allocations + // which results in perf-problems for many entries + // => pre-allocate nodes by using a non-default allocator + aCutPointSet.insert( aCutPoints[0]); + aCutPointSet.insert( aCutPoints[1]); + } + // add segment to xmin-compare-set + // TODO: do we have a good insertion hint? + aXMinSet.insert( /*itC,*/ rLS); + // register segment for retirement + aYMaxQueue.push( rLS); + aYMinQueue.pop(); + } + + // retire the remaining segments + aXMinSet.clear(); + while( !aYMaxQueue.empty()) { + // emit segments and cut them up if needed + const LineSeg& rLS = aYMaxQueue.top(); + addAndCutSegment( rLSVector, rLS, aCutPointSet); + aYMaxQueue.pop(); + } + + // get the segments ready to be consumed by the drawPolygon() caller + aLSit = rLSVector.begin(); + LSVector::iterator aLSit2 = aLSit; + for(; aLSit != rLSVector.end(); ++aLSit) { + LineSeg& rLS = *aLSit; + // restore the segment top member + rLS.mnY = rLS.maLine.p1.y; + // remove horizontal segments for now + // TODO: until the trapezoid converter is adjusted to handle them + if( rLS.maLine.p1.y == rLS.maLine.p2.y ) + continue; + *(aLSit2++) = rLS; + } + if(aLSit2 != aLSit) + rLSVector.resize( aLSit2 - rLSVector.begin() ); +} + +} // end anonymous namespace + +#endif // DISABLE_SOLVECROSSOVER_WORKAROUND + +// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + diff --git a/vcl/unx/source/gdi/salprnpsp.cxx b/vcl/unx/source/gdi/salprnpsp.cxx index 2cf4e3baedd3..d47e30a89633 100644 --- a/vcl/unx/source/gdi/salprnpsp.cxx +++ b/vcl/unx/source/gdi/salprnpsp.cxx @@ -177,6 +177,32 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData ) pJobSetup->mnPaperBin = 0; } + // copy duplex + pKey = NULL; + pValue = NULL; + + pJobSetup->meDuplexMode = DUPLEX_UNKNOWN; + if( rData.m_pParser ) + pKey = rData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) ); + if( pKey ) + pValue = rData.m_aContext.getValue( pKey ); + if( pKey && pValue ) + { + if( pValue->m_aOption.EqualsIgnoreCaseAscii( "None" ) || + pValue->m_aOption.EqualsIgnoreCaseAscii( "Simplex", 0, 7 ) + ) + { + pJobSetup->meDuplexMode = DUPLEX_OFF; + } + else if( pValue->m_aOption.EqualsIgnoreCaseAscii( "DuplexNoTumble" ) ) + { + pJobSetup->meDuplexMode = DUPLEX_LONGEDGE; + } + else if( pValue->m_aOption.EqualsIgnoreCaseAscii( "DuplexTumble" ) ) + { + pJobSetup->meDuplexMode = DUPLEX_SHORTEDGE; + } + } // copy the whole context if( pJobSetup->mpDriverData ) @@ -525,34 +551,6 @@ void PspSalInfoPrinter::InitPaperFormats( const ImplJobSetup* ) // ----------------------------------------------------------------------- -DuplexMode PspSalInfoPrinter::GetDuplexMode( const ImplJobSetup* pJobSetup ) -{ - DuplexMode aRet = DUPLEX_UNKNOWN; - PrinterInfo aInfo( PrinterInfoManager::get().getPrinterInfo( pJobSetup->maPrinterName ) ); - if ( pJobSetup->mpDriverData ) - JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aInfo ); - if( aInfo.m_pParser ) - { - const PPDKey * pKey = aInfo.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) ); - if( pKey ) - { - const PPDValue* pVal = aInfo.m_aContext.getValue( pKey ); - if( pVal && ( - pVal->m_aOption.EqualsIgnoreCaseAscii( "None" ) || - pVal->m_aOption.EqualsIgnoreCaseAscii( "Simplex", 0, 7 ) - ) ) - { - aRet = DUPLEX_OFF; - } - else - aRet = DUPLEX_ON; - } - } - return aRet; -} - -// ----------------------------------------------------------------------- - int PspSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* ) { return 900; @@ -727,6 +725,37 @@ BOOL PspSalInfoPrinter::SetData( if( nSetDataFlags & SAL_JOBSET_ORIENTATION ) aData.m_eOrientation = pJobSetup->meOrientation == ORIENTATION_LANDSCAPE ? orientation::Landscape : orientation::Portrait; + // merge duplex if necessary + if( nSetDataFlags & SAL_JOBSET_DUPLEXMODE ) + { + pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Duplex" ) ) ); + if( pKey ) + { + pValue = NULL; + switch( pJobSetup->meDuplexMode ) + { + case DUPLEX_OFF: + pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) ); + if( pValue == NULL ) + pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "SimplexNoTumble" ) ) ); + break; + case DUPLEX_SHORTEDGE: + pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "DuplexTumble" ) ) ); + break; + case DUPLEX_LONGEDGE: + pValue = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "DuplexNoTumble" ) ) ); + break; + case DUPLEX_UNKNOWN: + default: + pValue = 0; + break; + } + if( ! pValue ) + pValue = pKey->getDefaultValue(); + aData.m_aContext.setValue( pKey, pValue ); + } + } + m_aJobData = aData; copyJobDataToJobSetup( pJobSetup, aData ); return TRUE; @@ -828,9 +857,22 @@ ULONG PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, USHORT case PRINTER_CAPABILITIES_COPIES: return 0xffff; case PRINTER_CAPABILITIES_COLLATECOPIES: - return 0; + { + // see if the PPD contains a value to set Collate to True + JobData aData; + JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, aData ); + + const PPDKey* pKey = aData.m_pParser ? aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ) ) : NULL; + const PPDValue* pVal = pKey ? pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "True" ) ) ) : NULL; + + // PPDs don't mention the number of possible collated copies. + // so let's guess as many as we want ? + return pVal ? 0xffff : 0; + } case PRINTER_CAPABILITIES_SETORIENTATION: return 1; + case PRINTER_CAPABILITIES_SETDUPLEX: + return 1; case PRINTER_CAPABILITIES_SETPAPERBIN: return 1; case PRINTER_CAPABILITIES_SETPAPERSIZE: @@ -860,6 +902,7 @@ ULONG PspSalInfoPrinter::GetCapabilities( const ImplJobSetup* pJobSetup, USHORT m_bSwallowFaxNo( false ), m_pGraphics( NULL ), m_nCopies( 1 ), + m_bCollate( false ), m_pInfoPrinter( pInfoPrinter ) { } @@ -885,7 +928,9 @@ BOOL PspSalPrinter::StartJob( const XubString* pFileName, const XubString& rJobName, const XubString& rAppName, - ULONG nCopies, BOOL /*bCollate*/, + ULONG nCopies, + bool bCollate, + bool bDirect, ImplJobSetup* pJobSetup ) { vcl_sal::PrinterUpdate::jobStarted(); @@ -894,13 +939,17 @@ BOOL PspSalPrinter::StartJob( m_bPdf = false; m_aFileName = pFileName ? *pFileName : String(); m_aTmpFile = String(); - m_nCopies = nCopies; + m_nCopies = nCopies; + m_bCollate = bCollate; JobData::constructFromStreamBuffer( pJobSetup->mpDriverData, pJobSetup->mnDriverDataLen, m_aJobData ); if( m_nCopies > 1 ) + { // in case user did not do anything (m_nCopies=1) // take the default from jobsetup m_aJobData.m_nCopies = m_nCopies; + m_aJobData.setCollate( bCollate ); + } // check wether this printer is configured as fax int nMode = 0; @@ -943,15 +992,6 @@ BOOL PspSalPrinter::StartJob( } m_aPrinterGfx.Init( m_aJobData ); - bool bIsQuickJob = false; - std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator quick_it = - pJobSetup->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) ) ); - if( quick_it != pJobSetup->maValueMap.end() ) - { - if( quick_it->second.equalsIgnoreAsciiCaseAscii( "true" ) ) - bIsQuickJob = true; - } - // set/clear backwards compatibility flag bool bStrictSO52Compatibility = false; std::hash_map<rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator compat_it = @@ -964,7 +1004,7 @@ BOOL PspSalPrinter::StartJob( } m_aPrinterGfx.setStrictSO52Compatibility( bStrictSO52Compatibility ); - return m_aPrintJob.StartJob( m_aTmpFile.Len() ? m_aTmpFile : m_aFileName, nMode, rJobName, rAppName, m_aJobData, &m_aPrinterGfx, bIsQuickJob ) ? TRUE : FALSE; + return m_aPrintJob.StartJob( m_aTmpFile.Len() ? m_aTmpFile : m_aFileName, nMode, rJobName, rAppName, m_aJobData, &m_aPrinterGfx, bDirect ) ? TRUE : FALSE; } // ----------------------------------------------------------------------- @@ -1010,9 +1050,12 @@ SalGraphics* PspSalPrinter::StartPage( ImplJobSetup* pJobSetup, BOOL ) m_pGraphics = new PspGraphics( &m_aJobData, &m_aPrinterGfx, m_bFax ? &m_aFaxNr : NULL, m_bSwallowFaxNo, m_pInfoPrinter ); m_pGraphics->SetLayout( 0 ); if( m_nCopies > 1 ) + { // in case user did not do anything (m_nCopies=1) // take the default from jobsetup m_aJobData.m_nCopies = m_nCopies; + m_aJobData.setCollate( m_nCopies > 1 && m_bCollate ); + } m_aPrintJob.StartPage( m_aJobData ); m_aPrinterGfx.Init( m_aPrintJob ); diff --git a/vcl/unx/source/gdi/xrender_peer.cxx b/vcl/unx/source/gdi/xrender_peer.cxx index d8f2045c6fde..fc8de818fafd 100644 --- a/vcl/unx/source/gdi/xrender_peer.cxx +++ b/vcl/unx/source/gdi/xrender_peer.cxx @@ -142,6 +142,10 @@ void XRenderPeer::InitRenderLib() mpXRenderCreatePicture = (Picture(*)(Display*,Drawable,const XRenderPictFormat*, unsigned long,const XRenderPictureAttributes*))pFunc; + pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderChangePicture" ); + if( !pFunc ) return; + mpXRenderChangePicture = (void(*)(Display*,Picture,unsigned long,const XRenderPictureAttributes*))pFunc; + pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderSetPictureClipRegion" ); if( !pFunc ) return; mpXRenderSetPictureClipRegion = (void(*)(Display*,Picture,XLIB_Region))pFunc; diff --git a/vcl/unx/source/gdi/xrender_peer.hxx b/vcl/unx/source/gdi/xrender_peer.hxx index f1e2fd77a273..27c8fb3dcaeb 100644 --- a/vcl/unx/source/gdi/xrender_peer.hxx +++ b/vcl/unx/source/gdi/xrender_peer.hxx @@ -66,6 +66,8 @@ public: const XRenderPictFormat& ) const; Picture CreatePicture( Drawable, const XRenderPictFormat*, unsigned long nDrawable, const XRenderPictureAttributes* ) const; + void ChangePicture( Picture, unsigned long nValueMask, + const XRenderPictureAttributes* ) const; void SetPictureClipRegion( Picture, XLIB_Region ) const; void CompositePicture( int nOp, Picture aSrc, Picture aMask, Picture aDst, int nXSrc, int nYSrc, int nXMask, int nYMask, @@ -103,6 +105,8 @@ private: Picture (*mpXRenderCreatePicture)(Display*,Drawable, const XRenderPictFormat*, unsigned long,const XRenderPictureAttributes*); + void (*mpXRenderChangePicture)(Display*,Picture, + unsigned long,const XRenderPictureAttributes*); void (*mpXRenderSetPictureClipRegion)(Display*,Picture,XLIB_Region); void (*mpXRenderFreePicture)(Display*,Picture); void (*mpXRenderComposite)(Display*,int,Picture,Picture,Picture, @@ -194,6 +198,16 @@ inline Picture XRenderPeer::CreatePicture( Drawable aDrawable, #endif } +inline void XRenderPeer::ChangePicture( Picture aPicture, + unsigned long nValueMask, const XRenderPictureAttributes* pRenderAttr ) const +{ +#ifdef XRENDER_LINK + XRenderChangePicture( mpDisplay, aPicture, nValueMask, pRenderAttr ); +#else + (*mpXRenderChangePicture)( mpDisplay, aPicture, nValueMask, pRenderAttr ); +#endif +} + inline void XRenderPeer::SetPictureClipRegion( Picture aPicture, XLIB_Region aXlibRegion ) const { diff --git a/vcl/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx index 14de25b13e4d..08820b2cb7f9 100644 --- a/vcl/unx/source/plugadapt/salplug.cxx +++ b/vcl/unx/source/plugadapt/salplug.cxx @@ -149,34 +149,53 @@ static const rtl::OUString& get_desktop_environment() return aRet; } -static const char* autodetect_plugin() +static SalInstance* autodetect_plugin() { + static const char* pKDEFallbackList[] = + { + "kde4", "kde", "gtk", "gen", 0 + }; + + static const char* pStandardFallbackList[] = + { + "gtk", "gen", 0 + }; + + static const char* pHeadlessFallbackList[] = + { + "svp", 0 + }; + const rtl::OUString& desktop( get_desktop_environment() ); - const char * pRet = "gen"; + const char ** pList = pStandardFallbackList; + int nListEntry = 0; // no server at all: dummy plugin if ( desktop.equalsAscii( desktop_strings[DESKTOP_NONE] ) ) - pRet = "svp"; + pList = pHeadlessFallbackList; else if ( desktop.equalsAscii( desktop_strings[DESKTOP_GNOME] ) ) - pRet = "gtk"; + pList = pStandardFallbackList; else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE] ) ) - pRet = "kde"; - else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE4] ) ) - pRet = "kde4"; - else { - // #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"; + pList = pKDEFallbackList; + nListEntry = 1; } + else if( desktop.equalsAscii( desktop_strings[DESKTOP_KDE4] ) ) + pList = pKDEFallbackList; -#if OSL_DEBUG_LEVEL > 1 - std::fprintf( stderr, "plugin autodetection: %s\n", pRet ); -#endif + SalInstance* pInst = NULL; + while( pList[nListEntry] && pInst == NULL ) + { + rtl::OUString aTry( rtl::OUString::createFromAscii( pList[nListEntry] ) ); + pInst = tryInstance( aTry ); + #if OSL_DEBUG_LEVEL > 1 + if( pInst ) + std::fprintf( stderr, "plugin autodetection: %s\n", pList[nListEntry] ); + #endif + nListEntry++; + } - return pRet; + return pInst; } static SalInstance* check_headless_plugin() @@ -200,13 +219,12 @@ SalInstance *CreateSalInstance() if( !(pUsePlugin && *pUsePlugin) ) pInst = check_headless_plugin(); - - if( ! pInst && !(pUsePlugin && *pUsePlugin) ) - pUsePlugin = autodetect_plugin(); - - if( ! pInst && pUsePlugin && *pUsePlugin ) + else pInst = tryInstance( OUString::createFromAscii( pUsePlugin ) ); + if( ! pInst ) + pInst = autodetect_plugin(); + // fallback to gen if( ! pInst ) pInst = tryInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "gen" ) ) ); diff --git a/vcl/unx/source/printer/jobdata.cxx b/vcl/unx/source/printer/jobdata.cxx index 51e171d578d9..0410b349c93b 100644 --- a/vcl/unx/source/printer/jobdata.cxx +++ b/vcl/unx/source/printer/jobdata.cxx @@ -64,6 +64,28 @@ JobData& JobData::operator=(const JobData& rRight) return *this; } +void JobData::setCollate( bool bCollate ) +{ + const PPDParser* pParser = m_aContext.getParser(); + if( pParser ) + { + const PPDKey* pKey = pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ) ); + if( pKey ) + { + const PPDValue* pVal = NULL; + if( bCollate ) + pVal = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "True" ) ) ); + else + { + pVal = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "False" ) ) ); + if( ! pVal ) + pVal = pKey->getValue( String( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) ); + } + m_aContext.setValue( pKey, pVal ); + } + } +} + bool JobData::getStreamBuffer( void*& pData, int& bytes ) { // consistency checks diff --git a/vcl/unx/source/printer/printerinfomanager.cxx b/vcl/unx/source/printer/printerinfomanager.cxx index b3e5b4667a6a..53cd662db8e0 100644 --- a/vcl/unx/source/printer/printerinfomanager.cxx +++ b/vcl/unx/source/printer/printerinfomanager.cxx @@ -441,7 +441,7 @@ void PrinterInfoManager::initialize() * porters: please append your platform to the Solaris * case if your platform has SystemV printing per default. */ - #if defined SOLARIS || defined(IRIX) + #if defined SOLARIS aValue = "lp"; #else aValue = "lpr"; diff --git a/vcl/unx/source/printergfx/common_gfx.cxx b/vcl/unx/source/printergfx/common_gfx.cxx index 632f0d70aa2f..9b305ff323ba 100644 --- a/vcl/unx/source/printergfx/common_gfx.cxx +++ b/vcl/unx/source/printergfx/common_gfx.cxx @@ -7,7 +7,6 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: common_gfx.cxx,v $ - * $Revision: 1.20.18.1 $ * * This file is part of OpenOffice.org. * @@ -535,68 +534,47 @@ PrinterGfx::DrawPolyLineBezier (sal_uInt32 nPoints, const Point* pPath, const BY const sal_uInt32 nBezString = 1024; sal_Char pString[nBezString]; - if ( maLineColor.Is() && nPoints && pPath ) + if ( nPoints > 1 && maLineColor.Is() && pPath ) { PSSetColor (maLineColor); PSSetColor (); PSSetLineWidth (); - if (pFlgAry[0] != POLY_NORMAL) //There must be a starting point to moveto - { - return; - } - else - { - snprintf(pString, nBezString, "%li %li moveto\n", pPath[0].X(), pPath[0].Y()); - WritePS(mpPageBody, pString); - } + snprintf(pString, nBezString, "%li %li moveto\n", pPath[0].X(), pPath[0].Y()); + WritePS(mpPageBody, pString); // Handle the drawing of mixed lines mixed with curves // - a normal point followed by a normal point is a line // - a normal point followed by 2 control points and a normal point is a curve for (unsigned int i=1; i<nPoints;) { - if (pFlgAry[i+1] != POLY_CONTROL) //If the next point is a POLY_NORMAL, we're drawing a line + if (pFlgAry[i] != POLY_CONTROL) //If the next point is a POLY_NORMAL, we're drawing a line { - if (i+1 >= nPoints) return; //Make sure we don't pass the end of the array snprintf(pString, nBezString, "%li %li lineto\n", pPath[i].X(), pPath[i].Y()); i++; } else //Otherwise we're drawing a spline { - if (i+3 >= nPoints) return; //Make sure we don't pass the end of the array - snprintf(pString, nBezString, "%li %li %li %li %li %li curveto\n", - pPath[i+1].X(), pPath[i+1].Y(), - pPath[i+2].X(), pPath[i+2].Y(), - pPath[i+3].X(), pPath[i+3].Y()); + if (i+2 >= nPoints) + return; //Error: wrong sequence of contol/normal points somehow + if ((pFlgAry[i] == POLY_CONTROL) && (pFlgAry[i+1] == POLY_CONTROL) && + (pFlgAry[i+2] != POLY_CONTROL)) + { + snprintf(pString, nBezString, "%li %li %li %li %li %li curveto\n", + pPath[i].X(), pPath[i].Y(), + pPath[i+1].X(), pPath[i+1].Y(), + pPath[i+2].X(), pPath[i+2].Y()); + } + else + { + DBG_ERROR( "PrinterGfx::DrawPolyLineBezier: Strange output" ); + } i+=3; } WritePS(mpPageBody, pString); } - } - - // if eofill and stroke, save the current path - if( maFillColor.Is() && maLineColor.Is()) - PSGSave(); - - // first draw area - if( maFillColor.Is() ) - { - PSSetColor (maFillColor); - PSSetColor (); - WritePS (mpPageBody, "eofill\n"); - } - - // restore the current path - if( maFillColor.Is() && maLineColor.Is()) - PSGRestore(); - // now draw outlines - if( maLineColor.Is() ) - { - PSSetColor (maLineColor); - PSSetColor (); - PSSetLineWidth (); + // now draw outlines WritePS (mpPageBody, "stroke\n"); } } @@ -635,7 +613,7 @@ PrinterGfx::DrawPolygonBezier (sal_uInt32 nPoints, const Point* pPath, const BYT } else { - fprintf(stderr, "Strange output\n"); + DBG_ERROR( "PrinterGfx::DrawPolygonBezier: Strange output" ); } i+=3; } @@ -699,9 +677,7 @@ PrinterGfx::DrawPolyPolygonBezier (sal_uInt32 nPoly, const sal_uInt32 * pPoints, } else { -#if OSL_DEBUG_LEVEL > 1 - fprintf(stderr, "Strange output\n"); -#endif + DBG_ERROR( "PrinterGfx::DrawPolyPolygonBezier: Strange output" ); } j+=3; } diff --git a/vcl/unx/source/printergfx/glyphset.cxx b/vcl/unx/source/printergfx/glyphset.cxx index 156517d98220..5adff6683267 100644 --- a/vcl/unx/source/printergfx/glyphset.cxx +++ b/vcl/unx/source/printergfx/glyphset.cxx @@ -46,6 +46,7 @@ #include <set> #include <map> +#include <algorithm> using namespace vcl; using namespace psp; @@ -785,6 +786,17 @@ GlyphSet::PSUploadEncoding(osl::File* pOutFile, PrinterGfx &rGfx) return sal_True; } +struct EncEntry +{ + sal_uChar aEnc; + long aGID; + + EncEntry() : aEnc( 0 ), aGID( 0 ) {} + + bool operator<( const EncEntry& rRight ) const + { return aEnc < rRight.aEnc; } +}; + static void CreatePSUploadableFont( TrueTypeFont* pSrcFont, FILE* pTmpFile, const char* pGlyphSetName, int nGlyphCount, /*const*/ sal_uInt16* pRequestedGlyphs, /*const*/ sal_uChar* pEncoding, @@ -796,17 +808,29 @@ static void CreatePSUploadableFont( TrueTypeFont* pSrcFont, FILE* pTmpFile, if( bAllowType42 ) nTargetMask |= FontSubsetInfo::TYPE42_FONT; + std::vector< EncEntry > aSorted( nGlyphCount, EncEntry() ); + for( int i = 0; i < nGlyphCount; i++ ) + { + aSorted[i].aEnc = pEncoding[i]; + aSorted[i].aGID = pRequestedGlyphs[i]; + } + + std::stable_sort( aSorted.begin(), aSorted.end() ); + + std::vector< sal_uChar > aEncoding( nGlyphCount ); + std::vector< long > aRequestedGlyphs( nGlyphCount ); + + for( int i = 0; i < nGlyphCount; i++ ) + { + aEncoding[i] = aSorted[i].aEnc; + aRequestedGlyphs[i] = aSorted[i].aGID; + } + FontSubsetInfo aInfo; aInfo.LoadFont( pSrcFont ); -#if 1 // TODO: remove 16bit->long conversion when input args has been changed - long aRequestedGlyphs[256]; - for( int i = 0; i < nGlyphCount; ++i ) - aRequestedGlyphs[i] = pRequestedGlyphs[i]; -#endif - aInfo.CreateFontSubset( nTargetMask, pTmpFile, pGlyphSetName, - aRequestedGlyphs, pEncoding, nGlyphCount, NULL ); + &aRequestedGlyphs[0], &aEncoding[0], nGlyphCount, NULL ); } sal_Bool diff --git a/vcl/unx/source/printergfx/printerjob.cxx b/vcl/unx/source/printergfx/printerjob.cxx index 783dd5ff2b47..1c42cafa4cb9 100644 --- a/vcl/unx/source/printergfx/printerjob.cxx +++ b/vcl/unx/source/printergfx/printerjob.cxx @@ -681,14 +681,6 @@ PrinterJob::StartPage (const JobData& rJobSetup) if( ! (pPageHeader && pPageBody) ) return sal_False; - /* #i7262# write setup only before first page - * don't do this in StartJob since the jobsetup there may be - * different. - */ - bool bSuccess = true; - if( 1 == maPageList.size() ) - m_aDocumentJobData = rJobSetup; - // write page header according to Document Structuring Conventions (DSC) WritePS (pPageHeader, "%%Page: "); WritePS (pPageHeader, aPageNo); @@ -722,13 +714,25 @@ PrinterJob::StartPage (const JobData& rJobSetup) WritePS (pPageHeader, pBBox); - if (bSuccess) - bSuccess = writePageSetup ( pPageHeader, rJobSetup ); - if(bSuccess) - m_aLastJobData = rJobSetup; + /* #i7262# #i65491# write setup only before first page + * (to %%Begin(End)Setup, instead of %%Begin(End)PageSetup) + * don't do this in StartJob since the jobsetup there may be + * different. + */ + bool bWriteFeatures = true; + if( 1 == maPageList.size() ) + { + m_aDocumentJobData = rJobSetup; + bWriteFeatures = false; + } + if ( writePageSetup( pPageHeader, rJobSetup, bWriteFeatures ) ) + { + m_aLastJobData = rJobSetup; + return true; + } - return bSuccess; + return false; } sal_Bool @@ -828,12 +832,9 @@ bool PrinterJob::writeFeatureList( osl::File* pFile, const JobData& rJob, bool b if( pKey->getSetupType() == PPDKey::DocumentSetup ) bEmit = true; } - else - { - if( pKey->getSetupType() == PPDKey::PageSetup || - pKey->getSetupType() == PPDKey::AnySetup ) - bEmit = true; - } + if( pKey->getSetupType() == PPDKey::PageSetup || + pKey->getSetupType() == PPDKey::AnySetup ) + bEmit = true; if( bEmit ) { const PPDValue* pValue = rJob.m_aContext.getValue( pKey ); @@ -866,13 +867,13 @@ bool PrinterJob::writeFeatureList( osl::File* pFile, const JobData& rJob, bool b return bSuccess; } -bool PrinterJob::writePageSetup( osl::File* pFile, const JobData& rJob ) +bool PrinterJob::writePageSetup( osl::File* pFile, const JobData& rJob, bool bWriteFeatures ) { bool bSuccess = true; WritePS (pFile, "%%BeginPageSetup\n%\n"); - - bSuccess = writeFeatureList( pFile, rJob, false ); + if ( bWriteFeatures ) + bSuccess = writeFeatureList( pFile, rJob, false ); WritePS (pFile, "%%EndPageSetup\n"); sal_Char pTranslate [128]; diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx index 6219b50d6ec3..68c99e05da77 100644 --- a/vcl/unx/source/window/salframe.cxx +++ b/vcl/unx/source/window/salframe.cxx @@ -930,12 +930,13 @@ void X11SalFrame::ReleaseGraphics( SalGraphics *pGraphics ) pGraphics_ = NULL; } -void X11SalFrame::updateGraphics() +void X11SalFrame::updateGraphics( bool bClear ) { + Drawable aDrawable = bClear ? None : GetWindow(); if( pGraphics_ ) - pGraphics_->SetDrawable( GetWindow(), m_nScreen ); + pGraphics_->SetDrawable( aDrawable, m_nScreen ); if( pFreeGraphics_ ) - pFreeGraphics_->SetDrawable( GetWindow(), m_nScreen ); + pFreeGraphics_->SetDrawable( aDrawable, m_nScreen ); } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= @@ -2726,6 +2727,7 @@ void X11SalFrame::createNewWindow( XLIB_Window aNewParent, int nScreen ) } // first deinit frame + updateGraphics(true); if( mpInputContext ) { mpInputContext->UnsetICFocus( this ); @@ -2748,7 +2750,7 @@ void X11SalFrame::createNewWindow( XLIB_Window aNewParent, int nScreen ) Init( nStyle_ & ~SAL_FRAME_STYLE_PLUG, nScreen, NULL, true ); // update graphics if necessary - updateGraphics(); + updateGraphics(false); if( m_aTitle.Len() ) SetTitle( m_aTitle ); diff --git a/svtools/source/config/options.cxx b/vcl/util/hidother.src index b418b90530a3..ab10a1e4c4ea 100644 --- a/svtools/source/config/options.cxx +++ b/vcl/util/hidother.src @@ -6,8 +6,8 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: options.cxx,v $ - * $Revision: 1.5 $ + * $RCSfile: hidother.src,v $ + * $Revision: 1.20 $ * * This file is part of OpenOffice.org. * @@ -28,15 +28,7 @@ * ************************************************************************/ -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" +#include "vcl/svids.hrc" -#include "sal/config.h" +hidspecial HID_PRINTDLG { HelpID = HID_PRINTDLG; }; -#include <svtools/options.hxx> - -using svt::detail::Options; - -Options::Options() {} - -Options::~Options() {} diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk index 32620d9e966a..c5a99d47c709 100644 --- a/vcl/util/makefile.mk +++ b/vcl/util/makefile.mk @@ -31,6 +31,7 @@ PRJNAME=vcl TARGET=vcl TARGETTYPE=GUI USE_DEFFILE=TRUE +GEN_HID_OTHER=TRUE .IF "$(SNDFILE_LIBS)"!="" SNDFILELIB=$(SNDFILE_LIBS) @@ -73,7 +74,6 @@ HXXDEPNLST= $(INC)$/vcl$/accel.hxx \ $(INC)$/vcl$/fixed.hxx \ $(INC)$/vcl$/floatwin.hxx \ $(INC)$/vcl$/font.hxx \ - $(INC)$/vcl$/fontcvt.hxx \ $(INC)$/vcl$/floatwin.hxx \ $(INC)$/vcl$/graph.hxx \ $(INC)$/vcl$/group.hxx \ diff --git a/vcl/win/inc/salprn.h b/vcl/win/inc/salprn.h index 58d721fd043a..890ff70bc3d6 100644 --- a/vcl/win/inc/salprn.h +++ b/vcl/win/inc/salprn.h @@ -88,7 +88,6 @@ public: virtual String GetPaperBinName( const ImplJobSetup* pSetupData, ULONG nPaperBin ); virtual void InitPaperFormats( const ImplJobSetup* pSetupData ); virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ); - virtual DuplexMode GetDuplexMode( const ImplJobSetup* pSetupData ); }; // ----------------- @@ -117,7 +116,9 @@ public: virtual BOOL StartJob( const XubString* pFileName, const XubString& rJobName, const XubString& rAppName, - ULONG nCopies, BOOL bCollate, + ULONG nCopies, + bool bCollate, + bool bDirect, ImplJobSetup* pSetupData ); virtual BOOL EndJob(); virtual BOOL AbortJob(); diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index 2b5ac6d3162d..68177795c8db 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -55,6 +55,7 @@ #include <vcl/salimestatus.hxx> #include <vcl/timer.hxx> #include <wincomp.hxx> // CS_DROPSHADOW +#include <tools/solarmutex.hxx> #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) @@ -661,12 +662,14 @@ WinSalInstance::WinSalInstance() mpSalWaitMutex = new vos::OMutex; mnYieldWaitCount = 0; mpSalYieldMutex->acquire(); + ::tools::SolarMutex::SetSolarMutex( mpSalYieldMutex ); } // ----------------------------------------------------------------------- WinSalInstance::~WinSalInstance() { + ::tools::SolarMutex::SetSolarMutex( 0 ); mpSalYieldMutex->release(); delete mpSalYieldMutex; delete mpSalWaitMutex; diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx index 73f4d8320acc..12fdad65dfb1 100644 --- a/vcl/win/source/gdi/salgdi3.cxx +++ b/vcl/win/source/gdi/salgdi3.cxx @@ -65,6 +65,7 @@ #include "basegfx/polygon/b2dpolygon.hxx" #include "basegfx/polygon/b2dpolypolygon.hxx" #include "basegfx/matrix/b2dhommatrix.hxx" +#include <basegfx/matrix/b2dhommatrixtools.hxx> #include "sft.hxx" @@ -557,7 +558,7 @@ static ImplDevFontAttributes WinFont2DevFontAttributes( const ENUMLOGFONTEXA& rE if( 0 != (rMetric.ntmFlags & (NTM_TT_OPENTYPE | NTM_PS_OPENTYPE)) || 0 != (rMetric.tmPitchAndFamily & TMPF_TRUETYPE)) aDFA.mbSubsettable = true; - else if( 0 != (rMetric.tmPitchAndFamily & NTM_TYPE1) ) // TODO: implement subsetting for type1 too + else if( 0 != (rMetric.ntmFlags & NTM_TYPE1) ) // TODO: implement subsetting for type1 too aDFA.mbEmbeddable = true; // heuristics for font quality @@ -636,7 +637,7 @@ static ImplDevFontAttributes WinFont2DevFontAttributes( const ENUMLOGFONTEXW& rE if( 0 != (rMetric.ntmFlags & (NTM_TT_OPENTYPE | NTM_PS_OPENTYPE)) || 0 != (rMetric.tmPitchAndFamily & TMPF_TRUETYPE)) aDFA.mbSubsettable = true; - else if( 0 != (rMetric.tmPitchAndFamily & NTM_TYPE1) ) // TODO: implement subsetting for type1 too + else if( 0 != (rMetric.ntmFlags & NTM_TYPE1) ) // TODO: implement subsetting for type1 too aDFA.mbEmbeddable = true; // heuristics for font quality @@ -2162,7 +2163,7 @@ void WinSalGraphics::GetDevFontList( ImplDevFontList* pFontList ) ::rtl::OUString aExecutableFile( aPath ); aPath = aPath.copy( 0, aPath.lastIndexOf('/') ); String aFontDirUrl = aPath.copy( 0, aPath.lastIndexOf('/') ); - aFontDirUrl += String( RTL_CONSTASCII_USTRINGPARAM("/share/fonts/truetype") ); + aFontDirUrl += String( RTL_CONSTASCII_USTRINGPARAM("/Basis/share/fonts/truetype") ); // collect fonts in font path that could not be registered osl::Directory aFontDir( aFontDirUrl ); @@ -2480,9 +2481,8 @@ BOOL WinSalGraphics::GetGlyphOutline( long nIndex, // rescaling needed for the PolyPolygon conversion if( rB2DPolyPoly.count() ) { - ::basegfx::B2DHomMatrix aMatrix; - aMatrix.scale( mfFontScale/256, mfFontScale/256 ); - rB2DPolyPoly.transform( aMatrix ); + const double fFactor(mfFontScale/256); + rB2DPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix(fFactor, fFactor)); } return bRet; @@ -2723,7 +2723,8 @@ const void* WinSalGraphics::GetEmbedFontData( const ImplFontData* pFont, TEXTMETRICA aTm; if( !::GetTextMetricsA( mhDC, &aTm ) ) *pDataLen = 0; - rInfo.m_nFontType = FontSubsetInfo::ANY_TYPE1; + const bool bPFA = (*aRawFontData.get() < 0x80); + rInfo.m_nFontType = bPFA ? FontSubsetInfo::TYPE1_PFA : FontSubsetInfo::TYPE1_PFB; WCHAR aFaceName[64]; int nFNLen = ::GetTextFaceW( mhDC, 64, aFaceName ); // #i59854# strip eventual null byte diff --git a/vcl/win/source/gdi/salgdi_gdiplus.cxx b/vcl/win/source/gdi/salgdi_gdiplus.cxx index 5c00c786e22d..29e4ff1d801e 100644 --- a/vcl/win/source/gdi/salgdi_gdiplus.cxx +++ b/vcl/win/source/gdi/salgdi_gdiplus.cxx @@ -62,9 +62,9 @@ // ----------------------------------------------------------------------- -void impAddB2DPolygonToGDIPlusGraphicsPath(Gdiplus::GraphicsPath& rPath, const basegfx::B2DPolygon& rPolygon) +void impAddB2DPolygonToGDIPlusGraphicsPathReal(Gdiplus::GraphicsPath& rPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin) { - const sal_uInt32 nCount(rPolygon.count()); + sal_uInt32 nCount(rPolygon.count()); if(nCount) { @@ -97,8 +97,58 @@ void impAddB2DPolygonToGDIPlusGraphicsPath(Gdiplus::GraphicsPath& rPath, const b if(a + 1 < nEdgeCount) { - aCurr = aNext; aFCurr = aFNext; + + if(bNoLineJoin) + { + rPath.StartFigure(); + } + } + } + } +} + +void impAddB2DPolygonToGDIPlusGraphicsPathInteger(Gdiplus::GraphicsPath& rPath, const basegfx::B2DPolygon& rPolygon, bool bNoLineJoin) +{ + 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::Point aICurr(INT(aCurr.getX()), INT(aCurr.getY())); + + for(sal_uInt32 a(0); a < nEdgeCount; a++) + { + const sal_uInt32 nNextIndex((a + 1) % nCount); + const basegfx::B2DPoint aNext(rPolygon.getB2DPoint(nNextIndex)); + const Gdiplus::Point aINext(INT(aNext.getX()), INT(aNext.getY())); + + if(bControls && (rPolygon.isNextControlPointUsed(a) || rPolygon.isPrevControlPointUsed(nNextIndex))) + { + const basegfx::B2DPoint aCa(rPolygon.getNextControlPoint(a)); + const basegfx::B2DPoint aCb(rPolygon.getPrevControlPoint(nNextIndex)); + + rPath.AddBezier( + aICurr, + Gdiplus::Point(INT(aCa.getX()), INT(aCa.getY())), + Gdiplus::Point(INT(aCb.getX()), INT(aCb.getY())), + aINext); + } + else + { + rPath.AddLine(aICurr, aINext); + } + + if(a + 1 < nEdgeCount) + { + aICurr = aINext; + + if(bNoLineJoin) + { + rPath.StartFigure(); + } } } } @@ -123,7 +173,7 @@ bool WinSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly aPath.StartFigure(); // #i101491# not needed for first run } - impAddB2DPolygonToGDIPlusGraphicsPath(aPath, rPolyPolygon.getB2DPolygon(a)); + impAddB2DPolygonToGDIPlusGraphicsPathReal(aPath, rPolyPolygon.getB2DPolygon(a), false); aPath.CloseFigure(); } @@ -152,11 +202,16 @@ bool WinSalGraphics::drawPolyLine(const basegfx::B2DPolygon& rPolygon, const bas Gdiplus::Color aTestColor(255, SALCOLOR_RED(maLineColor), SALCOLOR_GREEN(maLineColor), SALCOLOR_BLUE(maLineColor)); Gdiplus::Pen aTestPen(aTestColor, Gdiplus::REAL(rLineWidths.getX())); Gdiplus::GraphicsPath aPath; + bool bNoLineJoin(false); switch(eLineJoin) { default : // basegfx::B2DLINEJOIN_NONE : { + if(basegfx::fTools::more(rLineWidths.getX(), 0.0)) + { + bNoLineJoin = true; + } break; } case basegfx::B2DLINEJOIN_BEVEL : @@ -179,9 +234,16 @@ bool WinSalGraphics::drawPolyLine(const basegfx::B2DPolygon& rPolygon, const bas } } - impAddB2DPolygonToGDIPlusGraphicsPath(aPath, rPolygon); + if(nCount > 250 && basegfx::fTools::more(rLineWidths.getX(), 1.5)) + { + impAddB2DPolygonToGDIPlusGraphicsPathInteger(aPath, rPolygon, bNoLineJoin); + } + else + { + impAddB2DPolygonToGDIPlusGraphicsPathReal(aPath, rPolygon, bNoLineJoin); + } - if(rPolygon.isClosed()) + if(rPolygon.isClosed() && !bNoLineJoin) { // #i101491# needed to create the correct line joins aPath.CloseFigure(); diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx index 5a5703e10944..5c85d5d67144 100644 --- a/vcl/win/source/gdi/salnativewidgets-luna.cxx +++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx @@ -337,7 +337,7 @@ BOOL ImplDrawTheme( HTHEME hTheme, HDC hDC, int iPart, int iState, RECT rc, cons } -Rectangle ImplGetThemeRect( HTHEME hTheme, HDC hDC, int iPart, int iState, const Rectangle& aRect ) +Rectangle ImplGetThemeRect( HTHEME hTheme, HDC hDC, int iPart, int iState, const Rectangle& aRect, THEMESIZE eTS = TS_TRUE ) { SIZE aSz; RECT rc; @@ -345,7 +345,7 @@ Rectangle ImplGetThemeRect( HTHEME hTheme, HDC hDC, int iPart, int iState, const rc.right = aRect.nRight; rc.top = aRect.nTop; rc.bottom = aRect.nBottom; - HRESULT hr = vsAPI.GetThemePartSize( hTheme, hDC, iPart, iState, NULL, TS_TRUE, &aSz ); // TS_TRUE returns optimal size + HRESULT hr = vsAPI.GetThemePartSize( hTheme, hDC, iPart, iState, NULL, eTS, &aSz ); // TS_TRUE returns optimal size if( hr == S_OK ) return Rectangle( 0, 0, aSz.cx, aSz.cy ); else @@ -1109,6 +1109,63 @@ BOOL WinSalGraphics::getNativeControlRegion( ControlType nType, bRet = TRUE; } } + + if( (nType == CTRL_LISTBOX || nType == CTRL_COMBOBOX ) && nPart == PART_ENTIRE_CONTROL ) + { + HTHEME hTheme = getThemeHandle( mhWnd, L"Combobox"); + if( hTheme ) + { + Rectangle aBoxRect( rControlRegion.GetBoundRect() ); + Rectangle aRect( ImplGetThemeRect( hTheme, hDC, CP_DROPDOWNBUTTON, + CBXS_NORMAL, aBoxRect ) ); + Rectangle aBrdRect( ImplGetThemeRect( hTheme, hDC, CP_BORDER, + CBB_HOT, aBoxRect ) ); + aRect.Top() -= aBrdRect.GetHeight(); + if( aRect.GetHeight() > aBoxRect.GetHeight() ) + aBoxRect.Bottom() = aBoxRect.Top() + aRect.GetHeight(); + if( aRect.GetWidth() > aBoxRect.GetWidth() ) + aBoxRect.Right() = aBoxRect.Left() + aRect.GetWidth(); + rNativeContentRegion = aBoxRect; + rNativeBoundingRegion = rNativeContentRegion; + if( !aRect.IsEmpty() ) + bRet = TRUE; + } + } + + if( (nType == CTRL_EDITBOX || nType == CTRL_SPINBOX) && nPart == PART_ENTIRE_CONTROL ) + { + HTHEME hTheme = getThemeHandle( mhWnd, L"Edit"); + if( hTheme ) + { + // get borderr size + Rectangle aBoxRect( rControlRegion.GetBoundRect() ); + Rectangle aRect( ImplGetThemeRect( hTheme, hDC, EP_BACKGROUNDWITHBORDER, + EBWBS_HOT, aBoxRect ) ); + // ad app font height + NONCLIENTMETRICSW aNonClientMetrics; + aNonClientMetrics.cbSize = sizeof( aNonClientMetrics ); + if ( SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, sizeof( aNonClientMetrics ), &aNonClientMetrics, 0 ) ) + { + long nFontHeight = aNonClientMetrics.lfMessageFont.lfHeight; + if( nFontHeight < 0 ) + nFontHeight = -nFontHeight; + + if( aRect.GetHeight() && nFontHeight ) + { + aRect.Bottom() += aRect.GetHeight(); + aRect.Bottom() += nFontHeight; + if( aRect.GetHeight() > aBoxRect.GetHeight() ) + aBoxRect.Bottom() = aBoxRect.Top() + aRect.GetHeight(); + if( aRect.GetWidth() > aBoxRect.GetWidth() ) + aBoxRect.Right() = aBoxRect.Left() + aRect.GetWidth(); + rNativeContentRegion = aBoxRect; + rNativeBoundingRegion = rNativeContentRegion; + bRet = TRUE; + } + } + } + } + ReleaseDC( mhWnd, hDC ); return( bRet ); } diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx index ecf91aea7c1b..f4f55dd0adbf 100644 --- a/vcl/win/source/gdi/salprn.cxx +++ b/vcl/win/source/gdi/salprn.cxx @@ -1059,6 +1059,21 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS break; } } + + if( nFlags & SAL_JOBSET_DUPLEXMODE ) + { + DuplexMode eDuplex = DUPLEX_UNKNOWN; + if( (CHOOSE_DEVMODE(dmFields) & DM_DUPLEX) ) + { + if( CHOOSE_DEVMODE(dmDuplex) == DMDUP_SIMPLEX ) + eDuplex = DUPLEX_OFF; + else if( CHOOSE_DEVMODE(dmDuplex) == DMDUP_VERTICAL ) + eDuplex = DUPLEX_LONGEDGE; + else if( CHOOSE_DEVMODE(dmDuplex) == DMDUP_HORIZONTAL ) + eDuplex = DUPLEX_SHORTEDGE; + } + pSetupData->meDuplexMode = eDuplex; + } } // ----------------------------------------------------------------------- @@ -1326,6 +1341,26 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS } } } + if( (nFlags & SAL_JOBSET_DUPLEXMODE) ) + { + switch( pSetupData->meDuplexMode ) + { + case DUPLEX_OFF: + CHOOSE_DEVMODE(dmFields) |= DM_DUPLEX; + CHOOSE_DEVMODE(dmDuplex) = DMDUP_SIMPLEX; + break; + case DUPLEX_SHORTEDGE: + CHOOSE_DEVMODE(dmFields) |= DM_DUPLEX; + CHOOSE_DEVMODE(dmDuplex) = DMDUP_HORIZONTAL; + break; + case DUPLEX_LONGEDGE: + CHOOSE_DEVMODE(dmFields) |= DM_DUPLEX; + CHOOSE_DEVMODE(dmDuplex) = DMDUP_VERTICAL; + break; + case DUPLEX_UNKNOWN: + break; + } + } } // ----------------------------------------------------------------------- @@ -1559,39 +1594,6 @@ void WinSalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData ) // ----------------------------------------------------------------------- -DuplexMode WinSalInfoPrinter::GetDuplexMode( const ImplJobSetup* pSetupData ) -{ - DuplexMode nRet = DUPLEX_UNKNOWN; - if ( pSetupData &&pSetupData->mpDriverData ) - { - if( aSalShlData.mbWPrinter ) - { - DEVMODEW* pDevMode = SAL_DEVMODE_W( pSetupData ); - if ( pDevMode && (pDevMode->dmFields & DM_DUPLEX )) - { - if ( pDevMode->dmDuplex == DMDUP_SIMPLEX ) - nRet = DUPLEX_OFF; - else - nRet = DUPLEX_ON; - } - } - else - { - DEVMODEA* pDevMode = SAL_DEVMODE_A( pSetupData ); - if ( pDevMode && (pDevMode->dmFields & DM_DUPLEX )) - { - if ( pDevMode->dmDuplex == DMDUP_SIMPLEX ) - nRet = DUPLEX_OFF; - else - nRet = DUPLEX_ON; - } - } - } - return nRet; -} - -// ----------------------------------------------------------------------- - int WinSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* pSetupData ) { int nRet = ImplDeviceCaps( this, DC_ORIENTATION, NULL, pSetupData ); @@ -1964,7 +1966,9 @@ static int lcl_StartDocA( HDC hDC, DOCINFOA* pInfo, WinSalPrinter* pPrt ) BOOL WinSalPrinter::StartJob( const XubString* pFileName, const XubString& rJobName, const XubString&, - ULONG nCopies, BOOL bCollate, + ULONG nCopies, + bool bCollate, + bool /*bDirect*/, ImplJobSetup* pSetupData ) { mnError = 0; diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx index 1b80bf578530..bf56b2a1082b 100644 --- a/vcl/win/source/gdi/winlayout.cxx +++ b/vcl/win/source/gdi/winlayout.cxx @@ -6,9 +6,6 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: winlayout.cxx,v $ - * $Revision: 1.113.6.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -1385,7 +1382,7 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs ) mpScriptItems = NULL; if( nRC != E_OUTOFMEMORY ) return false; - if( nItemCapacity > (nSubStringEnd - mnSubStringMin) ) + if( nItemCapacity > (nSubStringEnd - mnSubStringMin) + 16 ) return false; } diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 78c4e4e6ddcc..fc92757e0925 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -39,6 +39,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/awt/Rectangle.hpp> #include <comphelper/processfactory.hxx> +#include <unotools/misccfg.hxx> #include <string.h> #include <limits.h> @@ -2158,15 +2159,15 @@ static void ImplSalToTop( HWND hWnd, USHORT nFlags ) if ( nFlags & SAL_FRAME_TOTOP_FOREGROUNDTASK ) { - // This magic code is necessary to connect the input focus of the
- // current window thread and the thread which owns the window that
- // should be the new foreground window.
- HWND hCurrWnd = GetForegroundWindow();
- DWORD myThreadID = GetCurrentThreadId();
- DWORD currThreadID = GetWindowThreadProcessId(hCurrWnd,NULL);
- AttachThreadInput(myThreadID, currThreadID,TRUE);
- SetForegroundWindow(hWnd);
- AttachThreadInput(myThreadID,currThreadID,FALSE);
+ // This magic code is necessary to connect the input focus of the + // current window thread and the thread which owns the window that + // should be the new foreground window. + HWND hCurrWnd = GetForegroundWindow(); + DWORD myThreadID = GetCurrentThreadId(); + DWORD currThreadID = GetWindowThreadProcessId(hCurrWnd,NULL); + AttachThreadInput(myThreadID, currThreadID,TRUE); + SetForegroundWindow(hWnd); + AttachThreadInput(myThreadID,currThreadID,FALSE); } if ( nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN ) @@ -3095,7 +3096,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) if ( (nValue > 1000) && (nValue < 10000) ) { MiscSettings aMiscSettings = rSettings.GetMiscSettings(); - aMiscSettings.SetTwoDigitYearStart( (USHORT)(nValue-99) ); + utl::MiscCfg().SetYear2000( (sal_Int32)(nValue-99) ); rSettings.SetMiscSettings( aMiscSettings ); } } @@ -5436,7 +5437,7 @@ static BOOL ImplHandleIMECompositionInput( WinSalFrame* pFrame, WCHAR* pTextBuf = new WCHAR[nTextLen]; ImmGetCompositionStringW( hIMC, GCS_RESULTSTR, pTextBuf, nTextLen*sizeof( WCHAR ) ); aEvt.maText = XubString( reinterpret_cast<const xub_Unicode*>(pTextBuf), (xub_StrLen)nTextLen ); - delete pTextBuf; + delete [] pTextBuf; } aEvt.mnCursorPos = aEvt.maText.Len(); @@ -5462,7 +5463,7 @@ static BOOL ImplHandleIMECompositionInput( WinSalFrame* pFrame, WCHAR* pTextBuf = new WCHAR[nTextLen]; ImmGetCompositionStringW( hIMC, GCS_COMPSTR, pTextBuf, nTextLen*sizeof( WCHAR ) ); aEvt.maText = XubString( reinterpret_cast<const xub_Unicode*>(pTextBuf), (xub_StrLen)nTextLen ); - delete pTextBuf; + delete [] pTextBuf; WIN_BYTE* pAttrBuf = NULL; LONG nAttrLen = ImmGetCompositionStringW( hIMC, GCS_COMPATTR, 0, 0 ); @@ -5498,7 +5499,7 @@ static BOOL ImplHandleIMECompositionInput( WinSalFrame* pFrame, } aEvt.mpTextAttr = pSalAttrAry; - delete pAttrBuf; + delete [] pAttrBuf; } } @@ -5535,7 +5536,7 @@ static BOOL ImplHandleIMECompositionInput( WinSalFrame* pFrame, } if ( pSalAttrAry ) - delete pSalAttrAry; + delete [] pSalAttrAry; } return !bDef; diff --git a/vcl/workben/outdevgrind.cxx b/vcl/workben/outdevgrind.cxx index a92da7c05531..1109111b63c5 100755 --- a/vcl/workben/outdevgrind.cxx +++ b/vcl/workben/outdevgrind.cxx @@ -163,12 +163,12 @@ void setupMethodStubs( functor_vector_type& res ) xub_StrLen nIndex = 0, xub_StrLen nLen = STRING_LEN, MetricVector* pVector = NULL, String* pDisplayText = NULL ); */ - add(res, - "DrawText", - boost::bind( - &OutputDevice::DrawText, - _1, - aPt1, aString, (USHORT)0, aString.Len(), (MetricVector*)0, (String*)0 )); +// add(res, +// "DrawText", +// boost::bind( +// &OutputDevice::DrawText, +// _1, +// aPt1, aString, (USHORT)0, aString.Len(), (MetricVector*)0, (String*)0, (vcl::ITextLayout*)0 )); /* void DrawTextArray( const Point& rStartPt, const XubString& rStr, const sal_Int32* pDXAry = NULL, |