[Libreoffice-commits] .: 3 commits - sc/inc sc/sdi sc/source sd/sdi sd/source sfx2/inc sfx2/sdi sfx2/source svl/inc svl/source sw/inc sw/sdi sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Nov 30 09:10:25 PST 2012


 sc/inc/stlpool.hxx                  |    2 
 sc/sdi/drawsh.sdi                   |    1 
 sc/sdi/drtxtob.sdi                  |    1 
 sc/sdi/formatsh.sdi                 |    1 
 sc/source/ui/docshell/docsh6.cxx    |    2 
 sc/source/ui/styleui/scstyles.src   |    4 
 sc/source/ui/view/formatsh.cxx      |   29 +++
 sd/sdi/_drvwsh.sdi                  |    7 
 sd/sdi/outlnvsh.sdi                 |    7 
 sd/source/ui/app/res_bmp.src        |    6 
 sd/source/ui/func/futempl.cxx       |   11 +
 sd/source/ui/view/drviewsc.cxx      |    1 
 sd/source/ui/view/outlnvsh.cxx      |    3 
 sfx2/inc/sfx2/sfxsids.hrc           |    1 
 sfx2/inc/sfx2/tplpitem.hxx          |    3 
 sfx2/sdi/sfx.sdi                    |   25 +++
 sfx2/source/dialog/dialog.hrc       |    1 
 sfx2/source/dialog/dialog.src       |    5 
 sfx2/source/dialog/templdlg.cxx     |   54 +++++--
 sfx2/source/dialog/tplcitem.cxx     |    3 
 sfx2/source/doc/objcont.cxx         |    2 
 sfx2/source/inc/templdgi.hxx        |    6 
 svl/inc/svl/style.hrc               |   12 -
 svl/inc/svl/style.hxx               |   12 +
 svl/source/items/style.cxx          |   40 +++--
 sw/inc/docsh.hxx                    |    1 
 sw/inc/docstyle.hxx                 |    8 -
 sw/inc/format.hxx                   |    4 
 sw/inc/numrule.hxx                  |    4 
 sw/inc/pagedesc.hxx                 |    4 
 sw/sdi/_docsh.sdi                   |    6 
 sw/sdi/annotsh.sdi                  |    5 
 sw/source/core/attr/format.cxx      |    4 
 sw/source/core/doc/number.cxx       |    3 
 sw/source/core/layout/pagedesc.cxx  |    2 
 sw/source/core/unocore/unostyle.cxx |    4 
 sw/source/ui/app/app.src            |   15 +-
 sw/source/ui/app/docst.cxx          |   24 +++
 sw/source/ui/app/docstyle.cxx       |  268 ++++++++++++++++++++++++++++--------
 39 files changed, 481 insertions(+), 110 deletions(-)

New commits:
commit 1d6b6298199c2809de49f68714834aa94fb0143e
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Fri Nov 30 14:27:56 2012 +0100

    Fixed style iterators filters to show only hidden styles when required
    
    Change-Id: I60d4dff4fc6eabc3882361457e19ae66f148d114

diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index 153edb8..6df5bfa 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -375,15 +375,19 @@ inline bool SfxStyleSheetIterator::IsTrivialSearch()
 
 bool SfxStyleSheetIterator::DoesStyleMatch(SfxStyleSheetBase *pStyle)
 {
+    bool bMatchFamily = ((GetSearchFamily() == SFX_STYLE_FAMILY_ALL) ||
+            ( pStyle->GetFamily() == GetSearchFamily() ));
+
+    bool bUsed = bSearchUsed ? pStyle->IsUsed( ) : false;
+
     bool bSearchHidden = ( GetSearchMask() & SFXSTYLEBIT_HIDDEN );
-    bool bMatchVisibility = bSearchHidden || !pStyle->IsHidden();
+    bool bMatchVisibility = !( !bSearchHidden && pStyle->IsHidden() && !bUsed );
+    bool bOnlyHidden = GetSearchMask( ) == SFXSTYLEBIT_HIDDEN && pStyle->IsHidden( );
 
-    bool bMatches = ((GetSearchFamily() == SFX_STYLE_FAMILY_ALL) ||
-            ( pStyle->GetFamily() == GetSearchFamily() ))
+    bool bMatches = bMatchFamily && bMatchVisibility
         && (( pStyle->GetMask() & ( GetSearchMask() & ~SFXSTYLEBIT_USED )) ||
-            ( bSearchUsed ? pStyle->IsUsed() : false ) ||
-            ( GetSearchMask() & SFXSTYLEBIT_ALL_VISIBLE ) == SFXSTYLEBIT_ALL_VISIBLE )
-        && bMatchVisibility;
+            bUsed || bOnlyHidden ||
+            ( GetSearchMask() & SFXSTYLEBIT_ALL_VISIBLE ) == SFXSTYLEBIT_ALL_VISIBLE );
     return bMatches;
 }
 
diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
index f6f96f8..cae4c50 100644
--- a/sw/source/ui/app/docstyle.cxx
+++ b/sw/source/ui/app/docstyle.cxx
@@ -2532,6 +2532,9 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
             if( ( !bSearchHidden && pFmt->IsHidden() && !bUsed ) || ( pFmt->IsDefault() && pFmt != rDoc.GetDfltCharFmt() ) )
                 continue;
 
+            if ( nSrchMask == SFXSTYLEBIT_HIDDEN && !pFmt->IsHidden( ) )
+                continue;
+
             if( !bUsed )
             {
                 // Standard is no User template
@@ -2609,6 +2612,9 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
             if ( ( !bSearchHidden && pColl->IsHidden( ) && !bUsed ) || pColl->IsDefault() )
                 continue;
 
+            if ( nSMask == SFXSTYLEBIT_HIDDEN && !pColl->IsHidden( ) )
+                continue;
+
             if( !(bIsSearchUsed && bUsed ))
             {
                 const sal_uInt16 nId = pColl->GetPoolFmtId();
@@ -2750,9 +2756,10 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
 
             bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(*pFmt));
             if( ( !bSearchHidden && pFmt->IsHidden( ) && !bUsed ) || pFmt->IsDefault() || pFmt->IsAuto() )
-            {
                 continue;
-            }
+
+            if ( nSrchMask == SFXSTYLEBIT_HIDDEN && !pFmt->IsHidden( ) )
+                continue;
 
             const sal_uInt16 nId = pFmt->GetPoolFmtId();
             if( !bUsed )
@@ -2795,6 +2802,9 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
                     continue;
             }
 
+            if ( nSrchMask == SFXSTYLEBIT_HIDDEN && !rDesc.IsHidden( ) )
+                continue;
+
             aLst.Append( cPAGE, rDesc.GetName() );
         }
         if ( bAll )
@@ -2811,6 +2821,9 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
             const SwNumRule& rRule = *rNumTbl[ i ];
             if( !rRule.IsAutoRule() )
             {
+                if ( nSrchMask == SFXSTYLEBIT_HIDDEN && !rRule.IsHidden( ) )
+                    continue;
+
                 bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(rRule) );
                 if( !bUsed )
                 {
commit 715d79bcc59d68c77dc84a1038998dd873df92e9
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Fri Nov 30 11:51:46 2012 +0100

    Styles & Formatting: added SFXSTYLEBIT_ALL_VISIBLE and show hidden styles
    
    Change-Id: Ie74ec3c15ba270afd0a6864bd5824a5bc0e3ea8b

diff --git a/sc/source/ui/styleui/scstyles.src b/sc/source/ui/styleui/scstyles.src
index 2e28aa2..5f2a090 100644
--- a/sc/source/ui/styleui/scstyles.src
+++ b/sc/source/ui/styleui/scstyles.src
@@ -37,7 +37,8 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
             StyleFamily = SFX_STYLE_FAMILY_PARA ;
             FilterList [ en-US ] =
             {
-                < "All Styles" ; SFXSTYLEBIT_ALL ; > ;
+                < "All Styles" ; SFXSTYLEBIT_ALL_VISIBLE ; > ;
+                < "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ;
                 < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
                 < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; >  ;
             };
@@ -50,6 +51,7 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
             FilterList [ en-US ] =
             {
                 < "All Styles" ; SFXSTYLEBIT_ALL ; > ;
+                < "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ;
                 < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
             };
             Text [ en-US ] = "Page Styles" ;
diff --git a/sd/source/ui/app/res_bmp.src b/sd/source/ui/app/res_bmp.src
index c38add2..d828a9b 100644
--- a/sd/source/ui/app/res_bmp.src
+++ b/sd/source/ui/app/res_bmp.src
@@ -267,7 +267,8 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
             StyleFamily = SFX_STYLE_FAMILY_PARA ;
             FilterList [ en-US ] =
             {
-                < "All Styles" ; SFXSTYLEBIT_ALL ; > ;
+                < "All Styles" ; SFXSTYLEBIT_ALL_VISIBLE ; > ;
+                < "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ;
                 < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
                 < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
             };
@@ -278,7 +279,8 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
             StyleFamily = SFX_STYLE_FAMILY_PSEUDO ;
             FilterList [ en-US ] =
             {
-                < "All Styles" ; SFXSTYLEBIT_ALL ; > ;
+                < "All Styles" ; SFXSTYLEBIT_ALL_VISIBLE ; > ;
+                < "Hidden Styles" ; SFXSTYLEBIT_HIDDEN ; > ;
             };
         };
     };
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 25ea1ba..cb19f50 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -1064,7 +1064,7 @@ void SfxCommonTemplateDialog_Impl::SelectStyle(const String &rStr)
     if ( !pItem )
         return;
     const SfxStyleFamily eFam = pItem->GetFamily();
-    SfxStyleSheetBase* pStyle = pStyleSheetPool->Find( rStr, eFam, SFXSTYLEBIT_ALL | SFXSTYLEBIT_HIDDEN );
+    SfxStyleSheetBase* pStyle = pStyleSheetPool->Find( rStr, eFam, SFXSTYLEBIT_ALL );
     if( pStyle )
     {
         bool bReadWrite = !(pStyle->GetMask() & SFXSTYLEBIT_READONLY);
@@ -1170,7 +1170,7 @@ void SfxCommonTemplateDialog_Impl::FillTreeBox()
     if(pStyleSheetPool && nActFamily != 0xffff)
     {
         const SfxStyleFamilyItem *pItem = GetFamilyItem_Impl();
-        pStyleSheetPool->SetSearchMask(pItem->GetFamily(), SFXSTYLEBIT_ALL);
+        pStyleSheetPool->SetSearchMask(pItem->GetFamily(), SFXSTYLEBIT_ALL_VISIBLE);
         StyleTreeArr_Impl aArr;
         SfxStyleSheetBase *pStyle = pStyleSheetPool->First();
         if(pStyle && pStyle->HasParentSupport() && bTreeDrag )
@@ -1589,7 +1589,7 @@ void SfxCommonTemplateDialog_Impl::Notify(SfxBroadcaster& /*rBC*/, const SfxHint
                         const SfxStyleFamily eFam = pItem->GetFamily();
                         SfxStyleSheetBase *pStyle =
                             pStyleSheetPool->Find(
-                                aStr, eFam, SFXSTYLEBIT_ALL | SFXSTYLEBIT_HIDDEN );
+                                aStr, eFam, SFXSTYLEBIT_ALL );
                         if( pStyle )
                         {
                             bool bReadWrite = !(pStyle->GetMask() & SFXSTYLEBIT_READONLY);
@@ -2090,7 +2090,7 @@ void    SfxCommonTemplateDialog_Impl::EnableDelete()
         if(!nFilter)    // automatic
             nFilter = nAppFilter;
         const SfxStyleSheetBase *pStyle =
-            pStyleSheetPool->Find(aTemplName,eFam, pTreeBox? SFXSTYLEBIT_ALL | SFXSTYLEBIT_HIDDEN : nFilter);
+            pStyleSheetPool->Find(aTemplName,eFam, pTreeBox? SFXSTYLEBIT_ALL : nFilter);
 
         OSL_ENSURE(pStyle, "Style ot found");
         if(pStyle && pStyle->IsUserDefined())
diff --git a/svl/inc/svl/style.hrc b/svl/inc/svl/style.hrc
index ae08df4..d498840 100644
--- a/svl/inc/svl/style.hrc
+++ b/svl/inc/svl/style.hrc
@@ -19,11 +19,12 @@
 #ifndef _SFX_STYLE_HRC
 #define _SFX_STYLE_HRC
 
-#define SFXSTYLEBIT_AUTO     0x0000 // automatisch; Flags kommen von der Applikation
-#define SFXSTYLEBIT_HIDDEN   0x0200 // benutzte Vorlage (als Suchmaske)
-#define SFXSTYLEBIT_READONLY 0x2000 // benutzte Vorlage (als Suchmaske)
-#define SFXSTYLEBIT_USED     0x4000 // benutzte Vorlage (als Suchmaske)
-#define SFXSTYLEBIT_USERDEF  0x8000 // benutzerdefinierte Vorlage
-#define SFXSTYLEBIT_ALL      0xFDFF // alle Vorlagen
+#define SFXSTYLEBIT_AUTO        0x0000 // automatisch; Flags kommen von der Applikation
+#define SFXSTYLEBIT_HIDDEN      0x0200 // benutzte Vorlage (als Suchmaske)
+#define SFXSTYLEBIT_READONLY    0x2000 // benutzte Vorlage (als Suchmaske)
+#define SFXSTYLEBIT_USED        0x4000 // benutzte Vorlage (als Suchmaske)
+#define SFXSTYLEBIT_USERDEF     0x8000 // benutzerdefinierte Vorlage
+#define SFXSTYLEBIT_ALL_VISIBLE 0xFDFF // alle Vorlagen
+#define SFXSTYLEBIT_ALL         0xFFFF // alle Vorlagen
 
 #endif
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index 15deda6..153edb8 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -369,7 +369,8 @@ SfxStyleFamily SfxStyleSheetIterator::GetSearchFamily() const
 
 inline bool SfxStyleSheetIterator::IsTrivialSearch()
 {
-    return nMask == SFXSTYLEBIT_ALL && GetSearchFamily() == SFX_STYLE_FAMILY_ALL;
+    return ( nMask & SFXSTYLEBIT_ALL_VISIBLE ) == SFXSTYLEBIT_ALL_VISIBLE
+        && GetSearchFamily() == SFX_STYLE_FAMILY_ALL;
 }
 
 bool SfxStyleSheetIterator::DoesStyleMatch(SfxStyleSheetBase *pStyle)
@@ -381,7 +382,7 @@ bool SfxStyleSheetIterator::DoesStyleMatch(SfxStyleSheetBase *pStyle)
             ( pStyle->GetFamily() == GetSearchFamily() ))
         && (( pStyle->GetMask() & ( GetSearchMask() & ~SFXSTYLEBIT_USED )) ||
             ( bSearchUsed ? pStyle->IsUsed() : false ) ||
-            GetSearchMask() == SFXSTYLEBIT_ALL )
+            ( GetSearchMask() & SFXSTYLEBIT_ALL_VISIBLE ) == SFXSTYLEBIT_ALL_VISIBLE )
         && bMatchVisibility;
     return bMatches;
 }
@@ -393,7 +394,8 @@ SfxStyleSheetIterator::SfxStyleSheetIterator(SfxStyleSheetBasePool *pBase,
     pBasePool=pBase;
     nSearchFamily=eFam;
     bSearchUsed=sal_False;
-        if((n != SFXSTYLEBIT_ALL ) && ((n & SFXSTYLEBIT_USED) == SFXSTYLEBIT_USED))
+        if( (( n & SFXSTYLEBIT_ALL_VISIBLE ) != SFXSTYLEBIT_ALL_VISIBLE )
+                && ((n & SFXSTYLEBIT_USED) == SFXSTYLEBIT_USED))
     {
         bSearchUsed = sal_True;
         n &= ~SFXSTYLEBIT_USED;
diff --git a/sw/source/ui/app/app.src b/sw/source/ui/app/app.src
index d56012d..2af7888 100644
--- a/sw/source/ui/app/app.src
+++ b/sw/source/ui/app/app.src
@@ -92,7 +92,8 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
             StyleFamily = SFX_STYLE_FAMILY_PARA ;
             FilterList [ en-US ] =
             {
-                < "All Styles"          ; SFXSTYLEBIT_ALL       ; > ;
+                < "All Styles"          ; SFXSTYLEBIT_ALL_VISIBLE ; > ;
+                < "Hidden Styles"       ; SFXSTYLEBIT_HIDDEN    ; > ;
                 < "Applied Styles"      ; SFXSTYLEBIT_USED      ; > ;
                 < "Custom Styles"       ; SFXSTYLEBIT_USERDEF   ; > ;
                 < "Automatic"           ; SFXSTYLEBIT_AUTO      ; > ;
@@ -111,7 +112,8 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
             StyleFamily = SFX_STYLE_FAMILY_CHAR ;
             FilterList [ en-US ] =
             {
-                < "All"             ; SFXSTYLEBIT_ALL       ; > ;
+                < "All"             ; SFXSTYLEBIT_ALL_VISIBLE ; > ;
+                < "Hidden Styles"   ; SFXSTYLEBIT_HIDDEN    ; > ;
                 < "Applied Styles"  ; SFXSTYLEBIT_USED      ; > ;
                 < "Custom Styles"   ; SFXSTYLEBIT_USERDEF   ; > ;
             };
@@ -122,7 +124,8 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
             StyleFamily = SFX_STYLE_FAMILY_FRAME ;
             FilterList [ en-US ] =
             {
-                < "All"             ; SFXSTYLEBIT_ALL       ; > ;
+                < "All"             ; SFXSTYLEBIT_ALL_VISIBLE ; > ;
+                < "Hidden Styles"   ; SFXSTYLEBIT_HIDDEN    ; > ;
                 < "Applied Styles"  ; SFXSTYLEBIT_USED      ; > ;
                 < "Custom Styles"   ; SFXSTYLEBIT_USERDEF   ; > ;
             };
@@ -133,7 +136,8 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
             StyleFamily = SFX_STYLE_FAMILY_PAGE ;
             FilterList [ en-US ] =
             {
-                < "All"             ; SFXSTYLEBIT_ALL       ; > ;
+                < "All"             ; SFXSTYLEBIT_ALL_VISIBLE ; > ;
+                < "Hidden Styles"   ; SFXSTYLEBIT_HIDDEN    ; > ;
                 < "Applied Styles"  ; SFXSTYLEBIT_USED      ; > ;
                 < "Custom Styles"   ; SFXSTYLEBIT_USERDEF   ; > ;
             };
@@ -143,7 +147,8 @@ SfxStyleFamilies DLG_STYLE_DESIGNER
             StyleFamily = SFX_STYLE_FAMILY_PSEUDO ;
             FilterList [ en-US ] =
             {
-                < "All"             ; SFXSTYLEBIT_ALL       ; > ;
+                < "All"             ; SFXSTYLEBIT_ALL_VISIBLE ; > ;
+                < "Hidden Styles"   ; SFXSTYLEBIT_HIDDEN    ; > ;
                 < "Applied Styles"  ; SFXSTYLEBIT_USED      ; > ;
                 < "Custom Styles"   ; SFXSTYLEBIT_USERDEF   ; > ;
             };
diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
index e881cb1..f6f96f8 100644
--- a/sw/source/ui/app/docstyle.cxx
+++ b/sw/source/ui/app/docstyle.cxx
@@ -2518,6 +2518,7 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
     bool bSearchHidden = ( nMask & SFXSTYLEBIT_HIDDEN );
 
     const sal_Bool bOrganizer = ((SwDocStyleSheetPool*)pBasePool)->IsOrganizerMode();
+    bool bAll = ( nSrchMask & SFXSTYLEBIT_ALL_VISIBLE ) == SFXSTYLEBIT_ALL_VISIBLE;
 
     if( nSearchFamily == SFX_STYLE_FAMILY_CHAR
      || nSearchFamily == SFX_STYLE_FAMILY_ALL )
@@ -2561,7 +2562,7 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
 
         // PoolFormate
         //
-        if( nSrchMask == SFXSTYLEBIT_ALL )
+        if( bAll )
         {
             if( !rDoc.get(IDocumentSettingAccess::HTML_MODE) )
                 AppendStyleList(SwStyleNameMapper::GetChrFmtUINameArray(),
@@ -2589,7 +2590,7 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
         if( rDoc.get(IDocumentSettingAccess::HTML_MODE) )
         {
             // then only HTML-Template are of interest
-            if( SFXSTYLEBIT_ALL == nSMask )
+            if( SFXSTYLEBIT_ALL_VISIBLE == ( nSMask & SFXSTYLEBIT_ALL_VISIBLE ) )
                 nSMask = SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF |
                             SFXSTYLEBIT_USED;
             else
@@ -2675,7 +2676,7 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
             aLst.Append( cPARA, pColl->GetName() );
         }
 
-        const sal_Bool bAll = nSMask == SFXSTYLEBIT_ALL;
+        bAll = ( nSMask & SFXSTYLEBIT_ALL_VISIBLE ) == SFXSTYLEBIT_ALL_VISIBLE;
         if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_TEXT )
             AppendStyleList(SwStyleNameMapper::GetTextUINameArray(),
                             bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA );
@@ -2770,7 +2771,7 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
 
         // PoolFormate
         //
-        if ( nSrchMask == SFXSTYLEBIT_ALL )
+        if ( bAll )
             AppendStyleList(SwStyleNameMapper::GetFrmFmtUINameArray(),
                                     bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, cFRAME);
     }
@@ -2796,7 +2797,7 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
 
             aLst.Append( cPAGE, rDesc.GetName() );
         }
-        if ( nSrchMask == SFXSTYLEBIT_ALL )
+        if ( bAll )
             AppendStyleList(SwStyleNameMapper::GetPageDescUINameArray(),
                             bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, cPAGE);
     }
@@ -2824,7 +2825,7 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
                 aLst.Append( cNUMRULE, rRule.GetName() );
             }
         }
-        if ( nSrchMask == SFXSTYLEBIT_ALL )
+        if ( bAll )
             AppendStyleList(SwStyleNameMapper::GetNumRuleUINameArray(),
                             bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, cNUMRULE);
     }
commit 2fd9c2bf9af0c50dae3af3dbe5e22965ccdb4ae7
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Sun Nov 25 15:24:42 2012 +0100

    Allow to hide styles in the "Styles & Formating" dialog
    
    In its current state, the feature only hides the styles. Things to sort
    out are:
     + Add some automatic filter to show hidden styles
     + Make the visibility persist in the file format
    
    Change-Id: I5904f41bb567add7b6bf501c6c5297f9f149a915

diff --git a/sc/inc/stlpool.hxx b/sc/inc/stlpool.hxx
index 5cbca39..f2a0255 100644
--- a/sc/inc/stlpool.hxx
+++ b/sc/inc/stlpool.hxx
@@ -54,7 +54,7 @@ public:
     const String*       GetForceStdName() const { return pForceStdName; }
 
     virtual SfxStyleSheetBase& Make( const String&, SfxStyleFamily eFam,
-                                     sal_uInt16 nMask = 0xffff, sal_uInt16 nPos = 0xffff );
+                                     sal_uInt16 nMask = SFXSTYLEBIT_ALL, sal_uInt16 nPos = 0xffff );
 
 protected:
     virtual             ~ScStyleSheetPool();
diff --git a/sc/sdi/drawsh.sdi b/sc/sdi/drawsh.sdi
index 98fe422..d7e3c1a 100644
--- a/sc/sdi/drawsh.sdi
+++ b/sc/sdi/drawsh.sdi
@@ -57,6 +57,7 @@ interface TableDraw
     SID_STYLE_NEW               [ StateMethod = StateDisableItems; Export = FALSE; ]
     SID_STYLE_EDIT              [ StateMethod = StateDisableItems; Export = FALSE; ]
     SID_STYLE_DELETE            [ StateMethod = StateDisableItems; Export = FALSE; ]
+    SID_STYLE_HIDE              [ StateMethod = StateDisableItems; Export = FALSE; ]
 
      //----------------------------------------------------------------------------
     SID_TEXT_STANDARD       [ ExecMethod = ExecDrawAttr; StateMethod = NoState; Export = FALSE; ]
diff --git a/sc/sdi/drtxtob.sdi b/sc/sdi/drtxtob.sdi
index dce59dc..d17d285 100644
--- a/sc/sdi/drtxtob.sdi
+++ b/sc/sdi/drtxtob.sdi
@@ -54,6 +54,7 @@ interface TableDrawText
     SID_STYLE_NEW               [ StateMethod = StateDisableItems; Export = FALSE; ]
     SID_STYLE_EDIT              [ StateMethod = StateDisableItems; Export = FALSE; ]
     SID_STYLE_DELETE            [ StateMethod = StateDisableItems; Export = FALSE; ]
+    SID_STYLE_HIDE              [ StateMethod = StateDisableItems; Export = FALSE; ]
 
      //----------------------------------------------------------------------------
     SID_CUT             [ ExecMethod = Execute; StateMethod = GetState; Export = FALSE; ]
diff --git a/sc/sdi/formatsh.sdi b/sc/sdi/formatsh.sdi
index 8b84a7b..0304f61 100644
--- a/sc/sdi/formatsh.sdi
+++ b/sc/sdi/formatsh.sdi
@@ -67,6 +67,7 @@ interface FormatForSelection
     SID_STYLE_FAMILY4           [ ExecMethod = ExecuteStyle; StateMethod = GetStyleState; ]
     SID_STYLE_EDIT              [ ExecMethod = ExecuteStyle; StateMethod = GetStyleState; ]
     SID_STYLE_DELETE            [ ExecMethod = ExecuteStyle; StateMethod = GetStyleState; ]
+    SID_STYLE_HIDE            [ ExecMethod = ExecuteStyle; StateMethod = GetStyleState; ]
     // } Slot's die in der DrawShell disabled werden.
 
     SID_ATTR_ALIGN_HOR_JUSTIFY    [ ExecMethod = ExecuteAlignment; StateMethod = GetAttrState; ]
diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index 47315b3..b9268dd 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -241,7 +241,7 @@ SfxStyleSheetBasePool* ScDocShell::GetStyleSheetPool()
 
 static void lcl_AdjustPool( SfxStyleSheetBasePool* pStylePool )
 {
-    pStylePool->SetSearchMask(SFX_STYLE_FAMILY_PAGE, 0xffff);
+    pStylePool->SetSearchMask(SFX_STYLE_FAMILY_PAGE, SFXSTYLEBIT_ALL);
     SfxStyleSheetBase *pStyle = pStylePool->First();
     while ( pStyle )
     {
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 7d98e45..305e44b 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -233,6 +233,7 @@ void ScFormatShell::GetStyleState( SfxItemSet& rSet )
 
             case SID_STYLE_EDIT:
             case SID_STYLE_DELETE:
+            case SID_STYLE_HIDE:
             {
                 ISfxTemplateCommon* pDesigner = SFX_APP()->
                         GetCurrentTemplateCommon(pTabViewShell->GetViewFrame()->GetBindings());
@@ -278,6 +279,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
     if (   (nSlotId == SID_STYLE_NEW)
         || (nSlotId == SID_STYLE_EDIT)
         || (nSlotId == SID_STYLE_DELETE)
+        || (nSlotId == SID_STYLE_HIDE)
         || (nSlotId == SID_STYLE_APPLY)
         || (nSlotId == SID_STYLE_WATERCAN)
         || (nSlotId == SID_STYLE_FAMILY)
@@ -362,6 +364,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
             }
             case SID_STYLE_EDIT:
             case SID_STYLE_DELETE:
+            case SID_STYLE_HIDE:
             case SID_STYLE_NEW_BY_EXAMPLE:
                 {
                     const SfxPoolItem* pNameItem;
@@ -445,6 +448,19 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
                     }
                     break;
 
+                    case SID_STYLE_HIDE:
+                    {
+                        if ( pStyleSheet )
+                        {
+                            pStyleSheet->SetHidden( true );
+                            pTabViewShell->InvalidateAttribs();
+                            rReq.Done();
+                        }
+                        else
+                            nRetMask = false;
+                    }
+                    break;
+
                     case SID_STYLE_APPLY:
                     {
                         if ( pStyleSheet && !pScMod->GetIsWaterCan() )
@@ -602,6 +618,19 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
                     }
                     break;
 
+                    case SID_STYLE_HIDE:
+                    {
+                        nRetMask = ( NULL != pStyleSheet );
+                        if ( pStyleSheet )
+                        {
+                            pStyleSheet->SetHidden( true );
+                            rBindings.Invalidate( SID_STYLE_FAMILY4 );
+                            pDocSh->SetDocumentModified();
+                            rReq.Done();
+                        }
+                    }
+                    break;
+
                     case SID_STYLE_APPLY:
                     {
                         nRetMask = ( NULL != pStyleSheet );
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index fc2f01e..0fabae4 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -1366,6 +1366,13 @@ interface DrawView
         GroupId = GID_DOCUMENT ;
         Cachable ;
     ]
+    SID_STYLE_HIDE
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetAttrState ;
+        GroupId = GID_DOCUMENT ;
+        Cachable ;
+    ]
     SID_STYLE_APPLY // ole : no, status : ?
     [
         ExecMethod = FuTemporary ;
diff --git a/sd/sdi/outlnvsh.sdi b/sd/sdi/outlnvsh.sdi
index ec06d37..6632f09 100644
--- a/sd/sdi/outlnvsh.sdi
+++ b/sd/sdi/outlnvsh.sdi
@@ -326,6 +326,13 @@ interface OutlineView
         GroupId = GID_DOCUMENT ;
         Cachable ;
     ]
+    SID_STYLE_HIDE
+    [
+        ExecMethod = FuTemporary ;
+        StateMethod = GetAttrState ;
+        GroupId = GID_DOCUMENT ;
+        Cachable ;
+    ]
     SID_AUTOSPELL_CHECK // ole : no, status : play rec
     [
         ExecMethod = FuSupport ;
diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx
index 1326e51..f1d9fea 100644
--- a/sd/source/ui/func/futempl.cxx
+++ b/sd/source/ui/func/futempl.cxx
@@ -128,13 +128,14 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
     }
 
     String aStyleName;
-    sal_uInt16 nRetMask = 0xffff;
+    sal_uInt16 nRetMask = SFXSTYLEBIT_ALL;
 
     switch( nSId )
     {
         case SID_STYLE_APPLY:
         case SID_STYLE_EDIT:
         case SID_STYLE_DELETE:
+        case SID_STYLE_HIDE:
         case SID_STYLE_FAMILY:
         case SID_STYLE_NEW_BY_EXAMPLE:
         {
@@ -225,6 +226,12 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
             }
         break;
 
+        case SID_STYLE_HIDE:
+            pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
+            pStyleSheet->SetHidden( true );
+            nRetMask = sal_True;
+        break;
+
         case SID_STYLE_APPLY:
             // Anwenden der Vorlage auf das Dokument
             pStyleSheet = pSSPool->Find( aStyleName, (SfxStyleFamily) nFamily);
@@ -666,7 +673,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
         break;
 
     }
-    if( nRetMask != 0xffff )
+    if( nRetMask != SFXSTYLEBIT_ALL )
         rReq.SetReturnValue( SfxUInt16Item( nSId, nRetMask ) );
 }
 
diff --git a/sd/source/ui/view/drviewsc.cxx b/sd/source/ui/view/drviewsc.cxx
index cfecc20..9074fc2 100644
--- a/sd/source/ui/view/drviewsc.cxx
+++ b/sd/source/ui/view/drviewsc.cxx
@@ -539,6 +539,7 @@ void DrawViewShell::FuTemp03(SfxRequest& rReq)
         case SID_STYLE_APPLY:
         case SID_STYLE_EDIT:
         case SID_STYLE_DELETE:
+        case SID_STYLE_HIDE:
         case SID_STYLE_FAMILY:
         case SID_STYLE_WATERCAN:
         case SID_STYLE_UPDATE_BY_EXAMPLE:
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index 2b52207..881722d 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -1518,6 +1518,7 @@ sal_Bool OutlineViewShell::KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin)
     Invalidate(SID_STYLE_EDIT);
     Invalidate(SID_STYLE_NEW);
     Invalidate(SID_STYLE_DELETE);
+    Invalidate(SID_STYLE_HIDE);
     Invalidate(SID_STYLE_UPDATE_BY_EXAMPLE);
     Invalidate(SID_STYLE_NEW_BY_EXAMPLE);
     Invalidate(SID_STYLE_WATERCAN);
@@ -1710,6 +1711,7 @@ void OutlineViewShell::GetAttrState( SfxItemSet& rSet )
 
             case SID_STYLE_NEW:
             case SID_STYLE_DELETE:
