xref: /trunk/main/cui/source/tabpages/dstribut.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
1*2ee96f1cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2ee96f1cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2ee96f1cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2ee96f1cSAndrew Rist  * distributed with this work for additional information
6*2ee96f1cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2ee96f1cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2ee96f1cSAndrew Rist  * "License"); you may not use this file except in compliance
9*2ee96f1cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*2ee96f1cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*2ee96f1cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2ee96f1cSAndrew Rist  * software distributed under the License is distributed on an
15*2ee96f1cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2ee96f1cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*2ee96f1cSAndrew Rist  * specific language governing permissions and limitations
18*2ee96f1cSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*2ee96f1cSAndrew Rist  *************************************************************/
21*2ee96f1cSAndrew Rist 
22*2ee96f1cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_cui.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <sfx2/basedlgs.hxx>
28cdf0e10cSrcweir #include <cuires.hrc>
29cdf0e10cSrcweir #include "dstribut.hxx"
30cdf0e10cSrcweir #include "dstribut.hrc"
31cdf0e10cSrcweir #include <svx/dialogs.hrc>
32cdf0e10cSrcweir #include <svx/svddef.hxx>
33cdf0e10cSrcweir #include <dialmgr.hxx>
34cdf0e10cSrcweir #include <tools/shl.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir static sal_uInt16 pRanges[] =
37cdf0e10cSrcweir {
38cdf0e10cSrcweir     SDRATTR_MEASURE_FIRST,
39cdf0e10cSrcweir     SDRATTR_MEASURE_LAST,
40cdf0e10cSrcweir     0
41cdf0e10cSrcweir };
42cdf0e10cSrcweir 
43cdf0e10cSrcweir /*************************************************************************
44cdf0e10cSrcweir |*
45cdf0e10cSrcweir |* Dialog
46cdf0e10cSrcweir |*
47cdf0e10cSrcweir \************************************************************************/
48cdf0e10cSrcweir 
SvxDistributeDialog(Window * pParent,const SfxItemSet & rInAttrs,SvxDistributeHorizontal eHor,SvxDistributeVertical eVer)49cdf0e10cSrcweir SvxDistributeDialog::SvxDistributeDialog(
50cdf0e10cSrcweir     Window* pParent,
51cdf0e10cSrcweir     const SfxItemSet& rInAttrs,
52cdf0e10cSrcweir     SvxDistributeHorizontal eHor,
53cdf0e10cSrcweir     SvxDistributeVertical eVer)
54cdf0e10cSrcweir :   SfxSingleTabDialog(pParent, rInAttrs, RID_SVXPAGE_DISTRIBUTE ),
55cdf0e10cSrcweir     mpPage(0L)
56cdf0e10cSrcweir {
57cdf0e10cSrcweir     mpPage = new SvxDistributePage(this, rInAttrs, eHor, eVer);
58cdf0e10cSrcweir     SetTabPage(mpPage);
59cdf0e10cSrcweir     SetText(mpPage->GetText());
60cdf0e10cSrcweir }
61cdf0e10cSrcweir 
62cdf0e10cSrcweir /*************************************************************************
63cdf0e10cSrcweir |*
64cdf0e10cSrcweir |* Dtor
65cdf0e10cSrcweir |*
66cdf0e10cSrcweir \************************************************************************/
67cdf0e10cSrcweir 
~SvxDistributeDialog()68cdf0e10cSrcweir SvxDistributeDialog::~SvxDistributeDialog()
69cdf0e10cSrcweir {
70cdf0e10cSrcweir }
71cdf0e10cSrcweir 
72cdf0e10cSrcweir /*************************************************************************
73cdf0e10cSrcweir |*
74cdf0e10cSrcweir |* Tabpage
75cdf0e10cSrcweir |*
76cdf0e10cSrcweir \************************************************************************/
77cdf0e10cSrcweir 
SvxDistributePage(Window * pWindow,const SfxItemSet & rInAttrs,SvxDistributeHorizontal eHor,SvxDistributeVertical eVer)78cdf0e10cSrcweir SvxDistributePage::SvxDistributePage(
79cdf0e10cSrcweir     Window* pWindow,
80cdf0e10cSrcweir     const SfxItemSet& rInAttrs,
81cdf0e10cSrcweir     SvxDistributeHorizontal eHor,
82cdf0e10cSrcweir     SvxDistributeVertical eVer)
83cdf0e10cSrcweir :   SvxTabPage(pWindow, CUI_RES(RID_SVXPAGE_DISTRIBUTE), rInAttrs),
84cdf0e10cSrcweir     meDistributeHor(eHor),
85cdf0e10cSrcweir     meDistributeVer(eVer),
86cdf0e10cSrcweir     maFlHorizontal      (this, CUI_RES(FL_HORIZONTAL        )),
87cdf0e10cSrcweir     maBtnHorNone        (this, CUI_RES(BTN_HOR_NONE     )),
88cdf0e10cSrcweir     maBtnHorLeft        (this, CUI_RES(BTN_HOR_LEFT     )),
89cdf0e10cSrcweir     maBtnHorCenter      (this, CUI_RES(BTN_HOR_CENTER       )),
90cdf0e10cSrcweir     maBtnHorDistance    (this, CUI_RES(BTN_HOR_DISTANCE )),
91cdf0e10cSrcweir     maBtnHorRight       (this, CUI_RES(BTN_HOR_RIGHT        )),
92cdf0e10cSrcweir     maHorLow            (this, CUI_RES(IMG_HOR_LOW      )),
93cdf0e10cSrcweir     maHorCenter         (this, CUI_RES(IMG_HOR_CENTER       )),
94cdf0e10cSrcweir     maHorDistance       (this, CUI_RES(IMG_HOR_DISTANCE )),
95cdf0e10cSrcweir     maHorHigh           (this, CUI_RES(IMG_HOR_HIGH     )),
96cdf0e10cSrcweir     maFlVertical        (this, CUI_RES(FL_VERTICAL      )),
97cdf0e10cSrcweir     maBtnVerNone        (this, CUI_RES(BTN_VER_NONE     )),
98cdf0e10cSrcweir     maBtnVerTop         (this, CUI_RES(BTN_VER_TOP      )),
99cdf0e10cSrcweir     maBtnVerCenter      (this, CUI_RES(BTN_VER_CENTER       )),
100cdf0e10cSrcweir     maBtnVerDistance    (this, CUI_RES(BTN_VER_DISTANCE )),
101cdf0e10cSrcweir     maBtnVerBottom      (this, CUI_RES(BTN_VER_BOTTOM       )),
102cdf0e10cSrcweir     maVerLow            (this, CUI_RES(IMG_VER_LOW        )),
103cdf0e10cSrcweir     maVerCenter         (this, CUI_RES(IMG_VER_CENTER       )),
104cdf0e10cSrcweir     maVerDistance       (this, CUI_RES(IMG_VER_DISTANCE   )),
105cdf0e10cSrcweir     maVerHigh           (this, CUI_RES(IMG_VER_HIGH       ))
106cdf0e10cSrcweir {
107cdf0e10cSrcweir     maHorLow.SetModeImage( Image( CUI_RES( IMG_HOR_LOW_H ) ), BMP_COLOR_HIGHCONTRAST );
108cdf0e10cSrcweir     maHorCenter.SetModeImage( Image( CUI_RES( IMG_HOR_CENTER_H ) ), BMP_COLOR_HIGHCONTRAST );
109cdf0e10cSrcweir     maHorDistance.SetModeImage( Image( CUI_RES( IMG_HOR_DISTANCE_H ) ), BMP_COLOR_HIGHCONTRAST );
110cdf0e10cSrcweir     maHorHigh.SetModeImage( Image( CUI_RES( IMG_HOR_HIGH_H ) ), BMP_COLOR_HIGHCONTRAST );
111cdf0e10cSrcweir     maVerDistance.SetModeImage( Image( CUI_RES( IMG_VER_DISTANCE_H ) ), BMP_COLOR_HIGHCONTRAST );
112cdf0e10cSrcweir     maVerLow.SetModeImage( Image( CUI_RES( IMG_VER_LOW_H ) ), BMP_COLOR_HIGHCONTRAST );
113cdf0e10cSrcweir     maVerCenter.SetModeImage( Image( CUI_RES( IMG_VER_CENTER_H ) ), BMP_COLOR_HIGHCONTRAST );
114cdf0e10cSrcweir     maVerHigh.SetModeImage( Image( CUI_RES( IMG_VER_HIGH_H ) ), BMP_COLOR_HIGHCONTRAST );
115cdf0e10cSrcweir 
116cdf0e10cSrcweir     FreeResource();
117cdf0e10cSrcweir }
118cdf0e10cSrcweir 
119cdf0e10cSrcweir /*************************************************************************
120cdf0e10cSrcweir |*
121cdf0e10cSrcweir |* Dtor
122cdf0e10cSrcweir |*
123cdf0e10cSrcweir \************************************************************************/
124cdf0e10cSrcweir 
~SvxDistributePage()125cdf0e10cSrcweir SvxDistributePage::~SvxDistributePage()
126cdf0e10cSrcweir {
127cdf0e10cSrcweir }
128cdf0e10cSrcweir 
129cdf0e10cSrcweir /*************************************************************************
130cdf0e10cSrcweir |*
131cdf0e10cSrcweir |* create the tabpage
132cdf0e10cSrcweir |*
133cdf0e10cSrcweir \************************************************************************/
134cdf0e10cSrcweir 
Create(Window * pWindow,const SfxItemSet & rAttrs,SvxDistributeHorizontal eHor,SvxDistributeVertical eVer)135cdf0e10cSrcweir SfxTabPage* SvxDistributePage::Create(Window* pWindow, const SfxItemSet& rAttrs,
136cdf0e10cSrcweir     SvxDistributeHorizontal eHor, SvxDistributeVertical eVer)
137cdf0e10cSrcweir {
138cdf0e10cSrcweir     return(new SvxDistributePage(pWindow, rAttrs, eHor, eVer));
139cdf0e10cSrcweir }
140cdf0e10cSrcweir 
141cdf0e10cSrcweir /*************************************************************************
142cdf0e10cSrcweir |*
143cdf0e10cSrcweir |*
144cdf0e10cSrcweir |*
145cdf0e10cSrcweir \************************************************************************/
146cdf0e10cSrcweir 
GetRanges()147cdf0e10cSrcweir sal_uInt16* SvxDistributePage::GetRanges()
148cdf0e10cSrcweir {
149cdf0e10cSrcweir     return(pRanges);
150cdf0e10cSrcweir }
151cdf0e10cSrcweir 
152cdf0e10cSrcweir /*************************************************************************
153cdf0e10cSrcweir |*
154cdf0e10cSrcweir |*
155cdf0e10cSrcweir |*
156cdf0e10cSrcweir \************************************************************************/
157cdf0e10cSrcweir 
PointChanged(Window *,RECT_POINT)158cdf0e10cSrcweir void SvxDistributePage::PointChanged(Window* /*pWindow*/, RECT_POINT /*eRP*/)
159cdf0e10cSrcweir {
160cdf0e10cSrcweir }
161cdf0e10cSrcweir 
162cdf0e10cSrcweir /*************************************************************************
163cdf0e10cSrcweir |*
164cdf0e10cSrcweir |* read the delivered Item-Set
165cdf0e10cSrcweir |*
166cdf0e10cSrcweir \************************************************************************/
167cdf0e10cSrcweir 
Reset(const SfxItemSet &)168cdf0e10cSrcweir void __EXPORT SvxDistributePage::Reset(const SfxItemSet& )
169cdf0e10cSrcweir {
170cdf0e10cSrcweir     maBtnHorNone.SetState(sal_False);
171cdf0e10cSrcweir     maBtnHorLeft.SetState(sal_False);
172cdf0e10cSrcweir     maBtnHorCenter.SetState(sal_False);
173cdf0e10cSrcweir     maBtnHorDistance.SetState(sal_False);
174cdf0e10cSrcweir     maBtnHorRight.SetState(sal_False);
175cdf0e10cSrcweir 
176cdf0e10cSrcweir     switch(meDistributeHor)
177cdf0e10cSrcweir     {
178cdf0e10cSrcweir         case SvxDistributeHorizontalNone : maBtnHorNone.SetState(sal_True); break;
179cdf0e10cSrcweir         case SvxDistributeHorizontalLeft : maBtnHorLeft.SetState(sal_True); break;
180cdf0e10cSrcweir         case SvxDistributeHorizontalCenter : maBtnHorCenter.SetState(sal_True); break;
181cdf0e10cSrcweir         case SvxDistributeHorizontalDistance : maBtnHorDistance.SetState(sal_True); break;
182cdf0e10cSrcweir         case SvxDistributeHorizontalRight : maBtnHorRight.SetState(sal_True); break;
183cdf0e10cSrcweir     }
184cdf0e10cSrcweir 
185cdf0e10cSrcweir     maBtnVerNone.SetState(sal_False);
186cdf0e10cSrcweir     maBtnVerTop.SetState(sal_False);
187cdf0e10cSrcweir     maBtnVerCenter.SetState(sal_False);
188cdf0e10cSrcweir     maBtnVerDistance.SetState(sal_False);
189cdf0e10cSrcweir     maBtnVerBottom.SetState(sal_False);
190cdf0e10cSrcweir 
191cdf0e10cSrcweir     switch(meDistributeVer)
192cdf0e10cSrcweir     {
193cdf0e10cSrcweir         case SvxDistributeVerticalNone : maBtnVerNone.SetState(sal_True); break;
194cdf0e10cSrcweir         case SvxDistributeVerticalTop : maBtnVerTop.SetState(sal_True); break;
195cdf0e10cSrcweir         case SvxDistributeVerticalCenter : maBtnVerCenter.SetState(sal_True); break;
196cdf0e10cSrcweir         case SvxDistributeVerticalDistance : maBtnVerDistance.SetState(sal_True); break;
197cdf0e10cSrcweir         case SvxDistributeVerticalBottom : maBtnVerBottom.SetState(sal_True); break;
198cdf0e10cSrcweir     }
199cdf0e10cSrcweir }
200cdf0e10cSrcweir 
201cdf0e10cSrcweir /*************************************************************************
202cdf0e10cSrcweir |*
203cdf0e10cSrcweir |* Fill the delivered Item-Set with dialogbox-attributes
204cdf0e10cSrcweir |*
205cdf0e10cSrcweir \************************************************************************/
206cdf0e10cSrcweir 
FillItemSet(SfxItemSet &)207cdf0e10cSrcweir sal_Bool SvxDistributePage::FillItemSet( SfxItemSet& )
208cdf0e10cSrcweir {
209cdf0e10cSrcweir     SvxDistributeHorizontal eDistributeHor(SvxDistributeHorizontalNone);
210cdf0e10cSrcweir     SvxDistributeVertical eDistributeVer(SvxDistributeVerticalNone);
211cdf0e10cSrcweir 
212cdf0e10cSrcweir     if(maBtnHorLeft.IsChecked())
213cdf0e10cSrcweir         eDistributeHor = SvxDistributeHorizontalLeft;
214cdf0e10cSrcweir     else if(maBtnHorCenter.IsChecked())
215cdf0e10cSrcweir         eDistributeHor = SvxDistributeHorizontalCenter;
216cdf0e10cSrcweir     else if(maBtnHorDistance.IsChecked())
217cdf0e10cSrcweir         eDistributeHor = SvxDistributeHorizontalDistance;
218cdf0e10cSrcweir     else if(maBtnHorRight.IsChecked())
219cdf0e10cSrcweir         eDistributeHor = SvxDistributeHorizontalRight;
220cdf0e10cSrcweir 
221cdf0e10cSrcweir     if(maBtnVerTop.IsChecked())
222cdf0e10cSrcweir         eDistributeVer = SvxDistributeVerticalTop;
223cdf0e10cSrcweir     else if(maBtnVerCenter.IsChecked())
224cdf0e10cSrcweir         eDistributeVer = SvxDistributeVerticalCenter;
225cdf0e10cSrcweir     else if(maBtnVerDistance.IsChecked())
226cdf0e10cSrcweir         eDistributeVer = SvxDistributeVerticalDistance;
227cdf0e10cSrcweir     else if(maBtnVerBottom.IsChecked())
228cdf0e10cSrcweir         eDistributeVer = SvxDistributeVerticalBottom;
229cdf0e10cSrcweir 
230cdf0e10cSrcweir     if(eDistributeHor != meDistributeHor || eDistributeVer != meDistributeVer)
231cdf0e10cSrcweir     {
232cdf0e10cSrcweir         meDistributeHor = eDistributeHor;
233cdf0e10cSrcweir         meDistributeVer = eDistributeVer;
234cdf0e10cSrcweir         return sal_True;
235cdf0e10cSrcweir     }
236cdf0e10cSrcweir 
237cdf0e10cSrcweir     return sal_False;
238cdf0e10cSrcweir }
239