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