[Libreoffice-commits] core.git: include/rsc svl/source sw/inc sw/qa sw/source

Jakub Trzebiatowski ubap.dev at gmail.com
Tue May 24 09:47:10 UTC 2016


 include/rsc/rscsfx.hxx                   |    1 
 svl/source/items/IndexedStyleSheets.cxx  |    6 ++--
 sw/inc/SwGetPoolIdFromName.hxx           |    1 
 sw/inc/SwStyleNameMapper.hxx             |   10 +++++--
 sw/inc/doc.hxx                           |    1 
 sw/inc/poolfmt.hrc                       |    4 ++
 sw/inc/poolfmt.hxx                       |    9 ++++++
 sw/inc/rcid.hrc                          |    5 +++
 sw/inc/unocore.hrc                       |    3 +-
 sw/inc/unomap.hxx                        |    3 +-
 sw/qa/python/check_styles.py             |    4 +-
 sw/source/core/doc/SwStyleNameMapper.cxx |   43 +++++++++++++++++++++++++++++--
 sw/source/core/unocore/unocore.src       |    5 +++
 sw/source/core/unocore/unomap.cxx        |    9 ++++++
 sw/source/core/unocore/unomap1.cxx       |    6 ++++
 sw/source/core/unocore/unostyle.cxx      |   16 ++++++++++-
 sw/source/ui/utlui/poolfmt.src           |    7 +++++
 sw/source/uibase/app/docstyle.cxx        |   12 ++++++++
 18 files changed, 134 insertions(+), 11 deletions(-)

New commits:
commit 8b8159784821b7ddf031aec925353c274a10875e
Author: Jakub Trzebiatowski <ubap.dev at gmail.com>
Date:   Mon May 23 09:18:52 2016 +0200

    Implement basic TableStyle Family
    
    Change-Id: I3da13d26ced05e1948d483d432d6268b10c208b5
    Implementing: getCount, getElementNames
    Reviewed-on: https://gerrit.libreoffice.org/25351
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/include/rsc/rscsfx.hxx b/include/rsc/rscsfx.hxx
index b4dd3c7..cc3ab9c 100644
--- a/include/rsc/rscsfx.hxx
+++ b/include/rsc/rscsfx.hxx
@@ -37,6 +37,7 @@ enum class SfxStyleFamily {
     Frame   = 0x04,
     Page    = 0x08,
     Pseudo  = 0x10,
+    Table   = 0x20,
     All     = 0x7fff
 };
 
diff --git a/svl/source/items/IndexedStyleSheets.cxx b/svl/source/items/IndexedStyleSheets.cxx
index 1b1b54e..260ae10 100644
--- a/svl/source/items/IndexedStyleSheets.cxx
+++ b/svl/source/items/IndexedStyleSheets.cxx
@@ -19,7 +19,7 @@ using rtl::OUString;
 
 
 namespace {
-const size_t NUMBER_OF_FAMILIES = 6;
+const size_t NUMBER_OF_FAMILIES = 7;
 size_t family_to_index(SfxStyleFamily family)
 {
     switch (family) {
@@ -33,8 +33,10 @@ size_t family_to_index(SfxStyleFamily family)
         return 3;
     case SfxStyleFamily::Pseudo:
         return 4;
-    case SfxStyleFamily::All:
+    case SfxStyleFamily::Table:
         return 5;
+    case SfxStyleFamily::All:
+        return 6;
     default: break;
     }
     assert(false); // only for compiler warning. all cases are handled in the switch
diff --git a/sw/inc/SwGetPoolIdFromName.hxx b/sw/inc/SwGetPoolIdFromName.hxx
index 9d93e26..55f3ca6 100644
--- a/sw/inc/SwGetPoolIdFromName.hxx
+++ b/sw/inc/SwGetPoolIdFromName.hxx
@@ -31,6 +31,7 @@ namespace nsSwGetPoolIdFromName
     const SwGetPoolIdFromName GET_POOLID_FRMFMT   = 0x04;
     const SwGetPoolIdFromName GET_POOLID_PAGEDESC = 0x08;
     const SwGetPoolIdFromName GET_POOLID_NUMRULE  = 0x10;
+    const SwGetPoolIdFromName GET_POOLID_TABSTYLE = 0x20;
 }
 
 #endif
diff --git a/sw/inc/SwStyleNameMapper.hxx b/sw/inc/SwStyleNameMapper.hxx
index 89011ca..035e0c6 100644
--- a/sw/inc/SwStyleNameMapper.hxx
+++ b/sw/inc/SwStyleNameMapper.hxx
@@ -93,6 +93,7 @@ protected:
                             *m_pHTMLChrFormatUINameArray,
                             *m_pPageDescUINameArray,
                             *m_pNumRuleUINameArray,
+                            *m_pTableStyleUINameArray,
     // Programmatic Name tables
                             *m_pTextProgNameArray,
                             *m_pListsProgNameArray,
@@ -104,19 +105,22 @@ protected:
                             *m_pChrFormatProgNameArray,
                             *m_pHTMLChrFormatProgNameArray,
                             *m_pPageDescProgNameArray,
-                            *m_pNumRuleProgNameArray;
+                            *m_pNumRuleProgNameArray,
+                            *m_pTableStyleProgNameArray;
 
     static NameToIdHash     *m_pParaUIMap,
                             *m_pCharUIMap,
                             *m_pPageUIMap,
                             *m_pFrameUIMap,
                             *m_pNumRuleUIMap,
+                            *m_pTableStyleUIMap,
 
                             *m_pParaProgMap,
                             *m_pCharProgMap,
                             *m_pPageProgMap,
                             *m_pFrameProgMap,
-                            *m_pNumRuleProgMap;
+                            *m_pNumRuleProgMap,
+                            *m_pTableStyleProgMap;
 
     static void fillNameFromId(sal_uInt16 nId, OUString &rName, bool bProgName);
     static const OUString& getNameFromId(sal_uInt16 nId, const OUString &rName,
@@ -176,6 +180,7 @@ public:
     static const ::std::vector<OUString>& GetHTMLChrFormatUINameArray();
     static const ::std::vector<OUString>& GetPageDescUINameArray();
     static const ::std::vector<OUString>& GetNumRuleUINameArray();
+    static const ::std::vector<OUString>& GetTableStyleUINameArray();
 
     static const ::std::vector<OUString>& GetTextProgNameArray();
     static const ::std::vector<OUString>& GetListsProgNameArray();
@@ -188,6 +193,7 @@ public:
     static const ::std::vector<OUString>& GetHTMLChrFormatProgNameArray();
     static const ::std::vector<OUString>& GetPageDescProgNameArray();
     static const ::std::vector<OUString>& GetNumRuleProgNameArray();
+    static const ::std::vector<OUString>& GetTableStyleProgNameArray();
 };
 #endif // _NAME_MAPPER_HXX
 
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 4d84134..afed50a 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1253,6 +1253,7 @@ public:
 
     /// Return the available table styles.
     SwTableAutoFormatTable& GetTableStyles() { return *mpTableStyles.get(); }
+    const SwTableAutoFormatTable& GetTableStyles() const { return *mpTableStyles.get(); }
 
     void AppendUndoForInsertFromDB( const SwPaM& rPam, bool bIsTable );
 
diff --git a/sw/inc/poolfmt.hrc b/sw/inc/poolfmt.hrc
index a6b472b..c1140fb 100644
--- a/sw/inc/poolfmt.hrc
+++ b/sw/inc/poolfmt.hrc
@@ -263,6 +263,10 @@
 #define STR_COLUMN_VALUESET_ITEM3       (RC_POOLNUMRULE_BEGIN + 13 )
 #define STR_COLUMN_VALUESET_ITEM4       (RC_POOLNUMRULE_BEGIN + 14 )
 
+// Table styles
+
+#define STR_TABSTYLE_DEFAULT            (RC_POOLTABSTYLE_BEGIN+  0)
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/poolfmt.hxx b/sw/inc/poolfmt.hxx
index 2bc91f4..65a6d07 100644
--- a/sw/inc/poolfmt.hxx
+++ b/sw/inc/poolfmt.hxx
@@ -77,6 +77,7 @@ const sal_uInt16 POOLGRP_CHARFMT        = (0 << 11) + POOLGRP_NOCOLLID;
 const sal_uInt16 POOLGRP_FRAMEFMT       = (1 << 11) + POOLGRP_NOCOLLID;
 const sal_uInt16 POOLGRP_PAGEDESC       = (2 << 11) + POOLGRP_NOCOLLID;
 const sal_uInt16 POOLGRP_NUMRULE        = (3 << 11) + POOLGRP_NOCOLLID;
+const sal_uInt16 POOLGRP_TABSTYLE       = (4 << 11) + POOLGRP_NOCOLLID;
 
 /// Recognize whether it's a user defined style or not:
 const sal_uInt16 POOL_IDUSER_FMT =
@@ -197,6 +198,14 @@ RES_POOLNUMRULE_BUL5,                               ///< NumRule Bullets 5.
 RES_POOLNUMRULE_END
 };
 
