update credits
[LibreOffice.git] / cui / source / tabpages / dstribut.cxx
blobbde1590e88a4ab911a97b5f506edfeeafd35d0a0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sfx2/basedlgs.hxx>
21 #include <cuires.hrc>
22 #include "dstribut.hxx"
23 #include "dstribut.hrc"
24 #include <svx/dialogs.hrc>
25 #include <svx/svddef.hxx>
26 #include <dialmgr.hxx>
27 #include <tools/shl.hxx>
29 static sal_uInt16 pRanges[] =
31 SDRATTR_MEASURE_FIRST,
32 SDRATTR_MEASURE_LAST,
36 /*************************************************************************
38 |* Dialog
40 \************************************************************************/
42 SvxDistributeDialog::SvxDistributeDialog(
43 Window* pParent,
44 const SfxItemSet& rInAttrs,
45 SvxDistributeHorizontal eHor,
46 SvxDistributeVertical eVer)
47 : SfxNoLayoutSingleTabDialog(pParent, rInAttrs, RID_SVXPAGE_DISTRIBUTE ),
48 mpPage(0L)
50 mpPage = new SvxDistributePage(this, rInAttrs, eHor, eVer);
51 SetTabPage(mpPage);
52 SetText(mpPage->GetText());
55 /*************************************************************************
57 |* Dtor
59 \************************************************************************/
61 SvxDistributeDialog::~SvxDistributeDialog()
65 /*************************************************************************
67 |* Tabpage
69 \************************************************************************/
71 SvxDistributePage::SvxDistributePage(
72 Window* pWindow,
73 const SfxItemSet& rInAttrs,
74 SvxDistributeHorizontal eHor,
75 SvxDistributeVertical eVer)
76 : SvxTabPage(pWindow, CUI_RES(RID_SVXPAGE_DISTRIBUTE), rInAttrs),
77 meDistributeHor(eHor),
78 meDistributeVer(eVer),
79 maFlHorizontal (this, CUI_RES(FL_HORIZONTAL )),
80 maBtnHorNone (this, CUI_RES(BTN_HOR_NONE )),
81 maBtnHorLeft (this, CUI_RES(BTN_HOR_LEFT )),
82 maBtnHorCenter (this, CUI_RES(BTN_HOR_CENTER )),
83 maBtnHorDistance (this, CUI_RES(BTN_HOR_DISTANCE )),
84 maBtnHorRight (this, CUI_RES(BTN_HOR_RIGHT )),
85 maHorLow (this, CUI_RES(IMG_HOR_LOW )),
86 maHorCenter (this, CUI_RES(IMG_HOR_CENTER )),
87 maHorDistance (this, CUI_RES(IMG_HOR_DISTANCE )),
88 maHorHigh (this, CUI_RES(IMG_HOR_HIGH )),
89 maFlVertical (this, CUI_RES(FL_VERTICAL )),
90 maBtnVerNone (this, CUI_RES(BTN_VER_NONE )),
91 maBtnVerTop (this, CUI_RES(BTN_VER_TOP )),
92 maBtnVerCenter (this, CUI_RES(BTN_VER_CENTER )),
93 maBtnVerDistance (this, CUI_RES(BTN_VER_DISTANCE )),
94 maBtnVerBottom (this, CUI_RES(BTN_VER_BOTTOM )),
95 maVerLow (this, CUI_RES(IMG_VER_LOW )),
96 maVerCenter (this, CUI_RES(IMG_VER_CENTER )),
97 maVerDistance (this, CUI_RES(IMG_VER_DISTANCE )),
98 maVerHigh (this, CUI_RES(IMG_VER_HIGH ))
100 FreeResource();
103 /*************************************************************************
105 |* Dtor
107 \************************************************************************/
109 SvxDistributePage::~SvxDistributePage()
113 /*************************************************************************
115 |* create the tabpage
117 \************************************************************************/
119 SfxTabPage* SvxDistributePage::Create(Window* pWindow, const SfxItemSet& rAttrs,
120 SvxDistributeHorizontal eHor, SvxDistributeVertical eVer)
122 return(new SvxDistributePage(pWindow, rAttrs, eHor, eVer));
125 sal_uInt16* SvxDistributePage::GetRanges()
127 return(pRanges);
130 void SvxDistributePage::PointChanged(Window* /*pWindow*/, RECT_POINT /*eRP*/)
134 /*************************************************************************
136 |* read the delivered Item-Set
138 \************************************************************************/
140 void SvxDistributePage::Reset(const SfxItemSet& )
142 maBtnHorNone.SetState(sal_False);
143 maBtnHorLeft.SetState(sal_False);
144 maBtnHorCenter.SetState(sal_False);
145 maBtnHorDistance.SetState(sal_False);
146 maBtnHorRight.SetState(sal_False);
148 switch(meDistributeHor)
150 case SvxDistributeHorizontalNone : maBtnHorNone.SetState(sal_True); break;
151 case SvxDistributeHorizontalLeft : maBtnHorLeft.SetState(sal_True); break;
152 case SvxDistributeHorizontalCenter : maBtnHorCenter.SetState(sal_True); break;
153 case SvxDistributeHorizontalDistance : maBtnHorDistance.SetState(sal_True); break;
154 case SvxDistributeHorizontalRight : maBtnHorRight.SetState(sal_True); break;
157 maBtnVerNone.SetState(sal_False);
158 maBtnVerTop.SetState(sal_False);
159 maBtnVerCenter.SetState(sal_False);
160 maBtnVerDistance.SetState(sal_False);
161 maBtnVerBottom.SetState(sal_False);
163 switch(meDistributeVer)
165 case SvxDistributeVerticalNone : maBtnVerNone.SetState(sal_True); break;
166 case SvxDistributeVerticalTop : maBtnVerTop.SetState(sal_True); break;
167 case SvxDistributeVerticalCenter : maBtnVerCenter.SetState(sal_True); break;
168 case SvxDistributeVerticalDistance : maBtnVerDistance.SetState(sal_True); break;
169 case SvxDistributeVerticalBottom : maBtnVerBottom.SetState(sal_True); break;
173 /*************************************************************************
175 |* Fill the delivered Item-Set with dialogbox-attributes
177 \************************************************************************/
179 sal_Bool SvxDistributePage::FillItemSet( SfxItemSet& )
181 SvxDistributeHorizontal eDistributeHor(SvxDistributeHorizontalNone);
182 SvxDistributeVertical eDistributeVer(SvxDistributeVerticalNone);
184 if(maBtnHorLeft.IsChecked())
185 eDistributeHor = SvxDistributeHorizontalLeft;
186 else if(maBtnHorCenter.IsChecked())
187 eDistributeHor = SvxDistributeHorizontalCenter;
188 else if(maBtnHorDistance.IsChecked())
189 eDistributeHor = SvxDistributeHorizontalDistance;
190 else if(maBtnHorRight.IsChecked())
191 eDistributeHor = SvxDistributeHorizontalRight;
193 if(maBtnVerTop.IsChecked())
194 eDistributeVer = SvxDistributeVerticalTop;
195 else if(maBtnVerCenter.IsChecked())
196 eDistributeVer = SvxDistributeVerticalCenter;
197 else if(maBtnVerDistance.IsChecked())
198 eDistributeVer = SvxDistributeVerticalDistance;
199 else if(maBtnVerBottom.IsChecked())
200 eDistributeVer = SvxDistributeVerticalBottom;
202 if(eDistributeHor != meDistributeHor || eDistributeVer != meDistributeVer)
204 meDistributeHor = eDistributeHor;
205 meDistributeVer = eDistributeVer;
206 return sal_True;
209 return sal_False;
213 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */