Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_CUI_SOURCE_INC_SWPOSSIZETABPAGE_HXX
20 : #define INCLUDED_CUI_SOURCE_INC_SWPOSSIZETABPAGE_HXX
21 :
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>
29 :
30 : // SvxSwPosSizeTabPage - position and size page for Writer drawing objects
31 : struct FrmMap;
32 : class SdrView;
33 : class SvxSwPosSizeTabPage : public SfxTabPage
34 : {
35 : using TabPage::DeactivatePage;
36 :
37 : VclPtr<MetricField> m_pWidthMF;
38 : VclPtr<MetricField> m_pHeightMF;
39 : VclPtr<CheckBox> m_pKeepRatioCB;
40 :
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;
46 :
47 : VclPtr<TriStateBox> m_pPositionCB;
48 : VclPtr<TriStateBox> m_pSizeCB;
49 :
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;
57 :
58 : VclPtr<CheckBox> m_pHoriMirrorCB;
59 :
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;
66 :
67 : VclPtr<CheckBox> m_pFollowCB;
68 :
69 : VclPtr<SvxSwFrameExample> m_pExampleWN;
70 :
71 : Link<> m_aValidateLink;
72 :
73 : //'string provider'
74 : SvxSwFramePosString m_aFramePosString;
75 :
76 : Rectangle m_aRect; //size of all selected objects
77 : Rectangle m_aWorkArea;
78 : Point m_aAnchorPos;
79 :
80 : FrmMap* m_pVMap;
81 : FrmMap* m_pHMap;
82 : const SdrView* m_pSdrView;
83 :
84 : // initial values
85 : short m_nOldH;
86 : short m_nOldHRel;
87 : short m_nOldV;
88 : short m_nOldVRel;
89 :
90 : double m_fWidthHeightRatio; //width-to-height ratio to support the KeepRatio button
91 : bool m_bHtmlMode;
92 : bool m_bAtHoriPosModified;
93 : bool m_bAtVertPosModified;
94 : bool m_bIsVerticalFrame;
95 : bool m_bPositioningDisabled;
96 : bool m_bIsMultiSelection;
97 : bool m_bIsInRightToLeft;
98 :
99 :
100 :
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 *);
108 :
109 : void InitPos(short nAnchorType, sal_uInt16 nH, sal_uInt16 nHRel,
110 : sal_uInt16 nV, sal_uInt16 nVRel,
111 : long nX, long nY);
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);
118 :
119 : void UpdateExample();
120 :
121 : void setOptimalFrmWidth();
122 : void setOptimalRelWidth();
123 :
124 : public:
125 : SvxSwPosSizeTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
126 : virtual ~SvxSwPosSizeTabPage();
127 : virtual void dispose() SAL_OVERRIDE;
128 :
129 : static VclPtr<SfxTabPage> Create( vcl::Window*, const SfxItemSet* );
130 : static const sal_uInt16* GetRanges();
131 :
132 : virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
133 : virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE;
134 :
135 : virtual sfxpg DeactivatePage( SfxItemSet* pSet ) SAL_OVERRIDE;
136 :
137 : void EnableAnchorTypes(sal_uInt16 nAnchorEnable);
138 :
139 0 : void SetValidateFramePosLink( const Link<>& rLink )
140 0 : {m_aValidateLink = rLink;}
141 :
142 : void SetView( const SdrView* pSdrView );
143 : };
144 :
145 : #endif
146 :
147 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|