xref: /AOO41X/main/filter/inc/filter/msfilter/dffpropset.hxx (revision 3fd51d8f6ab4180d522b213bb4a7580b5eaa7b7a)
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 _DFFPROPSET_HXX
25 #define _DFFPROPSET_HXX
26 
27 #include <tools/solar.h>
28 #include <filter/msfilter/msfilterdllapi.h>
29 #include <filter/msfilter/dffrecordheader.hxx>
30 #include <tools/stream.hxx>
31 #include <vector>
32 #include <tools/table.hxx>
33 
34 struct DffPropFlags
35 {
36     sal_uInt16  bSet        : 1;
37     sal_uInt16  bComplex    : 1;
38     sal_uInt16  bBlip       : 1;
39     sal_uInt16  bSoftAttr   : 1;
40 };
41 
42 struct DffPropSetEntry
43 {
44     DffPropFlags    aFlags;
45     sal_uInt16      nComplexIndexOrFlagsHAttr;
46     sal_uInt32      nContent;
47 };
48 
49 class MSFILTER_DLLPUBLIC DffPropSet
50 {
51     private :
52 
53         DffPropSetEntry*            mpPropSetEntries;
54         std::vector< sal_uInt32 >   maOffsets;
55 
56         void ReadPropSet( SvStream&, bool );
57 
58     public :
59 
60         explicit DffPropSet();
61         ~DffPropSet();
62 
IsProperty(sal_uInt32 nRecType) const63         inline sal_Bool IsProperty( sal_uInt32 nRecType ) const { return ( mpPropSetEntries[ nRecType & 0x3ff ].aFlags.bSet ); };
IsComplex(sal_uInt32 nRecType) const64         inline sal_Bool IsComplex( sal_uInt32 nRecType ) const { return ( mpPropSetEntries[ nRecType & 0x3ff ].aFlags.bComplex ); };
65         sal_Bool        IsHardAttribute( sal_uInt32 nId ) const;
66         sal_uInt32      GetPropertyValue( sal_uInt32 nId, sal_uInt32 nDefault = 0 ) const;
67         /** Returns a boolean property by its real identifier. */
68         bool        GetPropertyBool( sal_uInt32 nId, bool bDefault = false ) const;
69         /** Returns a string property. */
70         ::rtl::OUString GetPropertyString( sal_uInt32 nId, SvStream& rStrm ) const;
71         void        SetPropertyValue( sal_uInt32 nId, sal_uInt32 nValue ) const;
72         sal_Bool        SeekToContent( sal_uInt32 nRecType, SvStream& rSt ) const;
73         void        InitializePropSet( sal_uInt16 nPropSetType ) const;
74 
75         friend SvStream& operator>>( SvStream& rIn, DffPropSet& rPropSet );
76         friend SvStream& operator|=( SvStream& rIn, DffPropSet& rPropSet );
77 };
78 
79 #endif
80 
81 
82