summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2009-12-07 09:34:25 +0100
committersb <sb@openoffice.org>2009-12-07 09:34:25 +0100
commit334c894c6fc1ac6d494b0256b7982ed7311d8854 (patch)
treeedbd496e0642fea062f8e50aa131f2c889e75465
parentfe537060e40a6d0c5411a800fd5c518d04a6209c (diff)
parentb31166829b6c56b963e6ca58cd1af8c746e8ab6a (diff)
merged in DEV300_m66
-rw-r--r--basegfx/inc/basegfx/curve/b2dcubicbezier.hxx16
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolygon.hxx5
-rw-r--r--basegfx/inc/basegfx/range/b1drange.hxx6
-rw-r--r--basegfx/inc/basegfx/range/b2drange.hxx9
-rw-r--r--basegfx/inc/basegfx/range/basicrange.hxx9
-rw-r--r--basegfx/source/curve/b2dcubicbezier.cxx60
-rw-r--r--basegfx/source/polygon/b2dpolygon.cxx50
-rw-r--r--basegfx/source/polygon/b2dpolygoncutandtouch.cxx46
-rw-r--r--basegfx/source/polygon/b2dpolygontools.cxx13
-rw-r--r--basegfx/source/polygon/b3dpolygontools.cxx167
-rw-r--r--goodies/source/filter.vcl/eos2met/eos2met.cxx6
-rw-r--r--goodies/source/filter.vcl/epict/epict.cxx6
-rw-r--r--i18npool/source/search/makefile.mk6
-rw-r--r--i18npool/source/search/textsearch.cxx1
-rw-r--r--i18npool/source/textconversion/genconv_dict.cxx12
-rw-r--r--padmin/source/adddlg.cxx2
-rw-r--r--padmin/source/cmddlg.cxx54
-rw-r--r--padmin/source/padialog.cxx2
-rw-r--r--svtools/inc/calendar.hxx1
-rw-r--r--svtools/inc/privsplt.hxx86
-rw-r--r--svtools/inc/sectctr.hxx154
-rw-r--r--svtools/inc/svtools/editbrowsebox.hxx1
-rw-r--r--svtools/inc/svtools/embedhlp.hxx10
-rw-r--r--svtools/inc/svtools/section.hxx104
-rw-r--r--svtools/inc/svtools/svmedit.hxx1
-rw-r--r--svtools/inc/svtools/valueset.hxx1
-rw-r--r--svtools/prj/d.lst3
-rw-r--r--svtools/source/brwbox/editbrowsebox.cxx12
-rw-r--r--svtools/source/contnr/fileview.cxx2
-rw-r--r--svtools/source/contnr/ivctrl.cxx7
-rw-r--r--svtools/source/contnr/svlbitm.cxx3
-rw-r--r--svtools/source/contnr/svtreebx.cxx2
-rw-r--r--svtools/source/contnr/templwin.cxx6
-rw-r--r--svtools/source/control/ctrlbox.cxx3
-rw-r--r--svtools/source/dialogs/printdlg.cxx2
-rw-r--r--svtools/source/filter.vcl/igif/decode.cxx3
-rw-r--r--svtools/source/filter.vcl/ixpm/xpmread.cxx21
-rw-r--r--svtools/source/filter.vcl/wmf/wmfwr.cxx6
-rw-r--r--svtools/source/misc/embedhlp.cxx41
-rw-r--r--svtools/source/svdde/ddeml1.cxx2
-rw-r--r--svtools/source/svdde/ddesvr.cxx2
-rw-r--r--svtools/source/uno/contextmenuhelper.cxx2
-rw-r--r--svtools/source/uno/toolboxcontroller.cxx2
-rw-r--r--toolkit/inc/toolkit/helper/property.hxx1
-rw-r--r--toolkit/source/awt/vclxwindow.cxx27
-rw-r--r--toolkit/source/awt/vclxwindows.cxx6
-rw-r--r--toolkit/source/controls/unocontrolmodel.cxx7
-rw-r--r--toolkit/source/helper/property.cxx15
-rw-r--r--toolkit/source/helper/throbberimpl.cxx4
-rw-r--r--tools/inc/tools/poly.hxx2
-rw-r--r--tools/inc/tools/solar.h2
-rw-r--r--tools/source/fsys/wntmsc.cxx2
-rw-r--r--tools/source/generic/poly.cxx53
-rw-r--r--tools/source/generic/poly2.cxx17
-rw-r--r--tools/source/stream/strmunx.cxx2
-rw-r--r--transex3/source/directory.cxx17
-rw-r--r--transex3/source/help/HelpLinker.cxx60
-rw-r--r--transex3/source/localize.cxx6
-rw-r--r--vcl/aqua/inc/salgdi.h1
-rwxr-xr-xvcl/aqua/source/gdi/salatslayout.cxx10
-rw-r--r--vcl/aqua/source/gdi/salatsuifontutils.cxx9
-rw-r--r--vcl/aqua/source/gdi/salgdi.cxx6
-rw-r--r--vcl/aqua/source/gdi/salnativewidgets.cxx5
-rwxr-xr-xvcl/aqua/source/window/salframeview.mm4
-rw-r--r--vcl/inc/vcl/bitmapex.hxx13
-rw-r--r--vcl/inc/vcl/button.hxx28
-rw-r--r--vcl/inc/vcl/controldata.hxx60
-rw-r--r--vcl/inc/vcl/ctrl.hxx52
-rw-r--r--vcl/inc/vcl/edit.hxx1
-rw-r--r--vcl/inc/vcl/fixbrd.hxx1
-rw-r--r--vcl/inc/vcl/fixed.hxx13
-rw-r--r--vcl/inc/vcl/group.hxx5
-rw-r--r--vcl/inc/vcl/ilstbox.hxx1
-rw-r--r--vcl/inc/vcl/outdev.hxx25
-rw-r--r--vcl/inc/vcl/pdfwriter.hxx2
-rw-r--r--vcl/inc/vcl/slider.hxx1
-rw-r--r--vcl/inc/vcl/tabctrl.hxx3
-rwxr-xr-xvcl/inc/vcl/textlayout.hxx134
-rw-r--r--vcl/inc/vcl/window.hxx1
-rw-r--r--vcl/os2/source/gdi/salgdi.cxx2
-rw-r--r--vcl/os2/source/window/salframe.cxx6
-rw-r--r--vcl/source/control/button.cxx175
-rw-r--r--vcl/source/control/combobox.cxx6
-rw-r--r--vcl/source/control/ctrl.cxx189
-rw-r--r--vcl/source/control/edit.cxx20
-rw-r--r--vcl/source/control/fixed.cxx108
-rw-r--r--vcl/source/control/group.cxx44
-rw-r--r--vcl/source/control/ilstbox.cxx40
-rw-r--r--vcl/source/control/lstbox.cxx6
-rw-r--r--vcl/source/control/spinfld.cxx4
-rw-r--r--vcl/source/control/tabctrl.cxx74
-rw-r--r--vcl/source/fontsubset/cff.cxx78
-rw-r--r--vcl/source/fontsubset/gsub.cxx8
-rw-r--r--vcl/source/gdi/bitmapex.cxx73
-rw-r--r--vcl/source/gdi/cvtsvm.cxx40
-rw-r--r--vcl/source/gdi/makefile.mk82
-rw-r--r--vcl/source/gdi/metaact.cxx37
-rw-r--r--vcl/source/gdi/outdev3.cxx184
-rw-r--r--vcl/source/gdi/pdfextoutdevdata.cxx13
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx49
-rw-r--r--vcl/source/gdi/region.cxx8
-rwxr-xr-xvcl/source/gdi/sallayout.cxx8
-rw-r--r--vcl/source/gdi/salmisc.cxx8
-rwxr-xr-xvcl/source/gdi/textlayout.cxx384
-rw-r--r--vcl/source/glyphs/gcach_ftyp.cxx10
-rw-r--r--vcl/source/glyphs/graphite_adaptors.cxx10
-rw-r--r--vcl/source/glyphs/makefile.mk3
-rw-r--r--vcl/source/window/menu.cxx24
-rw-r--r--vcl/source/window/status.cxx7
-rw-r--r--vcl/source/window/window.cxx2
-rw-r--r--vcl/unx/gtk/a11y/atkutil.cxx13
-rw-r--r--vcl/unx/gtk/window/gtkframe.cxx16
-rw-r--r--vcl/unx/inc/plugins/gtk/gtkframe.hxx7
-rw-r--r--vcl/unx/kde4/KDESalFrame.cxx28
-rw-r--r--vcl/unx/kde4/KDESalGraphics.cxx2
-rw-r--r--vcl/unx/kde4/KDEXLib.cxx13
-rw-r--r--vcl/unx/source/dtrans/X11_selection.cxx40
-rw-r--r--vcl/win/source/gdi/winlayout.cxx5
-rw-r--r--vcl/win/source/window/salframe.cxx26
-rwxr-xr-xvcl/workben/outdevgrind.cxx12
120 files changed, 2185 insertions, 1222 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/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/goodies/source/filter.vcl/eos2met/eos2met.cxx b/goodies/source/filter.vcl/eos2met/eos2met.cxx
index b176d186a217..e0b6c2bdea43 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 4df7abea01fc..73e321a5b5b3 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/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/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/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/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/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/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/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/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/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/prj/d.lst b/svtools/prj/d.lst
index 3dc9c0b013bb..aebe1dabc908 100644
--- a/svtools/prj/d.lst
+++ b/svtools/prj/d.lst
@@ -210,9 +210,6 @@ mkdir: %_DEST%\inc%_EXT%\svtools
..\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
diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx
index 086e00674a8e..36a798d666cd 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 274557051c27..243856a8e15a 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..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/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 2b212fdcffeb..8312fc432299 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 5be239a5593e..097bba0e39f9 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 68acffc62a74..3a7171090cd2 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 ee3a71c51f9d..95c60f1265c1 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/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index 6bd1126f8082..edddb7c1ab6d 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.
*
@@ -189,7 +188,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 +248,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 +263,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 +299,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 +457,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 +478,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 +608,7 @@ Graphic* EmbeddedObjectRef::GetHCGraphic() const
mpImp->pHCGraphic = pGraphic;
else
delete pGraphic;
+ mpImp->mnGraphicVersion++;
}
delete pStream;
@@ -615,7 +626,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 +636,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 +659,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 +896,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 +932,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 +952,5 @@ void EmbeddedObjectRef::SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM )
xSizeTransmitter->setDefaultSize( mpImp->aDefaultSizeForChart_In_100TH_MM );
}
-}
+} // namespace svt
+
diff --git a/svtools/source/svdde/ddeml1.cxx b/svtools/source/svdde/ddeml1.cxx
index 6cc09b612ecf..4b8011627c7d 100644
--- a/svtools/source/svdde/ddeml1.cxx
+++ b/svtools/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/svtools/source/svdde/ddesvr.cxx b/svtools/source/svdde/ddesvr.cxx
index a2124548b4c8..8c72c1713e90 100644
--- a/svtools/source/svdde/ddesvr.cxx
+++ b/svtools/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/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/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/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..ff5dd437ef52 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 );
}
@@ -817,6 +818,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 +1118,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 +1543,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 +2763,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 );
}
@@ -3762,6 +3767,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
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/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/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 4fe00adc9da0..195a6fd3ce87 100644
--- a/tools/inc/tools/solar.h
+++ b/tools/inc/tools/solar.h
@@ -385,6 +385,8 @@ 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
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 67049df439e1..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;
@@ -476,8 +484,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.
@@ -928,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;
@@ -1014,7 +1024,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;
}
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/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx
index e0905fe1d377..f389abd19a82 100644
--- a/vcl/aqua/source/gdi/salgdi.cxx
+++ b/vcl/aqua/source/gdi/salgdi.cxx
@@ -966,13 +966,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
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/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..b80edf6712cd 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; }
@@ -420,10 +429,10 @@ private:
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,10 +440,15 @@ 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;
public:
SAL_DLLPRIVATE void ImplCheck();
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/edit.hxx b/vcl/inc/vcl/edit.hxx
index 534d63b3427c..fb99bd028631 100644
--- a/vcl/inc/vcl/edit.hxx
+++ b/vcl/inc/vcl/edit.hxx
@@ -124,6 +124,7 @@ private:
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..a5c834fce486 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 );
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/outdev.hxx b/vcl/inc/vcl/outdev.hxx
index f4e42846dd5e..130492a2bd0c 100644
--- a/vcl/inc/vcl/outdev.hxx
+++ b/vcl/inc/vcl/outdev.hxx
@@ -103,8 +103,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
@@ -431,9 +435,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 +464,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 );
@@ -649,10 +658,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,
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/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/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx
index 378459b9eadb..30edf6227a60 100644
--- a/vcl/inc/vcl/tabctrl.hxx
+++ b/vcl/inc/vcl/tabctrl.hxx
@@ -78,6 +78,7 @@ private:
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();
@@ -101,6 +102,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:
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/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/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/control/button.cxx b/vcl/source/control/button.cxx
index e7a4aadb8694..53a060af6bd6 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 );
}
@@ -2225,31 +2218,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 +2411,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 +2431,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 +2563,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 +2839,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 +2894,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 +3142,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 +3324,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 +3388,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 +3514,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 +3529,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 +3627,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 +3784,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 +3839,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 +4085,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 +4227,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();
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..b654e034470f 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 )
@@ -526,8 +526,8 @@ void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool 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 +722,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 +864,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 +1006,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() )
@@ -1637,7 +1637,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 +1858,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 +2648,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() ) )
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index ecb066d107ce..3d19e288a1ce 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 );
}
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..a915d8e6b9e8 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 )
@@ -1900,7 +1900,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 +1978,7 @@ void ImplListBoxWindow::Resize()
if ( bShowFocusRect )
ImplShowFocusRect();
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
}
// -----------------------------------------------------------------------
@@ -2034,7 +2034,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 +2078,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 +2148,7 @@ void ImplListBoxWindow::StateChanged( StateChangedType nType )
ImplInitSettings( FALSE, FALSE, TRUE );
Invalidate();
}
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
}
// -----------------------------------------------------------------------
@@ -2162,7 +2162,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 +2743,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 +2936,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..ceabbe4ab166 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"
@@ -719,7 +719,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 +743,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
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..9a34629ddf8e 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -45,7 +45,7 @@
#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/window.h>
@@ -169,31 +169,25 @@ void TabControl::ImplInit( Window* pParent, WinBits nStyle )
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 +226,9 @@ void TabControl::ImplInitSettings( BOOL bFont,
void TabControl::ImplFreeLayoutData()
{
- if( mpLayoutData )
+ if( HasLayoutData() )
{
- delete mpLayoutData, mpLayoutData = NULL;
+ ImplClearLayoutData();
mpTabCtrlData->maLayoutPageIdToLine.clear();
mpTabCtrlData->maLayoutLineToPageId.clear();
}
@@ -864,9 +858,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 +1004,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 +1038,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
);
}
@@ -2108,17 +2102,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 +2125,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 +2167,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() )
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/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/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/makefile.mk b/vcl/source/gdi/makefile.mk
index a09ae92dcb5e..c77508ea159e 100644
--- a/vcl/source/gdi/makefile.mk
+++ b/vcl/source/gdi/makefile.mk
@@ -51,7 +51,34 @@ 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)$/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)$/textlayout.obj
+
+SLOFILES= $(EXCEPTIONSFILES) \
$(SLO)$/animate.obj \
$(SLO)$/impanmvw.obj \
$(SLO)$/bitmap.obj \
@@ -68,81 +95,30 @@ 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..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 0a7a8b765b6b..b6e0e1b8d441 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -61,6 +61,7 @@
#include <vcl/edit.hxx>
#include <vcl/fontcfg.hxx>
#include <vcl/sysdata.hxx>
+#include <vcl/textlayout.hxx>
#ifndef _OSL_FILE_H
#include <osl/file.h>
#endif
@@ -4835,7 +4836,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 +5258,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 +5296,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 +5305,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 +5409,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 +5423,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 +6160,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 )
@@ -6771,9 +6776,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 +6788,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 +6804,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 +6824,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 +6836,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 +6860,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 +6882,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 +6900,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 +6914,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 +6926,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 +6936,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 +6956,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 +6994,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 +7007,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 +7077,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 +7087,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 +7100,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 +7112,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 +7136,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 +7149,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 +7161,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 +7210,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 +7269,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 +7293,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 +7329,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 +7345,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 +7354,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 +7379,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/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..d4fc6fa27117 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>
@@ -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;
}
@@ -7307,7 +7310,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 +8796,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/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 21ac05a498fc..1f44b823ce44 100755
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -95,11 +95,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 +108,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
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/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/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/window.cxx b/vcl/source/window/window.cxx
index 63bf407ce49f..371f962c45ac 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -9752,6 +9752,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/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 eff7319d6efc..99a331be2318 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
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/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/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..53f822a1e409 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -2158,15 +2158,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 )
@@ -5436,7 +5436,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 +5462,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 +5498,7 @@ static BOOL ImplHandleIMECompositionInput( WinSalFrame* pFrame,
}
aEvt.mpTextAttr = pSalAttrAry;
- delete pAttrBuf;
+ delete [] pAttrBuf;
}
}
@@ -5535,7 +5535,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,