1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SVX_SWPOSSIZETABPAGE_HXX
24 #define _SVX_SWPOSSIZETABPAGE_HXX
25 
26 #include <sfx2/tabdlg.hxx>
27 #include <vcl/fixed.hxx>
28 #include <vcl/field.hxx>
29 #include <vcl/lstbox.hxx>
30 #include <svx/swframeposstrings.hxx>
31 #include <svx/swframeexample.hxx>
32 
33 /*-- 01.03.2004 15:45:01---------------------------------------------------
34   SvxSwPosSizeTabPage - position and size page for Writer drawing objects
35   -----------------------------------------------------------------------*/
36 struct FrmMap;
37 class SdrView;
38 class SvxSwPosSizeTabPage : public SfxTabPage
39 {
40 	using TabPage::DeactivatePage;
41 
42     FixedLine   m_aSizeFL;
43     FixedText   m_aWidthFT;
44     MetricField m_aWidthMF;
45     FixedText   m_aHeightFT;
46     MetricField m_aHeightMF;
47     CheckBox    m_aKeepRatioCB;
48 
49     FixedLine   m_aSeparatorFL;
50 
51     FixedLine   m_aAnchorFL;
52     RadioButton m_aToPageRB;
53     RadioButton m_aToParaRB;
54     RadioButton m_aToCharRB;
55     RadioButton m_aAsCharRB;
56     RadioButton m_aToFrameRB;
57 
58     FixedLine   m_aProtectionFL;
59     TriStateBox m_aPositionCB;
60     TriStateBox m_aSizeCB;
61 
62     FixedLine   m_aPositionFL;
63     FixedText   m_aHoriFT;
64     ListBox     m_aHoriLB;
65     FixedText   m_aHoriByFT;
66     MetricField m_aHoriByMF;
67     FixedText   m_aHoriToFT;
68     ListBox     m_aHoriToLB;
69 
70     CheckBox    m_aHoriMirrorCB;
71 
72     FixedText   m_aVertFT;
73     ListBox     m_aVertLB;
74     FixedText   m_aVertByFT;
75     MetricField m_aVertByMF;
76     FixedText   m_aVertToFT;
77     ListBox     m_aVertToLB;
78 
79     CheckBox    m_aFollowCB;
80 
81     SvxSwFrameExample m_aExampleWN;
82 
83     Link        m_aValidateLink;
84 
85     //'string provider'
86     SvxSwFramePosString m_aFramePosString;
87 
88     Rectangle           m_aRect; //size of all selected objects
89     Rectangle           m_aWorkArea;
90     Point               m_aAnchorPos;
91 
92     FrmMap* m_pVMap;
93     FrmMap* m_pHMap;
94     const SdrView*      m_pSdrView;
95 
96     // initial values
97     short   m_nOldH;
98     short   m_nOldHRel;
99     short   m_nOldV;
100     short   m_nOldVRel;
101 
102     double  m_fWidthHeightRatio; //width-to-height ratio to support the KeepRatio button
103     sal_uInt16  m_nHtmlMode;
104     bool    m_bHtmlMode;
105     bool    m_bAtHoriPosModified;
106     bool    m_bAtVertPosModified;
107     bool    m_bIsVerticalFrame;
108     bool    m_bPositioningDisabled;
109     bool    m_bIsMultiSelection;
110     bool    m_bIsInRightToLeft;
111 
112 
113 
114     DECL_LINK( RangeModifyHdl, Edit * );
115     DECL_LINK( AnchorTypeHdl, RadioButton * );
116     DECL_LINK( PosHdl, ListBox * );
117     DECL_LINK( RelHdl, ListBox * );
118     DECL_LINK( MirrorHdl, CheckBox * );
119     DECL_LINK( ModifyHdl, Edit * );
120     DECL_LINK( ProtectHdl, TriStateBox *);
121 
122     void            InitPos(short nAnchorType, sal_uInt16 nH, sal_uInt16 nHRel,
123                             sal_uInt16 nV,  sal_uInt16 nVRel,
124                             long   nX,  long   nY);
125     sal_uInt16          GetMapPos(FrmMap *pMap, ListBox &rAlignLB);
126     short           GetAlignment(FrmMap *pMap, sal_uInt16 nMapPos, ListBox &rAlignLB, ListBox &rRelationLB);
127     short           GetRelation(FrmMap *pMap, ListBox &rRelationLB);
128     short           GetAnchorType(bool* pbHasChanged = 0);
129     sal_uLong           FillRelLB(FrmMap *pMap, sal_uInt16 nLBSelPos, sal_uInt16 nAlign, sal_uInt16 nRel, ListBox &rLB, FixedText &rFT);
130     sal_uInt16          FillPosLB(FrmMap *pMap, sal_uInt16 nAlign, const sal_uInt16 _nRel, ListBox &rLB);
131 
132     void            UpdateExample();
133 
134 public:
135     SvxSwPosSizeTabPage( Window* pParent, const SfxItemSet& rInAttrs  );
136     ~SvxSwPosSizeTabPage();
137 
138     static SfxTabPage* Create( Window*, const SfxItemSet& );
139     static sal_uInt16*     GetRanges();
140 
141     virtual sal_Bool FillItemSet( SfxItemSet& );
142     virtual void Reset( const SfxItemSet & );
143 
144     virtual int  DeactivatePage( SfxItemSet* pSet );
145 
146     void    EnableAnchorTypes(sal_uInt16 nAnchorEnable);
147 
SetValidateFramePosLink(const Link & rLink)148     void SetValidateFramePosLink( const Link& rLink )
149             {m_aValidateLink = rLink;}
150 
151     void SetView( const SdrView* pSdrView );
152 };
153 
154 #endif
155