1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 
28 #ifndef FORMS_SOURCE_COMPONENT_FORMCONTROLFONT_HXX
29 #define FORMS_SOURCE_COMPONENT_FORMCONTROLFONT_HXX
30 
31 #include <com/sun/star/io/XObjectOutputStream.hpp>
32 #include <com/sun/star/awt/FontDescriptor.hpp>
33 #include <com/sun/star/beans/Property.hpp>
34 #include <com/sun/star/lang/IllegalArgumentException.hpp>
35 
36 //.........................................................................
37 namespace frm
38 {
39 //.........................................................................
40 
41     //=====================================================================
42     //= FontControlModel
43     //=====================================================================
44     class FontControlModel
45     {
46     private:
47         // <properties>
48     	::com::sun::star::awt::FontDescriptor   m_aFont;
49     	sal_Int16								m_nFontRelief;
50 	    sal_Int16								m_nFontEmphasis;
51     	::com::sun::star::uno::Any				m_aTextLineColor;
52         ::com::sun::star::uno::Any              m_aTextColor;
53         // </properties>
54 
55         bool                                    m_bToolkitCompatibleDefaults;
56 
57     protected:
58         const ::com::sun::star::awt::FontDescriptor& getFont() const { return m_aFont; }
59         void setFont( const ::com::sun::star::awt::FontDescriptor& _rFont ) { m_aFont = _rFont; }
60 
61         void        setTextColor( sal_Int32 _nColor ) { m_aTextColor <<= _nColor;       }
62         void        clearTextColor( )                 { m_aTextColor.clear();           }
63         bool        hasTextColor( ) const             { return m_aTextColor.hasValue(); }
64         sal_Int32   getTextColor( ) const;
65 
66         void        setTextLineColor( sal_Int32 _nColor ) { m_aTextLineColor <<= _nColor;       }
67         void        clearTextLineColor( )                 { m_aTextLineColor.clear();           }
68         bool        hasTextLineColor( ) const             { return m_aTextLineColor.hasValue(); }
69         sal_Int32   getTextLineColor( ) const;
70 
71     protected:
72         FontControlModel( bool _bToolkitCompatibleDefaults );
73         FontControlModel( const FontControlModel* _pOriginal );
74 
75     protected:
76         bool     isFontRelatedProperty( sal_Int32 _nPropertyHandle ) const;
77         bool     isFontAggregateProperty( sal_Int32 _nPropertyHandle ) const;
78 
79         /// appends (!) the description of all font related properties to the given sequence
80         void     describeFontRelatedProperties(
81             ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps ) const;
82 
83         void     getFastPropertyValue            ( ::com::sun::star::uno::Any& _rValue, sal_Int32 _nHandle ) const;
84         sal_Bool convertFastPropertyValue        ( ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) throw( ::com::sun::star::lang::IllegalArgumentException );
85         void     setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) throw ( ::com::sun::star::uno::Exception );
86         ::com::sun::star::uno::Any
87                  getPropertyDefaultByHandle      ( sal_Int32 _nHandle ) const;
88 
89     private:
90 
91     private:
92         FontControlModel();                                     // never implemented
93         FontControlModel( const FontControlModel& );            // never implemented
94         FontControlModel& operator=( const FontControlModel& ); // never implemented
95     };
96 
97 //.........................................................................
98 }   // namespace frm
99 //.........................................................................
100 
101 #endif // FORMS_SOURCE_COMPONENT_FORMCONTROLFONT_HXX
102