nss: upgrade to release 3.73
[LibreOffice.git] / sw / source / uibase / inc / frmmgr.hxx
blobfc038f96d77d22d6a1b22d49c3c83479b627ead7
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 const SwTwips DFLT_WIDTH = MM50 * 4;
39 const SwTwips DFLT_HEIGHT = MM50;
41 enum class Frmmgr_Type
43 NONE = 0x00,
44 TEXT = 0x01,
45 GRF = 0x02,
46 OLE = 0x04,
47 ENVELP = 0x10
50 class SW_DLLPUBLIC 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 SAL_DLLPRIVATE SwTwips CalcTopSpace();
64 SAL_DLLPRIVATE SwTwips CalcBottomSpace();
65 SAL_DLLPRIVATE SwTwips CalcLeftSpace();
66 SAL_DLLPRIVATE SwTwips CalcRightSpace();
68 SAL_DLLPRIVATE void UpdateFlyFrame_(); // post-treatment after insert or update
70 public:
71 SwFlyFrameAttrMgr( bool bNew, SwWrtShell* pSh, Frmmgr_Type nType, const SvGlobalName* pName );
73 //CopyCtor for dialogs to check the metrics
74 SwFlyFrameAttrMgr( bool bNew, SwWrtShell *pSh, const SfxItemSet &rSet );
76 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(sal_uInt16 nOld, sal_uInt16 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 void InsertFlyFrame(RndStdIds eAnchorType,
113 const Point &rPos,
114 const Size &rSize);
116 // check and change metrics
117 void ValidateMetrics(SvxSwFrameValidation& rVal,
118 const SwPosition* 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);
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;
134 tools::Long CalcWidthBorder() { return CalcLeftSpace()+CalcRightSpace(); }
135 tools::Long CalcHeightBorder() { return CalcTopSpace()+CalcBottomSpace(); }
138 inline const Size& SwFlyFrameAttrMgr::GetSize() const
140 return m_aSet.Get(RES_FRM_SIZE).GetSize();
143 inline const SwFormatVertOrient &SwFlyFrameAttrMgr::GetVertOrient() const
145 return m_aSet.Get(RES_VERT_ORIENT);
147 inline const SwFormatHoriOrient &SwFlyFrameAttrMgr::GetHoriOrient() const
149 return m_aSet.Get(RES_HORI_ORIENT);
151 inline const SwFormatFrameSize& SwFlyFrameAttrMgr::GetFrameSize() const
153 return m_aSet.Get(RES_FRM_SIZE);
155 inline const SvxShadowItem &SwFlyFrameAttrMgr::GetShadow() const
157 return m_aSet.Get(RES_SHADOW);
159 inline const SvxBoxItem &SwFlyFrameAttrMgr::GetBox() const
161 return m_aSet.Get(RES_BOX);
163 inline Point SwFlyFrameAttrMgr::GetPos() const
165 return Point( GetHoriOrient().GetPos(), GetVertOrient().GetPos() );
167 inline RndStdIds SwFlyFrameAttrMgr::GetAnchor() const
169 return m_aSet.Get(RES_ANCHOR).GetAnchorId();
172 #endif
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */