Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "oox/drawingml/fillproperties.hxx"
21 :
22 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
23 : #include <com/sun/star/beans/XPropertySet.hpp>
24 : #include <com/sun/star/awt/Gradient.hpp>
25 : #include <com/sun/star/text/GraphicCrop.hpp>
26 : #include <com/sun/star/awt/Size.hpp>
27 : #include <com/sun/star/drawing/BitmapMode.hpp>
28 : #include <com/sun/star/drawing/ColorMode.hpp>
29 : #include <com/sun/star/drawing/FillStyle.hpp>
30 : #include <com/sun/star/drawing/RectanglePoint.hpp>
31 : #include <com/sun/star/graphic/XGraphicTransformer.hpp>
32 : #include "oox/helper/graphichelper.hxx"
33 : #include "oox/drawingml/drawingmltypes.hxx"
34 : #include "oox/drawingml/shapepropertymap.hxx"
35 : #include "oox/token/tokens.hxx"
36 :
37 : using namespace ::com::sun::star;
38 : using namespace ::com::sun::star::drawing;
39 : using namespace ::com::sun::star::graphic;
40 :
41 : using ::com::sun::star::uno::Reference;
42 : using ::com::sun::star::uno::Exception;
43 : using ::com::sun::star::uno::UNO_QUERY;
44 : using ::com::sun::star::uno::UNO_QUERY_THROW;
45 : using ::com::sun::star::geometry::IntegerRectangle2D;
46 :
47 : namespace oox {
48 : namespace drawingml {
49 :
50 : // ============================================================================
51 :
52 : namespace {
53 :
54 0 : BitmapMode lclGetBitmapMode( sal_Int32 nToken )
55 : {
56 : OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
57 0 : switch( nToken )
58 : {
59 0 : case XML_tile: return BitmapMode_REPEAT;
60 0 : case XML_stretch: return BitmapMode_STRETCH;
61 : }
62 0 : return BitmapMode_NO_REPEAT;
63 : }
64 :
65 0 : RectanglePoint lclGetRectanglePoint( sal_Int32 nToken )
66 : {
67 : OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
68 0 : switch( nToken )
69 : {
70 0 : case XML_tl: return RectanglePoint_LEFT_TOP;
71 0 : case XML_t: return RectanglePoint_MIDDLE_TOP;
72 0 : case XML_tr: return RectanglePoint_RIGHT_TOP;
73 0 : case XML_l: return RectanglePoint_LEFT_MIDDLE;
74 0 : case XML_ctr: return RectanglePoint_MIDDLE_MIDDLE;
75 0 : case XML_r: return RectanglePoint_RIGHT_MIDDLE;
76 0 : case XML_bl: return RectanglePoint_LEFT_BOTTOM;
77 0 : case XML_b: return RectanglePoint_MIDDLE_BOTTOM;
78 0 : case XML_br: return RectanglePoint_RIGHT_BOTTOM;
79 : }
80 0 : return RectanglePoint_LEFT_TOP;
81 : }
82 :
83 0 : const awt::Size lclGetOriginalSize( const GraphicHelper& rGraphicHelper, const Reference< XGraphic >& rxGraphic )
84 : {
85 0 : awt::Size aSizeHmm( 0, 0 );
86 : try
87 : {
88 0 : Reference< beans::XPropertySet > xGraphicPropertySet( rxGraphic, UNO_QUERY_THROW );
89 0 : if( xGraphicPropertySet->getPropertyValue( CREATE_OUSTRING( "Size100thMM" ) ) >>= aSizeHmm )
90 : {
91 0 : if( !aSizeHmm.Width && !aSizeHmm.Height )
92 : { // MAPMODE_PIXEL USED :-(
93 0 : awt::Size aSourceSizePixel( 0, 0 );
94 0 : if( xGraphicPropertySet->getPropertyValue( CREATE_OUSTRING( "SizePixel" ) ) >>= aSourceSizePixel )
95 0 : aSizeHmm = rGraphicHelper.convertScreenPixelToHmm( aSourceSizePixel );
96 : }
97 0 : }
98 : }
99 0 : catch( Exception& )
100 : {
101 : }
102 0 : return aSizeHmm;
103 : }
104 :
105 : } // namespace
106 :
107 : // ============================================================================
108 :
109 95 : void GradientFillProperties::assignUsed( const GradientFillProperties& rSourceProps )
110 : {
111 95 : if( !rSourceProps.maGradientStops.empty() )
112 0 : maGradientStops = rSourceProps.maGradientStops;
113 95 : moFillToRect.assignIfUsed( rSourceProps.moFillToRect );
114 95 : moTileRect.assignIfUsed( rSourceProps.moTileRect );
115 95 : moGradientPath.assignIfUsed( rSourceProps.moGradientPath );
116 95 : moShadeAngle.assignIfUsed( rSourceProps.moShadeAngle );
117 95 : moShadeFlip.assignIfUsed( rSourceProps.moShadeFlip );
118 95 : moShadeScaled.assignIfUsed( rSourceProps.moShadeScaled );
119 95 : moRotateWithShape.assignIfUsed( rSourceProps.moRotateWithShape );
120 95 : }
121 :
122 : // ============================================================================
123 :
124 95 : void PatternFillProperties::assignUsed( const PatternFillProperties& rSourceProps )
125 : {
126 95 : maPattFgColor.assignIfUsed( rSourceProps.maPattFgColor );
127 95 : maPattBgColor.assignIfUsed( rSourceProps.maPattBgColor );
128 95 : moPattPreset.assignIfUsed( rSourceProps.moPattPreset );
129 95 : }
130 :
131 : // ============================================================================
132 :
133 95 : void BlipFillProperties::assignUsed( const BlipFillProperties& rSourceProps )
134 : {
135 95 : if( rSourceProps.mxGraphic.is() )
136 0 : mxGraphic = rSourceProps.mxGraphic;
137 95 : moBitmapMode.assignIfUsed( rSourceProps.moBitmapMode );
138 95 : moFillRect.assignIfUsed( rSourceProps.moFillRect );
139 95 : moTileOffsetX.assignIfUsed( rSourceProps.moTileOffsetX );
140 95 : moTileOffsetY.assignIfUsed( rSourceProps.moTileOffsetY );
141 95 : moTileScaleX.assignIfUsed( rSourceProps.moTileScaleX );
142 95 : moTileScaleY.assignIfUsed( rSourceProps.moTileScaleY );
143 95 : moTileAlign.assignIfUsed( rSourceProps.moTileAlign );
144 95 : moTileFlip.assignIfUsed( rSourceProps.moTileFlip );
145 95 : moRotateWithShape.assignIfUsed( rSourceProps.moRotateWithShape );
146 95 : moColorEffect.assignIfUsed( rSourceProps.moColorEffect );
147 95 : moBrightness.assignIfUsed( rSourceProps.moBrightness );
148 95 : moContrast.assignIfUsed( rSourceProps.moContrast );
149 95 : maColorChangeFrom.assignIfUsed( rSourceProps.maColorChangeFrom );
150 95 : maColorChangeTo.assignIfUsed( rSourceProps.maColorChangeTo );
151 95 : }
152 :
153 : // ============================================================================
154 :
155 95 : void FillProperties::assignUsed( const FillProperties& rSourceProps )
156 : {
157 95 : moFillType.assignIfUsed( rSourceProps.moFillType );
158 95 : maFillColor.assignIfUsed( rSourceProps.maFillColor );
159 95 : maGradientProps.assignUsed( rSourceProps.maGradientProps );
160 95 : maPatternProps.assignUsed( rSourceProps.maPatternProps );
161 95 : maBlipProps.assignUsed( rSourceProps.maBlipProps );
162 95 : }
163 :
164 60 : Color FillProperties::getBestSolidColor() const
165 : {
166 60 : Color aSolidColor;
167 60 : if( moFillType.has() ) switch( moFillType.get() )
168 : {
169 : case XML_solidFill:
170 20 : aSolidColor = maFillColor;
171 20 : break;
172 : case XML_gradFill:
173 0 : if( !maGradientProps.maGradientStops.empty() )
174 0 : aSolidColor = maGradientProps.maGradientStops.begin()->second;
175 0 : break;
176 : case XML_pattFill:
177 0 : aSolidColor = maPatternProps.maPattBgColor.isUsed() ? maPatternProps.maPattBgColor : maPatternProps.maPattFgColor;
178 0 : break;
179 : }
180 60 : return aSolidColor;
181 : }
182 :
183 63 : void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
184 : const GraphicHelper& rGraphicHelper, sal_Int32 nShapeRotation, sal_Int32 nPhClr,
185 : bool bFlipH, bool bFlipV ) const
186 : {
187 63 : if( moFillType.has() )
188 : {
189 63 : FillStyle eFillStyle = FillStyle_NONE;
190 : OSL_ASSERT((moFillType.get() & sal_Int32(0xFFFF0000))==0);
191 63 : switch( moFillType.get() )
192 : {
193 : case XML_noFill:
194 49 : eFillStyle = FillStyle_NONE;
195 49 : break;
196 :
197 : case XML_solidFill:
198 14 : if( maFillColor.isUsed() )
199 : {
200 14 : rPropMap.setProperty( SHAPEPROP_FillColor, maFillColor.getColor( rGraphicHelper, nPhClr ) );
201 14 : if( maFillColor.hasTransparency() )
202 0 : rPropMap.setProperty( SHAPEPROP_FillTransparency, maFillColor.getTransparency() );
203 14 : eFillStyle = FillStyle_SOLID;
204 : }
205 14 : break;
206 :
207 : case XML_gradFill:
208 : // do not create gradient struct if property is not supported...
209 0 : if( rPropMap.supportsProperty( SHAPEPROP_FillGradient ) )
210 : {
211 0 : sal_Int32 nEndTrans = 0;
212 0 : sal_Int32 nStartTrans = 0;
213 0 : awt::Gradient aGradient;
214 0 : aGradient.Angle = 900;
215 0 : aGradient.StartIntensity = 100;
216 0 : aGradient.EndIntensity = 100;
217 :
218 0 : size_t nColorCount = maGradientProps.maGradientStops.size();
219 0 : if( nColorCount > 1 )
220 : {
221 0 : aGradient.StartColor = maGradientProps.maGradientStops.begin()->second.getColor( rGraphicHelper, nPhClr );
222 0 : aGradient.EndColor = maGradientProps.maGradientStops.rbegin()->second.getColor( rGraphicHelper, nPhClr );
223 0 : if( maGradientProps.maGradientStops.rbegin()->second.hasTransparency() )
224 0 : nEndTrans = maGradientProps.maGradientStops.rbegin()->second.getTransparency()*255/100;
225 0 : if( maGradientProps.maGradientStops.begin()->second.hasTransparency() )
226 0 : nStartTrans = maGradientProps.maGradientStops.begin()->second.getTransparency()*255/100;
227 : }
228 :
229 : // Adjust for flips
230 0 : if ( bFlipH )
231 0 : nShapeRotation = 180*60000 - nShapeRotation;
232 0 : if ( bFlipV )
233 0 : nShapeRotation = -nShapeRotation;
234 :
235 : // "rotate with shape" not set, or set to false -> do not rotate
236 0 : if ( !maGradientProps.moRotateWithShape.get( false ) )
237 0 : nShapeRotation = 0;
238 :
239 0 : sal_Int32 nDmlAngle = 0;
240 0 : if( maGradientProps.moGradientPath.has() )
241 : {
242 0 : aGradient.Style = (maGradientProps.moGradientPath.get() == XML_circle) ? awt::GradientStyle_ELLIPTICAL : awt::GradientStyle_RECT;
243 : // position of gradient center (limited to [30%;70%], otherwise gradient is too hidden)
244 0 : IntegerRectangle2D aFillToRect = maGradientProps.moFillToRect.get( IntegerRectangle2D( 0, 0, MAX_PERCENT, MAX_PERCENT ) );
245 0 : sal_Int32 nCenterX = (MAX_PERCENT + aFillToRect.X1 - aFillToRect.X2) / 2;
246 0 : aGradient.XOffset = getLimitedValue< sal_Int16, sal_Int32 >( nCenterX / PER_PERCENT, 30, 70 );
247 0 : sal_Int32 nCenterY = (MAX_PERCENT + aFillToRect.Y1 - aFillToRect.Y2) / 2;
248 0 : aGradient.YOffset = getLimitedValue< sal_Int16, sal_Int32 >( nCenterY / PER_PERCENT, 30, 70 );
249 0 : ::std::swap( aGradient.StartColor, aGradient.EndColor );
250 0 : ::std::swap( nStartTrans, nEndTrans );
251 0 : nDmlAngle = nShapeRotation;
252 : }
253 : else
254 : {
255 : /* Try to detect a VML axial gradient. This type of
256 : gradient is simulated by a 3-point linear gradient.
257 : Even if its a multi-color linear gradient, its probably better to assume
258 : axial gradient, when there are 3 or more points.
259 : */
260 0 : bool bAxial = (nColorCount >= 3);
261 0 : aGradient.Style = bAxial ? awt::GradientStyle_AXIAL : awt::GradientStyle_LINEAR;
262 0 : nDmlAngle = maGradientProps.moShadeAngle.get( 0 ) - nShapeRotation;
263 : // convert DrawingML angle (in 1/60000 degrees) to API angle (in 1/10 degrees)
264 0 : aGradient.Angle = static_cast< sal_Int16 >( (4500 - (nDmlAngle / (PER_DEGREE / 10))) % 3600 );
265 0 : if( bAxial )
266 : {
267 0 : GradientFillProperties::GradientStopMap::const_iterator aIt = maGradientProps.maGradientStops.begin();
268 : // Try to find the axial median
269 0 : for(size_t i=0;i<nColorCount;i+=3)
270 0 : ++aIt;
271 : // API StartColor is inner color in axial gradient
272 : // aIt->second.hasColor() kind would be better than Color != API_RGB_WHITE
273 0 : if( aGradient.StartColor == aGradient.EndColor &&
274 0 : ( !aIt->second.hasTransparency() || aIt->second.getColor( rGraphicHelper, nPhClr ) != API_RGB_WHITE ) )
275 : {
276 0 : aGradient.StartColor = aIt->second.getColor( rGraphicHelper, nPhClr );
277 : }
278 :
279 0 : if( nStartTrans == nEndTrans && aIt->second.hasTransparency() )
280 0 : nStartTrans = aIt->second.getTransparency()*255/100;
281 : }
282 : }
283 :
284 : // push gradient or named gradient to property map
285 0 : if( rPropMap.setProperty( SHAPEPROP_FillGradient, aGradient ) )
286 0 : eFillStyle = FillStyle_GRADIENT;
287 :
288 : // push gradient transparency to property map
289 0 : if( nStartTrans != 0 || nEndTrans != 0 )
290 : {
291 0 : awt::Gradient aGrad(aGradient);
292 0 : uno::Any aVal;
293 0 : aGrad.EndColor = (sal_Int32)( nEndTrans | nEndTrans << 8 | nEndTrans << 16 );
294 0 : aGrad.StartColor = (sal_Int32)( nStartTrans | nStartTrans << 8 | nStartTrans << 16 );
295 0 : aVal <<= aGrad;
296 0 : rPropMap.setProperty( SHAPEPROP_GradientTransparency, aGrad );
297 : }
298 :
299 : }
300 0 : break;
301 :
302 : case XML_blipFill:
303 : // do not start complex graphic transformation if property is not supported...
304 0 : if( maBlipProps.mxGraphic.is() && rPropMap.supportsProperty( SHAPEPROP_FillBitmapUrl ) )
305 : {
306 : // TODO: "rotate with shape" is not possible with our current core
307 :
308 0 : OUString aGraphicUrl = rGraphicHelper.createGraphicObject( maBlipProps.mxGraphic );
309 : // push bitmap or named bitmap to property map
310 0 : if( !aGraphicUrl.isEmpty() && rPropMap.setProperty( SHAPEPROP_FillBitmapUrl, aGraphicUrl ) )
311 0 : eFillStyle = FillStyle_BITMAP;
312 :
313 : // set other bitmap properties, if bitmap has been inserted into the map
314 0 : if( eFillStyle == FillStyle_BITMAP )
315 : {
316 : // bitmap mode (single, repeat, stretch)
317 0 : BitmapMode eBitmapMode = lclGetBitmapMode( maBlipProps.moBitmapMode.get( XML_TOKEN_INVALID ) );
318 0 : rPropMap.setProperty( SHAPEPROP_FillBitmapMode, eBitmapMode );
319 :
320 : // additional settings for repeated bitmap
321 0 : if( eBitmapMode == BitmapMode_REPEAT )
322 : {
323 : // anchor position inside bitmap
324 0 : RectanglePoint eRectPoint = lclGetRectanglePoint( maBlipProps.moTileAlign.get( XML_tl ) );
325 0 : rPropMap.setProperty( SHAPEPROP_FillBitmapRectanglePoint, eRectPoint );
326 :
327 0 : awt::Size aOriginalSize = lclGetOriginalSize( rGraphicHelper, maBlipProps.mxGraphic );
328 0 : if( (aOriginalSize.Width > 0) && (aOriginalSize.Height > 0) )
329 : {
330 : // size of one bitmap tile (given as 1/1000 percent of bitmap size), convert to 1/100 mm
331 0 : double fScaleX = maBlipProps.moTileScaleX.get( MAX_PERCENT ) / static_cast< double >( MAX_PERCENT );
332 0 : sal_Int32 nFillBmpSizeX = getLimitedValue< sal_Int32, double >( aOriginalSize.Width * fScaleX, 1, SAL_MAX_INT32 );
333 0 : rPropMap.setProperty( SHAPEPROP_FillBitmapSizeX, nFillBmpSizeX );
334 0 : double fScaleY = maBlipProps.moTileScaleY.get( MAX_PERCENT ) / static_cast< double >( MAX_PERCENT );
335 0 : sal_Int32 nFillBmpSizeY = getLimitedValue< sal_Int32, double >( aOriginalSize.Height * fScaleY, 1, SAL_MAX_INT32 );
336 0 : rPropMap.setProperty( SHAPEPROP_FillBitmapSizeY, nFillBmpSizeY );
337 :
338 : // offset of the first bitmap tile (given as EMUs), convert to percent
339 0 : sal_Int16 nTileOffsetX = getDoubleIntervalValue< sal_Int16 >( maBlipProps.moTileOffsetX.get( 0 ) / 3.6 / aOriginalSize.Width, 0, 100 );
340 0 : rPropMap.setProperty( SHAPEPROP_FillBitmapOffsetX, nTileOffsetX );
341 0 : sal_Int16 nTileOffsetY = getDoubleIntervalValue< sal_Int16 >( maBlipProps.moTileOffsetY.get( 0 ) / 3.6 / aOriginalSize.Height, 0, 100 );
342 0 : rPropMap.setProperty( SHAPEPROP_FillBitmapOffsetY, nTileOffsetY );
343 : }
344 : }
345 0 : }
346 : }
347 0 : break;
348 :
349 : case XML_pattFill:
350 : {
351 : // todo
352 0 : Color aColor = getBestSolidColor();
353 0 : if( aColor.isUsed() )
354 : {
355 0 : rPropMap.setProperty( SHAPEPROP_FillColor, aColor.getColor( rGraphicHelper, nPhClr ) );
356 0 : if( aColor.hasTransparency() )
357 0 : rPropMap.setProperty( SHAPEPROP_FillTransparency, aColor.getTransparency() );
358 0 : eFillStyle = FillStyle_SOLID;
359 0 : }
360 : }
361 0 : break;
362 :
363 : case XML_grpFill:
364 : // todo
365 0 : eFillStyle = FillStyle_NONE;
366 0 : break;
367 : }
368 :
369 : // set final fill style property
370 63 : rPropMap.setProperty( SHAPEPROP_FillStyle, eFillStyle );
371 : }
372 63 : }
373 :
374 : // ============================================================================
375 :
376 14 : void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr ) const
377 : {
378 14 : if( maBlipProps.mxGraphic.is() )
379 : {
380 : // created transformed graphic
381 14 : Reference< XGraphic > xGraphic = maBlipProps.mxGraphic;
382 14 : if( maBlipProps.maColorChangeFrom.isUsed() && maBlipProps.maColorChangeTo.isUsed() )
383 : {
384 0 : sal_Int32 nFromColor = maBlipProps.maColorChangeFrom.getColor( rGraphicHelper, nPhClr );
385 0 : sal_Int32 nToColor = maBlipProps.maColorChangeTo.getColor( rGraphicHelper, nPhClr );
386 0 : if ( (nFromColor != nToColor) || maBlipProps.maColorChangeTo.hasTransparency() ) try
387 : {
388 0 : sal_Int16 nToTransparence = maBlipProps.maColorChangeTo.getTransparency();
389 0 : sal_Int8 nToAlpha = static_cast< sal_Int8 >( (100 - nToTransparence) / 39.062 ); // ?!? correct ?!?
390 0 : Reference< XGraphicTransformer > xTransformer( maBlipProps.mxGraphic, UNO_QUERY_THROW );
391 0 : xGraphic = xTransformer->colorChange( maBlipProps.mxGraphic, nFromColor, 9, nToColor, nToAlpha );
392 : }
393 0 : catch( Exception& )
394 : {
395 : }
396 : }
397 :
398 14 : OUString aGraphicUrl = rGraphicHelper.createGraphicObject( xGraphic );
399 14 : if( !aGraphicUrl.isEmpty() )
400 14 : rPropMap[ PROP_GraphicURL ] <<= aGraphicUrl;
401 :
402 : // cropping
403 14 : if ( maBlipProps.moClipRect.has() )
404 : {
405 5 : geometry::IntegerRectangle2D oClipRect( maBlipProps.moClipRect.get() );
406 5 : awt::Size aOriginalSize( rGraphicHelper.getOriginalSize( xGraphic ) );
407 5 : if ( aOriginalSize.Width && aOriginalSize.Height )
408 : {
409 5 : text::GraphicCrop aGraphCrop( 0, 0, 0, 0 );
410 5 : if ( oClipRect.X1 )
411 0 : aGraphCrop.Left = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Width ) * oClipRect.X1 ) / 100000 );
412 5 : if ( oClipRect.Y1 )
413 0 : aGraphCrop.Top = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Height ) * oClipRect.Y1 ) / 100000 );
414 5 : if ( oClipRect.X2 )
415 0 : aGraphCrop.Right = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Width ) * oClipRect.X2 ) / 100000 );
416 5 : if ( oClipRect.Y2 )
417 0 : aGraphCrop.Bottom = static_cast< sal_Int32 >( ( static_cast< double >( aOriginalSize.Height ) * oClipRect.Y2 ) / 100000 );
418 5 : rPropMap[ PROP_GraphicCrop ] <<= aGraphCrop;
419 : }
420 14 : }
421 : }
422 :
423 : // color effect
424 14 : ColorMode eColorMode = ColorMode_STANDARD;
425 14 : switch( maBlipProps.moColorEffect.get( XML_TOKEN_INVALID ) )
426 : {
427 0 : case XML_biLevel: eColorMode = ColorMode_MONO; break;
428 0 : case XML_grayscl: eColorMode = ColorMode_GREYS; break;
429 : }
430 14 : rPropMap[ PROP_GraphicColorMode ] <<= eColorMode;
431 :
432 : // brightness and contrast
433 14 : sal_Int16 nBrightness = getLimitedValue< sal_Int16, sal_Int32 >( maBlipProps.moBrightness.get( 0 ) / PER_PERCENT, -100, 100 );
434 14 : if( nBrightness != 0 )
435 0 : rPropMap[ PROP_AdjustLuminance ] <<= nBrightness;
436 14 : sal_Int16 nContrast = getLimitedValue< sal_Int16, sal_Int32 >( maBlipProps.moContrast.get( 0 ) / PER_PERCENT, -100, 100 );
437 14 : if( nContrast != 0 )
438 0 : rPropMap[ PROP_AdjustContrast ] <<= nContrast;
439 :
440 : // Media content
441 14 : if( !maAudio.msEmbed.isEmpty() )
442 0 : rPropMap[ PROP_MediaURL ] <<= maAudio.msEmbed;
443 14 : }
444 :
445 : // ============================================================================
446 :
447 : } // namespace drawingml
448 51 : } // namespace oox
449 :
450 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|