+            case SID_STYLE_HIDE:
             case SID_STYLE_NEW_BY_EXAMPLE:
             case SID_STYLE_WATERCAN:
             {
@@ -1740,6 +1742,7 @@ void OutlineViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin
     Invalidate(SID_STYLE_EDIT);
     Invalidate(SID_STYLE_NEW);
     Invalidate(SID_STYLE_DELETE);
+    Invalidate(SID_STYLE_HIDE);
     Invalidate(SID_STYLE_UPDATE_BY_EXAMPLE);
     Invalidate(SID_STYLE_NEW_BY_EXAMPLE);
     Invalidate(SID_STYLE_WATERCAN);
diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc
index 0998c65..34bc07f 100644
--- a/sfx2/inc/sfx2/sfxsids.hrc
+++ b/sfx2/inc/sfx2/sfxsids.hrc
@@ -359,6 +359,7 @@
 #define SID_STYLE_UPDATE_BY_EXAMPLE         (SID_SFX_START + 556)
 #define SID_STYLE_DRAGHIERARCHIE            (SID_SFX_START + 565)
 #define SID_STYLE_MASK                      (SID_SFX_START + 562)
+#define SID_STYLE_HIDE                      (SID_SFX_START + 1603)
 #define SID_STYLE_UPD_BY_EX_NAME            (SID_SFX_START + 1585)
 #define SID_STYLE_REFERENCE                 (SID_SFX_START + 1602)
 
diff --git a/sfx2/inc/sfx2/tplpitem.hxx b/sfx2/inc/sfx2/tplpitem.hxx
index 71cfba4..58f0618 100644
--- a/sfx2/inc/sfx2/tplpitem.hxx
+++ b/sfx2/inc/sfx2/tplpitem.hxx
@@ -24,6 +24,7 @@
 #include <tools/string.hxx>
 #include <tools/rtti.hxx>
 #include <svl/flagitem.hxx>
+#include <svl/style.hrc>
 
 class SFX2_DLLPUBLIC SfxTemplateItem: public SfxFlagItem
 {
@@ -33,7 +34,7 @@ public:
     SfxTemplateItem();
     SfxTemplateItem( sal_uInt16 nWhich,
                      const String &rStyle,
-                     sal_uInt16 nMask = 0xffff );
+                     sal_uInt16 nMask = SFXSTYLEBIT_ALL );
     SfxTemplateItem( const SfxTemplateItem& );
 
     const String&           GetStyleName() const { return aStyle; }
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index a7468ce..c269dea 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -1661,6 +1661,31 @@ SfxUInt16Item EditStyle SID_STYLE_EDIT
 ]
 
 //--------------------------------------------------------------------------
+SfxUInt16Item HideStyle SID_STYLE_HIDE
+(SfxStringItem Param SID_STYLE_HIDE,SfxUInt16Item Family SID_STYLE_FAMILY)
+[
+    /* flags: */
+    AutoUpdate = FALSE,
+    Cachable = Cachable,
+    FastCall = FALSE,
+    HasCoreId = FALSE,
+    HasDialog = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Synchron;
+
+    /* config: */
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    StatusBarConfig = FALSE,
+    ToolBoxConfig = FALSE,
+    GroupId = GID_TEMPLATE;
+]
+
+//--------------------------------------------------------------------------
 SfxVoidItem ExecuteSearch FID_SEARCH_NOW
 (SvxSearchItem SearchItem SID_SEARCH_ITEM, SfxBoolItem Quiet SID_SEARCH_QUIET )
 [
diff --git a/sfx2/source/dialog/dialog.hrc b/sfx2/source/dialog/dialog.hrc
index e27579d..80e04d8 100644
--- a/sfx2/source/dialog/dialog.hrc
+++ b/sfx2/source/dialog/dialog.hrc
@@ -26,6 +26,7 @@
 #define ID_NEW                          1
 #define ID_EDIT                         2
 #define ID_DELETE                       3
+#define ID_HIDE                         4
 
 #define RC_DIALOG_BEGIN                 RID_SFX_DIALOG_START
 
diff --git a/sfx2/source/dialog/dialog.src b/sfx2/source/dialog/dialog.src
index 725d519..4bcd140 100644
--- a/sfx2/source/dialog/dialog.src
+++ b/sfx2/source/dialog/dialog.src
@@ -81,6 +81,11 @@ Menu MN_CONTEXT_TEMPLDLG
         };
         MenuItem
         {
+            Identifier = ID_HIDE ;
+            Text [ en-US ] = "Hide..." ;
+        };
+        MenuItem
+        {
             Identifier = ID_DELETE ;
             Text [ en-US ] = "Delete..." ;
             HelpId = HID_STYLIST_DELETE ;
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index a4d9c9c..25ea1ba 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -763,6 +763,7 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, Sfx
     bCanEdit                ( sal_False ),
     bCanDel                 ( sal_False ),
     bCanNew                 ( sal_True ),
+    bCanHide                ( sal_True ),
     bWaterDisabled          ( sal_False ),
     bNewByExampleDisabled   ( sal_False ),
     bUpdateByExampleDisabled( sal_False ),
@@ -808,6 +809,7 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, Mod
     bCanEdit                ( sal_False ),
     bCanDel                 ( sal_False ),
     bCanNew                 ( sal_True ),
+    bCanHide                ( sal_True ),
     bWaterDisabled          ( sal_False ),
     bNewByExampleDisabled   ( sal_False ),
     bUpdateByExampleDisabled( sal_False ),
@@ -856,8 +858,8 @@ void SfxCommonTemplateDialog_Impl::ReadResource()
     else
         pStyleFamilies = new SfxStyleFamilies( aFamId );
 
-    nActFilter = pCurObjShell ? static_cast< sal_uInt16 >( LoadFactoryStyleFilter( pCurObjShell ) ) : 0xFFFF;
-    if ( pCurObjShell && 0xFFFF == nActFilter )
+    nActFilter = pCurObjShell ? static_cast< sal_uInt16 >( LoadFactoryStyleFilter( pCurObjShell ) ) : SFXSTYLEBIT_ALL;
+    if ( pCurObjShell && SFXSTYLEBIT_ALL == nActFilter )
         nActFilter = pCurObjShell->GetAutoStyleFilterIndex();
 
     // Paste in the toolbox
@@ -1062,11 +1064,18 @@ void SfxCommonTemplateDialog_Impl::SelectStyle(const String &rStr)
     if ( !pItem )
         return;
     const SfxStyleFamily eFam = pItem->GetFamily();
-    SfxStyleSheetBase* pStyle = pStyleSheetPool->Find( rStr, eFam, SFXSTYLEBIT_ALL );
+    SfxStyleSheetBase* pStyle = pStyleSheetPool->Find( rStr, eFam, SFXSTYLEBIT_ALL | SFXSTYLEBIT_HIDDEN );
     if( pStyle )
-        EnableEdit( !(pStyle->GetMask() & SFXSTYLEBIT_READONLY) );
+    {
+        bool bReadWrite = !(pStyle->GetMask() & SFXSTYLEBIT_READONLY);
+        EnableEdit( bReadWrite );
+        EnableHide( bReadWrite && !pStyle->IsHidden( ) && !pStyle->IsUsed( ) );
+    }
     else
-        EnableEdit(sal_False);
+    {
+        EnableEdit( sal_False );
+        EnableHide( sal_False );
+    }
 
     if ( pTreeBox )
     {
@@ -1110,6 +1119,7 @@ void SfxCommonTemplateDialog_Impl::SelectStyle(const String &rStr)
         {
             aFmtLb.SelectAll( sal_False );
             EnableEdit(sal_False);
+            EnableHide( sal_False );
         }
     }
 }
@@ -1477,7 +1487,7 @@ void SfxCommonTemplateDialog_Impl::Update_Impl()
          // other DocShell -> all new
          CheckItem( nActFamily, sal_True );
          nActFilter = static_cast< sal_uInt16 >( LoadFactoryStyleFilter( pDocShell ) );
-         if ( 0xFFFF == nActFilter )
+         if ( SFXSTYLEBIT_ALL == nActFilter )
             nActFilter = pDocShell->GetAutoStyleFilterIndex();
 
          nAppFilter = pItem->GetValue();
@@ -1579,12 +1589,18 @@ void SfxCommonTemplateDialog_Impl::Notify(SfxBroadcaster& /*rBC*/, const SfxHint
                         const SfxStyleFamily eFam = pItem->GetFamily();
                         SfxStyleSheetBase *pStyle =
                             pStyleSheetPool->Find(
-                                aStr, eFam, SFXSTYLEBIT_ALL );
+                                aStr, eFam, SFXSTYLEBIT_ALL | SFXSTYLEBIT_HIDDEN );
                         if( pStyle )
-                            EnableEdit(
-                                !(pStyle->GetMask() & SFXSTYLEBIT_READONLY) );
+                        {
+                            bool bReadWrite = !(pStyle->GetMask() & SFXSTYLEBIT_READONLY);
+                            EnableEdit( bReadWrite );
+                            EnableHide( bReadWrite && !pStyle->IsUsed( ) && !pStyle->IsHidden( ) );
+                        }
                         else
+                        {
                             EnableEdit(sal_False);
+                            EnableHide(sal_False);
+                        }
                     }
                 }
                 break;
@@ -1834,7 +1850,7 @@ void SfxCommonTemplateDialog_Impl::ActionSelect(sal_uInt16 nEntry)
                 const SfxStyleFamily eFam=GetFamilyItem_Impl()->GetFamily();
                 const SfxStyleFamilyItem *pItem = GetFamilyItem_Impl();
                 sal_uInt16 nFilter;
-                if( pItem && nActFilter != 0xffff )
+                if( pItem && nActFilter != SFXSTYLEBIT_ALL )
                 {
                     nFilter = pItem->GetFilterList()[ nActFilter ]->nFlags;
                     if(!nFilter)    // automatisch
@@ -1956,7 +1972,7 @@ void SfxCommonTemplateDialog_Impl::NewHdl(void *)
         const SfxStyleFamilyItem *pItem = GetFamilyItem_Impl();
         const SfxStyleFamily eFam=pItem->GetFamily();
         sal_uInt16 nMask;
-        if( pItem && nActFilter != 0xffff )
+        if( pItem && nActFilter != SFXSTYLEBIT_ALL )
         {
             nMask = pItem->GetFilterList()[ nActFilter ]->nFlags;
             if(!nMask)    // automatic
@@ -2044,6 +2060,20 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl(void *)
     }
 }
 
+void SfxCommonTemplateDialog_Impl::HideHdl(void *)
+{
+    if ( IsInitialized() && HasSelectedStyle() )
+    {
+        const String aTemplName( GetSelectedEntry() );
+        SfxStyleSheetBase* pStyle = GetSelectedStyle();
+        if ( pStyle )
+        {
+            Execute_Impl( SID_STYLE_HIDE, aTemplName,
+                          String(), (sal_uInt16)GetFamilyItem_Impl()->GetFamily() );
+        }
+    }
+}
+
 //-------------------------------------------------------------------------
 
 void    SfxCommonTemplateDialog_Impl::EnableDelete()
@@ -2060,7 +2090,7 @@ void    SfxCommonTemplateDialog_Impl::EnableDelete()
         if(!nFilter)    // automatic
             nFilter = nAppFilter;
         const SfxStyleSheetBase *pStyle =
