Revert "tdf#158280 Replace usage of InputDialog with SvxNameDialog"
[LibreOffice.git] / sw / source / uibase / inc / frmmgr.hxx
blobc574ac05009c3a6e977e0414782c4bb3e5be5165
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_FRMMGR_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_FRMMGR_HXX
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>
31 class SwWrtShell;
32 struct SvxSwFrameValidation;
33 struct SwPosition;
35 class SwFormatCol;
36 class SvGlobalName;
38 constexpr SwTwips DFLT_WIDTH = o3tl::toTwips(20, o3tl::Length::mm);
39 constexpr SwTwips DFLT_HEIGHT = o3tl::toTwips(5, o3tl::Length::mm);
41 enum class Frmmgr_Type
43 NONE = 0x00,
44 TEXT = 0x01,
45 GRF = 0x02,
46 OLE = 0x04,
47 ENVELP = 0x10
50 class SwFlyFrameAttrMgr
52 SfxItemSet m_aSet;
53 Point m_aAbsPos;
54 SwWrtShell* m_pOwnSh;
56 bool m_bAbsPos,
57 m_bNewFrame;
58 bool m_bIsInVertical;
59 // #mongolianlayout#
60 bool m_bIsInVerticalL2R;
62 // internal calculation for borders
63 SwTwips CalcTopSpace();
64 SwTwips CalcBottomSpace();
65 SwTwips CalcLeftSpace();
66 SwTwips CalcRightSpace();
68 void UpdateFlyFrame_(); // post-treatment after insert or update
70 public:
71 SW_DLLPUBLIC SwFlyFrameAttrMgr( bool bNew, SwWrtShell* pSh, Frmmgr_Type nType, const SvGlobalName* pName );
73 //CopyCtor for dialogs to check the metrics
74 SW_DLLPUBLIC SwFlyFrameAttrMgr( bool bNew, SwWrtShell *pSh, SfxItemSet aSet );
76 SW_DLLPUBLIC void SetAnchor(RndStdIds eId);
77 inline RndStdIds GetAnchor() const;
79 void SetHorzOrientation(sal_Int16 eOrient);
80 void SetVertOrientation(sal_Int16 eOrient);
82 // absolute position
83 void SetAbsPos(const Point& rLPoint);
85 // anchor's relative position
86 void SetPos(const Point& rLPoint);
87 inline Point GetPos() const;
89 // size
90 void SetSize(const Size& rLSize);
91 inline const Size& GetSize() const;
93 void SetHeightSizeType(SwFrameSize eType);
95 // rotation
96 void SetRotation(Degree10 nOld, Degree10 nNew, const Size& rUnrotatedSize);
98 // space to content
99 void SetLRSpace( tools::Long nLeft,
100 tools::Long nRight );
101 void SetULSpace( tools::Long nTop,
102 tools::Long nBottom );
104 void SetCol( const SwFormatCol &rCol);
106 // change and query attributes
107 void UpdateAttrMgr();
108 void UpdateFlyFrame();
110 // create new frame
111 void InsertFlyFrame();
112 SW_DLLPUBLIC void InsertFlyFrame(RndStdIds eAnchorType,
113 const Point &rPos,
114 const Size &rSize);
116 // check and change metrics
117 SW_DLLPUBLIC void ValidateMetrics(SvxSwFrameValidation& rVal,
118 const SwFormatAnchor* pToCharContentPos,
119 bool bOnlyPercentRefValue = false);
121 void DelAttr(sal_uInt16 nId);
123 // reach out the set
124 const SfxItemSet &GetAttrSet() const { return m_aSet; }
125 SfxItemSet &GetAttrSet() { return m_aSet; }
126 void SetAttrSet(const SfxItemSet& rSet);
127 void SetFrameSizeFromTable();
128 /// Checks if we have a table selection and that covers exactly 1 full table.
129 SW_DLLPUBLIC static const SwTableFormat* SingleTableSelected(SwWrtShell& rWrtShell);
131 inline const SwFormatVertOrient &GetVertOrient() const;
132 inline const SwFormatHoriOrient &GetHoriOrient() const;
133 inline const SvxShadowItem &GetShadow() const;
134 inline const SvxBoxItem &GetBox() const;
135 inline const SwFormatFrameSize &GetFrameSize() const;
137 tools::Long CalcWidthBorder() { return CalcLeftSpace()+CalcRightSpace(); }
138 tools::Long CalcHeightBorder() { return CalcTopSpace()+CalcBottomSpace(); }
141 inline const Size& SwFlyFrameAttrMgr::GetSize() const
143 return m_aSet.Get(RES_FRM_SIZE).GetSize();
146 inline const SwFormatVertOrient &SwFlyFrameAttrMgr::GetVertOrient() const
148 return m_aSet.Get(RES_VERT_ORIENT);
150 inline const SwFormatHoriOrient &SwFlyFrameAttrMgr::GetHoriOrient() const
152 return m_aSet.Get(RES_HORI_ORIENT);
154 inline const SwFormatFrameSize& SwFlyFrameAttrMgr::GetFrameSize() const
156 return m_aSet.Get(RES_FRM_SIZE);
158 inline const SvxShadowItem &SwFlyFrameAttrMgr::GetShadow() const
160 return m_aSet.Get(RES_SHADOW);
162 inline const SvxBoxItem &SwFlyFrameAttrMgr::GetBox() const
164 return m_aSet.Get(RES_BOX);
166 inline Point SwFlyFrameAttrMgr::GetPos() const
168 return Point( GetHoriOrient().GetPos(), GetVertOrient().GetPos() );
170 inline RndStdIds SwFlyFrameAttrMgr::GetAnchor() const
172 return m_aSet.Get(RES_ANCHOR).GetAnchorId();
175 #endif
177 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */