Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <docufld.hxx>
21 : #include <unofldmid.h>
22 : #include <comcore.hrc>
23 : #include <tools/resid.hxx>
24 :
25 : using namespace ::com::sun::star;
26 : using ::rtl::OUString;
27 : /*--------------------------------------------------------------------
28 : Beschreibung: ScriptField
29 : --------------------------------------------------------------------*/
30 :
31 276 : SwScriptFieldType::SwScriptFieldType( SwDoc* pD )
32 276 : : SwFieldType( RES_SCRIPTFLD ), pDoc( pD )
33 276 : {}
34 :
35 0 : SwFieldType* SwScriptFieldType::Copy() const
36 : {
37 0 : return new SwScriptFieldType( pDoc );
38 : }
39 :
40 :
41 : /*--------------------------------------------------------------------
42 : Beschreibung: SwScriptField
43 : --------------------------------------------------------------------*/
44 :
45 0 : SwScriptField::SwScriptField( SwScriptFieldType* pInitType,
46 : const String& rType, const String& rCode,
47 : sal_Bool bURL )
48 0 : : SwField( pInitType ), sType( rType ), sCode( rCode ), bCodeURL( bURL )
49 : {
50 0 : }
51 :
52 0 : String SwScriptField::GetDescription() const
53 : {
54 0 : return SW_RES(STR_SCRIPT);
55 : }
56 :
57 0 : String SwScriptField::Expand() const
58 : {
59 0 : return aEmptyStr;
60 : }
61 :
62 0 : SwField* SwScriptField::Copy() const
63 : {
64 0 : return new SwScriptField( (SwScriptFieldType*)GetTyp(), sType, sCode, bCodeURL );
65 : }
66 :
67 : /*--------------------------------------------------------------------
68 : Beschreibung: Type setzen
69 : --------------------------------------------------------------------*/
70 :
71 0 : void SwScriptField::SetPar1( const rtl::OUString& rStr )
72 : {
73 0 : sType = rStr;
74 0 : }
75 :
76 0 : const rtl::OUString& SwScriptField::GetPar1() const
77 : {
78 0 : return sType;
79 : }
80 :
81 : /*--------------------------------------------------------------------
82 : Beschreibung: Code setzen
83 : --------------------------------------------------------------------*/
84 :
85 0 : void SwScriptField::SetPar2( const rtl::OUString& rStr )
86 : {
87 0 : sCode = rStr;
88 0 : }
89 :
90 :
91 0 : rtl::OUString SwScriptField::GetPar2() const
92 : {
93 0 : return sCode;
94 : }
95 :
96 0 : bool SwScriptField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
97 : {
98 0 : switch( nWhichId )
99 : {
100 : case FIELD_PROP_PAR1:
101 0 : rAny <<= OUString( sType );
102 0 : break;
103 : case FIELD_PROP_PAR2:
104 0 : rAny <<= OUString( sCode );
105 0 : break;
106 : case FIELD_PROP_BOOL1:
107 0 : rAny.setValue(&bCodeURL, ::getBooleanCppuType());
108 0 : break;
109 : default:
110 : OSL_FAIL("illegal property");
111 : }
112 0 : return true;
113 : }
114 :
115 0 : bool SwScriptField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
116 : {
117 0 : switch( nWhichId )
118 : {
119 : case FIELD_PROP_PAR1:
120 0 : rAny >>= sType;
121 0 : break;
122 : case FIELD_PROP_PAR2:
123 0 : rAny >>= sCode;
124 0 : break;
125 : case FIELD_PROP_BOOL1:
126 0 : bCodeURL = *(sal_Bool*)rAny.getValue();
127 0 : break;
128 : default:
129 : OSL_FAIL("illegal property");
130 : }
131 0 : return true;
132 : }
133 :
134 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|