diff options
63 files changed, 230 insertions, 293 deletions
diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx index b93b7e9deafa..ec7f76af8a5b 100644 --- a/sw/qa/core/macros-test.cxx +++ b/sw/qa/core/macros-test.cxx @@ -216,14 +216,14 @@ void SwMacrosTest::testControlShapeGrouping() CPPUNIT_ASSERT(xModel.is()); uno::Reference<lang::XMultiServiceFactory> xFactory(xModel, UNO_QUERY); uno::Reference<drawing::XDrawPageSupplier> const xDPS(xModel, UNO_QUERY); - uno::Reference<drawing::XDrawPage> const xDP(xDPS->getDrawPage(), UNO_QUERY); + uno::Reference<drawing::XDrawPage> const xDP = xDPS->getDrawPage(); CPPUNIT_ASSERT(xDP.is()); - uno::Reference<drawing::XShapes> const xDPShapes(xDP, UNO_QUERY); + uno::Reference<drawing::XShapes> const xDPShapes = xDP; CPPUNIT_ASSERT(xDPShapes.is()); uno::Reference<drawing::XShapes> const xShapes(getMultiServiceFactory()->createInstance("com.sun.star.drawing.ShapeCollection"), UNO_QUERY); CPPUNIT_ASSERT(xShapes.is()); - uno::Reference<container::XIndexAccess> xShapesIC(xShapes, UNO_QUERY); + uno::Reference<container::XIndexAccess> xShapesIC = xShapes; CPPUNIT_ASSERT(xShapesIC.is()); // uno::Reference<beans::XPropertySet> xFormProps(xForm, UNO_QUERY); @@ -261,8 +261,8 @@ void SwMacrosTest::testControlShapeGrouping() xFormNC->insertByName("aTimeCntrl", makeAny(xTimeControlModel)); xDPShapes->add(xTimeShape); - xShapes->add(uno::Reference<drawing::XShape>(xDateShape, UNO_QUERY)); - xShapes->add(uno::Reference<drawing::XShape>(xTimeShape, UNO_QUERY)); + xShapes->add(xDateShape); + xShapes->add(xTimeShape); uno::Reference<drawing::XShapeGrouper> const xDPGrouper(xDP, UNO_QUERY); CPPUNIT_ASSERT(xDPGrouper.is()); uno::Reference<drawing::XShapeGroup> xGroup(xDPGrouper->group(xShapes)); @@ -323,8 +323,7 @@ void SwMacrosTest::testFdo55289() uno::Reference<frame::XModel> const xModel(pDocShell->GetModel()); uno::Reference<drawing::XDrawPageSupplier> const xDPS(xModel, UNO_QUERY); - uno::Reference<drawing::XShapes> const xShapes(xDPS->getDrawPage(), - UNO_QUERY); + uno::Reference<drawing::XShapes> const xShapes = xDPS->getDrawPage(); uno::Reference<beans::XPropertySet> const xShape( uno::Reference<lang::XMultiServiceFactory>(xModel, UNO_QUERY_THROW)-> createInstance("com.sun.star.drawing.GraphicObjectShape"), diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index db18b5d9b9be..fd42a91936ba 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -419,7 +419,7 @@ protected: uno::Reference<container::XNameAccess> getStyles(const OUString& aFamily) { uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies(); uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName(aFamily), uno::UNO_QUERY); return xStyleFamily; } @@ -625,7 +625,7 @@ protected: int const index, uno::Reference<text::XTextRange> const & xPara) const { uno::Reference<container::XContentEnumerationAccess> xContentEnumAccess(xPara, uno::UNO_QUERY); - uno::Reference<container::XEnumeration> xContentEnum(xContentEnumAccess->createContentEnumeration("com.sun.star.text.TextContent"), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xContentEnum = xContentEnumAccess->createContentEnumeration("com.sun.star.text.TextContent"); for (int i = 1; i < index; ++i) { xContentEnum->nextElement(); @@ -650,7 +650,7 @@ protected: OUString getFormula(uno::Reference<text::XTextRange> const & xRun) const { uno::Reference<container::XContentEnumerationAccess> xContentEnumAccess(xRun, uno::UNO_QUERY); - uno::Reference<container::XEnumeration> xContentEnum(xContentEnumAccess->createContentEnumeration(""), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xContentEnum = xContentEnumAccess->createContentEnumeration(""); uno::Reference<beans::XPropertySet> xFormula(xContentEnum->nextElement(), uno::UNO_QUERY); return getProperty<OUString>(getProperty< uno::Reference<beans::XPropertySet> >(xFormula, "Model"), "Formula"); } @@ -705,7 +705,7 @@ protected: uno::Reference<drawing::XShape> getTextFrameByName(const OUString& aName) { uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XNameAccess> xNameAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xNameAccess = xTextFramesSupplier->getTextFrames(); uno::Reference<drawing::XShape> xShape(xNameAccess->getByName(aName), uno::UNO_QUERY); return xShape; } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 23a97bfce953..e1696f902f98 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -911,7 +911,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf44986, "tdf44986.docx") { // Check that the table at the second paragraph. uno::Reference<text::XTextTable> xTable(getParagraphOrTable(2), uno::UNO_QUERY); - uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); + uno::Reference<table::XTableRows> xTableRows = xTable->getRows(); // Check the first row of the table, it should have two cells (one separator). // This was 0: the first row had no separators, so it had only one cell, which was too wide. CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength()); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index 089e6cd666d3..60263001baf1 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -105,7 +105,7 @@ DECLARE_OOXMLEXPORT_TEST(testSmartart, "smartart.docx") uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xTextDocumentPropertySet(xTextDocument, uno::UNO_QUERY); uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); // One groupshape in the doc uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY); @@ -232,7 +232,7 @@ DECLARE_OOXMLEXPORT_TEST(testMceNested, "mce-nested.docx") // This was -1 (default), make sure the background color is set. CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f81bd), getProperty<sal_Int32>(xShape, "FillColor")); - uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(getShape(2), uno::UNO_QUERY); + uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor = getShape(2); // This was a com.sun.star.drawing.CustomShape, due to incorrect handling of wpg elements after a wps textbox. CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.GroupShape"), xShapeDescriptor->getShapeType()); @@ -262,7 +262,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo70457, "fdo70457.docx") // Check: there is one shape in the doc uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); // Check: the angle of the shape is 45º @@ -335,7 +335,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo65090, "fdo65090.docx") uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, 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); + uno::Reference<table::XTableRows> xTableRows = xTextTable->getRows(); // The first row had two cells, instead of a single horizontally merged one. CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength()); } @@ -344,11 +344,11 @@ DECLARE_OOXMLEXPORT_TEST(testFdo69649, "fdo69649.docx") { // The DOCX containing the Table of Contents was not imported with correct page nos 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<text::XTextRange> xTextRange(xTOCIndex->getAnchor(), uno::UNO_QUERY); - uno::Reference<text::XText> xText(xTextRange->getText( ), uno::UNO_QUERY); - uno::Reference<text::XTextCursor> xTextCursor(xText->createTextCursor( ), uno::UNO_QUERY); + uno::Reference<text::XText> xText = xTextRange->getText( ); + uno::Reference<text::XTextCursor> xTextCursor = xText->createTextCursor( ); xTextCursor->gotoRange(xTextRange->getStart(),false); xTextCursor->gotoRange(xTextRange->getEnd(),true); OUString aTocString(xTextCursor->getString()); @@ -424,13 +424,13 @@ DECLARE_OOXMLEXPORT_TEST(testFloatingTablesAnchor, "floating-tables-anchor.docx" // Problem was one of the two text frames was anchored to the other text frame // Both frames should be anchored to the paragraph with the text "Anchor point" uno::Reference<text::XTextContent> xTextContent(getShape(1), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xTextContent->getAnchor(), uno::UNO_QUERY); - uno::Reference<text::XText> xText(xRange->getText(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xTextContent->getAnchor(); + uno::Reference<text::XText> xText = xRange->getText(); CPPUNIT_ASSERT_EQUAL(OUString("Anchor point"), xText->getString()); xTextContent.set(getShape(2), uno::UNO_QUERY); - xRange.set(xTextContent->getAnchor(), uno::UNO_QUERY); - xText.set(xRange->getText(), uno::UNO_QUERY); + xRange = xTextContent->getAnchor(); + xText = xRange->getText(); CPPUNIT_ASSERT_EQUAL(OUString("Anchor point"), xText->getString()); } @@ -530,7 +530,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo38414, "fdo38414.docx" ) uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, 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::XTableColumns> xTableColumns(xTextTable->getColumns(), uno::UNO_QUERY); + uno::Reference<table::XTableColumns> xTableColumns = xTextTable->getColumns(); CPPUNIT_ASSERT_EQUAL( sal_Int32( 5 ), xTableColumns->getCount()); OUString height3 = parseDump("/root/page/body/tab/row[1]/cell[4]/infos/bounds", "height" ); OUString height4 = parseDump("/root/page/body/tab/row[1]/cell[5]/infos/bounds", "height" ); @@ -541,7 +541,7 @@ DECLARE_OOXMLEXPORT_TEST(test_extra_image, "test_extra_image.docx" ) { // fdo#74652 Check there is no shape added to the doc during import uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xDraws->getCount()); } @@ -561,7 +561,7 @@ DECLARE_OOXMLEXPORT_TEST(testGridBefore, "gridbefore.docx") uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, 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::XTableColumns> xTableColumns(xTextTable->getColumns(), uno::UNO_QUERY); + uno::Reference<table::XTableColumns> xTableColumns = xTextTable->getColumns(); CPPUNIT_ASSERT_EQUAL( sal_Int32( 3 ), xTableColumns->getCount()); OUString textA3 = parseDump("/root/page/body/tab/row[1]/cell[3]/txt/text()" ); OUString leftA3 = parseDump("/root/page/body/tab/row[1]/cell[3]/infos/bounds", "left" ); @@ -573,7 +573,7 @@ DECLARE_OOXMLEXPORT_TEST(testGridBefore, "gridbefore.docx") DECLARE_OOXMLEXPORT_TEST(testMsoBrightnessContrast, "msobrightnesscontrast.docx") { uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<drawing::XShape> image(getShape(1), uno::UNO_QUERY); + uno::Reference<drawing::XShape> image = getShape(1); uno::Reference<beans::XPropertySet> imageProperties(image, uno::UNO_QUERY); uno::Reference<graphic::XGraphic> graphic; imageProperties->getPropertyValue( "Graphic" ) >>= graphic; @@ -643,13 +643,13 @@ DECLARE_OOXMLEXPORT_TEST(testBnc875718, "bnc875718.docx") ++i ) { uno::Reference<text::XTextFrame> frame(xIndexAccess->getByIndex( i ), uno::UNO_QUERY); - uno::Reference<text::XTextRange> range(frame->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> range = frame->getAnchor(); uno::Reference<lang::XServiceInfo> text(range->getText(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL( OUString( "SwXHeadFootText" ), text->getImplementationName()); } // Also check that the footer contents are not in the body text. uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<text::XText> text(textDocument->getText(), uno::UNO_QUERY); + uno::Reference<text::XText> text = textDocument->getText(); CPPUNIT_ASSERT_EQUAL( OUString( "Text" ), text->getString()); } @@ -683,7 +683,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo78939, "fdo78939.docx") DECLARE_OOXMLEXPORT_TEST(testFootnote, "footnote.docx") { uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes(); uno::Reference<text::XTextRange> xFootnote(xFootnotes->getByIndex(0), uno::UNO_QUERY); OUString aFootnote = xFootnote->getString(); // Ensure there are no additional newlines after "bar". diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index 529f1dfaca0e..87b1a4cfd37f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -48,8 +48,7 @@ DECLARE_OOXMLEXPORT_TEST(testTableCrossReference, "table_cross_reference.odt") uno::Reference<container::XIndexAccess> xBookmarksByIdx(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), xBookmarksByIdx->getCount()); - uno::Reference<container::XNameAccess> xBookmarksByName(xBookmarksSupplier->getBookmarks(), - uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xBookmarksByName = xBookmarksSupplier->getBookmarks(); CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table0_full")); CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table0_label_and_number")); CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table0_caption_only")); @@ -59,25 +58,25 @@ DECLARE_OOXMLEXPORT_TEST(testTableCrossReference, "table_cross_reference.odt") { uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table0_full"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("Table 1: Table caption"), xRange->getString()); } { uno::Reference<text::XTextContent> xContent( xBookmarksByName->getByName("Ref_Table0_label_and_number"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("Table 1"), xRange->getString()); } { uno::Reference<text::XTextContent> xContent( xBookmarksByName->getByName("Ref_Table0_caption_only"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("Table caption"), xRange->getString()); } { uno::Reference<text::XTextContent> xContent( xBookmarksByName->getByName("Ref_Table0_number_only"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("1"), xRange->getString()); } @@ -222,8 +221,7 @@ DECLARE_OOXMLEXPORT_TEST(testTableCrossReferenceCustomFormat, uno::Reference<container::XIndexAccess> xBookmarksByIdx(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(16), xBookmarksByIdx->getCount()); - uno::Reference<container::XNameAccess> xBookmarksByName(xBookmarksSupplier->getBookmarks(), - uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xBookmarksByName = xBookmarksSupplier->getBookmarks(); CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table0_full")); CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table0_label_and_number")); CPPUNIT_ASSERT(xBookmarksByName->hasByName("Ref_Table0_caption_only")); @@ -246,100 +244,100 @@ DECLARE_OOXMLEXPORT_TEST(testTableCrossReferenceCustomFormat, { uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table0_full"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("1. Table: Table caption"), xRange->getString()); } { uno::Reference<text::XTextContent> xContent( xBookmarksByName->getByName("Ref_Table0_label_and_number"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("1. Table"), xRange->getString()); } { uno::Reference<text::XTextContent> xContent( xBookmarksByName->getByName("Ref_Table0_caption_only"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("Table caption"), xRange->getString()); } { uno::Reference<text::XTextContent> xContent( xBookmarksByName->getByName("Ref_Table0_number_only"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("1"), xRange->getString()); } // Second table's caption { uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table1_full"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("2. TableTable caption"), xRange->getString()); } { uno::Reference<text::XTextContent> xContent( xBookmarksByName->getByName("Ref_Table1_label_and_number"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("2. Table"), xRange->getString()); } { uno::Reference<text::XTextContent> xContent( xBookmarksByName->getByName("Ref_Table1_caption_only"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("Table caption"), xRange->getString()); } { uno::Reference<text::XTextContent> xContent( xBookmarksByName->getByName("Ref_Table1_number_only"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("2"), xRange->getString()); } // Third table's caption { uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table2_full"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("3) Table Table caption"), xRange->getString()); } { uno::Reference<text::XTextContent> xContent( xBookmarksByName->getByName("Ref_Table2_label_and_number"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("3) Table"), xRange->getString()); } { uno::Reference<text::XTextContent> xContent( xBookmarksByName->getByName("Ref_Table2_caption_only"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("Table caption"), xRange->getString()); } { uno::Reference<text::XTextContent> xContent( xBookmarksByName->getByName("Ref_Table2_number_only"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("3"), xRange->getString()); } // Fourth table's caption { uno::Reference<text::XTextContent> xContent(xBookmarksByName->getByName("Ref_Table3_full"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("Table 4- Table caption"), xRange->getString()); } { uno::Reference<text::XTextContent> xContent( xBookmarksByName->getByName("Ref_Table3_label_and_number"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("Table 4"), xRange->getString()); } { uno::Reference<text::XTextContent> xContent( xBookmarksByName->getByName("Ref_Table3_caption_only"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("Table caption"), xRange->getString()); } { uno::Reference<text::XTextContent> xContent( xBookmarksByName->getByName("Ref_Table3_number_only"), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xContent->getAnchor(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xContent->getAnchor(); CPPUNIT_ASSERT_EQUAL(OUString("4"), xRange->getString()); } } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx index c9bbb812cd8b..07c59f3a0fb1 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx @@ -451,7 +451,7 @@ DECLARE_OOXMLEXPORT_TEST(testTextFrames, "textframes.odt") { // The frames were simply missing, so let's check if all 3 frames were imported back. uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xIndexAccess(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess = xDrawPageSupplier->getDrawPage(); CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xIndexAccess->getCount()); } @@ -492,7 +492,7 @@ DECLARE_OOXMLEXPORT_TEST(testTextFrameBorders, "textframe-borders.docx") DECLARE_OOXMLEXPORT_TEST(testTextframeGradient, "textframe-gradient.docx") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xIndexAccess(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess = xDrawPageSupplier->getDrawPage(); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); @@ -826,7 +826,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo58577, "fdo58577.odt") { // The second frame was simply missing, so let's check if both frames were imported back. uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xIndexAccess(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess = xDrawPageSupplier->getDrawPage(); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 405cba6c78a4..6b3a70dccfba 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -397,7 +397,7 @@ DECLARE_OOXMLEXPORT_TEST(testSmartart, "smartart.docx") CPPUNIT_ASSERT(bTheme); // Grab Bag has all the expected elements uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); // One groupshape in the doc uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY); @@ -607,7 +607,7 @@ DECLARE_OOXMLEXPORT_TEST(testLineSpacingexport, "test_line_spacing.docx") DECLARE_OOXMLEXPORT_TEST(testTextBoxGradientAngle, "fdo65295.docx") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xIndexAccess(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess = xDrawPageSupplier->getDrawPage(); CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xIndexAccess->getCount()); // Angle of frame#1 is 135 degrees, but 'aGradient.Angle' holds value in 1/10 of a degree @@ -933,7 +933,7 @@ DECLARE_OOXMLEXPORT_TEST(testDontSplitTable, "tdf101589_dontSplitTable.odt") uno::Reference<text::XTextTable> xTable (xTables->getByIndex(0), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xTable, "Split")); - uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); + uno::Reference<table::XTableRows> xTableRows = xTable->getRows(); CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xTableRows->getByIndex(0), "IsSplitAllowed")); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 8d1d58986ddb..e81e8fca8b5d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -67,7 +67,7 @@ DECLARE_OOXMLEXPORT_TEST(testRelorientation, "relorientation.docx") DECLARE_OOXMLEXPORT_TEST(testBezier, "bezier.odt") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); // Check that no shape got lost: a bezier, a line and a text shape. CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xDraws->getCount()); } @@ -452,7 +452,7 @@ DECLARE_OOXMLEXPORT_TEST(testChartInFooter, "chart-in-footer.docx") if (xDrawPageSupplier.is()) { // If xDrawPage->getCount()==1, then document contains one shape. - uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDrawPage = xDrawPageSupplier->getDrawPage(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount()); // One shape in the doc } } @@ -464,18 +464,18 @@ DECLARE_OOXMLEXPORT_TEST(testNestedTextFrames, "nested-text-frames.odt") // Second problem was LO made file corruption, writing out nested text boxes, which can't be handled by Word. // Test that all three exported text boxes are anchored to the same paragraph and not each other. uno::Reference<text::XTextContent> xTextContent(getShape(1), uno::UNO_QUERY); - uno::Reference<text::XTextRange> xRange(xTextContent->getAnchor(), uno::UNO_QUERY); - uno::Reference<text::XText> xText(xRange->getText(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xRange = xTextContent->getAnchor(); + uno::Reference<text::XText> xText = xRange->getText(); CPPUNIT_ASSERT_EQUAL(OUString("Anchor point"), xText->getString()); xTextContent.set(getShape(2), uno::UNO_QUERY); - xRange.set(xTextContent->getAnchor(), uno::UNO_QUERY); - xText.set(xRange->getText(), uno::UNO_QUERY); + xRange = xTextContent->getAnchor(); + xText = xRange->getText(); CPPUNIT_ASSERT_EQUAL(OUString("Anchor point"), xText->getString()); xTextContent.set(getShape(3), uno::UNO_QUERY); - xRange.set(xTextContent->getAnchor(), uno::UNO_QUERY); - xText.set(xRange->getText(), uno::UNO_QUERY); + xRange = xTextContent->getAnchor(); + xText = xRange->getText(); CPPUNIT_ASSERT_EQUAL(OUString("Anchor point"), xText->getString()); } @@ -506,7 +506,7 @@ DECLARE_OOXMLEXPORT_TEST(testEmbeddedXlsx, "embedded-xlsx.docx") { // check there are two objects and they are FrameShapes uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount()); CPPUNIT_ASSERT_EQUAL(OUString("FrameShape"), getShape(1)->getShapeType()); CPPUNIT_ASSERT_EQUAL(OUString("FrameShape"), getShape(2)->getShapeType()); @@ -1072,7 +1072,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf102466, "tdf102466.docx") // check content of the first page { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xIndexAccess(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess = xDrawPageSupplier->getDrawPage(); uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); // no border diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index fde09e123f9f..b70657edb1a0 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -510,7 +510,7 @@ DECLARE_OOXMLEXPORT_TEST(testFDO79062, "fdo79062.docx") //tdf#93121 don't add fake tabs in front of extra footnote paragraphs uno::Reference<text::XFootnotesSupplier> xFootnoteSupp(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xFootnoteIdxAcc(xFootnoteSupp->getFootnotes(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnoteIdxAcc = xFootnoteSupp->getFootnotes(); uno::Reference<text::XFootnote> xFootnote(xFootnoteIdxAcc->getByIndex(0), uno::UNO_QUERY); uno::Reference<text::XText> xFootnoteText(xFootnote, uno::UNO_QUERY); uno::Reference<container::XEnumerationAccess>xParaEnumAccess(xFootnoteText->getText(), uno::UNO_QUERY); @@ -858,13 +858,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf117297_tableStyle, "tdf117297_tableStyle.docx") uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY); - uno::Reference<text::XText> xText(xPara->getText(), uno::UNO_QUERY); + uno::Reference<text::XText> xText = xPara->getText(); CPPUNIT_ASSERT_EQUAL(OUString("Green text, default size (9), 1.5 spaced"), xPara->getString()); CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B1 Paragraph1 green font", sal_Int32(0x70AD47), getProperty<sal_Int32>(getRun(xPara, 1), "CharColor")); CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B1 Paragraph1 1.5 line spacing", sal_Int16(150), getProperty<style::LineSpacing>(xPara, "ParaLineSpacing").Height); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); - xText.set(xPara->getText(), uno::UNO_QUERY); + xText = xPara->getText(); CPPUNIT_ASSERT_EQUAL(OUString("TableGrid color (blue), TableGrid size (9), double spacing"), xPara->getString()); CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B1 Paragraph3 blue font", sal_Int32(0x00B0F0), getProperty<sal_Int32>(getRun(xPara, 1), "CharColor")); CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B1 Paragraph3 double spacing", sal_Int16(200), getProperty<style::LineSpacing>(xPara, "ParaLineSpacing").Height); @@ -1004,7 +1004,7 @@ DECLARE_OOXMLEXPORT_TEST(tdf66398_permissions, "tdf66398_permissions.docx") // 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()); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx index 1032d3abf09e..a46e3fb5eb63 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx @@ -143,15 +143,13 @@ DECLARE_OOXMLEXPORT_TEST(testFdo49940, "fdo49940.docx") DECLARE_OOXMLEXPORT_TEST(testFdo74745, "fdo74745.docx") { uno::Reference<text::XTextRange > paragraph = getParagraph(3); - uno::Reference<text::XTextRange> text(paragraph, uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("09/02/14"), text->getString()); + CPPUNIT_ASSERT_EQUAL(OUString("09/02/14"), paragraph->getString()); } DECLARE_OOXMLEXPORT_TEST(testFdo81486, "fdo81486.docx") { uno::Reference<text::XTextRange > paragraph = getParagraph(1); - uno::Reference<text::XTextRange> text(paragraph, uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(OUString("CustomTitle"), text->getString()); + CPPUNIT_ASSERT_EQUAL(OUString("CustomTitle"), paragraph->getString()); } DECLARE_OOXMLEXPORT_TEST(testFdo79738, "fdo79738.docx") @@ -360,7 +358,7 @@ note that the indexes may get off as the implementation evolves, C++ code search uno::Reference< text::XTextRange > paragraph(getParagraph( 1, "Text1." )); OUString numberingStyleName = getProperty< OUString >( paragraph, "NumberingStyleName" ); uno::Reference<text::XNumberingRulesSupplier> xNumberingRulesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> numberingRules(xNumberingRulesSupplier->getNumberingRules(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> numberingRules = xNumberingRulesSupplier->getNumberingRules(); uno::Reference<container::XIndexAccess> numberingRule; for( int i = 0; i < numberingRules->getCount(); @@ -505,7 +503,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo74357, "fdo74357.docx") { // Floating table wasn't converted to a textframe. uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDrawPage = xDrawPageSupplier->getDrawPage(); // This was 0. CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount()); @@ -639,7 +637,7 @@ DECLARE_OOXMLEXPORT_TEST(testN785767, "n785767.docx") uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, 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); + uno::Reference<table::XTableRows> xTableRows = xTextTable->getRows(); // Check the A1 and B1 cells, the width of both of them was the default value (10000 / 9, as there were 9 cells in the row). CPPUNIT_ASSERT_MESSAGE("A1 must not have default width", sal_Int16(10000 / 9) != getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position); CPPUNIT_ASSERT_MESSAGE("B1 must not have default width", sal_Int16(10000 / 9) != getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position); @@ -669,7 +667,7 @@ DECLARE_OOXMLEXPORT_TEST(testN792778, "n792778.docx") * xray ThisComponent.DrawPage(0).getByIndex(1).getByIndex(0).Position.Y ' 11684 */ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDrawPage = xDrawPageSupplier->getDrawPage(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount()); uno::Reference<drawing::XShapes> xGroupShape(xDrawPage->getByIndex(0), uno::UNO_QUERY); @@ -820,7 +818,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo61343, "fdo61343.docx") // The problem was that there were a groupshape in the doc, followed by an // OLE object, and this lead to a crash. uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); } @@ -884,7 +882,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo59273, "fdo59273.docx") // Was 115596 (i.e. 10 times wider than necessary), as w:tblW was missing and the importer didn't set it. CPPUNIT_ASSERT_EQUAL(sal_Int32(12961), getProperty<sal_Int32>(xTextTable, "Width")); - uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY); + uno::Reference<table::XTableRows> xTableRows = xTextTable->getRows(); // Was 9997, so the 4th column had ~zero width CPPUNIT_ASSERT_EQUAL(sal_Int16(7498), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[2].Position); } @@ -1037,7 +1035,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo65632, "fdo65632.docx") // The problem was that the footnote text had fake redline: only the body // text has redline in fact. uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes(); uno::Reference<text::XText> xText(xFootnotes->getByIndex(0), uno::UNO_QUERY); //uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xText); CPPUNIT_ASSERT_EQUAL(OUString("Text"), getProperty<OUString>(getRun(getParagraphOfText(1, xText), 1), "TextPortionType")); @@ -1127,7 +1125,7 @@ DECLARE_OOXMLEXPORT_TEST(testChartProp, "chart-prop.docx") { // The problem was that chart was not getting parsed in writer module. uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDrawPage = xDrawPageSupplier->getDrawPage(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount()); uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY); diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 3793a13a4028..cf2cb780bb12 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -457,8 +457,7 @@ DECLARE_RTFEXPORT_TEST(testFdo53604, "fdo53604.odt") { // Invalid output on empty footnote. uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), - uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes(); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xFootnotes->getCount()); } @@ -989,7 +988,7 @@ DECLARE_RTFEXPORT_TEST(testTdf80708, "tdf80708.rtf") uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(1), uno::UNO_QUERY); - uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); + uno::Reference<table::XTableRows> xTableRows = xTable->getRows(); // This was 2, i.e. the second table had 3 cols, now 2 as expected. CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), getProperty<uno::Sequence<text::TableColumnSeparator>>( @@ -1077,8 +1076,8 @@ DECLARE_RTFEXPORT_TEST(testTdf96175, "tdf96175.rtf") // The problem that a user defined property named "Company" was lost on export. uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier( mxComponent, uno::UNO_QUERY); - uno::Reference<document::XDocumentProperties> xDocumentProperties( - xDocumentPropertiesSupplier->getDocumentProperties(), uno::UNO_QUERY); + uno::Reference<document::XDocumentProperties> xDocumentProperties + = xDocumentPropertiesSupplier->getDocumentProperties(); uno::Reference<beans::XPropertyContainer> xUserDefinedProperties = xDocumentProperties->getUserDefinedProperties(); // This resulted in a beans::UnknownPropertyException. @@ -1331,7 +1330,7 @@ DECLARE_RTFEXPORT_TEST(testTdf104937, "tdf104937.rtf") uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); - uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); + uno::Reference<table::XTableRows> xTableRows = xTable->getRows(); auto aSeparators = getProperty<uno::Sequence<text::TableColumnSeparator>>( xTableRows->getByIndex(1), "TableColumnSeparators"); // First table's second row had 9 cells (so 8 separators). @@ -1347,7 +1346,7 @@ DECLARE_RTFEXPORT_TEST(testTdf112507, "tdf112507.rtf") uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); - uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); + uno::Reference<table::XTableRows> xTableRows = xTable->getRows(); auto aSeparators = getProperty<uno::Sequence<text::TableColumnSeparator>>( xTableRows->getByIndex(1), "TableColumnSeparators"); // First table's second row had 3 cells (so 2 separators). diff --git a/sw/qa/extras/rtfexport/rtfexport2.cxx b/sw/qa/extras/rtfexport/rtfexport2.cxx index f7bad9211af7..c90f4ca201db 100644 --- a/sw/qa/extras/rtfexport/rtfexport2.cxx +++ b/sw/qa/extras/rtfexport/rtfexport2.cxx @@ -131,8 +131,7 @@ DECLARE_RTFEXPORT_TEST(testFdo42465, "fdo42465.rtf") { CPPUNIT_ASSERT_EQUAL(3, g DECLARE_RTFEXPORT_TEST(testFdo45187, "fdo45187.rtf") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), - uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); // There should be two shapes. CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount()); @@ -301,8 +300,7 @@ DECLARE_RTFEXPORT_TEST(testFdo44176, "fdo44176.rtf") DECLARE_RTFEXPORT_TEST(testFdo39053, "fdo39053.rtf") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), - uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); int nAsCharacter = 0; for (int i = 0; i < xDraws->getCount(); ++i) if (getProperty<text::TextContentAnchorType>(xDraws->getByIndex(i), "AnchorType") @@ -471,7 +469,7 @@ DECLARE_RTFEXPORT_TEST(testFdo76633, "fdo76633.rtf") CPPUNIT_ASSERT(xShape->supportsService("com.sun.star.text.TextGraphicObject")); try { - uno::Reference<drawing::XShape> xShape2(getShape(2), uno::UNO_QUERY); + uno::Reference<drawing::XShape> xShape2 = getShape(2); CPPUNIT_FAIL("exception expected"); } catch (lang::IndexOutOfBoundsException const&) @@ -597,7 +595,7 @@ DECLARE_RTFEXPORT_TEST(testFdo52475, "fdo52475.rtf") DECLARE_RTFEXPORT_TEST(testFdo55493, "fdo55493.rtf") { // The problem was that the width of the PNG was detected as 15,24cm, instead of 3.97cm - uno::Reference<drawing::XShape> xShape(getShape(1), uno::UNO_QUERY); + uno::Reference<drawing::XShape> xShape = getShape(1); CPPUNIT_ASSERT_EQUAL(sal_Int32(3969), xShape->getSize().Width); } @@ -606,7 +604,7 @@ DECLARE_RTFEXPORT_TEST(testCopyPastePageStyle, "copypaste-pagestyle.rtf") // The problem was that RTF import during copy&paste did not ignore page styles. // Once we have more copy&paste tests, makes sense to refactor this to some helper method. uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); paste("rtfexport/data/copypaste-pagestyle-paste.rtf", xEnd); @@ -620,8 +618,7 @@ DECLARE_RTFEXPORT_TEST(testCopyPasteFootnote, "copypaste-footnote.rtf") { // The RTF import did not handle the case when the position wasn't the main document XText, but something different, e.g. a footnote. uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), - uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes(); uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY); paste("rtfexport/data/copypaste-footnote-paste.rtf", xTextRange); @@ -632,7 +629,7 @@ DECLARE_RTFEXPORT_TEST(testFdo63428, "hello.rtf") { // Pasting content that contained an annotation caused a crash. uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); paste("rtfexport/data/fdo63428.rtf", xEnd); @@ -656,7 +653,7 @@ DECLARE_RTFEXPORT_TEST(testFdo69384, "fdo69384-paste.rtf") DECLARE_RTFEXPORT_TEST(testFdo69384Inserted, "hello.rtf") { uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); paste("rtfexport/data/fdo69384-paste.rtf", xEnd); @@ -671,7 +668,7 @@ DECLARE_RTFEXPORT_TEST(testFdo61193, "hello.rtf") { // Pasting content that contained a footnote caused a crash. uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); paste("rtfexport/data/fdo61193.rtf", xEnd); } @@ -681,7 +678,7 @@ DECLARE_RTFEXPORT_TEST(testTdf108123, "hello.rtf") // This crashed, the shape push/pop and table manager stack went out of // sync -> we tried to de-reference an empty stack. uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); paste("rtfexport/data/tdf108123.rtf", xEnd); } @@ -696,8 +693,7 @@ DECLARE_RTFEXPORT_TEST(testShptxtPard, "shptxt-pard.rtf") DECLARE_RTFEXPORT_TEST(testDoDhgt, "do-dhgt.rtf") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), - uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); for (int i = 0; i < xDraws->getCount(); ++i) { sal_Int32 nFillColor = getProperty<sal_Int32>(xDraws->getByIndex(i), "FillColor"); @@ -732,8 +728,7 @@ DECLARE_RTFEXPORT_TEST(testDppolyline, "dppolyline.rtf") { // This was completely ignored, for now, just make sure we have all 4 lines. uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), - uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xDraws->getCount()); } @@ -750,7 +745,7 @@ DECLARE_RTFEXPORT_TEST(testFdo56512, "fdo56512.rtf") DECLARE_RTFEXPORT_TEST(testFdo52989, "fdo52989.rtf") { // Same as n#192129, but for JPEG files. - uno::Reference<drawing::XShape> xShape(getShape(1), uno::UNO_QUERY); + uno::Reference<drawing::XShape> xShape = getShape(1); OString aMessage("xShape->getSize().Width() = "); aMessage += OString::number(xShape->getSize().Width); @@ -806,8 +801,7 @@ DECLARE_RTFEXPORT_TEST(testFdo54612, "fdo54612.rtf") { // \dpptx without a \dppolycount caused a crash. uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), - uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xDraws->getCount()); } @@ -828,7 +822,7 @@ DECLARE_RTFEXPORT_TEST(testFdo44053, "fdo44053.rtf") 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); + uno::Reference<table::XTableRows> xTableRows = xTextTable->getRows(); // 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] diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx index dabe25ed2441..abdda750ba22 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -29,8 +29,7 @@ DECLARE_RTFEXPORT_TEST(testTdf108949, "tdf108949_footnoteCharFormat.odt") getProperty<OUString>(getParagraph(2), "NumberingStyleName")); uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), - uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes(); uno::Reference<text::XText> xFootnoteText; xFootnotes->getByIndex(0) >>= xFootnoteText; @@ -47,8 +46,7 @@ DECLARE_RTFEXPORT_TEST(testTdf108949_footnote, "tdf108949_footnote.rtf") getProperty<OUString>(getParagraph(2), "NumberingStyleName")); uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), - uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes(); uno::Reference<text::XFootnote> xFootnote; xFootnotes->getByIndex(0) >>= xFootnote; diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx index 7f11ece22fa8..85535078e0d6 100644 --- a/sw/qa/extras/rtfexport/rtfexport5.cxx +++ b/sw/qa/extras/rtfexport/rtfexport5.cxx @@ -116,7 +116,7 @@ DECLARE_RTFEXPORT_TEST(testFdo62044, "fdo62044.rtf") { // The problem was that RTF import during copy&paste did not ignore existing paragraph styles. uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); paste("rtfexport/data/fdo62044-paste.rtf", xEnd); @@ -211,8 +211,7 @@ DECLARE_RTFIMPORT_TEST(testParaStyleBottomMargin2, "para-style-bottom-margin-2.r DECLARE_RTFEXPORT_TEST(testFdo66040, "fdo66040.rtf") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), - uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); // This was 0 (no shapes were imported), we want two textframes. CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount()); @@ -261,8 +260,7 @@ DECLARE_RTFEXPORT_TEST(testFdo77996, "fdo77996.rtf") DECLARE_RTFEXPORT_TEST(testFdo47802, "fdo47802.rtf") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), - uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); // Shape inside table was ignored. CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); } @@ -331,8 +329,7 @@ DECLARE_RTFEXPORT_TEST(testFdo68076, "fdo68076.rtf") DECLARE_RTFEXPORT_TEST(testFdo70221, "fdo70221.rtf") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), - uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); // The picture was imported twice. CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); } @@ -342,8 +339,7 @@ DECLARE_RTFEXPORT_TEST(testCp1000018, "cp1000018.rtf") // The problem was that the empty paragraph at the end of the footnote got // lost during import. uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), - uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes(); uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY); OUString const aExpected = "Footnote first line." SAL_NEWLINE_STRING; @@ -355,8 +351,7 @@ DECLARE_RTFEXPORT_TEST(testCp1000018, "cp1000018.rtf") DECLARE_RTFEXPORT_TEST(testFdo94835, "fdo94835.rtf") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), - uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws = xDrawPageSupplier->getDrawPage(); // The picture was imported twice. CPPUNIT_ASSERT_EQUAL(sal_Int32(19), xDraws->getCount()); } @@ -444,7 +439,7 @@ DECLARE_RTFEXPORT_TEST(testFdo65090, "fdo65090.rtf") 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); + uno::Reference<table::XTableRows> xTableRows = xTextTable->getRows(); // The first row had 3 cells, instead of a horizontally merged one and a normal one (2 -> 1 separator). CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<uno::Sequence<text::TableColumnSeparator>>( xTableRows->getByIndex(0), "TableColumnSeparators") @@ -545,7 +540,7 @@ DECLARE_RTFEXPORT_TEST(testFdo69289, "fdo69289.rtf") uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); - uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); + uno::Reference<table::XTableRows> xTableRows = xTable->getRows(); // There were only 2 cells (1 separators) in the table, should be 3 (2 separators). CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<uno::Sequence<text::TableColumnSeparator>>( xTableRows->getByIndex(0), "TableColumnSeparators") @@ -788,7 +783,7 @@ DECLARE_RTFEXPORT_TEST(testFdo49893_2, "fdo49893-2.rtf") DECLARE_RTFEXPORT_TEST(testFdo89496, "fdo89496.rtf") { // Just ensure that document is loaded and shape exists - uno::Reference<drawing::XShape> xShape(getShape(1), uno::UNO_QUERY); + uno::Reference<drawing::XShape> xShape = getShape(1); CPPUNIT_ASSERT(xShape.is()); } @@ -822,7 +817,7 @@ DECLARE_RTFEXPORT_TEST(testTdf91074, "tdf91074.rtf") DECLARE_RTFEXPORT_TEST(testTdf90260Nopar, "hello.rtf") { uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); paste("rtfexport/data/tdf90260-nopar.rtf", xEnd); CPPUNIT_ASSERT_EQUAL(1, getParagraphs()); @@ -947,7 +942,7 @@ DECLARE_RTFEXPORT_TEST(testTdf97035, "tdf97035.rtf") uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); // First cell width of the second row should be 2300 - uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); + uno::Reference<table::XTableRows> xTableRows = xTable->getRows(); CPPUNIT_ASSERT_EQUAL(sal_Int16(2299), getProperty<uno::Sequence<text::TableColumnSeparator>>( xTableRows->getByIndex(1), "TableColumnSeparators")[0] .Position); @@ -963,7 +958,7 @@ DECLARE_RTFEXPORT_TEST(testTdf87034, "tdf87034.rtf") DECLARE_RTFEXPORT_TEST(testClassificatonPasteLevels, "classification-confidential.rtf") { uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xText = xTextDocument->getText(); uno::Reference<text::XTextRange> xEnd = xText->getEnd(); // Classified source and classified destination, but internal only has a @@ -1041,7 +1036,7 @@ DECLARE_RTFEXPORT_TEST(testTdf44986, "tdf44986.rtf") { // Check that the table at the second paragraph. uno::Reference<text::XTextTable> xTable(getParagraphOrTable(2), uno::UNO_QUERY); - uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY); + uno::Reference<table::XTableRows> xTableRows = xTable->getRows(); // Check the first row of the table, it should have two cells (one separator). // This was 0: the first row had no separators, so it had only one cell, which was too wide. CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<uno::Sequence<text::TableColumnSeparator>>( @@ -1079,7 +1074,7 @@ DECLARE_RTFEXPORT_TEST(testTdf105852, "tdf105852.rtf") 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); + uno::Reference<table::XTableRows> xTableRows = xTextTable->getRows(); // All rows but last were merged -> there were only 2 rows CPPUNIT_ASSERT_EQUAL(sal_Int32(6), xTableRows->getCount()); // The first row must have 4 cells. diff --git a/sw/source/core/docnode/finalthreadmanager.cxx b/sw/source/core/docnode/finalthreadmanager.cxx index 537ab6f08cb6..495c1b1041a3 100644 --- a/sw/source/core/docnode/finalthreadmanager.cxx +++ b/sw/source/core/docnode/finalthreadmanager.cxx @@ -205,7 +205,7 @@ void TerminateOfficeThread::PerformOfficeTermination() { css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create(mxContext); - css::uno::Reference< css::container::XElementAccess > xList( xDesktop->getFrames(), css::uno::UNO_QUERY ); + css::uno::Reference< css::container::XElementAccess > xList = xDesktop->getFrames(); if ( !xList.is() ) { OSL_FAIL( "<TerminateOfficeThread::PerformOfficeTermination()> - no XElementAccess!" ); diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index a61964900a1d..cd9bdd6281eb 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -527,10 +527,8 @@ bool lcl_UpdateParagraphSignatureField(SwDoc* pDoc, void lcl_RemoveParagraphMetadataField(const uno::Reference<css::text::XTextField>& xField) { - uno::Reference<css::text::XTextContent> xFieldTextContent(xField, uno::UNO_QUERY); - uno::Reference<css::text::XTextRange> xParagraph(xFieldTextContent->getAnchor()); - uno::Reference<css::text::XText> xParagraphText(xParagraph->getText(), uno::UNO_QUERY); - xParagraphText->removeTextContent(xFieldTextContent); + uno::Reference<css::text::XTextRange> xParagraph(xField->getAnchor()); + xParagraph->getText()->removeTextContent(xField); } /// Returns true iff the field in question is paragraph classification. @@ -784,7 +782,7 @@ void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationRes uno::Reference<frame::XModel> xModel = pDocShell->GetBaseModel(); uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xModel, uno::UNO_QUERY); - uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies(); uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("PageStyles"), uno::UNO_QUERY); uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(xModel, uno::UNO_QUERY); @@ -962,7 +960,7 @@ std::vector<svx::ClassificationResult> SwEditShell::CollectAdvancedClassificatio uno::Reference<frame::XModel> xModel = pDocShell->GetBaseModel(); uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xModel, uno::UNO_QUERY); - uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies(); uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("PageStyles"), uno::UNO_QUERY); std::vector<OUString> aPageStyles = lcl_getUsedPageStyles(this); @@ -1095,7 +1093,7 @@ void SwEditShell::SetClassification(const OUString& rName, SfxClassificationPoli uno::Reference<frame::XModel> xModel = pDocShell->GetBaseModel(); uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xModel, uno::UNO_QUERY); - uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies(); uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("PageStyles"), uno::UNO_QUERY); uno::Sequence<OUString> aStyles = xStyleFamily->getElementNames(); @@ -1390,7 +1388,7 @@ SfxWatermarkItem SwEditShell::GetWatermark() uno::Reference<frame::XModel> xModel = pDocShell->GetBaseModel(); uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xModel, uno::UNO_QUERY); - uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies(); uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("PageStyles"), uno::UNO_QUERY); std::vector<OUString> aUsedPageStyles = lcl_getUsedPageStyles(this); for (const OUString& rPageStyleName : aUsedPageStyles) @@ -1616,7 +1614,7 @@ void SwEditShell::SetWatermark(const SfxWatermarkItem& rWatermark) uno::Reference<frame::XModel> xModel = pDocShell->GetBaseModel(); uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xModel, uno::UNO_QUERY); - uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies(); uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("PageStyles"), uno::UNO_QUERY); uno::Sequence<OUString> aStyles = xStyleFamily->getElementNames(); @@ -1893,7 +1891,7 @@ static uno::Reference<text::XTextField> lcl_GetParagraphMetadataFieldAtIndex(con SwFormatMeta& rFormatMeta(static_cast<SwFormatMeta&>(pTextMeta->GetAttr())); if (::sw::Meta* pMeta = rFormatMeta.GetMeta()) { - const css::uno::Reference<css::rdf::XResource> xSubject(pMeta->MakeUnoObject(), uno::UNO_QUERY); + const css::uno::Reference<css::rdf::XResource> xSubject = pMeta->MakeUnoObject(); uno::Reference<frame::XModel> xModel = pDocSh->GetBaseModel(); const std::map<OUString, OUString> aStatements = lcl_getRDFStatements(xModel, xSubject); if (aStatements.find(ParagraphSignatureIdRDFName) != aStatements.end() || diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx index 78ff47515f5f..0ad5a1d4bd45 100644 --- a/sw/source/core/swg/SwXMLTextBlocks.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks.cxx @@ -165,9 +165,8 @@ void SwXMLTextBlocks::AddName( const OUString& rShort, const OUString& rLong, ErrCode SwXMLTextBlocks::Delete( sal_uInt16 n ) { const OUString aPckName (m_aNames[n]->aPackageName); - uno::Reference < container::XNameAccess > xAccess( xBlkRoot, uno::UNO_QUERY ); - if ( xAccess.is() && - xAccess->hasByName( aPckName ) && xBlkRoot->isStreamElement( aPckName ) ) + if ( xBlkRoot.is() && + xBlkRoot->hasByName( aPckName ) && xBlkRoot->isStreamElement( aPckName ) ) { try { diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index 0a064945be94..843e545a39a0 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -277,8 +277,7 @@ ErrCode SwXMLTextBlocks::GetBlockText( const OUString& rShort, OUString& rText ) bool bTextOnly = true; xRoot = xBlkRoot->openStorageElement( aFolderName, embed::ElementModes::READ ); - uno::Reference < container::XNameAccess > xAccess( xRoot, uno::UNO_QUERY ); - if ( !xAccess->hasByName( aStreamName ) || !xRoot->isStreamElement( aStreamName ) ) + if ( !xRoot->hasByName( aStreamName ) || !xRoot->isStreamElement( aStreamName ) ) { bTextOnly = false; aStreamName = "content.xml"; @@ -360,13 +359,9 @@ ErrCode SwXMLTextBlocks::PutBlockText( const OUString& rShort, uno::Reference < beans::XPropertySet > xSet( xDocStream, uno::UNO_QUERY ); xSet->setPropertyValue("MediaType", Any(OUString( "text/xml" )) ); uno::Reference < io::XOutputStream > xOut = xDocStream->getOutputStream(); - uno::Reference<io::XActiveDataSource> xSrc(xWriter, uno::UNO_QUERY); - xSrc->setOutputStream(xOut); + xWriter->setOutputStream(xOut); - uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter, - uno::UNO_QUERY); - - rtl::Reference<SwXMLTextBlockExport> xExp( new SwXMLTextBlockExport( xContext, *this, GetXMLToken ( XML_UNFORMATTED_TEXT ), xHandler) ); + rtl::Reference<SwXMLTextBlockExport> xExp( new SwXMLTextBlockExport( xContext, *this, GetXMLToken ( XML_UNFORMATTED_TEXT ), xWriter) ); xExp->exportDoc( rText ); @@ -408,8 +403,7 @@ void SwXMLTextBlocks::ReadInfo() try { const OUString sDocName( XMLN_BLOCKLIST ); - uno::Reference < container::XNameAccess > xAccess( xBlkRoot, uno::UNO_QUERY ); - if ( xAccess.is() && xAccess->hasByName( sDocName ) && xBlkRoot->isStreamElement( sDocName ) ) + if ( xBlkRoot.is() && xBlkRoot->hasByName( sDocName ) && xBlkRoot->isStreamElement( sDocName ) ) { uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); @@ -479,12 +473,9 @@ void SwXMLTextBlocks::WriteInfo() uno::Reference < beans::XPropertySet > xSet( xDocStream, uno::UNO_QUERY ); xSet->setPropertyValue("MediaType", Any(OUString( "text/xml" )) ); uno::Reference < io::XOutputStream > xOut = xDocStream->getOutputStream(); - uno::Reference<io::XActiveDataSource> xSrc(xWriter, uno::UNO_QUERY); - xSrc->setOutputStream(xOut); - - uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter, uno::UNO_QUERY); + xWriter->setOutputStream(xOut); - rtl::Reference<SwXMLBlockListExport> xExp(new SwXMLBlockListExport( xContext, *this, XMLN_BLOCKLIST, xHandler) ); + rtl::Reference<SwXMLBlockListExport> xExp(new SwXMLBlockListExport( xContext, *this, XMLN_BLOCKLIST, xWriter) ); xExp->exportDoc( XML_BLOCK_LIST ); @@ -517,8 +508,8 @@ ErrCode SwXMLTextBlocks::SetMacroTable( comphelper::getProcessComponentContext(); // Get model - uno::Reference< lang::XComponent > xModelComp( - m_xDoc->GetDocShell()->GetModel(), UNO_QUERY ); + uno::Reference< lang::XComponent > xModelComp = + m_xDoc->GetDocShell()->GetModel(); OSL_ENSURE( xModelComp.is(), "XMLWriter::Write: got no model" ); if( !xModelComp.is() ) return ERR_SWG_WRITE_ERROR; @@ -547,8 +538,6 @@ ErrCode SwXMLTextBlocks::SetMacroTable( // connect XML writer to output stream xSaxWriter->setOutputStream( xOutputStream ); - uno::Reference<xml::sax::XDocumentHandler> xDocHandler( - xSaxWriter, UNO_QUERY); // construct events object uno::Reference<XNameAccess> xEvents = @@ -556,7 +545,7 @@ ErrCode SwXMLTextBlocks::SetMacroTable( // prepare arguments (prepend doc handler to given arguments) Sequence<Any> aParams(2); - aParams[0] <<= xDocHandler; + aParams[0] <<= xSaxWriter; aParams[1] <<= xEvents; // get filter component diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 3d55ed251f2b..b155c0f98e4b 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1203,7 +1203,7 @@ void SwTextNode::DestroyAttr( SwTextAttr* pAttr ) if (SwDocShell* pDocSh = pDoc->GetDocShell()) { static const OUString metaNS("urn:bails"); - const css::uno::Reference<css::rdf::XResource> xSubject(pMeta->MakeUnoObject(), uno::UNO_QUERY); + const css::uno::Reference<css::rdf::XResource> xSubject = pMeta->MakeUnoObject(); uno::Reference<frame::XModel> xModel = pDocSh->GetBaseModel(); SwRDFHelper::clearStatements(xModel, metaNS, xSubject); } diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index eb81443bf984..b8b4cf4a7148 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -1016,8 +1016,8 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwChartDataProvider::detectArgume OSL_FAIL("got NULL for XLabeledDataSequence from Data source"); continue; } - const uno::Reference< chart2::data::XDataSequence > xCurLabel( xLabeledDataSequence->getLabel(), uno::UNO_QUERY ); - const uno::Reference< chart2::data::XDataSequence > xCurValues( xLabeledDataSequence->getValues(), uno::UNO_QUERY ); + const uno::Reference< chart2::data::XDataSequence > xCurLabel = xLabeledDataSequence->getLabel(); + const uno::Reference< chart2::data::XDataSequence > xCurValues = xLabeledDataSequence->getValues(); // get sequence lengths for label and values. // (0 length is Ok) @@ -1475,12 +1475,11 @@ void SwChartDataProvider::DeleteBox( const SwTable *pTable, const SwTableBox &rB bool bSeqDisposed = false; // check if weak reference is still valid... - uno::Reference< chart2::data::XDataSequence > xTemp(*aIt); // temporary needed for g++ 3.3.5 - uno::Reference< chart2::data::XDataSequence > xRef( xTemp, uno::UNO_QUERY ); - if (xRef.is()) + uno::Reference< chart2::data::XDataSequence > xTemp(*aIt); + if (xTemp.is()) { // then delete that table box (check if implementation cursor needs to be adjusted) - pDataSeq = static_cast< SwChartDataSequence * >( xRef.get() ); + pDataSeq = static_cast< SwChartDataSequence * >( xTemp.get() ); if (pDataSeq) { try diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 712342578872..cc7b7e79ea5d 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -267,8 +267,7 @@ const SdrMarkList& SwFmDrawPage::PreGroup(const uno::Reference< drawing::XShape void SwFmDrawPage::PreUnGroup(const uno::Reference< drawing::XShapeGroup >& rShapeGroup) { - uno::Reference< drawing::XShape > xShape( rShapeGroup, uno::UNO_QUERY); - SelectObjectInView( xShape, GetPageView() ); + SelectObjectInView( rShapeGroup, GetPageView() ); } SdrPageView* SwFmDrawPage::GetPageView() diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 9660d3187754..2152029a3972 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -537,9 +537,8 @@ lcl_CreateTOXMarkPortion( SwDoc* pDoc = pUnoCursor->GetDoc(); SwTOXMark & rTOXMark = static_cast<SwTOXMark&>(rAttr.GetAttr()); - const Reference<XTextContent> xContent( - SwXDocumentIndexMark::CreateXDocumentIndexMark(*pDoc, & rTOXMark), - uno::UNO_QUERY); + const Reference<XTextContent> xContent = + SwXDocumentIndexMark::CreateXDocumentIndexMark(*pDoc, & rTOXMark); SwXTextPortion* pPortion = nullptr; if (!bEnd) diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 204a3a737358..ab7e4f7adc3e 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -4766,7 +4766,7 @@ sal_Bool SAL_CALL SwXTextCellStyle::isInUse() if (!xFamiliesSupplier.is()) return false; - uno::Reference<container::XNameAccess> xFamilies(xFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xFamilies = xFamiliesSupplier->getStyleFamilies(); if (!xFamilies.is()) return false; diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 992c8be80532..040291d51652 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -877,8 +877,7 @@ SwXText::getStart() throw aRuntime; } xRef->gotoStart(false); - const uno::Reference< text::XTextRange > xRet(xRef, uno::UNO_QUERY); - return xRet; + return xRef; } uno::Reference< text::XTextRange > SAL_CALL @@ -894,8 +893,7 @@ SwXText::getEnd() throw aRuntime; } xRef->gotoEnd(false); - const uno::Reference< text::XTextRange > xRet(xRef, uno::UNO_QUERY); - return xRet; + return xRef; } OUString SAL_CALL SwXText::getString() diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index 9750ff7f07a0..482fce55732e 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -119,7 +119,7 @@ void SwHTMLParser::EndScript() aLibName = "Standard"; // get module library container - Reference< script::XLibraryContainer > xModLibContainer( pDocSh->GetBasicContainer(), UNO_QUERY ); + Reference< script::XLibraryContainer > xModLibContainer = pDocSh->GetBasicContainer(); if ( xModLibContainer.is() ) { @@ -161,7 +161,7 @@ void SwHTMLParser::EndScript() } // get dialog library container - Reference< script::XLibraryContainer > xDlgLibContainer( pDocSh->GetDialogContainer(), UNO_QUERY ); + Reference< script::XLibraryContainer > xDlgLibContainer = pDocSh->GetDialogContainer(); if ( xDlgLibContainer.is() ) { diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index f0e14faa4471..78c8d820df34 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -321,7 +321,7 @@ const uno::Reference< drawing::XShapes > & SwHTMLForm_Impl::GetShapes() GetDrawPage(); if( m_xDrawPage.is() ) { - m_xShapes.set( m_xDrawPage, UNO_QUERY ); + m_xShapes = m_xDrawPage; OSL_ENSURE( m_xShapes.is(), "XShapes not received from drawing::XDrawPage" ); } diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index eb8697d99291..87a190b322c0 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -88,8 +88,7 @@ static void lcl_html_outEvents( SvStream& rStrm, rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars ) { - uno::Reference< container::XChild > xChild( rFormComp, uno::UNO_QUERY ); - uno::Reference< uno::XInterface > xParentIfc = xChild->getParent(); + uno::Reference< uno::XInterface > xParentIfc = rFormComp->getParent(); OSL_ENSURE( xParentIfc.is(), "lcl_html_outEvents: no parent interface" ); if( !xParentIfc.is() ) return; diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index f6a60aff7962..222ca88667c0 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -1158,7 +1158,7 @@ sal_uInt16 SwHTMLWriter::GuessOLENodeFrameType( const SwNode& rNode ) SwHTMLFrameType eType = HTML_FRMTYPE_OLE; - uno::Reference < embed::XClassifiedObject > xClass ( rObj.GetOleRef(), uno::UNO_QUERY ); + uno::Reference < embed::XClassifiedObject > xClass = rObj.GetOleRef(); SvGlobalName aClass( xClass->getClassID() ); if( aClass == SvGlobalName( SO3_PLUGIN_CLASSID ) ) { diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 1e5b7ccc9a9c..c67971cc86b6 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -5044,8 +5044,7 @@ void DocxAttributeOutput::WritePostponedChart() OString aRelId; m_nChartCount++; - uno::Reference< frame::XModel > xModel( xChartDoc, uno::UNO_QUERY ); - aRelId = m_rExport.OutputChart( xModel, m_nChartCount, m_pSerializer ); + aRelId = m_rExport.OutputChart( xChartDoc, m_nChartCount, m_pSerializer ); m_pSerializer->singleElementNS( XML_c, XML_chart, FSNS( XML_xmlns, XML_c ), GetExport().GetFilter().getNamespaceURL(OOX_NS(dmlChart)).toUtf8(), diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 813839e4b84a..9a3d37c47b5b 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -1322,13 +1322,13 @@ void DocxExport::WriteVBA() if (!xStorageBasedDocument.is()) return; - uno::Reference<embed::XStorage> xDocumentStorage(xStorageBasedDocument->getDocumentStorage(), uno::UNO_QUERY); + uno::Reference<embed::XStorage> xDocumentStorage = xStorageBasedDocument->getDocumentStorage(); OUString aMacrosName("_MS_VBA_Macros"); if (!xDocumentStorage.is() || !xDocumentStorage->hasByName(aMacrosName)) return; const sal_Int32 nOpenMode = embed::ElementModes::READ; - uno::Reference<io::XStream> xMacrosStream(xDocumentStorage->openStreamElement(aMacrosName, nOpenMode), uno::UNO_QUERY); + uno::Reference<io::XStream> xMacrosStream = xDocumentStorage->openStreamElement(aMacrosName, nOpenMode); uno::Reference<io::XOutputStream> xProjectStream; if (xMacrosStream.is()) { @@ -1352,7 +1352,7 @@ void DocxExport::WriteVBA() if (!xDocumentStorage.is() || !xDocumentStorage->hasByName(aDataName)) return; - uno::Reference<io::XStream> xDataStream(xDocumentStorage->openStreamElement(aDataName, nOpenMode), uno::UNO_QUERY); + uno::Reference<io::XStream> xDataStream = xDocumentStorage->openStreamElement(aDataName, nOpenMode); if (xDataStream.is()) { // Then the data stream, which wants to work with an already set diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 11c99b5f29d1..b7a6141f60a7 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -3920,7 +3920,7 @@ bool RtfAttributeOutput::FlyFrameOLEMath(const SwFlyFrameFormat* pFlyFrameFormat return false; m_aRunText->append("{" LO_STRING_SVTOOLS_RTF_MMATH " "); - uno::Reference<util::XCloseable> xClosable(xObj->getComponent(), uno::UNO_QUERY); + uno::Reference<util::XCloseable> xClosable = xObj->getComponent(); if (!xClosable.is()) return false; // gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast directly to the target class, diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx index d3b2789b4333..c013515899ae 100644 --- a/sw/source/filter/ww8/writerhelper.cxx +++ b/sw/source/filter/ww8/writerhelper.cxx @@ -328,9 +328,7 @@ namespace sw OSL_ENSURE( !mrPers.GetEmbeddedObjectContainer().HasEmbeddedObject( mxIPRef ), "Object in adaptor is inserted?!" ); try { - uno::Reference < css::util::XCloseable > xClose( mxIPRef, uno::UNO_QUERY ); - if ( xClose.is() ) - xClose->close(true); + mxIPRef->close(true); } catch ( const css::util::CloseVetoException& ) { diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 1a76791f8e3c..dd0fad0b0421 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1866,9 +1866,8 @@ void SwWW8ImplReader::ImportDop() uno::Reference< uno::XComponentContext > xComponentContext(comphelper::getProcessComponentContext()); uno::Reference<container::XIndexContainer> xBox = document::IndexedPropertyValues::create(xComponentContext); xBox->insertByIndex(sal_Int32(0), uno::makeAny(aViewProps)); - uno::Reference<container::XIndexAccess> xIndexAccess(xBox, uno::UNO_QUERY); uno::Reference<document::XViewDataSupplier> xViewDataSupplier(m_pDocShell->GetModel(), uno::UNO_QUERY); - xViewDataSupplier->setViewData(xIndexAccess); + xViewDataSupplier->setViewData(xBox); } m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::USE_VIRTUAL_DEVICE, !m_xWDop->fUsePrinterMetrics); diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx index 6beddecc3691..9bb3521e51ea 100644 --- a/sw/source/filter/ww8/ww8par4.cxx +++ b/sw/source/filter/ww8/ww8par4.cxx @@ -210,7 +210,7 @@ SwFlyFrameFormat* SwWW8ImplReader::InsertOle(SdrOle2Obj &rObject, SwFlyFrameFormat *pRet = nullptr; std::unique_ptr<SfxItemSet> pMathFlySet; - uno::Reference < embed::XClassifiedObject > xClass( rObject.GetObjRef(), uno::UNO_QUERY ); + uno::Reference < embed::XClassifiedObject > xClass = rObject.GetObjRef(); if( xClass.is() ) { SvGlobalName aClassName( xClass->getClassID() ); diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx index c03777bbbdf8..a2406cf34d11 100644 --- a/sw/source/filter/ww8/ww8toolbar.cxx +++ b/sw/source/filter/ww8/ww8toolbar.cxx @@ -579,7 +579,7 @@ SwTBC::ImportToolBarControl( SwCTBWrapper& rWrapper, const css::uno::Reference< return false; if ( !bIsMenuBar ) { - if ( !helper.createMenu( pMenu->Name(), uno::Reference< container::XIndexAccess >( xMenuDesc, uno::UNO_QUERY ) ) ) + if ( !helper.createMenu( pMenu->Name(), xMenuDesc ) ) return false; } else diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index 25c415d65fcd..f82b4709c406 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -529,7 +529,7 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con OSL_ENSURE( pDocSh, "XMLReader::Read: got no doc shell" ); if( !pDocSh ) return ERR_SWG_READ_ERROR; - uno::Reference< lang::XComponent > xModelComp( pDocSh->GetModel(), UNO_QUERY ); + uno::Reference< lang::XComponent > xModelComp = pDocSh->GetModel(); OSL_ENSURE( xModelComp.is(), "XMLReader::Read: got no model" ); if( !xModelComp.is() ) diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx index 5ca7e7212be6..e4cef6663a15 100644 --- a/sw/source/filter/xml/wrtxml.cxx +++ b/sw/source/filter/xml/wrtxml.cxx @@ -543,9 +543,8 @@ bool SwXMLWriter::WriteThroughComponent( xSaxWriter->setOutputStream( xOutputStream ); // prepare arguments (prepend doc handler to given arguments) - uno::Reference<xml::sax::XDocumentHandler> xDocHandler( xSaxWriter,UNO_QUERY); Sequence<Any> aArgs( 1 + rArguments.getLength() ); - aArgs[0] <<= xDocHandler; + aArgs[0] <<= xSaxWriter; std::copy(rArguments.begin(), rArguments.end(), std::next(aArgs.begin())); // get filter component diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index da4020083fbc..20457677a024 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -314,7 +314,7 @@ XMLShapeExport* SwXMLExport::CreateShapeExport() Reference < XDrawPageSupplier > xDPS( GetModel(), UNO_QUERY ); if( xDPS.is() ) { - Reference < XShapes > xShapes( xDPS->getDrawPage(), UNO_QUERY ); + Reference < XShapes > xShapes = xDPS->getDrawPage(); pShapeExport->seekShapes( xShapes ); } diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 0c9f5e84ae84..aee43cb6f1ae 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1186,8 +1186,7 @@ SvTextShapeImportHelper::SvTextShapeImportHelper(SvXMLImport& rImp) : } xPage = xSupplier->getDrawPage(); - Reference<XShapes> xShapes( xPage, UNO_QUERY ); - XMLShapeImportHelper::startPage( xShapes ); + XMLShapeImportHelper::startPage( xPage ); } } @@ -1197,8 +1196,7 @@ SvTextShapeImportHelper::~SvTextShapeImportHelper() if (xPage.is()) { - Reference<XShapes> xShapes( xPage, UNO_QUERY ); - XMLShapeImportHelper::endPage(xShapes); + XMLShapeImportHelper::endPage(xPage); } } diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index 21c2a19dfef1..fc1475647b82 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -295,8 +295,7 @@ IMPL_LINK_NOARG(SwAddressListDialog, CreateHdl_Impl, weld::Button&, void) const OUString sURL = aDlg.GetURL(); try { - uno::Reference<XSingleServiceFactory> xFact( m_xDBContext, UNO_QUERY); - uno::Reference<XInterface> xNewInstance = xFact->createInstance(); + uno::Reference<XInterface> xNewInstance = m_xDBContext->createInstance(); INetURLObject aURL( sURL ); const OUString sNewName = aURL.getBase(); //find a unique name if sNewName already exists @@ -342,8 +341,7 @@ IMPL_LINK_NOARG(SwAddressListDialog, CreateHdl_Impl, weld::Button&, void) } xStore->storeAsURL(sTmpName, Sequence< PropertyValue >()); - uno::Reference<XNamingService> xNaming(m_xDBContext, UNO_QUERY); - xNaming->registerObject( sFind, xNewInstance ); + m_xDBContext->registerObject( sFind, xNewInstance ); //now insert the new source into the ListBox m_xListLB->append(m_xIter.get()); m_xListLB->set_text(*m_xIter, sFind, 0); @@ -449,7 +447,7 @@ void SwAddressListDialog::DetectTablesAndQueries( pUserData->xSource.set(xComplConnection, UNO_QUERY); uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - uno::Reference< XInteractionHandler > xHandler( InteractionHandler::createWithParent(xContext, nullptr), UNO_QUERY ); + uno::Reference< XInteractionHandler > xHandler = InteractionHandler::createWithParent(xContext, nullptr); pUserData->xConnection = SharedConnection( xComplConnection->connectWithCompletion( xHandler ) ); } if(pUserData->xConnection.is()) diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index 62b04be87fca..7edb7911cf88 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -421,9 +421,8 @@ IMPL_LINK_NOARG(SwCreateAddressListDialog, OkHdl_Impl, weld::Button&, void) const OUString sPath( SvtPathOptions().SubstituteVariable("$(userurl)/database") ); aDlgHelper.SetDisplayDirectory( sPath ); - uno::Reference< XFilterManager > xFltMgr(xFP, uno::UNO_QUERY); - xFltMgr->appendFilter( m_sAddressListFilterName, "*.csv" ); - xFltMgr->setCurrentFilter( m_sAddressListFilterName ) ; + xFP->appendFilter( m_sAddressListFilterName, "*.csv" ); + xFP->setCurrentFilter( m_sAddressListFilterName ) ; if( ERRCODE_NONE == aDlgHelper.Execute() ) { diff --git a/sw/source/ui/dbui/mmdocselectpage.cxx b/sw/source/ui/dbui/mmdocselectpage.cxx index fd2e3544639c..fb3e05110330 100644 --- a/sw/source/ui/dbui/mmdocselectpage.cxx +++ b/sw/source/ui/dbui/mmdocselectpage.cxx @@ -133,18 +133,17 @@ IMPL_LINK(SwMailMergeDocSelectPage, FileSelectHdl, weld::Button&, rButton, void) SfxObjectFactory &rFact = m_pWizard->GetSwView()->GetDocShell()->GetFactory(); SfxFilterMatcher aMatcher( rFact.GetFactoryName() ); SfxFilterMatcherIter aIter( aMatcher ); - Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY); std::shared_ptr<const SfxFilter> pFlt = aIter.First(); while( pFlt ) { if( pFlt && pFlt->IsAllowedAsTemplate() ) { const OUString sWild = pFlt->GetWildcard().getGlob(); - xFltMgr->appendFilter( pFlt->GetUIName(), sWild ); + xFP->appendFilter( pFlt->GetUIName(), sWild ); // #i40125 if(pFlt->GetFilterFlags() & SfxFilterFlags::DEFAULT) - xFltMgr->setCurrentFilter( pFlt->GetUIName() ) ; + xFP->setCurrentFilter( pFlt->GetUIName() ) ; } pFlt = aIter.Next(); diff --git a/sw/source/ui/index/cntex.cxx b/sw/source/ui/index/cntex.cxx index 361bf7520d37..1401f8a6b1fd 100644 --- a/sw/source/ui/index/cntex.cxx +++ b/sw/source/ui/index/cntex.cxx @@ -173,9 +173,8 @@ void SwMultiTOXTabDialog::CreateOrUpdateExample( OUString sIndexTypeName(OUString::createFromAscii( IndexServiceNames[ nTOXIndex <= TOX_AUTHORITIES ? nTOXIndex : TOX_USER] )); m_vTypeData[nTOXIndex].m_pxIndexSections->xDocumentIndex.set(xFact->createInstance(sIndexTypeName), uno::UNO_QUERY); - uno::Reference< text::XTextContent > xContent(m_vTypeData[nTOXIndex].m_pxIndexSections->xDocumentIndex, uno::UNO_QUERY); - uno::Reference< text::XTextRange > xRg(xCursor, uno::UNO_QUERY); - xCursor->getText()->insertTextContent(xRg, xContent, false); + uno::Reference< text::XTextContent > xContent = m_vTypeData[nTOXIndex].m_pxIndexSections->xDocumentIndex; + xCursor->getText()->insertTextContent(xCursor, xContent, false); } for(sal_uInt16 i = 0 ; i <= TOX_AUTHORITIES; i++) { diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 5b1f6c53d099..8bd225fde246 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -101,9 +101,8 @@ static OUString lcl_CreateAutoMarkFileDlg(weld::Window* pParent, const OUString& FileDialogFlags::NONE, pParent); uno::Reference < XFilePicker3 > xFP = aDlgHelper.GetFilePicker(); - uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY); - xFltMgr->appendFilter( rFileString, "*.sdi" ); - xFltMgr->setCurrentFilter( rFileString ) ; + xFP->appendFilter( rFileString, "*.sdi" ); + xFP->setCurrentFilter( rFileString ) ; if( !rURL.isEmpty() ) xFP->setDisplayDirectory( rURL ); diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index bd72af29a284..9f69596083c4 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -575,7 +575,6 @@ IMPL_LINK(SwGlossaryDlg, MenuHdl, const OString&, rItemIdent, void) SvtPathOptions aPathOpt; xFP->setDisplayDirectory(aPathOpt.GetWorkPath() ); - uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY); SfxFilterMatcher aMatcher( SwDocShell::Factory().GetFactoryName() ); SfxFilterMatcherIter aIter( aMatcher ); std::shared_ptr<const SfxFilter> pFilter = aIter.First(); @@ -583,15 +582,15 @@ IMPL_LINK(SwGlossaryDlg, MenuHdl, const OString&, rItemIdent, void) { if( pFilter->GetUserData() == FILTER_WW8 ) { - xFltMgr->appendFilter( pFilter->GetUIName(), + xFP->appendFilter( pFilter->GetUIName(), pFilter->GetWildcard().getGlob() ); - xFltMgr->setCurrentFilter( pFilter->GetUIName() ) ; + xFP->setCurrentFilter( pFilter->GetUIName() ) ; } else if( pFilter->GetUserData() == FILTER_DOCX ) { - xFltMgr->appendFilter( pFilter->GetUIName(), + xFP->appendFilter( pFilter->GetUIName(), pFilter->GetWildcard().getGlob() ); - xFltMgr->setCurrentFilter( pFilter->GetUIName() ) ; + xFP->setCurrentFilter( pFilter->GetUIName() ) ; } pFilter = aIter.Next(); @@ -934,8 +933,7 @@ void SwGlossaryDlg::ResumeShowAutoText() uno::Any aEntry(xGroup->getByName(sShortName)); uno::Reference< XAutoTextEntry > xEntry; aEntry >>= xEntry; - uno::Reference< XTextRange > xRange(xCursor, uno::UNO_QUERY); - xEntry->applyTo(xRange); + xEntry->applyTo(xCursor); } } } diff --git a/sw/source/ui/vba/vbaapplication.cxx b/sw/source/ui/vba/vbaapplication.cxx index 785c48a45057..857ca1231f89 100644 --- a/sw/source/ui/vba/vbaapplication.cxx +++ b/sw/source/ui/vba/vbaapplication.cxx @@ -388,13 +388,13 @@ void SAL_CALL SwVbaApplication::setCustomizationContext(const uno::Any& /*_custo void SAL_CALL SwVbaApplication::setStatusBar( const OUString& _statusbar ) { // ScVbaAppSettings::setStatusBar() also uses the XStatusIndicator to show this, so maybe that is OK? - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY ); + uno::Reference< frame::XModel > xModel = getCurrentDocument(); if (xModel.is()) { uno::Reference< task::XStatusIndicatorSupplier > xStatusIndicatorSupplier( xModel->getCurrentController(), uno::UNO_QUERY ); if (xStatusIndicatorSupplier.is()) { - uno::Reference< task::XStatusIndicator > xStatusIndicator( xStatusIndicatorSupplier->getStatusIndicator(), uno::UNO_QUERY ); + uno::Reference< task::XStatusIndicator > xStatusIndicator = xStatusIndicatorSupplier->getStatusIndicator(); if (xStatusIndicator.is()) xStatusIndicator->start( _statusbar, 100 ); } diff --git a/sw/source/ui/vba/vbacolumns.cxx b/sw/source/ui/vba/vbacolumns.cxx index e2049400efa6..2fbad7d3dccd 100644 --- a/sw/source/ui/vba/vbacolumns.cxx +++ b/sw/source/ui/vba/vbacolumns.cxx @@ -39,7 +39,7 @@ class ColumnsEnumWrapper : public EnumerationHelper_BASE public: ColumnsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< text::XTextTable >& xTextTable ) : mxParent( xParent ), mxContext( xContext ), mxTextTable( xTextTable ), nIndex( 0 ) { - mxIndexAccess.set( mxTextTable->getColumns(), uno::UNO_QUERY ); + mxIndexAccess = mxTextTable->getColumns(); } virtual sal_Bool SAL_CALL hasMoreElements( ) override { diff --git a/sw/source/ui/vba/vbadocuments.cxx b/sw/source/ui/vba/vbadocuments.cxx index bdf0f45e3722..0609817cc103 100644 --- a/sw/source/ui/vba/vbadocuments.cxx +++ b/sw/source/ui/vba/vbadocuments.cxx @@ -44,11 +44,10 @@ static uno::Any getDocument( uno::Reference< uno::XComponentContext > const & xContext, const uno::Reference< text::XTextDocument > &xDoc, const uno::Any& aApplication ) { // FIXME: fine as long as SwVbaDocument is stateless ... - uno::Reference< frame::XModel > xModel( xDoc, uno::UNO_QUERY ); - if( !xModel.is() ) + if( !xDoc.is() ) return uno::Any(); - SwVbaDocument *pWb = new SwVbaDocument( uno::Reference< XHelperInterface >( aApplication, uno::UNO_QUERY_THROW ), xContext, xModel ); + SwVbaDocument *pWb = new SwVbaDocument( uno::Reference< XHelperInterface >( aApplication, uno::UNO_QUERY_THROW ), xContext, xDoc ); return uno::Any( uno::Reference< word::XDocument > (pWb) ); } diff --git a/sw/source/ui/vba/vbarows.cxx b/sw/source/ui/vba/vbarows.cxx index 839a5021e870..65cdec698ef2 100644 --- a/sw/source/ui/vba/vbarows.cxx +++ b/sw/source/ui/vba/vbarows.cxx @@ -42,7 +42,7 @@ class RowsEnumWrapper : public EnumerationHelper_BASE public: RowsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< text::XTextTable >& xTextTable ) : mxParent( xParent ), mxContext( xContext ), mxTextTable( xTextTable ), nIndex( 0 ) { - mxIndexAccess.set( mxTextTable->getRows(), uno::UNO_QUERY ); + mxIndexAccess = mxTextTable->getRows(); } virtual sal_Bool SAL_CALL hasMoreElements( ) override { diff --git a/sw/source/ui/vba/wordvbahelper.cxx b/sw/source/ui/vba/wordvbahelper.cxx index 776067ff79b5..b54fb6ef3103 100644 --- a/sw/source/ui/vba/wordvbahelper.cxx +++ b/sw/source/ui/vba/wordvbahelper.cxx @@ -134,7 +134,7 @@ uno::Reference< text::XText > getCurrentXText( const uno::Reference< frame::XMod } if( xTextContent.is() ) - xTextRange.set( xTextContent->getAnchor(), uno::UNO_QUERY ); + xTextRange = xTextContent->getAnchor(); if( !xTextRange.is() ) xTextRange.set( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); @@ -142,7 +142,7 @@ uno::Reference< text::XText > getCurrentXText( const uno::Reference< frame::XMod uno::Reference< text::XText > xText; try { - xText.set( xTextRange->getText(), uno::UNO_QUERY ); + xText = xTextRange->getText(); } catch (const uno::RuntimeException&) { diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index b6c0df359aa8..481dd8e7a2c1 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -649,7 +649,7 @@ bool SwDocShell::ConvertTo( SfxMedium& rMedium ) SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get(); if( !rHtmlOpt.IsStarBasic() && rHtmlOpt.IsStarBasicWarning() && HasBasic() ) { - uno::Reference< XLibraryContainer > xLibCont(GetBasicContainer(), UNO_QUERY); + uno::Reference< XLibraryContainer > xLibCont = GetBasicContainer(); uno::Reference< XNameAccess > xLib; Sequence<OUString> aNames = xLibCont->getElementNames(); for(const OUString& rName : aNames) diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 771972fb63d5..408ec26170bd 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -582,7 +582,6 @@ void SwDocShell::Execute(SfxRequest& rReq) SfxObjectFactory &rFact = GetFactory(); SfxFilterMatcher aMatcher( rFact.GetFactoryName() ); SfxFilterMatcherIter aIter( aMatcher ); - uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY); std::shared_ptr<const SfxFilter> pFlt = aIter.First(); while( pFlt ) { @@ -592,7 +591,7 @@ void SwDocShell::Execute(SfxRequest& rReq) pFlt->GetUserData() == "CXMLV" ) ) { const OUString sWild = pFlt->GetWildcard().getGlob(); - xFltMgr->appendFilter( pFlt->GetUIName(), sWild ); + xFP->appendFilter( pFlt->GetUIName(), sWild ); } pFlt = aIter.Next(); } @@ -605,14 +604,14 @@ void SwDocShell::Execute(SfxRequest& rReq) if(bWeb) { const OUString sWild = pOwnFlt->GetWildcard().getGlob(); - xFltMgr->appendFilter( pOwnFlt->GetUIName(), sWild ); + xFP->appendFilter( pOwnFlt->GetUIName(), sWild ); } bool bError = false; // catch exception if wrong filter is selected - should not happen anymore try { - xFltMgr->setCurrentFilter( pOwnFlt->GetUIName() ); + xFP->setCurrentFilter( pOwnFlt->GetUIName() ); } catch (const uno::Exception&) { @@ -1013,12 +1012,11 @@ void SwDocShell::Execute(SfxRequest& rReq) if( pFlt ) { - uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY); const OUString sWild = pFlt->GetWildcard().getGlob(); - xFltMgr->appendFilter( pFlt->GetUIName(), sWild ); + xFP->appendFilter( pFlt->GetUIName(), sWild ); try { - xFltMgr->setCurrentFilter( pFlt->GetUIName() ) ; + xFP->setCurrentFilter( pFlt->GetUIName() ) ; } catch (const uno::Exception&) { diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx index 5bbc20421fbc..4f9690818f65 100644 --- a/sw/source/uibase/app/docshini.cxx +++ b/sw/source/uibase/app/docshini.cxx @@ -597,7 +597,7 @@ bool SwDocShell::LoadFrom( SfxMedium& rMedium ) do { // middle check loop ErrCode nErr = ERR_SWG_READ_ERROR; OUString aStreamName = "styles.xml"; - uno::Reference < container::XNameAccess > xAccess( rMedium.GetStorage(), uno::UNO_QUERY ); + uno::Reference < container::XNameAccess > xAccess = rMedium.GetStorage(); if ( xAccess->hasByName( aStreamName ) && rMedium.GetStorage()->isStreamElement( aStreamName ) ) { // Loading diff --git a/sw/source/uibase/config/StoredChapterNumbering.cxx b/sw/source/uibase/config/StoredChapterNumbering.cxx index 80439b19031d..653bd737bd0c 100644 --- a/sw/source/uibase/config/StoredChapterNumbering.cxx +++ b/sw/source/uibase/config/StoredChapterNumbering.cxx @@ -413,8 +413,7 @@ void ExportStoredChapterNumberingRules(SwChapterNumRules & rRules, uno::Reference<xml::sax::XWriter> const xWriter( xml::sax::Writer::create(xContext)); - uno::Reference<io::XActiveDataSource> const xADS(xWriter, uno::UNO_QUERY); - xADS->setOutputStream(xOutStream); + xWriter->setOutputStream(xOutStream); rtl::Reference<StoredChapterNumberingExport> exp(new StoredChapterNumberingExport(xContext, rFileName, xWriter)); diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 48ce4dc80a5a..77a2439990d1 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -327,7 +327,7 @@ struct SwDBManager::SwDBManager_Impl static void lcl_InitNumberFormatter(SwDSParam& rParam, uno::Reference<sdbc::XDataSource> const & xSource) { uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext(); - rParam.xFormatter.set(util::NumberFormatter::create(xContext), uno::UNO_QUERY); + rParam.xFormatter = util::NumberFormatter::create(xContext); uno::Reference<beans::XPropertySet> xSourceProps( (xSource.is() ? xSource @@ -2882,8 +2882,6 @@ OUString SwDBManager::LoadAndRegisterDataSource(weld::Window* pParent, SwDocShel OUString sHomePath(SvtPathOptions().GetWorkPath()); aDlgHelper.SetDisplayDirectory( sHomePath ); - uno::Reference<ui::dialogs::XFilterManager> xFltMgr(xFP, uno::UNO_QUERY); - OUString sFilterAll(SwResId(STR_FILTER_ALL)); OUString sFilterAllData(SwResId(STR_FILTER_ALL_DATA)); OUString sFilterSXB(SwResId(STR_FILTER_SXB)); @@ -2898,23 +2896,23 @@ OUString SwDBManager::LoadAndRegisterDataSource(weld::Window* pParent, SwDocShel OUString sFilterMDB(SwResId(STR_FILTER_MDB)); OUString sFilterACCDB(SwResId(STR_FILTER_ACCDB)); #endif - xFltMgr->appendFilter( sFilterAll, "*" ); - xFltMgr->appendFilter( sFilterAllData, "*.ods;*.sxc;*.odt;*.sxw;*.dbf;*.xls;*.xlsx;*.doc;*.docx;*.txt;*.csv"); - - xFltMgr->appendFilter( sFilterSXB, "*.odb" ); - xFltMgr->appendFilter( sFilterSXC, "*.ods;*.sxc" ); - xFltMgr->appendFilter( sFilterSXW, "*.odt;*.sxw" ); - xFltMgr->appendFilter( sFilterDBF, "*.dbf" ); - xFltMgr->appendFilter( sFilterXLS, "*.xls;*.xlsx" ); - xFltMgr->appendFilter( sFilterDOC, "*.doc;*.docx" ); - xFltMgr->appendFilter( sFilterTXT, "*.txt" ); - xFltMgr->appendFilter( sFilterCSV, "*.csv" ); + xFP->appendFilter( sFilterAll, "*" ); + xFP->appendFilter( sFilterAllData, "*.ods;*.sxc;*.odt;*.sxw;*.dbf;*.xls;*.xlsx;*.doc;*.docx;*.txt;*.csv"); + + xFP->appendFilter( sFilterSXB, "*.odb" ); + xFP->appendFilter( sFilterSXC, "*.ods;*.sxc" ); + xFP->appendFilter( sFilterSXW, "*.odt;*.sxw" ); + xFP->appendFilter( sFilterDBF, "*.dbf" ); + xFP->appendFilter( sFilterXLS, "*.xls;*.xlsx" ); + xFP->appendFilter( sFilterDOC, "*.doc;*.docx" ); + xFP->appendFilter( sFilterTXT, "*.txt" ); + xFP->appendFilter( sFilterCSV, "*.csv" ); #ifdef _WIN32 - xFltMgr->appendFilter(sFilterMDB, "*.mdb;*.mde"); - xFltMgr->appendFilter(sFilterACCDB, "*.accdb;*.accde"); + xFP->appendFilter(sFilterMDB, "*.mdb;*.mde"); + xFP->appendFilter(sFilterACCDB, "*.accdb;*.accde"); #endif - xFltMgr->setCurrentFilter( sFilterAll ) ; + xFP->setCurrentFilter( sFilterAll ) ; OUString sFind; if( ERRCODE_NONE == aDlgHelper.Execute() ) { diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx b/sw/source/uibase/dbui/mailmergehelper.cxx index cd01bbfb9e19..f65eb9c96620 100644 --- a/sw/source/uibase/dbui/mailmergehelper.cxx +++ b/sw/source/uibase/dbui/mailmergehelper.cxx @@ -152,7 +152,7 @@ uno::Reference< mail::XSmtpService > ConnectToSmtpServer( rConfigItem.GetMailPort(), rConfigItem.IsSecureConnection() ? OUString("Ssl") : OUString("Insecure") ); xSmtpServer->connect(xConnectionContext, xAuthenticator); - rxInMailService.set( xSmtpServer, uno::UNO_QUERY ); + rxInMailService = xSmtpServer; } catch (const uno::Exception&) { diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 75a5fd240168..2fd02b3e0ab6 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -1968,8 +1968,7 @@ bool SwTransferable::PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh, default: try { - uno::Reference < lang::XComponent > xComp( xStore, uno::UNO_QUERY ); - xComp->dispose(); + xStore->dispose(); xStore = nullptr; } catch (const uno::Exception&) diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx index a8ff226fce6f..f7e6a7b69272 100644 --- a/sw/source/uibase/lingu/olmenu.cxx +++ b/sw/source/uibase/lingu/olmenu.cxx @@ -162,7 +162,7 @@ void SwSpellPopup::fillLangPopupMenu( //6--all languages used in current document uno::Reference< css::frame::XModel > xModel; - uno::Reference< css::frame::XController > xController( pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface()->getController(), uno::UNO_QUERY ); + uno::Reference< css::frame::XController > xController = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface()->getController(); if ( xController.is() ) xModel = xController->getModel(); uno::Reference< document::XDocumentLanguages > xDocumentLanguages( xModel, uno::UNO_QUERY ); @@ -336,7 +336,7 @@ SwSpellPopup::SwSpellPopup( for( const uno::Reference< linguistic2::XDictionary >& rDic : m_aDics ) { - uno::Reference< linguistic2::XDictionary > xDicTmp( rDic, uno::UNO_QUERY ); + uno::Reference< linguistic2::XDictionary > xDicTmp = rDic; if (!xDicTmp.is() || LinguMgr::GetIgnoreAllList() == xDicTmp) continue; @@ -715,7 +715,7 @@ void SwSpellPopup::Execute( sal_uInt16 nId ) } else if (nId == m_nIgnoreWordId) { - uno::Reference< linguistic2::XDictionary > xDictionary( LinguMgr::GetIgnoreAllList(), uno::UNO_QUERY ); + uno::Reference< linguistic2::XDictionary > xDictionary = LinguMgr::GetIgnoreAllList(); if (m_bGrammarResults) { try { diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index b361136fde6d..2c70670b23b8 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -295,7 +295,6 @@ void SwSrcView::Execute(SfxRequest& rReq) TemplateDescription::FILESAVE_AUTOEXTENSION, FileDialogFlags::NONE, aEditWin->GetFrameWeld()); uno::Reference < XFilePicker3 > xFP = aDlgHelper.GetFilePicker(); - uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY); // search for an html filter for export SfxFilterContainer* pFilterCont = GetObjectShell()->GetFactory().GetFilterContainer(); @@ -306,15 +305,15 @@ void SwSrcView::Execute(SfxRequest& rReq) // filter found -> use its uiname and wildcard const OUString& rUIName = pFilter->GetUIName(); const WildCard& rCard = pFilter->GetWildcard(); - xFltMgr->appendFilter( rUIName, rCard.getGlob() ); - xFltMgr->setCurrentFilter( rUIName ) ; + xFP->appendFilter( rUIName, rCard.getGlob() ); + xFP->setCurrentFilter( rUIName ) ; } else { // filter not found OUString sHtml("HTML"); - xFltMgr->appendFilter( sHtml, "*.html;*.htm" ); - xFltMgr->setCurrentFilter( sHtml ) ; + xFP->appendFilter( sHtml, "*.html;*.htm" ); + xFP->setCurrentFilter( sHtml ) ; } xFP->setDisplayDirectory( aPathOpt.GetWorkPath() ); diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 26244630a1cc..b94db6f5b633 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1146,7 +1146,7 @@ void SwView::Execute(SfxRequest &rReq) // reset ignore lists pDoc->SpellItAgainSam( true, false, false ); // clear ignore dictionary - uno::Reference< linguistic2::XDictionary > xDictionary( LinguMgr::GetIgnoreAllList(), uno::UNO_QUERY ); + uno::Reference< linguistic2::XDictionary > xDictionary = LinguMgr::GetIgnoreAllList(); if( xDictionary.is() ) xDictionary->clear(); // put cursor to the start of the document diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx index f960d95c95a6..748f875831d3 100644 --- a/sw/source/uibase/uno/unomailmerge.cxx +++ b/sw/source/uibase/uno/unomailmerge.cxx @@ -637,7 +637,7 @@ uno::Any SAL_CALL SwXMailMerge::execute( xRowSet->execute(); // build ResultSet from properties if( !xCurConnection.is() ) xCurConnection.set( xRowSetPropSet->getPropertyValue( "ActiveConnection" ), UNO_QUERY ); - xCurResultSet.set( xRowSet, UNO_QUERY ); + xCurResultSet = xRowSet; OSL_ENSURE( xCurResultSet.is(), "failed to build ResultSet" ); } } diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx index e4069815e527..0a050a6f56fb 100644 --- a/sw/source/uibase/utlui/unotools.cxx +++ b/sw/source/uibase/utlui/unotools.cxx @@ -197,7 +197,6 @@ void SwOneExampleFrame::CreateControl() sTempURL = m_sArgumentURL; uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create(::comphelper::getProcessComponentContext()); - uno::Reference<frame::XComponentLoader> xLoader(xDesktop, uno::UNO_QUERY); uno::Sequence<beans::PropertyValue> args( comphelper::InitPropertySequence({ { "DocumentService", uno::Any(OUString("com.sun.star.text.TextDocument")) }, { "OpenFlags", uno::Any(OUString("-RB")) }, @@ -206,7 +205,7 @@ void SwOneExampleFrame::CreateControl() { "Hidden", uno::Any(true) } })); - m_xModel.set(xLoader->loadComponentFromURL(sTempURL, "_blank", 0, args), uno::UNO_QUERY); + m_xModel.set(xDesktop->loadComponentFromURL(sTempURL, "_blank", 0, args), uno::UNO_QUERY); m_aLoadedIdle.Start(); } @@ -232,7 +231,7 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer, void ) if (m_xController.is()) { - uno::Reference<frame::XFrame> xFrame(m_xController->getFrame(), uno::UNO_QUERY); + uno::Reference<frame::XFrame> xFrame = m_xController->getFrame(); uno::Reference< beans::XPropertySet > xPropSet( xFrame, uno::UNO_QUERY ); if ( xPropSet.is() ) { diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index fa1db7f69e70..a2de7b9c1bcb 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -553,7 +553,7 @@ bool SwWrtShell::InsertOleObject( const svt::EmbeddedObjectRef& xRef, SwFlyFrame if ( SotExchange::IsChart( aCLSID ) ) { - uno::Reference< embed::XEmbeddedObject > xEmbeddedObj( xRef.GetObject(), uno::UNO_QUERY ); + uno::Reference< embed::XEmbeddedObject > xEmbeddedObj = xRef.GetObject(); if ( xEmbeddedObj.is() ) { bool bDisableDataTableDialog = false; |