Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_FORMS_SOURCE_INC_FORMCONTROLFONT_HXX
21 : #define INCLUDED_FORMS_SOURCE_INC_FORMCONTROLFONT_HXX
22 :
23 : #include <com/sun/star/io/XObjectOutputStream.hpp>
24 : #include <com/sun/star/awt/FontDescriptor.hpp>
25 : #include <com/sun/star/beans/Property.hpp>
26 : #include <com/sun/star/lang/IllegalArgumentException.hpp>
27 :
28 : namespace cppu {
29 : class OPropertySetHelper;
30 : }
31 :
32 :
33 : namespace frm
34 : {
35 :
36 242 : class FontControlModel
37 : {
38 : private:
39 : // <properties>
40 : ::com::sun::star::awt::FontDescriptor m_aFont;
41 : sal_Int16 m_nFontRelief;
42 : sal_Int16 m_nFontEmphasis;
43 : ::com::sun::star::uno::Any m_aTextLineColor;
44 : ::com::sun::star::uno::Any m_aTextColor;
45 : // </properties>
46 :
47 : bool m_bToolkitCompatibleDefaults;
48 :
49 : protected:
50 223 : const ::com::sun::star::awt::FontDescriptor& getFont() const { return m_aFont; }
51 6 : void setFont( const ::com::sun::star::awt::FontDescriptor& _rFont ) { m_aFont = _rFont; }
52 :
53 0 : void setTextColor( sal_Int32 _nColor ) { m_aTextColor <<= _nColor; }
54 2 : void clearTextColor( ) { m_aTextColor.clear(); }
55 4 : bool hasTextColor( ) const { return m_aTextColor.hasValue(); }
56 : sal_Int32 getTextColor( ) const;
57 :
58 0 : void setTextLineColor( sal_Int32 _nColor ) { m_aTextLineColor <<= _nColor; }
59 2 : void clearTextLineColor( ) { m_aTextLineColor.clear(); }
60 2 : bool hasTextLineColor( ) const { return m_aTextLineColor.hasValue(); }
61 : sal_Int32 getTextLineColor( ) const;
62 :
63 : protected:
64 : FontControlModel( bool _bToolkitCompatibleDefaults );
65 : FontControlModel( const FontControlModel* _pOriginal );
66 :
67 : protected:
68 : bool isFontRelatedProperty( sal_Int32 _nPropertyHandle ) const;
69 : bool isFontAggregateProperty( sal_Int32 _nPropertyHandle ) const;
70 :
71 : /// appends (!) the description of all font related properties to the given sequence
72 : void describeFontRelatedProperties(
73 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps ) const;
74 :
75 : void getFastPropertyValue ( ::com::sun::star::uno::Any& _rValue, sal_Int32 _nHandle ) const;
76 : 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 );
77 : void setFastPropertyValue_NoBroadcast_impl(
78 : ::cppu::OPropertySetHelper & rBase,
79 : void (::cppu::OPropertySetHelper::*pSet)(
80 : sal_Int32, css::uno::Any const&),
81 : sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue)
82 : throw ( ::com::sun::star::uno::Exception );
83 : ::com::sun::star::uno::Any
84 : getPropertyDefaultByHandle ( sal_Int32 _nHandle ) const;
85 :
86 : private:
87 :
88 : private:
89 : FontControlModel(); // never implemented
90 : FontControlModel( const FontControlModel& ); // never implemented
91 : FontControlModel& operator=( const FontControlModel& ); // never implemented
92 : };
93 :
94 :
95 : } // namespace frm
96 :
97 :
98 : #endif // INCLUDED_FORMS_SOURCE_INC_FORMCONTROLFONT_HXX
99 :
100 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|