1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
14 #include <com/sun/star/text/XTextContent.hpp>
15 #include <com/sun/star/text/XTextRange.hpp>
16 #include <com/sun/star/text/XTextDocument.hpp>
18 #include <rtl/ustring.hxx>
19 #include <sal/types.h>
20 #include <comphelper/propertyvalue.hxx>
22 #include <swmodeltestbase.hxx>
25 #include <formatlinebreak.hxx>
27 #include <textcontentcontrol.hxx>
28 #include <fmtanchr.hxx>
32 /// Covers sw/source/uibase/wrtsh/ fixes.
33 class Test
: public SwModelTestBase
37 CPPUNIT_TEST_FIXTURE(Test
, testInsertLineBreak
)
39 // Given an empty document:
41 SwDoc
* pDoc
= getSwDoc();
43 // When inserting a clearing break:
44 SwWrtShell
* pWrtShell
= pDoc
->GetDocShell()->GetWrtShell();
45 std::optional
<SwLineBreakClear
> oClear
= SwLineBreakClear::ALL
;
46 pWrtShell
->InsertLineBreak(oClear
);
48 // Then make sure it's not just a plain linebreak:
49 uno::Reference
<css::text::XTextRange
> xTextPortion
= getRun(getParagraph(1), 1);
50 auto aPortionType
= getProperty
<OUString
>(xTextPortion
, "TextPortionType");
51 // Without the accompanying fix in place, this test would have failed with:
52 // - Expected: LineBreak
54 // i.e. the line break lost its "clear" property.
55 CPPUNIT_ASSERT_EQUAL(OUString("LineBreak"), aPortionType
);
56 auto xLineBreak
= getProperty
<uno::Reference
<text::XTextContent
>>(xTextPortion
, "LineBreak");
57 auto eClear
= getProperty
<sal_Int16
>(xLineBreak
, "Clear");
58 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16
>(SwLineBreakClear::ALL
), eClear
);
61 CPPUNIT_TEST_FIXTURE(Test
, testGotoContentControl
)
63 // Given a document with a content control:
65 SwDoc
* pDoc
= getSwDoc();
66 uno::Reference
<lang::XMultiServiceFactory
> xMSF(mxComponent
, uno::UNO_QUERY
);
67 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
68 uno::Reference
<text::XText
> xText
= xTextDocument
->getText();
69 uno::Reference
<text::XTextCursor
> xCursor
= xText
->createTextCursor();
70 xText
->insertString(xCursor
, "test", /*bAbsorb=*/false);
71 xCursor
->gotoStart(/*bExpand=*/false);
72 xCursor
->gotoEnd(/*bExpand=*/true);
73 uno::Reference
<text::XTextContent
> xContentControl(
74 xMSF
->createInstance("com.sun.star.text.ContentControl"), uno::UNO_QUERY
);
75 uno::Reference
<beans::XPropertySet
> xContentControlProps(xContentControl
, uno::UNO_QUERY
);
76 xContentControlProps
->setPropertyValue("ShowingPlaceHolder", uno::Any(true));
77 xText
->insertTextContent(xCursor
, xContentControl
, /*bAbsorb=*/true);
79 // When going to that content control in placeholder mode:
80 SwWrtShell
* pWrtShell
= pDoc
->GetDocShell()->GetWrtShell();
81 SwNodeOffset nIndex
= pWrtShell
->GetCursor()->GetPointNode().GetIndex();
82 SwTextNode
* pTextNode
= pDoc
->GetNodes()[nIndex
]->GetTextNode();
83 SwTextAttr
* pAttr
= pTextNode
->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL
);
84 auto pTextContentControl
= static_txtattr_cast
<SwTextContentControl
*>(pAttr
);
85 auto& rFormatContentControl
86 = static_cast<SwFormatContentControl
&>(pTextContentControl
->GetAttr());
87 pWrtShell
->GotoContentControl(rFormatContentControl
);
89 // Then make sure that the content control is selected (without the dummy character):
90 // Without the accompanying fix in place, this test would have failed, the user had to manually
91 // select the placeholder text.
92 sal_Int32 nStart
= pWrtShell
->GetCursor()->Start()->GetContentIndex();
93 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(1), nStart
);
94 sal_Int32 nEnd
= pWrtShell
->GetCursor()->End()->GetContentIndex();
95 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(5), nEnd
);
98 CPPUNIT_TEST_FIXTURE(Test
, testTickCheckboxContentControl
)
100 // Given a document with a checkbox (checked) content control:
102 SwDoc
* pDoc
= getSwDoc();
103 uno::Reference
<lang::XMultiServiceFactory
> xMSF(mxComponent
, uno::UNO_QUERY
);
104 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
105 uno::Reference
<text::XText
> xText
= xTextDocument
->getText();
106 uno::Reference
<text::XTextCursor
> xCursor
= xText
->createTextCursor();
107 xText
->insertString(xCursor
, OUString(u
"☒"), /*bAbsorb=*/false);
108 xCursor
->gotoStart(/*bExpand=*/false);
109 xCursor
->gotoEnd(/*bExpand=*/true);
110 uno::Reference
<text::XTextContent
> xContentControl(
111 xMSF
->createInstance("com.sun.star.text.ContentControl"), uno::UNO_QUERY
);
112 uno::Reference
<beans::XPropertySet
> xContentControlProps(xContentControl
, uno::UNO_QUERY
);
113 xContentControlProps
->setPropertyValue("Checkbox", uno::Any(true));
114 xContentControlProps
->setPropertyValue("Checked", uno::Any(true));
115 xContentControlProps
->setPropertyValue("CheckedState", uno::Any(OUString(u
"☒")));
116 xContentControlProps
->setPropertyValue("UncheckedState", uno::Any(OUString(u
"☐")));
117 xText
->insertTextContent(xCursor
, xContentControl
, /*bAbsorb=*/true);
119 // When clicking on that content control:
120 SwWrtShell
* pWrtShell
= pDoc
->GetDocShell()->GetWrtShell();
121 SwTextNode
* pTextNode
= pWrtShell
->GetCursor()->GetPointNode().GetTextNode();
122 SwTextAttr
* pAttr
= pTextNode
->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL
);
123 auto pTextContentControl
= static_txtattr_cast
<SwTextContentControl
*>(pAttr
);
124 auto& rFormatContentControl
125 = static_cast<SwFormatContentControl
&>(pTextContentControl
->GetAttr());
126 pWrtShell
->GotoContentControl(rFormatContentControl
);
128 // Then make sure that the checkbox is no longer checked:
129 // Without the accompanying fix in place, this test would have failed:
132 // i.e. the text node's text was "Ballot Box with X", not just "Ballot Box".
133 CPPUNIT_ASSERT_EQUAL(OUString(u
"☐"), pTextNode
->GetExpandText(pWrtShell
->GetLayout()));
136 CPPUNIT_TEST_FIXTURE(Test
, testInsertContentControl
)
138 // Given an empty document:
140 SwDoc
* pDoc
= getSwDoc();
142 // When inserting a content control:
143 SwWrtShell
* pWrtShell
= pDoc
->GetDocShell()->GetWrtShell();
144 pWrtShell
->InsertContentControl(SwContentControlType::RICH_TEXT
);
146 // Then make sure that the matching text attribute is added to the document model:
147 SwTextNode
* pTextNode
= pWrtShell
->GetCursor()->GetPointNode().GetTextNode();
148 // Without the accompanying fix in place, this test would have failed, nothing happened on
149 // InsertContentControl().
150 CPPUNIT_ASSERT(pTextNode
->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL
));
153 CPPUNIT_TEST_FIXTURE(Test
, testInsertCheckboxContentControl
)
155 // Given an empty document:
157 SwDoc
* pDoc
= getSwDoc();
159 // When inserting a content control:
160 SwWrtShell
* pWrtShell
= pDoc
->GetDocShell()->GetWrtShell();
161 pWrtShell
->InsertContentControl(SwContentControlType::CHECKBOX
);
163 // Then make sure that the matching text attribute is added to the document model:
164 SwTextNode
* pTextNode
= pWrtShell
->GetCursor()->GetPointNode().GetTextNode();
165 SwTextAttr
* pAttr
= pTextNode
->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL
);
166 auto pTextContentControl
= static_txtattr_cast
<SwTextContentControl
*>(pAttr
);
167 auto& rFormatContentControl
168 = static_cast<SwFormatContentControl
&>(pTextContentControl
->GetAttr());
169 std::shared_ptr
<SwContentControl
> pContentControl
= rFormatContentControl
.GetContentControl();
170 // Without the accompanying fix in place, this test would have failed, the inserted content
171 // control wasn't a checkbox one.
172 CPPUNIT_ASSERT(pContentControl
->GetCheckbox());
175 CPPUNIT_TEST_FIXTURE(Test
, testSelectDropdownContentControl
)
177 // Given a document with a dropdown content control:
179 SwDoc
* pDoc
= getSwDoc();
180 uno::Reference
<lang::XMultiServiceFactory
> xMSF(mxComponent
, uno::UNO_QUERY
);
181 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
182 uno::Reference
<text::XText
> xText
= xTextDocument
->getText();
183 uno::Reference
<text::XTextCursor
> xCursor
= xText
->createTextCursor();
184 xText
->insertString(xCursor
, "choose an item", /*bAbsorb=*/false);
185 xCursor
->gotoStart(/*bExpand=*/false);
186 xCursor
->gotoEnd(/*bExpand=*/true);
187 uno::Reference
<text::XTextContent
> xContentControl(
188 xMSF
->createInstance("com.sun.star.text.ContentControl"), uno::UNO_QUERY
);
189 uno::Reference
<beans::XPropertySet
> xContentControlProps(xContentControl
, uno::UNO_QUERY
);
191 uno::Sequence
<beans::PropertyValues
> aListItems
= {
193 comphelper::makePropertyValue("DisplayText", uno::Any(OUString("red"))),
194 comphelper::makePropertyValue("Value", uno::Any(OUString("R"))),
197 comphelper::makePropertyValue("DisplayText", uno::Any(OUString("green"))),
198 comphelper::makePropertyValue("Value", uno::Any(OUString("G"))),
201 comphelper::makePropertyValue("DisplayText", uno::Any(OUString("blue"))),
202 comphelper::makePropertyValue("Value", uno::Any(OUString("B"))),
205 xContentControlProps
->setPropertyValue("ListItems", uno::Any(aListItems
));
207 xText
->insertTextContent(xCursor
, xContentControl
, /*bAbsorb=*/true);
209 // When clicking on that content control:
210 SwWrtShell
* pWrtShell
= pDoc
->GetDocShell()->GetWrtShell();
211 SwTextNode
* pTextNode
= pWrtShell
->GetCursor()->GetPointNode().GetTextNode();
212 SwTextAttr
* pAttr
= pTextNode
->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL
);
213 auto pTextContentControl
= static_txtattr_cast
<SwTextContentControl
*>(pAttr
);
214 auto& rFormatContentControl
215 = static_cast<SwFormatContentControl
&>(pTextContentControl
->GetAttr());
216 rFormatContentControl
.GetContentControl()->SetSelectedListItem(0);
217 pWrtShell
->GotoContentControl(rFormatContentControl
);
219 // Then make sure that the document text is updated:
220 // Without the accompanying fix in place, this test would have failed:
222 // - Actual : choose an item
223 // i.e. the document text was unchanged instead of display text of the first list item.
224 CPPUNIT_ASSERT_EQUAL(OUString("red"), pTextNode
->GetExpandText(pWrtShell
->GetLayout()));
227 CPPUNIT_TEST_FIXTURE(Test
, testInsertDropdownContentControl
)
229 // Given an empty document:
231 SwDoc
* pDoc
= getSwDoc();
233 // When inserting a content control:
234 SwWrtShell
* pWrtShell
= pDoc
->GetDocShell()->GetWrtShell();
235 pWrtShell
->InsertContentControl(SwContentControlType::DROP_DOWN_LIST
);
237 // Then make sure that the matching text attribute is added to the document model:
238 SwTextNode
* pTextNode
= pWrtShell
->GetCursor()->GetPointNode().GetTextNode();
239 SwTextAttr
* pAttr
= pTextNode
->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL
);
240 auto pTextContentControl
= static_txtattr_cast
<SwTextContentControl
*>(pAttr
);
241 auto& rFormatContentControl
242 = static_cast<SwFormatContentControl
&>(pTextContentControl
->GetAttr());
243 std::shared_ptr
<SwContentControl
> pContentControl
= rFormatContentControl
.GetContentControl();
244 // Without the accompanying fix in place, this test would have failed:
247 // i.e. the inserted content control was a default (rich text) one, not a dropdown.
248 CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pContentControl
->GetListItems().size());
251 CPPUNIT_TEST_FIXTURE(Test
, testReplacePictureContentControl
)
253 // Given a document with a picture content control:
255 SwDoc
* pDoc
= getSwDoc();
256 uno::Reference
<lang::XMultiServiceFactory
> xMSF(mxComponent
, uno::UNO_QUERY
);
257 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
258 uno::Reference
<text::XText
> xText
= xTextDocument
->getText();
259 uno::Reference
<text::XTextCursor
> xCursor
= xText
->createTextCursor();
260 uno::Reference
<beans::XPropertySet
> xTextGraphic(
261 xMSF
->createInstance("com.sun.star.text.TextGraphicObject"), uno::UNO_QUERY
);
262 xTextGraphic
->setPropertyValue("AnchorType",
263 uno::Any(text::TextContentAnchorType_AS_CHARACTER
));
264 uno::Reference
<text::XTextContent
> xTextContent(xTextGraphic
, uno::UNO_QUERY
);
265 xText
->insertTextContent(xCursor
, xTextContent
, false);
266 xCursor
->gotoStart(/*bExpand=*/false);
267 xCursor
->gotoEnd(/*bExpand=*/true);
268 uno::Reference
<text::XTextContent
> xContentControl(
269 xMSF
->createInstance("com.sun.star.text.ContentControl"), uno::UNO_QUERY
);
270 uno::Reference
<beans::XPropertySet
> xContentControlProps(xContentControl
, uno::UNO_QUERY
);
271 xContentControlProps
->setPropertyValue("ShowingPlaceHolder", uno::Any(true));
272 xContentControlProps
->setPropertyValue("Picture", uno::Any(true));
273 xText
->insertTextContent(xCursor
, xContentControl
, /*bAbsorb=*/true);
275 // When clicking on that content control:
276 SwWrtShell
* pWrtShell
= pDoc
->GetDocShell()->GetWrtShell();
277 pWrtShell
->GotoObj(/*bNext=*/true, GotoObjFlags::Any
);
278 pWrtShell
->EnterSelFrameMode();
279 const SwFrameFormat
* pFlyFormat
= pWrtShell
->GetFlyFrameFormat();
280 const SwFormatAnchor
& rFormatAnchor
= pFlyFormat
->GetAnchor();
281 SwNode
* pAnchorNode
= rFormatAnchor
.GetAnchorNode();
282 SwTextNode
* pTextNode
= pAnchorNode
->GetTextNode();
283 SwTextAttr
* pAttr
= pTextNode
->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL
);
284 auto pTextContentControl
= static_txtattr_cast
<SwTextContentControl
*>(pAttr
);
285 auto& rFormatContentControl
286 = static_cast<SwFormatContentControl
&>(pTextContentControl
->GetAttr());
287 pWrtShell
->GotoContentControl(rFormatContentControl
);
289 // Then make sure that the picture is replaced:
290 CPPUNIT_ASSERT(!rFormatContentControl
.GetContentControl()->GetShowingPlaceHolder());
291 // Without the accompanying fix in place, this test would have failed, there was no special
292 // handling for picture content control (how to interact with them), and the default handler
293 // killed the image selection.
294 CPPUNIT_ASSERT(pWrtShell
->IsFrameSelected());
297 CPPUNIT_TEST_FIXTURE(Test
, testInsertPictureContentControl
)
299 // Given an empty document:
301 SwDoc
* pDoc
= getSwDoc();
303 // When inserting a content control:
304 SwWrtShell
* pWrtShell
= pDoc
->GetDocShell()->GetWrtShell();
305 pWrtShell
->InsertContentControl(SwContentControlType::PICTURE
);
307 // Then make sure that the matching text attribute is added to the document model:
308 SwTextNode
* pTextNode
= pWrtShell
->GetCursor()->GetPointNode().GetTextNode();
309 SwTextAttr
* pAttr
= pTextNode
->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL
);
310 auto pTextContentControl
= static_txtattr_cast
<SwTextContentControl
*>(pAttr
);
311 auto& rFormatContentControl
312 = static_cast<SwFormatContentControl
&>(pTextContentControl
->GetAttr());
313 std::shared_ptr
<SwContentControl
> pContentControl
= rFormatContentControl
.GetContentControl();
314 // Without the accompanying fix in place, this test would have failed, there was no special
315 // handling for picture content control, no placeholder fly content was inserted.
316 CPPUNIT_ASSERT(pContentControl
->GetPicture());
317 CPPUNIT_ASSERT(pTextNode
->GetTextAttrForCharAt(1, RES_TXTATR_FLYCNT
));
320 CPPUNIT_TEST_FIXTURE(Test
, testSelectDateContentControl
)
322 // Given a document with a date content control:
324 SwDoc
* pDoc
= getSwDoc();
325 uno::Reference
<lang::XMultiServiceFactory
> xMSF(mxComponent
, uno::UNO_QUERY
);
326 uno::Reference
<text::XTextDocument
> xTextDocument(mxComponent
, uno::UNO_QUERY
);
327 uno::Reference
<text::XText
> xText
= xTextDocument
->getText();
328 uno::Reference
<text::XTextCursor
> xCursor
= xText
->createTextCursor();
329 xText
->insertString(xCursor
, "test", /*bAbsorb=*/false);
330 xCursor
->gotoStart(/*bExpand=*/false);
331 xCursor
->gotoEnd(/*bExpand=*/true);
332 uno::Reference
<text::XTextContent
> xContentControl(
333 xMSF
->createInstance("com.sun.star.text.ContentControl"), uno::UNO_QUERY
);
334 uno::Reference
<beans::XPropertySet
> xContentControlProps(xContentControl
, uno::UNO_QUERY
);
335 xContentControlProps
->setPropertyValue("Date", uno::Any(true));
336 xContentControlProps
->setPropertyValue("DateFormat", uno::Any(OUString("YYYY-MM-DD")));
337 xContentControlProps
->setPropertyValue("DateLanguage", uno::Any(OUString("en-US")));
338 xText
->insertTextContent(xCursor
, xContentControl
, /*bAbsorb=*/true);
340 // When clicking on that content control:
341 SwWrtShell
* pWrtShell
= pDoc
->GetDocShell()->GetWrtShell();
342 SwTextNode
* pTextNode
= pWrtShell
->GetCursor()->GetPointNode().GetTextNode();
343 SwTextAttr
* pAttr
= pTextNode
->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL
);
344 auto pTextContentControl
= static_txtattr_cast
<SwTextContentControl
*>(pAttr
);
345 auto& rFormatContentControl
346 = static_cast<SwFormatContentControl
&>(pTextContentControl
->GetAttr());
347 rFormatContentControl
.GetContentControl()->SetSelectedDate(44705);
348 pWrtShell
->GotoContentControl(rFormatContentControl
);
350 // Then make sure that the document text is updated:
351 // Without the accompanying fix in place, this test would have failed with:
352 // - Expected: 2022-05-24
354 // i.e. the content control was not updated.
355 CPPUNIT_ASSERT_EQUAL(OUString("2022-05-24"), pTextNode
->GetExpandText(pWrtShell
->GetLayout()));
356 CPPUNIT_ASSERT_EQUAL(OUString("2022-05-24T00:00:00Z"),
357 rFormatContentControl
.GetContentControl()->GetCurrentDate());
360 CPPUNIT_TEST_FIXTURE(Test
, testInsertDateContentControl
)
362 // Given an empty document:
364 SwDoc
* pDoc
= getSwDoc();
366 // When inserting a date content control:
367 SwWrtShell
* pWrtShell
= pDoc
->GetDocShell()->GetWrtShell();
368 pWrtShell
->InsertContentControl(SwContentControlType::DATE
);
370 // Then make sure that the matching text attribute is added to the document model:
371 SwTextNode
* pTextNode
= pWrtShell
->GetCursor()->GetPointNode().GetTextNode();
372 SwTextAttr
* pAttr
= pTextNode
->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL
);
373 auto pTextContentControl
= static_txtattr_cast
<SwTextContentControl
*>(pAttr
);
374 auto& rFormatContentControl
375 = static_cast<SwFormatContentControl
&>(pTextContentControl
->GetAttr());
376 std::shared_ptr
<SwContentControl
> pContentControl
= rFormatContentControl
.GetContentControl();
377 // Without the accompanying fix in place, this test would have failed, there was no special
378 // handling for date content control.
379 CPPUNIT_ASSERT(pContentControl
->GetDate());
382 CPPUNIT_TEST_FIXTURE(Test
, testInsertPlainTextContentControl
)
384 // Given an empty document:
386 SwDoc
* pDoc
= getSwDoc();
388 // When inserting a plain text content control:
389 SwWrtShell
* pWrtShell
= pDoc
->GetDocShell()->GetWrtShell();
390 pWrtShell
->InsertContentControl(SwContentControlType::PLAIN_TEXT
);
392 // Then make sure that the matching text attribute is added to the document model:
393 SwTextNode
* pTextNode
= pWrtShell
->GetCursor()->GetPointNode().GetTextNode();
394 SwTextAttr
* pAttr
= pTextNode
->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL
);
395 auto pTextContentControl
= static_txtattr_cast
<SwTextContentControl
*>(pAttr
);
396 auto& rFormatContentControl
397 = static_cast<SwFormatContentControl
&>(pTextContentControl
->GetAttr());
398 std::shared_ptr
<SwContentControl
> pContentControl
= rFormatContentControl
.GetContentControl();
399 // Without the accompanying fix in place, this test would have failed, there was no special
400 // handling for plain text content controls.
401 CPPUNIT_ASSERT(pContentControl
->GetPlainText());
403 CPPUNIT_ASSERT(pContentControl
->GetShowingPlaceHolder());
404 pWrtShell
->GotoContentControl(rFormatContentControl
);
405 CPPUNIT_ASSERT(pContentControl
->GetShowingPlaceHolder());
406 pWrtShell
->Insert("Foo");
407 // No longer showing placeholder text, as it has been changed
408 CPPUNIT_ASSERT(!pContentControl
->GetShowingPlaceHolder());
411 CPPUNIT_TEST_FIXTURE(Test
, testInsertComboBoxContentControl
)
413 // Given an empty document:
415 SwDoc
* pDoc
= getSwDoc();
417 // When inserting a combo box content control:
418 dispatchCommand(mxComponent
, ".uno:InsertComboBoxContentControl", {});
420 // Then make sure that the matching text attribute is added to the document model:
421 SwWrtShell
* pWrtShell
= pDoc
->GetDocShell()->GetWrtShell();
422 SwTextNode
* pTextNode
= pWrtShell
->GetCursor()->GetPointNode().GetTextNode();
423 // Without the accompanying fix in place, this test would have failed, no content control was
425 SwTextAttr
* pAttr
= pTextNode
->GetTextAttrForCharAt(0, RES_TXTATR_CONTENTCONTROL
);
426 CPPUNIT_ASSERT(pAttr
);
427 auto pTextContentControl
= static_txtattr_cast
<SwTextContentControl
*>(pAttr
);
428 auto& rFormatContentControl
429 = static_cast<SwFormatContentControl
&>(pTextContentControl
->GetAttr());
430 std::shared_ptr
<SwContentControl
> pContentControl
= rFormatContentControl
.GetContentControl();
431 CPPUNIT_ASSERT(pContentControl
->GetComboBox());
435 CPPUNIT_PLUGIN_IMPLEMENT();
437 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */