icon-themes/galaxy/sw/imglst/sf06.png |binary
 include/sfx2/sfxsids.hrc              |    1 
 rsc/source/parser/rscicpx.cxx         |    1 
 sfx2/sdi/sfx.sdi                      |   17 +++++++++++++
 sfx2/source/dialog/templdlg.cxx       |    5 +++
 sfx2/source/dialog/tplcitem.cxx       |    3 ++
 sfx2/source/inc/templdgi.hxx          |    4 +--
 sw/inc/doc.hxx                        |    2 +
 sw/inc/fesh.hxx                       |    1 
 sw/inc/tblafmt.hxx                    |   12 +++++++++
 sw/sdi/_basesh.sdi                    |    5 +++
 sw/sdi/_docsh.sdi                     |    6 ++++
 sw/sdi/annotsh.sdi                    |    5 +++
 sw/source/core/doc/poolfmt.cxx        |   16 ++++++++++++
 sw/source/core/doc/tblafmt.cxx        |    6 ++++
 sw/source/core/frmedt/fetab.cxx       |   15 +++++++++++
 sw/source/ui/app/app.src              |   16 ++++++++++--
 sw/source/uibase/app/docst.cxx        |   17 +++++++++++++
 sw/source/uibase/app/docstyle.cxx     |   44 +++++++++++++++++++++++++++++++---
 19 files changed, 169 insertions(+), 7 deletions(-)

New commits:
commit e7ea91f283ce9b96db58087d87d81d29bcb727a4
Author: Jakub Trzebiatowski <ubap....@gmail.com>
Date:   Thu Jul 28 15:33:17 2016 +0200

    GSoC Writer Table Styles; Table Styles Panel
    
    Table styles panel:
    + Added simple table style panel tab icon.
        icon-themes/galaxy/sw/imglst/sf06.png
    + Listing table styles (hierarchical, same order as in container)
    + Listing all table styles (sorted by name).
    + Listing applied table styles.
    + Listing custom styles.
    + Listing hidden styles.
    + Hide/show style.
    + Applying style by double clicking.
    + Highlight current table style.
    Everything else yet to be done.
    
    Table styles (SwTableAutoFormat):
    + "hidden" property.
    + "userDefined" property. "Default style" is not user defined. Styles loaded
    from tblauto.fmt are also not user defined. Styles loaded from .odt are user
    defined. Styles created manually (before binary load/save roundtrip) are 
user
    defined.
    
    Change-Id: I739a48ae1d7ae66f4f8c08076871437ca491bd4e
    Reviewed-on: https://gerrit.libreoffice.org/27638
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/icon-themes/galaxy/sw/imglst/sf06.png 
b/icon-themes/galaxy/sw/imglst/sf06.png
new file mode 100644
index 0000000..ce7e5ac
Binary files /dev/null and b/icon-themes/galaxy/sw/imglst/sf06.png differ
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index 0946248..b39390a 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -313,6 +313,7 @@
 #define SID_STYLE_FAMILY3                   (SID_STYLE_FAMILY_START + 2)
 #define SID_STYLE_FAMILY4                   (SID_STYLE_FAMILY_START + 3)
 #define SID_STYLE_FAMILY5                   (SID_STYLE_FAMILY_START + 4)
+#define SID_STYLE_FAMILY6                   (SID_STYLE_FAMILY_START + 5)
 
 #define SID_STYLE_NEW                       (SID_SFX_START + 549)
 #define SID_STYLE_EDIT                      (SID_SFX_START + 550)
diff --git a/rsc/source/parser/rscicpx.cxx b/rsc/source/parser/rscicpx.cxx
index a66f6a0..584b681 100644
--- a/rsc/source/parser/rscicpx.cxx
+++ b/rsc/source/parser/rscicpx.cxx
@@ -1151,6 +1151,7 @@ RscTop * RscTypCont::InitClassSfxStyleFamilyItem( RscTop 
* pSuper,
         SETCONST( pSfxStyleFamily, 
"SfxStyleFamily::Frame",SfxStyleFamily::Frame);
         SETCONST( pSfxStyleFamily, "SfxStyleFamily::Page", 
SfxStyleFamily::Page );
         SETCONST( pSfxStyleFamily, "SfxStyleFamily::Pseudo", 
SfxStyleFamily::Pseudo );
+        SETCONST( pSfxStyleFamily, "SfxStyleFamily::Table", 
SfxStyleFamily::Table );
         aBaseLst.push_back( pSfxStyleFamily );
 
         nId = aNmTb.Put( "StyleFamily", VARNAME );
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 7e396af..f5e366a 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -4459,6 +4459,23 @@ SfxTemplateItem ListStyle SID_STYLE_FAMILY5
     GroupId = GID_DOCUMENT;
 ]
 
+SfxTemplateItem TableStyle SID_STYLE_FAMILY6
+
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    ToolBoxConfig = FALSE,
+    GroupId = GID_DOCUMENT;
+]
 
 SfxBoolItem TipsDialog SID_TIPWINDOW
 
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index e185487..f0a5369 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -754,6 +754,8 @@ void SfxCommonTemplateDialog_Impl::ReadResource()
                 nSlot = SID_STYLE_FAMILY4; break;
             case SfxStyleFamily::Pseudo:
                 nSlot = SID_STYLE_FAMILY5; break;
+            case SfxStyleFamily::Table:
+                nSlot = SID_STYLE_FAMILY6; break;
             default: OSL_FAIL("unknown StyleFamily"); break;
         }
         pBoundItems[i] =
@@ -896,6 +898,7 @@ namespace SfxTemplate
             case SfxStyleFamily::Frame:  return 3;
             case SfxStyleFamily::Page:   return 4;
             case SfxStyleFamily::Pseudo: return 5;
+            case SfxStyleFamily::Table:  return 6;
             default:                      return 0;
         }
     }
@@ -909,6 +912,7 @@ namespace SfxTemplate
             case 3: return SfxStyleFamily::Frame;
             case 4: return SfxStyleFamily::Page;
             case 5: return SfxStyleFamily::Pseudo;
+            case 6: return SfxStyleFamily::Table;
             default: return SfxStyleFamily::All;
         }
     }
@@ -2291,6 +2295,7 @@ void SfxTemplateDialog_Impl::InsertFamilyItem(sal_uInt16 
nId,const SfxStyleFamil
         case SfxStyleFamily::Frame:    sHelpId = ".uno:FrameStyle"; break;
         case SfxStyleFamily::Page:     sHelpId = ".uno:PageStyle"; break;
         case SfxStyleFamily::Pseudo:   sHelpId = ".uno:ListStyle"; break;
+        case SfxStyleFamily::Table:   sHelpId = ".uno:TableStyle"; break;
         default: OSL_FAIL("unknown StyleFamily"); break;
     }
     m_aActionTbL->InsertItem( nId, pItem->GetImage(), pItem->GetText(), 
ToolBoxItemBits::NONE, 0);
diff --git a/sfx2/source/dialog/tplcitem.cxx b/sfx2/source/dialog/tplcitem.cxx
index 714a2aa..e0916ba 100644
--- a/sfx2/source/dialog/tplcitem.cxx
+++ b/sfx2/source/dialog/tplcitem.cxx
@@ -63,6 +63,7 @@ void SfxTemplateControllerItem::StateChanged( sal_uInt16 
nSID, SfxItemState eSta
         case SID_STYLE_FAMILY3:
         case SID_STYLE_FAMILY4:
         case SID_STYLE_FAMILY5:
+        case SID_STYLE_FAMILY6:
         {
             bool bAvailable = SfxItemState::DEFAULT == eState;
             if ( !bAvailable )
@@ -87,6 +88,8 @@ void SfxTemplateControllerItem::StateChanged( sal_uInt16 
nSID, SfxItemState eSta
                     nFamily = 4; break;
                 case SID_STYLE_FAMILY5:
                     nFamily = 5; break;
+                case SID_STYLE_FAMILY6:
+                    nFamily = 6; break;
 
                 default: OSL_FAIL("unknown StyleFamily"); break;
             }
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx
index 385a40a..0938658 100644
--- a/sfx2/source/inc/templdgi.hxx
+++ b/sfx2/source/inc/templdgi.hxx
@@ -162,8 +162,8 @@ private:
     DeletionWatcher* impl_setDeletionWatcher(DeletionWatcher* pNewWatcher);
 
 protected:
-#define MAX_FAMILIES            5
-#define COUNT_BOUND_FUNC        13
+#define MAX_FAMILIES            6
+#define COUNT_BOUND_FUNC        14
 
     friend class DropListBox_Impl;
     friend class SfxTemplateControllerItem;
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index dc96eb0..755c598 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -890,6 +890,8 @@ public:
 
     // Query if style (paragraph- / character- / frame- / page-) is used.
     bool IsUsed( const SwModify& ) const;
+    /// Query if table style is used.
+    bool IsUsed( const SwTableAutoFormat& ) const;
     static bool IsUsed( const SwNumRule& );
 
     // Set name of newly loaded document template.
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 0e311d0..a1fefd8 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -725,6 +725,7 @@ public:
     bool IsAdjustCellWidthAllowed( bool bBalance = false ) const;
 
     /// Set table style of the current table.
+    bool SetTableStyle(const OUString& rStyleName);
     bool SetTableStyle(const SwTableAutoFormat& rNew);
 
     /// Update the direct formatting according to the current table style.
diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx
index 06aa12b..92bd534 100644
--- a/sw/inc/tblafmt.hxx
+++ b/sw/inc/tblafmt.hxx
@@ -266,6 +266,8 @@ class SW_DLLPUBLIC SwTableAutoFormat
     bool m_bCollapsingBorders;
     SvxShadowItem m_aShadow;
 
+    bool m_bHidden;
+    bool m_bUserDefined;
 public:
     SwTableAutoFormat( const OUString& rName );
     SwTableAutoFormat( const SwTableAutoFormat& rNew );
@@ -296,6 +298,11 @@ public:
     bool IsBackground() const   { return bInclBackground; }
     bool IsValueFormat() const  { return bInclValueFormat; }
 
+    /// Check if style is hidden.
+    bool IsHidden() const       { return m_bHidden; }
+    /// Check if style is defined by user.
+    bool IsUserDefined() const  { return m_bUserDefined; }
+
     void SetFont( const bool bNew )         { bInclFont = bNew; }
     void SetJustify( const  bool bNew )     { bInclJustify = bNew; }
     void SetFrame( const bool bNew )        { bInclFrame = bNew; }
@@ -303,6 +310,11 @@ public:
     void SetValueFormat( const bool bNew )  { bInclValueFormat = bNew; }
     void SetWidthHeight( const bool bNew )  { bInclWidthHeight = bNew; }
 
+    /// Set if style is hidden.
+    void SetHidden(bool bHidden)            { m_bHidden = bHidden; }
+    /// Set if style is user defined.
+    void SetUserDefined(bool bUserDefined)  { m_bUserDefined = bUserDefined; }
+
     /// These methods returns what style (row or column) is applied first on 
given Cell
     bool FirstRowEndColumnIsRow();
     bool FirstRowStartColumnIsRow();
diff --git a/sw/sdi/_basesh.sdi b/sw/sdi/_basesh.sdi
index 87de494..1d3d1ae 100644
--- a/sw/sdi/_basesh.sdi
+++ b/sw/sdi/_basesh.sdi
@@ -361,6 +361,11 @@ interface BaseTextSelection
         StateMethod = StateStyle ;
     ]
 
+    SID_STYLE_FAMILY6 // status(fina|play)
+    [
+        StateMethod = StateStyle ;
+    ]
+
     SID_CLASSIFICATION_APPLY
     [
         ExecMethod = Execute ;
diff --git a/sw/sdi/_docsh.sdi b/sw/sdi/_docsh.sdi
index 263dc15..3bb9b7f 100644
--- a/sw/sdi/_docsh.sdi
+++ b/sw/sdi/_docsh.sdi
@@ -109,6 +109,12 @@ interface BaseTextDocument
         StateMethod = StateStyleSheet ;
     ]
 
+    SID_STYLE_FAMILY6
+    [
+        Export = FALSE ;
+        StateMethod = StateStyleSheet ;
+    ]
+
     SID_ATTR_YEAR2000
     [
         ExecMethod = Execute ;
diff --git a/sw/sdi/annotsh.sdi b/sw/sdi/annotsh.sdi
index fbefb5e..8020246 100644
--- a/sw/sdi/annotsh.sdi
+++ b/sw/sdi/annotsh.sdi
@@ -303,6 +303,11 @@ interface Annotation : _Annotation
         StateMethod = StateDisableItems ;
     ]
 
+    SID_STYLE_FAMILY6
+    [
+        StateMethod = StateDisableItems ;
+    ]
+
     SID_STYLE_WATERCAN // status()
     [
         StateMethod = StateDisableItems ;
diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
index c780f81..88fddf4 100644
--- a/sw/source/core/doc/poolfmt.cxx
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -65,6 +65,8 @@
 #include <poolfmt.hrc>
 #include <GetMetricVal.hxx>
 #include <numrule.hxx>
+#include <swtable.hxx>
+#include <tblafmt.hxx>
 #include <svx/xdef.hxx>
 
 //UUUU
@@ -133,6 +135,20 @@ bool SwDoc::IsUsed( const SwModify& rModify ) const
     return !rModify.GetInfo( aGetHt );
 }
 
+// See if Table style is in use
+bool SwDoc::IsUsed( const SwTableAutoFormat& rTableAutoFormat) const
+{
+    size_t nTableCount = GetTableFrameFormatCount(true);
+    for (size_t i=0; i < nTableCount; ++i)
+    {
+        SwFrameFormat* pFrameFormat = &GetTableFrameFormat(i, true);
+        SwTable* pTable = SwTable::FindTable(pFrameFormat);
+        if (pTable->GetTableStyleName() == rTableAutoFormat.GetName())
+            return true;
+    }
+    return false;
+}
+
 // See if the NumRule is used
 bool SwDoc::IsUsed( const SwNumRule& rRule )
 {
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 0034998..f31fe77 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -600,6 +600,8 @@ SwTableAutoFormat::SwTableAutoFormat( const OUString& rName 
)
     , m_bRowSplit( true )
     , m_bCollapsingBorders(true)
     , m_aShadow( RES_SHADOW )
+    , m_bHidden( false )
+    , m_bUserDefined( true )
 {
     bInclFont = true;
     bInclJustify = true;
@@ -655,6 +657,8 @@ SwTableAutoFormat& SwTableAutoFormat::operator=( const 
SwTableAutoFormat& rNew )
     m_bRowSplit = rNew.m_bRowSplit;
     m_bCollapsingBorders = rNew.m_bCollapsingBorders;
     m_aShadow = rNew.m_aShadow;
+    m_bHidden = rNew.m_bHidden;
+    m_bUserDefined = rNew.m_bUserDefined;
 
     return *this;
 }
@@ -1018,6 +1022,7 @@ bool SwTableAutoFormat::Load( SvStream& rStream, const 
SwAfVersions& rVersions )
             }
         }
     }
+    m_bUserDefined = false;
     return bRet;
 }
 
@@ -1259,6 +1264,7 @@ SwTableAutoFormatTable::SwTableAutoFormatTable()
         const_cast<SwBoxAutoFormat&>(pNew->GetBoxFormat( i )).SetBox( aBox );
     }
 
+    pNew->SetUserDefined(false);
     m_pImpl->m_AutoFormats.push_back(std::move(pNew));
 }
 
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index f8236a19..8d19c73 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1175,6 +1175,21 @@ bool SwFEShell::IsAdjustCellWidthAllowed( bool bBalance 
) const
     return false;
 }
 
+bool SwFEShell::SetTableStyle(const OUString& rStyleName)
+{
+    // make sure SwDoc has the style
+    SwTableAutoFormat *pTableFormat = 
GetDoc()->GetTableStyles().FindAutoFormat(rStyleName);
+    if (!pTableFormat)
+        return false;
+
+    SwTableNode *pTableNode = const_cast<SwTableNode*>(IsCursorInTable());
+    if (!pTableNode)
+        return false;
+
+    // set the name & update
+    return UpdateTableStyleFormatting(pTableNode, false, &rStyleName);
+}
+
     // AutoFormat for the table/table selection
 bool SwFEShell::SetTableStyle(const SwTableAutoFormat& rStyle)
 {
diff --git a/sw/source/ui/app/app.src b/sw/source/ui/app/app.src
index 4f8bcdb..5ce2a0b 100644
--- a/sw/source/ui/app/app.src
+++ b/sw/source/ui/app/app.src
@@ -74,9 +74,9 @@ ImageList RID_DEFAULTIMAGELIST_LC
     MaskColor = IMAGE_MASK_COLOR ; \
     IdList = \
     { \
-        1; 2; 3; 4; 5; \
+        1; 2; 3; 4; 5; 6;\
     }; \
-    IdCount = 5;
+    IdCount = 6;
 
 SfxStyleFamilies DLG_STYLE_DESIGNER
 {
@@ -150,6 +150,18 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
             };
             Text [ en-US ] = "List Styles" ;
         };
+        SfxStyleFamilyItem
+        {
+            Text [ en-US ] = "Table Styles" ;
+            StyleFamily = SfxStyleFamily::Table ;
+            FilterList [ en-US ] =
+            {
+                < "All"             ; SFXSTYLEBIT_ALL_VISIBLE ; > ;
+                < "Hidden Styles"   ; SFXSTYLEBIT_HIDDEN    ; > ;
+                < "Applied Styles"  ; SFXSTYLEBIT_USED      ; > ;
+                < "Custom Styles"   ; SFXSTYLEBIT_USERDEF   ; > ;
+            };
+        };
     };
 
     ImageList 1 // == BMP_COLOR_NORMAL + 1
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index e66742f..4a1e742 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -227,6 +227,15 @@ void  SwDocShell::StateStyleSheet(SfxItemSet& rSet, 
SwWrtShell* pSh)
                     rSet.Put(SfxTemplateItem(nWhich, aName));
                 }
                 break;
+            case SID_STYLE_FAMILY6:
+                {
+                    const SwTableNode *pTableNd = pShell->IsCursorInTable();
+                    if( pTableNd )
+                        aName = pTableNd->GetTable().GetTableStyleName();
+
+                    rSet.Put(SfxTemplateItem(nWhich, aName));
+                }
+                break;
 
             case SID_STYLE_WATERCAN:
             {
@@ -410,6 +419,9 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
                     else
                     if(aFamily == "NumberingStyles")
                         nFamily = SfxStyleFamily::Pseudo;
+                    else
+                    if(aFamily == "TableStyles")
+                        nFamily = SfxStyleFamily::Table;
                 }
 
                 if( SfxItemState::SET == pArgs->GetItemState(SID_STYLE_MASK,
@@ -960,6 +972,11 @@ SfxStyleFamily SwDocShell::ApplyStyles(const OUString 
&rName, SfxStyleFamily nFa
             pSh->SetCurNumRule( *pNumRule, false, sListIdForStyle, true );
             break;
         }
+        case SfxStyleFamily::Table:
+        {
+            pSh->SetTableStyle(pStyle->GetName());
+            break;
+        }
         default:
             OSL_FAIL("Unknown family");
     }
diff --git a/sw/source/uibase/app/docstyle.cxx 
b/sw/source/uibase/app/docstyle.cxx
index 91c5c3b..f99b5ea 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -649,6 +649,17 @@ void SwDocStyleSheet::SetHidden( bool bValue )
             }
             break;
 
+        case SfxStyleFamily::Table:
+            {
+                SwTableAutoFormat* pTableAutoFormat = 
rDoc.GetTableStyles().FindAutoFormat( aName );
+                if ( pTableAutoFormat )
+                {
+                    pTableAutoFormat->SetHidden( bValue );
+                    bChg = true;
+                }
+            }
+            break;
+
         default:
             break;
     }
