xref: /aoo42x/main/sfx2/source/control/objface.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sfx2.hxx"
30 
31 #include <stdlib.h>
32 #include <tools/rcid.h>
33 #ifndef GCC
34 #endif
35 #include <tools/stream.hxx>
36 
37 #include <sfx2/module.hxx>
38 #include <sfx2/objface.hxx>
39 #include <sfx2/msg.hxx>
40 #include <sfx2/app.hxx>
41 #include <sfx2/msgpool.hxx>
42 #include "sfx2/sfxresid.hxx"
43 #include <sfx2/minarray.hxx>
44 #include <sfx2/objsh.hxx>
45 
46 DBG_NAME(SfxInterface)
47 
48 //====================================================================
49 
50 EXTERN_C
51 #if defined( PM2 ) && (!defined( CSET ) && !defined ( MTW ) && !defined( WTC ))
52 int _stdcall
53 #else
54 #ifdef WNT
55 int _cdecl
56 #else
57 int
58 #endif
59 #endif
60 
61 SfxCompareSlots_Impl( const void* pSmaller, const void* pBigger )
62 {
63 	DBG_MEMTEST();
64 	return ( (int) ((SfxSlot*)pSmaller)->GetSlotId() ) -
65 		   ( (int) ((SfxSlot*)pBigger)->GetSlotId() );
66 }
67 
68 //=========================================================================
69 
70 struct SfxObjectUI_Impl
71 {
72 	sal_uInt16	nPos;
73 	ResId	aResId;
74 	sal_Bool	bVisible;
75 	sal_Bool	bContext;
76 	String* pName;
77 	sal_uInt32	nFeature;
78 
79 	SfxObjectUI_Impl(sal_uInt16 n, const ResId& rResId, sal_Bool bVis, sal_uInt32 nFeat) :
80 		nPos(n),
81 		aResId(rResId.GetId(), *rResId.GetResMgr()),
82 		bVisible(bVis),
83 		bContext(sal_False),
84 		pName(0),
85 		nFeature(nFeat)
86 	{
87 		aResId.SetRT(rResId.GetRT());
88 	}
89 
90 	~SfxObjectUI_Impl()
91 	{
92 		delete pName;
93 	}
94 };
95 
96 DECL_PTRARRAY(SfxObjectUIArr_Impl, SfxObjectUI_Impl*, 2, 2)
97 
98 struct SfxInterface_Impl
99 {
100 	SfxObjectUIArr_Impl*	pObjectBars;	// registered ObjectBars
101 	SfxObjectUIArr_Impl*	pChildWindows;	// registered ChildWindows
102 	ResId					aPopupRes;		// registered PopupMenu
103 	ResId					aStatBarRes;	// registered StatusBar
104 	SfxModule*				pModule;
105     sal_Bool                    bRegistered;
106 
107 	SfxInterface_Impl() :
108 		aPopupRes(0,*SfxApplication::GetOrCreate()->GetSfxResManager()),
109 		aStatBarRes(0,*SfxApplication::GetOrCreate()->GetSfxResManager())
110     , bRegistered(sal_False)
111 	{
112 		pObjectBars   = new SfxObjectUIArr_Impl;
113 		pChildWindows = new SfxObjectUIArr_Impl;
114 	}
115 
116 	~SfxInterface_Impl()
117 	{
118 		sal_uInt16 n;
119 		for (n=0; n<pObjectBars->Count(); n++)
120 			delete (*pObjectBars)[n];
121 		delete pObjectBars;
122 
123 		for (n=0; n<pChildWindows->Count(); n++)
124 			delete (*pChildWindows)[n];
125 		delete pChildWindows;
126 	}
127 };
128 
129 static SfxObjectUI_Impl* CreateObjectBarUI_Impl( sal_uInt16 nPos, const ResId& rResId, sal_uInt32 nFeature, const String *pStr );
130 
131 //====================================================================
132 
133 //====================================================================
134 // ctor, registeres a new unit
135 
136 SfxInterface::SfxInterface( const char *pClassName,
137 							const ResId& rNameResId,
138 							SfxInterfaceId nId,
139 							const SfxInterface* pParent,
140 							SfxSlot &rSlotMap, sal_uInt16 nSlotCount ):
141 	pName(pClassName),
142 	pGenoType(pParent),
143 	nClassId(nId),
144 	aNameResId(rNameResId.GetId(),*rNameResId.GetResMgr()),
145 	pImpData(0)
146 {
147 	pImpData = new SfxInterface_Impl;
148 	SetSlotMap( rSlotMap, nSlotCount );
149 }
150 
151 void SfxInterface::Register( SfxModule* pMod )
152 {
153     pImpData->bRegistered = sal_True;
154 	pImpData->pModule = pMod;
155     if ( pMod )
156 		pMod->GetSlotPool()->RegisterInterface(*this);
157 	else
158         SFX_APP()->GetAppSlotPool_Impl().RegisterInterface(*this);
159 }
160 
161 void SfxInterface::SetSlotMap( SfxSlot& rSlotMap, sal_uInt16 nSlotCount )
162 {
163 	pSlots = &rSlotMap;
164 	nCount = nSlotCount;
165 	SfxSlot* pIter = pSlots;
166 	if ( 1 == nCount && !pIter->pNextSlot )
167 		pIter->pNextSlot = pIter;
168 
169 	if ( !pIter->pNextSlot )
170 	{
171 		// sort the SfxSlots by id
172 		qsort( pSlots, nCount, sizeof(SfxSlot), SfxCompareSlots_Impl );
173 
174 		// link masters and slaves
175 		sal_uInt16 nIter = 1;
176 		for ( pIter = pSlots; nIter <= nCount; ++pIter, ++nIter )
177 		{
178 			//! hier bitte sinnvoll pruefen
179 			//! DBG_ASSERT(!(pIter->IsMode(SFX_SLOT_CACHABLE) &&
180 			//!                 pIter->IsMode(SFX_SLOT_VOLATILE)),
181 			//!             "invalid Flags" );
182 			DBG_ASSERT( nIter == nCount ||
183 						pIter->GetSlotId() != (pIter+1)->GetSlotId(),
184 						"doppelte SID" );
185 
186 			// jeder Master verweist auf seinen ersten Slave (ENUM), alle
187 			// Slaves auf ihren Master.
188 			// Slaves verweisen im Ring auf die anderen mit gleichem Master
189 			if ( pIter->GetKind() == SFX_KIND_ENUM )
190 			{
191 				pIter->pLinkedSlot = GetSlot( pIter->nMasterSlotId );
192 				DBG_ASSERT( pIter->pLinkedSlot, "slave without master" );
193 				if ( !pIter->pLinkedSlot->pLinkedSlot )
194 					( (SfxSlot*) pIter->pLinkedSlot)->pLinkedSlot = pIter;
195 
196 				if ( 0 == pIter->GetNextSlot() )
197 				{
198 					SfxSlot *pLastSlot = pIter;
199 					for ( sal_uInt16 n = nIter; n < Count(); ++n )
200 					{
201 						SfxSlot *pCurSlot = (pSlots+n);
202 						if ( pCurSlot->nMasterSlotId == pIter->nMasterSlotId )
203 						{
204 							pLastSlot->pNextSlot = pCurSlot;
205 							pLastSlot = pCurSlot;
206 						}
207 					}
208 					pLastSlot->pNextSlot = pIter;
209 				}
210 			}
211 			else if ( 0 == pIter->GetNextSlot() )
212 			{
213 				// Slots verweisen im Ring auf den n"achten mit derselben Statusmethode
214 				SfxSlot *pLastSlot = pIter;
215 				for ( sal_uInt16 n = nIter; n < Count(); ++n )
216 				{
217 					SfxSlot *pCurSlot = (pSlots+n);
218 					if ( pCurSlot->GetStateFnc() == pIter->GetStateFnc() )
219 					{
220 						pLastSlot->pNextSlot = pCurSlot;
221 						pLastSlot = pCurSlot;
222 					}
223 				}
224 				pLastSlot->pNextSlot = pIter;
225 			}
226 		}
227 	}
228 #ifdef DBG_UTIL
229 	else
230 	{
231 		sal_uInt16 nIter = 1;
232 		for ( SfxSlot *pNext = pIter+1; nIter < nCount; ++pNext, ++nIter )
233 		{
234 
235 			if ( pNext->GetSlotId() <= pIter->GetSlotId() )
236 				DBG_ERROR ("Falsche Reihenfolge!");
237 
238 			if ( pIter->GetKind() == SFX_KIND_ENUM )
239 			{
240 				const SfxSlot *pMasterSlot = GetSlot(pIter->nMasterSlotId);
241 				const SfxSlot *pFirstSlave = pMasterSlot->pLinkedSlot;
242 				const SfxSlot *pSlave = pFirstSlave;
243 				do
244 				{
245 					if ( pSlave->pLinkedSlot != pMasterSlot )
246 					{
247 						ByteString aStr("Falsche Master/Slave-Verkettung : ");
248 						aStr += ByteString::CreateFromInt32(pMasterSlot->GetSlotId());
249 						aStr += " , ";
250 						aStr += ByteString::CreateFromInt32(pSlave->GetSlotId());
251 						DBG_ERROR(aStr.GetBuffer());
252 					}
253 
254 					if ( pSlave->nMasterSlotId != pMasterSlot->GetSlotId() )
255 					{
256 						ByteString aStr("Falsche Master/Slave-Ids : ");
257 						aStr += ByteString::CreateFromInt32(pMasterSlot->GetSlotId());
258 						aStr += " , ";
259 						aStr += ByteString::CreateFromInt32(pSlave->GetSlotId());
260 						DBG_ERROR(aStr.GetBuffer());
261 					}
262 
263 					pSlave = pSlave->pNextSlot;
264 				}
265 				while ( pSlave != pFirstSlave );
266 			}
267 			else
268 			{
269 				if ( pIter->pLinkedSlot )
270 				{
271 					if ( pIter->pLinkedSlot->GetKind() != SFX_KIND_ENUM )
272 					{
273 						ByteString aStr("Slave ist kein enum : ");
274 						aStr += ByteString::CreateFromInt32(pIter->GetSlotId());
275 						aStr += " , ";
276 						aStr += ByteString::CreateFromInt32(pIter->pLinkedSlot->GetSlotId());
277 						DBG_ERROR(aStr.GetBuffer());
278 					}
279 				}
280 
281 				const SfxSlot *pCurSlot = pIter;
282 				do
283 				{
284 					pCurSlot = pCurSlot->pNextSlot;
285 					if ( pCurSlot->GetStateFnc() != pIter->GetStateFnc() )
286 					{
287 						ByteString aStr("Verkettete Slots mit verschiedenen StateMethods : ");
288 						aStr += ByteString::CreateFromInt32(pCurSlot->GetSlotId());
289 						aStr += " , ";
290 						aStr += ByteString::CreateFromInt32(pIter->GetSlotId());
291 						DBG_ERROR(aStr.GetBuffer());
292 					}
293 				}
294 				while ( pCurSlot != pIter );
295 			}
296 
297 			pIter = pNext;
298 		}
299 	}
300 #endif
301 }
302 
303 
304 //--------------------------------------------------------------------
305 
306 
307 
308 SfxInterface::~SfxInterface()
309 {
310 	SfxModule *pMod = pImpData->pModule;
311     sal_Bool bRegistered = pImpData->bRegistered;
312 	delete pImpData;
313     DBG_ASSERT( bRegistered, "Interface not registered!" );
314     if ( bRegistered )
315 	{
316 		if ( pMod )
317 			pMod->GetSlotPool()->ReleaseInterface(*this);
318 		else
319 			SFX_APP()->GetAppSlotPool_Impl().ReleaseInterface(*this);
320 	}
321 }
322 
323 //--------------------------------------------------------------------
324 
325 // searches for the specified func
326 
327 
328 const SfxSlot* SfxInterface::GetSlot( sal_uInt16 nFuncId ) const
329 {
330 	DBG_MEMTEST();
331 	DBG_CHKTHIS(SfxInterface, 0);
332 	DBG_ASSERT( this && pSlots && nCount, "" );
333 
334 	// find the id using binary search
335 	void* p = bsearch( &nFuncId, pSlots, nCount, sizeof(SfxSlot),
336 					   SfxCompareSlots_Impl );
337 	if ( !p && pGenoType )
338 		return pGenoType->GetSlot( nFuncId );
339 
340 	return p ? (const SfxSlot*)p : 0;
341 }
342 
343 const SfxSlot* SfxInterface::GetSlot( const String& rCommand ) const
344 {
345     static const char UNO_COMMAND[] = ".uno:";
346 
347     String aCommand( rCommand );
348     if ( aCommand.SearchAscii( UNO_COMMAND ) == 0 )
349          aCommand.Erase( 0, sizeof( UNO_COMMAND )-1 );
350 
351     for ( sal_uInt16 n=0; n<nCount; n++ )
352     {
353         if ( (pSlots+n)->pUnoName &&
354              aCommand.CompareIgnoreCaseToAscii( (pSlots+n)->GetUnoName() ) == COMPARE_EQUAL )
355             return pSlots+n;
356     }
357 
358     return pGenoType ? pGenoType->GetSlot( aCommand ) : NULL;
359 }
360 
361 //--------------------------------------------------------------------
362 
363 
364 const SfxSlot* SfxInterface::GetRealSlot( const SfxSlot *pSlot ) const
365 {
366 	DBG_MEMTEST();
367 	DBG_CHKTHIS(SfxInterface, 0);
368 	DBG_ASSERT( this && pSlots && nCount, "" );
369 
370 	if ( !ContainsSlot_Impl(pSlot) )
371 	{
372 		if(pGenoType)
373 			return pGenoType->GetRealSlot(pSlot);
374 		DBG_ERROR("fremder Slot");
375 		return 0;
376 	}
377 
378 	return pSlot->pLinkedSlot;
379 }
380 
381 //--------------------------------------------------------------------
382 
383 
384 const SfxSlot* SfxInterface::GetRealSlot( sal_uInt16 nSlotId ) const
385 {
386 	DBG_MEMTEST();
387 	DBG_CHKTHIS(SfxInterface, 0);
388 	DBG_ASSERT( this && pSlots && nCount, "" );
389 
390 	const SfxSlot *pSlot = GetSlot(nSlotId);
391 	if ( !pSlot )
392 	{
393 		if(pGenoType)
394 			return pGenoType->GetRealSlot(nSlotId);
395 		DBG_ERROR("fremder Slot");
396 		return 0;
397 	}
398 
399 	return pSlot->pLinkedSlot;
400 }
401 
402 //--------------------------------------------------------------------
403 
404 
405 void SfxInterface::RegisterPopupMenu( const ResId& rResId )
406 {
407 	DBG_CHKTHIS(SfxInterface, 0);
408 	pImpData->aPopupRes = rResId;
409 }
410 
411 //--------------------------------------------------------------------
412 
413 void SfxInterface::RegisterObjectBar( sal_uInt16 nPos, const ResId& rResId,
414 		const String *pStr )
415 {
416 	RegisterObjectBar( nPos, rResId, 0UL, pStr );
417 }
418 
419 
420 void SfxInterface::RegisterObjectBar( sal_uInt16 nPos, const ResId& rResId, sal_uInt32 nFeature, const String *pStr )
421 {
422     SfxObjectUI_Impl* pUI = CreateObjectBarUI_Impl( nPos, rResId, nFeature, pStr );
423     if ( pUI )
424         pImpData->pObjectBars->Append(pUI);
425 }
426 
427 SfxObjectUI_Impl* CreateObjectBarUI_Impl( sal_uInt16 nPos, const ResId& rResId, sal_uInt32 nFeature, const String *pStr )
428 {
429 	if ((nPos & SFX_VISIBILITY_MASK) == 0)
430         nPos |= SFX_VISIBILITY_STANDARD;
431 
432 	SfxObjectUI_Impl* pUI = new SfxObjectUI_Impl(nPos, rResId, sal_True, nFeature);
433 
434 	if (pStr == 0)
435 	{
436 		ResId aResId(rResId);
437 		aResId.SetRT(RSC_STRING);
438 		aResId.SetResMgr(rResId.GetResMgr());
439         if( ! aResId.GetResMgr() )
440             aResId.SetResMgr( SfxApplication::GetOrCreate()->GetOffResManager_Impl() );
441 		if ( !aResId.GetResMgr()->IsAvailable(aResId) )
442 			pUI->pName = new String (DEFINE_CONST_UNICODE("NoName"));
443 		else
444 			pUI->pName = new String(aResId);
445 	}
446 	else
447 		pUI->pName = new String(*pStr);
448 
449     return pUI;
450 }
451 
452 const ResId& SfxInterface::GetObjectBarResId( sal_uInt16 nNo ) const
453 {
454 	sal_Bool bGenoType = (pGenoType != 0 && !pGenoType->HasName());
455 	if ( bGenoType )
456 	{
457 		// Gibt es Toolbars in der Superklasse ?
458 		sal_uInt16 nBaseCount = pGenoType->GetObjectBarCount();
459 		if ( nNo < nBaseCount )
460 			// Die der Superklasse kommen zuerst
461 			return pGenoType->GetObjectBarResId( nNo );
462 		else
463 			nNo = nNo - nBaseCount;
464 	}
465 
466 #ifdef DBG_UTIL
467 	sal_uInt16 nObjBarCount = pImpData->pObjectBars->Count();
468 	DBG_ASSERT( nNo<nObjBarCount,"Objectbar ist unbekannt!" );
469 #endif
470 	return (*pImpData->pObjectBars)[nNo]->aResId;
471 }
472 
473 //--------------------------------------------------------------------
474 
475 
476 sal_uInt16 SfxInterface::GetObjectBarPos( sal_uInt16 nNo ) const
477 {
478 	sal_Bool bGenoType = (pGenoType != 0 && !pGenoType->HasName());
479 	if ( bGenoType )
480 	{
481 		// Gibt es Toolbars in der Superklasse ?
482 		sal_uInt16 nBaseCount = pGenoType->GetObjectBarCount();
483 		if ( nNo < nBaseCount )
484 			// Die der Superklasse kommen zuerst
485 			return pGenoType->GetObjectBarPos( nNo );
486 		else
487 			nNo = nNo - nBaseCount;
488 	}
489 
490 #ifdef DBG_UTIL
491 	sal_uInt16 nObjBarCount = pImpData->pObjectBars->Count();
492 	DBG_ASSERT( nNo<nObjBarCount,"Objectbar ist unbekannt!" );
493 #endif
494 	return (*pImpData->pObjectBars)[nNo]->nPos;
495 }
496 
497 //--------------------------------------------------------------------
498 
499 
500 sal_uInt16 SfxInterface::GetObjectBarCount() const
501 {
502 	if (pGenoType && ! pGenoType->HasName())
503 		return pImpData->pObjectBars->Count() + pGenoType->GetObjectBarCount();
504 	else
505 		return pImpData->pObjectBars->Count();
506 }
507 
508 //--------------------------------------------------------------------
509 void SfxInterface::RegisterChildWindow(sal_uInt16 nId, sal_Bool bContext, const String* pChildWinName)
510 {
511 	RegisterChildWindow( nId, bContext, 0UL, pChildWinName );
512 }
513 
514 void SfxInterface::RegisterChildWindow(sal_uInt16 nId, sal_Bool bContext, sal_uInt32 nFeature, const String*)
515 {
516 	SfxObjectUI_Impl* pUI = new SfxObjectUI_Impl(0, ResId(nId, *SfxApplication::GetOrCreate()->GetOffResManager_Impl()), sal_True, nFeature);
517 	pUI->bContext = bContext;
518 	pImpData->pChildWindows->Append(pUI);
519 }
520 
521 void SfxInterface::RegisterStatusBar(const ResId& rResId)
522 {
523 	pImpData->aStatBarRes = rResId;
524 }
525 
526 
527 sal_uInt32 SfxInterface::GetChildWindowId (sal_uInt16 nNo) const
528 {
529 	if ( pGenoType )
530 	{
531 		// Gibt es ChildWindows in der Superklasse ?
532 		sal_uInt16 nBaseCount = pGenoType->GetChildWindowCount();
533 		if ( nNo < nBaseCount )
534 			// Die der Superklasse kommen zuerst
535 			return pGenoType->GetChildWindowId( nNo );
536 		else
537 			nNo = nNo - nBaseCount;
538 	}
539 
540 #ifdef DBG_UTIL
541 	sal_uInt16 nCWCount = pImpData->pChildWindows->Count();
542 	DBG_ASSERT( nNo<nCWCount,"ChildWindow ist unbekannt!" );
543 #endif
544 	sal_uInt32 nRet = (*pImpData->pChildWindows)[nNo]->aResId.GetId();
545 	if ( (*pImpData->pChildWindows)[nNo]->bContext )
546 		nRet += sal_uInt32( nClassId ) << 16;
547 	return nRet;
548 }
549 
550 sal_uInt32 SfxInterface::GetChildWindowFeature (sal_uInt16 nNo) const
551 {
552 	if ( pGenoType )
553 	{
554 		// Gibt es ChildWindows in der Superklasse ?
555 		sal_uInt16 nBaseCount = pGenoType->GetChildWindowCount();
556 		if ( nNo < nBaseCount )
557 			// Die der Superklasse kommen zuerst
558 			return pGenoType->GetChildWindowFeature( nNo );
559 		else
560 			nNo = nNo - nBaseCount;
561 	}
562 
563 #ifdef DBG_UTIL
564 	sal_uInt16 nCWCount = pImpData->pChildWindows->Count();
565 	DBG_ASSERT( nNo<nCWCount,"ChildWindow ist unbekannt!" );
566 #endif
567 	return (*pImpData->pChildWindows)[nNo]->nFeature;
568 }
569 
570 //--------------------------------------------------------------------
571 
572 
573 sal_uInt16 SfxInterface::GetChildWindowCount() const
574 {
575 	if (pGenoType)
576 		return pImpData->pChildWindows->Count() + pGenoType->GetChildWindowCount();
577 	else
578 		return pImpData->pChildWindows->Count();
579 }
580 
581 
582 const ResId& SfxInterface::GetPopupMenuResId() const
583 {
584 	return pImpData->aPopupRes;
585 }
586 
587 
588 const ResId& SfxInterface::GetStatusBarResId() const
589 {
590 	if (pImpData->aStatBarRes.GetId() == 0 && pGenoType)
591 		return pGenoType->GetStatusBarResId();
592 	else
593 		return pImpData->aStatBarRes;
594 }
595 
596 
597 
598 const String* SfxInterface::GetObjectBarName ( sal_uInt16 nNo ) const
599 {
600 	sal_Bool bGenoType = (pGenoType != 0 && !pGenoType->HasName());
601 	if ( bGenoType )
602 	{
603 		// Gibt es Toolbars in der Superklasse ?
604 		sal_uInt16 nBaseCount = pGenoType->GetObjectBarCount();
605 		if ( nNo < nBaseCount )
606 			// Die der Superklasse kommen zuerst
607 			return pGenoType->GetObjectBarName( nNo );
608 		else
609 			nNo = nNo - nBaseCount;
610 	}
611 
612 #ifdef DBG_UTIL
613 	sal_uInt16 nObjBarCount = pImpData->pObjectBars->Count();
614 	DBG_ASSERT( nNo<nObjBarCount,"Objectbar ist unbekannt!" );
615 #endif
616 	return (*pImpData->pObjectBars)[nNo]->pName;
617 }
618 
619 sal_uInt32 SfxInterface::GetObjectBarFeature ( sal_uInt16 nNo ) const
620 {
621 	sal_Bool bGenoType = (pGenoType != 0 && !pGenoType->HasName());
622 	if ( bGenoType )
623 	{
624 		// Gibt es Toolbars in der Superklasse ?
625 		sal_uInt16 nBaseCount = pGenoType->GetObjectBarCount();
626 		if ( nNo < nBaseCount )
627 			// Die der Superklasse kommen zuerst
628 			return pGenoType->GetObjectBarFeature( nNo );
629 		else
630 			nNo = nNo - nBaseCount;
631 	}
632 
633 #ifdef DBG_UTIL
634 	sal_uInt16 nObjBarCount = pImpData->pObjectBars->Count();
635 	DBG_ASSERT( nNo<nObjBarCount,"Objectbar ist unbekannt!" );
636 #endif
637 	return (*pImpData->pObjectBars)[nNo]->nFeature;
638 }
639 
640 sal_Bool SfxInterface::IsObjectBarVisible(sal_uInt16 nNo) const
641 {
642 	sal_Bool bGenoType = (pGenoType != 0 && !pGenoType->HasName());
643 	if ( bGenoType )
644 	{
645 		// Gibt es Toolbars in der Superklasse ?
646 		sal_uInt16 nBaseCount = pGenoType->GetObjectBarCount();
647 		if ( nNo < nBaseCount )
648 			// Die der Superklasse kommen zuerst
649 			return pGenoType->IsObjectBarVisible( nNo );
650 		else
651 			nNo = nNo - nBaseCount;
652 	}
653 
654 #ifdef DBG_UTIL
655 	sal_uInt16 nObjBarCount = pImpData->pObjectBars->Count();
656 	DBG_ASSERT( nNo<nObjBarCount,"Objectbar ist unbekannt!" );
657 #endif
658 	return (*pImpData->pObjectBars)[nNo]->bVisible;
659 }
660 
661 const SfxInterface* SfxInterface::GetRealInterfaceForSlot( const SfxSlot *pRealSlot ) const
662 {
663     DBG_ASSERT( pImpData->bRegistered, "Interface not registered!" );
664 	const SfxInterface* pInterface = this;
665 
666 	// Der Slot k"onnte auch aus dem Interface einer Shell-Basisklasse stammen
667 	do
668 	{
669 		const SfxSlot *pLastSlot  = (*pInterface)[pInterface->Count()-1];
670 		const SfxSlot *pFirstSlot = (*pInterface)[0];
671 
672 		// Ist pInterface der Owner von pRealSlot ?
673 		if ( pFirstSlot <= pRealSlot && pRealSlot <= pLastSlot )
674 			break;
675 
676 		// Sonst Interface der Superklasse probieren
677 		pInterface = pInterface->pGenoType;
678 	}
679 	while ( pInterface );
680 
681 	return pInterface;
682 }
683 
684 
685 
686