summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-12-04 12:02:19 +0100
committerLászló Németh <nemeth@numbertext.org>2020-12-04 13:44:56 +0100
commit69a73d0443d408f04837c8781e8fd2296fdd49c6 (patch)
tree0e40bdeaf6b08f514456c4db62e08c0e3e1482e6
parentf3cd444134e7b96eb5e462150b972df5aefcc1b1 (diff)
tdf#100691 sw Table of Contents: remove hidden text
part of chapter, section etc. names. See also commit daf2a7d957c829c551754871a3545495c0f76bc0 (tdf#61154 sw Table of Contents: remove tracked deletion). Change-Id: I96f2308b1b5241f62bcb0091aae32757caeab73b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107214 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--sw/qa/extras/uiwriter/data3/tdf100691.fodt230
-rw-r--r--sw/qa/extras/uiwriter/uiwriter3.cxx25
-rw-r--r--sw/source/core/tox/txmsrt.cxx2
3 files changed, 256 insertions, 1 deletions
diff --git a/sw/qa/extras/uiwriter/data3/tdf100691.fodt b/sw/qa/extras/uiwriter/data3/tdf100691.fodt
new file mode 100644
index 000000000000..6488f0b40663
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data3/tdf100691.fodt
@@ -0,0 +1,230 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:ooo="http://openoffice.org/2004/office" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:meta><dc:date>2020-12-04T11:52:59.211331599</dc:date><meta:editing-duration>PT29S</meta:editing-duration><meta:editing-cycles>1</meta:editing-cycles><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="3" meta:word-count="7" meta:character-count="34" meta:non-whitespace-character-count="30"/><meta:generator>LibreOfficeDev/7.2.0.0.alpha0$Linux_X86_64 LibreOffice_project/e3e68283a0a3457df3501428f8c1310077a7d9b8</meta:generator></office:meta>
+ <office:scripts>
+ <office:script script:language="ooo:Basic">
+ <ooo:libraries xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink"/>
+ </office:script>
+ </office:scripts>
+ <office:font-face-decls>
+ <style:font-face style:name="Liberation Sans" svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss"/>
+ </office:font-face-decls>
+ <office:styles>
+ <style:default-style style:family="graphic">
+ <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
+ <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+ <style:tab-stops/>
+ </style:paragraph-properties>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Sans" fo:font-size="12pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-name-asian="Liberation Sans" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Liberation Sans" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
+ </style:default-style>
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Sans" fo:font-size="12pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-name-asian="Liberation Sans" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Liberation Sans" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false"/>
+ </style:default-style>
+ <style:default-style style:family="table">
+ <style:table-properties table:border-model="collapsing"/>
+ </style:default-style>
+ <style:default-style style:family="table-row">
+ <style:table-row-properties fo:keep-together="auto"/>
+ </style:default-style>
+ <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
+ <style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text">
+ <style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" style:contextual-spacing="false" fo:keep-with-next="always"/>
+ <style:text-properties style:font-name="Liberation Sans" fo:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" fo:font-size="14pt" style:font-name-asian="Liberation Sans" style:font-family-asian="&apos;Liberation Sans&apos;" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="14pt" style:font-name-complex="Liberation Sans" style:font-family-complex="&apos;Liberation Sans&apos;" style:font-family-generic-complex="swiss" style:font-size-complex="14pt"/>
+ </style:style>
+ <style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">
+ <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.247cm" style:contextual-spacing="false" fo:line-height="115%"/>
+ </style:style>
+ <style:style style:name="List" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="list">
+ <style:text-properties style:font-name="Liberation Sans" fo:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-size-asian="12pt" style:font-name-complex="Liberation Sans" style:font-family-complex="&apos;Liberation Sans&apos;" style:font-family-generic-complex="swiss"/>
+ </style:style>
+ <style:style style:name="Caption" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
+ <style:paragraph-properties fo:margin-top="0.212cm" fo:margin-bottom="0.212cm" style:contextual-spacing="false" text:number-lines="false" text:line-number="0"/>
+ <style:text-properties style:font-name="Liberation Sans" fo:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" fo:font-size="12pt" fo:font-style="italic" style:font-size-asian="12pt" style:font-style-asian="italic" style:font-name-complex="Liberation Sans" style:font-family-complex="&apos;Liberation Sans&apos;" style:font-family-generic-complex="swiss" style:font-size-complex="12pt" style:font-style-complex="italic"/>
+ </style:style>
+ <style:style style:name="Index" style:family="paragraph" style:parent-style-name="Standard" style:class="index">
+ <style:paragraph-properties text:number-lines="false" text:line-number="0"/>
+ <style:text-properties style:font-name="Liberation Sans" fo:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-size-asian="12pt" style:font-name-complex="Liberation Sans" style:font-family-complex="&apos;Liberation Sans&apos;" style:font-family-generic-complex="swiss"/>
+ </style:style>
+ <text:outline-style style:name="Outline">
+ <text:outline-level-style text:level="1" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="2" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="3" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="4" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="5" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="6" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="7" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="8" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="9" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ <text:outline-level-style text:level="10" style:num-format="">
+ <style:list-level-properties text:list-level-position-and-space-mode="label-alignment">
+ <style:list-level-label-alignment text:label-followed-by="listtab"/>
+ </style:list-level-properties>
+ </text:outline-level-style>
+ </text:outline-style>
+ <text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
+ <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
+ <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/>
+ </office:styles>
+ <office:automatic-styles>
+ <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard" style:list-style-name=""/>
+ <style:style style:name="T1" style:family="text">
+ <style:text-properties text:display="none"/>
+ </style:style>
+ <style:style style:name="Sect1" style:family="section">
+ <style:section-properties style:editable="false">
+ <style:columns fo:column-count="1" fo:column-gap="0cm"/>
+ </style:section-properties>
+ </style:style>
+ <style:page-layout style:name="pm1">
+ <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
+ <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+ </style:page-layout-properties>
+ <style:header-style/>
+ <style:footer-style/>
+ </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+ <office:text>
+ <text:sequence-decls>
+ <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Table"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Text"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
+ <text:sequence-decl text:display-outline-level="0" text:name="Figure"/>
+ </text:sequence-decls>
+ <text:p text:style-name="Standard"/>
+ <text:table-of-content text:style-name="Sect1" text:protected="true" text:name="Table of Contents1">
+ <text:table-of-content-source text:outline-level="10">
+ <text:index-title-template text:style-name="Contents_20_Heading">Table of Contents</text:index-title-template>
+ <text:table-of-content-entry-template text:outline-level="1" text:style-name="Contents_20_1">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="2" text:style-name="Contents_20_2">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="3" text:style-name="Contents_20_3">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="4" text:style-name="Contents_20_4">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="5" text:style-name="Contents_20_5">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="6" text:style-name="Contents_20_6">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="7" text:style-name="Contents_20_7">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="8" text:style-name="Contents_20_8">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="9" text:style-name="Contents_20_9">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ <text:table-of-content-entry-template text:outline-level="10" text:style-name="Contents_20_10">
+ <text:index-entry-link-start text:style-name="Index_20_Link"/>
+ <text:index-entry-chapter/>
+ <text:index-entry-text/>
+ <text:index-entry-tab-stop style:type="right" style:leader-char="."/>
+ <text:index-entry-page-number/>
+ <text:index-entry-link-end/>
+ </text:table-of-content-entry-template>
+ </text:table-of-content-source>
+ <text:index-body>
+ <text:index-title text:style-name="Sect1" text:name="Table of Contents1_Head">
+ <text:p text:style-name="Standard">Table of Contents</text:p>
+ </text:index-title>
+ <text:p text:style-name="Standard">Text Hidden<text:tab/>1</text:p>
+ </text:index-body>
+ </text:table-of-content>
+ <text:h text:style-name="P1" text:outline-level="1"><text:bookmark-start text:name="__RefHeading__5574_1973640051"/>Text<text:span text:style-name="T1"> Hidden</text:span><text:bookmark-end text:name="__RefHeading__5574_1973640051"/></text:h>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index d5f57f018913..3f89bba3d171 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -254,6 +254,31 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf61154)
CPPUNIT_ASSERT_EQUAL(OUString("Text Inserted\t1"), pNext->GetText());
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf100691)
+{
+ load(DATA_DIRECTORY, "tdf100691.fodt");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+
+ SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+ CPPUNIT_ASSERT(pWrtShell);
+
+ SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
+
+ pWrtShell->GotoNextTOXBase();
+
+ const SwTOXBase* pTOXBase = pWrtShell->GetCurTOX();
+ pWrtShell->UpdateTableOf(*pTOXBase);
+ SwCursorShell* pShell(pDoc->GetEditShell());
+ SwTextNode* pTitleNode = pShell->GetCursor()->GetNode().GetTextNode();
+ SwNodeIndex aIdx(*pTitleNode);
+
+ // table of contents node shouldn't contain invisible text
+ // This was "Text Hidden\t1"
+ SwTextNode* pNext = static_cast<SwTextNode*>(pDoc->GetNodes().GoNext(&aIdx));
+ CPPUNIT_ASSERT_EQUAL(OUString("Text\t1"), pNext->GetText());
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134404)
{
load(DATA_DIRECTORY, "tdf134404.odt");
diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx
index 87e58744e260..7aefd76721a9 100644
--- a/sw/source/core/tox/txmsrt.cxx
+++ b/sw/source/core/tox/txmsrt.cxx
@@ -551,7 +551,7 @@ TextAndReading SwTOXPara::GetText_Impl(SwRootFrame const*const pLayout) const
assert(nEndIndex == -1);
return TextAndReading(sw::GetExpandTextMerged(
pLayout, *static_cast<const SwTextNode*>(pNd),
- false, false, ExpandMode::HideDeletions),
+ false, false, ExpandMode::HideInvisible | ExpandMode::HideDeletions),
OUString());
}
break;