diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-03-06 15:13:49 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-03-06 16:35:33 +0100 |
commit | 08e205ac6fe0aa1a77c17cacf8551fbfff264369 (patch) | |
tree | 45f4d8cbb80e0d2908f56fe05167a556688805d8 /chart2/source | |
parent | 18ea4fea4f4843c64e05827443f76122c1aed90e (diff) |
finally fix title rendering
We now reuse the normal text rendering.
Change-Id: Iabbe94c3f2473be1e61791b8493f0d8c4b894e28
Diffstat (limited to 'chart2/source')
-rw-r--r-- | chart2/source/view/main/OpenglShapeFactory.cxx | 49 |
1 files changed, 36 insertions, 13 deletions
diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx index 9fc424152baa..4843fe3da66d 100644 --- a/chart2/source/view/main/OpenglShapeFactory.cxx +++ b/chart2/source/view/main/OpenglShapeFactory.cxx @@ -411,24 +411,47 @@ uno::Reference< drawing::XShape > uno::Reference< drawing::XShape > OpenglShapeFactory::createText( const uno::Reference< drawing::XShapes >& xTarget, - const awt::Size& rSize, const awt::Point& rPos, + const awt::Size& , const awt::Point& rPos, uno::Sequence< uno::Reference< chart2::XFormattedString > >& rFormattedString, const uno::Reference< beans::XPropertySet > & xTextProperties, - double, const OUString& rName) + double nRotation, const OUString& rName) { - dummy::DummyFormattedText* pText = new dummy::DummyFormattedText( rFormattedString ); - uno::Reference< drawing::XShape > xShape(pText); - uno::Reference< beans::XPropertySet > xTargetProps(xShape, uno::UNO_QUERY_THROW); - awt::Size aOldRefSize; - bool bHasRefPageSize = - ( xTextProperties->getPropertyValue( "ReferencePageSize") >>= aOldRefSize ); - // adapt font size according to page size - if( bHasRefPageSize ) + tPropertyNameValueMap aValueMap; + //fill line-, fill- and paragraph-properties into the ValueMap { - RelativeSizeHelper::adaptFontSizes( xTargetProps, aOldRefSize, rSize ); + tMakePropertyNameMap aNameMap = PropertyMapper::getPropertyNameMapForParagraphProperties(); + aNameMap( PropertyMapper::getPropertyNameMapForFillAndLineProperties() ); + + PropertyMapper::getValueMap( aValueMap, aNameMap, xTextProperties ); + } + + //fill some more shape properties into the ValueMap + { + drawing::TextHorizontalAdjust eHorizontalAdjust = drawing::TextHorizontalAdjust_CENTER; + drawing::TextVerticalAdjust eVerticalAdjust = drawing::TextVerticalAdjust_CENTER; + + aValueMap.insert( tPropertyNameValueMap::value_type( "TextHorizontalAdjust", uno::makeAny(eHorizontalAdjust) ) ); // drawing::TextHorizontalAdjust + aValueMap.insert( tPropertyNameValueMap::value_type( "TextVerticalAdjust", uno::makeAny(eVerticalAdjust) ) ); //drawing::TextVerticalAdjust + aValueMap.insert( tPropertyNameValueMap::value_type( "TextAutoGrowHeight", uno::makeAny(sal_True) ) ); // sal_Bool + aValueMap.insert( tPropertyNameValueMap::value_type( "TextAutoGrowWidth", uno::makeAny(sal_True) ) ); // sal_Bool + } - pText->setPosition(rPos); - pText->setSize(awt::Size(0,0)); + + //set global title properties + tNameSequence aPropNames; + tAnySequence aPropValues; + PropertyMapper::getMultiPropertyListsFromValueMap( aPropNames, aPropValues, aValueMap ); + + OUString aString = rFormattedString[0]->getString(); + + sal_Int32 nXPos = rPos.X; + sal_Int32 nYPos = rPos.Y; + ::basegfx::B2DHomMatrix aM; + aM.rotate( -nRotation*F_PI/180.0 );//#i78696#->#i80521# + aM.translate( nXPos, nYPos ); + + dummy::DummyText* pText = new dummy::DummyText(aString, aPropNames, aPropValues, + uno::makeAny(B2DHomMatrixToHomogenMatrix3(aM)), xTarget); pText->setName(rName); xTarget->add(pText); return pText; |