[Libreoffice-commits] core.git: 6 commits - chart2/source oox/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Fri Feb 21 20:53:16 PST 2014
chart2/source/inc/OPropertySet.hxx | 4 +-
chart2/source/view/charttypes/BarChart.cxx | 8 ++++
chart2/source/view/main/DummyXShape.cxx | 19 +--------
chart2/source/view/main/OpenGLRender.cxx | 7 ---
chart2/source/view/main/OpenGLRender.hxx | 3 -
chart2/source/view/main/PropertyMapper.cxx | 40 ++++++++++++++++-----
oox/source/drawingml/chart/datasourceconverter.cxx | 28 ++++++++++++++
7 files changed, 74 insertions(+), 35 deletions(-)
New commits:
commit cd033b12cc50f48459b23faf68e96976c5882e7f
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Sat Feb 22 05:49:39 2014 +0100
we only support simple labels in the InternalDataProvider, bnc#864396
Change-Id: Ie31c5c73bb5185125fd4493c4e476997e2e9bc63
diff --git a/oox/source/drawingml/chart/datasourceconverter.cxx b/oox/source/drawingml/chart/datasourceconverter.cxx
index 6be4710..ea22348 100644
--- a/oox/source/drawingml/chart/datasourceconverter.cxx
+++ b/oox/source/drawingml/chart/datasourceconverter.cxx
@@ -50,6 +50,34 @@ Reference< XDataSequence > DataSequenceConverter::createDataSequence( const OUSt
Reference< XDataSequence > xDataSeq;
if( getChartConverter() )
{
+ // the internal data table does not support complex labels
+ // this is only supported in Calc!!!
+ // merge the labels into a single one
+ if(rRole == "label")
+ {
+ mrModel.mnPointCount = std::min<sal_Int32>(mrModel.mnPointCount, 1);
+ OUStringBuffer aTitle;
+ bool bFirst = true;
+ for(DataSequenceModel::AnyMap::const_iterator itr = mrModel.maData.begin(),
+ itrEnd = mrModel.maData.end(); itr != itrEnd; ++itr)
+ {
+ Any aAny = itr->second;
+ if(aAny.has<OUString>())
+ {
+ if(!bFirst)
+ aTitle.append(" ");
+
+ aTitle.append(aAny.get<OUString>());
+ bFirst = false;
+ }
+ }
+
+ if(!bFirst)
+ {
+ mrModel.maData.clear();
+ mrModel.maData.insert(std::make_pair<sal_Int32, Any>(1, Any(aTitle.makeStringAndClear())));
+ }
+ }
xDataSeq = getChartConverter()->createDataSequence( getChartDocument()->getDataProvider(), mrModel );
// set sequen ce role
commit 9f2acf24bf5b7d3c7f4482d0d63d9a7ad9d5481d
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Fri Feb 21 02:21:47 2014 +0100
we know the size so pre alloc the sequence
Change-Id: Icd85ede4898a62833792c68b3e42ad7afa246787
diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx
index 5c57ecf..941257b 100644
--- a/chart2/source/view/charttypes/BarChart.cxx
+++ b/chart2/source/view/charttypes/BarChart.cxx
@@ -773,7 +773,15 @@ void BarChart::createShapes()
}
else //m_nDimension!=3
{
+ // performance improvement: alloc the sequence before the rendering
+ // otherwise we have 2 realloc calls
drawing::PolyPolygonShape3D aPoly;
+ aPoly.SequenceX.realloc(1);
+ aPoly.SequenceY.realloc(1);
+ aPoly.SequenceZ.realloc(1);
+ aPoly.SequenceX[0].realloc(5);
+ aPoly.SequenceY[0].realloc(5);
+ aPoly.SequenceZ[0].realloc(5);
drawing::Position3D aLeftUpperPoint( fLogicX-fLogicBarWidth/2.0,fUpperYValue,fLogicZ );
drawing::Position3D aRightUpperPoint( fLogicX+fLogicBarWidth/2.0,fUpperYValue,fLogicZ );
commit 66b16aec3dc8f48f37179b8f5bc5ceaad0e0beb0
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Fri Feb 21 02:10:23 2014 +0100
replace auto_ptr with boost::scoped_ptr
Change-Id: I52299aa147799214c83a87dbc99104d8ba9b6206
diff --git a/chart2/source/inc/OPropertySet.hxx b/chart2/source/inc/OPropertySet.hxx
index 2fdb0ba..10ac717 100644
--- a/chart2/source/inc/OPropertySet.hxx
+++ b/chart2/source/inc/OPropertySet.hxx
@@ -33,7 +33,7 @@
#include <osl/mutex.hxx>
#include "charttoolsdllapi.hxx"
-#include <memory>
+#include <boost/scoped_ptr.hpp>
namespace property
{
@@ -226,7 +226,7 @@ private:
::osl::Mutex & m_rMutex;
/// pImpl idiom implementation
- ::std::auto_ptr< impl::ImplOPropertySet > m_pImplProperties;
+ boost::scoped_ptr< impl::ImplOPropertySet > m_pImplProperties;
bool m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault;
};
commit cf5fbc124e29fb558f423152fa6bd2237de43608
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Fri Feb 21 01:55:38 2014 +0100
try to limit the getPropertyValue calls
Change-Id: I70b7a3b5f508ecb89d4e4e43cc4297805e83c9f7
diff --git a/chart2/source/view/main/PropertyMapper.cxx b/chart2/source/view/main/PropertyMapper.cxx
index b4c276c..edd74c1 100644
--- a/chart2/source/view/main/PropertyMapper.cxx
+++ b/chart2/source/view/main/PropertyMapper.cxx
@@ -80,19 +80,41 @@ void PropertyMapper::getValueMap(
tPropertyNameMap::const_iterator aIt( rNameMap.begin() );
tPropertyNameMap::const_iterator aEnd( rNameMap.end() );
- for( ; aIt != aEnd; ++aIt )
+ uno::Reference< beans::XMultiPropertySet > xMultiPropSet(xSourceProp, uno::UNO_QUERY);
+ if(xMultiPropSet.is())
{
- OUString aTarget = aIt->first;
- OUString aSource = aIt->second;
- try
+ uno::Sequence< rtl::OUString > aPropSourceNames(rNameMap.size());
+ uno::Sequence< rtl::OUString > aPropTargetNames(rNameMap.size());
+ for(sal_Int32 i = 0; aIt != aEnd; ++aIt, ++i)
{
- uno::Any aAny( xSourceProp->getPropertyValue(aSource) );
- if( aAny.hasValue() )
- rValueMap.insert( tPropertyNameValueMap::value_type( aTarget, aAny ) );
+ aPropSourceNames[i] = aIt->first;
+ aPropTargetNames[i] = aIt->second;
}
- catch( const uno::Exception& e )
+
+ uno::Sequence< uno::Any > xValues = xMultiPropSet->getPropertyValues(aPropSourceNames);
+
+ for(sal_Int32 i = 0, n = rNameMap.size(); i < n; ++i)
+ {
+ if( xValues[i].hasValue() )
+ rValueMap.insert( tPropertyNameValueMap::value_type( aPropTargetNames[i], xValues[i] ) );
+ }
+ }
+ else
+ {
+ for( ; aIt != aEnd; ++aIt )
{
- ASSERT_EXCEPTION( e );
+ OUString aTarget = aIt->first;
+ OUString aSource = aIt->second;
+ try
+ {
+ uno::Any aAny( xSourceProp->getPropertyValue(aSource) );
+ if( aAny.hasValue() )
+ rValueMap.insert( tPropertyNameValueMap::value_type( aTarget, aAny ) );
+ }
+ catch( const uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
}
}
}
commit 02b73e7770868bd077c1916457e199f0e57b47ec
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Thu Feb 20 04:53:48 2014 +0100
setting width and height always happens together
Change-Id: I65ed326ed05474bf81d0323fe3dc61ed0d87cb4e
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 5bbc0d2..986589d 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -1452,8 +1452,7 @@ void SAL_CALL DummyChart::setSize( const awt::Size& aSize )
mpWindow->SetSizePixel(Size(width, height));
pWindow->SetSizePixel(Size(width, height));
DummyXShape::setSize(awt::Size(0,0));
- m_GLRender.SetWidth(width);
- m_GLRender.SetHeight(height);
+ m_GLRender.SetSize(width, height);
SAL_INFO("chart2.opengl", "DummyChart::GLRender.Width = " << width << ", GLRender.Height = " << height);
}
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 9b4cd8d..bf7bcdd 100755
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -723,14 +723,9 @@ OpenGLRender::~OpenGLRender()
}
// TODO: moggi: that screws up FBO if called after buffers have been created!!!!
-void OpenGLRender::SetWidth(int width)
+void OpenGLRender::SetSize(int width, int height)
{
m_iWidth = width;
- m_Projection = glm::ortho(0.f, float(m_iWidth), 0.f, float(m_iHeight), -4.f, 3.f);
-}
-
-void OpenGLRender::SetHeight(int height)
-{
m_iHeight = height;
m_Projection = glm::ortho(0.f, float(m_iWidth), 0.f, float(m_iHeight), -4.f, 3.f);
}
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index b91d5f3..8bcfc87 100755
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -140,8 +140,7 @@ public:
~OpenGLRender();
int InitOpenGL(GLWindow);
int MoveModelf(PosVecf3 trans, PosVecf3 angle, PosVecf3 scale);
- void SetWidth(int width);
- void SetHeight(int height);
+ void SetSize(int width, int height);
void Release();
#if RENDER_TO_FILE
int CreateBMPHeader(sal_uInt8 *bmpHeader, int xsize, int ysize);
commit 9eaf6ab9169b539aff219849877acb710cfcc0f6
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Thu Feb 20 04:50:26 2014 +0100
remove some old code
Change-Id: I6dde9ae70746a59eef8727f7798b6c58971e045f
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 53f233d..5bbc0d2 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -1446,27 +1446,15 @@ DummyChart::~DummyChart()
void SAL_CALL DummyChart::setSize( const awt::Size& aSize )
throw( beans::PropertyVetoException, uno::RuntimeException )
{
-#if 0
- DummyXShape::setSize(aSize);
- mpWindow->SetSizePixel(Size(aSize.Width, aSize.Height));
- pWindow->SetSizePixel(Size(aSize.Width, aSize.Height));
-#else
-
- SAL_WARN("chart2.opengl", "DummyChart::setSize()---aSize.Width = " << aSize.Width << ", aSize.Height = " << aSize.Height);
-// DummyXShape::setSize(aSize);
-// mpWindow->SetSizePixel(Size(aSize.Width, aSize.Height));
-// pWindow->SetSizePixel(Size(aSize.Width, aSize.Height));
+ SAL_INFO("chart2.opengl", "DummyChart::setSize()---aSize.Width = " << aSize.Width << ", aSize.Height = " << aSize.Height);
int width = aSize.Width / OPENGL_SCALE_VALUE;
int height = aSize.Height / OPENGL_SCALE_VALUE;
- width = (width + 3) & ~3;
- height = (height + 3) & ~3;
mpWindow->SetSizePixel(Size(width, height));
pWindow->SetSizePixel(Size(width, height));
DummyXShape::setSize(awt::Size(0,0));
m_GLRender.SetWidth(width);
m_GLRender.SetHeight(height);
- SAL_WARN("chart2.opengl", "DummyChart::GLRender.Width = " << width << ", GLRender.Height = " << height);
-#endif
+ SAL_INFO("chart2.opengl", "DummyChart::GLRender.Width = " << width << ", GLRender.Height = " << height);
}
void DummyChart::render()
More information about the Libreoffice-commits
mailing list