sw/qa/extras/layout/data/tdf113014.fodt |  108 ++++++++++++++++++++++++++++++++
 sw/qa/extras/layout/layout.cxx          |   19 +++++
 sw/source/core/text/itrcrsr.cxx         |   12 ++-
 3 files changed, 134 insertions(+), 5 deletions(-)

New commits:
commit f0c832acb53326ccc9a8c1a47401fbc9e1081feb
Author:     László Németh <nem...@numbertext.org>
AuthorDate: Tue Sep 10 11:58:50 2019 +0200
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Wed Sep 11 07:44:47 2019 +0200

    tdf#113014 Writer: show numbering in narrow cells
    
    Paragraph numbering was invisible in narrow cells
    of Writer tables, when the paragraphs have a wider
    indentation and an equivalent negative first line
    indentation, too.
    
    GetLeftMarginWithNum()==0 doesn't mean that the
    paragraph is not numbered with the "new" numbering
    style SvxNumberFormat::LABEL_ALIGNMENT.
    
    Change-Id: I99f0a84404876db6cefdf0da845cd8b425860553
    Reviewed-on: https://gerrit.libreoffice.org/78802
    Tested-by: Jenkins
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/sw/qa/extras/layout/data/tdf113014.fodt 
b/sw/qa/extras/layout/data/tdf113014.fodt
new file mode 100644
index 000000000000..86f26310acb0
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf113014.fodt
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
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:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.
 0" 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:rpt="http://op
 enoffice.org/2005/report" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
<office:meta><meta:creation-date>2018-08-13T16:49:19.884459566</meta:creation-date><dc:date>2018-08-13T16:56:24.066877759</dc:date><meta:editing-duration>PT7M6S</meta:editing-duration><meta:editing-cycles>2</meta:editing-cycles><meta:generator>LibreOfficeDev/6.4.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/628fbb66869ea82a1f38132ff2ba39e9666083eb</meta:generator><meta:document-statistic
 meta:table-count="1" meta:image-count="0" meta:object-count="0" 
