Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / writerfilter / source / rtftok / rtffly.hxx
blob9b40332fea93b84be7a25078f7b48b3b4ede6f91
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #ifndef INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFFLY_HXX
11 #define INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFFLY_HXX
13 #include <com/sun/star/text/HoriOrientation.hpp>
14 #include <com/sun/star/text/RelOrientation.hpp>
15 #include <com/sun/star/text/VertOrientation.hpp>
17 #include <osl/endian.h>
19 namespace writerfilter
21 namespace rtftok
23 /// Stores the vertical orientation properties of an RTF fly frame.
24 class RTFVertOrient
26 public:
27 explicit RTFVertOrient(sal_uInt16 nValue)
28 : m_nVal(nValue)
32 sal_uInt16 GetOrient() const { return OSL_LONIBBLE(OSL_LOBYTE(m_nVal)); }
34 sal_uInt16 GetRelation() const { return OSL_HINIBBLE(OSL_LOBYTE(m_nVal)); }
36 sal_Int32 GetAlign() const
38 sal_Int32 nAlign = 0;
39 switch (GetOrient())
41 case css::text::VertOrientation::CENTER:
42 nAlign = NS_ooxml::LN_Value_doc_ST_YAlign_center;
43 break;
44 case css::text::VertOrientation::TOP:
45 nAlign = NS_ooxml::LN_Value_doc_ST_YAlign_top;
46 break;
47 case css::text::VertOrientation::BOTTOM:
48 nAlign = NS_ooxml::LN_Value_doc_ST_YAlign_bottom;
49 break;
52 return nAlign;
55 sal_Int32 GetAnchor() const
57 sal_Int32 nAnchor = 0;
58 switch (GetRelation())
60 case css::text::RelOrientation::FRAME:
61 nAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_text;
62 break;
63 case css::text::RelOrientation::PAGE_FRAME:
64 nAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_page;
65 break;
66 case css::text::RelOrientation::PAGE_PRINT_AREA:
67 nAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_margin;
68 break;
71 return nAnchor;
74 private:
75 sal_uInt16 const m_nVal;
78 /// Stores the horizontal orientation properties of an RTF fly frame.
79 class RTFHoriOrient
81 public:
82 explicit RTFHoriOrient(sal_uInt16 nValue)
83 : m_nVal(nValue)
87 sal_uInt16 GetOrient() const { return OSL_LONIBBLE(OSL_LOBYTE(m_nVal)); }
89 sal_uInt16 GetRelation() const { return OSL_LONIBBLE(OSL_HIBYTE(m_nVal)); }
91 sal_Int32 GetAlign() const
93 sal_Int32 nAlign = 0;
94 switch (GetOrient())
96 case css::text::HoriOrientation::CENTER:
97 nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_center;
98 break;
99 case css::text::HoriOrientation::RIGHT:
100 nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_right;
101 break;
102 case css::text::HoriOrientation::LEFT:
103 nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_left;
104 break;
105 case css::text::HoriOrientation::INSIDE:
106 nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_inside;
107 break;
108 case css::text::HoriOrientation::OUTSIDE:
109 nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_outside;
110 break;
113 return nAlign;
116 sal_Int32 GetAnchor() const
118 sal_Int32 nAnchor = 0;
119 switch (GetRelation())
121 case css::text::RelOrientation::FRAME:
122 nAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_text;
123 break;
124 case css::text::RelOrientation::PAGE_FRAME:
125 nAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_page;
126 break;
127 case css::text::RelOrientation::PAGE_PRINT_AREA:
128 nAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_margin;
129 break;
132 return nAnchor;
135 private:
136 sal_uInt16 const m_nVal;
138 } // namespace rtftok
139 } // namespace writerfilter
141 #endif // INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFFLY_HXX
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */