[Libreoffice-commits] core.git: Branch 'feature/chart-opengl' - 7 commits - chart2/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Fri Mar 7 02:46:09 PST 2014


 chart2/source/view/inc/DummyXShape.hxx         |   14 ------
 chart2/source/view/main/DummyXShape.cxx        |   54 ++++++++++---------------
 chart2/source/view/main/OpenGLRender.cxx       |   33 ++++++---------
 chart2/source/view/main/OpenGLRender.hxx       |    4 -
 chart2/source/view/main/OpenglShapeFactory.cxx |   51 +++++++++++++++++------
 5 files changed, 77 insertions(+), 79 deletions(-)

New commits:
commit ba417e3599bc1ff1de8482ff6b081e9ca5b6956e
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Fri Mar 7 11:37:30 2014 +0100

    fix the rotation matrix for text shapes
    
    Change-Id: I78bf93da4b06f694621e92832773a1abd01256d7

diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 9a5e14e..5a154d0 100755
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -1302,24 +1302,23 @@ int OpenGLRender::CreateTextTexture(const BitmapEx& rBitmapEx, const awt::Point&
 
     TextInfo aTextInfo;
     aTextInfo.rotation = -(double)rotation / 360.0 * 2* GL_PI;
-    aTextInfo.vertex[0] = rTrans.Line1.Column3 / OPENGL_SCALE_VALUE;
-    aTextInfo.vertex[1] = rTrans.Line2.Column3 / OPENGL_SCALE_VALUE;
+    aTextInfo.vertex[0] = -aSize.Width / 2 / OPENGL_SCALE_VALUE;
+    aTextInfo.vertex[1] = -aSize.Height / 2 / OPENGL_SCALE_VALUE;
     aTextInfo.vertex[2] = m_fZStep;
 
-    aTextInfo.vertex[3] = (rTrans.Line1.Column3 + aSize.Width ) / OPENGL_SCALE_VALUE ;
-    aTextInfo.vertex[4] = rTrans.Line2.Column3 / OPENGL_SCALE_VALUE;
+    aTextInfo.vertex[3] = aSize.Width / 2 / OPENGL_SCALE_VALUE ;
+    aTextInfo.vertex[4] = -aSize.Height / 2 / OPENGL_SCALE_VALUE;
     aTextInfo.vertex[5] = m_fZStep;
 
-    aTextInfo.vertex[6] = (rTrans.Line1.Column3 + aSize.Width) / OPENGL_SCALE_VALUE;
-    aTextInfo.vertex[7] = (rTrans.Line2.Column3 + aSize.Height) / OPENGL_SCALE_VALUE;
+    aTextInfo.vertex[6] = aSize.Width / 2 / OPENGL_SCALE_VALUE;
+    aTextInfo.vertex[7] = aSize.Height / 2 / OPENGL_SCALE_VALUE;
     aTextInfo.vertex[8] = m_fZStep;
 
-    aTextInfo.vertex[9] = rTrans.Line1.Column3 / OPENGL_SCALE_VALUE;
-    aTextInfo.vertex[10] = (rTrans.Line2.Column3 + aSize.Height) / OPENGL_SCALE_VALUE;
+    aTextInfo.vertex[9] = -aSize.Width / 2 / OPENGL_SCALE_VALUE;
+    aTextInfo.vertex[10] = aSize.Height / 2 / OPENGL_SCALE_VALUE;
     aTextInfo.vertex[11] = m_fZStep;
-
-    aTextInfo.bmpWidth = bmpWidth;
-    aTextInfo.bmpHeight = bmpHeight;
+    aTextInfo.nDx = (rTrans.Line1.Column3 + aSize.Width / 2 ) / OPENGL_SCALE_VALUE - bmpWidth/2;
+    aTextInfo.nDy = (rTrans.Line2.Column3 + aSize.Height / 2 ) / OPENGL_SCALE_VALUE - bmpHeight/2;
 
     CHECK_GL_ERROR();
     glGenTextures(1, &aTextInfo.texture);
@@ -1349,11 +1348,7 @@ int OpenGLRender::RenderTextShape()
     for (size_t i = 0; i < listNum; i++)
     {
         TextInfo &textInfo = m_TextInfoList.front();
-        PosVecf3 trans = { (float)-textInfo.bmpWidth/2.0f, (float)-textInfo.bmpHeight/2.0f, 0};
-        if(0.0 != textInfo.rotation)
-        {
-            SAL_WARN("chart2.opengl", "rotation: " << textInfo.rotation);
-        }
+        PosVecf3 trans = { textInfo.nDx, textInfo.nDy, 0};
         PosVecf3 angle = {0.0f, 0.0f, float(textInfo.rotation)};
         PosVecf3 scale = {1.0, 1.0, 1.0f};
         MoveModelf(trans, angle, scale);
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 2610804..7e3cb97 100755
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -81,8 +81,8 @@ struct TextInfo
     GLuint texture;
     double rotation;
     float vertex[12];
-    long bmpWidth;
-    long bmpHeight;
+    float nDx;
+    float nDy;
 };
 
 typedef std::vector<GLfloat> Area2DPointList;
commit c84b8ec61403f3735ba869a4dac1f7a4e31ca44b
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Mar 6 16:59:38 2014 +0100

    fix the translation angle calculation
    
    Change-Id: If4b392f5f8dc4e67d00c6000dcf48a6c1f30db36

diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 73b1df7..9a5e14e 100755
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -1301,7 +1301,7 @@ int OpenGLRender::CreateTextTexture(const BitmapEx& rBitmapEx, const awt::Point&
     }
 
     TextInfo aTextInfo;
-    aTextInfo.rotation = -(double)rotation * GL_PI / 18000.0f;
+    aTextInfo.rotation = -(double)rotation / 360.0 * 2* GL_PI;
     aTextInfo.vertex[0] = rTrans.Line1.Column3 / OPENGL_SCALE_VALUE;
     aTextInfo.vertex[1] = rTrans.Line2.Column3 / OPENGL_SCALE_VALUE;
     aTextInfo.vertex[2] = m_fZStep;
@@ -1354,7 +1354,7 @@ int OpenGLRender::RenderTextShape()
         {
             SAL_WARN("chart2.opengl", "rotation: " << textInfo.rotation);
         }
-        PosVecf3 angle = {0.0f, float(textInfo.rotation), float(textInfo.rotation)};
+        PosVecf3 angle = {0.0f, 0.0f, float(textInfo.rotation)};
         PosVecf3 scale = {1.0, 1.0, 1.0f};
         MoveModelf(trans, angle, scale);
         m_MVP = m_Projection * m_View * m_Model;
commit 99f20bd9cf79e2f20b84bbcb3fb2a91d2ff2ae39
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Mar 6 16:58:48 2014 +0100

    make many SAL_WARN in chart2.opengl simple SAL_INFO
    
    Conflicts:
    	chart2/source/view/main/DummyXShape.cxx
    
    Change-Id: I786361b2adaec2c4c156162ff8c3f6b743275961

diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 43332c1..2d13f68 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -52,7 +52,7 @@ struct PrintProperties
 #if ENABLE_DEBUG_PROPERTIES
     void operator()(const std::pair<OUString, uno::Any>& rProp)
     {
-        SAL_WARN("chart2.opengl", "Property: " << rProp.first);
+        SAL_INFO("chart2.opengl.properties", "Property: " << rProp.first);
     }
 #else
     void operator()(const std::pair<OUString, uno::Any>&)
@@ -125,18 +125,18 @@ void DummyXShape::setPropertyValue( const OUString& rName, const uno::Any& rValu
             lang::IllegalArgumentException, lang::WrappedTargetException,
             uno::RuntimeException)
 {
-    SAL_WARN("chart2", "DummyXShape::setProperty: " << rName << " " << "Any");
+    SAL_INFO("chart2", "DummyXShape::setProperty: " << rName << " " << "Any");
     maProperties[rName] = rValue;
     if(rName == "Transformation")
     {
-        SAL_WARN("chart2.opengl", "Transformation");
+        SAL_INFO("chart2.opengl", "Transformation");
     }
 }
 
 uno::Any DummyXShape::getPropertyValue( const OUString& rName )
     throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
 {
-    SAL_WARN("chart2.opengl", "DummyXShape::getPropertyValue: " << rName);
+    SAL_INFO("chart2.opengl", "DummyXShape::getPropertyValue: " << rName);
     std::map<OUString, uno::Any>::iterator itr = maProperties.find(rName);
     if(itr != maProperties.end())
         return itr->second;
@@ -332,7 +332,7 @@ DummyPieSegment2D::DummyPieSegment2D(double fUnitCircleStartAngleDegree, double
 
 void DummyPieSegment2D::render()
 {
-    SAL_WARN("chart2.opengl", "render DummyPieSegment2D");
+    SAL_INFO("chart2.opengl", "render DummyPieSegment2D");
     DummyChart* pChart = getRootShape();
 
     while(mfUnitCircleWidthAngleDegree>360)
@@ -389,7 +389,7 @@ DummyArea2D::DummyArea2D(const drawing::PointSequenceSequence& rShape):
 
 void DummyArea2D::render()
 {
-    SAL_WARN("chart2.opengl", "render DummyArea2D");
+    SAL_INFO("chart2.opengl", "render DummyArea2D");
     DummyChart* pChart = getRootShape();
     sal_Int32 nPointssCount = maShapes.getLength();
     for(sal_Int32 i = 0; i < nPointssCount; i++)
@@ -441,7 +441,7 @@ DummyCircle::DummyCircle(const awt::Point& rPos, const awt::Size& rSize)
 
 void DummyCircle::render()
 {
-    SAL_WARN("chart2.opengl", "render DummyCircle");
+    SAL_INFO("chart2.opengl", "render DummyCircle");
     debugProperties(maProperties);
     DummyChart* pChart = getRootShape();
 
@@ -520,7 +520,7 @@ DummyLine2D::DummyLine2D(const awt::Size& rSize, const awt::Point& rPosition)
 
 void DummyLine2D::render()
 {
-    SAL_WARN("chart2.opengl", "rendering line 2D");
+    SAL_INFO("chart2.opengl", "rendering line 2D");
     debugProperties(maProperties);
     DummyChart* pChart = getRootShape();
 
@@ -570,7 +570,7 @@ void DummyLine2D::render()
         sal_Int32 nWidth = cow.get<sal_Int32>();
         pChart->m_GLRender.SetLine2DWidth(nWidth);
 
-        SAL_WARN("chart2.opengl", "width = " << nWidth);
+        SAL_INFO("chart2.opengl", "width = " << nWidth);
     }
     else
         SAL_WARN("chart2.opengl", "no line width set");
@@ -610,7 +610,7 @@ DummyRectangle::DummyRectangle(const awt::Size& rSize, const awt::Point& rPoint,
 
 void DummyRectangle::render()
 {
-    SAL_WARN("chart2.opengl", "render DummyRectangle");
+    SAL_INFO("chart2.opengl", "render DummyRectangle");
     debugProperties(maProperties);
     DummyChart* pChart = getRootShape();
     std::map< OUString, uno::Any >::const_iterator itr = maProperties.find("Invisible");
@@ -777,7 +777,7 @@ DummyText::DummyText(const OUString& rText, const tNameSequence& rNames,
 
 void DummyText::render()
 {
-    SAL_WARN("chart2.opengl", "render DummyText");
+    SAL_INFO("chart2.opengl", "render DummyText");
     debugProperties(maProperties);
 
     DummyChart* pChart = getRootShape();
@@ -787,7 +787,7 @@ void DummyText::render()
         maProperties.find("Transformation");
     if(itr != maProperties.end())
     {
-        SAL_WARN("chart2.opengl", "found a transformation");
+        SAL_INFO("chart2.opengl", "found a transformation");
         if(itr->second.hasValue())
         {
             aTransformation = itr->second.get<drawing::HomogenMatrix3>();
@@ -807,7 +807,7 @@ void DummyText::setPropertyValue( const OUString& rName, const uno::Any& rValue)
             lang::IllegalArgumentException, lang::WrappedTargetException,
             uno::RuntimeException)
 {
-    SAL_WARN("chart2.opengl", "property value set after image has been created");
+    SAL_INFO("chart2.opengl", "property value set after image has been created");
     DummyXShape::setPropertyValue(rName, rValue);
 }
 
@@ -1023,7 +1023,7 @@ uno::Any DummyXShapes::getByIndex(sal_Int32 nIndex)
 
 void DummyXShapes::render()
 {
-    SAL_WARN("chart2.opengl", "render DummyShapes");
+    SAL_INFO("chart2.opengl", "render DummyShapes");
     for(std::vector<DummyXShape*>::iterator itr = maShapes.begin(),
             itrEnd = maShapes.end(); itr != itrEnd; ++itr)
     {
@@ -1209,7 +1209,7 @@ debug_callback(GLenum source, GLenum type, GLuint id,
 
 bool DummyChart::initOpengl()
 {
-    SAL_WARN("chart2.opengl", "DummyChart::initOpengl----start");
+    SAL_INFO("chart2.opengl", "DummyChart::initOpengl----start");
     initWindow();
     mpWindow->setPosSizePixel(0,0,0,0);
     GLWin.Width = 0;
@@ -1353,8 +1353,7 @@ bool DummyChart::initOpengl()
     glMaterialfv(GL_FRONT,GL_DIFFUSE,materialDiffuse);
     glEnable(GL_LIGHT0);
     glEnable(GL_NORMALIZE);
-    SAL_WARN("chart2.opengl", "DummyChart::initOpengl----end");
-//    mpWindow->Show(1, 1);
+    SAL_INFO("chart2.opengl", "DummyChart::initOpengl----end");
     return true;
 }
 
@@ -1363,7 +1362,7 @@ DummyChart::DummyChart(uno::Reference< drawing::XShape > xTarget):
     mpWindow(new Window(0, WB_NOBORDER|WB_NODIALOGCONTROL)),
     m_GLRender(xTarget)
 {
-    SAL_WARN("chart2.opengl", "DummyXShape::DummyChart()-----test: ");
+    SAL_INFO("chart2.opengl", "DummyXShape::DummyChart()-----test: ");
     setName("com.sun.star.chart2.shapes");
     createGLContext();
 }
@@ -1411,7 +1410,7 @@ void DummyChart::setSize( const awt::Size& aSize )
 
 void DummyChart::render()
 {
-    SAL_WARN("chart2.opengl", "render chart");
+    SAL_INFO("chart2.opengl", "render chart");
     m_GLRender.prepareToRender();
 #if 0
     m_GLRender.renderDebug();
commit 19cb4e0b4f51c2fb37e2e4a9f8237b4d16956f9e
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 6768f87..7527a3d 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 fd91221..43332c1 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -723,9 +723,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);
 
@@ -796,8 +797,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 a701cc6..73b1df7 100755
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -1321,12 +1321,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();
@@ -1356,7 +1350,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 02c69a66624dbabe081092d460ec1d45ae9854e7
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 a2565a5..a701cc6 100755
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -669,7 +669,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 15ec950b443167f47008ab2cfb6795bfa3a73e51
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Mar 6 15:49:08 2014 +0100

    remove the formatted string dummy
    
    Conflicts:
    	chart2/source/view/main/DummyXShape.cxx
    
    Change-Id: I7e73f7362063ef0a3a56765635412746acfee166

diff --git a/chart2/source/view/inc/DummyXShape.hxx b/chart2/source/view/inc/DummyXShape.hxx
index 45f6dc4..6768f87 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 82285c7..fd91221 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -838,14 +838,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 e01c0e22f99acee8b2e7d6a13e1fdb5820b34737
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