xref: /trunk/main/sc/source/ui/vba/vbaformat.hxx (revision 38d50f7b)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef SC_VBA_FORMAT_HXX
24 #define SC_VBA_FORMAT_HXX
25 #include <ooo/vba/excel/XFormat.hpp>
26 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
28 #include <com/sun/star/util/XNumberFormats.hpp>
29 #include <com/sun/star/util/XNumberFormatTypes.hpp>
30 #include <com/sun/star/frame/XModel.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 #include <com/sun/star/lang/Locale.hpp>
34 #include <com/sun/star/beans/XPropertyState.hpp>
35 #include <vbahelper/vbahelperinterface.hxx>
36 
37 class ScCellRangesBase;
38 
39 template< typename Ifc1 >
40 class ScVbaFormat : public InheritedHelperInterfaceImpl1< Ifc1 >
41 {
42 typedef InheritedHelperInterfaceImpl1< Ifc1 > ScVbaFormat_BASE;
43 	css::lang::Locale m_aDefaultLocale;
44 protected:
getDefaultLocale()45 	css::lang::Locale getDefaultLocale() { return m_aDefaultLocale; }
46 	css::uno::Reference< css::beans::XPropertySet > mxPropertySet;
47 	css::uno::Reference< css::util::XNumberFormatsSupplier > mxNumberFormatsSupplier;
48 	css::uno::Reference< css::util::XNumberFormats > xNumberFormats;
49 	css::uno::Reference< css::util::XNumberFormatTypes > xNumberFormatTypes;
50 	css::uno::Reference< css::frame::XModel > mxModel;
51 	css::uno::Reference< css::beans::XPropertyState > xPropertyState;
52 	sal_Bool mbCheckAmbiguoity;
53 	sal_Bool mbAddIndent;
54 	//NumberFormatter oNumberFormatter = null;
55 	css::uno::Reference< css::lang::XMultiServiceFactory > xMultiServiceFactory;
56 	bool isAmbiguous(const rtl::OUString& _sPropertyName) throw ( css::script::BasicErrorException );
57 	css::uno::Reference< css::beans::XPropertyState > getXPropertyState() throw ( css::uno::RuntimeException );
58 	void initializeNumberFormats() throw ( css::script::BasicErrorException );
59 	void setNumberFormat( css::lang::Locale _aLocale, const rtl::OUString& _sFormatString) throw( css::script::BasicErrorException );
60 	SfxItemSet*  getCurrentDataSet( ) throw ( css::uno::RuntimeException );
61 protected:
62 	virtual ScCellRangesBase* getCellRangesBase() throw ( css::uno::RuntimeException );
63 public:
64 	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 );
~ScVbaFormat()65 	virtual ~ScVbaFormat() {}
66 	virtual css::uno::Reference< ov::XHelperInterface > thisHelperIface() = 0;
setAddIndent(const css::uno::Any & _BAddIndent)67 	 void SAL_CALL setAddIndent( const css::uno::Any& _BAddIndent) throw( css::uno::RuntimeException ) { _BAddIndent >>= mbAddIndent; }
getAddIndent()68 	 css::uno::Any SAL_CALL getAddIndent() throw( css::uno::RuntimeException ) { return css::uno::makeAny( mbAddIndent ); }
69     	// Interface Methods
70 	virtual css::uno::Any SAL_CALL Borders( const css::uno::Any& Index ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
71 	virtual css::uno::Reference< ::ooo::vba::excel::XFont > SAL_CALL Font(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
72 	virtual css::uno::Reference< ::ooo::vba::excel::XInterior > SAL_CALL Interior(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
73 	virtual void SAL_CALL setNumberFormat( const css::uno::Any& NumberFormat ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
74 	virtual css::uno::Any SAL_CALL getNumberFormat(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
75 	virtual void SAL_CALL setNumberFormatLocal( const css::uno::Any& NumberFormatLocal ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
76 	virtual css::uno::Any SAL_CALL getNumberFormatLocal(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
77 	virtual void SAL_CALL setIndentLevel( const css::uno::Any& IndentLevel ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
78 	virtual css::uno::Any SAL_CALL getIndentLevel(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
79 	virtual void SAL_CALL setHorizontalAlignment( const css::uno::Any& HorizontalAlignment ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
80 	virtual css::uno::Any SAL_CALL getHorizontalAlignment(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
81 	virtual void SAL_CALL setVerticalAlignment( const css::uno::Any& VerticalAlignment ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
82 	virtual css::uno::Any SAL_CALL getVerticalAlignment(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
83 	virtual void SAL_CALL setOrientation( const css::uno::Any& Orientation ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
84 	virtual css::uno::Any SAL_CALL getOrientation(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
85 	virtual void SAL_CALL setShrinkToFit( const css::uno::Any& ShrinkToFit ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
86 	virtual css::uno::Any SAL_CALL getShrinkToFit(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
87 	virtual void SAL_CALL setWrapText( const css::uno::Any& WrapText ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
88 	virtual css::uno::Any SAL_CALL getWrapText(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
89 	virtual void SAL_CALL setLocked( const css::uno::Any& Locked ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
90 	virtual css::uno::Any SAL_CALL getLocked(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
91 	virtual void SAL_CALL setFormulaHidden( const css::uno::Any& FormulaHidden ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
92 	virtual css::uno::Any SAL_CALL getFormulaHidden(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
93 	virtual void SAL_CALL setMergeCells( const css::uno::Any& MergeCells ) throw (css::script::BasicErrorException, css::uno::RuntimeException) = 0;
94 	virtual css::uno::Any SAL_CALL getMergeCells(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException) = 0;
95 	virtual void SAL_CALL setReadingOrder( const css::uno::Any& ReadingOrder ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
96 	virtual css::uno::Any SAL_CALL getReadingOrder(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
97 	// XHelperInterface
98 	virtual rtl::OUString& getServiceImplName();
99 	virtual css::uno::Sequence<rtl::OUString> getServiceNames();
100 };
101 
102 #endif
103