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 : : #include "vbaformat.hxx"
29 : : #include <ooo/vba/excel/XStyle.hpp>
30 : : #include <ooo/vba/excel/XlVAlign.hpp>
31 : : #include <ooo/vba/excel/XlHAlign.hpp>
32 : : #include <ooo/vba/excel/XlOrientation.hpp>
33 : : #include <ooo/vba/excel/Constants.hpp>
34 : : #include <ooo/vba/excel/XRange.hpp>
35 : : #include <com/sun/star/table/CellVertJustify2.hpp>
36 : : #include <com/sun/star/table/CellHoriJustify.hpp>
37 : : #include <com/sun/star/table/CellOrientation.hpp>
38 : : #include <com/sun/star/table/XCellRange.hpp>
39 : : #include <com/sun/star/text/WritingMode.hpp>
40 : : #include <com/sun/star/util/CellProtection.hpp>
41 : :
42 : : #include <rtl/math.hxx>
43 : :
44 : : #include "excelvbahelper.hxx"
45 : : #include "vbaborders.hxx"
46 : : #include "vbapalette.hxx"
47 : : #include "vbafont.hxx"
48 : : #include "vbainterior.hxx"
49 : :
50 : : #include <unonames.hxx>
51 : : #include <cellsuno.hxx>
52 : : #include <scitems.hxx>
53 : : #include <attrib.hxx>
54 : :
55 : : using namespace ::ooo::vba;
56 : : using namespace ::com::sun::star;
57 : :
58 : : #define FORMATSTRING "FormatString"
59 : : #define LOCALE "Locale"
60 : :
61 : : template< typename Ifc1 >
62 [ + - ][ + - ]: 214 : ScVbaFormat< Ifc1 >::ScVbaFormat( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& _xPropertySet, const uno::Reference< frame::XModel >& xModel, bool bCheckAmbiguoity ) throw ( script::BasicErrorException ) : ScVbaFormat_BASE( xParent, xContext ), m_aDefaultLocale( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("en") ), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "US") ), rtl::OUString() ), mxPropertySet( _xPropertySet ), mxModel( xModel ), mbCheckAmbiguoity( bCheckAmbiguoity ), mbAddIndent( sal_False )
[ # # ][ # # ]
63 : : {
64 : : try
65 : : {
66 [ + - # # ]: 214 : mxServiceInfo.set( mxPropertySet, uno::UNO_QUERY_THROW );
67 [ - + ][ # # ]: 214 : if ( !mxModel.is() )
68 [ # # ][ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XModel Interface could not be retrieved") ) );
[ # # ][ # # ]
69 [ + - ][ # # ]: 214 : mxNumberFormatsSupplier.set( mxModel, uno::UNO_QUERY_THROW );
70 : : }
71 [ # # # # : 0 : catch (const uno::Exception& )
# # # # ]
72 : : {
73 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
74 : : }
75 : 214 : }
76 : :
77 : : template< typename Ifc1 >
78 : : void SAL_CALL
79 : 0 : ScVbaFormat<Ifc1>::setVerticalAlignment( const uno::Any& _oAlignment) throw (script::BasicErrorException, uno::RuntimeException)
80 : : {
81 : : try
82 : : {
83 : 0 : uno::Any aVal;
84 : 0 : sal_Int32 nAlignment = 0;
85 [ # # # # ]: 0 : if ( !(_oAlignment >>= nAlignment ))
86 [ # # ][ # # ]: 0 : throw uno::RuntimeException();
87 [ # # # # : 0 : switch (nAlignment)
# ][ # # #
# # ]
88 : : {
89 : : case excel::XlVAlign::xlVAlignBottom :
90 [ # # ][ # # ]: 0 : aVal = uno::makeAny( table::CellVertJustify2::BOTTOM );
91 : 0 : break;
92 : : case excel::XlVAlign::xlVAlignCenter :
93 [ # # ][ # # ]: 0 : aVal = uno::makeAny( table::CellVertJustify2::CENTER );
94 : 0 : break;
95 : : case excel::XlVAlign::xlVAlignDistributed:
96 : : case excel::XlVAlign::xlVAlignJustify:
97 [ # # ][ # # ]: 0 : aVal = uno::makeAny( table::CellVertJustify2::STANDARD );
98 : 0 : break;
99 : :
100 : : case excel::XlVAlign::xlVAlignTop:
101 [ # # ][ # # ]: 0 : aVal = uno::makeAny( table::CellVertJustify2::TOP);
102 : 0 : break;
103 : : default:
104 [ # # ][ # # ]: 0 : aVal = uno::makeAny( table::CellVertJustify2::STANDARD );
105 : 0 : break;
106 : : }
107 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLVJUS ) ), aVal );
[ # # ][ # # ]
[ # # ][ # # ]
108 : : }
109 [ # # # # ]: 0 : catch (const uno::Exception& )
110 : : {
111 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
112 : : }
113 : 0 : }
114 : :
115 : : template< typename Ifc1 >
116 : : uno::Any SAL_CALL
117 : 0 : ScVbaFormat<Ifc1>::getVerticalAlignment( ) throw (script::BasicErrorException, uno::RuntimeException)
118 : : {
119 : 0 : uno::Any aResult = aNULL();
120 : : try
121 : : {
122 [ # # ]: 0 : if (!isAmbiguous( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLVJUS ) ) ) )
[ # # # # ]
[ # # ][ # # ]
[ # # ]
123 : : {
124 : 0 : sal_Int32 aAPIAlignment = table::CellVertJustify2::STANDARD;
125 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLVJUS ) ) ) >>= aAPIAlignment;
[ # # ][ # # ]
[ # # ][ # # ]
126 [ # # # # : 0 : switch( aAPIAlignment )
# # # # #
# ]
127 : : {
128 : : case table::CellVertJustify2::BOTTOM:
129 [ # # ][ # # ]: 0 : aResult = uno::makeAny( excel::XlVAlign::xlVAlignBottom );
130 : 0 : break;
131 : : case table::CellVertJustify2::CENTER:
132 [ # # ][ # # ]: 0 : aResult = uno::makeAny( excel::XlVAlign::xlVAlignCenter );
133 : 0 : break;
134 : : case table::CellVertJustify2::STANDARD:
135 [ # # ][ # # ]: 0 : aResult = uno::makeAny( excel::XlVAlign::xlVAlignBottom );
136 : 0 : break;
137 : : case table::CellVertJustify2::TOP:
138 [ # # ][ # # ]: 0 : aResult = uno::makeAny( excel::XlVAlign::xlVAlignTop );
139 : 0 : break;
140 : : default:
141 : 0 : break;
142 : : }
143 : : }
144 : : }
145 [ # # # # : 0 : catch (const uno::Exception& )
# # # # ]
146 : : {
147 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
148 : : }
149 : 0 : return aResult;
150 : : }
151 : :
152 : : template< typename Ifc1 >
153 : : void SAL_CALL
154 : 0 : ScVbaFormat<Ifc1>::setHorizontalAlignment( const uno::Any& HorizontalAlignment ) throw (script::BasicErrorException, uno::RuntimeException)
155 : : {
156 : : try
157 : : {
158 : 0 : uno::Any aVal;
159 : 0 : sal_Int32 nAlignment = 0;
160 [ # # # # ]: 0 : if ( !( HorizontalAlignment >>= nAlignment ) )
161 [ # # ][ # # ]: 0 : throw uno::RuntimeException();
162 [ # # # # : 0 : switch ( nAlignment )
# # ][ # #
# # # # ]
163 : : {
164 : : case excel::XlHAlign::xlHAlignJustify:
165 [ # # ][ # # ]: 0 : aVal = uno::makeAny( table::CellHoriJustify_BLOCK);
166 : 0 : break;
167 : : case excel::XlHAlign::xlHAlignCenter:
168 [ # # ][ # # ]: 0 : aVal = uno::makeAny( table::CellHoriJustify_CENTER );
169 : 0 : break;
170 : : case excel::XlHAlign::xlHAlignDistributed:
171 [ # # ][ # # ]: 0 : aVal = uno::makeAny( table::CellHoriJustify_BLOCK);
172 : 0 : break;
173 : : case excel::XlHAlign::xlHAlignLeft:
174 [ # # ][ # # ]: 0 : aVal = uno::makeAny( table::CellHoriJustify_LEFT);
175 : 0 : break;
176 : : case excel::XlHAlign::xlHAlignRight:
177 [ # # ][ # # ]: 0 : aVal = uno::makeAny( table::CellHoriJustify_RIGHT);
178 : 0 : break;
179 : : }
180 : : // #FIXME what about the default case above?
181 : : // shouldn't need the test below
182 [ # # ][ # # ]: 0 : if ( aVal.hasValue() )
183 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLHJUS ) ), aVal );
[ # # ][ # # ]
[ # # ][ # # ]
184 : : }
185 [ # # # # ]: 0 : catch (const uno::Exception& )
186 : : {
187 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
188 : : }
189 : :
190 : 0 : }
191 : :
192 : : template< typename Ifc1 >
193 : : uno::Any SAL_CALL
194 : 0 : ScVbaFormat<Ifc1>::getHorizontalAlignment( ) throw (script::BasicErrorException, uno::RuntimeException)
195 : : {
196 : 0 : uno::Any NRetAlignment = aNULL();
197 : : try
198 : : {
199 [ # # # # ]: 0 : rtl::OUString sHoriJust( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLHJUS ) );
200 [ # # ][ # # ]: 0 : if (!isAmbiguous(sHoriJust))
[ # # ][ # # ]
201 : : {
202 : 0 : table::CellHoriJustify aAPIAlignment = table::CellHoriJustify_BLOCK;
203 : :
204 [ # # ][ # # ]: 0 : if ( mxPropertySet->getPropertyValue(sHoriJust) >>= aAPIAlignment )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
205 : : {
206 [ # # # # : 0 : switch( aAPIAlignment )
# ][ # # #
# # ]
207 : : {
208 : : case table::CellHoriJustify_BLOCK:
209 [ # # ][ # # ]: 0 : NRetAlignment = uno::makeAny( excel::XlHAlign::xlHAlignJustify );
210 : 0 : break;
211 : : case table::CellHoriJustify_CENTER:
212 [ # # ][ # # ]: 0 : NRetAlignment = uno::makeAny( excel::XlHAlign::xlHAlignCenter );
213 : 0 : break;
214 : : case table::CellHoriJustify_LEFT:
215 [ # # ][ # # ]: 0 : NRetAlignment = uno::makeAny( excel::XlHAlign::xlHAlignLeft );
216 : 0 : break;
217 : : case table::CellHoriJustify_RIGHT:
218 [ # # ][ # # ]: 0 : NRetAlignment = uno::makeAny( excel::XlHAlign::xlHAlignRight );
219 : 0 : break;
220 : : default: // handle those other cases with a NULL return
221 : 0 : break;
222 : : }
223 : : }
224 : : }
225 : : }
226 [ # # # # : 0 : catch (const uno::Exception& )
# # # # ]
227 : : {
228 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
229 : : }
230 : 0 : return NRetAlignment;
231 : : }
232 : :
233 : : template< typename Ifc1 >
234 : : void SAL_CALL
235 : 0 : ScVbaFormat<Ifc1>::setOrientation( const uno::Any& _aOrientation ) throw (script::BasicErrorException, uno::RuntimeException)
236 : : {
237 : : try
238 : : {
239 : 0 : sal_Int32 nOrientation = 0;
240 [ # # ][ # # ]: 0 : if ( !( _aOrientation >>= nOrientation ) )
241 [ # # ][ # # ]: 0 : throw uno::RuntimeException();
242 : 0 : uno::Any aVal;
243 [ # # # # : 0 : switch( nOrientation )
# # # # #
# ]
244 : : {
245 : : case excel::XlOrientation::xlDownward:
246 [ # # ][ # # ]: 0 : aVal = uno::makeAny( table::CellOrientation_TOPBOTTOM);
247 : 0 : break;
248 : : case excel::XlOrientation::xlHorizontal:
249 [ # # ][ # # ]: 0 : aVal = uno::makeAny( table::CellOrientation_STANDARD );
250 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_ROTANG ) ), uno::makeAny( sal_Int32(0) ) );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
251 : 0 : break;
252 : : case excel::XlOrientation::xlUpward:
253 [ # # ][ # # ]: 0 : aVal = uno::makeAny( table::CellOrientation_BOTTOMTOP);
254 : 0 : break;
255 : : case excel::XlOrientation::xlVertical:
256 [ # # ][ # # ]: 0 : aVal = uno::makeAny( table::CellOrientation_STACKED);
257 : 0 : break;
258 : : }
259 : : // #FIXME what about the default case above?
260 : : // shouldn't need the test below
261 [ # # ][ # # ]: 0 : if ( aVal.hasValue() )
262 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLORI ) ), aVal );
[ # # ][ # # ]
[ # # ][ # # ]
263 : :
264 : : }
265 [ # # # # ]: 0 : catch (const uno::Exception& )
266 : : {
267 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
268 : : }
269 : 0 : }
270 : : template< typename Ifc1 >
271 : : uno::Any SAL_CALL
272 : 0 : ScVbaFormat<Ifc1>::getOrientation( ) throw (script::BasicErrorException, uno::RuntimeException)
273 : : {
274 : 0 : uno::Any NRetOrientation = aNULL();
275 : : try
276 : : {
277 [ # # ]: 0 : if (!isAmbiguous(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLORI ) )))
[ # # # # ]
[ # # ][ # # ]
[ # # ]
278 : : {
279 : 0 : table::CellOrientation aOrientation = table::CellOrientation_STANDARD;
280 [ # # ][ # # ]: 0 : if ( !( mxPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLORI ) ) ) >>= aOrientation ) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
281 [ # # ][ # # ]: 0 : throw uno::RuntimeException();
282 : :
283 [ # # # # : 0 : switch(aOrientation)
# ][ # # #
# # ]
284 : : {
285 : : case table::CellOrientation_STANDARD:
286 [ # # ][ # # ]: 0 : NRetOrientation = uno::makeAny( excel::XlOrientation::xlHorizontal );
287 : 0 : break;
288 : : case table::CellOrientation_BOTTOMTOP:
289 [ # # ][ # # ]: 0 : NRetOrientation = uno::makeAny( excel::XlOrientation::xlUpward );
290 : 0 : break;
291 : : case table::CellOrientation_TOPBOTTOM:
292 [ # # ][ # # ]: 0 : NRetOrientation = uno::makeAny( excel::XlOrientation::xlDownward );
293 : 0 : break;
294 : : case table::CellOrientation_STACKED:
295 [ # # ][ # # ]: 0 : NRetOrientation = uno::makeAny( excel::XlOrientation::xlVertical );
296 : 0 : break;
297 : : default:
298 [ # # ][ # # ]: 0 : NRetOrientation = uno::makeAny( excel::XlOrientation::xlHorizontal );
299 : : }
300 : : }
301 : : }
302 [ # # # # : 0 : catch (const uno::Exception& )
# # # # ]
303 : : {
304 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
305 : : }
306 : 0 : return NRetOrientation;
307 : : }
308 : :
309 : : template< typename Ifc1 >
310 : : void SAL_CALL
311 : 0 : ScVbaFormat<Ifc1>::setWrapText( const uno::Any& _aWrapText ) throw (script::BasicErrorException, uno::RuntimeException)
312 : : {
313 : : try
314 : : {
315 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_WRAP ) ), _aWrapText);
[ # # ][ # # ]
[ # # ][ # # ]
316 : : }
317 [ # # # # ]: 0 : catch (const uno::Exception& )
318 : : {
319 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
320 : : }
321 : 0 : }
322 : :
323 : : template< typename Ifc1 >
324 : : uno::Any SAL_CALL
325 : 0 : ScVbaFormat<Ifc1>::getWrapText( ) throw (script::BasicErrorException, uno::RuntimeException)
326 : : {
327 : 0 : uno::Any aWrap = aNULL();
328 : : try
329 : : {
330 [ # # # # ]: 0 : rtl::OUString aPropName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_WRAP ) ) );
331 [ # # ][ # # ]: 0 : if (!isAmbiguous( aPropName ))
[ # # ][ # # ]
332 : : {
333 [ # # ][ # # ]: 0 : aWrap = mxPropertySet->getPropertyValue(aPropName);
[ # # ][ # # ]
334 : : }
335 : : }
336 [ # # # # : 0 : catch (const uno::Exception& )
# # # # ]
337 : : {
338 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
339 : : }
340 : 0 : return aWrap;
341 : : }
342 : :
343 : : template< typename Ifc1 >
344 : : uno::Any SAL_CALL
345 : 0 : ScVbaFormat<Ifc1>::Borders( const uno::Any& Index ) throw (script::BasicErrorException, uno::RuntimeException )
346 : : {
347 [ # # ][ # # ]: 0 : ScVbaPalette aPalette( excel::getDocShell( mxModel ) );
348 [ # # ][ # # ]: 0 : uno::Reference< XCollection > xColl = new ScVbaBorders( thisHelperIface(), ScVbaFormat_BASE::mxContext, uno::Reference< table::XCellRange >( mxPropertySet, uno::UNO_QUERY_THROW ), aPalette );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
349 : :
350 [ # # # # ]: 0 : if ( Index.hasValue() )
351 : : {
352 [ # # ][ # # ]: 0 : return xColl->Item( Index, uno::Any() );
[ # # ][ # # ]
353 : : }
354 [ # # ][ # # ]: 0 : return uno::makeAny( xColl );
355 : : }
356 : :
357 : : template< typename Ifc1 >
358 : : uno::Reference< excel::XFont > SAL_CALL
359 : 0 : ScVbaFormat<Ifc1>::Font( ) throw (script::BasicErrorException, uno::RuntimeException)
360 : : {
361 [ # # ][ # # ]: 0 : ScVbaPalette aPalette( excel::getDocShell( mxModel ) );
362 [ # # ][ # # ]: 0 : return new ScVbaFont( thisHelperIface(), ScVbaFormat_BASE::mxContext, aPalette, mxPropertySet );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
363 : : }
364 : :
365 : : template< typename Ifc1 >
366 : : uno::Reference< excel::XInterior > SAL_CALL
367 : 0 : ScVbaFormat<Ifc1>::Interior( ) throw (script::BasicErrorException, uno::RuntimeException)
368 : : {
369 [ # # ][ # # ]: 0 : return new ScVbaInterior( thisHelperIface(), ScVbaFormat_BASE::mxContext, mxPropertySet );
[ # # ][ # # ]
[ # # ][ # # ]
370 : : }
371 : :
372 : : template< typename Ifc1 >
373 : : uno::Any SAL_CALL
374 : 0 : ScVbaFormat<Ifc1>::getNumberFormatLocal( ) throw (script::BasicErrorException, uno::RuntimeException)
375 : : {
376 [ # # ][ # # ]: 0 : uno::Any aRet = uno::makeAny( rtl::OUString() );
377 : : try
378 : : {
379 [ # # # # ]: 0 : rtl::OUString sPropName( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_DP_NUMBERFO ) );
380 [ # # ][ # # ]: 0 : if (!isAmbiguous( sPropName ))
[ # # ][ # # ]
381 : : {
382 : :
383 [ # # ][ # # ]: 0 : initializeNumberFormats();
384 : :
385 : 0 : sal_Int32 nFormat = 0;
386 [ # # ][ # # ]: 0 : if ( ! (mxPropertySet->getPropertyValue( sPropName ) >>= nFormat ) )
[ # # ][ # # ]
[ # # ][ # # ]
387 [ # # ][ # # ]: 0 : throw uno::RuntimeException();
388 : :
389 : 0 : rtl::OUString sFormat;
390 [ # # ][ # # ]: 0 : xNumberFormats->getByKey(nFormat)->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( FORMATSTRING ))) >>= sFormat;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
391 [ # # ][ # # ]: 0 : aRet = uno::makeAny( sFormat.toAsciiLowerCase() );
392 : :
393 : : }
394 : : }
395 [ # # # # : 0 : catch (const uno::Exception& )
# # # # ]
396 : : {
397 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
398 : : }
399 : 0 : return aRet;
400 : :
401 : : }
402 : :
403 : : template< typename Ifc1 >
404 : : void
405 : 0 : ScVbaFormat<Ifc1>::setNumberFormat( lang::Locale _aLocale, const rtl::OUString& _sFormatString) throw( script::BasicErrorException )
406 : : {
407 : : try
408 : : {
409 [ # # ][ # # ]: 0 : initializeNumberFormats();
410 [ # # ][ # # ]: 0 : sal_Int32 nFormat = xNumberFormats->queryKey(_sFormatString, _aLocale , sal_True);
[ # # ][ # # ]
411 [ # # ][ # # ]: 0 : if (nFormat == -1)
412 : : {
413 [ # # ][ # # ]: 0 : xNumberFormats->addNew(_sFormatString, _aLocale);
[ # # ][ # # ]
414 : : }
415 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_DP_NUMBERFO ) ), uno::makeAny( nFormat ) );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
416 : : }
417 [ # # # # ]: 0 : catch (const uno::Exception& )
418 : : {
419 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
420 : : }
421 : 0 : }
422 : :
423 : : template< typename Ifc1 >
424 : : void SAL_CALL
425 : 0 : ScVbaFormat<Ifc1>::setNumberFormatLocal( const uno::Any& _oLocalFormatString ) throw (script::BasicErrorException, uno::RuntimeException)
426 : : {
427 : : try
428 : : {
429 : 0 : rtl::OUString sLocalFormatString;
430 : 0 : sal_Int32 nFormat = -1;
431 [ # # # # ]: 0 : rtl::OUString sNumFormat( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_DP_NUMBERFO ) );
432 [ # # ][ # # ]: 0 : if ( !(_oLocalFormatString >>= sLocalFormatString )
[ # # ][ # # ]
[ # # ]
[ # # # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
[ # # # # ]
433 : : || !( mxPropertySet->getPropertyValue(sNumFormat) >>= nFormat ) )
434 [ # # ][ # # ]: 0 : throw uno::RuntimeException();
435 : :
436 : 0 : sLocalFormatString = sLocalFormatString.toAsciiUpperCase();
437 [ # # # # ]: 0 : initializeNumberFormats();
438 : 0 : lang::Locale aRangeLocale;
439 [ # # ][ # # ]: 0 : xNumberFormats->getByKey(nFormat)->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( LOCALE ) ) ) >>= aRangeLocale;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
440 [ # # # # ]: 0 : sal_Int32 nNewFormat = xNumberFormats->queryKey(sLocalFormatString, aRangeLocale, sal_True);
[ # # ][ # # ]
441 : :
442 [ # # ][ # # ]: 0 : if (nNewFormat == -1)
443 [ # # ][ # # ]: 0 : nNewFormat = xNumberFormats->addNew(sLocalFormatString, aRangeLocale);
[ # # ][ # # ]
444 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue(sNumFormat, uno::makeAny( nNewFormat ));
[ # # ][ # # ]
[ # # ][ # # ]
445 : : }
446 [ # # # # ]: 0 : catch (const uno::Exception& )
447 : : {
448 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
449 : : }
450 : 0 : }
451 : :
452 : : template< typename Ifc1 >
453 : : void SAL_CALL
454 : 0 : ScVbaFormat<Ifc1>::setNumberFormat( const uno::Any& _oFormatString ) throw (script::BasicErrorException, uno::RuntimeException)
455 : : {
456 : : try
457 : : {
458 : 0 : rtl::OUString sFormatString;
459 [ # # # # ]: 0 : if ( !( _oFormatString >>= sFormatString ) )
460 [ # # ][ # # ]: 0 : throw uno::RuntimeException();
461 : :
462 : 0 : sFormatString = sFormatString.toAsciiUpperCase();
463 : :
464 : 0 : lang::Locale aDefaultLocale = m_aDefaultLocale;
465 [ # # # # ]: 0 : initializeNumberFormats();
466 [ # # ][ # # ]: 0 : sal_Int32 nFormat = xNumberFormats->queryKey(sFormatString, aDefaultLocale, sal_True);
[ # # ][ # # ]
467 : :
468 [ # # ][ # # ]: 0 : if (nFormat == -1)
469 [ # # ][ # # ]: 0 : nFormat = xNumberFormats->addNew(sFormatString, aDefaultLocale);
[ # # ][ # # ]
470 : :
471 : 0 : lang::Locale aRangeLocale;
472 [ # # ][ # # ]: 0 : xNumberFormats->getByKey(nFormat)->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( LOCALE ) ) ) >>= aRangeLocale;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
473 [ # # # # ]: 0 : sal_Int32 nNewFormat = xNumberFormatTypes->getFormatForLocale(nFormat, aRangeLocale);
[ # # ][ # # ]
474 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_DP_NUMBERFO ) ), uno::makeAny( nNewFormat));
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
475 : : }
476 [ # # # # ]: 0 : catch (const uno::Exception& )
477 : : {
478 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
479 : : }
480 : :
481 : 0 : }
482 : :
483 : : template< typename Ifc1 >
484 : : void SAL_CALL
485 : 0 : ScVbaFormat<Ifc1>::setIndentLevel( const uno::Any& _aLevel ) throw (script::BasicErrorException, uno::RuntimeException)
486 : : {
487 : : try
488 : : {
489 : 0 : sal_Int32 nLevel = 0;
490 [ # # ][ # # ]: 0 : if ( !(_aLevel >>= nLevel ) )
491 [ # # ][ # # ]: 0 : throw uno::RuntimeException();
492 : 0 : table::CellHoriJustify aAPIAlignment = table::CellHoriJustify_STANDARD;
493 : :
494 [ # # ][ # # ]: 0 : rtl::OUString sHoriJust( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLHJUS ) );
495 [ # # ][ # # ]: 0 : if ( !( mxPropertySet->getPropertyValue(sHoriJust) >>= aAPIAlignment ) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
496 [ # # ][ # # ]: 0 : throw uno::RuntimeException();
497 [ # # ][ # # ]: 0 : if (aAPIAlignment == table::CellHoriJustify_STANDARD)
498 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( sHoriJust, uno::makeAny( table::CellHoriJustify_LEFT) ) ;
[ # # ][ # # ]
[ # # ][ # # ]
499 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_PINDENT ) ), uno::makeAny( sal_Int16(nLevel * 352.8) ) );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
500 : : }
501 [ # # # # ]: 0 : catch (const uno::Exception& )
502 : : {
503 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
504 : : }
505 : 0 : }
506 : :
507 : : template< typename Ifc1 >
508 : : uno::Any SAL_CALL
509 : 0 : ScVbaFormat<Ifc1>::getIndentLevel( ) throw (script::BasicErrorException, uno::RuntimeException)
510 : : {
511 : 0 : uno::Any NRetIndentLevel = aNULL();
512 : : try
513 : : {
514 [ # # # # ]: 0 : rtl::OUString sParaIndent( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_PINDENT ) );
515 [ # # ][ # # ]: 0 : if (!isAmbiguous(sParaIndent))
[ # # ][ # # ]
516 : : {
517 : 0 : sal_Int16 IndentLevel = 0;
518 [ # # ][ # # ]: 0 : if ( ( mxPropertySet->getPropertyValue(sParaIndent) >>= IndentLevel ) )
[ # # ][ # # ]
[ # # ][ # # ]
519 [ # # ][ # # ]: 0 : NRetIndentLevel = uno::makeAny( sal_Int32( rtl::math::round(static_cast<double>( IndentLevel ) / 352.8)) );
520 : : else
521 [ # # ][ # # ]: 0 : NRetIndentLevel = uno::makeAny( sal_Int32(0) );
522 : : }
523 : : }
524 [ # # # # : 0 : catch (const uno::Exception& )
# # # # ]
525 : : {
526 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
527 : : }
528 : 0 : return NRetIndentLevel;
529 : : }
530 : :
531 : : template< typename Ifc1 >
532 : : void SAL_CALL
533 : 0 : ScVbaFormat<Ifc1>::setLocked( const uno::Any& _aLocked ) throw (script::BasicErrorException, uno::RuntimeException)
534 : : {
535 : : try
536 : : {
537 : 0 : sal_Bool bIsLocked = false;
538 [ # # ][ # # ]: 0 : if ( !( _aLocked >>= bIsLocked ) )
539 [ # # ][ # # ]: 0 : throw uno::RuntimeException();
540 : 0 : util::CellProtection aCellProtection;
541 [ # # # # ]: 0 : rtl::OUString sCellProt( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLPRO ) );
542 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue(sCellProt) >>= aCellProtection;
[ # # ][ # # ]
[ # # ][ # # ]
543 : 0 : aCellProtection.IsLocked = bIsLocked;
544 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue(sCellProt, uno::makeAny( aCellProtection ) );
[ # # ][ # # ]
[ # # ][ # # ]
545 : : }
546 [ # # # # ]: 0 : catch (const uno::Exception& )
547 : : {
548 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
549 : : }
550 : 0 : }
551 : :
552 : : template< typename Ifc1 >
553 : : void SAL_CALL
554 : 0 : ScVbaFormat<Ifc1>::setFormulaHidden( const uno::Any& FormulaHidden ) throw (script::BasicErrorException, uno::RuntimeException)
555 : : {
556 : : try
557 : : {
558 : 0 : sal_Bool bIsFormulaHidden = false;
559 : 0 : FormulaHidden >>= bIsFormulaHidden;
560 : 0 : util::CellProtection aCellProtection;
561 [ # # # # ]: 0 : rtl::OUString sCellProt( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLPRO ) );
562 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue(sCellProt) >>= aCellProtection;
[ # # ][ # # ]
[ # # ][ # # ]
563 : 0 : aCellProtection.IsFormulaHidden = bIsFormulaHidden;
564 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue(sCellProt,uno::makeAny(aCellProtection));
[ # # ][ # # ]
[ # # ][ # # ]
565 : : }
566 [ # # # # ]: 0 : catch (const uno::Exception& )
567 : : {
568 [ # # # # ]: 0 : DebugHelper::exception( SbERR_METHOD_FAILED, rtl::OUString() );
569 : : }
570 : 0 : }
571 : :
572 : : template< typename Ifc1 >
573 : : uno::Any SAL_CALL
574 : 0 : ScVbaFormat<Ifc1>::getLocked( ) throw (script::BasicErrorException, uno::RuntimeException)
575 : : {
576 : 0 : uno::Any aCellProtection = aNULL();
577 : : try
578 : : {
579 [ # # # # ]: 0 : rtl::OUString sCellProt( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLPRO ) );
580 : :
581 [ # # ][ # # ]: 0 : if (!isAmbiguous(sCellProt))
[ # # ][ # # ]
582 : : {
583 [ # # ][ # # ]: 0 : SfxItemSet* pDataSet = getCurrentDataSet();
584 [ # # ][ # # ]: 0 : if ( pDataSet )
585 : : {
586 [ # # ][ # # ]: 0 : const ScProtectionAttr& rProtAttr = (const ScProtectionAttr &) pDataSet->Get(ATTR_PROTECTION, sal_True);
587 [ # # ][ # # ]: 0 : SfxItemState eState = pDataSet->GetItemState(ATTR_PROTECTION, sal_True, NULL);
588 [ # # ][ # # ]: 0 : if(eState != SFX_ITEM_DONTCARE)
589 [ # # ][ # # ]: 0 : aCellProtection = uno::makeAny(rProtAttr.GetProtection());
590 : : }
591 : : else // fallback to propertyset
592 : : {
593 : 0 : util::CellProtection cellProtection;
594 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue(sCellProt) >>= aCellProtection;
[ # # ][ # # ]
595 [ # # ][ # # ]: 0 : aCellProtection = uno::makeAny( cellProtection.IsLocked );
596 : : }
597 : : }
598 : : }
599 [ # # # # : 0 : catch (const uno::Exception& )
# # # # ]
600 : : {
601 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
602 : : }
603 : 0 : return aCellProtection;
604 : : }
605 : :
606 : : template< typename Ifc1 >
607 : : uno::Any SAL_CALL
608 : 0 : ScVbaFormat<Ifc1>::getFormulaHidden( ) throw (script::BasicErrorException, uno::RuntimeException)
609 : : {
610 : 0 : uno::Any aBoolRet = aNULL();
611 : : try
612 : : {
613 [ # # # # ]: 0 : rtl::OUString sCellProt( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_CELLPRO ) );
614 [ # # ][ # # ]: 0 : if (!isAmbiguous(sCellProt))
[ # # ][ # # ]
615 : : {
616 [ # # ][ # # ]: 0 : SfxItemSet* pDataSet = getCurrentDataSet();
617 [ # # ][ # # ]: 0 : if ( pDataSet )
618 : : {
619 [ # # ][ # # ]: 0 : const ScProtectionAttr& rProtAttr = (const ScProtectionAttr &) pDataSet->Get(ATTR_PROTECTION, sal_True);
620 [ # # ][ # # ]: 0 : SfxItemState eState = pDataSet->GetItemState(ATTR_PROTECTION, sal_True, NULL);
621 [ # # ][ # # ]: 0 : if(eState != SFX_ITEM_DONTCARE)
622 [ # # ][ # # ]: 0 : aBoolRet = uno::makeAny(rProtAttr.GetHideFormula());
623 : : }
624 : : else
625 : : {
626 : 0 : util::CellProtection aCellProtection;
627 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue(sCellProt) >>= aCellProtection;
[ # # ][ # # ]
[ # # ][ # # ]
628 [ # # ][ # # ]: 0 : aBoolRet = uno::makeAny( aCellProtection.IsFormulaHidden );
629 : : }
630 : : }
631 : : }
632 [ # # # # : 0 : catch (const uno::Exception&)
# # # # ]
633 : : {
634 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
635 : : }
636 : 0 : return aBoolRet;
637 : : }
638 : :
639 : : template< typename Ifc1 >
640 : : void SAL_CALL
641 : 0 : ScVbaFormat<Ifc1>::setShrinkToFit( const uno::Any& ShrinkToFit ) throw (script::BasicErrorException, uno::RuntimeException)
642 : : {
643 : : try
644 : : {
645 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_SHRINK_TO_FIT ) ), ShrinkToFit);
[ # # ][ # # ]
[ # # ][ # # ]
646 : : }
647 [ # # # # ]: 0 : catch (const uno::Exception& )
648 : : {
649 [ # # # # ]: 0 : DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString() );
650 : : }
651 : :
652 : 0 : }
653 : :
654 : : template< typename Ifc1 >
655 : : uno::Any SAL_CALL
656 : 0 : ScVbaFormat<Ifc1>::getShrinkToFit( ) throw (script::BasicErrorException, uno::RuntimeException)
657 : : {
658 : 0 : uno::Any aRet = aNULL();
659 : : try
660 : : {
661 [ # # # # ]: 0 : rtl::OUString sShrinkToFit( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_SHRINK_TO_FIT ) );
662 [ # # ][ # # ]: 0 : if (!isAmbiguous(sShrinkToFit))
[ # # ][ # # ]
663 [ # # ][ # # ]: 0 : aRet = mxPropertySet->getPropertyValue(sShrinkToFit);
[ # # ][ # # ]
664 : : }
665 [ # # # # : 0 : catch (const uno::Exception& )
# # # # ]
666 : : {
667 [ # # # # ]: 0 : DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString());
668 : : }
669 : 0 : return aRet;
670 : : }
671 : :
672 : : template< typename Ifc1 >
673 : : void SAL_CALL
674 : 0 : ScVbaFormat<Ifc1>::setReadingOrder( const uno::Any& ReadingOrder ) throw (script::BasicErrorException, uno::RuntimeException)
675 : : {
676 : : try
677 : : {
678 : 0 : sal_Int32 nReadingOrder = 0;
679 [ # # ][ # # ]: 0 : if ( !(ReadingOrder >>= nReadingOrder ))
680 [ # # ][ # # ]: 0 : throw uno::RuntimeException();
681 : 0 : uno::Any aVal;
682 [ # # # # : 0 : switch(nReadingOrder)
# # # # ]
683 : : {
684 : : case excel::Constants::xlLTR:
685 [ # # ][ # # ]: 0 : aVal = uno::makeAny( text::WritingMode_LR_TB );
686 : 0 : break;
687 : : case excel::Constants::xlRTL:
688 [ # # ][ # # ]: 0 : aVal = uno::makeAny( text::WritingMode_RL_TB );
689 : 0 : break;
690 : : case excel::Constants::xlContext:
691 [ # # ][ # # ]: 0 : DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString());
692 : 0 : break;
693 : : default:
694 [ # # ][ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
695 : : }
696 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_WRITING ) ), aVal );
[ # # ][ # # ]
[ # # ][ # # ]
697 : : }
698 [ # # # # ]: 0 : catch (const uno::Exception& )
699 : : {
700 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
701 : : }
702 : :
703 : 0 : }
704 : :
705 : : template< typename Ifc1 >
706 : : uno::Any SAL_CALL
707 : 0 : ScVbaFormat<Ifc1>::getReadingOrder( ) throw (script::BasicErrorException, uno::RuntimeException)
708 : : {
709 : 0 : uno::Any NRetReadingOrder = aNULL();
710 : : try
711 : : {
712 [ # # # # ]: 0 : rtl::OUString sWritingMode( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_WRITING ) );
713 [ # # ][ # # ]: 0 : if (!isAmbiguous(sWritingMode))
[ # # ][ # # ]
714 : : {
715 : 0 : text::WritingMode aWritingMode = text::WritingMode_LR_TB;
716 [ # # ][ # # ]: 0 : if ( ( mxPropertySet->getPropertyValue(sWritingMode) ) >>= aWritingMode )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
717 [ # # # ]: 0 : switch (aWritingMode){
[ # # # ]
718 : : case text::WritingMode_LR_TB:
719 [ # # ][ # # ]: 0 : NRetReadingOrder = uno::makeAny(excel::Constants::xlLTR);
720 : 0 : break;
721 : : case text::WritingMode_RL_TB:
722 [ # # ][ # # ]: 0 : NRetReadingOrder = uno::makeAny(excel::Constants::xlRTL);
723 : 0 : break;
724 : : default:
725 [ # # ][ # # ]: 0 : NRetReadingOrder = uno::makeAny(excel::Constants::xlRTL);
726 : : }
727 : : }
728 : : }
729 [ # # # # : 0 : catch (const uno::Exception& )
# # # # ]
730 : : {
731 [ # # # # ]: 0 : DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString());
732 : : }
733 : 0 : return NRetReadingOrder;
734 : :
735 : : }
736 : :
737 : : template< typename Ifc1 >
738 : : uno::Any SAL_CALL
739 : 0 : ScVbaFormat< Ifc1 >::getNumberFormat( ) throw (script::BasicErrorException, uno::RuntimeException)
740 : : {
741 : 0 : uno::Any aFormat = aNULL();
742 : : try
743 : : {
744 : 0 : sal_Int32 nFormat = -1;
745 [ # # # # ]: 0 : rtl::OUString sNumFormat( RTL_CONSTASCII_USTRINGPARAM( SC_UNO_DP_NUMBERFO ) );
746 [ # # ][ # # ]: 0 : if (!isAmbiguous(sNumFormat) &&
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # # ]
747 : : ( mxPropertySet->getPropertyValue(sNumFormat) >>= nFormat) )
748 : : {
749 [ # # ][ # # ]: 0 : initializeNumberFormats();
750 : :
751 [ # # ][ # # ]: 0 : sal_Int32 nNewFormat = xNumberFormatTypes->getFormatForLocale(nFormat, getDefaultLocale() );
[ # # ][ # # ]
[ # # ][ # # ]
752 : 0 : rtl::OUString sFormat;
753 [ # # ][ # # ]: 0 : xNumberFormats->getByKey(nNewFormat)->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( FORMATSTRING ))) >>= sFormat;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
754 [ # # ][ # # ]: 0 : aFormat = uno::makeAny( sFormat );
755 : : }
756 : : }
757 [ # # # # : 0 : catch (const uno::Exception& )
# # # # ]
758 : : {
759 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
760 : : }
761 : 0 : return aFormat;
762 : : }
763 : :
764 : : template< typename Ifc1 >
765 : : bool
766 : 0 : ScVbaFormat<Ifc1>::isAmbiguous(const rtl::OUString& _sPropertyName) throw ( script::BasicErrorException )
767 : : {
768 : 0 : bool bResult = false;
769 : : try
770 : : {
771 [ # # ][ # # ]: 0 : if (mbCheckAmbiguoity)
772 [ # # ][ # # ]: 0 : bResult = ( getXPropertyState()->getPropertyState(_sPropertyName) == beans::PropertyState_AMBIGUOUS_VALUE );
[ # # ][ # # ]
[ # # ][ # # ]
773 : : }
774 [ # # # # ]: 0 : catch (const uno::Exception& )
775 : : {
776 [ # # # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
777 : : }
778 : 0 : return bResult;
779 : : }
780 : :
781 : : template< typename Ifc1 >
782 : : void
783 : 0 : ScVbaFormat<Ifc1>::initializeNumberFormats() throw ( script::BasicErrorException )
784 : : {
785 [ # # ][ # # ]: 0 : if ( !xNumberFormats.is() )
786 : : {
787 : 0 : mxNumberFormatsSupplier.set( mxModel, uno::UNO_QUERY_THROW );
788 [ # # ][ # # ]: 0 : xNumberFormats = mxNumberFormatsSupplier->getNumberFormats();
789 : 0 : xNumberFormatTypes.set( xNumberFormats, uno::UNO_QUERY ); // _THROW?
790 : : }
791 : 0 : }
792 : :
793 : : template< typename Ifc1 >
794 : : uno::Reference< beans::XPropertyState >
795 : 0 : ScVbaFormat<Ifc1>::getXPropertyState() throw ( uno::RuntimeException )
796 : : {
797 [ # # ][ # # ]: 0 : if ( !xPropertyState.is() )
798 : 0 : xPropertyState.set( mxPropertySet, uno::UNO_QUERY_THROW );
799 : 0 : return xPropertyState;
800 : : }
801 : :
802 : : template< typename Ifc1 >
803 : : rtl::OUString
804 : 0 : ScVbaFormat<Ifc1>::getServiceImplName()
805 : : {
806 : 0 : return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScVbaFormat"));
807 : : }
808 : :
809 : : template< typename Ifc1 >
810 : : uno::Sequence< rtl::OUString >
811 : 0 : ScVbaFormat<Ifc1>::getServiceNames()
812 : : {
813 [ # # ][ # # ]: 0 : static uno::Sequence< rtl::OUString > aServiceNames;
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
814 [ # # ][ # # ]: 0 : if ( aServiceNames.getLength() == 0 )
815 : : {
816 : 0 : aServiceNames.realloc( 1 );
817 [ # # ][ # # ]: 0 : aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Format" ) );
818 : : }
819 : 0 : return aServiceNames;
820 : : }
821 : :
822 : : template< typename Ifc1 >
823 : : ScCellRangesBase*
824 : 0 : ScVbaFormat<Ifc1>::getCellRangesBase() throw ( ::uno::RuntimeException )
825 : : {
826 [ # # ][ # # ]: 0 : return ScCellRangesBase::getImplementation( mxPropertySet );
827 : : }
828 : :
829 : : template< typename Ifc1 >
830 : : SfxItemSet*
831 : 0 : ScVbaFormat<Ifc1>::getCurrentDataSet( ) throw ( uno::RuntimeException )
832 : : {
833 : 0 : SfxItemSet* pDataSet = excel::ScVbaCellRangeAccess::GetDataSet( getCellRangesBase() );
834 [ # # # # ]: 0 : if ( !pDataSet )
835 [ # # ][ # # ]: 0 : throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't access Itemset for XPropertySet" ) ), uno::Reference< uno::XInterface >() );
[ # # ][ # # ]
836 : 0 : return pDataSet;
837 : : }
838 : :
839 : :
840 : : template class ScVbaFormat< excel::XStyle >;
841 : : template class ScVbaFormat< excel::XRange >;
842 : :
843 : :
844 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|