1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_CUI_SOURCE_INC_SWPOSSIZETABPAGE_HXX
20 #define INCLUDED_CUI_SOURCE_INC_SWPOSSIZETABPAGE_HXX
22 #include <sfx2/tabdlg.hxx>
23 #include <vcl/fixed.hxx>
24 #include <vcl/field.hxx>
25 #include <vcl/layout.hxx>
26 #include <vcl/lstbox.hxx>
27 #include <svx/swframeposstrings.hxx>
28 #include <svx/swframeexample.hxx>
30 // SvxSwPosSizeTabPage - position and size page for Writer drawing objects
33 class SvxSwPosSizeTabPage
: public SfxTabPage
35 using TabPage::DeactivatePage
;
37 VclPtr
<MetricField
> m_pWidthMF
;
38 VclPtr
<MetricField
> m_pHeightMF
;
39 VclPtr
<CheckBox
> m_pKeepRatioCB
;
41 VclPtr
<RadioButton
> m_pToPageRB
;
42 VclPtr
<RadioButton
> m_pToParaRB
;
43 VclPtr
<RadioButton
> m_pToCharRB
;
44 VclPtr
<RadioButton
> m_pAsCharRB
;
45 VclPtr
<RadioButton
> m_pToFrameRB
;
47 VclPtr
<TriStateBox
> m_pPositionCB
;
48 VclPtr
<TriStateBox
> m_pSizeCB
;
50 VclPtr
<VclContainer
> m_pPosFrame
;
51 VclPtr
<FixedText
> m_pHoriFT
;
52 VclPtr
<ListBox
> m_pHoriLB
;
53 VclPtr
<FixedText
> m_pHoriByFT
;
54 VclPtr
<MetricField
> m_pHoriByMF
;
55 VclPtr
<FixedText
> m_pHoriToFT
;
56 VclPtr
<ListBox
> m_pHoriToLB
;
58 VclPtr
<CheckBox
> m_pHoriMirrorCB
;
60 VclPtr
<FixedText
> m_pVertFT
;
61 VclPtr
<ListBox
> m_pVertLB
;
62 VclPtr
<FixedText
> m_pVertByFT
;
63 VclPtr
<MetricField
> m_pVertByMF
;
64 VclPtr
<FixedText
> m_pVertToFT
;
65 VclPtr
<ListBox
> m_pVertToLB
;
67 VclPtr
<CheckBox
> m_pFollowCB
;
69 VclPtr
<SvxSwFrameExample
> m_pExampleWN
;
71 Link
<> m_aValidateLink
;
74 SvxSwFramePosString m_aFramePosString
;
76 Rectangle m_aRect
; //size of all selected objects
77 Rectangle m_aWorkArea
;
82 const SdrView
* m_pSdrView
;
90 double m_fWidthHeightRatio
; //width-to-height ratio to support the KeepRatio button
92 bool m_bAtHoriPosModified
;
93 bool m_bAtVertPosModified
;
94 bool m_bIsVerticalFrame
;
95 bool m_bPositioningDisabled
;
96 bool m_bIsMultiSelection
;
97 bool m_bIsInRightToLeft
;
101 DECL_LINK(RangeModifyHdl
, void *);
102 DECL_LINK(AnchorTypeHdl
, void *);
103 DECL_LINK( PosHdl
, ListBox
* );
104 DECL_LINK( RelHdl
, ListBox
* );
105 DECL_LINK(MirrorHdl
, void *);
106 DECL_LINK( ModifyHdl
, Edit
* );
107 DECL_LINK(ProtectHdl
, void *);
109 void InitPos(short nAnchorType
, sal_uInt16 nH
, sal_uInt16 nHRel
,
110 sal_uInt16 nV
, sal_uInt16 nVRel
,
112 sal_uInt16
GetMapPos(FrmMap
*pMap
, ListBox
&rAlignLB
);
113 static short GetAlignment(FrmMap
*pMap
, sal_uInt16 nMapPos
, ListBox
&rAlignLB
, ListBox
&rRelationLB
);
114 static short GetRelation(FrmMap
*pMap
, ListBox
&rRelationLB
);
115 short GetAnchorType(bool* pbHasChanged
= 0);
116 sal_uLong
FillRelLB(FrmMap
*pMap
, sal_uInt16 nLBSelPos
, sal_uInt16 nAlign
, sal_uInt16 nRel
, ListBox
&rLB
, FixedText
&rFT
);
117 sal_uInt16
FillPosLB(FrmMap
*pMap
, sal_uInt16 nAlign
, const sal_uInt16 _nRel
, ListBox
&rLB
);
119 void UpdateExample();
121 void setOptimalFrmWidth();
122 void setOptimalRelWidth();
125 SvxSwPosSizeTabPage( vcl::Window
* pParent
, const SfxItemSet
& rInAttrs
);
126 virtual ~SvxSwPosSizeTabPage();
127 virtual void dispose() SAL_OVERRIDE
;
129 static VclPtr
<SfxTabPage
> Create( vcl::Window
*, const SfxItemSet
* );
130 static const sal_uInt16
* GetRanges();
132 virtual bool FillItemSet( SfxItemSet
* ) SAL_OVERRIDE
;
133 virtual void Reset( const SfxItemSet
* ) SAL_OVERRIDE
;
135 virtual sfxpg
DeactivatePage( SfxItemSet
* pSet
) SAL_OVERRIDE
;
137 void EnableAnchorTypes(sal_uInt16 nAnchorEnable
);
139 void SetValidateFramePosLink( const Link
<>& rLink
)
140 {m_aValidateLink
= rLink
;}
142 void SetView( const SdrView
* pSdrView
);
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */