[Libreoffice-commits] core.git: 6 commits - chart2/source
Kohei Yoshida
kohei.yoshida at collabora.com
Thu Sep 18 19:52:24 PDT 2014
chart2/source/view/diagram/VDiagram.cxx | 28 ++++++++++-----------
chart2/source/view/main/ChartView.cxx | 11 +++-----
chart2/source/view/main/DrawModelWrapper.cxx | 35 ++++++++++++++-------------
chart2/source/view/main/ShapeFactory.cxx | 24 ++++++++++--------
4 files changed, 50 insertions(+), 48 deletions(-)
New commits:
commit 5abf95a4fe4b087f962201ffd1449fb143a89813
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Sep 18 22:47:03 2014 -0400
Returned shape object is assigned but not used.
Change-Id: Icd15ce57e6d4bb5384b7508d4d3ceb9cd1038f9a
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index ccc8fc4..77a70f8d 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2364,11 +2364,8 @@ void formatPage(
PropertyMapper::getMultiPropertyListsFromValueMap( aNames, aValues, aNameValueMap );
AbstractShapeFactory* pShapeFactory = AbstractShapeFactory::getOrCreateShapeFactory(xShapeFactory);
- uno::Reference< drawing::XShape > xShape =
- pShapeFactory->createRectangle( xTarget,
- rPageSize,
- awt::Point( 0, 0 ),
- aNames, aValues );
+ pShapeFactory->createRectangle(
+ xTarget, rPageSize, awt::Point(0, 0), aNames, aValues);
}
catch( const uno::Exception & ex )
{
commit 6ca26d642f1d7b8394d33dbd8fbdb828e6584459
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Sep 18 22:42:37 2014 -0400
Pass by const reference.
Change-Id: If4bcee8d9d45b43f025ee0409070afdc53b9405a
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 62b8fdd..ccc8fc4 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2338,7 +2338,7 @@ bool lcl_createLegend( const uno::Reference< XLegend > & xLegend
void formatPage(
ChartModel& rChartModel
- , const awt::Size rPageSize
+ , const awt::Size& rPageSize
, const uno::Reference< drawing::XShapes >& xTarget
, const uno::Reference< lang::XMultiServiceFactory>& xShapeFactory
)
commit ccfbb5af4f24a0e12f7f78c801f32e6564a85d9e
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Sep 18 22:38:26 2014 -0400
Scope level reduction.
Change-Id: I4e2f25cdb9aef851724073d32e96c76c3416de3c
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index 7cfef7e..865c95e 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -63,19 +63,21 @@ namespace chart
uno::Reference< drawing::XShapes > ShapeFactory::getOrCreateChartRootShape(
const uno::Reference< drawing::XDrawPage>& xDrawPage )
{
- uno::Reference< drawing::XShapes > xRet( ShapeFactory::getChartRootShape( xDrawPage ) );
- if( !xRet.is() )
- {
- uno::Reference< drawing::XShape > xShape( m_xShapeFactory->createInstance(
- "com.sun.star.drawing.GroupShape" ), uno::UNO_QUERY );
- uno::Reference< drawing::XShapes2 > xShapes2(xDrawPage, uno::UNO_QUERY_THROW);
- xShapes2->addBottom(xShape);
+ uno::Reference<drawing::XShapes> xRet = ShapeFactory::getChartRootShape(xDrawPage);
+ if (xRet.is())
+ return xRet;
- setShapeName( xShape, "com.sun.star.chart2.shapes" );
- xShape->setSize(awt::Size(0,0));
+ // Create a new root shape and set it to the bottom of the page. The root
+ // shape is identified by having the name com.sun.star.chart2.shapes.
+ uno::Reference<drawing::XShape> xShape(
+ m_xShapeFactory->createInstance("com.sun.star.drawing.GroupShape"), uno::UNO_QUERY);
+ uno::Reference<drawing::XShapes2> xShapes2(xDrawPage, uno::UNO_QUERY_THROW);
+ xShapes2->addBottom(xShape);
- xRet = uno::Reference<drawing::XShapes>( xShape, uno::UNO_QUERY );
- }
+ setShapeName(xShape, "com.sun.star.chart2.shapes");
+ xShape->setSize(awt::Size(0,0));
+
+ xRet = uno::Reference<drawing::XShapes>(xShape, uno::UNO_QUERY);
return xRet;
}
commit caa14121ea46982a97951728f08acb2dd5a97470
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Sep 18 22:19:11 2014 -0400
Scope level reduction.
Change-Id: I02701e70c064fe0378ff3bfc1c31365f7fba33cc
diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx
index fef6cab..d917ee1 100644
--- a/chart2/source/view/main/DrawModelWrapper.cxx
+++ b/chart2/source/view/main/DrawModelWrapper.cxx
@@ -204,24 +204,27 @@ uno::Reference< lang::XMultiServiceFactory > DrawModelWrapper::getShapeFactory()
uno::Reference< drawing::XDrawPage > DrawModelWrapper::getMainDrawPage()
{
- //create draw page:
- if( !m_xMainDrawPage.is() )
+ if (m_xMainDrawPage.is())
+ return m_xMainDrawPage;
+
+ // Create draw page.
+ uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSuplier(getUnoModel(), uno::UNO_QUERY);
+ if (!xDrawPagesSuplier.is())
+ return m_xMainDrawPage;
+
+ uno::Reference<drawing::XDrawPages> xDrawPages = xDrawPagesSuplier->getDrawPages();
+ if (xDrawPages->getCount() > 1)
{
- uno::Reference< drawing::XDrawPagesSupplier > xDrawPagesSuplier( this->getUnoModel(), uno::UNO_QUERY );
- if( xDrawPagesSuplier.is() )
- {
- uno::Reference< drawing::XDrawPages > xDrawPages( xDrawPagesSuplier->getDrawPages () );
- if( xDrawPages->getCount()>1 )
- {
- uno::Any aPage = xDrawPages->getByIndex( 0 ) ;
- aPage >>= m_xMainDrawPage;
- }
- if(!m_xMainDrawPage.is())
- {
- m_xMainDrawPage = xDrawPages->insertNewByIndex( 0 );
- }
- }
+ // Take the first page in case of multiple pages.
+ uno::Any aPage = xDrawPages->getByIndex(0);
+ aPage >>= m_xMainDrawPage;
}
+
+ if (!m_xMainDrawPage.is())
+ {
+ m_xMainDrawPage = xDrawPages->insertNewByIndex(0);
+ }
+
//ensure that additional shapes are in front of the chart objects so create the chart root before
// let us disable this call for now
// TODO:moggi
commit 312d1a5b443558c643fe4d2044909705749ccef0
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Sep 18 20:40:39 2014 -0400
Fix prefix for non-reference variable.
Also remove excessive static_cast for integer to integer assignments.
Change-Id: I8cc65a4e5385ad6d62bb22b24fbe879efbbabdb6
diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx
index 5a5ac45..30913e2 100644
--- a/chart2/source/view/diagram/VDiagram.cxx
+++ b/chart2/source/view/diagram/VDiagram.cxx
@@ -700,24 +700,24 @@ void VDiagram::reduceToMimimumSize()
::basegfx::B2IRectangle VDiagram::adjustInnerSize( const ::basegfx::B2IRectangle& rConsumedOuterRect )
{
- awt::Point aNewPos( m_aCurrentPosWithoutAxes );
- awt::Size aNewSize( m_aCurrentSizeWithoutAxes );
+ awt::Point aNewPos = m_aCurrentPosWithoutAxes;
+ awt::Size aNewSize = m_aCurrentSizeWithoutAxes;
- ::basegfx::B2IRectangle rAvailableOuterRect(
- BaseGFXHelper::makeRectangle(m_aAvailablePosIncludingAxes,m_aAvailableSizeIncludingAxes) );
+ basegfx::B2IRectangle aAvailableOuterRect =
+ BaseGFXHelper::makeRectangle(m_aAvailablePosIncludingAxes, m_aAvailableSizeIncludingAxes);
- sal_Int32 nDeltaWidth = static_cast<sal_Int32>(rAvailableOuterRect.getWidth() - rConsumedOuterRect.getWidth());
- sal_Int32 nDeltaHeight = static_cast<sal_Int32>(rAvailableOuterRect.getHeight() - rConsumedOuterRect.getHeight());
- if( (aNewSize.Width + nDeltaWidth) < rAvailableOuterRect.getWidth()/3 )
- nDeltaWidth = static_cast<sal_Int32>(rAvailableOuterRect.getWidth()/3 - aNewSize.Width);
+ sal_Int32 nDeltaWidth = aAvailableOuterRect.getWidth() - rConsumedOuterRect.getWidth();
+ sal_Int32 nDeltaHeight = aAvailableOuterRect.getHeight() - rConsumedOuterRect.getHeight();
+ if( (aNewSize.Width + nDeltaWidth) < aAvailableOuterRect.getWidth()/3 )
+ nDeltaWidth = aAvailableOuterRect.getWidth()/3 - aNewSize.Width;
aNewSize.Width += nDeltaWidth;
- if( (aNewSize.Height + nDeltaHeight) < rAvailableOuterRect.getHeight()/3 )
- nDeltaHeight = static_cast<sal_Int32>(rAvailableOuterRect.getHeight()/3 - aNewSize.Height);
+ if( (aNewSize.Height + nDeltaHeight) < aAvailableOuterRect.getHeight()/3 )
+ nDeltaHeight = aAvailableOuterRect.getHeight()/3 - aNewSize.Height;
aNewSize.Height += nDeltaHeight;
- sal_Int32 nDiffLeft = rConsumedOuterRect.getMinX() - rAvailableOuterRect.getMinX();
- sal_Int32 nDiffRight = rAvailableOuterRect.getMaxX() - rConsumedOuterRect.getMaxX();
+ sal_Int32 nDiffLeft = rConsumedOuterRect.getMinX() - aAvailableOuterRect.getMinX();
+ sal_Int32 nDiffRight = aAvailableOuterRect.getMaxX() - rConsumedOuterRect.getMaxX();
if( nDiffLeft >= 0 )
aNewPos.X -= nDiffLeft;
else if( nDiffRight >= 0 )
@@ -730,8 +730,8 @@ void VDiagram::reduceToMimimumSize()
aNewPos.X += abs(nDeltaWidth);
}
- sal_Int32 nDiffUp = rConsumedOuterRect.getMinY() - rAvailableOuterRect.getMinY();
- sal_Int32 nDiffDown = rAvailableOuterRect.getMaxY() - rConsumedOuterRect.getMaxY();
+ sal_Int32 nDiffUp = rConsumedOuterRect.getMinY() - aAvailableOuterRect.getMinY();
+ sal_Int32 nDiffDown = aAvailableOuterRect.getMaxY() - rConsumedOuterRect.getMaxY();
if( nDiffUp >= 0 )
aNewPos.Y -= nDiffUp;
else if( nDiffDown >= 0 )
commit 2eaf5095caa217131cb34863298a76245b9d6b6b
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Sep 18 16:25:33 2014 -0400
No need to instantiate B2IRectangle twice.
Change-Id: I584f3096221ff8b72ffde7ba5bce4259da64a14d
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 61ba728..62b8fdd 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1501,7 +1501,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
VCoordinateSystem* pVCooSys = rVCooSysList[0];
pVCooSys->createMaximumAxesLabels();
- aConsumedOuterRect = ::basegfx::B2IRectangle( AbstractShapeFactory::getRectangleOfShape(xBoundingShape) );
+ aConsumedOuterRect = AbstractShapeFactory::getRectangleOfShape(xBoundingShape);
::basegfx::B2IRectangle aNewInnerRect( aVDiagram.getCurrentRectangle() );
if( !bUseFixedInnerSize )
aNewInnerRect = aVDiagram.adjustInnerSize( aConsumedOuterRect );
More information about the Libreoffice-commits
mailing list