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