xref: /aoo41x/main/sfx2/source/control/sorgitm.cxx (revision d119d52d)
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 
27 #include <sfx2/sfxsids.hrc>
28 #include "sorgitm.hxx"
29 // STATIC DATA -----------------------------------------------------------
30 
31 TYPEINIT1_AUTOFACTORY(SfxScriptOrganizerItem, SfxStringItem);
32 
33 //------------------------------------------------------------------------
34 
SfxScriptOrganizerItem()35 SfxScriptOrganizerItem::SfxScriptOrganizerItem() :
36 
37 	SfxStringItem()
38 
39 {
40 }
41 
42 //------------------------------------------------------------------------
43 
SfxScriptOrganizerItem(const String & rLanguage)44 SfxScriptOrganizerItem::SfxScriptOrganizerItem( const String& rLanguage ) :
45 
46 	 SfxStringItem( SID_SCRIPTORGANIZER, rLanguage ),
47 
48 	 aLanguage( rLanguage )
49 
50 {
51 }
52 
53 //------------------------------------------------------------------------
54 
SfxScriptOrganizerItem(const SfxScriptOrganizerItem & rItem)55 SfxScriptOrganizerItem::SfxScriptOrganizerItem( const SfxScriptOrganizerItem& rItem ) :
56 
57 	SfxStringItem( rItem ),
58 
59 	aLanguage( rItem.aLanguage )
60 
61 {
62 }
63 
64 //------------------------------------------------------------------------
65 
~SfxScriptOrganizerItem()66 SfxScriptOrganizerItem::~SfxScriptOrganizerItem()
67 {
68 }
69 
70 //------------------------------------------------------------------------
71 
Clone(SfxItemPool *) const72 SfxPoolItem* SfxScriptOrganizerItem::Clone( SfxItemPool * ) const
73 {
74 	return new SfxScriptOrganizerItem( *this );
75 }
76 
77 //------------------------------------------------------------------------
78 
operator ==(const SfxPoolItem & rItem) const79 int SfxScriptOrganizerItem::operator==( const SfxPoolItem& rItem) const
80 {
81 	 return rItem.Type() == Type() &&
82 		 SfxStringItem::operator==(rItem) &&
83 		 aLanguage == ((const SfxScriptOrganizerItem &)rItem).aLanguage;
84 }
85 
86 
QueryValue(com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId) const87 sal_Bool SfxScriptOrganizerItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
88 {
89     String aValue;
90     sal_Bool bIsString = sal_False;
91 	sal_Bool bValue = sal_False;
92     nMemberId &= ~CONVERT_TWIPS;
93     switch ( nMemberId )
94     {
95         case 0:
96         case MID_SCRIPT_ORGANIZER_LANGUAGE:
97 			bIsString = sal_True;
98 			aValue = aLanguage;
99 			break;
100         default:
101 			DBG_ERROR("Wrong MemberId!");
102            	return sal_False;
103 	 }
104 
105 	if ( bIsString )
106 		rVal <<= ::rtl::OUString( aValue );
107 	else
108 		rVal <<= bValue;
109     return sal_True;
110 }
111 
PutValue(const com::sun::star::uno::Any & rVal,sal_uInt8 nMemberId)112 sal_Bool SfxScriptOrganizerItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
113 {
114     ::rtl::OUString aValue;
115 	sal_Bool bRet = sal_False;
116     nMemberId &= ~CONVERT_TWIPS;
117     switch ( nMemberId )
118     {
119         case 0:
120 		case MID_SCRIPT_ORGANIZER_LANGUAGE:
121 			bRet = (rVal >>= aValue);
122 			if ( bRet )
123             	aLanguage = aValue;
124             break;
125         default:
126 			DBG_ERROR("Wrong MemberId!");
127             return sal_False;
128     }
129 
130     return bRet;
131 }
132 
133