1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: scrptfld.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <docufld.hxx>
37 #include <unofldmid.h>
40 #include <comcore.hrc>
42 #include <tools/resid.hxx>
44 using namespace ::com::sun::star
;
45 using ::rtl::OUString
;
46 /*--------------------------------------------------------------------
47 Beschreibung: ScriptField
48 --------------------------------------------------------------------*/
50 SwScriptFieldType::SwScriptFieldType( SwDoc
* pD
)
51 : SwFieldType( RES_SCRIPTFLD
), pDoc( pD
)
54 SwFieldType
* SwScriptFieldType::Copy() const
56 return new SwScriptFieldType( pDoc
);
60 /*--------------------------------------------------------------------
61 Beschreibung: SwScriptField
62 --------------------------------------------------------------------*/
64 SwScriptField::SwScriptField( SwScriptFieldType
* pInitType
,
65 const String
& rType
, const String
& rCode
,
67 : SwField( pInitType
), sType( rType
), sCode( rCode
), bCodeURL( bURL
)
71 String
SwScriptField::GetDescription() const
73 return SW_RES(STR_SCRIPT
);
76 String
SwScriptField::Expand() const
81 SwField
* SwScriptField::Copy() const
83 return new SwScriptField( (SwScriptFieldType
*)GetTyp(), sType
, sCode
, bCodeURL
);
86 /*--------------------------------------------------------------------
87 Beschreibung: Type setzen
88 --------------------------------------------------------------------*/
90 void SwScriptField::SetPar1( const String
& rStr
)
95 const String
& SwScriptField::GetPar1() const
100 /*--------------------------------------------------------------------
101 Beschreibung: Code setzen
102 --------------------------------------------------------------------*/
104 void SwScriptField::SetPar2( const String
& rStr
)
110 String
SwScriptField::GetPar2() const
114 /*-----------------05.03.98 15:00-------------------
116 --------------------------------------------------*/
117 BOOL
SwScriptField::QueryValue( uno::Any
& rAny
, USHORT nWhichId
) const
121 case FIELD_PROP_PAR1
:
122 rAny
<<= OUString( sType
);
124 case FIELD_PROP_PAR2
:
125 rAny
<<= OUString( sCode
);
127 case FIELD_PROP_BOOL1
:
128 rAny
.setValue(&bCodeURL
, ::getBooleanCppuType());
131 DBG_ERROR("illegal property");
135 /*-----------------05.03.98 15:00-------------------
137 --------------------------------------------------*/
138 BOOL
SwScriptField::PutValue( const uno::Any
& rAny
, USHORT nWhichId
)
142 case FIELD_PROP_PAR1
:
143 ::GetString( rAny
, sType
);
145 case FIELD_PROP_PAR2
:
146 ::GetString( rAny
, sCode
);
148 case FIELD_PROP_BOOL1
:
149 bCodeURL
= *(sal_Bool
*)rAny
.getValue();
152 DBG_ERROR("illegal property");