summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-06-07 13:03:58 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2018-06-08 01:29:32 +0200
commit5708534b942c1d0ce384f6a8473da6bb569410e7 (patch)
tree2ec4fe87624541c15bf89c8b839e8f8dba8a89f4 /chart2
parent1e55a47e89a9d9d6cf9cb3993484022aaf2c097b (diff)
look for unnecessary calls to Reference::is() after an UNO_QUERY_THROW
Since the previous call would throw if there was nothing to be assigned to the value. Idea from tml. Used the following script to find places: git grep -A3 -n UNO_QUERY_THROW | grep -B3 -F 'is()' Change-Id: I36ba7b00bcd014bdf16c0455ab91056f82194969 Reviewed-on: https://gerrit.libreoffice.org/55417 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tor Lillqvist <tml@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/qa/extras/chart2_trendcalculators.cxx1
-rw-r--r--chart2/qa/extras/chart2dump/chart2dump.cxx19
-rw-r--r--chart2/qa/extras/chart2export.cxx3
-rw-r--r--chart2/qa/extras/chart2import.cxx12
-rw-r--r--chart2/qa/extras/charttest.hxx28
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx42
-rw-r--r--chart2/source/model/main/ChartModel_Persistence.cxx1
-rw-r--r--chart2/source/model/template/StockDataInterpreter.cxx1
-rw-r--r--chart2/source/tools/AxisHelper.cxx75
-rw-r--r--chart2/source/tools/ChartTypeHelper.cxx3
-rw-r--r--chart2/source/tools/DiagramHelper.cxx2
-rw-r--r--chart2/source/view/main/ChartView.cxx3
12 files changed, 56 insertions, 134 deletions
diff --git a/chart2/qa/extras/chart2_trendcalculators.cxx b/chart2/qa/extras/chart2_trendcalculators.cxx
index 42e1f52e467e..a889b6637eb7 100644
--- a/chart2/qa/extras/chart2_trendcalculators.cxx
+++ b/chart2/qa/extras/chart2_trendcalculators.cxx
@@ -84,7 +84,6 @@ void Chart2TrendCalculators::loadCalculatorFromSheet(sal_Int32 nSheet)
CPPUNIT_ASSERT(xDataSeries.is());
Reference<chart2::XRegressionCurveContainer> xRegressionCurveContainer(xDataSeries, UNO_QUERY_THROW);
- CPPUNIT_ASSERT( xRegressionCurveContainer.is() );
Sequence< Reference< chart2::XRegressionCurve > > xRegressionCurveSequence = xRegressionCurveContainer->getRegressionCurves();
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xRegressionCurveSequence.getLength());
diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx b/chart2/qa/extras/chart2dump/chart2dump.cxx
index 7e8cd9b2a2f6..ceb818c70e0f 100644
--- a/chart2/qa/extras/chart2dump/chart2dump.cxx
+++ b/chart2/qa/extras/chart2dump/chart2dump.cxx
@@ -295,7 +295,6 @@ DECLARE_DUMP_TEST(ChartDataTest, Chart2DumpTest, false)
setTestFileName(aTestFile);
load(getTestFileDirName(), getTestFileName());
uno::Reference< chart::XChartDocument > xChartDoc (getChartDocFromSheet(0, mxComponent), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartDoc.is());
// Check title
uno::Reference< chart2::XChartDocument > xChartDoc2(xChartDoc, UNO_QUERY_THROW);
@@ -344,7 +343,6 @@ DECLARE_DUMP_TEST(ChartDataTest, Chart2DumpTest, false)
// Check column labels
uno::Reference< chart::XChartDataArray > xChartData(xChartDoc->getData(), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartData.is());
uno::Sequence < OUString > aColumnLabels = xChartData->getColumnDescriptions();
CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aColumnLabels.getLength());
OUString sColumnLabels = sequenceToOneLineString(aColumnLabels);
@@ -410,7 +408,6 @@ DECLARE_DUMP_TEST(LegendTest, Chart2DumpTest, false)
setTestFileName(aTestFile);
load(getTestFileDirName(), getTestFileName());
uno::Reference< chart::XChartDocument > xChartDoc(getChartDocFromDrawImpress(0, 0), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartDoc.is());
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, uno::UNO_QUERY);
uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
uno::Reference<drawing::XShapes> xShapes(xDrawPage->getByIndex(0), uno::UNO_QUERY);
@@ -451,7 +448,6 @@ DECLARE_DUMP_TEST(LegendTest, Chart2DumpTest, false)
// Check transformation
Reference< beans::XPropertySet > xLegendEntryPropSet(xLegendEntry, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xLegendEntryPropSet.is());
drawing::HomogenMatrix3 aLegendEntryTransformation;
xLegendEntryPropSet->getPropertyValue("Transformation") >>= aLegendEntryTransformation;
CPPUNIT_DUMP_ASSERT_TRANSFORMATIONS_EQUAL(aLegendEntryTransformation, INT_EPS);*/
@@ -469,7 +465,6 @@ DECLARE_DUMP_TEST(LegendTest, Chart2DumpTest, false)
// Check display color
Reference< beans::XPropertySet > xPropSet(xLegendEntryGeom, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xPropSet.is());
util::Color aEntryGeomColor = 0;
xPropSet->getPropertyValue(UNO_NAME_FILLCOLOR) >>= aEntryGeomColor;
CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(static_cast<sal_Int32>(aEntryGeomColor));
@@ -536,7 +531,6 @@ DECLARE_DUMP_TEST(GridTest, Chart2DumpTest, false)
// Check transformation
Reference< beans::XPropertySet > xPropSet(xGrid, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xPropSet.is());
drawing::HomogenMatrix3 aGridTransformation;
xPropSet->getPropertyValue("Transformation") >>= aGridTransformation;
CPPUNIT_DUMP_ASSERT_TRANSFORMATIONS_EQUAL(aGridTransformation, INT_EPS);
@@ -545,7 +539,6 @@ DECLARE_DUMP_TEST(GridTest, Chart2DumpTest, false)
uno::Reference<container::XIndexAccess> xIndexAccess(xGrid, UNO_QUERY_THROW);
uno::Reference<drawing::XShape> xGridLine(xIndexAccess->getByIndex(0), UNO_QUERY_THROW);
Reference< beans::XPropertySet > xGridLinePropSet(xGridLine, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xGridLinePropSet.is());
// Line type
drawing::LineDash aLineDash;
xGridLinePropSet->getPropertyValue("LineDash") >>= aLineDash;
@@ -581,7 +574,6 @@ DECLARE_DUMP_TEST(AxisGeometryTest, Chart2DumpTest, false)
setTestFileName(sTestFile);
load(getTestFileDirName(), getTestFileName());
uno::Reference< chart::XChartDocument > xChartDoc(getChartDocFromDrawImpress(0, 0), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartDoc.is());
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, uno::UNO_QUERY);
uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
uno::Reference<drawing::XShapes> xShapes(xDrawPage->getByIndex(0), uno::UNO_QUERY);
@@ -609,7 +601,6 @@ DECLARE_DUMP_TEST(AxisGeometryTest, Chart2DumpTest, false)
// Check transformation
Reference< beans::XPropertySet > xPropSet(xXAxis, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xPropSet.is());
drawing::HomogenMatrix3 aAxisTransformation;
xPropSet->getPropertyValue("Transformation") >>= aAxisTransformation;
CPPUNIT_DUMP_ASSERT_TRANSFORMATIONS_EQUAL(aAxisTransformation, INT_EPS);
@@ -620,7 +611,6 @@ DECLARE_DUMP_TEST(AxisGeometryTest, Chart2DumpTest, false)
CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(nAxisGeometriesCount);
uno::Reference<drawing::XShape> xAxisLine(xIndexAccess->getByIndex(0), UNO_QUERY_THROW);
Reference< beans::XPropertySet > xAxisLinePropSet(xAxisLine, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xAxisLinePropSet.is());
// Line type
drawing::LineDash aLineDash;
xAxisLinePropSet->getPropertyValue("LineDash") >>= aLineDash;
@@ -655,7 +645,6 @@ DECLARE_DUMP_TEST(AxisLabelTest, Chart2DumpTest, false)
setTestFileName(sTestFile);
load(getTestFileDirName(), getTestFileName());
uno::Reference< chart::XChartDocument > xChartDoc(getChartDocFromDrawImpress(0, 0), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartDoc.is());
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, uno::UNO_QUERY);
uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
uno::Reference<drawing::XShapes> xShapes(xDrawPage->getByIndex(0), uno::UNO_QUERY);
@@ -705,7 +694,6 @@ DECLARE_DUMP_TEST(AxisLabelTest, Chart2DumpTest, false)
// Check transformation
Reference< beans::XPropertySet > xPropSet(xLabelShape, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xPropSet.is());
/*drawing::HomogenMatrix3 aLabelTransformation;
xPropSet->getPropertyValue("Transformation") >>= aLabelTransformation;
CPPUNIT_DUMP_ASSERT_TRANSFORMATIONS_EQUAL(aLabelTransformation, INT_EPS);*/
@@ -788,7 +776,6 @@ DECLARE_DUMP_TEST(ColumnBarChartTest, Chart2DumpTest, false)
// Check transformation
Reference< beans::XPropertySet > xPropSet(xColumnOrBar, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xPropSet.is());
drawing::HomogenMatrix3 aColumnOrBarTransformation;
xPropSet->getPropertyValue("Transformation") >>= aColumnOrBarTransformation;
CPPUNIT_DUMP_ASSERT_TRANSFORMATIONS_EQUAL(aColumnOrBarTransformation, INT_EPS);
@@ -811,7 +798,6 @@ DECLARE_DUMP_TEST(ChartWallTest, Chart2DumpTest, false)
setTestFileName(sTestFile);
load(getTestFileDirName(), getTestFileName());
uno::Reference< chart::XChartDocument > xChartDoc(getChartDocFromDrawImpress(0, 0), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartDoc.is());
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, uno::UNO_QUERY);
uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
uno::Reference<drawing::XShapes> xShapes(xDrawPage->getByIndex(0), uno::UNO_QUERY);
@@ -830,7 +816,6 @@ DECLARE_DUMP_TEST(ChartWallTest, Chart2DumpTest, false)
// Check transformation
Reference< beans::XPropertySet > xPropSet(xChartWall, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xPropSet.is());
/*drawing::HomogenMatrix3 aChartWallTransformation;
xPropSet->getPropertyValue("Transformation") >>= aChartWallTransformation;
CPPUNIT_DUMP_ASSERT_TRANSFORMATIONS_EQUAL(aChartWallTransformation, INT_EPS);*/
@@ -922,7 +907,6 @@ DECLARE_DUMP_TEST(PieChartTest, Chart2DumpTest, false)
// Check transformation
Reference< beans::XPropertySet > xPropSet(xSlice, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xPropSet.is());
drawing::HomogenMatrix3 aSliceTransformation;
xPropSet->getPropertyValue("Transformation") >>= aSliceTransformation;
CPPUNIT_DUMP_ASSERT_TRANSFORMATIONS_EQUAL(aSliceTransformation, INT_EPS);
@@ -987,7 +971,6 @@ DECLARE_DUMP_TEST(AreaChartTest, Chart2DumpTest, false)
// Check transformation
Reference< beans::XPropertySet > xPropSet(xArea, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xPropSet.is());
drawing::HomogenMatrix3 aAreaTransformation;
xPropSet->getPropertyValue("Transformation") >>= aAreaTransformation;
CPPUNIT_DUMP_ASSERT_TRANSFORMATIONS_EQUAL(aAreaTransformation, INT_EPS);
@@ -1083,7 +1066,6 @@ DECLARE_DUMP_TEST(PointLineChartTest, Chart2DumpTest, false)
{
uno::Reference<container::XIndexAccess> XPointContainer (
getShapeByName(xShapes, "CID/MultiClick/D=0:CS=0:CT=0:Series=" + OUString::number(nSeries) + ":Point=" + OUString::number(nPoint)), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(XPointContainer.is());
uno::Reference<drawing::XShape> XPoint(XPointContainer->getByIndex(0), UNO_QUERY_THROW);
uno::Reference<container::XNamed> xNamedShape(XPointContainer, uno::UNO_QUERY);
CPPUNIT_DUMP_ASSERT_NOTE(xNamedShape->getName());
@@ -1098,7 +1080,6 @@ DECLARE_DUMP_TEST(PointLineChartTest, Chart2DumpTest, false)
// Check transformation
Reference< beans::XPropertySet > xPointPropSet(XPoint, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xPointPropSet.is());
drawing::HomogenMatrix3 aPointTransformation;
xPointPropSet->getPropertyValue("Transformation") >>= aPointTransformation;
CPPUNIT_DUMP_ASSERT_TRANSFORMATIONS_EQUAL(aPointTransformation, INT_EPS);
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index c43433d690a9..8ed59e43cf84 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -432,7 +432,6 @@ void Chart2ExportTest::testErrorBarXLSX()
CPPUNIT_ASSERT( xDataSeries.is() );
Reference< beans::XPropertySet > xPropSet( xDataSeries, UNO_QUERY_THROW );
- CPPUNIT_ASSERT( xPropSet.is() );
// test that y error bars are there
Reference< beans::XPropertySet > xErrorBarYProps;
@@ -449,7 +448,6 @@ void Chart2ExportTest::testErrorBarXLSX()
CPPUNIT_ASSERT( xDataSeries.is() );
Reference< beans::XPropertySet > xPropSet( xDataSeries, UNO_QUERY_THROW );
- CPPUNIT_ASSERT( xPropSet.is() );
// test that y error bars are there
Reference< beans::XPropertySet > xErrorBarYProps;
@@ -1143,7 +1141,6 @@ void Chart2ExportTest::testErrorBarDataRangeODS()
CPPUNIT_ASSERT( xDataSeries.is() );
Reference< beans::XPropertySet > xPropSet( xDataSeries, UNO_QUERY_THROW );
- CPPUNIT_ASSERT( xPropSet.is() );
// test that y error bars are there
Reference< beans::XPropertySet > xErrorBarYProps;
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 4f065d27161e..361b16d43056 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -218,7 +218,6 @@ void Chart2ImportTest::Fdo60083()
CPPUNIT_ASSERT( xDataSeries.is() );
Reference< beans::XPropertySet > xPropSet( xDataSeries, UNO_QUERY_THROW );
- CPPUNIT_ASSERT( xPropSet.is() );
// test that y error bars are there
Reference< beans::XPropertySet > xErrorBarYProps;
@@ -268,7 +267,6 @@ void Chart2ImportTest::testErrorBarRange()
CPPUNIT_ASSERT( xDataSeries.is() );
Reference< beans::XPropertySet > xPropSet( xDataSeries, UNO_QUERY_THROW );
- CPPUNIT_ASSERT( xPropSet.is() );
// test that y error bars are there
Reference< beans::XPropertySet > xErrorBarYProps;
@@ -298,7 +296,6 @@ void Chart2ImportTest::testErrorBarFormatting()
CPPUNIT_ASSERT( xDataSeries.is() );
Reference< beans::XPropertySet > xPropSet( xDataSeries, UNO_QUERY_THROW );
- CPPUNIT_ASSERT( xPropSet.is() );
// test that y error bars are there
Reference< beans::XPropertySet > xErrorBarYProps;
@@ -354,7 +351,6 @@ uno::Sequence < OUString > getChartColumnDescriptions( uno::Reference< chart::XC
{
CPPUNIT_ASSERT(xChart1Doc.is());
uno::Reference< chart::XChartDataArray > xChartData ( xChart1Doc->getData(), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartData.is());
uno::Sequence < OUString > seriesList = xChartData->getColumnDescriptions();
return seriesList;
}
@@ -690,7 +686,6 @@ void Chart2ImportTest::testBnc889755()
{
load("/chart2/qa/extras/data/pptx/", "bnc889755.pptx");
uno::Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 6), uno::UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartDoc.is());
CPPUNIT_ASSERT(xChartDoc->hasInternalDataProvider());
uno::Reference< chart2::XInternalDataProvider > xDataProvider( xChartDoc->getDataProvider(), uno::UNO_QUERY_THROW );
@@ -926,7 +921,6 @@ void Chart2ImportTest::testTextCanOverlapXLSX()
uno::Reference< beans::XPropertySet > xAxisProp;
bool bTextCanOverlap = false;
uno::Reference< chart::XChartDocument > xChartDoc ( getChartCompFromSheet( 0, mxComponent ), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartDoc.is());
mxDiagram.set(xChartDoc->getDiagram());
CPPUNIT_ASSERT(mxDiagram.is());
uno::Reference< chart::XAxisXSupplier > xAxisXSupp( mxDiagram, uno::UNO_QUERY );
@@ -1161,7 +1155,6 @@ void Chart2ImportTest::testPlotVisOnlyDefaultValue2013XLSX()
{
load("/chart2/qa/extras/data/xlsx/", "plotVisOnly.xlsx");
uno::Reference< chart::XChartDocument > xChart1Doc ( getChartCompFromSheet( 0, mxComponent ), UNO_QUERY_THROW);
- CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChart1Doc.is());
Reference<beans::XPropertySet> xPropSet(xChart1Doc->getDiagram(), uno::UNO_QUERY_THROW);
uno::Any aAny = xPropSet->getPropertyValue("IncludeHiddenCells");
CPPUNIT_ASSERT(aAny.hasValue());
@@ -1174,7 +1167,6 @@ void Chart2ImportTest::testRAngAxDefaultValue2013XLSX()
{
load("/chart2/qa/extras/data/xlsx/", "rAngAx.xlsx");
uno::Reference< chart::XChartDocument > xChart1Doc ( getChartCompFromSheet( 0, mxComponent ), UNO_QUERY_THROW);
- CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChart1Doc.is());
Reference<beans::XPropertySet> xPropSet(xChart1Doc->getDiagram(), uno::UNO_QUERY_THROW);
uno::Any aAny = xPropSet->getPropertyValue("RightAngledAxes");
CPPUNIT_ASSERT(aAny.hasValue());
@@ -1328,7 +1320,6 @@ void Chart2ImportTest::testTdf90510()
{
load("/chart2/qa/extras/data/xls/", "piechart_outside.xls");
uno::Reference< chart::XChartDocument > xChart1Doc( getChartCompFromSheet( 0, mxComponent ), UNO_QUERY_THROW );
- CPPUNIT_ASSERT_MESSAGE( "failed to load chart", xChart1Doc.is() );
Reference<beans::XPropertySet> xPropSet( xChart1Doc->getDiagram()->getDataPointProperties( 0, 0 ), uno::UNO_QUERY_THROW );
uno::Any aAny = xPropSet->getPropertyValue( "LabelPlacement" );
CPPUNIT_ASSERT( aAny.hasValue() );
@@ -1341,7 +1332,6 @@ void Chart2ImportTest::testTdf109858()
{
load("/chart2/qa/extras/data/xlsx/", "piechart_outside.xlsx");
uno::Reference< chart::XChartDocument > xChart1Doc( getChartCompFromSheet( 0, mxComponent ), UNO_QUERY_THROW );
- CPPUNIT_ASSERT_MESSAGE( "failed to load chart", xChart1Doc.is() );
Reference<beans::XPropertySet> xPropSet( xChart1Doc->getDiagram()->getDataPointProperties( 0, 0 ), uno::UNO_QUERY_THROW );
uno::Any aAny = xPropSet->getPropertyValue( "LabelPlacement" );
CPPUNIT_ASSERT( aAny.hasValue() );
@@ -1354,7 +1344,6 @@ void Chart2ImportTest::testTdf111173()
{
load("/chart2/qa/extras/data/xlsx/", "tdf111173.xlsx");
uno::Reference< chart::XChartDocument > xChart1Doc( getChartCompFromSheet( 0, mxComponent ), UNO_QUERY_THROW );
- CPPUNIT_ASSERT_MESSAGE( "failed to load chart", xChart1Doc.is() );
}
void Chart2ImportTest::testTdf115107()
@@ -1556,7 +1545,6 @@ void Chart2ImportTest::testTdf116163()
CPPUNIT_ASSERT(xXAxis.is());
uno::Reference<container::XIndexAccess> xIndexAccess(xXAxis, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xIndexAccess.is());
// Check text
uno::Reference<text::XTextRange> xLabel0(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx
index 438565222db4..202475e7e4ca 100644
--- a/chart2/qa/extras/charttest.hxx
+++ b/chart2/qa/extras/charttest.hxx
@@ -184,26 +184,20 @@ Reference< lang::XComponent > getChartCompFromSheet( sal_Int32 nSheet, uno::Refe
// let us assume that we only have one chart per sheet
uno::Reference< sheet::XSpreadsheetDocument > xDoc(xComponent, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xDoc.is());
uno::Reference< container::XIndexAccess > xIA(xDoc->getSheets(), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xIA.is());
uno::Reference< table::XTableChartsSupplier > xChartSupplier( xIA->getByIndex(nSheet), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartSupplier.is());
uno::Reference< table::XTableCharts > xCharts = xChartSupplier->getCharts();
CPPUNIT_ASSERT(xCharts.is());
uno::Reference< container::XIndexAccess > xIACharts(xCharts, UNO_QUERY_THROW);
uno::Reference< table::XTableChart > xChart( xIACharts->getByIndex(0), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChart.is());
uno::Reference< document::XEmbeddedObjectSupplier > xEmbObjectSupplier(xChart, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xEmbObjectSupplier.is());
uno::Reference< lang::XComponent > xChartComp( xEmbObjectSupplier->getEmbeddedObject(), UNO_QUERY_THROW );
- CPPUNIT_ASSERT(xChartComp.is());
return xChartComp;
@@ -212,20 +206,16 @@ Reference< lang::XComponent > getChartCompFromSheet( sal_Int32 nSheet, uno::Refe
Reference< chart2::XChartDocument > getChartDocFromSheet( sal_Int32 nSheet, uno::Reference< lang::XComponent > const & xComponent )
{
uno::Reference< chart2::XChartDocument > xChartDoc ( getChartCompFromSheet(nSheet, xComponent), UNO_QUERY_THROW );
- CPPUNIT_ASSERT(xChartDoc.is());
return xChartDoc;
}
uno::Reference<table::XTablePivotCharts> getTablePivotChartsFromSheet(sal_Int32 nSheet, uno::Reference<lang::XComponent> const & xComponent)
{
uno::Reference<sheet::XSpreadsheetDocument> xDoc(xComponent, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xDoc.is());
uno::Reference<container::XIndexAccess> xIA(xDoc->getSheets(), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xIA.is());
uno::Reference<table::XTablePivotChartsSupplier> xChartSupplier(xIA->getByIndex(nSheet), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartSupplier.is());
uno::Reference<table::XTablePivotCharts> xTablePivotCharts = xChartSupplier->getPivotCharts();
CPPUNIT_ASSERT(xTablePivotCharts.is());
@@ -239,13 +229,10 @@ Reference<lang::XComponent> getPivotChartCompFromSheet(sal_Int32 nSheet, uno::Re
uno::Reference<container::XIndexAccess> xIACharts(xTablePivotCharts, UNO_QUERY_THROW);
uno::Reference<table::XTablePivotChart> xTablePivotChart(xIACharts->getByIndex(0), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xTablePivotChart.is());
uno::Reference<document::XEmbeddedObjectSupplier> xEmbObjectSupplier(xTablePivotChart, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xEmbObjectSupplier.is());
uno::Reference<lang::XComponent> xChartComp(xEmbObjectSupplier->getEmbeddedObject(), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartComp.is());
return xChartComp;
}
@@ -253,7 +240,6 @@ Reference<lang::XComponent> getPivotChartCompFromSheet(sal_Int32 nSheet, uno::Re
Reference<chart2::XChartDocument> getPivotChartDocFromSheet(sal_Int32 nSheet, uno::Reference<lang::XComponent> const & xComponent)
{
uno::Reference<chart2::XChartDocument> xChartDoc(getPivotChartCompFromSheet(nSheet, xComponent), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartDoc.is());
return xChartDoc;
}
@@ -261,16 +247,12 @@ Reference<chart2::XChartDocument> getPivotChartDocFromSheet(uno::Reference<table
{
uno::Reference<container::XIndexAccess> xIACharts(xTablePivotCharts, UNO_QUERY_THROW);
uno::Reference<table::XTablePivotChart> xTablePivotChart(xIACharts->getByIndex(nIndex), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xTablePivotChart.is());
uno::Reference<document::XEmbeddedObjectSupplier> xEmbObjectSupplier(xTablePivotChart, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xEmbObjectSupplier.is());
uno::Reference<lang::XComponent> xChartComp(xEmbObjectSupplier->getEmbeddedObject(), UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartComp.is());
uno::Reference<chart2::XChartDocument> xChartDoc(xChartComp, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartDoc.is());
return xChartDoc;
}
@@ -283,13 +265,11 @@ Reference< chart2::XChartType > getChartTypeFromDoc( Reference< chart2::XChartDo
CPPUNIT_ASSERT( xDiagram.is() );
Reference< chart2::XCoordinateSystemContainer > xCooSysContainer( xDiagram, UNO_QUERY_THROW );
- CPPUNIT_ASSERT( xCooSysContainer.is() );
Sequence< Reference< chart2::XCoordinateSystem > > xCooSysSequence( xCooSysContainer->getCoordinateSystems());
CPPUNIT_ASSERT( xCooSysSequence.getLength() > nCooSys );
Reference< chart2::XChartTypeContainer > xChartTypeContainer( xCooSysSequence[nCooSys], UNO_QUERY_THROW );
- CPPUNIT_ASSERT( xChartTypeContainer.is() );
Sequence< Reference< chart2::XChartType > > xChartTypeSequence( xChartTypeContainer->getChartTypes() );
CPPUNIT_ASSERT( xChartTypeSequence.getLength() > nChartType );
@@ -304,7 +284,6 @@ Reference<chart2::XAxis> getAxisFromDoc(
CPPUNIT_ASSERT(xDiagram.is());
Reference<chart2::XCoordinateSystemContainer> xCooSysContainer(xDiagram, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xCooSysContainer.is());
Sequence<Reference<chart2::XCoordinateSystem> > xCooSysSequence = xCooSysContainer->getCoordinateSystems();
CPPUNIT_ASSERT(xCooSysSequence.getLength() > nCooSys);
@@ -323,7 +302,6 @@ sal_Int32 getNumberOfDataSeries(uno::Reference<chart2::XChartDocument> const & x
{
Reference<chart2::XChartType> xChartType = getChartTypeFromDoc(xChartDoc, nChartType, nCooSys);
Reference<chart2::XDataSeriesContainer> xDataSeriesContainer(xChartType, UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xDataSeriesContainer.is());
uno::Sequence<uno::Reference<chart2::XDataSeries>> xSeriesSequence(xDataSeriesContainer->getDataSeries());
return xSeriesSequence.getLength();
@@ -335,7 +313,6 @@ Reference< chart2::XDataSeries > getDataSeriesFromDoc(uno::Reference<chart2::XCh
{
Reference< chart2::XChartType > xChartType = getChartTypeFromDoc( xChartDoc, nChartType, nCooSys );
Reference< chart2::XDataSeriesContainer > xDataSeriesContainer( xChartType, UNO_QUERY_THROW );
- CPPUNIT_ASSERT ( xDataSeriesContainer.is() );
Sequence< Reference< chart2::XDataSeries > > xSeriesSequence( xDataSeriesContainer->getDataSeries() );
CPPUNIT_ASSERT( xSeriesSequence.getLength() > nDataSeries );
@@ -407,7 +384,6 @@ uno::Sequence < OUString > getWriterChartColumnDescriptions( Reference< lang::XC
CPPUNIT_ASSERT( xChartDoc->getDataProvider().is() );
uno::Reference<beans::XPropertySet> xProp(xChartDoc->getDataProvider(), uno::UNO_QUERY );
uno::Reference< chart2::XAnyDescriptionAccess > xAnyDescriptionAccess ( xChartDoc->getDataProvider(), uno::UNO_QUERY_THROW );
- CPPUNIT_ASSERT( xAnyDescriptionAccess.is() );
uno::Sequence< OUString > seriesList = xAnyDescriptionAccess->getColumnDescriptions();
return seriesList;
}
@@ -503,7 +479,6 @@ uno::Reference< chart::XChartDocument > ChartTest::getChartDocFromImpress( const
uno::Reference< drawing::XDrawPagesSupplier > xDoc(mxComponent, uno::UNO_QUERY_THROW );
uno::Reference< drawing::XDrawPage > xPage(
xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
- CPPUNIT_ASSERT(xPage.is());
uno::Reference< beans::XPropertySet > xShapeProps(
xPage->getByIndex(0), uno::UNO_QUERY );
CPPUNIT_ASSERT(xShapeProps.is());
@@ -526,8 +501,6 @@ uno::Reference<chart::XChartDocument> ChartTest::getChartDocFromDrawImpress(
uno::Reference<drawing::XDrawPage> xPage(
xPages->getDrawPages()->getByIndex(nPage), uno::UNO_QUERY_THROW);
- if (!xPage.is())
- return xEmpty;
uno::Reference<beans::XPropertySet> xShapeProps(xPage->getByIndex(nShape), uno::UNO_QUERY);
if (!xShapeProps.is())
@@ -566,7 +539,6 @@ uno::Sequence < OUString > ChartTest::getImpressChartColumnDescriptions( const O
{
uno::Reference< chart::XChartDocument > xChartDoc = getChartDocFromImpress( pDir, pName );
uno::Reference< chart::XChartDataArray > xChartData ( xChartDoc->getData(), uno::UNO_QUERY_THROW);
- CPPUNIT_ASSERT(xChartData.is());
uno::Sequence < OUString > seriesList = xChartData->getColumnDescriptions();
return seriesList;
}
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index 94d74b0eefe3..5a80655bae99 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -1253,25 +1253,22 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
{
Reference< lang::XMultiServiceFactory > xFact(
m_spChart2ModelContact->m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
- if( xFact.is() )
+ Reference< lang::XInitialization > xViewInit( xFact->createInstance(
+ CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
+ if(xViewInit.is())
{
- Reference< lang::XInitialization > xViewInit( xFact->createInstance(
- CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
- if(xViewInit.is())
+ try
{
- try
- {
- m_xChartView = xViewInit;
-
- Sequence< Any > aArguments(2);
- aArguments[0] <<= Reference<frame::XModel>(this);
- aArguments[1] <<= true; // bRefreshAddIn
- xViewInit->initialize(aArguments);
- }
- catch (const uno::Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
+ m_xChartView = xViewInit;
+
+ Sequence< Any > aArguments(2);
+ aArguments[0] <<= Reference<frame::XModel>(this);
+ aArguments[1] <<= true; // bRefreshAddIn
+ xViewInit->initialize(aArguments);
+ }
+ catch (const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
}
}
}
@@ -1316,14 +1313,11 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
{
Reference< lang::XMultiServiceFactory > xFact(
m_spChart2ModelContact->m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
- if( xFact.is() )
+ uno::Reference< util::XRefreshable > xAddIn(
+ xFact->createInstance( aServiceSpecifier ), uno::UNO_QUERY );
+ if( xAddIn.is() )
{
- uno::Reference< util::XRefreshable > xAddIn(
- xFact->createInstance( aServiceSpecifier ), uno::UNO_QUERY );
- if( xAddIn.is() )
- {
- xResult = xAddIn;
- }
+ xResult = xAddIn;
}
}
catch (const uno::Exception&)
diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx
index cdc0d0338a02..dabde5d32ba4 100644
--- a/chart2/source/model/main/ChartModel_Persistence.cxx
+++ b/chart2/source/model/main/ChartModel_Persistence.cxx
@@ -129,7 +129,6 @@ Reference< embed::XStorage > lcl_createStorage(
aStorageArgs[2] <<= rMediaDescriptor;
xStorage.set(
xStorageFact->createInstanceWithArguments( aStorageArgs ), uno::UNO_QUERY_THROW );
- OSL_ENSURE( xStorage.is(), "No Storage" );
}
catch(const css::ucb::ContentCreationException&)
{
diff --git a/chart2/source/model/template/StockDataInterpreter.cxx b/chart2/source/model/template/StockDataInterpreter.cxx
index f766d41aaed9..a6db346a44ea 100644
--- a/chart2/source/model/template/StockDataInterpreter.cxx
+++ b/chart2/source/model/template/StockDataInterpreter.cxx
@@ -240,7 +240,6 @@ InterpretedData SAL_CALL StockDataInterpreter::interpretDataSource(
xSeries.set( new DataSeries );
OSL_ASSERT( xSeries.is() );
Reference< data::XDataSink > xSink( xSeries, uno::UNO_QUERY_THROW );
- OSL_ASSERT( xSink.is() );
xSink->setData( aSequences[nGroupIndex][nSeriesIdx] );
aResultSeries[nGroupIndex][nSeriesIdx].set( xSeries );
}
diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx
index 84c008612332..4a9cf9218641 100644
--- a/chart2/source/tools/AxisHelper.cxx
+++ b/chart2/source/tools/AxisHelper.cxx
@@ -239,52 +239,49 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
try
{
Reference< XChartTypeContainer > xCTCnt( xCorrespondingCoordinateSystem, uno::UNO_QUERY_THROW );
- if( xCTCnt.is() )
+ OUString aRoleToMatch;
+ if( nDimensionIndex == 0 )
+ aRoleToMatch = "values-x";
+ Sequence< Reference< XChartType > > aChartTypes( xCTCnt->getChartTypes());
+ for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
{
- OUString aRoleToMatch;
- if( nDimensionIndex == 0 )
- aRoleToMatch = "values-x";
- Sequence< Reference< XChartType > > aChartTypes( xCTCnt->getChartTypes());
- for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
+ if( nDimensionIndex != 0 )
+ aRoleToMatch = ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( aChartTypes[nCTIdx] );
+ Reference< XDataSeriesContainer > xDSCnt( aChartTypes[nCTIdx], uno::UNO_QUERY_THROW );
+ Sequence< Reference< XDataSeries > > aDataSeriesSeq( xDSCnt->getDataSeries());
+ for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aDataSeriesSeq.getLength(); ++nSeriesIdx )
{
- if( nDimensionIndex != 0 )
- aRoleToMatch = ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( aChartTypes[nCTIdx] );
- Reference< XDataSeriesContainer > xDSCnt( aChartTypes[nCTIdx], uno::UNO_QUERY_THROW );
- Sequence< Reference< XDataSeries > > aDataSeriesSeq( xDSCnt->getDataSeries());
- for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aDataSeriesSeq.getLength(); ++nSeriesIdx )
- {
- Reference< chart2::XDataSeries > xDataSeries(aDataSeriesSeq[nSeriesIdx]);
- Reference< data::XDataSource > xSource( xDataSeries, uno::UNO_QUERY_THROW );
+ Reference< chart2::XDataSeries > xDataSeries(aDataSeriesSeq[nSeriesIdx]);
+ Reference< data::XDataSource > xSource( xDataSeries, uno::UNO_QUERY_THROW );
- if( nDimensionIndex == 1 )
- {
- //only take those series into account that are attached to this axis
- sal_Int32 nAttachedAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries);
- if( nAttachedAxisIndex != nAxisIndex )
- continue;
- }
+ if( nDimensionIndex == 1 )
+ {
+ //only take those series into account that are attached to this axis
+ sal_Int32 nAttachedAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries);
+ if( nAttachedAxisIndex != nAxisIndex )
+ continue;
+ }
- Reference< data::XLabeledDataSequence > xLabeledSeq(
- DataSeriesHelper::getDataSequenceByRole( xSource, aRoleToMatch ) );
+ Reference< data::XLabeledDataSequence > xLabeledSeq(
+ DataSeriesHelper::getDataSequenceByRole( xSource, aRoleToMatch ) );
- if( !xLabeledSeq.is() && nDimensionIndex==0 )
- {
- ScaleData aData = xAxis->getScaleData();
- xLabeledSeq = aData.Categories;
- }
+ if( !xLabeledSeq.is() && nDimensionIndex==0 )
+ {
+ ScaleData aData = xAxis->getScaleData();
+ xLabeledSeq = aData.Categories;
+ }
- if( xLabeledSeq.is() )
+ if( xLabeledSeq.is() )
+ {
+ Reference< data::XDataSequence > xSeq( xLabeledSeq->getValues());
+ if( xSeq.is() )
{
- Reference< data::XDataSequence > xSeq( xLabeledSeq->getValues());
- if( xSeq.is() )
- {
- sal_Int32 nKey = xSeq->getNumberFormatKeyByIndex( -1 );
- // initialize the value
- if( aKeyMap.find( nKey ) == aKeyMap.end())
- aKeyMap[ nKey ] = 0;
- // increase frequency
- aKeyMap[ nKey ] = (aKeyMap[ nKey ] + 1);
- }
+ sal_Int32 nKey = xSeq->getNumberFormatKeyByIndex( -1 );
+ // initialize the value
+ if( aKeyMap.find( nKey ) == aKeyMap.end())
+ aKeyMap[ nKey ] = 0;
+ // increase frequency
+ aKeyMap[ nKey ] = (aKeyMap[ nKey ] + 1);
}
}
}
diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx
index 23aa42efed73..658855d6380b 100644
--- a/chart2/source/tools/ChartTypeHelper.cxx
+++ b/chart2/source/tools/ChartTypeHelper.cxx
@@ -248,8 +248,7 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const
{
bool bDonut = false;
uno::Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY_THROW );
- if(xChartTypeProp.is())
- xChartTypeProp->getPropertyValue( "UseRings") >>= bDonut;
+ xChartTypeProp->getPropertyValue( "UseRings") >>= bDonut;
if(!bDonut)
{
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index 801c40e2ce52..652a4e468841 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -578,8 +578,6 @@ bool DiagramHelper::attachSeriesToAxis( bool bAttachToMainAxis
//set property at axis
Reference< beans::XPropertySet > xProp( xDataSeries, uno::UNO_QUERY_THROW );
- if( !xProp.is() )
- return bChanged;
sal_Int32 nNewAxisIndex = bAttachToMainAxis ? 0 : 1;
sal_Int32 nOldAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries);
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 22f268b19a4a..259b58ce7779 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1808,8 +1808,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
bool bPosSizeExcludeAxesProperty = true;
uno::Reference< beans::XPropertySet > xDiaProps( xDiagram, uno::UNO_QUERY_THROW );
- if( xDiaProps.is() )
- xDiaProps->getPropertyValue("PosSizeExcludeAxes") >>= bPosSizeExcludeAxesProperty;
+ xDiaProps->getPropertyValue("PosSizeExcludeAxes") >>= bPosSizeExcludeAxesProperty;
if (rParam.mbUseFixedInnerSize || bPosSizeExcludeAxesProperty)
{
aPos = awt::Point( m_aResultingDiagramRectangleExcludingAxes.X, m_aResultingDiagramRectangleExcludingAxes.Y );