xref: /aoo41x/main/sw/source/core/fields/scrptfld.cxx (revision efeef26f)
1*efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*efeef26fSAndrew Rist  * distributed with this work for additional information
6*efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9*efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*efeef26fSAndrew Rist  *
11*efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*efeef26fSAndrew Rist  *
13*efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15*efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17*efeef26fSAndrew Rist  * specific language governing permissions and limitations
18*efeef26fSAndrew Rist  * under the License.
19*efeef26fSAndrew Rist  *
20*efeef26fSAndrew Rist  *************************************************************/
21*efeef26fSAndrew Rist 
22*efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <docufld.hxx>
29cdf0e10cSrcweir #ifndef _UNOFLDMID_H
30cdf0e10cSrcweir #include <unofldmid.h>
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #ifndef _COMCORE_HRC
33cdf0e10cSrcweir #include <comcore.hrc>
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir #include <tools/resid.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir using namespace ::com::sun::star;
38cdf0e10cSrcweir using ::rtl::OUString;
39cdf0e10cSrcweir /*--------------------------------------------------------------------
40cdf0e10cSrcweir 	Beschreibung: ScriptField
41cdf0e10cSrcweir  --------------------------------------------------------------------*/
42cdf0e10cSrcweir 
SwScriptFieldType(SwDoc * pD)43cdf0e10cSrcweir SwScriptFieldType::SwScriptFieldType( SwDoc* pD )
44cdf0e10cSrcweir 	: SwFieldType( RES_SCRIPTFLD ), pDoc( pD )
45cdf0e10cSrcweir {}
46cdf0e10cSrcweir 
Copy() const47cdf0e10cSrcweir SwFieldType* SwScriptFieldType::Copy() const
48cdf0e10cSrcweir {
49cdf0e10cSrcweir 	return new SwScriptFieldType( pDoc );
50cdf0e10cSrcweir }
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 
53cdf0e10cSrcweir /*--------------------------------------------------------------------
54cdf0e10cSrcweir 	Beschreibung: SwScriptField
55cdf0e10cSrcweir  --------------------------------------------------------------------*/
56cdf0e10cSrcweir 
SwScriptField(SwScriptFieldType * pInitType,const String & rType,const String & rCode,sal_Bool bURL)57cdf0e10cSrcweir SwScriptField::SwScriptField( SwScriptFieldType* pInitType,
58cdf0e10cSrcweir 								const String& rType, const String& rCode,
59cdf0e10cSrcweir 								sal_Bool bURL )
60cdf0e10cSrcweir 	: SwField( pInitType ), sType( rType ), sCode( rCode ), bCodeURL( bURL )
61cdf0e10cSrcweir {
62cdf0e10cSrcweir }
63cdf0e10cSrcweir 
GetDescription() const64cdf0e10cSrcweir String SwScriptField::GetDescription() const
65cdf0e10cSrcweir {
66cdf0e10cSrcweir     return SW_RES(STR_SCRIPT);
67cdf0e10cSrcweir }
68cdf0e10cSrcweir 
Expand() const69cdf0e10cSrcweir String SwScriptField::Expand() const
70cdf0e10cSrcweir {
71cdf0e10cSrcweir 	return aEmptyStr;
72cdf0e10cSrcweir }
73cdf0e10cSrcweir 
Copy() const74cdf0e10cSrcweir SwField* SwScriptField::Copy() const
75cdf0e10cSrcweir {
76cdf0e10cSrcweir 	return new SwScriptField( (SwScriptFieldType*)GetTyp(), sType, sCode, bCodeURL );
77cdf0e10cSrcweir }
78cdf0e10cSrcweir 
79cdf0e10cSrcweir /*--------------------------------------------------------------------
80cdf0e10cSrcweir 	Beschreibung: Type setzen
81cdf0e10cSrcweir  --------------------------------------------------------------------*/
82cdf0e10cSrcweir 
SetPar1(const String & rStr)83cdf0e10cSrcweir void SwScriptField::SetPar1( const String& rStr )
84cdf0e10cSrcweir {
85cdf0e10cSrcweir 	sType = rStr;
86cdf0e10cSrcweir }
87cdf0e10cSrcweir 
GetPar1() const88cdf0e10cSrcweir const String& SwScriptField::GetPar1() const
89cdf0e10cSrcweir {
90cdf0e10cSrcweir 	return sType;
91cdf0e10cSrcweir }
92cdf0e10cSrcweir 
93cdf0e10cSrcweir /*--------------------------------------------------------------------
94cdf0e10cSrcweir 	Beschreibung: Code setzen
95cdf0e10cSrcweir  --------------------------------------------------------------------*/
96cdf0e10cSrcweir 
SetPar2(const String & rStr)97cdf0e10cSrcweir void SwScriptField::SetPar2( const String& rStr )
98cdf0e10cSrcweir {
99cdf0e10cSrcweir 	sCode = rStr;
100cdf0e10cSrcweir }
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 
GetPar2() const103cdf0e10cSrcweir String SwScriptField::GetPar2() const
104cdf0e10cSrcweir {
105cdf0e10cSrcweir 	return sCode;
106cdf0e10cSrcweir }
107cdf0e10cSrcweir /*-----------------05.03.98 15:00-------------------
108cdf0e10cSrcweir 
109cdf0e10cSrcweir --------------------------------------------------*/
QueryValue(uno::Any & rAny,sal_uInt16 nWhichId) const110cdf0e10cSrcweir sal_Bool SwScriptField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
111cdf0e10cSrcweir {
112cdf0e10cSrcweir     switch( nWhichId )
113cdf0e10cSrcweir 	{
114cdf0e10cSrcweir 	case FIELD_PROP_PAR1:
115cdf0e10cSrcweir 		rAny <<= OUString( sType );
116cdf0e10cSrcweir 		break;
117cdf0e10cSrcweir 	case FIELD_PROP_PAR2:
118cdf0e10cSrcweir 		rAny <<= OUString( sCode );
119cdf0e10cSrcweir 		break;
120cdf0e10cSrcweir 	case FIELD_PROP_BOOL1:
121cdf0e10cSrcweir 		rAny.setValue(&bCodeURL, ::getBooleanCppuType());
122cdf0e10cSrcweir 		break;
123cdf0e10cSrcweir 	default:
124cdf0e10cSrcweir 		DBG_ERROR("illegal property");
125cdf0e10cSrcweir 	}
126cdf0e10cSrcweir 	return sal_True;
127cdf0e10cSrcweir }
128cdf0e10cSrcweir /*-----------------05.03.98 15:00-------------------
129cdf0e10cSrcweir 
130cdf0e10cSrcweir --------------------------------------------------*/
PutValue(const uno::Any & rAny,sal_uInt16 nWhichId)131cdf0e10cSrcweir sal_Bool SwScriptField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
132cdf0e10cSrcweir {
133cdf0e10cSrcweir     switch( nWhichId )
134cdf0e10cSrcweir 	{
135cdf0e10cSrcweir 	case FIELD_PROP_PAR1:
136cdf0e10cSrcweir 		::GetString( rAny, sType );
137cdf0e10cSrcweir 		break;
138cdf0e10cSrcweir 	case FIELD_PROP_PAR2:
139cdf0e10cSrcweir 		::GetString( rAny, sCode );
140cdf0e10cSrcweir 		break;
141cdf0e10cSrcweir 	case FIELD_PROP_BOOL1:
142cdf0e10cSrcweir 		bCodeURL = *(sal_Bool*)rAny.getValue();
143cdf0e10cSrcweir 		break;
144cdf0e10cSrcweir 	default:
145cdf0e10cSrcweir 		DBG_ERROR("illegal property");
146cdf0e10cSrcweir 	}
147cdf0e10cSrcweir 	return sal_True;
148cdf0e10cSrcweir }
149cdf0e10cSrcweir 
150