Avoid potential negative array index access to cached text.
[LibreOffice.git] / writerfilter / source / dmapper / SdtHelper.cxx
blob09e7903b5f984a2d1114f7c5d64ef0551e492951
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #include "SdtHelper.hxx"
11 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
12 #include <com/sun/star/drawing/XControlShape.hpp>
13 #include <com/sun/star/text/VertOrientation.hpp>
14 #include <editeng/unoprnms.hxx>
15 #include <sal/log.hxx>
16 #include <utility>
17 #include <vcl/svapp.hxx>
18 #include <vcl/outdev.hxx>
19 #include <comphelper/diagnose_ex.hxx>
20 #include <comphelper/string.hxx>
21 #include <comphelper/sequence.hxx>
22 #include <xmloff/odffields.hxx>
23 #include <com/sun/star/text/XTextField.hpp>
24 #include "DomainMapper_Impl.hxx"
25 #include "StyleSheetTable.hxx"
26 #include <officecfg/Office/Writer.hxx>
27 #include <com/sun/star/util/XRefreshable.hpp>
28 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
29 #include <com/sun/star/document/XOOXMLDocumentPropertiesImporter.hpp>
30 #include <ooxml/OOXMLDocument.hxx>
31 #include <com/sun/star/xml/xpath/XPathAPI.hpp>
32 #include <com/sun/star/xml/xpath/XPathException.hpp>
33 #include <com/sun/star/xml/dom/DocumentBuilder.hpp>
35 namespace writerfilter::dmapper
37 using namespace ::com::sun::star;
38 using namespace ::css::xml::xpath;
39 using namespace ::comphelper;
41 /// w:sdt's w:dropDownList doesn't have width, so guess the size based on the longest string.
42 static awt::Size lcl_getOptimalWidth(const StyleSheetTablePtr& pStyleSheet,
43 OUString const& rDefault, std::vector<OUString>& rItems)
45 OUString aLongest = rDefault;
46 sal_Int32 nHeight = 0;
47 for (const OUString& rItem : rItems)
48 if (rItem.getLength() > aLongest.getLength())
49 aLongest = rItem;
51 MapMode aMap(MapUnit::Map100thMM);
52 OutputDevice* pOut = Application::GetDefaultDevice();
53 pOut->Push(vcl::PushFlags::FONT | vcl::PushFlags::MAPMODE);
55 PropertyMapPtr pDefaultCharProps = pStyleSheet->GetDefaultCharProps();
56 vcl::Font aFont(pOut->GetFont());
57 std::optional<PropertyMap::Property> aFontName
58 = pDefaultCharProps->getProperty(PROP_CHAR_FONT_NAME);
59 if (aFontName)
60 aFont.SetFamilyName(aFontName->second.get<OUString>());
61 std::optional<PropertyMap::Property> aHeight = pDefaultCharProps->getProperty(PROP_CHAR_HEIGHT);
62 if (aHeight)
64 nHeight = aHeight->second.get<double>() * 35; // points -> mm100
65 aFont.SetFontSize(Size(0, nHeight));
67 pOut->SetFont(aFont);
68 pOut->SetMapMode(aMap);
69 sal_Int32 nWidth = pOut->GetTextWidth(aLongest);
71 pOut->Pop();
73 // Border: see PDFWriterImpl::drawFieldBorder(), border size is font height / 4,
74 // so additional width / height needed is height / 2.
75 sal_Int32 nBorder = nHeight / 2;
77 // Width: space for the text + the square having the dropdown arrow.
78 return { nWidth + nBorder + nHeight, nHeight + nBorder };
81 SdtHelper::SdtHelper(DomainMapper_Impl& rDM_Impl,
82 css::uno::Reference<css::uno::XComponentContext> xContext)
83 : m_rDM_Impl(rDM_Impl)
84 , m_xComponentContext(std::move(xContext))
85 , m_aControlType(SdtControlType::unknown)
86 , m_bHasUnusedText(false)
87 , m_bHasElements(false)
88 , m_bOutsideAParagraph(false)
89 , m_bPropertiesXMLsLoaded(false)
93 SdtHelper::~SdtHelper() = default;
95 void SdtHelper::loadPropertiesXMLs()
97 // Initialize properties xml storage (m_xPropertiesXMLs)
98 uno::Reference<uno::XInterface> xTemp
99 = m_xComponentContext->getServiceManager()->createInstanceWithContext(
100 "com.sun.star.document.OOXMLDocumentPropertiesImporter", m_xComponentContext);
101 uno::Reference<document::XOOXMLDocumentPropertiesImporter> xImporter(xTemp, uno::UNO_QUERY);
102 if (!xImporter.is())
103 return;
105 uno::Reference<xml::dom::XDocumentBuilder> xDomBuilder(
106 xml::dom::DocumentBuilder::create(m_xComponentContext));
107 if (!xDomBuilder.is())
108 return;
110 // Load core properties
113 auto xCorePropsStream = xImporter->getCorePropertiesStream(m_rDM_Impl.m_xDocumentStorage);
114 m_xPropertiesXMLs.insert(
115 { OUString("{6C3C8BC8-F283-45AE-878A-BAB7291924A1}"), // hardcoded id for core props
116 xDomBuilder->parse(xCorePropsStream) });
118 catch (const uno::Exception&)
120 SAL_WARN("writerfilter",
121 "SdtHelper::loadPropertiesXMLs: failed loading core properties XML");
124 // Load extended properties
127 auto xExtPropsStream
128 = xImporter->getExtendedPropertiesStream(m_rDM_Impl.m_xDocumentStorage);
129 m_xPropertiesXMLs.insert(
130 { OUString("{6668398D-A668-4E3E-A5EB-62B293D839F1}"), // hardcoded id for extended props
131 xDomBuilder->parse(xExtPropsStream) });
133 catch (const uno::Exception&)
135 SAL_WARN("writerfilter",
136 "SdtHelper::loadPropertiesXMLs: failed loading extended properties XML");
139 // TODO: some other property items?
141 // Add custom XMLs
142 uno::Sequence<uno::Reference<xml::dom::XDocument>> aCustomXmls
143 = m_rDM_Impl.getDocumentReference()->getCustomXmlDomList();
144 uno::Sequence<uno::Reference<xml::dom::XDocument>> aCustomXmlProps
145 = m_rDM_Impl.getDocumentReference()->getCustomXmlDomPropsList();
146 if (aCustomXmls.getLength())
148 uno::Reference<XXPathAPI> xXpathAPI = XPathAPI::create(m_xComponentContext);
149 xXpathAPI->registerNS("ds",
150 "http://schemas.openxmlformats.org/officeDocument/2006/customXml");
151 sal_Int32 nItem = 0;
152 // Hereby we assume that items from getCustomXmlDomList() and getCustomXmlDomPropsList()
153 // are matching each other:
154 // item1.xml -> itemProps1.xml, item2.xml -> itemProps2.xml
155 // This does works practically, but is it true in general?
156 for (const auto& xDoc : aCustomXmls)
158 // Retrieve storeid from properties xml
159 OUString aStoreId;
160 uno::Reference<XXPathObject> xResult
161 = xXpathAPI->eval(aCustomXmlProps[nItem], "string(/ds:datastoreItem/@ds:itemID)");
163 if (xResult.is() && xResult->getString().getLength())
165 aStoreId = xResult->getString();
167 else
169 SAL_WARN("writerfilter",
170 "SdtHelper::loadPropertiesXMLs: can't fetch storeid for custom doc!");
173 m_xPropertiesXMLs.insert({ aStoreId, xDoc });
174 nItem++;
178 m_bPropertiesXMLsLoaded = true;
181 static void lcl_registerNamespaces(std::u16string_view sNamespaceString,
182 const uno::Reference<XXPathAPI>& xXPathAPI)
184 // Split namespaces and register it in XPathAPI
185 auto aNamespaces = string::split(sNamespaceString, ' ');
186 for (const auto& sNamespace : aNamespaces)
188 // Here we have just one namespace in format "xmlns:ns0='http://someurl'"
189 auto aNamespace = string::split(sNamespace, '=');
190 if (aNamespace.size() < 2)
192 SAL_WARN("writerfilter",
193 "SdtHelper::getValueFromDataBinding: invalid namespace: " << sNamespace);
194 continue;
197 auto aNamespaceId = string::split(aNamespace[0], ':');
198 if (aNamespaceId.size() < 2)
200 SAL_WARN("writerfilter",
201 "SdtHelper::getValueFromDataBinding: invalid namespace: " << aNamespace[0]);
202 continue;
205 OUString sNamespaceURL = aNamespace[1];
206 sNamespaceURL = string::strip(sNamespaceURL, ' ');
207 sNamespaceURL = string::strip(sNamespaceURL, '\'');
209 xXPathAPI->registerNS(aNamespaceId[1], sNamespaceURL);
213 std::optional<OUString> SdtHelper::getValueFromDataBinding()
215 // No xpath - nothing to do
216 if (m_sDataBindingXPath.isEmpty())
217 return {};
219 // Load properties XMLs
220 if (!m_bPropertiesXMLsLoaded)
221 loadPropertiesXMLs();
223 uno::Reference<XXPathAPI> xXpathAPI = XPathAPI::create(m_xComponentContext);
225 lcl_registerNamespaces(m_sDataBindingPrefixMapping, xXpathAPI);
227 // Find storage by store id and eval xpath there
228 const auto& aSourceIt = m_xPropertiesXMLs.find(m_sDataBindingStoreItemID);
229 if (aSourceIt != m_xPropertiesXMLs.end())
233 uno::Reference<XXPathObject> xResult
234 = xXpathAPI->eval(aSourceIt->second, m_sDataBindingXPath);
236 if (xResult.is() && xResult->getNodeList() && xResult->getNodeList()->getLength()
237 && xResult->getString().getLength())
239 return xResult->getString();
242 catch (const XPathException& e)
244 // XPath failed? Log and continue with next data document
245 SAL_WARN("writerfilter", "SdtHelper::failed running XPath: " << e.Message);
249 // Nothing found? Try to iterate storages and eval xpath
250 for (const auto& aSource : m_xPropertiesXMLs)
254 uno::Reference<XXPathObject> xResult
255 = xXpathAPI->eval(aSource.second, m_sDataBindingXPath);
257 if (xResult.is() && xResult->getNodeList() && xResult->getNodeList()->getLength()
258 && xResult->getString().getLength())
260 return xResult->getString();
263 catch (const XPathException& e)
265 // XPath failed? Log and continue with next data document
266 SAL_WARN("writerfilter", "SdtHelper::failed running XPath: " << e.Message);
270 // No data
271 return {};
274 void SdtHelper::createDropDownControl()
276 assert(getControlType() == SdtControlType::dropDown
277 || getControlType() == SdtControlType::comboBox);
279 const bool bDropDown
280 = officecfg::Office::Writer::Filter::Import::DOCX::ImportComboBoxAsDropDown::get();
281 const OUString aDefaultText = m_aSdtTexts.makeStringAndClear();
283 if (bDropDown)
285 // create field
286 uno::Reference<css::text::XTextField> xControlModel(
287 m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.text.TextField.DropDown"),
288 uno::UNO_QUERY);
290 const auto it = std::find_if(
291 m_aDropDownItems.begin(), m_aDropDownItems.end(),
292 [aDefaultText](const OUString& item) -> bool { return !item.compareTo(aDefaultText); });
294 if (m_aDropDownItems.end() == it)
296 m_aDropDownItems.push_back(aDefaultText);
299 // set properties
300 uno::Reference<beans::XPropertySet> xPropertySet(xControlModel, uno::UNO_QUERY);
301 xPropertySet->setPropertyValue("SelectedItem", uno::Any(aDefaultText));
302 xPropertySet->setPropertyValue("Items",
303 uno::Any(comphelper::containerToSequence(m_aDropDownItems)));
305 // add it into document
306 m_rDM_Impl.appendTextContent(xControlModel, uno::Sequence<beans::PropertyValue>());
308 m_bHasElements = true;
310 else
312 // create control
313 uno::Reference<awt::XControlModel> xControlModel(
314 m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.form.component.ComboBox"),
315 uno::UNO_QUERY);
317 // set properties
318 uno::Reference<beans::XPropertySet> xPropertySet(xControlModel, uno::UNO_QUERY);
319 xPropertySet->setPropertyValue("DefaultText", uno::Any(aDefaultText));
320 xPropertySet->setPropertyValue("Dropdown", uno::Any(true));
321 xPropertySet->setPropertyValue("StringItemList",
322 uno::Any(comphelper::containerToSequence(m_aDropDownItems)));
324 // add it into document
325 createControlShape(
326 lcl_getOptimalWidth(m_rDM_Impl.GetStyleSheetTable(), aDefaultText, m_aDropDownItems),
327 xControlModel, uno::Sequence<beans::PropertyValue>());
330 // clean up
331 clear();
334 void SdtHelper::createPlainTextControl()
336 assert(getControlType() == SdtControlType::plainText);
338 if (!m_xFieldStartRange.is())
339 return;
341 uno::Reference<text::XTextCursor> xCrsr;
342 uno::Reference<text::XText> xText;
343 if (m_rDM_Impl.HasTopText())
345 uno::Reference<text::XTextAppend> xTextAppend = m_rDM_Impl.GetTopTextAppend();
346 if (xTextAppend.is())
348 xText = m_rDM_Impl.GetTopTextAppend()->getEnd()->getText();
349 xCrsr = xText->createTextCursorByRange(m_xFieldStartRange);
352 if (!xCrsr.is())
353 return;
357 bool bIsInTable = (m_rDM_Impl.hasTableManager() && m_rDM_Impl.getTableManager().isInTable())
358 != (0 < m_rDM_Impl.m_StreamStateStack.top().nTableDepth)
359 && m_rDM_Impl.GetIsDummyParaAddedForTableInSection();
360 if (bIsInTable)
361 xCrsr->goRight(1, false);
362 xCrsr->gotoEnd(true);
364 catch (uno::Exception&)
366 TOOLS_WARN_EXCEPTION("writerfilter.dmapper",
367 "Cannot get the right text range for date field");
368 return;
371 std::optional<OUString> oData = getValueFromDataBinding();
372 if (oData.has_value())
373 xCrsr->setString(*oData);
375 uno::Reference<text::XTextContent> xContentControl(
376 m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.text.ContentControl"),
377 uno::UNO_QUERY);
378 uno::Reference<beans::XPropertySet> xContentControlProps(xContentControl, uno::UNO_QUERY);
380 for (const beans::PropertyValue& prop : getInteropGrabBagAndClear())
382 OUString sPropertyName;
383 if (prop.Name == "ooxml:CT_SdtPr_showingPlcHdr")
384 sPropertyName = "ShowingPlaceHolder";
385 else if (prop.Name == "ooxml:CT_SdtPr_alias")
386 sPropertyName = "Alias";
387 else if (prop.Name == "ooxml:CT_SdtPr_tag")
388 sPropertyName = "Tag";
389 else if (prop.Name == "ooxml:CT_SdtPr_id")
390 sPropertyName = "Id";
391 else if (prop.Name == "ooxml:CT_SdtPr_tabIndex")
392 sPropertyName = "TabIndex";
393 else if (prop.Name == "ooxml:CT_SdtPr_lock")
394 sPropertyName = "Lock";
395 else if (prop.Name == "ooxml:CT_SdtPlaceholder_docPart"
396 || prop.Name == "ooxml:CT_SdtPr_dataBinding" || prop.Name == "ooxml:CT_SdtPr_color"
397 || prop.Name == "ooxml:CT_SdtPr_appearance" || prop.Name == "ooxml:CT_SdtPr_text")
399 uno::Sequence<beans::PropertyValue> aInternalGrabBag;
400 prop.Value >>= aInternalGrabBag;
401 for (const beans::PropertyValue& internalProp : aInternalGrabBag)
403 if (internalProp.Name == "ooxml:CT_SdtPlaceholder_docPart_val")
404 sPropertyName = "PlaceholderDocPart";
405 else if (internalProp.Name == "ooxml:CT_DataBinding_prefixMappings")
406 sPropertyName = "DataBindingPrefixMappings";
407 else if (internalProp.Name == "ooxml:CT_DataBinding_xpath")
408 sPropertyName = "DataBindingXpath";
409 else if (internalProp.Name == "ooxml:CT_DataBinding_storeItemID")
410 sPropertyName = "DataBindingStoreItemID";
411 else if (internalProp.Name == "ooxml:CT_SdtAppearance_val")
412 sPropertyName = "Appearance";
413 else if (internalProp.Name == "ooxml:CT_SdtColor_val")
414 sPropertyName = "Color";
415 else if (internalProp.Name == "ooxml:CT_SdtText_multiLine")
416 sPropertyName = "MultiLine";
417 if (!sPropertyName.isEmpty())
419 xContentControlProps->setPropertyValue(sPropertyName, internalProp.Value);
421 sPropertyName.clear();
425 if (!sPropertyName.isEmpty())
427 xContentControlProps->setPropertyValue(sPropertyName, prop.Value);
431 xContentControlProps->setPropertyValue("PlainText", uno::Any(true));
433 xText->insertTextContent(xCrsr, xContentControl, /*bAbsorb=*/true);
435 // clean up
436 clear();
439 void SdtHelper::createDateContentControl()
441 if (!m_xFieldStartRange.is())
442 return;
444 uno::Reference<text::XTextCursor> xCrsr;
445 if (m_rDM_Impl.HasTopText())
447 uno::Reference<text::XTextAppend> xTextAppend = m_rDM_Impl.GetTopTextAppend();
448 if (xTextAppend.is())
450 xCrsr = xTextAppend->createTextCursorByRange(xTextAppend);
453 if (!xCrsr.is())
454 return;
458 xCrsr->gotoRange(m_xFieldStartRange, false);
459 // tdf#138093: Date selector reset, if placed inside table
460 // Modified to XOR relationship and adding dummy paragraph conditions
461 bool bIsInTable = (m_rDM_Impl.hasTableManager() && m_rDM_Impl.getTableManager().isInTable())
462 != (0 < m_rDM_Impl.m_StreamStateStack.top().nTableDepth)
463 && m_rDM_Impl.GetIsDummyParaAddedForTableInSection();
464 if (bIsInTable)
465 xCrsr->goRight(1, false);
466 xCrsr->gotoEnd(true);
468 catch (uno::Exception&)
470 TOOLS_WARN_EXCEPTION("writerfilter.dmapper",
471 "Cannot get the right text range for date field");
472 return;
475 uno::Reference<uno::XInterface> xFieldInterface
476 = m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.text.Fieldmark");
477 uno::Reference<text::XFormField> xFormField(xFieldInterface, uno::UNO_QUERY);
478 uno::Reference<text::XTextContent> xToInsert(xFormField, uno::UNO_QUERY);
479 if (!(xFormField.is() && xToInsert.is()))
480 return;
482 xToInsert->attach(uno::Reference<text::XTextRange>(xCrsr, uno::UNO_QUERY_THROW));
483 xFormField->setFieldType(ODF_FORMDATE);
484 uno::Reference<container::XNameContainer> xNameCont = xFormField->getParameters();
485 if (xNameCont.is())
487 OUString sDateFormat = m_sDateFormat.makeStringAndClear();
489 // Replace quotation mark used for marking static strings in date format
490 sDateFormat = sDateFormat.replaceAll("'", "\"");
491 xNameCont->insertByName(ODF_FORMDATE_DATEFORMAT, uno::Any(sDateFormat));
492 xNameCont->insertByName(ODF_FORMDATE_DATEFORMAT_LANGUAGE,
493 uno::Any(m_sLocale.makeStringAndClear()));
495 OUString sFullDate = m_sDate.makeStringAndClear();
497 std::optional<OUString> oData = getValueFromDataBinding();
498 if (oData.has_value())
499 sFullDate = *oData;
501 if (!sFullDate.isEmpty())
503 sal_Int32 nTimeSep = sFullDate.indexOf("T");
504 if (nTimeSep != -1)
505 sFullDate = sFullDate.copy(0, nTimeSep);
506 xNameCont->insertByName(ODF_FORMDATE_CURRENTDATE, uno::Any(sFullDate));
509 uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(m_rDM_Impl.GetTextDocument(),
510 uno::UNO_QUERY);
511 uno::Reference<util::XRefreshable> xRefreshable(xTextFieldsSupplier->getTextFields(),
512 uno::UNO_QUERY);
513 xRefreshable->refresh();
515 // Store all unused sdt parameters from grabbag
516 xNameCont->insertByName(UNO_NAME_MISC_OBJ_INTEROPGRABBAG,
517 uno::Any(getInteropGrabBagAndClear()));
519 clear();
522 void SdtHelper::createControlShape(awt::Size aSize,
523 uno::Reference<awt::XControlModel> const& xControlModel,
524 const uno::Sequence<beans::PropertyValue>& rGrabBag)
526 uno::Reference<drawing::XControlShape> xControlShape(
527 m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.drawing.ControlShape"),
528 uno::UNO_QUERY);
529 xControlShape->setSize(aSize);
530 xControlShape->setControl(xControlModel);
532 uno::Reference<beans::XPropertySet> xPropertySet(xControlShape, uno::UNO_QUERY);
533 xPropertySet->setPropertyValue("VertOrient", uno::Any(text::VertOrientation::CENTER));
535 if (rGrabBag.hasElements())
536 xPropertySet->setPropertyValue(UNO_NAME_MISC_OBJ_INTEROPGRABBAG, uno::Any(rGrabBag));
538 uno::Reference<text::XTextContent> xTextContent(xControlShape, uno::UNO_QUERY);
539 m_rDM_Impl.appendTextContent(xTextContent, uno::Sequence<beans::PropertyValue>());
540 m_bHasElements = true;
543 void SdtHelper::appendToInteropGrabBag(const beans::PropertyValue& rValue)
545 m_aGrabBag.push_back(rValue);
548 uno::Sequence<beans::PropertyValue> SdtHelper::getInteropGrabBagAndClear()
550 uno::Sequence<beans::PropertyValue> aRet = comphelper::containerToSequence(m_aGrabBag);
551 m_aGrabBag.clear();
552 return aRet;
555 bool SdtHelper::isInteropGrabBagEmpty() const { return m_aGrabBag.empty(); }
557 sal_Int32 SdtHelper::getInteropGrabBagSize() const { return m_aGrabBag.size(); }
559 bool SdtHelper::containedInInteropGrabBag(const OUString& rValueName)
561 return std::any_of(
562 m_aGrabBag.begin(), m_aGrabBag.end(),
563 [&rValueName](const beans::PropertyValue& i) { return i.Name == rValueName; });
566 void SdtHelper::SetShowingPlcHdr() { m_bShowingPlcHdr = true; }
568 bool SdtHelper::GetShowingPlcHdr() const { return m_bShowingPlcHdr; }
570 void SdtHelper::SetChecked() { m_bChecked = true; }
572 bool SdtHelper::GetChecked() const { return m_bChecked; }
574 void SdtHelper::SetCheckedState(const OUString& rCheckedState) { m_aCheckedState = rCheckedState; }
576 const OUString& SdtHelper::GetCheckedState() const { return m_aCheckedState; }
578 void SdtHelper::SetUncheckedState(const OUString& rUncheckedState)
580 m_aUncheckedState = rUncheckedState;
583 const OUString& SdtHelper::GetUncheckedState() const { return m_aUncheckedState; }
585 void SdtHelper::clear()
587 m_aDropDownItems.clear();
588 m_aDropDownDisplayTexts.clear();
589 setControlType(SdtControlType::unknown);
590 m_nSdtType = 0;
591 m_sDataBindingPrefixMapping.clear();
592 m_sDataBindingXPath.clear();
593 m_sDataBindingStoreItemID.clear();
594 m_aGrabBag.clear();
595 m_bHasUnusedText = false;
596 m_bShowingPlcHdr = false;
597 m_bChecked = false;
598 m_aCheckedState.clear();
599 m_aUncheckedState.clear();
600 m_aPlaceholderDocPart.clear();
601 m_aColor.clear();
602 m_aAlias.clear();
603 m_aTag.clear();
604 m_nId = 0;
605 m_nTabIndex = 0;
606 m_aLock.clear();
607 m_xFieldStartRange.clear();
610 void SdtHelper::SetPlaceholderDocPart(const OUString& rPlaceholderDocPart)
612 m_aPlaceholderDocPart = rPlaceholderDocPart;
615 const OUString& SdtHelper::GetPlaceholderDocPart() const { return m_aPlaceholderDocPart; }
617 void SdtHelper::SetColor(const OUString& rColor) { m_aColor = rColor; }
619 const OUString& SdtHelper::GetColor() const { return m_aColor; }
621 void SdtHelper::SetAppearance(const OUString& rAppearance) { m_aAppearance = rAppearance; }
623 const OUString& SdtHelper::GetAppearance() const { return m_aAppearance; }
625 void SdtHelper::SetAlias(const OUString& rAlias) { m_aAlias = rAlias; }
627 const OUString& SdtHelper::GetAlias() const { return m_aAlias; }
629 void SdtHelper::SetTag(const OUString& rTag) { m_aTag = rTag; }
631 const OUString& SdtHelper::GetTag() const { return m_aTag; }
633 void SdtHelper::SetId(sal_Int32 nId) { m_nId = nId; }
635 sal_Int32 SdtHelper::GetId() const { return m_nId; }
637 void SdtHelper::SetTabIndex(sal_uInt32 nTabIndex) { m_nTabIndex = nTabIndex; }
639 sal_uInt32 SdtHelper::GetTabIndex() const { return m_nTabIndex; }
641 void SdtHelper::SetLock(const OUString& rLock) { m_aLock = rLock; }
643 const OUString& SdtHelper::GetLock() const { return m_aLock; }
645 } // namespace writerfilter::dmapper
647 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */