nss: upgrade to release 3.73
[LibreOffice.git] / sw / source / core / fields / scrptfld.cxx
blobded42cc7f0badf76a6fd444b98311e30abaffb19
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <docufld.hxx>
21 #include <unofldmid.h>
22 #include <strings.hrc>
23 #include <o3tl/any.hxx>
24 #include <swtypes.hxx>
26 using namespace ::com::sun::star;
28 SwScriptFieldType::SwScriptFieldType( SwDoc& rD )
29 : SwFieldType( SwFieldIds::Script ), m_rDoc( rD )
32 std::unique_ptr<SwFieldType> SwScriptFieldType::Copy() const
34 return std::make_unique<SwScriptFieldType>( m_rDoc );
37 SwScriptField::SwScriptField( SwScriptFieldType* pInitType,
38 const OUString& rType, const OUString& rCode,
39 bool bURL )
40 : SwField( pInitType ), m_sType( rType ), m_sCode( rCode ), m_bCodeURL( bURL )
44 OUString SwScriptField::GetDescription() const
46 return SwResId(STR_SCRIPT);
49 OUString SwScriptField::ExpandImpl(SwRootFrame const*const) const
51 return OUString();
54 std::unique_ptr<SwField> SwScriptField::Copy() const
56 return std::make_unique<SwScriptField>( static_cast<SwScriptFieldType*>(GetTyp()), m_sType, m_sCode, m_bCodeURL );
59 /// set type
60 void SwScriptField::SetPar1( const OUString& rStr )
62 m_sType = rStr;
65 OUString SwScriptField::GetPar1() const
67 return m_sType;
70 /// set code
71 void SwScriptField::SetPar2( const OUString& rStr )
73 m_sCode = rStr;
76 OUString SwScriptField::GetPar2() const
78 return m_sCode;
81 bool SwScriptField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
83 switch( nWhichId )
85 case FIELD_PROP_PAR1:
86 rAny <<= m_sType;
87 break;
88 case FIELD_PROP_PAR2:
89 rAny <<= m_sCode;
90 break;
91 case FIELD_PROP_BOOL1:
92 rAny <<= m_bCodeURL;
93 break;
94 default:
95 assert(false);
97 return true;
100 bool SwScriptField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
102 switch( nWhichId )
104 case FIELD_PROP_PAR1:
105 rAny >>= m_sType;
106 break;
107 case FIELD_PROP_PAR2:
108 rAny >>= m_sCode;
109 break;
110 case FIELD_PROP_BOOL1:
111 m_bCodeURL = *o3tl::doAccess<bool>(rAny);
112 break;
113 default:
114 assert(false);
116 return true;
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */