1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: servuno.cxx,v $
10 * $Revision: 1.17.32.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
36 #include <tools/debug.hxx>
37 #include <svtools/unoimap.hxx>
38 #include <svx/unofill.hxx>
39 #include <svx/unonrule.hxx>
40 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
41 #include <com/sun/star/container/XNameAccess.hpp>
43 #include "servuno.hxx"
44 #include "unonames.hxx"
45 #include "cellsuno.hxx"
46 #include "fielduno.hxx"
47 #include "styleuno.hxx"
48 #include "afmtuno.hxx"
49 #include "defltuno.hxx"
50 #include "drdefuno.hxx"
52 #include "drwlayer.hxx"
53 #include "confuno.hxx"
54 #include "shapeuno.hxx"
55 #include "cellvaluebinding.hxx"
56 #include "celllistsource.hxx"
57 #include "addruno.hxx"
58 #include "chart2uno.hxx"
59 #include "tokenuno.hxx"
61 // #100263# Support creation of GraphicObjectResolver and EmbeddedObjectResolver
62 #include <svx/xmleohlp.hxx>
63 #include <svx/xmlgrhlp.hxx>
65 #include <comphelper/processfactory.hxx>
66 #include <com/sun/star/document/XCodeNameQuery.hpp>
67 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
68 #include <com/sun/star/form/XFormsSupplier.hpp>
69 #include <com/sun/star/script/ScriptEventDescriptor.hpp>
70 #include <comphelper/componentcontext.hxx>
71 #include <cppuhelper/component_context.hxx>
72 #include <vbahelper/vbahelper.hxx>
73 using namespace ::com::sun::star
;
75 class ScVbaObjectForCodeNameProvider
: public ::cppu::WeakImplHelper1
< container::XNameAccess
>
78 uno::Any maCachedObject
;
79 ScDocShell
* mpDocShell
;
81 ScVbaObjectForCodeNameProvider( ScDocShell
* pDocShell
) : mpDocShell( pDocShell
)
83 ScDocument
* pDoc
= mpDocShell
->GetDocument();
85 throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("")), uno::Reference
< uno::XInterface
>() );
87 uno::Sequence
< uno::Any
> aArgs(2);
88 aArgs
[0] = uno::Any( uno::Reference
< uno::XInterface
>() );
89 aArgs
[1] = uno::Any( mpDocShell
->GetModel() );
90 maWorkbook
<<= ov::createVBAUnoAPIServiceWithArgs( mpDocShell
, "ooo.vba.excel.Workbook", aArgs
);
93 virtual ::sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
) throw (::com::sun::star::uno::RuntimeException
)
95 maCachedObject
= uno::Any(); // clear cached object
97 ScDocument
* pDoc
= mpDocShell
->GetDocument();
99 throw uno::RuntimeException();
100 if ( sName
== pDoc
->GetCodeName() )
101 maCachedObject
= maWorkbook
;
105 SCTAB nCount
= pDoc
->GetTableCount();
106 for( SCTAB i
= 0; i
< nCount
; i
++ )
108 pDoc
->GetCodeName( i
, sCodeName
);
109 if( sCodeName
== sName
)
112 if( pDoc
->GetName( i
, sSheetName
) )
114 uno::Reference
< frame::XModel
> xModel( mpDocShell
->GetModel() );
115 uno::Reference
<sheet::XSpreadsheetDocument
> xSpreadDoc( xModel
, uno::UNO_QUERY_THROW
);
116 uno::Reference
<sheet::XSpreadsheets
> xSheets( xSpreadDoc
->getSheets(), uno::UNO_QUERY_THROW
);
117 uno::Reference
< container::XIndexAccess
> xIndexAccess( xSheets
, uno::UNO_QUERY_THROW
);
118 uno::Reference
< sheet::XSpreadsheet
> xSheet( xIndexAccess
->getByIndex( i
), uno::UNO_QUERY_THROW
);
119 uno::Sequence
< uno::Any
> aArgs(3);
120 aArgs
[0] = maWorkbook
;
121 aArgs
[1] = uno::Any( xModel
);
122 aArgs
[2] = uno::Any( rtl::OUString( sSheetName
) );
123 maCachedObject
<<= ov::createVBAUnoAPIServiceWithArgs( mpDocShell
, "ooo.vba.excel.Worksheet", aArgs
);
129 return maCachedObject
.hasValue();
132 ::com::sun::star::uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
) throw (::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
)
134 OSL_TRACE("ScVbaObjectForCodeNameProvider::getByName( %s )",
135 rtl::OUStringToOString( aName
, RTL_TEXTENCODING_UTF8
).getStr() );
136 if ( !hasByName( aName
) )
137 throw ::com::sun::star::container::NoSuchElementException();
138 return maCachedObject
;
140 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames( ) throw (::com::sun::star::uno::RuntimeException
)
142 ScDocument
* pDoc
= mpDocShell
->GetDocument();
144 throw uno::RuntimeException();
145 SCTAB nCount
= pDoc
->GetTableCount();
146 uno::Sequence
< rtl::OUString
> aNames( nCount
+ 1 );
149 for( ; index
< nCount
; ++index
)
151 pDoc
->GetCodeName( index
, sCodeName
);
152 aNames
[ index
] = sCodeName
;
154 aNames
[ index
] = pDoc
->GetCodeName();
158 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType( ) throw (::com::sun::star::uno::RuntimeException
){ return uno::Type(); }
159 virtual ::sal_Bool SAL_CALL
hasElements( ) throw (::com::sun::star::uno::RuntimeException
) { return sal_True
; }
163 class ScVbaCodeNameProvider
: public ::cppu::WeakImplHelper1
< document::XCodeNameQuery
>
165 ScDocShell
* mpDocShell
;
167 ScVbaCodeNameProvider( ScDocShell
* pDocShell
) : mpDocShell( pDocShell
) {}
169 rtl::OUString SAL_CALL
getCodeNameForObject( const uno::Reference
< uno::XInterface
>& xIf
) throw( uno::RuntimeException
)
171 rtl::OUString sCodeName
;
174 OSL_TRACE( "*** In ScVbaCodeNameProvider::getCodeNameForObject");
175 // need to find the page ( and index ) for this control
176 uno::Reference
< drawing::XDrawPagesSupplier
> xSupplier( mpDocShell
->GetModel(), uno::UNO_QUERY_THROW
);
177 uno::Reference
< container::XIndexAccess
> xIndex( xSupplier
->getDrawPages(), uno::UNO_QUERY_THROW
);
178 sal_Int32 nLen
= xIndex
->getCount();
179 bool bMatched
= false;
180 uno::Sequence
< script::ScriptEventDescriptor
> aFakeEvents
;
181 for ( sal_Int32 index
= 0; index
< nLen
; ++index
)
185 uno::Reference
< form::XFormsSupplier
> xFormSupplier( xIndex
->getByIndex( index
), uno::UNO_QUERY_THROW
);
186 uno::Reference
< container::XIndexAccess
> xFormIndex( xFormSupplier
->getForms(), uno::UNO_QUERY_THROW
);
187 // get the www-standard container
188 uno::Reference
< container::XIndexAccess
> xFormControls( xFormIndex
->getByIndex(0), uno::UNO_QUERY_THROW
);
189 sal_Int32 nCntrls
= xFormControls
->getCount();
190 for( sal_Int32 cIndex
= 0; cIndex
< nCntrls
; ++cIndex
)
192 uno::Reference
< uno::XInterface
> xControl( xFormControls
->getByIndex( cIndex
), uno::UNO_QUERY_THROW
);
193 bMatched
= ( xControl
== xIf
);
197 mpDocShell
->GetDocument()->GetCodeName( index
, sName
);
202 catch( uno::Exception
& ) {}
207 // Probably should throw here ( if !bMatched )
213 //------------------------------------------------------------------------
215 static const sal_Char
* __FAR_DATA aProvNames
[SC_SERVICE_COUNT
] =
217 "com.sun.star.sheet.Spreadsheet", // SC_SERVICE_SHEET
218 "com.sun.star.text.TextField.URL", // SC_SERVICE_URLFIELD
219 "com.sun.star.text.TextField.PageNumber", // SC_SERVICE_PAGEFIELD
220 "com.sun.star.text.TextField.PageCount", // SC_SERVICE_PAGESFIELD
221 "com.sun.star.text.TextField.Date", // SC_SERVICE_DATEFIELD
222 "com.sun.star.text.TextField.Time", // SC_SERVICE_TIMEFIELD
223 "com.sun.star.text.TextField.DocumentTitle",// SC_SERVICE_TITLEFIELD
224 "com.sun.star.text.TextField.FileName", // SC_SERVICE_FILEFIELD
225 "com.sun.star.text.TextField.SheetName", // SC_SERVICE_SHEETFIELD
226 "com.sun.star.style.CellStyle", // SC_SERVICE_CELLSTYLE
227 "com.sun.star.style.PageStyle", // SC_SERVICE_PAGESTYLE
228 "com.sun.star.sheet.TableAutoFormat", // SC_SERVICE_AUTOFORMAT
229 "com.sun.star.sheet.SheetCellRanges", // SC_SERVICE_CELLRANGES
230 "com.sun.star.drawing.GradientTable", // SC_SERVICE_GRADTAB
231 "com.sun.star.drawing.HatchTable", // SC_SERVICE_HATCHTAB
232 "com.sun.star.drawing.BitmapTable", // SC_SERVICE_BITMAPTAB
233 "com.sun.star.drawing.TransparencyGradientTable", // SC_SERVICE_TRGRADTAB
234 "com.sun.star.drawing.MarkerTable", // SC_SERVICE_MARKERTAB
235 "com.sun.star.drawing.DashTable", // SC_SERVICE_DASHTAB
236 "com.sun.star.text.NumberingRules", // SC_SERVICE_NUMRULES
237 "com.sun.star.sheet.Defaults", // SC_SERVICE_DOCDEFLTS
238 "com.sun.star.drawing.Defaults", // SC_SERVICE_DRAWDEFLTS
239 "com.sun.star.comp.SpreadsheetSettings", // SC_SERVICE_DOCSPRSETT
240 "com.sun.star.document.Settings", // SC_SERVICE_DOCCONF
241 "com.sun.star.image.ImageMapRectangleObject",// SC_SERVICE_IMAP_RECT
242 "com.sun.star.image.ImageMapCircleObject", // SC_SERVICE_IMAP_CIRC
243 "com.sun.star.image.ImageMapPolygonObject", // SC_SERVICE_IMAP_POLY
245 // #100263# Support creation of GraphicObjectResolver and EmbeddedObjectResolver
246 "com.sun.star.document.ExportGraphicObjectResolver", // SC_SERVICE_EXPORT_GOR
247 "com.sun.star.document.ImportGraphicObjectResolver", // SC_SERVICE_IMPORT_GOR
248 "com.sun.star.document.ExportEmbeddedObjectResolver", // SC_SERVICE_EXPORT_EOR
249 "com.sun.star.document.ImportEmbeddedObjectResolver", // SC_SERVICE_IMPORT_EOR
251 SC_SERVICENAME_VALBIND
, // SC_SERVICE_VALBIND
252 SC_SERVICENAME_LISTCELLBIND
, // SC_SERVICE_LISTCELLBIND
253 SC_SERVICENAME_LISTSOURCE
, // SC_SERVICE_LISTSOURCE
254 SC_SERVICENAME_CELLADDRESS
, // SC_SERVICE_CELLADDRESS
255 SC_SERVICENAME_RANGEADDRESS
, // SC_SERVICE_RANGEADDRESS
257 "com.sun.star.sheet.DocumentSettings", // SC_SERVICE_SHEETDOCSET
259 SC_SERVICENAME_CHDATAPROV
, // SC_SERVICE_CHDATAPROV
260 SC_SERVICENAME_FORMULAPARS
, // SC_SERVICE_FORMULAPARS
261 SC_SERVICENAME_OPCODEMAPPER
, // SC_SERVICE_OPCODEMAPPER
262 "ooo.vba.VBAObjectModuleObjectProvider",// SC_SERVICE_VBAOBJECTPROVIDER
263 "ooo.vba.VBACodeNameProvider",// SC_SERVICE_VBACODENAMEPROVIDER
267 // old service names that were in 567 still work in createInstance,
268 // in case some macro is still using them
271 static const sal_Char
* __FAR_DATA aOldNames
[SC_SERVICE_COUNT
] =
273 "", // SC_SERVICE_SHEET
274 "stardiv.one.text.TextField.URL", // SC_SERVICE_URLFIELD
275 "stardiv.one.text.TextField.PageNumber", // SC_SERVICE_PAGEFIELD
276 "stardiv.one.text.TextField.PageCount", // SC_SERVICE_PAGESFIELD
277 "stardiv.one.text.TextField.Date", // SC_SERVICE_DATEFIELD
278 "stardiv.one.text.TextField.Time", // SC_SERVICE_TIMEFIELD
279 "stardiv.one.text.TextField.DocumentTitle", // SC_SERVICE_TITLEFIELD
280 "stardiv.one.text.TextField.FileName", // SC_SERVICE_FILEFIELD
281 "stardiv.one.text.TextField.SheetName", // SC_SERVICE_SHEETFIELD
282 "stardiv.one.style.CellStyle", // SC_SERVICE_CELLSTYLE
283 "stardiv.one.style.PageStyle", // SC_SERVICE_PAGESTYLE
284 "", // SC_SERVICE_AUTOFORMAT
285 "", // SC_SERVICE_CELLRANGES
286 "", // SC_SERVICE_GRADTAB
287 "", // SC_SERVICE_HATCHTAB
288 "", // SC_SERVICE_BITMAPTAB
289 "", // SC_SERVICE_TRGRADTAB
290 "", // SC_SERVICE_MARKERTAB
291 "", // SC_SERVICE_DASHTAB
292 "", // SC_SERVICE_NUMRULES
293 "", // SC_SERVICE_DOCDEFLTS
294 "", // SC_SERVICE_DRAWDEFLTS
295 "", // SC_SERVICE_DOCSPRSETT
296 "", // SC_SERVICE_DOCCONF
297 "", // SC_SERVICE_IMAP_RECT
298 "", // SC_SERVICE_IMAP_CIRC
299 "", // SC_SERVICE_IMAP_POLY
301 // #100263# Support creation of GraphicObjectResolver and EmbeddedObjectResolver
302 "", // SC_SERVICE_EXPORT_GOR
303 "", // SC_SERVICE_IMPORT_GOR
304 "", // SC_SERVICE_EXPORT_EOR
305 "", // SC_SERVICE_IMPORT_EOR
307 "", // SC_SERVICE_VALBIND
308 "", // SC_SERVICE_LISTCELLBIND
309 "", // SC_SERVICE_LISTSOURCE
310 "", // SC_SERVICE_CELLADDRESS
311 "", // SC_SERVICE_RANGEADDRESS
312 "", // SC_SERVICE_SHEETDOCSET
313 "", // SC_SERVICE_CHDATAPROV
314 "", // SC_SERVICE_FORMULAPARS
315 "", // SC_SERVICE_OPCODEMAPPER
316 "", // SC_SERVICE_VBAOBJECTPROVIDER
317 "", // SC_SERVICE_VBACODENAMEPROVIDER
323 //------------------------------------------------------------------------
327 //UNUSED2008-05 String ScServiceProvider::GetProviderName(sal_uInt16 nObjectType)
329 //UNUSED2008-05 String sRet;
330 //UNUSED2008-05 if (nObjectType < SC_SERVICE_COUNT)
331 //UNUSED2008-05 sRet = String::CreateFromAscii( aProvNames[nObjectType] );
332 //UNUSED2008-05 return sRet;
335 sal_uInt16
ScServiceProvider::GetProviderType(const String
& rServiceName
)
337 if (rServiceName
.Len())
340 for (i
=0; i
<SC_SERVICE_COUNT
; i
++)
341 if (rServiceName
.EqualsAscii( aProvNames
[i
] ))
344 for (i
=0; i
<SC_SERVICE_COUNT
; i
++)
346 DBG_ASSERT( aOldNames
[i
], "ScServiceProvider::GetProviderType: no oldname => crash");
347 if (rServiceName
.EqualsAscii( aOldNames
[i
] ))
349 DBG_ERROR("old service name used");
354 return SC_SERVICE_INVALID
;
357 uno::Reference
<uno::XInterface
> ScServiceProvider::MakeInstance(
358 sal_uInt16 nType
, ScDocShell
* pDocShell
)
360 uno::Reference
<uno::XInterface
> xRet
;
363 case SC_SERVICE_SHEET
:
364 // noch nicht eingefuegt - DocShell=Null
365 xRet
.set((sheet::XSpreadsheet
*)new ScTableSheetObj(NULL
,0));
367 case SC_SERVICE_URLFIELD
:
368 xRet
.set((text::XTextField
*)new ScCellFieldObj( NULL
, ScAddress(), ESelection() ));
370 case SC_SERVICE_PAGEFIELD
:
371 case SC_SERVICE_PAGESFIELD
:
372 case SC_SERVICE_DATEFIELD
:
373 case SC_SERVICE_TIMEFIELD
:
374 case SC_SERVICE_TITLEFIELD
:
375 case SC_SERVICE_FILEFIELD
:
376 case SC_SERVICE_SHEETFIELD
:
377 xRet
.set((text::XTextField
*)new ScHeaderFieldObj( NULL
, 0, nType
, ESelection() ));
379 case SC_SERVICE_CELLSTYLE
:
380 xRet
.set((style::XStyle
*)new ScStyleObj( NULL
, SFX_STYLE_FAMILY_PARA
, String() ));
382 case SC_SERVICE_PAGESTYLE
:
383 xRet
.set((style::XStyle
*)new ScStyleObj( NULL
, SFX_STYLE_FAMILY_PAGE
, String() ));
385 case SC_SERVICE_AUTOFORMAT
:
386 xRet
.set((container::XIndexAccess
*)new ScAutoFormatObj( SC_AFMTOBJ_INVALID
));
388 case SC_SERVICE_CELLRANGES
:
389 // wird nicht eingefuegt, sondern gefuellt
390 // -> DocShell muss gesetzt sein, aber leere Ranges
392 xRet
.set((sheet::XSheetCellRanges
*)new ScCellRangesObj( pDocShell
, ScRangeList() ));
395 case SC_SERVICE_DOCDEFLTS
:
397 xRet
.set((beans::XPropertySet
*)new ScDocDefaultsObj( pDocShell
));
399 case SC_SERVICE_DRAWDEFLTS
:
401 xRet
.set((beans::XPropertySet
*)new ScDrawDefaultsObj( pDocShell
));
404 // Drawing layer tables are not in SvxUnoDrawMSFactory,
405 // because SvxUnoDrawMSFactory doesn't have a SdrModel pointer.
406 // Drawing layer is always allocated if not there (MakeDrawLayer).
408 case SC_SERVICE_GRADTAB
:
410 xRet
.set(SvxUnoGradientTable_createInstance( pDocShell
->MakeDrawLayer() ));
412 case SC_SERVICE_HATCHTAB
:
414 xRet
.set(SvxUnoHatchTable_createInstance( pDocShell
->MakeDrawLayer() ));
416 case SC_SERVICE_BITMAPTAB
:
418 xRet
.set(SvxUnoBitmapTable_createInstance( pDocShell
->MakeDrawLayer() ));
420 case SC_SERVICE_TRGRADTAB
:
422 xRet
.set(SvxUnoTransGradientTable_createInstance( pDocShell
->MakeDrawLayer() ));
424 case SC_SERVICE_MARKERTAB
:
426 xRet
.set(SvxUnoMarkerTable_createInstance( pDocShell
->MakeDrawLayer() ));
428 case SC_SERVICE_DASHTAB
:
430 xRet
.set(SvxUnoDashTable_createInstance( pDocShell
->MakeDrawLayer() ));
432 case SC_SERVICE_NUMRULES
:
434 xRet
.set(SvxCreateNumRule( pDocShell
->MakeDrawLayer() ));
436 case SC_SERVICE_DOCSPRSETT
:
437 case SC_SERVICE_SHEETDOCSET
:
438 case SC_SERVICE_DOCCONF
:
440 xRet
.set((beans::XPropertySet
*)new ScDocumentConfiguration(pDocShell
));
443 case SC_SERVICE_IMAP_RECT
:
444 xRet
.set(SvUnoImageMapRectangleObject_createInstance( ScShapeObj::GetSupportedMacroItems() ));
446 case SC_SERVICE_IMAP_CIRC
:
447 xRet
.set(SvUnoImageMapCircleObject_createInstance( ScShapeObj::GetSupportedMacroItems() ));
449 case SC_SERVICE_IMAP_POLY
:
450 xRet
.set(SvUnoImageMapPolygonObject_createInstance( ScShapeObj::GetSupportedMacroItems() ));
453 // #100263# Support creation of GraphicObjectResolver and EmbeddedObjectResolver
454 case SC_SERVICE_EXPORT_GOR
:
455 xRet
.set((::cppu::OWeakObject
* )new SvXMLGraphicHelper( GRAPHICHELPER_MODE_WRITE
));
458 case SC_SERVICE_IMPORT_GOR
:
459 xRet
.set((::cppu::OWeakObject
* )new SvXMLGraphicHelper( GRAPHICHELPER_MODE_READ
));
462 case SC_SERVICE_EXPORT_EOR
:
464 xRet
.set((::cppu::OWeakObject
* )new SvXMLEmbeddedObjectHelper( *pDocShell
, EMBEDDEDOBJECTHELPER_MODE_WRITE
));
467 case SC_SERVICE_IMPORT_EOR
:
469 xRet
.set((::cppu::OWeakObject
* )new SvXMLEmbeddedObjectHelper( *pDocShell
, EMBEDDEDOBJECTHELPER_MODE_READ
));
472 case SC_SERVICE_VALBIND
:
473 case SC_SERVICE_LISTCELLBIND
:
476 sal_Bool bListPos
= ( nType
== SC_SERVICE_LISTCELLBIND
);
477 uno::Reference
<sheet::XSpreadsheetDocument
> xDoc( pDocShell
->GetBaseModel(), uno::UNO_QUERY
);
478 xRet
.set(*new calc::OCellValueBinding( xDoc
, bListPos
));
481 case SC_SERVICE_LISTSOURCE
:
484 uno::Reference
<sheet::XSpreadsheetDocument
> xDoc( pDocShell
->GetBaseModel(), uno::UNO_QUERY
);
485 xRet
.set(*new calc::OCellListSource( xDoc
));
488 case SC_SERVICE_CELLADDRESS
:
489 case SC_SERVICE_RANGEADDRESS
:
492 sal_Bool bRange
= ( nType
== SC_SERVICE_RANGEADDRESS
);
493 xRet
.set(*new ScAddressConversionObj( pDocShell
, bRange
));
497 case SC_SERVICE_CHDATAPROV
:
498 if (pDocShell
&& pDocShell
->GetDocument())
499 xRet
= *new ScChart2DataProvider( pDocShell
->GetDocument() );
502 case SC_SERVICE_FORMULAPARS
:
504 xRet
.set(static_cast<sheet::XFormulaParser
*>(new ScFormulaParserObj( pDocShell
)));
507 case SC_SERVICE_OPCODEMAPPER
:
509 ScDocument
* pDoc
= pDocShell
->GetDocument();
511 ScCompiler
* pComp
= new ScCompiler(pDoc
,aAddress
);
512 pComp
->SetGrammar( pDoc
->GetGrammar() );
513 xRet
.set(static_cast<sheet::XFormulaOpCodeMapper
*>(new ScFormulaOpCodeMapperObj(::std::auto_ptr
<formula::FormulaCompiler
> (pComp
))));
516 case SC_SERVICE_VBAOBJECTPROVIDER
:
517 xRet
.set(static_cast<container::XNameAccess
*>(new ScVbaObjectForCodeNameProvider( pDocShell
)));
519 case SC_SERVICE_VBACODENAMEPROVIDER
:
520 xRet
.set(static_cast<document::XCodeNameQuery
*>(new ScVbaCodeNameProvider( pDocShell
)));
526 uno::Sequence
<rtl::OUString
> ScServiceProvider::GetAllServiceNames()
528 uno::Sequence
<rtl::OUString
> aRet(SC_SERVICE_COUNT
);
529 rtl::OUString
* pArray
= aRet
.getArray();
530 for (sal_uInt16 i
= 0; i
< SC_SERVICE_COUNT
; i
++)
531 pArray
[i
] = rtl::OUString::createFromAscii( aProvNames
[i
] );