1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef _FORMS_LIMITED_FORMATS_HXX_
29 #define _FORMS_LIMITED_FORMATS_HXX_
31 #include <osl/mutex.hxx>
32 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
33 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34 #include <com/sun/star/beans/XFastPropertySet.hpp>
36 //.........................................................................
39 //.........................................................................
41 //=====================================================================
43 //=====================================================================
44 /** maintains translation tables format key <-> enum value
45 <p>Used for controls which provide a limited number for (standard) formats, which
46 should be available as format keys.</p>
51 static sal_Int32 s_nInstanceCount
;
52 static ::osl::Mutex s_aMutex
;
53 static ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
>
57 sal_Int32 m_nFormatEnumPropertyHandle
;
58 const sal_Int16 m_nTableId
;
59 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XFastPropertySet
>
64 <p>The class id is used to determine the translation table to use. All instances which
65 pass the same value here share one table.</p>
68 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxORB
,
69 const sal_Int16 _nClassId
75 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XFastPropertySet
>& _rxAggregate
,
76 sal_Int32 _nOriginalPropertyHandle
80 void getFormatKeyPropertyValue( ::com::sun::star::uno::Any
& _rValue
) const;
81 sal_Bool
convertFormatKeyPropertyValue(
82 ::com::sun::star::uno::Any
& _rConvertedValue
,
83 ::com::sun::star::uno::Any
& _rOldValue
,
84 const ::com::sun::star::uno::Any
& _rNewValue
86 void setFormatKeyPropertyValue( const ::com::sun::star::uno::Any
& _rNewValue
);
87 // setFormatKeyPropertyValue should only be called with a value got from convertFormatKeyPropertyValue!
89 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
>
90 getFormatsSupplier() const { return s_xStandardFormats
; }
93 void acquireSupplier(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxORB
);
94 void releaseSupplier();
96 static void ensureTableInitialized(const sal_Int16 _nTableId
);
97 static void clearTable(const sal_Int16 _nTableId
);
100 //.........................................................................
102 //.........................................................................
104 #endif // _FORMS_LIMITED_FORMATS_HXX_