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: limitedformats.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 ************************************************************************/
31 #ifndef _FORMS_LIMITED_FORMATS_HXX_
32 #define _FORMS_LIMITED_FORMATS_HXX_
34 #include <osl/mutex.hxx>
35 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
36 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
37 #include <com/sun/star/beans/XFastPropertySet.hpp>
39 //.........................................................................
42 //.........................................................................
44 //=====================================================================
46 //=====================================================================
47 /** maintains translation tables format key <-> enum value
48 <p>Used for controls which provide a limited number for (standard) formats, which
49 should be available as format keys.</p>
54 static sal_Int32 s_nInstanceCount
;
55 static ::osl::Mutex s_aMutex
;
56 static ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
>
60 sal_Int32 m_nFormatEnumPropertyHandle
;
61 const sal_Int16 m_nTableId
;
62 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XFastPropertySet
>
67 <p>The class id is used to determine the translation table to use. All instances which
68 pass the same value here share one table.</p>
71 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxORB
,
72 const sal_Int16 _nClassId
78 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XFastPropertySet
>& _rxAggregate
,
79 sal_Int32 _nOriginalPropertyHandle
83 void getFormatKeyPropertyValue( ::com::sun::star::uno::Any
& _rValue
) const;
84 sal_Bool
convertFormatKeyPropertyValue(
85 ::com::sun::star::uno::Any
& _rConvertedValue
,
86 ::com::sun::star::uno::Any
& _rOldValue
,
87 const ::com::sun::star::uno::Any
& _rNewValue
89 void setFormatKeyPropertyValue( const ::com::sun::star::uno::Any
& _rNewValue
);
90 // setFormatKeyPropertyValue should only be called with a value got from convertFormatKeyPropertyValue!
92 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
>
93 getFormatsSupplier() const { return s_xStandardFormats
; }
96 void acquireSupplier(const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxORB
);
97 void releaseSupplier();
99 static void ensureTableInitialized(const sal_Int16 _nTableId
);
100 static void clearTable(const sal_Int16 _nTableId
);
103 //.........................................................................
105 //.........................................................................
107 #endif // _FORMS_LIMITED_FORMATS_HXX_