xref: /AOO41X/main/unotools/inc/unotools/fontoptions.hxx (revision bae3752ec30c258ca902793e4eea3c818b0bcaad)
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 #ifndef INCLUDED_unotools_FONTOPTIONS_HXX
24 #define INCLUDED_unotools_FONTOPTIONS_HXX
25 
26 //_________________________________________________________________________________________________________________
27 //  includes
28 //_________________________________________________________________________________________________________________
29 
30 #include "unotools/unotoolsdllapi.h"
31 #include <sal/types.h>
32 #include <osl/mutex.hxx>
33 #include <rtl/ustring.hxx>
34 #include <unotools/options.hxx>
35 
36 //_________________________________________________________________________________________________________________
37 //  forward declarations
38 //_________________________________________________________________________________________________________________
39 
40 /*-************************************************************************************************************//**
41     @short          forward declaration to our private date container implementation
42     @descr          We use these class as internal member to support small memory requirements.
43                     You can create the container if it is neccessary. The class which use these mechanism
44                     is faster and smaller then a complete implementation!
45 *//*-*************************************************************************************************************/
46 
47 class SvtFontOptions_Impl;
48 
49 //_________________________________________________________________________________________________________________
50 //  declarations
51 //_________________________________________________________________________________________________________________
52 
53 /*-************************************************************************************************************//**
54     @short          collect informations about font features
55     @descr          -
56 
57     @implements     -
58     @base           -
59 
60     @devstatus      ready to use
61 *//*-*************************************************************************************************************/
62 
63 class UNOTOOLS_DLLPUBLIC SvtFontOptions: public utl::detail::Options
64 {
65     //-------------------------------------------------------------------------------------------------------------
66     //  public methods
67     //-------------------------------------------------------------------------------------------------------------
68 
69     public:
70 
71         //---------------------------------------------------------------------------------------------------------
72         //  constructor / destructor
73         //---------------------------------------------------------------------------------------------------------
74 
75         /*-****************************************************************************************************//**
76             @short      standard constructor and destructor
77             @descr      This will initialize an instance with default values.
78                         We implement these class with a refcount mechanism! Every instance of this class increase it
79                         at create and decrease it at delete time - but all instances use the same data container!
80                         He is implemented as a static member ...
81 
82             @seealso    member m_nRefCount
83             @seealso    member m_pDataContainer
84 
85             @param      -
86             @return     -
87 
88             @onerror    -
89         *//*-*****************************************************************************************************/
90 
91          SvtFontOptions();
92         virtual ~SvtFontOptions();
93 
94         //---------------------------------------------------------------------------------------------------------
95         //  interface
96         //---------------------------------------------------------------------------------------------------------
97 
98         /*-****************************************************************************************************//**
99             @short      interface methods to get and set value of config key "org.openoffice.Office.Common/Font"
100             @descr      These values defines different states of font handling.
101 
102                         ..ReplacementTable..()  =>  Determines if the list of font replacements is applied or not.
103 
104                         ..FontHistory..()       =>  The last 5 fonts will be shown and the last one will be the
105                                                     first name on the list. These will be displayed in the Font name
106                                                     combo box on the Object bar.
107 
108                         ..FontWYSIWYG..()       =>  With this option the names of the selectable fonts
109                                                     (for example, the fonts in the Font field in the object bar)
110                                                     will be formatted as the current font.
111 
112             @seealso    -
113 
114             @param      -
115             @return     -
116 
117             @onerror    No error should occurre!
118         *//*-*****************************************************************************************************/
119 
120         sal_Bool    IsReplacementTableEnabled   (                   ) const ;
121         void        EnableReplacementTable      ( sal_Bool bState   )       ;
122 
123         sal_Bool    IsFontHistoryEnabled        (                   ) const ;
124         void        EnableFontHistory           ( sal_Bool bState   )       ;
125 
126         sal_Bool    IsFontWYSIWYGEnabled        (                   ) const ;
127         void        EnableFontWYSIWYG           ( sal_Bool bState   )       ;
128 
129     //-------------------------------------------------------------------------------------------------------------
130     //  private methods
131     //-------------------------------------------------------------------------------------------------------------
132 
133     private:
134 
135         /*-****************************************************************************************************//**
136             @short      return a reference to a static mutex
137             @descr      These class use his own static mutex to be threadsafe.
138                         We create a static mutex only for one ime and use at different times.
139 
140             @seealso    -
141 
142             @param      -
143             @return     A reference to a static mutex member.
144 
145             @onerror    -
146         *//*-*****************************************************************************************************/
147 
148         UNOTOOLS_DLLPRIVATE static ::osl::Mutex& impl_GetOwnStaticMutex();
149 
150     //-------------------------------------------------------------------------------------------------------------
151     //  private member
152     //-------------------------------------------------------------------------------------------------------------
153 
154     private:
155 
156         /*Attention
157 
158             Don't initialize these static member in these header!
159             a) Double dfined symbols will be detected ...
160             b) and unresolved externals exist at linking time.
161             Do it in your source only.
162          */
163 
164         static SvtFontOptions_Impl*         m_pDataContainer    ;   /// impl. data container as dynamic pointer for smaller memory requirements!
165         static sal_Int32                    m_nRefCount         ;   /// internal ref count mechanism
166 
167 };      // class SvtFontOptions
168 
169 #endif  // #ifndef INCLUDED_unotools_FONTOPTIONS_HXX
170