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); 57 css::uno::Reference< css::beans::XPropertyState > getXPropertyState(); 58 void initializeNumberFormats(); 59 void setNumberFormat( css::lang::Locale _aLocale, const rtl::OUString& _sFormatString); 60 SfxItemSet* getCurrentDataSet( ); 61 protected: 62 virtual ScCellRangesBase* getCellRangesBase(); 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 ); ~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) { _BAddIndent >>= mbAddIndent; } getAddIndent()68 css::uno::Any SAL_CALL getAddIndent() { return css::uno::makeAny( mbAddIndent ); } 69 // Interface Methods 70 virtual css::uno::Any SAL_CALL Borders( const css::uno::Any& Index ); 71 virtual css::uno::Reference< ::ooo::vba::excel::XFont > SAL_CALL Font( ); 72 virtual css::uno::Reference< ::ooo::vba::excel::XInterior > SAL_CALL Interior( ); 73 virtual void SAL_CALL setNumberFormat( const css::uno::Any& NumberFormat ); 74 virtual css::uno::Any SAL_CALL getNumberFormat( ); 75 virtual void SAL_CALL setNumberFormatLocal( const css::uno::Any& NumberFormatLocal ); 76 virtual css::uno::Any SAL_CALL getNumberFormatLocal( ); 77 virtual void SAL_CALL setIndentLevel( const css::uno::Any& IndentLevel ); 78 virtual css::uno::Any SAL_CALL getIndentLevel( ); 79 virtual void SAL_CALL setHorizontalAlignment( const css::uno::Any& HorizontalAlignment ); 80 virtual css::uno::Any SAL_CALL getHorizontalAlignment( ); 81 virtual void SAL_CALL setVerticalAlignment( const css::uno::Any& VerticalAlignment ); 82 virtual css::uno::Any SAL_CALL getVerticalAlignment( ); 83 virtual void SAL_CALL setOrientation( const css::uno::Any& Orientation ); 84 virtual css::uno::Any SAL_CALL getOrientation( ); 85 virtual void SAL_CALL setShrinkToFit( const css::uno::Any& ShrinkToFit ); 86 virtual css::uno::Any SAL_CALL getShrinkToFit( ); 87 virtual void SAL_CALL setWrapText( const css::uno::Any& WrapText ); 88 virtual css::uno::Any SAL_CALL getWrapText( ); 89 virtual void SAL_CALL setLocked( const css::uno::Any& Locked ); 90 virtual css::uno::Any SAL_CALL getLocked( ); 91 virtual void SAL_CALL setFormulaHidden( const css::uno::Any& FormulaHidden ); 92 virtual css::uno::Any SAL_CALL getFormulaHidden( ); 93 virtual void SAL_CALL setMergeCells( const css::uno::Any& MergeCells ) = 0; 94 virtual css::uno::Any SAL_CALL getMergeCells( ) = 0; 95 virtual void SAL_CALL setReadingOrder( const css::uno::Any& ReadingOrder ); 96 virtual css::uno::Any SAL_CALL getReadingOrder( ); 97 // XHelperInterface 98 virtual rtl::OUString& getServiceImplName(); 99 virtual css::uno::Sequence<rtl::OUString> getServiceNames(); 100 }; 101 102 #endif 103