Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <docufld.hxx>
30 : : #include <unofldmid.h>
31 : : #include <comcore.hrc>
32 : : #include <tools/resid.hxx>
33 : :
34 : : using namespace ::com::sun::star;
35 : : using ::rtl::OUString;
36 : : /*--------------------------------------------------------------------
37 : : Beschreibung: ScriptField
38 : : --------------------------------------------------------------------*/
39 : :
40 : 1921 : SwScriptFieldType::SwScriptFieldType( SwDoc* pD )
41 : 1921 : : SwFieldType( RES_SCRIPTFLD ), pDoc( pD )
42 : 1921 : {}
43 : :
44 : 0 : SwFieldType* SwScriptFieldType::Copy() const
45 : : {
46 [ # # ]: 0 : return new SwScriptFieldType( pDoc );
47 : : }
48 : :
49 : :
50 : : /*--------------------------------------------------------------------
51 : : Beschreibung: SwScriptField
52 : : --------------------------------------------------------------------*/
53 : :
54 : 0 : SwScriptField::SwScriptField( SwScriptFieldType* pInitType,
55 : : const String& rType, const String& rCode,
56 : : sal_Bool bURL )
57 [ # # ][ # # ]: 0 : : SwField( pInitType ), sType( rType ), sCode( rCode ), bCodeURL( bURL )
58 : : {
59 : 0 : }
60 : :
61 : 0 : String SwScriptField::GetDescription() const
62 : : {
63 [ # # ]: 0 : return SW_RES(STR_SCRIPT);
64 : : }
65 : :
66 : 0 : String SwScriptField::Expand() const
67 : : {
68 : 0 : return aEmptyStr;
69 : : }
70 : :
71 : 0 : SwField* SwScriptField::Copy() const
72 : : {
73 [ # # ][ # # ]: 0 : return new SwScriptField( (SwScriptFieldType*)GetTyp(), sType, sCode, bCodeURL );
[ # # ][ # # ]
74 : : }
75 : :
76 : : /*--------------------------------------------------------------------
77 : : Beschreibung: Type setzen
78 : : --------------------------------------------------------------------*/
79 : :
80 : 0 : void SwScriptField::SetPar1( const rtl::OUString& rStr )
81 : : {
82 : 0 : sType = rStr;
83 : 0 : }
84 : :
85 : 0 : const rtl::OUString& SwScriptField::GetPar1() const
86 : : {
87 : 0 : return sType;
88 : : }
89 : :
90 : : /*--------------------------------------------------------------------
91 : : Beschreibung: Code setzen
92 : : --------------------------------------------------------------------*/
93 : :
94 : 0 : void SwScriptField::SetPar2( const rtl::OUString& rStr )
95 : : {
96 : 0 : sCode = rStr;
97 : 0 : }
98 : :
99 : :
100 : 0 : rtl::OUString SwScriptField::GetPar2() const
101 : : {
102 : 0 : return sCode;
103 : : }
104 : :
105 : 0 : bool SwScriptField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
106 : : {
107 [ # # # # ]: 0 : switch( nWhichId )
108 : : {
109 : : case FIELD_PROP_PAR1:
110 [ # # ]: 0 : rAny <<= OUString( sType );
111 : 0 : break;
112 : : case FIELD_PROP_PAR2:
113 [ # # ]: 0 : rAny <<= OUString( sCode );
114 : 0 : break;
115 : : case FIELD_PROP_BOOL1:
116 : 0 : rAny.setValue(&bCodeURL, ::getBooleanCppuType());
117 : 0 : break;
118 : : default:
119 : : OSL_FAIL("illegal property");
120 : : }
121 : 0 : return true;
122 : : }
123 : :
124 : 0 : bool SwScriptField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
125 : : {
126 [ # # # # ]: 0 : switch( nWhichId )
127 : : {
128 : : case FIELD_PROP_PAR1:
129 : 0 : rAny >>= sType;
130 : 0 : break;
131 : : case FIELD_PROP_PAR2:
132 : 0 : rAny >>= sCode;
133 : 0 : break;
134 : : case FIELD_PROP_BOOL1:
135 : 0 : bCodeURL = *(sal_Bool*)rAny.getValue();
136 : 0 : break;
137 : : default:
138 : : OSL_FAIL("illegal property");
139 : : }
140 : 0 : return true;
141 : : }
142 : :
143 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|