LibreOffice Module writerfilter (master) 1
SdtHelper.cxx
Go to the documentation of this file.
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 "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>
20#include <comphelper/string.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>
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>
34
36{
37using namespace ::com::sun::star;
38using namespace ::css::xml::xpath;
39using namespace ::comphelper;
40
42static awt::Size lcl_getOptimalWidth(const StyleSheetTablePtr& pStyleSheet,
43 OUString const& rDefault, std::vector<OUString>& rItems)
44{
45 OUString aLongest = rDefault;
46 sal_Int32 nHeight = 0;
47 for (const OUString& rItem : rItems)
48 if (rItem.getLength() > aLongest.getLength())
49 aLongest = rItem;
50
51 MapMode aMap(MapUnit::Map100thMM);
54
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)
63 {
64 nHeight = aHeight->second.get<double>() * 35; // points -> mm100
65 aFont.SetFontSize(Size(0, nHeight));
66 }
67 pOut->SetFont(aFont);
68 pOut->SetMapMode(aMap);
69 sal_Int32 nWidth = pOut->GetTextWidth(aLongest);
70
71 pOut->Pop();
72
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;
76
77 // Width: space for the text + the square having the dropdown arrow.
78 return { nWidth + nBorder + nHeight, nHeight + nBorder };
79}
80
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_bHasElements(false)
87 , m_bOutsideAParagraph(false)
88 , m_bPropertiesXMLsLoaded(false)
89{
90}
91
92SdtHelper::~SdtHelper() = default;
93
95{
96 // Initialize properties xml storage (m_xPropertiesXMLs)
98 = m_xComponentContext->getServiceManager()->createInstanceWithContext(
99 "com.sun.star.document.OOXMLDocumentPropertiesImporter", m_xComponentContext);
100 uno::Reference<document::XOOXMLDocumentPropertiesImporter> xImporter(xTemp, uno::UNO_QUERY);
101 if (!xImporter.is())
102 return;
103
105 xml::dom::DocumentBuilder::create(m_xComponentContext));
106 if (!xDomBuilder.is())
107 return;
108
109 // Load core properties
110 try
111 {
112 auto xCorePropsStream = xImporter->getCorePropertiesStream(m_rDM_Impl.m_xDocumentStorage);
113 m_xPropertiesXMLs.insert(
114 { OUString("{6C3C8BC8-F283-45AE-878A-BAB7291924A1}"), // hardcoded id for core props
115 xDomBuilder->parse(xCorePropsStream) });
116 }
117 catch (const uno::Exception&)
118 {
119 SAL_WARN("writerfilter",
120 "SdtHelper::loadPropertiesXMLs: failed loading core properties XML");
121 }
122
123 // Load extended properties
124 try
125 {
126 auto xExtPropsStream
127 = xImporter->getExtendedPropertiesStream(m_rDM_Impl.m_xDocumentStorage);
128 m_xPropertiesXMLs.insert(
129 { OUString("{6668398D-A668-4E3E-A5EB-62B293D839F1}"), // hardcoded id for extended props
130 xDomBuilder->parse(xExtPropsStream) });
131 }
132 catch (const uno::Exception&)
133 {
134 SAL_WARN("writerfilter",
135 "SdtHelper::loadPropertiesXMLs: failed loading extended properties XML");
136 }
137
138 // TODO: some other property items?
139
140 // Add custom XMLs
145 if (aCustomXmls.getLength())
146 {
147 uno::Reference<XXPathAPI> xXpathAPI = XPathAPI::create(m_xComponentContext);
148 xXpathAPI->registerNS("ds",
149 "http://schemas.openxmlformats.org/officeDocument/2006/customXml");
150 sal_Int32 nItem = 0;
151 // Hereby we assume that items from getCustomXmlDomList() and getCustomXmlDomPropsList()
152 // are matching each other:
153 // item1.xml -> itemProps1.xml, item2.xml -> itemProps2.xml
154 // This does works practically, but is it true in general?
155 for (const auto& xDoc : aCustomXmls)
156 {
157 // Retrieve storeid from properties xml
158 OUString aStoreId;
160 = xXpathAPI->eval(aCustomXmlProps[nItem], "string(/ds:datastoreItem/@ds:itemID)");
161
162 if (xResult.is() && xResult->getString().getLength())
163 {
164 aStoreId = xResult->getString();
165 }
166 else
167 {
168 SAL_WARN("writerfilter",
169 "SdtHelper::loadPropertiesXMLs: can't fetch storeid for custom doc!");
170 }
171
172 m_xPropertiesXMLs.insert({ aStoreId, xDoc });
173 nItem++;
174 }
175 }
176
178}
179
180static void lcl_registerNamespaces(std::u16string_view sNamespaceString,
181 const uno::Reference<XXPathAPI>& xXPathAPI)
182{
183 // Split namespaces and register it in XPathAPI
184 auto aNamespaces = string::split(sNamespaceString, ' ');
185 for (const auto& sNamespace : aNamespaces)
186 {
187 // Here we have just one namespace in format "xmlns:ns0='http://someurl'"
188 auto aNamespace = string::split(sNamespace, '=');
189 if (aNamespace.size() < 2)
190 {
191 SAL_WARN("writerfilter",
192 "SdtHelper::getValueFromDataBinding: invalid namespace: " << sNamespace);
193 continue;
194 }
195
196 auto aNamespaceId = string::split(aNamespace[0], ':');
197 if (aNamespaceId.size() < 2)
198 {
199 SAL_WARN("writerfilter",
200 "SdtHelper::getValueFromDataBinding: invalid namespace: " << aNamespace[0]);
201 continue;
202 }
203
204 OUString sNamespaceURL = aNamespace[1];
205 sNamespaceURL = string::strip(sNamespaceURL, ' ');
206 sNamespaceURL = string::strip(sNamespaceURL, '\'');
207
208 xXPathAPI->registerNS(aNamespaceId[1], sNamespaceURL);
209 }
210}
211
212std::optional<OUString> SdtHelper::getValueFromDataBinding()
213{
214 // No xpath - nothing to do
215 if (m_sDataBindingXPath.isEmpty())
216 return {};
217
218 // Load properties XMLs
221
222 uno::Reference<XXPathAPI> xXpathAPI = XPathAPI::create(m_xComponentContext);
223
225
226 // Find storage by store id and eval xpath there
227 const auto& aSourceIt = m_xPropertiesXMLs.find(m_sDataBindingStoreItemID);
228 if (aSourceIt != m_xPropertiesXMLs.end())
229 {
230 try
231 {
233 = xXpathAPI->eval(aSourceIt->second, m_sDataBindingXPath);
234
235 if (xResult.is() && xResult->getNodeList() && xResult->getNodeList()->getLength()
236 && xResult->getString().getLength())
237 {
238 return xResult->getString();
239 }
240 }
241 catch (const XPathException& e)
242 {
243 // XPath failed? Log and continue with next data document
244 SAL_WARN("writerfilter", "SdtHelper::failed running XPath: " << e.Message);
245 }
246 }
247
248 // Nothing found? Try to iterate storages and eval xpath
249 for (const auto& aSource : m_xPropertiesXMLs)
250 {
251 try
252 {
254 = xXpathAPI->eval(aSource.second, m_sDataBindingXPath);
255
256 if (xResult.is() && xResult->getNodeList() && xResult->getNodeList()->getLength()
257 && xResult->getString().getLength())
258 {
259 return xResult->getString();
260 }
261 }
262 catch (const XPathException& e)
263 {
264 // XPath failed? Log and continue with next data document
265 SAL_WARN("writerfilter", "SdtHelper::failed running XPath: " << e.Message);
266 }
267 }
268
269 // No data
270 return {};
271}
272
274{
277
278 const bool bDropDown
279 = officecfg::Office::Writer::Filter::Import::DOCX::ImportComboBoxAsDropDown::get();
280 const OUString aDefaultText = m_aSdtTexts.makeStringAndClear();
281
282 if (bDropDown)
283 {
284 // create field
286 m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.text.TextField.DropDown"),
287 uno::UNO_QUERY);
288
289 const auto it = std::find_if(
290 m_aDropDownItems.begin(), m_aDropDownItems.end(),
291 [aDefaultText](const OUString& item) -> bool { return !item.compareTo(aDefaultText); });
292
293 if (m_aDropDownItems.end() == it)
294 {
295 m_aDropDownItems.push_back(aDefaultText);
296 }
297
298 // set properties
299 uno::Reference<beans::XPropertySet> xPropertySet(xControlModel, uno::UNO_QUERY);
300 xPropertySet->setPropertyValue("SelectedItem", uno::Any(aDefaultText));
301 xPropertySet->setPropertyValue("Items",
303
304 // add it into document
306
307 m_bHasElements = true;
308 }
309 else
310 {
311 // create control
313 m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.form.component.ComboBox"),
314 uno::UNO_QUERY);
315
316 // set properties
317 uno::Reference<beans::XPropertySet> xPropertySet(xControlModel, uno::UNO_QUERY);
318 xPropertySet->setPropertyValue("DefaultText", uno::Any(aDefaultText));
319 xPropertySet->setPropertyValue("Dropdown", uno::Any(true));
320 xPropertySet->setPropertyValue("StringItemList",
322
323 // add it into document
326 xControlModel, uno::Sequence<beans::PropertyValue>());
327 }
328
329 // clean up
330 clear();
331}
332
334{
336
337 OUString aDefaultText = m_aSdtTexts.makeStringAndClear();
338
339 // create field
341 m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.text.TextField.Input"),
342 uno::UNO_QUERY);
343
344 // set properties
345 uno::Reference<beans::XPropertySet> xPropertySet(xControlModel, uno::UNO_QUERY);
346
347 std::optional<OUString> oData = getValueFromDataBinding();
348 if (oData.has_value())
349 aDefaultText = *oData;
350
351 xPropertySet->setPropertyValue("Content", uno::Any(aDefaultText));
352
353 // add it into document
355
356 // Store all unused sdt parameters from grabbag
357 xPropertySet->setPropertyValue(UNO_NAME_MISC_OBJ_INTEROPGRABBAG,
359
360 // clean up
361 clear();
362}
363
365{
366 if (!m_xDateFieldStartRange.is())
367 return;
368
371 {
373 if (xTextAppend.is())
374 {
375 xCrsr = xTextAppend->createTextCursorByRange(xTextAppend);
376 }
377 }
378 if (!xCrsr.is())
379 return;
380
381 try
382 {
383 xCrsr->gotoRange(m_xDateFieldStartRange, false);
384 // tdf#138093: Date selector reset, if placed inside table
385 // Modified to XOR relationship and adding dummy paragraph conditions
389 if (bIsInTable)
390 xCrsr->goRight(1, false);
391 xCrsr->gotoEnd(true);
392 }
393 catch (uno::Exception&)
394 {
395 TOOLS_WARN_EXCEPTION("writerfilter.dmapper",
396 "Cannot get the right text range for date field");
397 return;
398 }
399
400 uno::Reference<uno::XInterface> xFieldInterface
401 = m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.text.Fieldmark");
402 uno::Reference<text::XFormField> xFormField(xFieldInterface, uno::UNO_QUERY);
403 uno::Reference<text::XTextContent> xToInsert(xFormField, uno::UNO_QUERY);
404 if (!(xFormField.is() && xToInsert.is()))
405 return;
406
407 xToInsert->attach(uno::Reference<text::XTextRange>(xCrsr, uno::UNO_QUERY_THROW));
408 xFormField->setFieldType(ODF_FORMDATE);
409 uno::Reference<container::XNameContainer> xNameCont = xFormField->getParameters();
410 if (xNameCont.is())
411 {
412 OUString sDateFormat = m_sDateFormat.makeStringAndClear();
413
414 // Replace quotation mark used for marking static strings in date format
415 sDateFormat = sDateFormat.replaceAll("'", "\"");
416 xNameCont->insertByName(ODF_FORMDATE_DATEFORMAT, uno::Any(sDateFormat));
417 xNameCont->insertByName(ODF_FORMDATE_DATEFORMAT_LANGUAGE,
418 uno::Any(m_sLocale.makeStringAndClear()));
419 }
420 OUString sFullDate = m_sDate.makeStringAndClear();
421
422 std::optional<OUString> oData = getValueFromDataBinding();
423 if (oData.has_value())
424 sFullDate = *oData;
425
426 if (!sFullDate.isEmpty())
427 {
428 sal_Int32 nTimeSep = sFullDate.indexOf("T");
429 if (nTimeSep != -1)
430 sFullDate = sFullDate.copy(0, nTimeSep);
431 xNameCont->insertByName(ODF_FORMDATE_CURRENTDATE, uno::Any(sFullDate));
432 }
433
435 uno::UNO_QUERY);
436 uno::Reference<util::XRefreshable> xRefreshable(xTextFieldsSupplier->getTextFields(),
437 uno::UNO_QUERY);
438 xRefreshable->refresh();
439
440 // Store all unused sdt parameters from grabbag
441 xNameCont->insertByName(UNO_NAME_MISC_OBJ_INTEROPGRABBAG,
443
444 clear();
445}
446
447void SdtHelper::createControlShape(awt::Size aSize,
448 uno::Reference<awt::XControlModel> const& xControlModel,
450{
452 m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.drawing.ControlShape"),
453 uno::UNO_QUERY);
454 xControlShape->setSize(aSize);
455 xControlShape->setControl(xControlModel);
456
457 uno::Reference<beans::XPropertySet> xPropertySet(xControlShape, uno::UNO_QUERY);
458 xPropertySet->setPropertyValue("VertOrient", uno::Any(text::VertOrientation::CENTER));
459
460 if (rGrabBag.hasElements())
461 xPropertySet->setPropertyValue(UNO_NAME_MISC_OBJ_INTEROPGRABBAG, uno::Any(rGrabBag));
462
463 uno::Reference<text::XTextContent> xTextContent(xControlShape, uno::UNO_QUERY);
465 m_bHasElements = true;
466}
467
468void SdtHelper::appendToInteropGrabBag(const beans::PropertyValue& rValue)
469{
470 m_aGrabBag.push_back(rValue);
471}
472
474{
476 m_aGrabBag.clear();
477 return aRet;
478}
479
480bool SdtHelper::isInteropGrabBagEmpty() const { return m_aGrabBag.empty(); }
481
482sal_Int32 SdtHelper::getInteropGrabBagSize() const { return m_aGrabBag.size(); }
483
484bool SdtHelper::containedInInteropGrabBag(const OUString& rValueName)
485{
486 return std::any_of(
487 m_aGrabBag.begin(), m_aGrabBag.end(),
488 [&rValueName](const beans::PropertyValue& i) { return i.Name == rValueName; });
489}
490
492
494
496
497bool SdtHelper::GetChecked() const { return m_bChecked; }
498
499void SdtHelper::SetCheckedState(const OUString& rCheckedState) { m_aCheckedState = rCheckedState; }
500
501const OUString& SdtHelper::GetCheckedState() const { return m_aCheckedState; }
502
503void SdtHelper::SetUncheckedState(const OUString& rUncheckedState)
504{
505 m_aUncheckedState = rUncheckedState;
506}
507
508const OUString& SdtHelper::GetUncheckedState() const { return m_aUncheckedState; }
509
511{
512 m_aDropDownItems.clear();
515 m_nSdtType = 0;
517 m_sDataBindingXPath.clear();
519 m_aGrabBag.clear();
520 m_bShowingPlcHdr = false;
521 m_bChecked = false;
522 m_aCheckedState.clear();
523 m_aUncheckedState.clear();
524 m_aPlaceholderDocPart.clear();
525 m_aColor.clear();
526 m_aAlias.clear();
527 m_aTag.clear();
528 m_nId = 0;
529 m_nTabIndex = 0;
530 m_aLock.clear();
531}
532
533void SdtHelper::SetPlaceholderDocPart(const OUString& rPlaceholderDocPart)
534{
535 m_aPlaceholderDocPart = rPlaceholderDocPart;
536}
537
539
540void SdtHelper::SetColor(const OUString& rColor) { m_aColor = rColor; }
541
542const OUString& SdtHelper::GetColor() const { return m_aColor; }
543
544void SdtHelper::SetAppearance(const OUString& rAppearance) { m_aAppearance = rAppearance; }
545
546const OUString& SdtHelper::GetAppearance() const { return m_aAppearance; }
547
548void SdtHelper::SetAlias(const OUString& rAlias) { m_aAlias = rAlias; }
549
550const OUString& SdtHelper::GetAlias() const { return m_aAlias; }
551
552void SdtHelper::SetTag(const OUString& rTag) { m_aTag = rTag; }
553
554const OUString& SdtHelper::GetTag() const { return m_aTag; }
555
556void SdtHelper::SetId(sal_Int32 nId) { m_nId = nId; }
557
558sal_Int32 SdtHelper::GetId() const { return m_nId; }
559
560void SdtHelper::SetTabIndex(sal_uInt32 nTabIndex) { m_nTabIndex = nTabIndex; }
561
562sal_uInt32 SdtHelper::GetTabIndex() const { return m_nTabIndex; }
563
564void SdtHelper::SetLock(const OUString& rLock) { m_aLock = rLock; }
565
566const OUString& SdtHelper::GetLock() const { return m_aLock; }
567
568} // namespace writerfilter::dmapper
569
570/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static OutputDevice * GetDefaultDevice()
T * get() const
void SetFontSize(const Size &)
void SetFamilyName(const OUString &rFamilyName)
void appendTextContent(const css::uno::Reference< css::text::XTextContent > &, const css::uno::Sequence< css::beans::PropertyValue > &)
writerfilter::ooxml::OOXMLDocument * getDocumentReference() const
const css::uno::Reference< css::text::XTextDocument > & GetTextDocument() const
const css::uno::Reference< css::lang::XMultiServiceFactory > & GetTextFactory() const
sal_Int32 m_nTableDepth
This contains the raw table depth.
css::uno::Reference< css::embed::XStorage > m_xDocumentStorage
DomainMapperTableManager & getTableManager()
css::uno::Reference< css::text::XTextAppend > const & GetTopTextAppend()
StyleSheetTablePtr const & GetStyleSheetTable()
void SetAlias(const OUString &rAlias)
Definition: SdtHelper.cxx:548
OUStringBuffer m_sDate
Date ISO string contained in the w:date element, used by the date control.
Definition: SdtHelper.hxx:75
OUString m_sDataBindingPrefixMapping
<w:dataBinding w:prefixMappings="">
Definition: SdtHelper.hxx:80
const OUString & GetColor() const
Definition: SdtHelper.cxx:542
void SetCheckedState(const OUString &rCheckedState)
Definition: SdtHelper.cxx:499
std::optional< OUString > getValueFromDataBinding()
Definition: SdtHelper.cxx:212
void SetTabIndex(sal_uInt32 nTabIndex)
Definition: SdtHelper.cxx:560
bool m_bShowingPlcHdr
Current contents are placeholder text.
Definition: SdtHelper.hxx:105
const OUString & GetCheckedState() const
Definition: SdtHelper.cxx:501
std::unordered_map< OUString, css::uno::Reference< css::xml::dom::XDocument > > m_xPropertiesXMLs
Storage for all properties documents as xml::dom::XDocument for later querying xpath for data.
Definition: SdtHelper.hxx:98
sal_uInt32 m_nTabIndex
<w:sdtPr>'s <w:tabIndex w:val="...">.
Definition: SdtHelper.hxx:142
void SetAppearance(const OUString &rAppearance)
Definition: SdtHelper.cxx:544
void SetColor(const OUString &rColor)
Definition: SdtHelper.cxx:540
std::vector< OUString > m_aDropDownDisplayTexts
Display texts of a drop-down control: <w:listItem w:displayText="...">.
Definition: SdtHelper.hxx:68
const OUString & GetPlaceholderDocPart() const
Definition: SdtHelper.cxx:538
OUString m_aPlaceholderDocPart
<w:placeholder>'s <w:docPart w:val="...">.
Definition: SdtHelper.hxx:124
bool containedInInteropGrabBag(const OUString &rValueName)
Definition: SdtHelper.cxx:484
OUString m_aAlias
<w:sdtPr>'s <w:alias w:val="...">.
Definition: SdtHelper.hxx:133
std::vector< css::beans::PropertyValue > m_aGrabBag
Grab bag to store unsupported SDTs, aiming to save them back on export.
Definition: SdtHelper.hxx:91
OUStringBuffer m_sDateFormat
Date format string as it comes from the ooxml document.
Definition: SdtHelper.hxx:77
std::vector< OUString > m_aDropDownItems
Items of the drop-down control: <w:listItem w:value="...">.
Definition: SdtHelper.hxx:66
const OUString & GetLock() const
Definition: SdtHelper.cxx:566
OUString m_aColor
<w:sdtPr>'s <w15:color w:val="...">.
Definition: SdtHelper.hxx:127
OUStringBuffer m_aSdtTexts
Pieces of the default text – currently used only by the dropdown control.
Definition: SdtHelper.hxx:73
void appendToInteropGrabBag(const css::beans::PropertyValue &rValue)
Definition: SdtHelper.cxx:468
const OUString & GetUncheckedState() const
Definition: SdtHelper.cxx:508
void createDateContentControl()
Create date control from w:sdt's w:date.
Definition: SdtHelper.cxx:364
bool m_bChecked
If this is a checkbox, is the checkbox checked?
Definition: SdtHelper.hxx:108
void createControlShape(css::awt::Size aSize, css::uno::Reference< css::awt::XControlModel > const &xControlModel, const css::uno::Sequence< css::beans::PropertyValue > &rGrabBag)
Create and append the drawing::XControlShape, containing the various models.
Definition: SdtHelper.cxx:447
void SetPlaceholderDocPart(const OUString &rPlaceholderDocPart)
Definition: SdtHelper.cxx:533
bool m_bPropertiesXMLsLoaded
Check if m_xPropertiesXMLs is initialized and loaded (need extra flag to distinguish empty sequence f...
Definition: SdtHelper.hxx:102
sal_Int32 getInteropGrabBagSize() const
Definition: SdtHelper.cxx:482
css::uno::Sequence< css::beans::PropertyValue > getInteropGrabBagAndClear()
Definition: SdtHelper.cxx:473
void SetTag(const OUString &rTag)
Definition: SdtHelper.cxx:552
OUStringBuffer m_sLocale
Locale string as it comes from the ooxml document.
Definition: SdtHelper.hxx:89
SdtHelper(DomainMapper_Impl &rDM_Impl, css::uno::Reference< css::uno::XComponentContext > xContext)
Definition: SdtHelper.cxx:81
void setControlType(SdtControlType aType)
Definition: SdtHelper.hxx:189
OUString m_sDataBindingStoreItemID
<w:dataBinding w:storeItemID="">
Definition: SdtHelper.hxx:84
OUString m_aLock
<w:sdtPr>'s <w:lock w:val="...">.
Definition: SdtHelper.hxx:145
OUString m_sDataBindingXPath
<w:dataBinding w:xpath="">
Definition: SdtHelper.hxx:82
void clear()
Clear all collected attributes for further reuse.
Definition: SdtHelper.cxx:510
const OUString & GetAlias() const
Definition: SdtHelper.cxx:550
DomainMapper_Impl & m_rDM_Impl
Definition: SdtHelper.hxx:62
const OUString & GetTag() const
Definition: SdtHelper.cxx:554
OUString m_aCheckedState
If this is a checkbox, the value of a checked checkbox.
Definition: SdtHelper.hxx:111
css::uno::Reference< css::text::XTextRange > m_xDateFieldStartRange
Start range of the date field.
Definition: SdtHelper.hxx:87
void SetUncheckedState(const OUString &rUncheckedState)
Definition: SdtHelper.cxx:503
sal_Int32 m_nId
<w:sdtPr>'s <w:id w:val="...">.
Definition: SdtHelper.hxx:139
OUString m_aTag
<w:sdtPr>'s <w:tag w:val="...">.
Definition: SdtHelper.hxx:136
const OUString & GetAppearance() const
Definition: SdtHelper.cxx:546
OUString m_aUncheckedState
If this is a checkbox, the value of an unchecked checkbox.
Definition: SdtHelper.hxx:114
void SetLock(const OUString &rLock)
Definition: SdtHelper.cxx:564
OUString m_aAppearance
<w:sdtPr>'s <w15:appearance w:val="...">.
Definition: SdtHelper.hxx:130
sal_uInt32 GetTabIndex() const
Definition: SdtHelper.cxx:562
void createDropDownControl()
Create drop-down control from w:sdt's w:dropDownList.
Definition: SdtHelper.cxx:273
css::uno::Reference< css::uno::XComponentContext > m_xComponentContext
Definition: SdtHelper.hxx:63
bool isInTable()
Tells whether a table has been started or not.
virtual css::uno::Sequence< css::uno::Reference< css::xml::dom::XDocument > > getCustomXmlDomList()=0
virtual css::uno::Sequence< css::uno::Reference< css::xml::dom::XDocument > > getCustomXmlDomPropsList()=0
#define TOOLS_WARN_EXCEPTION(area, stream)
Reference< XComponentContext > const m_xComponentContext
#define SAL_WARN(area, stream)
tools::Long const nBorder
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
int i
static awt::Size lcl_getOptimalWidth(const StyleSheetTablePtr &pStyleSheet, OUString const &rDefault, std::vector< OUString > &rItems)
w:sdt's w:dropDownList doesn't have width, so guess the size based on the longest string.
Definition: SdtHelper.cxx:42
static void lcl_registerNamespaces(std::u16string_view sNamespaceString, const uno::Reference< XXPathAPI > &xXPathAPI)
Definition: SdtHelper.cxx:180
HashMap_OWString_Interface aMap
constexpr OUStringLiteral ODF_FORMDATE_CURRENTDATE
constexpr OUStringLiteral ODF_FORMDATE_DATEFORMAT
constexpr OUStringLiteral ODF_FORMDATE
constexpr OUStringLiteral ODF_FORMDATE_DATEFORMAT_LANGUAGE
sal_Int16 nId
constexpr OUStringLiteral UNO_NAME_MISC_OBJ_INTEROPGRABBAG
oslFileHandle & pOut