LibreOffice Module sw (master) 1
frmmgr.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#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_FRMMGR_HXX
20#define INCLUDED_SW_SOURCE_UIBASE_INC_FRMMGR_HXX
21
22#include <swtypes.hxx>
23#include <editeng/boxitem.hxx>
24#include <editeng/shaditem.hxx>
25#include <tools/gen.hxx>
26#include <fmtfsize.hxx>
27#include <fmtornt.hxx>
28#include <fmtanchr.hxx>
29#include <swdllapi.h>
30
31class SwWrtShell;
33struct SwPosition;
34
35class SwFormatCol;
36class SvGlobalName;
37
40
41enum class Frmmgr_Type
42{
43 NONE = 0x00,
44 TEXT = 0x01,
45 GRF = 0x02,
46 OLE = 0x04,
47 ENVELP = 0x10
48};
49
51{
55
59 // #mongolianlayout#
61
62 // internal calculation for borders
63 SAL_DLLPRIVATE SwTwips CalcTopSpace();
64 SAL_DLLPRIVATE SwTwips CalcBottomSpace();
65 SAL_DLLPRIVATE SwTwips CalcLeftSpace();
66 SAL_DLLPRIVATE SwTwips CalcRightSpace();
67
68 SAL_DLLPRIVATE void UpdateFlyFrame_(); // post-treatment after insert or update
69
70public:
71 SwFlyFrameAttrMgr( bool bNew, SwWrtShell* pSh, Frmmgr_Type nType, const SvGlobalName* pName );
72
73 //CopyCtor for dialogs to check the metrics
74 SwFlyFrameAttrMgr( bool bNew, SwWrtShell *pSh, SfxItemSet aSet );
75
76 void SetAnchor(RndStdIds eId);
77 inline RndStdIds GetAnchor() const;
78
79 void SetHorzOrientation(sal_Int16 eOrient);
80 void SetVertOrientation(sal_Int16 eOrient);
81
82 // absolute position
83 void SetAbsPos(const Point& rLPoint);
84
85 // anchor's relative position
86 void SetPos(const Point& rLPoint);
87 inline Point GetPos() const;
88
89 // size
90 void SetSize(const Size& rLSize);
91 inline const Size& GetSize() const;
92
93 void SetHeightSizeType(SwFrameSize eType);
94
95 // rotation
96 void SetRotation(Degree10 nOld, Degree10 nNew, const Size& rUnrotatedSize);
97
98 // space to content
99 void SetLRSpace( tools::Long nLeft,
100 tools::Long nRight );
101 void SetULSpace( tools::Long nTop,
102 tools::Long nBottom );
103
104 void SetCol( const SwFormatCol &rCol);
105
106 // change and query attributes
107 void UpdateAttrMgr();
108 void UpdateFlyFrame();
109
110 // create new frame
111 void InsertFlyFrame();
112 void InsertFlyFrame(RndStdIds eAnchorType,
113 const Point &rPos,
114 const Size &rSize);
115
116 // check and change metrics
117 void ValidateMetrics(SvxSwFrameValidation& rVal,
118 const SwFormatAnchor* pToCharContentPos,
119 bool bOnlyPercentRefValue = false);
120
121 void DelAttr(sal_uInt16 nId);
122
123 // reach out the set
124 const SfxItemSet &GetAttrSet() const { return m_aSet; }
126 void SetAttrSet(const SfxItemSet& rSet);
127
128 inline const SwFormatVertOrient &GetVertOrient() const;
129 inline const SwFormatHoriOrient &GetHoriOrient() const;
130 inline const SvxShadowItem &GetShadow() const;
131 inline const SvxBoxItem &GetBox() const;
132 inline const SwFormatFrameSize &GetFrameSize() const;
133
134 tools::Long CalcWidthBorder() { return CalcLeftSpace()+CalcRightSpace(); }
135 tools::Long CalcHeightBorder() { return CalcTopSpace()+CalcBottomSpace(); }
136};
137
138inline const Size& SwFlyFrameAttrMgr::GetSize() const
139{
140 return m_aSet.Get(RES_FRM_SIZE).GetSize();
141}
142
144{
145 return m_aSet.Get(RES_VERT_ORIENT);
146}
148{
149 return m_aSet.Get(RES_HORI_ORIENT);
150}
152{
153 return m_aSet.Get(RES_FRM_SIZE);
154}
156{
157 return m_aSet.Get(RES_SHADOW);
158}
160{
161 return m_aSet.Get(RES_BOX);
162}
164{
165 return Point( GetHoriOrient().GetPos(), GetVertOrient().GetPos() );
166}
168{
169 return m_aSet.Get(RES_ANCHOR).GetAnchorId();
170}
171
172#endif
173
174/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
SwWrtShell * m_pOwnSh
Definition: frmmgr.hxx:54
const SwFormatFrameSize & GetFrameSize() const
Definition: frmmgr.hxx:151
const SwFormatVertOrient & GetVertOrient() const
Definition: frmmgr.hxx:143
tools::Long CalcWidthBorder()
Definition: frmmgr.hxx:134
RndStdIds GetAnchor() const
Definition: frmmgr.hxx:167
Point GetPos() const
Definition: frmmgr.hxx:163
bool m_bIsInVertical
Definition: frmmgr.hxx:58
const Size & GetSize() const
Definition: frmmgr.hxx:138
SfxItemSet m_aSet
Definition: frmmgr.hxx:52
bool m_bIsInVerticalL2R
Definition: frmmgr.hxx:60
tools::Long CalcHeightBorder()
Definition: frmmgr.hxx:135
const SwFormatHoriOrient & GetHoriOrient() const
Definition: frmmgr.hxx:147
SfxItemSet & GetAttrSet()
Definition: frmmgr.hxx:125
const SfxItemSet & GetAttrSet() const
Definition: frmmgr.hxx:124
const SvxBoxItem & GetBox() const
Definition: frmmgr.hxx:159
const SvxShadowItem & GetShadow() const
Definition: frmmgr.hxx:155
FlyAnchors.
Definition: fmtanchr.hxx:37
Defines the horizontal position of a fly frame.
Definition: fmtornt.hxx:73
Defines the vertical position of a fly frame.
Definition: fmtornt.hxx:37
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
std::vector< bool, std::allocator< bool > > m_aSet
SwFrameSize
Definition: fmtfsize.hxx:36
constexpr SwTwips DFLT_HEIGHT
Definition: frmmgr.hxx:39
Frmmgr_Type
Definition: frmmgr.hxx:42
constexpr SwTwips DFLT_WIDTH
Definition: frmmgr.hxx:38
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(109)
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(113)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(108)
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(110)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
NONE
constexpr auto toTwips(N number, Length from)
long Long
Marks a position in the document model.
Definition: pam.hxx:38
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
RndStdIds
tools::Long SwTwips
Definition: swtypes.hxx:51
TEXT