LibreOffice Module sw (master) 1
ascharanchoredobjectposition.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 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef INCLUDED_SW_SOURCE_CORE_INC_ASCHARANCHOREDOBJECTPOSITION_HXX
21#define INCLUDED_SW_SOURCE_CORE_INC_ASCHARANCHOREDOBJECTPOSITION_HXX
22
24#include <swtypes.hxx>
25#include <swrect.hxx>
27
28class SwTextFrame;
30
31// flags for positioning algorithm of as-character-anchored objects
32enum class AsCharFlags {
33 None = 0x00,
34 Quick = 0x01,
35 UlSpace = 0x02,
36 Init = 0x04,
37 Rotate = 0x08,
38 Reverse = 0x10,
39 Bidi = 0x20,
40};
41namespace o3tl {
42 template<> struct typed_flags<AsCharFlags> : is_typed_flags<AsCharFlags, 0x3f> {};
43};
44
45namespace sw
46{
47 // TODO: merge/migrate this to com::sun::star::VertOrientation instead of duplicating?
48 enum class LineAlign
49 {
50 NONE,
51 TOP,
52 CENTER,
53 BOTTOM
54 };
55};
56namespace objectpositioning
57{
59 {
60 private:
61 // data to calculate object position
62 // Proposed anchor position, starting point for the calculation
63 // of the object position.
65 // flags that influences the calculation of the anchor position
66 // AsCharFlags::Quick : quick formatting - calculated position not set at object
67 // AsCharFlags::UlSpace : consider upper/lower spacing - adjustment of anchor position
68 // AsCharFlags::Init : initial calculation
69 // AsCharFlags::Rotate : object is rotated by 90 degrees
70 // AsCharFlags::Reverse : object is reversed (rotated by 270 degrees)
71 // AsCharFlags::Bidi : object belongs to a BIDI-multi-portion
73 // needed line values for the different alignments.
78
79 // calculated data for object position
83 // line alignment relative to line height
85
86 // method to cast <SwAnchoredObjectPosition::GetAnchorFrame()>
87 const SwTextFrame& GetAnchorTextFrame() const;
88
100 SwTwips GetRelPosToBase( const SwTwips _nObjBoundHeight,
101 const SwFormatVertOrient& _rVert );
102
103 public:
128 const Point& _rProposedAnchorPos,
129 const AsCharFlags _nFlags,
130 const SwTwips _nLineAscent,
131 const SwTwips _nLineDescent,
132 const SwTwips _nLineAscentInclObjs,
133 const SwTwips _nLineDescentInclObjs );
134 virtual ~SwAsCharAnchoredObjectPosition() override;
135
142 virtual void CalcPosition() override;
143
144 // calculated anchored position for object position type AS_CHAR
145 const Point& GetAnchorPos() const { return maAnchorPos;}
146
147 // calculated relative position to base line for object position type AS_CHAR
148 SwTwips GetRelPosY() const { return mnRelPos;}
149
150 // determined object rectangle including spacing for object position type AS_CHAR
152
153 // determined line alignment relative to line height
155 };
156}
157
158#endif
159
160/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Defines the vertical position of a fly frame.
Definition: fmtornt.hxx:37
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:168
const SwTextFrame & GetAnchorTextFrame() const
method to cast <SwAnchoredObjectPosition::GetAnchorFrame()> to needed type
SwAsCharAnchoredObjectPosition(SdrObject &_rDrawObj, const Point &_rProposedAnchorPos, const AsCharFlags _nFlags, const SwTwips _nLineAscent, const SwTwips _nLineDescent, const SwTwips _nLineAscentInclObjs, const SwTwips _nLineDescentInclObjs)
constructor; provided object to be positioned and needed data for calculation of the object position
SwTwips GetRelPosToBase(const SwTwips _nObjBoundHeight, const SwFormatVertOrient &_rVert)
determine the relative position to base line for object position
virtual void CalcPosition() override
calculate position for object position
void Init()
const sal_uInt32 TOP
const sal_uInt32 BOTTOM
NONE
None
Dialog to specify the properties of date form field.
tools::Long SwTwips
Definition: swtypes.hxx:51