summaryrefslogtreecommitdiff
path: root/oox/source/vml/vmlshape.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source/vml/vmlshape.cxx')
-rw-r--r--oox/source/vml/vmlshape.cxx69
1 files changed, 1 insertions, 68 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 6e792d93157e..8dfadd766f19 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -1143,79 +1143,12 @@ CustomShape::CustomShape( Drawing& rDrawing ) :
{
}
-static OUString lcl_getFontFamily( const oox::OptValue<OUString>& rStyle )
-{
- OUString sFont = "";
-
- if( rStyle.has() )
- {
- OUString aStyle = rStyle.get( OUString() );
-
- sal_Int32 nIndex = 0;
- while( nIndex >= 0 )
- {
- OUString aName;
- if( ConversionHelper::separatePair( aName, sFont, aStyle.getToken( 0, ';', nIndex ), ':' ) )
- {
- if( aName == "font-family" )
- {
- // remove " (first, and last character)
- if( sFont.getLength() > 2 )
- sFont = sFont.copy( 1, sFont.getLength() - 2 );
- }
- }
- }
- }
-
- return sFont;
-}
-
-/// modifies rShapeRect's height and returns difference
-sal_Int32 lcl_correctWatermarkRect( awt::Rectangle& rShapeRect, const OUString& sFont, const OUString& sText )
-{
- sal_Int32 nPaddingY = 0;
- double fRatio = 0;
- VclPtr<VirtualDevice> pDevice = VclPtr<VirtualDevice>::Create();
- vcl::Font aFont = pDevice->GetFont();
- aFont.SetFamilyName( sFont );
- aFont.SetFontSize( Size( 0, 96 ) );
- pDevice->SetFont( aFont );
-
- auto nTextWidth = pDevice->GetTextWidth( sText );
- if( nTextWidth )
- {
- fRatio = pDevice->GetTextHeight();
- fRatio /= nTextWidth;
-
- sal_Int32 nNewHeight = fRatio * rShapeRect.Width;
- nPaddingY = rShapeRect.Height - nNewHeight;
- rShapeRect.Height = nNewHeight;
- }
-
- return nPaddingY;
-}
-
Reference< XShape > CustomShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const
{
- awt::Rectangle aShapeRect( rShapeRect );
-
- // Add padding for Watermark like Word does
- sal_Int32 nPaddingY = 0;
- if( getShapeName().match( "PowerPlusWaterMarkObject" ) && maTypeModel.maTextpathModel.moString.has() )
- {
- OUString sText = maTypeModel.maTextpathModel.moString.get();
- OUString sFont = lcl_getFontFamily( maTypeModel.maTextpathModel.moStyle );
- nPaddingY = lcl_correctWatermarkRect( aShapeRect, sFont, sText );
- }
-
// try to create a custom shape
- Reference< XShape > xShape = SimpleShape::implConvertAndInsert( rxShapes, aShapeRect );
+ Reference< XShape > xShape = SimpleShape::implConvertAndInsert( rxShapes, rShapeRect );
if( xShape.is() ) try
{
- // Remember padding for Watermark
- if( nPaddingY )
- PropertySet( xShape ).setAnyProperty( PROP_TextUpperDistance, makeAny( nPaddingY ) );
-
// create the custom shape geometry
Reference< XEnhancedCustomShapeDefaulter > xDefaulter( xShape, UNO_QUERY_THROW );
xDefaulter->createCustomShapeDefaults( OUString::number( getShapeType() ) );