1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
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
23 /// Stores the vertical orientation properties of an RTF fly frame.
27 explicit RTFVertOrient(sal_uInt16 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
41 case css::text::VertOrientation::CENTER
:
42 nAlign
= NS_ooxml::LN_Value_doc_ST_YAlign_center
;
44 case css::text::VertOrientation::TOP
:
45 nAlign
= NS_ooxml::LN_Value_doc_ST_YAlign_top
;
47 case css::text::VertOrientation::BOTTOM
:
48 nAlign
= NS_ooxml::LN_Value_doc_ST_YAlign_bottom
;
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
;
63 case css::text::RelOrientation::PAGE_FRAME
:
64 nAnchor
= NS_ooxml::LN_Value_doc_ST_VAnchor_page
;
66 case css::text::RelOrientation::PAGE_PRINT_AREA
:
67 nAnchor
= NS_ooxml::LN_Value_doc_ST_VAnchor_margin
;
75 sal_uInt16
const m_nVal
;
78 /// Stores the horizontal orientation properties of an RTF fly frame.
82 explicit RTFHoriOrient(sal_uInt16 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
96 case css::text::HoriOrientation::CENTER
:
97 nAlign
= NS_ooxml::LN_Value_doc_ST_XAlign_center
;
99 case css::text::HoriOrientation::RIGHT
:
100 nAlign
= NS_ooxml::LN_Value_doc_ST_XAlign_right
;
102 case css::text::HoriOrientation::LEFT
:
103 nAlign
= NS_ooxml::LN_Value_doc_ST_XAlign_left
;
105 case css::text::HoriOrientation::INSIDE
:
106 nAlign
= NS_ooxml::LN_Value_doc_ST_XAlign_inside
;
108 case css::text::HoriOrientation::OUTSIDE
:
109 nAlign
= NS_ooxml::LN_Value_doc_ST_XAlign_outside
;
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
;
124 case css::text::RelOrientation::PAGE_FRAME
:
125 nAnchor
= NS_ooxml::LN_Value_doc_ST_HAnchor_page
;
127 case css::text::RelOrientation::PAGE_PRINT_AREA
:
128 nAnchor
= NS_ooxml::LN_Value_doc_ST_HAnchor_margin
;
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: */