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; 4137fee4fdSAndre 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) 5637fee4fdSAndre Fischer : Control( 57facb16e7SArmin Le Grand pParent, 5837fee4fdSAndre Fischer ScResId(RID_PROPERTYPANEL_SC_ALIGNMENT)), 5937fee4fdSAndre Fischer mpTBHorizontalBackground(ControlFactory::CreateToolBoxBackground(this)), 6037fee4fdSAndre Fischer mpTBHorizontal(ControlFactory::CreateToolBox( 6137fee4fdSAndre Fischer mpTBHorizontalBackground.get(), 6237fee4fdSAndre Fischer ScResId(TBX_HORIZONTAL_ALIGNMENT))), 6337fee4fdSAndre Fischer mpTBVerticalBackground(ControlFactory::CreateToolBoxBackground(this)), 6437fee4fdSAndre Fischer mpTBVertical(ControlFactory::CreateToolBox( 6537fee4fdSAndre Fischer mpTBVerticalBackground.get(), 6637fee4fdSAndre Fischer ScResId(TBX_VERTICAL_ALIGN))), 6737fee4fdSAndre Fischer mpFTLeftIndent(new FixedText(this, ScResId(FT_LEFT_INDENT))), 6837fee4fdSAndre Fischer mpMFLeftIndent(new MetricField(this, ScResId(MF_LEFT_INDENT))), 6937fee4fdSAndre Fischer mpCBXWrapText(new CheckBox(this, ScResId(CBX_WRAP))), 7037fee4fdSAndre Fischer mpCBXMergeCell(new CheckBox(this, ScResId(CBX_MERGE))), 7137fee4fdSAndre Fischer mpFtRotate(new FixedText(this, ScResId(FT_ORIENT))), 7237fee4fdSAndre Fischer mpCtrlDial(new svx::sidebar::SidebarDialControl(this, ScResId(DIAL_CONTROL))), // , true)), 7337fee4fdSAndre Fischer mpMtrAngle(new MetricBox(this, ScResId(CBOX_ANGLE))), 7437fee4fdSAndre Fischer mpCbStacked(new CheckBox(this, ScResId(CBX_VERT))), 7537fee4fdSAndre Fischer maAlignHorControl(SID_H_ALIGNCELL, *pBindings, *this), 7637fee4fdSAndre Fischer maAlignVerControl(SID_V_ALIGNCELL, *pBindings, *this), 7737fee4fdSAndre Fischer maLeftIndentControl(SID_ATTR_ALIGN_INDENT, *pBindings, *this), 7837fee4fdSAndre Fischer maMergeCellControl(FID_MERGE_TOGGLE, *pBindings, *this), 7937fee4fdSAndre Fischer maWrapTextControl(SID_ATTR_ALIGN_LINEBREAK, *pBindings, *this), 8037fee4fdSAndre Fischer maAngleControl(SID_ATTR_ALIGN_DEGREES, *pBindings, *this), 8137fee4fdSAndre Fischer maStackControl(SID_ATTR_ALIGN_STACKED, *pBindings, *this), 8237fee4fdSAndre Fischer maIMGAlignLeft(ScResId(IMG_ALIGN_LEFT)), 8337fee4fdSAndre Fischer maIMGAlignCenter(ScResId(IMG_ALIGN_CENTER)), 8437fee4fdSAndre Fischer maIMGAlignRight(ScResId(IMG_ALIGN_RIGHT)), 8537fee4fdSAndre Fischer maIMGAlignJust(ScResId(IMG_ALIGN_JUST)), 8637fee4fdSAndre Fischer maIMGAlignTop(ScResId(IMG_ALIGN_TOP)), 8737fee4fdSAndre Fischer maIMGAlignCenterV(ScResId(IMG_ALIGN_CENTER_V)), 8837fee4fdSAndre Fischer maIMGAlignBottom(ScResId(IMG_ALIGN_BOTTOM)), 8937fee4fdSAndre Fischer meHorAlignState(SVX_HOR_JUSTIFY_STANDARD), 9037fee4fdSAndre Fischer meVerAlignState(SVX_VER_JUSTIFY_STANDARD), 9137fee4fdSAndre Fischer mbMultiDisable(false), 9237fee4fdSAndre Fischer mxFrame(rxFrame), 9337fee4fdSAndre Fischer maContext(), 9437fee4fdSAndre Fischer mpBindings(pBindings) 95facb16e7SArmin Le Grand { 96facb16e7SArmin Le Grand Initialize(); 97facb16e7SArmin Le Grand FreeResource(); 9837fee4fdSAndre Fischer 9937fee4fdSAndre Fischer mpFTLeftIndent->SetBackground(Wallpaper()); 10037fee4fdSAndre 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, 389*45da7d5eSAndre Fischer const SfxPoolItem* pState, 390*45da7d5eSAndre Fischer const bool bIsEnabled) 391facb16e7SArmin Le Grand { 392*45da7d5eSAndre Fischer (void)bIsEnabled; 393*45da7d5eSAndre Fischer 394facb16e7SArmin Le Grand switch(nSID) 395facb16e7SArmin Le Grand { 396facb16e7SArmin Le Grand case SID_H_ALIGNCELL: 397facb16e7SArmin Le Grand if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxHorJustifyItem) ) 398facb16e7SArmin Le Grand { 399facb16e7SArmin Le Grand const SvxHorJustifyItem* pItem = (const SvxHorJustifyItem*)pState; 400facb16e7SArmin Le Grand meHorAlignState = (SvxCellHorJustify)pItem->GetValue(); 401facb16e7SArmin Le Grand } 402facb16e7SArmin Le Grand else 403facb16e7SArmin Le Grand { 404facb16e7SArmin Le Grand meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; 405facb16e7SArmin Le Grand } 406facb16e7SArmin Le Grand UpdateHorAlign(); 407facb16e7SArmin Le Grand break; 408facb16e7SArmin Le Grand case SID_V_ALIGNCELL: 409facb16e7SArmin Le Grand if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxVerJustifyItem) ) 410facb16e7SArmin Le Grand { 411facb16e7SArmin Le Grand const SvxVerJustifyItem* pItem = (const SvxVerJustifyItem*)pState; 412facb16e7SArmin Le Grand meVerAlignState = (SvxCellVerJustify)pItem->GetValue(); 413facb16e7SArmin Le Grand } 414facb16e7SArmin Le Grand else 415facb16e7SArmin Le Grand { 416facb16e7SArmin Le Grand meVerAlignState = SVX_VER_JUSTIFY_STANDARD; 417facb16e7SArmin Le Grand } 418facb16e7SArmin Le Grand UpdateVerAlign(); 419facb16e7SArmin Le Grand break; 420facb16e7SArmin Le Grand case SID_ATTR_ALIGN_INDENT: 421facb16e7SArmin Le Grand if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxUInt16Item) ) 422facb16e7SArmin Le Grand { 423facb16e7SArmin Le Grand const SfxUInt16Item* pItem = (const SfxUInt16Item*)pState; 424facb16e7SArmin Le Grand sal_uInt16 nVal = pItem->GetValue(); 425facb16e7SArmin Le Grand mpMFLeftIndent->SetValue( CalcToPoint(nVal, SFX_MAPUNIT_TWIP, 1) ); 426facb16e7SArmin Le Grand } 427facb16e7SArmin Le Grand else 428facb16e7SArmin Le Grand { 429facb16e7SArmin Le Grand mpMFLeftIndent->SetValue(0); 430facb16e7SArmin Le Grand mpMFLeftIndent->SetText(String()); 431facb16e7SArmin Le Grand } 432facb16e7SArmin Le Grand break; 433facb16e7SArmin Le Grand case FID_MERGE_TOGGLE: 434facb16e7SArmin Le Grand if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxBoolItem) ) 435facb16e7SArmin Le Grand { 436facb16e7SArmin Le Grand mpCBXMergeCell->Enable(); 437facb16e7SArmin Le Grand const SfxBoolItem* pItem = (const SfxBoolItem*)pState; 438facb16e7SArmin Le Grand bool bVal = pItem->GetValue(); 439facb16e7SArmin Le Grand if(bVal) 440facb16e7SArmin Le Grand mpCBXMergeCell->Check(true); 441facb16e7SArmin Le Grand else 442facb16e7SArmin Le Grand mpCBXMergeCell->Check(false); 443facb16e7SArmin Le Grand } 444facb16e7SArmin Le Grand else 445facb16e7SArmin Le Grand { 446facb16e7SArmin Le Grand mpCBXMergeCell->Check(false); 447facb16e7SArmin Le Grand mpCBXMergeCell->Disable(); 448facb16e7SArmin Le Grand } 449facb16e7SArmin Le Grand break; 450facb16e7SArmin Le Grand 451facb16e7SArmin Le Grand case SID_ATTR_ALIGN_LINEBREAK: 452facb16e7SArmin Le Grand if(eState == SFX_ITEM_DISABLED) 453facb16e7SArmin Le Grand { 454facb16e7SArmin Le Grand mpCBXWrapText->EnableTriState(false); 455facb16e7SArmin Le Grand mpCBXWrapText->Check(false); 456facb16e7SArmin Le Grand mpCBXWrapText->Disable(); 457facb16e7SArmin Le Grand } 458facb16e7SArmin Le Grand else 459facb16e7SArmin Le Grand { 460facb16e7SArmin Le Grand mpCBXWrapText->Enable(); 461facb16e7SArmin Le Grand if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxBoolItem) ) 462facb16e7SArmin Le Grand { 463facb16e7SArmin Le Grand mpCBXWrapText->EnableTriState(false); 464facb16e7SArmin Le Grand const SfxBoolItem* pItem = (const SfxBoolItem*)pState; 465facb16e7SArmin Le Grand bool bVal = pItem->GetValue(); 466facb16e7SArmin Le Grand if(bVal) 467facb16e7SArmin Le Grand mpCBXWrapText->Check(true); 468facb16e7SArmin Le Grand else 469facb16e7SArmin Le Grand mpCBXWrapText->Check(false); 470facb16e7SArmin Le Grand } 471facb16e7SArmin Le Grand else if(eState == SFX_ITEM_DONTCARE) 472facb16e7SArmin Le Grand { 473facb16e7SArmin Le Grand mpCBXWrapText->EnableTriState(true); 474facb16e7SArmin Le Grand mpCBXWrapText->SetState(STATE_DONTKNOW); 475facb16e7SArmin Le Grand } 476facb16e7SArmin Le Grand } 477facb16e7SArmin Le Grand break; 478facb16e7SArmin Le Grand case SID_ATTR_ALIGN_DEGREES: 479facb16e7SArmin Le Grand if (eState >= SFX_ITEM_AVAILABLE) 480facb16e7SArmin Le Grand { 481facb16e7SArmin Le Grand long nTmp = ((const SfxInt32Item*)pState)->GetValue(); 482facb16e7SArmin Le Grand mpMtrAngle->SetValue( nTmp / 100); //wj 483facb16e7SArmin Le Grand mpCtrlDial->SetRotation( nTmp ); 484facb16e7SArmin Le Grand switch(nTmp) 485facb16e7SArmin Le Grand { 486facb16e7SArmin Le Grand case 0: 487facb16e7SArmin Le Grand mpMtrAngle->SelectEntryPos(0); 488facb16e7SArmin Le Grand break; 489facb16e7SArmin Le Grand case 4500: 490facb16e7SArmin Le Grand mpMtrAngle->SelectEntryPos(1); 491facb16e7SArmin Le Grand break; 492facb16e7SArmin Le Grand case 9000: 493facb16e7SArmin Le Grand mpMtrAngle->SelectEntryPos(2); 494facb16e7SArmin Le Grand break; 495facb16e7SArmin Le Grand case 13500: 496facb16e7SArmin Le Grand mpMtrAngle->SelectEntryPos(3); 497facb16e7SArmin Le Grand break; 498facb16e7SArmin Le Grand case 18000: 499facb16e7SArmin Le Grand mpMtrAngle->SelectEntryPos(4); 500facb16e7SArmin Le Grand break; 501facb16e7SArmin Le Grand case 22500: 502facb16e7SArmin Le Grand mpMtrAngle->SelectEntryPos(5); 503facb16e7SArmin Le Grand break; 504facb16e7SArmin Le Grand case 27000: 505facb16e7SArmin Le Grand mpMtrAngle->SelectEntryPos(6); 506facb16e7SArmin Le Grand break; 507facb16e7SArmin Le Grand case 31500: 508facb16e7SArmin Le Grand mpMtrAngle->SelectEntryPos(7); 509facb16e7SArmin Le Grand } 510facb16e7SArmin Le Grand } 511facb16e7SArmin Le Grand else 512facb16e7SArmin Le Grand { 513facb16e7SArmin Le Grand mpMtrAngle->SetText( String() ); 514facb16e7SArmin Le Grand mpCtrlDial->SetRotation( 0 ); 515facb16e7SArmin Le Grand } 516facb16e7SArmin Le Grand break; 517facb16e7SArmin Le Grand case SID_ATTR_ALIGN_STACKED: 518facb16e7SArmin Le Grand if (eState >= SFX_ITEM_AVAILABLE) 519facb16e7SArmin Le Grand { 520facb16e7SArmin Le Grand mpCbStacked->EnableTriState(false); 521facb16e7SArmin Le Grand const SfxBoolItem* aStackItem = (const SfxBoolItem*)pState; 522facb16e7SArmin Le Grand bool IsChecked = (bool)aStackItem->GetValue(); 523facb16e7SArmin Le Grand if(IsChecked) 524facb16e7SArmin Le Grand { 525facb16e7SArmin Le Grand mpCbStacked->Check(IsChecked); 526facb16e7SArmin Le Grand mpFtRotate->Disable(); 527facb16e7SArmin Le Grand mpMtrAngle->Disable(); 528facb16e7SArmin Le Grand mpCtrlDial->Disable(); 529facb16e7SArmin Le Grand mbMultiDisable = true; 530facb16e7SArmin Le Grand } 531facb16e7SArmin Le Grand else 532facb16e7SArmin Le Grand { 533facb16e7SArmin Le Grand mpCbStacked->Check(IsChecked); 534facb16e7SArmin Le Grand mpFtRotate->Enable(); 535facb16e7SArmin Le Grand mpMtrAngle->Enable(); 536facb16e7SArmin Le Grand mpCtrlDial->Enable(); 537facb16e7SArmin Le Grand mbMultiDisable = false; 538facb16e7SArmin Le Grand } 539facb16e7SArmin Le Grand } 540facb16e7SArmin Le Grand else 541facb16e7SArmin Le Grand { 542facb16e7SArmin Le Grand mbMultiDisable = true; 543facb16e7SArmin Le Grand mpFtRotate->Disable(); 544facb16e7SArmin Le Grand mpMtrAngle->Disable(); 545facb16e7SArmin Le Grand mpCtrlDial->Disable(); 546facb16e7SArmin Le Grand mpCbStacked->EnableTriState(true); 547facb16e7SArmin Le Grand mpCbStacked->SetState(STATE_DONTKNOW); 548facb16e7SArmin Le Grand } 549facb16e7SArmin Le Grand } 550facb16e7SArmin Le Grand } 551facb16e7SArmin Le Grand 552facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 553facb16e7SArmin Le Grand 554facb16e7SArmin Le Grand SfxBindings* AlignmentPropertyPanel::GetBindings() 555facb16e7SArmin Le Grand { 556facb16e7SArmin Le Grand return mpBindings; 557facb16e7SArmin Le Grand } 558facb16e7SArmin Le Grand 559facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 560facb16e7SArmin Le Grand 561facb16e7SArmin Le Grand void AlignmentPropertyPanel::FormatDegrees(double& dTmp) 562facb16e7SArmin Le Grand { 563facb16e7SArmin Le Grand while(dTmp<0) 564facb16e7SArmin Le Grand dTmp += 360; 565facb16e7SArmin Le Grand while (dTmp > 359) //modify 566facb16e7SArmin Le Grand dTmp = 359; 567facb16e7SArmin Le Grand } 568facb16e7SArmin Le Grand 569facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 570facb16e7SArmin Le Grand 571facb16e7SArmin Le Grand void AlignmentPropertyPanel::UpdateHorAlign() 572facb16e7SArmin Le Grand { 573facb16e7SArmin Le Grand mpTBHorizontal->SetItemState(ID_SUBSTLEFT, STATE_NOCHECK); 574facb16e7SArmin Le Grand mpTBHorizontal->SetItemState(ID_SUBSTCENTER, STATE_NOCHECK); 575facb16e7SArmin Le Grand mpTBHorizontal->SetItemState(ID_SUBSTRIGHT, STATE_NOCHECK); 576facb16e7SArmin Le Grand mpTBHorizontal->SetItemState(ID_SUBSTJUSTIFY,STATE_NOCHECK); 577facb16e7SArmin Le Grand mpFTLeftIndent->Disable(); 578facb16e7SArmin Le Grand mpMFLeftIndent->Disable(); 579facb16e7SArmin Le Grand if(meHorAlignState==SVX_HOR_JUSTIFY_REPEAT) 580facb16e7SArmin Le Grand { 581facb16e7SArmin Le Grand mpFtRotate->Disable(); 582facb16e7SArmin Le Grand mpCtrlDial->Disable(); 583facb16e7SArmin Le Grand mpMtrAngle->Disable(); 584facb16e7SArmin Le Grand mpCbStacked->Disable(); 585facb16e7SArmin Le Grand } 586facb16e7SArmin Le Grand else 587facb16e7SArmin Le Grand { 588facb16e7SArmin Le Grand if(!mbMultiDisable) 589facb16e7SArmin Le Grand { 590facb16e7SArmin Le Grand mpFtRotate->Enable(); 591facb16e7SArmin Le Grand mpCtrlDial->Enable(); 592facb16e7SArmin Le Grand mpMtrAngle->Enable(); 593facb16e7SArmin Le Grand } 594facb16e7SArmin Le Grand else 595facb16e7SArmin Le Grand { 596facb16e7SArmin Le Grand mpFtRotate->Disable(); 597facb16e7SArmin Le Grand mpCtrlDial->Disable(); 598facb16e7SArmin Le Grand mpMtrAngle->Disable(); 599facb16e7SArmin Le Grand } 600facb16e7SArmin Le Grand mpCbStacked->Enable(); 601facb16e7SArmin Le Grand } 602facb16e7SArmin Le Grand switch(meHorAlignState) 603facb16e7SArmin Le Grand { 604facb16e7SArmin Le Grand case SVX_HOR_JUSTIFY_LEFT: 605facb16e7SArmin Le Grand mpTBHorizontal->SetItemState(ID_SUBSTLEFT, STATE_CHECK); 606facb16e7SArmin Le Grand mpFTLeftIndent->Enable(); 607facb16e7SArmin Le Grand mpMFLeftIndent->Enable(); 608facb16e7SArmin Le Grand break; 609facb16e7SArmin Le Grand case SVX_HOR_JUSTIFY_CENTER:mpTBHorizontal->SetItemState(ID_SUBSTCENTER, STATE_CHECK);break; 610facb16e7SArmin Le Grand case SVX_HOR_JUSTIFY_RIGHT: mpTBHorizontal->SetItemState(ID_SUBSTRIGHT, STATE_CHECK);break; 611facb16e7SArmin Le Grand case SVX_HOR_JUSTIFY_BLOCK: mpTBHorizontal->SetItemState(ID_SUBSTJUSTIFY,STATE_CHECK);break; 612facb16e7SArmin Le Grand default:; 613facb16e7SArmin Le Grand } 614facb16e7SArmin Le Grand } 615facb16e7SArmin Le Grand 616facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 617facb16e7SArmin Le Grand 618facb16e7SArmin Le Grand void AlignmentPropertyPanel::UpdateVerAlign() 619facb16e7SArmin Le Grand { 620facb16e7SArmin Le Grand mpTBVertical->SetItemState(IID_VERT_TOP, STATE_NOCHECK); 621facb16e7SArmin Le Grand mpTBVertical->SetItemState(IID_VERT_CENTER, STATE_NOCHECK); 622facb16e7SArmin Le Grand mpTBVertical->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK); 623facb16e7SArmin Le Grand 624facb16e7SArmin Le Grand switch(meVerAlignState) 625facb16e7SArmin Le Grand { 626facb16e7SArmin Le Grand case SVX_VER_JUSTIFY_TOP: mpTBVertical->SetItemState(IID_VERT_TOP, STATE_CHECK);break; 627facb16e7SArmin Le Grand case SVX_VER_JUSTIFY_CENTER:mpTBVertical->SetItemState(IID_VERT_CENTER, STATE_CHECK);break; 628facb16e7SArmin Le Grand case SVX_VER_JUSTIFY_BOTTOM: mpTBVertical->SetItemState(IID_VERT_BOTTOM, STATE_CHECK);break; 629facb16e7SArmin Le Grand default:; 630facb16e7SArmin Le Grand } 631facb16e7SArmin Le Grand } 632facb16e7SArmin Le Grand 633facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 634facb16e7SArmin Le Grand // namespace close 635facb16e7SArmin Le Grand 636facb16e7SArmin Le Grand }} // end of namespace ::sc::sidebar 637facb16e7SArmin Le Grand 638facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 639facb16e7SArmin Le Grand // eof 640