summaryrefslogtreecommitdiff
path: root/sw/qa/extras/odfexport/odfexport.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-07-18 14:57:37 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-23 13:51:18 +0200
commitc4bce5dafdfcb97586fab4bc3834daa6a27fec4c (patch)
treeb7143868f8ba67936fdf2e7227883789b210faaf /sw/qa/extras/odfexport/odfexport.cxx
parent413956ae4c1e833d7ecb6e3695bcdec92533c2ce (diff)
resurrect and improve loplugin:referencecasting
Improve the plugin to avoid generating false+ with the special case of querying XInterface (what the code calls normalisation). Also ignore places where the querying is dealing with ambiguous base classes. Change-Id: I23b2b2fa6618328fafc4707b94c26582a462ea87 Reviewed-on: https://gerrit.libreoffice.org/74993 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/qa/extras/odfexport/odfexport.cxx')
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx22
1 files changed, 11 insertions, 11 deletions
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 0d7253924d50..99d6d8059c59 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -575,7 +575,7 @@ DECLARE_ODFEXPORT_TEST(testFdo79358, "fdo79358.odt")
{
// the boolean properties of the index were not exported properly
uno::Reference<text::XDocumentIndexesSupplier> xIndexSupplier(mxComponent, uno::UNO_QUERY);
- uno::Reference<container::XIndexAccess> xIndexes(xIndexSupplier->getDocumentIndexes(), uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xIndexes = xIndexSupplier->getDocumentIndexes();
uno::Reference<text::XDocumentIndex> xTOCIndex(xIndexes->getByIndex(0), uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xTOCProps(xTOCIndex, uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xTOCProps, "CreateFromOutline"));
@@ -637,8 +637,8 @@ DECLARE_ODFEXPORT_TEST(testDuplicateCrossRefHeadingBookmark, "CrossRefHeadingBoo
uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent,
uno::UNO_QUERY);
- uno::Reference<container::XNameAccess> xBookmarks(
- xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xBookmarks =
+ xBookmarksSupplier->getBookmarks();
uno::Reference<text::XTextContent> xBookmark1(
xBookmarks->getByName("__RefHeading__8284_1826734303"), uno::UNO_QUERY);
CPPUNIT_ASSERT(xBookmark1.is());
@@ -721,7 +721,7 @@ DECLARE_ODFEXPORT_TEST(testStylePageNumber, "ooo321_stylepagenumber.odt")
CPPUNIT_ASSERT_EQUAL(OUString("Right Page"), getProperty<OUString>(xPara0, "PageDescName"));
CPPUNIT_ASSERT_EQUAL(uno::Any(), xPara0->getPropertyValue("PageNumberOffset"));
- uno::Reference<container::XNameAccess> xParaStyles(getStyles("ParagraphStyles"), uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xParaStyles = getStyles("ParagraphStyles");
uno::Reference<beans::XPropertySet> xStyle1(xParaStyles->getByName("stylewithbreak1"), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(OUString("Right Page"), getProperty<OUString>(xStyle1, "PageDescName"));
CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty<sal_Int16>(xStyle1, "PageNumberOffset"));
@@ -864,7 +864,7 @@ DECLARE_ODFEXPORT_TEST(testCharacterBorder, "charborder.odt")
// Check character style
{
- uno::Reference< container::XNameAccess > xStyleFamily(getStyles("CharacterStyles"), uno::UNO_QUERY);
+ uno::Reference< container::XNameAccess > xStyleFamily = getStyles("CharacterStyles");
uno::Reference < beans::XPropertySet > xStyleSet(xStyleFamily->getByName("CharDiffBor"), uno::UNO_QUERY);
// Top border
@@ -1149,8 +1149,8 @@ DECLARE_ODFEXPORT_TEST(testWhitespace, "whitespace.odt")
// what a stupid idea to require recursively enumerating this
uno::Reference<container::XEnumerationAccess> xMeta(
getProperty<uno::Reference<text::XTextContent>>(xPortion, "InContentMetadata"), uno::UNO_QUERY);
- uno::Reference<container::XEnumeration> xMetaPortions(
- xMeta->createEnumeration(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xMetaPortions =
+ xMeta->createEnumeration();
uno::Reference<text::XTextRange> xMP(xMetaPortions->nextElement(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty<OUString>(xMP, "TextPortionType"));
CPPUNIT_ASSERT_EQUAL(OUString(" "), xMP->getString());
@@ -1172,8 +1172,8 @@ DECLARE_ODFEXPORT_TEST(testWhitespace, "whitespace.odt")
// what a stupid idea to require recursively enumerating this
uno::Reference<container::XEnumerationAccess> xMeta(
getProperty<uno::Reference<text::XTextContent>>(xPortion, "TextField"), uno::UNO_QUERY);
- uno::Reference<container::XEnumeration> xMetaPortions(
- xMeta->createEnumeration(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xMetaPortions =
+ xMeta->createEnumeration();
uno::Reference<text::XTextRange> xMP(xMetaPortions->nextElement(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty<OUString>(xMP, "TextPortionType"));
CPPUNIT_ASSERT_EQUAL(OUString(" "), xMP->getString());
@@ -2139,7 +2139,7 @@ DECLARE_ODFEXPORT_TEST(tdf101856_overlapped, "tdf101856_overlapped.odt")
// get bookmark interface
uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xBookmarksByIdx(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY);
- uno::Reference<container::XNameAccess> xBookmarksByName(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xBookmarksByName = xBookmarksSupplier->getBookmarks();
// check: we have 2 bookmarks
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), xBookmarksByIdx->getCount());
@@ -2163,7 +2163,7 @@ DECLARE_ODFEXPORT_TEST(tdf101856, "tdf101856.odt")
// get bookmark interface
uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xBookmarksByIdx(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY);
- uno::Reference<container::XNameAccess> xBookmarksByName(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xBookmarksByName = xBookmarksSupplier->getBookmarks();
// check: we have 2 bookmarks
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(5), xBookmarksByIdx->getCount());