xref: /trunk/main/svx/inc/svx/ucsubset.hxx (revision 3334a7e6)
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 _SVX_SUBSETMAP_HXX
25 #define _SVX_SUBSETMAP_HXX
26 
27 #include "svx/svxdllapi.h"
28 
29 #include <svx/ucsubset.hrc>
30 #include <vcl/metric.hxx>
31 
32 #include <list>
33 
34 class FontCharMap;
35 
36 // classes Subset & SubsetMap --------------------------------------------
37 // TODO: should be moved into Font Attributes territory,
38 // we let them mature here though because this is currently the only use
39 
40 class Subset
41 {
42 public:
Subset(sal_UCS4 nMin,sal_UCS4 nMax,const String & aName)43     Subset( sal_UCS4 nMin, sal_UCS4 nMax, const String& aName )
44     : mnRangeMin(nMin), mnRangeMax(nMax), maRangeName(aName)
45     {}
46 
47     Subset( sal_UCS4 nMin, sal_UCS4 nMax, int resId );
48 
GetRangeMin() const49     sal_UCS4        GetRangeMin() const { return mnRangeMin;}
GetRangeMax() const50     sal_UCS4        GetRangeMax() const { return mnRangeMax;}
GetName() const51     const String    GetName()     const { return maRangeName;}
52 
53 private:
54     sal_UCS4        mnRangeMin;
55     sal_UCS4        mnRangeMax;
56     String          maRangeName;
57 };
58 
59 typedef ::std::list<Subset> SubsetList;
60 
61 class SVX_DLLPUBLIC SubsetMap : private Resource
62 {
63 public:
64     SubsetMap( const FontCharMap* );
65 
66     const Subset*   GetSubsetByUnicode( sal_UCS4 ) const;
67     const Subset*   GetNextSubset( bool bFirst ) const;
68 
69 private:
70     SubsetList      maSubsets;
71     mutable SubsetList::const_iterator maSubsetIterator;
72 
73     SVX_DLLPRIVATE void            InitList();
74     SVX_DLLPRIVATE void            ApplyCharMap( const FontCharMap* );
75 };
76 
77 #endif
78