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 : :
29 : : #include <sfx2/basedlgs.hxx>
30 : : #include <cuires.hrc>
31 : : #include "dstribut.hxx"
32 : : #include "dstribut.hrc"
33 : : #include <svx/dialogs.hrc>
34 : : #include <svx/svddef.hxx>
35 : : #include <dialmgr.hxx>
36 : : #include <tools/shl.hxx>
37 : :
38 : : static sal_uInt16 pRanges[] =
39 : : {
40 : : SDRATTR_MEASURE_FIRST,
41 : : SDRATTR_MEASURE_LAST,
42 : : 0
43 : : };
44 : :
45 : : /*************************************************************************
46 : : |*
47 : : |* Dialog
48 : : |*
49 : : \************************************************************************/
50 : :
51 : 0 : SvxDistributeDialog::SvxDistributeDialog(
52 : : Window* pParent,
53 : : const SfxItemSet& rInAttrs,
54 : : SvxDistributeHorizontal eHor,
55 : : SvxDistributeVertical eVer)
56 : : : SfxSingleTabDialog(pParent, rInAttrs, RID_SVXPAGE_DISTRIBUTE ),
57 : 0 : mpPage(0L)
58 : : {
59 [ # # ][ # # ]: 0 : mpPage = new SvxDistributePage(this, rInAttrs, eHor, eVer);
60 [ # # ]: 0 : SetTabPage(mpPage);
61 [ # # ][ # # ]: 0 : SetText(mpPage->GetText());
[ # # ]
62 : 0 : }
63 : :
64 : : /*************************************************************************
65 : : |*
66 : : |* Dtor
67 : : |*
68 : : \************************************************************************/
69 : :
70 : 0 : SvxDistributeDialog::~SvxDistributeDialog()
71 : : {
72 [ # # ]: 0 : }
73 : :
74 : : /*************************************************************************
75 : : |*
76 : : |* Tabpage
77 : : |*
78 : : \************************************************************************/
79 : :
80 : 0 : SvxDistributePage::SvxDistributePage(
81 : : Window* pWindow,
82 : : const SfxItemSet& rInAttrs,
83 : : SvxDistributeHorizontal eHor,
84 : : SvxDistributeVertical eVer)
85 : 0 : : SvxTabPage(pWindow, CUI_RES(RID_SVXPAGE_DISTRIBUTE), rInAttrs),
86 : : meDistributeHor(eHor),
87 : : meDistributeVer(eVer),
88 [ # # ]: 0 : maFlHorizontal (this, CUI_RES(FL_HORIZONTAL )),
89 [ # # ]: 0 : maBtnHorNone (this, CUI_RES(BTN_HOR_NONE )),
90 [ # # ]: 0 : maBtnHorLeft (this, CUI_RES(BTN_HOR_LEFT )),
91 [ # # ]: 0 : maBtnHorCenter (this, CUI_RES(BTN_HOR_CENTER )),
92 [ # # ]: 0 : maBtnHorDistance (this, CUI_RES(BTN_HOR_DISTANCE )),
93 [ # # ]: 0 : maBtnHorRight (this, CUI_RES(BTN_HOR_RIGHT )),
94 [ # # ]: 0 : maHorLow (this, CUI_RES(IMG_HOR_LOW )),
95 [ # # ]: 0 : maHorCenter (this, CUI_RES(IMG_HOR_CENTER )),
96 [ # # ]: 0 : maHorDistance (this, CUI_RES(IMG_HOR_DISTANCE )),
97 [ # # ]: 0 : maHorHigh (this, CUI_RES(IMG_HOR_HIGH )),
98 [ # # ]: 0 : maFlVertical (this, CUI_RES(FL_VERTICAL )),
99 [ # # ]: 0 : maBtnVerNone (this, CUI_RES(BTN_VER_NONE )),
100 [ # # ]: 0 : maBtnVerTop (this, CUI_RES(BTN_VER_TOP )),
101 [ # # ]: 0 : maBtnVerCenter (this, CUI_RES(BTN_VER_CENTER )),
102 [ # # ]: 0 : maBtnVerDistance (this, CUI_RES(BTN_VER_DISTANCE )),
103 [ # # ]: 0 : maBtnVerBottom (this, CUI_RES(BTN_VER_BOTTOM )),
104 [ # # ]: 0 : maVerLow (this, CUI_RES(IMG_VER_LOW )),
105 [ # # ]: 0 : maVerCenter (this, CUI_RES(IMG_VER_CENTER )),
106 [ # # ]: 0 : maVerDistance (this, CUI_RES(IMG_VER_DISTANCE )),
107 [ # # ][ # # ]: 0 : maVerHigh (this, CUI_RES(IMG_VER_HIGH ))
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
108 : : {
109 [ # # ]: 0 : FreeResource();
110 : 0 : }
111 : :
112 : : /*************************************************************************
113 : : |*
114 : : |* Dtor
115 : : |*
116 : : \************************************************************************/
117 : :
118 [ # # ][ # # ]: 0 : SvxDistributePage::~SvxDistributePage()
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
119 : : {
120 [ # # ]: 0 : }
121 : :
122 : : /*************************************************************************
123 : : |*
124 : : |* create the tabpage
125 : : |*
126 : : \************************************************************************/
127 : :
128 : 0 : SfxTabPage* SvxDistributePage::Create(Window* pWindow, const SfxItemSet& rAttrs,
129 : : SvxDistributeHorizontal eHor, SvxDistributeVertical eVer)
130 : : {
131 [ # # ]: 0 : return(new SvxDistributePage(pWindow, rAttrs, eHor, eVer));
132 : : }
133 : :
134 : 0 : sal_uInt16* SvxDistributePage::GetRanges()
135 : : {
136 : 0 : return(pRanges);
137 : : }
138 : :
139 : 0 : void SvxDistributePage::PointChanged(Window* /*pWindow*/, RECT_POINT /*eRP*/)
140 : : {
141 : 0 : }
142 : :
143 : : /*************************************************************************
144 : : |*
145 : : |* read the delivered Item-Set
146 : : |*
147 : : \************************************************************************/
148 : :
149 : 0 : void SvxDistributePage::Reset(const SfxItemSet& )
150 : : {
151 : 0 : maBtnHorNone.SetState(sal_False);
152 : 0 : maBtnHorLeft.SetState(sal_False);
153 : 0 : maBtnHorCenter.SetState(sal_False);
154 : 0 : maBtnHorDistance.SetState(sal_False);
155 : 0 : maBtnHorRight.SetState(sal_False);
156 : :
157 [ # # # # : 0 : switch(meDistributeHor)
# # ]
158 : : {
159 : 0 : case SvxDistributeHorizontalNone : maBtnHorNone.SetState(sal_True); break;
160 : 0 : case SvxDistributeHorizontalLeft : maBtnHorLeft.SetState(sal_True); break;
161 : 0 : case SvxDistributeHorizontalCenter : maBtnHorCenter.SetState(sal_True); break;
162 : 0 : case SvxDistributeHorizontalDistance : maBtnHorDistance.SetState(sal_True); break;
163 : 0 : case SvxDistributeHorizontalRight : maBtnHorRight.SetState(sal_True); break;
164 : : }
165 : :
166 : 0 : maBtnVerNone.SetState(sal_False);
167 : 0 : maBtnVerTop.SetState(sal_False);
168 : 0 : maBtnVerCenter.SetState(sal_False);
169 : 0 : maBtnVerDistance.SetState(sal_False);
170 : 0 : maBtnVerBottom.SetState(sal_False);
171 : :
172 [ # # # # : 0 : switch(meDistributeVer)
# # ]
173 : : {
174 : 0 : case SvxDistributeVerticalNone : maBtnVerNone.SetState(sal_True); break;
175 : 0 : case SvxDistributeVerticalTop : maBtnVerTop.SetState(sal_True); break;
176 : 0 : case SvxDistributeVerticalCenter : maBtnVerCenter.SetState(sal_True); break;
177 : 0 : case SvxDistributeVerticalDistance : maBtnVerDistance.SetState(sal_True); break;
178 : 0 : case SvxDistributeVerticalBottom : maBtnVerBottom.SetState(sal_True); break;
179 : : }
180 : 0 : }
181 : :
182 : : /*************************************************************************
183 : : |*
184 : : |* Fill the delivered Item-Set with dialogbox-attributes
185 : : |*
186 : : \************************************************************************/
187 : :
188 : 0 : sal_Bool SvxDistributePage::FillItemSet( SfxItemSet& )
189 : : {
190 : 0 : SvxDistributeHorizontal eDistributeHor(SvxDistributeHorizontalNone);
191 : 0 : SvxDistributeVertical eDistributeVer(SvxDistributeVerticalNone);
192 : :
193 [ # # ]: 0 : if(maBtnHorLeft.IsChecked())
194 : 0 : eDistributeHor = SvxDistributeHorizontalLeft;
195 [ # # ]: 0 : else if(maBtnHorCenter.IsChecked())
196 : 0 : eDistributeHor = SvxDistributeHorizontalCenter;
197 [ # # ]: 0 : else if(maBtnHorDistance.IsChecked())
198 : 0 : eDistributeHor = SvxDistributeHorizontalDistance;
199 [ # # ]: 0 : else if(maBtnHorRight.IsChecked())
200 : 0 : eDistributeHor = SvxDistributeHorizontalRight;
201 : :
202 [ # # ]: 0 : if(maBtnVerTop.IsChecked())
203 : 0 : eDistributeVer = SvxDistributeVerticalTop;
204 [ # # ]: 0 : else if(maBtnVerCenter.IsChecked())
205 : 0 : eDistributeVer = SvxDistributeVerticalCenter;
206 [ # # ]: 0 : else if(maBtnVerDistance.IsChecked())
207 : 0 : eDistributeVer = SvxDistributeVerticalDistance;
208 [ # # ]: 0 : else if(maBtnVerBottom.IsChecked())
209 : 0 : eDistributeVer = SvxDistributeVerticalBottom;
210 : :
211 [ # # ][ # # ]: 0 : if(eDistributeHor != meDistributeHor || eDistributeVer != meDistributeVer)
212 : : {
213 : 0 : meDistributeHor = eDistributeHor;
214 : 0 : meDistributeVer = eDistributeVer;
215 : 0 : return sal_True;
216 : : }
217 : :
218 : 0 : return sal_False;
219 : : }
220 : :
221 : :
222 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|