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