meta:page-count="1" meta:paragraph-count="5" meta:word-count="24" 
meta:character-count="118"/></office:meta>
+ <office:styles>
+  <text:list-style style:name="Numbering_20_123" style:display-name="Numbering 
123">
+   <text:list-level-style-number text:level="1" 
text:style-name="Numbering_20_Symbols" style:num-suffix="." 
style:num-format="1">
+    <style:list-level-properties 
text:list-level-position-and-space-mode="label-alignment">
+     <style:list-level-label-alignment text:label-followed-by="listtab" 
text:list-tab-stop-position="0.7cm" fo:text-indent="-0.7cm" 
fo:margin-left="1.33cm"/>
+    </style:list-level-properties>
+   </text:list-level-style-number>
+    </text:list-style>
+  <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="Table1" style:family="table">
+   <style:table-properties style:width="10.8cm" style:rel-width="100%" 
fo:margin-left="0cm" table:align="left"/>
+  </style:style>
+  <style:style style:name="Table1.A" style:family="table-column">
+   <style:table-column-properties style:column-width="1.905cm" 
style:rel-column-width="1080*"/>
+  </style:style>
+  <style:style style:name="Table1.B" style:family="table-column">
+   <style:table-column-properties style:column-width="8.895cm" 
style:rel-column-width="5043*"/>
+  </style:style>
+  <style:style style:name="Table1.A1" style:family="table-cell">
+   <style:table-cell-properties fo:background-color="transparent" 
fo:padding="0.097cm" fo:border-left="0.5pt solid #000000" 
fo:border-right="none" fo:border-top="0.5pt solid #000000" 
fo:border-bottom="0.5pt solid #000000" style:writing-mode="page">
+    <style:background-image/>
+   </style:table-cell-properties>
+  </style:style>
+  <style:style style:name="Table1.B1" style:family="table-cell">
+   <style:table-cell-properties fo:background-color="transparent" 
fo:padding="0.097cm" fo:border="0.5pt solid #000000" style:writing-mode="page">
+    <style:background-image/>
+   </style:table-cell-properties>
+  </style:style>
+  <style:style style:name="Table1.A2" style:family="table-cell">
+   <style:table-cell-properties fo:background-color="transparent" 
fo:padding="0.097cm" fo:border-left="0.5pt solid #000000" 
fo:border-right="none" fo:border-top="none" fo:border-bottom="0.5pt solid 
#000000" style:writing-mode="page">
+    <style:background-image/>
+   </style:table-cell-properties>
+  </style:style>
+  <style:style style:name="Table1.B2" style:family="table-cell">
+   <style:table-cell-properties fo:background-color="transparent" 
fo:padding="0.097cm" fo:border-left="0.5pt solid #000000" 
fo:border-right="0.5pt solid #000000" fo:border-top="none" 
fo:border-bottom="0.5pt solid #000000" style:writing-mode="page">
+    <style:background-image/>
+   </style:table-cell-properties>
+  </style:style>
+  <style:style style:name="P1" style:family="paragraph" 
style:parent-style-name="Table_20_Contents">
+   <style:paragraph-properties fo:text-align="start" 
style:justify-single-word="false"/>
+   <style:text-properties fo:color="#000000" style:text-outline="false" 
style:text-line-through-style="none" style:text-line-through-type="none" 
style:font-name="Liberation Serif" fo:font-size="12pt" fo:font-style="normal" 
fo:text-shadow="none" style:text-underline-style="none" fo:font-weight="normal" 
officeooo:rsid="00187a1b" officeooo:paragraph-rsid="00187a1b" 
style:font-size-asian="12pt" style:font-style-asian="normal" 
style:font-weight-asian="normal" style:font-size-complex="12pt" 
style:font-style-complex="normal" style:font-weight-complex="normal" 
style:text-overline-style="none" style:text-overline-color="font-color"/>
+  </style:style>
+  <style:style style:name="P2" style:family="paragraph" 
style:parent-style-name="Standard" style:list-style-name="Numbering_20_123">
+   <style:paragraph-properties fo:margin-left="1.33cm" 
fo:margin-right="8.969cm" fo:text-indent="-0.7cm" 
style:auto-text-indent="false">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties officeooo:rsid="0018961b" 
officeooo:paragraph-rsid="0018961b"/>
+  </style:style>
+  <style:style style:name="P3" style:family="paragraph" 
style:parent-style-name="Table_20_Contents" 
style:list-style-name="Numbering_20_123">
+   <loext:graphic-properties draw:fill="none"/>
+   <style:paragraph-properties fo:margin-left="3cm" fo:margin-right="0cm" 
fo:text-align="start" style:justify-single-word="false" fo:text-indent="-3cm" 
style:auto-text-indent="false" fo:background-color="transparent" 
text:number-lines="false" text:line-number="0">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties fo:color="#000000" style:text-outline="false" 
style:text-line-through-style="none" style:text-line-through-type="none" 
style:font-name="Liberation Serif" fo:font-size="12pt" fo:font-style="normal" 
fo:text-shadow="none" style:text-underline-style="none" fo:font-weight="normal" 
style:font-size-asian="12pt" style:font-style-asian="normal" 
style:font-weight-asian="normal" style:font-size-complex="12pt" 
style:font-style-complex="normal" style:font-weight-complex="normal" 
style:text-overline-style="none" style:text-overline-color="font-color"/>
+  </style:style>
+  <style:style style:name="P4" style:family="paragraph" 
style:parent-style-name="Table_20_Contents" 
style:list-style-name="Numbering_20_123">
+   <loext:graphic-properties draw:fill="none"/>
+   <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" 
fo:text-align="start" style:justify-single-word="false" fo:text-indent="0cm" 
style:auto-text-indent="false" fo:background-color="transparent" 
text:number-lines="false" text:line-number="0">
+    <style:tab-stops/>
+   </style:paragraph-properties>
+   <style:text-properties fo:color="#000000" style:text-outline="false" 
style:text-line-through-style="none" style:text-line-through-type="none" 
style:font-name="Liberation Serif" fo:font-size="12pt" fo:font-style="normal" 
fo:text-shadow="none" style:text-underline-style="none" fo:font-weight="normal" 
style:font-size-asian="12pt" style:font-style-asian="normal" 
style:font-weight-asian="normal" style:font-size-complex="12pt" 
style:font-style-complex="normal" style:font-weight-complex="normal" 
style:text-overline-style="none" style:text-overline-color="font-color"/>
+  </style:style>
+ </office:automatic-styles>
+ <office:body>
+  <office:text>
+   <office:forms form:automatic-focus="false" form:apply-design-mode="false"/>
+   <table:table table:name="Table1" table:style-name="Table1">
+    <table:table-column table:style-name="Table1.A"/>
+    <table:table-column table:style-name="Table1.B"/>
+    <table:table-row>
+     <table:table-cell table:style-name="Table1.A1" office:value-type="string">
+      <text:list xml:id="list1838682746" text:style-name="Numbering_20_123">
+       <text:list-item>
+        <text:p text:style-name="P3"/>
+       </text:list-item>
+      </text:list>
+     </table:table-cell>
+     <table:table-cell table:style-name="Table1.B1" office:value-type="string">
+      <text:p text:style-name="P1">First column should have numbering 
showing</text:p>
+     </table:table-cell>
+    </table:table-row>
+    <table:table-row>
+     <table:table-cell table:style-name="Table1.A2" office:value-type="string">
+      <text:list xml:id="list150830635477682" text:continue-numbering="true" 
text:style-name="Numbering_20_123">
+       <text:list-item>
+        <text:p text:style-name="P4"/>
+       </text:list-item>
+      </text:list>
+     </table:table-cell>
+     <table:table-cell table:style-name="Table1.B2" office:value-type="string">
+      <text:p text:style-name="P1">But, if the cell is too small for the 
margin, then the text is hidden.</text:p>
+     </table:table-cell>
+    </table:table-row>
+   </table:table>
+   <text:list xml:id="list150830193122568" text:continue-numbering="true" 
text:style-name="Numbering_20_123">
+    <text:list-item>
+     <text:p text:style-name="P2"/>
+    </text:list-item>
+   </text:list>
+  </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 43f2381ada5b..66421ec4998b 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -3060,6 +3060,25 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf64222)
     assertXPath(pXmlDoc, "/root/page/body/txt[2]/Special", "nHeight", "560");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf113014)
+{
+    SwDoc* pDoc = createDoc("tdf113014.fodt");
+    SwDocShell* pShell = pDoc->GetDocShell();
+
+    // Dump the rendering of the first page as an XML file.
+    std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+    MetafileXmlDump dumper;
+    xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    // This failed, if numbering of cell A1 is missing
+    // (A1: left indent: 3 cm, first line indent: -3 cm
+    // A2: left indent: 0 cm, first line indent: 0 cm)
+    assertXPathContent(pXmlDoc, 
"/metafile/push[1]/push[1]/push[1]/textarray[1]/text", "1.");
+    assertXPathContent(pXmlDoc, 
"/metafile/push[1]/push[1]/push[1]/textarray[3]/text", "2.");
+    assertXPathContent(pXmlDoc, 
"/metafile/push[1]/push[1]/push[1]/textarray[5]/text", "3.");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 4baadcf57f25..ae0d717f6967 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -133,11 +133,11 @@ static void lcl_GetCharRectInsideField( SwTextSizeInfo& 
rInf, SwRect& rOrig,
 
 // #i111284#
 namespace {
-    bool AreListLevelIndentsApplicableAndLabelAlignmentActive( const 
SwTextNode& rTextNode )
+    bool IsLabelAlignmentActive( const SwTextNode& rTextNode )
     {
         bool bRet( false );
 
-        if ( rTextNode.GetNumRule() && 
rTextNode.AreListLevelIndentsApplicable() )
+        if ( rTextNode.GetNumRule() )
         {
             int nListLevel = rTextNode.GetActualListLevel();
 
@@ -170,8 +170,10 @@ void SwTextMargin::CtorInitTextMargin( SwTextFrame 
*pNewFrame, SwTextSizeInfo *p
     const SvxLRSpaceItem &rSpace = pNode->GetSwAttrSet().GetLRSpace();
     // #i95907#
     // #i111284#
-    const bool bListLevelIndentsApplicableAndLabelAlignmentActive(
-        AreListLevelIndentsApplicableAndLabelAlignmentActive( 
*(m_pFrame->GetTextNodeForParaProps()) ) );
+    const SwTextNode *pTextNode = m_pFrame->GetTextNodeForParaProps();
+    const bool bLabelAlignmentActive = IsLabelAlignmentActive( *pTextNode );
+    const bool bListLevelIndentsApplicable = 
pTextNode->AreListLevelIndentsApplicable();
+    const bool bListLevelIndentsApplicableAndLabelAlignmentActive = 
bListLevelIndentsApplicable && bLabelAlignmentActive;
 
     // Carefully adjust the text formatting ranges.
 
@@ -232,7 +234,7 @@ void SwTextMargin::CtorInitTextMargin( SwTextFrame 
*pNewFrame, SwTextSizeInfo *p
          // paras inside cells inside new documents:
         ( 
pNode->getIDocumentSettingAccess()->get(DocumentSettingId::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING)
 ||
           !m_pFrame->IsInTab() ||
-          !nLMWithNum ) )
+          ( !nLMWithNum && !(bLabelAlignmentActive && 
!bListLevelIndentsApplicable) ) ) )
     {
         nLeft = m_pFrame->getFramePrintArea().Left() + 
m_pFrame->getFrameArea().Left();
         if( nLeft >= nRight )   // e.g. with large paragraph indentations in 
slim table columns
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to