10#include <ooo/vba/word/WdColor.hpp>
11#include <ooo/vba/word/WdCalendarType.hpp>
12#include <ooo/vba/word/WdContentControlType.hpp>
13#include <ooo/vba/word/WdLanguageID.hpp>
35 const uno::Reference<uno::XComponentContext>& rContext,
36 const uno::Reference<text::XTextDocument>& xTextDocument,
37 std::shared_ptr<SwContentControl> pContentControl)
39 , mxTextDocument(xTextDocument)
40 , m_pCC(pContentControl)
42 assert(
m_pCC &&
"SwVbaContentControl created without a shared_ptr. Why would you do that?");
49 SAL_INFO(
"sw.vba",
"SwVbaContentControl::getAllowInsertDeleteSection stub");
55 SAL_INFO(
"sw.vba",
"SwVbaContentControl::setAllowInsertDeleteSection stub");
60 SAL_INFO(
"sw.vba",
"SwVbaContentControl::getAppearance stub");
67 SAL_INFO(
"sw.vba",
"SwVbaContentControl::setAppearance[" << nSet <<
"] stub");
72 SAL_INFO(
"sw.vba",
"SwVbaContentControl::getBuildingBlockCategory stub");
78 SAL_INFO(
"sw.vba",
"SwVbaContentControl::setBuildingBlockCategory[" << sSet <<
"] stub");
83 SAL_INFO(
"sw.vba",
"SwVbaContentControl::getBuildingBlockType stub");
90 SAL_INFO(
"sw.vba",
"SwVbaContentControl::setBuildingBlockType[" << nSet <<
"] stub");
104 if (
m_pCC->GetCheckbox() &&
m_pCC->GetChecked() !=
static_cast<bool>(bSet))
106 m_pCC->SetChecked(bSet);
107 m_pCC->SetShowingPlaceHolder(
false);
108 if (
m_pCC->GetTextAttr())
109 m_pCC->GetTextAttr()->Invalidate();
117 if (
sColor ==
"wdColorAutomatic")
118 return word::WdColor::wdColorAutomatic;
119 if (
sColor ==
"wdColorBlack")
120 return word::WdColor::wdColorBlack;
121 if (
sColor ==
"wdColorBlue")
122 return word::WdColor::wdColorBlue;
123 if (
sColor ==
"wdColorBlueGray")
124 return word::WdColor::wdColorBlueGray;
125 if (
sColor ==
"wdColorBrightGreen")
126 return word::WdColor::wdColorBrightGreen;
127 if (
sColor ==
"wdColorBrown")
128 return word::WdColor::wdColorBrown;
129 if (
sColor ==
"wdColorDarkBlue")
130 return word::WdColor::wdColorDarkBlue;
131 if (
sColor ==
"wdColorDarkGreen")
132 return word::WdColor::wdColorDarkGreen;
133 if (
sColor ==
"wdColorDarkRed")
134 return word::WdColor::wdColorDarkRed;
135 if (
sColor ==
"wdColorDarkTeal")
136 return word::WdColor::wdColorDarkTeal;
137 if (
sColor ==
"wdColorDarkYellow")
138 return word::WdColor::wdColorDarkYellow;
139 if (
sColor ==
"wdColorGold")
140 return word::WdColor::wdColorGold;
141 if (
sColor ==
"wdColorGray05")
142 return word::WdColor::wdColorGray05;
143 if (
sColor ==
"wdColorGray10")
144 return word::WdColor::wdColorGray10;
145 if (
sColor ==
"wdColorGray125")
146 return word::WdColor::wdColorGray125;
147 if (
sColor ==
"wdColorGray15")
148 return word::WdColor::wdColorGray15;
149 if (
sColor ==
"wdColorGray20")
150 return word::WdColor::wdColorGray20;
151 if (
sColor ==
"wdColorGray25")
152 return word::WdColor::wdColorGray25;
153 if (
sColor ==
"wdColorGray30")
154 return word::WdColor::wdColorGray30;
155 if (
sColor ==
"wdColorGray35")
156 return word::WdColor::wdColorGray35;
157 if (
sColor ==
"wdColorGray375")
158 return word::WdColor::wdColorGray375;
159 if (
sColor ==
"wdColorGray40")
160 return word::WdColor::wdColorGray40;
161 if (
sColor ==
"wdColorGray45")
162 return word::WdColor::wdColorGray45;
163 if (
sColor ==
"wdColorGray50")
164 return word::WdColor::wdColorGray50;
165 if (
sColor ==
"wdColorGray55")
166 return word::WdColor::wdColorGray55;
167 if (
sColor ==
"wdColorGray60")
168 return word::WdColor::wdColorGray60;
169 if (
sColor ==
"wdColorGray625")
170 return word::WdColor::wdColorGray625;
171 if (
sColor ==
"wdColorGray65")
172 return word::WdColor::wdColorGray65;
173 if (
sColor ==
"wdColorGray70")
174 return word::WdColor::wdColorGray70;
175 if (
sColor ==
"wdColorGray75")
176 return word::WdColor::wdColorGray75;
177 if (
sColor ==
"wdColorGray80")
178 return word::WdColor::wdColorGray80;
179 if (
sColor ==
"wdColorGray85")
180 return word::WdColor::wdColorGray85;
181 if (
sColor ==
"wdColorGray875")
182 return word::WdColor::wdColorGray875;
183 if (
sColor ==
"wdColorGray90")
184 return word::WdColor::wdColorGray90;
185 if (
sColor ==
"wdColorGray95")
186 return word::WdColor::wdColorGray95;
187 if (
sColor ==
"wdColorGreen")
188 return word::WdColor::wdColorGreen;
189 if (
sColor ==
"wdColorIndigo")
190 return word::WdColor::wdColorIndigo;
191 if (
sColor ==
"wdColorLavender")
192 return word::WdColor::wdColorLavender;
193 if (
sColor ==
"wdColorLightBlue")
194 return word::WdColor::wdColorLightBlue;
195 if (
sColor ==
"wdColorLightGreen")
196 return word::WdColor::wdColorLightGreen;
197 if (
sColor ==
"wdColorLightOrange")
198 return word::WdColor::wdColorLightOrange;
199 if (
sColor ==
"wdColorLightTurquoise")
200 return word::WdColor::wdColorLightTurquoise;
201 if (
sColor ==
"wdColorLightYellow")
202 return word::WdColor::wdColorLightYellow;
203 if (
sColor ==
"wdColorLime")
204 return word::WdColor::wdColorLime;
205 if (
sColor ==
"wdColorOliveGreen")
206 return word::WdColor::wdColorOliveGreen;
207 if (
sColor ==
"wdColorOrange")
208 return word::WdColor::wdColorOrange;
209 if (
sColor ==
"wdColorPaleBlue")
210 return word::WdColor::wdColorPaleBlue;
211 if (
sColor ==
"wdColorPink")
212 return word::WdColor::wdColorPink;
213 if (
sColor ==
"wdColorPlum")
214 return word::WdColor::wdColorPlum;
215 if (
sColor ==
"wdColorRed")
216 return word::WdColor::wdColorRed;
217 if (
sColor ==
"wdColorRose")
218 return word::WdColor::wdColorRose;
219 if (
sColor ==
"wdColorSeaGreen")
220 return word::WdColor::wdColorSeaGreen;
221 if (
sColor ==
"wdColorSkyBlue")
222 return word::WdColor::wdColorSkyBlue;
223 if (
sColor ==
"wdColorTan")
224 return word::WdColor::wdColorTan;
225 if (
sColor ==
"wdColorTeal")
226 return word::WdColor::wdColorTeal;
227 if (
sColor ==
"wdColorTurquoise")
228 return word::WdColor::wdColorTurquoise;
229 if (
sColor ==
"wdColorViolet")
230 return word::WdColor::wdColorViolet;
231 if (
sColor ==
"wdColorWhite")
232 return word::WdColor::wdColorWhite;
233 if (
sColor ==
"wdColorYellow")
234 return word::WdColor::wdColorYellow;
236 return word::WdColor::wdColorBlack;
243 case word::WdColor::wdColorAqua:
244 m_pCC->SetColor(
"wdColorAqua");
246 case word::WdColor::wdColorAutomatic:
247 m_pCC->SetColor(
"wdColorAutomatic");
249 case word::WdColor::wdColorBlack:
250 m_pCC->SetColor(
"wdColorBlack");
252 case word::WdColor::wdColorBlue:
253 m_pCC->SetColor(
"wdColorBlue");
255 case word::WdColor::wdColorBlueGray:
256 m_pCC->SetColor(
"wdColorBlueGray");
258 case word::WdColor::wdColorBrightGreen:
259 m_pCC->SetColor(
"wdColorBrightGreen");
261 case word::WdColor::wdColorBrown:
262 m_pCC->SetColor(
"wdColorBrown");
264 case word::WdColor::wdColorDarkBlue:
265 m_pCC->SetColor(
"wdColorDarkBlue");
267 case word::WdColor::wdColorDarkGreen:
268 m_pCC->SetColor(
"wdColorDarkGreen");
270 case word::WdColor::wdColorDarkRed:
271 m_pCC->SetColor(
"wdColorDarkRed");
273 case word::WdColor::wdColorDarkTeal:
274 m_pCC->SetColor(
"wdColorDarkTeal");
276 case word::WdColor::wdColorDarkYellow:
277 m_pCC->SetColor(
"wdColorDarkYellow");
279 case word::WdColor::wdColorGold:
280 m_pCC->SetColor(
"wdColorGold");
282 case word::WdColor::wdColorGray05:
283 m_pCC->SetColor(
"wdColorGray05");
285 case word::WdColor::wdColorGray10:
286 m_pCC->SetColor(
"wdColorGray10");
288 case word::WdColor::wdColorGray125:
289 m_pCC->SetColor(
"wdColorGray125");
291 case word::WdColor::wdColorGray15:
292 m_pCC->SetColor(
"wdColorGray15");
294 case word::WdColor::wdColorGray20:
295 m_pCC->SetColor(
"wdColorGray20");
297 case word::WdColor::wdColorGray25:
298 m_pCC->SetColor(
"wdColorGray25");
300 case word::WdColor::wdColorGray30:
301 m_pCC->SetColor(
"wdColorGray30");
303 case word::WdColor::wdColorGray35:
304 m_pCC->SetColor(
"wdColorGray35");
306 case word::WdColor::wdColorGray375:
307 m_pCC->SetColor(
"wdColorGray375");
309 case word::WdColor::wdColorGray40:
310 m_pCC->SetColor(
"wdColorGray40");
312 case word::WdColor::wdColorGray45:
313 m_pCC->SetColor(
"wdColorGray45");
315 case word::WdColor::wdColorGray50:
316 m_pCC->SetColor(
"wdColorGray50");
318 case word::WdColor::wdColorGray55:
319 m_pCC->SetColor(
"wdColorGray55");
321 case word::WdColor::wdColorGray60:
322 m_pCC->SetColor(
"wdColorGray60");
324 case word::WdColor::wdColorGray625:
325 m_pCC->SetColor(
"wdColorGray625");
327 case word::WdColor::wdColorGray65:
328 m_pCC->SetColor(
"wdColorGray65");
330 case word::WdColor::wdColorGray70:
331 m_pCC->SetColor(
"wdColorGray70");
333 case word::WdColor::wdColorGray75:
334 m_pCC->SetColor(
"wdColorGray75");
336 case word::WdColor::wdColorGray80:
337 m_pCC->SetColor(
"wdColorGray80");
339 case word::WdColor::wdColorGray85:
340 m_pCC->SetColor(
"wdColorGray85");
342 case word::WdColor::wdColorGray875:
343 m_pCC->SetColor(
"wdColorGray875");
345 case word::WdColor::wdColorGray90:
346 m_pCC->SetColor(
"wdColorGray90");
348 case word::WdColor::wdColorGray95:
349 m_pCC->SetColor(
"wdColorGray95");
351 case word::WdColor::wdColorGreen:
352 m_pCC->SetColor(
"wdColorGreen");
354 case word::WdColor::wdColorIndigo:
355 m_pCC->SetColor(
"wdColorIndigo");
357 case word::WdColor::wdColorLavender:
358 m_pCC->SetColor(
"wdColorLavender");
360 case word::WdColor::wdColorLightBlue:
361 m_pCC->SetColor(
"wdColorLightBlue");
363 case word::WdColor::wdColorLightGreen:
364 m_pCC->SetColor(
"wdColorLightGreen");
366 case word::WdColor::wdColorLightOrange:
367 m_pCC->SetColor(
"wdColorLightOrange");
369 case word::WdColor::wdColorLightTurquoise:
370 m_pCC->SetColor(
"wdColorLightTurquoise");
372 case word::WdColor::wdColorLightYellow:
373 m_pCC->SetColor(
"wdColorLightYellow");
375 case word::WdColor::wdColorLime:
376 m_pCC->SetColor(
"wdColorLime");
378 case word::WdColor::wdColorOliveGreen:
379 m_pCC->SetColor(
"wdColorOliveGreen");
381 case word::WdColor::wdColorOrange:
382 m_pCC->SetColor(
"wdColorOrange");
384 case word::WdColor::wdColorPaleBlue:
385 m_pCC->SetColor(
"wdColorPaleBlue");
387 case word::WdColor::wdColorPink:
388 m_pCC->SetColor(
"wdColorPink");
390 case word::WdColor::wdColorPlum:
391 m_pCC->SetColor(
"wdColorPlum");
393 case word::WdColor::wdColorRed:
394 m_pCC->SetColor(
"wdColorRed");
396 case word::WdColor::wdColorRose:
397 m_pCC->SetColor(
"wdColorRose");
399 case word::WdColor::wdColorSeaGreen:
400 m_pCC->SetColor(
"wdColorSeaGreen");
402 case word::WdColor::wdColorSkyBlue:
403 m_pCC->SetColor(
"wdColorSkyBlue");
405 case word::WdColor::wdColorTan:
406 m_pCC->SetColor(
"wdColorTan");
408 case word::WdColor::wdColorTeal:
409 m_pCC->SetColor(
"wdColorTeal");
411 case word::WdColor::wdColorTurquoise:
412 m_pCC->SetColor(
"wdColorTurquoise");
414 case word::WdColor::wdColorViolet:
415 m_pCC->SetColor(
"wdColorViolet");
417 case word::WdColor::wdColorWhite:
418 m_pCC->SetColor(
"wdColorWhite");
426 SAL_INFO(
"sw.vba",
"SwVbaContentControl::getDateCalendarType stub");
428 return word::WdCalendarType::wdCalendarWestern;
433 SAL_INFO(
"sw.vba",
"SwVbaContentControl::setDateCalendarType[" << nSet <<
"] stub");
442 SAL_INFO(
"sw.vba",
"SwVbaContentControl::getDateStorageFormat stub");
449 SAL_INFO(
"sw.vba",
"SwVbaContentControl::setDateStorageFormat[" << nSet <<
"] stub");
454 SAL_INFO(
"sw.vba",
"SwVbaContentControl::getDateDisplayLocale stub");
456 return word::WdLanguageID::wdEnglishUS;
461 if (!
m_pCC->GetDropDown() && !
m_pCC->GetComboBox())
471 return OUString::number(
static_cast<sal_uInt32
>(
m_pCC->GetId()));
476 SAL_INFO(
"sw.vba",
"SwVbaContentControl::getLevel stub");
483 std::optional<bool> oLock =
m_pCC->GetLock(
true);
484 return oLock && *oLock;
489 std::optional<bool> oLock =
m_pCC->GetLock(
false);
490 m_pCC->SetLock(oLock && *oLock, bSet);
496 std::optional<bool> oLock =
m_pCC->GetLock(
false);
509 return m_pCC->GetReadWrite();
515 std::optional<bool> oLock =
m_pCC->GetLock(
true);
516 m_pCC->SetLock(bSet, oLock && *oLock);
525 m_pCC->SetReadWrite(bSet);
530 SAL_INFO(
"sw.vba",
"SwVbaContentControl::getMultiLine stub");
536 SAL_INFO(
"sw.vba",
"SwVbaContentControl::setMultiLine stub");
542 SAL_INFO(
"sw.vba",
"SwVbaContentControl::getPlaceholderText stub");
550 uno::Reference<word::XRange> xRet;
552 if (pTextNode &&
m_pCC->GetTextAttr())
558 uno::Reference<text::XTextRange> xText(
569 SAL_INFO(
"sw.vba",
"SwVbaContentControl::getRepeatingSectionItemTitle stub");
575 SAL_INFO(
"sw.vba",
"SwVbaContentControl::setRepeatingSectionItemTitle[" <<
rSet <<
"] stub");
584 SAL_INFO(
"sw.vba",
"SwVbaContentControl::getTemporary stub");
591 SAL_INFO(
"sw.vba",
"SwVbaContentControl::setTemporary stub");
601 sal_Int32 eVbaType = word::WdContentControlType::wdContentControlRichText;
606 eVbaType = word::WdContentControlType::wdContentControlCheckbox;
609 eVbaType = word::WdContentControlType::wdContentControlDropdownList;
612 eVbaType = word::WdContentControlType::wdContentControlPicture;
615 eVbaType = word::WdContentControlType::wdContentControlDate;
618 eVbaType = word::WdContentControlType::wdContentControlText;
621 eVbaType = word::WdContentControlType::wdContentControlComboBox;
631 SAL_INFO(
"sw.vba",
"SwVbaContentControl::setType[" << nSet <<
"] stub");
661 SAL_INFO(
"sw.vba",
"SwVbaContentControl::Copy[" <<
getID() <<
"] stub");
670 "SwVbaContentControl::Cut[" <<
getID() <<
"], but missing sending to clipboard");
680 bool bDeleteContents =
false;
681 DeleteContents >>= bDeleteContents;
688 if (!
m_pCC->GetTextAttr())
697 if (
m_pCC->GetCheckbox() &&
m_pCC->GetChecked() && !
m_pCC->GetShowingPlaceHolder())
698 m_pCC->GetTextAttr()->Invalidate();
703 if (!
m_pCC->GetTextAttr())
712 if (
m_pCC->GetCheckbox() && !
m_pCC->GetChecked() && !
m_pCC->GetShowingPlaceHolder())
713 m_pCC->GetTextAttr()->Invalidate();
719 SAL_INFO(
"sw.vba",
"SwVbaContentControl::SetPlaceholderText stub");
724 else if (
Range.hasValue())
728 else if (
Text.hasValue())
735 m_pCC->SetPlaceholderDocPart(
"");
749 static uno::Sequence<OUString>
const aServiceNames{
"ooo.vba.word.ContentControl" };
css::uno::Reference< css::uno::XComponentContext > mxContext
css::uno::WeakReference< ov::XHelperInterface > mxParent
SwTextNode is a paragraph in the document model.
void SAL_CALL setBuildingBlockType(sal_Int32 nSet) override
OUString SAL_CALL getDateDisplayFormat() override
sal_Int32 SAL_CALL getLevel() override
OUString SAL_CALL getRepeatingSectionItemTitle() override
void SAL_CALL SetUnCheckedSymbol(sal_Int32 Character, const css::uno::Any &sFont) override
std::shared_ptr< SwContentControl > m_pCC
OUString SAL_CALL getTitle() override
void SAL_CALL setColor(sal_Int32 nSet) override
void SAL_CALL setMultiLine(sal_Bool bSet) override
void SAL_CALL setDateDisplayFormat(const OUString &sSet) override
sal_Int32 SAL_CALL getColor() override
void SAL_CALL Delete(const css::uno::Any &bDeleteContents) override
OUString getServiceImplName() override
css::uno::Sequence< OUString > getServiceNames() override
void SAL_CALL setAppearance(sal_Int32 nSet) override
sal_Int32 SAL_CALL getDateStorageFormat() override
void SAL_CALL setDateCalendarType(sal_Int32 nSet) override
OUString SAL_CALL getID() override
SwVbaContentControl(const css::uno::Reference< ooo::vba::XHelperInterface > &rParent, const css::uno::Reference< css::uno::XComponentContext > &rContext, const css::uno::Reference< css::text::XTextDocument > &xTextDocument, std::shared_ptr< SwContentControl > pContentControl)
Content controls are the modern version of FormFields, providing inline functionality similar to that...
sal_Bool SAL_CALL getShowingPlaceholderText() override
void SAL_CALL SetPlaceholderText(const css::uno::Any &BuildingBlock, const css::uno::Any &Range, const css::uno::Any &sText) override
~SwVbaContentControl() override
css::uno::Any SAL_CALL getDropdownListEntries() override
sal_Bool SAL_CALL getTemporary() override
OUString SAL_CALL getPlaceholderText() override
void SAL_CALL setDateStorageFormat(sal_Int32 nSet) override
sal_Int32 SAL_CALL getType() override
void SAL_CALL setLockContents(sal_Bool bSet) override
void SAL_CALL Ungroup() override
sal_Int32 SAL_CALL getDateCalendarType() override
OUString SAL_CALL getTag() override
void SAL_CALL setChecked(sal_Bool bSet) override
sal_Int32 SAL_CALL getBuildingBlockType() override
sal_Bool SAL_CALL getMultiLine() override
void SAL_CALL setBuildingBlockCategory(const OUString &sSet) override
void SAL_CALL setType(sal_Int32 nSet) override
void SAL_CALL setTitle(const OUString &rSet) override
void SAL_CALL Cut() override
sal_Bool SAL_CALL getLockContentControl() override
void SAL_CALL setTag(const OUString &rSet) override
void SAL_CALL Copy() override
void SAL_CALL SetCheckedSymbol(sal_Int32 Character, const css::uno::Any &sFont) override
sal_Int32 SAL_CALL getAppearance() override
sal_Bool SAL_CALL getAllowInsertDeleteSection() override
void SAL_CALL setRepeatingSectionItemTitle(const OUString &rSet) override
sal_Int32 SAL_CALL getDateDisplayLocale() override
css::uno::Reference< ooo::vba::word::XRange > SAL_CALL getRange() override
void SAL_CALL setLockContentControl(sal_Bool bSet) override
OUString SAL_CALL getBuildingBlockCategory() override
sal_Bool SAL_CALL getChecked() override
css::uno::Reference< css::text::XTextDocument > mxTextDocument
void SAL_CALL setTemporary(sal_Bool bSet) override
sal_Bool SAL_CALL getLockContents() override
void SAL_CALL setAllowInsertDeleteSection(sal_Bool bSet) override
constexpr OUStringLiteral sColor
Sequence< OUString > aServiceNames
#define SAL_INFO_IF(condition, area, stream)
#define SAL_INFO(area, stream)
Marks a position in the document model.