23#include <ooo/vba/excel/XRange.hpp>
24#include <com/sun/star/beans/XPropertySet.hpp>
25#include <com/sun/star/lang/XMultiServiceFactory.hpp>
32lcl_createAPIStyleToVBAObject(
const css::uno::Any& aObject,
const uno::Reference< XHelperInterface >& xParent,
const uno::Reference< uno::XComponentContext >& xContext,
const uno::Reference< frame::XModel >& xModel )
34 uno::Reference< beans::XPropertySet > xStyleProps( aObject, uno::UNO_QUERY_THROW );
35 uno::Reference< excel::XStyle > xStyle(
new ScVbaStyle( xParent, xContext, xStyleProps,
xModel ) );
40 const uno::Reference< css::uno::XComponentContext > & xContext,
41 const uno::Reference< frame::XModel >& xModel )
52 catch (uno::Exception& )
58uno::Sequence< OUString >
80 uno::Reference<container::XIndexAccess > m_xIndexAccess;
81 uno::Reference<XHelperInterface > m_xParent;
82 uno::Reference<uno::XComponentContext >
m_xContext;
83 uno::Reference<frame::XModel >
m_xModel;
87 EnumWrapper( uno::Reference< container::XIndexAccess > xIndexAccess, uno::Reference<XHelperInterface > xParent, uno::Reference<uno::XComponentContext > xContext, uno::Reference<frame::XModel > xModel ) : m_xIndexAccess(
std::move( xIndexAccess )), m_xParent(
std::move( xParent )),
m_xContext(
std::move( xContext )),
m_xModel(
std::move(
xModel )),
nIndex( 0 ) {}
88 virtual sal_Bool SAL_CALL hasMoreElements( )
override
90 return ( nIndex < m_xIndexAccess->getCount() );
92 virtual uno::Any SAL_CALL nextElement( )
override
96 if ( nIndex < m_xIndexAccess->getCount() )
99 catch (
const container::NoSuchElementException&)
103 catch (
const lang::WrappedTargetException&)
107 catch (
const uno::RuntimeException&)
111 catch (
const uno::Exception& e)
114 throw css::lang::WrappedTargetException(
115 "wrapped Exception " + e.Message,
116 css::uno::Reference<css::uno::XInterface>(), a);
118 throw container::NoSuchElementException();
124uno::Reference< container::XEnumeration > SAL_CALL
130uno::Reference< excel::XStyle > SAL_CALL
133 uno::Reference< excel::XStyle > aRet;
136 OUString sParentCellStyleName(
"Default");
139 uno::Reference< excel::XRange > oRange;
140 if ( _aBasedOn >>= oRange)
142 uno::Reference< excel::XStyle > oStyle( oRange->getStyle(), uno::UNO_QUERY_THROW );
143 sParentCellStyleName = oStyle->getName();
151 uno::Reference< style::XStyle > xStyle(
mxMSF->createInstance(
"com.sun.star.style.CellStyle"), uno::UNO_QUERY_THROW );
157 if (sParentCellStyleName !=
"Default")
159 xStyle->setParentStyle( sParentCellStyleName );
163 catch (
const uno::Exception&)
178 catch (
const uno::Exception&)
187 return "ScVbaStyles";
190uno::Sequence< OUString >
195 "ooo.vba.excel.XStyles"
Reference< XComponentContext > m_xContext
css::uno::Reference< css::frame::XModel2 > mxModel
css::uno::Reference< css::uno::XComponentContext > mxContext
css::uno::WeakReference< ov::XHelperInterface > mxParent
css::uno::Reference< css::container::XNameAccess > m_xNameAccess
virtual css::uno::Any SAL_CALL Item(const css::uno::Any &Index1, const css::uno::Any &) override
css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess
virtual css::uno::Sequence< OUString > getServiceNames() override
css::uno::Sequence< OUString > getStyleNames()
css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF
virtual css::uno::Reference< ov::excel::XStyle > SAL_CALL Add(const OUString &Name, const css::uno::Any &BasedOn) override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
css::uno::Reference< css::frame::XModel > mxModel
void Delete(const OUString &_sStyleName)
css::uno::Reference< css::container::XNameContainer > mxNameContainerCellStyles
virtual OUString getServiceImplName() override
ScVbaStyles(const css::uno::Reference< ov::XHelperInterface > &xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::frame::XModel > &xModel)
virtual css::uno::Any createCollectionObject(const css::uno::Any &) override
virtual css::uno::Type SAL_CALL getElementType() override
css::uno::Type const & get()
Reference< frame::XModel > m_xModel
Sequence< OUString > aServiceNames
Any SAL_CALL getCaughtException()
#define ERRCODE_BASIC_METHOD_FAILED
#define ERRCODE_BASIC_BAD_ARGUMENT
Reference< XModel > xModel
::cppu::WeakImplHelper< css::container::XEnumeration > EnumerationHelper_BASE
static css::uno::Any lcl_createAPIStyleToVBAObject(const css::uno::Any &aObject, const uno::Reference< XHelperInterface > &xParent, const uno::Reference< uno::XComponentContext > &xContext, const uno::Reference< frame::XModel > &xModel)