1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sfx2/sidebar/ResourceDefinitions.hrc>
21 #include <sfx2/sidebar/Theme.hxx>
22 #include <sfx2/sidebar/ControlFactory.hxx>
23 #include <CellAppearancePropertyPanel.hxx>
24 #include <CellAppearancePropertyPanel.hrc>
26 #include "scresid.hxx"
27 #include <sfx2/bindings.hxx>
28 #include <sfx2/dispatch.hxx>
29 #include <vcl/fixed.hxx>
30 #include <svx/tbxcolorupdate.hxx>
31 #include <svl/eitem.hxx>
32 #include <editeng/borderline.hxx>
33 #include <editeng/boxitem.hxx>
34 #include <editeng/colritem.hxx>
35 #include <editeng/lineitem.hxx>
36 #include <vcl/svapp.hxx>
37 #include <svx/sidebar/ColorControl.hxx>
38 #include <boost/bind.hpp>
39 #include <svx/sidebar/PopupContainer.hxx>
40 #include <CellLineStyleControl.hxx>
41 #include <CellLineStylePopup.hxx>
42 #include <CellBorderUpdater.hxx>
43 #include <CellBorderStyleControl.hxx>
44 #include <CellBorderStylePopup.hxx>
49 const char UNO_BACKGROUNDCOLOR
[] = ".uno:BackgroundColor";
50 const char UNO_SETBORDERSTYLE
[] = ".uno:SetBorderStyle";
51 const char UNO_LINESTYLE
[] = ".uno:LineStyle";
52 const char UNO_FRAMELINECOLOR
[] = ".uno:FrameLineColor";
54 //////////////////////////////////////////////////////////////////////////////
59 Color
GetTransparentColor(void)
61 return COL_TRANSPARENT
;
63 } // end of anonymous namespace
65 //////////////////////////////////////////////////////////////////////////////
68 namespace sc
{ namespace sidebar
{
70 //////////////////////////////////////////////////////////////////////////////
72 svx::sidebar::PopupControl
* CellAppearancePropertyPanel::CreateFillColorPopupControl(svx::sidebar::PopupContainer
* pParent
)
74 const ScResId
aResId(VS_NOFILLCOLOR
);
76 return new svx::sidebar::ColorControl(
79 ScResId(RID_POPUPPANEL_CELLAPPEARANCE_FILLCOLOR
),
80 ScResId(VS_FILLCOLOR
),
81 ::boost::bind(GetTransparentColor
),
82 ::boost::bind(&CellAppearancePropertyPanel::SetFillColor
, this, _1
, _2
),
87 void CellAppearancePropertyPanel::SetFillColor(
88 const OUString
& /*rsColorName*/,
91 const SvxColorItem
aColorItem(aColor
, SID_BACKGROUND_COLOR
);
92 mpBindings
->GetDispatcher()->Execute(SID_BACKGROUND_COLOR
, SFX_CALLMODE_RECORD
, &aColorItem
, 0L);
96 //////////////////////////////////////////////////////////////////////////////
98 svx::sidebar::PopupControl
* CellAppearancePropertyPanel::CreateLineColorPopupControl(svx::sidebar::PopupContainer
* pParent
)
100 return new svx::sidebar::ColorControl(
103 ScResId(RID_POPUPPANEL_CELLAPPEARANCE_LINECOLOR
),
104 ScResId(VS_LINECOLOR
),
105 ::boost::bind(GetTransparentColor
),
106 ::boost::bind(&CellAppearancePropertyPanel::SetLineColor
, this, _1
, _2
),
111 void CellAppearancePropertyPanel::SetLineColor(
112 const OUString
& /*rsColorName*/,
115 const SvxColorItem
aColorItem(aColor
, SID_FRAME_LINECOLOR
);
116 mpBindings
->GetDispatcher()->Execute(SID_FRAME_LINECOLOR
, SFX_CALLMODE_RECORD
, &aColorItem
, 0L);
117 maLineColor
= aColor
;
120 //////////////////////////////////////////////////////////////////////////////
122 svx::sidebar::PopupControl
* CellAppearancePropertyPanel::CreateCellLineStylePopupControl(svx::sidebar::PopupContainer
* pParent
)
124 return new CellLineStyleControl(pParent
, *this);
127 void CellAppearancePropertyPanel::EndCellLineStylePopupMode(void)
129 if(mpCellLineStylePopup
.get())
131 mpCellLineStylePopup
->Hide();
135 //////////////////////////////////////////////////////////////////////////////
137 svx::sidebar::PopupControl
* CellAppearancePropertyPanel::CreateCellBorderStylePopupControl(svx::sidebar::PopupContainer
* pParent
)
139 return new CellBorderStyleControl(pParent
, *this);
142 void CellAppearancePropertyPanel::EndCellBorderStylePopupMode(void)
144 if(mpCellBorderStylePopup
.get())
146 mpCellBorderStylePopup
->Hide();
150 //////////////////////////////////////////////////////////////////////////////
152 CellAppearancePropertyPanel::CellAppearancePropertyPanel(
154 const cssu::Reference
<css::frame::XFrame
>& rxFrame
,
155 SfxBindings
* pBindings
)
156 : PanelLayout(pParent
, "CellAppearancePropertyPanel", "modules/scalc/ui/sidebarcellappearance.ui", rxFrame
),
158 maBackColorControl(SID_BACKGROUND_COLOR
, *pBindings
, *this),
159 maLineColorControl(SID_FRAME_LINECOLOR
, *pBindings
, *this),
160 maLineStyleControl(SID_FRAME_LINESTYLE
, *pBindings
, *this),
161 maBorderOuterControl(SID_ATTR_BORDER_OUTER
, *pBindings
, *this),
162 maBorderInnerControl(SID_ATTR_BORDER_INNER
, *pBindings
, *this),
163 maGridShowControl(SID_SCGRIDSHOW
, *pBindings
, *this),
164 maBorderTLBRControl(SID_ATTR_BORDER_DIAG_TLBR
, *pBindings
, *this),
165 maBorderBLTRControl(SID_ATTR_BORDER_DIAG_BLTR
, *pBindings
, *this),
167 maIMGCellBorder(ScResId(IMG_CELL_BORDER
)),
168 maIMGLineStyle1(ScResId(IMG_LINE_STYLE1
)),
169 maIMGLineStyle2(ScResId(IMG_LINE_STYLE2
)),
170 maIMGLineStyle3(ScResId(IMG_LINE_STYLE3
)),
171 maIMGLineStyle4(ScResId(IMG_LINE_STYLE4
)),
172 maIMGLineStyle5(ScResId(IMG_LINE_STYLE5
)),
173 maIMGLineStyle6(ScResId(IMG_LINE_STYLE6
)),
174 maIMGLineStyle7(ScResId(IMG_LINE_STYLE7
)),
175 maIMGLineStyle8(ScResId(IMG_LINE_STYLE8
)),
176 maIMGLineStyle9(ScResId(IMG_LINE_STYLE9
)),
178 maBackColor(COL_TRANSPARENT
),
179 maLineColor(COL_BLACK
),
180 maTLBRColor(COL_BLACK
),
181 maBLTRColor(COL_BLACK
),
191 mbBackColorAvailable(true),
192 mbLineColorAvailable(true),
193 mbBorderStyleAvailable(true),
200 mbOuterBorder(false),
201 mbInnerBorder(false),
205 maFillColorPopup(this, ::boost::bind(&CellAppearancePropertyPanel::CreateFillColorPopupControl
, this, _1
)),
206 maLineColorPopup(this, ::boost::bind(&CellAppearancePropertyPanel::CreateLineColorPopupControl
, this, _1
)),
207 mpCellLineStylePopup(),
208 mpCellBorderStylePopup(),
212 mpBindings(pBindings
)
214 get(mpTBFillColor
, "cellbackgroundcolor");
215 get(mpTBCellBorder
, "cellbordertype");
216 get(mpTBLineStyle
, "borderlinestyle");
217 get(mpTBLineColor
, "borderlinecolor");
218 get(mpCBXShowGrid
, "cellgridlines");
220 mpFillColorUpdater
.reset( new ::svx::ToolboxButtonColorUpdater(SID_ATTR_BRUSH
,
221 mpTBFillColor
->GetItemId( UNO_BACKGROUNDCOLOR
),
223 mpLineColorUpdater
.reset( new ::svx::ToolboxButtonColorUpdater(SID_FRAME_LINECOLOR
,
224 mpTBLineColor
->GetItemId( UNO_FRAMELINECOLOR
),
226 mpCellBorderUpdater
.reset( new CellBorderUpdater(
227 mpTBCellBorder
->GetItemId( UNO_SETBORDERSTYLE
), *mpTBCellBorder
) );
232 //////////////////////////////////////////////////////////////////////////////
234 CellAppearancePropertyPanel::~CellAppearancePropertyPanel()
238 //////////////////////////////////////////////////////////////////////////////
240 void CellAppearancePropertyPanel::Initialize()
242 const sal_uInt16 nIdBkColor
= mpTBFillColor
->GetItemId( UNO_BACKGROUNDCOLOR
);
243 mpTBFillColor
->SetItemBits( nIdBkColor
, mpTBFillColor
->GetItemBits( nIdBkColor
) | TIB_DROPDOWNONLY
);
244 Link aLink
= LINK(this, CellAppearancePropertyPanel
, TbxBKColorSelectHdl
);
245 mpTBFillColor
->SetDropdownClickHdl ( aLink
);
246 mpTBFillColor
->SetSelectHdl ( aLink
);
248 const sal_uInt16 nIdBorderType
= mpTBCellBorder
->GetItemId( UNO_SETBORDERSTYLE
);
249 mpTBCellBorder
->SetItemImage( nIdBorderType
, maIMGCellBorder
);
250 mpTBCellBorder
->SetItemBits( nIdBorderType
, mpTBCellBorder
->GetItemBits( nIdBorderType
) | TIB_DROPDOWNONLY
);
251 aLink
= LINK(this, CellAppearancePropertyPanel
, TbxCellBorderSelectHdl
);
252 mpTBCellBorder
->SetDropdownClickHdl ( aLink
);
253 mpTBCellBorder
->SetSelectHdl ( aLink
);
255 const sal_uInt16 nIdBorderLineStyle
= mpTBLineStyle
->GetItemId( UNO_LINESTYLE
);
256 mpTBLineStyle
->SetItemImage( nIdBorderLineStyle
, maIMGLineStyle1
);
257 mpTBLineStyle
->SetItemBits( nIdBorderLineStyle
, mpTBLineStyle
->GetItemBits( nIdBorderLineStyle
) | TIB_DROPDOWNONLY
);
258 aLink
= LINK(this, CellAppearancePropertyPanel
, TbxLineStyleSelectHdl
);
259 mpTBLineStyle
->SetDropdownClickHdl ( aLink
);
260 mpTBLineStyle
->SetSelectHdl ( aLink
);
261 mpTBLineStyle
->Disable();
263 const sal_uInt16 nIdBorderLinecolor
= mpTBLineColor
->GetItemId( UNO_FRAMELINECOLOR
);
264 mpTBLineColor
->SetItemBits( nIdBorderLinecolor
, mpTBLineColor
->GetItemBits( nIdBorderLinecolor
) | TIB_DROPDOWNONLY
);
265 aLink
= LINK(this, CellAppearancePropertyPanel
, TbxLineColorSelectHdl
);
266 mpTBLineColor
->SetDropdownClickHdl ( aLink
);
267 mpTBLineColor
->SetSelectHdl ( aLink
);
268 mpTBLineColor
->Disable();
270 aLink
= LINK(this, CellAppearancePropertyPanel
, CBOXGridShowClkHdl
);
271 mpCBXShowGrid
->SetClickHdl ( aLink
);
273 mpTBLineColor
->SetAccessibleRelationLabeledBy(mpTBLineColor
);
274 mpTBLineStyle
->SetAccessibleRelationLabeledBy(mpTBLineStyle
);
277 //////////////////////////////////////////////////////////////////////////////
279 IMPL_LINK(CellAppearancePropertyPanel
, TbxBKColorSelectHdl
, ToolBox
*, pToolBox
)
281 const OUString
aCommand(pToolBox
->GetItemCommand(pToolBox
->GetCurItemId()));
283 if(aCommand
== UNO_BACKGROUNDCOLOR
)
285 maFillColorPopup
.Show(*pToolBox
);
286 maFillColorPopup
.SetCurrentColor(maBackColor
, mbBackColorAvailable
);
291 //////////////////////////////////////////////////////////////////////////////
293 IMPL_LINK(CellAppearancePropertyPanel
, TbxLineColorSelectHdl
, ToolBox
*, pToolBox
)
295 const OUString
aCommand(pToolBox
->GetItemCommand(pToolBox
->GetCurItemId()));
297 if(aCommand
== UNO_FRAMELINECOLOR
)
299 maLineColorPopup
.Show(*pToolBox
);
300 maLineColorPopup
.SetCurrentColor(maLineColor
, mbLineColorAvailable
);
305 //////////////////////////////////////////////////////////////////////////////
307 IMPL_LINK(CellAppearancePropertyPanel
, TbxCellBorderSelectHdl
, ToolBox
*, pToolBox
)
309 const OUString
aCommand(pToolBox
->GetItemCommand(pToolBox
->GetCurItemId()));
311 if(aCommand
== UNO_SETBORDERSTYLE
)
313 // create popup on demand
314 if(!mpCellBorderStylePopup
.get())
316 mpCellBorderStylePopup
.reset(
317 new CellBorderStylePopup(
319 ::boost::bind(&CellAppearancePropertyPanel::CreateCellBorderStylePopupControl
, this, _1
)));
322 if(mpCellBorderStylePopup
.get())
324 mpCellBorderStylePopup
->Show(*pToolBox
);
330 //////////////////////////////////////////////////////////////////////////////
332 IMPL_LINK(CellAppearancePropertyPanel
, TbxLineStyleSelectHdl
, ToolBox
*, pToolBox
)
334 const OUString
aCommand(pToolBox
->GetItemCommand(pToolBox
->GetCurItemId()));
336 if(aCommand
== UNO_LINESTYLE
)
338 // create popup on demand
339 if(!mpCellLineStylePopup
.get())
341 mpCellLineStylePopup
.reset(
342 new CellLineStylePopup(
344 ::boost::bind(&CellAppearancePropertyPanel::CreateCellLineStylePopupControl
, this, _1
)));
347 if(mpCellLineStylePopup
.get())
349 mpCellLineStylePopup
->SetLineStyleSelect(mnOut
, mnIn
, mnDis
);
350 mpCellLineStylePopup
->Show(*pToolBox
);
356 //////////////////////////////////////////////////////////////////////////////
358 IMPL_LINK(CellAppearancePropertyPanel
, CBOXGridShowClkHdl
, void*, EMPTYARG
)
360 bool bState
= mpCBXShowGrid
->IsChecked();
361 SfxBoolItem
aItem( SID_SCGRIDSHOW
, bState
);
362 GetBindings()->GetDispatcher()->Execute(SID_SCGRIDSHOW
, SFX_CALLMODE_RECORD
, &aItem
, false, 0L);
366 //////////////////////////////////////////////////////////////////////////////
368 CellAppearancePropertyPanel
* CellAppearancePropertyPanel::Create (
370 const cssu::Reference
<css::frame::XFrame
>& rxFrame
,
371 SfxBindings
* pBindings
)
374 throw lang::IllegalArgumentException("no parent Window given to CellAppearancePropertyPanel::Create", NULL
, 0);
376 throw lang::IllegalArgumentException("no XFrame given to CellAppearancePropertyPanel::Create", NULL
, 1);
377 if (pBindings
== NULL
)
378 throw lang::IllegalArgumentException("no SfxBindings given to CellAppearancePropertyPanel::Create", NULL
, 2);
380 return new CellAppearancePropertyPanel(
386 //////////////////////////////////////////////////////////////////////////////
388 void CellAppearancePropertyPanel::DataChanged(
389 const DataChangedEvent
& rEvent
)
394 //////////////////////////////////////////////////////////////////////////////
396 void CellAppearancePropertyPanel::HandleContextChange(
397 const ::sfx2::sidebar::EnumContext aContext
)
399 if(maContext
== aContext
)
405 maContext
= aContext
;
412 //////////////////////////////////////////////////////////////////////////////
414 void CellAppearancePropertyPanel::NotifyItemUpdate(
417 const SfxPoolItem
* pState
,
418 const bool bIsEnabled
)
424 case SID_BACKGROUND_COLOR
:
425 if(eState
>= SFX_ITEM_DEFAULT
)
427 const SvxColorItem
* pSvxColorItem
= dynamic_cast< const SvxColorItem
* >(pState
);
431 maBackColor
= ((const SvxColorItem
*)pState
)->GetValue();
432 mbBackColorAvailable
= true;
433 mpFillColorUpdater
->Update(maBackColor
);
438 mbBackColorAvailable
= false;
439 maBackColor
.SetColor(COL_TRANSPARENT
);
440 mpFillColorUpdater
->Update(COL_TRANSPARENT
);
442 case SID_FRAME_LINECOLOR
:
443 if( eState
== SFX_ITEM_DONTCARE
)
445 mbLineColorAvailable
= true;
446 maLineColor
.SetColor( COL_TRANSPARENT
);
447 UpdateControlState();
451 if(eState
>= SFX_ITEM_DEFAULT
&& pState
&& pState
->ISA(SvxColorItem
) )
453 const SvxColorItem
* pSvxColorItem
= dynamic_cast< const SvxColorItem
* >(pState
);
457 maLineColor
= ((const SvxColorItem
*)pState
)->GetValue();
458 if(maLineColor
== COL_AUTO
)
459 mbLineColorAvailable
= false;
462 mbLineColorAvailable
= true;
463 // mpLineColorUpdater->Update(maLineColor);
466 UpdateControlState();
471 mbLineColorAvailable
= false;
472 maLineColor
.SetColor(COL_AUTO
);
473 // mpLineColorUpdater->Update(maLineColor);
474 UpdateControlState();
476 case SID_FRAME_LINESTYLE
:
477 if( eState
== SFX_ITEM_DONTCARE
)
479 mbBorderStyleAvailable
= true;
487 if(eState
>= SFX_ITEM_DEFAULT
)
489 const SvxLineItem
* pSvxLineItem
= dynamic_cast< const SvxLineItem
* >(pState
);
493 const editeng::SvxBorderLine
* mbLineItem
= pSvxLineItem
->GetLine();
494 mnIn
= mbLineItem
->GetInWidth();
495 mnOut
= mbLineItem
->GetOutWidth();
496 mnDis
= mbLineItem
->GetDistance();
498 if(mnIn
== 0 && mnOut
== 0 && mnDis
== 0)
499 mbBorderStyleAvailable
= false;
501 mbBorderStyleAvailable
= true;
508 mbBorderStyleAvailable
= false;
511 case SID_ATTR_BORDER_OUTER
:
512 if(eState
>= SFX_ITEM_DEFAULT
)
514 const SvxBoxItem
* pBoxItem
= dynamic_cast< const SvxBoxItem
* >(pState
);
518 mbLeft
=false, mbRight
=false, mbTop
=false, mbBottom
=false;
520 if(pBoxItem
->GetLeft())
523 if(pBoxItem
->GetRight())
526 if(pBoxItem
->GetTop())
529 if(pBoxItem
->GetBottom())
532 if(!Application::GetSettings().GetLayoutRTL())
533 mpCellBorderUpdater
->UpdateCellBorder(mbTop
, mbBottom
, mbLeft
, mbRight
, maIMGCellBorder
, mbVer
, mbHor
);
535 mpCellBorderUpdater
->UpdateCellBorder(mbTop
, mbBottom
, mbRight
, mbLeft
, maIMGCellBorder
, mbVer
, mbHor
);
537 if(mbLeft
|| mbRight
|| mbTop
|| mbBottom
)
538 mbOuterBorder
= true;
540 mbOuterBorder
= false;
542 UpdateControlState();
546 case SID_ATTR_BORDER_INNER
:
547 if(eState
>= SFX_ITEM_DEFAULT
)
549 const SvxBoxInfoItem
* pBoxInfoItem
= dynamic_cast< const SvxBoxInfoItem
* >(pState
);
553 bool bLeft(false), bRight(false), bTop(false), bBottom(false);
555 mbVer
= false, mbHor
= false;
557 if(!pBoxInfoItem
->IsValid( VALID_VERT
) || pBoxInfoItem
->GetVert())
560 if(!pBoxInfoItem
->IsValid( VALID_HORI
) || pBoxInfoItem
->GetHori())
563 if(!pBoxInfoItem
->IsValid( VALID_LEFT
) || mbLeft
)
566 if(!pBoxInfoItem
->IsValid( VALID_RIGHT
) || mbRight
)
569 if(!pBoxInfoItem
->IsValid( VALID_TOP
) || mbTop
)
572 if(!pBoxInfoItem
->IsValid( VALID_BOTTOM
) || mbBottom
)
575 if(!Application::GetSettings().GetLayoutRTL())
576 mpCellBorderUpdater
->UpdateCellBorder(bTop
, bBottom
, bLeft
, bRight
, maIMGCellBorder
, mbVer
, mbHor
);
578 mpCellBorderUpdater
->UpdateCellBorder(bTop
, bBottom
, bRight
, bLeft
, maIMGCellBorder
, mbVer
, mbHor
);
580 if(mbVer
|| mbHor
|| bLeft
|| bRight
|| bTop
|| bBottom
)
581 mbInnerBorder
= true;
583 mbInnerBorder
= false;
585 UpdateControlState();
589 case SID_ATTR_BORDER_DIAG_TLBR
:
590 if( eState
== SFX_ITEM_DONTCARE
)
593 maTLBRColor
.SetColor(COL_TRANSPARENT
);
594 mnTLBRIn
= mnTLBROut
= mnTLBRDis
= 0;
595 UpdateControlState();
599 if(eState
>= SFX_ITEM_DEFAULT
)
601 const SvxLineItem
* pItem
= dynamic_cast< const SvxLineItem
* >(pState
);
605 const editeng::SvxBorderLine
* aLine
= pItem
->GetLine();
614 maTLBRColor
= aLine
->GetColor();
615 mnTLBRIn
= aLine
->GetInWidth();
616 mnTLBROut
= aLine
->GetOutWidth();
617 mnTLBRDis
= aLine
->GetDistance();
619 if(mnTLBRIn
== 0 && mnTLBROut
== 0 && mnTLBRDis
== 0)
623 UpdateControlState();
629 UpdateControlState();
631 case SID_ATTR_BORDER_DIAG_BLTR
:
632 if( eState
== SFX_ITEM_DONTCARE
)
635 maBLTRColor
.SetColor( COL_TRANSPARENT
);
636 mnBLTRIn
= mnBLTROut
= mnBLTRDis
= 0;
637 UpdateControlState();
641 if(eState
>= SFX_ITEM_DEFAULT
)
643 const SvxLineItem
* pItem
= dynamic_cast< const SvxLineItem
* >(pState
);
647 const editeng::SvxBorderLine
* aLine
= pItem
->GetLine();
656 maBLTRColor
= aLine
->GetColor();
657 mnBLTRIn
= aLine
->GetInWidth();
658 mnBLTROut
= aLine
->GetOutWidth();
659 mnBLTRDis
= aLine
->GetDistance();
661 if(mnBLTRIn
== 0 && mnBLTROut
== 0 && mnBLTRDis
== 0)
665 UpdateControlState();
671 UpdateControlState();
674 if(eState
>= SFX_ITEM_DEFAULT
)
676 const SfxBoolItem
* pItem
= dynamic_cast< const SfxBoolItem
* >(pState
);
680 const bool bVal
= pItem
->GetValue();
683 mpCBXShowGrid
->Check(true);
685 mpCBXShowGrid
->Check(false);
692 //////////////////////////////////////////////////////////////////////////////
694 SfxBindings
* CellAppearancePropertyPanel::GetBindings()
699 //////////////////////////////////////////////////////////////////////////////
701 void CellAppearancePropertyPanel::SetStyleIcon()
703 const sal_uInt16 nIdBorderLineStyle
= mpTBLineStyle
->GetItemId( UNO_LINESTYLE
);
705 //FIXME: update for new line border possibilities
706 if(mnOut
== DEF_LINE_WIDTH_0
&& mnIn
== 0 && mnDis
== 0) //1
707 mpTBLineStyle
->SetItemImage(nIdBorderLineStyle
, maIMGLineStyle1
);
708 else if(mnOut
== DEF_LINE_WIDTH_2
&& mnIn
== 0 && mnDis
== 0) //2
709 mpTBLineStyle
->SetItemImage(nIdBorderLineStyle
, maIMGLineStyle2
);
710 else if(mnOut
== DEF_LINE_WIDTH_3
&& mnIn
== 0 && mnDis
== 0) //3
711 mpTBLineStyle
->SetItemImage(nIdBorderLineStyle
, maIMGLineStyle3
);
712 else if(mnOut
== DEF_LINE_WIDTH_4
&& mnIn
== 0 && mnDis
== 0) //4
713 mpTBLineStyle
->SetItemImage(nIdBorderLineStyle
, maIMGLineStyle4
);
714 else if(mnOut
== DEF_LINE_WIDTH_0
&& mnIn
== DEF_LINE_WIDTH_0
&& mnDis
== DEF_LINE_WIDTH_1
) //5
715 mpTBLineStyle
->SetItemImage(nIdBorderLineStyle
, maIMGLineStyle5
);
716 else if(mnOut
== DEF_LINE_WIDTH_0
&& mnIn
== DEF_LINE_WIDTH_0
&& mnDis
== DEF_LINE_WIDTH_2
) //6
717 mpTBLineStyle
->SetItemImage(nIdBorderLineStyle
, maIMGLineStyle6
);
718 else if(mnOut
== DEF_LINE_WIDTH_1
&& mnIn
== DEF_LINE_WIDTH_2
&& mnDis
== DEF_LINE_WIDTH_1
) //7
719 mpTBLineStyle
->SetItemImage(nIdBorderLineStyle
, maIMGLineStyle7
);
720 else if(mnOut
== DEF_LINE_WIDTH_2
&& mnIn
== DEF_LINE_WIDTH_0
&& mnDis
== DEF_LINE_WIDTH_2
) //8
721 mpTBLineStyle
->SetItemImage(nIdBorderLineStyle
, maIMGLineStyle8
);
722 else if(mnOut
== DEF_LINE_WIDTH_2
&& mnIn
== DEF_LINE_WIDTH_2
&& mnDis
== DEF_LINE_WIDTH_2
) //9
723 mpTBLineStyle
->SetItemImage(nIdBorderLineStyle
, maIMGLineStyle9
);
725 mpTBLineStyle
->SetItemImage(nIdBorderLineStyle
, maIMGLineStyle1
);
728 void CellAppearancePropertyPanel::UpdateControlState()
730 if(mbOuterBorder
|| mbInnerBorder
|| mbTLBR
|| mbBLTR
)
732 mpTBLineColor
->Enable();
733 mpTBLineStyle
->Enable();
735 //set line color state
736 if( mbLineColorAvailable
&& !mbTLBR
&& !mbBLTR
)
737 mpLineColorUpdater
->Update(maLineColor
);
738 else if( !mbLineColorAvailable
&& mbTLBR
&& !mbBLTR
)
739 mpLineColorUpdater
->Update(maTLBRColor
);
740 else if ( !mbLineColorAvailable
&& !mbTLBR
&& mbBLTR
)
741 mpLineColorUpdater
->Update(maBLTRColor
);
742 else if( !mbLineColorAvailable
&& mbTLBR
&& mbBLTR
)
744 if( maTLBRColor
== maBLTRColor
)
745 mpLineColorUpdater
->Update(maBLTRColor
);
747 mpLineColorUpdater
->Update(COL_TRANSPARENT
);
749 else if( mbLineColorAvailable
&& mbTLBR
&& !mbBLTR
)
751 if( maTLBRColor
== maLineColor
)
752 mpLineColorUpdater
->Update(maLineColor
);
754 mpLineColorUpdater
->Update(COL_TRANSPARENT
);
756 else if( mbLineColorAvailable
&& !mbTLBR
&& mbBLTR
)
758 if( maBLTRColor
== maLineColor
)
759 mpLineColorUpdater
->Update(maLineColor
);
761 mpLineColorUpdater
->Update(COL_TRANSPARENT
);
764 mpLineColorUpdater
->Update(COL_TRANSPARENT
);
766 //set line style state
767 if( mbBorderStyleAvailable
&& !mbTLBR
&& !mbBLTR
)
770 else if( !mbBorderStyleAvailable
&& mbTLBR
&& !mbBLTR
)
776 else if ( !mbBorderStyleAvailable
&& !mbTLBR
&& mbBLTR
)
782 else if( !mbBorderStyleAvailable
&& mbTLBR
&& mbBLTR
)
784 if( mnTLBRIn
== mnBLTRIn
&& mnTLBROut
== mnBLTROut
&& mnTLBRDis
== mnBLTRDis
)
797 else if( mbBorderStyleAvailable
&& mbTLBR
&& !mbBLTR
)
799 if( mnTLBRIn
!= mnIn
|| mnTLBROut
!= mnOut
|| mnTLBRDis
!= mnDis
)
806 else if( mbBorderStyleAvailable
&& !mbTLBR
&& mbBLTR
)
808 if( mnBLTRIn
!= mnIn
|| mnBLTROut
!= mnOut
|| mnBLTRDis
!= mnDis
)
825 mpTBLineColor
->Disable();
826 mpTBLineStyle
->Disable();
830 //////////////////////////////////////////////////////////////////////////////
833 }} // end of namespace ::sc::sidebar
835 //////////////////////////////////////////////////////////////////////////////
838 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */