diff options
68 files changed, 637 insertions, 339 deletions
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/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/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/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/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..7485387c6cb9 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. * @@ -192,6 +191,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 +274,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 +347,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()); @@ -3269,6 +3277,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/comphelper/source/misc/uieventslogger.cxx b/comphelper/source/misc/uieventslogger.cxx index ae351340bc7a..b88abff17f4a 100644 --- a/comphelper/source/misc/uieventslogger.cxx +++ b/comphelper/source/misc/uieventslogger.cxx @@ -383,6 +383,16 @@ namespace comphelper logdata[3] = URL_FILE; else logdata[3] = url.Main; + OSL_TRACE("UiEventsLogger Logging: %s,%s,%s,%s,%s,%s,%s,%s", + OUStringToOString(logdata[0],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[1],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[2],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[3],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[4],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[5],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[6],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[7],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[8],RTL_TEXTENCODING_UTF8).getStr()); m_Logger->log(LogLevel::INFO, m_Formatter->formatMultiColumn(logdata)); m_SessionLogEventCount++; } @@ -391,6 +401,16 @@ namespace comphelper { Sequence<OUString> logdata = Sequence<OUString>(COLUMNS); logdata[0] = ETYPE_ROTATED; + OSL_TRACE("UiEventsLogger Logging: %s,%s,%s,%s,%s,%s,%s,%s", + OUStringToOString(logdata[0],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[1],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[2],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[3],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[4],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[5],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[6],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[7],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[8],RTL_TEXTENCODING_UTF8).getStr()); m_Logger->log(LogLevel::INFO, m_Formatter->formatMultiColumn(logdata)); } @@ -412,6 +432,16 @@ namespace comphelper logdata[6] = id; logdata[7] = method; logdata[8] = param; + OSL_TRACE("UiEventsLogger Logging: %s,%s,%s,%s,%s,%s,%s,%s", + OUStringToOString(logdata[0],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[1],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[2],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[3],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[4],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[5],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[6],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[7],RTL_TEXTENCODING_UTF8).getStr(), + OUStringToOString(logdata[8],RTL_TEXTENCODING_UTF8).getStr()); m_Logger->log(LogLevel::INFO, m_Formatter->formatMultiColumn(logdata)); m_SessionLogEventCount++; } diff --git a/goodies/source/filter.vcl/eos2met/eos2met.cxx b/goodies/source/filter.vcl/eos2met/eos2met.cxx index 51ef34d79cfd..b818e9cd26ba 100644 --- a/goodies/source/filter.vcl/eos2met/eos2met.cxx +++ b/goodies/source/filter.vcl/eos2met/eos2met.cxx @@ -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/epict/epict.cxx b/goodies/source/filter.vcl/epict/epict.cxx index e176be21d6bb..3e4dca455d05 100644 --- a/goodies/source/filter.vcl/epict/epict.cxx +++ b/goodies/source/filter.vcl/epict/epict.cxx @@ -1573,7 +1573,7 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) Polygon aSimplePoly; if ( rPoly.HasFlags() ) - rPoly.GetSimple( aSimplePoly ); + rPoly.AdaptiveSubdivide( aSimplePoly ); else aSimplePoly = rPoly; @@ -1603,7 +1603,7 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF ) Polygon aSimplePoly; if ( rPoly.HasFlags() ) - rPoly.GetSimple( aSimplePoly ); + rPoly.AdaptiveSubdivide( aSimplePoly ); else aSimplePoly = rPoly; @@ -1632,7 +1632,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/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/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..f73427526be6 100644 --- a/padmin/source/padialog.cxx +++ b/padmin/source/padialog.cxx @@ -106,7 +106,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 ) ) ); diff --git a/svl/source/svdde/ddeml1.cxx b/svl/source/svdde/ddeml1.cxx index bb9c428178b2..9d1351b17f16 100644 --- a/svl/source/svdde/ddeml1.cxx +++ b/svl/source/svdde/ddeml1.cxx @@ -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/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx index 9b7a4b4e15bf..ec718d4e56ee 100644 --- a/svl/source/svdde/ddesvr.cxx +++ b/svl/source/svdde/ddesvr.cxx @@ -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/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index a6e47765eb06..09d1f5c869b9 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -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/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index cea28d2d2fb5..7fddf18ee266 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -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/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx index c0f40fd306df..b3b5829b479e 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 ) { 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/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 28d541513cff..06de35ba19aa 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -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/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 1ba8af0c8dca..b0d20bf7ce30 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -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/dialogs/printdlg.cxx b/svtools/source/dialogs/printdlg.cxx index f2b269e13b6a..a006f209af18 100644 --- a/svtools/source/dialogs/printdlg.cxx +++ b/svtools/source/dialogs/printdlg.cxx @@ -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/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/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/wmf/wmfwr.cxx b/svtools/source/filter.vcl/wmf/wmfwr.cxx index 5b9970ee471f..d25d4e94f97a 100644 --- a/svtools/source/filter.vcl/wmf/wmfwr.cxx +++ b/svtools/source/filter.vcl/wmf/wmfwr.cxx @@ -755,7 +755,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 +770,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 +792,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; } } 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/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/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/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/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/poly.cxx b/tools/source/generic/poly.cxx index 5cca29b3066e..7f1eb94b646d 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. 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/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/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/help/HelpLinker.cxx b/transex3/source/help/HelpLinker.cxx index 8acb129b21fb..19b9ead8521e 100644 --- a/transex3/source/help/HelpLinker.cxx +++ b/transex3/source/help/HelpLinker.cxx @@ -174,15 +174,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 @@ -384,8 +392,8 @@ void HelpLinker::initIndexerPreProcessor() */ void HelpLinker::link() throw( HelpProcessingException ) { - bool bIndexForExtension = true;
-
+ bool bIndexForExtension = true; + if( bExtensionMode ) { indexDirParentName = sourceRoot; @@ -930,34 +938,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; diff --git a/transex3/source/localize.cxx b/transex3/source/localize.cxx index bcd45d7027a4..31143ab50d38 100644 --- a/transex3/source/localize.cxx +++ b/transex3/source/localize.cxx @@ -345,7 +345,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 ); @@ -621,7 +622,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("."); } diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h index 11abd6086ce7..4933dbc48586 100644 --- a/vcl/aqua/inc/salgdi.h +++ b/vcl/aqua/inc/salgdi.h @@ -358,6 +358,7 @@ private: void ApplyXorContext(); void Pattern50Fill(); + UInt32 getState( ControlState nState ); }; class XorEmulation diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx index 7ecef01cf0d5..3021e85fed5c 100755 --- a/vcl/aqua/source/gdi/salatslayout.cxx +++ b/vcl/aqua/source/gdi/salatslayout.cxx @@ -302,16 +302,14 @@ 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]; + mnTrailingSpaceWidth -= rArgs.mpDXArray[ i-1 ]; InitGIA(); // ensure valid mpCharWidths[] mnTrailingSpaceWidth -= Fixed2Vcl( mpCharWidths[i] ); // ignore trailing space for calculating the available width 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/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/window/salframeview.mm b/vcl/aqua/source/window/salframeview.mm index 68ea2c2062f2..0305b4cadb43 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 diff --git a/vcl/inc/vcl/pdfwriter.hxx b/vcl/inc/vcl/pdfwriter.hxx index bdf636754c77..a4a6c4d53170 100644 --- a/vcl/inc/vcl/pdfwriter.hxx +++ b/vcl/inc/vcl/pdfwriter.hxx @@ -546,6 +546,7 @@ The following structure describes the permissions used in PDF security will be submitted. */ PDFWriter::ExportDataFormat SubmitFormat; + bool AllowDuplicateFieldNames; /* the following data members are used to customize the PDF viewer preferences */ @@ -590,6 +591,7 @@ The following structure describes the permissions used in PDF security Tagged( false ), EmbedStandardFonts( false ), SubmitFormat( PDFWriter::FDF ), + AllowDuplicateFieldNames( false ), PDFDocumentMode( PDFWriter::ModeDefault ), PDFDocumentAction( PDFWriter::ActionDefault ), Zoom( 100 ), 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/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/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/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx index c1c02b673658..4ecb89ec5a8e 100644 --- a/vcl/source/gdi/cvtsvm.cxx +++ b/vcl/source/gdi/cvtsvm.cxx @@ -90,12 +90,17 @@ void ImplReadPoly( SvStream& rIStm, Polygon& rPoly ) void ImplWritePoly( SvStream& rOStm, const Polygon& rPoly ) { - INT32 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; + rPoly.AdaptiveSubdivide(aSimplePoly); + INT32 nSize = aSimplePoly.GetSize(); rOStm << nSize; for( INT32 i = 0; i < nSize; i++ ) - rOStm << rPoly[ (USHORT) i ]; + rOStm << aSimplePoly[ (USHORT) i ]; } // ------------------------------------------------------------------------ @@ -131,13 +136,18 @@ void ImplWritePolyPolyAction( SvStream& rOStm, const PolyPolygon& rPolyPoly ) for( n = 0; n < nPoly; n++ ) { + // #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 const Polygon& rPoly = rPolyPoly[ n ]; - const USHORT nSize = rPoly.GetSize(); + Polygon aSimplePoly; + rPoly.AdaptiveSubdivide(aSimplePoly); + const USHORT nSize = aSimplePoly.GetSize(); rOStm << (INT32) nSize; for( USHORT j = 0; j < nSize; j++ ) - rOStm << rPoly[ j ]; + rOStm << aSimplePoly[ j ]; } } @@ -1354,8 +1364,15 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaPolyLineAction* pAct = (MetaPolyLineAction*) pAction; const Polygon& rPoly = pAct->GetPolygon(); + + // #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; + rPoly.AdaptiveSubdivide(aSimplePoly); + const LineInfo& rInfo = pAct->GetLineInfo(); - const USHORT nPoints = rPoly.GetSize(); + const USHORT nPoints = aSimplePoly.GetSize(); const BOOL bFatLine = ( !rInfo.IsDefault() && ( LINE_NONE != rInfo.GetStyle() ) ); if( bFatLine ) @@ -1369,7 +1386,7 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, rOStm << (INT32) nPoints; for( USHORT n = 0; n < nPoints; n++ ) - rOStm << rPoly[ n ]; + rOStm << aSimplePoly[ n ]; nCount++; @@ -1385,14 +1402,21 @@ ULONG SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf, { MetaPolygonAction* pAct = (MetaPolygonAction*) pAction; const Polygon& rPoly = pAct->GetPolygon(); - const USHORT nPoints = 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; + rPoly.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++; } diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 4fe9a41be797..82566b2b4362 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -989,7 +989,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 +1077,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 +1169,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; } @@ -2581,7 +2581,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 +2655,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; } // ------------------------------------------------------------------------ @@ -3716,7 +3728,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; } diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index ff8947069060..c886debc1df2 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -4276,7 +4276,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(); 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..dc3ead5d2d6f 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -667,26 +667,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; } @@ -8792,6 +8795,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 diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index 43bb224aaa94..5314837143de 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -2537,7 +2537,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/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/glyphs/gcach_ftyp.cxx b/vcl/source/glyphs/gcach_ftyp.cxx index 712c2334b35c..18857b94af8f 100644 --- a/vcl/source/glyphs/gcach_ftyp.cxx +++ b/vcl/source/glyphs/gcach_ftyp.cxx @@ -135,7 +135,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 +473,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); @@ -2487,10 +2489,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/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/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/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/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 8963ac2e3643..eff7319d6efc 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -70,9 +70,9 @@ #ifdef ENABLE_DBUS #include <dbus/dbus-glib.h> -#define GSS_DBUS_SERVICE "org.gnome.ScreenSaver" -#define GSS_DBUS_PATH "/org/gnome/ScreenSaver" -#define GSS_DBUS_INTERFACE "org.gnome.ScreenSaver" +#define GSM_DBUS_SERVICE "org.gnome.SessionManager" +#define GSM_DBUS_PATH "/org/gnome/SessionManager" +#define GSM_DBUS_INTERFACE "org.gnome.SessionManager" #endif // make compile on gtk older than 2.10 @@ -565,7 +565,7 @@ void GtkSalFrame::InitCommon() m_pIMHandler = NULL; m_hBackgroundPixmap = None; m_nSavedScreenSaverTimeout = 0; - m_nGSSCookie = 0; + m_nGSMCookie = 0; m_nExtStyle = 0; m_pRegion = NULL; m_ePointerStyle = 0xffff; @@ -1904,8 +1904,9 @@ void GtkSalFrame::setAutoLock( bool bLock ) #ifdef ENABLE_DBUS /** cookie is returned as an unsigned integer */ static guint -dbus_inhibit_gss (const gchar *appname, - const gchar *reason) +dbus_inhibit_gsm (const gchar *appname, + const gchar *reason, + guint xid) { gboolean res; guint cookie; @@ -1921,20 +1922,22 @@ dbus_inhibit_gss (const gchar *appname, return -1; } - /* get the proxy with gnome-screensaver */ + /* get the proxy with gnome-session-manager */ proxy = dbus_g_proxy_new_for_name (session_connection, - GSS_DBUS_SERVICE, - GSS_DBUS_PATH, - GSS_DBUS_INTERFACE); + GSM_DBUS_SERVICE, + GSM_DBUS_PATH, + GSM_DBUS_INTERFACE); if (proxy == NULL) { - g_warning ("Could not get DBUS proxy: %s", GSS_DBUS_SERVICE); + g_warning ("Could not get DBUS proxy: %s", GSM_DBUS_SERVICE); return -1; } res = dbus_g_proxy_call (proxy, "Inhibit", &error, G_TYPE_STRING, appname, + G_TYPE_UINT, xid, G_TYPE_STRING, reason, + G_TYPE_UINT, 8, //Inhibit the session being marked as idle G_TYPE_INVALID, G_TYPE_UINT, &cookie, G_TYPE_INVALID); @@ -1957,15 +1960,14 @@ dbus_inhibit_gss (const gchar *appname, } static void -dbus_uninhibit_gss (guint cookie) +dbus_uninhibit_gsm (guint cookie) { gboolean res; GError *error = NULL; DBusGProxy *proxy = NULL; DBusGConnection *session_connection = NULL; - /* cookies have to be positive as unsigned */ - if (cookie < 0) { + if (cookie == guint(-1)) { g_warning ("Invalid cookie"); return; } @@ -1978,18 +1980,18 @@ dbus_uninhibit_gss (guint cookie) return; } - /* get the proxy with gnome-screensaver */ + /* get the proxy with gnome-session-manager */ proxy = dbus_g_proxy_new_for_name (session_connection, - GSS_DBUS_SERVICE, - GSS_DBUS_PATH, - GSS_DBUS_INTERFACE); + GSM_DBUS_SERVICE, + GSM_DBUS_PATH, + GSM_DBUS_INTERFACE); if (proxy == NULL) { - g_warning ("Could not get DBUS proxy: %s", GSS_DBUS_SERVICE); + g_warning ("Could not get DBUS proxy: %s", GSM_DBUS_SERVICE); return; } res = dbus_g_proxy_call (proxy, - "UnInhibit", + "Uninhibit", &error, G_TYPE_UINT, cookie, G_TYPE_INVALID, @@ -1997,12 +1999,12 @@ dbus_uninhibit_gss (guint cookie) /* check the return value */ if (! res) { - g_warning ("UnInhibit method failed"); + g_warning ("Uninhibit method failed"); } /* check the error value */ if (error != NULL) { - g_warning ("Inhibit problem : %s", error->message); + g_warning ("Uninhibit problem : %s", error->message); g_error_free (error); cookie = -1; } @@ -2030,7 +2032,8 @@ void GtkSalFrame::StartPresentation( BOOL bStart ) bPreferBlanking, bAllowExposures ); } #ifdef ENABLE_DBUS - m_nGSSCookie = dbus_inhibit_gss(g_get_application_name(), "presentation"); + m_nGSMCookie = dbus_inhibit_gsm(g_get_application_name(), "presentation", + GDK_WINDOW_XID(m_pWindow->window)); #endif } else @@ -2041,7 +2044,7 @@ void GtkSalFrame::StartPresentation( BOOL bStart ) bAllowExposures ); m_nSavedScreenSaverTimeout = 0; #ifdef ENABLE_DBUS - dbus_uninhibit_gss(m_nGSSCookie); + dbus_uninhibit_gsm(m_nGSMCookie); #endif } } diff --git a/vcl/unx/inc/plugins/gtk/gtkframe.hxx b/vcl/unx/inc/plugins/gtk/gtkframe.hxx index 74394c71e4b2..a8fc6f65d4ee 100644 --- a/vcl/unx/inc/plugins/gtk/gtkframe.hxx +++ b/vcl/unx/inc/plugins/gtk/gtkframe.hxx @@ -180,7 +180,7 @@ class GtkSalFrame : public SalFrame GdkVisibilityState m_nVisibility; PointerStyle m_ePointerStyle; int m_nSavedScreenSaverTimeout; - guint m_nGSSCookie; + guint m_nGSMCookie; int m_nWorkArea; bool m_bFullscreen; bool m_bSingleAltPress; diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx index 796350a63d50..202d3dbcd517 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 ); } 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/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/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index bca2ec34498d..fc92757e0925 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -2159,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 ) @@ -5437,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(); @@ -5463,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 ); @@ -5499,7 +5499,7 @@ static BOOL ImplHandleIMECompositionInput( WinSalFrame* pFrame, } aEvt.mpTextAttr = pSalAttrAry; - delete pAttrBuf; + delete [] pAttrBuf; } } @@ -5536,7 +5536,7 @@ static BOOL ImplHandleIMECompositionInput( WinSalFrame* pFrame, } if ( pSalAttrAry ) - delete pSalAttrAry; + delete [] pSalAttrAry; } return !bDef; |