xref: /aoo4110/main/sfx2/source/control/msg.cxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sfx2.hxx"
26 #include <svl/itempool.hxx>
27 #include <svl/eitem.hxx>
28 #include <sfx2/msg.hxx>
29 
30 //====================================================================
31 
GetKind() const32 SfxSlotKind SfxSlot::GetKind() const
33 {
34 	if( !nMasterSlotId && !nValue)
35 		return (SfxSlotKind) SFX_KIND_STANDARD;
36 	if ( nMasterSlotId && fnExec==0 && fnState==0 )
37 	{
38 		if ( pType->Type() == TYPE(SfxBoolItem) )
39 			return (SfxSlotKind) SFX_KIND_ENUM;
40 		else
41 		{
42 			DBG_ERROR( "invalid slot kind detected" );
43 			return SFX_KIND_ENUM;
44 		}
45 	}
46 	else
47 		return (SfxSlotKind) SFX_KIND_ATTR;
48 }
49 
50 //--------------------------------------------------------------------
51 
GetWhich(const SfxItemPool & rPool) const52 sal_uInt16 SfxSlot::GetWhich( const SfxItemPool &rPool ) const
53 {
54 	if ( !nMasterSlotId || nMasterSlotId == USHRT_MAX )
55 		((SfxSlot*) this) -> nMasterSlotId = rPool.GetWhich(nSlotId);
56 	return nMasterSlotId;
57 }
58 
GetCommand() const59 ::rtl::OString SfxSlot::GetCommand() const
60 {
61     rtl::OString sRet(".uno:");
62     sRet += pUnoName;
63     return sRet;
64 }
65 
GetCommandString() const66 ::rtl::OUString SfxSlot::GetCommandString() const
67 {
68     return rtl::OStringToOUString( GetCommand(), RTL_TEXTENCODING_UTF8);
69 }
70 
71