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 :
27 2958 : SwScriptFieldType::SwScriptFieldType( SwDoc* pD )
28 2958 : : SwFieldType( RES_SCRIPTFLD ), pDoc( pD )
29 2958 : {}
30 :
31 0 : SwFieldType* SwScriptFieldType::Copy() const
32 : {
33 0 : return new SwScriptFieldType( pDoc );
34 : }
35 :
36 0 : SwScriptField::SwScriptField( SwScriptFieldType* pInitType,
37 : const OUString& rType, const OUString& rCode,
38 : bool bURL )
39 0 : : SwField( pInitType ), sType( rType ), sCode( rCode ), bCodeURL( bURL )
40 : {
41 0 : }
42 :
43 0 : OUString SwScriptField::GetDescription() const
44 : {
45 0 : return SW_RES(STR_SCRIPT);
46 : }
47 :
48 0 : OUString SwScriptField::Expand() const
49 : {
50 0 : return OUString();
51 : }
52 :
53 0 : SwField* SwScriptField::Copy() const
54 : {
55 0 : return new SwScriptField( static_cast<SwScriptFieldType*>(GetTyp()), sType, sCode, bCodeURL );
56 : }
57 :
58 : /// set type
59 0 : void SwScriptField::SetPar1( const OUString& rStr )
60 : {
61 0 : sType = rStr;
62 0 : }
63 :
64 0 : OUString SwScriptField::GetPar1() const
65 : {
66 0 : return sType;
67 : }
68 :
69 : /// set code
70 0 : void SwScriptField::SetPar2( const OUString& rStr )
71 : {
72 0 : sCode = rStr;
73 0 : }
74 :
75 0 : OUString SwScriptField::GetPar2() const
76 : {
77 0 : return sCode;
78 : }
79 :
80 0 : bool SwScriptField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
81 : {
82 0 : switch( nWhichId )
83 : {
84 : case FIELD_PROP_PAR1:
85 0 : rAny <<= sType;
86 0 : break;
87 : case FIELD_PROP_PAR2:
88 0 : rAny <<= sCode;
89 0 : break;
90 : case FIELD_PROP_BOOL1:
91 0 : rAny <<= bCodeURL;
92 0 : break;
93 : default:
94 : OSL_FAIL("illegal property");
95 : }
96 0 : return true;
97 : }
98 :
99 0 : bool SwScriptField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
100 : {
101 0 : switch( nWhichId )
102 : {
103 : case FIELD_PROP_PAR1:
104 0 : rAny >>= sType;
105 0 : break;
106 : case FIELD_PROP_PAR2:
107 0 : rAny >>= sCode;
108 0 : break;
109 : case FIELD_PROP_BOOL1:
110 0 : bCodeURL = *static_cast<sal_Bool const *>(rAny.getValue());
111 0 : break;
112 : default:
113 : OSL_FAIL("illegal property");
114 : }
115 0 : return true;
116 : }
117 :
118 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|