xref: /aoo42x/main/sw/source/filter/inc/rtf.hxx (revision 1d2dbeb0)
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 _RTF_HXX
24 #define _RTF_HXX
25 
26 #include <tools/solar.h>
27 
28 // Umsetzung einiger FlyFrame-Attribute
29 class RTFVertOrient
30 {
31 	union {
32 		struct {
33 			sal_uInt16 nOrient : 4;
34 			sal_uInt16 nRelOrient : 1;
35 		} Flags;
36 		sal_uInt16 nVal;
37 	} Value;
38 
39 public:
RTFVertOrient(sal_uInt16 nValue)40 	RTFVertOrient( sal_uInt16 nValue ) { Value.nVal = nValue; }
41 
RTFVertOrient(sal_uInt16 nOrient,sal_uInt16 nRelOrient)42 	RTFVertOrient( sal_uInt16 nOrient, sal_uInt16 nRelOrient )	{
43 		Value.Flags.nOrient = nOrient;
44 		Value.Flags.nRelOrient = nRelOrient;
45 	}
46 
GetOrient() const47 	sal_uInt16 GetOrient() 	 const { return Value.Flags.nOrient; }
GetRelation() const48 	sal_uInt16 GetRelation() const { return Value.Flags.nRelOrient; }
GetValue() const49 	sal_uInt16 GetValue() 	 const { return Value.nVal; }
50 };
51 
52 
53 class RTFHoriOrient
54 {
55 	union {
56 		struct {
57 			sal_uInt16 nOrient : 4;
58 			sal_uInt16 nRelAnchor : 4;
59 			sal_uInt16 nRelOrient : 1;
60 		} Flags;
61 		sal_uInt16 nVal;
62 	} Value;
63 
64 public:
RTFHoriOrient(sal_uInt16 nValue)65 	RTFHoriOrient( sal_uInt16 nValue ) { Value.nVal = nValue; }
66 
RTFHoriOrient(sal_uInt16 nOrient,sal_uInt16 nRelOrient)67 	RTFHoriOrient( sal_uInt16 nOrient, sal_uInt16 nRelOrient ) {
68 		Value.Flags.nOrient = nOrient;
69 		Value.Flags.nRelOrient = nRelOrient;
70 		Value.Flags.nRelAnchor = 0;
71 	}
72 
GetOrient() const73 	sal_uInt16 GetOrient() 	 const { return Value.Flags.nOrient; }
GetRelation() const74 	sal_uInt16 GetRelation() const { return Value.Flags.nRelOrient; }
GetValue() const75 	sal_uInt16 GetValue() 	 const { return Value.nVal; }
76 };
77 
78 class RTFProtect
79 {
80 	union {
81 		struct {
82 			sal_Bool bCntnt : 1;
83 			sal_Bool bSize : 1;
84 			sal_Bool bPos : 1;
85 		} Flags;
86 		sal_uInt8 nVal;
87 	} Value;
88 public:
RTFProtect(sal_uInt8 nValue)89 	RTFProtect( sal_uInt8 nValue ) { Value.nVal = nValue; }
90 
RTFProtect(sal_Bool bCntnt,sal_Bool bSize,sal_Bool bPos)91 	RTFProtect( sal_Bool bCntnt, sal_Bool bSize, sal_Bool bPos ) {
92 		Value.Flags.bCntnt = bCntnt;
93 		Value.Flags.bSize = bSize;
94 		Value.Flags.bPos = bPos;
95 	}
96 
GetCntnt() const97 	sal_Bool GetCntnt()  	const { return Value.Flags.bCntnt; }
GetSize() const98 	sal_Bool GetSize()		const { return Value.Flags.bSize; }
GetPos() const99 	sal_Bool GetPos()		const { return Value.Flags.bPos; }
GetValue() const100 	sal_uInt16 GetValue() 	const { return Value.nVal; }
101 };
102 
103 
104 class RTFSurround
105 {
106 	union {
107 		struct {
108 			sal_uInt16 nGoldCut : 1;
109 			sal_uInt16 nOrder : 4;
110 		} Flags;
111 		sal_uInt8 nVal;
112 	} Value;
113 public:
RTFSurround(sal_uInt8 nValue)114 	RTFSurround( sal_uInt8 nValue ) { Value.nVal = nValue; }
115 
RTFSurround(sal_Bool bGoldCut,sal_uInt8 nOrder)116 	RTFSurround( sal_Bool bGoldCut, sal_uInt8 nOrder ) {
117 		Value.Flags.nOrder = nOrder;
118 		Value.Flags.nGoldCut = bGoldCut;
119 	}
120 
GetOrder() const121 	sal_uInt8 GetOrder()     const { return (sal_uInt8)Value.Flags.nOrder; }
GetGoldCut() const122 	sal_Bool GetGoldCut()   const { return (sal_Bool)Value.Flags.nGoldCut; }
GetValue() const123 	sal_uInt16 GetValue() 	const { return Value.nVal; }
124 };
125 
126 #endif // _RTF_HXX
127 
128 
129