[Libreoffice-commits] core.git: 4 commits - chart2/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Thu Mar 6 07:37:05 PST 2014


 chart2/source/view/inc/DummyXShape.hxx         |   14 ------
 chart2/source/view/main/DummyXShape.cxx        |   15 ++-----
 chart2/source/view/main/OpenGLRender.cxx       |   14 ++----
 chart2/source/view/main/OpenglShapeFactory.cxx |   51 ++++++++++++++++++-------
 4 files changed, 50 insertions(+), 44 deletions(-)

New commits:
commit 95d70e56c7ed7f1308cee97290c8cf262cd015b2
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Mar 6 15:55:36 2014 +0100

    initial work on rotation for text shapes
    
    Change-Id: I5752884efd32711f9ac2257a9223eb79c04e8335

diff --git a/chart2/source/view/inc/DummyXShape.hxx b/chart2/source/view/inc/DummyXShape.hxx
index 4769a3a..1d2eba6 100644
--- a/chart2/source/view/inc/DummyXShape.hxx
+++ b/chart2/source/view/inc/DummyXShape.hxx
@@ -333,7 +333,7 @@ class DummyText : public DummyXShape
 public:
     DummyText(const OUString& rText, const tNameSequence& rNames,
             const tAnySequence& rValues, const uno::Any& rTrans, com::sun::star::uno::Reference<
-            com::sun::star::drawing::XShapes > xTarget);
+            com::sun::star::drawing::XShapes > xTarget, double nRotation);
 
     virtual void render() SAL_OVERRIDE;
 
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index c359595..9f8db07 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -784,9 +784,10 @@ private:
 }
 
 DummyText::DummyText(const OUString& rText, const tNameSequence& rNames,
-        const tAnySequence& rValues, const uno::Any& rTrans, uno::Reference< drawing::XShapes > xTarget ):
+        const tAnySequence& rValues, const uno::Any& rTrans, uno::Reference< drawing::XShapes > xTarget, double nRotation ):
     maText(rText),
-    maTrans(rTrans)
+    maTrans(rTrans),
+    mnRotation(nRotation)
 {
     setProperties(rNames, rValues, maProperties);
 
@@ -857,8 +858,8 @@ void DummyText::render()
     {
         aTransformation = maTrans.get<drawing::HomogenMatrix3>();
     }
-    pChart->m_GLRender.CreateTextTexture(maBitmap, maPosition, maSize, 0,
-            aTransformation);
+    pChart->m_GLRender.CreateTextTexture(maBitmap, maPosition, maSize,
+            mnRotation, aTransformation);
     pChart->m_GLRender.RenderTextShape();
 }
 
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 24277b7..dff7ff9 100755
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -1318,12 +1318,6 @@ int OpenGLRender::CreateTextTexture(const BitmapEx& rBitmapEx, const awt::Point&
     aTextInfo.bmpWidth = bmpWidth;
     aTextInfo.bmpHeight = bmpHeight;
 
-    //if has ratotion, we must re caculate the central pos
-    if (!rtl::math::approxEqual(0, rotation))
-    {
-        // handle rotation
-    }
-
     CHECK_GL_ERROR();
     glGenTextures(1, &aTextInfo.texture);
     CHECK_GL_ERROR();
@@ -1353,7 +1347,11 @@ int OpenGLRender::RenderTextShape()
     {
         TextInfo &textInfo = m_TextInfoList.front();
         PosVecf3 trans = { (float)-textInfo.bmpWidth/2.0f, (float)-textInfo.bmpHeight/2.0f, 0};
-        PosVecf3 angle = {0.0f, 0.0f, float(textInfo.rotation)};
+        if(0.0 != textInfo.rotation)
+        {
+            SAL_WARN("chart2.opengl", "rotation: " << textInfo.rotation);
+        }
+        PosVecf3 angle = {0.0f, float(textInfo.rotation), float(textInfo.rotation)};
         PosVecf3 scale = {1.0, 1.0, 1.0f};
         MoveModelf(trans, angle, scale);
         m_MVP = m_Projection * m_View * m_Model;
diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx
index 4843fe3..93e4084 100644
--- a/chart2/source/view/main/OpenglShapeFactory.cxx
+++ b/chart2/source/view/main/OpenglShapeFactory.cxx
@@ -403,7 +403,7 @@ uno::Reference< drawing::XShape >
                     , const uno::Any& rATransformation )
 {
     dummy::DummyText* pText = new dummy::DummyText( rText, rPropNames, rPropValues,
-            rATransformation, xTarget );
+            rATransformation, xTarget, 0 );
     xTarget->add(pText);
     return pText;
 }
@@ -451,7 +451,7 @@ uno::Reference< drawing::XShape >
     aM.translate( nXPos, nYPos );
 
     dummy::DummyText* pText = new dummy::DummyText(aString, aPropNames, aPropValues,
-            uno::makeAny(B2DHomMatrixToHomogenMatrix3(aM)), xTarget);
+            uno::makeAny(B2DHomMatrixToHomogenMatrix3(aM)), xTarget, nRotation);
     pText->setName(rName);
     xTarget->add(pText);
     return pText;
commit ceb284f51fc9b26db2cdda1e01e21824317ffc50
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Mar 6 15:50:47 2014 +0100

    fix OpenGL error when line width is 0
    
    Change-Id: Ifc70c632b1f26f77c253edb17cd0b29715389614

diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 55ce9d5..24277b7 100755
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -675,7 +675,7 @@ OpenGLRender::OpenGLRender(uno::Reference< drawing::XShape > xTarget)
     , m_RboID(0)
     , m_iWidth(0)
     , m_iHeight(0)
-    , m_fLineWidth(0)
+    , m_fLineWidth(0.001f)
     , mxRenderTarget(xTarget)
     , mbArbMultisampleSupported(false)
 #if defined( _WIN32 )
commit 82299c334037ecaa1eab1ebf799af2ac028f8ec2
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Mar 6 15:49:08 2014 +0100

    remove the formatted string dummy
    
    Change-Id: I7e73f7362063ef0a3a56765635412746acfee166

diff --git a/chart2/source/view/inc/DummyXShape.hxx b/chart2/source/view/inc/DummyXShape.hxx
index 2a07094..4769a3a 100644
--- a/chart2/source/view/inc/DummyXShape.hxx
+++ b/chart2/source/view/inc/DummyXShape.hxx
@@ -347,17 +347,7 @@ private:
     OUString maText;
     uno::Any maTrans;
     BitmapEx maBitmap;
-};
-
-class DummyFormattedText : public DummyXShape
-{
-public:
-    DummyFormattedText(uno::Sequence< uno::Reference<
-        chart2::XFormattedString > >& rFormattedString);
-
-private:
-    com::sun::star::uno::Sequence< com::sun::star::uno::Reference<
-        chart2::XFormattedString > > maFormattedString;
+    double mnRotation;
 };
 
 class DummyXShapes : public DummyXShape, public com::sun::star::drawing::XShapes
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 493eb83..c359595 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -900,12 +900,6 @@ void DummyText::setTransformatAsProperty(const drawing::HomogenMatrix3& rMatrix)
     setPropertyValue("Transformation", aNewTrans);
 }
 
-DummyFormattedText::DummyFormattedText(uno::Sequence< uno::Reference<
-        chart2::XFormattedString > >& rFormattedString):
-    maFormattedString(rFormattedString)
-{
-}
-
 DummyGroup3D::DummyGroup3D(const OUString& rName)
 {
     setName(rName);
commit 08e205ac6fe0aa1a77c17cacf8551fbfff264369
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Mar 6 15:13:49 2014 +0100

    finally fix title rendering
    
    We now reuse the normal text rendering.
    
    Change-Id: Iabbe94c3f2473be1e61791b8493f0d8c4b894e28

diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx
index 9fc4241..4843fe3 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;


More information about the Libreoffice-commits mailing list