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                          |   20 ++++++++++++++++++
 xmloff/inc/xmlprop.hxx                                |    1 
 xmloff/source/core/xmltoken.cxx                       |    2 +
 xmloff/source/draw/sdpropls.cxx                       |    1 
 xmloff/source/style/prhdlfac.cxx                      |    5 ++++
 xmloff/source/token/tokens.txt                        |    2 +
 9 files changed, 52 insertions(+)

New commits:
commit a925476352b3cb32f6384e7b0fb07e323bb6e64f
Author:     Sarper Akdemir <sarper.akde...@collabora.com>
AuthorDate: Fri Apr 7 13:32:49 2023 +0300
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Wed Apr 12 14:47:18 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>

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 5262f3b3ab5e..0fc0127813e7 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,
@@ -1455,6 +1456,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 e585673e3ad8..dd290907ee79 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -1872,6 +1872,26 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, 
testTdf149588TransparentSolidFill)
     CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xCC636363), nCharColor);
 }
 
+CPPUNIT_TEST_FIXTURE(SdImportTest2, testOverflowBehaviorClip)
+{
+    createSdImpressDoc("odp/style-overflow-behavior-clip.fodp");
+    {
+        uno::Reference<beans::XPropertySet> xPropSet(getShapeFromPage(0, 0));
+        // 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>());
+    }
+
+    saveAndReload("impress8");
+    {
+        uno::Reference<beans::XPropertySet> xPropSet(getShapeFromPage(0, 0));
+        CPPUNIT_ASSERT_EQUAL(true,
+                             
xPropSet->getPropertyValue("TextClipVerticalOverflow").get<bool>());
+    }
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/inc/xmlprop.hxx b/xmloff/inc/xmlprop.hxx
index 3b2cd86816bc..b93bf926e569 100644
--- a/xmloff/inc/xmlprop.hxx
+++ b/xmloff/inc/xmlprop.hxx
@@ -611,6 +611,7 @@ inline constexpr OUStringLiteral PROP_TextAutoGrowWidth = 
u"TextAutoGrowWidth";
 inline constexpr OUStringLiteral PROP_TextBreak = u"TextBreak";
 inline constexpr OUStringLiteral PROP_TextCanOverlap = u"TextCanOverlap";
 inline constexpr OUStringLiteral PROP_TextChainNextName = u"TextChainNextName";
+inline constexpr OUStringLiteral PROP_TextClipVerticalOverflow = 
u"TextClipVerticalOverflow";
 inline constexpr OUStringLiteral PROP_TextColor = u"TextColor";
 inline constexpr OUStringLiteral PROP_TextColumns = u"TextColumns";
 inline constexpr OUStringLiteral PROP_TextContourFrame = u"TextContourFrame";
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index daa658011ae3..43d47aec8cae 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 ),
@@ -1468,6 +1469,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 de7030f8efff..03e37c97bc2e 100644
--- a/xmloff/source/draw/sdpropls.cxx
+++ b/xmloff/source/draw/sdpropls.cxx
@@ -150,6 +150,7 @@ const XMLPropertyMapEntry aXMLSDProperties[] =
     GMAP( PROP_NumberingRules,                 XML_NAMESPACE_TEXT, 
XML_LIST_STYLE_NAME,        XML_TYPE_STRING, CTF_SD_NUMBERINGRULES_NAME ),
     GMAP( PROP_TextWordWrap,                   XML_NAMESPACE_FO,   
XML_WRAP_OPTION,            XML_TYPE_WRAP_OPTION, 0 ),
     GMAP( PROP_TextChainNextName,              XML_NAMESPACE_DRAW,   
XML_CHAIN_NEXT_NAME,      XML_TYPE_STRING, 0 ),
+    GMAP( PROP_TextClipVerticalOverflow,       XML_NAMESPACE_STYLE, 
XML_OVERFLOW_BEHAVIOR,     XML_TYPE_TEXT_OVERFLOW_BEHAVIOR, 0 ),
 
     GMAP( PROP_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 3b8cbe371000..5ff7172834e4 100644
--- a/xmloff/source/style/prhdlfac.cxx
+++ b/xmloff/source/style/prhdlfac.cxx
@@ -469,6 +469,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 098d8dd4c501..5e60e58b2b73 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
@@ -1368,6 +1369,7 @@ outline-level-style
 outline-style
 outset
 outside
+overflow-behavior
 overlap
 overlay
 p

Reply via email to