summaryrefslogtreecommitdiff
path: root/sd/qa/unit/export-tests.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sd/qa/unit/export-tests.cxx')
-rw-r--r--sd/qa/unit/export-tests.cxx252
1 files changed, 50 insertions, 202 deletions
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index ba6c3092d3f7..02e42e710a25 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -194,8 +194,7 @@ void SdExportTest::testN821567()
uno::Reference< drawing::XDrawPagesSupplier > xDoc(
xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
CPPUNIT_ASSERT_MESSAGE( "not exactly one page", xDoc->getDrawPages()->getCount() == 1 );
- uno::Reference< drawing::XDrawPage > xPage(
- xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
+ uno::Reference< drawing::XDrawPage > xPage( getPage( 0, xDocShRef ) );
uno::Reference< beans::XPropertySet > xPropSet( xPage, uno::UNO_QUERY );
uno::Any aAny = xPropSet->getPropertyValue( "Background" );
@@ -237,10 +236,7 @@ void SdExportTest::testBnc870233_1()
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_1.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
- const SdrPage *pPage = pDoc->GetPage (1);
- CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
// The problem was all shapes had the same font (the last parsed font attribues overwrote all previous ones)
@@ -266,10 +262,7 @@ void SdExportTest::testBnc870233_2()
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc870233_2.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
- const SdrPage *pPage = pDoc->GetPage (1);
- CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
// The problem was in some SmartArts font color was wrong
@@ -301,10 +294,7 @@ void SdExportTest::testN828390_4()
xDocShRef = saveAndReload( xDocShRef, PPTX );
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
- const SdrPage *pPage = pDoc->GetPage(1);
- CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
{
std::vector<EECharAttrib> rLst;
SdrObject *pObj = pPage->GetObj(0);
@@ -339,10 +329,7 @@ void SdExportTest::testN828390_5()
xDocShRef = saveAndReload( xDocShRef, PPTX );
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
- const SdrPage *pPage = pDoc->GetPage(1);
- CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
{
SdrObject *pObj = pPage->GetObj(0);
SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
@@ -361,10 +348,7 @@ void SdExportTest::testTransparentBackground()
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/transparent_background.odp"), ODP);
xDocShRef = saveAndReload( xDocShRef, ODP );
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
- const SdrPage *pPage = pDoc->GetPage (1);
- CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
const SdrTextObj *pObj1 = dynamic_cast<SdrTextObj *>( pPage->GetObj( 0 ) );
checkFontAttributes<Color, SvxBackgroundColorItem>( pObj1, Color(COL_TRANSPARENT) );
@@ -381,10 +365,7 @@ void SdExportTest::testMediaEmbedding()
xDocShRef = saveAndReload( xDocShRef, ODP );
#endif
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
- const SdrPage *pPage = pDoc->GetPage (1);
- CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
#if HAVE_FEATURE_GLTF
// First object is a glTF model
@@ -414,10 +395,7 @@ void SdExportTest::testFdo84043()
xDocShRef = saveAndReload( xDocShRef, ODP );
// the bug was duplicate attributes, causing crash in a build with asserts
- SdDrawDocument const* pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE("no document", pDoc != nullptr);
- SdrPage const* pPage = pDoc->GetPage(1);
- CPPUNIT_ASSERT_MESSAGE("no page", pPage != nullptr);
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
SdrObject const* pShape = pPage->GetObj(1);
CPPUNIT_ASSERT_MESSAGE("no shape", pShape != nullptr);
}
@@ -427,11 +405,7 @@ void SdExportTest::testFdo71961()
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo71961.odp"), ODP);
xDocShRef = saveAndReload( xDocShRef, PPTX );
-
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
- const SdrPage *pPage = pDoc->GetPage (1);
- CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
// Export to .pptx changes all text frames to custom shape objects, which obey TextWordWrap property
// (which is false for text frames otherwise and is ignored). Check that frames that should wrap still do.
@@ -460,10 +434,7 @@ void SdExportTest::testN828390()
xDocShRef = saveAndReload( xDocShRef, PPTX );
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
- const SdrPage *pPage = pDoc->GetPage(1);
- CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
{
std::vector<EECharAttrib> rLst;
// Get the object
@@ -495,10 +466,7 @@ void SdExportTest::testBnc880763()
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc880763.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
- const SdrPage *pPage = pDoc->GetPage (1);
- CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
// Check z-order of the two shapes, use background color to identify them
// First object in the background has blue background color
@@ -519,10 +487,7 @@ void SdExportTest::testBnc862510_5()
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc862510_5.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
- const SdrPage *pPage = pDoc->GetPage (1);
- CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
// Same as testBnc870237, but here we check the horizontal spacing
const SdrObject* pObj = dynamic_cast<SdrObject*>( pPage->GetObj( 1 ) );
@@ -572,16 +537,7 @@ void SdExportTest::testFdo90607()
sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/fdo90607.pptx"), PPTX);
xDocShRef = saveAndReload(xDocShRef, PPTX);
- uno::Reference< drawing::XDrawPagesSupplier > xDoc(
- xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
-
- uno::Reference< drawing::XDrawPage > xPage(
- xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
-
- const SdrPage *pPage = pDoc->GetPage(1);
- CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pPage->GetObj(1) );
CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != nullptr);
OutlinerParaObject* pOutlinerParagraphObject = pTxtObj->GetOutlinerParaObject();
@@ -860,10 +816,7 @@ void SdExportTest::testTableCellFillProperties()
xComponent->dispose();
xDocShRef = loadURL(aTempFile.GetURL(), PPTX);
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
- const SdrPage *pPage = pDoc->GetPage(1);
- CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
CPPUNIT_ASSERT( pTableObj );
@@ -895,16 +848,7 @@ void SdExportTest::testBulletStartNumber()
::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n90255.pptx"), PPTX );
xDocShRef = saveAndReload( xDocShRef, PPTX );
- uno::Reference< drawing::XDrawPagesSupplier > xDoc(
- xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
-
- uno::Reference< drawing::XDrawPage > xPage(
- xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
-
- const SdrPage *pPage = pDoc->GetPage(1);
- CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pPage->GetObj(0) );
CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != nullptr);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
@@ -919,10 +863,7 @@ void SdExportTest::testLineStyle()
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/lineStyle.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
- SdDrawDocument const* pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE("no document", pDoc != nullptr);
- SdrPage const* pPage = pDoc->GetPage(1);
- CPPUNIT_ASSERT_MESSAGE("no page", pPage != nullptr);
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
SdrObject const* pShape = pPage->GetObj(0);
CPPUNIT_ASSERT_MESSAGE("no shape", pShape != nullptr);
@@ -935,28 +876,13 @@ void SdExportTest::testLineStyle()
void SdExportTest::testRightToLeftParaghraph()
{
- ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/rightToLeftParagraph.pptx"), PPTX);
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/rightToLeftParagraph.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
-
- uno::Reference< drawing::XDrawPagesSupplier > xDoc(
- xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
-
- uno::Reference< drawing::XDrawPage > xPage(
- xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
-
- uno::Reference< beans::XPropertySet > xShape(
- xPage->getByIndex(0), uno::UNO_QUERY );
- CPPUNIT_ASSERT_MESSAGE( "no shape", xShape.is() );
+ uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
// Get first paragraph
- uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
- CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText.is() );
- uno::Reference<container::XEnumerationAccess> paraEnumAccess;
- paraEnumAccess.set(xText, uno::UNO_QUERY);
- uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration();
- uno::Reference<text::XTextRange> const xParagraph(paraEnum->nextElement(),
- uno::UNO_QUERY_THROW);
+ uno::Reference<text::XTextRange> const xParagraph( getParagraphFromShape( 0, xShape ) );
uno::Reference< beans::XPropertySet > xPropSet( xParagraph, uno::UNO_QUERY_THROW );
sal_Int16 nWritingMode = 0;
@@ -971,31 +897,13 @@ void SdExportTest::testTextboxWithHyperlink()
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/hyperlinktest.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
-
- uno::Reference< drawing::XDrawPagesSupplier > xDoc(
- xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
-
- uno::Reference< drawing::XDrawPage > xPage(
- xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
-
- uno::Reference< beans::XPropertySet > xShape(
- xPage->getByIndex(0), uno::UNO_QUERY );
- CPPUNIT_ASSERT_MESSAGE( "no shape", xShape.is() );
+ uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
// Get first paragraph
- uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
- CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText.is() );
- uno::Reference<container::XEnumerationAccess> paraEnumAccess;
- paraEnumAccess.set(xText, uno::UNO_QUERY);
- uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration();
- uno::Reference<text::XTextRange> const xParagraph(paraEnum->nextElement(),
- uno::UNO_QUERY_THROW);
+ uno::Reference<text::XTextRange> const xParagraph( getParagraphFromShape( 0, xShape ) );
// first chunk of text
- // FIXME: those should really be some convenience function (getShape, getParagraph, getRun etc.)
- uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParagraph, uno::UNO_QUERY);
- uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
- uno::Reference<text::XTextRange> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xRun( getRunFromParagraph( 0, xParagraph ) );
uno::Reference< beans::XPropertySet > xPropSet( xRun, uno::UNO_QUERY_THROW );
uno::Reference<text::XTextField> xField;
@@ -1016,16 +924,7 @@ void SdExportTest::testBulletColor()
xDocShRef = saveAndReload( xDocShRef, PPTX );
- uno::Reference< drawing::XDrawPagesSupplier > xDoc(
- xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
-
- uno::Reference< drawing::XDrawPage > xPage(
- xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
-
- const SdrPage *pPage = pDoc->GetPage(1);
- CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pPage->GetObj(0) );
CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != nullptr);
@@ -1039,11 +938,12 @@ void SdExportTest::testBulletColor()
void SdExportTest::testTdf62176()
{
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/Tdf62176.odp"), ODP);
- uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
- uno::Reference<drawing::XDrawPage> xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XDrawPage> xPage( getPage( 0, xDocShRef ) );
+
//there should be only *one* shape
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xPage->getCount());
- uno::Reference<beans::XPropertySet> xShape(xPage->getByIndex(0), uno::UNO_QUERY);
+
+ uno::Reference<beans::XPropertySet> xShape( getShape( 0, xPage ) );
//checking Paragraph's Left Margin with expected value
sal_Int32 nParaLeftMargin = 0;
xShape->getPropertyValue("ParaLeftMargin") >>= nParaLeftMargin;
@@ -1052,19 +952,18 @@ void SdExportTest::testTdf62176()
sal_Int32 nParaFirstLineIndent = 0;
xShape->getPropertyValue("ParaFirstLineIndent") >>= nParaFirstLineIndent;
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1300), nParaFirstLineIndent);
+
//Checking the *Text* in TextBox
- uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
- uno::Reference<container::XEnumerationAccess> paraEnumAccess(xText, uno::UNO_QUERY);
- uno::Reference<container::XEnumeration> paraEnum(paraEnumAccess->createEnumeration());
- uno::Reference<text::XTextRange> xParagraph(paraEnum->nextElement(), uno::UNO_QUERY_THROW);
+ uno::Reference<text::XTextRange> xParagraph( getParagraphFromShape( 0, xShape ) );
CPPUNIT_ASSERT_EQUAL(OUString("Hello World"), xParagraph->getString());
+
//Saving and Reloading the file
xDocShRef = saveAndReload(xDocShRef, ODP);
- uno::Reference<drawing::XDrawPagesSupplier> xDoc2(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
- uno::Reference<drawing::XDrawPage> xPage2(xDoc2->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XDrawPage> xPage2( getPage(0, xDocShRef ) );
//there should be only *one* shape
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xPage2->getCount());
- uno::Reference<beans::XPropertySet> xShape2(xPage2->getByIndex(0), uno::UNO_QUERY);
+
+ uno::Reference<beans::XPropertySet> xShape2( getShape( 0, xPage2 ) );
//checking Paragraph's Left Margin with expected value
sal_Int32 nParaLeftMargin2 = 0;
xShape2->getPropertyValue("ParaLeftMargin") >>= nParaLeftMargin2;
@@ -1073,26 +972,21 @@ void SdExportTest::testTdf62176()
sal_Int32 nParaFirstLineIndent2 = 0;
xShape2->getPropertyValue("ParaFirstLineIndent") >>= nParaFirstLineIndent2;
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1300), nParaFirstLineIndent2);
+
//Checking the *Text* in TextBox
- uno::Reference<text::XText> xText2 = uno::Reference<text::XTextRange>(xShape2, uno::UNO_QUERY)->getText();
- uno::Reference<container::XEnumerationAccess> paraEnumAccess2(xText2, uno::UNO_QUERY);
- uno::Reference<container::XEnumeration> paraEnum2(paraEnumAccess2->createEnumeration());
- uno::Reference<text::XTextRange> xParagraph2(paraEnum2->nextElement(), uno::UNO_QUERY_THROW);
+ uno::Reference<text::XTextRange> xParagraph2( getParagraphFromShape( 0, xShape2 ) );
CPPUNIT_ASSERT_EQUAL(OUString("Hello World"), xParagraph2->getString());
}
+
void SdExportTest::testBulletCharAndFont()
{
::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/odp/bulletCharAndFont.odp"), ODP);
xDocShRef = saveAndReload( xDocShRef, PPTX );
- uno::Reference< drawing::XDrawPagesSupplier > xDoc( xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XDrawPage > xPage( xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XShape > xShape(xPage->getByIndex(0), uno::UNO_QUERY);
- uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY_THROW)->getText();
- uno::Reference<container::XEnumerationAccess> paraEnumAccess;
- paraEnumAccess.set(xText, uno::UNO_QUERY);
- uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration();
- uno::Reference<text::XTextRange> const xParagraph(paraEnum->nextElement(), uno::UNO_QUERY_THROW);
+
+ uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
+ uno::Reference<text::XTextRange> const xParagraph( getParagraphFromShape( 0, xShape ) );
uno::Reference< beans::XPropertySet > xPropSet( xParagraph, uno::UNO_QUERY_THROW );
+
uno::Reference<container::XIndexAccess> xLevels(xPropSet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
uno::Sequence<beans::PropertyValue> aProps;
xLevels->getByIndex(0) >>= aProps; // 1st level
@@ -1142,10 +1036,7 @@ void SdExportTest::testBnc822341()
// Export an LO specific ole object (imported from an ODP document)
{
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
- const SdrPage *pPage = pDoc->GetPage(1);
- CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
const SdrObject* pObj = dynamic_cast<SdrObject*>( pPage->GetObj(0) );
CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr);
@@ -1174,18 +1065,9 @@ void SdExportTest::testBnc822341()
void SdExportTest::testBulletMarginAndIndentation()
{
::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/bulletMarginAndIndent.pptx"), PPTX );
-
xDocShRef = saveAndReload( xDocShRef, PPTX );
- uno::Reference< drawing::XDrawPagesSupplier > xDoc(
- xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XDrawPage > xPage(
- xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
-
- const SdrPage *pPage = pDoc->GetPage(1);
- CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pPage->GetObj(0) );
CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != nullptr);
@@ -1203,25 +1085,10 @@ void SdExportTest::testParaMarginAndindentation()
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/paraMarginAndIndentation.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
-
- uno::Reference< drawing::XDrawPagesSupplier > xDoc(
- xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
-
- uno::Reference< drawing::XDrawPage > xPage(
- xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
-
- uno::Reference< beans::XPropertySet > xShape(
- xPage->getByIndex(0), uno::UNO_QUERY );
- CPPUNIT_ASSERT_MESSAGE( "no shape", xShape.is() );
+ uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
// Get first paragraph
- uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
- CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText.is() );
- uno::Reference<container::XEnumerationAccess> paraEnumAccess;
- paraEnumAccess.set(xText, uno::UNO_QUERY);
- uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration();
- uno::Reference<text::XTextRange> const xParagraph(paraEnum->nextElement(),
- uno::UNO_QUERY_THROW);
+ uno::Reference<text::XTextRange> const xParagraph( getParagraphFromShape( 0, xShape ) );
uno::Reference< beans::XPropertySet > xPropSet( xParagraph, uno::UNO_QUERY_THROW );
sal_Int32 nParaLeftMargin = 0;
@@ -1241,15 +1108,7 @@ void SdExportTest::testCellLeftAndRightMargin()
xDocShRef = saveAndReload( xDocShRef, PPTX );
sal_Int32 nLeftMargin, nRightMargin;
- uno::Reference< drawing::XDrawPagesSupplier > xDoc(
- xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
-
- uno::Reference< drawing::XDrawPage > xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
-
- const SdrPage *pPage = pDoc->GetPage(1);
- CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
CPPUNIT_ASSERT( pTableObj );
@@ -1279,14 +1138,7 @@ void SdExportTest::testTableCellBorder()
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/n90190.pptx"), PPTX);
xDocShRef = saveAndReload( xDocShRef, PPTX );
- uno::Reference< drawing::XDrawPagesSupplier > xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
-
- uno::Reference< drawing::XDrawPage > xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
- SdDrawDocument *pDoc = xDocShRef->GetDoc();
- CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
-
- const SdrPage *pPage = pDoc->GetPage(1);
- CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
CPPUNIT_ASSERT( pTableObj );
@@ -1335,15 +1187,11 @@ void SdExportTest::testTdf80224()
{
::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/odp/tdf80224.odp"), ODP);
xDocShRef = saveAndReload( xDocShRef, PPTX );
- uno::Reference< drawing::XDrawPagesSupplier > xDoc( xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XDrawPage > xPage( xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
- uno::Reference< drawing::XShape > xShape(xPage->getByIndex(0), uno::UNO_QUERY);
- uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY_THROW)->getText();
- uno::Reference<container::XEnumerationAccess> paraEnumAccess;
- paraEnumAccess.set(xText, uno::UNO_QUERY);
- uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration();
- uno::Reference<text::XTextRange> const xParagraph(paraEnum->nextElement(), uno::UNO_QUERY_THROW);
+ uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
+
+ uno::Reference<text::XTextRange> const xParagraph( getParagraphFromShape( 0, xShape ) );
uno::Reference< beans::XPropertySet > xPropSet( xParagraph->getStart(), uno::UNO_QUERY_THROW );
+
sal_Int32 nCharColor;
xPropSet->getPropertyValue("CharColor") >>= nCharColor;
CPPUNIT_ASSERT_EQUAL(sal_Int32(6644396), nCharColor);