1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sfx2.hxx" 30*cdf0e10cSrcweir #include <svl/itempool.hxx> 31*cdf0e10cSrcweir #ifndef GCC 32*cdf0e10cSrcweir #endif 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir #include <sfx2/ctrlitem.hxx> 35*cdf0e10cSrcweir #include <sfx2/bindings.hxx> 36*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 37*cdf0e10cSrcweir #include <sfx2/msgpool.hxx> 38*cdf0e10cSrcweir #include "statcach.hxx" 39*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir //==================================================================== 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir DBG_NAME(SfxControllerItem); 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir //-------------------------------------------------------------------- 46*cdf0e10cSrcweir #ifdef DBG_UTIL 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir void SfxControllerItem::CheckConfigure_Impl( sal_uIntPtr nType ) 49*cdf0e10cSrcweir { 50*cdf0e10cSrcweir // echter Slot? (also kein Separator etc.) 51*cdf0e10cSrcweir if ( !nId ) 52*cdf0e10cSrcweir return; 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir // ist die Id "uberhaupt in 'nType' konfigurierbar? 55*cdf0e10cSrcweir const SfxSlot *pSlot = SFX_SLOTPOOL().GetSlot(nId); 56*cdf0e10cSrcweir DBG_ASSERTWARNING( pSlot, "SfxControllerItem: binding not existing slot" ); 57*cdf0e10cSrcweir if ( pSlot && !pSlot->IsMode(nType) ) 58*cdf0e10cSrcweir { 59*cdf0e10cSrcweir DBG_WARNING( "SfxControllerItem: slot without ...Config-flag" ); 60*cdf0e10cSrcweir DbgOutf( "SfxControllerItem: Config-flag missing at SID %5d", 61*cdf0e10cSrcweir pSlot->GetSlotId() ); 62*cdf0e10cSrcweir } 63*cdf0e10cSrcweir } 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir #endif 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir //-------------------------------------------------------------------- 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir // returns the next registered SfxControllerItem with the same id 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir SfxControllerItem* SfxControllerItem::GetItemLink() 72*cdf0e10cSrcweir { 73*cdf0e10cSrcweir DBG_MEMTEST(); 74*cdf0e10cSrcweir DBG_CHKTHIS(SfxControllerItem, 0); 75*cdf0e10cSrcweir return pNext == this ? 0 : pNext; 76*cdf0e10cSrcweir } 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir //-------------------------------------------------------------------- 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir // returns sal_True if this binding is really bound to a function 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir sal_Bool SfxControllerItem::IsBound() const 83*cdf0e10cSrcweir { 84*cdf0e10cSrcweir DBG_MEMTEST(); 85*cdf0e10cSrcweir DBG_CHKTHIS(SfxControllerItem, 0); 86*cdf0e10cSrcweir return pNext != this; 87*cdf0e10cSrcweir } 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir //-------------------------------------------------------------------- 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir // returns the associated function-id or 0 if none 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir // sal_uInt16 SfxControllerItem::GetId() const; 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir //==================================================================== 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir // registeres with the id at the bindings 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir void SfxControllerItem::Bind( sal_uInt16 nNewId, SfxBindings *pBindinx ) 100*cdf0e10cSrcweir { 101*cdf0e10cSrcweir DBG_MEMTEST(); 102*cdf0e10cSrcweir DBG_CHKTHIS(SfxControllerItem, 0); 103*cdf0e10cSrcweir DBG_ASSERT(pBindings || pBindinx, "Keine Bindings"); 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir if ( IsBound() ) { 106*cdf0e10cSrcweir DBG_ASSERT(pBindings, "Keine Bindings"); 107*cdf0e10cSrcweir pBindings->Release(*this); 108*cdf0e10cSrcweir } 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir nId = nNewId; 111*cdf0e10cSrcweir pNext = 0; 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir if (pBindinx) 114*cdf0e10cSrcweir pBindings = pBindinx; 115*cdf0e10cSrcweir pBindings->Register(*this); 116*cdf0e10cSrcweir } 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir void SfxControllerItem::BindInternal_Impl( sal_uInt16 nNewId, SfxBindings *pBindinx ) 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir DBG_MEMTEST(); 121*cdf0e10cSrcweir DBG_CHKTHIS(SfxControllerItem, 0); 122*cdf0e10cSrcweir DBG_ASSERT(pBindings || pBindinx, "Keine Bindings"); 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir if ( IsBound() ) { 125*cdf0e10cSrcweir DBG_ASSERT(pBindings, "Keine Bindings"); 126*cdf0e10cSrcweir pBindings->Release(*this); 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir nId = nNewId; 130*cdf0e10cSrcweir pNext = 0; 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir if (pBindinx) 133*cdf0e10cSrcweir pBindings = pBindinx; 134*cdf0e10cSrcweir pBindings->RegisterInternal_Impl(*this); 135*cdf0e10cSrcweir } 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir //==================================================================== 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir void SfxControllerItem::UnBind() 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir /* [Beschreibung] 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir "ost die Verbindung dieses SfxControllerItems mit der SfxBindings-Instanz, 145*cdf0e10cSrcweir an der es zur Zeit gebunden ist. Ab diesem Zeitpunkt erh"alt es keine 146*cdf0e10cSrcweir Statusbenachrichtigungen (<SfxControllerItem::StateChented()>) mehr. 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir [Querverweise] 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir <SfxControllerItem::ReBind()> 152*cdf0e10cSrcweir <SfxControllerItem::ClearCache()> 153*cdf0e10cSrcweir */ 154*cdf0e10cSrcweir { 155*cdf0e10cSrcweir DBG_MEMTEST(); 156*cdf0e10cSrcweir DBG_CHKTHIS(SfxControllerItem, 0); 157*cdf0e10cSrcweir DBG_ASSERT(pBindings, "Keine Bindings"); 158*cdf0e10cSrcweir DBG_ASSERT( IsBound(), "unbindings unbound SfxControllerItem" ); 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir pBindings->Release(*this); 161*cdf0e10cSrcweir pNext = this; 162*cdf0e10cSrcweir } 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir //==================================================================== 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir void SfxControllerItem::ReBind() 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir /* [Beschreibung] 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir Binded dieses SfxControllerItem wieder an die SfxBindings-Instanz, 171*cdf0e10cSrcweir an der es zuletzt gebunden war. Ab diesem Zeitpunkt erh"alt es wieder 172*cdf0e10cSrcweir Statusbenachrichtigungen (<SfxControllerItem::StateChented()>). 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir [Querverweise] 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir <SfxControllerItem::UnBind()> 178*cdf0e10cSrcweir <SfxControllerItem::ClearCache()> 179*cdf0e10cSrcweir */ 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir DBG_MEMTEST(); 183*cdf0e10cSrcweir DBG_CHKTHIS(SfxControllerItem, 0); 184*cdf0e10cSrcweir DBG_ASSERT(pBindings, "Keine Bindings"); 185*cdf0e10cSrcweir DBG_ASSERT( !IsBound(), "bindings rebound SfxControllerItem" ); 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir pBindings->Register(*this); 188*cdf0e10cSrcweir } 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir //==================================================================== 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir void SfxControllerItem::UpdateSlot() 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir /* [Beschreibung] 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir Holt den Status 'hart' neu. 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir [Querverweise] 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir <SfxControllerItem::ClearCache()> 201*cdf0e10cSrcweir */ 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir { 204*cdf0e10cSrcweir DBG_MEMTEST(); 205*cdf0e10cSrcweir DBG_CHKTHIS(SfxControllerItem, 0); 206*cdf0e10cSrcweir DBG_ASSERT(pBindings, "Keine Bindings"); 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir pBindings->Update( GetId() ); 209*cdf0e10cSrcweir } 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir //-------------------------------------------------------------------- 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir void SfxControllerItem::ClearCache() 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir /* [Beschreibung] 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir "oscht den Status-Cache f"ur dieses SfxControllerItem. D.h. beim 218*cdf0e10cSrcweir n"achsten Status-Update wird das <SfxPoolItem> auf jeden Fall geschickt, 219*cdf0e10cSrcweir auch wenn zuvor dasselbe geschickt wurde. Dies wird ben"otigt, wenn 220*cdf0e10cSrcweir ein Controller umgeschaltet werden kann und sich diesen Status 221*cdf0e10cSrcweir selbst merkt. 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir [Beispiel] 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir Der Kombi-Controller f"ur das Einstellen des Fl"achentyps und der 227*cdf0e10cSrcweir konkreten Auspr"agung (Farbe blau oder Schraffur X) kann im Typ 228*cdf0e10cSrcweir umgestellt werden, wird jedoch dann bei der n"achsten Selektion 229*cdf0e10cSrcweir wieder benachrichtigt, auch wenn es dieselben Daten sind. 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir [Querverweise] 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir <SfxControllerItem::UnBind()> 235*cdf0e10cSrcweir <SfxControllerItem::ReBind()> 236*cdf0e10cSrcweir */ 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir DBG_MEMTEST(); 241*cdf0e10cSrcweir DBG_CHKTHIS(SfxControllerItem, 0); 242*cdf0e10cSrcweir DBG_ASSERT(pBindings, "Keine Bindings"); 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir pBindings->ClearCache_Impl( GetId() ); 245*cdf0e10cSrcweir } 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir //-------------------------------------------------------------------- 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir // replaces the successor in the list of bindings of the same id 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir SfxControllerItem* SfxControllerItem::ChangeItemLink( SfxControllerItem* pNewLink ) 252*cdf0e10cSrcweir { 253*cdf0e10cSrcweir DBG_MEMTEST(); 254*cdf0e10cSrcweir DBG_CHKTHIS(SfxControllerItem, 0); 255*cdf0e10cSrcweir SfxControllerItem* pOldLink = pNext; 256*cdf0e10cSrcweir pNext = pNewLink; 257*cdf0e10cSrcweir return pOldLink == this ? 0 : pOldLink; 258*cdf0e10cSrcweir } 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir //-------------------------------------------------------------------- 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir // changes the id of unbound functions (e.g. for sub-menu-ids) 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir void SfxControllerItem::SetId( sal_uInt16 nItemId ) 265*cdf0e10cSrcweir { 266*cdf0e10cSrcweir DBG_MEMTEST(); 267*cdf0e10cSrcweir DBG_CHKTHIS(SfxControllerItem, 0); 268*cdf0e10cSrcweir DBG_ASSERT( !IsBound(), "changing id of bound binding" ); 269*cdf0e10cSrcweir nId = nItemId; 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir //-------------------------------------------------------------------- 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir // creates a atomic item for a controller without registration 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir SfxControllerItem::SfxControllerItem(): 277*cdf0e10cSrcweir nId(0), 278*cdf0e10cSrcweir pNext(this), 279*cdf0e10cSrcweir pBindings(0) 280*cdf0e10cSrcweir { 281*cdf0e10cSrcweir DBG_MEMTEST(); 282*cdf0e10cSrcweir DBG_CTOR(SfxControllerItem, 0); 283*cdf0e10cSrcweir } 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir //-------------------------------------------------------------------- 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir // creates a representation of the function nId and registeres it 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir SfxControllerItem::SfxControllerItem( sal_uInt16 nID, SfxBindings &rBindings ): 290*cdf0e10cSrcweir nId(nID), 291*cdf0e10cSrcweir pNext(this), 292*cdf0e10cSrcweir pBindings(&rBindings) 293*cdf0e10cSrcweir { 294*cdf0e10cSrcweir DBG_MEMTEST(); 295*cdf0e10cSrcweir DBG_CTOR(SfxControllerItem, 0); 296*cdf0e10cSrcweir Bind(nId, &rBindings); 297*cdf0e10cSrcweir } 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir //-------------------------------------------------------------------- 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir // unregisteres the item in the bindings 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir SfxControllerItem::~SfxControllerItem() 304*cdf0e10cSrcweir { 305*cdf0e10cSrcweir DBG_MEMTEST(); 306*cdf0e10cSrcweir if ( IsBound() ) 307*cdf0e10cSrcweir pBindings->Release(*this); 308*cdf0e10cSrcweir DBG_DTOR(SfxControllerItem, 0); 309*cdf0e10cSrcweir } 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir //-------------------------------------------------------------------- 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir void SfxControllerItem::StateChanged 314*cdf0e10cSrcweir ( 315*cdf0e10cSrcweir sal_uInt16 , // <SID> des ausl"osenden Slot 316*cdf0e10cSrcweir SfxItemState , // <SfxItemState> von 'pState' 317*cdf0e10cSrcweir const SfxPoolItem* // Slot-Status, ggf. 0 oder IsInvalidItem() 318*cdf0e10cSrcweir ) 319*cdf0e10cSrcweir 320*cdf0e10cSrcweir /* [Beschreibung] 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir Diese virtuelle Methode wird vom SFx gerufen, um <SfxControllerItem>s 323*cdf0e10cSrcweir dar"uber zu benachrichtigen, da\s sich der Status des Slots 'nSID' 324*cdf0e10cSrcweir ge"andert hat. Der neue Wert sowie der von diesem Wert ermittelte 325*cdf0e10cSrcweir Status wird als 'pState' bzw. 'eState' mitgegeben. 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir Der Status eines Slots kann sich "andern, wenn z.B. das MDI-Fenster 328*cdf0e10cSrcweir gewechselt wird oder der Slot explizit mit <SfxBindings::Invalidate()> 329*cdf0e10cSrcweir invalidiert wurde. 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir Achtung! Die Methode wird nicht gerufen, wenn der Slot ung"ultig wurde, 332*cdf0e10cSrcweir danach jedoch wieder denselben Wert angenommen hat. 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir Diese Basisklasse braucht nicht gerufen zu werden, weitere Zwischenstufen 335*cdf0e10cSrcweir jedoch (z.B. <SfxToolboxControl>) sollten gerufen werden. 336*cdf0e10cSrcweir */ 337*cdf0e10cSrcweir 338*cdf0e10cSrcweir { 339*cdf0e10cSrcweir DBG_MEMTEST(); 340*cdf0e10cSrcweir DBG_CHKTHIS(SfxControllerItem, 0); 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir //-------------------------------------------------------------------- 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir void SfxControllerItem::DeleteFloatingWindow() 346*cdf0e10cSrcweir { 347*cdf0e10cSrcweir DBG_MEMTEST(); 348*cdf0e10cSrcweir DBG_CHKTHIS(SfxControllerItem, 0); 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir //-------------------------------------------------------------------- 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir void SfxStatusForwarder::StateChanged 354*cdf0e10cSrcweir ( 355*cdf0e10cSrcweir sal_uInt16 nSID, // <SID> des ausl"osenden Slot 356*cdf0e10cSrcweir SfxItemState eState, // <SfxItemState> von 'pState' 357*cdf0e10cSrcweir const SfxPoolItem* pState // Slot-Status, ggf. 0 oder IsInvalidItem() 358*cdf0e10cSrcweir ) 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir { 361*cdf0e10cSrcweir pMaster->StateChanged( nSID, eState, pState ); 362*cdf0e10cSrcweir } 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir //-------------------------------------------------------------------- 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir SfxStatusForwarder::SfxStatusForwarder( 367*cdf0e10cSrcweir sal_uInt16 nSlotId, 368*cdf0e10cSrcweir SfxControllerItem& rMaster ): 369*cdf0e10cSrcweir SfxControllerItem( nSlotId, rMaster.GetBindings() ), 370*cdf0e10cSrcweir pMaster( &rMaster ) 371*cdf0e10cSrcweir { 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir //-------------------------------------------------------------------- 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir SfxItemState SfxControllerItem::GetItemState 377*cdf0e10cSrcweir ( 378*cdf0e10cSrcweir const SfxPoolItem* pState /* Pointer auf das <SfxPoolItem>, dessen 379*cdf0e10cSrcweir Status erfragt werden soll. */ 380*cdf0e10cSrcweir ) 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir /* [Beschreibung] 383*cdf0e10cSrcweir 384*cdf0e10cSrcweir Statische Methode zum Ermitteln des Status des SfxPoolItem-Pointers, 385*cdf0e10cSrcweir in der Methode <SfxControllerItem::StateChanged(const SfxPoolItem*)> 386*cdf0e10cSrcweir zu verwenden. 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir [R"uckgabewert] 389*cdf0e10cSrcweir 390*cdf0e10cSrcweir SfxItemState SFX_ITEM_UNKNOWN 391*cdf0e10cSrcweir Enabled, aber keine weitere Statusinformation 392*cdf0e10cSrcweir verf"ugbar. Typisch f"ur <Slot>s, die allenfalls 393*cdf0e10cSrcweir zeitweise disabled sind, aber ihre Darstellung sonst 394*cdf0e10cSrcweir nicht "andern. 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir SFX_ITEM_DISABLED 397*cdf0e10cSrcweir Disabled und keine weiter Statusinformation 398*cdf0e10cSrcweir verf"ugbar. Alle anderen ggf. angezeigten Werte sollten 399*cdf0e10cSrcweir auf den Default zur"uckgesetzt werden. 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir SFX_ITEM_DONTCARE 402*cdf0e10cSrcweir Enabled aber es waren nur uneindeutige Werte 403*cdf0e10cSrcweir verf"ugbar (also keine, die abgefragt werden k"onnen). 404*cdf0e10cSrcweir 405*cdf0e10cSrcweir SFX_ITEM_AVAILABLE 406*cdf0e10cSrcweir Enabled und mit verf"ugbarem Wert, der von 'pState' 407*cdf0e10cSrcweir erfragbar ist. Der Typ ist dabei im gesamten 408*cdf0e10cSrcweir Programm eindeutig und durch den Slot festgelegt. 409*cdf0e10cSrcweir */ 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir { 412*cdf0e10cSrcweir return !pState 413*cdf0e10cSrcweir ? SFX_ITEM_DISABLED 414*cdf0e10cSrcweir : IsInvalidItem(pState) 415*cdf0e10cSrcweir ? SFX_ITEM_DONTCARE 416*cdf0e10cSrcweir : pState->ISA(SfxVoidItem) && !pState->Which() 417*cdf0e10cSrcweir ? SFX_ITEM_UNKNOWN 418*cdf0e10cSrcweir : SFX_ITEM_AVAILABLE; 419*cdf0e10cSrcweir } 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir //-------------------------------------------------------------------- 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir SfxMapUnit SfxControllerItem::GetCoreMetric() const 424*cdf0e10cSrcweir 425*cdf0e10cSrcweir /* [Beschreibung] 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir Holt vom zust"andigen Pool die Ma\seinheit ab, in der das Status-Item 428*cdf0e10cSrcweir vorliegt. 429*cdf0e10cSrcweir */ 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir { 432*cdf0e10cSrcweir SfxStateCache *pCache = pBindings->GetStateCache( nId ); 433*cdf0e10cSrcweir SfxDispatcher *pDispat = pBindings->GetDispatcher_Impl(); 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir if ( !pDispat ) 436*cdf0e10cSrcweir { 437*cdf0e10cSrcweir SfxViewFrame* pViewFrame = SfxViewFrame::Current(); 438*cdf0e10cSrcweir if ( !pViewFrame ) 439*cdf0e10cSrcweir SfxViewFrame::GetFirst(); 440*cdf0e10cSrcweir if ( pViewFrame ) 441*cdf0e10cSrcweir pDispat = pViewFrame->GetDispatcher(); 442*cdf0e10cSrcweir } 443*cdf0e10cSrcweir 444*cdf0e10cSrcweir if ( pDispat && pCache ) 445*cdf0e10cSrcweir { 446*cdf0e10cSrcweir const SfxSlotServer *pServer = pCache->GetSlotServer( *pDispat ); 447*cdf0e10cSrcweir if ( pServer ) 448*cdf0e10cSrcweir { 449*cdf0e10cSrcweir SfxShell *pSh = pDispat->GetShell( pServer->GetShellLevel() ); 450*cdf0e10cSrcweir SfxItemPool &rPool = pSh->GetPool(); 451*cdf0e10cSrcweir sal_uInt16 nWhich = rPool.GetWhich( nId ); 452*cdf0e10cSrcweir return rPool.GetMetric( nWhich ); 453*cdf0e10cSrcweir } 454*cdf0e10cSrcweir } 455*cdf0e10cSrcweir 456*cdf0e10cSrcweir DBG_WARNING( "W1: Can not find ItemPool!" ); 457*cdf0e10cSrcweir return SFX_MAPUNIT_100TH_MM; 458*cdf0e10cSrcweir } 459*cdf0e10cSrcweir 460*cdf0e10cSrcweir //------------------------------------------------------------------------ 461*cdf0e10cSrcweir 462*cdf0e10cSrcweir #ifdef _MSC_VER 463*cdf0e10cSrcweir #pragma optimize("g",off) 464*cdf0e10cSrcweir #endif 465*cdf0e10cSrcweir 466*cdf0e10cSrcweir 467