+// IDs for table styles.
+enum RES_POOL_TABSTYLE_TYPE
+{
+RES_POOLTABSTYLE_BEGIN = POOLGRP_TABSTYLE,
+RES_POOLTABSTYLE_DEFAULT = RES_POOLTABSTYLE_BEGIN,
+RES_POOLTABSTYLE_END
+};
+
 // IDs for paragraph styles.
 enum RES_POOL_COLLFMT_TYPE
 {
diff --git a/sw/inc/rcid.hrc b/sw/inc/rcid.hrc
index 528c5bb..f565097 100644
--- a/sw/inc/rcid.hrc
+++ b/sw/inc/rcid.hrc
@@ -71,6 +71,7 @@
 #define RC_IDXTXT                   (RC_BASE + 4350)
 #define RC_SIDEBAR                  (RC_BASE + 4450)
 #define RC_ATTR                     (RC_BASE + 4550)
+#define RC_POOLTABSTYLE             (RC_BASE + 4650)
 
 /*--------------------------------------------------------------------
     Description: areas unharness
@@ -257,6 +258,10 @@
 #define RC_ATTR_BEGIN               RC_ATTR
 #define RC_ATTR_END                 (RC_ATTR + 99)
 
+// Table styles
+#define RC_POOLTABSTYLE_BEGIN       RC_POOLTABSTYLE
+#define RC_POOLTABSTYLE_END         (RC_POOLTABSTYLE + 99)
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/unocore.hrc b/sw/inc/unocore.hrc
index 7f8dbde..9f8e8c6 100644
--- a/sw/inc/unocore.hrc
+++ b/sw/inc/unocore.hrc
@@ -29,8 +29,9 @@
 #define STR_STYLE_FAMILY_FRAME              (RC_UNOCORE_BEGIN + 5)
 #define STR_STYLE_FAMILY_PAGE               (RC_UNOCORE_BEGIN + 6)
 #define STR_STYLE_FAMILY_NUMBERING          (RC_UNOCORE_BEGIN + 7)
+#define STR_STYLE_FAMILY_TABLE              (RC_UNOCORE_BEGIN + 8)
 
-#define UNOCORE_ACT_END                     STR_STYLE_FAMILY_NUMBERING
+#define UNOCORE_ACT_END                     STR_STYLE_FAMILY_TABLE
 
 #if UNOCORE_ACT_END > RC_UNOCORE_END
 #error Resource-Id Ueberlauf in #file, #line
diff --git a/sw/inc/unomap.hxx b/sw/inc/unomap.hxx
index 0baa5c7..80439cb 100644
--- a/sw/inc/unomap.hxx
+++ b/sw/inc/unomap.hxx
@@ -122,7 +122,8 @@
 #define PROPERTY_MAP_FLDTYP_DOCINFO_CUSTOM              97
 #define PROPERTY_MAP_METAFIELD                          98
 #define PROPERTY_MAP_ACCESSIBILITY_TEXT_ATTRIBUTE       99
-#define PROPERTY_MAP_END                                100
+#define PROPERTY_MAP_TABLE_STYLE                        100
+#define PROPERTY_MAP_END                                101
 
 //S&E
 #define WID_WORDS                0
diff --git a/sw/qa/python/check_styles.py b/sw/qa/python/check_styles.py
index 2e34f32..4f9cefb 100644
--- a/sw/qa/python/check_styles.py
+++ b/sw/qa/python/check_styles.py
@@ -38,11 +38,11 @@ class CheckStyle(unittest.TestCase):
         self.assertFalse(xStyleFamilies.supportsService("foobarbaz"))
         self.assertTrue(xStyleFamilies.hasElements())
         self.assertRegex(str(xStyleFamilies.ElementType), "com\.sun\.star\.container\.XNameContainer")
-        self.assertEqual(len(xStyleFamilies.ElementNames), 5)
+        self.assertEqual(len(xStyleFamilies.ElementNames), 6)
 
         for sFamilyname in xStyleFamilies.ElementNames:
             self.assertIn(sFamilyname,
-                          ["CharacterStyles", "ParagraphStyles", "PageStyles", "FrameStyles", "NumberingStyles"])
+                          ["CharacterStyles", "ParagraphStyles", "PageStyles", "FrameStyles", "NumberingStyles", "TableStyles"])
 
         with self.assertRaises(NoSuchElementException):
             xStyleFamilies.getByName("foobarbaz")
diff --git a/sw/source/core/doc/SwStyleNameMapper.cxx b/sw/source/core/doc/SwStyleNameMapper.cxx
index 10b00a4..4d23cca 100644
--- a/sw/source/core/doc/SwStyleNameMapper.cxx
+++ b/sw/source/core/doc/SwStyleNameMapper.cxx
@@ -42,6 +42,7 @@ extern ResMgr* pSwResMgr;
                 *SwStyleNameMapper::m_pHTMLChrFormatUINameArray = nullptr,
                 *SwStyleNameMapper::m_pPageDescUINameArray = nullptr,
                 *SwStyleNameMapper::m_pNumRuleUINameArray = nullptr,
+                *SwStyleNameMapper::m_pTableStyleUINameArray = nullptr,
 
 // Initialise programmatic names to 0
                 *SwStyleNameMapper::m_pTextProgNameArray = nullptr,
@@ -54,19 +55,22 @@ extern ResMgr* pSwResMgr;
                 *SwStyleNameMapper::m_pChrFormatProgNameArray = nullptr,
                 *SwStyleNameMapper::m_pHTMLChrFormatProgNameArray = nullptr,
                 *SwStyleNameMapper::m_pPageDescProgNameArray = nullptr,
-                *SwStyleNameMapper::m_pNumRuleProgNameArray = nullptr;
+                *SwStyleNameMapper::m_pNumRuleProgNameArray = nullptr,
+                *SwStyleNameMapper::m_pTableStyleProgNameArray = nullptr;
 
 NameToIdHash    *SwStyleNameMapper::m_pParaUIMap = nullptr,
                 *SwStyleNameMapper::m_pCharUIMap = nullptr,
                 *SwStyleNameMapper::m_pPageUIMap = nullptr,
                 *SwStyleNameMapper::m_pFrameUIMap = nullptr,
                 *SwStyleNameMapper::m_pNumRuleUIMap = nullptr,
+                *SwStyleNameMapper::m_pTableStyleUIMap = nullptr,
 
                 *SwStyleNameMapper::m_pParaProgMap = nullptr,
                 *SwStyleNameMapper::m_pCharProgMap = nullptr,
                 *SwStyleNameMapper::m_pPageProgMap = nullptr,
                 *SwStyleNameMapper::m_pFrameProgMap = nullptr,
-                *SwStyleNameMapper::m_pNumRuleProgMap = nullptr;
+                *SwStyleNameMapper::m_pNumRuleProgMap = nullptr,
+                *SwStyleNameMapper::m_pTableStyleProgMap = nullptr;
 
 // SwTableEntry so we can pass the length to the String CTOR
 struct SwTableEntry
@@ -310,6 +314,12 @@ const struct SwTableEntry NumRuleProgNameTable [] =
     ENTRY( "List 5" ), // STR_POOLNUMRULE_PRGM_BUL5
     { 0, nullptr }
 };
+
+const struct SwTableEntry TableStyleProgNameTable [] =
+{
+    ENTRY( "Default Style" ), // RES_POOLTABLESTYLE_DEFAULT
+    { 0, nullptr }
+};
 #undef ENTRY
 
 ::std::vector<OUString>*
@@ -466,6 +476,12 @@ const NameToIdHash & SwStyleNameMapper::getHashTable ( SwGetPoolIdFromName eFlag
             vIndexes.push_back( std::make_tuple(RES_POOLNUMRULE_BEGIN, RES_POOLNUMRULE_END, bProgName ? &GetNumRuleProgNameArray : &GetNumRuleUINameArray) );
         }
         break;
+        case nsSwGetPoolIdFromName::GET_POOLID_TABSTYLE:
+        {
+            pHashPointer = bProgName ? &m_pTableStyleProgMap : &m_pTableStyleUIMap;
+            vIndexes.push_back( std::make_tuple(RES_POOLTABSTYLE_BEGIN, RES_POOLTABSTYLE_END, bProgName ? &GetTableStyleProgNameArray : &GetTableStyleUINameArray) );
+        }
+        break;
         default:
             assert(false && "unknown pool family");
     }
@@ -666,6 +682,13 @@ const OUString& SwStyleNameMapper::getNameFromId(
             nStt = RES_POOLNUMRULE_BEGIN;
         }
         break;
+    case POOLGRP_TABSTYLE:
+        if( RES_POOLTABSTYLE_BEGIN <= nId && nId < RES_POOLTABSTYLE_END )
+        {
+            pStrArr = bProgName ? &GetTableStyleProgNameArray() : &GetTableStyleUINameArray();
+            nStt = RES_POOLTABSTYLE_BEGIN;
+        }
+        break;
     }
     return pStrArr ? pStrArr->operator[](nId - nStt) : rFillName;
 }
@@ -808,6 +831,14 @@ const ::std::vector<OUString>& SwStyleNameMapper::GetNumRuleUINameArray()
     return *m_pNumRuleUINameArray;
 }
 
+const ::std::vector<OUString>& SwStyleNameMapper::GetTableStyleUINameArray()
+{
+    if (!m_pTableStyleUINameArray)
+        m_pTableStyleUINameArray = lcl_NewUINameArray( RC_POOLTABSTYLE_BEGIN,
+            RC_POOLTABSTYLE_BEGIN + (RES_POOLTABSTYLE_END - RES_POOLTABSTYLE_BEGIN) );
+    return *m_pTableStyleUINameArray;
+}
+
 const ::std::vector<OUString>& SwStyleNameMapper::GetTextProgNameArray()
 {
     if (!m_pTextProgNameArray)
@@ -896,6 +927,14 @@ const ::std::vector<OUString>& SwStyleNameMapper::GetNumRuleProgNameArray()
     return *m_pNumRuleProgNameArray;
 }
 
+const ::std::vector<OUString>& SwStyleNameMapper::GetTableStyleProgNameArray()
+{
+    if (!m_pTableStyleProgNameArray)
+        m_pTableStyleProgNameArray = lcl_NewProgNameArray( TableStyleProgNameTable,
+            sizeof ( TableStyleProgNameTable ) / sizeof ( SwTableEntry ) );
+    return *m_pTableStyleProgNameArray;
+}
+
 const OUString
 SwStyleNameMapper::GetSpecialExtraProgName(const OUString& rExtraUIName)
 {
diff --git a/sw/source/core/unocore/unocore.src b/sw/source/core/unocore/unocore.src
index a195dba..e9f3d61 100644
--- a/sw/source/core/unocore/unocore.src
+++ b/sw/source/core/unocore/unocore.src
@@ -54,4 +54,9 @@ String STR_STYLE_FAMILY_NUMBERING
     Text [ en-US ] = "Numbering" ;
 };
 
+String STR_STYLE_FAMILY_TABLE
+{
+    Text [ en-US ] = "Table" ;
+};
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index 30409a0..669c535 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -1488,6 +1488,15 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
                 m_aMapEntriesArr[nPropertyId] = aMetaFieldMap;
             }
             break;
+            case PROPERTY_MAP_TABLE_STYLE:
+            {
+                static SfxItemPropertyMapEntry const aTableStyleMap[] =
+                {
+                    { OUString(), 0, css::uno::Type(), 0, 0 }
+                };
+                m_aMapEntriesArr[nPropertyId] = aTableStyleMap;
+            }
+            break;
 
             default:
                 OSL_FAIL( "unexpected property map ID" );
diff --git a/sw/source/core/unocore/unomap1.cxx b/sw/source/core/unocore/unomap1.cxx
index 5c81b29..bdf5820 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -1641,6 +1641,12 @@ const SfxItemPropertySet*  SwUnoPropertyMapProvider::GetPropertySet( sal_uInt16
                 m_aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_METAFIELD;
             }
             break;
+            case PROPERTY_MAP_TABLE_STYLE:
+            {
+                static SfxItemPropertySet aPROPERTY_MAP_TABLE_STYLE(pEntries);
+                m_aPropertySetArr[nPropertyId] = &aPROPERTY_MAP_TABLE_STYLE;
+            }
+            break;
         }
     }
     return m_aPropertySetArr[nPropertyId];
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 7b7a467..e0d874f 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -68,6 +68,7 @@
 #include <GetMetricVal.hxx>
 #include <fmtfsize.hxx>
 #include <numrule.hxx>
+#include <tblafmt.hxx>
 
 #include <comphelper/servicehelper.hxx>
 #include <cppuhelper/supportsservice.hxx>
@@ -699,6 +700,12 @@ sal_Int32 lcl_GetCountOrName<SfxStyleFamily::Pseudo>(const SwDoc& rDoc, OUString
     return nCount + nPoolNumRange;
 }
 
+template<>
+sal_Int32 lcl_GetCountOrName<SfxStyleFamily::Table>(const SwDoc& rDoc, OUString* /*pString*/, sal_Int32 /*nIndex*/)
+{
+    return rDoc.GetDocShell()->GetDoc()->GetTableStyles().size();
+}
+
 template<SfxStyleFamily eFamily>
 static uno::Reference< css::style::XStyle> lcl_CreateStyle(SfxStyleSheetBasePool* pBasePool, SwDocShell* pDocShell, const OUString& sStyleName)
     { return pBasePool ? new SwXStyle(pBasePool, eFamily, pDocShell->GetDoc(), sStyleName) : new SwXStyle(pDocShell->GetDoc(), eFamily, false); };
@@ -759,6 +766,12 @@ sal_uInt16 lcl_TranslateIndex<SfxStyleFamily::Para>(const sal_uInt16 nIndex)
     throw lang::IndexOutOfBoundsException();
 }
 
+template<>
+sal_uInt16 lcl_TranslateIndex<SfxStyleFamily::Table>(const sal_uInt16 nIndex)
+{
+    return nIndex;
+}
+
 template<sal_uInt16 nRangeBegin, sal_uInt16 nRangeSize>
 static sal_uInt16 lcl_TranslateIndexRange(const sal_uInt16 nIndex)
 {
@@ -953,7 +966,8 @@ static const std::vector<StyleFamilyEntry>* lcl_GetStyleFamilyEntries()
             { SfxStyleFamily::Para,   PROPERTY_MAP_PARA_STYLE,  nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL,  "ParagraphStyles", STR_STYLE_FAMILY_PARAGRAPH, &lcl_GetCountOrName<SfxStyleFamily::Para>,   &lcl_CreateStyle<SfxStyleFamily::Para>,   &lcl_TranslateIndex<SfxStyleFamily::Para>                       },
             { SfxStyleFamily::Page,   PROPERTY_MAP_PAGE_STYLE,  nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, "PageStyles",      STR_STYLE_FAMILY_PAGE,      &lcl_GetCountOrName<SfxStyleFamily::Page>,   &lcl_CreateStyle<SfxStyleFamily::Page>,   &lcl_TranslateIndexRange<RES_POOLPAGE_BEGIN,    nPoolPageRange>  },
             { SfxStyleFamily::Frame,  PROPERTY_MAP_FRAME_STYLE, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT,   "FrameStyles",     STR_STYLE_FAMILY_FRAME,     &lcl_GetCountOrName<SfxStyleFamily::Frame>,  &lcl_CreateStyle<SfxStyleFamily::Frame>,  &lcl_TranslateIndexRange<RES_POOLFRM_BEGIN,     nPoolFrameRange> },
-            { SfxStyleFamily::Pseudo, PROPERTY_MAP_NUM_STYLE,   nsSwGetPoolIdFromName::GET_POOLID_NUMRULE,  "NumberingStyles", STR_STYLE_FAMILY_NUMBERING, &lcl_GetCountOrName<SfxStyleFamily::Pseudo>, &lcl_CreateStyle<SfxStyleFamily::Pseudo>, &lcl_TranslateIndexRange<RES_POOLNUMRULE_BEGIN, nPoolNumRange>   }
+            { SfxStyleFamily::Pseudo, PROPERTY_MAP_NUM_STYLE,   nsSwGetPoolIdFromName::GET_POOLID_NUMRULE,  "NumberingStyles", STR_STYLE_FAMILY_NUMBERING, &lcl_GetCountOrName<SfxStyleFamily::Pseudo>, &lcl_CreateStyle<SfxStyleFamily::Pseudo>, &lcl_TranslateIndexRange<RES_POOLNUMRULE_BEGIN, nPoolNumRange>   },
+            { SfxStyleFamily::Table,  PROPERTY_MAP_TABLE_STYLE, nsSwGetPoolIdFromName::GET_POOLID_TABSTYLE, "TableStyles",     STR_STYLE_FAMILY_TABLE,     &lcl_GetCountOrName<SfxStyleFamily::Table>,  &lcl_CreateStyle<SfxStyleFamily::Table>,  &lcl_TranslateIndex<SfxStyleFamily::Table>                       }
        };
     }
     return our_pStyleFamilyEntries;
diff --git a/sw/source/ui/utlui/poolfmt.src b/sw/source/ui/utlui/poolfmt.src
index 7b4d41c..4a206e6 100644
--- a/sw/source/ui/utlui/poolfmt.src
+++ b/sw/source/ui/utlui/poolfmt.src
@@ -759,4 +759,11 @@ String STR_POOLCHR_VERT_NUM
     Text [ en-US ] = "Vertical Numbering Symbols";
 };
 
+// Table styles
+
+String STR_TABSTYLE_DEFAULT
+{
+    Text [ en-US ] = "Default Style";
+};
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index dcbfba2..0171cf5 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -37,6 +37,7 @@
 #include <docsh.hxx>
 #include <frmfmt.hxx>
 #include <charfmt.hxx>
+#include <tblafmt.hxx>
 #include <poolfmt.hxx>
 #include <pagedesc.hxx>
 #include <docstyle.hxx>
@@ -75,6 +76,7 @@
 #define cFRAME      (sal_Unicode)'f'
 #define cPAGE       (sal_Unicode)'g'
 #define cNUMRULE    (sal_Unicode)'n'
+#define cTABSTYLE   (sal_Unicode)'t'
 
 using namespace com::sun::star;
 
@@ -2902,6 +2904,16 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
                             bIsSearchUsed, bSearchHidden, bOnlyHidden, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, cNUMRULE);
     }
 
+    if( nSearchFamily == SfxStyleFamily::Table ||
+        nSearchFamily == SfxStyleFamily::All )
+    {
+        const SwTableAutoFormatTable& rTableStyles = rDoc.GetTableStyles();
+        for(size_t i = 0; i < rTableStyles.size(); ++i)
+        {
+            aLst.Append( cTABSTYLE, rTableStyles[i].GetName() );
+        }
+    }
+
     if(!aLst.empty())
     {
         nLastPos = SAL_MAX_UINT32;


More information about the Libreoffice-commits mailing list