summaryrefslogtreecommitdiff
path: root/slideshow/source/engine/tools.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'slideshow/source/engine/tools.cxx')
-rw-r--r--slideshow/source/engine/tools.cxx212
1 files changed, 106 insertions, 106 deletions
diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx
index 85b2e0323aab..9a74e4114206 100644
--- a/slideshow/source/engine/tools.cxx
+++ b/slideshow/source/engine/tools.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -83,7 +83,7 @@ namespace slideshow
}
private:
- const ::rtl::OUString& mrSearchString;
+ const ::rtl::OUString& mrSearchString;
};
class NamedValueComparator
@@ -100,14 +100,14 @@ namespace slideshow
}
private:
- const beans::NamedValue& mrKey;
+ const beans::NamedValue& mrKey;
};
- ::basegfx::B2DHomMatrix getAttributedShapeTransformation( const ::basegfx::B2DRectangle& rShapeBounds,
- const ShapeAttributeLayerSharedPtr& pAttr )
+ ::basegfx::B2DHomMatrix getAttributedShapeTransformation( const ::basegfx::B2DRectangle& rShapeBounds,
+ const ShapeAttributeLayerSharedPtr& pAttr )
{
- ::basegfx::B2DHomMatrix aTransform;
- const ::basegfx::B2DSize& rSize( rShapeBounds.getRange() );
+ ::basegfx::B2DHomMatrix aTransform;
+ const ::basegfx::B2DSize& rSize( rShapeBounds.getRange() );
const double nShearX( pAttr->isShearXAngleValid() ?
pAttr->getShearXAngle() :
@@ -121,12 +121,12 @@ namespace slideshow
// scale, shear and rotation pivot point is the shape
// center - adapt origin accordingly
- aTransform.translate( -0.5, -0.5 );
+ aTransform.translate( -0.5, -0.5 );
// ensure valid size (zero size will inevitably lead
// to a singular transformation matrix)
aTransform.scale( ::basegfx::pruneScaleValue(
- rSize.getX() ),
+ rSize.getX() ),
::basegfx::pruneScaleValue(
rSize.getY() ) );
@@ -145,7 +145,7 @@ namespace slideshow
if( bNeedRotation )
aTransform.rotate( nRotation );
}
-
+
// move left, top corner back to position of the
// shape. Since we've already translated the
// center of the shape to the origin (the
@@ -162,10 +162,10 @@ namespace slideshow
// =========================
/// extract unary double value from Any
- bool extractValue( double& o_rValue,
- const uno::Any& rSourceAny,
- const ShapeSharedPtr& rShape,
- const ::basegfx::B2DVector& rSlideBounds )
+ bool extractValue( double& o_rValue,
+ const uno::Any& rSourceAny,
+ const ShapeSharedPtr& rShape,
+ const ::basegfx::B2DVector& rSlideBounds )
{
// try to extract numeric value (double, or smaller POD, like float or int)
if( (rSourceAny >>= o_rValue) )
@@ -183,7 +183,7 @@ namespace slideshow
try
{
// Parse string into ExpressionNode, eval node at time 0.0
- o_rValue = (*SmilFunctionParser::parseSmilValue(
+ o_rValue = (*SmilFunctionParser::parseSmilValue(
aString,
calcRelativeShapeBounds(rSlideBounds,
rShape->getBounds()) ))(0.0);
@@ -197,10 +197,10 @@ namespace slideshow
}
/// extract enum/constant group value from Any
- bool extractValue( sal_Int32& o_rValue,
- const uno::Any& rSourceAny,
- const ShapeSharedPtr& /*rShape*/,
- const ::basegfx::B2DVector& /*rSlideBounds*/ )
+ bool extractValue( sal_Int32& o_rValue,
+ const uno::Any& rSourceAny,
+ const ShapeSharedPtr& /*rShape*/,
+ const ::basegfx::B2DVector& /*rSlideBounds*/ )
{
// try to extract numeric value (int, or smaller POD, like byte)
if( (rSourceAny >>= o_rValue) )
@@ -242,10 +242,10 @@ namespace slideshow
}
/// extract enum/constant group value from Any
- bool extractValue( sal_Int16& o_rValue,
- const uno::Any& rSourceAny,
- const ShapeSharedPtr& rShape,
- const ::basegfx::B2DVector& rSlideBounds )
+ bool extractValue( sal_Int16& o_rValue,
+ const uno::Any& rSourceAny,
+ const ShapeSharedPtr& rShape,
+ const ::basegfx::B2DVector& rSlideBounds )
{
sal_Int32 aValue;
if( !extractValue(aValue,rSourceAny,rShape,rSlideBounds) )
@@ -263,10 +263,10 @@ namespace slideshow
}
/// extract color value from Any
- bool extractValue( RGBColor& o_rValue,
- const uno::Any& rSourceAny,
- const ShapeSharedPtr& /*rShape*/,
- const ::basegfx::B2DVector& /*rSlideBounds*/ )
+ bool extractValue( RGBColor& o_rValue,
+ const uno::Any& rSourceAny,
+ const ShapeSharedPtr& /*rShape*/,
+ const ::basegfx::B2DVector& /*rSlideBounds*/ )
{
// try to extract numeric value (double, or smaller POD, like float or int)
{
@@ -307,10 +307,10 @@ namespace slideshow
"extractValue(): inappropriate length for RGB color value" );
// truncate to byte
- o_rValue = RGBColor( ::cppcanvas::makeColor(
- static_cast<sal_uInt8>(aTmp[0]),
+ o_rValue = RGBColor( ::cppcanvas::makeColor(
+ static_cast<sal_uInt8>(aTmp[0]),
static_cast<sal_uInt8>(aTmp[1]),
- static_cast<sal_uInt8>(aTmp[2]),
+ static_cast<sal_uInt8>(aTmp[2]),
255 ) );
// succeeded
@@ -345,10 +345,10 @@ namespace slideshow
}
/// extract color value from Any
- bool extractValue( HSLColor& o_rValue,
- const uno::Any& rSourceAny,
- const ShapeSharedPtr& /*rShape*/,
- const ::basegfx::B2DVector& /*rSlideBounds*/ )
+ bool extractValue( HSLColor& o_rValue,
+ const uno::Any& rSourceAny,
+ const ShapeSharedPtr& /*rShape*/,
+ const ::basegfx::B2DVector& /*rSlideBounds*/ )
{
// try double sequence
{
@@ -379,15 +379,15 @@ namespace slideshow
return true;
}
}
-
+
return false; // nothing left to try
}
/// extract plain string from Any
- bool extractValue( ::rtl::OUString& o_rValue,
- const uno::Any& rSourceAny,
- const ShapeSharedPtr& /*rShape*/,
- const ::basegfx::B2DVector& /*rSlideBounds*/ )
+ bool extractValue( ::rtl::OUString& o_rValue,
+ const uno::Any& rSourceAny,
+ const ShapeSharedPtr& /*rShape*/,
+ const ::basegfx::B2DVector& /*rSlideBounds*/ )
{
// try to extract string
if( !(rSourceAny >>= o_rValue) )
@@ -397,10 +397,10 @@ namespace slideshow
}
/// extract bool value from Any
- bool extractValue( bool& o_rValue,
- const uno::Any& rSourceAny,
- const ShapeSharedPtr& /*rShape*/,
- const ::basegfx::B2DVector& /*rSlideBounds*/ )
+ bool extractValue( bool& o_rValue,
+ const uno::Any& rSourceAny,
+ const ShapeSharedPtr& /*rShape*/,
+ const ::basegfx::B2DVector& /*rSlideBounds*/ )
{
sal_Bool nTmp = sal_Bool();
// try to extract bool value
@@ -417,7 +417,7 @@ namespace slideshow
if( !(rSourceAny >>= aString) )
return false; // nothing left to try
- // we also take the strings "true" and "false",
+ // we also take the strings "true" and "false",
// as well as "on" and "off" here
if( aString.equalsIgnoreAsciiCaseAscii("true") ||
aString.equalsIgnoreAsciiCaseAscii("on") )
@@ -437,10 +437,10 @@ namespace slideshow
}
/// extract double 2-tuple from Any
- bool extractValue( ::basegfx::B2DTuple& o_rPair,
- const uno::Any& rSourceAny,
- const ShapeSharedPtr& rShape,
- const ::basegfx::B2DVector& rSlideBounds )
+ bool extractValue( ::basegfx::B2DTuple& o_rPair,
+ const uno::Any& rSourceAny,
+ const ShapeSharedPtr& rShape,
+ const ::basegfx::B2DVector& rSlideBounds )
{
animations::ValuePair aPair;
@@ -461,11 +461,11 @@ namespace slideshow
return true;
}
- bool findNamedValue( uno::Sequence< beans::NamedValue > const& rSequence,
- const beans::NamedValue& rSearchKey )
+ bool findNamedValue( uno::Sequence< beans::NamedValue > const& rSequence,
+ const beans::NamedValue& rSearchKey )
{
- const beans::NamedValue* pArray = rSequence.getConstArray();
- const size_t nLen( rSequence.getLength() );
+ const beans::NamedValue* pArray = rSequence.getConstArray();
+ const size_t nLen( rSequence.getLength() );
if( nLen == 0 )
return false;
@@ -479,13 +479,13 @@ namespace slideshow
return true;
}
-
- bool findNamedValue( beans::NamedValue* o_pRet,
- const uno::Sequence< beans::NamedValue >& rSequence,
- const ::rtl::OUString& rSearchString )
+
+ bool findNamedValue( beans::NamedValue* o_pRet,
+ const uno::Sequence< beans::NamedValue >& rSequence,
+ const ::rtl::OUString& rSearchString )
{
- const beans::NamedValue* pArray = rSequence.getConstArray();
- const size_t nLen( rSequence.getLength() );
+ const beans::NamedValue* pArray = rSequence.getConstArray();
+ const size_t nLen( rSequence.getLength() );
if( nLen == 0 )
return false;
@@ -511,15 +511,15 @@ namespace slideshow
rShapeBounds.getMaxY() / rPageSize.getY() );
}
- // TODO(F2): Currently, the positional attributes DO NOT mirror the XShape properties.
+ // TODO(F2): Currently, the positional attributes DO NOT mirror the XShape properties.
// First and foremost, this is because we must operate with the shape boundrect,
// not position and size (the conversion between logic rect, snap rect and boundrect
// are non-trivial for draw shapes, and I won't duplicate them here). Thus, shapes
// rotated on the page will still have 0.0 rotation angle, as the metafile
// representation fetched over the API is our default zero case.
- ::basegfx::B2DHomMatrix getShapeTransformation( const ::basegfx::B2DRectangle& rShapeBounds,
- const ShapeAttributeLayerSharedPtr& pAttr )
+ ::basegfx::B2DHomMatrix getShapeTransformation( const ::basegfx::B2DRectangle& rShapeBounds,
+ const ShapeAttributeLayerSharedPtr& pAttr )
{
if( !pAttr )
{
@@ -536,9 +536,9 @@ namespace slideshow
}
}
- ::basegfx::B2DHomMatrix getSpriteTransformation( const ::basegfx::B2DVector& rPixelSize,
- const ::basegfx::B2DVector& rOrigSize,
- const ShapeAttributeLayerSharedPtr& pAttr )
+ ::basegfx::B2DHomMatrix getSpriteTransformation( const ::basegfx::B2DVector& rPixelSize,
+ const ::basegfx::B2DVector& rOrigSize,
+ const ShapeAttributeLayerSharedPtr& pAttr )
{
::basegfx::B2DHomMatrix aTransform;
@@ -557,20 +557,20 @@ namespace slideshow
// scale, shear and rotation pivot point is the
// sprite's pixel center - adapt origin accordingly
aTransform.translate( -0.5*rPixelSize.getX(),
- -0.5*rPixelSize.getY() );
+ -0.5*rPixelSize.getY() );
- const ::basegfx::B2DSize aSize(
+ const ::basegfx::B2DSize aSize(
pAttr->isWidthValid() ? pAttr->getWidth() : rOrigSize.getX(),
pAttr->isHeightValid() ? pAttr->getHeight() : rOrigSize.getY() );
// ensure valid size (zero size will inevitably lead
// to a singular transformation matrix).
aTransform.scale( ::basegfx::pruneScaleValue(
- aSize.getX() /
+ aSize.getX() /
::basegfx::pruneScaleValue(
- rOrigSize.getX() ) ),
+ rOrigSize.getX() ) ),
::basegfx::pruneScaleValue(
- aSize.getY() /
+ aSize.getY() /
::basegfx::pruneScaleValue(
rOrigSize.getY() ) ) );
@@ -594,7 +594,7 @@ namespace slideshow
// the sprite (we've translated the center of the
// sprite to the origin above).
aTransform.translate( 0.5*rPixelSize.getX(),
- 0.5*rPixelSize.getY() );
+ 0.5*rPixelSize.getY() );
}
// return identity transform for un-attributed
@@ -603,9 +603,9 @@ namespace slideshow
return aTransform;
}
- ::basegfx::B2DRectangle getShapeUpdateArea( const ::basegfx::B2DRectangle& rUnitBounds,
- const ::basegfx::B2DHomMatrix& rShapeTransform,
- const ShapeAttributeLayerSharedPtr& pAttr )
+ ::basegfx::B2DRectangle getShapeUpdateArea( const ::basegfx::B2DRectangle& rUnitBounds,
+ const ::basegfx::B2DHomMatrix& rShapeTransform,
+ const ShapeAttributeLayerSharedPtr& pAttr )
{
::basegfx::B2DHomMatrix aTransform;
@@ -619,9 +619,9 @@ namespace slideshow
const double nCharScale( pAttr->getCharScale() );
// center of scaling is the middle of the shape
- aTransform.translate( -0.5, -0.5 );
+ aTransform.translate( -0.5, -0.5 );
aTransform.scale( nCharScale, nCharScale );
- aTransform.translate( 0.5, 0.5 );
+ aTransform.translate( 0.5, 0.5 );
}
aTransform *= rShapeTransform;
@@ -629,14 +629,14 @@ namespace slideshow
::basegfx::B2DRectangle aRes;
// apply shape transformation to unit rect
- return ::canvas::tools::calcTransformedRectBounds(
- aRes,
+ return ::canvas::tools::calcTransformedRectBounds(
+ aRes,
rUnitBounds,
aTransform );
}
- ::basegfx::B2DRange getShapeUpdateArea( const ::basegfx::B2DRange& rUnitBounds,
- const ::basegfx::B2DRange& rShapeBounds )
+ ::basegfx::B2DRange getShapeUpdateArea( const ::basegfx::B2DRange& rUnitBounds,
+ const ::basegfx::B2DRange& rShapeBounds )
{
return ::basegfx::B2DRectangle(
basegfx::tools::lerp( rShapeBounds.getMinX(),
@@ -652,9 +652,9 @@ namespace slideshow
rShapeBounds.getMaxY(),
rUnitBounds.getMaxY() ) );
}
-
- ::basegfx::B2DRectangle getShapePosSize( const ::basegfx::B2DRectangle& rOrigBounds,
- const ShapeAttributeLayerSharedPtr& pAttr )
+
+ ::basegfx::B2DRectangle getShapePosSize( const ::basegfx::B2DRectangle& rOrigBounds,
+ const ShapeAttributeLayerSharedPtr& pAttr )
{
// an already empty shape bound need no further
// treatment. In fact, any changes applied below would
@@ -667,7 +667,7 @@ namespace slideshow
}
else
{
- // cannot use maBounds anymore, attributes might have been
+ // cannot use maBounds anymore, attributes might have been
// changed by now.
// Have to use absolute values here, as negative sizes
// (aka mirrored shapes) _still_ have the same bounds,
@@ -691,14 +691,14 @@ namespace slideshow
// the positional attribute retrieved from the
// ShapeAttributeLayer actually denotes the _middle_
// of the shape (do it as the PPTs do...)
- return ::basegfx::B2DRectangle( aPos - 0.5*aSize,
+ return ::basegfx::B2DRectangle( aPos - 0.5*aSize,
aPos + 0.5*aSize );
}
}
RGBColor unoColor2RGBColor( sal_Int32 nColor )
{
- return RGBColor(
+ return RGBColor(
::cppcanvas::makeColor(
// convert from API color to IntSRGBA color
// (0xAARRGGBB -> 0xRRGGBBAA)
@@ -707,7 +707,7 @@ namespace slideshow
static_cast< sal_uInt8 >( nColor ),
static_cast< sal_uInt8 >( nColor >> 24U ) ) );
}
-
+
sal_Int32 RGBAColor2UnoColor( ::cppcanvas::Color::IntSRGBA aColor )
{
return ::cppcanvas::makeColorARGB(
@@ -718,7 +718,7 @@ namespace slideshow
::cppcanvas::getGreen(aColor),
::cppcanvas::getBlue(aColor));
}
-
+
/*sal_Int32 RGBAColor2UnoColor( ::cppcanvas::Color::IntSRGBA aColor )
{
return ::cppcanvas::unMakeColor(
@@ -731,7 +731,7 @@ namespace slideshow
}*/
sal_Int8 unSignedToSigned(sal_Int8 nInt)
- {
+ {
if(nInt < 0 ){
sal_Int8 nInt2 = nInt >> 1U;
return nInt2;
@@ -739,16 +739,16 @@ namespace slideshow
return nInt;
}
}
-
+
void fillRect( const ::cppcanvas::CanvasSharedPtr& rCanvas,
- const ::basegfx::B2DRectangle& rRect,
+ const ::basegfx::B2DRectangle& rRect,
::cppcanvas::Color::IntSRGBA aFillColor )
{
const ::basegfx::B2DPolygon aPoly(
::basegfx::tools::createPolygonFromRect( rRect ));
- ::cppcanvas::PolyPolygonSharedPtr pPolyPoly(
- ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( rCanvas,
+ ::cppcanvas::PolyPolygonSharedPtr pPolyPoly(
+ ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( rCanvas,
aPoly ) );
if( pPolyPoly )
@@ -759,7 +759,7 @@ namespace slideshow
}
void initSlideBackground( const ::cppcanvas::CanvasSharedPtr& rCanvas,
- const ::basegfx::B2ISize& rSize )
+ const ::basegfx::B2ISize& rSize )
{
::cppcanvas::CanvasSharedPtr pCanvas( rCanvas->clone() );
@@ -771,7 +771,7 @@ namespace slideshow
// pixel, and the bitmap is initialized white,
// depending on the slide content a one pixel wide
// line will show to the bottom and the right.
- fillRect( pCanvas,
+ fillRect( pCanvas,
::basegfx::B2DRectangle( 0.0, 0.0,
rSize.getX(),
rSize.getY() ),
@@ -785,7 +785,7 @@ namespace slideshow
// off. OTOH, every other slide background (solid fill,
// gradient, bitmap) render one pixel less, thus revealing
// ugly white pixel to the right and the bottom.
- fillRect( pCanvas,
+ fillRect( pCanvas,
::basegfx::B2DRectangle( 0.0, 0.0,
rSize.getX()-1,
rSize.getY()-1 ),
@@ -794,37 +794,37 @@ namespace slideshow
::basegfx::B2DRectangle getAPIShapeBounds( const uno::Reference< drawing::XShape >& xShape )
{
- uno::Reference< beans::XPropertySet > xPropSet( xShape,
+ uno::Reference< beans::XPropertySet > xPropSet( xShape,
uno::UNO_QUERY_THROW );
// read bound rect
awt::Rectangle aTmpRect;
- if( !(xPropSet->getPropertyValue(
+ if( !(xPropSet->getPropertyValue(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BoundRect") ) ) >>= aTmpRect) )
{
ENSURE_OR_THROW( false,
"getAPIShapeBounds(): Could not get \"BoundRect\" property from shape" );
}
- return ::basegfx::B2DRectangle( aTmpRect.X,
+ return ::basegfx::B2DRectangle( aTmpRect.X,
aTmpRect.Y,
- aTmpRect.X+aTmpRect.Width,
+ aTmpRect.X+aTmpRect.Width,
aTmpRect.Y+aTmpRect.Height );
}
double getAPIShapePrio( const uno::Reference< drawing::XShape >& xShape )
{
- uno::Reference< beans::XPropertySet > xPropSet( xShape,
+ uno::Reference< beans::XPropertySet > xPropSet( xShape,
uno::UNO_QUERY_THROW );
// read prio
sal_Int32 nPrio(0);
- if( !(xPropSet->getPropertyValue(
+ if( !(xPropSet->getPropertyValue(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ZOrder") ) ) >>= nPrio) )
{
ENSURE_OR_THROW( false,
"getAPIShapePrio(): Could not get \"ZOrder\" property from shape" );
}
- // TODO(F2): Check and adapt the range of possible values here.
+ // TODO(F2): Check and adapt the range of possible values here.
// Maybe we can also take the total number of shapes here
return nPrio / 65535.0;
}
@@ -839,17 +839,17 @@ namespace slideshow
rSlideSize.getX(),
rSlideSize.getY() );
basegfx::B2DRange aTmpRect;
- canvas::tools::calcTransformedRectBounds( aTmpRect,
- aRect,
+ canvas::tools::calcTransformedRectBounds( aTmpRect,
+ aRect,
pView->getTransformation() );
// #i42440# Returned slide size is one pixel too small, as
// rendering happens one pixel to the right and below the
// actual bound rect.
- return basegfx::B2IVector(
+ return basegfx::B2IVector(
basegfx::fround( aTmpRect.getRange().getX() ) + 1,
basegfx::fround( aTmpRect.getRange().getY() ) + 1 );
- }
+ }
}
}