eraser01: merge with DEV300 m70
This commit is contained in:
commit
2d56531153
@ -52,12 +52,22 @@ namespace basegfx
|
||||
B2DHomMatrix(const B2DHomMatrix& rMat);
|
||||
~B2DHomMatrix();
|
||||
|
||||
/** constructor to allow setting all needed values for a 3x2 matrix at once. The
|
||||
parameter f_0x1 e.g. is the same as using set(0, 1, f)
|
||||
*/
|
||||
B2DHomMatrix(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2);
|
||||
|
||||
/// unshare this matrix with all internally shared instances
|
||||
void makeUnique();
|
||||
|
||||
double get(sal_uInt16 nRow, sal_uInt16 nColumn) const;
|
||||
void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue);
|
||||
|
||||
/** allow setting all needed values for a 3x2 matrix in one call. The
|
||||
parameter f_0x1 e.g. is the same as using set(0, 1, f)
|
||||
*/
|
||||
void set3x2(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2);
|
||||
|
||||
// test if last line is default to see if last line needs to be
|
||||
// involved in calculations
|
||||
bool isLastLineDefault() const;
|
||||
|
@ -40,45 +40,190 @@
|
||||
|
||||
namespace basegfx
|
||||
{
|
||||
class DecomposedB2DHomMatrixContainer
|
||||
namespace tools
|
||||
{
|
||||
private:
|
||||
B2DHomMatrix maB2DHomMatrix;
|
||||
B2DVector maScale;
|
||||
B2DVector maTranslate;
|
||||
double mfRotate;
|
||||
double mfShearX;
|
||||
/** If the rotation angle is an approximate multiple of pi/2,
|
||||
force fSin/fCos to -1/0/1, to maintain orthogonality (which
|
||||
might also be advantageous for the other cases, but: for
|
||||
multiples of pi/2, the exact values _can_ be attained. It
|
||||
would be largely unintuitive, if a 180 degrees rotation
|
||||
would introduce slight roundoff errors, instead of exactly
|
||||
mirroring the coordinate system)
|
||||
*/
|
||||
void createSinCosOrthogonal(double& o_rSin, double& rCos, double fRadiant);
|
||||
|
||||
// bitfield
|
||||
unsigned mbDecomposed : 1;
|
||||
/** Tooling methods for on-the-fly matrix generation e.g. for inline
|
||||
multiplications
|
||||
*/
|
||||
B2DHomMatrix createScaleB2DHomMatrix(double fScaleX, double fScaleY);
|
||||
B2DHomMatrix createShearXB2DHomMatrix(double fShearX);
|
||||
B2DHomMatrix createShearYB2DHomMatrix(double fShearY);
|
||||
B2DHomMatrix createRotateB2DHomMatrix(double fRadiant);
|
||||
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY);
|
||||
|
||||
void impCheckDecompose()
|
||||
/// inline versions for parameters as tuples
|
||||
inline B2DHomMatrix createScaleB2DHomMatrix(const B2DTuple& rScale)
|
||||
{
|
||||
if(!mbDecomposed)
|
||||
return createScaleB2DHomMatrix(rScale.getX(), rScale.getY());
|
||||
}
|
||||
|
||||
inline B2DHomMatrix createTranslateB2DHomMatrix(const B2DTuple& rTranslate)
|
||||
{
|
||||
return createTranslateB2DHomMatrix(rTranslate.getX(), rTranslate.getY());
|
||||
}
|
||||
|
||||
/** Tooling methods for faster completely combined matrix creation
|
||||
when scale, shearX, rotation and translation needs to be done in
|
||||
exactly that order. It's faster since it direcly calculates
|
||||
each matrix value based on a symbolic calculation of the three
|
||||
matrix multiplications.
|
||||
Inline versions for parameters as tuples added, too.
|
||||
*/
|
||||
B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(
|
||||
double fScaleX, double fScaleY,
|
||||
double fShearX,
|
||||
double fRadiant,
|
||||
double fTranslateX, double fTranslateY);
|
||||
inline B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(
|
||||
const B2DTuple& rScale,
|
||||
double fShearX,
|
||||
double fRadiant,
|
||||
const B2DTuple& rTranslate)
|
||||
{
|
||||
return createScaleShearXRotateTranslateB2DHomMatrix(
|
||||
rScale.getX(), rScale.getY(),
|
||||
fShearX,
|
||||
fRadiant,
|
||||
rTranslate.getX(), rTranslate.getY());
|
||||
}
|
||||
|
||||
B2DHomMatrix createShearXRotateTranslateB2DHomMatrix(
|
||||
double fShearX,
|
||||
double fRadiant,
|
||||
double fTranslateX, double fTranslateY);
|
||||
inline B2DHomMatrix createShearXRotateTranslateB2DHomMatrix(
|
||||
double fShearX,
|
||||
double fRadiant,
|
||||
const B2DTuple& rTranslate)
|
||||
{
|
||||
return createShearXRotateTranslateB2DHomMatrix(
|
||||
fShearX,
|
||||
fRadiant,
|
||||
rTranslate.getX(), rTranslate.getY());
|
||||
}
|
||||
|
||||
B2DHomMatrix createScaleTranslateB2DHomMatrix(
|
||||
double fScaleX, double fScaleY,
|
||||
double fTranslateX, double fTranslateY);
|
||||
inline B2DHomMatrix createScaleTranslateB2DHomMatrix(
|
||||
const B2DTuple& rScale,
|
||||
const B2DTuple& rTranslate)
|
||||
{
|
||||
return createScaleTranslateB2DHomMatrix(
|
||||
rScale.getX(), rScale.getY(),
|
||||
rTranslate.getX(), rTranslate.getY());
|
||||
}
|
||||
|
||||
/// special for the often used case of rotation around a point
|
||||
B2DHomMatrix createRotateAroundPoint(
|
||||
double fPointX, double fPointY,
|
||||
double fRadiant);
|
||||
inline B2DHomMatrix createRotateAroundPoint(
|
||||
const B2DTuple& rPoint,
|
||||
double fRadiant)
|
||||
{
|
||||
return createRotateAroundPoint(
|
||||
rPoint.getX(), rPoint.getY(),
|
||||
fRadiant);
|
||||
}
|
||||
} // end of namespace tools
|
||||
} // end of namespace basegfx
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace basegfx
|
||||
{
|
||||
namespace tools
|
||||
{
|
||||
class B2DHomMatrixBufferedDecompose
|
||||
{
|
||||
private:
|
||||
B2DVector maScale;
|
||||
B2DVector maTranslate;
|
||||
double mfRotate;
|
||||
double mfShearX;
|
||||
|
||||
public:
|
||||
B2DHomMatrixBufferedDecompose(const B2DHomMatrix& rB2DHomMatrix)
|
||||
: maScale(),
|
||||
maTranslate(),
|
||||
mfRotate(0.0),
|
||||
mfShearX(0.0)
|
||||
{
|
||||
maB2DHomMatrix.decompose(maScale, maTranslate, mfRotate, mfShearX);
|
||||
mbDecomposed = true;
|
||||
rB2DHomMatrix.decompose(maScale, maTranslate, mfRotate, mfShearX);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
DecomposedB2DHomMatrixContainer(const B2DHomMatrix& rB2DHomMatrix)
|
||||
: maB2DHomMatrix(rB2DHomMatrix),
|
||||
maScale(),
|
||||
maTranslate(),
|
||||
mfRotate(0.0),
|
||||
mfShearX(0.0),
|
||||
mbDecomposed(false)
|
||||
// data access
|
||||
B2DHomMatrix getB2DHomMatrix() const
|
||||
{
|
||||
return createScaleShearXRotateTranslateB2DHomMatrix(
|
||||
maScale, mfShearX, mfRotate, maTranslate);
|
||||
}
|
||||
|
||||
const B2DVector& getScale() const { return maScale; }
|
||||
const B2DVector& getTranslate() const { return maTranslate; }
|
||||
double getRotate() const { return mfRotate; }
|
||||
double getShearX() const { return mfShearX; }
|
||||
};
|
||||
} // end of namespace tools
|
||||
} // end of namespace basegfx
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace basegfx
|
||||
{
|
||||
namespace tools
|
||||
{
|
||||
class B2DHomMatrixBufferedOnDemandDecompose
|
||||
{
|
||||
}
|
||||
private:
|
||||
B2DHomMatrix maB2DHomMatrix;
|
||||
B2DVector maScale;
|
||||
B2DVector maTranslate;
|
||||
double mfRotate;
|
||||
double mfShearX;
|
||||
|
||||
// data access
|
||||
const B2DHomMatrix& getB2DHomMatrix() const { return maB2DHomMatrix; }
|
||||
const B2DVector& getScale() const { const_cast< DecomposedB2DHomMatrixContainer* >(this)->impCheckDecompose(); return maScale; }
|
||||
const B2DVector& getTranslate() const { const_cast< DecomposedB2DHomMatrixContainer* >(this)->impCheckDecompose(); return maTranslate; }
|
||||
double getRotate() const { const_cast< DecomposedB2DHomMatrixContainer* >(this)->impCheckDecompose(); return mfRotate; }
|
||||
double getShearX() const { const_cast< DecomposedB2DHomMatrixContainer* >(this)->impCheckDecompose(); return mfShearX; }
|
||||
};
|
||||
// bitfield
|
||||
unsigned mbDecomposed : 1;
|
||||
|
||||
void impCheckDecompose()
|
||||
{
|
||||
if(!mbDecomposed)
|
||||
{
|
||||
maB2DHomMatrix.decompose(maScale, maTranslate, mfRotate, mfShearX);
|
||||
mbDecomposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
B2DHomMatrixBufferedOnDemandDecompose(const B2DHomMatrix& rB2DHomMatrix)
|
||||
: maB2DHomMatrix(rB2DHomMatrix),
|
||||
maScale(),
|
||||
maTranslate(),
|
||||
mfRotate(0.0),
|
||||
mfShearX(0.0),
|
||||
mbDecomposed(false)
|
||||
{
|
||||
}
|
||||
|
||||
// data access
|
||||
const B2DHomMatrix& getB2DHomMatrix() const { return maB2DHomMatrix; }
|
||||
const B2DVector& getScale() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return maScale; }
|
||||
const B2DVector& getTranslate() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return maTranslate; }
|
||||
double getRotate() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return mfRotate; }
|
||||
double getShearX() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return mfShearX; }
|
||||
};
|
||||
} // end of namespace tools
|
||||
} // end of namespace basegfx
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -288,14 +288,6 @@ namespace basegfx
|
||||
*/
|
||||
B2DPolygon createPolygonFromCircle( const B2DPoint& rCenter, double fRadius );
|
||||
|
||||
/** append a unit circle with one point and the control vectors to the given polygon
|
||||
*/
|
||||
void appendUnitCircleQuadrant(B2DPolygon& rPolygon, sal_uInt32 nQuadrant, bool bEndPoint);
|
||||
|
||||
/** append a segment of unit circle with one point and the control vectors to the given polygon
|
||||
*/
|
||||
void appendUnitCircleQuadrantSegment(B2DPolygon& rPolygon, sal_uInt32 nQuadrant, double fStart, double fEnd, bool bEndPoint);
|
||||
|
||||
/** create a polygon which describes the unit circle and close it
|
||||
|
||||
@param nStartQuadrant
|
||||
@ -325,59 +317,6 @@ namespace basegfx
|
||||
*/
|
||||
B2DPolygon createPolygonFromEllipse( const B2DPoint& rCenter, double fRadiusX, double fRadiusY );
|
||||
|
||||
/** append a unit circle with one point and the control vectors to the given polygon
|
||||
*/
|
||||
void appendUnitCircleQuadrant(B2DPolygon& rPolygon, sal_uInt32 nQuadrant);
|
||||
|
||||
/** append a segment of unit circle with start point, the control vectors and end point to the given polygon
|
||||
*/
|
||||
void appendUnitCircleQuadrantSegment(B2DPolygon& rPolygon, sal_uInt32 nQuadrant, double fStart, double fEnd);
|
||||
|
||||
/** Create an ellipse polygon with given radii.
|
||||
|
||||
This method creates an ellipse approximation consisting of
|
||||
four cubic bezier segments, which approximate the given
|
||||
ellipse with an error of less than 0.5 percent.
|
||||
|
||||
@param rCenter
|
||||
Center point of the circle
|
||||
|
||||
@param fRadiusX
|
||||
Radius of the ellipse in X direction
|
||||
|
||||
@param fRadiusY
|
||||
Radius of the ellipse in Y direction
|
||||
|
||||
@param fStart
|
||||
Start angle where the ellipe segment starts in the range [0.0 .. 2PI[
|
||||
|
||||
@param fEnd
|
||||
End angle where the ellipe segment ends in the range [0.0 .. 2PI[
|
||||
*/
|
||||
B2DPolygon createPolygonFromEllipse( const B2DPoint& rCenter, double fRadiusX, double fRadiusY );
|
||||
|
||||
/** Create an ellipse polygon with given radii and the given angles, from start to end
|
||||
|
||||
This method creates an ellipse approximation consisting of
|
||||
four cubic bezier segments, which approximate the given
|
||||
ellipse with an error of less than 0.5 percent.
|
||||
|
||||
@param rCenter
|
||||
Center point of the circle
|
||||
|
||||
@param fRadiusX
|
||||
Radius of the ellipse in X direction
|
||||
|
||||
@param fRadiusY
|
||||
Radius of the ellipse in Y direction
|
||||
|
||||
@param fStart
|
||||
Start angle where the ellipe segment starts in the range [0.0 .. 2PI[
|
||||
|
||||
@param fEnd
|
||||
End angle where the ellipe segment ends in the range [0.0 .. 2PI[
|
||||
*/
|
||||
|
||||
/** Create an unit ellipse polygon with the given angles, from start to end
|
||||
*/
|
||||
B2DPolygon createPolygonFromEllipseSegment( const B2DPoint& rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd );
|
||||
|
@ -36,6 +36,9 @@
|
||||
#include <hommatrixtemplate.hxx>
|
||||
#include <basegfx/tuple/b2dtuple.hxx>
|
||||
#include <basegfx/vector/b2dvector.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace basegfx
|
||||
{
|
||||
@ -60,6 +63,17 @@ namespace basegfx
|
||||
{
|
||||
}
|
||||
|
||||
B2DHomMatrix::B2DHomMatrix(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2)
|
||||
: mpImpl( IdentityMatrix::get() ) // use common identity matrix, will be made unique with 1st set-call
|
||||
{
|
||||
mpImpl->set(0, 0, f_0x0);
|
||||
mpImpl->set(0, 1, f_0x1);
|
||||
mpImpl->set(0, 2, f_0x2);
|
||||
mpImpl->set(1, 0, f_1x0);
|
||||
mpImpl->set(1, 1, f_1x1);
|
||||
mpImpl->set(1, 2, f_1x2);
|
||||
}
|
||||
|
||||
B2DHomMatrix& B2DHomMatrix::operator=(const B2DHomMatrix& rMat)
|
||||
{
|
||||
mpImpl = rMat.mpImpl;
|
||||
@ -81,6 +95,16 @@ namespace basegfx
|
||||
mpImpl->set(nRow, nColumn, fValue);
|
||||
}
|
||||
|
||||
void B2DHomMatrix::set3x2(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2)
|
||||
{
|
||||
mpImpl->set(0, 0, f_0x0);
|
||||
mpImpl->set(0, 1, f_0x1);
|
||||
mpImpl->set(0, 2, f_0x2);
|
||||
mpImpl->set(1, 0, f_1x0);
|
||||
mpImpl->set(1, 1, f_1x1);
|
||||
mpImpl->set(1, 2, f_1x2);
|
||||
}
|
||||
|
||||
bool B2DHomMatrix::isLastLineDefault() const
|
||||
{
|
||||
return mpImpl->isLastLineDefault();
|
||||
@ -206,56 +230,9 @@ namespace basegfx
|
||||
if(!fTools::equalZero(fRadiant))
|
||||
{
|
||||
double fSin(0.0);
|
||||
double fCos(0.0);
|
||||
|
||||
// is the rotation angle an approximate multiple of pi/2?
|
||||
// If yes, force fSin/fCos to -1/0/1, to maintain
|
||||
// orthogonality (which might also be advantageous for the
|
||||
// other cases, but: for multiples of pi/2, the exact
|
||||
// values _can_ be attained. It would be largely
|
||||
// unintuitive, if a 180 degrees rotation would introduce
|
||||
// slight roundoff errors, instead of exactly mirroring
|
||||
// the coordinate system).
|
||||
if( fTools::equalZero( fmod( fRadiant, F_PI2 ) ) )
|
||||
{
|
||||
// determine quadrant
|
||||
const sal_Int32 nQuad(
|
||||
(4 + fround( 4/F_2PI*fmod( fRadiant, F_2PI ) )) % 4 );
|
||||
switch( nQuad )
|
||||
{
|
||||
case 0: // -2pi,0,2pi
|
||||
fSin = 0.0;
|
||||
fCos = 1.0;
|
||||
break;
|
||||
|
||||
case 1: // -3/2pi,1/2pi
|
||||
fSin = 1.0;
|
||||
fCos = 0.0;
|
||||
break;
|
||||
|
||||
case 2: // -pi,pi
|
||||
fSin = 0.0;
|
||||
fCos = -1.0;
|
||||
break;
|
||||
|
||||
case 3: // -1/2pi,3/2pi
|
||||
fSin = -1.0;
|
||||
fCos = 0.0;
|
||||
break;
|
||||
|
||||
default:
|
||||
OSL_ENSURE( false,
|
||||
"B2DHomMatrix::rotate(): Impossible case reached" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO(P1): Maybe use glibc's sincos here (though
|
||||
// that's kinda non-portable...)
|
||||
fSin = sin(fRadiant);
|
||||
fCos = cos(fRadiant);
|
||||
}
|
||||
double fCos(1.0);
|
||||
|
||||
tools::createSinCosOrthogonal(fSin, fCos, fRadiant);
|
||||
Impl2DHomMatrix aRotMat;
|
||||
|
||||
aRotMat.set(0, 0, fCos);
|
||||
@ -474,104 +451,7 @@ namespace basegfx
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Old version: Used 3D decompose when shaer was involved and also a determinant test
|
||||
(but only in that case). Keeping as comment since it also worked and to allow a
|
||||
fallback in case the new version makes trouble somehow. Definitely missing in the 2nd
|
||||
case is the sign correction for Y-Scale, this would need to be added following the above
|
||||
pattern
|
||||
|
||||
bool B2DHomMatrix::decompose(B2DTuple& rScale, B2DTuple& rTranslate, double& rRotate, double& rShearX) const
|
||||
{
|
||||
// when perspective is used, decompose is not made here
|
||||
if(!mpImpl->isLastLineDefault())
|
||||
return false;
|
||||
|
||||
// test for rotation and shear
|
||||
if(fTools::equalZero(get(0, 1))
|
||||
&& fTools::equalZero(get(1, 0)))
|
||||
{
|
||||
// no rotation and shear, direct value extraction
|
||||
rRotate = rShearX = 0.0;
|
||||
|
||||
// copy scale values
|
||||
rScale.setX(get(0, 0));
|
||||
rScale.setY(get(1, 1));
|
||||
|
||||
// copy translation values
|
||||
rTranslate.setX(get(0, 2));
|
||||
rTranslate.setY(get(1, 2));
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// test if shear is zero. That's the case, if the unit vectors in the matrix
|
||||
// are perpendicular -> scalar is zero
|
||||
const ::basegfx::B2DVector aUnitVecX(get(0, 0), get(1, 0));
|
||||
const ::basegfx::B2DVector aUnitVecY(get(0, 1), get(1, 1));
|
||||
|
||||
if(fTools::equalZero(aUnitVecX.scalar(aUnitVecY)))
|
||||
{
|
||||
// no shear, direct value extraction
|
||||
rShearX = 0.0;
|
||||
|
||||
// calculate rotation
|
||||
rShearX = 0.0;
|
||||
rRotate = atan2(aUnitVecX.getY(), aUnitVecX.getX());
|
||||
|
||||
// calculate scale values
|
||||
rScale.setX(aUnitVecX.getLength());
|
||||
rScale.setY(aUnitVecY.getLength());
|
||||
|
||||
// copy translation values
|
||||
rTranslate.setX(get(0, 2));
|
||||
rTranslate.setY(get(1, 2));
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If determinant is zero, decomposition is not possible
|
||||
if(0.0 == determinant())
|
||||
return false;
|
||||
|
||||
// copy 2x2 matrix and translate vector to 3x3 matrix
|
||||
::basegfx::B3DHomMatrix a3DHomMat;
|
||||
|
||||
a3DHomMat.set(0, 0, get(0, 0));
|
||||
a3DHomMat.set(0, 1, get(0, 1));
|
||||
a3DHomMat.set(1, 0, get(1, 0));
|
||||
a3DHomMat.set(1, 1, get(1, 1));
|
||||
a3DHomMat.set(0, 3, get(0, 2));
|
||||
a3DHomMat.set(1, 3, get(1, 2));
|
||||
|
||||
::basegfx::B3DTuple r3DScale, r3DTranslate, r3DRotate, r3DShear;
|
||||
|
||||
if(a3DHomMat.decompose(r3DScale, r3DTranslate, r3DRotate, r3DShear))
|
||||
{
|
||||
// copy scale values
|
||||
rScale.setX(r3DScale.getX());
|
||||
rScale.setY(r3DScale.getY());
|
||||
|
||||
// copy shear
|
||||
rShearX = r3DShear.getX();
|
||||
|
||||
// copy rotate
|
||||
rRotate = r3DRotate.getZ();
|
||||
|
||||
// copy translate
|
||||
rTranslate.setX(r3DTranslate.getX());
|
||||
rTranslate.setY(r3DTranslate.getY());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
} */
|
||||
|
||||
} // end of namespace basegfx
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// eof
|
||||
|
@ -38,6 +38,339 @@
|
||||
|
||||
namespace basegfx
|
||||
{
|
||||
namespace tools
|
||||
{
|
||||
void createSinCosOrthogonal(double& o_rSin, double& o_rCos, double fRadiant)
|
||||
{
|
||||
if( fTools::equalZero( fmod( fRadiant, F_PI2 ) ) )
|
||||
{
|
||||
// determine quadrant
|
||||
const sal_Int32 nQuad(
|
||||
(4 + fround( 4/F_2PI*fmod( fRadiant, F_2PI ) )) % 4 );
|
||||
switch( nQuad )
|
||||
{
|
||||
case 0: // -2pi,0,2pi
|
||||
o_rSin = 0.0;
|
||||
o_rCos = 1.0;
|
||||
break;
|
||||
|
||||
case 1: // -3/2pi,1/2pi
|
||||
o_rSin = 1.0;
|
||||
o_rCos = 0.0;
|
||||
break;
|
||||
|
||||
case 2: // -pi,pi
|
||||
o_rSin = 0.0;
|
||||
o_rCos = -1.0;
|
||||
break;
|
||||
|
||||
case 3: // -1/2pi,3/2pi
|
||||
o_rSin = -1.0;
|
||||
o_rCos = 0.0;
|
||||
break;
|
||||
|
||||
default:
|
||||
OSL_ENSURE( false, "createSinCos: Impossible case reached" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO(P1): Maybe use glibc's sincos here (though
|
||||
// that's kinda non-portable...)
|
||||
o_rSin = sin(fRadiant);
|
||||
o_rCos = cos(fRadiant);
|
||||
}
|
||||
}
|
||||
|
||||
B2DHomMatrix createScaleB2DHomMatrix(double fScaleX, double fScaleY)
|
||||
{
|
||||
B2DHomMatrix aRetval;
|
||||
const double fOne(1.0);
|
||||
|
||||
if(!fTools::equal(fScaleX, fOne))
|
||||
{
|
||||
aRetval.set(0, 0, fScaleX);
|
||||
}
|
||||
|
||||
if(!fTools::equal(fScaleY, fOne))
|
||||
{
|
||||
aRetval.set(1, 1, fScaleY);
|
||||
}
|
||||
|
||||
return aRetval;
|
||||
}
|
||||
|
||||
B2DHomMatrix createShearXB2DHomMatrix(double fShearX)
|
||||
{
|
||||
B2DHomMatrix aRetval;
|
||||
|
||||
if(!fTools::equalZero(fShearX))
|
||||
{
|
||||
aRetval.set(0, 1, fShearX);
|
||||
}
|
||||
|
||||
return aRetval;
|
||||
}
|
||||
|
||||
B2DHomMatrix createShearYB2DHomMatrix(double fShearY)
|
||||
{
|
||||
B2DHomMatrix aRetval;
|
||||
|
||||
if(!fTools::equalZero(fShearY))
|
||||
{
|
||||
aRetval.set(1, 0, fShearY);
|
||||
}
|
||||
|
||||
return aRetval;
|
||||
}
|
||||
|
||||
B2DHomMatrix createRotateB2DHomMatrix(double fRadiant)
|
||||
{
|
||||
B2DHomMatrix aRetval;
|
||||
|
||||
if(!fTools::equalZero(fRadiant))
|
||||
{
|
||||
double fSin(0.0);
|
||||
double fCos(1.0);
|
||||
|
||||
createSinCosOrthogonal(fSin, fCos, fRadiant);
|
||||
aRetval.set(0, 0, fCos);
|
||||
aRetval.set(1, 1, fCos);
|
||||
aRetval.set(1, 0, fSin);
|
||||
aRetval.set(0, 1, -fSin);
|
||||
}
|
||||
|
||||
return aRetval;
|
||||
}
|
||||
|
||||
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
|
||||
{
|
||||
B2DHomMatrix aRetval;
|
||||
|
||||
if(!(fTools::equalZero(fTranslateX) && fTools::equalZero(fTranslateY)))
|
||||
{
|
||||
aRetval.set(0, 2, fTranslateX);
|
||||
aRetval.set(1, 2, fTranslateY);
|
||||
}
|
||||
|
||||
return aRetval;
|
||||
}
|
||||
|
||||
B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(
|
||||
double fScaleX, double fScaleY,
|
||||
double fShearX,
|
||||
double fRadiant,
|
||||
double fTranslateX, double fTranslateY)
|
||||
{
|
||||
const double fOne(1.0);
|
||||
|
||||
if(fTools::equal(fScaleX, fOne) && fTools::equal(fScaleY, fOne))
|
||||
{
|
||||
/// no scale, take shortcut
|
||||
return createShearXRotateTranslateB2DHomMatrix(fShearX, fRadiant, fTranslateX, fTranslateY);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// scale used
|
||||
if(fTools::equalZero(fShearX))
|
||||
{
|
||||
/// no shear
|
||||
if(fTools::equalZero(fRadiant))
|
||||
{
|
||||
/// no rotate, take shortcut
|
||||
return createScaleTranslateB2DHomMatrix(fScaleX, fScaleY, fTranslateX, fTranslateY);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// rotate and scale used, no shear
|
||||
double fSin(0.0);
|
||||
double fCos(1.0);
|
||||
|
||||
createSinCosOrthogonal(fSin, fCos, fRadiant);
|
||||
|
||||
B2DHomMatrix aRetval(
|
||||
/* Row 0, Column 0 */ fCos * fScaleX,
|
||||
/* Row 0, Column 1 */ fScaleY * -fSin,
|
||||
/* Row 0, Column 2 */ fTranslateX,
|
||||
/* Row 1, Column 0 */ fSin * fScaleX,
|
||||
/* Row 1, Column 1 */ fScaleY * fCos,
|
||||
/* Row 1, Column 2 */ fTranslateY);
|
||||
|
||||
return aRetval;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/// scale and shear used
|
||||
if(fTools::equalZero(fRadiant))
|
||||
{
|
||||
/// scale and shear, but no rotate
|
||||
B2DHomMatrix aRetval(
|
||||
/* Row 0, Column 0 */ fScaleX,
|
||||
/* Row 0, Column 1 */ fScaleY * fShearX,
|
||||
/* Row 0, Column 2 */ fTranslateX,
|
||||
/* Row 1, Column 0 */ 0.0,
|
||||
/* Row 1, Column 1 */ fScaleY,
|
||||
/* Row 1, Column 2 */ fTranslateY);
|
||||
|
||||
return aRetval;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// scale, shear and rotate used
|
||||
double fSin(0.0);
|
||||
double fCos(1.0);
|
||||
|
||||
createSinCosOrthogonal(fSin, fCos, fRadiant);
|
||||
|
||||
B2DHomMatrix aRetval(
|
||||
/* Row 0, Column 0 */ fCos * fScaleX,
|
||||
/* Row 0, Column 1 */ fScaleY * ((fCos * fShearX) - fSin),
|
||||
/* Row 0, Column 2 */ fTranslateX,
|
||||
/* Row 1, Column 0 */ fSin * fScaleX,
|
||||
/* Row 1, Column 1 */ fScaleY * ((fSin * fShearX) + fCos),
|
||||
/* Row 1, Column 2 */ fTranslateY);
|
||||
|
||||
return aRetval;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
B2DHomMatrix createShearXRotateTranslateB2DHomMatrix(
|
||||
double fShearX,
|
||||
double fRadiant,
|
||||
double fTranslateX, double fTranslateY)
|
||||
{
|
||||
if(fTools::equalZero(fShearX))
|
||||
{
|
||||
/// no shear
|
||||
if(fTools::equalZero(fRadiant))
|
||||
{
|
||||
/// no shear, no rotate, take shortcut
|
||||
return createTranslateB2DHomMatrix(fTranslateX, fTranslateY);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// no shear, but rotate used
|
||||
double fSin(0.0);
|
||||
double fCos(1.0);
|
||||
|
||||
createSinCosOrthogonal(fSin, fCos, fRadiant);
|
||||
|
||||
B2DHomMatrix aRetval(
|
||||
/* Row 0, Column 0 */ fCos,
|
||||
/* Row 0, Column 1 */ -fSin,
|
||||
/* Row 0, Column 2 */ fTranslateX,
|
||||
/* Row 1, Column 0 */ fSin,
|
||||
/* Row 1, Column 1 */ fCos,
|
||||
/* Row 1, Column 2 */ fTranslateY);
|
||||
|
||||
return aRetval;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/// shear used
|
||||
if(fTools::equalZero(fRadiant))
|
||||
{
|
||||
/// no rotate, but shear used
|
||||
B2DHomMatrix aRetval(
|
||||
/* Row 0, Column 0 */ 1.0,
|
||||
/* Row 0, Column 1 */ fShearX,
|
||||
/* Row 0, Column 2 */ fTranslateX,
|
||||
/* Row 1, Column 0 */ 0.0,
|
||||
/* Row 1, Column 1 */ 1.0,
|
||||
/* Row 1, Column 2 */ fTranslateY);
|
||||
|
||||
return aRetval;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// shear and rotate used
|
||||
double fSin(0.0);
|
||||
double fCos(1.0);
|
||||
|
||||
createSinCosOrthogonal(fSin, fCos, fRadiant);
|
||||
|
||||
B2DHomMatrix aRetval(
|
||||
/* Row 0, Column 0 */ fCos,
|
||||
/* Row 0, Column 1 */ (fCos * fShearX) - fSin,
|
||||
/* Row 0, Column 2 */ fTranslateX,
|
||||
/* Row 1, Column 0 */ fSin,
|
||||
/* Row 1, Column 1 */ (fSin * fShearX) + fCos,
|
||||
/* Row 1, Column 2 */ fTranslateY);
|
||||
|
||||
return aRetval;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
B2DHomMatrix createScaleTranslateB2DHomMatrix(
|
||||
double fScaleX, double fScaleY,
|
||||
double fTranslateX, double fTranslateY)
|
||||
{
|
||||
const double fOne(1.0);
|
||||
|
||||
if(fTools::equal(fScaleX, fOne) && fTools::equal(fScaleY, fOne))
|
||||
{
|
||||
/// no scale, take shortcut
|
||||
return createTranslateB2DHomMatrix(fTranslateX, fTranslateY);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// scale used
|
||||
if(fTools::equalZero(fTranslateX) && fTools::equalZero(fTranslateY))
|
||||
{
|
||||
/// no translate, but scale.
|
||||
B2DHomMatrix aRetval;
|
||||
|
||||
aRetval.set(0, 0, fScaleX);
|
||||
aRetval.set(1, 1, fScaleY);
|
||||
|
||||
return aRetval;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// translate and scale
|
||||
B2DHomMatrix aRetval(
|
||||
/* Row 0, Column 0 */ fScaleX,
|
||||
/* Row 0, Column 1 */ 0.0,
|
||||
/* Row 0, Column 2 */ fTranslateX,
|
||||
/* Row 1, Column 0 */ 0.0,
|
||||
/* Row 1, Column 1 */ fScaleY,
|
||||
/* Row 1, Column 2 */ fTranslateY);
|
||||
|
||||
return aRetval;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
B2DHomMatrix createRotateAroundPoint(
|
||||
double fPointX, double fPointY,
|
||||
double fRadiant)
|
||||
{
|
||||
B2DHomMatrix aRetval;
|
||||
|
||||
if(!fTools::equalZero(fRadiant))
|
||||
{
|
||||
double fSin(0.0);
|
||||
double fCos(1.0);
|
||||
|
||||
createSinCosOrthogonal(fSin, fCos, fRadiant);
|
||||
|
||||
aRetval.set3x2(
|
||||
/* Row 0, Column 0 */ fCos,
|
||||
/* Row 0, Column 1 */ -fSin,
|
||||
/* Row 0, Column 2 */ (fPointX * (1.0 - fCos)) + (fSin * fPointY),
|
||||
/* Row 1, Column 0 */ fSin,
|
||||
/* Row 1, Column 1 */ fCos,
|
||||
/* Row 1, Column 2 */ (fPointY * (1.0 - fCos)) - (fSin * fPointX));
|
||||
}
|
||||
|
||||
return aRetval;
|
||||
}
|
||||
} // end of namespace tools
|
||||
} // end of namespace basegfx
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <basegfx/range/b2drange.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrix.hxx>
|
||||
#include <basegfx/curve/b2dcubicbezier.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -85,11 +86,9 @@ namespace basegfx
|
||||
// get size of the arrow
|
||||
const B2DRange aArrowSize(getRange(rArrow));
|
||||
|
||||
// build ArrowTransform
|
||||
B2DHomMatrix aArrowTransform;
|
||||
|
||||
// center in X, align with axis in Y
|
||||
aArrowTransform.translate(-aArrowSize.getCenter().getX(), -aArrowSize.getMinimum().getY());
|
||||
// build ArrowTransform; center in X, align with axis in Y
|
||||
B2DHomMatrix aArrowTransform(basegfx::tools::createTranslateB2DHomMatrix(
|
||||
-aArrowSize.getCenter().getX(), -aArrowSize.getMinimum().getY()));
|
||||
|
||||
// scale to target size
|
||||
const double fArrowScale(fWidth / (aArrowSize.getRange().getX()));
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <basegfx/polygon/b2dpolypolygontools.hxx>
|
||||
#include <basegfx/curve/b2dcubicbezier.hxx>
|
||||
#include <basegfx/tools/rectcliptools.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -361,11 +362,10 @@ namespace basegfx
|
||||
else if(rCandidate.count())
|
||||
{
|
||||
const B2DVector aEdge(rPointB - rPointA);
|
||||
B2DHomMatrix aMatrixTransform;
|
||||
B2DPolygon aCandidate(rCandidate);
|
||||
|
||||
// translate and rotate polygon so that given edge is on x axis
|
||||
aMatrixTransform.translate(-rPointA.getX(), -rPointA.getY());
|
||||
B2DHomMatrix aMatrixTransform(basegfx::tools::createTranslateB2DHomMatrix(-rPointA.getX(), -rPointA.getY()));
|
||||
aMatrixTransform.rotate(-atan2(aEdge.getY(), aEdge.getX()));
|
||||
aCandidate.transform(aMatrixTransform);
|
||||
|
||||
@ -395,11 +395,10 @@ namespace basegfx
|
||||
else if(rCandidate.count())
|
||||
{
|
||||
const B2DVector aEdge(rPointB - rPointA);
|
||||
B2DHomMatrix aMatrixTransform;
|
||||
B2DPolyPolygon aCandidate(rCandidate);
|
||||
|
||||
// translate and rotate polygon so that given edge is on x axis
|
||||
aMatrixTransform.translate(-rPointA.getX(), -rPointA.getY());
|
||||
B2DHomMatrix aMatrixTransform(basegfx::tools::createTranslateB2DHomMatrix(-rPointA.getX(), -rPointA.getY()));
|
||||
aMatrixTransform.rotate(-atan2(aEdge.getY(), aEdge.getX()));
|
||||
aCandidate.transform(aMatrixTransform);
|
||||
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include <basegfx/polygon/b2dpolygontools.hxx>
|
||||
#include <osl/diagnose.h>
|
||||
#include <rtl/math.hxx>
|
||||
|
||||
#include <basegfx/polygon/b2dpolygon.hxx>
|
||||
#include <basegfx/polygon/b2dpolypolygon.hxx>
|
||||
#include <basegfx/range/b2drange.hxx>
|
||||
@ -43,6 +42,8 @@
|
||||
#include <basegfx/matrix/b3dhommatrix.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrix.hxx>
|
||||
#include <basegfx/curve/b2dbeziertools.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
#include <osl/mutex.hxx>
|
||||
|
||||
#include <numeric>
|
||||
#include <limits>
|
||||
@ -54,6 +55,7 @@
|
||||
#ifdef DBG_UTIL
|
||||
static double fAngleBoundStartValue = ANGLE_BOUND_START_VALUE;
|
||||
#endif
|
||||
#define STEPSPERQUARTER (3)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -1840,145 +1842,106 @@ namespace basegfx
|
||||
return createPolygonFromEllipse( rCenter, fRadius, fRadius );
|
||||
}
|
||||
|
||||
void appendUnitCircleQuadrant(B2DPolygon& rPolygon, sal_uInt32 nQuadrant)
|
||||
B2DPolygon impCreateUnitCircle(sal_uInt32 nStartQuadrant)
|
||||
{
|
||||
const double fZero(0.0);
|
||||
const double fOne(1.0);
|
||||
B2DPolygon aUnitCircle;
|
||||
const double fKappa((M_SQRT2 - 1.0) * 4.0 / 3.0);
|
||||
const double fScaledKappa(fKappa * (1.0 / STEPSPERQUARTER));
|
||||
const B2DHomMatrix aRotateMatrix(createRotateB2DHomMatrix(F_PI2 / STEPSPERQUARTER));
|
||||
|
||||
// create closed unit-circle with 4 segments
|
||||
switch(nQuadrant)
|
||||
B2DPoint aPoint(1.0, 0.0);
|
||||
B2DPoint aForward(1.0, fScaledKappa);
|
||||
B2DPoint aBackward(1.0, -fScaledKappa);
|
||||
|
||||
if(0 != nStartQuadrant)
|
||||
{
|
||||
case 0 : // first quadrant
|
||||
{
|
||||
rPolygon.append(B2DPoint(fOne, fZero));
|
||||
rPolygon.appendBezierSegment(B2DPoint(fOne, fKappa), B2DPoint(fKappa, fOne), B2DPoint(fZero, fOne));
|
||||
break;
|
||||
}
|
||||
case 1 : // second quadrant
|
||||
{
|
||||
rPolygon.append(B2DPoint(fZero, fOne));
|
||||
rPolygon.appendBezierSegment(B2DPoint(-fKappa, fOne), B2DPoint(-fOne, fKappa), B2DPoint(-fOne, fZero));
|
||||
break;
|
||||
}
|
||||
case 2 : // third quadrant
|
||||
{
|
||||
rPolygon.append(B2DPoint(-fOne, fZero));
|
||||
rPolygon.appendBezierSegment(B2DPoint(-fOne, -fKappa), B2DPoint(-fKappa, -fOne), B2DPoint(fZero, -fOne));
|
||||
break;
|
||||
}
|
||||
default : // last quadrant
|
||||
{
|
||||
rPolygon.append(B2DPoint(fZero, -fOne));
|
||||
rPolygon.appendBezierSegment(B2DPoint(fKappa, -fOne), B2DPoint(fOne, -fKappa), B2DPoint(fOne, fZero));
|
||||
break;
|
||||
}
|
||||
const B2DHomMatrix aQuadrantMatrix(createRotateB2DHomMatrix(F_PI2 * (nStartQuadrant % 4)));
|
||||
aPoint *= aQuadrantMatrix;
|
||||
aBackward *= aQuadrantMatrix;
|
||||
aForward *= aQuadrantMatrix;
|
||||
}
|
||||
|
||||
aUnitCircle.append(aPoint);
|
||||
|
||||
for(sal_uInt32 a(0); a < STEPSPERQUARTER * 4; a++)
|
||||
{
|
||||
aPoint *= aRotateMatrix;
|
||||
aBackward *= aRotateMatrix;
|
||||
aUnitCircle.appendBezierSegment(aForward, aBackward, aPoint);
|
||||
aForward *= aRotateMatrix;
|
||||
}
|
||||
|
||||
aUnitCircle.setClosed(true);
|
||||
aUnitCircle.removeDoublePoints();
|
||||
|
||||
return aUnitCircle;
|
||||
}
|
||||
|
||||
B2DPolygon createPolygonFromUnitCircle(sal_uInt32 nStartQuadrant)
|
||||
{
|
||||
B2DPolygon aRetval;
|
||||
switch(nStartQuadrant % 4)
|
||||
{
|
||||
case 1 :
|
||||
{
|
||||
static B2DPolygon aUnitCircleStartQuadrantOne;
|
||||
|
||||
// create unit-circle with all 4 segments, close it
|
||||
appendUnitCircleQuadrant(aRetval, nStartQuadrant % 4); nStartQuadrant++;
|
||||
appendUnitCircleQuadrant(aRetval, nStartQuadrant % 4); nStartQuadrant++;
|
||||
appendUnitCircleQuadrant(aRetval, nStartQuadrant % 4); nStartQuadrant++;
|
||||
appendUnitCircleQuadrant(aRetval, nStartQuadrant % 4); nStartQuadrant++;
|
||||
aRetval.setClosed(true);
|
||||
if(!aUnitCircleStartQuadrantOne.count())
|
||||
{
|
||||
::osl::Mutex m_mutex;
|
||||
aUnitCircleStartQuadrantOne = impCreateUnitCircle(1);
|
||||
}
|
||||
|
||||
// remove double points between segments created by segmented creation
|
||||
aRetval.removeDoublePoints();
|
||||
return aUnitCircleStartQuadrantOne;
|
||||
}
|
||||
case 2 :
|
||||
{
|
||||
static B2DPolygon aUnitCircleStartQuadrantTwo;
|
||||
|
||||
return aRetval;
|
||||
if(!aUnitCircleStartQuadrantTwo.count())
|
||||
{
|
||||
::osl::Mutex m_mutex;
|
||||
aUnitCircleStartQuadrantTwo = impCreateUnitCircle(2);
|
||||
}
|
||||
|
||||
return aUnitCircleStartQuadrantTwo;
|
||||
}
|
||||
case 3 :
|
||||
{
|
||||
static B2DPolygon aUnitCircleStartQuadrantThree;
|
||||
|
||||
if(!aUnitCircleStartQuadrantThree.count())
|
||||
{
|
||||
::osl::Mutex m_mutex;
|
||||
aUnitCircleStartQuadrantThree = impCreateUnitCircle(3);
|
||||
}
|
||||
|
||||
return aUnitCircleStartQuadrantThree;
|
||||
}
|
||||
default : // case 0 :
|
||||
{
|
||||
static B2DPolygon aUnitCircleStartQuadrantZero;
|
||||
|
||||
if(!aUnitCircleStartQuadrantZero.count())
|
||||
{
|
||||
::osl::Mutex m_mutex;
|
||||
aUnitCircleStartQuadrantZero = impCreateUnitCircle(0);
|
||||
}
|
||||
|
||||
return aUnitCircleStartQuadrantZero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
B2DPolygon createPolygonFromEllipse( const B2DPoint& rCenter, double fRadiusX, double fRadiusY )
|
||||
{
|
||||
const double fOne(1.0);
|
||||
B2DPolygon aRetval(createPolygonFromUnitCircle());
|
||||
const B2DHomMatrix aMatrix(createScaleTranslateB2DHomMatrix(fRadiusX, fRadiusY, rCenter.getX(), rCenter.getY()));
|
||||
|
||||
// transformation necessary?
|
||||
const sal_Bool bScale(!fTools::equal(fRadiusX, fOne) || !fTools::equal(fRadiusY, fOne));
|
||||
const sal_Bool bTranslate(!rCenter.equalZero());
|
||||
|
||||
if(bScale || bTranslate)
|
||||
{
|
||||
B2DHomMatrix aMatrix;
|
||||
|
||||
if(bScale)
|
||||
{
|
||||
aMatrix.scale(fRadiusX, fRadiusY);
|
||||
}
|
||||
|
||||
if(bTranslate)
|
||||
{
|
||||
aMatrix.translate(rCenter.getX(), rCenter.getY());
|
||||
}
|
||||
|
||||
aRetval.transform(aMatrix);
|
||||
}
|
||||
aRetval.transform(aMatrix);
|
||||
|
||||
return aRetval;
|
||||
}
|
||||
|
||||
void appendUnitCircleQuadrantSegment(B2DPolygon& rPolygon, sal_uInt32 nQuadrant, double fStart, double fEnd)
|
||||
{
|
||||
OSL_ENSURE(fStart >= 0.0 && fStart <= 1.0, "appendUnitCircleQuadrantSegment: Access out of range (!)");
|
||||
OSL_ENSURE(fEnd >= 0.0 && fEnd <= 1.0, "appendUnitCircleQuadrantSegment: Access out of range (!)");
|
||||
OSL_ENSURE(fEnd >= fStart, "appendUnitCircleQuadrantSegment: Access out of range (!)");
|
||||
const double fOne(1.0);
|
||||
const bool bStartIsZero(fTools::equalZero(fStart));
|
||||
const bool bEndIsOne(fTools::equal(fEnd, fOne));
|
||||
|
||||
if(bStartIsZero && bEndIsOne)
|
||||
{
|
||||
// add completely
|
||||
appendUnitCircleQuadrant(rPolygon, nQuadrant);
|
||||
}
|
||||
else
|
||||
{
|
||||
// split and add
|
||||
B2DPolygon aQuadrant;
|
||||
appendUnitCircleQuadrant(aQuadrant, nQuadrant);
|
||||
const bool bStartEndEqual(fTools::equal(fStart, fEnd));
|
||||
|
||||
if(bStartEndEqual)
|
||||
{
|
||||
if(bStartIsZero)
|
||||
{
|
||||
// both zero, add start point
|
||||
rPolygon.append(aQuadrant.getB2DPoint(0L));
|
||||
}
|
||||
else if(bEndIsOne)
|
||||
{
|
||||
// both one, add end point
|
||||
rPolygon.append(aQuadrant.getB2DPoint(1L));
|
||||
}
|
||||
else
|
||||
{
|
||||
// both equal but not zero, add split point
|
||||
B2DCubicBezier aCubicBezier(
|
||||
aQuadrant.getB2DPoint(0L), aQuadrant.getNextControlPoint(0L),
|
||||
aQuadrant.getPrevControlPoint(1L), aQuadrant.getB2DPoint(1L));
|
||||
|
||||
aCubicBezier.split(fStart, &aCubicBezier, 0);
|
||||
rPolygon.append(aCubicBezier.getEndPoint());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
B2DCubicBezier aCubicBezier(
|
||||
aQuadrant.getB2DPoint(0L), aQuadrant.getNextControlPoint(0L),
|
||||
aQuadrant.getPrevControlPoint(1L), aQuadrant.getB2DPoint(1L));
|
||||
|
||||
aCubicBezier = aCubicBezier.snippet(fStart, fEnd);
|
||||
rPolygon.append(aCubicBezier.getStartPoint());
|
||||
rPolygon.appendBezierSegment(aCubicBezier.getControlPointA(), aCubicBezier.getControlPointB(), aCubicBezier.getEndPoint());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
B2DPolygon createPolygonFromUnitEllipseSegment( double fStart, double fEnd )
|
||||
{
|
||||
B2DPolygon aRetval;
|
||||
@ -2005,49 +1968,74 @@ namespace basegfx
|
||||
fEnd = 0.0;
|
||||
}
|
||||
|
||||
const sal_uInt32 nQuadrantStart(sal_uInt32(fStart / F_PI2) % 4L);
|
||||
const sal_uInt32 nQuadrantEnd(sal_uInt32(fEnd / F_PI2) % 4L);
|
||||
sal_uInt32 nCurrentQuadrant(nQuadrantStart);
|
||||
bool bStartDone(false);
|
||||
bool bEndDone(false);
|
||||
|
||||
do
|
||||
if(fTools::equal(fStart, fEnd))
|
||||
{
|
||||
if(!bStartDone && nQuadrantStart == nCurrentQuadrant)
|
||||
// same start and end angle, add single point
|
||||
aRetval.append(B2DPoint(cos(fStart), sin(fStart)));
|
||||
}
|
||||
else
|
||||
{
|
||||
const sal_uInt32 nSegments(STEPSPERQUARTER * 4);
|
||||
const double fAnglePerSegment(F_PI2 / STEPSPERQUARTER);
|
||||
const sal_uInt32 nStartSegment(sal_uInt32(fStart / fAnglePerSegment) % nSegments);
|
||||
const sal_uInt32 nEndSegment(sal_uInt32(fEnd / fAnglePerSegment) % nSegments);
|
||||
const double fKappa((M_SQRT2 - 1.0) * 4.0 / 3.0);
|
||||
const double fScaledKappa(fKappa * (1.0 / STEPSPERQUARTER));
|
||||
|
||||
B2DPoint aSegStart(cos(fStart), sin(fStart));
|
||||
aRetval.append(aSegStart);
|
||||
|
||||
if(nStartSegment == nEndSegment && fTools::more(fEnd, fStart))
|
||||
{
|
||||
if(nQuadrantStart == nQuadrantEnd && fTools::moreOrEqual(fEnd, fStart))
|
||||
{
|
||||
// both in one quadrant and defining the complete segment, create start to end
|
||||
double fSplitOffsetStart((fStart - (nCurrentQuadrant * F_PI2)) / F_PI2);
|
||||
double fSplitOffsetEnd((fEnd - (nCurrentQuadrant * F_PI2)) / F_PI2);
|
||||
appendUnitCircleQuadrantSegment(aRetval, nCurrentQuadrant, fSplitOffsetStart, fSplitOffsetEnd);
|
||||
bStartDone = bEndDone = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// create start to quadrant end
|
||||
const double fSplitOffsetStart((fStart - (nCurrentQuadrant * F_PI2)) / F_PI2);
|
||||
appendUnitCircleQuadrantSegment(aRetval, nCurrentQuadrant, fSplitOffsetStart, 1.0);
|
||||
bStartDone = true;
|
||||
}
|
||||
}
|
||||
else if(!bEndDone && nQuadrantEnd == nCurrentQuadrant)
|
||||
{
|
||||
// create quadrant start to end
|
||||
const double fSplitOffsetEnd((fEnd - (nCurrentQuadrant * F_PI2)) / F_PI2);
|
||||
appendUnitCircleQuadrantSegment(aRetval, nCurrentQuadrant, 0.0, fSplitOffsetEnd);
|
||||
bEndDone = true;
|
||||
// start and end in one sector and in the right order, create in one segment
|
||||
const B2DPoint aSegEnd(cos(fEnd), sin(fEnd));
|
||||
const double fFactor(fScaledKappa * ((fEnd - fStart) / fAnglePerSegment));
|
||||
|
||||
aRetval.appendBezierSegment(
|
||||
aSegStart + (B2DPoint(-aSegStart.getY(), aSegStart.getX()) * fFactor),
|
||||
aSegEnd - (B2DPoint(-aSegEnd.getY(), aSegEnd.getX()) * fFactor),
|
||||
aSegEnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
// add quadrant completely
|
||||
appendUnitCircleQuadrant(aRetval, nCurrentQuadrant);
|
||||
}
|
||||
double fSegEndRad((nStartSegment + 1) * fAnglePerSegment);
|
||||
double fFactor(fScaledKappa * ((fSegEndRad - fStart) / fAnglePerSegment));
|
||||
B2DPoint aSegEnd(cos(fSegEndRad), sin(fSegEndRad));
|
||||
|
||||
// next step
|
||||
nCurrentQuadrant = (nCurrentQuadrant + 1L) % 4L;
|
||||
aRetval.appendBezierSegment(
|
||||
aSegStart + (B2DPoint(-aSegStart.getY(), aSegStart.getX()) * fFactor),
|
||||
aSegEnd - (B2DPoint(-aSegEnd.getY(), aSegEnd.getX()) * fFactor),
|
||||
aSegEnd);
|
||||
|
||||
sal_uInt32 nSegment((nStartSegment + 1) % nSegments);
|
||||
aSegStart = aSegEnd;
|
||||
|
||||
while(nSegment != nEndSegment)
|
||||
{
|
||||
// No end in this sector, add full sector.
|
||||
fSegEndRad = (nSegment + 1) * fAnglePerSegment;
|
||||
aSegEnd = B2DPoint(cos(fSegEndRad), sin(fSegEndRad));
|
||||
|
||||
aRetval.appendBezierSegment(
|
||||
aSegStart + (B2DPoint(-aSegStart.getY(), aSegStart.getX()) * fScaledKappa),
|
||||
aSegEnd - (B2DPoint(-aSegEnd.getY(), aSegEnd.getX()) * fScaledKappa),
|
||||
aSegEnd);
|
||||
|
||||
nSegment = (nSegment + 1) % nSegments;
|
||||
aSegStart = aSegEnd;
|
||||
}
|
||||
|
||||
// End in this sector
|
||||
const double fSegStartRad(nSegment * fAnglePerSegment);
|
||||
fFactor = fScaledKappa * ((fEnd - fSegStartRad) / fAnglePerSegment);
|
||||
aSegEnd = B2DPoint(cos(fEnd), sin(fEnd));
|
||||
|
||||
aRetval.appendBezierSegment(
|
||||
aSegStart + (B2DPoint(-aSegStart.getY(), aSegStart.getX()) * fFactor),
|
||||
aSegEnd - (B2DPoint(-aSegEnd.getY(), aSegEnd.getX()) * fFactor),
|
||||
aSegEnd);
|
||||
}
|
||||
}
|
||||
while(!(bStartDone && bEndDone));
|
||||
|
||||
// remove double points between segments created by segmented creation
|
||||
aRetval.removeDoublePoints();
|
||||
@ -2058,28 +2046,9 @@ namespace basegfx
|
||||
B2DPolygon createPolygonFromEllipseSegment( const B2DPoint& rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd )
|
||||
{
|
||||
B2DPolygon aRetval(createPolygonFromUnitEllipseSegment(fStart, fEnd));
|
||||
const B2DHomMatrix aMatrix(createScaleTranslateB2DHomMatrix(fRadiusX, fRadiusY, rCenter.getX(), rCenter.getY()));
|
||||
|
||||
// transformation necessary?
|
||||
const double fOne(1.0);
|
||||
const sal_Bool bScale(!fTools::equal(fRadiusX, fOne) || !fTools::equal(fRadiusY, fOne));
|
||||
const sal_Bool bTranslate(!rCenter.equalZero());
|
||||
|
||||
if(bScale || bTranslate)
|
||||
{
|
||||
B2DHomMatrix aMatrix;
|
||||
|
||||
if(bScale)
|
||||
{
|
||||
aMatrix.scale(fRadiusX, fRadiusY);
|
||||
}
|
||||
|
||||
if(bTranslate)
|
||||
{
|
||||
aMatrix.translate(rCenter.getX(), rCenter.getY());
|
||||
}
|
||||
|
||||
aRetval.transform(aMatrix);
|
||||
}
|
||||
aRetval.transform(aMatrix);
|
||||
|
||||
return aRetval;
|
||||
}
|
||||
@ -2709,11 +2678,7 @@ namespace basegfx
|
||||
|
||||
if(nPointCount)
|
||||
{
|
||||
B2DHomMatrix aMatrix;
|
||||
|
||||
aMatrix.translate(-rCenter.getX(), -rCenter.getY());
|
||||
aMatrix.rotate(fAngle);
|
||||
aMatrix.translate(rCenter.getX(), rCenter.getY());
|
||||
const B2DHomMatrix aMatrix(basegfx::tools::createRotateAroundPoint(rCenter, fAngle));
|
||||
|
||||
aRetval.transform(aMatrix);
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <basegfx/polygon/b2dpolygontools.hxx>
|
||||
#include <basegfx/polygon/b2dpolypolygon.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrix.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
#include <rtl/ustring.hxx>
|
||||
#include <rtl/math.hxx>
|
||||
|
||||
@ -705,7 +706,7 @@ namespace basegfx
|
||||
// |y1'| = |-sin phi cos phi| |(y1 - y2)/2|
|
||||
const B2DPoint p1(nLastX, nLastY);
|
||||
const B2DPoint p2(nX, nY);
|
||||
B2DHomMatrix aTransform; aTransform.rotate(-fPhi*M_PI/180);
|
||||
B2DHomMatrix aTransform(basegfx::tools::createRotateB2DHomMatrix(-fPhi*M_PI/180));
|
||||
|
||||
const B2DPoint p1_prime( aTransform * B2DPoint(((p1-p2)/2.0)) );
|
||||
|
||||
@ -797,8 +798,7 @@ namespace basegfx
|
||||
fTheta1, fTheta2 ));
|
||||
|
||||
// transform ellipse by rotation & move to final center
|
||||
aTransform.identity();
|
||||
aTransform.scale(fRX,fRY);
|
||||
aTransform = basegfx::tools::createScaleB2DHomMatrix(fRX, fRY);
|
||||
aTransform.translate(aCenter_prime.getX(),
|
||||
aCenter_prime.getY());
|
||||
aTransform.rotate(fPhi*M_PI/180);
|
||||
|
@ -32,9 +32,9 @@
|
||||
#include "precompiled_basegfx.hxx"
|
||||
|
||||
#include <basegfx/tools/gradienttools.hxx>
|
||||
|
||||
#include <basegfx/point/b2dpoint.hxx>
|
||||
#include <basegfx/range/b2drange.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
|
||||
namespace basegfx
|
||||
{
|
||||
@ -79,9 +79,8 @@ namespace basegfx
|
||||
B2DPoint aCenter(0.5, 0.5);
|
||||
aCenter *= o_rGradientInfo.maTextureTransform;
|
||||
|
||||
o_rGradientInfo.maTextureTransform.translate(-aCenter.getX(), -aCenter.getY());
|
||||
o_rGradientInfo.maTextureTransform.rotate(fAngle);
|
||||
o_rGradientInfo.maTextureTransform.translate(aCenter.getX(), aCenter.getY());
|
||||
o_rGradientInfo.maTextureTransform = basegfx::tools::createRotateAroundPoint(aCenter, fAngle)
|
||||
* o_rGradientInfo.maTextureTransform;
|
||||
}
|
||||
|
||||
// add object translate
|
||||
@ -158,9 +157,8 @@ namespace basegfx
|
||||
B2DPoint aCenter(0.5, 0.5);
|
||||
aCenter *= o_rGradientInfo.maTextureTransform;
|
||||
|
||||
o_rGradientInfo.maTextureTransform.translate(-aCenter.getX(), -aCenter.getY());
|
||||
o_rGradientInfo.maTextureTransform.rotate(fAngle);
|
||||
o_rGradientInfo.maTextureTransform.translate(aCenter.getX(), aCenter.getY());
|
||||
o_rGradientInfo.maTextureTransform = basegfx::tools::createRotateAroundPoint(aCenter, fAngle)
|
||||
* o_rGradientInfo.maTextureTransform;
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,9 +230,8 @@ namespace basegfx
|
||||
B2DPoint aCenter(0.5, 0.5);
|
||||
aCenter *= o_rGradientInfo.maTextureTransform;
|
||||
|
||||
o_rGradientInfo.maTextureTransform.translate(-aCenter.getX(), -aCenter.getY());
|
||||
o_rGradientInfo.maTextureTransform.rotate(fAngle);
|
||||
o_rGradientInfo.maTextureTransform.translate(aCenter.getX(), aCenter.getY());
|
||||
o_rGradientInfo.maTextureTransform = basegfx::tools::createRotateAroundPoint(aCenter, fAngle)
|
||||
* o_rGradientInfo.maTextureTransform;
|
||||
}
|
||||
|
||||
// add defined offsets after rotation
|
||||
|
@ -44,8 +44,8 @@
|
||||
#include <basegfx/tools/canvastools.hxx>
|
||||
#include <basegfx/polygon/b2dpolygon.hxx>
|
||||
#include <basegfx/polygon/b2dpolypolygontools.hxx>
|
||||
|
||||
#include <basegfx/tools/unopolypolygon.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
@ -138,9 +138,7 @@ namespace unotools
|
||||
|
||||
if( !aOffset.equalZero() )
|
||||
{
|
||||
B2DHomMatrix aTranslate;
|
||||
aTranslate.translate( aOffset.getX(), aOffset.getY() );
|
||||
|
||||
const B2DHomMatrix aTranslate(tools::createTranslateB2DHomMatrix(aOffset));
|
||||
aSrcPoly.transform( aTranslate );
|
||||
}
|
||||
|
||||
|
@ -484,8 +484,13 @@ public:
|
||||
}
|
||||
while ( nIndex >= 0 );
|
||||
|
||||
// Adapted number of spaces to 50 and 67 because of the new circle construction
|
||||
// methods which produce more points and thus more spaces, too. Use both since
|
||||
// depending on float precision and the getContinuity() implemetation using
|
||||
// fTools::equal, linux and mac produce more 'C' than 'S' statements, while WIN32
|
||||
// uses more 'S' statements (as it should be for circles)
|
||||
CPPUNIT_ASSERT_MESSAGE("exporting to circle does not produce the expected number of coordinates",
|
||||
nCount==18);
|
||||
nCount==67 || nCount==50);
|
||||
|
||||
const B2DPolygon aRect(
|
||||
tools::createPolygonFromRect( B2DRange(0.0,0.0,4000.0,4000.0) ));
|
||||
|
@ -958,6 +958,7 @@ namespace cairocanvas
|
||||
|
||||
void CanvasHelper::doPolyPolygonPath( const uno::Reference< rendering::XPolyPolygon2D >& xPolyPolygon,
|
||||
Operation aOperation,
|
||||
bool bNoLineJoin,
|
||||
const uno::Sequence< rendering::Texture >* pTextures,
|
||||
Cairo* pCairo ) const
|
||||
{
|
||||
@ -967,10 +968,47 @@ namespace cairocanvas
|
||||
if( !pCairo )
|
||||
pCairo = mpCairo.get();
|
||||
|
||||
doPolyPolygonImplementation( rPolyPoly, aOperation,
|
||||
pCairo, pTextures,
|
||||
mpSurfaceProvider,
|
||||
xPolyPolygon->getFillRule() );
|
||||
if(bNoLineJoin && Stroke == aOperation)
|
||||
{
|
||||
// emulate rendering::PathJoinType::NONE by painting single edges
|
||||
for(sal_uInt32 a(0); a < rPolyPoly.count(); a++)
|
||||
{
|
||||
const basegfx::B2DPolygon aCandidate(rPolyPoly.getB2DPolygon(a));
|
||||
const sal_uInt32 nPointCount(aCandidate.count());
|
||||
|
||||
if(nPointCount)
|
||||
{
|
||||
const sal_uInt32 nEdgeCount(aCandidate.isClosed() ? nPointCount + 1: nPointCount);
|
||||
basegfx::B2DPolygon aEdge;
|
||||
aEdge.append(aCandidate.getB2DPoint(0));
|
||||
aEdge.append(basegfx::B2DPoint(0.0, 0.0));
|
||||
|
||||
for(sal_uInt32 a(0); a < nEdgeCount; a++)
|
||||
{
|
||||
const sal_uInt32 nNextIndex((a + 1) % nPointCount);
|
||||
aEdge.setB2DPoint(1, aCandidate.getB2DPoint(nNextIndex));
|
||||
aEdge.setNextControlPoint(0, aCandidate.getNextControlPoint(a));
|
||||
aEdge.setPrevControlPoint(1, aCandidate.getPrevControlPoint(nNextIndex));
|
||||
|
||||
doPolyPolygonImplementation( basegfx::B2DPolyPolygon(aEdge),
|
||||
aOperation,
|
||||
pCairo, pTextures,
|
||||
mpSurfaceProvider,
|
||||
xPolyPolygon->getFillRule() );
|
||||
|
||||
// prepare next step
|
||||
aEdge.setB2DPoint(0, aEdge.getB2DPoint(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
doPolyPolygonImplementation( rPolyPoly, aOperation,
|
||||
pCairo, pTextures,
|
||||
mpSurfaceProvider,
|
||||
xPolyPolygon->getFillRule() );
|
||||
}
|
||||
}
|
||||
|
||||
uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawPolyPolygon( const rendering::XCanvas* ,
|
||||
@ -1039,9 +1077,12 @@ namespace cairocanvas
|
||||
break;
|
||||
}
|
||||
|
||||
bool bNoLineJoin(false);
|
||||
|
||||
switch( strokeAttributes.JoinType ) {
|
||||
// cairo doesn't have join type NONE so we use MITER as it's pretty close
|
||||
case rendering::PathJoinType::NONE:
|
||||
bNoLineJoin = true;
|
||||
case rendering::PathJoinType::MITER:
|
||||
cairo_set_line_join( mpCairo.get(), CAIRO_LINE_JOIN_MITER );
|
||||
break;
|
||||
@ -1063,7 +1104,7 @@ namespace cairocanvas
|
||||
|
||||
// TODO(rodo) use LineArray of strokeAttributes
|
||||
|
||||
doPolyPolygonPath( xPolyPolygon, Stroke );
|
||||
doPolyPolygonPath( xPolyPolygon, Stroke, bNoLineJoin );
|
||||
|
||||
cairo_restore( mpCairo.get() );
|
||||
} else
|
||||
@ -1147,7 +1188,7 @@ namespace cairocanvas
|
||||
cairo_save( mpCairo.get() );
|
||||
|
||||
useStates( viewState, renderState, true );
|
||||
doPolyPolygonPath( xPolyPolygon, Fill, &textures );
|
||||
doPolyPolygonPath( xPolyPolygon, Fill, false, &textures );
|
||||
|
||||
cairo_restore( mpCairo.get() );
|
||||
}
|
||||
|
@ -276,6 +276,7 @@ namespace cairocanvas
|
||||
|
||||
void doPolyPolygonPath( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
|
||||
Operation aOperation,
|
||||
bool bNoLineJoin = false,
|
||||
const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >* pTextures=NULL,
|
||||
::cairo::Cairo* pCairo=NULL ) const;
|
||||
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include <basegfx/matrix/b2dhommatrix.hxx>
|
||||
#include <basegfx/point/b2dpoint.hxx>
|
||||
#include <basegfx/tools/canvastools.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
|
||||
#include <comphelper/sequence.hxx>
|
||||
#include <canvas/canvastools.hxx>
|
||||
@ -367,7 +368,11 @@ namespace dxcanvas
|
||||
pGraphics->GetPixelOffsetMode() );
|
||||
pGraphics->SetPixelOffsetMode( Gdiplus::PixelOffsetModeNone );
|
||||
|
||||
aPen.SetMiterLimit( static_cast< Gdiplus::REAL >(strokeAttributes.MiterLimit) );
|
||||
const bool bIsMiter(rendering::PathJoinType::MITER == strokeAttributes.JoinType);
|
||||
const bool bIsNone(rendering::PathJoinType::NONE == strokeAttributes.JoinType);
|
||||
|
||||
if(bIsMiter)
|
||||
aPen.SetMiterLimit( static_cast< Gdiplus::REAL >(strokeAttributes.MiterLimit) );
|
||||
|
||||
const ::std::vector< Gdiplus::REAL >& rDashArray(
|
||||
::comphelper::sequenceToContainer< ::std::vector< Gdiplus::REAL > >(
|
||||
@ -380,9 +385,10 @@ namespace dxcanvas
|
||||
aPen.SetLineCap( gdiCapFromCap(strokeAttributes.StartCapType),
|
||||
gdiCapFromCap(strokeAttributes.EndCapType),
|
||||
Gdiplus::DashCapFlat );
|
||||
aPen.SetLineJoin( gdiJoinFromJoin(strokeAttributes.JoinType) );
|
||||
if(!bIsNone)
|
||||
aPen.SetLineJoin( gdiJoinFromJoin(strokeAttributes.JoinType) );
|
||||
|
||||
GraphicsPathSharedPtr pPath( tools::graphicsPathFromXPolyPolygon2D( xPolyPolygon ) );
|
||||
GraphicsPathSharedPtr pPath( tools::graphicsPathFromXPolyPolygon2D( xPolyPolygon, bIsNone ) );
|
||||
|
||||
// TODO(E1): Return value
|
||||
Gdiplus::Status hr = pGraphics->DrawPath( &aPen, pPath.get() );
|
||||
@ -733,10 +739,8 @@ namespace dxcanvas
|
||||
// add output offset
|
||||
if( !maOutputOffset.equalZero() )
|
||||
{
|
||||
::basegfx::B2DHomMatrix aOutputOffset;
|
||||
aOutputOffset.translate( maOutputOffset.getX(),
|
||||
maOutputOffset.getY() );
|
||||
|
||||
const basegfx::B2DHomMatrix aOutputOffset(basegfx::tools::createTranslateB2DHomMatrix(
|
||||
maOutputOffset.getX(), maOutputOffset.getY()));
|
||||
aTransform = aOutputOffset * aTransform;
|
||||
}
|
||||
|
||||
@ -774,10 +778,8 @@ namespace dxcanvas
|
||||
// add output offset
|
||||
if( !maOutputOffset.equalZero() )
|
||||
{
|
||||
::basegfx::B2DHomMatrix aOutputOffset;
|
||||
aOutputOffset.translate( maOutputOffset.getX(),
|
||||
maOutputOffset.getY() );
|
||||
|
||||
const basegfx::B2DHomMatrix aOutputOffset(basegfx::tools::createTranslateB2DHomMatrix(
|
||||
maOutputOffset.getX(), maOutputOffset.getY()));
|
||||
aTransform = aOutputOffset * aTransform;
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include <basegfx/numeric/ftools.hxx>
|
||||
#include <basegfx/tools/tools.hxx>
|
||||
#include <basegfx/tools/canvastools.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
|
||||
#include <canvas/parametricpolypolygon.hxx>
|
||||
|
||||
@ -452,8 +453,7 @@ namespace dxcanvas
|
||||
aFillBrush.SetColor( aFillColor );
|
||||
|
||||
const double nCurrScale( (nStepCount-i)/(double)nStepCount );
|
||||
aScaleMatrix.identity();
|
||||
aScaleMatrix.translate( -0.5, -0.5 );
|
||||
aScaleMatrix = basegfx::tools::createTranslateB2DHomMatrix(-0.5, -0.5);
|
||||
|
||||
// handle anisotrophic polygon scaling
|
||||
if( rValues.mnAspectRatio < 1.0 )
|
||||
|
@ -194,7 +194,8 @@ namespace dxcanvas
|
||||
|
||||
void graphicsPathFromB2DPolygon( GraphicsPathSharedPtr& rOutput,
|
||||
::std::vector< Gdiplus::PointF >& rPoints,
|
||||
const ::basegfx::B2DPolygon& rPoly )
|
||||
const ::basegfx::B2DPolygon& rPoly,
|
||||
bool bNoLineJoin)
|
||||
{
|
||||
const sal_uInt32 nPoints( rPoly.count() );
|
||||
|
||||
@ -241,7 +242,18 @@ namespace dxcanvas
|
||||
rPoints[nCurrOutput++] = Gdiplus::PointF( static_cast<Gdiplus::REAL>(rPoint.getX()),
|
||||
static_cast<Gdiplus::REAL>(rPoint.getY()) );
|
||||
|
||||
rOutput->AddBeziers( &rPoints[0], nCurrOutput );
|
||||
if(bNoLineJoin && nCurrOutput > 7)
|
||||
{
|
||||
for(sal_uInt32 a(3); a < nCurrOutput; a+=3)
|
||||
{
|
||||
rOutput->StartFigure();
|
||||
rOutput->AddBezier(rPoints[a - 3], rPoints[a - 2], rPoints[a - 1], rPoints[a]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rOutput->AddBeziers( &rPoints[0], nCurrOutput );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -251,7 +263,20 @@ namespace dxcanvas
|
||||
// Therefore, simply don't pass the last two
|
||||
// points here.
|
||||
if( nCurrOutput > 3 )
|
||||
rOutput->AddBeziers( &rPoints[0], nCurrOutput-2 );
|
||||
{
|
||||
if(bNoLineJoin && nCurrOutput > 7)
|
||||
{
|
||||
for(sal_uInt32 a(3); a < nCurrOutput; a+=3)
|
||||
{
|
||||
rOutput->StartFigure();
|
||||
rOutput->AddBezier(rPoints[a - 3], rPoints[a - 2], rPoints[a - 1], rPoints[a]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rOutput->AddBeziers( &rPoints[0], nCurrOutput-2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -267,10 +292,27 @@ namespace dxcanvas
|
||||
static_cast<Gdiplus::REAL>(rPoint.getY()) );
|
||||
}
|
||||
|
||||
rOutput->AddLines( &rPoints[0], nPoints );
|
||||
if(bNoLineJoin && nPoints > 2)
|
||||
{
|
||||
for(sal_uInt32 a(1); a < nPoints; a++)
|
||||
{
|
||||
rOutput->StartFigure();
|
||||
rOutput->AddLine(rPoints[a - 1], rPoints[a]);
|
||||
}
|
||||
|
||||
if(bClosedPolygon)
|
||||
{
|
||||
rOutput->StartFigure();
|
||||
rOutput->AddLine(rPoints[nPoints - 1], rPoints[0]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rOutput->AddLines( &rPoints[0], nPoints );
|
||||
}
|
||||
}
|
||||
|
||||
if( bClosedPolygon )
|
||||
if( bClosedPolygon && !bNoLineJoin )
|
||||
rOutput->CloseFigure();
|
||||
}
|
||||
}
|
||||
@ -426,17 +468,17 @@ namespace dxcanvas
|
||||
return pRes;
|
||||
}
|
||||
|
||||
GraphicsPathSharedPtr graphicsPathFromB2DPolygon( const ::basegfx::B2DPolygon& rPoly )
|
||||
GraphicsPathSharedPtr graphicsPathFromB2DPolygon( const ::basegfx::B2DPolygon& rPoly, bool bNoLineJoin )
|
||||
{
|
||||
GraphicsPathSharedPtr pRes( new Gdiplus::GraphicsPath() );
|
||||
::std::vector< Gdiplus::PointF > aPoints;
|
||||
|
||||
graphicsPathFromB2DPolygon( pRes, aPoints, rPoly );
|
||||
graphicsPathFromB2DPolygon( pRes, aPoints, rPoly, bNoLineJoin );
|
||||
|
||||
return pRes;
|
||||
}
|
||||
|
||||
GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly )
|
||||
GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly, bool bNoLineJoin )
|
||||
{
|
||||
GraphicsPathSharedPtr pRes( new Gdiplus::GraphicsPath() );
|
||||
::std::vector< Gdiplus::PointF > aPoints;
|
||||
@ -446,24 +488,25 @@ namespace dxcanvas
|
||||
{
|
||||
graphicsPathFromB2DPolygon( pRes,
|
||||
aPoints,
|
||||
rPoly.getB2DPolygon( nCurrPoly ) );
|
||||
rPoly.getB2DPolygon( nCurrPoly ),
|
||||
bNoLineJoin);
|
||||
}
|
||||
|
||||
return pRes;
|
||||
}
|
||||
|
||||
GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D( const uno::Reference< rendering::XPolyPolygon2D >& xPoly )
|
||||
GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D( const uno::Reference< rendering::XPolyPolygon2D >& xPoly, bool bNoLineJoin )
|
||||
{
|
||||
LinePolyPolygon* pPolyImpl = dynamic_cast< LinePolyPolygon* >( xPoly.get() );
|
||||
|
||||
if( pPolyImpl )
|
||||
{
|
||||
return pPolyImpl->getGraphicsPath();
|
||||
return pPolyImpl->getGraphicsPath( bNoLineJoin );
|
||||
}
|
||||
else
|
||||
{
|
||||
return tools::graphicsPathFromB2DPolyPolygon(
|
||||
polyPolygonFromXPolyPolygon2D( xPoly ) );
|
||||
polyPolygonFromXPolyPolygon2D( xPoly ), bNoLineJoin );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,11 +107,18 @@ namespace dxcanvas
|
||||
GraphicsPathSharedPtr graphicsPathFromRealPoint2DSequence( const ::com::sun::star::uno::Sequence<
|
||||
::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& );
|
||||
|
||||
GraphicsPathSharedPtr graphicsPathFromB2DPolygon( const ::basegfx::B2DPolygon& rPoly );
|
||||
GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly );
|
||||
GraphicsPathSharedPtr graphicsPathFromB2DPolygon(
|
||||
const ::basegfx::B2DPolygon& rPoly,
|
||||
bool bNoLineJoin = false);
|
||||
|
||||
GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon(
|
||||
const ::basegfx::B2DPolyPolygon& rPoly,
|
||||
bool bNoLineJoin = false);
|
||||
|
||||
GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D(
|
||||
const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >&,
|
||||
bool bNoLineJoin = false );
|
||||
|
||||
GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D( const ::com::sun::star::uno::Reference<
|
||||
::com::sun::star::rendering::XPolyPolygon2D >& );
|
||||
bool drawGdiPlusBitmap( const GraphicsSharedPtr& rGraphics,
|
||||
const BitmapSharedPtr& rBitmap );
|
||||
bool drawDIBits( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics,
|
||||
|
@ -46,14 +46,14 @@ namespace dxcanvas
|
||||
{
|
||||
}
|
||||
|
||||
GraphicsPathSharedPtr LinePolyPolygon::getGraphicsPath() const
|
||||
GraphicsPathSharedPtr LinePolyPolygon::getGraphicsPath( bool bNoLineJoin ) const
|
||||
{
|
||||
// generate GraphicsPath only on demand (gets deleted as soon
|
||||
// as any of the modifying methods above touches the
|
||||
// B2DPolyPolygon).
|
||||
if( !mpPath )
|
||||
{
|
||||
mpPath = tools::graphicsPathFromB2DPolyPolygon( getPolyPolygonUnsafe() );
|
||||
mpPath = tools::graphicsPathFromB2DPolyPolygon( getPolyPolygonUnsafe(), bNoLineJoin );
|
||||
mpPath->SetFillMode( const_cast<LinePolyPolygon*>(this)->getFillRule() == rendering::FillRule_EVEN_ODD ?
|
||||
Gdiplus::FillModeAlternate : Gdiplus::FillModeWinding );
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ namespace dxcanvas
|
||||
public:
|
||||
explicit LinePolyPolygon( const ::basegfx::B2DPolyPolygon& );
|
||||
|
||||
GraphicsPathSharedPtr getGraphicsPath() const;
|
||||
GraphicsPathSharedPtr getGraphicsPath( bool bNoLineJoin = false) const;
|
||||
|
||||
private:
|
||||
// overridden, to clear mpPath
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include <comphelper/servicedecl.hxx>
|
||||
|
||||
#include <basegfx/matrix/b2dhommatrix.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
|
||||
#include "canvas/canvastools.hxx"
|
||||
|
||||
@ -287,10 +288,7 @@ namespace
|
||||
::sal_Int8 nTextDirection ) throw (uno::RuntimeException)
|
||||
{
|
||||
::osl::MutexGuard aGuard( m_aMutex );
|
||||
|
||||
basegfx::B2DHomMatrix offsetTransform;
|
||||
offsetTransform.translate(aOutPos.X,aOutPos.Y);
|
||||
|
||||
const basegfx::B2DHomMatrix offsetTransform(basegfx::tools::createTranslateB2DHomMatrix(aOutPos.X,aOutPos.Y));
|
||||
rendering::RenderState aRenderState( createStrokingRenderState() );
|
||||
tools::appendToRenderState(aRenderState, offsetTransform);
|
||||
|
||||
@ -305,10 +303,7 @@ namespace
|
||||
const geometry::RealPoint2D& aLeftTop ) throw (uno::RuntimeException)
|
||||
{
|
||||
::osl::MutexGuard aGuard( m_aMutex );
|
||||
|
||||
basegfx::B2DHomMatrix offsetTransform;
|
||||
offsetTransform.translate(aLeftTop.X,aLeftTop.Y);
|
||||
|
||||
const basegfx::B2DHomMatrix offsetTransform(basegfx::tools::createTranslateB2DHomMatrix(aLeftTop.X,aLeftTop.Y));
|
||||
rendering::RenderState aRenderState( createStrokingRenderState() );
|
||||
tools::appendToRenderState(aRenderState, offsetTransform);
|
||||
|
||||
|
@ -63,6 +63,7 @@
|
||||
#include <basegfx/polygon/b2dpolypolygontools.hxx>
|
||||
#include <basegfx/tools/canvastools.hxx>
|
||||
#include <basegfx/numeric/ftools.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
|
||||
#include <cppuhelper/compbase1.hxx>
|
||||
#include <rtl/instance.hxx>
|
||||
@ -679,9 +680,8 @@ namespace canvas
|
||||
i_transformation );
|
||||
|
||||
// now move resulting left,top point of bounds to (0,0)
|
||||
::basegfx::B2DHomMatrix aCorrectedTransform;
|
||||
aCorrectedTransform.translate( -aTransformedRect.getMinX(),
|
||||
-aTransformedRect.getMinY() );
|
||||
const basegfx::B2DHomMatrix aCorrectedTransform(basegfx::tools::createTranslateB2DHomMatrix(
|
||||
-aTransformedRect.getMinX(), -aTransformedRect.getMinY()));
|
||||
|
||||
// prepend to original transformation
|
||||
o_transform = aCorrectedTransform * i_transformation;
|
||||
@ -745,9 +745,8 @@ namespace canvas
|
||||
transformation );
|
||||
|
||||
// now move resulting left,top point of bounds to (0,0)
|
||||
::basegfx::B2DHomMatrix aCorrectedTransform;
|
||||
aCorrectedTransform.translate( -aTransformedRect.getMinX(),
|
||||
-aTransformedRect.getMinY() );
|
||||
basegfx::B2DHomMatrix aCorrectedTransform(basegfx::tools::createTranslateB2DHomMatrix(
|
||||
-aTransformedRect.getMinX(), -aTransformedRect.getMinY()));
|
||||
|
||||
// scale to match outRect
|
||||
const double xDenom( aTransformedRect.getWidth() );
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include "surface.hxx"
|
||||
#include <basegfx/polygon/b2dpolygonclipper.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
#include <comphelper/scopeguard.hxx>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
@ -150,9 +151,8 @@ namespace canvas
|
||||
// 4) scale to normalized device coordinates
|
||||
// 5) flip y-axis
|
||||
// 6) translate to account for viewport transform
|
||||
::basegfx::B2DHomMatrix aTransform;
|
||||
aTransform.translate(maSourceOffset.getX(),
|
||||
maSourceOffset.getY());
|
||||
basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(
|
||||
maSourceOffset.getX(), maSourceOffset.getY()));
|
||||
aTransform = aTransform * rTransform;
|
||||
aTransform.translate(::basegfx::fround(rPos.getX()),
|
||||
::basegfx::fround(rPos.getY()));
|
||||
@ -277,8 +277,7 @@ namespace canvas
|
||||
// 1) offset of surface subarea
|
||||
// 2) surface transform
|
||||
// 3) translation to output position [rPos]
|
||||
::basegfx::B2DHomMatrix aTransform;
|
||||
aTransform.translate(aPos1.getX(),aPos1.getY());
|
||||
basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix(aPos1.getX(), aPos1.getY()));
|
||||
aTransform = aTransform * rTransform;
|
||||
aTransform.translate(::basegfx::fround(rPos.getX()),
|
||||
::basegfx::fround(rPos.getY()));
|
||||
@ -380,7 +379,7 @@ namespace canvas
|
||||
// be transformed by the overall transform and uv coordinates will
|
||||
// be calculated from the result, and this is why we need to use
|
||||
// integer coordinates here...
|
||||
::basegfx::B2DHomMatrix aTransform;
|
||||
basegfx::B2DHomMatrix aTransform;
|
||||
aTransform = aTransform * rTransform;
|
||||
aTransform.translate(::basegfx::fround(rPos.getX()),
|
||||
::basegfx::fround(rPos.getY()));
|
||||
|
@ -240,7 +240,7 @@ namespace comphelper
|
||||
if ( !( _element >>= aProperty ) )
|
||||
throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
|
||||
|
||||
::osl::MutexGuard aGuard( m_aMutex );
|
||||
::osl::ClearableMutexGuard g( m_aMutex );
|
||||
|
||||
// check whether the type is allowed, everything else will be checked
|
||||
// by m_aDynamicProperties
|
||||
@ -254,6 +254,7 @@ namespace comphelper
|
||||
// our property info is dirty
|
||||
m_pArrayHelper.reset();
|
||||
|
||||
g.clear();
|
||||
setModified(sal_True);
|
||||
}
|
||||
|
||||
@ -346,7 +347,7 @@ namespace comphelper
|
||||
//--------------------------------------------------------------------
|
||||
void SAL_CALL OPropertyBag::addProperty( const ::rtl::OUString& _rName, ::sal_Int16 _nAttributes, const Any& _rInitialValue ) throw (PropertyExistException, IllegalTypeException, IllegalArgumentException, RuntimeException)
|
||||
{
|
||||
::osl::MutexGuard aGuard( m_aMutex );
|
||||
::osl::ClearableMutexGuard g( m_aMutex );
|
||||
|
||||
// check whether the type is allowed, everything else will be checked
|
||||
// by m_aDynamicProperties
|
||||
@ -362,19 +363,21 @@ namespace comphelper
|
||||
// our property info is dirty
|
||||
m_pArrayHelper.reset();
|
||||
|
||||
g.clear();
|
||||
setModified(sal_True);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
void SAL_CALL OPropertyBag::removeProperty( const ::rtl::OUString& _rName ) throw (UnknownPropertyException, NotRemoveableException, RuntimeException)
|
||||
{
|
||||
::osl::MutexGuard aGuard( m_aMutex );
|
||||
::osl::ClearableMutexGuard g( m_aMutex );
|
||||
|
||||
m_aDynamicProperties.removeProperty( _rName );
|
||||
|
||||
// our property info is dirty
|
||||
m_pArrayHelper.reset();
|
||||
|
||||
g.clear();
|
||||
setModified(sal_True);
|
||||
}
|
||||
|
||||
|
@ -38,15 +38,11 @@
|
||||
#include <osl/diagnose.h>
|
||||
|
||||
#if OSL_DEBUG_LEVEL > 0
|
||||
#ifndef _RTL_STRBUF_HXX_
|
||||
#include <rtl/strbuf.hxx>
|
||||
#endif
|
||||
#ifndef _CPPUHELPER_EXC_HLP_HXX_
|
||||
#include <cppuhelper/exc_hlp.hxx>
|
||||
#endif
|
||||
#ifndef _OSL_THREAD_H_
|
||||
#include <osl/thread.h>
|
||||
#endif
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <typeinfo>
|
||||
#endif
|
||||
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
||||
#include <com/sun/star/lang/IllegalArgumentException.hpp>
|
||||
@ -71,6 +67,10 @@ namespace comphelper
|
||||
using ::com::sun::star::uno::cpp_queryInterface;
|
||||
using ::com::sun::star::uno::cpp_acquire;
|
||||
using ::com::sun::star::uno::cpp_release;
|
||||
#if OSL_DEBUG_LEVEL > 0
|
||||
using ::com::sun::star::lang::XServiceInfo;
|
||||
#endif
|
||||
using ::com::sun::star::uno::UNO_QUERY;
|
||||
/** === end UNO using === **/
|
||||
namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute;
|
||||
|
||||
@ -110,7 +110,18 @@ void copyProperties(const Reference<XPropertySet>& _rxSource,
|
||||
::rtl::OStringBuffer aBuffer;
|
||||
aBuffer.append( "::comphelper::copyProperties: could not copy property '" );
|
||||
aBuffer.append( ::rtl::OString( pSourceProps->Name.getStr(), pSourceProps->Name.getLength(), RTL_TEXTENCODING_ASCII_US ) );
|
||||
aBuffer.append( "' to the destination set.\n" );
|
||||
aBuffer.append( "' to the destination set (a '" );
|
||||
|
||||
Reference< XServiceInfo > xSI( _rxDest, UNO_QUERY );
|
||||
if ( xSI.is() )
|
||||
{
|
||||
aBuffer.append( ::rtl::OUStringToOString( xSI->getImplementationName(), osl_getThreadTextEncoding() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
aBuffer.append( typeid( *_rxDest.get() ).name() );
|
||||
}
|
||||
aBuffer.append( "' implementation).\n" );
|
||||
|
||||
Any aException( ::cppu::getCaughtException() );
|
||||
aBuffer.append( "Caught an exception of type '" );
|
||||
|
@ -35,25 +35,21 @@
|
||||
#include <com/sun/star/rendering/XBitmap.hpp>
|
||||
#include <com/sun/star/rendering/RepaintResult.hpp>
|
||||
#include <com/sun/star/rendering/XCachedPrimitive.hpp>
|
||||
|
||||
#include <vcl/bitmapex.hxx>
|
||||
#include <tools/gen.hxx>
|
||||
#include <vcl/canvastools.hxx>
|
||||
|
||||
#include <canvas/canvastools.hxx>
|
||||
|
||||
#include <basegfx/matrix/b2dhommatrix.hxx>
|
||||
#include <basegfx/vector/b2dsize.hxx>
|
||||
#include <basegfx/point/b2dpoint.hxx>
|
||||
#include <basegfx/range/b2drange.hxx>
|
||||
#include <basegfx/tools/canvastools.hxx>
|
||||
|
||||
#include <boost/utility.hpp>
|
||||
|
||||
#include "cachedprimitivebase.hxx"
|
||||
#include "bitmapaction.hxx"
|
||||
#include "outdevstate.hxx"
|
||||
#include "mtftools.hxx"
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
@ -112,9 +108,7 @@ namespace cppcanvas
|
||||
|
||||
// Setup transformation such that the next render call is
|
||||
// moved rPoint away.
|
||||
::basegfx::B2DHomMatrix aLocalTransformation;
|
||||
aLocalTransformation.translate( rDstPoint.getX(),
|
||||
rDstPoint.getY() );
|
||||
const basegfx::B2DHomMatrix aLocalTransformation(basegfx::tools::createTranslateB2DHomMatrix(rDstPoint));
|
||||
::canvas::tools::appendToRenderState( maState,
|
||||
aLocalTransformation );
|
||||
|
||||
@ -144,15 +138,12 @@ namespace cppcanvas
|
||||
// moved rPoint away, and scaled according to the ratio
|
||||
// given by src and dst size.
|
||||
const ::Size aBmpSize( rBmpEx.GetSizePixel() );
|
||||
::basegfx::B2DHomMatrix aLocalTransformation;
|
||||
|
||||
const ::basegfx::B2DVector aScale( rDstSize.getX() / aBmpSize.Width(),
|
||||
rDstSize.getY() / aBmpSize.Height() );
|
||||
aLocalTransformation.scale( aScale.getX(), aScale.getY() );
|
||||
aLocalTransformation.translate( rDstPoint.getX(),
|
||||
rDstPoint.getY() );
|
||||
::canvas::tools::appendToRenderState( maState,
|
||||
aLocalTransformation );
|
||||
const basegfx::B2DHomMatrix aLocalTransformation(basegfx::tools::createScaleTranslateB2DHomMatrix(
|
||||
aScale, rDstPoint));
|
||||
::canvas::tools::appendToRenderState( maState, aLocalTransformation );
|
||||
|
||||
// correct clip (which is relative to original transform)
|
||||
tools::modifyClip( maState,
|
||||
|
@ -34,19 +34,14 @@
|
||||
#include <canvas/debug.hxx>
|
||||
#include <tools/diagnose_ex.h>
|
||||
#include <canvas/verbosetrace.hxx>
|
||||
|
||||
#include <osl/mutex.hxx>
|
||||
#include <vos/mutex.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
|
||||
#include <rtl/logfile.hxx>
|
||||
|
||||
#include <comphelper/sequence.hxx>
|
||||
#include <comphelper/anytostring.hxx>
|
||||
#include <cppuhelper/exc_hlp.hxx>
|
||||
|
||||
#include <cppcanvas/canvas.hxx>
|
||||
|
||||
#include <com/sun/star/rendering/XGraphicDevice.hpp>
|
||||
#include <com/sun/star/rendering/TexturingMode.hpp>
|
||||
#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
|
||||
@ -59,7 +54,6 @@
|
||||
#include <com/sun/star/rendering/XCanvas.hpp>
|
||||
#include <com/sun/star/rendering/PathCapType.hpp>
|
||||
#include <com/sun/star/rendering/PathJoinType.hpp>
|
||||
|
||||
#include <basegfx/tools/canvastools.hxx>
|
||||
#include <basegfx/numeric/ftools.hxx>
|
||||
#include <basegfx/polygon/b2dpolypolygontools.hxx>
|
||||
@ -73,7 +67,6 @@
|
||||
#include <basegfx/tuple/b2dtuple.hxx>
|
||||
#include <basegfx/polygon/b2dpolygonclipper.hxx>
|
||||
#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
|
||||
|
||||
#include <canvas/canvastools.hxx>
|
||||
#include <vcl/canvastools.hxx>
|
||||
#include <vcl/salbtype.hxx>
|
||||
@ -84,11 +77,9 @@
|
||||
#include <vcl/graphictools.hxx>
|
||||
#include <tools/poly.hxx>
|
||||
#include <i18npool/mslangid.hxx>
|
||||
|
||||
#include <implrenderer.hxx>
|
||||
#include <tools.hxx>
|
||||
#include <outdevstate.hxx>
|
||||
|
||||
#include <action.hxx>
|
||||
#include <bitmapaction.hxx>
|
||||
#include <lineaction.hxx>
|
||||
@ -96,15 +87,13 @@
|
||||
#include <polypolyaction.hxx>
|
||||
#include <textaction.hxx>
|
||||
#include <transparencygroupaction.hxx>
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
#include "mtftools.hxx"
|
||||
#include "outdevstate.hxx"
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
@ -286,10 +275,25 @@ namespace
|
||||
(getState( rParms.mrStates ).mapModeTransform * aWidth).getX();
|
||||
|
||||
// setup reasonable defaults
|
||||
o_rStrokeAttributes.MiterLimit = 1.0;
|
||||
o_rStrokeAttributes.MiterLimit = 15.0; // 1.0 was no good default; GDI+'s limit is 10.0, our's is 15.0
|
||||
o_rStrokeAttributes.StartCapType = rendering::PathCapType::BUTT;
|
||||
o_rStrokeAttributes.EndCapType = rendering::PathCapType::BUTT;
|
||||
o_rStrokeAttributes.JoinType = rendering::PathJoinType::MITER;
|
||||
|
||||
switch(rLineInfo.GetLineJoin())
|
||||
{
|
||||
default: // B2DLINEJOIN_NONE, B2DLINEJOIN_MIDDLE
|
||||
o_rStrokeAttributes.JoinType = rendering::PathJoinType::NONE;
|
||||
break;
|
||||
case basegfx::B2DLINEJOIN_BEVEL:
|
||||
o_rStrokeAttributes.JoinType = rendering::PathJoinType::BEVEL;
|
||||
break;
|
||||
case basegfx::B2DLINEJOIN_MITER:
|
||||
o_rStrokeAttributes.JoinType = rendering::PathJoinType::MITER;
|
||||
break;
|
||||
case basegfx::B2DLINEJOIN_ROUND:
|
||||
o_rStrokeAttributes.JoinType = rendering::PathJoinType::ROUND;
|
||||
break;
|
||||
}
|
||||
|
||||
if( LINE_DASH == rLineInfo.GetStyle() )
|
||||
{
|
||||
@ -729,12 +733,11 @@ namespace cppcanvas
|
||||
fabs( aBounds.getHeight()*sin(nRotation) ) +
|
||||
fabs( aBounds.getWidth()*cos(nRotation) )));
|
||||
|
||||
aTextureTransformation.scale( nScale, nScale );
|
||||
|
||||
// translate back origin to center of
|
||||
// scale and translate back origin to center of
|
||||
// primitive
|
||||
aTextureTransformation.translate( 0.5*aBounds.getWidth(),
|
||||
0.5*aBounds.getHeight() );
|
||||
aTextureTransformation = basegfx::tools::createScaleTranslateB2DHomMatrix(
|
||||
nScale, nScale, 0.5*aBounds.getWidth(), 0.5*aBounds.getHeight())
|
||||
* aTextureTransformation;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -856,9 +859,8 @@ namespace cppcanvas
|
||||
aTextureTransformation.scale( nScaleX, nScaleY );
|
||||
|
||||
// rotate texture according to gradient rotation
|
||||
aTextureTransformation.translate( -0.5*nScaleX, -0.5*nScaleY );
|
||||
aTextureTransformation.rotate( nRotation );
|
||||
aTextureTransformation.translate( 0.5*nScaleX, 0.5*nScaleY );
|
||||
aTextureTransformation = basegfx::tools::createRotateAroundPoint(0.5*nScaleX, 0.5*nScaleY, nRotation)
|
||||
* aTextureTransformation;
|
||||
|
||||
aTextureTransformation.translate( nOffsetX, nOffsetY );
|
||||
}
|
||||
|
@ -34,10 +34,8 @@
|
||||
#include <canvas/debug.hxx>
|
||||
#include <tools/diagnose_ex.h>
|
||||
#include <canvas/verbosetrace.hxx>
|
||||
|
||||
#include <com/sun/star/rendering/RenderState.hpp>
|
||||
#include <com/sun/star/rendering/XCanvas.hpp>
|
||||
|
||||
#include <basegfx/numeric/ftools.hxx>
|
||||
#include <basegfx/tools/canvastools.hxx>
|
||||
#include <basegfx/polygon/b2dpolygontools.hxx>
|
||||
@ -45,16 +43,15 @@
|
||||
#include <basegfx/range/b2drectangle.hxx>
|
||||
#include <basegfx/vector/b2dvector.hxx>
|
||||
#include <canvas/canvastools.hxx>
|
||||
|
||||
#include <vcl/gdimtf.hxx>
|
||||
#include <vcl/metaact.hxx>
|
||||
#include <vcl/virdev.hxx>
|
||||
#include <vcl/metric.hxx>
|
||||
#include <tools/poly.hxx>
|
||||
|
||||
#include "mtftools.hxx"
|
||||
#include "outdevstate.hxx"
|
||||
#include "polypolyaction.hxx"
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
|
||||
|
||||
|
||||
@ -111,9 +108,9 @@ namespace cppcanvas
|
||||
|
||||
const ::Size aSizePixel( rVDev.LogicToPixel( aSizeLogic ) );
|
||||
|
||||
o_rMatrix.identity();
|
||||
o_rMatrix.scale( aSizePixel.Width() / (double)aSizeLogic.Width(),
|
||||
aSizePixel.Height() / (double)aSizeLogic.Height() );
|
||||
o_rMatrix = basegfx::tools::createScaleB2DHomMatrix(
|
||||
aSizePixel.Width() / (double)aSizeLogic.Width(),
|
||||
aSizePixel.Height() / (double)aSizeLogic.Height() );
|
||||
|
||||
return o_rMatrix;
|
||||
}
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include <basegfx/vector/b2dsize.hxx>
|
||||
#include <basegfx/polygon/b2dpolypolygontools.hxx>
|
||||
#include <basegfx/polygon/b2dpolygontools.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
|
||||
#include <tools/gen.hxx>
|
||||
#include <vcl/canvastools.hxx>
|
||||
@ -93,9 +94,7 @@ namespace cppcanvas
|
||||
NULL,
|
||||
&rState.fontRotation );
|
||||
|
||||
::basegfx::B2DHomMatrix aLocalTransformation;
|
||||
|
||||
aLocalTransformation.rotate( rState.fontRotation );
|
||||
basegfx::B2DHomMatrix aLocalTransformation(basegfx::tools::createRotateB2DHomMatrix(rState.fontRotation));
|
||||
aLocalTransformation.translate( rStartPoint.getX(),
|
||||
rStartPoint.getY() );
|
||||
::canvas::tools::appendToRenderState( o_rRenderState,
|
||||
|
@ -353,7 +353,7 @@ public:
|
||||
void ReleaseFromCache();
|
||||
|
||||
const Graphic& GetGraphic() const;
|
||||
void SetGraphic( const Graphic& rGraphic );
|
||||
void SetGraphic( const Graphic& rGraphic, const GraphicObject* pCopyObj = 0);
|
||||
void SetGraphic( const Graphic& rGraphic, const String& rLink );
|
||||
|
||||
/** Get graphic transformed according to given attributes
|
||||
|
@ -55,6 +55,9 @@
|
||||
#include "dlgepct.hrc"
|
||||
#include "dlgepct.hxx"
|
||||
|
||||
#include <basegfx/polygon/b2dpolygon.hxx>
|
||||
#include <basegfx/polygon/b2dpolypolygon.hxx>
|
||||
|
||||
//============================== PictWriter ===================================
|
||||
|
||||
struct PictWriterAttrStackMember {
|
||||
@ -77,7 +80,6 @@ struct PictPattern {
|
||||
sal_uInt32 nLo, nHi;
|
||||
};
|
||||
|
||||
|
||||
class PictWriter {
|
||||
|
||||
private:
|
||||
@ -178,6 +180,7 @@ private:
|
||||
|
||||
void WriteTextArray(Point & rPoint, const String& rString, const sal_Int32 * pDXAry);
|
||||
|
||||
void HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon);
|
||||
void WriteOpcodes(const GDIMetaFile & rMTF);
|
||||
|
||||
void WriteHeader(const GDIMetaFile & rMTF);
|
||||
@ -1371,6 +1374,65 @@ void PictWriter::WriteTextArray(Point & rPoint, const String& rString, const sal
|
||||
}
|
||||
}
|
||||
|
||||
void PictWriter::HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon)
|
||||
{
|
||||
if(rLinePolygon.count())
|
||||
{
|
||||
basegfx::B2DPolyPolygon aLinePolyPolygon(rLinePolygon);
|
||||
basegfx::B2DPolyPolygon aFillPolyPolygon;
|
||||
|
||||
rInfo.applyToB2DPolyPolygon(aLinePolyPolygon, aFillPolyPolygon);
|
||||
|
||||
if(aLinePolyPolygon.count())
|
||||
{
|
||||
aLinePolyPolygon = aLinePolyPolygon.getDefaultAdaptiveSubdivision();
|
||||
const sal_uInt32 nPolyCount(aLinePolyPolygon.count());
|
||||
SetAttrForFrame();
|
||||
|
||||
for(sal_uInt32 a(0); a < nPolyCount; a++)
|
||||
{
|
||||
const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a));
|
||||
const sal_uInt32 nPointCount(aCandidate.count());
|
||||
|
||||
if(nPointCount)
|
||||
{
|
||||
const sal_uInt32 nEdgeCount(aCandidate.isClosed() ? nPointCount + 1 : nPointCount);
|
||||
const basegfx::B2DPoint aCurr(aCandidate.getB2DPoint(0));
|
||||
Point nCurr(basegfx::fround(aCurr.getX()), basegfx::fround(aCurr.getY()));
|
||||
|
||||
for(sal_uInt32 b(0); b < nEdgeCount; b++)
|
||||
{
|
||||
const sal_uInt32 nNextIndex((b + 1) % nPointCount);
|
||||
const basegfx::B2DPoint aNext(aCandidate.getB2DPoint(nNextIndex));
|
||||
const Point nNext(basegfx::fround(aNext.getX()), basegfx::fround(aNext.getY()));
|
||||
|
||||
WriteOpcode_Line(nCurr, nNext);
|
||||
nCurr = nNext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(aFillPolyPolygon.count())
|
||||
{
|
||||
const Color aOldLineColor(aLineColor);
|
||||
const Color aOldFillColor(aFillColor);
|
||||
|
||||
aLineColor = Color( COL_TRANSPARENT );
|
||||
aFillColor = aOldLineColor;
|
||||
SetAttrForPaint();
|
||||
|
||||
for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++)
|
||||
{
|
||||
const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a).getDefaultAdaptiveSubdivision());
|
||||
WriteOpcode_Poly(PDM_PAINT, aPolygon);
|
||||
}
|
||||
|
||||
aLineColor = aOldLineColor;
|
||||
aFillColor = aOldFillColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
|
||||
{
|
||||
@ -1417,8 +1479,19 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
|
||||
|
||||
if( aLineColor != Color( COL_TRANSPARENT ) )
|
||||
{
|
||||
SetAttrForFrame();
|
||||
WriteOpcode_Line( pA->GetStartPoint(),pA->GetEndPoint() );
|
||||
if(pA->GetLineInfo().IsDefault())
|
||||
{
|
||||
SetAttrForFrame();
|
||||
WriteOpcode_Line( pA->GetStartPoint(),pA->GetEndPoint() );
|
||||
}
|
||||
else
|
||||
{
|
||||
// LineInfo used; handle Dash/Dot and fat lines
|
||||
basegfx::B2DPolygon aPolygon;
|
||||
aPolygon.append(basegfx::B2DPoint(pA->GetStartPoint().X(), pA->GetStartPoint().Y()));
|
||||
aPolygon.append(basegfx::B2DPoint(pA->GetEndPoint().X(), pA->GetEndPoint().Y()));
|
||||
HandleLineInfoPolyPolygons(pA->GetLineInfo(), aPolygon);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1571,24 +1644,35 @@ void PictWriter::WriteOpcodes( const GDIMetaFile & rMTF )
|
||||
{
|
||||
const Polygon& rPoly = pA->GetPolygon();
|
||||
|
||||
Polygon aSimplePoly;
|
||||
if ( rPoly.HasFlags() )
|
||||
rPoly.AdaptiveSubdivide( aSimplePoly );
|
||||
else
|
||||
aSimplePoly = rPoly;
|
||||
|
||||
const USHORT nSize = aSimplePoly.GetSize();
|
||||
Point aLast;
|
||||
|
||||
if ( nSize )
|
||||
if( rPoly.GetSize() )
|
||||
{
|
||||
SetAttrForFrame();
|
||||
aLast = aSimplePoly[0];
|
||||
|
||||
for ( USHORT i = 1; i < nSize; i++ )
|
||||
if(pA->GetLineInfo().IsDefault())
|
||||
{
|
||||
WriteOpcode_Line( aLast, aSimplePoly[i] );
|
||||
aLast = aSimplePoly[i];
|
||||
Polygon aSimplePoly;
|
||||
if ( rPoly.HasFlags() )
|
||||
rPoly.AdaptiveSubdivide( aSimplePoly );
|
||||
else
|
||||
aSimplePoly = rPoly;
|
||||
|
||||
const USHORT nSize = aSimplePoly.GetSize();
|
||||
Point aLast;
|
||||
|
||||
if ( nSize )
|
||||
{
|
||||
SetAttrForFrame();
|
||||
aLast = aSimplePoly[0];
|
||||
|
||||
for ( USHORT i = 1; i < nSize; i++ )
|
||||
{
|
||||
WriteOpcode_Line( aLast, aSimplePoly[i] );
|
||||
aLast = aSimplePoly[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// LineInfo used; handle Dash/Dot and fat lines
|
||||
HandleLineInfoPolyPolygons(pA->GetLineInfo(), rPoly.getB2DPolygon());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ RESLIB1SRSFILES=$(SRS)$/$(TARGET).srs
|
||||
.IF "$(L10N_framework)"==""
|
||||
SHL1TARGET= ept$(DLLPOSTFIX)
|
||||
SHL1IMPLIB= epict
|
||||
SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB)
|
||||
SHL1STDLIBS= $(TOOLSLIB) $(VCLLIB) $(SVTOOLLIB) $(CPPULIB) $(SALLIB) $(BASEGFXLIB)
|
||||
|
||||
SHL1LIBS= $(SLB)$/epict.lib
|
||||
|
||||
|
@ -388,7 +388,7 @@ BOOL PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter
|
||||
bTextFillColor = TRUE;
|
||||
aTextFillColor = Color( COL_BLACK );
|
||||
fLineWidth = 1;
|
||||
fMiterLimit = 10;
|
||||
fMiterLimit = 15; // use same limit as most graphic systems and basegfx
|
||||
eLineCap = SvtGraphicStroke::capButt;
|
||||
eJoinType = SvtGraphicStroke::joinMiter;
|
||||
aBackgroundColor = Color( COL_WHITE );
|
||||
@ -701,7 +701,40 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
|
||||
Polygon aPoly( ( (const MetaPolyLineAction*) pMA )->GetPolygon() );
|
||||
const LineInfo& rLineInfo = ( ( const MetaPolyLineAction*)pMA )->GetLineInfo();
|
||||
ImplWriteLineInfo( rLineInfo );
|
||||
ImplPolyLine( aPoly );
|
||||
|
||||
if(basegfx::B2DLINEJOIN_NONE == rLineInfo.GetLineJoin()
|
||||
&& rLineInfo.GetWidth() > 1)
|
||||
{
|
||||
// emulate B2DLINEJOIN_NONE by creating single edges
|
||||
const sal_uInt16 nPoints(aPoly.GetSize());
|
||||
const bool bCurve(aPoly.HasFlags());
|
||||
|
||||
for(sal_uInt16 a(0); a + 1 < nPoints; a++)
|
||||
{
|
||||
if(bCurve
|
||||
&& POLY_NORMAL != aPoly.GetFlags(a + 1)
|
||||
&& a + 2 < nPoints
|
||||
&& POLY_NORMAL != aPoly.GetFlags(a + 2)
|
||||
&& a + 3 < nPoints)
|
||||
{
|
||||
const Polygon aSnippet(4,
|
||||
aPoly.GetConstPointAry() + a,
|
||||
aPoly.GetConstFlagAry() + a);
|
||||
ImplPolyLine(aSnippet);
|
||||
a += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
const Polygon aSnippet(2,
|
||||
aPoly.GetConstPointAry() + a);
|
||||
ImplPolyLine(aSnippet);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ImplPolyLine( aPoly );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -2343,8 +2376,28 @@ void PSWriter::ImplWriteLineInfo( const LineInfo& rLineInfo )
|
||||
SvtGraphicStroke::DashArray l_aDashArray;
|
||||
if ( rLineInfo.GetStyle() == LINE_DASH )
|
||||
l_aDashArray.push_back( 2 );
|
||||
double fLWidth = ( ( rLineInfo.GetWidth() + 1 ) + ( rLineInfo.GetWidth() + 1 ) ) * 0.5;
|
||||
ImplWriteLineInfo( fLWidth, 10.0, SvtGraphicStroke::capButt, SvtGraphicStroke::joinMiter, l_aDashArray );
|
||||
const double fLWidth(( ( rLineInfo.GetWidth() + 1 ) + ( rLineInfo.GetWidth() + 1 ) ) * 0.5);
|
||||
SvtGraphicStroke::JoinType aJoinType(SvtGraphicStroke::joinMiter);
|
||||
|
||||
switch(rLineInfo.GetLineJoin())
|
||||
{
|
||||
default: // B2DLINEJOIN_NONE, B2DLINEJOIN_MIDDLE
|
||||
// do NOT use SvtGraphicStroke::joinNone here
|
||||
// since it will be written as numerical value directly
|
||||
// and is NOT a valid EPS value
|
||||
break;
|
||||
case basegfx::B2DLINEJOIN_MITER:
|
||||
aJoinType = SvtGraphicStroke::joinMiter;
|
||||
break;
|
||||
case basegfx::B2DLINEJOIN_BEVEL:
|
||||
aJoinType = SvtGraphicStroke::joinBevel;
|
||||
break;
|
||||
case basegfx::B2DLINEJOIN_ROUND:
|
||||
aJoinType = SvtGraphicStroke::joinRound;
|
||||
break;
|
||||
}
|
||||
|
||||
ImplWriteLineInfo( fLWidth, fMiterLimit, SvtGraphicStroke::capButt, aJoinType, l_aDashArray );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
|
@ -164,12 +164,54 @@ static void MakeAsMeta(Graphic &rGraphic)
|
||||
rGraphic = aMtf;
|
||||
}
|
||||
|
||||
static oslProcessError runProcessWithPathSearch(const rtl::OUString &rProgName,
|
||||
rtl_uString* pArgs[], sal_uInt32 nArgs, oslProcess *pProcess,
|
||||
oslFileHandle *pIn, oslFileHandle *pOut, oslFileHandle *pErr)
|
||||
{
|
||||
#ifdef WNT
|
||||
/*
|
||||
* ooo#72096
|
||||
* On Window the underlying SearchPath searches in order of...
|
||||
* The directory from which the application loaded.
|
||||
* The current directory.
|
||||
* The Windows system directory.
|
||||
* The Windows directory.
|
||||
* The directories that are listed in the PATH environment variable.
|
||||
*
|
||||
* Because one of our programs is called "convert" and there is a convert
|
||||
* in the windows system directory, we want to explicitly search the PATH
|
||||
* to avoid picking up on that one if ImageMagick's convert preceeds it in
|
||||
* PATH.
|
||||
*
|
||||
*/
|
||||
rtl::OUString url;
|
||||
rtl::OUString path(_wgetenv(L"PATH"));
|
||||
|
||||
oslFileError err = osl_searchFileURL(rProgName.pData, path.pData, &url.pData);
|
||||
if (err != osl_File_E_None)
|
||||
return osl_Process_E_NotFound;
|
||||
return osl_executeProcess_WithRedirectedIO(url.pData,
|
||||
pArgs, nArgs, osl_Process_HIDDEN,
|
||||
osl_getCurrentSecurity(), 0, 0, 0, pProcess, pIn, pOut, pErr);
|
||||
#else
|
||||
return osl_executeProcess_WithRedirectedIO(rProgName.pData,
|
||||
pArgs, nArgs, osl_Process_SEARCHPATH | osl_Process_HIDDEN,
|
||||
osl_getCurrentSecurity(), 0, 0, 0, pProcess, pIn, pOut, pErr);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(WNT) || defined(OS2)
|
||||
# define EXESUFFIX ".exe"
|
||||
#else
|
||||
# define EXESUFFIX ""
|
||||
#endif
|
||||
|
||||
static bool RenderAsEMF(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &rGraphic)
|
||||
{
|
||||
TempFile aTemp;
|
||||
aTemp.EnableKillingFile();
|
||||
rtl::OUString fileName =
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pstoedit"));
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pstoedit"EXESUFFIX));
|
||||
rtl::OUString arg1 =
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-f"));
|
||||
rtl::OUString arg2 =
|
||||
@ -186,10 +228,10 @@ static bool RenderAsEMF(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &r
|
||||
oslFileHandle pIn = NULL;
|
||||
oslFileHandle pOut = NULL;
|
||||
oslFileHandle pErr = NULL;
|
||||
oslProcessError eErr = osl_executeProcess_WithRedirectedIO(fileName.pData,
|
||||
args, sizeof(args)/sizeof(rtl_uString *),
|
||||
osl_Process_SEARCHPATH | osl_Process_HIDDEN,
|
||||
osl_getCurrentSecurity(), 0, 0, 0, &aProcess, &pIn, &pOut, &pErr);
|
||||
oslProcessError eErr = runProcessWithPathSearch(fileName,
|
||||
args, sizeof(args)/sizeof(rtl_uString *),
|
||||
&aProcess, &pIn, &pOut, &pErr);
|
||||
|
||||
if (eErr!=osl_Process_E_None)
|
||||
return false;
|
||||
|
||||
@ -222,15 +264,15 @@ static bool RenderAsEMF(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &r
|
||||
}
|
||||
|
||||
static bool RenderAsPNGThroughHelper(const sal_uInt8* pBuf, sal_uInt32 nBytesRead,
|
||||
Graphic &rGraphic, rtl::OUString &rProgName, rtl_uString **pArgs, size_t nArgs)
|
||||
Graphic &rGraphic, rtl::OUString &rProgName, rtl_uString *pArgs[], size_t nArgs)
|
||||
{
|
||||
oslProcess aProcess;
|
||||
oslFileHandle pIn = NULL;
|
||||
oslFileHandle pOut = NULL;
|
||||
oslFileHandle pErr = NULL;
|
||||
oslProcessError eErr = osl_executeProcess_WithRedirectedIO(rProgName.pData,
|
||||
pArgs, nArgs, osl_Process_SEARCHPATH | osl_Process_HIDDEN,
|
||||
osl_getCurrentSecurity(), 0, 0, 0, &aProcess, &pIn, &pOut, &pErr);
|
||||
oslProcessError eErr = runProcessWithPathSearch(rProgName,
|
||||
pArgs, nArgs,
|
||||
&aProcess, &pIn, &pOut, &pErr);
|
||||
if (eErr!=osl_Process_E_None)
|
||||
return false;
|
||||
|
||||
@ -251,7 +293,7 @@ static bool RenderAsPNGThroughHelper(const sal_uInt8* pBuf, sal_uInt32 nBytesRea
|
||||
|
||||
aMemStm.Seek(0);
|
||||
if (
|
||||
eFileErr == osl_File_E_None &&
|
||||
aMemStm.GetEndOfData() &&
|
||||
GraphicConverter::Import(aMemStm, rGraphic, CVT_PNG) == ERRCODE_NONE
|
||||
)
|
||||
{
|
||||
@ -270,7 +312,7 @@ static bool RenderAsPNGThroughConvert(const sal_uInt8* pBuf, sal_uInt32 nBytesRe
|
||||
Graphic &rGraphic)
|
||||
{
|
||||
rtl::OUString fileName =
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("convert"));
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("convert"EXESUFFIX));
|
||||
// density in pixel/inch
|
||||
rtl::OUString arg1 = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-density"));
|
||||
// since the preview is also used for PDF-Export & printing on non-PS-printers,
|
||||
@ -293,10 +335,10 @@ static bool RenderAsPNGThroughGS(const sal_uInt8* pBuf, sal_uInt32 nBytesRead,
|
||||
{
|
||||
#ifdef WNT
|
||||
rtl::OUString fileName =
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gswin32c"));
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gswin32c"EXESUFFIX));
|
||||
#else
|
||||
rtl::OUString fileName =
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gs"));
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gs"EXESUFFIX));
|
||||
#endif
|
||||
rtl::OUString arg1 =
|
||||
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("-q"));
|
||||
|
@ -846,7 +846,7 @@ void OS2METReader::ReadRelLine(BOOL bGivenPos, USHORT nOrderLen)
|
||||
if (nPolySize==0) return;
|
||||
Polygon aPolygon(nPolySize);
|
||||
for (i=0; i<nPolySize; i++) {
|
||||
#if (defined SOLARIS && defined PPC) || defined IRIX
|
||||
#if defined SOLARIS && defined PPC
|
||||
UINT8 nunsignedbyte;
|
||||
*pOS2MET >> nunsignedbyte; aP0.X()+=(INT8)nunsignedbyte;
|
||||
*pOS2MET >> nunsignedbyte; aP0.Y()+=(INT8)nunsignedbyte;
|
||||
|
@ -845,7 +845,7 @@ const Graphic& GraphicObject::GetGraphic() const
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void GraphicObject::SetGraphic( const Graphic& rGraphic )
|
||||
void GraphicObject::SetGraphic( const Graphic& rGraphic, const GraphicObject* pCopyObj )
|
||||
{
|
||||
mpMgr->ImplUnregisterObj( *this );
|
||||
|
||||
@ -858,7 +858,7 @@ void GraphicObject::SetGraphic( const Graphic& rGraphic )
|
||||
delete mpLink, mpLink = NULL;
|
||||
delete mpSimpleCache, mpSimpleCache = NULL;
|
||||
|
||||
mpMgr->ImplRegisterObj( *this, maGraphic );
|
||||
mpMgr->ImplRegisterObj( *this, maGraphic, 0, pCopyObj);
|
||||
|
||||
if( mpSwapOutTimer )
|
||||
mpSwapOutTimer->Start();
|
||||
|
@ -60,11 +60,16 @@
|
||||
#include "unotools/localedatawrapper.hxx"
|
||||
#include "unotools/configitem.hxx"
|
||||
#include "unotools/configmgr.hxx"
|
||||
|
||||
#include "com/sun/star/awt/Size.hpp"
|
||||
|
||||
using namespace psp;
|
||||
using namespace rtl;
|
||||
using namespace padmin;
|
||||
using namespace osl;
|
||||
using namespace com::sun::star;
|
||||
using namespace com::sun::star::uno;
|
||||
using namespace com::sun::star::beans;
|
||||
|
||||
PADialog* PADialog::Create( Window* pParent, BOOL bAdmin )
|
||||
{
|
||||
@ -96,7 +101,6 @@ PADialog::PADialog( Window* pParent, BOOL /*bAdmin*/ ) :
|
||||
m_aCancelButton( this, PaResId( RID_PA_BTN_CANCEL ) ),
|
||||
m_aDefPrt( PaResId( RID_PA_STR_DEFPRT ) ),
|
||||
m_aRenameStr( PaResId( RID_PA_STR_RENAME ) ),
|
||||
m_pPrinter( 0 ),
|
||||
m_rPIManager( PrinterInfoManager::get() )
|
||||
{
|
||||
FreeResource();
|
||||
@ -248,18 +252,6 @@ IMPL_LINK( PADialog, SelectHdl, ListBox*, pListBox )
|
||||
return 0;
|
||||
}
|
||||
|
||||
IMPL_LINK( PADialog, EndPrintHdl, void*, EMPTYARG )
|
||||
{
|
||||
String aInfoString( PaResId( RID_PA_TXT_TESTPAGE_PRINTED ) );
|
||||
InfoBox aInfoBox( this, aInfoString );
|
||||
aInfoBox.SetText( String( PaResId( RID_BXT_TESTPAGE ) ) );
|
||||
aInfoBox.Execute();
|
||||
|
||||
delete m_pPrinter;
|
||||
m_pPrinter = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PADialog::UpdateDefPrt()
|
||||
{
|
||||
m_rPIManager.setDefaultPrinter( getSelectedDevice() );
|
||||
@ -369,66 +361,77 @@ static Color approachColor( const Color& rFrom, const Color& rTo )
|
||||
return aColor;
|
||||
}
|
||||
|
||||
#define DELTA 5.0
|
||||
void PADialog::PrintTestPage()
|
||||
class SpaPrinterController : public vcl::PrinterController
|
||||
{
|
||||
if( m_pPrinter ) // already printing; user pressed button twice
|
||||
return;
|
||||
public:
|
||||
SpaPrinterController( const boost::shared_ptr<Printer>& i_pPrinter )
|
||||
: vcl::PrinterController( i_pPrinter )
|
||||
{}
|
||||
virtual ~SpaPrinterController()
|
||||
{}
|
||||
|
||||
String sPrinter( getSelectedDevice() );
|
||||
virtual int getPageCount() const { return 1; }
|
||||
virtual Sequence< PropertyValue > getPageParameters( int i_nPage ) const;
|
||||
virtual void printPage( int i_nPage ) const;
|
||||
virtual void jobFinished( com::sun::star::view::PrintableState );
|
||||
};
|
||||
|
||||
m_pPrinter = new Printer( sPrinter );
|
||||
Sequence< PropertyValue > SpaPrinterController::getPageParameters( int ) const
|
||||
{
|
||||
Sequence< PropertyValue > aRet( 1 );
|
||||
|
||||
PrinterInfo aInfo( m_rPIManager.getPrinterInfo( sPrinter ) );
|
||||
Size aPageSize( getPrinter()->GetPaperSizePixel() );
|
||||
aPageSize = getPrinter()->PixelToLogic( aPageSize, MapMode( MAP_100TH_MM ) );
|
||||
|
||||
awt::Size aSize;
|
||||
aSize.Width = aPageSize.Width();
|
||||
aSize.Height = aPageSize.Height();
|
||||
aRet[0].Value = makeAny(aSize);
|
||||
|
||||
return aRet;
|
||||
}
|
||||
|
||||
void SpaPrinterController::printPage( int ) const
|
||||
{
|
||||
const double DELTA = 5.0;
|
||||
|
||||
boost::shared_ptr<Printer> pPrinter( getPrinter() );
|
||||
|
||||
PrinterInfo aInfo( psp::PrinterInfoManager::get().getPrinterInfo( pPrinter->GetName() ) );
|
||||
const PPDParser* pPrintParser = aInfo.m_pParser;
|
||||
|
||||
MapMode aMapMode( MAP_100TH_MM );
|
||||
|
||||
Bitmap aButterfly( PaResId( RID_BUTTERFLY ) );
|
||||
|
||||
m_pPrinter->SetMapMode( aMapMode );
|
||||
m_pPrinter->SetEndPrintHdl( LINK( this, PADialog, EndPrintHdl ) );
|
||||
pPrinter->SetMapMode( aMapMode );
|
||||
|
||||
Any aRet = utl::ConfigManager::GetDirectConfigProperty( utl::ConfigManager::PRODUCTNAME );
|
||||
OUString aJobName;
|
||||
aRet >>= aJobName;
|
||||
|
||||
aJobName = aJobName + OUString( RTL_CONSTASCII_USTRINGPARAM( " Testpage" ) );
|
||||
if( m_pPrinter->GetName() != sPrinter || ! m_pPrinter->StartJob( aJobName ) )
|
||||
{
|
||||
String aString( PaResId( RID_ERR_NOPRINTER ) );
|
||||
aString.SearchAndReplaceAscii( "%s", sPrinter );
|
||||
|
||||
ErrorBox aErrorBox( this, WB_OK | WB_DEF_OK, aString );
|
||||
aErrorBox.SetText( String( PaResId( RID_BXT_ENVIRONMENT ) ) );
|
||||
aErrorBox.Execute();
|
||||
delete m_pPrinter;
|
||||
m_pPrinter = 0;
|
||||
return;
|
||||
}
|
||||
m_pPrinter->StartPage();
|
||||
|
||||
Size aPaperSize=m_pPrinter->GetOutputSize();
|
||||
Size aPaperSize=pPrinter->GetOutputSize();
|
||||
Point aCenter( aPaperSize.Width()/2-300,
|
||||
aPaperSize.Height() - aPaperSize.Width()/2 );
|
||||
Point aP1( aPaperSize.Width()/48, 0), aP2( aPaperSize.Width()/40, 0 ), aPoint;
|
||||
|
||||
m_pPrinter->DrawRect( Rectangle( Point( 0,0 ), aPaperSize ) );
|
||||
m_pPrinter->DrawRect( Rectangle( Point( 100,100 ),
|
||||
pPrinter->DrawRect( Rectangle( Point( 0,0 ), aPaperSize ) );
|
||||
pPrinter->DrawRect( Rectangle( Point( 100,100 ),
|
||||
Size( aPaperSize.Width()-200,
|
||||
aPaperSize.Height()-200 ) ) );
|
||||
m_pPrinter->DrawRect( Rectangle( Point( 200,200 ),
|
||||
pPrinter->DrawRect( Rectangle( Point( 200,200 ),
|
||||
Size( aPaperSize.Width()-400,
|
||||
aPaperSize.Height()-400 ) ) );
|
||||
m_pPrinter->DrawRect( Rectangle( Point( 300,300 ),
|
||||
pPrinter->DrawRect( Rectangle( Point( 300,300 ),
|
||||
Size( aPaperSize.Width()-600,
|
||||
aPaperSize.Height()-600 ) ) );
|
||||
|
||||
Font aFont( m_pPrinter->GetFont() );
|
||||
aFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM( "Courier" ) ) );
|
||||
Font aFont( String( RTL_CONSTASCII_USTRINGPARAM( "Courier" ) ), Size( 0, 400 ) );
|
||||
aFont.SetWeight( WEIGHT_NORMAL );
|
||||
aFont.SetItalic( ITALIC_NONE );
|
||||
m_pPrinter->SetFont( aFont );
|
||||
pPrinter->SetFont( aFont );
|
||||
|
||||
OUStringBuffer aPrintText(1024);
|
||||
long nWidth = 0, nMaxWidth = 0;
|
||||
@ -455,12 +458,12 @@ void PADialog::PrintTestPage()
|
||||
aToken = String::CreateFromAscii( aResIds[i].pDirect );
|
||||
else
|
||||
aToken = String( PaResId( aResIds[i].nResId ) );
|
||||
nMaxWidth = ( nWidth = m_pPrinter->GetTextWidth( aToken ) ) > nMaxWidth ? nWidth : nMaxWidth;
|
||||
nMaxWidth = ( nWidth = pPrinter->GetTextWidth( aToken ) ) > nMaxWidth ? nWidth : nMaxWidth;
|
||||
aPrintText.append( aToken );
|
||||
aPrintText.append( (sal_Unicode)'\n' );
|
||||
};
|
||||
|
||||
m_pPrinter->DrawText( Rectangle( Point( 1000, 2000 ),
|
||||
pPrinter->DrawText( Rectangle( Point( 1000, 1000 ),
|
||||
Size( aPaperSize.Width() - 2000,
|
||||
aPaperSize.Height() - 4000 ) ),
|
||||
aPrintText.makeStringAndClear(),
|
||||
@ -470,7 +473,7 @@ void PADialog::PrintTestPage()
|
||||
const LocaleDataWrapper& rLocaleWrapper( aSettings.GetLocaleDataWrapper() );
|
||||
|
||||
aPrintText.appendAscii( ": " );
|
||||
aPrintText.append( sPrinter );
|
||||
aPrintText.append( pPrinter->GetName() );
|
||||
aPrintText.appendAscii( "\n: " );
|
||||
if( pPrintParser )
|
||||
aPrintText.append( pPrintParser->getPrinterName() );
|
||||
@ -487,17 +490,17 @@ void PADialog::PrintTestPage()
|
||||
aPrintText.appendAscii( "\n: " );
|
||||
aPrintText.append( rLocaleWrapper.getTime( Time() ) );
|
||||
|
||||
m_pPrinter->DrawText( Rectangle( Point( 1100 + nMaxWidth, 2000 ),
|
||||
pPrinter->DrawText( Rectangle( Point( 1100 + nMaxWidth, 1000 ),
|
||||
Size( aPaperSize.Width() - 2100 - nMaxWidth,
|
||||
aPaperSize.Height() - 4000 ) ),
|
||||
aPrintText.makeStringAndClear(),
|
||||
TEXT_DRAW_MULTILINE );
|
||||
|
||||
m_pPrinter->DrawBitmap( Point( aPaperSize.Width() - 4000, 1000 ),
|
||||
pPrinter->DrawBitmap( Point( aPaperSize.Width() - 4000, 1000 ),
|
||||
Size( 3000,3000 ),
|
||||
aButterfly );
|
||||
m_pPrinter->SetFillColor();
|
||||
m_pPrinter->DrawRect( Rectangle( Point( aPaperSize.Width() - 4000, 1000 ),
|
||||
pPrinter->SetFillColor();
|
||||
pPrinter->DrawRect( Rectangle( Point( aPaperSize.Width() - 4000, 1000 ),
|
||||
Size( 3000,3000 ) ) );
|
||||
|
||||
Color aWhite( 0xff, 0xff, 0xff );
|
||||
@ -511,22 +514,22 @@ void PADialog::PrintTestPage()
|
||||
|
||||
Gradient aGradient( GRADIENT_LINEAR, aBlack, aWhite );
|
||||
aGradient.SetAngle( 900 );
|
||||
m_pPrinter->DrawGradient( Rectangle( Point( 1000, 5500 ),
|
||||
pPrinter->DrawGradient( Rectangle( Point( 1000, 5500 ),
|
||||
Size( aPaperSize.Width() - 2000,
|
||||
500 ) ), aGradient );
|
||||
aGradient.SetStartColor( aDarkRed );
|
||||
aGradient.SetEndColor( aLightBlue );
|
||||
m_pPrinter->DrawGradient( Rectangle( Point( 1000, 6300 ),
|
||||
pPrinter->DrawGradient( Rectangle( Point( 1000, 6300 ),
|
||||
Size( aPaperSize.Width() - 2000,
|
||||
500 ) ), aGradient );
|
||||
aGradient.SetStartColor( aDarkBlue );
|
||||
aGradient.SetEndColor( aLightGreen );
|
||||
m_pPrinter->DrawGradient( Rectangle( Point( 1000, 7100 ),
|
||||
pPrinter->DrawGradient( Rectangle( Point( 1000, 7100 ),
|
||||
Size( aPaperSize.Width() - 2000,
|
||||
500 ) ), aGradient );
|
||||
aGradient.SetStartColor( aDarkGreen );
|
||||
aGradient.SetEndColor( aLightRed );
|
||||
m_pPrinter->DrawGradient( Rectangle( Point( 1000, 7900 ),
|
||||
pPrinter->DrawGradient( Rectangle( Point( 1000, 7900 ),
|
||||
Size( aPaperSize.Width() - 2000,
|
||||
500 ) ), aGradient );
|
||||
|
||||
@ -543,7 +546,7 @@ void PADialog::PrintTestPage()
|
||||
{
|
||||
aLineInfo.SetWidth( n/3 );
|
||||
aLineColor = approachColor( aLineColor, aApproachColor );
|
||||
m_pPrinter->SetLineColor( aLineColor );
|
||||
pPrinter->SetLineColor( aLineColor );
|
||||
|
||||
// switch aproach color
|
||||
if( aApproachColor.IsRGBEqual( aLineColor ) )
|
||||
@ -556,7 +559,7 @@ void PADialog::PrintTestPage()
|
||||
aApproachColor = Color( 0, 200, 0 );
|
||||
}
|
||||
|
||||
m_pPrinter->DrawLine( project( aP1 ) + aCenter,
|
||||
pPrinter->DrawLine( project( aP1 ) + aCenter,
|
||||
project( aP2 ) + aCenter,
|
||||
aLineInfo );
|
||||
aPoint.X() = (int)((((double)aP1.X())*cosd - ((double)aP1.Y())*sind)*factor);
|
||||
@ -569,8 +572,38 @@ void PADialog::PrintTestPage()
|
||||
#if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL
|
||||
fprintf( stderr, "%d lines\n",n );
|
||||
#endif
|
||||
m_pPrinter->EndPage();
|
||||
m_pPrinter->EndJob();
|
||||
}
|
||||
|
||||
void SpaPrinterController::jobFinished( com::sun::star::view::PrintableState )
|
||||
{
|
||||
String aInfoString( PaResId( RID_PA_TXT_TESTPAGE_PRINTED ) );
|
||||
InfoBox aInfoBox( NULL, aInfoString );
|
||||
aInfoBox.SetText( String( PaResId( RID_BXT_TESTPAGE ) ) );
|
||||
aInfoBox.Execute();
|
||||
}
|
||||
|
||||
void PADialog::PrintTestPage()
|
||||
{
|
||||
String sPrinter( getSelectedDevice() );
|
||||
|
||||
boost::shared_ptr<Printer> pPrinter( new Printer( sPrinter ) );
|
||||
|
||||
if( pPrinter->GetName() != sPrinter )
|
||||
{
|
||||
String aString( PaResId( RID_ERR_NOPRINTER ) );
|
||||
aString.SearchAndReplaceAscii( "%s", sPrinter );
|
||||
|
||||
ErrorBox aErrorBox( this, WB_OK | WB_DEF_OK, aString );
|
||||
aErrorBox.SetText( String( PaResId( RID_BXT_ENVIRONMENT ) ) );
|
||||
aErrorBox.Execute();
|
||||
return;
|
||||
}
|
||||
|
||||
boost::shared_ptr<vcl::PrinterController> pController( new SpaPrinterController( pPrinter ) );
|
||||
JobSetup aJobSetup( pPrinter->GetJobSetup() );
|
||||
aJobSetup.SetValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) ),
|
||||
String( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) );
|
||||
Printer::PrintJob( pController, aJobSetup );
|
||||
}
|
||||
|
||||
void PADialog::AddDevice()
|
||||
|
@ -83,7 +83,6 @@ namespace padmin {
|
||||
String m_aDefPrt;
|
||||
String m_aRenameStr;
|
||||
|
||||
Printer* m_pPrinter;
|
||||
::psp::PrinterInfoManager& m_rPIManager;
|
||||
::std::list< ::rtl::OUString > m_aPrinters;
|
||||
|
||||
@ -94,7 +93,6 @@ namespace padmin {
|
||||
DECL_LINK( ClickBtnHdl, PushButton* );
|
||||
DECL_LINK( DoubleClickHdl, ListBox* );
|
||||
DECL_LINK( SelectHdl, ListBox* );
|
||||
DECL_LINK( EndPrintHdl, void* );
|
||||
DECL_LINK( DelPressedHdl, ListBox* );
|
||||
|
||||
PADialog( Window*, BOOL );
|
||||
|
@ -2281,6 +2281,7 @@ RscTop * RscTypCont::InitClassTabControl( RscTop * pSuper,
|
||||
RSC_TABCONTROL_ITEMLIST );
|
||||
|
||||
INS_WINBIT( pClassTabControl, SingleLine );
|
||||
INS_WINBIT( pClassTabControl, DropDown );
|
||||
}
|
||||
|
||||
return pClassTabControl;
|
||||
|
@ -317,7 +317,7 @@ int yylex()
|
||||
/****************** yyerror **********************************************/
|
||||
#ifdef RS6000
|
||||
extern "C" void yyerror( char* pMessage )
|
||||
#elif defined HP9000 || defined SCO || defined IRIX || defined SOLARIS
|
||||
#elif defined HP9000 || defined SCO || defined SOLARIS
|
||||
extern "C" void yyerror( const char* pMessage )
|
||||
#else
|
||||
void yyerror( char* pMessage )
|
||||
|
@ -107,7 +107,7 @@ class ObjectStack {
|
||||
extern "C" int yyparse(); // forward Deklaration fuer erzeugte Funktion
|
||||
extern "C" void yyerror( char * );
|
||||
extern "C" int yylex( void );
|
||||
#elif defined( HP9000 ) || defined( SCO ) || defined ( IRIX ) || defined ( SOLARIS )
|
||||
#elif defined( HP9000 ) || defined( SCO ) || defined ( SOLARIS )
|
||||
extern "C" int yyparse(); // forward Deklaration fuer erzeugte Funktion
|
||||
extern "C" void yyerror( const char * );
|
||||
extern "C" int yylex( void );
|
||||
|
@ -40,10 +40,6 @@ ENABLE_EXCEPTIONS=true
|
||||
|
||||
.INCLUDE : settings.mk
|
||||
|
||||
.IF "$(OS)"=="IRIX"
|
||||
NOOPTFILES= $(OBJ)$/rsc.obj
|
||||
.ENDIF
|
||||
|
||||
OBJFILES= $(OBJ)$/rsc.obj
|
||||
|
||||
.INCLUDE : target.mk
|
||||
|
@ -1104,7 +1104,7 @@ StgTmpStrm::~StgTmpStrm()
|
||||
}
|
||||
}
|
||||
|
||||
ULONG StgTmpStrm::GetSize()
|
||||
ULONG StgTmpStrm::GetSize() const
|
||||
{
|
||||
ULONG n;
|
||||
if( pStrm )
|
||||
|
@ -167,8 +167,7 @@ public:
|
||||
~StgTmpStrm();
|
||||
BOOL Copy( StgTmpStrm& );
|
||||
void SetSize( ULONG );
|
||||
using SvMemoryStream::GetSize;
|
||||
ULONG GetSize();
|
||||
ULONG GetSize() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -2,13 +2,10 @@
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2008 by Sun Microsystems, Inc.
|
||||
* Copyright 2009 by Sun Microsystems, Inc.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* $RCSfile: solar.hrc,v $
|
||||
* $Revision: 1.6 $
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* OpenOffice.org is free software: you can redistribute it and/or modify
|
||||
@ -171,6 +168,9 @@
|
||||
|
||||
#define HID_START 32768
|
||||
|
||||
#define HID_VCL_START (HID_START+100)
|
||||
#define HID_VCL_END (HID_START+150)
|
||||
|
||||
#define HID_SVTOOLS_START (HID_START+200)
|
||||
#define HID_SVTOOLS_END (HID_START+299)
|
||||
|
||||
@ -207,8 +207,10 @@
|
||||
#define HID_GOODIES_START (HID_LIB_START+2100)
|
||||
#define HID_GOODIES_END (HID_LIB_START+2199)
|
||||
|
||||
#if 0 // currently unused range
|
||||
#define HID_SCHEDULE_START (HID_LIB_START+2200)
|
||||
#define HID_SCHEDULE_END (HID_LIB_START+3399)
|
||||
#endif
|
||||
|
||||
#define HID_CHANNEL_START (HID_LIB_START+3400)
|
||||
#define HID_CHANNEL_END (HID_LIB_START+3499)
|
||||
@ -300,6 +302,5 @@
|
||||
#define HID_EXTENSIONS_START (HID_OBJ_START+2281)
|
||||
#define HID_EXTENSIONS_END (HID_OBJ_START+2800)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1034,7 +1034,7 @@ public:\
|
||||
#define C40_PTR_REPLACE( c, p) Replace( (c const *) p )
|
||||
#define C40_GETPOS( c, r) GetPos( (c const *)r )
|
||||
#else
|
||||
#if defined WTC || defined IRIX || defined ICC || defined HPUX || (defined GCC && __GNUC__ >= 3) || (defined(WNT) && _MSC_VER >= 1400)
|
||||
#if defined WTC || defined ICC || defined HPUX || (defined GCC && __GNUC__ >= 3) || (defined(WNT) && _MSC_VER >= 1400)
|
||||
#define C40_INSERT( c, p, n ) Insert( (c const *&) p, n )
|
||||
#define C40_PUSH( c, p) Push( (c const *&) p )
|
||||
#define C40_PTR_INSERT( c, p ) Insert( (c const *&) p )
|
||||
|
@ -139,7 +139,7 @@ ImpSvNumMultipleReadHeader::ImpSvNumMultipleReadHeader(SvStream& rNewStream) :
|
||||
|
||||
ImpSvNumMultipleReadHeader::~ImpSvNumMultipleReadHeader()
|
||||
{
|
||||
DBG_ASSERT( pMemStream->Tell() == pMemStream->GetSize(),
|
||||
DBG_ASSERT( pMemStream->Tell() == pMemStream->GetEndOfData(),
|
||||
"Sizes nicht vollstaendig gelesen" );
|
||||
delete pMemStream;
|
||||
delete [] pBuf;
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
|
||||
static rtl_TextEncoding nActualTextEncoding;
|
||||
|
||||
IMapObject() {};
|
||||
IMapObject();
|
||||
IMapObject( const String& rURL,
|
||||
const String& rAltText,
|
||||
const String& rDesc,
|
||||
|
@ -78,6 +78,9 @@ WinBits FileControl::ImplInitStyle( WinBits nStyle )
|
||||
maButton.SetStyle( (maButton.GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) );
|
||||
}
|
||||
|
||||
const WinBits nAlignmentStyle = ( WB_TOP | WB_VCENTER | WB_BOTTOM );
|
||||
maEdit.SetStyle( ( maEdit.GetStyle() & ~nAlignmentStyle ) | ( nStyle & nAlignmentStyle ) );
|
||||
|
||||
if ( !(nStyle & WB_NOGROUP) )
|
||||
nStyle |= WB_GROUP;
|
||||
|
||||
|
@ -59,7 +59,7 @@ void ImplFillPrnDlgListBox( const Printer* pPrinter,
|
||||
}
|
||||
|
||||
pBox->Enable( nCount != 0 );
|
||||
pPropBtn->Enable( pPrinter->HasSupport( SUPPORT_SETUPDIALOG ) );
|
||||
pPropBtn->Show( pPrinter->HasSupport( SUPPORT_SETUPDIALOG ) );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
@ -471,7 +471,8 @@ BOOL GraphicDescriptor::ImpDetectJPG( SvStream& rStm, BOOL bExtendedInfo )
|
||||
|
||||
// Groesse des verbleibenden Puffers ermitteln
|
||||
if ( bLinked )
|
||||
nMax = ( (SvMemoryStream&) rStm ).GetSize() - 16;
|
||||
nMax = static_cast< SvMemoryStream& >(rStm).GetEndOfData()
|
||||
- 16;
|
||||
else
|
||||
nMax = DATA_SIZE - 16;
|
||||
|
||||
|
@ -33,6 +33,9 @@
|
||||
|
||||
#include "emfwr.hxx"
|
||||
#include <vcl/salbtype.hxx>
|
||||
#include <basegfx/polygon/b2dpolygon.hxx>
|
||||
#include <basegfx/polygon/b2dpolypolygon.hxx>
|
||||
#include <vcl/lineinfo.hxx>
|
||||
|
||||
// -----------
|
||||
// - Defines -
|
||||
@ -829,6 +832,46 @@ void EMFWriter::ImplWriteTextRecord( const Point& rPos, const String rText, cons
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void EMFWriter::Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon)
|
||||
{
|
||||
if(rLinePolygon.count())
|
||||
{
|
||||
basegfx::B2DPolyPolygon aLinePolyPolygon(rLinePolygon);
|
||||
basegfx::B2DPolyPolygon aFillPolyPolygon;
|
||||
|
||||
rInfo.applyToB2DPolyPolygon(aLinePolyPolygon, aFillPolyPolygon);
|
||||
|
||||
if(aLinePolyPolygon.count())
|
||||
{
|
||||
for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++)
|
||||
{
|
||||
const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a));
|
||||
ImplWritePolygonRecord( Polygon(aCandidate), FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
if(aFillPolyPolygon.count())
|
||||
{
|
||||
const Color aOldLineColor(maVDev.GetLineColor());
|
||||
const Color aOldFillColor(maVDev.GetFillColor());
|
||||
|
||||
maVDev.SetLineColor();
|
||||
maVDev.SetFillColor(aOldLineColor);
|
||||
|
||||
for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++)
|
||||
{
|
||||
const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a));
|
||||
ImplWritePolyPolygonRecord(PolyPolygon(Polygon(aPolygon)));
|
||||
}
|
||||
|
||||
maVDev.SetLineColor(aOldLineColor);
|
||||
maVDev.SetFillColor(aOldFillColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
|
||||
{
|
||||
for( ULONG j = 0, nActionCount = rMtf.GetActionCount(); j < nActionCount; j++ )
|
||||
@ -871,20 +914,31 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
|
||||
{
|
||||
const MetaLineAction* pA = (const MetaLineAction*) pAction;
|
||||
|
||||
ImplCheckLineAttr();
|
||||
if(pA->GetLineInfo().IsDefault())
|
||||
{
|
||||
ImplCheckLineAttr();
|
||||
|
||||
ImplBeginRecord( WIN_EMR_MOVETOEX );
|
||||
ImplWritePoint( pA->GetStartPoint() );
|
||||
ImplEndRecord();
|
||||
ImplBeginRecord( WIN_EMR_MOVETOEX );
|
||||
ImplWritePoint( pA->GetStartPoint() );
|
||||
ImplEndRecord();
|
||||
|
||||
ImplBeginRecord( WIN_EMR_LINETO );
|
||||
ImplWritePoint( pA->GetEndPoint() );
|
||||
ImplEndRecord();
|
||||
ImplBeginRecord( WIN_EMR_LINETO );
|
||||
ImplWritePoint( pA->GetEndPoint() );
|
||||
ImplEndRecord();
|
||||
|
||||
ImplBeginRecord( WIN_EMR_SETPIXELV );
|
||||
ImplWritePoint( pA->GetEndPoint() );
|
||||
ImplWriteColor( maVDev.GetLineColor() );
|
||||
ImplEndRecord();
|
||||
ImplBeginRecord( WIN_EMR_SETPIXELV );
|
||||
ImplWritePoint( pA->GetEndPoint() );
|
||||
ImplWriteColor( maVDev.GetLineColor() );
|
||||
ImplEndRecord();
|
||||
}
|
||||
else
|
||||
{
|
||||
// LineInfo used; handle Dash/Dot and fat lines
|
||||
basegfx::B2DPolygon aPolygon;
|
||||
aPolygon.append(basegfx::B2DPoint(pA->GetStartPoint().X(), pA->GetStartPoint().Y()));
|
||||
aPolygon.append(basegfx::B2DPoint(pA->GetEndPoint().X(), pA->GetEndPoint().Y()));
|
||||
Impl_handleLineInfoPolyPolygons(pA->GetLineInfo(), aPolygon);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -983,7 +1037,23 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
|
||||
case( META_POLYLINE_ACTION ):
|
||||
{
|
||||
if( maVDev.IsLineColor() )
|
||||
ImplWritePolygonRecord( ( (const MetaPolyLineAction*) pAction )->GetPolygon(), FALSE );
|
||||
{
|
||||
const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pAction;
|
||||
const Polygon& rPoly = pA->GetPolygon();
|
||||
|
||||
if( rPoly.GetSize() )
|
||||
{
|
||||
if(pA->GetLineInfo().IsDefault())
|
||||
{
|
||||
ImplWritePolygonRecord( rPoly, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
// LineInfo used; handle Dash/Dot and fat lines
|
||||
Impl_handleLineInfoPolyPolygons(pA->GetLineInfo(), rPoly.getB2DPolygon());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -42,6 +42,9 @@
|
||||
// - EMFWriter -
|
||||
// -------------
|
||||
|
||||
class LineInfo;
|
||||
namespace basegfx { class B2DPolygon; }
|
||||
|
||||
class EMFWriter
|
||||
{
|
||||
private:
|
||||
@ -86,6 +89,7 @@ private:
|
||||
void ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, const Size& rSz, UINT32 nROP );
|
||||
void ImplWriteTextRecord( const Point& rPos, const String rText, const sal_Int32* pDXArray, sal_uInt32 nWidth );
|
||||
|
||||
void Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon);
|
||||
void ImplWrite( const GDIMetaFile& rMtf );
|
||||
|
||||
public:
|
||||
|
@ -42,8 +42,9 @@
|
||||
#include <i18nutil/unicode.hxx> //unicode::getUnicodeScriptType
|
||||
#endif
|
||||
|
||||
|
||||
#include <vcl/metric.hxx>
|
||||
#include <basegfx/polygon/b2dpolygon.hxx>
|
||||
#include <basegfx/polygon/b2dpolypolygon.hxx>
|
||||
|
||||
//====================== MS-Windows-defines ===============================
|
||||
|
||||
@ -1136,6 +1137,49 @@ void WMFWriter::SetAllAttr()
|
||||
}
|
||||
|
||||
|
||||
void WMFWriter::HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon)
|
||||
{
|
||||
if(rLinePolygon.count())
|
||||
{
|
||||
basegfx::B2DPolyPolygon aLinePolyPolygon(rLinePolygon);
|
||||
basegfx::B2DPolyPolygon aFillPolyPolygon;
|
||||
|
||||
rInfo.applyToB2DPolyPolygon(aLinePolyPolygon, aFillPolyPolygon);
|
||||
|
||||
if(aLinePolyPolygon.count())
|
||||
{
|
||||
aSrcLineInfo = rInfo;
|
||||
SetLineAndFillAttr();
|
||||
|
||||
for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++)
|
||||
{
|
||||
const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a));
|
||||
WMFRecord_PolyLine(Polygon(aCandidate));
|
||||
}
|
||||
}
|
||||
|
||||
if(aFillPolyPolygon.count())
|
||||
{
|
||||
const Color aOldLineColor(aSrcLineColor);
|
||||
const Color aOldFillColor(aSrcFillColor);
|
||||
|
||||
aSrcLineColor = Color( COL_TRANSPARENT );
|
||||
aSrcFillColor = aOldLineColor;
|
||||
SetLineAndFillAttr();
|
||||
|
||||
for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++)
|
||||
{
|
||||
const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a));
|
||||
WMFRecord_Polygon(Polygon(aPolygon));
|
||||
}
|
||||
|
||||
aSrcLineColor = aOldLineColor;
|
||||
aSrcFillColor = aOldFillColor;
|
||||
SetLineAndFillAttr();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
|
||||
{
|
||||
ULONG nA, nACount;
|
||||
@ -1176,10 +1220,21 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
|
||||
case META_LINE_ACTION:
|
||||
{
|
||||
const MetaLineAction* pA = (const MetaLineAction *) pMA;
|
||||
aSrcLineInfo = pA->GetLineInfo();
|
||||
SetLineAndFillAttr();
|
||||
WMFRecord_MoveTo( pA->GetStartPoint() );
|
||||
WMFRecord_LineTo( pA->GetEndPoint() );
|
||||
if(pA->GetLineInfo().IsDefault())
|
||||
{
|
||||
aSrcLineInfo = pA->GetLineInfo();
|
||||
SetLineAndFillAttr();
|
||||
WMFRecord_MoveTo( pA->GetStartPoint() );
|
||||
WMFRecord_LineTo( pA->GetEndPoint() );
|
||||
}
|
||||
else
|
||||
{
|
||||
// LineInfo used; handle Dash/Dot and fat lines
|
||||
basegfx::B2DPolygon aPolygon;
|
||||
aPolygon.append(basegfx::B2DPoint(pA->GetStartPoint().X(), pA->GetStartPoint().Y()));
|
||||
aPolygon.append(basegfx::B2DPoint(pA->GetEndPoint().X(), pA->GetEndPoint().Y()));
|
||||
HandleLineInfoPolyPolygons(pA->GetLineInfo(), aPolygon);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1241,9 +1296,22 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
|
||||
case META_POLYLINE_ACTION:
|
||||
{
|
||||
const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pMA;
|
||||
aSrcLineInfo = pA->GetLineInfo();
|
||||
SetLineAndFillAttr();
|
||||
WMFRecord_PolyLine( pA->GetPolygon() );
|
||||
const Polygon& rPoly = pA->GetPolygon();
|
||||
|
||||
if( rPoly.GetSize() )
|
||||
{
|
||||
if(pA->GetLineInfo().IsDefault())
|
||||
{
|
||||
aSrcLineInfo = pA->GetLineInfo();
|
||||
SetLineAndFillAttr();
|
||||
WMFRecord_PolyLine( rPoly );
|
||||
}
|
||||
else
|
||||
{
|
||||
// LineInfo used; handle Dash/Dot and fat lines
|
||||
HandleLineInfoPolyPolygons(pA->GetLineInfo(), rPoly.getB2DPolygon());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -65,6 +65,9 @@ struct WMFWriterAttrStackMember
|
||||
// -------------
|
||||
|
||||
class StarSymbolToMSMultiFont;
|
||||
class LineInfo;
|
||||
namespace basegfx { class B2DPolygon; }
|
||||
|
||||
class WMFWriter
|
||||
{
|
||||
private:
|
||||
@ -202,6 +205,7 @@ private:
|
||||
void SetLineAndFillAttr();
|
||||
void SetAllAttr();
|
||||
|
||||
void HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon);
|
||||
void WriteRecords(const GDIMetaFile & rMTF);
|
||||
|
||||
void WriteHeader(const GDIMetaFile & rMTF, BOOL bPlaceable);
|
||||
|
@ -64,6 +64,12 @@ UINT16 IMapObject::nActualTextEncoding = (UINT16) RTL_TEXTENCODING_DONTKNOW;
|
||||
#pragma optimize ( "", off )
|
||||
#endif
|
||||
|
||||
IMapObject::IMapObject()
|
||||
: bActive( false )
|
||||
, nReadVersion( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
IMapObject::IMapObject( const String& rURL, const String& rAltText, const String& rDesc,
|
||||
const String& rTarget, const String& rName, BOOL bURLActive )
|
||||
: aURL( rURL )
|
||||
@ -72,6 +78,7 @@ IMapObject::IMapObject( const String& rURL, const String& rAltText, const String
|
||||
, aTarget( rTarget )
|
||||
, aName( rName )
|
||||
, bActive( bURLActive )
|
||||
, nReadVersion( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -548,86 +548,6 @@ void VCLXMultiLineEdit::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
|
||||
VCLXWindow::ImplGetPropertyIds( rIds, true );
|
||||
|
||||
}
|
||||
// ----------------------------------------------------
|
||||
// class VCLXFileDialog
|
||||
// ----------------------------------------------------
|
||||
/*
|
||||
VCLXFileDialog::VCLXFileDialog()
|
||||
{
|
||||
}
|
||||
|
||||
VCLXFileDialog::~VCLXFileDialog()
|
||||
{
|
||||
}
|
||||
|
||||
::com::sun::star::uno::Any VCLXFileDialog::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
|
||||
{
|
||||
::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
|
||||
SAL_STATIC_CAST( ::com::sun::star::awt::XXX*, this ) );
|
||||
return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
|
||||
}
|
||||
|
||||
// ::com::sun::star::lang::XTypeProvider
|
||||
IMPL_XTYPEPROVIDER_START( VCLXFileDialog )
|
||||
getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XXX>* ) NULL )
|
||||
IMPL_XTYPEPROVIDER_END
|
||||
|
||||
void VCLXFileDialog::setPath( const ::rtl::OUString& rPath )
|
||||
{
|
||||
::vos::OGuard aGuard( GetMutex() );
|
||||
|
||||
FileDialog* pDlg = (FileDialog*)GetWindow();
|
||||
if ( pDlg )
|
||||
pDlg->SetPath( ::rtl::OUStringToOString( rPath, CHARSET_SYSTEM ) );
|
||||
}
|
||||
|
||||
::rtl::OUString VCLXFileDialog::getPath()
|
||||
{
|
||||
::vos::OGuard aGuard( GetMutex() );
|
||||
|
||||
::rtl::OUString aPath;
|
||||
FileDialog* pDlg = (FileDialog*)GetWindow();
|
||||
if ( pDlg )
|
||||
aPath = StringToOUString( pDlg->GetPath(), CHARSET_SYSTEM );
|
||||
return aPath;
|
||||
}
|
||||
|
||||
void VCLXFileDialog::setFilters( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& rFilterNames, const ::com::sun::star::uno::Sequence< ::rtl::OUString>& rMasks )
|
||||
{
|
||||
::vos::OGuard aGuard( GetMutex() );
|
||||
|
||||
FileDialog* pDlg = (FileDialog*)GetWindow();
|
||||
if ( pDlg )
|
||||
{
|
||||
sal_uInt32 nFlts = rFilterNames.getLength();
|
||||
for ( sal_uInt32 n = 0; n < nFlts; n++ )
|
||||
pDlg->AddFilter(
|
||||
::rtl::OUStringToOString( rFilterNames.getConstArray()[n], CHARSET_SYSTEM ),
|
||||
::rtl::OUStringToOString( rMasks.getConstArray()[n], CHARSET_SYSTEM ) );
|
||||
}
|
||||
}
|
||||
|
||||
void VCLXFileDialog::setCurrentFilter( const ::rtl::OUString& rFilterName )
|
||||
{
|
||||
::vos::OGuard aGuard( GetMutex() );
|
||||
|
||||
FileDialog* pDlg = (FileDialog*)GetWindow();
|
||||
if ( pDlg )
|
||||
pDlg->SetCurFilter( ::rtl::OUStringToOString( rFilterName, CHARSET_SYSTEM ) );
|
||||
}
|
||||
|
||||
::rtl::OUString VCLXFileDialog::getCurrentFilter()
|
||||
{
|
||||
::vos::OGuard aGuard( GetMutex() );
|
||||
|
||||
::rtl::OUString aFilter;
|
||||
FileDialog* pDlg = (FileDialog*)GetWindow();
|
||||
if ( pDlg )
|
||||
aFilter = StringToOUString( pDlg->GetCurFilter(), CHARSET_SYSTEM );
|
||||
return aFilter;
|
||||
}
|
||||
*/
|
||||
|
||||
// ----------------------------------------------------
|
||||
// class VCLXFileControl
|
||||
// ----------------------------------------------------
|
||||
|
@ -112,6 +112,7 @@ SHL1STDLIBS+= \
|
||||
$(VCLLIB) \
|
||||
$(SVLLIB) \
|
||||
$(SOTLIB) \
|
||||
$(BASEGFXLIB) \
|
||||
$(UNOTOOLSLIB) \
|
||||
$(TOOLSLIB) \
|
||||
$(I18NISOLANGLIB) \
|
||||
|
@ -43,9 +43,7 @@
|
||||
#include <toolkit/helper/mutexandbroadcasthelper.hxx>
|
||||
#include <cppuhelper/propshlp.hxx>
|
||||
|
||||
class Printer;
|
||||
class String;
|
||||
|
||||
#include "vcl/oldprintadaptor.hxx"
|
||||
|
||||
// Fuer den Drucker relevante Properties:
|
||||
/*
|
||||
@ -65,20 +63,17 @@ class VCLXPrinterPropertySet : public ::com::sun::star::awt::XPrinterPropertySe
|
||||
public MutexAndBroadcastHelper,
|
||||
public ::cppu::OPropertySetHelper
|
||||
{
|
||||
private:
|
||||
Printer* mpPrinter;
|
||||
protected:
|
||||
boost::shared_ptr<Printer> mpPrinter;
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > mxPrnDevice;
|
||||
|
||||
sal_Int16 mnOrientation;
|
||||
sal_Bool mbHorizontal;
|
||||
|
||||
protected:
|
||||
|
||||
public:
|
||||
VCLXPrinterPropertySet( const String& rPrinterName );
|
||||
virtual ~VCLXPrinterPropertySet();
|
||||
|
||||
Printer* GetPrinter() const { return mpPrinter; }
|
||||
Printer* GetPrinter() const { return mpPrinter.get(); }
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > GetDevice();
|
||||
|
||||
// ::com::sun::star::uno::XInterface
|
||||
@ -120,6 +115,8 @@ class VCLXPrinter: public ::com::sun::star::awt::XPrinter,
|
||||
public VCLXPrinterPropertySet,
|
||||
public ::cppu::OWeakObject
|
||||
{
|
||||
boost::shared_ptr<vcl::OldStylePrintAdaptor> mpListener;
|
||||
JobSetup maInitJobSetup;
|
||||
public:
|
||||
VCLXPrinter( const String& rPrinterName );
|
||||
~VCLXPrinter();
|
||||
|
@ -102,10 +102,10 @@ IMPL_XTYPEPROVIDER_END
|
||||
|
||||
VCLXPrinterPropertySet::VCLXPrinterPropertySet( const String& rPrinterName )
|
||||
: OPropertySetHelper( BrdcstHelper )
|
||||
, mpPrinter( new Printer( rPrinterName ) )
|
||||
{
|
||||
osl::Guard< vos::IMutex > aSolarGuard( Application::GetSolarMutex() );
|
||||
|
||||
mpPrinter = new Printer( rPrinterName );
|
||||
mnOrientation = 0;
|
||||
mbHorizontal = sal_False;
|
||||
}
|
||||
@ -113,8 +113,7 @@ VCLXPrinterPropertySet::VCLXPrinterPropertySet( const String& rPrinterName )
|
||||
VCLXPrinterPropertySet::~VCLXPrinterPropertySet()
|
||||
{
|
||||
osl::Guard< vos::IMutex > aSolarGuard( Application::GetSolarMutex() );
|
||||
|
||||
delete mpPrinter;
|
||||
mpPrinter.reset();
|
||||
}
|
||||
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinterPropertySet::GetDevice()
|
||||
@ -326,13 +325,16 @@ IMPL_XTYPEPROVIDER_START( VCLXPrinter )
|
||||
VCLXPrinterPropertySet::getTypes()
|
||||
IMPL_XTYPEPROVIDER_END
|
||||
|
||||
sal_Bool VCLXPrinter::start( const ::rtl::OUString& rJobName, sal_Int16 /*nCopies*/, sal_Bool /*bCollate*/ ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
|
||||
sal_Bool VCLXPrinter::start( const ::rtl::OUString& /*rJobName*/, sal_Int16 /*nCopies*/, sal_Bool /*bCollate*/ ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
|
||||
{
|
||||
::osl::Guard< ::osl::Mutex > aGuard( Mutex );
|
||||
|
||||
sal_Bool bDone = sal_True;
|
||||
if ( GetPrinter() )
|
||||
bDone = GetPrinter()->StartJob( rJobName );
|
||||
if ( mpListener.get() )
|
||||
{
|
||||
maInitJobSetup = mpPrinter->GetJobSetup();
|
||||
mpListener.reset( new vcl::OldStylePrintAdaptor( mpPrinter ) );
|
||||
}
|
||||
|
||||
return bDone;
|
||||
}
|
||||
@ -341,24 +343,28 @@ void VCLXPrinter::end( ) throw(::com::sun::star::awt::PrinterException, ::com::
|
||||
{
|
||||
::osl::Guard< ::osl::Mutex > aGuard( Mutex );
|
||||
|
||||
if ( GetPrinter() )
|
||||
GetPrinter()->EndJob();
|
||||
if ( mpListener.get() )
|
||||
{
|
||||
Printer::PrintJob( mpListener, maInitJobSetup );
|
||||
mpListener.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void VCLXPrinter::terminate( ) throw(::com::sun::star::uno::RuntimeException)
|
||||
{
|
||||
::osl::Guard< ::osl::Mutex > aGuard( Mutex );
|
||||
|
||||
if ( GetPrinter() )
|
||||
GetPrinter()->AbortJob();
|
||||
mpListener.reset();
|
||||
}
|
||||
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinter::startPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException)
|
||||
{
|
||||
::osl::Guard< ::osl::Mutex > aGuard( Mutex );
|
||||
|
||||
if ( GetPrinter() )
|
||||
GetPrinter()->StartPage();
|
||||
if ( mpListener.get() )
|
||||
{
|
||||
mpListener->StartPage();
|
||||
}
|
||||
return GetDevice();
|
||||
}
|
||||
|
||||
@ -366,8 +372,10 @@ void VCLXPrinter::endPage( ) throw(::com::sun::star::awt::PrinterException, ::c
|
||||
{
|
||||
::osl::Guard< ::osl::Mutex > aGuard( Mutex );
|
||||
|
||||
if ( GetPrinter() )
|
||||
GetPrinter()->EndPage();
|
||||
if ( mpListener.get() )
|
||||
{
|
||||
mpListener->EndPage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -3390,6 +3390,7 @@ void VCLXEdit::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
|
||||
BASEPROPERTY_PAINTTRANSPARENT,
|
||||
BASEPROPERTY_AUTOHSCROLL,
|
||||
BASEPROPERTY_AUTOVSCROLL,
|
||||
BASEPROPERTY_VERTICALALIGN,
|
||||
BASEPROPERTY_WRITING_MODE,
|
||||
BASEPROPERTY_CONTEXT_WRITING_MODE,
|
||||
0);
|
||||
@ -4283,6 +4284,7 @@ void VCLXDateField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
|
||||
BASEPROPERTY_ENFORCE_FORMAT,
|
||||
BASEPROPERTY_TEXT,
|
||||
BASEPROPERTY_HIDEINACTIVESELECTION,
|
||||
BASEPROPERTY_VERTICALALIGN,
|
||||
BASEPROPERTY_WRITING_MODE,
|
||||
BASEPROPERTY_CONTEXT_WRITING_MODE,
|
||||
BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
|
||||
@ -4624,6 +4626,7 @@ void VCLXTimeField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
|
||||
BASEPROPERTY_ENFORCE_FORMAT,
|
||||
BASEPROPERTY_TEXT,
|
||||
BASEPROPERTY_HIDEINACTIVESELECTION,
|
||||
BASEPROPERTY_VERTICALALIGN,
|
||||
BASEPROPERTY_WRITING_MODE,
|
||||
BASEPROPERTY_CONTEXT_WRITING_MODE,
|
||||
BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
|
||||
@ -4927,6 +4930,7 @@ void VCLXNumericField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
|
||||
BASEPROPERTY_VALUE_DOUBLE,
|
||||
BASEPROPERTY_ENFORCE_FORMAT,
|
||||
BASEPROPERTY_HIDEINACTIVESELECTION,
|
||||
BASEPROPERTY_VERTICALALIGN,
|
||||
BASEPROPERTY_WRITING_MODE,
|
||||
BASEPROPERTY_CONTEXT_WRITING_MODE,
|
||||
BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
|
||||
@ -5521,6 +5525,7 @@ void VCLXCurrencyField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
|
||||
BASEPROPERTY_VALUE_DOUBLE,
|
||||
BASEPROPERTY_ENFORCE_FORMAT,
|
||||
BASEPROPERTY_HIDEINACTIVESELECTION,
|
||||
BASEPROPERTY_VERTICALALIGN,
|
||||
BASEPROPERTY_WRITING_MODE,
|
||||
BASEPROPERTY_CONTEXT_WRITING_MODE,
|
||||
BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
|
||||
@ -5868,6 +5873,7 @@ void VCLXPatternField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
|
||||
BASEPROPERTY_TABSTOP,
|
||||
BASEPROPERTY_TEXT,
|
||||
BASEPROPERTY_HIDEINACTIVESELECTION,
|
||||
BASEPROPERTY_VERTICALALIGN,
|
||||
BASEPROPERTY_WRITING_MODE,
|
||||
BASEPROPERTY_CONTEXT_WRITING_MODE,
|
||||
BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
|
||||
|
@ -160,6 +160,7 @@ namespace toolkit
|
||||
ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
|
||||
ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION );
|
||||
ImplRegisterProperty( BASEPROPERTY_ENFORCE_FORMAT );
|
||||
ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
|
||||
ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
|
||||
ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
|
||||
ImplRegisterProperty( BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR );
|
||||
|
@ -476,6 +476,7 @@ void UnoEditControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) t
|
||||
// ----------------------------------------------------
|
||||
UnoControlFileControlModel::UnoControlFileControlModel()
|
||||
{
|
||||
ImplRegisterProperty( BASEPROPERTY_ALIGN );
|
||||
ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
|
||||
ImplRegisterProperty( BASEPROPERTY_BORDER );
|
||||
ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
|
||||
@ -489,6 +490,7 @@ UnoControlFileControlModel::UnoControlFileControlModel()
|
||||
ImplRegisterProperty( BASEPROPERTY_READONLY );
|
||||
ImplRegisterProperty( BASEPROPERTY_TABSTOP );
|
||||
ImplRegisterProperty( BASEPROPERTY_TEXT );
|
||||
ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
|
||||
ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
|
||||
ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
|
||||
ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION );
|
||||
|
@ -61,8 +61,6 @@
|
||||
#define TOOLS_INETDEF_OS "FreeBSD/amd64"
|
||||
#elif defined SINIX
|
||||
#define TOOLS_INETDEF_OS "SINIX"
|
||||
#elif defined IRIX
|
||||
#define TOOLS_INETDEF_OS "IRIX"
|
||||
#else // AIX, HPUX, SOLARIS, ...
|
||||
#define TOOLS_INETDEF_OS "Unix"
|
||||
#endif // AIX, HPUX, SOLARIS, ...
|
||||
|
@ -35,6 +35,9 @@
|
||||
#include <tools/list.hxx>
|
||||
#include <tools/string.hxx>
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
||||
#ifdef _SV_MULTISEL_CXX
|
||||
@ -112,4 +115,105 @@ public:
|
||||
const Range& GetRange( ULONG nRange ) const { return *(const Range*)aSels.GetObject(nRange); }
|
||||
};
|
||||
|
||||
class TOOLS_DLLPUBLIC StringRangeEnumerator
|
||||
{
|
||||
struct Range
|
||||
{
|
||||
sal_Int32 nFirst;
|
||||
sal_Int32 nLast;
|
||||
|
||||
Range() : nFirst( -1 ), nLast( -1 ) {}
|
||||
Range( sal_Int32 i_nFirst, sal_Int32 i_nLast ) : nFirst( i_nFirst ), nLast( i_nLast ) {}
|
||||
};
|
||||
std::vector< StringRangeEnumerator::Range > maSequence;
|
||||
sal_Int32 mnCount;
|
||||
sal_Int32 mnMin;
|
||||
sal_Int32 mnMax;
|
||||
sal_Int32 mnOffset;
|
||||
|
||||
bool insertRange( sal_Int32 nFirst, sal_Int32 nLast, bool bSequence, bool bMayAdjust );
|
||||
bool checkValue( sal_Int32, const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const;
|
||||
public:
|
||||
class TOOLS_DLLPUBLIC Iterator
|
||||
{
|
||||
const StringRangeEnumerator* pEnumerator;
|
||||
const std::set< sal_Int32 >* pPossibleValues;
|
||||
sal_Int32 nRangeIndex;
|
||||
sal_Int32 nCurrent;
|
||||
|
||||
friend class StringRangeEnumerator;
|
||||
Iterator( const StringRangeEnumerator* i_pEnum,
|
||||
const std::set< sal_Int32 >* i_pPossibleValues,
|
||||
sal_Int32 i_nRange,
|
||||
sal_Int32 i_nCurrent )
|
||||
: pEnumerator( i_pEnum ), pPossibleValues( i_pPossibleValues )
|
||||
, nRangeIndex( i_nRange ), nCurrent( i_nCurrent ) {}
|
||||
public:
|
||||
Iterator() : pEnumerator( NULL ), pPossibleValues( NULL ), nRangeIndex( -1 ), nCurrent( -1 ) {}
|
||||
Iterator& operator++();
|
||||
sal_Int32 operator*() const;
|
||||
bool operator==(const Iterator&) const;
|
||||
bool operator!=(const Iterator& i_rComp) const
|
||||
{ return ! (*this == i_rComp); }
|
||||
};
|
||||
|
||||
friend class StringRangeEnumerator::Iterator;
|
||||
|
||||
StringRangeEnumerator() : mnCount( 0 ), mnMin( -1 ), mnMax( -1 ), mnOffset( -1 ) {}
|
||||
StringRangeEnumerator( const rtl::OUString& i_rInput,
|
||||
sal_Int32 i_nMinNumber = -1,
|
||||
sal_Int32 i_nMaxNumber = -1,
|
||||
sal_Int32 i_nLogicalOffset = -1
|
||||
);
|
||||
|
||||
size_t size() const { return size_t(mnCount); }
|
||||
Iterator begin( const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const;
|
||||
Iterator end( const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const;
|
||||
|
||||
sal_Int32 getMin() const { return mnMin; }
|
||||
void setMin( sal_Int32 i_nMinValue ) { mnMin = i_nMinValue; }
|
||||
sal_Int32 getMax() const { return mnMax; }
|
||||
void setMax( sal_Int32 i_nMaxValue ) { mnMax = i_nMaxValue; }
|
||||
sal_Int32 getLogicalOffset() const { return mnOffset; }
|
||||
void setLogicalOffset( sal_Int32 i_nOffset ) { mnOffset = i_nOffset; }
|
||||
|
||||
bool setRange( const rtl::OUString& i_rNewRange, bool i_bStrict = false );
|
||||
bool hasValue( sal_Int32 nValue, const std::set< sal_Int32 >* i_pPossibleValues = NULL ) const;
|
||||
|
||||
|
||||
/**
|
||||
i_rPageRange: the string to be changed into a sequence of numbers
|
||||
valid format example "5-3,9,9,7-8" ; instead of ',' ';' or ' ' are allowed as well
|
||||
o_rPageVector: the output sequence of numbers
|
||||
i_nLogicalOffset: an offset to be applied to each number in the string before inserting it in the resulting sequence
|
||||
example: a user enters page numbers from 1 to n (since that is logical)
|
||||
of course usable page numbers in code would start from 0 and end at n-1
|
||||
so the logical offset would be -1
|
||||
i_nMinNumber: the minimum allowed number, a negative number means no minimum check
|
||||
i_nMaxNumber: the maximum allowed number, a negative number means no maximum check
|
||||
|
||||
@returns: true if the input string was valid, o_rPageVector will contain the resulting sequence
|
||||
false if the input string was invalid, o_rPageVector will be unchanged
|
||||
|
||||
behavior:
|
||||
- only non-negative sequence numbers are allowed
|
||||
- only non-negative values in the input string are allowed
|
||||
- the string "-3" will be either
|
||||
* an error if no minimum is given
|
||||
* or result in the sequence i_nMinNumber to 3
|
||||
- the string "3-" will be either
|
||||
* an error if no maximum is given
|
||||
* or result in the seqeuence 3 to i_nMaxNumber
|
||||
- an empty string as input is valid and will result in the range [min,max] if given
|
||||
or an empty vector, if not
|
||||
*/
|
||||
static bool getRangesFromString( const rtl::OUString& i_rPageRange,
|
||||
std::vector< sal_Int32 >& o_rPageVector,
|
||||
sal_Int32 i_nMinNumber = -1,
|
||||
sal_Int32 i_nMaxNumber = -1,
|
||||
sal_Int32 i_nLogicalOffset = -1,
|
||||
std::set< sal_Int32 >* i_pPossibleValues = NULL
|
||||
);
|
||||
};
|
||||
|
||||
#endif // _SV_MULTISEL_HXX
|
||||
|
@ -393,8 +393,6 @@ template<typename T> inline T Abs(T a) { return (a>=0?a:-a); }
|
||||
#define __DLLEXTENSION "fi.so"
|
||||
#elif defined FREEBSD && defined X86_64
|
||||
#define __DLLEXTENSION "fx.so"
|
||||
#elif defined IRIX
|
||||
#define __DLLEXTENSION "im.so"
|
||||
#elif defined MACOSX && defined POWERPC
|
||||
#define __DLLEXTENSION "mxp.dylib"
|
||||
#elif defined MACOSX && defined X86
|
||||
|
@ -776,6 +776,9 @@ class TOOLS_DLLPUBLIC SvMemoryStream : public SvStream
|
||||
SvMemoryStream (const SvMemoryStream&);
|
||||
SvMemoryStream & operator= (const SvMemoryStream&);
|
||||
|
||||
friend class SvCacheStream;
|
||||
sal_Size GetSize() const { return nSize; }
|
||||
|
||||
protected:
|
||||
sal_Size nSize;
|
||||
sal_Size nResize;
|
||||
@ -817,7 +820,7 @@ public:
|
||||
|
||||
virtual void ResetError();
|
||||
|
||||
sal_Size GetSize() const { return nSize; }
|
||||
sal_Size GetEndOfData() const { return nEndOfData; }
|
||||
const void* GetData() { Flush(); return pBuf; }
|
||||
operator const void*() { Flush(); return pBuf; }
|
||||
virtual sal_uInt16 IsA() const;
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <utime.h>
|
||||
#if defined HPUX || defined LINUX || defined IRIX
|
||||
#if defined HPUX || defined LINUX
|
||||
#include <mntent.h>
|
||||
#define mnttab mntent
|
||||
#elif defined SCO
|
||||
|
@ -1022,16 +1022,14 @@ bool INetURLObject::setAbsURIRef(rtl::OUString const & rTheAbsURIRef,
|
||||
if (pEnd - pPos >= 2 && pPos[0] == '/' && pPos[1] == '/')
|
||||
{
|
||||
sal_Unicode const * p1 = pPos + 2;
|
||||
if (
|
||||
p1 == pEnd || *p1 == nFragmentDelimiter || *p1 == '/' ||
|
||||
(
|
||||
(
|
||||
scanDomain(p1, pEnd) > 0 ||
|
||||
scanIPv6reference(p1, pEnd)
|
||||
) &&
|
||||
(p1 == pEnd || *p1 == nFragmentDelimiter || *p1 == '/')
|
||||
)
|
||||
)
|
||||
while (p1 != pEnd && *p1 != '/' &&
|
||||
*p1 != nFragmentDelimiter)
|
||||
{
|
||||
++p1;
|
||||
}
|
||||
if (parseHostOrNetBiosName(
|
||||
pPos + 2, p1, bOctets, ENCODE_ALL,
|
||||
RTL_TEXTENCODING_DONTKNOW, true, NULL))
|
||||
{
|
||||
aSynAbsURIRef.
|
||||
appendAscii(RTL_CONSTASCII_STRINGPARAM("//"));
|
||||
|
@ -1615,7 +1615,16 @@ void Polygon::Clip( const Rectangle& rRect, BOOL bPolygon )
|
||||
Rectangle Polygon::GetBoundRect() const
|
||||
{
|
||||
DBG_CHKTHIS( Polygon, NULL );
|
||||
DBG_ASSERT( !mpImplPolygon->mpFlagAry, "GetBoundRect could fail with beziers!" );
|
||||
// Removing the assert. Bezier curves have the attribute that each single
|
||||
// curve segment defined by four points can not exit the four-point polygon
|
||||
// defined by that points. This allows to say that the curve segment can also
|
||||
// never leave the Range of it's defining points.
|
||||
// The result is that Polygon::GetBoundRect() may not create the minimal
|
||||
// BoundRect of the Polygon (to get that, use basegfx::B2DPolygon classes),
|
||||
// but will always create a valid BoundRect, at least as long as this method
|
||||
// 'blindly' travels over all points, including control points.
|
||||
//
|
||||
// DBG_ASSERT( !mpImplPolygon->mpFlagAry, "GetBoundRect could fail with beziers!" );
|
||||
|
||||
USHORT nCount = mpImplPolygon->mnPoints;
|
||||
if( ! nCount )
|
||||
|
@ -47,6 +47,8 @@ SLOFILES= $(SLO)$/contnr.obj \
|
||||
$(SLO)$/mempool.obj \
|
||||
$(SLO)$/multisel.obj
|
||||
|
||||
EXCEPTIONSFILES= $(SLO)$/multisel.obj $(OBJ)$/multisel.obj
|
||||
|
||||
OBJFILES= $(OBJ)$/contnr.obj \
|
||||
$(OBJ)$/table.obj \
|
||||
$(OBJ)$/unqidx.obj \
|
||||
|
@ -41,12 +41,16 @@
|
||||
#include <tools/debug.hxx>
|
||||
#include <tools/multisel.hxx>
|
||||
|
||||
#include "rtl/ustrbuf.hxx"
|
||||
|
||||
#ifdef MI_DEBUG
|
||||
#define DBG(x) x
|
||||
#else
|
||||
#define DBG(x)
|
||||
#endif
|
||||
|
||||
using namespace rtl;
|
||||
|
||||
//==================================================================
|
||||
|
||||
#ifdef MI_DEBUG
|
||||
@ -865,3 +869,297 @@ void MultiSelection::SetTotalRange( const Range& rTotRange )
|
||||
bCurValid = FALSE;
|
||||
nCurIndex = 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
//
|
||||
// StringRangeEnumerator
|
||||
//
|
||||
// -----------------------------------------------------------------------
|
||||
StringRangeEnumerator::StringRangeEnumerator( const rtl::OUString& i_rInput,
|
||||
sal_Int32 i_nMinNumber,
|
||||
sal_Int32 i_nMaxNumber,
|
||||
sal_Int32 i_nLogicalOffset
|
||||
)
|
||||
: mnCount( 0 )
|
||||
, mnMin( i_nMinNumber )
|
||||
, mnMax( i_nMaxNumber )
|
||||
, mnOffset( i_nLogicalOffset )
|
||||
{
|
||||
setRange( i_rInput );
|
||||
}
|
||||
|
||||
bool StringRangeEnumerator::checkValue( sal_Int32 i_nValue, const std::set< sal_Int32 >* i_pPossibleValues ) const
|
||||
{
|
||||
if( mnMin >= 0 && i_nValue < mnMin )
|
||||
return false;
|
||||
if( mnMax >= 0 && i_nValue > mnMax )
|
||||
return false;
|
||||
if( i_nValue < 0 )
|
||||
return false;
|
||||
if( i_pPossibleValues && i_pPossibleValues->find( i_nValue ) == i_pPossibleValues->end() )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StringRangeEnumerator::insertRange( sal_Int32 i_nFirst, sal_Int32 i_nLast, bool bSequence, bool bMayAdjust )
|
||||
{
|
||||
bool bSuccess = true;
|
||||
if( bSequence )
|
||||
{
|
||||
if( i_nFirst == -1 )
|
||||
i_nFirst = mnMin;
|
||||
if( i_nLast == -1 )
|
||||
i_nLast = mnMax;
|
||||
if( bMayAdjust )
|
||||
{
|
||||
if( i_nFirst < mnMin )
|
||||
i_nFirst = mnMin;
|
||||
if( i_nFirst > mnMax )
|
||||
i_nFirst = mnMax;
|
||||
if( i_nLast < mnMin )
|
||||
i_nLast = mnMin;
|
||||
if( i_nLast > mnMax )
|
||||
i_nLast = mnMax;
|
||||
}
|
||||
if( checkValue( i_nFirst ) && checkValue( i_nLast ) )
|
||||
{
|
||||
maSequence.push_back( Range( i_nFirst, i_nLast ) );
|
||||
sal_Int32 nNumber = i_nLast - i_nFirst;
|
||||
nNumber = nNumber < 0 ? -nNumber : nNumber;
|
||||
mnCount += nNumber + 1;
|
||||
}
|
||||
else
|
||||
bSuccess = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( i_nFirst >= 0 )
|
||||
{
|
||||
if( checkValue( i_nFirst ) )
|
||||
{
|
||||
maSequence.push_back( Range( i_nFirst, i_nFirst ) );
|
||||
mnCount++;
|
||||
}
|
||||
else
|
||||
bSuccess = false;
|
||||
}
|
||||
if( i_nLast >= 0 )
|
||||
{
|
||||
if( checkValue( i_nLast ) )
|
||||
{
|
||||
maSequence.push_back( Range( i_nLast, i_nLast ) );
|
||||
mnCount++;
|
||||
}
|
||||
else
|
||||
bSuccess = false;
|
||||
}
|
||||
}
|
||||
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
bool StringRangeEnumerator::setRange( const rtl::OUString& i_rNewRange, bool i_bStrict )
|
||||
{
|
||||
mnCount = 0;
|
||||
maSequence.clear();
|
||||
|
||||
// we love special cases
|
||||
if( i_rNewRange.getLength() == 0 )
|
||||
{
|
||||
if( mnMin >= 0 && mnMax >= 0 )
|
||||
{
|
||||
insertRange( mnMin, mnMax, mnMin != mnMax, ! i_bStrict );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const sal_Unicode* pInput = i_rNewRange.getStr();
|
||||
rtl::OUStringBuffer aNumberBuf( 16 );
|
||||
sal_Int32 nLastNumber = -1, nNumber = -1;
|
||||
bool bSequence = false;
|
||||
bool bSuccess = true;
|
||||
while( *pInput )
|
||||
{
|
||||
while( *pInput >= sal_Unicode('0') && *pInput <= sal_Unicode('9') )
|
||||
aNumberBuf.append( *pInput++ );
|
||||
if( aNumberBuf.getLength() )
|
||||
{
|
||||
if( nNumber != -1 )
|
||||
{
|
||||
if( bSequence )
|
||||
{
|
||||
if( ! insertRange( nLastNumber, nNumber, true, ! i_bStrict ) && i_bStrict )
|
||||
{
|
||||
bSuccess = false;
|
||||
break;
|
||||
}
|
||||
nLastNumber = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ! insertRange( nNumber, nNumber, false, ! i_bStrict ) && i_bStrict )
|
||||
{
|
||||
bSuccess = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
nNumber = aNumberBuf.makeStringAndClear().toInt32();
|
||||
nNumber += mnOffset;
|
||||
}
|
||||
bool bInsertRange = false;
|
||||
if( *pInput == sal_Unicode('-') )
|
||||
{
|
||||
nLastNumber = nNumber;
|
||||
nNumber = -1;
|
||||
bSequence = true;
|
||||
}
|
||||
else if( *pInput == ' ' )
|
||||
{
|
||||
}
|
||||
else if( *pInput == sal_Unicode(',') || *pInput == sal_Unicode(';') )
|
||||
bInsertRange = true;
|
||||
else if( *pInput )
|
||||
{
|
||||
|
||||
bSuccess = false;
|
||||
break; // parse error
|
||||
}
|
||||
|
||||
if( bInsertRange )
|
||||
{
|
||||
if( ! insertRange( nLastNumber, nNumber, bSequence, ! i_bStrict ) && i_bStrict )
|
||||
{
|
||||
bSuccess = false;
|
||||
break;
|
||||
}
|
||||
nNumber = nLastNumber = -1;
|
||||
bSequence = false;
|
||||
}
|
||||
if( *pInput )
|
||||
pInput++;
|
||||
}
|
||||
// insert last entries
|
||||
insertRange( nLastNumber, nNumber, bSequence, ! i_bStrict );
|
||||
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
bool StringRangeEnumerator::hasValue( sal_Int32 i_nValue, const std::set< sal_Int32 >* i_pPossibleValues ) const
|
||||
{
|
||||
if( i_pPossibleValues && i_pPossibleValues->find( i_nValue ) == i_pPossibleValues->end() )
|
||||
return false;
|
||||
size_t n = maSequence.size();
|
||||
for( size_t i= 0; i < n; ++i )
|
||||
{
|
||||
const StringRangeEnumerator::Range rRange( maSequence[i] );
|
||||
if( rRange.nFirst < rRange.nLast )
|
||||
{
|
||||
if( i_nValue >= rRange.nFirst && i_nValue <= rRange.nLast )
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( i_nValue >= rRange.nLast && i_nValue <= rRange.nFirst )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
StringRangeEnumerator::Iterator& StringRangeEnumerator::Iterator::operator++()
|
||||
{
|
||||
if( nRangeIndex >= 0 && nCurrent >= 0 && pEnumerator )
|
||||
{
|
||||
const StringRangeEnumerator::Range& rRange( pEnumerator->maSequence[nRangeIndex] );
|
||||
bool bRangeChange = false;
|
||||
if( rRange.nLast < rRange.nFirst )
|
||||
{
|
||||
// backward range
|
||||
if( nCurrent > rRange.nLast )
|
||||
nCurrent--;
|
||||
else
|
||||
bRangeChange = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// forward range
|
||||
if( nCurrent < rRange.nLast )
|
||||
nCurrent++;
|
||||
else
|
||||
bRangeChange = true;
|
||||
}
|
||||
if( bRangeChange )
|
||||
{
|
||||
nRangeIndex++;
|
||||
if( size_t(nRangeIndex) == pEnumerator->maSequence.size() )
|
||||
{
|
||||
// reached the end
|
||||
nRangeIndex = nCurrent = -1;
|
||||
}
|
||||
else
|
||||
nCurrent = pEnumerator->maSequence[nRangeIndex].nFirst;
|
||||
}
|
||||
if( nRangeIndex != -1 && nCurrent != -1 )
|
||||
{
|
||||
if( ! pEnumerator->checkValue( nCurrent, pPossibleValues ) )
|
||||
return ++(*this);
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
sal_Int32 StringRangeEnumerator::Iterator::operator*() const
|
||||
{
|
||||
return nCurrent;
|
||||
}
|
||||
|
||||
bool StringRangeEnumerator::Iterator::operator==( const Iterator& i_rCompare ) const
|
||||
{
|
||||
return i_rCompare.pEnumerator == pEnumerator && i_rCompare.nRangeIndex == nRangeIndex && i_rCompare.nCurrent == nCurrent;
|
||||
}
|
||||
|
||||
StringRangeEnumerator::Iterator StringRangeEnumerator::begin( const std::set< sal_Int32 >* i_pPossibleValues ) const
|
||||
{
|
||||
StringRangeEnumerator::Iterator it( this,
|
||||
i_pPossibleValues,
|
||||
maSequence.empty() ? -1 : 0,
|
||||
maSequence.empty() ? -1 : maSequence[0].nFirst );
|
||||
if( ! checkValue(*it, i_pPossibleValues ) )
|
||||
++it;
|
||||
return it;
|
||||
}
|
||||
|
||||
StringRangeEnumerator::Iterator StringRangeEnumerator::end( const std::set< sal_Int32 >* i_pPossibleValues ) const
|
||||
{
|
||||
return StringRangeEnumerator::Iterator( this, i_pPossibleValues, -1, -1 );
|
||||
}
|
||||
|
||||
bool StringRangeEnumerator::getRangesFromString( const OUString& i_rPageRange,
|
||||
std::vector< sal_Int32 >& o_rPageVector,
|
||||
sal_Int32 i_nMinNumber,
|
||||
sal_Int32 i_nMaxNumber,
|
||||
sal_Int32 i_nLogicalOffset,
|
||||
std::set< sal_Int32 >* i_pPossibleValues
|
||||
)
|
||||
{
|
||||
StringRangeEnumerator aEnum;
|
||||
aEnum.setMin( i_nMinNumber );
|
||||
aEnum.setMax( i_nMaxNumber );
|
||||
aEnum.setLogicalOffset( i_nLogicalOffset );
|
||||
|
||||
bool bRes = aEnum.setRange( i_rPageRange );
|
||||
if( bRes )
|
||||
{
|
||||
o_rPageVector.clear();
|
||||
o_rPageVector.reserve( aEnum.size() );
|
||||
for( StringRangeEnumerator::Iterator it = aEnum.begin( i_pPossibleValues );
|
||||
it != aEnum.end( i_pPossibleValues ); ++it )
|
||||
{
|
||||
o_rPageVector.push_back( *it );
|
||||
}
|
||||
}
|
||||
|
||||
return bRes;
|
||||
}
|
||||
|
||||
|
@ -1629,6 +1629,20 @@ main()
|
||||
rtl::OUString(urlobj.GetMainURL(INetURLObject::NO_DECODE)));
|
||||
}
|
||||
|
||||
if (true) { // #i53184#
|
||||
rtl::OUString url(RTL_CONSTASCII_USTRINGPARAM("file://comp_name/path"));
|
||||
bSuccess &= assertEqual(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM("#i53184# smart INET_PROT_FILE")),
|
||||
INetURLObject(url, INET_PROT_FILE).GetMainURL(
|
||||
INetURLObject::NO_DECODE),
|
||||
url);
|
||||
bSuccess &= assertEqual(
|
||||
rtl::OUString(
|
||||
RTL_CONSTASCII_USTRINGPARAM("#i53184# strict")),
|
||||
INetURLObject(url).GetMainURL(INetURLObject::NO_DECODE), url);
|
||||
}
|
||||
|
||||
if (true) {
|
||||
rtl::OUString path;
|
||||
path = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/a/b/c"));
|
||||
|
@ -120,7 +120,7 @@ void INIreader::toStlString( const UnicodeString& str , string& stl_str)
|
||||
char* buffer = new char[ str.length()*3 ];
|
||||
str.extract( 0 , str.length() , buffer );
|
||||
stl_str = string( buffer );
|
||||
delete buffer;
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
void INIreader::trim( string& str )
|
||||
|
@ -88,6 +88,9 @@ namespace utl
|
||||
/// dtor
|
||||
~OConfigurationNode() {}
|
||||
|
||||
/// returns the local name of the node
|
||||
::rtl::OUString getLocalName() const;
|
||||
|
||||
/** open a sub node
|
||||
@param _rPath access path of the to-be-opened sub node. May be a hierarchical path.
|
||||
*/
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include <com/sun/star/lang/XComponent.hpp>
|
||||
#include <com/sun/star/util/XStringEscape.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <com/sun/star/container/XNamed.hpp>
|
||||
#include <comphelper/extract.hxx>
|
||||
#include <rtl/string.hxx>
|
||||
#if OSL_DEBUG_LEVEL > 0
|
||||
@ -138,6 +139,22 @@ namespace utl
|
||||
clear();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
::rtl::OUString OConfigurationNode::getLocalName() const
|
||||
{
|
||||
::rtl::OUString sLocalName;
|
||||
try
|
||||
{
|
||||
Reference< XNamed > xNamed( m_xDirectAccess, UNO_QUERY_THROW );
|
||||
sLocalName = xNamed->getName();
|
||||
}
|
||||
catch( const Exception& )
|
||||
{
|
||||
DBG_UNHANDLED_EXCEPTION();
|
||||
}
|
||||
return sLocalName;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
::rtl::OUString OConfigurationNode::normalizeName(const ::rtl::OUString& _rName, NAMEORIGIN _eOrigin) const
|
||||
{
|
||||
@ -155,13 +172,9 @@ namespace utl
|
||||
else
|
||||
sName = xEscaper->unescapeString(sName);
|
||||
}
|
||||
catch(IllegalArgumentException&)
|
||||
{
|
||||
OSL_ENSURE(sal_False, "OConfigurationNode::normalizeName: illegal argument (caught an exception saying so)!");
|
||||
}
|
||||
catch(Exception&)
|
||||
{
|
||||
OSL_ENSURE(sal_False, "OConfigurationNode::normalizeName: caught an exception!");
|
||||
DBG_UNHANDLED_EXCEPTION();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* $RCSfile: aquaprintview.h,v $
|
||||
* $Revision: 1.3 $
|
||||
* $Revision: 1.3.114.1 $
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
@ -35,20 +35,36 @@
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#include "postmac.h"
|
||||
|
||||
class ImplQPrinter;
|
||||
#include "vcl/print.hxx"
|
||||
|
||||
class AquaSalInfoPrinter;
|
||||
|
||||
struct PrintAccessoryViewState
|
||||
{
|
||||
bool bNeedRestart;
|
||||
sal_Int32 nLastPage;
|
||||
|
||||
PrintAccessoryViewState()
|
||||
: bNeedRestart( false ), nLastPage( 0 ) {}
|
||||
};
|
||||
|
||||
@interface AquaPrintView : NSView
|
||||
{
|
||||
ImplQPrinter* mpQPrinter;
|
||||
AquaSalInfoPrinter* mpInfoPrinter;
|
||||
vcl::PrinterController* mpController;
|
||||
AquaSalInfoPrinter* mpInfoPrinter;
|
||||
}
|
||||
-(id)initWithQPrinter: (ImplQPrinter*)pPrinter withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter;
|
||||
-(id)initWithController: (vcl::PrinterController*)pController withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter;
|
||||
-(MacOSBOOL)knowsPageRange: (NSRangePointer)range;
|
||||
-(NSRect)rectForPage: (int)page;
|
||||
-(NSPoint)locationOfPrintRect: (NSRect)aRect;
|
||||
-(void)drawRect: (NSRect)rect;
|
||||
@end
|
||||
|
||||
@interface AquaPrintAccessoryView : NSObject
|
||||
{
|
||||
}
|
||||
+(NSObject*)setupPrinterPanel: (NSPrintOperation*)pOp withController: (vcl::PrinterController*)pController withState: (PrintAccessoryViewState*)pState;
|
||||
@end
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -175,6 +175,9 @@ public:
|
||||
void RefreshRect(float lX, float lY, float lWidth, float lHeight);
|
||||
|
||||
void SetState();
|
||||
void UnsetState();
|
||||
// InvalidateContext does an UnsetState and sets mrContext to 0
|
||||
void InvalidateContext();
|
||||
|
||||
virtual BOOL unionClipRegion( long nX, long nY, long nWidth, long nHeight );
|
||||
virtual bool unionClipRegion( const ::basegfx::B2DPolyPolygon& );
|
||||
|
@ -7,7 +7,7 @@
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* $RCSfile: salprn.h,v $
|
||||
* $Revision: 1.12 $
|
||||
* $Revision: 1.12.56.1 $
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
@ -73,8 +73,8 @@ class AquaSalInfoPrinter : public SalInfoPrinter
|
||||
|
||||
int mnStartPageOffsetX;
|
||||
int mnStartPageOffsetY;
|
||||
ULONG mnCurPageRangeStart;
|
||||
ULONG mnCurPageRangeCount;
|
||||
sal_Int32 mnCurPageRangeStart;
|
||||
sal_Int32 mnCurPageRangeCount;
|
||||
|
||||
public:
|
||||
AquaSalInfoPrinter( const SalPrinterQueueInfo& pInfo );
|
||||
@ -96,19 +96,17 @@ class AquaSalInfoPrinter : public SalInfoPrinter
|
||||
virtual String GetPaperBinName( const ImplJobSetup* i_pSetupData, ULONG i_nPaperBin );
|
||||
virtual void InitPaperFormats( const ImplJobSetup* i_pSetupData );
|
||||
virtual int GetLandscapeAngle( const ImplJobSetup* i_pSetupData );
|
||||
virtual DuplexMode GetDuplexMode( const ImplJobSetup* i_pSetupData );
|
||||
|
||||
|
||||
// the artificial separation between InfoPrinter and Printer
|
||||
// is not really useful for us
|
||||
// so let's make AquaSalPrinter just a forwarder to AquaSalInfoPrinter
|
||||
// and concentrate the real work in one class
|
||||
// implement pull model print system
|
||||
BOOL StartJob( const String* pFileName,
|
||||
const String& rAppName,
|
||||
ImplJobSetup* pSetupData,
|
||||
ImplQPrinter* pQPrinter,
|
||||
bool bIsQuickJob );
|
||||
BOOL StartJob( const String* i_pFileName,
|
||||
const String& rJobName,
|
||||
const String& i_rAppName,
|
||||
ImplJobSetup* i_pSetupData,
|
||||
vcl::PrinterController& i_rController );
|
||||
BOOL EndJob();
|
||||
BOOL AbortJob();
|
||||
SalGraphics* StartPage( ImplJobSetup* i_pSetupData, BOOL i_bNewJobData );
|
||||
@ -117,8 +115,12 @@ class AquaSalInfoPrinter : public SalInfoPrinter
|
||||
|
||||
NSPrintInfo* getPrintInfo() const { return mpPrintInfo; }
|
||||
void setStartPageOffset( int nOffsetX, int nOffsetY ) { mnStartPageOffsetX = nOffsetX; mnStartPageOffsetY = nOffsetY; }
|
||||
ULONG getCurPageRangeStart() const { return mnCurPageRangeStart; }
|
||||
ULONG getCurPageRangeCount() const { return mnCurPageRangeCount; }
|
||||
sal_Int32 getCurPageRangeStart() const { return mnCurPageRangeStart; }
|
||||
sal_Int32 getCurPageRangeCount() const { return mnCurPageRangeCount; }
|
||||
|
||||
// match width/height against known paper formats, possibly switching orientation
|
||||
const PaperInfo* matchPaper( long i_nWidth, long i_nHeight, Orientation& o_rOrientation ) const;
|
||||
void setPaperSize( long i_nWidth, long i_nHeight, Orientation i_eSetOrientation );
|
||||
|
||||
private:
|
||||
AquaSalInfoPrinter( const AquaSalInfoPrinter& );
|
||||
@ -139,13 +141,16 @@ class AquaSalPrinter : public SalPrinter
|
||||
virtual BOOL StartJob( const XubString* i_pFileName,
|
||||
const XubString& i_rJobName,
|
||||
const XubString& i_rAppName,
|
||||
ULONG i_nCopies, BOOL i_bCollate,
|
||||
ULONG i_nCopies,
|
||||
bool i_bCollate,
|
||||
bool i_bDirect,
|
||||
ImplJobSetup* i_pSetupData );
|
||||
// implement pull model print system
|
||||
virtual BOOL StartJob( const String* pFileName,
|
||||
const String& rAppName,
|
||||
ImplJobSetup* pSetupData,
|
||||
ImplQPrinter* pQPrinter );
|
||||
virtual BOOL StartJob( const String* i_pFileName,
|
||||
const String& rJobName,
|
||||
const String& i_rAppName,
|
||||
ImplJobSetup* i_pSetupData,
|
||||
vcl::PrinterController& i_rListener );
|
||||
|
||||
virtual BOOL EndJob();
|
||||
virtual BOOL AbortJob();
|
||||
@ -162,7 +167,7 @@ const double fPtTo100thMM = 35.27777778;
|
||||
|
||||
inline int PtTo10Mu( double nPoints ) { return (int)(((nPoints)*fPtTo100thMM)+0.5); }
|
||||
|
||||
inline double TenMuToPt( double nUnits ) { return (((nUnits)/fPtTo100thMM)+0.5); }
|
||||
inline double TenMuToPt( double nUnits ) { return floor(((nUnits)/fPtTo100thMM)+0.5); }
|
||||
|
||||
|
||||
|
||||
|
1237
vcl/aqua/source/gdi/aquaprintaccessoryview.mm
Normal file
1237
vcl/aqua/source/gdi/aquaprintaccessoryview.mm
Normal file
File diff suppressed because it is too large
Load Diff
@ -7,7 +7,7 @@
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* $RCSfile: aquaprintview.mm,v $
|
||||
* $Revision: 1.5 $
|
||||
* $Revision: 1.5.56.1 $
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
@ -33,15 +33,15 @@
|
||||
|
||||
#include "aquaprintview.h"
|
||||
#include "salprn.h"
|
||||
#include "vcl/impprn.hxx"
|
||||
#include "vcl/print.hxx"
|
||||
|
||||
@implementation AquaPrintView
|
||||
-(id)initWithQPrinter: (ImplQPrinter*)pPrinter withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter
|
||||
-(id)initWithController: (vcl::PrinterController*)pController withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter
|
||||
{
|
||||
NSRect aRect = { { 0, 0 }, [pInfoPrinter->getPrintInfo() paperSize] };
|
||||
if( (self = [super initWithFrame: aRect]) != nil )
|
||||
{
|
||||
mpQPrinter = pPrinter;
|
||||
mpController = pController;
|
||||
mpInfoPrinter = pInfoPrinter;
|
||||
}
|
||||
return self;
|
||||
@ -79,6 +79,7 @@
|
||||
int nPage = (int)(aPaperSize.width * rect.origin.y + rect.origin.x);
|
||||
|
||||
// page count is 1 based
|
||||
mpQPrinter->PrintPage( nPage-1 + mpInfoPrinter->getCurPageRangeStart() );
|
||||
if( nPage - 1 < (mpInfoPrinter->getCurPageRangeStart() + mpInfoPrinter->getCurPageRangeCount() ) )
|
||||
mpController->printFilteredPage( nPage-1 );
|
||||
}
|
||||
@end
|
||||
|
@ -62,6 +62,7 @@ SLOFILES= $(SLO)$/salmathutils.obj \
|
||||
$(SLO)$/salvd.obj \
|
||||
$(SLO)$/salprn.obj \
|
||||
$(SLO)$/aquaprintview.obj \
|
||||
$(SLO)$/aquaprintaccessoryview.obj \
|
||||
$(SLO)$/salbmp.obj
|
||||
|
||||
.IF "$(ENABLE_CAIRO)" == "TRUE"
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include "basegfx/polygon/b2dpolygon.hxx"
|
||||
#include "basegfx/polygon/b2dpolygontools.hxx"
|
||||
#include "basegfx/matrix/b2dhommatrix.hxx"
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
|
||||
using namespace vcl;
|
||||
|
||||
@ -603,7 +604,8 @@ void AquaSalGraphics::EndSetClipRegion()
|
||||
void AquaSalGraphics::SetLineColor()
|
||||
{
|
||||
maLineColor.SetAlpha( 0.0 ); // transparent
|
||||
CGContextSetStrokeColor( mrContext, maLineColor.AsArray() );
|
||||
if( CheckContext() )
|
||||
CGContextSetStrokeColor( mrContext, maLineColor.AsArray() );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
@ -611,7 +613,8 @@ void AquaSalGraphics::SetLineColor()
|
||||
void AquaSalGraphics::SetLineColor( SalColor nSalColor )
|
||||
{
|
||||
maLineColor = RGBAColor( nSalColor );
|
||||
CGContextSetStrokeColor( mrContext, maLineColor.AsArray() );
|
||||
if( CheckContext() )
|
||||
CGContextSetStrokeColor( mrContext, maLineColor.AsArray() );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
@ -619,7 +622,8 @@ void AquaSalGraphics::SetLineColor( SalColor nSalColor )
|
||||
void AquaSalGraphics::SetFillColor()
|
||||
{
|
||||
maFillColor.SetAlpha( 0.0 ); // transparent
|
||||
CGContextSetFillColor( mrContext, maFillColor.AsArray() );
|
||||
if( CheckContext() )
|
||||
CGContextSetFillColor( mrContext, maFillColor.AsArray() );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
@ -627,7 +631,8 @@ void AquaSalGraphics::SetFillColor()
|
||||
void AquaSalGraphics::SetFillColor( SalColor nSalColor )
|
||||
{
|
||||
maFillColor = RGBAColor( nSalColor );
|
||||
CGContextSetFillColor( mrContext, maFillColor.AsArray() );
|
||||
if( CheckContext() )
|
||||
CGContextSetFillColor( mrContext, maFillColor.AsArray() );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
@ -1768,9 +1773,7 @@ BOOL AquaSalGraphics::GetGlyphOutline( long nGlyphId, basegfx::B2DPolyPolygon& r
|
||||
|
||||
GgoClosePathProc( &aGgoData );
|
||||
if( mfFontScale != 1.0 ) {
|
||||
basegfx::B2DHomMatrix aScale;
|
||||
aScale.scale( +mfFontScale, +mfFontScale );
|
||||
rPolyPoly.transform( aScale );
|
||||
rPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix(+mfFontScale, +mfFontScale));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -68,6 +68,13 @@ void AquaSalGraphics::SetPrinterGraphics( CGContextRef xContext, long nDPIX, lon
|
||||
mnRealDPIX = nDPIX;
|
||||
mnRealDPIY = nDPIY;
|
||||
|
||||
// a previously set clip path is now invalid
|
||||
if( mxClipPath )
|
||||
{
|
||||
CGPathRelease( mxClipPath );
|
||||
mxClipPath = NULL;
|
||||
}
|
||||
|
||||
if( mrContext )
|
||||
{
|
||||
CGContextSetFillColorSpace( mrContext, GetSalData()->mxRGBSpace );
|
||||
@ -126,6 +133,28 @@ void AquaSalGraphics::SetVirDevGraphics( CGLayerRef xLayer, CGContextRef xContex
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void AquaSalGraphics::InvalidateContext()
|
||||
{
|
||||
UnsetState();
|
||||
mrContext = 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void AquaSalGraphics::UnsetState()
|
||||
{
|
||||
if( mrContext )
|
||||
{
|
||||
CGContextRestoreGState( mrContext );
|
||||
mrContext = 0;
|
||||
}
|
||||
if( mxClipPath )
|
||||
{
|
||||
CGPathRelease( mxClipPath );
|
||||
mxClipPath = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void AquaSalGraphics::SetState()
|
||||
{
|
||||
CGContextRestoreGState( mrContext );
|
||||
@ -134,9 +163,9 @@ void AquaSalGraphics::SetState()
|
||||
// setup clipping
|
||||
if( mxClipPath )
|
||||
{
|
||||
CGContextBeginPath( mrContext ); // discard any existing path
|
||||
CGContextBeginPath( mrContext ); // discard any existing path
|
||||
CGContextAddPath( mrContext, mxClipPath ); // set the current path to the clipping path
|
||||
CGContextClip( mrContext ); // use it for clipping
|
||||
CGContextClip( mrContext ); // use it for clipping
|
||||
}
|
||||
|
||||
// set RGB colorspace and line and fill colors
|
||||
@ -205,7 +234,7 @@ bool AquaSalGraphics::CheckContext()
|
||||
CGContextRelease( rReleaseContext );
|
||||
}
|
||||
|
||||
DBG_ASSERT( mrContext, "<<<WARNING>>> AquaSalGraphics::CheckContext() FAILED!!!!\n" );
|
||||
DBG_ASSERT( mrContext || mbPrinter, "<<<WARNING>>> AquaSalGraphics::CheckContext() FAILED!!!!\n" );
|
||||
return (mrContext != NULL);
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* $RCSfile: salprn.cxx,v $
|
||||
* $Revision: 1.16 $
|
||||
* $Revision: 1.16.56.2 $
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
@ -38,7 +38,6 @@
|
||||
#include "saldata.hxx"
|
||||
#include "vcl/jobset.h"
|
||||
#include "vcl/salptype.hxx"
|
||||
#include "vcl/impprn.hxx"
|
||||
#include "vcl/print.hxx"
|
||||
#include "vcl/unohelp.hxx"
|
||||
|
||||
@ -47,11 +46,13 @@
|
||||
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
|
||||
#include "com/sun/star/container/XNameAccess.hpp"
|
||||
#include "com/sun/star/beans/PropertyValue.hpp"
|
||||
#include "com/sun/star/awt/Size.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace rtl;
|
||||
using namespace vcl;
|
||||
using namespace com::sun::star;
|
||||
using namespace com::sun::star::uno;
|
||||
using namespace com::sun::star::lang;
|
||||
using namespace com::sun::star::beans;
|
||||
@ -67,7 +68,9 @@ AquaSalInfoPrinter::AquaSalInfoPrinter( const SalPrinterQueueInfo& i_rQueue ) :
|
||||
mpPrintInfo( nil ),
|
||||
mePageOrientation( ORIENTATION_PORTRAIT ),
|
||||
mnStartPageOffsetX( 0 ),
|
||||
mnStartPageOffsetY( 0 )
|
||||
mnStartPageOffsetY( 0 ),
|
||||
mnCurPageRangeStart( 0 ),
|
||||
mnCurPageRangeCount( 0 )
|
||||
{
|
||||
NSString* pStr = CreateNSString( i_rQueue.maPrinterName );
|
||||
mpPrinter = [NSPrinter printerWithName: pStr];
|
||||
@ -87,6 +90,7 @@ AquaSalInfoPrinter::AquaSalInfoPrinter( const SalPrinterQueueInfo& i_rQueue ) :
|
||||
const int nWidth = 100, nHeight = 100;
|
||||
maContextMemory.reset( reinterpret_cast<sal_uInt8*>( rtl_allocateMemory( nWidth * 4 * nHeight ) ),
|
||||
boost::bind( rtl_freeMemory, _1 ) );
|
||||
|
||||
if( maContextMemory )
|
||||
{
|
||||
mrContext = CGBitmapContextCreate( maContextMemory.get(), nWidth, nHeight, 8, nWidth * 4, GetSalData()->mxRGBSpace, kCGImageAlphaNoneSkipFirst );
|
||||
@ -134,7 +138,7 @@ void AquaSalInfoPrinter::SetupPrinterGraphics( CGContextRef i_rContext ) const
|
||||
dY -= aPaperSize.height - aImageRect.size.height - aImageRect.origin.y;
|
||||
CGContextTranslateCTM( i_rContext, dX + mnStartPageOffsetX, dY - mnStartPageOffsetY );
|
||||
// scale to be top/down and reflect our "virtual" DPI
|
||||
CGContextScaleCTM( i_rContext, 0.1, -0.1 );
|
||||
CGContextScaleCTM( i_rContext, 72.0/double(nDPIX), -(72.0/double(nDPIY)) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -148,7 +152,7 @@ void AquaSalInfoPrinter::SetupPrinterGraphics( CGContextRef i_rContext ) const
|
||||
dY = -aPaperSize.width;
|
||||
CGContextTranslateCTM( i_rContext, dX + mnStartPageOffsetY, dY - mnStartPageOffsetX );
|
||||
// scale to be top/down and reflect our "virtual" DPI
|
||||
CGContextScaleCTM( i_rContext, -0.1, 0.1 );
|
||||
CGContextScaleCTM( i_rContext, -(72.0/double(nDPIY)), (72.0/double(nDPIX)) );
|
||||
}
|
||||
mpGraphics->SetPrinterGraphics( i_rContext, nDPIX, nDPIY, 1.0 );
|
||||
}
|
||||
@ -296,6 +300,28 @@ BOOL AquaSalInfoPrinter::SetPrinterData( ImplJobSetup* io_pSetupData )
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void AquaSalInfoPrinter::setPaperSize( long i_nWidth, long i_nHeight, Orientation i_eSetOrientation )
|
||||
{
|
||||
|
||||
Orientation ePaperOrientation = ORIENTATION_PORTRAIT;
|
||||
const PaperInfo* pPaper = matchPaper( i_nWidth, i_nHeight, ePaperOrientation );
|
||||
|
||||
if( pPaper )
|
||||
{
|
||||
NSString* pPaperName = [CreateNSString( rtl::OStringToOUString(PaperInfo::toPSName(pPaper->getPaper()), RTL_TEXTENCODING_ASCII_US) ) autorelease];
|
||||
[mpPrintInfo setPaperName: pPaperName];
|
||||
}
|
||||
else if( i_nWidth > 0 && i_nHeight > 0 )
|
||||
{
|
||||
NSSize aPaperSize = { TenMuToPt(i_nWidth), TenMuToPt(i_nHeight) };
|
||||
[mpPrintInfo setPaperSize: aPaperSize];
|
||||
}
|
||||
// this seems counterintuitive
|
||||
mePageOrientation = i_eSetOrientation;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
BOOL AquaSalInfoPrinter::SetData( ULONG i_nFlags, ImplJobSetup* io_pSetupData )
|
||||
{
|
||||
if( ! io_pSetupData || io_pSetupData->mnSystem != JOBSETUP_SYSTEM_MAC )
|
||||
@ -304,31 +330,32 @@ BOOL AquaSalInfoPrinter::SetData( ULONG i_nFlags, ImplJobSetup* io_pSetupData )
|
||||
|
||||
if( mpPrintInfo )
|
||||
{
|
||||
if( (i_nFlags & SAL_JOBSET_ORIENTATION) != 0 )
|
||||
mePageOrientation = io_pSetupData->meOrientation;
|
||||
|
||||
if( (i_nFlags & SAL_JOBSET_PAPERSIZE) != 0)
|
||||
{
|
||||
// set paper format
|
||||
double width = 0, height = 0;
|
||||
long width = 21000, height = 29700;
|
||||
if( io_pSetupData->mePaperFormat == PAPER_USER )
|
||||
{
|
||||
// #i101108# sanity check
|
||||
if( io_pSetupData->mnPaperWidth && io_pSetupData->mnPaperHeight )
|
||||
{
|
||||
width = TenMuToPt( io_pSetupData->mnPaperWidth );
|
||||
height = TenMuToPt( io_pSetupData->mnPaperHeight );
|
||||
width = io_pSetupData->mnPaperWidth;
|
||||
height = io_pSetupData->mnPaperHeight;
|
||||
}
|
||||
}
|
||||
else
|
||||
getPaperSize( width, height, io_pSetupData->mePaperFormat );
|
||||
|
||||
if( width > 0 && height > 0 )
|
||||
{
|
||||
NSSize aPaperSize = { width, height };
|
||||
[mpPrintInfo setPaperSize: aPaperSize];
|
||||
double w = 595, h = 842;
|
||||
getPaperSize( w, h, io_pSetupData->mePaperFormat );
|
||||
width = static_cast<long>(PtTo10Mu( w ));
|
||||
height = static_cast<long>(PtTo10Mu( h ));
|
||||
}
|
||||
}
|
||||
|
||||
if( (i_nFlags & SAL_JOBSET_ORIENTATION) != 0 )
|
||||
mePageOrientation = io_pSetupData->meOrientation;
|
||||
setPaperSize( width, height, mePageOrientation );
|
||||
}
|
||||
}
|
||||
|
||||
return mpPrintInfo != nil;
|
||||
@ -424,6 +451,8 @@ ULONG AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup* i_pSetupData, USH
|
||||
return 0;
|
||||
case PRINTER_CAPABILITIES_SETORIENTATION:
|
||||
return 1;
|
||||
case PRINTER_CAPABILITIES_SETDUPLEX:
|
||||
return 0;
|
||||
case PRINTER_CAPABILITIES_SETPAPERBIN:
|
||||
return 0;
|
||||
case PRINTER_CAPABILITIES_SETPAPERSIZE:
|
||||
@ -432,6 +461,8 @@ ULONG AquaSalInfoPrinter::GetCapabilities( const ImplJobSetup* i_pSetupData, USH
|
||||
return 1;
|
||||
case PRINTER_CAPABILITIES_EXTERNALDIALOG:
|
||||
return getUseNativeDialog() ? 1 : 0;
|
||||
case PRINTER_CAPABILITIES_PDF:
|
||||
return 1;
|
||||
default: break;
|
||||
};
|
||||
return 0;
|
||||
@ -470,58 +501,129 @@ void AquaSalInfoPrinter::GetPageInfo( const ImplJobSetup*,
|
||||
}
|
||||
}
|
||||
|
||||
BOOL AquaSalInfoPrinter::StartJob( const String* pFileName,
|
||||
const String& rAppName,
|
||||
ImplJobSetup* pSetupData,
|
||||
ImplQPrinter* pQPrinter,
|
||||
bool bIsQuickJob )
|
||||
static Size getPageSize( vcl::PrinterController& i_rController, sal_Int32 i_nPage )
|
||||
{
|
||||
Size aPageSize;
|
||||
Sequence< PropertyValue > aPageParms( i_rController.getPageParameters( i_nPage ) );
|
||||
for( sal_Int32 nProperty = 0, nPropertyCount = aPageParms.getLength(); nProperty < nPropertyCount; ++nProperty )
|
||||
{
|
||||
if( aPageParms[ nProperty ].Name.equalsAscii( "PageSize" ) )
|
||||
{
|
||||
awt::Size aSize;
|
||||
aPageParms[ nProperty].Value >>= aSize;
|
||||
aPageSize.Width() = aSize.Width;
|
||||
aPageSize.Height() = aSize.Height;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return aPageSize;
|
||||
}
|
||||
|
||||
BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName,
|
||||
const String& i_rJobName,
|
||||
const String& i_rAppName,
|
||||
ImplJobSetup* i_pSetupData,
|
||||
vcl::PrinterController& i_rController
|
||||
)
|
||||
{
|
||||
if( mbJob )
|
||||
return FALSE;
|
||||
|
||||
BOOL bSuccess = FALSE;
|
||||
std::vector<ULONG> aPaperRanges;
|
||||
if( ! pQPrinter->GetPaperRanges( aPaperRanges, true ) )
|
||||
return FALSE;
|
||||
|
||||
size_t nRanges = aPaperRanges.size();
|
||||
bool bWasAborted = false;
|
||||
AquaSalInstance* pInst = GetSalData()->mpFirstInstance;
|
||||
PrintAccessoryViewState aAccViewState;
|
||||
sal_Int32 nAllPages = 0;
|
||||
|
||||
for( ULONG nCurRange = 0; nCurRange < nRanges-1; nCurRange++ )
|
||||
aAccViewState.bNeedRestart = true;
|
||||
|
||||
// reset IsLastPage
|
||||
i_rController.setLastPage( sal_False );
|
||||
|
||||
// update job data
|
||||
if( i_pSetupData )
|
||||
SetData( ~0, i_pSetupData );
|
||||
|
||||
// do we want a progress panel ?
|
||||
sal_Bool bShowProgressPanel = sal_True;
|
||||
beans::PropertyValue* pMonitor = i_rController.getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MonitorVisible" ) ) );
|
||||
if( pMonitor )
|
||||
pMonitor->Value >>= bShowProgressPanel;
|
||||
if( ! i_rController.isShowDialogs() )
|
||||
bShowProgressPanel = sal_False;
|
||||
|
||||
// FIXME: jobStarted() should be done after the print dialog has ended (if there is one)
|
||||
// how do I know when that might be ?
|
||||
i_rController.jobStarted();
|
||||
do
|
||||
{
|
||||
if( aAccViewState.bNeedRestart )
|
||||
{
|
||||
mnCurPageRangeStart = 0;
|
||||
mnCurPageRangeCount = 0;
|
||||
nAllPages = i_rController.getFilteredPageCount();
|
||||
}
|
||||
|
||||
aAccViewState.bNeedRestart = false;
|
||||
|
||||
Size aCurSize( 21000, 29700 );
|
||||
if( nAllPages > 0 )
|
||||
{
|
||||
mnCurPageRangeCount = 1;
|
||||
aCurSize = getPageSize( i_rController, mnCurPageRangeStart );
|
||||
Size aNextSize( aCurSize );
|
||||
|
||||
// print pages up to a different size
|
||||
while( mnCurPageRangeCount + mnCurPageRangeStart < nAllPages )
|
||||
{
|
||||
aNextSize = getPageSize( i_rController, mnCurPageRangeStart + mnCurPageRangeCount );
|
||||
if( aCurSize == aNextSize // same page size
|
||||
||
|
||||
(aCurSize.Width() == aNextSize.Height() && aCurSize.Height() == aNextSize.Width()) // same size, but different orientation
|
||||
)
|
||||
{
|
||||
mnCurPageRangeCount++;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
mnCurPageRangeCount = 0;
|
||||
|
||||
// now for the current run
|
||||
mnStartPageOffsetX = mnStartPageOffsetY = 0;
|
||||
// setup the paper size and orientation
|
||||
// do this on our associated Printer object, since that is
|
||||
// out interface to the applications which occasionally rely on the paper
|
||||
// information (e.g. brochure printing scales to the found paper size)
|
||||
// also SetPaperSizeUser has the advantage that we can share a
|
||||
// platform independent paper matching algorithm
|
||||
boost::shared_ptr<Printer> pPrinter( i_rController.getPrinter() );
|
||||
pPrinter->SetMapMode( MapMode( MAP_100TH_MM ) );
|
||||
pPrinter->SetPaperSizeUser( aCurSize, true );
|
||||
|
||||
// update job data
|
||||
ImplJobSetup* pSetup = pQPrinter->GetPageSetup( aPaperRanges[ nCurRange ] );
|
||||
if( pSetup )
|
||||
SetData( ~0, pSetup );
|
||||
DBG_ASSERT( pSetup, "no job setup for range" );
|
||||
|
||||
mnCurPageRangeStart = aPaperRanges[nCurRange];
|
||||
mnCurPageRangeCount = aPaperRanges[nCurRange+1] - aPaperRanges[nCurRange];
|
||||
// create view
|
||||
NSView* pPrintView = [[AquaPrintView alloc] initWithQPrinter: pQPrinter withInfoPrinter: this];
|
||||
NSView* pPrintView = [[AquaPrintView alloc] initWithController: &i_rController withInfoPrinter: this];
|
||||
|
||||
NSMutableDictionary* pPrintDict = [mpPrintInfo dictionary];
|
||||
|
||||
// set filename
|
||||
if( pFileName )
|
||||
if( i_pFileName )
|
||||
{
|
||||
[mpPrintInfo setJobDisposition: NSPrintSaveJob];
|
||||
NSString* pPath = CreateNSString( *pFileName );
|
||||
NSString* pPath = CreateNSString( *i_pFileName );
|
||||
[pPrintDict setObject: pPath forKey: NSPrintSavePath];
|
||||
[pPath release];
|
||||
|
||||
// in this case we can only deliver the print job in one file
|
||||
mnCurPageRangeStart = 0;
|
||||
mnCurPageRangeCount = aPaperRanges.back();
|
||||
nCurRange = nRanges;
|
||||
}
|
||||
|
||||
[pPrintDict setObject: [[NSNumber numberWithInt: (int)pQPrinter->GetCopyCount()] autorelease] forKey: NSPrintCopies];
|
||||
[pPrintDict setObject: [[NSNumber numberWithInt: (int)i_rController.getPrinter()->GetCopyCount()] autorelease] forKey: NSPrintCopies];
|
||||
[pPrintDict setObject: [[NSNumber numberWithBool: YES] autorelease] forKey: NSPrintDetailedErrorReporting];
|
||||
[pPrintDict setObject: [[NSNumber numberWithInt: 1] autorelease] forKey: NSPrintFirstPage];
|
||||
[pPrintDict setObject: [[NSNumber numberWithInt: (int)mnCurPageRangeCount] autorelease] forKey: NSPrintLastPage];
|
||||
// #i103253# weird: for some reason, autoreleasing the value below like the others above
|
||||
// leads do a double free malloc error. Why this value should behave differently from all the others
|
||||
// is a mystery.
|
||||
[pPrintDict setObject: [NSNumber numberWithInt: mnCurPageRangeCount] forKey: NSPrintLastPage];
|
||||
|
||||
|
||||
// create print operation
|
||||
@ -529,17 +631,47 @@ BOOL AquaSalInfoPrinter::StartJob( const String* pFileName,
|
||||
|
||||
if( pPrintOperation )
|
||||
{
|
||||
bool bShowPanel = (! bIsQuickJob && getUseNativeDialog() );
|
||||
NSObject* pReleaseAfterUse = nil;
|
||||
bool bShowPanel = (! i_rController.isDirectPrint() && getUseNativeDialog() && i_rController.isShowDialogs() );
|
||||
[pPrintOperation setShowsPrintPanel: bShowPanel ? YES : NO ];
|
||||
// [pPrintOperation setShowsProgressPanel: NO];
|
||||
[pPrintOperation setShowsProgressPanel: bShowProgressPanel ? YES : NO];
|
||||
|
||||
// set job title (since MacOSX 10.5)
|
||||
if( [pPrintOperation respondsToSelector: @selector(setJobTitle:)] )
|
||||
[pPrintOperation performSelector: @selector(setJobTitle:) withObject: [CreateNSString( i_rJobName ) autorelease]];
|
||||
|
||||
if( bShowPanel && mnCurPageRangeStart == 0 ) // only the first range of pages gets the accesory view
|
||||
pReleaseAfterUse = [AquaPrintAccessoryView setupPrinterPanel: pPrintOperation withController: &i_rController withState: &aAccViewState];
|
||||
|
||||
bSuccess = TRUE;
|
||||
mbJob = true;
|
||||
pInst->startedPrintJob();
|
||||
[pPrintOperation runOperation];
|
||||
pInst->endedPrintJob();
|
||||
bWasAborted = [[[pPrintOperation printInfo] jobDisposition] compare: NSPrintCancelJob] == NSOrderedSame;
|
||||
mbJob = false;
|
||||
if( pReleaseAfterUse )
|
||||
[pReleaseAfterUse release];
|
||||
}
|
||||
}
|
||||
|
||||
mnCurPageRangeStart += mnCurPageRangeCount;
|
||||
mnCurPageRangeCount = 1;
|
||||
} while( aAccViewState.bNeedRestart || mnCurPageRangeStart + mnCurPageRangeCount < nAllPages );
|
||||
|
||||
// inform application that it can release its data
|
||||
// this is awkward, but the XRenderable interface has no method for this,
|
||||
// so we need to call XRenderadble::render one last time with IsLastPage = TRUE
|
||||
i_rController.setLastPage( sal_True );
|
||||
GDIMetaFile aPageFile;
|
||||
if( mrContext )
|
||||
SetupPrinterGraphics( mrContext );
|
||||
i_rController.getFilteredPageFile( 0, aPageFile );
|
||||
|
||||
i_rController.setJobState( bWasAborted
|
||||
? view::PrintableState_JOB_ABORTED
|
||||
: view::PrintableState_JOB_SPOOLED );
|
||||
|
||||
mnCurPageRangeStart = mnCurPageRangeCount = 0;
|
||||
|
||||
return bSuccess;
|
||||
}
|
||||
@ -581,6 +713,7 @@ SalGraphics* AquaSalInfoPrinter::StartPage( ImplJobSetup* i_pSetupData, BOOL i_b
|
||||
|
||||
BOOL AquaSalInfoPrinter::EndPage()
|
||||
{
|
||||
mpGraphics->InvalidateContext();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -606,31 +739,24 @@ AquaSalPrinter::~AquaSalPrinter()
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
BOOL AquaSalPrinter::StartJob( const String* pFileName,
|
||||
const String& rAppName,
|
||||
ImplJobSetup* pSetupData,
|
||||
ImplQPrinter* pQPrinter )
|
||||
BOOL AquaSalPrinter::StartJob( const String* i_pFileName,
|
||||
const String& i_rJobName,
|
||||
const String& i_rAppName,
|
||||
ImplJobSetup* i_pSetupData,
|
||||
vcl::PrinterController& i_rController )
|
||||
{
|
||||
bool bIsQuickJob = false;
|
||||
std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator quick_it =
|
||||
pSetupData->maValueMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) ) );
|
||||
|
||||
if( quick_it != pSetupData->maValueMap.end() )
|
||||
{
|
||||
if( quick_it->second.equalsIgnoreAsciiCaseAscii( "true" ) )
|
||||
bIsQuickJob = true;
|
||||
}
|
||||
|
||||
return mpInfoPrinter->StartJob( pFileName, rAppName, pSetupData, pQPrinter, bIsQuickJob );
|
||||
return mpInfoPrinter->StartJob( i_pFileName, i_rJobName, i_rAppName, i_pSetupData, i_rController );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
BOOL AquaSalPrinter::StartJob( const XubString* i_pFileName,
|
||||
const XubString& i_rJobName,
|
||||
const XubString& i_rAppName,
|
||||
ULONG i_nCopies, BOOL i_bCollate,
|
||||
ImplJobSetup* i_pSetupData )
|
||||
const XubString& i_rJobName,
|
||||
const XubString& i_rAppName,
|
||||
ULONG i_nCopies,
|
||||
bool i_bCollate,
|
||||
bool i_bDirect,
|
||||
ImplJobSetup* i_pSetupData )
|
||||
{
|
||||
DBG_ERROR( "should never be called" );
|
||||
return FALSE;
|
||||
@ -671,20 +797,62 @@ ULONG AquaSalPrinter::GetErrorCode()
|
||||
return mpInfoPrinter->GetErrorCode();
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
////// IMPLEMENT US /////
|
||||
////////////////////////////
|
||||
|
||||
DuplexMode AquaSalInfoPrinter::GetDuplexMode( const ImplJobSetup* i_pSetupData )
|
||||
{
|
||||
return DUPLEX_UNKNOWN;
|
||||
}
|
||||
|
||||
void AquaSalInfoPrinter::InitPaperFormats( const ImplJobSetup* i_pSetupData )
|
||||
{
|
||||
m_aPaperFormats.clear();
|
||||
m_bPapersInit = true;
|
||||
|
||||
if( mpPrinter )
|
||||
{
|
||||
if( [mpPrinter statusForTable: @"PPD"] == NSPrinterTableOK )
|
||||
{
|
||||
NSArray* pPaperNames = [mpPrinter stringListForKey: @"PageSize" inTable: @"PPD"];
|
||||
if( pPaperNames )
|
||||
{
|
||||
unsigned int nPapers = [pPaperNames count];
|
||||
for( unsigned int i = 0; i < nPapers; i++ )
|
||||
{
|
||||
NSString* pPaper = [pPaperNames objectAtIndex: i];
|
||||
NSSize aPaperSize = [mpPrinter pageSizeForPaper: pPaper];
|
||||
if( aPaperSize.width > 0 && aPaperSize.height > 0 )
|
||||
{
|
||||
PaperInfo aInfo( PtTo10Mu( aPaperSize.width ),
|
||||
PtTo10Mu( aPaperSize.height ) );
|
||||
m_aPaperFormats.push_back( aInfo );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const PaperInfo* AquaSalInfoPrinter::matchPaper( long i_nWidth, long i_nHeight, Orientation& o_rOrientation ) const
|
||||
{
|
||||
if( ! m_bPapersInit )
|
||||
const_cast<AquaSalInfoPrinter*>(this)->InitPaperFormats( NULL );
|
||||
|
||||
const PaperInfo* pMatch = NULL;
|
||||
o_rOrientation = ORIENTATION_PORTRAIT;
|
||||
for( int n = 0; n < 2 ; n++ )
|
||||
{
|
||||
for( size_t i = 0; i < m_aPaperFormats.size(); i++ )
|
||||
{
|
||||
if( abs( m_aPaperFormats[i].getWidth() - i_nWidth ) < 50 &&
|
||||
abs( m_aPaperFormats[i].getHeight() - i_nHeight ) < 50 )
|
||||
{
|
||||
pMatch = &m_aPaperFormats[i];
|
||||
return pMatch;
|
||||
}
|
||||
}
|
||||
o_rOrientation = ORIENTATION_LANDSCAPE;
|
||||
std::swap( i_nWidth, i_nHeight );
|
||||
}
|
||||
return pMatch;
|
||||
}
|
||||
|
||||
int AquaSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* i_pSetupData )
|
||||
{
|
||||
return 0;
|
||||
return 900;
|
||||
}
|
||||
|
||||
|
||||
|
425
vcl/inc/vcl/arrange.hxx
Normal file
425
vcl/inc/vcl/arrange.hxx
Normal file
@ -0,0 +1,425 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* Copyright 2008 by Sun Microsystems, Inc.
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* $RCSfile: accel.hxx,v $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* OpenOffice.org is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License version 3
|
||||
* only, as published by the Free Software Foundation.
|
||||
*
|
||||
* OpenOffice.org is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License version 3 for more details
|
||||
* (a copy is included in the LICENSE file that accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* version 3 along with OpenOffice.org. If not, see
|
||||
* <http://www.openoffice.org/license.html>
|
||||
* for a copy of the LGPLv3 License.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _VCL_ARRANGE_HXX
|
||||
#define _VCL_ARRANGE_HXX
|
||||
|
||||
#include "vcl/window.hxx"
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
namespace vcl
|
||||
{
|
||||
/* some helper classes for simple window layouting
|
||||
guidelines:
|
||||
- a WindowArranger is not a Window
|
||||
- a WindowArranger hierarchy manages exactly one level of child windows inside a common parent
|
||||
this is to keep the vcl Window hierarchy flat, as some code like accelerators depend on such behavior
|
||||
- a WindowArranger never becomes owner of a Window, windows need to be destroyed separately
|
||||
- a WindowArranger however always is owner of its child WindowArrangers, that is the
|
||||
WindowArranger hierarchy will keep track of its objects and delete them
|
||||
- a managed element of a WindowArranger can either be a Window (a leaf in the hierarchy)
|
||||
or a child WindowArranger (a node in the hierarchy), but never both
|
||||
*/
|
||||
|
||||
class WindowArranger
|
||||
{
|
||||
protected:
|
||||
struct Element
|
||||
{
|
||||
Window* m_pElement;
|
||||
boost::shared_ptr<WindowArranger> m_pChild;
|
||||
sal_Int32 m_nExpandPriority;
|
||||
Size m_aMinSize;
|
||||
bool m_bHidden;
|
||||
long m_nLeftBorder;
|
||||
long m_nTopBorder;
|
||||
long m_nRightBorder;
|
||||
long m_nBottomBorder;
|
||||
|
||||
Element()
|
||||
: m_pElement( NULL )
|
||||
, m_pChild()
|
||||
, m_nExpandPriority( 0 )
|
||||
, m_bHidden( false )
|
||||
, m_nLeftBorder( 0 )
|
||||
, m_nTopBorder( 0 )
|
||||
, m_nRightBorder( 0 )
|
||||
, m_nBottomBorder( 0 )
|
||||
{}
|
||||
|
||||
Element( Window* i_pWin,
|
||||
boost::shared_ptr<WindowArranger> const & i_pChild = boost::shared_ptr<WindowArranger>(),
|
||||
sal_Int32 i_nExpandPriority = 0
|
||||
)
|
||||
: m_pElement( i_pWin )
|
||||
, m_pChild( i_pChild )
|
||||
, m_nExpandPriority( i_nExpandPriority )
|
||||
, m_bHidden( false )
|
||||
, m_nLeftBorder( 0 )
|
||||
, m_nTopBorder( 0 )
|
||||
, m_nRightBorder( 0 )
|
||||
, m_nBottomBorder( 0 )
|
||||
{}
|
||||
|
||||
void deleteChild() { m_pChild.reset(); }
|
||||
|
||||
sal_Int32 getExpandPriority() const;
|
||||
Size getOptimalSize( WindowSizeType ) const;
|
||||
bool isVisible() const;
|
||||
void setPosSize( const Point&, const Size& );
|
||||
};
|
||||
|
||||
Window* m_pParentWindow;
|
||||
WindowArranger* m_pParentArranger;
|
||||
Rectangle m_aManagedArea;
|
||||
long m_nOuterBorder;
|
||||
|
||||
virtual Element* getElement( size_t i_nIndex ) = 0;
|
||||
const Element* getConstElement( size_t i_nIndex ) const
|
||||
{ return const_cast<WindowArranger*>(this)->getElement( i_nIndex ); }
|
||||
|
||||
|
||||
public:
|
||||
WindowArranger( WindowArranger* i_pParent = NULL )
|
||||
: m_pParentWindow( i_pParent ? i_pParent->m_pParentWindow : NULL )
|
||||
, m_pParentArranger( i_pParent )
|
||||
, m_nOuterBorder( 0 )
|
||||
{}
|
||||
virtual ~WindowArranger();
|
||||
|
||||
// ask what would be the optimal size
|
||||
virtual Size getOptimalSize( WindowSizeType ) const = 0;
|
||||
// call Resize to trigger layouting inside the managed area
|
||||
// without function while parent window is unset
|
||||
virtual void resize() = 0;
|
||||
// avoid this if possible, using the constructor instead
|
||||
// there can be only one parent window and all managed windows MUST
|
||||
// be direct children of that window
|
||||
// violating that condition will result in undefined behavior
|
||||
virtual void setParentWindow( Window* );
|
||||
|
||||
virtual void setParent( WindowArranger* );
|
||||
|
||||
virtual size_t countElements() const = 0;
|
||||
boost::shared_ptr<WindowArranger> getChild( size_t i_nIndex ) const
|
||||
{
|
||||
const Element* pEle = getConstElement( i_nIndex );
|
||||
return pEle ? pEle->m_pChild : boost::shared_ptr<WindowArranger>();
|
||||
}
|
||||
Window* getWindow( size_t i_nIndex ) const
|
||||
{
|
||||
const Element* pEle = getConstElement( i_nIndex );
|
||||
return pEle ? pEle->m_pElement : NULL;
|
||||
}
|
||||
|
||||
virtual bool isVisible() const; // true if any element is visible
|
||||
|
||||
sal_Int32 getExpandPriority( size_t i_nIndex ) const
|
||||
{
|
||||
const Element* pEle = getConstElement( i_nIndex );
|
||||
return pEle ? pEle->getExpandPriority() : 0;
|
||||
}
|
||||
|
||||
Size getMinimumSize( size_t i_nIndex ) const
|
||||
{
|
||||
const Element* pEle = getConstElement( i_nIndex );
|
||||
return pEle ? pEle->m_aMinSize : Size();
|
||||
}
|
||||
|
||||
bool setMinimumSize( size_t i_nIndex, const Size& i_rMinSize )
|
||||
{
|
||||
Element* pEle = getElement( i_nIndex );
|
||||
if( pEle )
|
||||
pEle->m_aMinSize = i_rMinSize;
|
||||
return pEle != NULL;
|
||||
}
|
||||
|
||||
void setBorders( size_t i_nIndex, long i_nLeft, long i_nTop, long i_nRight, long i_nBottom )
|
||||
{
|
||||
Element* pEle = getElement( i_nIndex );
|
||||
if( pEle )
|
||||
{
|
||||
pEle->m_nLeftBorder = i_nLeft;
|
||||
pEle->m_nRightBorder = i_nRight;
|
||||
pEle->m_nTopBorder = i_nTop;
|
||||
pEle->m_nBottomBorder = i_nBottom;
|
||||
}
|
||||
}
|
||||
|
||||
void show( bool i_bShow = true, bool i_bImmediateUpdate = true );
|
||||
|
||||
void setManagedArea( const Rectangle& i_rArea )
|
||||
{
|
||||
m_aManagedArea = i_rArea;
|
||||
resize();
|
||||
}
|
||||
const Rectangle& getManagedArea() const { return m_aManagedArea; }
|
||||
|
||||
void setOuterBorder( long i_nBorder )
|
||||
{
|
||||
m_nOuterBorder = i_nBorder;
|
||||
resize();
|
||||
}
|
||||
};
|
||||
|
||||
class RowOrColumn : public WindowArranger
|
||||
{
|
||||
long m_nBorderWidth;
|
||||
bool m_bColumn;
|
||||
|
||||
std::vector< WindowArranger::Element > m_aElements;
|
||||
|
||||
void distributeRowWidth( std::vector< Size >& io_rSizes, long i_nUsedWidth, long i_nExtraWidth );
|
||||
void distributeColumnHeight( std::vector< Size >& io_rSizes, long i_nUsedHeight, long i_nExtraHeight );
|
||||
protected:
|
||||
virtual Element* getElement( size_t i_nIndex )
|
||||
{ return i_nIndex < m_aElements.size() ? &m_aElements[ i_nIndex ] : 0; }
|
||||
|
||||
public:
|
||||
RowOrColumn( WindowArranger* i_pParent = NULL,
|
||||
bool bColumn = true, long i_nBorderWidth = 5 )
|
||||
: WindowArranger( i_pParent )
|
||||
, m_nBorderWidth( i_nBorderWidth )
|
||||
, m_bColumn( bColumn )
|
||||
{}
|
||||
|
||||
virtual ~RowOrColumn();
|
||||
|
||||
virtual Size getOptimalSize( WindowSizeType ) const;
|
||||
virtual void resize();
|
||||
virtual size_t countElements() const { return m_aElements.size(); }
|
||||
|
||||
// add a managed window at the given index
|
||||
// an index smaller than zero means add the window at the end
|
||||
size_t addWindow( Window*, sal_Int32 i_nExpandPrio = 0, size_t i_nIndex = ~0 );
|
||||
void remove( Window* );
|
||||
|
||||
size_t addChild( boost::shared_ptr<WindowArranger> const &, sal_Int32 i_nExpandPrio = 0, size_t i_nIndex = ~0 );
|
||||
// convenience: use for addChild( new WindowArranger( ... ) ) constructs
|
||||
size_t addChild( WindowArranger* i_pNewChild, sal_Int32 i_nExpandPrio = 0, size_t i_nIndex = ~0 )
|
||||
{ return addChild( boost::shared_ptr<WindowArranger>( i_pNewChild ), i_nExpandPrio, i_nIndex ); }
|
||||
void remove( boost::shared_ptr<WindowArranger> const & );
|
||||
|
||||
long getBorderWidth() const { return m_nBorderWidth; }
|
||||
};
|
||||
|
||||
class LabeledElement : public WindowArranger
|
||||
{
|
||||
WindowArranger::Element m_aLabel;
|
||||
WindowArranger::Element m_aElement;
|
||||
long m_nDistance;
|
||||
long m_nLabelColumnWidth;
|
||||
int m_nLabelStyle;
|
||||
protected:
|
||||
virtual Element* getElement( size_t i_nIndex )
|
||||
{
|
||||
if( i_nIndex == 0 )
|
||||
return &m_aLabel;
|
||||
else if( i_nIndex == 1 )
|
||||
return &m_aElement;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public:
|
||||
LabeledElement( WindowArranger* i_pParent = NULL, int i_nLabelStyle = 0, long i_nDistance = 5 )
|
||||
: WindowArranger( i_pParent )
|
||||
, m_nDistance( i_nDistance )
|
||||
, m_nLabelColumnWidth( 0 )
|
||||
, m_nLabelStyle( i_nLabelStyle )
|
||||
{}
|
||||
|
||||
virtual ~LabeledElement();
|
||||
|
||||
virtual Size getOptimalSize( WindowSizeType ) const;
|
||||
virtual void resize();
|
||||
virtual size_t countElements() const { return 2; }
|
||||
|
||||
void setLabel( Window* );
|
||||
void setLabel( boost::shared_ptr<WindowArranger> const & );
|
||||
void setElement( Window* );
|
||||
void setElement( boost::shared_ptr<WindowArranger> const & );
|
||||
void setLabelColumnWidth( long i_nWidth )
|
||||
{ m_nLabelColumnWidth = i_nWidth; }
|
||||
|
||||
Size getLabelSize( WindowSizeType i_eType ) const
|
||||
{ return m_aLabel.getOptimalSize( i_eType ); }
|
||||
Size getElementSize( WindowSizeType i_eType ) const
|
||||
{ return m_aElement.getOptimalSize( i_eType ); }
|
||||
};
|
||||
|
||||
class LabelColumn : public RowOrColumn
|
||||
{
|
||||
long getLabelWidth() const;
|
||||
public:
|
||||
LabelColumn( WindowArranger* i_pParent = NULL, long i_nBorderWidth = 5 )
|
||||
: RowOrColumn( i_pParent, true, i_nBorderWidth )
|
||||
{}
|
||||
virtual ~LabelColumn();
|
||||
|
||||
virtual Size getOptimalSize( WindowSizeType ) const;
|
||||
virtual void resize();
|
||||
|
||||
// returns the index of the added label
|
||||
size_t addRow( Window* i_pLabel, boost::shared_ptr<WindowArranger> const& i_rElement, long i_nIndent = 0 );
|
||||
size_t addRow( Window* i_pLabel, Window* i_pElement, long i_nIndent = 0 );
|
||||
};
|
||||
|
||||
class Indenter : public WindowArranger
|
||||
{
|
||||
long m_nIndent;
|
||||
WindowArranger::Element m_aElement;
|
||||
|
||||
protected:
|
||||
virtual Element* getElement( size_t i_nIndex )
|
||||
{ return i_nIndex == 0 ? &m_aElement : NULL; }
|
||||
|
||||
public:
|
||||
Indenter( WindowArranger* i_pParent = NULL, long i_nIndent = 15 )
|
||||
: WindowArranger( i_pParent )
|
||||
, m_nIndent( i_nIndent )
|
||||
{}
|
||||
|
||||
virtual ~Indenter();
|
||||
|
||||
virtual Size getOptimalSize( WindowSizeType ) const;
|
||||
virtual void resize();
|
||||
virtual size_t countElements() const { return (m_aElement.m_pElement != 0 || m_aElement.m_pChild != 0) ? 1 : 0; }
|
||||
|
||||
void setIndent( long i_nIndent )
|
||||
{
|
||||
m_nIndent = i_nIndent;
|
||||
resize();
|
||||
}
|
||||
|
||||
void setWindow( Window*, sal_Int32 i_nExpandPrio = 0 );
|
||||
void setChild( boost::shared_ptr<WindowArranger> const &, sal_Int32 i_nExpandPrio = 0 );
|
||||
// convenience: use for setChild( new WindowArranger( ... ) ) constructs
|
||||
void setChild( WindowArranger* i_pChild, sal_Int32 i_nExpandPrio = 0 )
|
||||
{ setChild( boost::shared_ptr<WindowArranger>( i_pChild ), i_nExpandPrio ); }
|
||||
};
|
||||
|
||||
class Spacer : public WindowArranger
|
||||
{
|
||||
WindowArranger::Element m_aElement;
|
||||
Size m_aSize;
|
||||
|
||||
protected:
|
||||
virtual Element* getElement( size_t i_nIndex )
|
||||
{ return i_nIndex == 0 ? &m_aElement : NULL; }
|
||||
|
||||
public:
|
||||
Spacer( WindowArranger* i_pParent = NULL, sal_Int32 i_nPrio = 20, const Size& i_rSize = Size( 0, 0 ) )
|
||||
: WindowArranger( i_pParent )
|
||||
, m_aElement( NULL, boost::shared_ptr<WindowArranger>(), i_nPrio )
|
||||
, m_aSize( i_rSize )
|
||||
{}
|
||||
|
||||
virtual ~Spacer() {}
|
||||
|
||||
virtual Size getOptimalSize( WindowSizeType ) const
|
||||
{ return m_aSize; }
|
||||
virtual void resize() {}
|
||||
virtual void setParentWindow( Window* ) {}
|
||||
virtual size_t countElements() const { return 1; }
|
||||
virtual bool isVisible() const { return true; }
|
||||
};
|
||||
|
||||
class MatrixArranger : public WindowArranger
|
||||
{
|
||||
long m_nBorderX;
|
||||
long m_nBorderY;
|
||||
|
||||
struct MatrixElement : public WindowArranger::Element
|
||||
{
|
||||
sal_uInt32 m_nX;
|
||||
sal_uInt32 m_nY;
|
||||
|
||||
MatrixElement()
|
||||
: WindowArranger::Element()
|
||||
, m_nX( 0 )
|
||||
, m_nY( 0 )
|
||||
{}
|
||||
|
||||
MatrixElement( Window* i_pWin,
|
||||
sal_uInt32 i_nX, sal_uInt32 i_nY,
|
||||
boost::shared_ptr<WindowArranger> const & i_pChild = boost::shared_ptr<WindowArranger>(),
|
||||
sal_Int32 i_nExpandPriority = 0
|
||||
)
|
||||
: WindowArranger::Element( i_pWin, i_pChild, i_nExpandPriority )
|
||||
, m_nX( i_nX )
|
||||
, m_nY( i_nY )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
std::vector< MatrixElement > m_aElements;
|
||||
std::map< sal_uInt64, size_t > m_aMatrixMap; // maps (x | (y << 32)) to index in m_aElements
|
||||
|
||||
sal_uInt64 getMap( sal_uInt32 i_nX, sal_uInt32 i_nY )
|
||||
{ return static_cast< sal_uInt64 >(i_nX) | (static_cast< sal_uInt64>(i_nY) << 32 ); }
|
||||
|
||||
Size getOptimalSize( WindowSizeType, std::vector<long>& o_rColumnWidths, std::vector<long>& o_rRowHeights ) const;
|
||||
protected:
|
||||
virtual Element* getElement( size_t i_nIndex )
|
||||
{ return i_nIndex < m_aElements.size() ? &m_aElements[ i_nIndex ] : 0; }
|
||||
|
||||
public:
|
||||
MatrixArranger( WindowArranger* i_pParent = NULL,
|
||||
long i_nBorderX = 5,
|
||||
long i_nBorderY = 5 )
|
||||
: WindowArranger( i_pParent )
|
||||
, m_nBorderX( i_nBorderX )
|
||||
, m_nBorderY( i_nBorderY )
|
||||
{}
|
||||
|
||||
virtual ~MatrixArranger();
|
||||
|
||||
virtual Size getOptimalSize( WindowSizeType ) const;
|
||||
virtual void resize();
|
||||
virtual size_t countElements() const { return m_aElements.size(); }
|
||||
|
||||
// add a managed window at the given matrix position
|
||||
size_t addWindow( Window*, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio = 0 );
|
||||
void remove( Window* );
|
||||
|
||||
size_t addChild( boost::shared_ptr<WindowArranger> const &, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio = 0 );
|
||||
// convenience: use for addChild( new WindowArranger( ... ) ) constructs
|
||||
size_t addChild( WindowArranger* i_pNewChild, sal_uInt32 i_nX, sal_uInt32 i_nY, sal_Int32 i_nExpandPrio = 0 )
|
||||
{ return addChild( boost::shared_ptr<WindowArranger>( i_pNewChild ), i_nX, i_nY, i_nExpandPrio ); }
|
||||
void remove( boost::shared_ptr<WindowArranger> const & );
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -425,7 +425,6 @@ private:
|
||||
SAL_DLLPRIVATE void ImplInitCheckBoxData();
|
||||
SAL_DLLPRIVATE WinBits ImplInitStyle( const Window* pPrevWindow, WinBits nStyle );
|
||||
SAL_DLLPRIVATE void ImplInitSettings( BOOL bFont, BOOL bForeground, BOOL bBackground );
|
||||
SAL_DLLPRIVATE void ImplDrawCheckBoxState();
|
||||
SAL_DLLPRIVATE void ImplInvalidateOrDrawCheckBoxState();
|
||||
SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
|
||||
const Point& rPos, const Size& rSize,
|
||||
@ -450,10 +449,12 @@ protected:
|
||||
SAL_DLLPRIVATE virtual const Color&
|
||||
GetCanonicalTextColor( const StyleSettings& _rStyle ) const;
|
||||
|
||||
SAL_DLLPRIVATE virtual void ImplDrawCheckBoxState();
|
||||
SAL_DLLPRIVATE const Rectangle& GetStateRect() const { return maStateRect; }
|
||||
SAL_DLLPRIVATE const Rectangle& GetMouseRect() const { return maMouseRect; }
|
||||
public:
|
||||
SAL_DLLPRIVATE void ImplCheck();
|
||||
SAL_DLLPRIVATE void ImplSetMinimumNWFSize();
|
||||
|
||||
public:
|
||||
CheckBox( Window* pParent, WinBits nStyle = 0 );
|
||||
CheckBox( Window* pParent, const ResId& rResId );
|
||||
@ -552,4 +553,15 @@ public:
|
||||
~TriStateBox();
|
||||
};
|
||||
|
||||
class VCL_DLLPUBLIC DisclosureButton : public CheckBox
|
||||
{
|
||||
protected:
|
||||
SAL_DLLPRIVATE virtual void ImplDrawCheckBoxState();
|
||||
public:
|
||||
DisclosureButton( Window* pParent, WinBits nStyle = 0 );
|
||||
DisclosureButton( Window* pParent, const ResId& rResId );
|
||||
|
||||
virtual void KeyInput( const KeyEvent& rKEvt );
|
||||
};
|
||||
|
||||
#endif // _SV_BUTTON_HXX
|
||||
|
@ -54,7 +54,6 @@ namespace vcl
|
||||
std::hash_map< rtl::OUString, SmallOUStrMap, rtl::OUStringHash > m_aSettings;
|
||||
|
||||
virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames );
|
||||
virtual void Commit();
|
||||
|
||||
void getValues();
|
||||
SettingsConfigItem();
|
||||
@ -65,6 +64,8 @@ namespace vcl
|
||||
|
||||
const rtl::OUString& getValue( const rtl::OUString& rGroup, const rtl::OUString& rKey ) const;
|
||||
void setValue( const rtl::OUString& rGroup, const rtl::OUString& rKey, const rtl::OUString& rValue );
|
||||
|
||||
virtual void Commit();
|
||||
};
|
||||
|
||||
//........................................................................
|
||||
|
@ -85,6 +85,10 @@
|
||||
#define GDI_COMMENT_COMMENT 1031
|
||||
#define GDI_UNICODE_COMMENT 1032
|
||||
|
||||
#define GDI_LINEJOIN_ACTION 1033
|
||||
#define GDI_EXTENDEDPOLYGON_ACTION 1034
|
||||
#define GDI_LINEDASHDOT_ACTION 1035
|
||||
|
||||
// ----------------
|
||||
// - SVMConverter -
|
||||
// ----------------
|
||||
|
@ -120,6 +120,7 @@ private:
|
||||
SAL_DLLPRIVATE void ImplCopy( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard );
|
||||
SAL_DLLPRIVATE void ImplPaste( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard );
|
||||
SAL_DLLPRIVATE long ImplGetExtraOffset() const;
|
||||
SAL_DLLPRIVATE long ImplGetTextYPosition() const;
|
||||
SAL_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XExtendedInputSequenceChecker > ImplGetInputSequenceChecker() const;
|
||||
SAL_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > ImplGetBreakIterator() const;
|
||||
|
||||
|
@ -187,6 +187,7 @@ public:
|
||||
virtual void StateChanged( StateChangedType nType );
|
||||
virtual void DataChanged( const DataChangedEvent& rDCEvt );
|
||||
virtual void UserDraw( const UserDrawEvent& rUDEvt );
|
||||
virtual Size GetOptimalSize(WindowSizeType eType) const;
|
||||
|
||||
void SetImage( const Image& rImage );
|
||||
const Image& GetImage() const { return maImage; }
|
||||
|
@ -164,6 +164,7 @@ public:
|
||||
void Scale( double fScaleX, double fScaleY );
|
||||
void Scale( const Fraction& rScaleX, const Fraction& rScaleY );
|
||||
void Rotate( long nAngle10 );
|
||||
void Clip( const Rectangle& );
|
||||
/* get the bound rect of the contained actions
|
||||
* caveats:
|
||||
* - clip actions will limit the contained actions,
|
||||
|
@ -28,7 +28,7 @@
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _SV_IMPPRN_HXX
|
||||
#if 0
|
||||
#define _SV_IMPPRN_HXX
|
||||
|
||||
#include <vcl/print.hxx>
|
||||
@ -107,7 +107,6 @@ public:
|
||||
/**
|
||||
used by pull implementation to emit the next page
|
||||
*/
|
||||
using Printer::PrintPage;
|
||||
void PrintPage( unsigned int nPage );
|
||||
/**
|
||||
used by pull implementation to get the number of physical pages
|
||||
|
@ -74,6 +74,8 @@ struct JobData
|
||||
|
||||
JobData( const JobData& rData ) { *this = rData; }
|
||||
|
||||
void setCollate( bool bCollate );
|
||||
|
||||
// creates a new buffer using new
|
||||
// it is up to the user to delete it again
|
||||
bool getStreamBuffer( void*& pData, int& bytes );
|
||||
|
@ -60,12 +60,13 @@ struct ImplJobSetup
|
||||
String maPrinterName; // Printer-Name
|
||||
String maDriver; // Driver-Name
|
||||
Orientation meOrientation; // Orientation
|
||||
USHORT mnPaperBin; // Papierschacht
|
||||
Paper mePaperFormat; // Papierformat
|
||||
long mnPaperWidth; // Papierbreite in 100tel mm
|
||||
long mnPaperHeight; // Papierhoehe in 100tel mm
|
||||
ULONG mnDriverDataLen; // Laenge der systemabhaengigen Daten
|
||||
BYTE* mpDriverData; // Systemabhaengige Daten die als Byte-Block rausgeschrieben werden
|
||||
DuplexMode meDuplexMode; // Duplex
|
||||
USHORT mnPaperBin; // paper bin / in tray
|
||||
Paper mePaperFormat; // paper format
|
||||
long mnPaperWidth; // paper width (100th mm)
|
||||
long mnPaperHeight; // paper height (100th mm)
|
||||
ULONG mnDriverDataLen; // length of system specific data
|
||||
BYTE* mpDriverData; // system specific data (will be streamed a byte block)
|
||||
::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > maValueMap;
|
||||
|
||||
ImplJobSetup();
|
||||
|
@ -32,26 +32,29 @@
|
||||
#define _SV_LINEINFO_HXX
|
||||
|
||||
#include <vcl/dllapi.h>
|
||||
|
||||
#include <tools/gen.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
#include <basegfx/vector/b2enums.hxx>
|
||||
|
||||
// ----------------
|
||||
// - ImplLineInfo -
|
||||
// ----------------
|
||||
|
||||
class SvStream;
|
||||
namespace basegfx { class B2DPolyPolygon; }
|
||||
|
||||
struct ImplLineInfo
|
||||
{
|
||||
ULONG mnRefCount;
|
||||
LineStyle meStyle;
|
||||
long mnWidth;
|
||||
USHORT mnDashCount;
|
||||
long mnDashLen;
|
||||
USHORT mnDotCount;
|
||||
long mnDotLen;
|
||||
long mnDistance;
|
||||
ULONG mnRefCount;
|
||||
LineStyle meStyle;
|
||||
long mnWidth;
|
||||
USHORT mnDashCount;
|
||||
long mnDashLen;
|
||||
USHORT mnDotCount;
|
||||
long mnDotLen;
|
||||
long mnDistance;
|
||||
|
||||
basegfx::B2DLineJoin meLineJoin;
|
||||
|
||||
ImplLineInfo();
|
||||
ImplLineInfo( const ImplLineInfo& rImplLineInfo );
|
||||
@ -107,10 +110,26 @@ public:
|
||||
void SetDistance( long nDistance );
|
||||
long GetDistance() const { return mpImplLineInfo->mnDistance; }
|
||||
|
||||
void SetLineJoin(basegfx::B2DLineJoin eLineJoin);
|
||||
basegfx::B2DLineJoin GetLineJoin() const { return mpImplLineInfo->meLineJoin; }
|
||||
|
||||
BOOL IsDefault() const { return( !mpImplLineInfo->mnWidth && ( LINE_SOLID == mpImplLineInfo->meStyle ) ); }
|
||||
|
||||
friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, LineInfo& rLineInfo );
|
||||
friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const LineInfo& rLineInfo );
|
||||
|
||||
// helper to check if line width or DashDot is used
|
||||
bool isDashDotOrFatLineUsed() const;
|
||||
|
||||
// helper to get decomposed polygon data with the LineInfo applied. The source
|
||||
// hairline polygon is given in io_rLinePolyPolygon. Both given polygons may
|
||||
// contain results; e.g. when no fat line but DasDot is defined, the resut will
|
||||
// be in io_rLinePolyPolygon while o_rFillPolyPolygon will be empty. When fat line
|
||||
// is defined, it will be vice-versa. If none is defined, io_rLinePolyPolygon will
|
||||
// not be changed (but o_rFillPolyPolygon will be freed)
|
||||
void applyToB2DPolyPolygon(
|
||||
basegfx::B2DPolyPolygon& io_rLinePolyPolygon,
|
||||
basegfx::B2DPolyPolygon& o_rFillPolyPolygon) const;
|
||||
};
|
||||
|
||||
#endif // _SV_LINEINFO_HXX
|
||||
|
@ -60,4 +60,9 @@
|
||||
*/
|
||||
#define LISTBOX_ENTRY_FLAG_MULTILINE 0x0000002
|
||||
|
||||
/** this flags lets the item be drawn disabled (e.g. in grey text)
|
||||
usage only guaranteed with LISTBOX_ENTRY_FLAG_DISABLE_SELECTION
|
||||
*/
|
||||
#define LISTBOX_ENTRY_FLAG_DRAW_DISABLED 0x0000004
|
||||
|
||||
#endif // _SV_LSTBOX_H
|
||||
|
@ -93,6 +93,8 @@ typedef USHORT MenuItemBits;
|
||||
#define MIB_POPUPSELECT ((MenuItemBits)0x0020)
|
||||
// not in rsc/vclsrc.hxx because only a prelimitary solution
|
||||
#define MIB_NOSELECT ((MenuItemBits)0x0040)
|
||||
#define MIB_ICON ((MenuItemBits)0x0080)
|
||||
#define MIB_TEXT ((MenuItemBits)0x0100)
|
||||
|
||||
#define MENU_FLAG_NOAUTOMNEMONICS 0x0001
|
||||
#define MENU_FLAG_HIDEDISABLEDENTRIES 0x0002
|
||||
|
@ -6,9 +6,6 @@
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* $RCSfile: implncvt.hxx,v $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
* This file is part of OpenOffice.org.
|
||||
*
|
||||
* OpenOffice.org is free software: you can redistribute it and/or modify
|
||||
@ -28,51 +25,28 @@
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _SV_LINECONV_HXX
|
||||
#define _SV_LINECONV_HXX
|
||||
#ifndef _VCL_OLDPRINTADAPTOR
|
||||
#define _VCL_OLDPRINTADAPTOR
|
||||
|
||||
#include <tools/poly.hxx>
|
||||
#include <vcl/lineinfo.hxx>
|
||||
#include "vcl/print.hxx"
|
||||
|
||||
// --------------------
|
||||
// - ImplLineConverter
|
||||
// --------------------
|
||||
|
||||
struct ImplFloatPoint;
|
||||
|
||||
class ImplLineConverter
|
||||
namespace vcl
|
||||
{
|
||||
BOOL mbClosed;
|
||||
BOOL mbRefPoint;
|
||||
INT32 mnRefDistance;
|
||||
|
||||
double mfWidthHalf;
|
||||
LineInfo maLineInfo;
|
||||
|
||||
double mfDashDotLenght;
|
||||
double mfDistanceLenght;
|
||||
|
||||
UINT32 mnDashCount;
|
||||
UINT32 mnDotCount;
|
||||
|
||||
Polygon maPolygon;
|
||||
UINT32 mnFloat0Points;
|
||||
ImplFloatPoint* mpFloat0;
|
||||
UINT32 mnFloat1Points;
|
||||
ImplFloatPoint* mpFloat1;
|
||||
|
||||
UINT32 mnLinesAvailable;
|
||||
UINT32 mnLines;
|
||||
|
||||
ImplFloatPoint* mpFloatPoint;
|
||||
|
||||
struct ImplOldStyleAdaptorData;
|
||||
class VCL_DLLPUBLIC OldStylePrintAdaptor : public PrinterController
|
||||
{
|
||||
ImplOldStyleAdaptorData* mpData;
|
||||
public:
|
||||
OldStylePrintAdaptor( const boost::shared_ptr< Printer >& );
|
||||
virtual ~OldStylePrintAdaptor();
|
||||
|
||||
ImplLineConverter( const Polygon& rPoly, const LineInfo& rLineInfo, const Point* pRefPoint );
|
||||
~ImplLineConverter();
|
||||
void StartPage();
|
||||
void EndPage();
|
||||
|
||||
const Polygon* ImplGetFirst();
|
||||
const Polygon* ImplGetNext();
|
||||
};
|
||||
virtual int getPageCount() const;
|
||||
virtual com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > getPageParameters( int i_nPage ) const;
|
||||
virtual void printPage( int i_nPage ) const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -562,6 +562,9 @@ public:
|
||||
// Helper who tries to use SalGDI's DrawPolyLine direct and returns it's bool. Contains no AA check.
|
||||
SAL_DLLPRIVATE bool ImpTryDrawPolyLineDirect(const basegfx::B2DPolygon& rB2DPolygon, double fLineWidth, basegfx::B2DLineJoin eLineJoin);
|
||||
|
||||
// Helper for line geometry paint with support for graphic expansion (pattern and fat_to_area)
|
||||
void impPaintLineGeometryWithEvtlExpand(const LineInfo& rInfo, basegfx::B2DPolyPolygon aLinePolyPolygon);
|
||||
|
||||
protected:
|
||||
OutputDevice();
|
||||
|
||||
@ -1088,7 +1091,12 @@ public:
|
||||
*/
|
||||
BOOL HasAlpha();
|
||||
|
||||
void DrawEPS( const Point& rPt, const Size& rSz,
|
||||
/** Added return value to see if EPS could be painted directly.
|
||||
Theoreticaly, handing over a matrix would be needed to handle
|
||||
painting rotated EPS files (e.g. contained mín Metafiles). This
|
||||
would then need to be supported for Mac and PS printers, but
|
||||
that's too much for now, wrote #i107046# for this */
|
||||
bool DrawEPS( const Point& rPt, const Size& rSz,
|
||||
const GfxLink& rGfxLink, GDIMetaFile* pSubst = NULL );
|
||||
|
||||
/// request XCanvas render interface for this OutputDevice
|
||||
@ -1123,12 +1131,15 @@ public:
|
||||
false: output metafile is unchanged input metafile
|
||||
|
||||
@attention this is a member method, so current state can influence the result !
|
||||
@attention the output metafile is prepared in pixel mode for the currentOutputDevice
|
||||
state. It can not be moved or rotated reliably anymore.
|
||||
*/
|
||||
bool RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf,
|
||||
long nMaxBmpDPIX, long nMaxBmpDPIY,
|
||||
bool bReduceTransparency,
|
||||
bool bTransparencyAutoMode,
|
||||
bool bDownsampleBitmaps
|
||||
bool bDownsampleBitmaps,
|
||||
const Color& rBackground = Color( COL_TRANSPARENT )
|
||||
);
|
||||
/** Retrieve downsampled and cropped bitmap
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user