errobject.cxx (e1f63238) errobject.cxx (a3415cde)
1/**************************************************************
1/**************************************************************
2 *
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
19 *
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_basic.hxx"
26#include "errobject.hxx"
27
28#include <cppuhelper/implbase2.hxx>
29#include <com/sun/star/script/XDefaultProperty.hpp>
30#include "sbintern.hxx"
31#include "runtime.hxx"
32
33using namespace ::com::sun::star;
34using namespace ::ooo;
35
36typedef ::cppu::WeakImplHelper2< vba::XErrObject, script::XDefaultProperty > ErrObjectImpl_BASE;
37
38class ErrObject : public ErrObjectImpl_BASE
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_basic.hxx"
26#include "errobject.hxx"
27
28#include <cppuhelper/implbase2.hxx>
29#include <com/sun/star/script/XDefaultProperty.hpp>
30#include "sbintern.hxx"
31#include "runtime.hxx"
32
33using namespace ::com::sun::star;
34using namespace ::ooo;
35
36typedef ::cppu::WeakImplHelper2< vba::XErrObject, script::XDefaultProperty > ErrObjectImpl_BASE;
37
38class ErrObject : public ErrObjectImpl_BASE
39{
39{
40 rtl::OUString m_sHelpFile;
41 rtl::OUString m_sSource;
40 rtl::OUString m_sHelpFile;
41 rtl::OUString m_sSource;
42 rtl::OUString m_sDescription;
42 rtl::OUString m_sDescription;
43 sal_Int32 m_nNumber;
44 sal_Int32 m_nHelpContext;
43 sal_Int32 m_nNumber;
44 sal_Int32 m_nHelpContext;
45
45
46public:
47 ErrObject();
48 ~ErrObject();
49 // Attributes
50 virtual ::sal_Int32 SAL_CALL getNumber() throw (uno::RuntimeException);
51 virtual void SAL_CALL setNumber( ::sal_Int32 _number ) throw (uno::RuntimeException);
52 virtual ::sal_Int32 SAL_CALL getHelpContext() throw (uno::RuntimeException);
53 virtual void SAL_CALL setHelpContext( ::sal_Int32 _helpcontext ) throw (uno::RuntimeException);
54 virtual ::rtl::OUString SAL_CALL getHelpFile() throw (uno::RuntimeException);
55 virtual void SAL_CALL setHelpFile( const ::rtl::OUString& _helpfile ) throw (uno::RuntimeException);
56 virtual ::rtl::OUString SAL_CALL getDescription() throw (uno::RuntimeException);
57 virtual void SAL_CALL setDescription( const ::rtl::OUString& _description ) throw (uno::RuntimeException);
58 virtual ::rtl::OUString SAL_CALL getSource() throw (uno::RuntimeException);
59 virtual void SAL_CALL setSource( const ::rtl::OUString& _source ) throw (uno::RuntimeException);
46public:
47 ErrObject();
48 ~ErrObject();
49 // Attributes
50 virtual ::sal_Int32 SAL_CALL getNumber() throw (uno::RuntimeException);
51 virtual void SAL_CALL setNumber( ::sal_Int32 _number ) throw (uno::RuntimeException);
52 virtual ::sal_Int32 SAL_CALL getHelpContext() throw (uno::RuntimeException);
53 virtual void SAL_CALL setHelpContext( ::sal_Int32 _helpcontext ) throw (uno::RuntimeException);
54 virtual ::rtl::OUString SAL_CALL getHelpFile() throw (uno::RuntimeException);
55 virtual void SAL_CALL setHelpFile( const ::rtl::OUString& _helpfile ) throw (uno::RuntimeException);
56 virtual ::rtl::OUString SAL_CALL getDescription() throw (uno::RuntimeException);
57 virtual void SAL_CALL setDescription( const ::rtl::OUString& _description ) throw (uno::RuntimeException);
58 virtual ::rtl::OUString SAL_CALL getSource() throw (uno::RuntimeException);
59 virtual void SAL_CALL setSource( const ::rtl::OUString& _source ) throw (uno::RuntimeException);
60
60
61 // Methods
62 virtual void SAL_CALL Clear( ) throw (uno::RuntimeException);
63 virtual void SAL_CALL Raise( const uno::Any& Number, const uno::Any& Source, const uno::Any& Description, const uno::Any& HelpFile, const uno::Any& HelpContext ) throw (uno::RuntimeException);
61 // Methods
62 virtual void SAL_CALL Clear( ) throw (uno::RuntimeException);
63 virtual void SAL_CALL Raise( const uno::Any& Number, const uno::Any& Source, const uno::Any& Description, const uno::Any& HelpFile, const uno::Any& HelpContext ) throw (uno::RuntimeException);
64 // XDefaultProperty
64 // XDefaultProperty
65 virtual ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (uno::RuntimeException);
66
67 // Helper method
68 void setData( const uno::Any& Number, const uno::Any& Source, const uno::Any& Description,
69 const uno::Any& HelpFile, const uno::Any& HelpContext ) throw (uno::RuntimeException);
70};
71
72

--- 6 unchanged lines hidden (view full) ---

79}
80
81sal_Int32 SAL_CALL
82ErrObject::getNumber() throw (uno::RuntimeException)
83{
84 return m_nNumber;
85}
86
65 virtual ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (uno::RuntimeException);
66
67 // Helper method
68 void setData( const uno::Any& Number, const uno::Any& Source, const uno::Any& Description,
69 const uno::Any& HelpFile, const uno::Any& HelpContext ) throw (uno::RuntimeException);
70};
71
72

--- 6 unchanged lines hidden (view full) ---

79}
80
81sal_Int32 SAL_CALL
82ErrObject::getNumber() throw (uno::RuntimeException)
83{
84 return m_nNumber;
85}
86
87void SAL_CALL
87void SAL_CALL
88ErrObject::setNumber( ::sal_Int32 _number ) throw (uno::RuntimeException)
89{
90 pINST->setErrorVB( _number, String() );
91 ::rtl::OUString _description = pINST->GetErrorMsg();
92 setData( uno::makeAny( _number ), uno::Any(), uno::makeAny( _description ), uno::Any(), uno::Any() );
93}
94
88ErrObject::setNumber( ::sal_Int32 _number ) throw (uno::RuntimeException)
89{
90 pINST->setErrorVB( _number, String() );
91 ::rtl::OUString _description = pINST->GetErrorMsg();
92 setData( uno::makeAny( _number ), uno::Any(), uno::makeAny( _description ), uno::Any(), uno::Any() );
93}
94
95::sal_Int32 SAL_CALL
95::sal_Int32 SAL_CALL
96ErrObject::getHelpContext() throw (uno::RuntimeException)
97{
98 return m_nHelpContext;
99}
96ErrObject::getHelpContext() throw (uno::RuntimeException)
97{
98 return m_nHelpContext;
99}
100void SAL_CALL
100void SAL_CALL
101ErrObject::setHelpContext( ::sal_Int32 _helpcontext ) throw (uno::RuntimeException)
102{
103 m_nHelpContext = _helpcontext;
104}
105
101ErrObject::setHelpContext( ::sal_Int32 _helpcontext ) throw (uno::RuntimeException)
102{
103 m_nHelpContext = _helpcontext;
104}
105
106::rtl::OUString SAL_CALL
106::rtl::OUString SAL_CALL
107ErrObject::getHelpFile() throw (uno::RuntimeException)
108{
109 return m_sHelpFile;
110}
111
107ErrObject::getHelpFile() throw (uno::RuntimeException)
108{
109 return m_sHelpFile;
110}
111
112void SAL_CALL
112void SAL_CALL
113ErrObject::setHelpFile( const ::rtl::OUString& _helpfile ) throw (uno::RuntimeException)
114{
115 m_sHelpFile = _helpfile;
116}
117
113ErrObject::setHelpFile( const ::rtl::OUString& _helpfile ) throw (uno::RuntimeException)
114{
115 m_sHelpFile = _helpfile;
116}
117
118::rtl::OUString SAL_CALL
118::rtl::OUString SAL_CALL
119ErrObject::getDescription() throw (uno::RuntimeException)
120{
121 return m_sDescription;
122}
123
119ErrObject::getDescription() throw (uno::RuntimeException)
120{
121 return m_sDescription;
122}
123
124void SAL_CALL
124void SAL_CALL
125ErrObject::setDescription( const ::rtl::OUString& _description ) throw (uno::RuntimeException)
126{
127 m_sDescription = _description;
128}
129
125ErrObject::setDescription( const ::rtl::OUString& _description ) throw (uno::RuntimeException)
126{
127 m_sDescription = _description;
128}
129
130::rtl::OUString SAL_CALL
130::rtl::OUString SAL_CALL
131ErrObject::getSource() throw (uno::RuntimeException)
132{
133 return m_sSource;
134}
135
131ErrObject::getSource() throw (uno::RuntimeException)
132{
133 return m_sSource;
134}
135
136void SAL_CALL
136void SAL_CALL
137ErrObject::setSource( const ::rtl::OUString& _source ) throw (uno::RuntimeException)
138{
139 m_sSource = _source;
140}
137ErrObject::setSource( const ::rtl::OUString& _source ) throw (uno::RuntimeException)
138{
139 m_sSource = _source;
140}
141
141
142// Methods
142// Methods
143void SAL_CALL
143void SAL_CALL
144ErrObject::Clear( ) throw (uno::RuntimeException)
145{
146 m_sHelpFile = rtl::OUString();
147 m_sSource = m_sHelpFile;
148 m_sDescription = m_sSource;
144ErrObject::Clear( ) throw (uno::RuntimeException)
145{
146 m_sHelpFile = rtl::OUString();
147 m_sSource = m_sHelpFile;
148 m_sDescription = m_sSource;
149 m_nNumber = 0;
150 m_nHelpContext = 0;
149 m_nNumber = 0;
150 m_nHelpContext = 0;
151}
152
151}
152
153void SAL_CALL
153void SAL_CALL
154ErrObject::Raise( const uno::Any& Number, const uno::Any& Source, const uno::Any& Description, const uno::Any& HelpFile, const uno::Any& HelpContext ) throw (uno::RuntimeException)
155{
156 setData( Number, Source, Description, HelpFile, HelpContext );
157 if ( m_nNumber )
158 pINST->ErrorVB( m_nNumber, m_sDescription );
159}
160
154ErrObject::Raise( const uno::Any& Number, const uno::Any& Source, const uno::Any& Description, const uno::Any& HelpFile, const uno::Any& HelpContext ) throw (uno::RuntimeException)
155{
156 setData( Number, Source, Description, HelpFile, HelpContext );
157 if ( m_nNumber )
158 pINST->ErrorVB( m_nNumber, m_sDescription );
159}
160
161// XDefaultProperty
162::rtl::OUString SAL_CALL
161// XDefaultProperty
162::rtl::OUString SAL_CALL
163ErrObject::getDefaultPropertyName( ) throw (uno::RuntimeException)
164{
165 static rtl::OUString sDfltPropName( RTL_CONSTASCII_USTRINGPARAM("Number") );
166 return sDfltPropName;
167}
168
169void ErrObject::setData( const uno::Any& Number, const uno::Any& Source, const uno::Any& Description, const uno::Any& HelpFile, const uno::Any& HelpContext )
170 throw (uno::RuntimeException)
171{
172 if ( !Number.hasValue() )
163ErrObject::getDefaultPropertyName( ) throw (uno::RuntimeException)
164{
165 static rtl::OUString sDfltPropName( RTL_CONSTASCII_USTRINGPARAM("Number") );
166 return sDfltPropName;
167}
168
169void ErrObject::setData( const uno::Any& Number, const uno::Any& Source, const uno::Any& Description, const uno::Any& HelpFile, const uno::Any& HelpContext )
170 throw (uno::RuntimeException)
171{
172 if ( !Number.hasValue() )
173 throw uno::RuntimeException( rtl::OUString::createFromAscii("Missing Required Paramater"), uno::Reference< uno::XInterface >() );
173 throw uno::RuntimeException( rtl::OUString::createFromAscii("Missing Required Parameter"), uno::Reference< uno::XInterface >() );
174 Number >>= m_nNumber;
175 Description >>= m_sDescription;
176 Source >>= m_sSource;
177 HelpFile >>= m_sHelpFile;
178 HelpContext >>= m_nHelpContext;
179}
180
181// SbxErrObject

--- 10 unchanged lines hidden (view full) ---

192 }
193}
194
195SbxErrObject::~SbxErrObject()
196{
197 OSL_TRACE("SbxErrObject::~SbxErrObject dtor");
198}
199
174 Number >>= m_nNumber;
175 Description >>= m_sDescription;
176 Source >>= m_sSource;
177 HelpFile >>= m_sHelpFile;
178 HelpContext >>= m_nHelpContext;
179}
180
181// SbxErrObject

--- 10 unchanged lines hidden (view full) ---

192 }
193}
194
195SbxErrObject::~SbxErrObject()
196{
197 OSL_TRACE("SbxErrObject::~SbxErrObject dtor");
198}
199
200uno::Reference< vba::XErrObject >
200uno::Reference< vba::XErrObject >
201SbxErrObject::getUnoErrObject()
202{
203 SbxVariable* pVar = getErrObject();
204 SbxErrObject* pGlobErr = static_cast< SbxErrObject* >( pVar );
201SbxErrObject::getUnoErrObject()
202{
203 SbxVariable* pVar = getErrObject();
204 SbxErrObject* pGlobErr = static_cast< SbxErrObject* >( pVar );
205 return pGlobErr->m_xErr;
205 return pGlobErr->m_xErr;
206}
207
208SbxVariableRef
209SbxErrObject::getErrObject()
210{
211 static SbxVariableRef pGlobErr = new SbxErrObject( String( RTL_CONSTASCII_USTRINGPARAM("Err")), uno::makeAny( uno::Reference< vba::XErrObject >( new ErrObject() ) ) );
212 return pGlobErr;
213}
214
215void SbxErrObject::setNumberAndDescription( ::sal_Int32 _number, const ::rtl::OUString& _description )
216 throw (uno::RuntimeException)
217{
218 if( m_pErrObject != NULL )
219 m_pErrObject->setData( uno::makeAny( _number ), uno::Any(), uno::makeAny( _description ), uno::Any(), uno::Any() );
220}
221
206}
207
208SbxVariableRef
209SbxErrObject::getErrObject()
210{
211 static SbxVariableRef pGlobErr = new SbxErrObject( String( RTL_CONSTASCII_USTRINGPARAM("Err")), uno::makeAny( uno::Reference< vba::XErrObject >( new ErrObject() ) ) );
212 return pGlobErr;
213}
214
215void SbxErrObject::setNumberAndDescription( ::sal_Int32 _number, const ::rtl::OUString& _description )
216 throw (uno::RuntimeException)
217{
218 if( m_pErrObject != NULL )
219 m_pErrObject->setData( uno::makeAny( _number ), uno::Any(), uno::makeAny( _description ), uno::Any(), uno::Any() );
220}
221
222/* vim: set noet sw=4 ts=4: */