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 : MetricField* m_pWidthMF;
38 : MetricField* m_pHeightMF;
39 : CheckBox* m_pKeepRatioCB;
40 :
41 : RadioButton* m_pToPageRB;
42 : RadioButton* m_pToParaRB;
43 : RadioButton* m_pToCharRB;
44 : RadioButton* m_pAsCharRB;
45 : RadioButton* m_pToFrameRB;
46 :
47 : TriStateBox* m_pPositionCB;
48 : TriStateBox* m_pSizeCB;
49 :
50 : VclContainer* m_pPosFrame;
51 : FixedText* m_pHoriFT;
52 : ListBox* m_pHoriLB;
53 : FixedText* m_pHoriByFT;
54 : MetricField* m_pHoriByMF;
55 : FixedText* m_pHoriToFT;
56 : ListBox* m_pHoriToLB;
57 :
58 : CheckBox* m_pHoriMirrorCB;
59 :
60 : FixedText* m_pVertFT;
61 : ListBox* m_pVertLB;
62 : FixedText* m_pVertByFT;
63 : MetricField* m_pVertByMF;
64 : FixedText* m_pVertToFT;
65 : ListBox* m_pVertToLB;
66 :
67 : CheckBox* m_pFollowCB;
68 :
69 : 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 : short GetAlignment(FrmMap *pMap, sal_uInt16 nMapPos, ListBox &rAlignLB, ListBox &rRelationLB);
114 : 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 :
128 : static SfxTabPage* Create( vcl::Window*, const SfxItemSet* );
129 : static const sal_uInt16* GetRanges();
130 :
131 : virtual bool FillItemSet( SfxItemSet* ) SAL_OVERRIDE;
132 : virtual void Reset( const SfxItemSet * ) SAL_OVERRIDE;
133 :
134 : virtual int DeactivatePage( SfxItemSet* pSet ) SAL_OVERRIDE;
135 :
136 : void EnableAnchorTypes(sal_uInt16 nAnchorEnable);
137 :
138 0 : void SetValidateFramePosLink( const Link& rLink )
139 0 : {m_aValidateLink = rLink;}
140 :
141 : void SetView( const SdrView* pSdrView );
142 : };
143 :
144 : #endif
145 :
146 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|