include/xmloff/xmltoken.hxx                           |    2 +
 include/xmloff/xmltypes.hxx                           |    1 
 sd/qa/unit/data/odp/style-overflow-behavior-clip.fodp |   18 ++++++++++++
 sd/qa/unit/import-tests2.cxx                          |   25 +++++++++++++++++-
 xmloff/source/core/xmltoken.cxx                       |    2 +
 xmloff/source/draw/sdpropls.cxx                       |    1 
 xmloff/source/style/prhdlfac.cxx                      |    5 +++
 xmloff/source/token/tokens.txt                        |    2 +
 8 files changed, 55 insertions(+), 1 deletion(-)

New commits:
commit d15784adcb96f1d03c20885042d93f5a1a4495f4
Author:     Sarper Akdemir <sarper.akde...@collabora.com>
AuthorDate: Fri Apr 7 13:32:49 2023 +0300
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Wed Apr 12 23:29:04 2023 +0200

    xmloff: ODF import/export for style:overflow-behavior "clip"
    
    Adds initial support for style:overflow-behavior
    
    According to OpenDocument-v1.3-part3 style:overflow-behavior can take
    values of:
    - "clip"
    - "auto-create-new-frame"
    
    This patch doesn't properly implement support "auto-create-new-frame",
    only "clip".
    
    If "clip" is set, TextClipVerticalOverflow is set to true, causing the
    vertical overflowing text to be clipped.
    
    "auto-create-new-frame" is treated the same as omitting the
    style:overflow-behavior attribute, setting TextClipVerticalOverflow to
    false.
    
    Change-Id: Iea298f41fbf0cf18dc07f41788ba0b665515db8b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150122
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150305
    Tested-by: Andras Timar <andras.ti...@collabora.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 4eb363dc0ee3..888f57053dc8 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -287,6 +287,7 @@ namespace xmloff::token {
         XML_AUTHOR_NAME,
         XML_AUTO,
         XML_AUTO_COMPLETE,
+        XML_AUTO_CREATE_NEW_FRAME,
         XML_AUTO_GROW_HEIGHT,
         XML_AUTO_GROW_WIDTH,
         XML_AUTO_RELOAD,
@@ -1452,6 +1453,7 @@ namespace xmloff::token {
         XML_OUTLINE_STYLE,
         XML_OUTSET,
         XML_OUTSIDE,
+        XML_OVERFLOW_BEHAVIOR,
         XML_OVERLAP,
         XML_OVERLAY,
         XML_P,
diff --git a/include/xmloff/xmltypes.hxx b/include/xmloff/xmltypes.hxx
index 13e7c3fcc6c0..4dbf2081db1b 100644
--- a/include/xmloff/xmltypes.hxx
+++ b/include/xmloff/xmltypes.hxx
@@ -277,6 +277,7 @@
 #define XML_TYPE_TEXT_OVERLINE_COLOR    (XML_TEXT_TYPES_START + 112)
 #define XML_TYPE_TEXT_OVERLINE_HASCOLOR (XML_TEXT_TYPES_START + 113)
 #define XML_TYPE_BOOL_FALSE             (XML_TEXT_TYPES_START + 114)
+#define XML_TYPE_TEXT_OVERFLOW_BEHAVIOR (XML_TEXT_TYPES_START + 115)
 
 #define XML_TYPE_CHAR_SCRIPT            (XML_TEXT_TYPES_START + 116)
 #define XML_TYPE_CHAR_RFC_LANGUAGE_TAG  (XML_TEXT_TYPES_START + 117)
diff --git a/sd/qa/unit/data/odp/style-overflow-behavior-clip.fodp 
b/sd/qa/unit/data/odp/style-overflow-behavior-clip.fodp
new file mode 100644
index 000000000000..29baf838f724
--- /dev/null
+++ b/sd/qa/unit/data/odp/style-overflow-behavior-clip.fodp
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.presentation">
+ <office:automatic-styles>
+  <style:style style:name="gr1" style:family="graphic">
+   <style:graphic-properties style:overflow-behavior="clip"/>
+  </style:style>
+ </office:automatic-styles>
+ <office:body>
+  <office:presentation>
+   <draw:page>
+    <draw:rect draw:style-name="gr1" svg:width="25cm" svg:height="1cm" 
svg:x="1cm" svg:y="1cm">
+      <text:p>First line that is not clipped.</text:p>
+      <text:p>Second line that is clipped - but still shows up when 
editing</text:p>
+    </draw:rect>
+   </draw:page>
+  </office:presentation>
+ </office:body>
+</office:document>
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 803408adc3f4..570e9078e914 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -178,6 +178,7 @@ public:
     void testTdf144092TableHeight();
     void testTdf151547TransparentWhiteText();
     void testTdf149588TransparentSolidFill();
+    void testOverflowBehaviorClip();
 
     CPPUNIT_TEST_SUITE(SdImportTest2);
 
@@ -248,6 +249,7 @@ public:
     CPPUNIT_TEST(testTdf144092TableHeight);
     CPPUNIT_TEST(testTdf151547TransparentWhiteText);
     CPPUNIT_TEST(testTdf149588TransparentSolidFill);
+    CPPUNIT_TEST(testOverflowBehaviorClip);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -2064,8 +2066,29 @@ void SdImportTest2::testTdf149588TransparentSolidFill()
     xDocShRef->DoClose();
 }
 
-CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest2);
+void SdImportTest2::testOverflowBehaviorClip()
+{
+    sd::DrawDocShellRef xDocShRef = loadURL(
+        
m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/style-overflow-behavior-clip.fodp"),
+        FODP);
+    {
+        uno::Reference<beans::XPropertySet> xPropSet(getShapeFromPage(0, 0, 
xDocShRef));
+        // Without the accompanying fix in place, this test would have failed 
with:
+        // - Expected: 1
+        // - Actual  : 0
+        CPPUNIT_ASSERT_EQUAL(true,
+                             
xPropSet->getPropertyValue("TextClipVerticalOverflow").get<bool>());
+    }
 
+    xDocShRef = saveAndReload(xDocShRef.get(), ODP);
+    {
+        uno::Reference<beans::XPropertySet> xPropSet(getShapeFromPage(0, 0, 
xDocShRef));
+        CPPUNIT_ASSERT_EQUAL(true,
+                             
xPropSet->getPropertyValue("TextClipVerticalOverflow").get<bool>());
+    }
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest2);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 794e31abe7b2..ad672bde8fb1 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -299,6 +299,7 @@ namespace xmloff::token {
         TOKEN( "author-name",                     XML_AUTHOR_NAME ),
         TOKEN( "auto",                            XML_AUTO ),
         TOKEN( "auto-complete",                   XML_AUTO_COMPLETE ),
+        TOKEN( "auto-create-new-frame",           XML_AUTO_CREATE_NEW_FRAME ),
         TOKEN( "auto-grow-height",                XML_AUTO_GROW_HEIGHT ),
         TOKEN( "auto-grow-width",                 XML_AUTO_GROW_WIDTH ),
         TOKEN( "auto-reload",                     XML_AUTO_RELOAD ),
@@ -1465,6 +1466,7 @@ namespace xmloff::token {
         TOKEN( "outline-style",                   XML_OUTLINE_STYLE ),
         TOKEN( "outset",                          XML_OUTSET ),
         TOKEN( "outside",                         XML_OUTSIDE ),
+        TOKEN( "overflow-behavior",               XML_OVERFLOW_BEHAVIOR ),
         TOKEN( "overlap",                         XML_OVERLAP ),
         TOKEN( "overlay",                         XML_OVERLAY ),
         TOKEN( "p",                               XML_P ),
diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx
index ead2c9c729d2..11cef753996f 100644
--- a/xmloff/source/draw/sdpropls.cxx
+++ b/xmloff/source/draw/sdpropls.cxx
@@ -146,6 +146,7 @@ const XMLPropertyMapEntry aXMLSDProperties[] =
     GMAP( "NumberingRules",                 XML_NAMESPACE_TEXT, 
XML_LIST_STYLE_NAME,        XML_TYPE_STRING, CTF_SD_NUMBERINGRULES_NAME ),
     GMAP( "TextWordWrap",                   XML_NAMESPACE_FO,   
XML_WRAP_OPTION,            XML_TYPE_WRAP_OPTION, 0 ),
     GMAP( "TextChainNextName",              XML_NAMESPACE_DRAW,   
XML_CHAIN_NEXT_NAME,      XML_TYPE_STRING, 0 ),
+    GMAP( "TextClipVerticalOverflow",       XML_NAMESPACE_STYLE, 
XML_OVERFLOW_BEHAVIOR,     XML_TYPE_TEXT_OVERFLOW_BEHAVIOR, 0 ),
 
     GMAP( "TextColumns",                    XML_NAMESPACE_STYLE, XML_COLUMNS, 
XML_TYPE_TEXT_COLUMNS|MID_FLAG_ELEMENT_ITEM, CTF_TEXTCOLUMNS ),
 
diff --git a/xmloff/source/style/prhdlfac.cxx b/xmloff/source/style/prhdlfac.cxx
index ca96e0421552..e5236078f842 100644
--- a/xmloff/source/style/prhdlfac.cxx
+++ b/xmloff/source/style/prhdlfac.cxx
@@ -466,6 +466,11 @@ std::unique_ptr<XMLPropertyHandler> 
XMLPropertyHandlerFactory::CreatePropertyHan
         case XML_TYPE_TEXT_VERTICAL_POS:
             pPropHdl.reset(new XMLConstantsPropertyHandler( pXML_VertPos_Enum, 
XML_TOKEN_INVALID ));
         break;
+        case XML_TYPE_TEXT_OVERFLOW_BEHAVIOR:
+            // auto-create-new-frame isn't properly implemented yet. It just 
means don't clip.
+            pPropHdl.reset(new XMLNamedBoolPropertyHdl(GetXMLToken(XML_CLIP),
+                                                       
GetXMLToken(XML_AUTO_CREATE_NEW_FRAME)));
+            break;
 
     }
 
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index 99191ad0e097..93bb1bdbccff 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -204,6 +204,7 @@ author-initials
 author-name
 auto
 auto-complete
+auto-create-new-frame
 auto-grow-height
 auto-grow-width
 auto-reload
@@ -1365,6 +1366,7 @@ outline-level-style
 outline-style
 outset
 outside
+overflow-behavior
 overlap
 overlay
 p

Reply via email to