1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _SVX_SWPOSSIZETABPAGE_HXX
28 #define _SVX_SWPOSSIZETABPAGE_HXX
29 
30 #include <sfx2/tabdlg.hxx>
31 #include <vcl/fixed.hxx>
32 #include <vcl/field.hxx>
33 #include <vcl/lstbox.hxx>
34 #include <svx/swframeposstrings.hxx>
35 #include <svx/swframeexample.hxx>
36 
37 /*-- 01.03.2004 15:45:01---------------------------------------------------
38   SvxSwPosSizeTabPage - position and size page for Writer drawing objects
39   -----------------------------------------------------------------------*/
40 struct FrmMap;
41 class SdrView;
42 class SvxSwPosSizeTabPage : public SfxTabPage
43 {
44 	using TabPage::DeactivatePage;
45 
46     FixedLine   m_aSizeFL;
47     FixedText   m_aWidthFT;
48     MetricField m_aWidthMF;
49     FixedText   m_aHeightFT;
50     MetricField m_aHeightMF;
51     CheckBox    m_aKeepRatioCB;
52 
53     FixedLine   m_aSeparatorFL;
54 
55     FixedLine   m_aAnchorFL;
56     RadioButton m_aToPageRB;
57     RadioButton m_aToParaRB;
58     RadioButton m_aToCharRB;
59     RadioButton m_aAsCharRB;
60     RadioButton m_aToFrameRB;
61 
62     FixedLine   m_aProtectionFL;
63     TriStateBox m_aPositionCB;
64     TriStateBox m_aSizeCB;
65 
66     FixedLine   m_aPositionFL;
67     FixedText   m_aHoriFT;
68     ListBox     m_aHoriLB;
69     FixedText   m_aHoriByFT;
70     MetricField m_aHoriByMF;
71     FixedText   m_aHoriToFT;
72     ListBox     m_aHoriToLB;
73 
74     CheckBox    m_aHoriMirrorCB;
75 
76     FixedText   m_aVertFT;
77     ListBox     m_aVertLB;
78     FixedText   m_aVertByFT;
79     MetricField m_aVertByMF;
80     FixedText   m_aVertToFT;
81     ListBox     m_aVertToLB;
82 
83     CheckBox    m_aFollowCB;
84 
85     SvxSwFrameExample m_aExampleWN;
86 
87     Link        m_aValidateLink;
88 
89     //'string provider'
90     SvxSwFramePosString m_aFramePosString;
91 
92     Rectangle           m_aRect; //size of all selected objects
93     Rectangle           m_aWorkArea;
94     Point               m_aAnchorPos;
95 
96     FrmMap* m_pVMap;
97     FrmMap* m_pHMap;
98     const SdrView*      m_pSdrView;
99 
100     // initial values
101     short   m_nOldH;
102     short   m_nOldHRel;
103     short   m_nOldV;
104     short   m_nOldVRel;
105 
106     double  m_fWidthHeightRatio; //width-to-height ratio to support the KeepRatio button
107     sal_uInt16  m_nHtmlMode;
108     bool    m_bHtmlMode;
109     bool    m_bAtHoriPosModified;
110     bool    m_bAtVertPosModified;
111     bool    m_bIsVerticalFrame;
112     bool    m_bPositioningDisabled;
113     bool    m_bIsMultiSelection;
114     bool    m_bIsInRightToLeft;
115 
116 
117 
118     DECL_LINK( RangeModifyHdl, Edit * );
119     DECL_LINK( AnchorTypeHdl, RadioButton * );
120     DECL_LINK( PosHdl, ListBox * );
121     DECL_LINK( RelHdl, ListBox * );
122     DECL_LINK( MirrorHdl, CheckBox * );
123     DECL_LINK( ModifyHdl, Edit * );
124     DECL_LINK( ProtectHdl, TriStateBox *);
125 
126     void            InitPos(short nAnchorType, sal_uInt16 nH, sal_uInt16 nHRel,
127                             sal_uInt16 nV,  sal_uInt16 nVRel,
128                             long   nX,  long   nY);
129     sal_uInt16          GetMapPos(FrmMap *pMap, ListBox &rAlignLB);
130     short           GetAlignment(FrmMap *pMap, sal_uInt16 nMapPos, ListBox &rAlignLB, ListBox &rRelationLB);
131     short           GetRelation(FrmMap *pMap, ListBox &rRelationLB);
132     short           GetAnchorType(bool* pbHasChanged = 0);
133     sal_uLong           FillRelLB(FrmMap *pMap, sal_uInt16 nLBSelPos, sal_uInt16 nAlign, sal_uInt16 nRel, ListBox &rLB, FixedText &rFT);
134     sal_uInt16          FillPosLB(FrmMap *pMap, sal_uInt16 nAlign, const sal_uInt16 _nRel, ListBox &rLB);
135 
136     void            UpdateExample();
137 
138 public:
139     SvxSwPosSizeTabPage( Window* pParent, const SfxItemSet& rInAttrs  );
140     ~SvxSwPosSizeTabPage();
141 
142     static SfxTabPage* Create( Window*, const SfxItemSet& );
143     static sal_uInt16*     GetRanges();
144 
145     virtual sal_Bool FillItemSet( SfxItemSet& );
146     virtual void Reset( const SfxItemSet & );
147 
148     virtual int  DeactivatePage( SfxItemSet* pSet );
149 
150     void    EnableAnchorTypes(sal_uInt16 nAnchorEnable);
151 
152     void SetValidateFramePosLink( const Link& rLink )
153             {m_aValidateLink = rLink;}
154 
155     void SetView( const SdrView* pSdrView );
156 };
157 
158 #endif
159