1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_cui.hxx"
31 #include <sfx2/basedlgs.hxx>
33 #include "dstribut.hxx"
34 #include "dstribut.hrc"
35 #include <svx/dialogs.hrc>
36 #include <svx/svddef.hxx>
37 #include <dialmgr.hxx>
38 #include <tools/shl.hxx>
40 static sal_uInt16 pRanges
[] =
42 SDRATTR_MEASURE_FIRST
,
47 /*************************************************************************
51 \************************************************************************/
53 SvxDistributeDialog::SvxDistributeDialog(
55 const SfxItemSet
& rInAttrs
,
56 SvxDistributeHorizontal eHor
,
57 SvxDistributeVertical eVer
)
58 : SfxSingleTabDialog(pParent
, rInAttrs
, RID_SVXPAGE_DISTRIBUTE
),
61 mpPage
= new SvxDistributePage(this, rInAttrs
, eHor
, eVer
);
63 SetText(mpPage
->GetText());
66 /*************************************************************************
70 \************************************************************************/
72 SvxDistributeDialog::~SvxDistributeDialog()
76 /*************************************************************************
80 \************************************************************************/
82 SvxDistributePage::SvxDistributePage(
84 const SfxItemSet
& rInAttrs
,
85 SvxDistributeHorizontal eHor
,
86 SvxDistributeVertical eVer
)
87 : SvxTabPage(pWindow
, CUI_RES(RID_SVXPAGE_DISTRIBUTE
), rInAttrs
),
88 meDistributeHor(eHor
),
89 meDistributeVer(eVer
),
90 maFlHorizontal (this, CUI_RES(FL_HORIZONTAL
)),
91 maBtnHorNone (this, CUI_RES(BTN_HOR_NONE
)),
92 maBtnHorLeft (this, CUI_RES(BTN_HOR_LEFT
)),
93 maBtnHorCenter (this, CUI_RES(BTN_HOR_CENTER
)),
94 maBtnHorDistance (this, CUI_RES(BTN_HOR_DISTANCE
)),
95 maBtnHorRight (this, CUI_RES(BTN_HOR_RIGHT
)),
96 maHorLow (this, CUI_RES(IMG_HOR_LOW
)),
97 maHorCenter (this, CUI_RES(IMG_HOR_CENTER
)),
98 maHorDistance (this, CUI_RES(IMG_HOR_DISTANCE
)),
99 maHorHigh (this, CUI_RES(IMG_HOR_HIGH
)),
100 maFlVertical (this, CUI_RES(FL_VERTICAL
)),
101 maBtnVerNone (this, CUI_RES(BTN_VER_NONE
)),
102 maBtnVerTop (this, CUI_RES(BTN_VER_TOP
)),
103 maBtnVerCenter (this, CUI_RES(BTN_VER_CENTER
)),
104 maBtnVerDistance (this, CUI_RES(BTN_VER_DISTANCE
)),
105 maBtnVerBottom (this, CUI_RES(BTN_VER_BOTTOM
)),
106 maVerLow (this, CUI_RES(IMG_VER_LOW
)),
107 maVerCenter (this, CUI_RES(IMG_VER_CENTER
)),
108 maVerDistance (this, CUI_RES(IMG_VER_DISTANCE
)),
109 maVerHigh (this, CUI_RES(IMG_VER_HIGH
))
111 maHorLow
.SetModeImage( Image( CUI_RES( IMG_HOR_LOW_H
) ), BMP_COLOR_HIGHCONTRAST
);
112 maHorCenter
.SetModeImage( Image( CUI_RES( IMG_HOR_CENTER_H
) ), BMP_COLOR_HIGHCONTRAST
);
113 maHorDistance
.SetModeImage( Image( CUI_RES( IMG_HOR_DISTANCE_H
) ), BMP_COLOR_HIGHCONTRAST
);
114 maHorHigh
.SetModeImage( Image( CUI_RES( IMG_HOR_HIGH_H
) ), BMP_COLOR_HIGHCONTRAST
);
115 maVerDistance
.SetModeImage( Image( CUI_RES( IMG_VER_DISTANCE_H
) ), BMP_COLOR_HIGHCONTRAST
);
116 maVerLow
.SetModeImage( Image( CUI_RES( IMG_VER_LOW_H
) ), BMP_COLOR_HIGHCONTRAST
);
117 maVerCenter
.SetModeImage( Image( CUI_RES( IMG_VER_CENTER_H
) ), BMP_COLOR_HIGHCONTRAST
);
118 maVerHigh
.SetModeImage( Image( CUI_RES( IMG_VER_HIGH_H
) ), BMP_COLOR_HIGHCONTRAST
);
123 /*************************************************************************
127 \************************************************************************/
129 SvxDistributePage::~SvxDistributePage()
133 /*************************************************************************
135 |* create the tabpage
137 \************************************************************************/
139 SfxTabPage
* SvxDistributePage::Create(Window
* pWindow
, const SfxItemSet
& rAttrs
,
140 SvxDistributeHorizontal eHor
, SvxDistributeVertical eVer
)
142 return(new SvxDistributePage(pWindow
, rAttrs
, eHor
, eVer
));
145 /*************************************************************************
149 \************************************************************************/
151 sal_uInt16
* SvxDistributePage::GetRanges()
156 /*************************************************************************
160 \************************************************************************/
162 void SvxDistributePage::PointChanged(Window
* /*pWindow*/, RECT_POINT
/*eRP*/)
166 /*************************************************************************
168 |* read the delivered Item-Set
170 \************************************************************************/
172 void __EXPORT
SvxDistributePage::Reset(const SfxItemSet
& )
174 maBtnHorNone
.SetState(sal_False
);
175 maBtnHorLeft
.SetState(sal_False
);
176 maBtnHorCenter
.SetState(sal_False
);
177 maBtnHorDistance
.SetState(sal_False
);
178 maBtnHorRight
.SetState(sal_False
);
180 switch(meDistributeHor
)
182 case SvxDistributeHorizontalNone
: maBtnHorNone
.SetState(sal_True
); break;
183 case SvxDistributeHorizontalLeft
: maBtnHorLeft
.SetState(sal_True
); break;
184 case SvxDistributeHorizontalCenter
: maBtnHorCenter
.SetState(sal_True
); break;
185 case SvxDistributeHorizontalDistance
: maBtnHorDistance
.SetState(sal_True
); break;
186 case SvxDistributeHorizontalRight
: maBtnHorRight
.SetState(sal_True
); break;
189 maBtnVerNone
.SetState(sal_False
);
190 maBtnVerTop
.SetState(sal_False
);
191 maBtnVerCenter
.SetState(sal_False
);
192 maBtnVerDistance
.SetState(sal_False
);
193 maBtnVerBottom
.SetState(sal_False
);
195 switch(meDistributeVer
)
197 case SvxDistributeVerticalNone
: maBtnVerNone
.SetState(sal_True
); break;
198 case SvxDistributeVerticalTop
: maBtnVerTop
.SetState(sal_True
); break;
199 case SvxDistributeVerticalCenter
: maBtnVerCenter
.SetState(sal_True
); break;
200 case SvxDistributeVerticalDistance
: maBtnVerDistance
.SetState(sal_True
); break;
201 case SvxDistributeVerticalBottom
: maBtnVerBottom
.SetState(sal_True
); break;
205 /*************************************************************************
207 |* Fill the delivered Item-Set with dialogbox-attributes
209 \************************************************************************/
211 sal_Bool
SvxDistributePage::FillItemSet( SfxItemSet
& )
213 SvxDistributeHorizontal
eDistributeHor(SvxDistributeHorizontalNone
);
214 SvxDistributeVertical
eDistributeVer(SvxDistributeVerticalNone
);
216 if(maBtnHorLeft
.IsChecked())
217 eDistributeHor
= SvxDistributeHorizontalLeft
;
218 else if(maBtnHorCenter
.IsChecked())
219 eDistributeHor
= SvxDistributeHorizontalCenter
;
220 else if(maBtnHorDistance
.IsChecked())
221 eDistributeHor
= SvxDistributeHorizontalDistance
;
222 else if(maBtnHorRight
.IsChecked())
223 eDistributeHor
= SvxDistributeHorizontalRight
;
225 if(maBtnVerTop
.IsChecked())
226 eDistributeVer
= SvxDistributeVerticalTop
;
227 else if(maBtnVerCenter
.IsChecked())
228 eDistributeVer
= SvxDistributeVerticalCenter
;
229 else if(maBtnVerDistance
.IsChecked())
230 eDistributeVer
= SvxDistributeVerticalDistance
;
231 else if(maBtnVerBottom
.IsChecked())
232 eDistributeVer
= SvxDistributeVerticalBottom
;
234 if(eDistributeHor
!= meDistributeHor
|| eDistributeVer
!= meDistributeVer
)
236 meDistributeHor
= eDistributeHor
;
237 meDistributeVer
= eDistributeVer
;