include/svx/xgrad.hxx | 1 svx/source/xoutdev/xattr.cxx | 16 ----- sw/qa/extras/rtfexport/rtfexport.cxx | 10 ++- sw/qa/extras/rtfimport/rtfimport.cxx | 101 ++++++++++++++++------------------- sw/source/core/doc/docbm.cxx | 3 - unusedcode.easy | 1 6 files changed, 55 insertions(+), 77 deletions(-)
New commits: commit 8ae06100856964d849e8c6ecbc85cbb44bcf0414 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri May 16 22:19:37 2014 +0200 coverity#704866 Unchecked dynamic_cast Change-Id: Ib1108a6641635bbbb0d88968754d7bb19a8c9e73 diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index b28239f..72764a6 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -486,7 +486,8 @@ namespace sw { namespace mark sw::mark::IMark* pMark = makeMark( rPaM, rName, IDocumentMarkAccess::CHECKBOX_FIELDMARK ); sw::mark::IFieldmark* pFieldMark = dynamic_cast<sw::mark::IFieldmark*>( pMark ); - pFieldMark->SetFieldname( rType ); + if (pFieldMark) + pFieldMark->SetFieldname( rType ); return pFieldMark; } commit 5bbc90be755aae4b87125f9d748828d74efe645d Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri May 16 22:17:11 2014 +0200 unused XGradient::VclGradient Change-Id: Ia0c416ce7c1323f9c0c20b969bd57e9a2174a3dc diff --git a/include/svx/xgrad.hxx b/include/svx/xgrad.hxx index 30c1741..b97d0c0 100644 --- a/include/svx/xgrad.hxx +++ b/include/svx/xgrad.hxx @@ -75,7 +75,6 @@ public: sal_uInt16 GetStartIntens() const { return nIntensStart; } sal_uInt16 GetEndIntens() const { return nIntensEnd; } sal_uInt16 GetSteps() const { return nStepCount; } - Gradient VclGradient() const; }; #endif diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 84b1f0a..b9dfb6a 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -2511,22 +2511,6 @@ bool XGradient::operator==(const XGradient& rGradient) const nStepCount == rGradient.nStepCount ); } -Gradient XGradient::VclGradient() const -{ - Gradient aGradient; - aGradient.SetStyle((GradientStyle)eStyle); - aGradient.SetStartColor(aStartColor); - aGradient.SetEndColor(aEndColor); - aGradient.SetAngle(nAngle); - aGradient.SetBorder(nBorder); - aGradient.SetOfsX(nOfsX); - aGradient.SetOfsY(nOfsY); - aGradient.SetStartIntensity(nIntensStart); - aGradient.SetEndIntensity(nIntensEnd); - aGradient.SetSteps(nStepCount); - return aGradient; -} - // class XFillGradientItem TYPEINIT1_AUTOFACTORY(XFillGradientItem, NameOrIndex); diff --git a/unusedcode.easy b/unusedcode.easy index 5e769ec..e75d512 100644 --- a/unusedcode.easy +++ b/unusedcode.easy @@ -59,7 +59,6 @@ VCLXGraphics::getLineColor() VCLXGraphics::getRasterOp() VCLXGraphics::getTextColor() VCLXGraphics::getTextFillColor() -XGradient::VclGradient() const apitest::CellProperties::testRotateReference() apitest::CellProperties::testVertJustify() apitest::DataPilotField::testAutoShowInfo() commit 04ab7b8e16af993c3269e3780e5234903cdc0cf1 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri May 16 22:11:51 2014 +0200 sw: fix indentation in rtf{export,import} test Change-Id: Ie777de47dc70da136b145028a08ea17a0de7a87d diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index c395ec9..9a38b49 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -30,9 +30,11 @@ class Test : public SwModelTestBase public: Test() : SwModelTestBase("/sw/qa/extras/rtfexport/data/", "Rich Text Format") {} - bool mustTestImportOf(const char* filename) const SAL_OVERRIDE { + bool mustTestImportOf(const char* filename) const SAL_OVERRIDE + { // Don't test the first import of these, for some reason those tests fail - const char* aBlacklist[] = { + const char* aBlacklist[] = + { "math-eqarray.rtf", "math-escaping.rtf", "math-lim.rtf", @@ -230,7 +232,7 @@ DECLARE_RTFEXPORT_TEST(testMathMso2007, "math-mso2007.rtf") aActual = getFormula(getRun(getParagraph(4), 1)); aExpected = OUString("f left (x right ) = {a} rsub {0} + sum from {n = 1} to {\xe2\x88\x9e} {left ({a} rsub {n} cos {n\xcf\x80x} over {L} + {b} rsub {n} sin {n\xcf\x80x} over {L} right )}", 144, - RTL_TEXTENCODING_UTF8); + RTL_TEXTENCODING_UTF8); CPPUNIT_ASSERT_EQUAL(aExpected, aActual); aActual = getFormula(getRun(getParagraph(5), 1)); @@ -355,7 +357,7 @@ DECLARE_RTFEXPORT_TEST(testFdo55939, "fdo55939.odt") getRun(xParagraph, 1, "Main text before footnote."); // Why the tab has to be removed here? CPPUNIT_ASSERT_EQUAL(OUString("Footnote text."), - getProperty< uno::Reference<text::XTextRange> >(getRun(xParagraph, 2), "Footnote")->getText()->getString().replaceAll("\t", "")); + getProperty< uno::Reference<text::XTextRange> >(getRun(xParagraph, 2), "Footnote")->getText()->getString().replaceAll("\t", "")); getRun(xParagraph, 3, " Text after the footnote."); // However, this leading space is intentional and OK. } diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 5e8f0a0..e96f037 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -127,9 +127,9 @@ DECLARE_RTFIMPORT_TEST(testFdo45553, "fdo45553.rtf") { uno::Reference<text::XTextRange> xRange(xRangeEnum->nextElement(), uno::UNO_QUERY); OUString aStr = xRange->getString(); - if ( aStr == "space-before" ) + if (aStr == "space-before") CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(120)), getProperty<sal_Int32>(xRange, "ParaTopMargin")); - else if ( aStr == "space-after" ) + else if (aStr == "space-after") CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(240)), getProperty<sal_Int32>(xRange, "ParaBottomMargin")); } } @@ -140,7 +140,7 @@ DECLARE_RTFIMPORT_TEST(testN192129, "n192129.rtf") // We expect that the result will be 16x16px. Size aExpectedSize(16, 16); MapMode aMap(MAP_100TH_MM); - aExpectedSize = Application::GetDefaultDevice()->PixelToLogic( aExpectedSize, aMap ); + aExpectedSize = Application::GetDefaultDevice()->PixelToLogic(aExpectedSize, aMap); uno::Reference<text::XTextGraphicObjectsSupplier> xTextGraphicObjectsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xIndexAccess(xTextGraphicObjectsSupplier->getGraphicObjects(), uno::UNO_QUERY); @@ -230,9 +230,9 @@ DECLARE_RTFIMPORT_TEST(testFdo46662, "fdo46662.rtf") { const beans::PropertyValue& rProp = aProps[i]; - if ( rProp.Name == "ParentNumbering" ) + if (rProp.Name == "ParentNumbering") CPPUNIT_ASSERT_EQUAL(sal_Int16(2), rProp.Value.get<sal_Int16>()); - else if ( rProp.Name == "Suffix" ) + else if (rProp.Name == "Suffix") CPPUNIT_ASSERT_EQUAL(sal_Int32(0), rProp.Value.get<OUString>().getLength()); } } @@ -922,12 +922,12 @@ DECLARE_RTFIMPORT_TEST(testFdo58933, "fdo58933.rtf") DECLARE_RTFIMPORT_TEST(testFdo44053, "fdo44053.rtf") { uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY); // The with of the table's A1 and A2 cell should equal. CPPUNIT_ASSERT_EQUAL(getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position, - getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position); + getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position); } DECLARE_RTFIMPORT_TEST(testFdo48440, "fdo48440.rtf") @@ -1409,33 +1409,31 @@ DECLARE_RTFIMPORT_TEST(testNestedTable, "rhbz1065629.rtf") xTable.set(xTables->getByIndex(2), uno::UNO_QUERY); xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY); CPPUNIT_ASSERT(xCell.is()); - table::BorderLine2 fullPtSolid( - 1, 0, 35, 0, table::BorderLineStyle::SOLID, 35); + table::BorderLine2 fullPtSolid(1, 0, 35, 0, table::BorderLineStyle::SOLID, 35); CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid, - getProperty<table::BorderLine2>(xCell, "LeftBorder")); + getProperty<table::BorderLine2>(xCell, "LeftBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid, - getProperty<table::BorderLine2>(xCell, "RightBorder")); + getProperty<table::BorderLine2>(xCell, "RightBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid, - getProperty<table::BorderLine2>(xCell, "TopBorder")); + getProperty<table::BorderLine2>(xCell, "TopBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(fullPtSolid, - getProperty<table::BorderLine2>(xCell, "BottomBorder")); + getProperty<table::BorderLine2>(xCell, "BottomBorder")); CPPUNIT_ASSERT_EQUAL(sal_Int32(0xCC0000), getProperty<sal_Int32>(xCell, "BackColor")); xCell.set(xTable->getCellByName("A2"), uno::UNO_QUERY); CPPUNIT_ASSERT(xCell.is()); - table::BorderLine2 halfPtSolid( - /*0*/1, 0, 18, 0, table::BorderLineStyle::SOLID, 18); + table::BorderLine2 halfPtSolid(/*0*/1, 0, 18, 0, table::BorderLineStyle::SOLID, 18); CPPUNIT_ASSERT_BORDER_EQUAL(halfPtSolid, - getProperty<table::BorderLine2>(xCell, "LeftBorder")); + getProperty<table::BorderLine2>(xCell, "LeftBorder")); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xffffffff), - getProperty<sal_Int32>(xCell, "BackColor")); + getProperty<sal_Int32>(xCell, "BackColor")); xCell.set(xTable->getCellByName("B2"), uno::UNO_QUERY); CPPUNIT_ASSERT(xCell.is()); CPPUNIT_ASSERT_BORDER_EQUAL(halfPtSolid, - getProperty<table::BorderLine2>(xCell, "LeftBorder")); + getProperty<table::BorderLine2>(xCell, "LeftBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(halfPtSolid, - getProperty<table::BorderLine2>(xCell, "RightBorder")); + getProperty<table::BorderLine2>(xCell, "RightBorder")); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xffffffff), - getProperty<sal_Int32>(xCell, "BackColor")); + getProperty<sal_Int32>(xCell, "BackColor")); // \sect at the end resulted in spurious page break CPPUNIT_ASSERT_EQUAL(1, getPages()); @@ -1446,21 +1444,21 @@ DECLARE_RTFIMPORT_TEST(testContSectionPageBreak, "cont-section-pagebreak.rtf") uno::Reference<text::XTextRange> xParaSecond = getParagraph(2); CPPUNIT_ASSERT_EQUAL(OUString("SECOND"), xParaSecond->getString()); CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, - getProperty<style::BreakType>(xParaSecond, "BreakType")); + getProperty<style::BreakType>(xParaSecond, "BreakType")); CPPUNIT_ASSERT_EQUAL(OUString(""), - getProperty<OUString>(xParaSecond, "PageDescName")); + getProperty<OUString>(xParaSecond, "PageDescName")); // actually not sure how many paragraph there should be between // SECOND and THIRD - important is that the page break is on there uno::Reference<text::XTextRange> xParaNext = getParagraph(3); CPPUNIT_ASSERT_EQUAL(OUString(""), xParaNext->getString()); CPPUNIT_ASSERT_EQUAL(OUString("Converted1"), - getProperty<OUString>(xParaNext, "PageDescName")); + getProperty<OUString>(xParaNext, "PageDescName")); uno::Reference<text::XTextRange> xParaThird = getParagraph(4); CPPUNIT_ASSERT_EQUAL(OUString("THIRD"), xParaThird->getString()); CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, - getProperty<style::BreakType>(xParaThird, "BreakType")); + getProperty<style::BreakType>(xParaThird, "BreakType")); CPPUNIT_ASSERT_EQUAL(OUString(""), - getProperty<OUString>(xParaThird, "PageDescName")); + getProperty<OUString>(xParaThird, "PageDescName")); CPPUNIT_ASSERT_EQUAL(2, getPages()); } @@ -1469,14 +1467,13 @@ DECLARE_RTFIMPORT_TEST(testFooterPara, "footer-para.rtf") { // check that paragraph properties in footer are imported uno::Reference<text::XText> xFooterText = - getProperty< uno::Reference<text::XText> >( - getStyles("PageStyles")->getByName("First Page"), "FooterText"); + getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("First Page"), "FooterText"); uno::Reference<text::XTextContent> xParagraph = getParagraphOrTable(1, xFooterText); CPPUNIT_ASSERT_EQUAL(OUString("All Rights Reserved."), - uno::Reference<text::XTextRange>(xParagraph, uno::UNO_QUERY)->getString()); + uno::Reference<text::XTextRange>(xParagraph, uno::UNO_QUERY)->getString()); CPPUNIT_ASSERT_EQUAL((sal_Int16)style::ParagraphAdjust_CENTER, - getProperty</*style::ParagraphAdjust*/sal_Int16>(xParagraph, "ParaAdjust")); + getProperty</*style::ParagraphAdjust*/sal_Int16>(xParagraph, "ParaAdjust")); } DECLARE_RTFIMPORT_TEST(testCp1000016, "hello.rtf") @@ -1497,7 +1494,7 @@ DECLARE_RTFIMPORT_TEST(testCp1000016, "hello.rtf") DECLARE_RTFIMPORT_TEST(testFdo65090, "fdo65090.rtf") { uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY); // The first row had 3 cells, instead of a horizontally merged one and a normal one (2 -> 1 separator). @@ -1512,58 +1509,54 @@ DECLARE_RTFIMPORT_TEST(testTableBorderDefaults, "fdo68779.rtf") uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); CPPUNIT_ASSERT(xCell.is()); - table::BorderLine2 solid( - 1, 0, 26, 0, table::BorderLineStyle::SOLID, 26); + table::BorderLine2 solid(1, 0, 26, 0, table::BorderLineStyle::SOLID, 26); CPPUNIT_ASSERT_BORDER_EQUAL(solid, - getProperty<table::BorderLine2>(xCell, "LeftBorder")); + getProperty<table::BorderLine2>(xCell, "LeftBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(solid, - getProperty<table::BorderLine2>(xCell, "RightBorder")); + getProperty<table::BorderLine2>(xCell, "RightBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(solid, - getProperty<table::BorderLine2>(xCell, "TopBorder")); + getProperty<table::BorderLine2>(xCell, "TopBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(solid, - getProperty<table::BorderLine2>(xCell, "BottomBorder")); + getProperty<table::BorderLine2>(xCell, "BottomBorder")); xTable.set(xTables->getByIndex(1), uno::UNO_QUERY); xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY); CPPUNIT_ASSERT(xCell.is()); - table::BorderLine2 dotted( - 1, 0, 26, 0, table::BorderLineStyle::DOTTED, 26); + table::BorderLine2 dotted(1, 0, 26, 0, table::BorderLineStyle::DOTTED, 26); CPPUNIT_ASSERT_BORDER_EQUAL(dotted, - getProperty<table::BorderLine2>(xCell, "LeftBorder")); + getProperty<table::BorderLine2>(xCell, "LeftBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(dotted, - getProperty<table::BorderLine2>(xCell, "RightBorder")); + getProperty<table::BorderLine2>(xCell, "RightBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(dotted, - getProperty<table::BorderLine2>(xCell, "TopBorder")); + getProperty<table::BorderLine2>(xCell, "TopBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(dotted, - getProperty<table::BorderLine2>(xCell, "BottomBorder")); + getProperty<table::BorderLine2>(xCell, "BottomBorder")); xTable.set(xTables->getByIndex(2), uno::UNO_QUERY); xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY); CPPUNIT_ASSERT(xCell.is()); - table::BorderLine2 doubled( - 1, 26, 26, 26, table::BorderLineStyle::DOUBLE, 79); + table::BorderLine2 doubled(1, 26, 26, 26, table::BorderLineStyle::DOUBLE, 79); CPPUNIT_ASSERT_BORDER_EQUAL(doubled, - getProperty<table::BorderLine2>(xCell, "LeftBorder")); + getProperty<table::BorderLine2>(xCell, "LeftBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(doubled, - getProperty<table::BorderLine2>(xCell, "RightBorder")); + getProperty<table::BorderLine2>(xCell, "RightBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(doubled, - getProperty<table::BorderLine2>(xCell, "TopBorder")); + getProperty<table::BorderLine2>(xCell, "TopBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(doubled, - getProperty<table::BorderLine2>(xCell, "BottomBorder")); + getProperty<table::BorderLine2>(xCell, "BottomBorder")); xTable.set(xTables->getByIndex(3), uno::UNO_QUERY); xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY); CPPUNIT_ASSERT(xCell.is()); - table::BorderLine2 thinThickMG( - 1, 14, 26, 14, table::BorderLineStyle::THINTHICK_MEDIUMGAP, 53); + table::BorderLine2 thinThickMG(1, 14, 26, 14, table::BorderLineStyle::THINTHICK_MEDIUMGAP, 53); CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG, - getProperty<table::BorderLine2>(xCell, "LeftBorder")); + getProperty<table::BorderLine2>(xCell, "LeftBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG, - getProperty<table::BorderLine2>(xCell, "RightBorder")); + getProperty<table::BorderLine2>(xCell, "RightBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG, - getProperty<table::BorderLine2>(xCell, "TopBorder")); + getProperty<table::BorderLine2>(xCell, "TopBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(thinThickMG, - getProperty<table::BorderLine2>(xCell, "BottomBorder")); + getProperty<table::BorderLine2>(xCell, "BottomBorder")); } DECLARE_RTFIMPORT_TEST(testShpzDhgt, "shpz-dhgt.rtf") _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits