Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : */
9 :
10 : #include <swmodeltestbase.hxx>
11 :
12 : #if !defined(WNT)
13 :
14 : #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
15 : #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
16 : #include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
17 : #include <com/sun/star/drawing/FillStyle.hpp>
18 : #include <com/sun/star/drawing/Hatch.hpp>
19 : #include <com/sun/star/drawing/LineJoint.hpp>
20 : #include <com/sun/star/drawing/LineStyle.hpp>
21 : #include <com/sun/star/drawing/PointSequenceSequence.hpp>
22 : #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
23 : #include <com/sun/star/style/LineSpacing.hpp>
24 : #include <com/sun/star/style/LineSpacingMode.hpp>
25 : #include <com/sun/star/text/GraphicCrop.hpp>
26 :
27 : #include <comphelper/sequenceashashmap.hxx>
28 :
29 94 : class Test : public SwModelTestBase
30 : {
31 : public:
32 94 : Test() : SwModelTestBase("/sw/qa/extras/ooxmlexport/data/", "Office Open XML Text") {}
33 :
34 : protected:
35 : /**
36 : * Blacklist handling
37 : */
38 47 : bool mustTestImportOf(const char* filename) const SAL_OVERRIDE {
39 : // If the testcase is stored in some other format, it's pointless to test.
40 47 : return (OString(filename).endsWith(".docx"));
41 : }
42 : };
43 :
44 17 : DECLARE_OOXMLEXPORT_TEST( testChildNodesOfCubicBezierTo, "FDO74774.docx")
45 : {
46 : /* Number of children required by cubicBexTo is 3 of type "pt".
47 : While exporting, sometimes the child nodes are less than 3.
48 : The test case ensures that there are 3 child nodes of type "pt"
49 : for cubicBexTo
50 : */
51 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
52 2 : if (!pXmlDoc)
53 3 : return;
54 :
55 : assertXPath( pXmlDoc,
56 1 : "/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent[1]/mc:Choice/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/wpg:wgp[1]/wps:wsp[3]/wps:spPr[1]/a:custGeom[1]/a:pathLst[1]/a:path[1]/a:cubicBezTo[2]/a:pt[3]");
57 : }
58 :
59 17 : DECLARE_OOXMLEXPORT_TEST(testMSwordHang,"test_msword_hang.docx")
60 : {
61 : // fdo#74771:
62 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
63 2 : if (!pXmlDoc)
64 3 : return;
65 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p/w:r[2]/w:drawing/wp:inline", "distT", "0");
66 : }
67 :
68 17 : DECLARE_OOXMLEXPORT_TEST(testGroupshapeThemeFont, "groupshape-theme-font.docx")
69 : {
70 : // Font was specified using a theme reference, which wasn't handled.
71 2 : uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
72 4 : uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xGroup->getByIndex(0), uno::UNO_QUERY)->getText();
73 4 : uno::Reference<text::XTextRange> xRun = getRun(getParagraphOfText(1, xText),1);
74 : // This was Calibri.
75 4 : CPPUNIT_ASSERT_EQUAL(OUString("Cambria"), getProperty<OUString>(xRun, "CharFontName"));
76 2 : }
77 :
78 17 : DECLARE_OOXMLEXPORT_TEST(testAnchorIdForWP14AndW14, "AnchorId.docx")
79 : {
80 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
81 2 : if (!pXmlDoc)
82 3 : return;
83 :
84 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[3]/mc:AlternateContent/mc:Choice/w:drawing/wp:inline", "anchorId", "78735EFD");
85 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[3]/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "anchorId", "78735EFD");
86 :
87 :
88 : }
89 :
90 17 : DECLARE_OOXMLEXPORT_TEST(testDkVert, "dkvert.docx")
91 : {
92 : // <a:pattFill prst="dkVert"> was exported as ltVert.
93 2 : uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
94 4 : uno::Reference<beans::XPropertySet> xShape(xGroup->getByIndex(0), uno::UNO_QUERY);
95 : // This was 50.
96 4 : CPPUNIT_ASSERT_EQUAL(sal_Int32(25), getProperty<drawing::Hatch>(xShape, "FillHatch").Distance);
97 2 : }
98 :
99 17 : DECLARE_OOXMLEXPORT_TEST(testTextWatermark, "textWatermark.docx")
100 : {
101 : //The problem was that the watermark ID was not preserved,
102 : //and Word uses the object ID to identify if it is a watermark.
103 : //It has to have the 'PowerPlusWaterMarkObject' string in it
104 2 : xmlDocPtr pXmlHeader1 = parseExport("word/header1.xml");
105 2 : if (!pXmlHeader1)
106 3 : return;
107 :
108 1 : assertXPath(pXmlHeader1, "/w:hdr[1]/w:p[1]/w:r[1]/w:pict[1]/v:shape[1]","id","PowerPlusWaterMarkObject93701316");
109 : }
110 :
111 17 : DECLARE_OOXMLEXPORT_TEST(testPictureWatermark, "pictureWatermark.docx")
112 : {
113 : //The problem was that the watermark ID was not preserved,
114 : //and Word uses the object ID to identify if it is a watermark.
115 : //It has to have the 'WordPictureWaterMarkObject' string in it
116 :
117 2 : xmlDocPtr pXmlHeader1 = parseExport("word/header1.xml");
118 2 : if (!pXmlHeader1)
119 3 : return;
120 :
121 : // Check the watermark ID
122 1 : assertXPath(pXmlHeader1, "/w:hdr[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Fallback[1]/w:pict[1]/v:rect[1]","id","WordPictureWatermark11962361");
123 : }
124 :
125 :
126 17 : DECLARE_OOXMLEXPORT_TEST(testFdo76249, "fdo76249.docx")
127 : {
128 : /*
129 : * The Locked Canvas is imported correctly, but while exporting
130 : * the drawing element is exported inside a textbox. However a the drawing has to exported
131 : * as a Locked Canvas inside a text-box for the RT file to work in MS Word, as drawing elements
132 : * are not allowed inside the textboxes.
133 : */
134 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
135 2 : if (!pXmlDoc)
136 3 : return;
137 1 : assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Fallback[1]/w:pict[1]/v:rect[1]/v:textbox[1]/w:txbxContent[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/lc:lockedCanvas[1]",1);
138 : }
139 :
140 17 : DECLARE_OOXMLEXPORT_TEST(testFdo76979, "fdo76979.docx")
141 : {
142 : // The problem was that black was exported as "auto" fill color, resulting in well-formed, but invalid XML.
143 2 : xmlDocPtr pXmlDoc = parseExport("word/header2.xml");
144 2 : if (!pXmlDoc)
145 3 : return;
146 : // This was "auto", not "FFFFFF".
147 1 : assertXPath(pXmlDoc, "//wps:spPr/a:solidFill/a:srgbClr", "val", "FFFFFF");
148 : }
149 :
150 17 : DECLARE_OOXMLEXPORT_TEST(testShapeEffectPreservation, "shape-effect-preservation.docx")
151 : {
152 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
153 2 : if (!pXmlDoc)
154 3 : return;
155 :
156 : // first shape with outer shadow, rgb color
157 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
158 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
159 1 : "algn", "tl");
160 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
161 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
162 1 : "blurRad", "50800");
163 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
164 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
165 1 : "dir", "2700000");
166 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
167 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
168 1 : "dist", "38100");
169 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
170 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
171 1 : "rotWithShape", "0");
172 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
173 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw/a:srgbClr",
174 1 : "val", "000000");
175 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
176 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw/a:srgbClr/a:alpha",
177 1 : "val", "40000");
178 :
179 : // second shape with outer shadow, scheme color
180 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
181 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
182 1 : "algn", "tl");
183 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
184 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
185 1 : "blurRad", "114300");
186 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
187 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
188 1 : "dir", "2700000");
189 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
190 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
191 1 : "dist", "203200");
192 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
193 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw",
194 1 : "rotWithShape", "0");
195 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
196 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw/a:schemeClr",
197 1 : "val", "accent1");
198 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
199 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw/a:schemeClr/a:lumMod",
200 1 : "val", "40000");
201 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
202 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw/a:schemeClr/a:lumOff",
203 1 : "val", "60000");
204 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
205 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw/a:schemeClr/a:alpha",
206 1 : "val", "40000");
207 :
208 : // third shape with inner shadow, rgb color
209 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
210 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw",
211 1 : "blurRad", "63500");
212 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
213 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw",
214 1 : "dir", "16200000");
215 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
216 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw",
217 1 : "dist", "50800");
218 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
219 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw/a:srgbClr",
220 1 : "val", "ffff00");
221 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
222 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw/a:srgbClr/a:alpha",
223 1 : "val", "50000");
224 :
225 : // 4th shape with soft edge
226 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
227 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:softEdge",
228 1 : "rad", "127000");
229 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
230 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:softEdge/*",
231 1 : 0 ); // should not be present
232 :
233 : // 5th shape with glow effect, scheme color
234 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
235 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow",
236 1 : "rad", "101600");
237 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
238 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow/a:schemeClr",
239 1 : "val", "accent2");
240 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
241 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow/a:schemeClr/a:satMod",
242 1 : "val", "175000");
243 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
244 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow/a:schemeClr/a:alpha",
245 1 : "val", "40000");
246 :
247 : // 6th shape with reflection
248 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
249 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection",
250 1 : "blurRad", "6350");
251 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
252 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection",
253 1 : "stA", "50000");
254 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
255 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection",
256 1 : "endA", "300");
257 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
258 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection",
259 1 : "endPos", "55500");
260 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
261 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection/*",
262 1 : 0 ); // should not be present
263 :
264 : // 7th shape with several effects: glow, inner shadow and reflection
265 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
266 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow",
267 1 : "rad", "63500");
268 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
269 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow/a:schemeClr",
270 1 : "val", "accent2");
271 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
272 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow/a:schemeClr/*",
273 1 : 2);
274 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
275 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw",
276 1 : "blurRad", "63500");
277 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
278 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw",
279 1 : "dir", "2700000");
280 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
281 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw/a:srgbClr",
282 1 : "val", "000000");
283 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
284 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw/a:srgbClr/a:alpha",
285 1 : "val", "50000");
286 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
287 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection",
288 1 : "blurRad", "6350");
289 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
290 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection",
291 1 : "stA", "52000");
292 : }
293 :
294 17 : DECLARE_OOXMLEXPORT_TEST(testShape3DEffectPreservation, "shape-3d-effect-preservation.docx")
295 : {
296 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
297 2 : if (!pXmlDoc)
298 3 : return;
299 :
300 : // first shape: extrusion and shift on z, rotated camera with zoom, rotated light rig
301 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
302 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera",
303 1 : "prst", "perspectiveRelaxedModerately");
304 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
305 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera",
306 1 : "zoom", "150000");
307 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
308 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera/a:rot",
309 1 : "lat", "19490639");
310 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
311 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera/a:rot",
312 1 : "lon", "0");
313 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
314 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera/a:rot",
315 1 : "rev", "12900001");
316 :
317 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
318 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:lightRig",
319 1 : "rig", "threePt");
320 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
321 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:lightRig",
322 1 : "dir", "t");
323 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
324 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:lightRig/a:rot",
325 1 : "lat", "0");
326 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
327 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:lightRig/a:rot",
328 1 : "lon", "0");
329 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
330 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:lightRig/a:rot",
331 1 : "rev", "4800000");
332 :
333 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
334 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
335 1 : "extrusionH", "63500");
336 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
337 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
338 1 : "z", "488950");
339 :
340 : // second shape: extrusion with theme color, no camera or light rotation, metal material
341 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
342 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera",
343 1 : "prst", "isometricLeftDown");
344 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
345 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera/a:rot",
346 1 : 0);
347 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
348 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:lightRig",
349 1 : "rig", "threePt");
350 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
351 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:lightRig",
352 1 : "dir", "t");
353 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
354 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:lightRig/a:rot",
355 1 : 0);
356 :
357 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
358 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
359 1 : "extrusionH", "25400");
360 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
361 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
362 1 : "prstMaterial", "metal");
363 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
364 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:extrusionClr/a:schemeClr",
365 1 : "val", "accent5");
366 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
367 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:extrusionClr/a:schemeClr/a:lumMod",
368 1 : "val", "40000");
369 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
370 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:extrusionClr/a:schemeClr/a:lumOff",
371 1 : "val", "60000");
372 :
373 : // third shape: colored countour and top and bottom bevel, plastic material
374 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
375 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
376 1 : "contourW", "50800");
377 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
378 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
379 1 : "prstMaterial", "plastic");
380 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
381 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:bevelT",
382 1 : "w", "139700");
383 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
384 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:bevelT",
385 1 : "h", "88900");
386 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
387 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:bevelT",
388 1 : "prst", "cross");
389 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
390 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:bevelB",
391 1 : "h", "88900");
392 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
393 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:bevelB",
394 1 : "prst", "relaxedInset");
395 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
396 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d/a:contourClr/a:srgbClr",
397 1 : "val", "3333ff");
398 :
399 : // fourth shape: wireframe
400 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
401 : "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:sp3d",
402 1 : "prstMaterial", "legacyWireframe");
403 : }
404 :
405 17 : DECLARE_OOXMLEXPORT_TEST(testPictureEffectPreservation, "picture-effects-preservation.docx")
406 : {
407 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
408 2 : if (!pXmlDoc)
409 3 : return;
410 :
411 : // first picture: glow effect with theme color and transformations, 3d rotation and extrusion
412 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
413 : "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:glow",
414 1 : "rad", "228600");
415 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
416 : "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:glow/a:schemeClr",
417 1 : "val", "accent1");
418 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
419 : "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:glow/a:schemeClr/*",
420 1 : 2);
421 :
422 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
423 : "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:scene3d/a:camera",
424 1 : "prst", "isometricRightUp");
425 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
426 : "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:scene3d/a:lightRig",
427 1 : "rig", "threePt");
428 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
429 : "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:sp3d",
430 1 : "extrusionH", "76200");
431 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
432 : "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:sp3d/a:extrusionClr/a:srgbClr",
433 1 : "val", "92d050");
434 :
435 : // second picture: shadow and reflection effects
436 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
437 : "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:outerShdw",
438 1 : "dir", "8100000");
439 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
440 : "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:outerShdw/a:srgbClr",
441 1 : "val", "000000");
442 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
443 : "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:outerShdw/a:srgbClr/a:alpha",
444 1 : "val", "40000");
445 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
446 : "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:reflection",
447 1 : "dir", "5400000");
448 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
449 : "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:reflection/*",
450 1 : 0 ); // should not be present
451 :
452 : // third picture: soft edge effect
453 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
454 : "wp:anchor/a:graphic/a:graphicData/pic:pic/pic:spPr/a:effectLst/a:softEdge",
455 1 : "rad", "63500");
456 : }
457 :
458 17 : DECLARE_OOXMLEXPORT_TEST(testPictureArtisticEffectPreservation, "picture-artistic-effects-preservation.docx")
459 : {
460 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
461 2 : xmlDocPtr pRelsDoc = parseExport("word/_rels/document.xml.rels");
462 2 : if (!pXmlDoc || !pRelsDoc)
463 3 : return;
464 :
465 : uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(
466 1 : comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL());
467 :
468 : // 1st picture: marker effect
469 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
470 : "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
471 : "a14:artisticMarker",
472 1 : "trans", "14000");
473 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
474 : "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
475 : "a14:artisticMarker",
476 1 : "size", "80");
477 :
478 : OUString sEmbedId1 = getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
479 : "wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer",
480 2 : "embed");
481 2 : OUString sXmlPath = "/rels:Relationships/rels:Relationship[@Id='" + sEmbedId1 + "']";
482 2 : OUString sFile = getXPath(pRelsDoc, OUStringToOString( sXmlPath, RTL_TEXTENCODING_UTF8 ), "Target");
483 1 : CPPUNIT_ASSERT_EQUAL(true, bool(xNameAccess->hasByName("word/" + sFile)));
484 :
485 : // 2nd picture: pencil grayscale
486 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
487 : "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
488 : "a14:artisticPencilGrayscale",
489 1 : "trans", "15000");
490 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
491 : "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
492 : "a14:artisticPencilGrayscale",
493 1 : "pencilSize", "66");
494 :
495 : OUString sEmbedId2 = getXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
496 : "wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer",
497 2 : "embed");
498 1 : CPPUNIT_ASSERT_EQUAL(sEmbedId1, sEmbedId2);
499 :
500 : // 3rd picture: pencil sketch
501 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
502 : "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
503 : "a14:artisticPencilSketch",
504 1 : "trans", "7000");
505 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
506 : "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
507 : "a14:artisticPencilSketch",
508 1 : "pressure", "17");
509 :
510 : OUString sEmbedId3 = getXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
511 : "wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer",
512 2 : "embed");
513 1 : CPPUNIT_ASSERT_EQUAL(sEmbedId1, sEmbedId3);
514 :
515 : // 4th picture: light screen
516 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
517 : "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
518 : "a14:artisticLightScreen",
519 1 : "trans", "13000");
520 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
521 : "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
522 : "a14:artisticLightScreen",
523 1 : "gridSize", "1");
524 :
525 : OUString sEmbedId4 = getXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
526 : "wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer",
527 2 : "embed");
528 1 : sXmlPath = "/rels:Relationships/rels:Relationship[@Id='" + sEmbedId4 + "']";
529 1 : sFile = getXPath(pRelsDoc, OUStringToOString( sXmlPath, RTL_TEXTENCODING_UTF8 ), "Target");
530 1 : CPPUNIT_ASSERT_EQUAL(true, bool(xNameAccess->hasByName("word/" + sFile)));
531 :
532 : // 5th picture: watercolor sponge
533 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
534 : "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
535 : "a14:artisticWatercolorSponge",
536 1 : "brushSize", "4");
537 :
538 : OUString sEmbedId5 = getXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
539 : "wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer",
540 2 : "embed");
541 1 : CPPUNIT_ASSERT_EQUAL(sEmbedId1, sEmbedId5);
542 :
543 : // 6th picture: photocopy (no attributes)
544 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/"
545 : "a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer/a14:imgEffect/"
546 1 : "a14:artisticPhotocopy", 1);
547 :
548 : OUString sEmbedId6 = getXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
549 : "wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:extLst/a:ext/a14:imgProps/a14:imgLayer",
550 2 : "embed");
551 1 : CPPUNIT_ASSERT_EQUAL(sEmbedId1, sEmbedId6);
552 :
553 : // no redundant wdp files saved
554 2 : CPPUNIT_ASSERT_EQUAL(false, bool(xNameAccess->hasByName("word/media/hdphoto3.wdp")));
555 : }
556 :
557 17 : DECLARE_OOXMLEXPORT_TEST(fdo77719, "fdo77719.docx")
558 : {
559 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
560 2 : if (!pXmlDoc)
561 3 : return;
562 1 : assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:custGeom[1]", 1);
563 : }
564 :
565 17 : DECLARE_OOXMLEXPORT_TEST(testNestedAlternateContent, "nestedAlternateContent.docx")
566 : {
567 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
568 2 : if (!pXmlDoc)
569 3 : return;
570 : // We check alternateContent could not contains alternateContent (i.e. nested alternateContent)
571 1 : assertXPath(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wpg:wgp[1]/wps:wsp[2]/wps:txbx[1]/w:txbxContent[1]/w:p[1]/w:r[2]/mc:AlternateContent[1]",0);
572 : }
573 :
574 : #if 0
575 : // Currently LibreOffice exports custom geometry for this hexagon, not preset shape.
576 : // When LibreOffice can export preset shapes with correct modifiers, then this test can be re-enabled.
577 :
578 : DECLARE_OOXMLEXPORT_TEST(test76317, "test76317.docx")
579 : {
580 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
581 : if (!pXmlDoc) return;
582 : assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:prstGeom[1]", "prst", "hexagon");
583 : }
584 :
585 : #endif
586 :
587 17 : DECLARE_OOXMLEXPORT_TEST(fdo76591, "fdo76591.docx")
588 : {
589 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
590 2 : if (!pXmlDoc)
591 3 : return;
592 1 : assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[3]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]", "relativeHeight", "3");
593 : }
594 :
595 17 : DECLARE_OOXMLEXPORT_TEST(test76317_2K10, "test76317_2K10.docx")
596 : {
597 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
598 4 : if (!pXmlDoc) return;
599 1 : assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:prstGeom[1]/a:avLst[1]/a:gd[1]", "name", "adj");
600 : }
601 :
602 17 : DECLARE_OOXMLEXPORT_TEST(testFDO77122, "LinkedTextBoxes.docx")
603 : {
604 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
605 2 : if (!pXmlDoc)
606 3 : return;
607 : //ensure that the text box links are preserved.
608 1 : assertXPath(pXmlDoc, "//wps:txbx[1]", "id", "1");
609 1 : assertXPath(pXmlDoc, "//wps:linkedTxbx[1]", "id", "1");
610 : }
611 :
612 17 : DECLARE_OOXMLEXPORT_TEST(test76734_2K7, "test76734_2K7.docx")
613 : {
614 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
615 2 : if (!pXmlDoc)
616 3 : return;
617 1 : assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[3]/mc:AlternateContent[1]/mc:Choice[1]", "Requires", "wps");
618 : }
619 :
620 17 : DECLARE_OOXMLEXPORT_TEST(test77219, "test77219.docx")
621 : {
622 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
623 2 : if (!pXmlDoc)
624 3 : return;
625 1 : assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[6]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]", "behindDoc", "1");
626 : }
627 :
628 17 : DECLARE_OOXMLEXPORT_TEST(testPresetShape, "preset-shape.docx")
629 : {
630 : // Document contains a flowChartMultidocument preset shape, our date for that shape wasn't correct.
631 2 : uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
632 4 : comphelper::SequenceAsHashMap aCustomShapeGeometry(xPropertySet->getPropertyValue("CustomShapeGeometry"));
633 4 : comphelper::SequenceAsHashMap aPath(aCustomShapeGeometry["Path"]);
634 4 : uno::Sequence<awt::Size> aSubViewSize((aPath["SubViewSize"]).get<uno::Sequence<awt::Size> >() );
635 :
636 : // This was 0.
637 4 : CPPUNIT_ASSERT_EQUAL(sal_Int32(21600), aSubViewSize[0].Height);
638 2 : }
639 :
640 17 : DECLARE_OOXMLEXPORT_TEST(testFdo76101, "fdo76101.docx")
641 : {
642 2 : xmlDocPtr pXmlDoc = parseExport("word/styles.xml");
643 :
644 2 : if (!pXmlDoc)
645 3 : return;
646 1 : xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "/w:styles/w:style");
647 1 : xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
648 1 : CPPUNIT_ASSERT(4091 >= xmlXPathNodeSetGetLength(pXmlNodes));
649 1 : xmlXPathFreeObject(pXmlObj);
650 : }
651 :
652 17 : DECLARE_OOXMLEXPORT_TEST(testSdtAndShapeOverlapping,"ShapeOverlappingWithSdt.docx")
653 : {
654 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
655 2 : if (!pXmlDoc)
656 3 : return;
657 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[1]/mc:AlternateContent");
658 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt[1]/w:sdtContent[1]/w:r[1]/w:t[1]");
659 : }
660 :
661 17 : DECLARE_OOXMLEXPORT_TEST(testLockedCanvas, "fdo78658.docx")
662 : {
663 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
664 2 : if (!pXmlDoc)
665 3 : return;
666 : // Checking for lockedCanvas tag
667 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/lc:lockedCanvas", 1);
668 : }
669 :
670 17 : DECLARE_OOXMLEXPORT_TEST(fdo78474, "fdo78474.docx")
671 : {
672 2 : xmlDocPtr pXmlDoc1 = parseExport("word/document.xml");
673 2 : if (!pXmlDoc1) return;
674 : //docx file after RT is getting corrupted.
675 1 : assertXPath(pXmlDoc1, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:txbx[1]/w:txbxContent[1]/w:p[1]/w:r[1]/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/pic:pic[1]/pic:blipFill[1]/a:blip[1]", "embed", "rId2");
676 :
677 1 : xmlDocPtr pXmlDoc2 = parseExport("word/_rels/document.xml.rels");
678 1 : if (!pXmlDoc2) return;
679 1 : assertXPath(pXmlDoc2,"/rels:Relationships/rels:Relationship[2]","Id","rId2");
680 : }
681 :
682 17 : DECLARE_OOXMLEXPORT_TEST(testAbsolutePositionOffsetValue,"fdo78432.docx")
683 : {
684 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
685 2 : if (!pXmlDoc)
686 3 : return;
687 :
688 1 : sal_Int32 IntMax = SAL_MAX_INT32;
689 :
690 : xmlXPathObjectPtr pXmlObjs[6];
691 1 : pXmlObjs[0] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionH[1]/wp:posOffset[1]");
692 1 : pXmlObjs[1] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionV[1]/wp:posOffset[1]");
693 :
694 1 : pXmlObjs[2] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[2]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionH[1]/wp:posOffset[1]");
695 1 : pXmlObjs[3] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[2]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionV[1]/wp:posOffset[1]");
696 :
697 1 : pXmlObjs[4] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[3]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionH[1]/wp:posOffset[1]");
698 1 : pXmlObjs[5] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[3]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionV[1]/wp:posOffset[1]");
699 :
700 7 : for(sal_Int32 index = 0; index<6; ++index)
701 : {
702 6 : CPPUNIT_ASSERT(pXmlObjs[index]->nodesetval != 0);
703 6 : xmlNodePtr pXmlNode = pXmlObjs[index]->nodesetval->nodeTab[0];
704 6 : OUString contents = OUString::createFromAscii(reinterpret_cast<const char*>((pXmlNode->children[0]).content));
705 6 : CPPUNIT_ASSERT( contents.toInt64() <= IntMax );
706 6 : xmlXPathFreeObject(pXmlObjs[index]);
707 6 : }
708 : }
709 :
710 17 : DECLARE_OOXMLEXPORT_TEST(testfdo78300,"fdo78300.docx")
711 : {
712 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
713 2 : if (!pXmlDoc)
714 3 : return;
715 : assertXPath(pXmlDoc,
716 : "/w:document/w:body/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing[1]/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p[1]/w:r[1]/w:drawing[1]",
717 1 : 0);
718 : }
719 :
720 17 : DECLARE_OOXMLEXPORT_TEST(testWordArtWithinDraingtool, "testWordArtWithinDraingtool.docx")
721 : {
722 : /* * Within a file, there is a 2007 wordArt enclosed in a drawing tool
723 : * LO was exporting it as below:
724 : * Sample XML as in Original file:
725 : * <p> <r> <ac> <drawing> <txbx> <txbxContent> .. <pict> </pict> </txbxContent></txbx> </drawing> </ac> </r> </p>
726 : * After RT :
727 : * <p> <r> <ac> <drawing> <txbx> <txbxContent> .. <drawing> <txbx> <txbxContent> .. </txbxContent></txbx> </drawing> .. </txbxContent></txbx> </drawing> </ac> </r> </p>
728 : * Expected : As there is nesting of a 2007 Word Art within a draing tool, then can be separated in two different runs.
729 : * */
730 :
731 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
732 2 : if (!pXmlDoc)
733 3 : return;
734 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent",1);
735 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:textbox/w:txbxContent/w:p/w:r/w:pict/v:shape",1);
736 : // Make sure that the shape inside a shape is exported as VML-only, no embedded mc:AlternateContent before w:pict.
737 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p/w:r/w:pict",1);
738 : }
739 :
740 17 : DECLARE_OOXMLEXPORT_TEST(testfdo78663, "fdo78663.docx")
741 : {
742 : /* * A 2007 word art tool is enclosed in a 2010 drawing toolWithin a file,
743 : * Originally the file has the following xml tag hierarchy.
744 : *
745 : * <p> <r> <ac> <drawing> <txbx> <txbxContent> <pict><shapetype> <shape> ...</shape></shapetype> </pict> </txbxContent></txbx> </drawing> </ac> </r> </p>
746 : * After RT :
747 : * <p> <r> <ac> <drawing> <txbx> <txbxContent> <pict><shapetype> <shape> <textbox><txbxContent> ... </txbxContent></textbox></shape></shapetype> </pict> </txbxContent></txbx> </drawing> </ac> </r> </p>
748 : * MSO doesn't allow nesting of txbxContent tags.
749 : * As the text of the wordart tool is written in the tag <v:textpath string="Welcome to... "History is fun and informative"/>
750 : * We shouldn't repeat it again in <shapetype><shape> <textbox><txbxContent>
751 : * */
752 :
753 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
754 2 : if (!pXmlDoc)
755 3 : return;
756 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p/w:r/w:pict/v:shape/v:path",1);
757 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:textbox/w:txbxContent/w:p/w:r/w:pict/v:shape/v:path",1);
758 : // Make sure that the shape inside a shape is exported as VML-only, no embedded mc:AlternateContent before w:pict.
759 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:txbx/w:txbxContent/w:p/w:r/w:pict",1);
760 : }
761 :
762 17 : DECLARE_OOXMLEXPORT_TEST(testFdo78957, "fdo78957.docx")
763 : {
764 2 : xmlDocPtr pXmlHeader = parseExport("word/header2.xml");
765 :
766 2 : if(!pXmlHeader)
767 3 : return;
768 :
769 1 : const sal_Int64 IntMax = SAL_MAX_INT32;
770 1 : sal_Int64 cx = 0, cy = 0;
771 1 : cx = getXPath(pXmlHeader,"/w:hdr[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:extent[1]","cx").toInt64();
772 1 : cy = getXPath(pXmlHeader,"/w:hdr[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:extent[1]","cy").toInt64();
773 : // Here we check the values of extent width & height
774 1 : CPPUNIT_ASSERT(cx <= IntMax );
775 1 : CPPUNIT_ASSERT(cy >= 0 );
776 : }
777 :
778 17 : DECLARE_OOXMLEXPORT_TEST(testfdo79256, "fdo79256.docx")
779 : {
780 : /* Corruption issue containing Line Style with Long Dashes and Dots
781 : * After RT checking the Dash Length value. Dash Length value should not be greater than 2147483.
782 : */
783 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
784 2 : if (!pXmlDoc)
785 3 : return;
786 :
787 1 : const sal_Int32 maxLimit = 2147483;
788 1 : sal_Int32 d = getXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[1]","d").toInt32();
789 1 : CPPUNIT_ASSERT(d <= maxLimit );
790 : }
791 :
792 17 : DECLARE_OOXMLEXPORT_TEST(testDashedLinePreset, "dashed_line_preset.docx")
793 : {
794 : /* Make sure that preset line is exported correctly as "1000th of a percent".
795 : * This test-file has a PRESET dash-line which will be converted by LO import
796 : * to a custom-dash (dash-dot-dot). This test-case makes sure that the exporter
797 : * outputs the correct values.
798 : */
799 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
800 2 : if (!pXmlDoc)
801 3 : return;
802 :
803 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[1]", "d" , "800000");
804 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[1]", "sp", "300000");
805 :
806 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[2]", "d" , "100000");
807 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[2]", "sp", "300000");
808 :
809 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[3]", "d" , "100000");
810 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[3]", "sp", "300000");
811 : }
812 :
813 17 : DECLARE_OOXMLEXPORT_TEST(testDashedLine_CustDash1000thOfPercent, "dashed_line_custdash_1000th_of_percent.docx")
814 : {
815 : /* Make sure that preset line is exported correctly as "1000th of a percent".
816 : * This test-file has a CUSTOM dash-line that is defined as '1000th of a percent'.
817 : * This should be imported by LO as-is, and exported back with the same values.
818 : */
819 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
820 2 : if (!pXmlDoc)
821 3 : return;
822 :
823 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[1]", "d" , "800000");
824 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[1]", "sp", "300000");
825 :
826 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[2]", "d" , "100000");
827 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[2]", "sp", "300000");
828 :
829 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[3]", "d" , "100000");
830 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[3]", "sp", "300000");
831 : }
832 :
833 17 : DECLARE_OOXMLEXPORT_TEST(testDashedLine_CustDashPercentage, "dashed_line_custdash_percentage.docx")
834 : {
835 : /* Make sure that preset line is exported correctly as "1000th of a percent".
836 : * This test-file has a CUSTOM dash-line that is defined as percentages.
837 : * This should be imported by LO as '1000th of a percent', and exported back
838 : * as '1000th of a percent'.
839 : */
840 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
841 2 : if (!pXmlDoc)
842 3 : return;
843 :
844 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[1]", "d" , "800000");
845 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[1]", "sp", "300000");
846 :
847 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[2]", "d" , "100000");
848 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[2]", "sp", "300000");
849 :
850 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[3]", "d" , "100000");
851 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[3]", "sp", "300000");
852 : }
853 :
854 16 : DECLARE_OOXMLEXPORT_TEST(testCommentInitials, "comment_initials.odt")
855 : {
856 1 : xmlDocPtr pXmlDoc = parseExport("word/comments.xml");
857 1 : if (!pXmlDoc)
858 1 : return;
859 :
860 1 : assertXPath(pXmlDoc,"/w:comments/w:comment[1]", "initials", "initials");
861 : }
862 :
863 17 : DECLARE_OOXMLEXPORT_TEST(testTextboxRoundedCorners, "textbox-rounded-corners.docx")
864 : {
865 2 : uno::Reference<drawing::XShape> xShape = getShape(1);
866 4 : comphelper::SequenceAsHashMap aCustomShapeGeometry = comphelper::SequenceAsHashMap(getProperty< uno::Sequence<beans::PropertyValue> >(xShape, "CustomShapeGeometry"));
867 :
868 : // Test that the shape is a rounded rectangle.
869 2 : CPPUNIT_ASSERT_EQUAL(OUString("ooxml-roundRect"), aCustomShapeGeometry["Type"].get<OUString>());
870 :
871 : // The shape text should start with a table, with "a" in its A1 cell.
872 4 : uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
873 4 : uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1, xText), uno::UNO_QUERY);
874 4 : uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
875 4 : CPPUNIT_ASSERT_EQUAL(OUString("a"), xCell->getString());
876 2 : }
877 :
878 17 : DECLARE_OOXMLEXPORT_TEST(testfdo79591, "fdo79591.docx")
879 : {
880 : /* Values set for docPr name and shape ID attributes
881 : * in RT file were not valid as per UTF-8 encoding format
882 : * and hence was showing RT document as corrupt with error
883 : * message "invalid character"
884 : */
885 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
886 2 : if (!pXmlDoc)
887 3 : return;
888 :
889 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp:docPr", "name", "");
890 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:shape", "ID", "");
891 : }
892 :
893 17 : DECLARE_OOXMLEXPORT_TEST(testBnc884615, "bnc884615.docx")
894 : {
895 : // The problem was that the shape in the header wasn't in the background.
896 2 : CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(getShape(1), "Opaque")));
897 2 : }
898 :
899 17 : DECLARE_OOXMLEXPORT_TEST(testFdo80894, "TextFrameRotation.docx")
900 : {
901 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
902 2 : if (!pXmlDoc)
903 3 : return;
904 :
905 : // Rotation value was not roundtripped for textframe.
906 : assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[2]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:xfrm",
907 1 : "rot","16200000");
908 : }
909 :
910 17 : DECLARE_OOXMLEXPORT_TEST(testfdo80895, "fdo80895.docx")
911 : {
912 : // DML shapes in header and footer were not getting rendered in LO and the same were not preserved after RT.
913 : // In actual there was a shape but because of fetching wrong theme for header.xml or footer.xml
914 : // resultant shape was with <a:noFill/> prop in <wps:spPr> hence was not visible.
915 : // Checking there is a shape in header without <a:noFill/> element.
916 :
917 2 : xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
918 2 : if (!pXmlDoc)
919 3 : return;
920 1 : assertXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:noFill",0);
921 1 : assertXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:noFill",0);
922 :
923 : // Check for fallback (required for MSO-2007)
924 1 : assertXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "fillcolor", "#4f81bd");
925 1 : assertXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:fill", "type", "solid");
926 : }
927 :
928 17 : DECLARE_OOXMLEXPORT_TEST(testWrapTightThrough, "wrap-tight-through.docx")
929 : {
930 : // These were wrapSquare without a wrap polygon before.
931 2 : if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
932 : {
933 : // The first shape should be wrapThrough with a wrap polygon (was wrapSquare).
934 1 : assertXPath(pXmlDoc, "//w:drawing/wp:anchor[1]/wp:wrapThrough/wp:wrapPolygon/wp:start", "x", "-1104");
935 : // The second shape should be wrapTight with a wrap polygon (was wrapSquare).
936 1 : assertXPath(pXmlDoc, "//w:drawing/wp:anchor[1]/wp:wrapTight/wp:wrapPolygon/wp:start", "y", "792");
937 : }
938 2 : }
939 :
940 17 : DECLARE_OOXMLEXPORT_TEST(testPictureWrapPolygon, "picture-wrap-polygon.docx")
941 : {
942 : // The problem was that the wrap polygon was ignored during export.
943 2 : drawing::PointSequenceSequence aSeqSeq = getProperty<drawing::PointSequenceSequence>(getShape(1), "ContourPolyPolygon");
944 : // This was 0: the polygon list was empty.
945 2 : CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aSeqSeq.getLength());
946 :
947 4 : drawing::PointSequence aSeq = aSeqSeq[0];
948 4 : CPPUNIT_ASSERT_EQUAL(sal_Int32(11), aSeq.getLength());
949 2 : }
950 :
951 17 : DECLARE_OOXMLEXPORT_TEST(testPictureColormodeGrayscale, "picture_colormode_grayscale.docx")
952 : {
953 : // THe problem was that the grayscale was not exported
954 2 : xmlDocPtr pXmlDoc = parseExport ("word/document.xml");
955 2 : if (!pXmlDoc)
956 3 : return;
957 :
958 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing/wp:inline/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:grayscl", 1);
959 : }
960 :
961 16 : DECLARE_OOXMLEXPORT_TEST(testPictureColormodeBlackWhite, "picture_colormode_black_white.odt")
962 : {
963 1 : xmlDocPtr pXmlDoc = parseExport ("word/document.xml");
964 1 : if (!pXmlDoc)
965 1 : return;
966 :
967 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing/wp:anchor/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:biLevel", "thresh", "50000");
968 : }
969 :
970 16 : DECLARE_OOXMLEXPORT_TEST(testPictureColormodeWatermark, "picture_colormode_watermark.odt")
971 : {
972 1 : xmlDocPtr pXmlDoc = parseExport ("word/document.xml");
973 1 : if (!pXmlDoc)
974 1 : return;
975 :
976 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing/wp:anchor/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:lum", "bright", "50000");
977 1 : assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:drawing/wp:anchor/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:lum", "contrast", "-70000");
978 : }
979 :
980 :
981 16 : DECLARE_OOXMLEXPORT_TEST(testExportShadow, "bnc637947.odt")
982 : {
983 : // The problem was that shadows of shapes from non-OOXML origin were not exported to DrawingML
984 1 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
985 1 : if (!pXmlDoc)
986 1 : return;
987 :
988 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:spPr/a:effectLst/a:outerShdw", "dist" , "109865");
989 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:spPr/a:effectLst/a:outerShdw", "dir" , "634411");
990 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:spPr/a:effectLst/a:outerShdw/a:srgbClr", "val" , "000000");
991 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:spPr/a:effectLst/a:outerShdw/a:srgbClr/a:alpha", "val" , "38000");
992 : }
993 :
994 17 : DECLARE_OOXMLEXPORT_TEST(testExportAdjustmentValue, "tdf91429.docx")
995 : {
996 2 : xmlDocPtr pXmlDoc = parseExport("word/document.xml");
997 2 : if (!pXmlDoc)
998 3 : return;
999 :
1000 1 : assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd", "fmla", "val 50000");
1001 : }
1002 : #endif
1003 :
1004 4 : CPPUNIT_PLUGIN_IMPLEMENT();
1005 :
1006 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|