xref: /aoo42x/main/sc/source/ui/vba/vbaformat.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #ifndef SC_VBA_FORMAT_HXX
28*cdf0e10cSrcweir #define SC_VBA_FORMAT_HXX
29*cdf0e10cSrcweir #include <ooo/vba/excel/XFormat.hpp>
30*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
31*cdf0e10cSrcweir #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/util/XNumberFormats.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/util/XNumberFormatTypes.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/lang/Locale.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyState.hpp>
39*cdf0e10cSrcweir #include <vbahelper/vbahelperinterface.hxx>
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir class ScCellRangesBase;
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir template< typename Ifc1 >
44*cdf0e10cSrcweir class ScVbaFormat : public InheritedHelperInterfaceImpl1< Ifc1 >
45*cdf0e10cSrcweir {
46*cdf0e10cSrcweir typedef InheritedHelperInterfaceImpl1< Ifc1 > ScVbaFormat_BASE;
47*cdf0e10cSrcweir 	css::lang::Locale m_aDefaultLocale;
48*cdf0e10cSrcweir protected:
49*cdf0e10cSrcweir 	css::lang::Locale getDefaultLocale() { return m_aDefaultLocale; }
50*cdf0e10cSrcweir 	css::uno::Reference< css::beans::XPropertySet > mxPropertySet;
51*cdf0e10cSrcweir 	css::uno::Reference< css::util::XNumberFormatsSupplier > mxNumberFormatsSupplier;
52*cdf0e10cSrcweir 	css::uno::Reference< css::util::XNumberFormats > xNumberFormats;
53*cdf0e10cSrcweir 	css::uno::Reference< css::util::XNumberFormatTypes > xNumberFormatTypes;
54*cdf0e10cSrcweir 	css::uno::Reference< css::frame::XModel > mxModel;
55*cdf0e10cSrcweir 	css::uno::Reference< css::beans::XPropertyState > xPropertyState;
56*cdf0e10cSrcweir 	sal_Bool mbCheckAmbiguoity;
57*cdf0e10cSrcweir 	sal_Bool mbAddIndent;
58*cdf0e10cSrcweir 	//NumberFormatter oNumberFormatter = null;
59*cdf0e10cSrcweir 	css::uno::Reference< css::lang::XMultiServiceFactory > xMultiServiceFactory;
60*cdf0e10cSrcweir 	bool isAmbiguous(const rtl::OUString& _sPropertyName) throw ( css::script::BasicErrorException );
61*cdf0e10cSrcweir 	css::uno::Reference< css::beans::XPropertyState > getXPropertyState() throw ( css::uno::RuntimeException );
62*cdf0e10cSrcweir 	void initializeNumberFormats() throw ( css::script::BasicErrorException );
63*cdf0e10cSrcweir 	void setNumberFormat( css::lang::Locale _aLocale, const rtl::OUString& _sFormatString) throw( css::script::BasicErrorException );
64*cdf0e10cSrcweir 	SfxItemSet*  getCurrentDataSet( ) throw ( css::uno::RuntimeException );
65*cdf0e10cSrcweir protected:
66*cdf0e10cSrcweir 	virtual ScCellRangesBase* getCellRangesBase() throw ( css::uno::RuntimeException );
67*cdf0e10cSrcweir public:
68*cdf0e10cSrcweir 	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 );
69*cdf0e10cSrcweir 	virtual ~ScVbaFormat() {}
70*cdf0e10cSrcweir 	virtual css::uno::Reference< ov::XHelperInterface > thisHelperIface() = 0;
71*cdf0e10cSrcweir 	 void SAL_CALL setAddIndent( const css::uno::Any& _BAddIndent) throw( css::uno::RuntimeException ) { _BAddIndent >>= mbAddIndent; }
72*cdf0e10cSrcweir 	 css::uno::Any SAL_CALL getAddIndent() throw( css::uno::RuntimeException ) { return css::uno::makeAny( mbAddIndent ); }
73*cdf0e10cSrcweir     	// Interface Methods
74*cdf0e10cSrcweir 	virtual css::uno::Any SAL_CALL Borders( const css::uno::Any& Index ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
75*cdf0e10cSrcweir 	virtual css::uno::Reference< ::ooo::vba::excel::XFont > SAL_CALL Font(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
76*cdf0e10cSrcweir 	virtual css::uno::Reference< ::ooo::vba::excel::XInterior > SAL_CALL Interior(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
77*cdf0e10cSrcweir 	virtual void SAL_CALL setNumberFormat( const css::uno::Any& NumberFormat ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
78*cdf0e10cSrcweir 	virtual css::uno::Any SAL_CALL getNumberFormat(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
79*cdf0e10cSrcweir 	virtual void SAL_CALL setNumberFormatLocal( const css::uno::Any& NumberFormatLocal ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
80*cdf0e10cSrcweir 	virtual css::uno::Any SAL_CALL getNumberFormatLocal(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
81*cdf0e10cSrcweir 	virtual void SAL_CALL setIndentLevel( const css::uno::Any& IndentLevel ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
82*cdf0e10cSrcweir 	virtual css::uno::Any SAL_CALL getIndentLevel(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
83*cdf0e10cSrcweir 	virtual void SAL_CALL setHorizontalAlignment( const css::uno::Any& HorizontalAlignment ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
84*cdf0e10cSrcweir 	virtual css::uno::Any SAL_CALL getHorizontalAlignment(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
85*cdf0e10cSrcweir 	virtual void SAL_CALL setVerticalAlignment( const css::uno::Any& VerticalAlignment ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
86*cdf0e10cSrcweir 	virtual css::uno::Any SAL_CALL getVerticalAlignment(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
87*cdf0e10cSrcweir 	virtual void SAL_CALL setOrientation( const css::uno::Any& Orientation ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
88*cdf0e10cSrcweir 	virtual css::uno::Any SAL_CALL getOrientation(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
89*cdf0e10cSrcweir 	virtual void SAL_CALL setShrinkToFit( const css::uno::Any& ShrinkToFit ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
90*cdf0e10cSrcweir 	virtual css::uno::Any SAL_CALL getShrinkToFit(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
91*cdf0e10cSrcweir 	virtual void SAL_CALL setWrapText( const css::uno::Any& WrapText ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
92*cdf0e10cSrcweir 	virtual css::uno::Any SAL_CALL getWrapText(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
93*cdf0e10cSrcweir 	virtual void SAL_CALL setLocked( const css::uno::Any& Locked ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
94*cdf0e10cSrcweir 	virtual css::uno::Any SAL_CALL getLocked(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
95*cdf0e10cSrcweir 	virtual void SAL_CALL setFormulaHidden( const css::uno::Any& FormulaHidden ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
96*cdf0e10cSrcweir 	virtual css::uno::Any SAL_CALL getFormulaHidden(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
97*cdf0e10cSrcweir 	virtual void SAL_CALL setMergeCells( const css::uno::Any& MergeCells ) throw (css::script::BasicErrorException, css::uno::RuntimeException) = 0;
98*cdf0e10cSrcweir 	virtual css::uno::Any SAL_CALL getMergeCells(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException) = 0;
99*cdf0e10cSrcweir 	virtual void SAL_CALL setReadingOrder( const css::uno::Any& ReadingOrder ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
100*cdf0e10cSrcweir 	virtual css::uno::Any SAL_CALL getReadingOrder(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
101*cdf0e10cSrcweir 	// XHelperInterface
102*cdf0e10cSrcweir 	virtual rtl::OUString& getServiceImplName();
103*cdf0e10cSrcweir 	virtual css::uno::Sequence<rtl::OUString> getServiceNames();
104*cdf0e10cSrcweir };
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir #endif
107