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