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 
24 #ifndef FORMS_SOURCE_COMPONENT_FORMCONTROLFONT_HXX
25 #define FORMS_SOURCE_COMPONENT_FORMCONTROLFONT_HXX
26 
27 #include <com/sun/star/io/XObjectOutputStream.hpp>
28 #include <com/sun/star/awt/FontDescriptor.hpp>
29 #include <com/sun/star/beans/Property.hpp>
30 #include <com/sun/star/lang/IllegalArgumentException.hpp>
31 
32 //.........................................................................
33 namespace frm
34 {
35 //.........................................................................
36 
37     //=====================================================================
38     //= FontControlModel
39     //=====================================================================
40     class FontControlModel
41     {
42     private:
43         // <properties>
44     	::com::sun::star::awt::FontDescriptor   m_aFont;
45     	sal_Int16								m_nFontRelief;
46 	    sal_Int16								m_nFontEmphasis;
47     	::com::sun::star::uno::Any				m_aTextLineColor;
48         ::com::sun::star::uno::Any              m_aTextColor;
49         // </properties>
50 
51         bool                                    m_bToolkitCompatibleDefaults;
52 
53     protected:
getFont() const54         const ::com::sun::star::awt::FontDescriptor& getFont() const { return m_aFont; }
setFont(const::com::sun::star::awt::FontDescriptor & _rFont)55         void setFont( const ::com::sun::star::awt::FontDescriptor& _rFont ) { m_aFont = _rFont; }
56 
setTextColor(sal_Int32 _nColor)57         void        setTextColor( sal_Int32 _nColor ) { m_aTextColor <<= _nColor;       }
clearTextColor()58         void        clearTextColor( )                 { m_aTextColor.clear();           }
hasTextColor() const59         bool        hasTextColor( ) const             { return m_aTextColor.hasValue(); }
60         sal_Int32   getTextColor( ) const;
61 
setTextLineColor(sal_Int32 _nColor)62         void        setTextLineColor( sal_Int32 _nColor ) { m_aTextLineColor <<= _nColor;       }
clearTextLineColor()63         void        clearTextLineColor( )                 { m_aTextLineColor.clear();           }
hasTextLineColor() const64         bool        hasTextLineColor( ) const             { return m_aTextLineColor.hasValue(); }
65         sal_Int32   getTextLineColor( ) const;
66 
67     protected:
68         FontControlModel( bool _bToolkitCompatibleDefaults );
69         FontControlModel( const FontControlModel* _pOriginal );
70 
71     protected:
72         bool     isFontRelatedProperty( sal_Int32 _nPropertyHandle ) const;
73         bool     isFontAggregateProperty( sal_Int32 _nPropertyHandle ) const;
74 
75         /// appends (!) the description of all font related properties to the given sequence
76         void     describeFontRelatedProperties(
77             ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps ) const;
78 
79         void     getFastPropertyValue            ( ::com::sun::star::uno::Any& _rValue, sal_Int32 _nHandle ) const;
80         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 );
81         void     setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) throw ( ::com::sun::star::uno::Exception );
82         ::com::sun::star::uno::Any
83                  getPropertyDefaultByHandle      ( sal_Int32 _nHandle ) const;
84 
85     private:
86 
87     private:
88         FontControlModel();                                     // never implemented
89         FontControlModel( const FontControlModel& );            // never implemented
90         FontControlModel& operator=( const FontControlModel& ); // never implemented
91     };
92 
93 //.........................................................................
94 }   // namespace frm
95 //.........................................................................
96 
97 #endif // FORMS_SOURCE_COMPONENT_FORMCONTROLFONT_HXX
98