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 <CellAppearancePropertyPanel.hxx> 28facb16e7SArmin Le Grand #include <CellAppearancePropertyPanel.hrc> 29facb16e7SArmin Le Grand #include "sc.hrc" 30facb16e7SArmin Le Grand #include "scresid.hxx" 31facb16e7SArmin Le Grand #include <sfx2/bindings.hxx> 32facb16e7SArmin Le Grand #include <sfx2/dispatch.hxx> 33facb16e7SArmin Le Grand #include <vcl/fixed.hxx> 34facb16e7SArmin Le Grand #include <svx/tbxcolorupdate.hxx> 35facb16e7SArmin Le Grand #include <svl/eitem.hxx> 36facb16e7SArmin Le Grand #include <editeng/bolnitem.hxx> 37facb16e7SArmin Le Grand #include <editeng/boxitem.hxx> 38facb16e7SArmin Le Grand #include <editeng/colritem.hxx> 39facb16e7SArmin Le Grand #include <vcl/svapp.hxx> 40facb16e7SArmin Le Grand #include <svx/sidebar/ColorControl.hxx> 41facb16e7SArmin Le Grand #include <boost/bind.hpp> 42facb16e7SArmin Le Grand #include <svx/sidebar/PopupContainer.hxx> 43facb16e7SArmin Le Grand #include <CellLineStyleControl.hxx> 44facb16e7SArmin Le Grand #include <CellLineStylePopup.hxx> 45facb16e7SArmin Le Grand #include <CellBorderUpdater.hxx> 46facb16e7SArmin Le Grand #include <CellBorderStyleControl.hxx> 47facb16e7SArmin Le Grand #include <CellBorderStylePopup.hxx> 48facb16e7SArmin Le Grand 49facb16e7SArmin Le Grand using namespace css; 50facb16e7SArmin Le Grand using namespace cssu; 51facb16e7SArmin Le Grand 52facb16e7SArmin Le Grand #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) 53facb16e7SArmin Le Grand 54facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 5540fa6838SArmin Le Grand // helpers 5640fa6838SArmin Le Grand 5740fa6838SArmin Le Grand namespace 5840fa6838SArmin Le Grand { 5940fa6838SArmin Le Grand Color GetTransparentColor(void) 6040fa6838SArmin Le Grand { 6140fa6838SArmin Le Grand return COL_TRANSPARENT; 6240fa6838SArmin Le Grand } 6340fa6838SArmin Le Grand } // end of anonymous namespace 6440fa6838SArmin Le Grand 6540fa6838SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 66facb16e7SArmin Le Grand // namespace open 67facb16e7SArmin Le Grand 68facb16e7SArmin Le Grand namespace sc { namespace sidebar { 69facb16e7SArmin Le Grand 70facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 71facb16e7SArmin Le Grand 72facb16e7SArmin Le Grand svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateFillColorPopupControl(svx::sidebar::PopupContainer* pParent) 73facb16e7SArmin Le Grand { 74facb16e7SArmin Le Grand const ScResId aResId(VS_NOFILLCOLOR); 75facb16e7SArmin Le Grand 76facb16e7SArmin Le Grand return new svx::sidebar::ColorControl( 77facb16e7SArmin Le Grand pParent, 78facb16e7SArmin Le Grand mpBindings, 79facb16e7SArmin Le Grand ScResId(RID_POPUPPANEL_CELLAPPEARANCE_FILLCOLOR), 80facb16e7SArmin Le Grand ScResId(VS_FILLCOLOR), 8140fa6838SArmin Le Grand ::boost::bind(GetTransparentColor), 82facb16e7SArmin Le Grand ::boost::bind(&CellAppearancePropertyPanel::SetFillColor, this, _1, _2), 83facb16e7SArmin Le Grand pParent, 84facb16e7SArmin Le Grand &aResId); 85facb16e7SArmin Le Grand } 86facb16e7SArmin Le Grand 87facb16e7SArmin Le Grand void CellAppearancePropertyPanel::SetFillColor( 88facb16e7SArmin Le Grand const String& /*rsColorName*/, 89facb16e7SArmin Le Grand const Color aColor) 90facb16e7SArmin Le Grand { 91facb16e7SArmin Le Grand const SvxColorItem aColorItem(aColor, SID_BACKGROUND_COLOR); 92facb16e7SArmin Le Grand mpBindings->GetDispatcher()->Execute(SID_BACKGROUND_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); 93facb16e7SArmin Le Grand maBackColor = aColor; 94facb16e7SArmin Le Grand } 95facb16e7SArmin Le Grand 96facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 97facb16e7SArmin Le Grand 98facb16e7SArmin Le Grand svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateLineColorPopupControl(svx::sidebar::PopupContainer* pParent) 99facb16e7SArmin Le Grand { 100facb16e7SArmin Le Grand return new svx::sidebar::ColorControl( 101facb16e7SArmin Le Grand pParent, 102facb16e7SArmin Le Grand mpBindings, 103facb16e7SArmin Le Grand ScResId(RID_POPUPPANEL_CELLAPPEARANCE_LINECOLOR), 104facb16e7SArmin Le Grand ScResId(VS_LINECOLOR), 10540fa6838SArmin Le Grand ::boost::bind(GetTransparentColor), 106facb16e7SArmin Le Grand ::boost::bind(&CellAppearancePropertyPanel::SetLineColor, this, _1, _2), 107facb16e7SArmin Le Grand pParent, 108facb16e7SArmin Le Grand 0); 109facb16e7SArmin Le Grand } 110facb16e7SArmin Le Grand 111facb16e7SArmin Le Grand void CellAppearancePropertyPanel::SetLineColor( 112facb16e7SArmin Le Grand const String& /*rsColorName*/, 113facb16e7SArmin Le Grand const Color aColor) 114facb16e7SArmin Le Grand { 115facb16e7SArmin Le Grand const SvxColorItem aColorItem(aColor, SID_FRAME_LINECOLOR); 116facb16e7SArmin Le Grand mpBindings->GetDispatcher()->Execute(SID_FRAME_LINECOLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); 117facb16e7SArmin Le Grand maLineColor = aColor; 118facb16e7SArmin Le Grand } 119facb16e7SArmin Le Grand 120facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 121facb16e7SArmin Le Grand 122facb16e7SArmin Le Grand svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateCellLineStylePopupControl(svx::sidebar::PopupContainer* pParent) 123facb16e7SArmin Le Grand { 124facb16e7SArmin Le Grand return new CellLineStyleControl(pParent, *this); 125facb16e7SArmin Le Grand } 126facb16e7SArmin Le Grand 127facb16e7SArmin Le Grand void CellAppearancePropertyPanel::EndCellLineStylePopupMode(void) 128facb16e7SArmin Le Grand { 129facb16e7SArmin Le Grand if(mpCellLineStylePopup.get()) 130facb16e7SArmin Le Grand { 131facb16e7SArmin Le Grand mpCellLineStylePopup->Hide(); 132facb16e7SArmin Le Grand } 133facb16e7SArmin Le Grand } 134facb16e7SArmin Le Grand 135facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 136facb16e7SArmin Le Grand 137facb16e7SArmin Le Grand svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateCellBorderStylePopupControl(svx::sidebar::PopupContainer* pParent) 138facb16e7SArmin Le Grand { 139facb16e7SArmin Le Grand return new CellBorderStyleControl(pParent, *this); 140facb16e7SArmin Le Grand } 141facb16e7SArmin Le Grand 142facb16e7SArmin Le Grand void CellAppearancePropertyPanel::EndCellBorderStylePopupMode(void) 143facb16e7SArmin Le Grand { 144facb16e7SArmin Le Grand if(mpCellBorderStylePopup.get()) 145facb16e7SArmin Le Grand { 146facb16e7SArmin Le Grand mpCellBorderStylePopup->Hide(); 147facb16e7SArmin Le Grand } 148facb16e7SArmin Le Grand } 149facb16e7SArmin Le Grand 150facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 151facb16e7SArmin Le Grand 152facb16e7SArmin Le Grand CellAppearancePropertyPanel::CellAppearancePropertyPanel( 153facb16e7SArmin Le Grand Window* pParent, 154facb16e7SArmin Le Grand const cssu::Reference<css::frame::XFrame>& rxFrame, 155facb16e7SArmin Le Grand SfxBindings* pBindings) 156facb16e7SArmin Le Grand : Control( 157facb16e7SArmin Le Grand pParent, 158facb16e7SArmin Le Grand ScResId(RID_PROPERTYPANEL_SC_APPEAR)), 159facb16e7SArmin Le Grand 160facb16e7SArmin Le Grand mpFTFillColor(new FixedText(this, ScResId(FT_BK_COLOR))), 161facb16e7SArmin Le Grand mpTBFillColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), 162facb16e7SArmin Le Grand mpTBFillColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBFillColorBackground.get(), ScResId(TB_BK_COLOR))), 163facb16e7SArmin Le Grand mpFillColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_BRUSH, TBI_BK_COLOR, mpTBFillColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)), 164facb16e7SArmin Le Grand 165facb16e7SArmin Le Grand mpFTCellBorder(new FixedText(this, ScResId(FT_BORDER))), 166facb16e7SArmin Le Grand mpTBCellBorderBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), 167facb16e7SArmin Le Grand mpTBCellBorder(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBCellBorderBackground.get(), ScResId(TB_APP_BORDER))), 168facb16e7SArmin Le Grand mpCellBorderUpdater(new CellBorderUpdater(TBI_BORDER, *mpTBCellBorder)), 169facb16e7SArmin Le Grand 170facb16e7SArmin Le Grand mpTBLineStyleBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), 171facb16e7SArmin Le Grand mpTBLineStyle(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBLineStyleBackground.get(), ScResId(TB_BORDER_LINE_STYLE))), 172facb16e7SArmin Le Grand 173facb16e7SArmin Le Grand mpTBLineColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), 174facb16e7SArmin Le Grand mpTBLineColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBLineColorBackground.get(), ScResId(TB_BORDER_LINE_COLOR))), 175facb16e7SArmin Le Grand mpLineColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_FRAME_LINECOLOR, TBI_LINE_COLOR, mpTBLineColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)), 176facb16e7SArmin Le Grand 177facb16e7SArmin Le Grand mpCBXShowGrid(new CheckBox(this, ScResId(CBX_SHOW_GRID))), 178facb16e7SArmin Le Grand 179facb16e7SArmin Le Grand maBackColorControl(SID_BACKGROUND_COLOR, *pBindings, *this), 180facb16e7SArmin Le Grand maLineColorControl(SID_FRAME_LINECOLOR, *pBindings, *this), 181facb16e7SArmin Le Grand maLineStyleControl(SID_FRAME_LINESTYLE, *pBindings, *this), 182facb16e7SArmin Le Grand maBorderOuterControl(SID_ATTR_BORDER_OUTER, *pBindings, *this), 183facb16e7SArmin Le Grand maBorderInnerControl(SID_ATTR_BORDER_INNER, *pBindings, *this), 184facb16e7SArmin Le Grand maGridShowControl(SID_SCGRIDSHOW, *pBindings, *this), 185facb16e7SArmin Le Grand maBorderTLBRControl(SID_ATTR_BORDER_DIAG_TLBR, *pBindings, *this), 186facb16e7SArmin Le Grand maBorderBLTRControl(SID_ATTR_BORDER_DIAG_BLTR, *pBindings, *this), 187facb16e7SArmin Le Grand 188facb16e7SArmin Le Grand maIMGBKColor(ScResId(IMG_BK_COLOR)), 189facb16e7SArmin Le Grand maIMGCellBorder(ScResId(IMG_CELL_BORDER)), 190facb16e7SArmin Le Grand maIMGLineColor(ScResId(IMG_LINE_COLOR)), 191facb16e7SArmin Le Grand maIMGLineStyle1(ScResId(IMG_LINE_STYLE1)), 192facb16e7SArmin Le Grand maIMGLineStyle2(ScResId(IMG_LINE_STYLE2)), 193facb16e7SArmin Le Grand maIMGLineStyle3(ScResId(IMG_LINE_STYLE3)), 194facb16e7SArmin Le Grand maIMGLineStyle4(ScResId(IMG_LINE_STYLE4)), 195facb16e7SArmin Le Grand maIMGLineStyle5(ScResId(IMG_LINE_STYLE5)), 196facb16e7SArmin Le Grand maIMGLineStyle6(ScResId(IMG_LINE_STYLE6)), 197facb16e7SArmin Le Grand maIMGLineStyle7(ScResId(IMG_LINE_STYLE7)), 198facb16e7SArmin Le Grand maIMGLineStyle8(ScResId(IMG_LINE_STYLE8)), 199facb16e7SArmin Le Grand maIMGLineStyle9(ScResId(IMG_LINE_STYLE9)), 200facb16e7SArmin Le Grand 201facb16e7SArmin Le Grand maIMGBKColorH(ScResId(IMG_BK_COLOR_H)), 202facb16e7SArmin Le Grand maIMGLineStyle1H(ScResId(IMG_LINE_STYLE1_H)), 203facb16e7SArmin Le Grand maIMGLineStyle2H(ScResId(IMG_LINE_STYLE2_H)), 204facb16e7SArmin Le Grand maIMGLineStyle3H(ScResId(IMG_LINE_STYLE3_H)), 205facb16e7SArmin Le Grand maIMGLineStyle4H(ScResId(IMG_LINE_STYLE4_H)), 206facb16e7SArmin Le Grand maIMGLineStyle5H(ScResId(IMG_LINE_STYLE5_H)), 207facb16e7SArmin Le Grand maIMGLineStyle6H(ScResId(IMG_LINE_STYLE6_H)), 208facb16e7SArmin Le Grand maIMGLineStyle7H(ScResId(IMG_LINE_STYLE7_H)), 209facb16e7SArmin Le Grand maIMGLineStyle8H(ScResId(IMG_LINE_STYLE8_H)), 210facb16e7SArmin Le Grand maIMGLineStyle9H(ScResId(IMG_LINE_STYLE9_H)), 211facb16e7SArmin Le Grand 212facb16e7SArmin Le Grand maBackColor(COL_TRANSPARENT), 213facb16e7SArmin Le Grand maLineColor(COL_BLACK), 214facb16e7SArmin Le Grand maTLBRColor(COL_BLACK), 215facb16e7SArmin Le Grand maBLTRColor(COL_BLACK), 216facb16e7SArmin Le Grand mnIn(0), 217facb16e7SArmin Le Grand mnOut(0), 218facb16e7SArmin Le Grand mnDis(0), 219facb16e7SArmin Le Grand mnTLBRIn(0), 220facb16e7SArmin Le Grand mnTLBROut(0), 221facb16e7SArmin Le Grand mnTLBRDis(0), 222facb16e7SArmin Le Grand mnBLTRIn(0), 223facb16e7SArmin Le Grand mnBLTROut(0), 224facb16e7SArmin Le Grand mnBLTRDis(0), 225facb16e7SArmin Le Grand mbBackColorAvailable(true), 226facb16e7SArmin Le Grand mbLineColorAvailable(true), 227facb16e7SArmin Le Grand mbBorderStyleAvailable(true), 228facb16e7SArmin Le Grand mbLeft(false), 229facb16e7SArmin Le Grand mbRight(false), 230facb16e7SArmin Le Grand mbTop(false), 231facb16e7SArmin Le Grand mbBottom(false), 232facb16e7SArmin Le Grand mbVer(false), 233facb16e7SArmin Le Grand mbHor(false), 234facb16e7SArmin Le Grand mbOuterBorder(false), 235facb16e7SArmin Le Grand mbInnerBorder(false), 236facb16e7SArmin Le Grand mbTLBR(false), 237facb16e7SArmin Le Grand mbBLTR(false), 238facb16e7SArmin Le Grand 239facb16e7SArmin Le Grand maFillColorPopup(this, ::boost::bind(&CellAppearancePropertyPanel::CreateFillColorPopupControl, this, _1)), 240facb16e7SArmin Le Grand maLineColorPopup(this, ::boost::bind(&CellAppearancePropertyPanel::CreateLineColorPopupControl, this, _1)), 241facb16e7SArmin Le Grand mpCellLineStylePopup(), 242facb16e7SArmin Le Grand mpCellBorderStylePopup(), 243facb16e7SArmin Le Grand 244facb16e7SArmin Le Grand mxFrame(rxFrame), 245facb16e7SArmin Le Grand maContext(), 246facb16e7SArmin Le Grand mpBindings(pBindings) 247facb16e7SArmin Le Grand { 248facb16e7SArmin Le Grand Initialize(); 249facb16e7SArmin Le Grand FreeResource(); 250facb16e7SArmin Le Grand } 251facb16e7SArmin Le Grand 252facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 253facb16e7SArmin Le Grand 254facb16e7SArmin Le Grand CellAppearancePropertyPanel::~CellAppearancePropertyPanel() 255facb16e7SArmin Le Grand { 256facb16e7SArmin Le Grand // Destroy the toolboxes, then their background windows. 257facb16e7SArmin Le Grand mpTBFillColor.reset(); 258facb16e7SArmin Le Grand mpTBCellBorder.reset(); 259facb16e7SArmin Le Grand mpTBLineStyle.reset(); 260facb16e7SArmin Le Grand mpTBLineColor.reset(); 261facb16e7SArmin Le Grand 262facb16e7SArmin Le Grand mpTBFillColorBackground.reset(); 263facb16e7SArmin Le Grand mpTBCellBorderBackground.reset(); 264facb16e7SArmin Le Grand mpTBLineStyleBackground.reset(); 265facb16e7SArmin Le Grand mpTBLineColorBackground.reset(); 266facb16e7SArmin Le Grand } 267facb16e7SArmin Le Grand 268facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 269facb16e7SArmin Le Grand 270facb16e7SArmin Le Grand void CellAppearancePropertyPanel::Initialize() 271facb16e7SArmin Le Grand { 272facb16e7SArmin Le Grand mpTBFillColor->SetItemImage(TBI_BK_COLOR, GetDisplayBackground().GetColor().IsDark() ? maIMGBKColorH : maIMGBKColor); 273facb16e7SArmin Le Grand mpTBFillColor->SetItemBits( TBI_BK_COLOR, mpTBFillColor->GetItemBits( TBI_BK_COLOR ) | TIB_DROPDOWNONLY ); 274facb16e7SArmin Le Grand mpTBFillColor->SetQuickHelpText(TBI_BK_COLOR,String(ScResId(STR_QH_BK_COLOR))); //Add 275facb16e7SArmin Le Grand Size aTbxSize1( mpTBFillColor->CalcWindowSizePixel() ); 276facb16e7SArmin Le Grand mpTBFillColor->SetOutputSizePixel( aTbxSize1 ); 277facb16e7SArmin Le Grand mpTBFillColor->SetBackground(Wallpaper()); 278facb16e7SArmin Le Grand mpTBFillColor->SetPaintTransparent(true); 279facb16e7SArmin Le Grand Link aLink = LINK(this, CellAppearancePropertyPanel, TbxBKColorSelectHdl); 280facb16e7SArmin Le Grand mpTBFillColor->SetDropdownClickHdl ( aLink ); 281facb16e7SArmin Le Grand mpTBFillColor->SetSelectHdl ( aLink ); 282facb16e7SArmin Le Grand 283facb16e7SArmin Le Grand mpTBCellBorder->SetItemImage(TBI_BORDER, maIMGCellBorder); 284facb16e7SArmin Le Grand mpTBCellBorder->SetItemBits( TBI_BORDER, mpTBCellBorder->GetItemBits( TBI_BORDER ) | TIB_DROPDOWNONLY ); 285facb16e7SArmin Le Grand mpTBCellBorder->SetQuickHelpText(TBI_BORDER,String(ScResId(STR_QH_BORDER))); //Add 286facb16e7SArmin Le Grand Size aTbxSize2( mpTBCellBorder->CalcWindowSizePixel() ); 287facb16e7SArmin Le Grand mpTBCellBorder->SetOutputSizePixel( aTbxSize2 ); 288facb16e7SArmin Le Grand mpTBCellBorder->SetBackground(Wallpaper()); 289facb16e7SArmin Le Grand mpTBCellBorder->SetPaintTransparent(true); 290facb16e7SArmin Le Grand aLink = LINK(this, CellAppearancePropertyPanel, TbxCellBorderSelectHdl); 291facb16e7SArmin Le Grand mpTBCellBorder->SetDropdownClickHdl ( aLink ); 292facb16e7SArmin Le Grand mpTBCellBorder->SetSelectHdl ( aLink ); 293facb16e7SArmin Le Grand 294facb16e7SArmin Le Grand mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle1); 295facb16e7SArmin Le Grand mpTBLineStyle->SetItemBits( TBI_LINE_STYLE, mpTBLineStyle->GetItemBits( TBI_LINE_STYLE ) | TIB_DROPDOWNONLY ); 296facb16e7SArmin Le Grand mpTBLineStyle->SetQuickHelpText(TBI_LINE_STYLE,String(ScResId(STR_QH_BORDER_LINE_STYLE))); //Add 297facb16e7SArmin Le Grand Size aTbxSize3( mpTBLineStyle->CalcWindowSizePixel() ); 298facb16e7SArmin Le Grand mpTBLineStyle->SetOutputSizePixel( aTbxSize3 ); 299facb16e7SArmin Le Grand mpTBLineStyle->SetBackground(Wallpaper()); 300facb16e7SArmin Le Grand mpTBLineStyle->SetPaintTransparent(true); 301facb16e7SArmin Le Grand aLink = LINK(this, CellAppearancePropertyPanel, TbxLineStyleSelectHdl); 302facb16e7SArmin Le Grand mpTBLineStyle->SetDropdownClickHdl ( aLink ); 303facb16e7SArmin Le Grand mpTBLineStyle->SetSelectHdl ( aLink ); 304facb16e7SArmin Le Grand mpTBLineStyle->Disable(); 305facb16e7SArmin Le Grand 306facb16e7SArmin Le Grand mpTBLineColor->SetItemImage(TBI_LINE_COLOR, maIMGLineColor); 307facb16e7SArmin Le Grand mpTBLineColor->SetItemBits( TBI_LINE_COLOR, mpTBLineColor->GetItemBits( TBI_LINE_COLOR ) | TIB_DROPDOWNONLY ); 308facb16e7SArmin Le Grand mpTBLineColor->SetQuickHelpText(TBI_LINE_COLOR,String(ScResId(STR_QH_BORDER_LINE_COLOR))); //Add 309facb16e7SArmin Le Grand Size aTbxSize4( mpTBLineColor->CalcWindowSizePixel() ); 310facb16e7SArmin Le Grand mpTBLineColor->SetOutputSizePixel( aTbxSize4 ); 311facb16e7SArmin Le Grand mpTBLineColor->SetBackground(Wallpaper()); 312facb16e7SArmin Le Grand mpTBLineColor->SetPaintTransparent(true); 313facb16e7SArmin Le Grand aLink = LINK(this, CellAppearancePropertyPanel, TbxLineColorSelectHdl); 314facb16e7SArmin Le Grand mpTBLineColor->SetDropdownClickHdl ( aLink ); 315facb16e7SArmin Le Grand mpTBLineColor->SetSelectHdl ( aLink ); 316facb16e7SArmin Le Grand mpTBLineColor->Disable(); 317facb16e7SArmin Le Grand 318facb16e7SArmin Le Grand aLink = LINK(this, CellAppearancePropertyPanel, CBOXGridShowClkHdl); 319facb16e7SArmin Le Grand mpCBXShowGrid->SetClickHdl ( aLink ); 320facb16e7SArmin Le Grand 321facb16e7SArmin Le Grand mpTBFillColor->SetAccessibleRelationLabeledBy(mpFTFillColor.get()); 322facb16e7SArmin Le Grand mpTBLineColor->SetAccessibleRelationLabeledBy(mpTBLineColor.get()); 323facb16e7SArmin Le Grand mpTBCellBorder->SetAccessibleRelationLabeledBy(mpFTCellBorder.get()); 324facb16e7SArmin Le Grand mpTBLineStyle->SetAccessibleRelationLabeledBy(mpTBLineStyle.get()); 325facb16e7SArmin Le Grand } 326facb16e7SArmin Le Grand 327facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 328facb16e7SArmin Le Grand 329facb16e7SArmin Le Grand IMPL_LINK(CellAppearancePropertyPanel, TbxBKColorSelectHdl, ToolBox*, pToolBox) 330facb16e7SArmin Le Grand { 331facb16e7SArmin Le Grand sal_uInt16 nId = pToolBox->GetCurItemId(); 332facb16e7SArmin Le Grand if(nId == TBI_BK_COLOR) 333facb16e7SArmin Le Grand { 334facb16e7SArmin Le Grand maFillColorPopup.Show(*pToolBox); 335facb16e7SArmin Le Grand maFillColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable); 336facb16e7SArmin Le Grand } 337facb16e7SArmin Le Grand return 0; 338facb16e7SArmin Le Grand } 339facb16e7SArmin Le Grand 340facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 341facb16e7SArmin Le Grand 342facb16e7SArmin Le Grand IMPL_LINK(CellAppearancePropertyPanel, TbxLineColorSelectHdl, ToolBox*, pToolBox) 343facb16e7SArmin Le Grand { 344facb16e7SArmin Le Grand sal_uInt16 nId = pToolBox->GetCurItemId(); 345facb16e7SArmin Le Grand if(nId == TBI_LINE_COLOR) 346facb16e7SArmin Le Grand { 347facb16e7SArmin Le Grand maLineColorPopup.Show(*pToolBox); 348facb16e7SArmin Le Grand maLineColorPopup.SetCurrentColor(maLineColor, mbLineColorAvailable); 349facb16e7SArmin Le Grand } 350facb16e7SArmin Le Grand return 0; 351facb16e7SArmin Le Grand } 352facb16e7SArmin Le Grand 353facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 354facb16e7SArmin Le Grand 355facb16e7SArmin Le Grand IMPL_LINK(CellAppearancePropertyPanel, TbxCellBorderSelectHdl, ToolBox*, pToolBox) 356facb16e7SArmin Le Grand { 357facb16e7SArmin Le Grand sal_uInt16 nId = pToolBox->GetCurItemId(); 358facb16e7SArmin Le Grand 359facb16e7SArmin Le Grand if(nId == TBI_BORDER) 360facb16e7SArmin Le Grand { 361facb16e7SArmin Le Grand // create popup on demand 362facb16e7SArmin Le Grand if(!mpCellBorderStylePopup.get()) 363facb16e7SArmin Le Grand { 364facb16e7SArmin Le Grand mpCellBorderStylePopup.reset( 365facb16e7SArmin Le Grand new CellBorderStylePopup( 366facb16e7SArmin Le Grand this, 367facb16e7SArmin Le Grand ::boost::bind(&CellAppearancePropertyPanel::CreateCellBorderStylePopupControl, this, _1))); 368facb16e7SArmin Le Grand } 369facb16e7SArmin Le Grand 370facb16e7SArmin Le Grand if(mpCellBorderStylePopup.get()) 371facb16e7SArmin Le Grand { 372facb16e7SArmin Le Grand mpCellBorderStylePopup->Show(*pToolBox); 373facb16e7SArmin Le Grand } 374facb16e7SArmin Le Grand } 375facb16e7SArmin Le Grand return 0; 376facb16e7SArmin Le Grand } 377facb16e7SArmin Le Grand 378facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 379facb16e7SArmin Le Grand 380facb16e7SArmin Le Grand IMPL_LINK(CellAppearancePropertyPanel, TbxLineStyleSelectHdl, ToolBox*, pToolBox) 381facb16e7SArmin Le Grand { 382facb16e7SArmin Le Grand sal_uInt16 nId = pToolBox->GetCurItemId(); 383facb16e7SArmin Le Grand if(nId == TBI_LINE_STYLE) 384facb16e7SArmin Le Grand { 385facb16e7SArmin Le Grand // create popup on demand 386facb16e7SArmin Le Grand if(!mpCellLineStylePopup.get()) 387facb16e7SArmin Le Grand { 388facb16e7SArmin Le Grand mpCellLineStylePopup.reset( 389facb16e7SArmin Le Grand new CellLineStylePopup( 390facb16e7SArmin Le Grand this, 391facb16e7SArmin Le Grand ::boost::bind(&CellAppearancePropertyPanel::CreateCellLineStylePopupControl, this, _1))); 392facb16e7SArmin Le Grand } 393facb16e7SArmin Le Grand 394facb16e7SArmin Le Grand if(mpCellLineStylePopup.get()) 395facb16e7SArmin Le Grand { 396facb16e7SArmin Le Grand mpCellLineStylePopup->SetLineStyleSelect(mnOut, mnIn, mnDis); 397facb16e7SArmin Le Grand mpCellLineStylePopup->Show(*pToolBox); 398facb16e7SArmin Le Grand } 399facb16e7SArmin Le Grand } 400facb16e7SArmin Le Grand return 0; 401facb16e7SArmin Le Grand } 402facb16e7SArmin Le Grand 403facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 404facb16e7SArmin Le Grand 405facb16e7SArmin Le Grand IMPL_LINK(CellAppearancePropertyPanel, CBOXGridShowClkHdl, void*, EMPTYARG) 406facb16e7SArmin Le Grand { 407facb16e7SArmin Le Grand bool bState = mpCBXShowGrid->IsChecked(); 408facb16e7SArmin Le Grand SfxBoolItem aItem( SID_SCGRIDSHOW , bState); 409facb16e7SArmin Le Grand GetBindings()->GetDispatcher()->Execute(SID_SCGRIDSHOW, SFX_CALLMODE_RECORD, &aItem, false, 0L); 410facb16e7SArmin Le Grand return 0; 411facb16e7SArmin Le Grand } 412facb16e7SArmin Le Grand 413facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 414facb16e7SArmin Le Grand 415facb16e7SArmin Le Grand CellAppearancePropertyPanel* CellAppearancePropertyPanel::Create ( 416facb16e7SArmin Le Grand Window* pParent, 417facb16e7SArmin Le Grand const cssu::Reference<css::frame::XFrame>& rxFrame, 418facb16e7SArmin Le Grand SfxBindings* pBindings) 419facb16e7SArmin Le Grand { 420facb16e7SArmin Le Grand if (pParent == NULL) 421facb16e7SArmin Le Grand throw lang::IllegalArgumentException(A2S("no parent Window given to CellAppearancePropertyPanel::Create"), NULL, 0); 422facb16e7SArmin Le Grand if ( ! rxFrame.is()) 423facb16e7SArmin Le Grand throw lang::IllegalArgumentException(A2S("no XFrame given to CellAppearancePropertyPanel::Create"), NULL, 1); 424facb16e7SArmin Le Grand if (pBindings == NULL) 425facb16e7SArmin Le Grand throw lang::IllegalArgumentException(A2S("no SfxBindings given to CellAppearancePropertyPanel::Create"), NULL, 2); 426facb16e7SArmin Le Grand 427facb16e7SArmin Le Grand return new CellAppearancePropertyPanel( 428facb16e7SArmin Le Grand pParent, 429facb16e7SArmin Le Grand rxFrame, 430facb16e7SArmin Le Grand pBindings); 431facb16e7SArmin Le Grand } 432facb16e7SArmin Le Grand 433facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 434facb16e7SArmin Le Grand 435facb16e7SArmin Le Grand void CellAppearancePropertyPanel::DataChanged( 436facb16e7SArmin Le Grand const DataChangedEvent& rEvent) 437facb16e7SArmin Le Grand { 438facb16e7SArmin Le Grand (void)rEvent; 439facb16e7SArmin Le Grand } 440facb16e7SArmin Le Grand 441facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 442facb16e7SArmin Le Grand 443facb16e7SArmin Le Grand void CellAppearancePropertyPanel::HandleContextChange( 444facb16e7SArmin Le Grand const ::sfx2::sidebar::EnumContext aContext) 445facb16e7SArmin Le Grand { 446facb16e7SArmin Le Grand if(maContext == aContext) 447facb16e7SArmin Le Grand { 448facb16e7SArmin Le Grand // Nothing to do. 449facb16e7SArmin Le Grand return; 450facb16e7SArmin Le Grand } 451facb16e7SArmin Le Grand 452facb16e7SArmin Le Grand maContext = aContext; 453facb16e7SArmin Le Grand 454facb16e7SArmin Le Grand 455facb16e7SArmin Le Grand 456facb16e7SArmin Le Grand // todo 457facb16e7SArmin Le Grand } 458facb16e7SArmin Le Grand 459facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 460facb16e7SArmin Le Grand 461facb16e7SArmin Le Grand void CellAppearancePropertyPanel::NotifyItemUpdate( 462facb16e7SArmin Le Grand sal_uInt16 nSID, 463facb16e7SArmin Le Grand SfxItemState eState, 464*45da7d5eSAndre Fischer const SfxPoolItem* pState, 465*45da7d5eSAndre Fischer const bool bIsEnabled) 466facb16e7SArmin Le Grand { 467*45da7d5eSAndre Fischer (void)bIsEnabled; 468*45da7d5eSAndre Fischer 469facb16e7SArmin Le Grand switch(nSID) 470facb16e7SArmin Le Grand { 471facb16e7SArmin Le Grand case SID_BACKGROUND_COLOR: 472facb16e7SArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 473facb16e7SArmin Le Grand { 474facb16e7SArmin Le Grand const SvxColorItem* pSvxColorItem = dynamic_cast< const SvxColorItem* >(pState); 475facb16e7SArmin Le Grand 476facb16e7SArmin Le Grand if(pSvxColorItem) 477facb16e7SArmin Le Grand { 478facb16e7SArmin Le Grand maBackColor = ((const SvxColorItem*)pState)->GetValue(); 479facb16e7SArmin Le Grand mbBackColorAvailable = true; 480facb16e7SArmin Le Grand mpFillColorUpdater->Update(maBackColor); 481facb16e7SArmin Le Grand break; 482facb16e7SArmin Le Grand } 483facb16e7SArmin Le Grand } 484facb16e7SArmin Le Grand 485facb16e7SArmin Le Grand mbBackColorAvailable = false; 486facb16e7SArmin Le Grand maBackColor.SetColor(COL_TRANSPARENT); 487facb16e7SArmin Le Grand mpFillColorUpdater->Update(COL_TRANSPARENT); 488facb16e7SArmin Le Grand break; 489facb16e7SArmin Le Grand case SID_FRAME_LINECOLOR: 490facb16e7SArmin Le Grand if( eState == SFX_ITEM_DONTCARE) 491facb16e7SArmin Le Grand { 492facb16e7SArmin Le Grand mbLineColorAvailable = true; 493facb16e7SArmin Le Grand maLineColor.SetColor( COL_TRANSPARENT ); 494facb16e7SArmin Le Grand UpdateControlState(); 495facb16e7SArmin Le Grand break; 496facb16e7SArmin Le Grand } 497facb16e7SArmin Le Grand 498facb16e7SArmin Le Grand if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxColorItem) ) 499facb16e7SArmin Le Grand { 500facb16e7SArmin Le Grand const SvxColorItem* pSvxColorItem = dynamic_cast< const SvxColorItem* >(pState); 501facb16e7SArmin Le Grand 502facb16e7SArmin Le Grand if(pSvxColorItem) 503facb16e7SArmin Le Grand { 504facb16e7SArmin Le Grand maLineColor = ((const SvxColorItem*)pState)->GetValue(); 505facb16e7SArmin Le Grand if(maLineColor == COL_AUTO) 506facb16e7SArmin Le Grand mbLineColorAvailable = false; 507facb16e7SArmin Le Grand else 508facb16e7SArmin Le Grand { 509facb16e7SArmin Le Grand mbLineColorAvailable = true; 510facb16e7SArmin Le Grand // mpLineColorUpdater->Update(maLineColor); 511facb16e7SArmin Le Grand } 512facb16e7SArmin Le Grand 513facb16e7SArmin Le Grand UpdateControlState(); 514facb16e7SArmin Le Grand break; 515facb16e7SArmin Le Grand } 516facb16e7SArmin Le Grand } 517facb16e7SArmin Le Grand 518facb16e7SArmin Le Grand mbLineColorAvailable = false; 519facb16e7SArmin Le Grand maLineColor.SetColor(COL_AUTO); 520facb16e7SArmin Le Grand // mpLineColorUpdater->Update(maLineColor); 521facb16e7SArmin Le Grand UpdateControlState(); 522facb16e7SArmin Le Grand break; 523facb16e7SArmin Le Grand case SID_FRAME_LINESTYLE: 524facb16e7SArmin Le Grand if( eState == SFX_ITEM_DONTCARE ) 525facb16e7SArmin Le Grand { 526facb16e7SArmin Le Grand mbBorderStyleAvailable = true; 527facb16e7SArmin Le Grand mnIn = 0; 528facb16e7SArmin Le Grand mnOut = 0; 529facb16e7SArmin Le Grand mnDis = 0; 530facb16e7SArmin Le Grand SetStyleIcon(); 531facb16e7SArmin Le Grand break; 532facb16e7SArmin Le Grand } 533facb16e7SArmin Le Grand 534facb16e7SArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 535facb16e7SArmin Le Grand { 536facb16e7SArmin Le Grand const SvxLineItem* pSvxLineItem = dynamic_cast< const SvxLineItem* >(pState); 537facb16e7SArmin Le Grand 538facb16e7SArmin Le Grand if(pSvxLineItem) 539facb16e7SArmin Le Grand { 540facb16e7SArmin Le Grand const SvxBorderLine* mbLineItem = pSvxLineItem->GetLine(); 541facb16e7SArmin Le Grand mnIn = mbLineItem->GetInWidth(); 542facb16e7SArmin Le Grand mnOut = mbLineItem->GetOutWidth(); 543facb16e7SArmin Le Grand mnDis = mbLineItem->GetDistance(); 544facb16e7SArmin Le Grand 545facb16e7SArmin Le Grand if(mnIn == 0 && mnOut == 0 && mnDis == 0) 546facb16e7SArmin Le Grand mbBorderStyleAvailable = false; 547facb16e7SArmin Le Grand else 548facb16e7SArmin Le Grand mbBorderStyleAvailable = true; 549facb16e7SArmin Le Grand 550facb16e7SArmin Le Grand SetStyleIcon(); 551facb16e7SArmin Le Grand break; 552facb16e7SArmin Le Grand } 553facb16e7SArmin Le Grand } 554facb16e7SArmin Le Grand 555facb16e7SArmin Le Grand mbBorderStyleAvailable = false; 556facb16e7SArmin Le Grand SetStyleIcon(); 557facb16e7SArmin Le Grand break; 558facb16e7SArmin Le Grand case SID_ATTR_BORDER_OUTER: 559facb16e7SArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 560facb16e7SArmin Le Grand { 561facb16e7SArmin Le Grand const SvxBoxItem* pBoxItem = dynamic_cast< const SvxBoxItem* >(pState); 562facb16e7SArmin Le Grand 563facb16e7SArmin Le Grand if(pBoxItem) 564facb16e7SArmin Le Grand { 565facb16e7SArmin Le Grand mbLeft=false, mbRight=false, mbTop=false, mbBottom=false; 566facb16e7SArmin Le Grand 567facb16e7SArmin Le Grand if(pBoxItem->GetLeft()) 568facb16e7SArmin Le Grand mbLeft = true; 569facb16e7SArmin Le Grand 570facb16e7SArmin Le Grand if(pBoxItem->GetRight()) 571facb16e7SArmin Le Grand mbRight = true; 572facb16e7SArmin Le Grand 573facb16e7SArmin Le Grand if(pBoxItem->GetTop()) 574facb16e7SArmin Le Grand mbTop = true; 575facb16e7SArmin Le Grand 576facb16e7SArmin Le Grand if(pBoxItem->GetBottom()) 577facb16e7SArmin Le Grand mbBottom = true; 578facb16e7SArmin Le Grand 579facb16e7SArmin Le Grand if(!Application::GetSettings().GetLayoutRTL()) 580facb16e7SArmin Le Grand mpCellBorderUpdater->UpdateCellBorder(mbTop, mbBottom, mbLeft, mbRight, maIMGCellBorder, mbVer, mbHor); 581facb16e7SArmin Le Grand else 582facb16e7SArmin Le Grand mpCellBorderUpdater->UpdateCellBorder(mbTop, mbBottom, mbRight, mbLeft, maIMGCellBorder, mbVer, mbHor); 583facb16e7SArmin Le Grand 584facb16e7SArmin Le Grand if(mbLeft || mbRight || mbTop || mbBottom) 585facb16e7SArmin Le Grand mbOuterBorder = true; 586facb16e7SArmin Le Grand else 587facb16e7SArmin Le Grand mbOuterBorder = false; 588facb16e7SArmin Le Grand 589facb16e7SArmin Le Grand UpdateControlState(); 590facb16e7SArmin Le Grand } 591facb16e7SArmin Le Grand } 592facb16e7SArmin Le Grand break; 593facb16e7SArmin Le Grand case SID_ATTR_BORDER_INNER: 594facb16e7SArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 595facb16e7SArmin Le Grand { 596facb16e7SArmin Le Grand const SvxBoxInfoItem* pBoxInfoItem = dynamic_cast< const SvxBoxInfoItem* >(pState); 597facb16e7SArmin Le Grand 598facb16e7SArmin Le Grand if(pBoxInfoItem) 599facb16e7SArmin Le Grand { 600facb16e7SArmin Le Grand bool bLeft(false), bRight(false), bTop(false), bBottom(false); 601facb16e7SArmin Le Grand 602facb16e7SArmin Le Grand mbVer = false, mbHor = false; 603facb16e7SArmin Le Grand 604facb16e7SArmin Le Grand if(!pBoxInfoItem->IsValid( VALID_VERT ) || pBoxInfoItem->GetVert()) 605facb16e7SArmin Le Grand mbVer = true; 606facb16e7SArmin Le Grand 607facb16e7SArmin Le Grand if(!pBoxInfoItem->IsValid( VALID_HORI ) || pBoxInfoItem->GetHori()) 608facb16e7SArmin Le Grand mbHor = true; 609facb16e7SArmin Le Grand 610facb16e7SArmin Le Grand if(!pBoxInfoItem->IsValid( VALID_LEFT ) || mbLeft) 611facb16e7SArmin Le Grand bLeft = true; 612facb16e7SArmin Le Grand 613facb16e7SArmin Le Grand if(!pBoxInfoItem->IsValid( VALID_RIGHT ) || mbRight) 614facb16e7SArmin Le Grand bRight = true; 615facb16e7SArmin Le Grand 616facb16e7SArmin Le Grand if(!pBoxInfoItem->IsValid( VALID_TOP ) || mbTop) 617facb16e7SArmin Le Grand bTop = true; 618facb16e7SArmin Le Grand 619facb16e7SArmin Le Grand if(!pBoxInfoItem->IsValid( VALID_BOTTOM ) || mbBottom) 620facb16e7SArmin Le Grand bBottom = true; 621facb16e7SArmin Le Grand 622facb16e7SArmin Le Grand if(!Application::GetSettings().GetLayoutRTL()) 623facb16e7SArmin Le Grand mpCellBorderUpdater->UpdateCellBorder(bTop, bBottom, bLeft, bRight, maIMGCellBorder, mbVer, mbHor); 624facb16e7SArmin Le Grand else 625facb16e7SArmin Le Grand mpCellBorderUpdater->UpdateCellBorder(bTop, bBottom, bRight, bLeft, maIMGCellBorder, mbVer, mbHor); 626facb16e7SArmin Le Grand 627facb16e7SArmin Le Grand if(mbVer || mbHor || bLeft || bRight || bTop || bBottom) 628facb16e7SArmin Le Grand mbInnerBorder = true; 629facb16e7SArmin Le Grand else 630facb16e7SArmin Le Grand mbInnerBorder = false; 631facb16e7SArmin Le Grand 632facb16e7SArmin Le Grand UpdateControlState(); 633facb16e7SArmin Le Grand } 634facb16e7SArmin Le Grand } 635facb16e7SArmin Le Grand break; 636facb16e7SArmin Le Grand case SID_ATTR_BORDER_DIAG_TLBR: 637facb16e7SArmin Le Grand if( eState == SFX_ITEM_DONTCARE ) 638facb16e7SArmin Le Grand { 639facb16e7SArmin Le Grand mbTLBR = true; 640facb16e7SArmin Le Grand maTLBRColor.SetColor(COL_TRANSPARENT); 641facb16e7SArmin Le Grand mnTLBRIn = mnTLBROut = mnTLBRDis = 0; 642facb16e7SArmin Le Grand UpdateControlState(); 643facb16e7SArmin Le Grand break; 644facb16e7SArmin Le Grand } 645facb16e7SArmin Le Grand 646facb16e7SArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 647facb16e7SArmin Le Grand { 648facb16e7SArmin Le Grand const SvxLineItem* pItem = dynamic_cast< const SvxLineItem* >(pState); 649facb16e7SArmin Le Grand 650facb16e7SArmin Le Grand if(pItem) 651facb16e7SArmin Le Grand { 652facb16e7SArmin Le Grand const SvxBorderLine* aLine = pItem->GetLine(); 653facb16e7SArmin Le Grand 654facb16e7SArmin Le Grand if(!aLine) 655facb16e7SArmin Le Grand { 656facb16e7SArmin Le Grand mbTLBR = false; 657facb16e7SArmin Le Grand } 658facb16e7SArmin Le Grand else 659facb16e7SArmin Le Grand { 660facb16e7SArmin Le Grand mbTLBR = true; 661facb16e7SArmin Le Grand maTLBRColor = aLine->GetColor(); 662facb16e7SArmin Le Grand mnTLBRIn = aLine->GetInWidth(); 663facb16e7SArmin Le Grand mnTLBROut = aLine->GetOutWidth(); 664facb16e7SArmin Le Grand mnTLBRDis = aLine->GetDistance(); 665facb16e7SArmin Le Grand 666facb16e7SArmin Le Grand if(mnTLBRIn == 0 && mnTLBROut == 0 && mnTLBRDis == 0) 667facb16e7SArmin Le Grand mbTLBR = false; 668facb16e7SArmin Le Grand } 669facb16e7SArmin Le Grand 670facb16e7SArmin Le Grand UpdateControlState(); 671facb16e7SArmin Le Grand break; 672facb16e7SArmin Le Grand } 673facb16e7SArmin Le Grand } 674facb16e7SArmin Le Grand 675facb16e7SArmin Le Grand mbTLBR = false; 676facb16e7SArmin Le Grand UpdateControlState(); 677facb16e7SArmin Le Grand break; 678facb16e7SArmin Le Grand case SID_ATTR_BORDER_DIAG_BLTR: 679facb16e7SArmin Le Grand if( eState == SFX_ITEM_DONTCARE ) 680facb16e7SArmin Le Grand { 681facb16e7SArmin Le Grand mbBLTR = true; 682facb16e7SArmin Le Grand maBLTRColor.SetColor( COL_TRANSPARENT ); 683facb16e7SArmin Le Grand mnBLTRIn = mnBLTROut = mnBLTRDis = 0; 684facb16e7SArmin Le Grand UpdateControlState(); 685facb16e7SArmin Le Grand break; 686facb16e7SArmin Le Grand } 687facb16e7SArmin Le Grand 688facb16e7SArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 689facb16e7SArmin Le Grand { 690facb16e7SArmin Le Grand const SvxLineItem* pItem = dynamic_cast< const SvxLineItem* >(pState); 691facb16e7SArmin Le Grand 692facb16e7SArmin Le Grand if(pItem) 693facb16e7SArmin Le Grand { 694facb16e7SArmin Le Grand const SvxBorderLine* aLine = pItem->GetLine(); 695facb16e7SArmin Le Grand 696facb16e7SArmin Le Grand if(!aLine) 697facb16e7SArmin Le Grand { 698facb16e7SArmin Le Grand mbBLTR = false; 699facb16e7SArmin Le Grand } 700facb16e7SArmin Le Grand else 701facb16e7SArmin Le Grand { 702facb16e7SArmin Le Grand mbBLTR = true; 703facb16e7SArmin Le Grand maBLTRColor = aLine->GetColor(); 704facb16e7SArmin Le Grand mnBLTRIn = aLine->GetInWidth(); 705facb16e7SArmin Le Grand mnBLTROut = aLine->GetOutWidth(); 706facb16e7SArmin Le Grand mnBLTRDis = aLine->GetDistance(); 707facb16e7SArmin Le Grand 708facb16e7SArmin Le Grand if(mnBLTRIn == 0 && mnBLTROut == 0 && mnBLTRDis == 0) 709facb16e7SArmin Le Grand mbBLTR = false; 710facb16e7SArmin Le Grand } 711facb16e7SArmin Le Grand 712facb16e7SArmin Le Grand UpdateControlState(); 713facb16e7SArmin Le Grand } 714facb16e7SArmin Le Grand break; 715facb16e7SArmin Le Grand } 716facb16e7SArmin Le Grand 717facb16e7SArmin Le Grand mbBLTR = false; 718facb16e7SArmin Le Grand UpdateControlState(); 719facb16e7SArmin Le Grand break; 720facb16e7SArmin Le Grand case SID_SCGRIDSHOW: 721facb16e7SArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 722facb16e7SArmin Le Grand { 723facb16e7SArmin Le Grand const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState); 724facb16e7SArmin Le Grand 725facb16e7SArmin Le Grand if(pItem) 726facb16e7SArmin Le Grand { 727facb16e7SArmin Le Grand const bool bVal = pItem->GetValue(); 728facb16e7SArmin Le Grand 729facb16e7SArmin Le Grand if(bVal) 730facb16e7SArmin Le Grand mpCBXShowGrid->Check(true); 731facb16e7SArmin Le Grand else 732facb16e7SArmin Le Grand mpCBXShowGrid->Check(false); 733facb16e7SArmin Le Grand } 734facb16e7SArmin Le Grand } 735facb16e7SArmin Le Grand break; 736facb16e7SArmin Le Grand } 737facb16e7SArmin Le Grand } 738facb16e7SArmin Le Grand 739facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 740facb16e7SArmin Le Grand 741facb16e7SArmin Le Grand SfxBindings* CellAppearancePropertyPanel::GetBindings() 742facb16e7SArmin Le Grand { 743facb16e7SArmin Le Grand return mpBindings; 744facb16e7SArmin Le Grand } 745facb16e7SArmin Le Grand 746facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 747facb16e7SArmin Le Grand 748facb16e7SArmin Le Grand void CellAppearancePropertyPanel::SetStyleIcon() 749facb16e7SArmin Le Grand { 750facb16e7SArmin Le Grand if(mnOut == DEF_LINE_WIDTH_0 && mnIn == 0 && mnDis == 0) //1 751facb16e7SArmin Le Grand mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle1H : maIMGLineStyle1); 752facb16e7SArmin Le Grand else if(mnOut == DEF_LINE_WIDTH_2 && mnIn == 0 && mnDis == 0) //2 753facb16e7SArmin Le Grand mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle2H :maIMGLineStyle2); 754facb16e7SArmin Le Grand else if(mnOut == DEF_LINE_WIDTH_3 && mnIn == 0 && mnDis == 0) //3 755facb16e7SArmin Le Grand mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle3H :maIMGLineStyle3); 756facb16e7SArmin Le Grand else if(mnOut == DEF_LINE_WIDTH_4 && mnIn == 0 && mnDis == 0) //4 757facb16e7SArmin Le Grand mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle4H :maIMGLineStyle4); 758facb16e7SArmin Le Grand else if(mnOut == DEF_DOUBLE_LINE0_OUT && mnIn == DEF_DOUBLE_LINE0_IN && mnDis == DEF_DOUBLE_LINE0_DIST) //5 759facb16e7SArmin Le Grand mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle5H :maIMGLineStyle5); 760facb16e7SArmin Le Grand else if(mnOut == DEF_DOUBLE_LINE7_OUT && mnIn == DEF_DOUBLE_LINE7_IN && mnDis == DEF_DOUBLE_LINE7_DIST) //6 761facb16e7SArmin Le Grand mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle6H :maIMGLineStyle6); 762facb16e7SArmin Le Grand else if(mnOut == DEF_DOUBLE_LINE4_OUT && mnIn == DEF_DOUBLE_LINE4_IN && mnDis == DEF_DOUBLE_LINE4_DIST) //7 763facb16e7SArmin Le Grand mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle7H :maIMGLineStyle7); 764facb16e7SArmin Le Grand else if(mnOut == DEF_DOUBLE_LINE9_OUT && mnIn == DEF_DOUBLE_LINE9_IN && mnDis == DEF_DOUBLE_LINE9_DIST) //8 765facb16e7SArmin Le Grand mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle8H :maIMGLineStyle8); 766facb16e7SArmin Le Grand else if(mnOut == DEF_DOUBLE_LINE2_OUT && mnIn == DEF_DOUBLE_LINE2_IN && mnDis == DEF_DOUBLE_LINE2_DIST) //9 767facb16e7SArmin Le Grand mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle9H :maIMGLineStyle9); 768facb16e7SArmin Le Grand else 769facb16e7SArmin Le Grand mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, GetDisplayBackground().GetColor().IsDark() ? maIMGLineStyle1H :maIMGLineStyle1); 770facb16e7SArmin Le Grand } 771facb16e7SArmin Le Grand 772facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 773facb16e7SArmin Le Grand 774facb16e7SArmin Le Grand void CellAppearancePropertyPanel::UpdateControlState() 775facb16e7SArmin Le Grand { 776facb16e7SArmin Le Grand if(mbOuterBorder || mbInnerBorder || mbTLBR || mbBLTR) 777facb16e7SArmin Le Grand { 778facb16e7SArmin Le Grand mpTBLineColor->Enable(); 779facb16e7SArmin Le Grand mpTBLineStyle->Enable(); 780facb16e7SArmin Le Grand 781facb16e7SArmin Le Grand //set line color state 782facb16e7SArmin Le Grand if( mbLineColorAvailable && !mbTLBR && !mbBLTR ) 783facb16e7SArmin Le Grand mpLineColorUpdater->Update(maLineColor); 784facb16e7SArmin Le Grand else if( !mbLineColorAvailable && mbTLBR && !mbBLTR ) 785facb16e7SArmin Le Grand mpLineColorUpdater->Update(maTLBRColor); 786facb16e7SArmin Le Grand else if ( !mbLineColorAvailable && !mbTLBR && mbBLTR ) 787facb16e7SArmin Le Grand mpLineColorUpdater->Update(maBLTRColor); 788facb16e7SArmin Le Grand else if( !mbLineColorAvailable && mbTLBR && mbBLTR) 789facb16e7SArmin Le Grand { 790facb16e7SArmin Le Grand if( maTLBRColor == maBLTRColor) 791facb16e7SArmin Le Grand mpLineColorUpdater->Update(maBLTRColor); 792facb16e7SArmin Le Grand else 793facb16e7SArmin Le Grand mpLineColorUpdater->Update(COL_TRANSPARENT); 794facb16e7SArmin Le Grand } 795facb16e7SArmin Le Grand else if( mbLineColorAvailable && mbTLBR && !mbBLTR ) 796facb16e7SArmin Le Grand { 797facb16e7SArmin Le Grand if( maTLBRColor == maLineColor) 798facb16e7SArmin Le Grand mpLineColorUpdater->Update(maLineColor); 799facb16e7SArmin Le Grand else 800facb16e7SArmin Le Grand mpLineColorUpdater->Update(COL_TRANSPARENT); 801facb16e7SArmin Le Grand } 802facb16e7SArmin Le Grand else if( mbLineColorAvailable && !mbTLBR && mbBLTR ) 803facb16e7SArmin Le Grand { 804facb16e7SArmin Le Grand if( maBLTRColor == maLineColor) 805facb16e7SArmin Le Grand mpLineColorUpdater->Update(maLineColor); 806facb16e7SArmin Le Grand else 807facb16e7SArmin Le Grand mpLineColorUpdater->Update(COL_TRANSPARENT); 808facb16e7SArmin Le Grand } 809facb16e7SArmin Le Grand else 810facb16e7SArmin Le Grand mpLineColorUpdater->Update(COL_TRANSPARENT); 811facb16e7SArmin Le Grand 812facb16e7SArmin Le Grand //set line style state 813facb16e7SArmin Le Grand if( mbBorderStyleAvailable && !mbTLBR && !mbBLTR ) 814facb16e7SArmin Le Grand { 815facb16e7SArmin Le Grand } 816facb16e7SArmin Le Grand else if( !mbBorderStyleAvailable && mbTLBR && !mbBLTR ) 817facb16e7SArmin Le Grand { 818facb16e7SArmin Le Grand mnIn = mnTLBRIn; 819facb16e7SArmin Le Grand mnOut = mnTLBROut; 820facb16e7SArmin Le Grand mnDis = mnTLBRDis; 821facb16e7SArmin Le Grand } 822facb16e7SArmin Le Grand else if ( !mbBorderStyleAvailable && !mbTLBR && mbBLTR ) 823facb16e7SArmin Le Grand { 824facb16e7SArmin Le Grand mnIn = mnBLTRIn; 825facb16e7SArmin Le Grand mnOut = mnBLTROut; 826facb16e7SArmin Le Grand mnDis = mnBLTRDis; 827facb16e7SArmin Le Grand } 828facb16e7SArmin Le Grand else if( !mbBorderStyleAvailable && mbTLBR && mbBLTR) 829facb16e7SArmin Le Grand { 830facb16e7SArmin Le Grand if( mnTLBRIn == mnBLTRIn && mnTLBROut == mnBLTROut && mnTLBRDis == mnBLTRDis) 831facb16e7SArmin Le Grand { 832facb16e7SArmin Le Grand mnIn = mnTLBRIn; 833facb16e7SArmin Le Grand mnOut = mnTLBROut; 834facb16e7SArmin Le Grand mnDis = mnTLBRDis; 835facb16e7SArmin Le Grand } 836facb16e7SArmin Le Grand else 837facb16e7SArmin Le Grand { 838facb16e7SArmin Le Grand mnIn = 0; 839facb16e7SArmin Le Grand mnOut = 0; 840facb16e7SArmin Le Grand mnDis = 0; 841facb16e7SArmin Le Grand } 842facb16e7SArmin Le Grand } 843facb16e7SArmin Le Grand else if( mbBorderStyleAvailable && mbTLBR && !mbBLTR ) 844facb16e7SArmin Le Grand { 845facb16e7SArmin Le Grand if( mnTLBRIn != mnIn || mnTLBROut != mnOut || mnTLBRDis != mnDis) 846facb16e7SArmin Le Grand { 847facb16e7SArmin Le Grand mnIn = 0; 848facb16e7SArmin Le Grand mnOut = 0; 849facb16e7SArmin Le Grand mnDis = 0; 850facb16e7SArmin Le Grand } 851facb16e7SArmin Le Grand } 852facb16e7SArmin Le Grand else if( mbBorderStyleAvailable && !mbTLBR && mbBLTR ) 853facb16e7SArmin Le Grand { 854facb16e7SArmin Le Grand if( mnBLTRIn != mnIn || mnBLTROut != mnOut || mnBLTRDis != mnDis ) 855facb16e7SArmin Le Grand { 856facb16e7SArmin Le Grand mnIn = 0; 857facb16e7SArmin Le Grand mnOut = 0; 858facb16e7SArmin Le Grand mnDis = 0; 859facb16e7SArmin Le Grand } 860facb16e7SArmin Le Grand } 861facb16e7SArmin Le Grand else 862facb16e7SArmin Le Grand { 863facb16e7SArmin Le Grand mnIn = 0; 864facb16e7SArmin Le Grand mnOut = 0; 865facb16e7SArmin Le Grand mnDis = 0; 866facb16e7SArmin Le Grand } 867facb16e7SArmin Le Grand SetStyleIcon(); 868facb16e7SArmin Le Grand } 869facb16e7SArmin Le Grand else 870facb16e7SArmin Le Grand { 871facb16e7SArmin Le Grand mpTBLineColor->Disable(); 872facb16e7SArmin Le Grand mpTBLineStyle->Disable(); 873facb16e7SArmin Le Grand } 874facb16e7SArmin Le Grand } 875facb16e7SArmin Le Grand 876facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 877facb16e7SArmin Le Grand // namespace close 878facb16e7SArmin Le Grand 879facb16e7SArmin Le Grand }} // end of namespace ::sc::sidebar 880facb16e7SArmin Le Grand 881facb16e7SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 882facb16e7SArmin Le Grand // eof 883