-            pStyleSheetPool->Find(aTemplName,eFam, pTreeBox? SFXSTYLEBIT_ALL: nFilter);
+            pStyleSheetPool->Find(aTemplName,eFam, pTreeBox? SFXSTYLEBIT_ALL | SFXSTYLEBIT_HIDDEN : nFilter);
 
         OSL_ENSURE(pStyle, "Style ot found");
         if(pStyle && pStyle->IsUserDefined())
@@ -2160,6 +2190,7 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, MenuSelectHdl, Menu *, pMenu )
     case ID_NEW: NewHdl(0); break;
     case ID_EDIT: EditHdl(0); break;
     case ID_DELETE: DeleteHdl(0); break;
+    case ID_HIDE: HideHdl(0); break;
     default: return sal_False;
     }
     return sal_True;
@@ -2218,6 +2249,7 @@ PopupMenu* SfxCommonTemplateDialog_Impl::CreateContextMenu( void )
     pMenu->EnableItem( ID_EDIT, bCanEdit );
     pMenu->EnableItem( ID_DELETE, bCanDel );
     pMenu->EnableItem( ID_NEW, bCanNew );
+    pMenu->EnableItem( ID_HIDE, bCanHide );
 
     return pMenu;
 }
diff --git a/sfx2/source/dialog/tplcitem.cxx b/sfx2/source/dialog/tplcitem.cxx
index 420f9b3..314a39a 100644
--- a/sfx2/source/dialog/tplcitem.cxx
+++ b/sfx2/source/dialog/tplcitem.cxx
@@ -118,6 +118,9 @@ void SfxTemplateControllerItem::StateChanged( sal_uInt16 nSID, SfxItemState eSta
         case SID_STYLE_DELETE:
             rTemplateDlg.EnableDel( SFX_ITEM_DISABLED != eState );
             break;
+        case SID_STYLE_HIDE:
+            rTemplateDlg.EnableHide( SFX_ITEM_DISABLED != eState );
+            break;
         case SID_STYLE_NEW_BY_EXAMPLE:
 
             rTemplateDlg.EnableExample_Impl(
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index af77983..c532a31 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -793,7 +793,7 @@ void SfxObjectShell::LoadStyles
     DBG_ASSERT(pSourcePool, "Source-DocumentShell ohne StyleSheetPool");
     SfxStyleSheetBasePool *pMyPool = GetStyleSheetPool();
     DBG_ASSERT(pMyPool, "Dest-DocumentShell ohne StyleSheetPool");
-    pSourcePool->SetSearchMask(SFX_STYLE_FAMILY_ALL, 0xffff);
+    pSourcePool->SetSearchMask(SFX_STYLE_FAMILY_ALL, SFXSTYLEBIT_ALL);
     Styles_Impl *pFound = new Styles_Impl[pSourcePool->Count()];
     sal_uInt16 nFound = 0;
 
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx
index 12fe315..821695a 100644
--- a/sfx2/source/inc/templdgi.hxx
+++ b/sfx2/source/inc/templdgi.hxx
@@ -158,6 +158,7 @@ protected:
                                 bCanEdit                :1,
                                 bCanDel                 :1,
                                 bCanNew                 :1,
+                                bCanHide                :1,
                                 bWaterDisabled          :1,
                                 bNewByExampleDisabled   :1,
                                 bUpdateByExampleDisabled:1,
@@ -183,9 +184,10 @@ protected:
     virtual void        ClearFamilyList() = 0;
     virtual void        ReplaceUpdateButtonByMenu();
 
-        void                NewHdl( void* );
+    void                NewHdl( void* );
     void                EditHdl( void* );
     void                DeleteHdl( void* );
+    void                HideHdl( void* );
 
     sal_Bool                Execute_Impl( sal_uInt16 nId, const String& rStr, const String& rRefStr,
                                       sal_uInt16 nFamily, sal_uInt16 nMask = 0,
@@ -234,6 +236,7 @@ public:
     virtual void        EnableEdit( sal_Bool b = sal_True ) { bCanEdit = b; }
     virtual void        EnableDel( sal_Bool b = sal_True )  { bCanDel = b; }
     virtual void        EnableNew( sal_Bool b = sal_True )  { bCanNew = b; }
+    virtual void        EnableHide( sal_Bool b = sal_True )  { bCanHide = b; }
 
     ISfxTemplateCommon* GetISfxTemplateCommon() { return &aISfxTemplateCommon; }
     Window*             GetWindow() { return pWindow; }
@@ -250,6 +253,7 @@ public:
     inline sal_Bool         CanEdit( void ) const   { return bCanEdit; }
     inline sal_Bool         CanDel( void ) const    { return bCanDel; }
     inline sal_Bool         CanNew( void ) const    { return bCanNew; }
+    inline sal_Bool         CanHide( void ) const    { return bCanHide; }
 
     // normaly for derivates from SvTreeListBoxes, but in this case the dialog handles context menus
     virtual PopupMenu*  CreateContextMenu( void );
diff --git a/svl/inc/svl/style.hrc b/svl/inc/svl/style.hrc
index a4fea6d..ae08df4 100644
--- a/svl/inc/svl/style.hrc
+++ b/svl/inc/svl/style.hrc
@@ -20,9 +20,10 @@
 #define _SFX_STYLE_HRC
 
 #define SFXSTYLEBIT_AUTO     0x0000 // automatisch; Flags kommen von der Applikation
+#define SFXSTYLEBIT_HIDDEN   0x0200 // benutzte Vorlage (als Suchmaske)
 #define SFXSTYLEBIT_READONLY 0x2000 // benutzte Vorlage (als Suchmaske)
 #define SFXSTYLEBIT_USED     0x4000 // benutzte Vorlage (als Suchmaske)
 #define SFXSTYLEBIT_USERDEF  0x8000 // benutzerdefinierte Vorlage
-#define SFXSTYLEBIT_ALL      0xFFFF // alle Vorlagen
+#define SFXSTYLEBIT_ALL      0xFDFF // alle Vorlagen
 
 #endif
diff --git a/svl/inc/svl/style.hxx b/svl/inc/svl/style.hxx
index f0878c4..48557c5 100644
--- a/svl/inc/svl/style.hxx
+++ b/svl/inc/svl/style.hxx
@@ -90,6 +90,7 @@ protected:
     sal_uLong               nHelpId;        // Hilfe-ID
 
     bool                    bMySet;         // sal_True: Set loeschen im dtor
+    bool                    bHidden;
 
     SfxStyleSheetBase( const UniString&, SfxStyleSheetBasePool*, SfxStyleFamily eFam, sal_uInt16 mask );
     SfxStyleSheetBase( const SfxStyleSheetBase& );
@@ -133,6 +134,9 @@ public:
     bool     IsUserDefined() const
            { return ( nMask & SFXSTYLEBIT_USERDEF) != 0; }
 
+    virtual sal_Bool IsHidden() const { return bHidden; }
+    virtual void SetHidden( sal_Bool bValue );
+
     virtual sal_uLong GetHelpId( String& rFile );
     virtual void   SetHelpId( const String& r, sal_uLong nId );
 
@@ -157,7 +161,7 @@ class SVL_DLLPUBLIC SfxStyleSheetIterator
 {
 public:
     SfxStyleSheetIterator(SfxStyleSheetBasePool *pBase,
-                          SfxStyleFamily eFam, sal_uInt16 n=0xFFFF );
+                          SfxStyleFamily eFam, sal_uInt16 n=SFXSTYLEBIT_ALL );
     virtual sal_uInt16 GetSearchMask() const;
     virtual SfxStyleFamily GetSearchFamily() const;
     virtual sal_uInt16 Count();
@@ -229,7 +233,7 @@ public:
 
     virtual SfxStyleSheetBase&  Make(const UniString&,
                                      SfxStyleFamily eFam,
-                                     sal_uInt16 nMask = 0xffff ,
+                                     sal_uInt16 nMask = SFXSTYLEBIT_ALL ,
                                      sal_uInt16 nPos = 0xffff);
 
     virtual void             Replace(
@@ -246,7 +250,7 @@ public:
     const SfxStyles&            GetStyles();
     virtual SfxStyleSheetBase*  First();
     virtual SfxStyleSheetBase*  Next();
-    virtual SfxStyleSheetBase*  Find( const UniString&, SfxStyleFamily eFam, sal_uInt16 n=0xFFFF );
+    virtual SfxStyleSheetBase*  Find( const UniString&, SfxStyleFamily eFam, sal_uInt16 n=SFXSTYLEBIT_ALL );
 
     virtual bool                SetParent(SfxStyleFamily eFam,
                                           const UniString &rStyle,
@@ -255,7 +259,7 @@ public:
     SfxStyleSheetBase*          Find(const UniString& rStr)
                                 { return Find(rStr, nSearchFamily, nMask); }
 
-    void                        SetSearchMask(SfxStyleFamily eFam, sal_uInt16 n=0xFFFF );
+    void                        SetSearchMask(SfxStyleFamily eFam, sal_uInt16 n=SFXSTYLEBIT_ALL );
     sal_uInt16                      GetSearchMask() const;
     SfxStyleFamily              GetSearchFamily() const  { return nSearchFamily; }
 };
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index 3c1f9b7..15deda6 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -89,7 +89,6 @@ SfxStyleSheetHint::SfxStyleSheetHint
 class SfxStyleSheetBasePool_Impl
 {
   public:
-    SfxStyles aStyles;
     SfxStyleSheetIterator *pIter;
     SfxStyleSheetBasePool_Impl() : pIter(0){}
     ~SfxStyleSheetBasePool_Impl(){delete pIter;}
@@ -110,6 +109,7 @@ SfxStyleSheetBase::SfxStyleSheetBase( const XubString& rName, SfxStyleSheetBaseP
     , nMask(mask)
     , nHelpId( 0 )
     , bMySet( sal_False )
+    , bHidden( sal_False )
 {
 #ifdef DBG_UTIL
     aDbgStyleSheetReferences.mnStyles++;
@@ -127,6 +127,7 @@ SfxStyleSheetBase::SfxStyleSheetBase( const SfxStyleSheetBase& r )
     , nMask( r.nMask )
     , nHelpId( r.nHelpId )
     , bMySet( r.bMySet )
+    , bHidden( r.bHidden )
 {
 #ifdef DBG_UTIL
     aDbgStyleSheetReferences.mnStyles++;
@@ -241,6 +242,12 @@ bool SfxStyleSheetBase::SetParent( const XubString& rName )
     return true;
 }
 
+void SfxStyleSheetBase::SetHidden( sal_Bool hidden )
+{
+    bHidden = hidden;
+    pPool->Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) );
+}
+
 // Follow aendern
 
 const XubString& SfxStyleSheetBase::GetFollow() const
@@ -362,16 +369,21 @@ SfxStyleFamily SfxStyleSheetIterator::GetSearchFamily() const
 
 inline bool SfxStyleSheetIterator::IsTrivialSearch()
 {
-    return nMask == 0xFFFF && GetSearchFamily() == SFX_STYLE_FAMILY_ALL;
+    return nMask == SFXSTYLEBIT_ALL && GetSearchFamily() == SFX_STYLE_FAMILY_ALL;
 }
 
 bool SfxStyleSheetIterator::DoesStyleMatch(SfxStyleSheetBase *pStyle)
 {
-    return ((GetSearchFamily() == SFX_STYLE_FAMILY_ALL) ||
+    bool bSearchHidden = ( GetSearchMask() & SFXSTYLEBIT_HIDDEN );
+    bool bMatchVisibility = bSearchHidden || !pStyle->IsHidden();
+
+    bool bMatches = ((GetSearchFamily() == SFX_STYLE_FAMILY_ALL) ||
             ( pStyle->GetFamily() == GetSearchFamily() ))
         && (( pStyle->GetMask() & ( GetSearchMask() & ~SFXSTYLEBIT_USED )) ||
             ( bSearchUsed ? pStyle->IsUsed() : false ) ||
-            GetSearchMask() == SFXSTYLEBIT_ALL );
+            GetSearchMask() == SFXSTYLEBIT_ALL )
+        && bMatchVisibility;
+    return bMatches;
 }
 
 
@@ -544,7 +556,7 @@ SfxStyleSheetBasePool::SfxStyleSheetBasePool( SfxItemPool& r )
     : aAppName(r.GetName())
     , rPool(r)
     , nSearchFamily(SFX_STYLE_FAMILY_PARA)
-    , nMask(0xFFFF)
+    , nMask(SFXSTYLEBIT_ALL)
 {
 #ifdef DBG_UTIL
     aDbgStyleSheetReferences.mnPools++;
@@ -808,7 +820,7 @@ void SfxStyleSheetBasePool::ChangeParent(const XubString& rOld,
                                          bool bVirtual)
 {
     const sal_uInt16 nTmpMask = GetSearchMask();
-    SetSearchMask(GetSearchFamily(), 0xffff);
+    SetSearchMask(GetSearchFamily(), SFXSTYLEBIT_ALL);
     for( SfxStyleSheetBase* p = First(); p; p = Next() )
     {
         if( p->GetParent().Equals( rOld ) )
@@ -872,14 +884,14 @@ bool SfxStyleSheet::SetParent( const XubString& rName )
             // aus der Benachrichtigungskette des alten
             // Parents gfs. austragen
         if(aOldParent.Len()) {
-            SfxStyleSheet *pParent = (SfxStyleSheet *)pPool->Find(aOldParent, nFamily, 0xffff);
+            SfxStyleSheet *pParent = (SfxStyleSheet *)pPool->Find(aOldParent, nFamily, SFXSTYLEBIT_ALL);
             if(pParent)
                 EndListening(*pParent);
         }
             // in die Benachrichtigungskette des neuen
             // Parents eintragen
         if(aParent.Len()) {
-            SfxStyleSheet *pParent = (SfxStyleSheet *)pPool->Find(aParent, nFamily, 0xffff);
+            SfxStyleSheet *pParent = (SfxStyleSheet *)pPool->Find(aParent, nFamily, SFXSTYLEBIT_ALL);
             if(pParent)
                 StartListening(*pParent);
         }
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index 6016890..4d660e5 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -107,6 +107,7 @@ class SW_DLLPUBLIC SwDocShell: public SfxObjectShell, public SfxListener
                                     SwWrtShell* pActShell = 0,
                                     sal_Bool bBasic = sal_False );
     SW_DLLPRIVATE sal_uInt16                    Delete(const String &rName, sal_uInt16 nFamily);
+    SW_DLLPRIVATE sal_uInt16                    Hide(const String &rName, sal_uInt16 nFamily, bool bHidden);
     SW_DLLPRIVATE sal_uInt16                    ApplyStyles(const String &rName, sal_uInt16 nFamily, SwWrtShell* pShell = 0,
                                         sal_uInt16 nMode = 0 );
     SW_DLLPRIVATE sal_uInt16                    DoWaterCan( const String &rName, sal_uInt16 nFamily);
diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx
index 3385650..9c05f54 100644
--- a/sw/inc/docstyle.hxx
+++ b/sw/inc/docstyle.hxx
@@ -97,6 +97,9 @@ public:
     sal_Bool                    IsPhysical() const              { return bPhysical; }
     void                    SetPhysical(sal_Bool bPhys);
 
+    virtual void            SetHidden( sal_Bool bHidden );
+    virtual sal_Bool        IsHidden( ) const;
+
     /** add optional parameter <bResetIndentAttrsAtParagraphStyle>, default value sal_False,
      which indicates that the indent attributes at a paragraph style should
      be reset in case that a list style is applied to the paragraph style and
@@ -155,12 +158,13 @@ class SwStyleSheetIterator : public SfxStyleSheetIterator, public SfxListener
 
     void                AppendStyleList(const boost::ptr_vector<String>& rLst,
                                         sal_Bool    bUsed,
+                                        sal_Bool    bTestHidden,
                                         sal_uInt16  nSection,
                                         char    cType);
 
 public:
     SwStyleSheetIterator( SwDocStyleSheetPool* pBase,
-                          SfxStyleFamily eFam, sal_uInt16 n=0xFFFF );
+                          SfxStyleFamily eFam, sal_uInt16 n=SFXSTYLEBIT_ALL );
     virtual ~SwStyleSheetIterator();
 
     virtual sal_uInt16 Count();
@@ -193,7 +197,7 @@ public:
     virtual SfxStyleSheetBase& Make(const String&, SfxStyleFamily, sal_uInt16 nMask, sal_uInt16 nPos = 0xffff);
 
     virtual SfxStyleSheetBase* Find( const String&, SfxStyleFamily eFam,
-                                    sal_uInt16 n=0xFFFF );
+                                    sal_uInt16 n=SFXSTYLEBIT_ALL );
 
     virtual bool SetParent( SfxStyleFamily eFam, const String &rStyle,
                             const String &rParent );
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index 3fd0a35..1f178cb 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -52,6 +52,7 @@ class SW_DLLPUBLIC SwFmt : public SwModify
                                        to recognize this in FmtChg-message!! */
     sal_Bool   bAutoUpdateFmt : 1;/**< TRUE: Set attributes of a whole paragraph
                                        at format (UI-side!). */
+    bool bHidden : 1;
 
 protected:
     SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
@@ -155,6 +156,9 @@ public:
     bool IsAuto() const                 { return bAutoFmt; }
     void SetAuto( bool bNew = false )   { bAutoFmt = bNew; }
 
+    bool IsHidden() const                 { return bHidden; }
+    void SetHidden( bool bValue = false ) { bHidden = bValue; }
+
     /// Query / set bAutoUpdateFmt-flag.
     sal_Bool IsAutoUpdateFmt() const                { return bAutoUpdateFmt; }
     void SetAutoUpdateFmt( sal_Bool bNew = sal_True )   { bAutoUpdateFmt = bNew; }
diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx
index 03f281d..1fe43ba 100644
--- a/sw/inc/numrule.hxx
+++ b/sw/inc/numrule.hxx
@@ -132,6 +132,7 @@ private:
     sal_Bool bInvalidRuleFlag : 1;
     sal_Bool bContinusNum : 1;  ///< Continuous numbering without levels.
     sal_Bool bAbsSpaces : 1;    ///< Levels represent absolute indents.
+    sal_Bool bHidden : 1;       ///< Is the numering rule to be hidden in the UI?
     bool mbCountPhantoms;
 
     const SvxNumberFormat::SvxNumPositionAndSpaceMode meDefaultNumberFormatPositionAndSpaceMode;
@@ -154,6 +155,9 @@ public:
     const SwNumFmt* GetNumFmt( sal_uInt16 i ) const;
     const SwNumFmt& Get( sal_uInt16 i ) const;
 
+    sal_Bool IsHidden( ) const { return bHidden; }
+    void SetHidden( sal_Bool bValue ) { bHidden = bValue; }
+
     void Set( sal_uInt16 i, const SwNumFmt* );
     void Set( sal_uInt16 i, const SwNumFmt& );
     String MakeNumString( const SwNodeNum&, sal_Bool bInclStrings = sal_True,
diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx
index 76a6809..b6c40a8 100644
--- a/sw/inc/pagedesc.hxx
+++ b/sw/inc/pagedesc.hxx
@@ -144,6 +144,7 @@ class SW_DLLPUBLIC SwPageDesc : public SwModify
     sal_uInt16  nRegAscent; ///< For grid alignment (Registerhaltigkeit).
     UseOnPage   eUse;
     sal_Bool        bLandscape;
+    sal_Bool    bHidden;
 
     /// Footnote information.
     SwPageFtnInfo aFtnInfo;
@@ -180,6 +181,9 @@ public:
     sal_Bool IsFirstShared() const;
     void ChgFirstShare( sal_Bool bNew );
 
+    sal_Bool IsHidden( ) const { return bHidden; }
+    void SetHidden( sal_Bool bValue ) { bHidden = bValue; }
+
     inline void      SetUseOn( UseOnPage eNew );
     inline UseOnPage GetUseOn() const;
 
diff --git a/sw/sdi/_docsh.sdi b/sw/sdi/_docsh.sdi
index e1f0ae9..cfc3337 100644
--- a/sw/sdi/_docsh.sdi
+++ b/sw/sdi/_docsh.sdi
@@ -50,6 +50,12 @@ interface BaseTextDocument
         StateMethod = NoState ;
     ]
 
+    SID_STYLE_HIDE
+    [
+        ExecMethod = ExecStyleSheet ;
+        StateMethod = NoState ;
+    ]
+
     SID_TEMPLATE_LOAD
     [
         ExecMethod = Execute ;
diff --git a/sw/sdi/annotsh.sdi b/sw/sdi/annotsh.sdi
index ed99f70..9e566b2 100644
--- a/sw/sdi/annotsh.sdi
+++ b/sw/sdi/annotsh.sdi
@@ -346,6 +346,11 @@ interface Annotation : _Annotation
     [
         StateMethod = StateDisableItems ;
     ]
+
+    SID_STYLE_HIDE
+    [
+        StateMethod = StateDisableItems ;
+    ]
     FN_STAT_SELMODE
     [
         StateMethod = StateStatusLine ;
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index 78d3c36..4524937 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -43,6 +43,7 @@ SwFmt::SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
     aFmtName.AssignAscii( pFmtNm );
     bWritten = bFmtInDTOR = bAutoUpdateFmt = sal_False; // LAYER_IMPL
     bAutoFmt = sal_True;
+    bHidden = false;
 
     if( pDrvdFrm )
         aSet.SetParent( &pDrvdFrm->aSet );
@@ -62,6 +63,7 @@ SwFmt::SwFmt( SwAttrPool& rPool, const String& rFmtNm,
 {
     bWritten = bFmtInDTOR = bAutoUpdateFmt = sal_False; // LAYER_IMPL
     bAutoFmt = sal_True;
+    bHidden = false;
 
     if( pDrvdFrm )
         aSet.SetParent( &pDrvdFrm->aSet );
@@ -79,6 +81,7 @@ SwFmt::SwFmt( const SwFmt& rFmt )
 {
     bWritten = bFmtInDTOR = sal_False; // LAYER_IMPL
     bAutoFmt = rFmt.bAutoFmt;
+    bHidden = rFmt.bHidden;
     bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
 
     if( rFmt.DerivedFrom() )
@@ -133,6 +136,7 @@ SwFmt &SwFmt::operator=(const SwFmt& rFmt)
         }
     }
     bAutoFmt = rFmt.bAutoFmt;
+    bHidden = rFmt.bHidden;
     bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
     return *this;
 }
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 97061d5..91b822b 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -398,6 +398,7 @@ SwNumRule::SwNumRule( const String& rNm,
     bInvalidRuleFlag( sal_True ),
     bContinusNum( sal_False ),
     bAbsSpaces( sal_False ),
+    bHidden( sal_False ),
     mbCountPhantoms( true ),
     meDefaultNumberFormatPositionAndSpaceMode( eDefaultNumberFormatPositionAndSpaceMode ),
     msDefaultListId()
@@ -496,6 +497,7 @@ SwNumRule::SwNumRule( const SwNumRule& rNumRule )
       bInvalidRuleFlag( sal_True ),
       bContinusNum( rNumRule.bContinusNum ),
       bAbsSpaces( rNumRule.bAbsSpaces ),
+      bHidden( rNumRule.bHidden ),
       mbCountPhantoms( true ),
       meDefaultNumberFormatPositionAndSpaceMode( rNumRule.meDefaultNumberFormatPositionAndSpaceMode ),
       msDefaultListId( rNumRule.msDefaultListId )
@@ -569,6 +571,7 @@ SwNumRule& SwNumRule::operator=( const SwNumRule& rNumRule )
         bInvalidRuleFlag = sal_True;
         bContinusNum = rNumRule.bContinusNum;
         bAbsSpaces = rNumRule.bAbsSpaces;
+        bHidden = rNumRule.bHidden;
         nPoolFmtId = rNumRule.GetPoolFmtId();
         nPoolHelpId = rNumRule.GetPoolHelpId();
         nPoolHlpFileId = rNumRule.GetPoolHlpFileId();
diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx
index 7314130..37a8d9b 100644
--- a/sw/source/core/layout/pagedesc.cxx
+++ b/sw/source/core/layout/pagedesc.cxx
@@ -56,6 +56,7 @@ SwPageDesc::SwPageDesc( const String& rName, SwFrmFmt *pFmt, SwDoc *pDc ) :
     nRegAscent( 0 ),
     eUse( (UseOnPage)(nsUseOnPage::PD_ALL | nsUseOnPage::PD_HEADERSHARE | nsUseOnPage::PD_FOOTERSHARE | nsUseOnPage::PD_FIRSTSHARE ) ),
     bLandscape( sal_False ),
+    bHidden( sal_False ),
     aFtnInfo()
 {
 }
@@ -73,6 +74,7 @@ SwPageDesc::SwPageDesc( const SwPageDesc &rCpy ) :
     nRegAscent( rCpy.GetRegAscent() ),
     eUse( rCpy.ReadUseOn() ),
     bLandscape( rCpy.GetLandscape() ),
+    bHidden( rCpy.IsHidden() ),
     aFtnInfo( rCpy.GetFtnInfo() )
 {
 }
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index d04a95f..5e6f87f 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -785,7 +785,7 @@ uno::Sequence< OUString > SwXStyleFamily::getElementNames(void) throw( uno::Runt
     uno::Sequence< OUString > aRet;
     if(pBasePool)
     {
-        SfxStyleSheetIterator* pIterator = pBasePool->CreateIterator(eFamily, 0xffff);
+        SfxStyleSheetIterator* pIterator = pBasePool->CreateIterator(eFamily, SFXSTYLEBIT_ALL);
         sal_uInt16 nCount = pIterator->Count();
         aRet.realloc(nCount);
         OUString* pArray = aRet.getArray();
@@ -867,7 +867,7 @@ void SwXStyleFamily::insertByName(const OUString& rName, const uno::Any& rElemen
                         throw lang::IllegalArgumentException();
                 if(pNewStyle)
                 {
-                    sal_uInt16 nMask = 0xffff;
+                    sal_uInt16 nMask = SFXSTYLEBIT_ALL;
                     if(eFamily == SFX_STYLE_FAMILY_PARA && !pNewStyle->IsConditional())
                         nMask &= ~SWSTYLEBIT_CONDCOLL;
 #if OSL_DEBUG_LEVEL > 1
diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx
index 8923077..14144c2 100644
--- a/sw/source/ui/app/docst.cxx
+++ b/sw/source/ui/app/docst.cxx
@@ -258,7 +258,7 @@ void  SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh)
 void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
 {
     sal_uInt16  nSlot   = rReq.GetSlot();
-    sal_uInt16  nRet    = 0xffff;
+    sal_uInt16  nRet    = SFXSTYLEBIT_ALL;
 
     const SfxItemSet* pArgs = rReq.GetArgs();
     const SfxPoolItem* pItem;
@@ -325,6 +325,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
 
         case SID_STYLE_EDIT:
         case SID_STYLE_DELETE:
+        case SID_STYLE_HIDE:
         case SID_STYLE_WATERCAN:
         case SID_STYLE_FAMILY:
         case SID_STYLE_UPDATE_BY_EXAMPLE:
@@ -450,6 +451,9 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
                     case SID_STYLE_DELETE:
                         nRet = Delete(aParam, nFamily);
                         break;
+                    case SID_STYLE_HIDE:
+                        nRet = Hide(aParam, nFamily, true);
+                        break;
                     case SID_STYLE_APPLY:
                         // Shell-switch in ApplyStyles
                         nRet = ApplyStyles(aParam, nFamily, pActShell, rReq.GetModifier() );
@@ -820,6 +824,24 @@ sal_uInt16 SwDocShell::Delete(const String &rName, sal_uInt16 nFamily)
     return sal_False;
 }
 
+sal_uInt16 SwDocShell::Hide(const String &rName, sal_uInt16 nFamily, bool bHidden)
+{
+    SfxStyleSheetBase *pStyle = mxBasePool->Find(rName, (SfxStyleFamily)nFamily);
+
+    if(pStyle)
+    {
+        OSL_ENSURE(GetWrtShell(), "No Shell, no Styles");
+
+        GetWrtShell()->StartAllAction();
+        rtl::Reference< SwDocStyleSheet > xTmp( new SwDocStyleSheet( *(SwDocStyleSheet*)pStyle ) );
+        xTmp->SetHidden( bHidden );
+        GetWrtShell()->EndAllAction();
+
+        return sal_True;
+    }
+    return sal_False;
+}
+
 /*--------------------------------------------------------------------
     Description:    apply template
  --------------------------------------------------------------------*/
diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
index fa38da7..e881cb1 100644
--- a/sw/source/ui/app/docstyle.cxx
+++ b/sw/source/ui/app/docstyle.cxx
@@ -450,6 +450,116 @@ void  SwDocStyleSheet::Reset()
     Description:    virtual methods
  --------------------------------------------------------------------*/
 
+void SwDocStyleSheet::SetHidden( sal_Bool bValue )
+{
+    bool bChg = false;
+    if(!bPhysical)
+        FillStyleSheet( FillPhysical );
+
+    SwFmt* pFmt = 0;
+    switch(nFamily)
+    {
+        case SFX_STYLE_FAMILY_CHAR:
+            pFmt = rDoc.FindCharFmtByName( aName );
+            if ( pFmt )
+            {
+                pFmt->SetHidden( bValue );
+                bChg = true;
+            }
+            break;
+
+        case SFX_STYLE_FAMILY_PARA:
+            pFmt = rDoc.FindTxtFmtCollByName( aName );
+            if ( pFmt )
+            {
+                pFmt->SetHidden( bValue );
+                bChg = true;
+            }
+            break;
+
+        case SFX_STYLE_FAMILY_FRAME:
+            pFmt = rDoc.FindFrmFmtByName( aName );
+            if ( pFmt )
+            {
+                pFmt->SetHidden( bValue );
+                bChg = true;
+            }
+            break;
+
+        case SFX_STYLE_FAMILY_PAGE:
+            {
+                SwPageDesc* pPgDesc = rDoc.FindPageDescByName( aName );
+                if ( pPgDesc )
+                {
+                    pPgDesc->SetHidden( bValue );
+                    bChg = true;
+                }
+            }
+            break;
+
+        case SFX_STYLE_FAMILY_PSEUDO:
+            {
+                SwNumRule* pRule = rDoc.FindNumRulePtr( aName );
+                if ( pRule )
+                {
+                    pRule->SetHidden( bValue );
+                    bChg = true;
+                }
+            }
+        default:;
+    }
+
+    if( bChg )
+    {
+        pPool->First();  // internal list has to be updated
+        pPool->Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) );
+        SwEditShell* pSh = rDoc.GetEditShell();
+        if( pSh )
+            pSh->CallChgLnk();
+    }
+}
+
+sal_Bool SwDocStyleSheet::IsHidden( ) const
+{
+    sal_Bool bRet = sal_False;
+
+    if(!bPhysical)
+    {
+        SwFmt* pFmt = 0;
+        switch(nFamily)
+        {
+            case SFX_STYLE_FAMILY_CHAR:
+                pFmt = rDoc.FindCharFmtByName( aName );
+                bRet = pFmt && pFmt->IsHidden( );
+                break;
+
+            case SFX_STYLE_FAMILY_PARA:
+                pFmt = rDoc.FindTxtFmtCollByName( aName );
+                bRet = pFmt && pFmt->IsHidden( );
+                break;
+
+            case SFX_STYLE_FAMILY_FRAME:
+                pFmt = rDoc.FindFrmFmtByName( aName );
+                bRet = pFmt && pFmt->IsHidden( );
+                break;
+
+            case SFX_STYLE_FAMILY_PAGE:
+                {
+                    SwPageDesc* pPgDesc = rDoc.FindPageDescByName( aName );
+                    bRet = pPgDesc && pPgDesc->IsHidden( );
+                }
+                break;
+            case SFX_STYLE_FAMILY_PSEUDO:
+                {
+                    SwNumRule* pRule = rDoc.FindNumRulePtr( aName );
+                    bRet = pRule && pRule->IsHidden( );
+                }
+            default:;
+        }
+    }
+
+    return bRet;
+}
 
 const String&  SwDocStyleSheet::GetParent() const
 {
@@ -2325,7 +2435,7 @@ SfxStyleSheetBase* SwDocStyleSheetPool::Find( const String& rName,
             {
                 const SwNumRule* pRule = mxStyleSheet->GetNumRule();
                 if( pRule &&
-                    !(bSearchUsed && (bOrganizer || rDoc.IsUsed(*pRule)) ) &&
+                    !bSearchUsed &&
                     (( nSMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
                             ? !(pRule->GetPoolFmtId() & USER_FMT)
                                 // searched for used and found none
@@ -2340,7 +2450,7 @@ SfxStyleSheetBase* SwDocStyleSheetPool::Find( const String& rName,
     }
 
     // then evaluate the mask:
-    if( pMod && !(bSearchUsed && (bOrganizer || rDoc.IsUsed(*pMod)) ) )
+    if( pMod && !bSearchUsed )
     {
         const sal_uInt16 nId = SFX_STYLE_FAMILY_PAGE == eFam
                         ? ((SwPageDesc*)pMod)->GetPoolFmtId()
@@ -2366,7 +2476,7 @@ SwStyleSheetIterator::SwStyleSheetIterator( SwDocStyleSheetPool* pBase,
     StartListening( *pBase );
 }
 
- SwStyleSheetIterator::~SwStyleSheetIterator()
+SwStyleSheetIterator::~SwStyleSheetIterator()
 {
     EndListening( mxIterSheet->GetPool() );
 }
@@ -2405,6 +2515,8 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
     const sal_uInt16 nSrchMask = nMask;
     const sal_Bool bIsSearchUsed = SearchUsed();
 
+    bool bSearchHidden = ( nMask & SFXSTYLEBIT_HIDDEN );
+
     const sal_Bool bOrganizer = ((SwDocStyleSheetPool*)pBasePool)->IsOrganizerMode();
 
     if( nSearchFamily == SFX_STYLE_FAMILY_CHAR
@@ -2414,10 +2526,11 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
         for( sal_uInt16 i = 0; i < nArrLen; i++ )
         {
             SwCharFmt* pFmt = (*rDoc.GetCharFmts())[ i ];
-            if( pFmt->IsDefault() && pFmt != rDoc.GetDfltCharFmt() )
-                continue;
 
             const bool bUsed = bIsSearchUsed && (bOrganizer || rDoc.IsUsed(*pFmt));
+            if( ( !bSearchHidden && pFmt->IsHidden() && !bUsed ) || ( pFmt->IsDefault() && pFmt != rDoc.GetDfltCharFmt() ) )
+                continue;
+
             if( !bUsed )
             {
                 // Standard is no User template
@@ -2452,7 +2565,7 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
         {
             if( !rDoc.get(IDocumentSettingAccess::HTML_MODE) )
                 AppendStyleList(SwStyleNameMapper::GetChrFmtUINameArray(),
-                                bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, cCHAR);
+                                bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, cCHAR);
             else
             {
                 aLst.Append( cCHAR, SwStyleNameMapper::GetChrFmtUINameArray()[
@@ -2465,7 +2578,7 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
                         RES_POOLCHR_FOOTNOTE - RES_POOLCHR_BEGIN ] );
             }
             AppendStyleList(SwStyleNameMapper::GetHTMLChrFmtUINameArray(),
-                                bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, cCHAR);
+                                bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, cCHAR);
         }
     }
 
@@ -2476,7 +2589,7 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
         if( rDoc.get(IDocumentSettingAccess::HTML_MODE) )
         {
             // then only HTML-Template are of interest
-            if( USHRT_MAX == nSMask )
+            if( SFXSTYLEBIT_ALL == nSMask )
                 nSMask = SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF |
                             SFXSTYLEBIT_USED;
             else
@@ -2491,10 +2604,10 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
         {
             SwTxtFmtColl* pColl = (*rDoc.GetTxtFmtColls())[ i ];
 
-            if(pColl->IsDefault())
+            const bool bUsed = bOrganizer || rDoc.IsUsed(*pColl);
+            if ( ( !bSearchHidden && pColl->IsHidden( ) && !bUsed ) || pColl->IsDefault() )
                 continue;
 
-            const bool bUsed = bOrganizer || rDoc.IsUsed(*pColl);
             if( !(bIsSearchUsed && bUsed ))
             {
                 const sal_uInt16 nId = pColl->GetPoolFmtId();
@@ -2565,19 +2678,19 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
         const sal_Bool bAll = nSMask == SFXSTYLEBIT_ALL;
         if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_TEXT )
             AppendStyleList(SwStyleNameMapper::GetTextUINameArray(),
-                            bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA );
+                            bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA );
         if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_CHAPTER )
             AppendStyleList(SwStyleNameMapper::GetDocUINameArray(),
-                            bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+                            bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
         if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_LIST )
             AppendStyleList(SwStyleNameMapper::GetListsUINameArray(),
-                            bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+                            bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
         if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_IDX )
             AppendStyleList(SwStyleNameMapper::GetRegisterUINameArray(),
-                            bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+                            bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
         if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_EXTRA )
             AppendStyleList(SwStyleNameMapper::GetExtraUINameArray(),
-                            bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+                            bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
         if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_CONDCOLL )
         {
             if( !bIsSearchUsed ||
@@ -2591,7 +2704,7 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
                         (SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF) )
         {
             AppendStyleList(SwStyleNameMapper::GetHTMLUINameArray(),
-                            bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+                            bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
             if( !bAll )
             {
                 // then also the ones, that we are mapping:
@@ -2634,13 +2747,13 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
         {
             SwFrmFmt* pFmt = (*rDoc.GetFrmFmts())[ i ];
 
-            if(pFmt->IsDefault() || pFmt->IsAuto())
+            bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(*pFmt));
+            if( ( !bSearchHidden && pFmt->IsHidden( ) && !bUsed ) || pFmt->IsDefault() || pFmt->IsAuto() )
             {
                 continue;
             }
 
             const sal_uInt16 nId = pFmt->GetPoolFmtId();
-            bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(*pFmt));
             if( !bUsed )
             {
                 if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
@@ -2659,7 +2772,7 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
         //
         if ( nSrchMask == SFXSTYLEBIT_ALL )
             AppendStyleList(SwStyleNameMapper::GetFrmFmtUINameArray(),
-                                    bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, cFRAME);
+                                    bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, cFRAME);
     }
 
     if( nSearchFamily == SFX_STYLE_FAMILY_PAGE ||
@@ -2673,10 +2786,11 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
             bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(rDesc));
             if( !bUsed )
             {
-                if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
+                if ( ( !bSearchHidden && rDesc.IsHidden() ) ||
+                       ( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
                     ? !(nId & USER_FMT)
                     // searched for used and found none
-                    : bIsSearchUsed )
+                    : bIsSearchUsed ) )
                     continue;
             }
 
@@ -2684,7 +2798,7 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
         }
         if ( nSrchMask == SFXSTYLEBIT_ALL )
             AppendStyleList(SwStyleNameMapper::GetPageDescUINameArray(),
-                            bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, cPAGE);
+                            bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, cPAGE);
     }
 
     if( nSearchFamily == SFX_STYLE_FAMILY_PSEUDO ||
@@ -2699,10 +2813,11 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
                 bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(rRule) );
                 if( !bUsed )
                 {
-                    if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
+                    if( ( !bSearchHidden && rRule.IsHidden() ) ||
+                           ( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
                         ? !(rRule.GetPoolFmtId() & USER_FMT)
                         // searched for used and found none
-                        : bIsSearchUsed )
+                        : bIsSearchUsed ) )
                         continue;
                 }
 
@@ -2711,7 +2826,7 @@ SfxStyleSheetBase*  SwStyleSheetIterator::First()
         }
         if ( nSrchMask == SFXSTYLEBIT_ALL )
             AppendStyleList(SwStyleNameMapper::GetNumRuleUINameArray(),
-                            bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, cNUMRULE);
+                            bIsSearchUsed, bSearchHidden, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, cNUMRULE);
     }
 
     if(!aLst.empty())
@@ -2762,39 +2877,60 @@ SfxStyleSheetBase*  SwStyleSheetIterator::Find(const rtl::OUString& rName)
 }
 
 void SwStyleSheetIterator::AppendStyleList(const boost::ptr_vector<String>& rList,
-                                            sal_Bool    bTestUsed,
+                                            sal_Bool bTestUsed, sal_Bool bTestHidden,
                                             sal_uInt16 nSection, char cType )
 {
-    if( bTestUsed )
+    SwDoc& rDoc = ((SwDocStyleSheetPool*)pBasePool)->GetDoc();
+    sal_Bool bUsed = sal_False;
+    for ( sal_uInt16 i=0; i < rList.size(); ++i )
     {
-        SwDoc& rDoc = ((SwDocStyleSheetPool*)pBasePool)->GetDoc();
-        for ( sal_uInt16 i=0; i < rList.size(); ++i )
+        sal_Bool bHidden = sal_False;
+        sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rList[i], (SwGetPoolIdFromName)nSection);
+        switch ( nSection )
         {
-            sal_Bool bUsed = sal_False;
-            sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rList[i], (SwGetPoolIdFromName)nSection);
-            switch ( nSection )
-            {
-                case nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL:
-                        bUsed = rDoc.IsPoolTxtCollUsed( nId );
-                        break;
-                case nsSwGetPoolIdFromName::GET_POOLID_CHRFMT:
-                        bUsed = rDoc.IsPoolFmtUsed( nId );
-                        break;
-                case nsSwGetPoolIdFromName::GET_POOLID_FRMFMT:
-                        bUsed = rDoc.IsPoolFmtUsed( nId );
-                case nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC:
-                        bUsed = rDoc.IsPoolPageDescUsed( nId );
-                        break;
-                default:
-                    OSL_ENSURE( !this, "unknown PoolFmt-Id" );
-            }
-            if ( bUsed )
-                aLst.Append( cType, rList[i] );
+            case nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL:
+                {
+                    bUsed = rDoc.IsPoolTxtCollUsed( nId );
+                    SwFmt* pFmt = rDoc.FindTxtFmtCollByName( rList[i] );
+                    bHidden = pFmt && pFmt->IsHidden( );
+                }
+                break;
+            case nsSwGetPoolIdFromName::GET_POOLID_CHRFMT:
+                {
+                    bUsed = rDoc.IsPoolFmtUsed( nId );
+                    SwFmt* pFmt = rDoc.FindCharFmtByName( rList[i] );
+                    bHidden = pFmt && pFmt->IsHidden( );
+                }
+                break;
+            case nsSwGetPoolIdFromName::GET_POOLID_FRMFMT:
+                {
+                    bUsed = rDoc.IsPoolFmtUsed( nId );
+                    SwFmt* pFmt = rDoc.FindFrmFmtByName( rList[i] );
+                    bHidden = pFmt && pFmt->IsHidden( );
+                }
+                break;
+            case nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC:
+                {
+                    bUsed = rDoc.IsPoolPageDescUsed( nId );
+                    SwPageDesc* pPgDesc = rDoc.FindPageDescByName( rList[i] );
+                    bHidden = pPgDesc && pPgDesc->IsHidden( );
+                }
+                break;
+            case nsSwGetPoolIdFromName::GET_POOLID_NUMRULE:
+                {
+                    SwNumRule* pRule = rDoc.FindNumRulePtr( rList[i] );
+                    bUsed = pRule && rDoc.IsUsed( *pRule );
+                    bHidden = pRule && pRule->IsHidden( );
+                }
+                break;
+            default:
+                OSL_ENSURE( !this, "unknown PoolFmt-Id" );
         }
-    }
-    else
-        for ( sal_uInt16 i=0; i < rList.size(); ++i )
+
+        bool bMatchHidden = ( bTestHidden && bHidden ) || ( !bTestHidden && ( !bHidden || bUsed ) );
+        if ( ( !bTestUsed && bMatchHidden ) || ( bTestUsed && bUsed ) )
             aLst.Append( cType, rList[i] );
+    }
 }
 
 void  SwStyleSheetIterator::Notify( SfxBroadcaster&, const SfxHint& rHint )


More information about the Libreoffice-commits mailing list