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: vbastyles.cxx,v $
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 ************************************************************************/
30 #include "vbastyles.hxx"
31 #include "vbastyle.hxx"
32 #include <cppuhelper/implbase3.hxx>
33 #include <com/sun/star/container/XEnumerationAccess.hpp>
34 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
35 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
36 #include <com/sun/star/style/XStyle.hpp>
37 #include <ooo/vba/word/WdBuiltinStyle.hpp>
38 #include <ooo/vba/word/WdStyleType.hpp>
40 using namespace ::ooo::vba
;
41 using namespace ::com::sun::star
;
43 struct BuiltinStyleTable
45 sal_Int32 wdBuiltinStyle
;
46 const sal_Char
* pOOoStyleName
;
47 sal_Int32 wdStyleType
;
50 const BuiltinStyleTable aBuiltinStyleTable
[] =
52 { word::WdBuiltinStyle::wdStyleBlockQuotation
, "", word::WdStyleType::wdStyleTypeParagraph
},
53 { word::WdBuiltinStyle::wdStyleBodyText
, "Text body", word::WdStyleType::wdStyleTypeParagraph
},
54 { word::WdBuiltinStyle::wdStyleBodyText2
, "", word::WdStyleType::wdStyleTypeParagraph
},
55 { word::WdBuiltinStyle::wdStyleBodyText3
, "", word::WdStyleType::wdStyleTypeParagraph
},
56 { word::WdBuiltinStyle::wdStyleBodyTextFirstIndent
, "First line indent", word::WdStyleType::wdStyleTypeParagraph
},
57 { word::WdBuiltinStyle::wdStyleBodyTextFirstIndent2
, "", word::WdStyleType::wdStyleTypeParagraph
},
58 { word::WdBuiltinStyle::wdStyleBodyTextIndent
, "Text body indent", word::WdStyleType::wdStyleTypeParagraph
},
59 { word::WdBuiltinStyle::wdStyleBodyTextIndent2
, "", word::WdStyleType::wdStyleTypeParagraph
},
60 { word::WdBuiltinStyle::wdStyleBodyTextIndent3
, "", word::WdStyleType::wdStyleTypeParagraph
},
61 { word::WdBuiltinStyle::wdStyleCaption
, "", word::WdStyleType::wdStyleTypeParagraph
},
62 { word::WdBuiltinStyle::wdStyleClosing
, "", word::WdStyleType::wdStyleTypeParagraph
},
63 { word::WdBuiltinStyle::wdStyleCommentReference
, "", word::WdStyleType::wdStyleTypeParagraph
},
64 { word::WdBuiltinStyle::wdStyleCommentText
, "", word::WdStyleType::wdStyleTypeParagraph
},
65 { word::WdBuiltinStyle::wdStyleDate
, "", word::WdStyleType::wdStyleTypeParagraph
},
66 { word::WdBuiltinStyle::wdStyleDefaultParagraphFont
, "", word::WdStyleType::wdStyleTypeParagraph
},
67 { word::WdBuiltinStyle::wdStyleEmphasis
, "", word::WdStyleType::wdStyleTypeParagraph
},
68 { word::WdBuiltinStyle::wdStyleEndnoteReference
, "", word::WdStyleType::wdStyleTypeParagraph
},
69 { word::WdBuiltinStyle::wdStyleEndnoteText
, "Endnote", word::WdStyleType::wdStyleTypeParagraph
},
70 { word::WdBuiltinStyle::wdStyleEnvelopeAddress
, "", word::WdStyleType::wdStyleTypeParagraph
},
71 { word::WdBuiltinStyle::wdStyleEnvelopeReturn
, "", word::WdStyleType::wdStyleTypeParagraph
},
72 { word::WdBuiltinStyle::wdStyleFooter
, "", word::WdStyleType::wdStyleTypeParagraph
},
73 { word::WdBuiltinStyle::wdStyleFootnoteReference
, "", word::WdStyleType::wdStyleTypeParagraph
},
74 { word::WdBuiltinStyle::wdStyleFootnoteText
, "Footnote", word::WdStyleType::wdStyleTypeParagraph
},
75 { word::WdBuiltinStyle::wdStyleHeader
, "Header", word::WdStyleType::wdStyleTypeParagraph
},
76 { word::WdBuiltinStyle::wdStyleHeading1
, "Heading 1", word::WdStyleType::wdStyleTypeParagraph
},
77 { word::WdBuiltinStyle::wdStyleHeading2
, "Heading 2", word::WdStyleType::wdStyleTypeParagraph
},
78 { word::WdBuiltinStyle::wdStyleHeading3
, "Heading 3", word::WdStyleType::wdStyleTypeParagraph
},
79 { word::WdBuiltinStyle::wdStyleHeading4
, "Heading 4", word::WdStyleType::wdStyleTypeParagraph
},
80 { word::WdBuiltinStyle::wdStyleHeading5
, "Heading 5", word::WdStyleType::wdStyleTypeParagraph
},
81 { word::WdBuiltinStyle::wdStyleHeading6
, "Heading 6", word::WdStyleType::wdStyleTypeParagraph
},
82 { word::WdBuiltinStyle::wdStyleHeading7
, "Heading 7", word::WdStyleType::wdStyleTypeParagraph
},
83 { word::WdBuiltinStyle::wdStyleHeading8
, "Heading 8", word::WdStyleType::wdStyleTypeParagraph
},
84 { word::WdBuiltinStyle::wdStyleHeading9
, "Heading 9", word::WdStyleType::wdStyleTypeParagraph
},
85 { word::WdBuiltinStyle::wdStyleHtmlAcronym
, "", word::WdStyleType::wdStyleTypeParagraph
},
86 { word::WdBuiltinStyle::wdStyleHtmlAddress
, "", word::WdStyleType::wdStyleTypeParagraph
},
87 { word::WdBuiltinStyle::wdStyleHtmlCite
, "", word::WdStyleType::wdStyleTypeParagraph
},
88 { word::WdBuiltinStyle::wdStyleHtmlCode
, "", word::WdStyleType::wdStyleTypeParagraph
},
89 { word::WdBuiltinStyle::wdStyleHtmlDfn
, "", word::WdStyleType::wdStyleTypeParagraph
},
90 { word::WdBuiltinStyle::wdStyleHtmlKbd
, "", word::WdStyleType::wdStyleTypeParagraph
},
91 { word::WdBuiltinStyle::wdStyleHtmlNormal
, "", word::WdStyleType::wdStyleTypeParagraph
},
92 { word::WdBuiltinStyle::wdStyleHtmlPre
, "", word::WdStyleType::wdStyleTypeParagraph
},
93 { word::WdBuiltinStyle::wdStyleHtmlSamp
, "", word::WdStyleType::wdStyleTypeParagraph
},
94 { word::WdBuiltinStyle::wdStyleHtmlTt
, "", word::WdStyleType::wdStyleTypeParagraph
},
95 { word::WdBuiltinStyle::wdStyleHtmlVar
, "", word::WdStyleType::wdStyleTypeParagraph
},
96 { word::WdBuiltinStyle::wdStyleHyperlink
, "", word::WdStyleType::wdStyleTypeParagraph
},
97 { word::WdBuiltinStyle::wdStyleHyperlinkFollowed
, "", word::WdStyleType::wdStyleTypeParagraph
},
98 { word::WdBuiltinStyle::wdStyleIndex1
, "Index 1", word::WdStyleType::wdStyleTypeParagraph
},
99 { word::WdBuiltinStyle::wdStyleIndex2
, "Index 2", word::WdStyleType::wdStyleTypeParagraph
},
100 { word::WdBuiltinStyle::wdStyleIndex3
, "Index 3", word::WdStyleType::wdStyleTypeParagraph
},
101 { word::WdBuiltinStyle::wdStyleIndex4
, "", word::WdStyleType::wdStyleTypeParagraph
},
102 { word::WdBuiltinStyle::wdStyleIndex5
, "", word::WdStyleType::wdStyleTypeParagraph
},
103 { word::WdBuiltinStyle::wdStyleIndex6
, "", word::WdStyleType::wdStyleTypeParagraph
},
104 { word::WdBuiltinStyle::wdStyleIndex7
, "", word::WdStyleType::wdStyleTypeParagraph
},
105 { word::WdBuiltinStyle::wdStyleIndex8
, "", word::WdStyleType::wdStyleTypeParagraph
},
106 { word::WdBuiltinStyle::wdStyleIndex9
, "", word::WdStyleType::wdStyleTypeParagraph
},
107 { word::WdBuiltinStyle::wdStyleIndexHeading
, "Index Heading", word::WdStyleType::wdStyleTypeParagraph
},
108 { word::WdBuiltinStyle::wdStyleLineNumber
, "", word::WdStyleType::wdStyleTypeParagraph
},
109 { word::WdBuiltinStyle::wdStyleList
, "List", word::WdStyleType::wdStyleTypeParagraph
},
110 { word::WdBuiltinStyle::wdStyleList2
, "List 2", word::WdStyleType::wdStyleTypeParagraph
},
111 { word::WdBuiltinStyle::wdStyleList3
, "List 3", word::WdStyleType::wdStyleTypeParagraph
},
112 { word::WdBuiltinStyle::wdStyleList4
, "List 4", word::WdStyleType::wdStyleTypeParagraph
},
113 { word::WdBuiltinStyle::wdStyleList5
, "List 5", word::WdStyleType::wdStyleTypeParagraph
},
114 { word::WdBuiltinStyle::wdStyleListBullet
, "List 1", word::WdStyleType::wdStyleTypeList
},
115 { word::WdBuiltinStyle::wdStyleListBullet2
, "List 2", word::WdStyleType::wdStyleTypeList
},
116 { word::WdBuiltinStyle::wdStyleListBullet3
, "List 3", word::WdStyleType::wdStyleTypeList
},
117 { word::WdBuiltinStyle::wdStyleListBullet4
, "List 4", word::WdStyleType::wdStyleTypeList
},
118 { word::WdBuiltinStyle::wdStyleListBullet5
, "List 5", word::WdStyleType::wdStyleTypeList
},
119 { word::WdBuiltinStyle::wdStyleListContinue
, "", word::WdStyleType::wdStyleTypeParagraph
},
120 { word::WdBuiltinStyle::wdStyleListContinue2
, "", word::WdStyleType::wdStyleTypeParagraph
},
121 { word::WdBuiltinStyle::wdStyleListContinue3
, "", word::WdStyleType::wdStyleTypeParagraph
},
122 { word::WdBuiltinStyle::wdStyleListContinue4
, "", word::WdStyleType::wdStyleTypeParagraph
},
123 { word::WdBuiltinStyle::wdStyleListContinue5
, "", word::WdStyleType::wdStyleTypeParagraph
},
124 { word::WdBuiltinStyle::wdStyleListNumber
, "Numbering 1", word::WdStyleType::wdStyleTypeList
},
125 { word::WdBuiltinStyle::wdStyleListNumber2
, "Numbering 2", word::WdStyleType::wdStyleTypeList
},
126 { word::WdBuiltinStyle::wdStyleListNumber3
, "Numbering 3", word::WdStyleType::wdStyleTypeList
},
127 { word::WdBuiltinStyle::wdStyleListNumber4
, "Numbering 4", word::WdStyleType::wdStyleTypeList
},
128 { word::WdBuiltinStyle::wdStyleListNumber5
, "Numbering 5", word::WdStyleType::wdStyleTypeList
},
129 { word::WdBuiltinStyle::wdStyleMacroText
, "", word::WdStyleType::wdStyleTypeParagraph
},
130 { word::WdBuiltinStyle::wdStyleMessageHeader
, "", word::WdStyleType::wdStyleTypeParagraph
},
131 { word::WdBuiltinStyle::wdStyleNavPane
, "", word::WdStyleType::wdStyleTypeParagraph
},
132 { word::WdBuiltinStyle::wdStyleNormal
, "Default", word::WdStyleType::wdStyleTypeParagraph
},
133 { word::WdBuiltinStyle::wdStyleNormalIndent
, "", word::WdStyleType::wdStyleTypeParagraph
},
134 { word::WdBuiltinStyle::wdStyleNormalTable
, "Table", word::WdStyleType::wdStyleTypeParagraph
},
135 { word::WdBuiltinStyle::wdStyleNoteHeading
, "", word::WdStyleType::wdStyleTypeParagraph
},
136 { word::WdBuiltinStyle::wdStylePageNumber
, "", word::WdStyleType::wdStyleTypeParagraph
},
137 { word::WdBuiltinStyle::wdStylePlainText
, "", word::WdStyleType::wdStyleTypeParagraph
},
138 { word::WdBuiltinStyle::wdStyleSalutation
, "", word::WdStyleType::wdStyleTypeParagraph
},
139 { word::WdBuiltinStyle::wdStyleSignature
, "", word::WdStyleType::wdStyleTypeParagraph
},
140 { word::WdBuiltinStyle::wdStyleStrong
, "", word::WdStyleType::wdStyleTypeParagraph
},
141 { word::WdBuiltinStyle::wdStyleSubtitle
, "", word::WdStyleType::wdStyleTypeParagraph
},
142 { word::WdBuiltinStyle::wdStyleTableOfAuthorities
, "", word::WdStyleType::wdStyleTypeParagraph
},
143 { word::WdBuiltinStyle::wdStyleTableOfFigures
, "", word::WdStyleType::wdStyleTypeParagraph
},
144 { word::WdBuiltinStyle::wdStyleTitle
, "Title", word::WdStyleType::wdStyleTypeParagraph
},
145 { word::WdBuiltinStyle::wdStyleTOAHeading
, "Contents Heading", word::WdStyleType::wdStyleTypeParagraph
},
146 { word::WdBuiltinStyle::wdStyleTOC1
, "Contents 1", word::WdStyleType::wdStyleTypeParagraph
},
147 { word::WdBuiltinStyle::wdStyleTOC2
, "Contents 2", word::WdStyleType::wdStyleTypeParagraph
},
148 { word::WdBuiltinStyle::wdStyleTOC3
, "Contents 3", word::WdStyleType::wdStyleTypeParagraph
},
149 { word::WdBuiltinStyle::wdStyleTOC4
, "Contents 4", word::WdStyleType::wdStyleTypeParagraph
},
150 { word::WdBuiltinStyle::wdStyleTOC5
, "Contents 5", word::WdStyleType::wdStyleTypeParagraph
},
151 { word::WdBuiltinStyle::wdStyleTOC6
, "Contents 6", word::WdStyleType::wdStyleTypeParagraph
},
152 { word::WdBuiltinStyle::wdStyleTOC7
, "Contents 7", word::WdStyleType::wdStyleTypeParagraph
},
153 { word::WdBuiltinStyle::wdStyleTOC8
, "Contents 8", word::WdStyleType::wdStyleTypeParagraph
},
154 { word::WdBuiltinStyle::wdStyleTOC9
, "Contents 9", word::WdStyleType::wdStyleTypeParagraph
},
159 static uno::Sequence
< rtl::OUString
> getStyleTypes()
161 uno::Sequence
< rtl::OUString
> aRet(3);
162 rtl::OUString
* pArray
= aRet
.getArray();
163 pArray
[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") );
164 pArray
[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharacterStyles") );
165 pArray
[2] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") );
169 typedef ::cppu::WeakImplHelper1
< container::XEnumeration
> StyleEnumeration_BASE
;
170 typedef ::cppu::WeakImplHelper3
< container::XNameAccess
, container::XIndexAccess
, container::XEnumerationAccess
> StyleCollectionHelper_BASE
;
172 class StylesEnumeration : public StyleEnumeration_BASE
175 StylesEnumeration( const SheetMap& sMap ) : mSheetMap( sMap ), mIt( mSheetMap.begin() ) {}
176 virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
178 return ( mIt != mSheetMap.end() );
180 virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
182 if ( !hasMoreElements() )
183 throw container::NoSuchElementException();
184 uno::Reference< sheet::XSpreadsheet > xSheet( *mIt++ );
185 return uno::makeAny( xSheet ) ;
189 class StyleCollectionHelper
: public StyleCollectionHelper_BASE
192 uno::Reference
< frame::XModel
> mxModel
;
193 uno::Reference
< container::XNameAccess
> mxStyleFamilies
;
194 uno::Reference
< container::XNameContainer
> mxCurrentStyleFamily
;
197 StyleCollectionHelper( const uno::Reference
< frame::XModel
>& _xModel
) : mxModel( _xModel
)
199 uno::Reference
< style::XStyleFamiliesSupplier
> xStyleSupplier( _xModel
, uno::UNO_QUERY_THROW
);
200 mxStyleFamilies
= xStyleSupplier
->getStyleFamilies();
202 uno::Reference
< container::XNameContainer
> getCurrentStyleFamily(){ return mxCurrentStyleFamily
; }
204 virtual uno::Type SAL_CALL
getElementType( ) throw (uno::RuntimeException
) { return style::XStyle::static_type(0); }
205 virtual ::sal_Bool SAL_CALL
hasElements( ) throw (uno::RuntimeException
) { return getCount() > 0; }
207 virtual uno::Any SAL_CALL
getByName( const ::rtl::OUString
& aName
) throw (container::NoSuchElementException
, lang::WrappedTargetException
, uno::RuntimeException
)
209 if ( !hasByName(aName
) )
210 throw container::NoSuchElementException();
213 virtual uno::Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames( ) throw (uno::RuntimeException
)
215 uno::Sequence
< rtl::OUString
> sNames( getCount() );
216 rtl::OUString
* pString
= sNames
.getArray();
217 uno::Sequence
< rtl::OUString
> aStyleTypes
= getStyleTypes();
218 sal_Int32 nCount
= 0;
219 for( sal_Int32 i
= 0; i
< aStyleTypes
.getLength(); i
++ )
221 uno::Reference
< container::XNameAccess
> xNameAccess( mxStyleFamilies
->getByName( aStyleTypes
[i
] ), uno::UNO_QUERY_THROW
);
222 uno::Sequence
< rtl::OUString
> sElementNames
= xNameAccess
->getElementNames();
223 for( sal_Int32 j
= 0; j
< sElementNames
.getLength(); j
++ )
225 pString
[nCount
++] = sElementNames
[j
];
230 virtual ::sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
) throw (uno::RuntimeException
)
232 uno::Sequence
< rtl::OUString
> aStyleTypes
= getStyleTypes();
233 for( sal_Int32 i
= 0; i
< aStyleTypes
.getLength(); i
++ )
235 uno::Reference
< container::XNameAccess
> xNameAccess( mxStyleFamilies
->getByName( aStyleTypes
[i
] ), uno::UNO_QUERY_THROW
);
236 if( xNameAccess
->hasByName( aName
) )
238 cachePos
= xNameAccess
->getByName( aName
);
239 mxCurrentStyleFamily
.set( xNameAccess
, uno::UNO_QUERY_THROW
);
247 virtual ::sal_Int32 SAL_CALL
getCount( ) throw (uno::RuntimeException
)
249 uno::Sequence
< rtl::OUString
> aStyleTypes
= getStyleTypes();
250 sal_Int32 nCount
= 0;
251 for( sal_Int32 i
= 0; i
< aStyleTypes
.getLength(); i
++ )
253 uno::Reference
< container::XIndexAccess
> xIndexAccess( mxStyleFamilies
->getByName( aStyleTypes
[i
] ), uno::UNO_QUERY_THROW
);
254 nCount
+= xIndexAccess
->getCount();
258 virtual uno::Any SAL_CALL
getByIndex( ::sal_Int32 Index
) throw (lang::IndexOutOfBoundsException
, lang::WrappedTargetException
, uno::RuntimeException
)
260 if ( Index
< 0 || Index
>= getCount() )
261 throw lang::IndexOutOfBoundsException();
263 // FIXME: need to make a alphabetically sorted list of style names
264 uno::Sequence
< rtl::OUString
> aStyleTypes
= getStyleTypes();
265 for( sal_Int32 i
= 0; i
< aStyleTypes
.getLength(); i
++ )
267 uno::Reference
< container::XIndexAccess
> xIndexAccess( mxStyleFamilies
->getByName( aStyleTypes
[i
] ), uno::UNO_QUERY_THROW
);
268 sal_Int32 nCount
= xIndexAccess
->getCount();
269 if( Index
>= nCount
)
273 mxCurrentStyleFamily
.set( xIndexAccess
, uno::UNO_QUERY_THROW
);
274 return xIndexAccess
->getByIndex( Index
);
277 throw lang::IndexOutOfBoundsException();
279 // XEnumerationAccess
280 virtual uno::Reference
< container::XEnumeration
> SAL_CALL
createEnumeration( ) throw (uno::RuntimeException
)
283 throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference
< uno::XInterface
>() );
287 SwVbaStyles::SwVbaStyles( const uno::Reference
< XHelperInterface
>& xParent
, const uno::Reference
< css::uno::XComponentContext
> & xContext
, const uno::Reference
< frame::XModel
>& xModel
) throw ( script::BasicErrorException
) : SwVbaStyles_BASE( xParent
, xContext
, uno::Reference
< container::XIndexAccess
>( new StyleCollectionHelper( xModel
) ) ), mxModel( xModel
)
289 mxMSF
.set( mxModel
, uno::UNO_QUERY_THROW
);
293 SwVbaStyles::createCollectionObject(const uno::Any
& aObject
)
295 uno::Reference
< beans::XPropertySet
> xStyleProp( aObject
, uno::UNO_QUERY_THROW
);
296 return uno::makeAny( uno::Reference
< word::XStyle
>( new SwVbaStyle( this, mxContext
, xStyleProp
) ) );
300 SwVbaStyles::getElementType() throw (uno::RuntimeException
)
302 return word::XStyle::static_type(0);
305 uno::Reference
< container::XEnumeration
> SAL_CALL
306 SwVbaStyles::createEnumeration() throw (uno::RuntimeException
)
308 throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference
< uno::XInterface
>() );
312 SwVbaStyles::Item( const uno::Any
& Index1
, const uno::Any
& Index2
) throw (uno::RuntimeException
)
314 //handle WdBuiltinStyle
315 sal_Int32 nIndex
= 0;
316 if( ( Index1
>>= nIndex
) && ( nIndex
< 0 ) )
318 for( const BuiltinStyleTable
* pTable
= aBuiltinStyleTable
; pTable
!= NULL
; pTable
++ )
320 if( nIndex
== pTable
->wdBuiltinStyle
)
322 rtl::OUString aStyleName
= rtl::OUString::createFromAscii( pTable
->pOOoStyleName
);
323 if( aStyleName
.getLength() > 0 )
325 rtl::OUString aStyleType
= SwVbaStyle::getOOoStyleTypeFromMSWord( pTable
->wdStyleType
);
326 switch( pTable
->wdStyleType
)
328 case word::WdStyleType::wdStyleTypeParagraph
:
329 case word::WdStyleType::wdStyleTypeTable
:
331 aStyleType
= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") );
334 case word::WdStyleType::wdStyleTypeCharacter
:
336 aStyleType
= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharacterStyles") );
339 case word::WdStyleType::wdStyleTypeList
:
341 aStyleType
= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") );
345 DebugHelper::exception( SbERR_INTERNAL_ERROR
, rtl::OUString() );
347 uno::Reference
< style::XStyleFamiliesSupplier
> xStyleSupplier( mxModel
, uno::UNO_QUERY_THROW
);
348 uno::Reference
< container::XNameAccess
> xStylesAccess( xStyleSupplier
->getStyleFamilies()->getByName( aStyleType
), uno::UNO_QUERY_THROW
);
349 uno::Reference
< beans::XPropertySet
> xStyleProps( xStylesAccess
->getByName( aStyleName
), uno::UNO_QUERY_THROW
);
350 return uno::makeAny( uno::Reference
< word::XStyle
>( new SwVbaStyle( this, mxContext
, xStyleProps
) ) );
354 OSL_TRACE("SwVbaStyles::Item: the builtin style type is not implemented");
355 throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference
< uno::XInterface
>() );
360 return SwVbaStyles_BASE::Item( Index1
, Index2
);
364 SwVbaStyles::getServiceImplName()
366 static rtl::OUString
sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaStyles") );
370 uno::Sequence
< rtl::OUString
>
371 SwVbaStyles::getServiceNames()
373 static uno::Sequence
< rtl::OUString
> aServiceNames
;
374 if ( aServiceNames
.getLength() == 0 )
376 aServiceNames
.realloc( 1 );
377 aServiceNames
[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.XStyles" ) );
379 return aServiceNames
;