LibreOffice Module writerfilter (master) 1
rtffly.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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 */
9
10#pragma once
11
12#include <com/sun/star/text/HoriOrientation.hpp>
13#include <com/sun/star/text/RelOrientation.hpp>
14#include <com/sun/star/text/VertOrientation.hpp>
15
16#include <ooxml/resourceids.hxx>
17#include <osl/endian.h>
18
20{
23{
24public:
25 explicit RTFVertOrient(sal_uInt16 nValue)
26 : m_nVal(nValue)
27 {
28 }
29
30 sal_uInt16 GetOrient() const { return OSL_LONIBBLE(OSL_LOBYTE(m_nVal)); }
31
32 sal_uInt16 GetRelation() const { return OSL_HINIBBLE(OSL_LOBYTE(m_nVal)); }
33
34 sal_Int32 GetAlign() const
35 {
36 sal_Int32 nAlign = 0;
37 switch (GetOrient())
38 {
39 case css::text::VertOrientation::CENTER:
40 nAlign = NS_ooxml::LN_Value_doc_ST_YAlign_center;
41 break;
42 case css::text::VertOrientation::TOP:
43 nAlign = NS_ooxml::LN_Value_doc_ST_YAlign_top;
44 break;
45 case css::text::VertOrientation::BOTTOM:
46 nAlign = NS_ooxml::LN_Value_doc_ST_YAlign_bottom;
47 break;
48 }
49
50 return nAlign;
51 }
52
53 sal_Int32 GetAnchor() const
54 {
55 sal_Int32 nAnchor = 0;
56 switch (GetRelation())
57 {
59 nAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_text;
60 break;
61 case css::text::RelOrientation::PAGE_FRAME:
62 nAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_page;
63 break;
64 case css::text::RelOrientation::PAGE_PRINT_AREA:
65 nAnchor = NS_ooxml::LN_Value_doc_ST_VAnchor_margin;
66 break;
67 }
68
69 return nAnchor;
70 }
71
72private:
73 sal_uInt16 m_nVal;
74};
75
78{
79public:
80 explicit RTFHoriOrient(sal_uInt16 nValue)
81 : m_nVal(nValue)
82 {
83 }
84
85 sal_uInt16 GetOrient() const { return OSL_LONIBBLE(OSL_LOBYTE(m_nVal)); }
86
87 sal_uInt16 GetRelation() const { return OSL_LONIBBLE(OSL_HIBYTE(m_nVal)); }
88
89 sal_Int32 GetAlign() const
90 {
91 sal_Int32 nAlign = 0;
92 switch (GetOrient())
93 {
94 case css::text::HoriOrientation::CENTER:
95 nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_center;
96 break;
97 case css::text::HoriOrientation::RIGHT:
98 nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_right;
99 break;
100 case css::text::HoriOrientation::LEFT:
101 nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_left;
102 break;
103 case css::text::HoriOrientation::INSIDE:
104 nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_inside;
105 break;
106 case css::text::HoriOrientation::OUTSIDE:
107 nAlign = NS_ooxml::LN_Value_doc_ST_XAlign_outside;
108 break;
109 }
110
111 return nAlign;
112 }
113
114 sal_Int32 GetAnchor() const
115 {
116 sal_Int32 nAnchor = 0;
117 switch (GetRelation())
118 {
120 nAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_text;
121 break;
122 case css::text::RelOrientation::PAGE_FRAME:
123 nAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_page;
124 break;
125 case css::text::RelOrientation::PAGE_PRINT_AREA:
126 nAnchor = NS_ooxml::LN_Value_doc_ST_HAnchor_margin;
127 break;
128 }
129
130 return nAnchor;
131 }
132
133private:
134 sal_uInt16 m_nVal;
135};
136} // namespace writerfilter::rtftok
137
138/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Stores the horizontal orientation properties of an RTF fly frame.
Definition: rtffly.hxx:78
sal_uInt16 GetOrient() const
Definition: rtffly.hxx:85
sal_uInt16 GetRelation() const
Definition: rtffly.hxx:87
RTFHoriOrient(sal_uInt16 nValue)
Definition: rtffly.hxx:80
Stores the vertical orientation properties of an RTF fly frame.
Definition: rtffly.hxx:23
sal_uInt16 GetRelation() const
Definition: rtffly.hxx:32
sal_uInt16 GetOrient() const
Definition: rtffly.hxx:30
RTFVertOrient(sal_uInt16 nValue)
Definition: rtffly.hxx:25
sal_Int16 nValue