summaryrefslogtreecommitdiff
path: root/sw/qa/extras/rtfexport
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-07-20 13:30:53 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-20 17:59:32 +0200
commit586cfef1df9fb99aaf018029b7f06363e96bc72b (patch)
treedc4be0619ab5fccdf1e8e8780ddcdfa022e2f0eb /sw/qa/extras/rtfexport
parentf44bd7bb0ce23535f5e0ced7966677f4fff943fc (diff)
loplugin:referencecasting in sw
Change-Id: Ib5de4377b22815ba718559ff6fcfd6ab5a0547a6 Reviewed-on: https://gerrit.libreoffice.org/75999 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/qa/extras/rtfexport')
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx13
-rw-r--r--sw/qa/extras/rtfexport/rtfexport2.cxx36
-rw-r--r--sw/qa/extras/rtfexport/rtfexport3.cxx6
-rw-r--r--sw/qa/extras/rtfexport/rtfexport5.cxx33
4 files changed, 37 insertions, 51 deletions
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.