@@ -698,6 +709,12 @@ bool SwDocStyleSheet::IsHidden( ) const
                 bRet = pRule && pRule->IsHidden( );
             }
             break;
+        case SfxStyleFamily::Table:
+            {
+                SwTableAutoFormat* pTableAutoFormat = 
rDoc.GetTableStyles().FindAutoFormat( aName );
+                bRet = pTableAutoFormat && pTableAutoFormat->IsHidden( );
+            }
+            break;
         default:
             break;
     }
@@ -1263,9 +1280,9 @@ std::unique_ptr<SfxItemSet> 
lcl_SwFormatToFlatItemSet(SwFormat *const pFormat)
 
 std::unique_ptr<SfxItemSet> SwDocStyleSheet::GetItemSetForPreview()
 {
-    if (SfxStyleFamily::Page == nFamily || SfxStyleFamily::Pseudo == nFamily)
+    if (SfxStyleFamily::Page == nFamily || SfxStyleFamily::Pseudo == nFamily 
|| SfxStyleFamily::Table == nFamily)
     {
-        SAL_WARN("sw.ui", "GetItemSetForPreview not implemented for page or 
number style");
+        SAL_WARN("sw.ui", "GetItemSetForPreview not implemented for page or 
number or table style");
         return std::unique_ptr<SfxItemSet>();
     }
     if (!bPhysical)
@@ -1988,6 +2005,7 @@ bool SwDocStyleSheet::FillStyleSheet(
 
     case SfxStyleFamily::Table:
         pTableFormat = lcl_FindTableStyle(rDoc, aName, this);
+        SetMask((pTableFormat && pTableFormat->IsUserDefined()) ? 
SFXSTYLEBIT_USERDEF : 0);
         bRet = bPhysical = (nullptr != pTableFormat);
         break;
 
@@ -2164,6 +2182,7 @@ void SwDocStyleSheet::PresetNameAndFamily(const OUString& 
rName)
     case cFRAME:    nFamily = SfxStyleFamily::Frame; break;
     case cPAGE:     nFamily = SfxStyleFamily::Page; break;
     case cNUMRULE:  nFamily = SfxStyleFamily::Pseudo; break;
+    case cTABSTYLE: nFamily = SfxStyleFamily::Table; break;
     default:        nFamily = SfxStyleFamily::Char; break;
     }
     aName = rName.copy(1);
@@ -2212,6 +2231,9 @@ bool  SwDocStyleSheet::IsUsed() const
     case SfxStyleFamily::Pseudo:
             return pNumRule && SwDoc::IsUsed( *pNumRule );
 
+    case SfxStyleFamily::Table:
+            return pTableFormat && rDoc.IsUsed( *pTableFormat );
+
     default:
         OSL_ENSURE(false, "unknown style family");
         return false;
@@ -2980,7 +3002,23 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
         const SwTableAutoFormatTable& rTableStyles = rDoc.GetTableStyles();
         for(size_t i = 0; i < rTableStyles.size(); ++i)
         {
-            aLst.Append( cTABSTYLE, rTableStyles[i].GetName() );
+            const SwTableAutoFormat& rTableStyle = rTableStyles[i];
+
+            bool bUsed = bIsSearchUsed && (bOrganizer || 
rDoc.IsUsed(rTableStyle));
+            if(!bUsed)
+            {
+                if(nSrchMask == SFXSTYLEBIT_HIDDEN && !rTableStyle.IsHidden())
+                    continue;
+
+                if( (!bSearchHidden && rTableStyle.IsHidden() ) ||
+                        ( (nSrchMask & ~SFXSTYLEBIT_USED) == 
SFXSTYLEBIT_USERDEF
+                    ? !rTableStyle.IsUserDefined()
+                    // searched for used and found none
+                    : bIsSearchUsed ) )
+                    continue;
+            }
+
+            aLst.Append( cTABSTYLE, rTableStyle.GetName() );
         }
     }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to