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/.
12 #include <com/sun/star/text/HoriOrientation.hpp>
13 #include <com/sun/star/text/RelOrientation.hpp>
14 #include <com/sun/star/text/VertOrientation.hpp>
16 #include <ooxml/resourceids.hxx>
17 #include <osl/endian.h>
19 namespace writerfilter::rtftok
21 /// Stores the vertical orientation properties of an RTF fly frame.
25 explicit RTFVertOrient(sal_uInt16 nValue
)
30 sal_uInt16
GetOrient() const { return OSL_LONIBBLE(OSL_LOBYTE(m_nVal
)); }
32 sal_uInt16
GetRelation() const { return OSL_HINIBBLE(OSL_LOBYTE(m_nVal
)); }
34 sal_Int32
GetAlign() const
39 case css::text::VertOrientation::CENTER
:
40 nAlign
= NS_ooxml::LN_Value_doc_ST_YAlign_center
;
42 case css::text::VertOrientation::TOP
:
43 nAlign
= NS_ooxml::LN_Value_doc_ST_YAlign_top
;
45 case css::text::VertOrientation::BOTTOM
:
46 nAlign
= NS_ooxml::LN_Value_doc_ST_YAlign_bottom
;
53 sal_Int32
GetAnchor() const
55 sal_Int32 nAnchor
= 0;
56 switch (GetRelation())
58 case css::text::RelOrientation::FRAME
:
59 nAnchor
= NS_ooxml::LN_Value_doc_ST_VAnchor_text
;
61 case css::text::RelOrientation::PAGE_FRAME
:
62 nAnchor
= NS_ooxml::LN_Value_doc_ST_VAnchor_page
;
64 case css::text::RelOrientation::PAGE_PRINT_AREA
:
65 nAnchor
= NS_ooxml::LN_Value_doc_ST_VAnchor_margin
;
76 /// Stores the horizontal orientation properties of an RTF fly frame.
80 explicit RTFHoriOrient(sal_uInt16 nValue
)
85 sal_uInt16
GetOrient() const { return OSL_LONIBBLE(OSL_LOBYTE(m_nVal
)); }
87 sal_uInt16
GetRelation() const { return OSL_LONIBBLE(OSL_HIBYTE(m_nVal
)); }
89 sal_Int32
GetAlign() const
94 case css::text::HoriOrientation::CENTER
:
95 nAlign
= NS_ooxml::LN_Value_doc_ST_XAlign_center
;
97 case css::text::HoriOrientation::RIGHT
:
98 nAlign
= NS_ooxml::LN_Value_doc_ST_XAlign_right
;
100 case css::text::HoriOrientation::LEFT
:
101 nAlign
= NS_ooxml::LN_Value_doc_ST_XAlign_left
;
103 case css::text::HoriOrientation::INSIDE
:
104 nAlign
= NS_ooxml::LN_Value_doc_ST_XAlign_inside
;
106 case css::text::HoriOrientation::OUTSIDE
:
107 nAlign
= NS_ooxml::LN_Value_doc_ST_XAlign_outside
;
114 sal_Int32
GetAnchor() const
116 sal_Int32 nAnchor
= 0;
117 switch (GetRelation())
119 case css::text::RelOrientation::FRAME
:
120 nAnchor
= NS_ooxml::LN_Value_doc_ST_HAnchor_text
;
122 case css::text::RelOrientation::PAGE_FRAME
:
123 nAnchor
= NS_ooxml::LN_Value_doc_ST_HAnchor_page
;
125 case css::text::RelOrientation::PAGE_PRINT_AREA
:
126 nAnchor
= NS_ooxml::LN_Value_doc_ST_HAnchor_margin
;
136 } // namespace writerfilter::rtftok
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */