sd/source/core/stlsheet.cxx |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

New commits:
commit 4e20f95cf6744ca85bc8c090b926031729addc89
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Jun 29 23:58:32 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Jun 30 01:03:29 2023 +0200

    tdf#156091: handle OWN_ATTR_TEXTCOLUMNS in 
SdStyleSheet::getPropertyValue_Impl
    
    Somehow I failed to implement this from start. In commit
    95ebd24a629b4c8cd62cc20c0701683512cc8fa0 (editengine-columns:
    ODF support [API CHANGE], 2021-06-08), I implemented its
    support in SdStyleSheet::getPropertyState; then, in commit
    f2ea39c70da3f82bb39f8b51b5484172360b1fc2 (Avoid crash getting
    default item for OWN_ATTR_TEXTCOLUMNS, 2021-06-22), I added
    its support in SdStyleSheet::setPropertyValue; and finally,
    the time has come to support getting its value. Better late
    than never.
    
    Change-Id: Ifa1f933f00336bf6d01a5c71d0c92baf846ccabb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153777
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index fe981d8bca45..4ea270b4f38e 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -51,6 +51,7 @@
 #include <svx/sdtacitm.hxx>
 #include <svx/sdtayitm.hxx>
 #include <svx/sdtaiitm.hxx>
+#include <svx/SvxXTextColumns.hxx>
 #include <svx/xit.hxx>
 #include <svx/xflclit.hxx>
 #include <comphelper/diagnose_ex.hxx>
@@ -1146,6 +1147,19 @@ css::uno::Any SdStyleSheet::getPropertyValue_Impl(const 
OUString& PropertyName)
     {
         aAny <<= IsHidden( );
     }
+    else if (pEntry->nWID == OWN_ATTR_TEXTCOLUMNS)
+    {
+        const SfxItemSet& rStyleSet = GetItemSet();
+
+        auto xIf = SvxXTextColumns_createInstance();
+        css::uno::Reference<css::text::XTextColumns> xCols(xIf, 
css::uno::UNO_QUERY_THROW);
+        
xCols->setColumnCount(rStyleSet.Get(SDRATTR_TEXTCOLUMNS_NUMBER).GetValue());
+        css::uno::Reference<css::beans::XPropertySet> xProp(xIf, 
css::uno::UNO_QUERY_THROW);
+        xProp->setPropertyValue(
+            "AutomaticDistance",
+            
css::uno::Any(rStyleSet.Get(SDRATTR_TEXTCOLUMNS_SPACING).GetValue()));
+        aAny <<= xIf;
+    }
     else
     {
         SfxItemSet aSet( GetPool()->GetPool(), pEntry->nWID, pEntry->nWID);

Reply via email to