[Libreoffice-commits] core.git: 7 commits - chart2/inc chart2/source
Kohei Yoshida
kohei.yoshida at collabora.com
Fri Sep 19 15:44:45 PDT 2014
chart2/inc/ChartView.hxx | 12 --
chart2/source/inc/BaseGFXHelper.hxx | 2
chart2/source/tools/BaseGFXHelper.cxx | 5 +
chart2/source/view/main/ChartView.cxx | 169 ++++++++++++++++------------------
4 files changed, 92 insertions(+), 96 deletions(-)
New commits:
commit 3b6dcf40f1ac395af3301af08f47c4db9cd1e1e0
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Sep 19 16:44:34 2014 -0400
These are no longer used.
Change-Id: I55a19ab06108825ece00844bb20c3fd5f65dfe37
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 747ebe8..3a6e6f5 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -3090,9 +3090,6 @@ void ChartView::createShapes2D( const awt::Size& rPageSize )
if (getAvailablePosAndSizeForDiagram(aParam, rPageSize, mrChartModel.getFirstDiagram()))
{
- awt::Point aAvailablePosDia(aParam.maRemainingSpace.X, aParam.maRemainingSpace.Y);
- awt::Size aAvailableSizeForDiagram(aParam.maRemainingSpace.Width, aParam.maRemainingSpace.Height);
-
awt::Rectangle aUsedOuterRect = impl_createDiagramAndContent(aSeriesPlotterContainer, aParam, rPageSize);
if (aParam.mxPlotAreaWithAxes.is())
commit 9396f59a3c3012cc7514d50f1b3f6476cb73ca9d
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Sep 19 16:41:41 2014 -0400
Finally, move the group shape object for the diagram with axes to the param.
Change-Id: I134275076256bb1b5441ae7804eacaaaa689d171
diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx
index 1d90414..dc3d495 100644
--- a/chart2/inc/ChartView.hxx
+++ b/chart2/inc/ChartView.hxx
@@ -222,10 +222,9 @@ private: //methods
void render();
- ::com::sun::star::awt::Rectangle impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlotterContainer
- , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes>& xDiagramPlusAxes_Shapes
- , const CreateShapeParam2D& rParam
- , const ::com::sun::star::awt::Size& rPageSize );
+ css::awt::Rectangle impl_createDiagramAndContent(
+ SeriesPlotterContainer& rSeriesPlotterContainer,
+ const CreateShapeParam2D& rParam, const css::awt::Size& rPageSize );
DECL_LINK( UpdateTimeBased, void* );
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index a40799f..747ebe8 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -144,6 +144,8 @@ struct CreateShapeParam2D
css::uno::Reference<css::drawing::XShape> mxMarkHandles;
css::uno::Reference<css::drawing::XShape> mxPlotAreaWithAxes;
+ css::uno::Reference<css::drawing::XShapes> mxDiagramWithAxesShapes;
+
bool mbAutoPosTitleX;
bool mbAutoPosTitleY;
bool mbAutoPosTitleZ;
@@ -1430,10 +1432,9 @@ sal_Int16 lcl_getDefaultWritingModeFromPool( const boost::shared_ptr<DrawModelWr
} //end anonymous namespace
-awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlotterContainer
- , const uno::Reference< drawing::XShapes>& xDiagramPlusAxes_Shapes
- , const CreateShapeParam2D& rParam
- , const awt::Size& rPageSize )
+awt::Rectangle ChartView::impl_createDiagramAndContent(
+ SeriesPlotterContainer& rSeriesPlotterContainer,
+ const CreateShapeParam2D& rParam, const awt::Size& rPageSize )
{
//return the used rectangle
awt::Rectangle aUsedOuterRect(rParam.maRemainingSpace.X, rParam.maRemainingSpace.Y, 0, 0);
@@ -1490,7 +1491,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
VDiagram aVDiagram(xDiagram, aPreferredAspectRatio, nDimensionCount);
bool bIsPieOrDonut = lcl_IsPieOrDonut(xDiagram);
{//create diagram
- aVDiagram.init(xDiagramPlusAxes_Shapes, m_xShapeFactory);
+ aVDiagram.init(rParam.mxDiagramWithAxesShapes, m_xShapeFactory);
aVDiagram.createShapes(
awt::Point(rParam.maRemainingSpace.X, rParam.maRemainingSpace.Y),
awt::Size(rParam.maRemainingSpace.Width, rParam.maRemainingSpace.Height));
@@ -1501,7 +1502,8 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
aVDiagram.reduceToMimimumSize();
}
- uno::Reference< drawing::XShapes > xTextTargetShapes( AbstractShapeFactory::getOrCreateShapeFactory(m_xShapeFactory)->createGroup2D(xDiagramPlusAxes_Shapes) );
+ uno::Reference< drawing::XShapes > xTextTargetShapes =
+ AbstractShapeFactory::getOrCreateShapeFactory(m_xShapeFactory)->createGroup2D(rParam.mxDiagramWithAxesShapes);
// - create axis and grids for all coordinate systems
@@ -1519,7 +1521,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
//calculate resulting size respecting axis label layout and fontscaling
- uno::Reference< drawing::XShape > xBoundingShape( xDiagramPlusAxes_Shapes, uno::UNO_QUERY );
+ uno::Reference< drawing::XShape > xBoundingShape(rParam.mxDiagramWithAxesShapes, uno::UNO_QUERY);
::basegfx::B2IRectangle aConsumedOuterRect;
//use first coosys only so far; todo: calculate for more than one coosys if we have more in future
@@ -3035,7 +3037,7 @@ void ChartView::createShapes2D( const awt::Size& rPageSize )
xDiagramPlusAxesPlusMarkHandlesGroup_Shapes, awt::Size(0, 0));
AbstractShapeFactory::setShapeName(aParam.mxPlotAreaWithAxes, "PlotAreaIncludingAxes");
- uno::Reference< drawing::XShapes > xDiagramPlusAxes_Shapes( pShapeFactory->createGroup2D(xDiagramPlusAxesPlusMarkHandlesGroup_Shapes ) );
+ aParam.mxDiagramWithAxesShapes = pShapeFactory->createGroup2D(xDiagramPlusAxesPlusMarkHandlesGroup_Shapes);
bool bAutoPositionDummy = true;
@@ -3091,8 +3093,7 @@ void ChartView::createShapes2D( const awt::Size& rPageSize )
awt::Point aAvailablePosDia(aParam.maRemainingSpace.X, aParam.maRemainingSpace.Y);
awt::Size aAvailableSizeForDiagram(aParam.maRemainingSpace.Width, aParam.maRemainingSpace.Height);
- awt::Rectangle aUsedOuterRect = impl_createDiagramAndContent(
- aSeriesPlotterContainer, xDiagramPlusAxes_Shapes, aParam, rPageSize);
+ awt::Rectangle aUsedOuterRect = impl_createDiagramAndContent(aSeriesPlotterContainer, aParam, rPageSize);
if (aParam.mxPlotAreaWithAxes.is())
{
commit 21c92bb25cb67c589adb3799d07a9703c6ce83d3
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Sep 19 16:31:24 2014 -0400
Move the "PlotAreaIncludingAxes" shape object to CreateShapeParam2D.
Change-Id: I6c88611e837f651af92406952df273693d651121
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index cebc415..a40799f 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -142,6 +142,7 @@ struct CreateShapeParam2D
boost::shared_ptr<VTitle> mpVTitleSecondY;
css::uno::Reference<css::drawing::XShape> mxMarkHandles;
+ css::uno::Reference<css::drawing::XShape> mxPlotAreaWithAxes;
bool mbAutoPosTitleX;
bool mbAutoPosTitleY;
@@ -3030,9 +3031,9 @@ void ChartView::createShapes2D( const awt::Size& rPageSize )
xDiagramPlusAxesPlusMarkHandlesGroup_Shapes, awt::Size(0,0));
AbstractShapeFactory::setShapeName(aParam.mxMarkHandles, "MarkHandles");
- uno::Reference< drawing::XShape > xDiagram_OuterRect( pShapeFactory->createInvisibleRectangle(
- xDiagramPlusAxesPlusMarkHandlesGroup_Shapes, awt::Size(0,0) ) );
- AbstractShapeFactory::setShapeName( xDiagram_OuterRect, "PlotAreaIncludingAxes" );
+ aParam.mxPlotAreaWithAxes = pShapeFactory->createInvisibleRectangle(
+ xDiagramPlusAxesPlusMarkHandlesGroup_Shapes, awt::Size(0, 0));
+ AbstractShapeFactory::setShapeName(aParam.mxPlotAreaWithAxes, "PlotAreaIncludingAxes");
uno::Reference< drawing::XShapes > xDiagramPlusAxes_Shapes( pShapeFactory->createGroup2D(xDiagramPlusAxesPlusMarkHandlesGroup_Shapes ) );
@@ -3093,10 +3094,10 @@ void ChartView::createShapes2D( const awt::Size& rPageSize )
awt::Rectangle aUsedOuterRect = impl_createDiagramAndContent(
aSeriesPlotterContainer, xDiagramPlusAxes_Shapes, aParam, rPageSize);
- if( xDiagram_OuterRect.is() )
+ if (aParam.mxPlotAreaWithAxes.is())
{
- xDiagram_OuterRect->setPosition( awt::Point( aUsedOuterRect.X, aUsedOuterRect.Y ) );
- xDiagram_OuterRect->setSize( awt::Size( aUsedOuterRect.Width, aUsedOuterRect.Height ) );
+ aParam.mxPlotAreaWithAxes->setPosition(awt::Point(aUsedOuterRect.X, aUsedOuterRect.Y));
+ aParam.mxPlotAreaWithAxes->setSize(awt::Size(aUsedOuterRect.Width, aUsedOuterRect.Height));
}
//correct axis title position
commit 133b7b935ccf09afbe40649c5781c225ee3ac757
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Sep 19 16:25:46 2014 -0400
Move the "MarkHandles" shape object to CreateShapeParam2D.
Change-Id: I66843ca4ded3b69cb7f5256c94566c8f5d2de31c
diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx
index 7019187..1d90414 100644
--- a/chart2/inc/ChartView.hxx
+++ b/chart2/inc/ChartView.hxx
@@ -225,8 +225,7 @@ private: //methods
::com::sun::star::awt::Rectangle impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlotterContainer
, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes>& xDiagramPlusAxes_Shapes
, const CreateShapeParam2D& rParam
- , const ::com::sun::star::awt::Size& rPageSize
- , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>& xDiagram_MarkHandles );
+ , const ::com::sun::star::awt::Size& rPageSize );
DECL_LINK( UpdateTimeBased, void* );
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 8e8dec6..cebc415 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -141,6 +141,8 @@ struct CreateShapeParam2D
boost::shared_ptr<VTitle> mpVTitleSecondX;
boost::shared_ptr<VTitle> mpVTitleSecondY;
+ css::uno::Reference<css::drawing::XShape> mxMarkHandles;
+
bool mbAutoPosTitleX;
bool mbAutoPosTitleY;
bool mbAutoPosTitleZ;
@@ -1430,9 +1432,7 @@ sal_Int16 lcl_getDefaultWritingModeFromPool( const boost::shared_ptr<DrawModelWr
awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlotterContainer
, const uno::Reference< drawing::XShapes>& xDiagramPlusAxes_Shapes
, const CreateShapeParam2D& rParam
- , const awt::Size& rPageSize
- , const uno::Reference< drawing::XShape>& xDiagram_MarkHandles /*needs to be resized to fit the result*/
- )
+ , const awt::Size& rPageSize )
{
//return the used rectangle
awt::Rectangle aUsedOuterRect(rParam.maRemainingSpace.X, rParam.maRemainingSpace.Y, 0, 0);
@@ -1690,7 +1690,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
}
}
- if( xDiagram_MarkHandles.is() )
+ if (rParam.mxMarkHandles.is())
{
awt::Point aPos(rParam.maRemainingSpace.X, rParam.maRemainingSpace.Y);
awt::Size aSize(rParam.maRemainingSpace.Width, rParam.maRemainingSpace.Height);
@@ -1704,8 +1704,8 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
aPos = awt::Point( m_aResultingDiagramRectangleExcludingAxes.X, m_aResultingDiagramRectangleExcludingAxes.Y );
aSize = awt::Size( m_aResultingDiagramRectangleExcludingAxes.Width, m_aResultingDiagramRectangleExcludingAxes.Height );
}
- xDiagram_MarkHandles->setPosition( aPos );
- xDiagram_MarkHandles->setSize( aSize );
+ rParam.mxMarkHandles->setPosition(aPos);
+ rParam.mxMarkHandles->setSize(aSize);
}
return aUsedOuterRect;
@@ -3026,9 +3026,9 @@ void ChartView::createShapes2D( const awt::Size& rPageSize )
uno::Reference< drawing::XShapes > xDiagramPlusAxesPlusMarkHandlesGroup_Shapes(
pShapeFactory->createGroup2D(mxRootShape,aDiagramCID) );
- uno::Reference< drawing::XShape > xDiagram_MarkHandles( pShapeFactory->createInvisibleRectangle(
- xDiagramPlusAxesPlusMarkHandlesGroup_Shapes, awt::Size(0,0) ) );
- AbstractShapeFactory::setShapeName( xDiagram_MarkHandles, "MarkHandles" );
+ aParam.mxMarkHandles = pShapeFactory->createInvisibleRectangle(
+ xDiagramPlusAxesPlusMarkHandlesGroup_Shapes, awt::Size(0,0));
+ AbstractShapeFactory::setShapeName(aParam.mxMarkHandles, "MarkHandles");
uno::Reference< drawing::XShape > xDiagram_OuterRect( pShapeFactory->createInvisibleRectangle(
xDiagramPlusAxesPlusMarkHandlesGroup_Shapes, awt::Size(0,0) ) );
@@ -3091,7 +3091,7 @@ void ChartView::createShapes2D( const awt::Size& rPageSize )
awt::Size aAvailableSizeForDiagram(aParam.maRemainingSpace.Width, aParam.maRemainingSpace.Height);
awt::Rectangle aUsedOuterRect = impl_createDiagramAndContent(
- aSeriesPlotterContainer, xDiagramPlusAxes_Shapes, aParam, rPageSize, xDiagram_MarkHandles);
+ aSeriesPlotterContainer, xDiagramPlusAxes_Shapes, aParam, rPageSize);
if( xDiagram_OuterRect.is() )
{
commit db51e40450959cbd5557034663a65f973be1a167
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Sep 19 15:38:06 2014 -0400
Remove double-conversion between awt::Rectangle and basegfx::B2IRectangle.
Change-Id: I51b1a366ca49f680f964814b0fd0fa69a6a7f5bd
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index f13e6aa..8e8dec6 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1467,10 +1467,8 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
CuboidPlanePosition eBottomPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( xSceneProperties ) );
pVCooSys->set3DWallPositions( eLeftWallPos, eBackWallPos, eBottomPos );
}
- pVCooSys->createVAxisList( xNumberFormatsSupplier
- , rPageSize //font reference size
- , BaseGFXHelper::B2IRectangleToAWTRectangle( aAvailableOuterRect ) //maximum space for labels
- );
+
+ pVCooSys->createVAxisList(xNumberFormatsSupplier, rPageSize, rParam.maRemainingSpace);
}
// - prepare list of all axis and how they are used
commit af655d2f76cf4739024832642aef4a01d5d977e1
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Sep 19 15:09:06 2014 -0400
Refactor impl_createDiagramAndContent() to take CreateShapeParam2D.
Change-Id: I517c4e4a2296531c0d7f129ff46adca0f85a969d
diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx
index 51b6a48..7019187 100644
--- a/chart2/inc/ChartView.hxx
+++ b/chart2/inc/ChartView.hxx
@@ -205,7 +205,7 @@ private: //methods
void createShapes();
void createShapes2D( const css::awt::Size& rPageSize );
- bool createAxisTitleShapes2D( const css::awt::Size& rPageSize, CreateShapeParam2D& rParam );
+ bool createAxisTitleShapes2D( CreateShapeParam2D& rParam, const css::awt::Size& rPageSize );
void createShapes3D();
bool isReal3DChart();
void getMetaFile( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutStream
@@ -224,10 +224,8 @@ private: //methods
::com::sun::star::awt::Rectangle impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlotterContainer
, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes>& xDiagramPlusAxes_Shapes
- , const ::com::sun::star::awt::Point& rAvailablePos
- , const ::com::sun::star::awt::Size& rAvailableSize
+ , const CreateShapeParam2D& rParam
, const ::com::sun::star::awt::Size& rPageSize
- , bool bUseFixedInnerSize
, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>& xDiagram_MarkHandles );
DECL_LINK( UpdateTimeBased, void* );
diff --git a/chart2/source/inc/BaseGFXHelper.hxx b/chart2/source/inc/BaseGFXHelper.hxx
index fec9f27..e4f9867 100644
--- a/chart2/source/inc/BaseGFXHelper.hxx
+++ b/chart2/source/inc/BaseGFXHelper.hxx
@@ -47,6 +47,8 @@ OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B2IRectangle makeRectangle(
const com::sun::star::awt::Point& rPosition,
const com::sun::star::awt::Size& rSize );
+OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B2IRectangle makeRectangle( const css::awt::Rectangle& rRect );
+
OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::awt::Point B2IRectangleToAWTPoint(
const ::basegfx::B2IRectangle& rB2IRectangle );
diff --git a/chart2/source/tools/BaseGFXHelper.cxx b/chart2/source/tools/BaseGFXHelper.cxx
index df67116..8b79b68 100644
--- a/chart2/source/tools/BaseGFXHelper.cxx
+++ b/chart2/source/tools/BaseGFXHelper.cxx
@@ -66,6 +66,11 @@ B2IRectangle makeRectangle( const awt::Point& rPos, const awt::Size& rSize )
return B2IRectangle(rPos.X,rPos.Y,rPos.X+rSize.Width,rPos.Y+rSize.Height);
}
+B2IRectangle makeRectangle( const awt::Rectangle& rRect )
+{
+ return B2IRectangle(rRect.X, rRect.Y, rRect.X+rRect.Width, rRect.Y+rRect.Height);
+}
+
awt::Point B2IRectangleToAWTPoint( const ::basegfx::B2IRectangle& rB2IRectangle )
{
return awt::Point( rB2IRectangle.getMinX(), rB2IRectangle.getMinY() );
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 70e1494..f13e6aa 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1429,17 +1429,14 @@ sal_Int16 lcl_getDefaultWritingModeFromPool( const boost::shared_ptr<DrawModelWr
awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer& rSeriesPlotterContainer
, const uno::Reference< drawing::XShapes>& xDiagramPlusAxes_Shapes
- , const awt::Point& rAvailablePos
- , const awt::Size& rAvailableSize
+ , const CreateShapeParam2D& rParam
, const awt::Size& rPageSize
- , bool bUseFixedInnerSize
, const uno::Reference< drawing::XShape>& xDiagram_MarkHandles /*needs to be resized to fit the result*/
)
{
//return the used rectangle
- awt::Rectangle aUsedOuterRect( rAvailablePos.X, rAvailablePos.Y, 0, 0 );
+ awt::Rectangle aUsedOuterRect(rParam.maRemainingSpace.X, rParam.maRemainingSpace.Y, 0, 0);
-// sal_Int32 nDiagramIndex = 0;//todo if more than one diagam is supported
uno::Reference< XDiagram > xDiagram( mrChartModel.getFirstDiagram() );
if( !xDiagram.is())
return aUsedOuterRect;
@@ -1451,7 +1448,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
nDimensionCount = 2;
}
- ::basegfx::B2IRectangle aAvailableOuterRect( BaseGFXHelper::makeRectangle(rAvailablePos,rAvailableSize) );
+ basegfx::B2IRectangle aAvailableOuterRect = BaseGFXHelper::makeRectangle(rParam.maRemainingSpace);
const std::vector< VCoordinateSystem* >& rVCooSysList( rSeriesPlotterContainer.getCooSysList() );
const std::vector< VSeriesPlotter* >& rSeriesPlotterList( rSeriesPlotterContainer.getSeriesPlotterList() );
@@ -1495,10 +1492,13 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
bool bIsPieOrDonut = lcl_IsPieOrDonut(xDiagram);
{//create diagram
aVDiagram.init(xDiagramPlusAxes_Shapes, m_xShapeFactory);
- aVDiagram.createShapes(rAvailablePos,rAvailableSize);
+ aVDiagram.createShapes(
+ awt::Point(rParam.maRemainingSpace.X, rParam.maRemainingSpace.Y),
+ awt::Size(rParam.maRemainingSpace.Width, rParam.maRemainingSpace.Height));
+
xSeriesTargetInFrontOfAxis = aVDiagram.getCoordinateRegion();
// It is preferrable to use full size than minimum for pie charts
- if( !bIsPieOrDonut && !bUseFixedInnerSize )
+ if (!bIsPieOrDonut && !rParam.mbUseFixedInnerSize)
aVDiagram.reduceToMimimumSize();
}
@@ -1532,7 +1532,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
aConsumedOuterRect = AbstractShapeFactory::getRectangleOfShape(xBoundingShape);
::basegfx::B2IRectangle aNewInnerRect( aVDiagram.getCurrentRectangle() );
- if( !bUseFixedInnerSize )
+ if (!rParam.mbUseFixedInnerSize)
aNewInnerRect = aVDiagram.adjustInnerSize( aConsumedOuterRect );
pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix(
@@ -1555,7 +1555,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
bLessSpaceConsumedThanExpected = true;
}
- if( bLessSpaceConsumedThanExpected && !bUseFixedInnerSize )
+ if (bLessSpaceConsumedThanExpected && !rParam.mbUseFixedInnerSize)
{
aVDiagram.adjustInnerSize( aConsumedOuterRect );
pVCooSys->setTransformationSceneToScreen( B3DHomMatrixToHomogenMatrix(
@@ -1616,7 +1616,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
aConsumedOuterRect = ::basegfx::B2IRectangle( AbstractShapeFactory::getRectangleOfShape(xBoundingShape) );
::basegfx::B2IRectangle aNewInnerRect( aVDiagram.getCurrentRectangle() );
- if( !bUseFixedInnerSize )
+ if (!rParam.mbUseFixedInnerSize)
aNewInnerRect = aVDiagram.adjustInnerSize( aConsumedOuterRect );
for( aPlotterIter = rSeriesPlotterList.begin(); aPlotterIter != aPlotterEnd; ++aPlotterIter )
@@ -1656,12 +1656,12 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
}
}
- if( bUseFixedInnerSize )
+ if (rParam.mbUseFixedInnerSize)
{
aUsedOuterRect = awt::Rectangle( aConsumedOuterRect.getMinX(), aConsumedOuterRect.getMinY(), aConsumedOuterRect.getWidth(), aConsumedOuterRect.getHeight() );
}
else
- aUsedOuterRect = awt::Rectangle( rAvailablePos.X, rAvailablePos.Y, rAvailableSize.Width, rAvailableSize.Height );
+ aUsedOuterRect = rParam.maRemainingSpace;
bool bSnapRectToUsedArea = false;
for( aPlotterIter = rSeriesPlotterList.begin(); aPlotterIter != aPlotterEnd; ++aPlotterIter )
@@ -1673,7 +1673,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
}
if(bSnapRectToUsedArea)
{
- if( bUseFixedInnerSize )
+ if (rParam.mbUseFixedInnerSize)
m_aResultingDiagramRectangleExcludingAxes = getRectangleOfObject( "PlotAreaExcludingAxes" );
else
{
@@ -1683,8 +1683,8 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
}
else
{
- if( bUseFixedInnerSize )
- m_aResultingDiagramRectangleExcludingAxes = awt::Rectangle( rAvailablePos.X, rAvailablePos.Y, rAvailableSize.Width, rAvailableSize.Height );
+ if (rParam.mbUseFixedInnerSize)
+ m_aResultingDiagramRectangleExcludingAxes = rParam.maRemainingSpace;
else
{
::basegfx::B2IRectangle aConsumedInnerRect = aVDiagram.getCurrentRectangle();
@@ -1694,13 +1694,14 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( SeriesPlotterContainer&
if( xDiagram_MarkHandles.is() )
{
- awt::Point aPos(rAvailablePos);
- awt::Size aSize(rAvailableSize);
+ awt::Point aPos(rParam.maRemainingSpace.X, rParam.maRemainingSpace.Y);
+ awt::Size aSize(rParam.maRemainingSpace.Width, rParam.maRemainingSpace.Height);
+
bool bPosSizeExcludeAxesProperty = true;
uno::Reference< beans::XPropertySet > xDiaProps( xDiagram, uno::UNO_QUERY_THROW );
if( xDiaProps.is() )
xDiaProps->getPropertyValue("PosSizeExcludeAxes") >>= bPosSizeExcludeAxesProperty;
- if( bUseFixedInnerSize || bPosSizeExcludeAxesProperty )
+ if (rParam.mbUseFixedInnerSize || bPosSizeExcludeAxesProperty)
{
aPos = awt::Point( m_aResultingDiagramRectangleExcludingAxes.X, m_aResultingDiagramRectangleExcludingAxes.Y );
aSize = awt::Size( m_aResultingDiagramRectangleExcludingAxes.Width, m_aResultingDiagramRectangleExcludingAxes.Height );
@@ -3080,7 +3081,7 @@ void ChartView::createShapes2D( const awt::Size& rPageSize )
if (aParam.maRemainingSpace.Width <= 0 || aParam.maRemainingSpace.Height <= 0)
return;
- if (!createAxisTitleShapes2D(rPageSize, aParam))
+ if (!createAxisTitleShapes2D(aParam, rPageSize))
return;
bool bDummy = false;
@@ -3091,9 +3092,8 @@ void ChartView::createShapes2D( const awt::Size& rPageSize )
awt::Point aAvailablePosDia(aParam.maRemainingSpace.X, aParam.maRemainingSpace.Y);
awt::Size aAvailableSizeForDiagram(aParam.maRemainingSpace.Width, aParam.maRemainingSpace.Height);
- awt::Rectangle aUsedOuterRect = impl_createDiagramAndContent( aSeriesPlotterContainer
- , xDiagramPlusAxes_Shapes
- , aAvailablePosDia ,aAvailableSizeForDiagram, rPageSize, aParam.mbUseFixedInnerSize, xDiagram_MarkHandles );
+ awt::Rectangle aUsedOuterRect = impl_createDiagramAndContent(
+ aSeriesPlotterContainer, xDiagramPlusAxes_Shapes, aParam, rPageSize, xDiagram_MarkHandles);
if( xDiagram_OuterRect.is() )
{
@@ -3159,7 +3159,7 @@ void ChartView::createShapes2D( const awt::Size& rPageSize )
}
}
-bool ChartView::createAxisTitleShapes2D( const css::awt::Size& rPageSize, CreateShapeParam2D& rParam )
+bool ChartView::createAxisTitleShapes2D( CreateShapeParam2D& rParam, const css::awt::Size& rPageSize )
{
uno::Reference<XDiagram> xDiagram = mrChartModel.getFirstDiagram();
commit d4a6d85cef5a0773f9c9679727191e3f0d871002
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Sep 19 14:51:33 2014 -0400
Refactor getAvailablePosAndSizeForDiagram() to use CreateShapeParam2D.
Re-use its maRemainingSpace member to keep track of available space.
Change-Id: I28fdaf11c4ab895cd09a5b6c7ea3da7c730044d5
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 34f0ee1..70e1494 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -148,12 +148,15 @@ struct CreateShapeParam2D
bool mbAutoPosSecondTitleX;
bool mbAutoPosSecondTitleY;
+ bool mbUseFixedInnerSize;
+
CreateShapeParam2D() :
mbAutoPosTitleX(true),
mbAutoPosTitleY(true),
mbAutoPosTitleZ(true),
mbAutoPosSecondTitleX(true),
- mbAutoPosSecondTitleY(true) {}
+ mbAutoPosSecondTitleY(true),
+ mbUseFixedInnerSize(false) {}
};
class GL2DRenderer : public IRenderer
@@ -2105,25 +2108,19 @@ double lcl_getPageLayoutDistancePercentage()
}
bool getAvailablePosAndSizeForDiagram(
- awt::Point& rOutPos, awt::Size& rOutAvailableDiagramSize
- , const awt::Rectangle& rSpaceLeft
- , const awt::Size & rPageSize
- , const uno::Reference< XDiagram > & xDiagram
- , bool& bUseFixedInnerSize )
+ CreateShapeParam2D& rParam, const awt::Size & rPageSize, const uno::Reference<XDiagram>& xDiagram )
{
- bUseFixedInnerSize = false;
+ rParam.mbUseFixedInnerSize = false;
//@todo: we need a size dependent on the axis labels
- awt::Rectangle aRemainingSpace(rSpaceLeft);
- {
- sal_Int32 nYDistance = static_cast<sal_Int32>(rPageSize.Height*lcl_getPageLayoutDistancePercentage());
- sal_Int32 nXDistance = static_cast<sal_Int32>(rPageSize.Width*lcl_getPageLayoutDistancePercentage());
- aRemainingSpace.X+=nXDistance;
- aRemainingSpace.Width-=2*nXDistance;
- aRemainingSpace.Y+=nYDistance;
- aRemainingSpace.Height-=2*nYDistance;
- }
- if(aRemainingSpace.Width <= 0 || aRemainingSpace.Height <= 0 )
+ sal_Int32 nYDistance = static_cast<sal_Int32>(rPageSize.Height*lcl_getPageLayoutDistancePercentage());
+ sal_Int32 nXDistance = static_cast<sal_Int32>(rPageSize.Width*lcl_getPageLayoutDistancePercentage());
+ rParam.maRemainingSpace.X += nXDistance;
+ rParam.maRemainingSpace.Width -= 2*nXDistance;
+ rParam.maRemainingSpace.Y += nYDistance;
+ rParam.maRemainingSpace.Height -= 2*nYDistance;
+
+ if (rParam.maRemainingSpace.Width <= 0 || rParam.maRemainingSpace.Height <= 0)
return false;
uno::Reference< beans::XPropertySet > xProp(xDiagram, uno::UNO_QUERY);
@@ -2136,12 +2133,10 @@ bool getAvailablePosAndSizeForDiagram(
::com::sun::star::chart2::RelativeSize aRelativeSize;
if( xProp.is() && (xProp->getPropertyValue( "RelativeSize" )>>=aRelativeSize) )
{
- rOutAvailableDiagramSize.Height = static_cast<sal_Int32>(aRelativeSize.Secondary*rPageSize.Height);
- rOutAvailableDiagramSize.Width = static_cast<sal_Int32>(aRelativeSize.Primary*rPageSize.Width);
- bUseFixedInnerSize = bPosSizeExcludeAxes;
+ rParam.maRemainingSpace.Height = static_cast<sal_Int32>(aRelativeSize.Secondary*rPageSize.Height);
+ rParam.maRemainingSpace.Width = static_cast<sal_Int32>(aRelativeSize.Primary*rPageSize.Width);
+ rParam.mbUseFixedInnerSize = bPosSizeExcludeAxes;
}
- else
- rOutAvailableDiagramSize = awt::Size(aRemainingSpace.Width,aRemainingSpace.Height);
//position:
chart2::RelativePosition aRelativePosition;
@@ -2153,21 +2148,23 @@ bool getAvailablePosAndSizeForDiagram(
double fX = aRelativePosition.Primary*rPageSize.Width;
double fY = aRelativePosition.Secondary*rPageSize.Height;
- rOutPos = RelativePositionHelper::getUpperLeftCornerOfAnchoredObject(
- awt::Point(static_cast<sal_Int32>(fX),static_cast<sal_Int32>(fY))
- , rOutAvailableDiagramSize, aRelativePosition.Anchor );
- bUseFixedInnerSize = bPosSizeExcludeAxes;
+ awt::Point aPos = RelativePositionHelper::getUpperLeftCornerOfAnchoredObject(
+ awt::Point(static_cast<sal_Int32>(fX),static_cast<sal_Int32>(fY)),
+ awt::Size(rParam.maRemainingSpace.Width, rParam.maRemainingSpace.Height),
+ aRelativePosition.Anchor);
+
+ rParam.maRemainingSpace.X = aPos.X;
+ rParam.maRemainingSpace.Y = aPos.Y;
+
+ rParam.mbUseFixedInnerSize = bPosSizeExcludeAxes;
}
- else
- rOutPos = awt::Point(aRemainingSpace.X,aRemainingSpace.Y);
//ensure that the diagram does not lap out right side or out of bottom
- {
- if( rOutPos.Y + rOutAvailableDiagramSize.Height > rPageSize.Height )
- rOutAvailableDiagramSize.Height = rPageSize.Height - rOutPos.Y;
- if( rOutPos.X + rOutAvailableDiagramSize.Width > rPageSize.Width )
- rOutAvailableDiagramSize.Width = rPageSize.Width - rOutPos.X;
- }
+ if (rParam.maRemainingSpace.Y + rParam.maRemainingSpace.Height > rPageSize.Height)
+ rParam.maRemainingSpace.Height = rPageSize.Height - rParam.maRemainingSpace.Y;
+
+ if (rParam.maRemainingSpace.X + rParam.maRemainingSpace.Width > rPageSize.Width)
+ rParam.maRemainingSpace.Width = rPageSize.Width - rParam.maRemainingSpace.X;
return true;
}
@@ -3086,18 +3083,17 @@ void ChartView::createShapes2D( const awt::Size& rPageSize )
if (!createAxisTitleShapes2D(rPageSize, aParam))
return;
- awt::Point aAvailablePosDia;
- awt::Size aAvailableSizeForDiagram;
- bool bUseFixedInnerSize = false;
bool bDummy = false;
bool bIsVertical = DiagramHelper::getVertical(xDiagram, bDummy, bDummy);
- if (getAvailablePosAndSizeForDiagram(
- aAvailablePosDia, aAvailableSizeForDiagram, aParam.maRemainingSpace, rPageSize, mrChartModel.getFirstDiagram(), bUseFixedInnerSize))
+ if (getAvailablePosAndSizeForDiagram(aParam, rPageSize, mrChartModel.getFirstDiagram()))
{
+ awt::Point aAvailablePosDia(aParam.maRemainingSpace.X, aParam.maRemainingSpace.Y);
+ awt::Size aAvailableSizeForDiagram(aParam.maRemainingSpace.Width, aParam.maRemainingSpace.Height);
+
awt::Rectangle aUsedOuterRect = impl_createDiagramAndContent( aSeriesPlotterContainer
, xDiagramPlusAxes_Shapes
- , aAvailablePosDia ,aAvailableSizeForDiagram, rPageSize, bUseFixedInnerSize, xDiagram_MarkHandles );
+ , aAvailablePosDia ,aAvailableSizeForDiagram, rPageSize, aParam.mbUseFixedInnerSize, xDiagram_MarkHandles );
if( xDiagram_OuterRect.is() )
{
More information about the Libreoffice-commits
mailing list