summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2004-11-17 12:35:52 +0000
committerOliver Bolte <obo@openoffice.org>2004-11-17 12:35:52 +0000
commit04e6c77397b244fc305cd023d19566d32052d309 (patch)
tree500ba130b843b3bef031f985948aeba036040a40
parentacd86be8a40e43cefc85a23cee1d3cea18c7a154 (diff)
INTEGRATION: CWS fwkbugfix03 (1.20.90); FILE MERGED
2004/10/19 11:37:33 cd 1.20.90.1: #i30041# Added support to show/hide controllers
-rw-r--r--sfx2/source/control/statcach.cxx51
1 files changed, 48 insertions, 3 deletions
diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx
index d528a0d0088c..44fad16ecd9c 100644
--- a/sfx2/source/control/statcach.cxx
+++ b/sfx2/source/control/statcach.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: statcach.cxx,v $
*
- * $Revision: 1.21 $
+ * $Revision: 1.22 $
*
- * last change: $Author: obo $ $Date: 2004-11-16 16:21:20 $
+ * last change: $Author: obo $ $Date: 2004-11-17 13:35:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -93,6 +93,7 @@
#include <svtools/eitem.hxx>
#include <svtools/intitem.hxx>
#include <svtools/stritem.hxx>
+#include <svtools/visitem.hxx>
#include <comphelper/processfactory.hxx>
#ifndef GCC
@@ -252,7 +253,8 @@ SfxStateCache::SfxStateCache( sal_uInt16 nFuncId ):
nId(nFuncId),
pController(0),
pLastItem( 0 ),
- eLastState( 0 )
+ eLastState( 0 ),
+ bItemVisible( sal_True )
{
DBG_MEMTEST();
DBG_CTOR(SfxStateCache, 0);
@@ -433,6 +435,49 @@ void SfxStateCache::SetState
SetState_Impl( eState, pState, bMaybeDirty );
}
+//--------------------------------------------------------------------
+
+void SfxStateCache::SetVisibleState( BOOL bShow )
+{
+ SfxItemState eState( SFX_ITEM_AVAILABLE );
+ const SfxPoolItem* pState( NULL );
+ sal_Bool bNotify( sal_False );
+ sal_Bool bDeleteItem( sal_False );
+
+ if ( bShow != bItemVisible )
+ {
+ bItemVisible = bShow;
+ if ( bShow )
+ {
+ if ( IsInvalidItem(pLastItem) || ( pLastItem == NULL ))
+ {
+ pState = new SfxVoidItem( nId );
+ bDeleteItem = sal_True;
+ }
+ else
+ pState = pLastItem;
+
+ eState = eLastState;
+ bNotify = ( pState != 0 );
+ }
+ else
+ {
+ pState = new SfxVisibilityItem( nId, FALSE );
+ bDeleteItem = sal_True;
+ }
+
+ // Controller updaten
+ for ( SfxControllerItem *pCtrl = pController;
+ pCtrl;
+ pCtrl = pCtrl->GetItemLink() )
+ pCtrl->StateChanged( nId, eState, pState );
+
+ if ( !bDeleteItem )
+ delete pState;
+ }
+}
+
+//--------------------------------------------------------------------
void SfxStateCache::SetState_Impl
(