summaryrefslogtreecommitdiff
path: root/sw/source/filter/docx
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2017-05-01 19:05:48 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-05-02 09:33:35 +0200
commitfb3989b6f70b48f4da8ca87e791f6922da56279e (patch)
treefe4cb5b2698c21ed6661ab411d566d58a4992d3f /sw/source/filter/docx
parent1b9d9a8bb640b7883c143cb39e3024be86528977 (diff)
AutoText: read names of entries
+ extended model to parse <docPartPr> and <name> marks + names are inserted to the document before content of each entry + SwDOCXReader interprets first paragraph of each section as a name Change-Id: Ib7de152ba1c6bea4f4665f98d321019c3f68863e Reviewed-on: https://gerrit.libreoffice.org/37124 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw/source/filter/docx')
-rw-r--r--sw/source/filter/docx/swdocxreader.cxx18
1 files changed, 14 insertions, 4 deletions
diff --git a/sw/source/filter/docx/swdocxreader.cxx b/sw/source/filter/docx/swdocxreader.cxx
index 7a3cc9425bd5..8a20cf0d2a8a 100644
--- a/sw/source/filter/docx/swdocxreader.cxx
+++ b/sw/source/filter/docx/swdocxreader.cxx
@@ -111,6 +111,19 @@ bool SwDOCXReader::MakeEntries( SwDoc *pD, SwTextBlocks &rBlocks )
sal_uInt16 nGlosEntry = 0;
SwContentNode* pCNd = nullptr;
do {
+ // Get name - first paragraph
+ OUString aLNm;
+ {
+ SwPaM aPam( aStart );
+ SwNodeIndex& rIdx = aPam.GetPoint()->nNode;
+ ++rIdx;
+ aLNm = aPam.GetNode().GetTextNode()->GetText();
+ }
+
+ // Do not copy name
+ aStart++;
+
+ // Get content
SwPaM aPam( aStart );
{
SwNodeIndex& rIdx = aPam.GetPoint()->nNode;
@@ -139,10 +152,7 @@ bool SwDOCXReader::MakeEntries( SwDoc *pD, SwTextBlocks &rBlocks )
// Now we have the right selection for one entry
rBlocks.ClearDoc();
- // TODO: correct entry name
- const OUString rLNm = "ImportedAutoText";
-
- OUString sShortcut = rLNm;
+ OUString sShortcut = aLNm;
// Need to check make sure the shortcut is not already being used
sal_Int32 nStart = 0;