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: vbaformat.hxx,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 #ifndef SC_VBA_FORMAT_HXX
31 #define SC_VBA_FORMAT_HXX
32 #include <ooo/vba/excel/XFormat.hpp>
33 #include <com/sun/star/beans/XPropertySet.hpp>
34 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
35 #include <com/sun/star/util/XNumberFormats.hpp>
36 #include <com/sun/star/util/XNumberFormatTypes.hpp>
37 #include <com/sun/star/frame/XModel.hpp>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
39 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
40 #include <com/sun/star/lang/Locale.hpp>
41 #include <com/sun/star/beans/XPropertyState.hpp>
42 #include <vbahelper/vbahelperinterface.hxx>
44 template< typename Ifc1
>
45 class ScVbaFormat
: public InheritedHelperInterfaceImpl1
< Ifc1
>
47 typedef InheritedHelperInterfaceImpl1
< Ifc1
> ScVbaFormat_BASE
;
48 css::lang::Locale m_aDefaultLocale
;
50 css::lang::Locale
getDefaultLocale() { return m_aDefaultLocale
; }
51 css::uno::Reference
< css::beans::XPropertySet
> mxPropertySet
;
52 css::uno::Reference
< css::util::XNumberFormatsSupplier
> mxNumberFormatsSupplier
;
53 css::uno::Reference
< css::util::XNumberFormats
> xNumberFormats
;
54 css::uno::Reference
< css::util::XNumberFormatTypes
> xNumberFormatTypes
;
55 css::uno::Reference
< css::frame::XModel
> mxModel
;
56 css::uno::Reference
< css::lang::XServiceInfo
> mxServiceInfo
;
57 css::uno::Reference
< css::beans::XPropertyState
> xPropertyState
;
58 sal_Bool mbCheckAmbiguoity
;
60 //NumberFormatter oNumberFormatter = null;
61 css::uno::Reference
< css::lang::XMultiServiceFactory
> xMultiServiceFactory
;
62 bool isAmbiguous(const rtl::OUString
& _sPropertyName
) throw ( css::script::BasicErrorException
);
63 css::uno::Reference
< css::beans::XPropertyState
> getXPropertyState() throw ( css::uno::RuntimeException
);
64 void initializeNumberFormats() throw ( css::script::BasicErrorException
);
65 void setNumberFormat( css::lang::Locale _aLocale
, const rtl::OUString
& _sFormatString
) throw( css::script::BasicErrorException
);
67 ScVbaFormat( const css::uno::Reference
< ov::XHelperInterface
>& xParent
, const css::uno::Reference
< css::uno::XComponentContext
> & xContext
, const css::uno::Reference
< css::beans::XPropertySet
>& _xPropertySet
, const css::uno::Reference
< css::frame::XModel
>& xModel
, bool bCheckAmbiguoity
) throw ( css::script::BasicErrorException
);
68 virtual ~ScVbaFormat() {}
69 virtual css::uno::Reference
< ov::XHelperInterface
> thisHelperIface() = 0;
70 css::uno::Reference
< css::lang::XServiceInfo
> getXServiceInfo() { return mxServiceInfo
; }
71 void SAL_CALL
setAddIndent( const css::uno::Any
& _BAddIndent
) throw( css::uno::RuntimeException
) { _BAddIndent
>>= mbAddIndent
; }
72 css::uno::Any SAL_CALL
getAddIndent() throw( css::uno::RuntimeException
) { return css::uno::makeAny( mbAddIndent
); }
74 virtual css::uno::Any SAL_CALL
Borders( const css::uno::Any
& Index
) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
75 virtual css::uno::Reference
< ::ooo::vba::excel::XFont
> SAL_CALL
Font( ) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
76 virtual css::uno::Reference
< ::ooo::vba::excel::XInterior
> SAL_CALL
Interior( ) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
77 virtual void SAL_CALL
setNumberFormat( const css::uno::Any
& NumberFormat
) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
78 virtual css::uno::Any SAL_CALL
getNumberFormat( ) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
79 virtual void SAL_CALL
setNumberFormatLocal( const css::uno::Any
& NumberFormatLocal
) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
80 virtual css::uno::Any SAL_CALL
getNumberFormatLocal( ) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
81 virtual void SAL_CALL
setIndentLevel( const css::uno::Any
& IndentLevel
) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
82 virtual css::uno::Any SAL_CALL
getIndentLevel( ) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
83 virtual void SAL_CALL
setHorizontalAlignment( const css::uno::Any
& HorizontalAlignment
) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
84 virtual css::uno::Any SAL_CALL
getHorizontalAlignment( ) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
85 virtual void SAL_CALL
setVerticalAlignment( const css::uno::Any
& VerticalAlignment
) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
86 virtual css::uno::Any SAL_CALL
getVerticalAlignment( ) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
87 virtual void SAL_CALL
setOrientation( const css::uno::Any
& Orientation
) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
88 virtual css::uno::Any SAL_CALL
getOrientation( ) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
89 virtual void SAL_CALL
setShrinkToFit( const css::uno::Any
& ShrinkToFit
) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
90 virtual css::uno::Any SAL_CALL
getShrinkToFit( ) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
91 virtual void SAL_CALL
setWrapText( const css::uno::Any
& WrapText
) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
92 virtual css::uno::Any SAL_CALL
getWrapText( ) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
93 virtual void SAL_CALL
setLocked( const css::uno::Any
& Locked
) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
94 virtual css::uno::Any SAL_CALL
getLocked( ) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
95 virtual void SAL_CALL
setFormulaHidden( const css::uno::Any
& FormulaHidden
) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
96 virtual css::uno::Any SAL_CALL
getFormulaHidden( ) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
97 virtual void SAL_CALL
setMergeCells( const css::uno::Any
& MergeCells
) throw (css::script::BasicErrorException
, css::uno::RuntimeException
) = 0;
98 virtual css::uno::Any SAL_CALL
getMergeCells( ) throw (css::script::BasicErrorException
, css::uno::RuntimeException
) = 0;
99 virtual void SAL_CALL
setReadingOrder( const css::uno::Any
& ReadingOrder
) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
100 virtual css::uno::Any SAL_CALL
getReadingOrder( ) throw (css::script::BasicErrorException
, css::uno::RuntimeException
);
102 virtual rtl::OUString
& getServiceImplName();
103 virtual css::uno::Sequence
<rtl::OUString
> getServiceNames();