[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 5 commits - schema/libreoffice sw/qa sw/source sw/uiconfig

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 2 09:09:22 UTC 2019


 schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng |    2 
 sw/qa/extras/layout/data/btlr-cell.odt                      |binary
 sw/qa/extras/layout/layout.cxx                              |   32 +++++
 sw/qa/uitest/table/tableProperties.py                       |   12 +-
 sw/source/core/layout/newfrm.cxx                            |   66 ++++++------
 sw/source/core/text/itrtxt.cxx                              |    8 +
 sw/source/ui/table/tabledlg.cxx                             |    2 
 sw/uiconfig/swriter/ui/tabletextflowpage.ui                 |    7 -
 8 files changed, 84 insertions(+), 45 deletions(-)

New commits:
commit b82fc5e685fc1472fdc79f67636ee60253118657
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Feb 15 12:07:07 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Jul 2 11:01:31 2019 +0200

    sw btlr writing mode layout: fix multiple paragraphs
    
    aVerticalLeftToRightBottomToTop was wrong, it mapped from physical to
    logical, and it should be the other way around.
    
    In practice this means that when SwTextFrame::AdjustFrame() is invoked
    for a second lower, then nAdd will be a small positive (and not a large
    negative) number, so the
    
    warn:legacy.osl:20827:20827:sw/source/core/text/frmform.cxx:479: Ey
    
    warning goes away and the second lower becomes visible.
    
    Change-Id: I894fef4a89b1feeb333537ff7d76793130007ed8
    Reviewed-on: https://gerrit.libreoffice.org/67862
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit 835d054434d0000a5741a5bfa5f577e855594c40)

diff --git a/sw/qa/extras/layout/data/btlr-cell.odt b/sw/qa/extras/layout/data/btlr-cell.odt
index c010fa9f51b6..17a9c19eef25 100644
Binary files a/sw/qa/extras/layout/data/btlr-cell.odt and b/sw/qa/extras/layout/data/btlr-cell.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 36f4c06f105e..c70b0d13d9da 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2759,10 +2759,15 @@ void SwLayoutWriter::testBtlrCell()
 
 #ifndef MACOSX // macOS fails with actual == 2662 for some reason.
     // Without the accompanying fix in place, this test would have failed with 'Expected: 1915;
-    // Actual  : 1756', i.e. the AAA text was too close to the left cell border due to an ascent vs
+    // Actual  : 1756', i.e. the AAA1 text was too close to the left cell border due to an ascent vs
     // descent mismatch when calculating the baseline offset of the text portion.
     assertXPath(pXmlDoc, "//textarray[1]", "x", "1915");
     assertXPath(pXmlDoc, "//textarray[1]", "y", "2707");
+
+    // Without the accompanying fix in place, this test would have failed with 'Expected: 269;
+    // Actual  : 0', i.e. the AAA2 frame was not visible due to 0 width.
+    pXmlDoc = parseLayoutDump();
+    assertXPath(pXmlDoc, "/root/page/body/tab/row/cell[1]/txt[2]/infos/bounds", "width", "269");
 #endif
 }
 
diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index 0971c2d95a8e..94e016434e47 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -226,62 +226,62 @@ static SwRectFnCollection aVerticalLeftToRight = {
 
 /**
  * This is the same as horizontal, but rotated counter-clockwise by 90 degrees.
- * This means logical top is physical right, bottom is left, left is top,
- * finally right is bottom.
+ * This means logical top is physical left, bottom is right, left is bottom,
+ * finally right is top. Values map from logical to physical.
  */
 static SwRectFnCollection aVerticalLeftToRightBottomToTop = {
-    /*.fnGetTop =*/&SwRect::Right_,
-    /*.fnGetBottom =*/&SwRect::Left_,
-    /*.fnGetLeft =*/&SwRect::Top_,
-    /*.fnGetRight =*/&SwRect::Bottom_,
+    /*.fnGetTop =*/&SwRect::Left_,
+    /*.fnGetBottom =*/&SwRect::Right_,
+    /*.fnGetLeft =*/&SwRect::Bottom_,
+    /*.fnGetRight =*/&SwRect::Top_,
     /*.fnGetWidth =*/&SwRect::Height_,
     /*.fnGetHeight =*/&SwRect::Width_,
-    /*.fnGetPos =*/&SwRect::TopRight,
+    /*.fnGetPos =*/&SwRect::BottomLeft,
     /*.fnGetSize =*/&SwRect::SwappedSize,
 
-    /*.fnSetTop =*/&SwRect::Right_,
-    /*.fnSetBottom =*/&SwRect::Left_,
-    /*.fnSetLeft =*/&SwRect::Top_,
-    /*.fnSetRight =*/&SwRect::Bottom_,
+    /*.fnSetTop =*/&SwRect::Left_,
+    /*.fnSetBottom =*/&SwRect::Right_,
+    /*.fnSetLeft =*/&SwRect::Bottom_,
+    /*.fnSetRight =*/&SwRect::Top_,
     /*.fnSetWidth =*/&SwRect::Height_,
     /*.fnSetHeight =*/&SwRect::Width_,
 
-    /*.fnSubTop =*/&SwRect::AddRight,
-    /*.fnAddBottom =*/&SwRect::SubLeft,
-    /*.fnSubLeft =*/&SwRect::SubTop,
-    /*.fnAddRight =*/&SwRect::AddBottom,
+    /*.fnSubTop =*/&SwRect::SubLeft,
+    /*.fnAddBottom =*/&SwRect::AddRight,
+    /*.fnSubLeft =*/&SwRect::AddBottom,
+    /*.fnAddRight =*/&SwRect::SubTop,
     /*.fnAddWidth =*/&SwRect::AddHeight,
     /*.fnAddHeight =*/&SwRect::AddWidth,
 
     /*.fnSetPosX =*/&SwRect::SetPosY,
     /*.fnSetPosY =*/&SwRect::SetPosX,
 
-    /*.fnGetTopMargin =*/&SwFrame::GetRightMargin,
-    /*.fnGetBottomMargin =*/&SwFrame::GetLeftMargin,
-    /*.fnGetLeftMargin =*/&SwFrame::GetTopMargin,
-    /*.fnGetRightMargin =*/&SwFrame::GetBottomMargin,
+    /*.fnGetTopMargin =*/&SwFrame::GetLeftMargin,
+    /*.fnGetBottomMargin =*/&SwFrame::GetRightMargin,
+    /*.fnGetLeftMargin =*/&SwFrame::GetBottomMargin,
+    /*.fnGetRightMargin =*/&SwFrame::GetTopMargin,
     /*.fnSetXMargins =*/&SwFrame::SetTopBottomMargins,
     /*.fnSetYMargins =*/&SwFrame::SetLeftRightMargins,
-    /*.fnGetPrtTop =*/&SwFrame::GetPrtRight,
-    /*.fnGetPrtBottom =*/&SwFrame::GetPrtLeft,
-    /*.fnGetPrtLeft =*/&SwFrame::GetPrtTop,
-    /*.fnGetPrtRight =*/&SwFrame::GetPrtBottom,
-    /*.fnTopDist =*/&SwRect::GetRightDistance,
-    /*.fnBottomDist =*/&SwRect::GetLeftDistance,
-    /*.fnLeftDist =*/&SwRect::GetTopDistance,
-    /*.fnRightDist =*/&SwRect::GetBottomDistance,
-    /*.fnSetLimit =*/&SwFrame::SetMinLeft,
-    /*.fnOverStep =*/&SwRect::OverStepLeft,
+    /*.fnGetPrtTop =*/&SwFrame::GetPrtLeft,
+    /*.fnGetPrtBottom =*/&SwFrame::GetPrtRight,
+    /*.fnGetPrtLeft =*/&SwFrame::GetPrtBottom,
+    /*.fnGetPrtRight =*/&SwFrame::GetPrtTop,
+    /*.fnTopDist =*/&SwRect::GetLeftDistance,
+    /*.fnBottomDist =*/&SwRect::GetRightDistance,
+    /*.fnLeftDist =*/&SwRect::GetBottomDistance,
+    /*.fnRightDist =*/&SwRect::GetTopDistance,
+    /*.fnSetLimit =*/&SwFrame::SetMaxRight,
+    /*.fnOverStep =*/&SwRect::OverStepRight,
 
-    /*.fnSetPos =*/&SwRect::SetUpperRightCorner,
-    /*.fnMakePos =*/&SwFrame::MakeLeftPos,
+    /*.fnSetPos =*/&SwRect::SetLowerLeftCorner,
+    /*.fnMakePos =*/&SwFrame::MakeRightPos,
     /*.fnXDiff =*/&FirstMinusSecond,
     /*.fnYDiff =*/&FirstMinusSecond,
     /*.fnXInc =*/&SwIncrement,
     /*.fnYInc =*/&SwIncrement,
 
-    /*.fnSetLeftAndWidth =*/&SwRect::SetTopAndHeight,
-    /*.fnSetTopAndHeight =*/&SwRect::SetRightAndWidth
+    /*.fnSetLeftAndWidth =*/&SwRect::SetBottomAndHeight,
+    /*.fnSetTopAndHeight =*/&SwRect::SetLeftAndWidth
 };
 
 SwRectFn fnRectHori = &aHorizontal;
commit 741d3a94133d48fe17f9f698745276312e0a6269
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Feb 14 15:35:12 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Jul 2 11:01:04 2019 +0200

    sw btlr writing mode layout: fix baseline offset
    
    The problem was that the x position of the btlr text had a 159 twips
    difference (it was too close to the cell border), since the text portion
    height -> baseline offset calculation worked with the descent, not with
    the ascent.
    
    The position of the text now matches exactly what Word does.
    
    As a side-effect this means that multiple portions in a line and also
    multiple lines in a text frame now work correctly.
    
    Change-Id: Ic139db328e2a913e5cae4026886c3410cdab357d
    Reviewed-on: https://gerrit.libreoffice.org/67823
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    (cherry picked from commit a0bb480364c80192111ecab3501d63584e651ea3)

diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 153f8926b4a6..36f4c06f105e 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2756,6 +2756,14 @@ void SwLayoutWriter::testBtlrCell()
     // the orientation was 0 (layout did not take btlr direction request from
     // doc model).
     assertXPath(pXmlDoc, "//font[1]", "orientation", "900");
+
+#ifndef MACOSX // macOS fails with actual == 2662 for some reason.
+    // Without the accompanying fix in place, this test would have failed with 'Expected: 1915;
+    // Actual  : 1756', i.e. the AAA text was too close to the left cell border due to an ascent vs
+    // descent mismatch when calculating the baseline offset of the text portion.
+    assertXPath(pXmlDoc, "//textarray[1]", "x", "1915");
+    assertXPath(pXmlDoc, "//textarray[1]", "y", "2707");
+#endif
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx
index 53c1c7c91b2b..0f08b824effe 100644
--- a/sw/source/core/text/itrtxt.cxx
+++ b/sw/source/core/text/itrtxt.cxx
@@ -274,7 +274,13 @@ sal_uInt16 SwTextCursor::AdjustBaseLine( const SwLineLayout& rLine,
             case SvxParaVertAlignItem::Align::Automatic :
                 if ( bAutoToCentered || GetInfo().GetTextFrame()->IsVertical() )
                 {
-                    if( GetInfo().GetTextFrame()->IsVertLR() )
+                    // Vertical text has these cases to calculate the baseline:
+                    // - Implicitly TB and RL: the origo is the top right corner, offset is the
+                    //   ascent.
+                    // - (Implicitly TB and) LR: the origo is the top left corner, offset is the
+                    //   descent.
+                    // - BT and LR: the origo is the bottom left corner, offset is the ascent.
+                    if (GetInfo().GetTextFrame()->IsVertLR() && !GetInfo().GetTextFrame()->IsVertLRBT())
                             nOfst += rLine.Height() - ( rLine.Height() - nPorHeight ) / 2 - nPorAscent;
                     else
                             nOfst += ( rLine.Height() - nPorHeight ) / 2 + nPorAscent;
commit 976c14ec7d2f2f0629419c16331b908e8d2888c1
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Feb 14 11:49:47 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Jul 2 11:00:48 2019 +0200

    sw btlr writing mode: add odf spec proposal URL
    
    Change-Id: I7848677cf4c8246fc7a1833bec809945fb541b29
    Reviewed-on: https://gerrit.libreoffice.org/67814
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit 3157a3a8332ad342fb2b44659123217fa3450168)

diff --git a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
index 956ccc2f02e4..19786f82a7e1 100644
--- a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
+++ b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
@@ -2323,7 +2323,7 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
     </rng:optional>
   </rng:define>
 
-  <!-- TODO no proposal -->
+  <!-- https://issues.oasis-open.org/browse/OFFICE-4030 -->
   <rng:define name="common-writing-mode-attlist" combine="interleave">
     <rng:optional>
       <rng:attribute name="loext:writing-mode">
commit 494acf1c10678d619f7e494349698ae2d229d720
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Feb 13 18:32:31 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Jul 2 11:00:21 2019 +0200

    sw btlr writing mode: add UI for this
    
    There was only horizontal and vertical previously, so keep things simple
    and talk about the BT and TB version of vertical, not mentioning the
    LR/RL aspect.
    
    Also rename the textdirection widget, so it's unique not only within the
    tab page, but inside the dialog, so we can have uitest coverage for
    this.
    
    Change-Id: Ie396898fde03aca6cd37a29f049099fa4b2c5fc0
    Reviewed-on: https://gerrit.libreoffice.org/67789
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit 081b753d4cb4f4a25073ca7de12a7bdaa9fc2be4)

diff --git a/sw/qa/uitest/table/tableProperties.py b/sw/qa/uitest/table/tableProperties.py
index 009a807aa4b0..882ae0976ab2 100644
--- a/sw/qa/uitest/table/tableProperties.py
+++ b/sw/qa/uitest/table/tableProperties.py
@@ -121,10 +121,10 @@ class tableProperties(UITestCase):
         keep.executeAction("CLICK", tuple())
         headline = xDialog.getChild("headline")
         headline.executeAction("CLICK", tuple())
-#        textdirection = xDialog.getChild("textdirection")  #the name of the ui item is not unique
-#        props = {"TEXT": "Vertical"}
-#        actionProps = mkPropertyValues(props)
-#        textdirection.executeAction("SELECT", actionProps)
+        textdirection = xDialog.getChild("textorientation")
+        props = {"TEXT": "Vertical (bottom to top)"}
+        actionProps = mkPropertyValues(props)
+        textdirection.executeAction("SELECT", actionProps)
         vertorient = xDialog.getChild("vertorient")
         props2 = {"TEXT": "Bottom"}
         actionProps2 = mkPropertyValues(props2)
@@ -147,8 +147,8 @@ class tableProperties(UITestCase):
         self.assertEqual(get_state_as_dict(keep)["Selected"], "true")
         headline = xDialog.getChild("headline")
         self.assertEqual(get_state_as_dict(headline)["Selected"], "true")
-#        textdirection = xDialog.getChild("textdirection")
-#        self.assertEqual(get_state_as_dict(textdirection)["SelectEntryText"], "Vertical")
+        textdirection = xDialog.getChild("textorientation")
+        self.assertEqual(get_state_as_dict(textdirection)["SelectEntryText"], "Vertical (bottom to top)")
         vertorient = xDialog.getChild("vertorient")
         self.assertEqual(get_state_as_dict(vertorient)["SelectEntryText"], "Bottom")
         xOKBtn = xDialog.getChild("ok")
diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index b19711eb2502..c38a2f62d4ad 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -1226,7 +1226,7 @@ SwTextFlowPage::SwTextFlowPage(TabPageParent pParent, const SfxItemSet& rSet)
     , m_xHeadLineCB(m_xBuilder->weld_check_button("headline"))
     , m_xRepeatHeaderCombo(m_xBuilder->weld_widget("repeatheader"))
     , m_xRepeatHeaderNF(m_xBuilder->weld_spin_button("repeatheadernf"))
-    , m_xTextDirectionLB(m_xBuilder->weld_combo_box("textdirection"))
+    , m_xTextDirectionLB(m_xBuilder->weld_combo_box("textorientation"))
     , m_xVertOrientLB(m_xBuilder->weld_combo_box("vertorient"))
 {
     m_xPgBrkCB->connect_toggled(LINK(this, SwTextFlowPage, PageBreakHdl_Impl));
diff --git a/sw/uiconfig/swriter/ui/tabletextflowpage.ui b/sw/uiconfig/swriter/ui/tabletextflowpage.ui
index 6ac2c41ab08e..ef46e8eafc96 100644
--- a/sw/uiconfig/swriter/ui/tabletextflowpage.ui
+++ b/sw/uiconfig/swriter/ui/tabletextflowpage.ui
@@ -283,7 +283,7 @@
                         <property name="can_focus">False</property>
                         <property name="label" translatable="yes" context="tabletextflowpage|label40">Text _orientation</property>
                         <property name="use_underline">True</property>
-                        <property name="mnemonic_widget">textdirection</property>
+                        <property name="mnemonic_widget">textorientation</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
@@ -291,13 +291,14 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkComboBoxText" id="textdirection">
+                      <object class="GtkComboBoxText" id="textorientation">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <items>
                           <item id="0" translatable="yes" context="tabletextflowpage|liststore1">Horizontal</item>
-                          <item id="2" translatable="yes" context="tabletextflowpage|liststore1">Vertical</item>
+                          <item id="2" translatable="yes" context="tabletextflowpage|liststore1">Vertical (top to bottom)</item>
                           <item id="4" translatable="yes" context="tabletextflowpage|liststore1">Use superordinate object settings</item>
+                          <item id="5" translatable="yes" context="tabletextflowpage|liststore1">Vertical (bottom to top)</item>
                         </items>
                       </object>
                       <packing>
commit ac1ca418d1f3a803102d2508f6e0029ad65c4af7
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Feb 13 15:19:56 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Jul 2 10:59:30 2019 +0200

    sw btlr writing mode: add a layout-level test
    
    Fails with commit e8b9572bf89f55463f2c879a401ed62efc165d95 (sw btlr
    writing mode: implement initial layout, 2019-02-12) reverted.
    
    (cherry picked from commit bef3818dbedba467a257e2573e298d98062be37b)
    
    Conflicts:
            sw/qa/extras/layout/layout.cxx
    
    Change-Id: Ic68ef53a8b5bf86678d7e67c9960501f23341268

diff --git a/sw/qa/extras/layout/data/btlr-cell.odt b/sw/qa/extras/layout/data/btlr-cell.odt
new file mode 100644
index 000000000000..c010fa9f51b6
Binary files /dev/null and b/sw/qa/extras/layout/data/btlr-cell.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 3239b1cac3aa..153f8926b4a6 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -68,6 +68,7 @@ public:
     void testTdf115094();
     void testTdf118719();
     void testTdf123651();
+    void testBtlrCell();
 
     CPPUNIT_TEST_SUITE(SwLayoutWriter);
     CPPUNIT_TEST(testRedlineFootnotes);
@@ -108,6 +109,7 @@ public:
     CPPUNIT_TEST(testTdf115094);
     CPPUNIT_TEST(testTdf118719);
     CPPUNIT_TEST(testTdf123651);
+    CPPUNIT_TEST(testBtlrCell);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2739,6 +2741,23 @@ void SwLayoutWriter::testTdf123651()
     assertXPath(pXmlDoc, "//SwAnchoredDrawObject/bounds", "top", "7639");
 }
 
+void SwLayoutWriter::testBtlrCell()
+{
+    SwDoc* pDoc = createDoc("btlr-cell.odt");
+    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 = dumper.dumpAndParse(*xMetaFile);
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    // Without the accompanying fix in place, this test would have failed, as
+    // the orientation was 0 (layout did not take btlr direction request from
+    // doc model).
+    assertXPath(pXmlDoc, "//font[1]", "orientation", "900");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwLayoutWriter);
 CPPUNIT_PLUGIN_IMPLEMENT();
 


More information about the Libreoffice-commits mailing list