diff options
author | Tünde Tóth <toth.tunde@nisz.hu> | 2021-11-19 12:23:41 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-11-30 10:07:47 +0100 |
commit | 5d0f0d1a70a0b001be9db95d85f1d33a5f23f13f (patch) | |
tree | 841552b8768dd064a27de08582e4789be0c8a664 /sw | |
parent | 843a82a1f5b3c6a220c4fdb70ae03b6ccaf592ac (diff) |
tdf#97899 DOCX import: allow character formatting only of numbering
After the DOCX round-trip of a numbering created in Writer
using direct formatting (e.g. using Toggle Ordered/Unordered
List icons), it was not possible to format only the numbering
or bullets, e.g. selecting and formatting them by positioning
the text cursor on the numbering. Set CharStyleName property
during the DOCX import to allow this formatting.
Note: default list styles of Writer is still not supported,
resulting missing numbering after DOCX import.
Change-Id: I6f2c5d6e0d63b15e9c28367181af1e9e083ae68d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125649
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit 7b8ae6f90c37c18ff724c0751b5f73cca6ae02ac)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125999
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter3.cxx | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 80874d041267..43ef4250aaba 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -3250,6 +3250,42 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf103612) "Text after section"); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf97899) +{ + SwDoc* pDoc = createSwDoc(); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + SwPaM* pCursor = pDoc->GetEditShell()->GetCursor(); + IDocumentContentOperations& rIDCO(pDoc->getIDocumentContentOperations()); + + // Create an Ordered List + rIDCO.InsertString(*pCursor, "a"); + pWrtShell->SplitNode(); + rIDCO.InsertString(*pCursor, "b"); + pWrtShell->SplitNode(); + rIDCO.InsertString(*pCursor, "c"); + + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + dispatchCommand(mxComponent, ".uno:DefaultNumbering", {}); + + // Save it as DOCX & load it again + reload("Office Open XML Text", "tdf97899-tmp.docx"); + uno::Reference<container::XIndexAccess> xNumberingRules + = getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(1), "NumberingRules"); + CPPUNIT_ASSERT(xNumberingRules->getCount()); + uno::Sequence<beans::PropertyValue> aNumbering; + xNumberingRules->getByIndex(0) >>= aNumbering; + OUString sCharStyleName; + for (const auto& prop : aNumbering) + { + if (prop.Name == "CharStyleName") + { + prop.Value >>= sCharStyleName; + break; + } + } + CPPUNIT_ASSERT(!sCharStyleName.isEmpty()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |