1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski *
3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file
5*b1cdbd2cSJim Jagielski * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file
7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski *
11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski *
13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the
17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski * under the License.
19*b1cdbd2cSJim Jagielski *
20*b1cdbd2cSJim Jagielski *************************************************************/
21*b1cdbd2cSJim Jagielski
22*b1cdbd2cSJim Jagielski #include "precompiled_sc.hxx"
23*b1cdbd2cSJim Jagielski
24*b1cdbd2cSJim Jagielski #include <sfx2/sidebar/ResourceDefinitions.hrc>
25*b1cdbd2cSJim Jagielski #include <sfx2/sidebar/Theme.hxx>
26*b1cdbd2cSJim Jagielski #include <sfx2/sidebar/ControlFactory.hxx>
27*b1cdbd2cSJim Jagielski #include <sfx2/sidebar/Layouter.hxx>
28*b1cdbd2cSJim Jagielski #include <AlignmentPropertyPanel.hxx>
29*b1cdbd2cSJim Jagielski #include <AlignmentPropertyPanel.hrc>
30*b1cdbd2cSJim Jagielski #include <svx/dialmgr.hxx>
31*b1cdbd2cSJim Jagielski #include "sc.hrc"
32*b1cdbd2cSJim Jagielski #include "scresid.hxx"
33*b1cdbd2cSJim Jagielski #include <sfx2/bindings.hxx>
34*b1cdbd2cSJim Jagielski #include <sfx2/dispatch.hxx>
35*b1cdbd2cSJim Jagielski #include <svx/algitem.hxx>
36*b1cdbd2cSJim Jagielski #include <svx/dlgutil.hxx>
37*b1cdbd2cSJim Jagielski #include <vcl/toolbox.hxx>
38*b1cdbd2cSJim Jagielski #include <svx/sidebar/SidebarDialControl.hxx>
39*b1cdbd2cSJim Jagielski
40*b1cdbd2cSJim Jagielski using namespace css;
41*b1cdbd2cSJim Jagielski using namespace cssu;
42*b1cdbd2cSJim Jagielski using ::sfx2::sidebar::Layouter;
43*b1cdbd2cSJim Jagielski using ::sfx2::sidebar::ControlFactory;
44*b1cdbd2cSJim Jagielski
45*b1cdbd2cSJim Jagielski #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
46*b1cdbd2cSJim Jagielski
47*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
48*b1cdbd2cSJim Jagielski // namespace open
49*b1cdbd2cSJim Jagielski
50*b1cdbd2cSJim Jagielski namespace sc { namespace sidebar {
51*b1cdbd2cSJim Jagielski
52*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
53*b1cdbd2cSJim Jagielski
AlignmentPropertyPanel(Window * pParent,const cssu::Reference<css::frame::XFrame> & rxFrame,SfxBindings * pBindings)54*b1cdbd2cSJim Jagielski AlignmentPropertyPanel::AlignmentPropertyPanel(
55*b1cdbd2cSJim Jagielski Window* pParent,
56*b1cdbd2cSJim Jagielski const cssu::Reference<css::frame::XFrame>& rxFrame,
57*b1cdbd2cSJim Jagielski SfxBindings* pBindings)
58*b1cdbd2cSJim Jagielski : Control(
59*b1cdbd2cSJim Jagielski pParent,
60*b1cdbd2cSJim Jagielski ScResId(RID_PROPERTYPANEL_SC_ALIGNMENT)),
61*b1cdbd2cSJim Jagielski mpTBHorizontalBackground(ControlFactory::CreateToolBoxBackground(this)),
62*b1cdbd2cSJim Jagielski mpTBHorizontal(ControlFactory::CreateToolBox(
63*b1cdbd2cSJim Jagielski mpTBHorizontalBackground.get(),
64*b1cdbd2cSJim Jagielski ScResId(TBX_HORIZONTAL_ALIGNMENT))),
65*b1cdbd2cSJim Jagielski mpTBVerticalBackground(ControlFactory::CreateToolBoxBackground(this)),
66*b1cdbd2cSJim Jagielski mpTBVertical(ControlFactory::CreateToolBox(
67*b1cdbd2cSJim Jagielski mpTBVerticalBackground.get(),
68*b1cdbd2cSJim Jagielski ScResId(TBX_VERTICAL_ALIGN))),
69*b1cdbd2cSJim Jagielski mpFTLeftIndent(new FixedText(this, ScResId(FT_LEFT_INDENT))),
70*b1cdbd2cSJim Jagielski mpMFLeftIndent(new MetricField(this, ScResId(MF_LEFT_INDENT))),
71*b1cdbd2cSJim Jagielski mpCBXWrapText(new CheckBox(this, ScResId(CBX_WRAP))),
72*b1cdbd2cSJim Jagielski mpCBXMergeCell(new CheckBox(this, ScResId(CBX_MERGE))),
73*b1cdbd2cSJim Jagielski mpFtRotate(new FixedText(this, ScResId(FT_ORIENT))),
74*b1cdbd2cSJim Jagielski mpCtrlDial(new svx::sidebar::SidebarDialControl(this, ScResId(DIAL_CONTROL))), // , true)),
75*b1cdbd2cSJim Jagielski mpMtrAngle(new MetricBox(this, ScResId(CBOX_ANGLE))),
76*b1cdbd2cSJim Jagielski mpCbStacked(new CheckBox(this, ScResId(CBX_VERT))),
77*b1cdbd2cSJim Jagielski maAlignHorControl(SID_H_ALIGNCELL, *pBindings, *this),
78*b1cdbd2cSJim Jagielski maAlignVerControl(SID_V_ALIGNCELL, *pBindings, *this),
79*b1cdbd2cSJim Jagielski maLeftIndentControl(SID_ATTR_ALIGN_INDENT, *pBindings, *this),
80*b1cdbd2cSJim Jagielski maMergeCellControl(FID_MERGE_TOGGLE, *pBindings, *this),
81*b1cdbd2cSJim Jagielski maWrapTextControl(SID_ATTR_ALIGN_LINEBREAK, *pBindings, *this),
82*b1cdbd2cSJim Jagielski maAngleControl(SID_ATTR_ALIGN_DEGREES, *pBindings, *this),
83*b1cdbd2cSJim Jagielski maStackControl(SID_ATTR_ALIGN_STACKED, *pBindings, *this),
84*b1cdbd2cSJim Jagielski maIMGAlignLeft(ScResId(IMG_ALIGN_LEFT)),
85*b1cdbd2cSJim Jagielski maIMGAlignCenter(ScResId(IMG_ALIGN_CENTER)),
86*b1cdbd2cSJim Jagielski maIMGAlignRight(ScResId(IMG_ALIGN_RIGHT)),
87*b1cdbd2cSJim Jagielski maIMGAlignJust(ScResId(IMG_ALIGN_JUST)),
88*b1cdbd2cSJim Jagielski maIMGAlignTop(ScResId(IMG_ALIGN_TOP)),
89*b1cdbd2cSJim Jagielski maIMGAlignCenterV(ScResId(IMG_ALIGN_CENTER_V)),
90*b1cdbd2cSJim Jagielski maIMGAlignBottom(ScResId(IMG_ALIGN_BOTTOM)),
91*b1cdbd2cSJim Jagielski meHorAlignState(SVX_HOR_JUSTIFY_STANDARD),
92*b1cdbd2cSJim Jagielski meVerAlignState(SVX_VER_JUSTIFY_STANDARD),
93*b1cdbd2cSJim Jagielski mbMultiDisable(false),
94*b1cdbd2cSJim Jagielski mxFrame(rxFrame),
95*b1cdbd2cSJim Jagielski maContext(),
96*b1cdbd2cSJim Jagielski mpBindings(pBindings)
97*b1cdbd2cSJim Jagielski {
98*b1cdbd2cSJim Jagielski Initialize();
99*b1cdbd2cSJim Jagielski FreeResource();
100*b1cdbd2cSJim Jagielski
101*b1cdbd2cSJim Jagielski mpFTLeftIndent->SetBackground(Wallpaper());
102*b1cdbd2cSJim Jagielski mpFtRotate->SetBackground(Wallpaper());
103*b1cdbd2cSJim Jagielski
104*b1cdbd2cSJim Jagielski Layouter::PrepareForLayouting(*mpFTLeftIndent);
105*b1cdbd2cSJim Jagielski Layouter::PrepareForLayouting(*mpFtRotate);
106*b1cdbd2cSJim Jagielski Layouter::PrepareForLayouting(*mpCBXWrapText);
107*b1cdbd2cSJim Jagielski Layouter::PrepareForLayouting(*mpCBXMergeCell);
108*b1cdbd2cSJim Jagielski Layouter::PrepareForLayouting(*mpCbStacked);
109*b1cdbd2cSJim Jagielski
110*b1cdbd2cSJim Jagielski }
111*b1cdbd2cSJim Jagielski
112*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
113*b1cdbd2cSJim Jagielski
~AlignmentPropertyPanel()114*b1cdbd2cSJim Jagielski AlignmentPropertyPanel::~AlignmentPropertyPanel()
115*b1cdbd2cSJim Jagielski {
116*b1cdbd2cSJim Jagielski }
117*b1cdbd2cSJim Jagielski
118*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
119*b1cdbd2cSJim Jagielski
Initialize()120*b1cdbd2cSJim Jagielski void AlignmentPropertyPanel::Initialize()
121*b1cdbd2cSJim Jagielski {
122*b1cdbd2cSJim Jagielski mpTBHorizontal->SetItemImage(ID_SUBSTLEFT, maIMGAlignLeft);
123*b1cdbd2cSJim Jagielski mpTBHorizontal->SetItemImage(ID_SUBSTCENTER, maIMGAlignCenter);
124*b1cdbd2cSJim Jagielski mpTBHorizontal->SetItemImage(ID_SUBSTRIGHT, maIMGAlignRight);
125*b1cdbd2cSJim Jagielski mpTBHorizontal->SetItemImage(ID_SUBSTJUSTIFY, maIMGAlignJust);
126*b1cdbd2cSJim Jagielski Size aTbxSize( mpTBHorizontal->CalcWindowSizePixel() );
127*b1cdbd2cSJim Jagielski mpTBHorizontal->SetOutputSizePixel( aTbxSize );
128*b1cdbd2cSJim Jagielski mpTBHorizontal->SetBackground(Wallpaper());
129*b1cdbd2cSJim Jagielski mpTBHorizontal->SetPaintTransparent(true);
130*b1cdbd2cSJim Jagielski Link aLink = LINK(this, AlignmentPropertyPanel, TbxHorAlignSelectHdl);
131*b1cdbd2cSJim Jagielski mpTBHorizontal->SetSelectHdl ( aLink );
132*b1cdbd2cSJim Jagielski
133*b1cdbd2cSJim Jagielski mpTBVertical->SetItemImage(IID_VERT_TOP, maIMGAlignTop);
134*b1cdbd2cSJim Jagielski mpTBVertical->SetItemImage(IID_VERT_CENTER, maIMGAlignCenterV);
135*b1cdbd2cSJim Jagielski mpTBVertical->SetItemImage(IID_VERT_BOTTOM, maIMGAlignBottom);
136*b1cdbd2cSJim Jagielski Size aTbxSize2( mpTBVertical->CalcWindowSizePixel() );
137*b1cdbd2cSJim Jagielski mpTBVertical->SetOutputSizePixel( aTbxSize2 );
138*b1cdbd2cSJim Jagielski mpTBVertical->SetBackground(Wallpaper());
139*b1cdbd2cSJim Jagielski mpTBVertical->SetPaintTransparent(true);
140*b1cdbd2cSJim Jagielski aLink = LINK(this, AlignmentPropertyPanel, TbxVerAlignSelectHdl);
141*b1cdbd2cSJim Jagielski mpTBVertical->SetSelectHdl ( aLink );
142*b1cdbd2cSJim Jagielski
143*b1cdbd2cSJim Jagielski mpFTLeftIndent->Disable();
144*b1cdbd2cSJim Jagielski mpMFLeftIndent->Disable();
145*b1cdbd2cSJim Jagielski mpMFLeftIndent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Left Indent"))); //wj acc
146*b1cdbd2cSJim Jagielski aLink = LINK(this, AlignmentPropertyPanel, MFLeftIndentMdyHdl);
147*b1cdbd2cSJim Jagielski mpMFLeftIndent->SetModifyHdl ( aLink );
148*b1cdbd2cSJim Jagielski
149*b1cdbd2cSJim Jagielski aLink = LINK(this, AlignmentPropertyPanel, CBOXMergnCellClkHdl);
150*b1cdbd2cSJim Jagielski mpCBXMergeCell->SetClickHdl ( aLink );
151*b1cdbd2cSJim Jagielski
152*b1cdbd2cSJim Jagielski aLink = LINK(this, AlignmentPropertyPanel, CBOXWrapTextClkHdl);
153*b1cdbd2cSJim Jagielski mpCBXWrapText->SetClickHdl ( aLink );
154*b1cdbd2cSJim Jagielski
155*b1cdbd2cSJim Jagielski //rotation control
156*b1cdbd2cSJim Jagielski mpCtrlDial->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text Orientation"))); //wj acc
157*b1cdbd2cSJim Jagielski mpCtrlDial->SetModifyHdl(LINK( this, AlignmentPropertyPanel, RotationHdl));
158*b1cdbd2cSJim Jagielski
159*b1cdbd2cSJim Jagielski //rotation
160*b1cdbd2cSJim Jagielski mpMtrAngle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text Orientation"))); //wj acc
161*b1cdbd2cSJim Jagielski mpMtrAngle->SetModifyHdl(LINK( this, AlignmentPropertyPanel, AngleModifiedHdl));
162*b1cdbd2cSJim Jagielski mpMtrAngle->EnableAutocomplete( false );
163*b1cdbd2cSJim Jagielski
164*b1cdbd2cSJim Jagielski //Vertical stacked
165*b1cdbd2cSJim Jagielski mpCbStacked->SetClickHdl( LINK( this, AlignmentPropertyPanel, ClickStackHdl ) );
166*b1cdbd2cSJim Jagielski
167*b1cdbd2cSJim Jagielski mpMtrAngle->InsertValue(0, FUNIT_CUSTOM);
168*b1cdbd2cSJim Jagielski mpMtrAngle->InsertValue(45, FUNIT_CUSTOM);
169*b1cdbd2cSJim Jagielski mpMtrAngle->InsertValue(90, FUNIT_CUSTOM);
170*b1cdbd2cSJim Jagielski mpMtrAngle->InsertValue(135, FUNIT_CUSTOM);
171*b1cdbd2cSJim Jagielski mpMtrAngle->InsertValue(180, FUNIT_CUSTOM);
172*b1cdbd2cSJim Jagielski mpMtrAngle->InsertValue(225, FUNIT_CUSTOM);
173*b1cdbd2cSJim Jagielski mpMtrAngle->InsertValue(270, FUNIT_CUSTOM);
174*b1cdbd2cSJim Jagielski mpMtrAngle->InsertValue(315, FUNIT_CUSTOM);
175*b1cdbd2cSJim Jagielski mpMtrAngle->SetDropDownLineCount(mpMtrAngle->GetEntryCount());
176*b1cdbd2cSJim Jagielski
177*b1cdbd2cSJim Jagielski mpTBHorizontal->SetAccessibleRelationLabeledBy(mpTBHorizontal.get());
178*b1cdbd2cSJim Jagielski mpTBVertical->SetAccessibleRelationLabeledBy(mpTBVertical.get());
179*b1cdbd2cSJim Jagielski mpMFLeftIndent->SetAccessibleRelationLabeledBy(mpFTLeftIndent.get());
180*b1cdbd2cSJim Jagielski mpMtrAngle->SetAccessibleRelationLabeledBy(mpFtRotate.get());
181*b1cdbd2cSJim Jagielski #ifdef HAS_IA2
182*b1cdbd2cSJim Jagielski mpMtrAngle->SetMpSubEditAccLableBy(mpFtRotate.get());
183*b1cdbd2cSJim Jagielski #endif
184*b1cdbd2cSJim Jagielski }
185*b1cdbd2cSJim Jagielski
186*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
187*b1cdbd2cSJim Jagielski
IMPL_LINK(AlignmentPropertyPanel,AngleModifiedHdl,void *,EMPTYARG)188*b1cdbd2cSJim Jagielski IMPL_LINK( AlignmentPropertyPanel, AngleModifiedHdl, void *, EMPTYARG )
189*b1cdbd2cSJim Jagielski {
190*b1cdbd2cSJim Jagielski String sTmp = mpMtrAngle->GetText();
191*b1cdbd2cSJim Jagielski
192*b1cdbd2cSJim Jagielski sal_Unicode nChar = sTmp.GetChar( 0 );
193*b1cdbd2cSJim Jagielski if((sTmp.Len()== 1 && nChar == '-') ||
194*b1cdbd2cSJim Jagielski (nChar != '-' && ((nChar < '0') || (nChar > '9') ) )) ////modify
195*b1cdbd2cSJim Jagielski return 0;
196*b1cdbd2cSJim Jagielski
197*b1cdbd2cSJim Jagielski double dTmp = sTmp.ToDouble();
198*b1cdbd2cSJim Jagielski FormatDegrees(dTmp);
199*b1cdbd2cSJim Jagielski
200*b1cdbd2cSJim Jagielski sal_Int64 nTmp = (sal_Int64)dTmp*100;
201*b1cdbd2cSJim Jagielski SfxInt32Item aAngleItem( SID_ATTR_ALIGN_DEGREES,(sal_uInt32) nTmp);
202*b1cdbd2cSJim Jagielski
203*b1cdbd2cSJim Jagielski GetBindings()->GetDispatcher()->Execute(
204*b1cdbd2cSJim Jagielski SID_ATTR_ALIGN_DEGREES, SFX_CALLMODE_RECORD, &aAngleItem, 0L );
205*b1cdbd2cSJim Jagielski return 0;
206*b1cdbd2cSJim Jagielski }
207*b1cdbd2cSJim Jagielski
208*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
209*b1cdbd2cSJim Jagielski
IMPL_LINK(AlignmentPropertyPanel,RotationHdl,void *,EMPTYARG)210*b1cdbd2cSJim Jagielski IMPL_LINK( AlignmentPropertyPanel, RotationHdl, void *, EMPTYARG )
211*b1cdbd2cSJim Jagielski {
212*b1cdbd2cSJim Jagielski sal_Int32 nTmp = mpCtrlDial->GetRotation();
213*b1cdbd2cSJim Jagielski SfxInt32Item aAngleItem( SID_ATTR_ALIGN_DEGREES,(sal_uInt32) nTmp);
214*b1cdbd2cSJim Jagielski
215*b1cdbd2cSJim Jagielski GetBindings()->GetDispatcher()->Execute(
216*b1cdbd2cSJim Jagielski SID_ATTR_ALIGN_DEGREES, SFX_CALLMODE_RECORD, &aAngleItem, 0L );
217*b1cdbd2cSJim Jagielski
218*b1cdbd2cSJim Jagielski return 0;
219*b1cdbd2cSJim Jagielski }
220*b1cdbd2cSJim Jagielski
221*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
222*b1cdbd2cSJim Jagielski
IMPL_LINK(AlignmentPropertyPanel,ClickStackHdl,void *,EMPTYARG)223*b1cdbd2cSJim Jagielski IMPL_LINK( AlignmentPropertyPanel, ClickStackHdl, void *, EMPTYARG )
224*b1cdbd2cSJim Jagielski {
225*b1cdbd2cSJim Jagielski bool bVertical = mpCbStacked->IsChecked() ? true : false;
226*b1cdbd2cSJim Jagielski SfxBoolItem aStackItem( SID_ATTR_ALIGN_STACKED, bVertical );
227*b1cdbd2cSJim Jagielski GetBindings()->GetDispatcher()->Execute(
228*b1cdbd2cSJim Jagielski SID_ATTR_ALIGN_STACKED, SFX_CALLMODE_RECORD, &aStackItem, 0L );
229*b1cdbd2cSJim Jagielski return 0;
230*b1cdbd2cSJim Jagielski }
231*b1cdbd2cSJim Jagielski
232*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
233*b1cdbd2cSJim Jagielski
IMPL_LINK(AlignmentPropertyPanel,TbxHorAlignSelectHdl,ToolBox *,pToolBox)234*b1cdbd2cSJim Jagielski IMPL_LINK(AlignmentPropertyPanel, TbxHorAlignSelectHdl, ToolBox*, pToolBox)
235*b1cdbd2cSJim Jagielski {
236*b1cdbd2cSJim Jagielski sal_uInt16 nId = pToolBox->GetCurItemId();
237*b1cdbd2cSJim Jagielski
238*b1cdbd2cSJim Jagielski if(nId == ID_SUBSTLEFT)
239*b1cdbd2cSJim Jagielski {
240*b1cdbd2cSJim Jagielski if(meHorAlignState != SVX_HOR_JUSTIFY_LEFT)
241*b1cdbd2cSJim Jagielski meHorAlignState = SVX_HOR_JUSTIFY_LEFT;
242*b1cdbd2cSJim Jagielski else
243*b1cdbd2cSJim Jagielski meHorAlignState = SVX_HOR_JUSTIFY_STANDARD;
244*b1cdbd2cSJim Jagielski }
245*b1cdbd2cSJim Jagielski else if( nId == ID_SUBSTCENTER )
246*b1cdbd2cSJim Jagielski {
247*b1cdbd2cSJim Jagielski if(meHorAlignState != SVX_HOR_JUSTIFY_CENTER)
248*b1cdbd2cSJim Jagielski meHorAlignState = SVX_HOR_JUSTIFY_CENTER;
249*b1cdbd2cSJim Jagielski else
250*b1cdbd2cSJim Jagielski meHorAlignState = SVX_HOR_JUSTIFY_STANDARD;
251*b1cdbd2cSJim Jagielski }
252*b1cdbd2cSJim Jagielski else if( nId == ID_SUBSTRIGHT )
253*b1cdbd2cSJim Jagielski {
254*b1cdbd2cSJim Jagielski if(meHorAlignState != SVX_HOR_JUSTIFY_RIGHT)
255*b1cdbd2cSJim Jagielski meHorAlignState = SVX_HOR_JUSTIFY_RIGHT;
256*b1cdbd2cSJim Jagielski else
257*b1cdbd2cSJim Jagielski meHorAlignState = SVX_HOR_JUSTIFY_STANDARD;
258*b1cdbd2cSJim Jagielski }
259*b1cdbd2cSJim Jagielski else if( nId == ID_SUBSTJUSTIFY )
260*b1cdbd2cSJim Jagielski {
261*b1cdbd2cSJim Jagielski if(meHorAlignState != SVX_HOR_JUSTIFY_BLOCK)
262*b1cdbd2cSJim Jagielski meHorAlignState = SVX_HOR_JUSTIFY_BLOCK;
263*b1cdbd2cSJim Jagielski else
264*b1cdbd2cSJim Jagielski meHorAlignState = SVX_HOR_JUSTIFY_STANDARD;
265*b1cdbd2cSJim Jagielski }
266*b1cdbd2cSJim Jagielski SvxHorJustifyItem aHorItem(meHorAlignState, SID_H_ALIGNCELL);
267*b1cdbd2cSJim Jagielski GetBindings()->GetDispatcher()->Execute(SID_H_ALIGNCELL, SFX_CALLMODE_RECORD, &aHorItem, 0L);
268*b1cdbd2cSJim Jagielski UpdateHorAlign();
269*b1cdbd2cSJim Jagielski return 0;
270*b1cdbd2cSJim Jagielski }
271*b1cdbd2cSJim Jagielski
272*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
273*b1cdbd2cSJim Jagielski
IMPL_LINK(AlignmentPropertyPanel,TbxVerAlignSelectHdl,ToolBox *,pToolBox)274*b1cdbd2cSJim Jagielski IMPL_LINK(AlignmentPropertyPanel, TbxVerAlignSelectHdl, ToolBox*, pToolBox)
275*b1cdbd2cSJim Jagielski {
276*b1cdbd2cSJim Jagielski sal_uInt16 nId = pToolBox->GetCurItemId();
277*b1cdbd2cSJim Jagielski
278*b1cdbd2cSJim Jagielski //Bold
279*b1cdbd2cSJim Jagielski if(nId == IID_VERT_TOP)
280*b1cdbd2cSJim Jagielski {
281*b1cdbd2cSJim Jagielski if(meVerAlignState != SVX_VER_JUSTIFY_TOP)
282*b1cdbd2cSJim Jagielski meVerAlignState = SVX_VER_JUSTIFY_TOP;
283*b1cdbd2cSJim Jagielski else
284*b1cdbd2cSJim Jagielski meVerAlignState = SVX_VER_JUSTIFY_STANDARD;
285*b1cdbd2cSJim Jagielski }
286*b1cdbd2cSJim Jagielski else if( nId == IID_VERT_CENTER )
287*b1cdbd2cSJim Jagielski {
288*b1cdbd2cSJim Jagielski if(meVerAlignState != SVX_VER_JUSTIFY_CENTER)
289*b1cdbd2cSJim Jagielski meVerAlignState = SVX_VER_JUSTIFY_CENTER;
290*b1cdbd2cSJim Jagielski else
291*b1cdbd2cSJim Jagielski meVerAlignState = SVX_VER_JUSTIFY_STANDARD;
292*b1cdbd2cSJim Jagielski }
293*b1cdbd2cSJim Jagielski else if( nId == IID_VERT_BOTTOM )
294*b1cdbd2cSJim Jagielski {
295*b1cdbd2cSJim Jagielski if(meVerAlignState != SVX_VER_JUSTIFY_BOTTOM)
296*b1cdbd2cSJim Jagielski meVerAlignState = SVX_VER_JUSTIFY_BOTTOM;
297*b1cdbd2cSJim Jagielski else
298*b1cdbd2cSJim Jagielski meVerAlignState = SVX_VER_JUSTIFY_STANDARD;
299*b1cdbd2cSJim Jagielski }
300*b1cdbd2cSJim Jagielski SvxVerJustifyItem aVerItem(meVerAlignState, SID_V_ALIGNCELL);
301*b1cdbd2cSJim Jagielski GetBindings()->GetDispatcher()->Execute(SID_V_ALIGNCELL, SFX_CALLMODE_RECORD, &aVerItem, 0L);
302*b1cdbd2cSJim Jagielski UpdateVerAlign();
303*b1cdbd2cSJim Jagielski return 0;
304*b1cdbd2cSJim Jagielski }
305*b1cdbd2cSJim Jagielski
306*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
307*b1cdbd2cSJim Jagielski
IMPL_LINK(AlignmentPropertyPanel,MFLeftIndentMdyHdl,void *,EMPTYARG)308*b1cdbd2cSJim Jagielski IMPL_LINK(AlignmentPropertyPanel, MFLeftIndentMdyHdl, void*, EMPTYARG)
309*b1cdbd2cSJim Jagielski {
310*b1cdbd2cSJim Jagielski mpCBXWrapText->EnableTriState(false);
311*b1cdbd2cSJim Jagielski sal_uInt16 nVal = (sal_uInt16)mpMFLeftIndent->GetValue();
312*b1cdbd2cSJim Jagielski SfxUInt16Item aItem( SID_ATTR_ALIGN_INDENT, (sal_uInt16)CalcToUnit( nVal, SFX_MAPUNIT_TWIP ) );
313*b1cdbd2cSJim Jagielski
314*b1cdbd2cSJim Jagielski GetBindings()->GetDispatcher()->Execute(SID_ATTR_ALIGN_INDENT, SFX_CALLMODE_RECORD, &aItem, 0L);
315*b1cdbd2cSJim Jagielski return( 0L );
316*b1cdbd2cSJim Jagielski }
317*b1cdbd2cSJim Jagielski
318*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
319*b1cdbd2cSJim Jagielski
IMPL_LINK(AlignmentPropertyPanel,CBOXMergnCellClkHdl,void *,EMPTYARG)320*b1cdbd2cSJim Jagielski IMPL_LINK(AlignmentPropertyPanel, CBOXMergnCellClkHdl, void*, EMPTYARG)
321*b1cdbd2cSJim Jagielski {
322*b1cdbd2cSJim Jagielski bool bState = mpCBXMergeCell->IsChecked();
323*b1cdbd2cSJim Jagielski
324*b1cdbd2cSJim Jagielski //Modified
325*b1cdbd2cSJim Jagielski //SfxBoolItem aItem( FID_MERGE_TOGGLE , bState);
326*b1cdbd2cSJim Jagielski //GetBindings()->GetDispatcher()->Execute(FID_MERGE_TOGGLE, SFX_CALLMODE_RECORD, &aItem, false, 0L);
327*b1cdbd2cSJim Jagielski if(bState)
328*b1cdbd2cSJim Jagielski GetBindings()->GetDispatcher()->Execute(FID_MERGE_ON, SFX_CALLMODE_RECORD);
329*b1cdbd2cSJim Jagielski else
330*b1cdbd2cSJim Jagielski GetBindings()->GetDispatcher()->Execute(FID_MERGE_OFF, SFX_CALLMODE_RECORD);
331*b1cdbd2cSJim Jagielski GetBindings()->Invalidate(FID_MERGE_TOGGLE,true,false);
332*b1cdbd2cSJim Jagielski //modified end
333*b1cdbd2cSJim Jagielski
334*b1cdbd2cSJim Jagielski return 0;
335*b1cdbd2cSJim Jagielski }
336*b1cdbd2cSJim Jagielski
337*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
338*b1cdbd2cSJim Jagielski
IMPL_LINK(AlignmentPropertyPanel,CBOXWrapTextClkHdl,void *,EMPTYARG)339*b1cdbd2cSJim Jagielski IMPL_LINK(AlignmentPropertyPanel, CBOXWrapTextClkHdl, void*, EMPTYARG)
340*b1cdbd2cSJim Jagielski {
341*b1cdbd2cSJim Jagielski bool bState = mpCBXWrapText->IsChecked();
342*b1cdbd2cSJim Jagielski SfxBoolItem aItem( SID_ATTR_ALIGN_LINEBREAK , bState);
343*b1cdbd2cSJim Jagielski GetBindings()->GetDispatcher()->Execute(SID_ATTR_ALIGN_LINEBREAK, SFX_CALLMODE_RECORD, &aItem, 0L);
344*b1cdbd2cSJim Jagielski return 0;
345*b1cdbd2cSJim Jagielski }
346*b1cdbd2cSJim Jagielski
347*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
348*b1cdbd2cSJim Jagielski
Create(Window * pParent,const cssu::Reference<css::frame::XFrame> & rxFrame,SfxBindings * pBindings)349*b1cdbd2cSJim Jagielski AlignmentPropertyPanel* AlignmentPropertyPanel::Create (
350*b1cdbd2cSJim Jagielski Window* pParent,
351*b1cdbd2cSJim Jagielski const cssu::Reference<css::frame::XFrame>& rxFrame,
352*b1cdbd2cSJim Jagielski SfxBindings* pBindings)
353*b1cdbd2cSJim Jagielski {
354*b1cdbd2cSJim Jagielski if (pParent == NULL)
355*b1cdbd2cSJim Jagielski throw lang::IllegalArgumentException(A2S("no parent Window given to AlignmentPropertyPanel::Create"), NULL, 0);
356*b1cdbd2cSJim Jagielski if ( ! rxFrame.is())
357*b1cdbd2cSJim Jagielski throw lang::IllegalArgumentException(A2S("no XFrame given to AlignmentPropertyPanel::Create"), NULL, 1);
358*b1cdbd2cSJim Jagielski if (pBindings == NULL)
359*b1cdbd2cSJim Jagielski throw lang::IllegalArgumentException(A2S("no SfxBindings given to AlignmentPropertyPanel::Create"), NULL, 2);
360*b1cdbd2cSJim Jagielski
361*b1cdbd2cSJim Jagielski return new AlignmentPropertyPanel(
362*b1cdbd2cSJim Jagielski pParent,
363*b1cdbd2cSJim Jagielski rxFrame,
364*b1cdbd2cSJim Jagielski pBindings);
365*b1cdbd2cSJim Jagielski }
366*b1cdbd2cSJim Jagielski
367*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
368*b1cdbd2cSJim Jagielski
DataChanged(const DataChangedEvent & rEvent)369*b1cdbd2cSJim Jagielski void AlignmentPropertyPanel::DataChanged(
370*b1cdbd2cSJim Jagielski const DataChangedEvent& rEvent)
371*b1cdbd2cSJim Jagielski {
372*b1cdbd2cSJim Jagielski (void)rEvent;
373*b1cdbd2cSJim Jagielski }
374*b1cdbd2cSJim Jagielski
375*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
376*b1cdbd2cSJim Jagielski
HandleContextChange(const::sfx2::sidebar::EnumContext aContext)377*b1cdbd2cSJim Jagielski void AlignmentPropertyPanel::HandleContextChange(
378*b1cdbd2cSJim Jagielski const ::sfx2::sidebar::EnumContext aContext)
379*b1cdbd2cSJim Jagielski {
380*b1cdbd2cSJim Jagielski if(maContext == aContext)
381*b1cdbd2cSJim Jagielski {
382*b1cdbd2cSJim Jagielski // Nothing to do.
383*b1cdbd2cSJim Jagielski return;
384*b1cdbd2cSJim Jagielski }
385*b1cdbd2cSJim Jagielski
386*b1cdbd2cSJim Jagielski maContext = aContext;
387*b1cdbd2cSJim Jagielski
388*b1cdbd2cSJim Jagielski
389*b1cdbd2cSJim Jagielski
390*b1cdbd2cSJim Jagielski // todo
391*b1cdbd2cSJim Jagielski }
392*b1cdbd2cSJim Jagielski
393*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
394*b1cdbd2cSJim Jagielski
NotifyItemUpdate(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState,const bool bIsEnabled)395*b1cdbd2cSJim Jagielski void AlignmentPropertyPanel::NotifyItemUpdate(
396*b1cdbd2cSJim Jagielski sal_uInt16 nSID,
397*b1cdbd2cSJim Jagielski SfxItemState eState,
398*b1cdbd2cSJim Jagielski const SfxPoolItem* pState,
399*b1cdbd2cSJim Jagielski const bool bIsEnabled)
400*b1cdbd2cSJim Jagielski {
401*b1cdbd2cSJim Jagielski (void)bIsEnabled;
402*b1cdbd2cSJim Jagielski
403*b1cdbd2cSJim Jagielski switch(nSID)
404*b1cdbd2cSJim Jagielski {
405*b1cdbd2cSJim Jagielski case SID_H_ALIGNCELL:
406*b1cdbd2cSJim Jagielski if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxHorJustifyItem) )
407*b1cdbd2cSJim Jagielski {
408*b1cdbd2cSJim Jagielski const SvxHorJustifyItem* pItem = (const SvxHorJustifyItem*)pState;
409*b1cdbd2cSJim Jagielski meHorAlignState = (SvxCellHorJustify)pItem->GetValue();
410*b1cdbd2cSJim Jagielski }
411*b1cdbd2cSJim Jagielski else
412*b1cdbd2cSJim Jagielski {
413*b1cdbd2cSJim Jagielski meHorAlignState = SVX_HOR_JUSTIFY_STANDARD;
414*b1cdbd2cSJim Jagielski }
415*b1cdbd2cSJim Jagielski UpdateHorAlign();
416*b1cdbd2cSJim Jagielski break;
417*b1cdbd2cSJim Jagielski case SID_V_ALIGNCELL:
418*b1cdbd2cSJim Jagielski if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxVerJustifyItem) )
419*b1cdbd2cSJim Jagielski {
420*b1cdbd2cSJim Jagielski const SvxVerJustifyItem* pItem = (const SvxVerJustifyItem*)pState;
421*b1cdbd2cSJim Jagielski meVerAlignState = (SvxCellVerJustify)pItem->GetValue();
422*b1cdbd2cSJim Jagielski }
423*b1cdbd2cSJim Jagielski else
424*b1cdbd2cSJim Jagielski {
425*b1cdbd2cSJim Jagielski meVerAlignState = SVX_VER_JUSTIFY_STANDARD;
426*b1cdbd2cSJim Jagielski }
427*b1cdbd2cSJim Jagielski UpdateVerAlign();
428*b1cdbd2cSJim Jagielski break;
429*b1cdbd2cSJim Jagielski case SID_ATTR_ALIGN_INDENT:
430*b1cdbd2cSJim Jagielski if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxUInt16Item) )
431*b1cdbd2cSJim Jagielski {
432*b1cdbd2cSJim Jagielski const SfxUInt16Item* pItem = (const SfxUInt16Item*)pState;
433*b1cdbd2cSJim Jagielski sal_uInt16 nVal = pItem->GetValue();
434*b1cdbd2cSJim Jagielski mpMFLeftIndent->SetValue( CalcToPoint(nVal, SFX_MAPUNIT_TWIP, 1) );
435*b1cdbd2cSJim Jagielski }
436*b1cdbd2cSJim Jagielski else
437*b1cdbd2cSJim Jagielski {
438*b1cdbd2cSJim Jagielski mpMFLeftIndent->SetValue(0);
439*b1cdbd2cSJim Jagielski mpMFLeftIndent->SetText(String());
440*b1cdbd2cSJim Jagielski }
441*b1cdbd2cSJim Jagielski break;
442*b1cdbd2cSJim Jagielski case FID_MERGE_TOGGLE:
443*b1cdbd2cSJim Jagielski if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxBoolItem) )
444*b1cdbd2cSJim Jagielski {
445*b1cdbd2cSJim Jagielski mpCBXMergeCell->Enable();
446*b1cdbd2cSJim Jagielski const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
447*b1cdbd2cSJim Jagielski bool bVal = pItem->GetValue();
448*b1cdbd2cSJim Jagielski if(bVal)
449*b1cdbd2cSJim Jagielski mpCBXMergeCell->Check(true);
450*b1cdbd2cSJim Jagielski else
451*b1cdbd2cSJim Jagielski mpCBXMergeCell->Check(false);
452*b1cdbd2cSJim Jagielski }
453*b1cdbd2cSJim Jagielski else
454*b1cdbd2cSJim Jagielski {
455*b1cdbd2cSJim Jagielski mpCBXMergeCell->Check(false);
456*b1cdbd2cSJim Jagielski mpCBXMergeCell->Disable();
457*b1cdbd2cSJim Jagielski }
458*b1cdbd2cSJim Jagielski break;
459*b1cdbd2cSJim Jagielski
460*b1cdbd2cSJim Jagielski case SID_ATTR_ALIGN_LINEBREAK:
461*b1cdbd2cSJim Jagielski if(eState == SFX_ITEM_DISABLED)
462*b1cdbd2cSJim Jagielski {
463*b1cdbd2cSJim Jagielski mpCBXWrapText->EnableTriState(false);
464*b1cdbd2cSJim Jagielski mpCBXWrapText->Check(false);
465*b1cdbd2cSJim Jagielski mpCBXWrapText->Disable();
466*b1cdbd2cSJim Jagielski }
467*b1cdbd2cSJim Jagielski else
468*b1cdbd2cSJim Jagielski {
469*b1cdbd2cSJim Jagielski mpCBXWrapText->Enable();
470*b1cdbd2cSJim Jagielski if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxBoolItem) )
471*b1cdbd2cSJim Jagielski {
472*b1cdbd2cSJim Jagielski mpCBXWrapText->EnableTriState(false);
473*b1cdbd2cSJim Jagielski const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
474*b1cdbd2cSJim Jagielski bool bVal = pItem->GetValue();
475*b1cdbd2cSJim Jagielski if(bVal)
476*b1cdbd2cSJim Jagielski mpCBXWrapText->Check(true);
477*b1cdbd2cSJim Jagielski else
478*b1cdbd2cSJim Jagielski mpCBXWrapText->Check(false);
479*b1cdbd2cSJim Jagielski }
480*b1cdbd2cSJim Jagielski else if(eState == SFX_ITEM_DONTCARE)
481*b1cdbd2cSJim Jagielski {
482*b1cdbd2cSJim Jagielski mpCBXWrapText->EnableTriState(true);
483*b1cdbd2cSJim Jagielski mpCBXWrapText->SetState(STATE_DONTKNOW);
484*b1cdbd2cSJim Jagielski }
485*b1cdbd2cSJim Jagielski }
486*b1cdbd2cSJim Jagielski break;
487*b1cdbd2cSJim Jagielski case SID_ATTR_ALIGN_DEGREES:
488*b1cdbd2cSJim Jagielski if (eState >= SFX_ITEM_AVAILABLE)
489*b1cdbd2cSJim Jagielski {
490*b1cdbd2cSJim Jagielski long nTmp = ((const SfxInt32Item*)pState)->GetValue();
491*b1cdbd2cSJim Jagielski mpMtrAngle->SetValue( nTmp / 100); //wj
492*b1cdbd2cSJim Jagielski mpCtrlDial->SetRotation( nTmp );
493*b1cdbd2cSJim Jagielski switch(nTmp)
494*b1cdbd2cSJim Jagielski {
495*b1cdbd2cSJim Jagielski case 0:
496*b1cdbd2cSJim Jagielski mpMtrAngle->SelectEntryPos(0);
497*b1cdbd2cSJim Jagielski break;
498*b1cdbd2cSJim Jagielski case 4500:
499*b1cdbd2cSJim Jagielski mpMtrAngle->SelectEntryPos(1);
500*b1cdbd2cSJim Jagielski break;
501*b1cdbd2cSJim Jagielski case 9000:
502*b1cdbd2cSJim Jagielski mpMtrAngle->SelectEntryPos(2);
503*b1cdbd2cSJim Jagielski break;
504*b1cdbd2cSJim Jagielski case 13500:
505*b1cdbd2cSJim Jagielski mpMtrAngle->SelectEntryPos(3);
506*b1cdbd2cSJim Jagielski break;
507*b1cdbd2cSJim Jagielski case 18000:
508*b1cdbd2cSJim Jagielski mpMtrAngle->SelectEntryPos(4);
509*b1cdbd2cSJim Jagielski break;
510*b1cdbd2cSJim Jagielski case 22500:
511*b1cdbd2cSJim Jagielski mpMtrAngle->SelectEntryPos(5);
512*b1cdbd2cSJim Jagielski break;
513*b1cdbd2cSJim Jagielski case 27000:
514*b1cdbd2cSJim Jagielski mpMtrAngle->SelectEntryPos(6);
515*b1cdbd2cSJim Jagielski break;
516*b1cdbd2cSJim Jagielski case 31500:
517*b1cdbd2cSJim Jagielski mpMtrAngle->SelectEntryPos(7);
518*b1cdbd2cSJim Jagielski }
519*b1cdbd2cSJim Jagielski }
520*b1cdbd2cSJim Jagielski else
521*b1cdbd2cSJim Jagielski {
522*b1cdbd2cSJim Jagielski mpMtrAngle->SetText( String() );
523*b1cdbd2cSJim Jagielski mpCtrlDial->SetRotation( 0 );
524*b1cdbd2cSJim Jagielski }
525*b1cdbd2cSJim Jagielski break;
526*b1cdbd2cSJim Jagielski case SID_ATTR_ALIGN_STACKED:
527*b1cdbd2cSJim Jagielski if (eState >= SFX_ITEM_AVAILABLE)
528*b1cdbd2cSJim Jagielski {
529*b1cdbd2cSJim Jagielski mpCbStacked->EnableTriState(false);
530*b1cdbd2cSJim Jagielski const SfxBoolItem* aStackItem = (const SfxBoolItem*)pState;
531*b1cdbd2cSJim Jagielski bool IsChecked = (bool)aStackItem->GetValue();
532*b1cdbd2cSJim Jagielski if(IsChecked)
533*b1cdbd2cSJim Jagielski {
534*b1cdbd2cSJim Jagielski mpCbStacked->Check(IsChecked);
535*b1cdbd2cSJim Jagielski mpFtRotate->Disable();
536*b1cdbd2cSJim Jagielski mpMtrAngle->Disable();
537*b1cdbd2cSJim Jagielski mpCtrlDial->Disable();
538*b1cdbd2cSJim Jagielski mbMultiDisable = true;
539*b1cdbd2cSJim Jagielski }
540*b1cdbd2cSJim Jagielski else
541*b1cdbd2cSJim Jagielski {
542*b1cdbd2cSJim Jagielski mpCbStacked->Check(IsChecked);
543*b1cdbd2cSJim Jagielski mpFtRotate->Enable();
544*b1cdbd2cSJim Jagielski mpMtrAngle->Enable();
545*b1cdbd2cSJim Jagielski mpCtrlDial->Enable();
546*b1cdbd2cSJim Jagielski mbMultiDisable = false;
547*b1cdbd2cSJim Jagielski }
548*b1cdbd2cSJim Jagielski }
549*b1cdbd2cSJim Jagielski else
550*b1cdbd2cSJim Jagielski {
551*b1cdbd2cSJim Jagielski mbMultiDisable = true;
552*b1cdbd2cSJim Jagielski mpFtRotate->Disable();
553*b1cdbd2cSJim Jagielski mpMtrAngle->Disable();
554*b1cdbd2cSJim Jagielski mpCtrlDial->Disable();
555*b1cdbd2cSJim Jagielski mpCbStacked->EnableTriState(true);
556*b1cdbd2cSJim Jagielski mpCbStacked->SetState(STATE_DONTKNOW);
557*b1cdbd2cSJim Jagielski }
558*b1cdbd2cSJim Jagielski }
559*b1cdbd2cSJim Jagielski }
560*b1cdbd2cSJim Jagielski
561*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
562*b1cdbd2cSJim Jagielski
GetBindings()563*b1cdbd2cSJim Jagielski SfxBindings* AlignmentPropertyPanel::GetBindings()
564*b1cdbd2cSJim Jagielski {
565*b1cdbd2cSJim Jagielski return mpBindings;
566*b1cdbd2cSJim Jagielski }
567*b1cdbd2cSJim Jagielski
568*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
569*b1cdbd2cSJim Jagielski
FormatDegrees(double & dTmp)570*b1cdbd2cSJim Jagielski void AlignmentPropertyPanel::FormatDegrees(double& dTmp)
571*b1cdbd2cSJim Jagielski {
572*b1cdbd2cSJim Jagielski while(dTmp<0)
573*b1cdbd2cSJim Jagielski dTmp += 360;
574*b1cdbd2cSJim Jagielski while (dTmp > 359) //modify
575*b1cdbd2cSJim Jagielski dTmp = 359;
576*b1cdbd2cSJim Jagielski }
577*b1cdbd2cSJim Jagielski
578*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
579*b1cdbd2cSJim Jagielski
UpdateHorAlign()580*b1cdbd2cSJim Jagielski void AlignmentPropertyPanel::UpdateHorAlign()
581*b1cdbd2cSJim Jagielski {
582*b1cdbd2cSJim Jagielski mpTBHorizontal->SetItemState(ID_SUBSTLEFT, STATE_NOCHECK);
583*b1cdbd2cSJim Jagielski mpTBHorizontal->SetItemState(ID_SUBSTCENTER, STATE_NOCHECK);
584*b1cdbd2cSJim Jagielski mpTBHorizontal->SetItemState(ID_SUBSTRIGHT, STATE_NOCHECK);
585*b1cdbd2cSJim Jagielski mpTBHorizontal->SetItemState(ID_SUBSTJUSTIFY,STATE_NOCHECK);
586*b1cdbd2cSJim Jagielski mpFTLeftIndent->Disable();
587*b1cdbd2cSJim Jagielski mpMFLeftIndent->Disable();
588*b1cdbd2cSJim Jagielski if(meHorAlignState==SVX_HOR_JUSTIFY_REPEAT)
589*b1cdbd2cSJim Jagielski {
590*b1cdbd2cSJim Jagielski mpFtRotate->Disable();
591*b1cdbd2cSJim Jagielski mpCtrlDial->Disable();
592*b1cdbd2cSJim Jagielski mpMtrAngle->Disable();
593*b1cdbd2cSJim Jagielski mpCbStacked->Disable();
594*b1cdbd2cSJim Jagielski }
595*b1cdbd2cSJim Jagielski else
596*b1cdbd2cSJim Jagielski {
597*b1cdbd2cSJim Jagielski if(!mbMultiDisable)
598*b1cdbd2cSJim Jagielski {
599*b1cdbd2cSJim Jagielski mpFtRotate->Enable();
600*b1cdbd2cSJim Jagielski mpCtrlDial->Enable();
601*b1cdbd2cSJim Jagielski mpMtrAngle->Enable();
602*b1cdbd2cSJim Jagielski }
603*b1cdbd2cSJim Jagielski else
604*b1cdbd2cSJim Jagielski {
605*b1cdbd2cSJim Jagielski mpFtRotate->Disable();
606*b1cdbd2cSJim Jagielski mpCtrlDial->Disable();
607*b1cdbd2cSJim Jagielski mpMtrAngle->Disable();
608*b1cdbd2cSJim Jagielski }
609*b1cdbd2cSJim Jagielski mpCbStacked->Enable();
610*b1cdbd2cSJim Jagielski }
611*b1cdbd2cSJim Jagielski switch(meHorAlignState)
612*b1cdbd2cSJim Jagielski {
613*b1cdbd2cSJim Jagielski case SVX_HOR_JUSTIFY_LEFT:
614*b1cdbd2cSJim Jagielski mpTBHorizontal->SetItemState(ID_SUBSTLEFT, STATE_CHECK);
615*b1cdbd2cSJim Jagielski mpFTLeftIndent->Enable();
616*b1cdbd2cSJim Jagielski mpMFLeftIndent->Enable();
617*b1cdbd2cSJim Jagielski break;
618*b1cdbd2cSJim Jagielski case SVX_HOR_JUSTIFY_CENTER:mpTBHorizontal->SetItemState(ID_SUBSTCENTER, STATE_CHECK);break;
619*b1cdbd2cSJim Jagielski case SVX_HOR_JUSTIFY_RIGHT: mpTBHorizontal->SetItemState(ID_SUBSTRIGHT, STATE_CHECK);break;
620*b1cdbd2cSJim Jagielski case SVX_HOR_JUSTIFY_BLOCK: mpTBHorizontal->SetItemState(ID_SUBSTJUSTIFY,STATE_CHECK);break;
621*b1cdbd2cSJim Jagielski default:;
622*b1cdbd2cSJim Jagielski }
623*b1cdbd2cSJim Jagielski }
624*b1cdbd2cSJim Jagielski
625*b1cdbd2cSJim Jagielski //////////////////////////////////////////////////////////////////////////////
626*b1cdbd2cSJim Jagielski
UpdateVerAlign()627*b1cdbd2cSJim Jagielski void AlignmentPropertyPanel::UpdateVerAlign()
628*b1cdbd2cSJim Jagielski {
629*b1cdbd2cSJim Jagielski mpTBVertical->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
630*b1cdbd2cSJim Jagielski mpTBVertical->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
631*b1cdbd2cSJim Jagielski mpTBVertical->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
632*b1cdbd2cSJim Jagielski
633*b1cdbd2cSJim Jagielski switch(meVerAlignState)
634*b1cdbd2cSJim Jagielski {
635*b1cdbd2cSJim Jagielski case SVX_VER_JUSTIFY_TOP: mpTBVertical->SetItemState(IID_VERT_TOP, STATE_CHECK);break;
636*b1cdbd2cSJim Jagielski case SVX_VER_JUSTIFY_CENTER:mpTBVertical->SetItemState(IID_VERT_CENTER, STATE_CHECK);break;
637*b1cdbd2cSJim Jagielski case SVX_VER_JUSTIFY_BOTTOM: mpTBVertical->SetItemState(IID_VERT_BOTTOM, STATE_CHECK);break;
638*b1cdbd2cSJim Jagielski default:;
639*b1cdbd2cSJim Jagielski }
640*b1cdbd2cSJim Jagielski }
641*b1cdbd2cSJim Jagielski
642*b1cdbd2cSJim Jagielski
643*b1cdbd2cSJim Jagielski
644*b1cdbd2cSJim Jagielski
Resize(void)645*b1cdbd2cSJim Jagielski void AlignmentPropertyPanel::Resize (void)
646*b1cdbd2cSJim Jagielski {
647*b1cdbd2cSJim Jagielski const sal_Int32 nRight (GetSizePixel().Width() - Layouter::MapWidth(*this, TB_BORDER));
648*b1cdbd2cSJim Jagielski Layouter::SetRight(*mpFtRotate, nRight);
649*b1cdbd2cSJim Jagielski Layouter::SetRight(*mpCBXWrapText, nRight);
650*b1cdbd2cSJim Jagielski Layouter::SetRight(*mpCBXMergeCell, nRight);
651*b1cdbd2cSJim Jagielski Layouter::SetRight(*mpCbStacked, nRight);
652*b1cdbd2cSJim Jagielski }
653*b1cdbd2cSJim Jagielski
654*b1cdbd2cSJim Jagielski
655*b1cdbd2cSJim Jagielski }} // end of namespace ::sc::sidebar
656