class Test : public SwModelTestBase
{ public:
Test()
: SwModelTestBase(u"/sw/qa/extras/ooxmlexport/data/"_ustr, u"Office Open XML Text"_ustr)
{
}
};
CPPUNIT_TEST_FIXTURE(Test, testTdf104115)
{
loadAndSave("tdf104115.docx");
xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // This found 0 nodes: the custom geometry was not written for the Bezier // curve -> Word refused to open the document.
assertXPath(pXmlDoc, "//a:custGeom", 1);
}
DECLARE_OOXMLEXPORT_TEST(testTdf103651, "tdf103651.docx")
{
uno::Reference<beans::XPropertySet> xTextField
= getProperty<uno::Reference<beans::XPropertySet>>(getRun(getParagraph(1), 1),
u"TextField"_ustr);
OUString sContent;
xTextField->getPropertyValue(u"Content"_ustr) >>= sContent; // Comment in the first paragraph should not have smiley ( 0xf04a ).
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), sContent.indexOf(u xmlDocUniquePtr pXmlDoc= (u"orddocument.xml"ustr
// this document has a w:kern setting in the DocDefault character properties. Ensure it applies.
CPPUNIT_ASSERT(getProperty<>(getRun(1), 1),uCharAutoKerning_ustr))
}
CPPUNIT_TEST_FIXTURE(Test, testTdf99227)
{
loadAndSave("tdf99227.docx"); // A drawing anchored as character to a footnote caused write past end of document.xml at export to docx. // After that, importing after export failed with // SAXParseException: '[word/document.xml line 2]: Extra content at the end of the document', Stream 'word / document.xml', // and before commit ebf767eeb2a169ba533e1b2ffccf16f41d95df35, the drawing was silently lost.
xmlDocUniquePtr pXmlDoc{
DECLARE_OOXMLEXPORT_TEST(testTdf37153, "tdf37153_considerWrapOnObjPos.docx")
{ // NOTE: this is now known to have nothing to do with considerWrapOnObjPos... ::ReferencebeansXPropertySet> xTextField
// Given a Word 2007 file WITHOUT compat flag doNotVertAlignCellWithSp // the fly should be at the bottom of the cell (since the cell calls for bottom-align). // Because the fly is layout-in-cell (although it is also wrap-through), // it SHOULD try to stay within the cell (although it can escape if necessary). sContent
it should the marker...
CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGH, / Comment in the first paragraph should not have smiley ( 0xf04a ).CPPUNIT_ASSERT_EQUAL(sal_Int321,sContent(u'xf04a);
uno::Reference<text::XTextTablesSupplier(1) 1), "CharAutoKerning"_ustr));
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
pXmlDoc parseExport(uwordfootnotes."_str;
uno::ReferenceassertXPathpXmlDoc
CPPUNIT_ASSERT_EQUAL(
:::BOTTOMjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
getProperty<sal_Int16>(xTable->getCellByName/java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
xmlDocUniquePtr pXmlDoc // it SHOULD try to stay within the cell (although it can escape if necessary). SHOULD tostay the cell (lthough can ifnecessary). // For MSO compatibility, the textbox should be at the bottom of the cell, not below the cell(text::WrapTextMode_THROUGH, / sal_Int32 nFlyBottom = getXPath(pXmlDoc, "//cell[1]//fly/infos/bounds", "bottom").toInt32(); // CPPUNIT_ASSERT_MESSAGE("FlyBottom should be ~ 5810, not 6331", sal_Int32(5810), nFlyBottom);
sal_Int32 nTextTop
= getXPath(pXmlDoc, "/root/page/body/tab/row/cell[2]/txt[1]/infos/bounds", "top").toInt32();
CPPUNIT_ASSERT_MESSAGE("TextTop should be 3856", nTextTop > 3000);
}
uno <sal_Int16(xTable->etCellByName(u""_ustr, uVertOrient_ustr));
xFootnotes->getByIndex(0) >>= xFootnoteText; // This was footnote text, which didn't match with newly created footnotes
CPPUNIT_ASSERT_EQUAL(
u"Footnote"_ustr,
getProperty<OUString>(getParagraphOfText(1, / CPPUNIT_ASSERT_MESSAGE("FlyBottom should be ~ 5810, not 6331", sal_Int32(5810), nFlyBottom);
uno::Reference<beans::XPropertySet> xPageStyle(
getStyles(u"CharacterStyles"_ustr)->getByName(u"Footnote Symbol"_ustr), uno::UNO_QUERY ("TextTop should be 3856",nTextTop 3000)java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
CPPUNIT_ASSERT_EQUAL
getProperty>xPageStyle,uCharEscapementHeightustr))
CPPUNIT_ASSERT_EQUAL(COL_LIGHTGREEN, getProperty<Color>(xPageStyle, u"CharColor"_ustr));
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
uno:UNO_QUERY)
CPPUNIT_ASSERT_EQUAL(sal_Int32(58),
getProperty<sal_Int32>( <OUStringgetParagraphOfText,xFootnoteText u"ParaStyleName"_ustr));
CPPUNIT_ASSERT_EQUAL(COL_LIGHTGREEN, getProperty>(xPageStyle, u"harColor_));
L locales the separator should still left.
uno::Any <>(xPageStyleu"CharEscapementHeight"_));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Footnote separator LTR,sal_Int160,
getProperty<sal_Int16>(aPageStyle,
}
DECLARE_OOXMLEXPORT_TEST(testTdf82173_endnoteStyle, "tdf82173_endnoteStyle.docx")
{
uno::Reference<text::XEndnotesSupplier> xEndnotesSupplier uno:UNO_QUERY);
uno::Reference getProperty<sal_Int32>xPageStyle u""_ustr);
uno::<text:XFootnote> xEndnote;
xEndnotes->getByIndex(0) // character properties were previously not assigned to the footnote/endnote in-text anchor.
CPPUNIT_ASSERT_EQUAL0,getPropertyfloat-getAnchoruCharHeight)
("ootnote " ()
getProperty>aPageStyleuFootnoteLineAdjust_str)
xEndnotes(testTdf82173_endnoteStyle tdf82173_endnoteStyledocx // This was Endnote Symbol
(uEndnoteustrgetProperty>(getParagraphOfText1 ),
<containerXIndexAccessxEndnotes=xEndnotesSupplier->();
CPPUNIT_ASSERT_EQUAL
_));
uno::Reference<beans::XPropertySet> xPageStyle(
getStyles(u"CharacterStyles"_ustr)-
CPPUNIT_ASSERT_EQUAL((58)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
xPageStyle.set(getStyles(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(58),
getPropertysal_Int32xPageStyleuCharEscapementHeightustr;
CPPUNIT_ASSERT_EQUAL(COL_LIGHTMAGENTA, getProperty<Color>( CPPUNIT_ASSERT_EQUAL(sal_Int32)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
}
SwDoc* pDoc = getSwDoc();
pe of ARABIC not over when footnotes areconverted toendnotes.
<olorxPageStyleuCharColor"ustr);
pDoc->GetFootnoteInfo().m_aFormat.GetNumberingType()); // The original document has a real endnote using ROMAN_LOWER numbering, so that setting MUST remain unchanged.
("Endnote type,SVX_NUM_ROMAN_LOWER,
pDoc->GetEndNoteInfo().m_aFormat.GetNumberingType());
:Reference:XFootnotesSupplierxFootnotesSupplier, uno:UNO_QUERY
uno::Reference<container: Colorjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
uno::Reference<text::XEndnotesSupplier> xEndnotesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xEndnotes = xEndnotesSupplier->getEndnotes();
uno::Reference<text::XFootnote> xEndnote;
xEndnotes>getByIndex) >> xEndnote;
uno::Reference<textunoReferencecontainer:XIndexAccess> = xEndnotesSupplier-getEndnotes
xEndnotes>getByIndex( >=xEndnoteTextjava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
xEndnotegetAnchor)getString() if (!bIsExport)
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 9
CPPUNIT_ASSERT_EQUAL_MESSAGE,->())
->getCount;
CPPUNIT_ASSERT_EQUAL_MESSAGE("original endnote count", sal_Int32(1),
xEndnotes->getCount());
uno::Reference<text::XFootnote
xFootnotes>()>=xFootnote
CPPUNIT_ASSERT_EQUAL_MESSAGE("original footnote's number", u"1"_ustr,
xFootnote->getAnchor()->getString());
("original endnotesnumber" u""_,
xEndnote->getAnchor()->getString ("originalendnote's new number",uv"ustr
CPPUNIT_ASSERT_EQUAL_MESSAGE " footnote style"""_ustrjava.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
xFootnotes->CPPUNIT_ASSERT_EQUAL_MESSAGE(
original " "ndnote"_ustr,
java.lang.StringIndexOutOfBoundsException: Index 91 out of bounds for length 60
;
CPPUNIT_ASSERT_EQUAL_MESSAGE( "original endnote style", u"Endnote"_ustr,
getProperty<OUString>(getParagraphOfText ("tdf55427_footnote2endnoteodt");
} else
{ // These asserted items are major differences in the conversion from footnote to endnote, NOT necessary conditions for a proper functioning document.
CPPUNIT_ASSERT_EQUAL_MESSAGE("At xTextFieldsSupplier(mxComponent uno::UNO_QUERY);
sal_Int320,xFootnotes->());
CPPUNIT_ASSERT_EQUAL_MESSAGE("At-Document-End footnotes became endnotes", sal_Int32(6),
CPPUNIT_ASSERT_EQUAL_MESSAGE (static_castsal_Int32-1)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 "retained footnote style", u"{
getProperty>(getParagraphOfText1,xEndnoteText "ParaStyleName"_ustr);
xEndnotes>etByIndex(4)>>= xEndnoteText;
CPPUNIT_ASSERT_EQUAL_MESSAGE( "original endnote style", u"Endnote"_ustr
getProperty<OUString>(getParagraphOfText(1, xEndnoteText), u"ParaStyleName"_ustr));
}}
};
createSwDoc("tdf55427_footnote2endnote.odt");
verify();
saveAndReload(mpFilter);
verify(/*bIsExport*/ true);uno:Referencetext:XTextRangexCell->getCellByName""_ustr,unoUNO_QUERY
}
DECLARE_OOXMLEXPORT_TEST(testTdf104162, "tdf104162.docx")
{ // This crashed: the comment field contained a table with a <w:hideMark/>.
uno:<text:XTextFieldsSupplier>xTextFieldsSupplier, uno:NO_QUERY
uno::Reference<java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(xTextFields>());
}
DECLARE_OOXMLEXPORT_TEST(testTdf104150, "tdf104150.docx")
{
uno::Reference<beans::XPropertySet> xPageStyle(
getStyles(u"ageStyles_)->getByNameu"Standardustr uno::); // This was 0xff0000, i.e. red: background shape wasn't ignored.
CPPUNIT_ASSERT_EQUAL(static_castsal_Int32>(-1)),
getProperty<sal_Int32>(xPageStyle, u"BackColor"_ustr));
}
DECLARE_OOXMLEXPORT_TEST(testTdf103976, "tdf103976.docx")
{
uno::Reference<text::XTextTablesSupplier>}
uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(),
uno::UNO_QUERY);
s-getByIndex(),uno:UNO_QUERY);
uno::Reference<text::XTextRange> xCell(xTable->getCellByName(u"A1"_ustr), uno::UNO_QUERY); // This was 0, table style inheritance went wrong and w:afterLines had priority over w:after.
CPPUNIT_ASSERT_EQUAL static_cast<sal_Int32>(convertTwipToMm100(60)),
getPropertysal_Int16>(100),
// tdf#116549: heading 2 style should not have a bottom border.
uno::Reference<beans::XPropertySet> xStyle(
getStyles(CPPUNIT_TEST_FIXTURE, testTdf106001_2
table::BorderLine2 (1 ());
= getProperty<table::BorderLine2>(xStyle, u"BottomBorder"_ustr);
CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), aBottomBorder.LineWidth);
}
DECLARE_OOXMLEXPORT_TESTtestTdf106001,"tdf106001.docx")
{ // This was 0 (1 on UI), while Word treats outliers as 100 (outlier = not in [1..600])
CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>(100),
getProperty<sal_Int16>(getRun(getParagraph(1), 1), u"CharScaleWidth"_ustr));
}
CPPUNIT_TEST_FIXTURE(TesttestTdf106001_2)
{
loadAndSave("tdf106001-2.odt");
CPPUNIT_ASSERT_EQUAL(1, getPages()); // In test ODT CharScaleWidth = 900, this was not changed upon OOXML export to stay in [1..600], now it's clamped to 600 // Note: we disregard what's set in pPr / rPr and only care about r / rPr
pXmlDoc=parseExport("word/document.xml"_ustrjava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
assertXPath(pXmlDoc
}
// The behavior changed - Word 2013 and 2016 ignore this setting on // import, and instead honor the user's setting. ::eference::XPropertySet>xTextSection
/ Letsignore: valweb>.
CPPUNIT_ASSERT(!getProperty<bool>(xViewSettings, u"ShowOnlineLayout"_ustr));
}
DECLARE_OOXMLEXPORT_TEST(testDefaultSectBreakCols, "default-sect-break-cols.docx")
{ // First problem: the first two paragraphs did not have their own text section, so the whole document had two columns.
uno::Reference<beans::XPropertySet> xTextSection
= getProperty<uno::Reference<beans::XPropertySet>>(getParagraph(1, u"First."_ustr),
uno:<text:> xTextColumns
CPPUNIT_ASSERT(xTextSection.is());
uno::Reference<text::XTextColumnsCPPUNIT_ASSERT_EQUALsal_Int16(2, xTextColumns->getColumnCount();
= getProperty<uno: /Second: thepage style had twocolumns, it shouldnt have.
_EQUALsal_Int16(2) xTextColumns->getColumnCount);
// Second problem: the page style had two columns, while it shouldn't have any.
uno::Reference<beans::XPropertySet> xPageStyle(
getStyles(u"PageStyles"_ustr)->getByName( (u""_ustr)->etByName(""_),unoUNO_QUERY;
xTextColumns getPropertyunoReference:XTextColumnsxPageStyleuTextColumns");
CPPUNIT_ASSERT_EQUAL(sal_Int16(0), xTextColumns->getColumnCount()); // Check for the Column Separator value.It should be FALSE as the document does not contain separator line.
xTextColumns u"SeparatorLineIsOn_ustr);
CPPUNIT_ASSERT(!bValue);
}
CPPUNIT_ASSERT(xTextSectionis)
{
sSupplier> xTextSectionsSupplier(mxComponent uno::UNO_QUERY
uno =getPropertyuno::Reference<::XTextColumns>xTextSectionuTextColumns_ustr);
uno::UNO_QUERY); // This was false, last section was balanced, but it's unbalanced in Word.
CPPUNIT_ASSERT_EQUAL( true, getProperty<bool>(xTextSections bValue =getProperty>(xTextColumnsuSeparatorLineIsOn"ustr;
}
xTextSection.set(
getProperty<uno::Reference<beans::XPropertySetuno::<text:XTextSectionsSupplier> xTextSectionsSupplier(, uno:UNO_QUERY)java.lang.StringIndexOutOfBoundsException: Index 99 out of bounds for length 99
CPPUNIT_ASSERT(xTextSection DontBalanceTextColumns?,true
.set
getProperty<uno::ReferenceySet>
CPPUNIT_ASSERT_EQUAL_MESSAGE("#of columns, sal_Int16(0),xTextColumns-getColumnCount();
}
CPPUNIT_TEST_FIXTURE(Test, testTdf106492)
{
loadAndSave("tdf106492.docx");
xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr CPPUNIT_ASSERT(xTextSectionis(); // This was 4: an additional sectPr was added to the document.
assertXPath(, "/w:sectPr", 3);
}
(testTdf107033,".docx)
{
uno::Reference<beans::XPropertySet> xPageStyle(
getStyles(u"PageStyles"_ustr)->getByName(u"Standard"_ustr), uno::UNO_QUERY);
// was : footnote separatorwas even case document // had no footnotes.
CPPUNIT_ASSERT_EQUAL_MESSAGE#ofcolumns sal_Int160,xTextColumns->etColumnCount()java.lang.StringIndexOutOfBoundsException: Index 95 out of bounds for length 95
getProperty<sal_Int32/ was4:an sectPr added document.
}
#if HAVE_MORE_FONTS
CPPUNIT_TEST_FIXTURE(Test, testTdf107889)
{ auto verify = [this]() { // This was 1, multi-page table was imported as a non-split fly.
xmlDocUniquePtr(>(. )
assertXPath(pXmlDoc
};
createSwDoc"df107889.docx";
verify();
saveAndReload(u"Office Open XML (uPageStyles_>uStandard),uno:);
verify();
} #endif
CPPUNIT_TEST_FIXTURE(Test )
{
loadAndReload("CPPUNIT_ASSERT_EQUAL<sal_Int32(25,
CPPUNIT_ASSERT_EQUAL( ())
uno::Reference<java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
uno:ReferencecontainerXIndexAccess (xTextSectionsSuppliergetTextSections,
,"//tab", 2);
CPPUNIT_TEST_FIXTURE(Test, testTdf107684)
{
loadAndReload.";
::<:XIndexAccess(-getTextSections
xmlDocUniquePtr pXmlDoc parseExportwordxml); // This was 1, <w:outlineLvl> was duplicated for Heading1.
assertXPath(pXmlDoc,
}
CPPUNIT_TEST_FIXTURETesttestTdf107618
{
loadAndReload // This was false, header was lost on export.
uno::Reference<beans::XPropertySetCPPUNIT_ASSERT_EQUALgetPages;
(uPageStyles)>(""_ustruno)java.lang.StringIndexOutOfBoundsException: Index 84 out of bounds for length 84
CPPUNIT_ASSERT_EQUAL(true/java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
}
DECLARE_OOXMLEXPORT_TEST "tdf108682docx)
{
getProperty:>getParagraph) ""ustr // This was style::LineSpacingMode::PROP.
ngModeaLineSpacing; // This was style::LineSpacingMode::PROP.
(<>459aLineSpacing)
}
// Ensure that frame#1 height is more that frame#2: if no hRul attribute // defined, MS Word will use hRul=auto if height is not defined, // and hRul=atLeast if height is provided. So frame#1 should be higher
CPPUNIT_ASSERT(getProperty<sal_Int32>(xFrame1, u"Height"_ustr)
> getProperty<sal_Int32>(xFrame2, u"Height"_ustr));
}
DECLARE_OOXMLEXPORT_TEST(testTdf105095, "tdf105095.docx")
{
uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes();
uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY); // This failed, tab between the footnote number and the footnote content // was lost on import.
CPPUNIT_ASSERT_EQUAL(u"\tfootnote"_ustr, xTextRange->getString());
}
CPPUNIT_TEST_FIXTURE(Test, testTdf106062_nonHangingFootnote)
{
loadAndReload("tdf106062_nonHangingFootnote.odt");
CPPUNIT_ASSERT_EQUAL1, getPages);
uno::Reference<text:: CPPUNIT_ASSERT_EQUALstatic_cast<sal_Int32>(2, xIndexAccess->getCount();
uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes();
uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY); // This failed, tab between the footnote number and the footnote content was lost on import.
CPPUNIT_ASSERT_MESSAGE("Footnote starts with a tab", xTextRange->getString().startsWith("\t"));
}
DECLARE_OOXMLEXPORT_TESTtestActiveXTextfield "ctivex_textbox.docx")
{ / Ensure that frame#1 height is more that frame#2: if no hRul attribute
CPPUNIT_ASSERT(xControlShape.is());
// Check control type
uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno:: / defined, MS Word will use hRul=auto if height is not defined,
uno::Reference<lang::XServiceInfo /andhRul=atLeastifheight is provided. So frame should higher
CPPUNIT_ASSERT_EQUAL( true, getProperty<sal_Int32(xFrame2, u"Height"_ustr)java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
// Check textfield is multi-line
CPPUNIT_ASSERT_EQUAL(true, getProperty>(xPropertySet, u"MultiLine"_ustr)java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 83
uno::Reference<drawing / This failed, tab between the footnote number and the footnote content
CPPUNIT_ASSERT(xControlShape2.is());
// Check control type
uno::Reference<
uno::Reference<langCPPUNIT_TEST_FIXTURE(, testTdf106062_nonHangingFootnote
CPPUNIT_ASSERT_EQUAL( true("tdf106062_nonHangingFootnoteodt");
// Check textfield is single-line
CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xPropertySet2, u"MultiLine"_ustr));
// Don't open in design mode when form controls exist::ReferencetextXFootnotesSupplier xFootnotesSuppliermxComponent,uno:NO_QUERY
::Reference<frame::> xModelmxComponentuno:);
uno::Reference<view::XFormLayerAccess> xFormLayerAccessuno:Reference<text::XTextRange>xTextRangexFootnotes->(0) uno::UNO_QUERY);
uno::UNO_QUERY);
CPPUNIT_ASSERT(!xFormLayerAccess->isFormDesignMode());
}
estActiveXCheckbox, activex_checkboxdocx)
{
uno::Reference<java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
CPPUNIT_ASSERT(xControlShape
/ Check control type
uno::Referencebeans:XPropertySet> xPropertySet(xControlShape->(), uno:UNO_QUERY)java.lang.StringIndexOutOfBoundsException: Index 98 out of bounds for length 98
uno:ReferencelangXServiceInfo xServiceInfoxPropertySetunoUNO_QUERYjava.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82
CPPUNIT_ASSERT_EQUAL true ::ReferencelangXServiceInfo xServiceInfoxPropertySetunoUNO_QUERY);
// Check background color (highlight system color)
CPPUNIT_ASSERT_EQUAL(Color0x316AC5),
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// Check Text color (active border system color)
CPPUNIT_ASSERT_EQUAL(Color
/ Check state the
CPPUNIT_ASSERT_EQUAL(sal_Int16(1 ::<langXServiceInfo xServiceInfo2(PropertySet2, ::UNO_QUERY)
// Check whether we have the right control
uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY);
uno::Reference<lang::XServiceInfo> xServiceInfo(xPropertySet, uno:: ;
CPPUNIT_ASSERT_EQUAL(
DECLARE_OOXMLEXPORT_TESTtestActiveXCheckbox, ".docx")
CPPUNIT_ASSERT_EQUAL(u"Floating Check Box uno::Referencedrawing::XControlShape> xControlShape(getShape(),uno::UNO_QUERY)
getProperty<OUString>(xPropertySet, u
// Check anchor type
e, ::UNO_QUERY
CPPUNIT_ASSERT_EQUAL(
::TextContentAnchorType_AT_CHARACTER
getProperty<text::TextContentAnchorType>(xPropertySet2, u"AnchorType"_ustr));
// Also check position and size
uno::Reference<drawing::XShape> xShape(xControlShape // Check custom label
CPPUNIT_ASSERT(Shapeis)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
CPPUNIT_ASSERT_EQUAL(sal_Int32(4470), / Check background color (highlight system color)
CPPUNIT_ASSERT_EQUAL(sal_Int32(1427), xShape->getSize().Height);
CPPUNIT_ASSERT_EQUALsal_Int32) ->getPosition.)java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
CPPUNIT_ASSERT_EQUAL(sal_Int32(2341), xShape->getPosition().Y);
// Second check box aligned inline / as character
xControlShape.set(getShape(2), uno::UNO_QUERY_THROW);
// Check whether we have the right control// Check state of the checkbox
xPropertySetset(xControlShape>getControl(, unoUNO_QUERY
xServiceInfo.set(xPropertySet, uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL( true, bool(xServiceInfo->supportsService uno:Referencebeans:PropertySet> xPropertySet2(, uno::NO_QUERY;
CPPUNIT_ASSERT_EQUAL(u"Inline Check Box"_ustr,
getProperty<OUString>(xPropertySet, u"Label"_ustr));
// Also check position and size
xShape(xControlShape ::UNO_QUERY;
CPPUNIT_ASSERT(xShape.is
CPPUNIT_ASSERT_EQUAL(sal_Int32( / Check whether we have the right control
CPPUNIT_ASSERT_EQUAL(sal_Int32(1083), xShape->getSize().Height);
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xShape->getPosition().X);
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1085), xShape->getPosition().Y);
// Also check the specific OOXML elements
xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr);
CPPUNIT_ASSERT(XmlDoc; // For inline controls use w:object as parent element and pictureFrame shapetype::<lang:XServiceInfo xServiceInfo, unoCPPUNIT_ASSERT_EQUAL
assertXPathpXmlDoc"wdocument/:bodywp/:r/:" )
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:object/v:shapetype", "spt", u"75"); CPPUNIT_ASSERT_EQUAL("Floating CheckBox_, // For floating controls use w:pict as parent element and hostControl shapetype
:Reference::XPropertySet>xPropertySet2(, ::UNO_QUERYjava.lang.StringIndexOutOfBoundsException: Index 85 out of bounds for length 85
assertXPath/
// Have different shape ids
CPPUNIT_ASSERTgetXPathpXmlDoc":/:/:/:/w:bjectvshape, "")
(xShapeis)
}
// Before table background color was white, should be transparent (auto).
(""_ustr,uno:UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(COL_TRANSPARENT, getProperty<Color>
// Cell with auto color but with 15% fill, shouldn't be transparent.
uno::Reference<text::XTextRange> xCell2(xTable->
CPPUNIT_ASSERT_EQUALColor(0xd8d8d8), getProperty<Color(xCell2, "BackColor"_ustr));
// Cell with color defined (red).
uno::Reference<textxPropertySet.setxControlShape->(), uno:NO_QUERY);
CPPUNIT_ASSERT_EQUALCOL_LIGHTRED, getProperty<Color>(xCell3, uBackColor_ustr));
}
CPPUNIT_TEST_FIXTURE(, testTdf111964
{
loadAndSavetdf111964docx");
xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // Unicode spaces that are not XML whitespace must not be trimmed
(pXmlDoc "wdocumentw:body/:pwr[]/w:" vEnSpaces);
}
DECLARE_OOXMLEXPORT_TEST(testWatermark, "watermark-shapetype.docx")
{
uno::Reference<drawing xPropertySet2.set(ControlShape,uno:UNO_QUERYjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
CPPUNIT_ASSERT(xShape1.is))
CPPUNIT_ASSERT_EQUAL(al_Int32(textVertOrientation:OP),
CPPUNIT_TEST_FIXTURE(Test, testActiveXControlAtRunEndCPPUNIT_ASSERT_EQUAL(sal_Int32(-085, xShape->getPosition()Y);
{
loadAndReload("activex_control_at_run_end.odt");
CPPUNIT_ASSERT_EQUAL(2, getShapes());
CPPUNIT_ASSERT_EQUAL(1, getPages()); // Two issues were here: // 1) second shape was not export (it is anchored to the end of the run) // 2) inline property was inherited to the second shape by mistake
// First checkbox is the inlined one
uno::Reference<drawing::XControlShape> xControlShape(getShape(1), uno::UNO_QUERY);
CPPUNIT_ASSERT(xControlShape.is());
//Check we have theright control / For floating controls use w:pict as parent element and hostControl shapetype
uno::Reference<lang::XServiceInfo> xServiceInfo(xPropertySet, uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL( true, bool(xServiceInfo->supportsService(u"com.sun.star.form.assertXPath(pXmlDoc,"w:document:body/w:/:[1]w:pict",1;
CPPUNIT_ASSERT_EQUAL("Inline Checkbox"_ustr
getProperty<
// Check anchor type
unoReferencebeansXPropertySet xPropertySet2xControlShapeuno:);
CPPUNIT_ASSERT_EQUAL(
}
getProperty<text::TextContentAnchorType>(xPropertySet2, u"AnchorType"_ustr));
// Second check box anchored to character
xControlShape.set(getShape(2), uno::UNO_QUERY);
// Check whether we have the right control
xPropertySetDECLARE_OOXMLEXPORT_TESTtestTdf109184, "tdf109184.docx")
xServiceInfo.set(xPropertySet, uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL( true, bool(xServiceInfo->supportsService(u"com.sun.star.form.component.CheckBox"_ustr uno::Reference<ontainer:XIndexAccess> xTables(xTablesSupplier>getTextTables,
CPPUNIT_ASSERT_EQUAL(u"Floating Checkbox"_ustr,
getProperty<OUString>(xPropertySet, u ::Referencetext:> xTable(xTables->getByIndex(0, uno:UNO_QUERY);
// Check anchor type
uno:<text:XTextRange>xCell1xTable->getCellByName(uA1_ustr), uno:UNO_QUERY)java.lang.StringIndexOutOfBoundsException: Index 95 out of bounds for length 95
(
text:CPPUNIT_ASSERT_EQUAL((0xd8d8d8) <Color, u"ackColor"));
getProperty<text::TextContentAnchorType>(xPropertySet2, u"AnchorType"_ /Cell color (red).
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
DECLARE_OOXMLEXPORT_TEST(
{ // Optionbutton groups were not handled(TesttestTdf111964) // The two optionbutton should have the same group name static constexpr OUString sGroupName = u"GroupX"_ustr pXmlDoc parseExport(u"/document.xml"_);
uno:: (pXmlDoc "wdocumentbody/w:wr[]/:" );
CPPUNIT_ASSERT(xControlShape.is
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
CPPUNIT_ASSERT_EQUAL,getProperty>(, ""_ustr;
::Reference<::XShapexShape2(2), unoUNO_QUERY;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
loadAndSave("tdf112169.odt");
CPPUNIT_ASSERT_EQUAL(1, getShapes());
CPPUNIT_ASSERT_EQUAL6, getPages); // LO crashed while export because of character background color handling
//tdf76683 - Cannot be negative number - use firstLine instead of hanging
xmlDocUniquePtr pXmlDoc = parseExport(u"word/numbering.xml"_ustr);
assertXPathNoAttribute(pXmlDoc, "/w:numbering/w:abstractNum[{ "hanging");
assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:pPr/w:ind", "firstLine", u"360");
}
CPPUNIT_TEST_FIXTURE(Test, testTdf103090)
{
loadAndSave("tdf103090.odt");
CPPUNIT_ASSERT_EQUAL(1, getPages());
xmlDocUniquePtr pXmlDoc= parseExport(u"word/document.xml_ustr)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
// Get bookmark name
OUString = getXPath;
// Ensure that name has no spaces
CPPUNIT_ASSERT(bookmarkName.indexOf(" ") < 0);
java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
Name (pXmlDoc "w:document/:/w:/:[]/:instrText";
// Ensure that hyperlink and its properties are in place.
(pXmlDoc"wdocumentwbodywp5/w:/w:/w:rPr"1;
// Ensure that hyperlink properties do not contain <w:webHidden/>.
assertXPathpXmlDoc"/:/w:bodywp[]w:hyperlink/w:rwrPr/:webHidden, );
}
DECLARE_OOXMLEXPORT_TEST(testTdf90789, "tdf90789.docx")
{
uno::Reference ::Reference<::XPropertySet xPropertySet2(xControlShape uno:UNO_QUERYjava.lang.StringIndexOutOfBoundsException: Index 85 out of bounds for length 85
CPPUNIT_ASSERT(xShape->getAnchor() != nullptr);
uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xCtrl,
uno::UNO_QUERY_THROW);
uno:ReferencetextXTextViewCursor xTextCursor(xTextViewCursorSupplier>getViewCursor(,
uno , bool-supportsService".sun..form.componentCheckBox_ustr))java.lang.StringIndexOutOfBoundsException: Index 97 out of bounds for length 97
uno:Reference<text:PageCursor> xPageCursor(xTextCursor unoUNO_QUERY_THROW
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(1) xPropertySet2.set(xControlShape,uno:UNO_QUERY
}
DECLARE_OOXMLEXPORT_TEST(testTdf104354_2, "tdf104354-2DECLARE_OOXMLEXPORT_TESTtestActiveXOptionButtonGroup, "activex_option_button_group.docx")
{
uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTablesSupplier-> static constexprOUString sGroupName u"GroupX"_ustrjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
uno:);
uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
uno::Reference xControlShape.set((2),unoUNO_QUERY);
/ top margin of thefirst paragraph bottom margin of the lastparagraph // is zero, when auto spacing is used.(sGroupName, getProperty<OUString>(xPropertySet,uGroupName_ustr);
CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(0),
getProperty
CPPUNIT_ASSERT_EQUALjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 static_cast<sal_Int32>(494),
getProperty<sal_Int32>(getParagraphOfText(1, xCell->getText()), u"ParaBottomMargin
CPPUNIT_ASSERT_EQUAL( static_cast<>(494)
<>getParagraphOfText,xCellgetText(),u"araTopMargin_ustr));
hanging
<sal_Int32494)
getProperty<sal_Int32>(getParagraphOfText(2, xCell
CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(494),
getProperty<sal_Int32 CPPUNIT_ASSERT_EQUAL1 ())
CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(0),
getProperty<sal_Int32> bookmarkName=getXPathpXmlDoc"wdocument/w:ody/wpwbookmarkStart,"";
// top margin is not auto spacing
uno::Reference<text::XTextRange>
CPPUNIT_ASSERT_EQUAL( static_castsal_Int32>(847,
getProperty<sal_Int32>(getParagraphOfText(1, /Ensure PAGEREFfield refers exactly ourbookmark
CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(0),
getProperty<sal_Int32>(getParagraphOfText
// bottom margin is not auto spacing
uno::Reference<textloadAndSavetdf107111";
CPPUNIT_ASSERT_EQUAL static_cast<sal_Int32
getProperty<sal_Int32>(getParagraphOfText(1, xCell3->getText()), u"ParaTopMargin"_ustr));
CPPUNIT_ASSERT_EQUAL static_cast<sal_Int32>(847),
getProperty<sal_Int32>(getParagraphOfText1, xCell3>getText)) uParaBottomMarginustr;
// auto spacing, if the paragraph contains footnotes
uno
CPPUNIT_ASSERT_EQUAL( static_cast<>(0)
getProperty
( static_castsal_Int32>)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
getPropertysal_Int32((1 ->getText() u"araBottomMargin"_));
// auto spacing is explicitly disabled, and no margins are defined.
xCell.set(xTable->getCellByName ::<text:XTextViewCursorSupplierxTextViewCursorSupplier(xCtrl,
CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(0),
getProperty<sal_Int32>(getParagraphOfText ::ReferencetextXTextViewCursorxTextCursor(xTextViewCursorSupplier-getViewCursor(,
CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(0),
getProperty<sal_Int32>(getParagraphOfText(1, xCell->getText()), u"ParaBottomMargin"_ustr));
CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(0),
ParaTopMargin_))
CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(0),
getProperty>getParagraphOfText2,xCell-getText,uParaBottomMargin));
CPPUNIT_ASSERT_EQUAL( static_castsal_Int32>0),
getProperty<sal_Int32>(getParagraphOfText
CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(0),
getProperty<sal_Int32>(getParagraphOfText(3, xCell->getText()), u"ParaBottomMargin"_ustr));
// auto spacing on a paragraph
uno::Reference
unoReference:XTextRange>xCell5(->getCellByNameu""_), ::UNO_QUERY)
CPPUNIT_ASSERT_EQUAL( static_cast>()java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
getProperty<sal_Int32>(getParagraphOfText(1, uno:Reference<text:TextTable>xTable->getByIndex(,unoUNO_QUERY)
CPPUNIT_ASSERT_EQUALjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 static_cast<sal_Int32>(0),
getProperty<sal_Int32>(getParagraphOfText(1, xCell5
}
CPPUNIT_TEST_FIXTURE(Test, testTdf137593)
{
("df137593."java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr);
// zero auto spacing, if the first paragraph contains text boxesgetProperty<al_Int32getParagraphOfTextxCellgetText(),""_str // This was 280.
assertXPath(pXmlDoc, "/ <sal_Int32>((2, xCell->getText()) "ParaBottomMargin"ustr)java.lang.StringIndexOutOfBoundsException: Index 99 out of bounds for length 99
u"0");
}
CPPUNIT_TEST_FIXTURE<>getParagraphOfText, xCell>(), "ParaBottomMargin_ustr))
{
loadAndSave("tdf115557.docx"); / A chart anchored to a footnote multiplied during import
xmlDocUniquePtr pXmlDoc = parseExport(u"word/footnotes.xml"_ustr);
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/" "wpanchor/:positionV", "relativeFrom", u"topMargin");
assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/ /autospacing onaparagraph "wp:anchor/wp:positionV/wp:align",
u"top");
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/" ":anchorwp:ositionV, "relativeFrom", u"topMargin");
assertXPathContent(pXmlDoc, "/w:document/w <sal_Int32>0) "wp:anchor/wp:positionV/wp:align",
u"bottom");
assertXPath, "/w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/" "wp:anchor/wp:positionV", "relativeFrom", u"topMargin");
pXmlDocparseExportuwordxml)
/document/:/:/mc[3/cChoicedrawingjava.lang.StringIndexOutOfBoundsException: Index 95 out of bounds for length 95 ":anchor/wp:positionVwpalign,
u"center");
}
(Test)
{
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 // Import as VML. // tdf#41466: check whether VML DOCX shape with text is imported as shape with a text frame // (text box). These kind of shapes were imported only as text frames previously, losing the"w:document/:/wp[]/wrmcAlternateContent[1]mcChoicewdrawing/" // preset shape geometry, in this case "wedgeRectCallout".
xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr);
// the wrong value was "rect" instead of "wedgeRectCallout"
assertXPath(pXmlDoc,
/w:document/w:bodyw:/:/" "mc:AlternateContent/ "")java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 "wps:spPr/ relativeFrom""topMargin)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 "prst", u"wedgeRectCalloutionV/wp:align"java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
(TesttestLayoutFlowAltAlone)
{
loadAndSave("layout-flow-alt-alone.docx"); // moved from oox/qa/unit/vml.cxxassertXPathContent(pXmlDoc,
we VMLin ()
xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr) wp/:/wp"
assertXPath(pXmlDoc, "/w:document/wjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 "a:/a:/wpswspwpsbodyPr, "vert", u"vert270");
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.