summaryrefslogtreecommitdiff
path: root/xmloff/source
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2022-12-02 10:48:46 -0500
committerMiklos Vajna <vmiklos@collabora.com>2022-12-14 07:14:59 +0000
commit908d058c67c4efb3dc142ea8d6ad59badf01c9c6 (patch)
tree2922abca85f2700d11c881ceaf241a5d1eabdf01 /xmloff/source
parente15658a7576c8160c9f1b861201e206f9cf34df9 (diff)
tdf#151548 sw content controls: preserve tabIndex
This has to be vital to keyboard navigation. Certainly it is good to have it imported before we start to consider tab-movements for form controls. All tabIndex 1's are processed (in placement order) and then the 2's etc. 0's are to be done last. XML_TAB_INDEX already existed in include/xmloff/xmltoken.hxx and "tab-index" already exists in xmloff/source/token/tokens.txt make CppunitTest_writerfilter_dmapper CPPUNIT_TEST_NAME=testSdtRunRichText make CppunitTest_sw_ooxmlexport17 CPPUNIT_TEST_NAME=testDateContentControlExport make CppunitTest_sw_core_unocore CPPUNIT_TEST_NAME=testContentControlDate make CppunitTest_xmloff_text CPPUNIT_TEST_NAME=testAliasContentControlExport make CppunitTest_xmloff_text CPPUNIT_TEST_NAME=testAliasContentControlImport No existing unit test found containing blockSDT with tabIndex. Change-Id: I8a958844e6192b079a2b22a62dedfd8739021f4a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143603 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'xmloff/source')
-rw-r--r--xmloff/source/text/txtparae.cxx8
-rw-r--r--xmloff/source/text/xmlcontentcontrolcontext.cxx14
-rw-r--r--xmloff/source/text/xmlcontentcontrolcontext.hxx1
3 files changed, 23 insertions, 0 deletions
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index b2117dfdc726..4ee5f3fd8a90 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -4067,6 +4067,14 @@ void XMLTextParagraphExport::ExportContentControl(
GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, XML_TAG, aTag);
}
+ sal_uInt32 nTabIndex;
+ xPropertySet->getPropertyValue("TabIndex") >>= nTabIndex;
+ if (nTabIndex)
+ {
+ GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, XML_TAB_INDEX,
+ OUString::number(nTabIndex));
+ }
+
OUString aLock;
xPropertySet->getPropertyValue("Lock") >>= aLock;
if (!aLock.isEmpty())
diff --git a/xmloff/source/text/xmlcontentcontrolcontext.cxx b/xmloff/source/text/xmlcontentcontrolcontext.cxx
index 83c1621b057e..caf1af04b8d7 100644
--- a/xmloff/source/text/xmlcontentcontrolcontext.cxx
+++ b/xmloff/source/text/xmlcontentcontrolcontext.cxx
@@ -49,6 +49,7 @@ void XMLContentControlContext::startFastElement(
for (auto& rIter : sax_fastparser::castToFastAttributeList(xAttrList))
{
bool bTmp = false;
+ sal_Int32 nTmp = 0;
switch (rIter.getToken())
{
@@ -151,6 +152,14 @@ void XMLContentControlContext::startFastElement(
m_aTag = rIter.toString();
break;
}
+ case XML_ELEMENT(LO_EXT, XML_TAB_INDEX):
+ {
+ if (sax::Converter::convertNumber(nTmp, rIter.toView()))
+ {
+ m_nTabIndex = nTmp;
+ }
+ break;
+ }
case XML_ELEMENT(LO_EXT, XML_LOCK):
{
m_aLock = rIter.toString();
@@ -267,6 +276,11 @@ void XMLContentControlContext::endFastElement(sal_Int32)
xPropertySet->setPropertyValue("Tag", uno::Any(m_aTag));
}
+ if (m_nTabIndex)
+ {
+ xPropertySet->setPropertyValue("TabIndex", uno::Any(m_nTabIndex));
+ }
+
if (!m_aLock.isEmpty())
{
xPropertySet->setPropertyValue("Lock", uno::Any(m_aLock));
diff --git a/xmloff/source/text/xmlcontentcontrolcontext.hxx b/xmloff/source/text/xmlcontentcontrolcontext.hxx
index f0b1eea0b010..44abe71d6a08 100644
--- a/xmloff/source/text/xmlcontentcontrolcontext.hxx
+++ b/xmloff/source/text/xmlcontentcontrolcontext.hxx
@@ -53,6 +53,7 @@ class XMLContentControlContext : public SvXMLImportContext
bool m_bDropDown = false;
OUString m_aAlias;
OUString m_aTag;
+ sal_uInt32 m_nTabIndex = 0;
OUString m_aLock;
public: