1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22 #include <sfx2/sidebar/ResourceDefinitions.hrc>
23 #include <sfx2/sidebar/Theme.hxx>
24 #include <sfx2/sidebar/ControlFactory.hxx>
25 #include <sfx2/sidebar/Layouter.hxx>
26 #include <LinePropertyPanel.hxx>
27 #include <LinePropertyPanel.hrc>
28 #include <svx/dialogs.hrc>
29 #include <svx/dialmgr.hxx>
30 #include <sfx2/objsh.hxx>
31 #include <sfx2/bindings.hxx>
32 #include <sfx2/dispatch.hxx>
33 #include <svx/xlnclit.hxx>
34 #include <svx/xtable.hxx>
35 #include <svx/xdash.hxx>
36 #include <svx/drawitem.hxx>
37 #include <svx/svxitems.hrc>
38 #include <svtools/valueset.hxx>
39 #include <unotools/pathoptions.hxx>
40 #include <unotools/viewoptions.hxx>
41 #include <comphelper/processfactory.hxx>
42 #include <i18npool/mslangid.hxx>
43 #include <svx/xlineit0.hxx>
44 #include <svx/xlndsit.hxx>
45 #include <vcl/svapp.hxx>
46 #include <svx/xlnwtit.hxx>
47 #include <vcl/lstbox.hxx>
48 #include <svx/tbxcolorupdate.hxx>
49 #include <vcl/toolbox.hxx>
50 #include <svx/xlntrit.hxx>
51 #include <svx/xlnstit.hxx>
52 #include <svx/xlnedit.hxx>
53 #include <svx/xlncapit.hxx>
54 #include <svx/xlinjoit.hxx>
55 #include "svx/sidebar/PopupContainer.hxx"
56 #include "svx/sidebar/PopupControl.hxx"
57 #include <svx/sidebar/ColorControl.hxx>
58 #include "LineWidthControl.hxx"
59 #include <boost/bind.hpp>
60
61 using namespace css;
62 using namespace cssu;
63 using ::sfx2::sidebar::Layouter;
64 using ::sfx2::sidebar::Theme;
65
66
67 #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
68
69 namespace {
GetItemId_Impl_line(ValueSet & rValueSet,const Color & rCol)70 short GetItemId_Impl_line( ValueSet& rValueSet, const Color& rCol )
71 {
72 if(rCol == COL_AUTO)
73 return 0;
74
75 bool bFound = false;
76 sal_uInt16 nCount = rValueSet.GetItemCount();
77 sal_uInt16 n = 1;
78
79 while ( !bFound && n <= nCount )
80 {
81 Color aValCol = rValueSet.GetItemColor(n);
82
83 bFound = ( aValCol.GetRed() == rCol.GetRed()
84 && aValCol.GetGreen() == rCol.GetGreen()
85 && aValCol.GetBlue() == rCol.GetBlue() );
86
87 if ( !bFound )
88 n++;
89 }
90 return bFound ? n : -1;
91 }
92
FillLineEndListBox(ListBox & rListBoxStart,ListBox & rListBoxEnd,const XLineEndListSharedPtr aList)93 void FillLineEndListBox(ListBox& rListBoxStart, ListBox& rListBoxEnd, const XLineEndListSharedPtr aList)
94 {
95 const sal_uInt32 nCount(aList.get() ? aList->Count() : 0);
96 const String sNone(SVX_RES(RID_SVXSTR_NONE));
97
98 rListBoxStart.SetUpdateMode(false);
99 rListBoxEnd.SetUpdateMode(false);
100
101 rListBoxStart.Clear();
102 rListBoxEnd.Clear();
103
104 // add 'none' entries
105 rListBoxStart.InsertEntry(sNone);
106 rListBoxEnd.InsertEntry(sNone);
107
108 for(sal_uInt32 i(0); i < nCount; i++)
109 {
110 XLineEndEntry* pEntry = aList->GetLineEnd(i);
111 const Bitmap aBitmap = aList->GetUiBitmap(i);
112
113 if(!aBitmap.IsEmpty())
114 {
115 Bitmap aCopyStart(aBitmap);
116 Bitmap aCopyEnd(aBitmap);
117 // delete pBitmap;
118 const Size aBmpSize(aCopyStart.GetSizePixel());
119 const Rectangle aCropRectStart(Point(), Size(aBmpSize.Width() / 2, aBmpSize.Height()));
120 const Rectangle aCropRectEnd(Point(aBmpSize.Width() / 2, 0), Size(aBmpSize.Width() / 2, aBmpSize.Height()));
121
122 aCopyStart.Crop(aCropRectStart);
123 rListBoxStart.InsertEntry(
124 pEntry->GetName(),
125 aCopyStart);
126
127 aCopyEnd.Crop(aCropRectEnd);
128 rListBoxEnd.InsertEntry(
129 pEntry->GetName(),
130 aCopyEnd);
131 }
132 else
133 {
134 rListBoxStart.InsertEntry(pEntry->GetName());
135 rListBoxEnd.InsertEntry(pEntry->GetName());
136 }
137 }
138
139 rListBoxStart.SetUpdateMode(true);
140 rListBoxEnd.SetUpdateMode(true);
141 }
142
FillLineStyleListBox(ListBox & rListBox,const XDashListSharedPtr aList)143 void FillLineStyleListBox(ListBox& rListBox, const XDashListSharedPtr aList)
144 {
145 const sal_uInt32 nCount(aList.get() ? aList->Count() : 0);
146 rListBox.SetUpdateMode(false);
147
148 rListBox.Clear();
149
150 // entry for 'none'
151 rListBox.InsertEntry(aList->GetStringForUiNoLine());
152
153 // entry for solid line
154 rListBox.InsertEntry(aList->GetStringForUiSolidLine(), aList->GetBitmapForUISolidLine());
155
156 for(sal_uInt32 i(0); i < nCount; i++)
157 {
158 XDashEntry* pEntry = aList->GetDash(i);
159 const Bitmap aBitmap = aList->GetUiBitmap(i);
160
161 if(!aBitmap.IsEmpty())
162 {
163 rListBox.InsertEntry(
164 pEntry->GetName(),
165 aBitmap);
166 // delete pBitmap;
167 }
168 else
169 {
170 rListBox.InsertEntry(pEntry->GetName());
171 }
172 }
173
174 rListBox.SetUpdateMode(true);
175 }
176 } // end of anonymous namespace
177
178 // namespace open
179
180 namespace svx { namespace sidebar {
181
LinePropertyPanel(Window * pParent,const cssu::Reference<css::frame::XFrame> & rxFrame,SfxBindings * pBindings)182 LinePropertyPanel::LinePropertyPanel(
183 Window* pParent,
184 const cssu::Reference<css::frame::XFrame>& rxFrame,
185 SfxBindings* pBindings)
186 : Control(
187 pParent,
188 SVX_RES(RID_SIDEBAR_LINE_PANEL)),
189 mpFTWidth(new FixedText(this, SVX_RES(FT_WIDTH))),
190 mpTBWidthBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
191 mpTBWidth(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBWidthBackground.get(), SVX_RES(TB_WIDTH))),
192 mpFTColor(new FixedText(this, SVX_RES(FT_COLOR))),
193 mpTBColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
194 mpTBColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBColorBackground.get(), SVX_RES(TB_COLOR))),
195 mpFTStyle(new FixedText(this, SVX_RES(FT_STYLE))),
196 mpLBStyle(new ListBox(this, SVX_RES(LB_STYLE))),
197 mpFTTrancparency(new FixedText(this, SVX_RES(FT_TRANSPARENT))),
198 mpMFTransparent(new MetricField(this, SVX_RES(MF_TRANSPARENT))),
199 mpFTArrow(new FixedText(this, SVX_RES(FT_ARROW))),
200 mpLBStart(new ListBox(this, SVX_RES(LB_START))),
201 mpLBEnd(new ListBox(this, SVX_RES(LB_END))),
202 mpFTEdgeStyle(new FixedText(this, SVX_RES(FT_EDGESTYLE))),
203 mpLBEdgeStyle(new ListBox(this, SVX_RES(LB_EDGESTYLE))),
204 mpFTCapStyle(new FixedText(this, SVX_RES(FT_CAPSTYLE))),
205 mpLBCapStyle(new ListBox(this, SVX_RES(LB_CAPSTYLE))),
206 maStyleControl(SID_ATTR_LINE_STYLE, *pBindings, *this),
207 maDashControl (SID_ATTR_LINE_DASH, *pBindings, *this),
208 maWidthControl(SID_ATTR_LINE_WIDTH, *pBindings, *this),
209 maColorControl(SID_ATTR_LINE_COLOR, *pBindings, *this),
210 maStartControl(SID_ATTR_LINE_START, *pBindings, *this),
211 maEndControl(SID_ATTR_LINE_END, *pBindings, *this),
212 maLineEndListControl(SID_LINEEND_LIST, *pBindings, *this),
213 maLineStyleListControl(SID_DASH_LIST, *pBindings, *this),
214 maTransControl(SID_ATTR_LINE_TRANSPARENCE, *pBindings, *this),
215 maEdgeStyle(SID_ATTR_LINE_JOINT, *pBindings, *this),
216 maCapStyle(SID_ATTR_LINE_CAP, *pBindings, *this),
217 maColor(COL_BLACK),
218 mpColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_LINE_COLOR, TBI_COLOR, mpTBColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)),
219 mpStyleItem(),
220 mpDashItem(),
221 mnTrans(0),
222 meMapUnit(SFX_MAPUNIT_MM),
223 mnWidthCoreValue(0),
224 maLineEndList(),
225 maLineStyleList(),
226 mpStartItem(0),
227 mpEndItem(0),
228 maColorPopup(this, ::boost::bind(&LinePropertyPanel::CreateColorPopupControl, this, _1)),
229 maLineWidthPopup(this, ::boost::bind(&LinePropertyPanel::CreateLineWidthPopupControl, this, _1)),
230 maIMGColor(SVX_RES(IMG_COLOR)),
231 maIMGNone(SVX_RES(IMG_NONE_ICON)),
232 mpIMGWidthIcon(),
233 mpIMGWidthIconH(),
234 mxFrame(rxFrame),
235 mpBindings(pBindings),
236 mbColorAvailable(true),
237 mbWidthValuable(true),
238 maLayouter(*this)
239 {
240 Initialize();
241 FreeResource();
242
243 // Setup the grid layouter.
244 const sal_Int32 nMappedToolBoxWidth (Layouter::MapWidth(*this, TOOLBOX_WIDTH));
245
246 maLayouter.GetCell(0,0).SetControl(*mpFTWidth);
247 maLayouter.GetCell(1,0).SetControl(*mpTBWidthBackground).SetFixedWidth();
248
249 maLayouter.GetCell(0,2).SetControl(*mpFTColor);
250 maLayouter.GetCell(1,2).SetControl(*mpTBColorBackground).SetFixedWidth();
251
252 maLayouter.GetCell(2,0).SetControl(*mpFTStyle);
253 maLayouter.GetCell(3,0).SetControl(*mpLBStyle);
254
255 maLayouter.GetCell(2,2).SetControl(*mpFTTrancparency);
256 maLayouter.GetCell(3,2).SetControl(*mpMFTransparent);
257
258 maLayouter.GetCell(4,0).SetControl(*mpFTArrow).SetGridWidth(3);
259 maLayouter.GetCell(5,0).SetControl(*mpLBStart);
260 maLayouter.GetCell(5,2).SetControl(*mpLBEnd);
261
262 maLayouter.GetCell(6,0).SetControl(*mpFTEdgeStyle);
263 maLayouter.GetCell(7,0).SetControl(*mpLBEdgeStyle);
264
265 maLayouter.GetCell(6,2).SetControl(*mpFTCapStyle);
266 maLayouter.GetCell(7,2).SetControl(*mpLBCapStyle);
267
268 maLayouter.GetColumn(0)
269 .SetWeight(1)
270 .SetLeftPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL))
271 .SetMinimumWidth(nMappedToolBoxWidth);
272 maLayouter.GetColumn(1)
273 .SetWeight(0)
274 .SetMinimumWidth(Layouter::MapWidth(*this, CONTROL_SPACING_HORIZONTAL));
275 maLayouter.GetColumn(2)
276 .SetWeight(1)
277 .SetRightPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL))
278 .SetMinimumWidth(nMappedToolBoxWidth);
279
280 // Make controls that display text handle short widths more
281 // graceful.
282 Layouter::PrepareForLayouting(*mpFTWidth);
283 Layouter::PrepareForLayouting(*mpFTColor);
284 Layouter::PrepareForLayouting(*mpFTStyle);
285 Layouter::PrepareForLayouting(*mpFTTrancparency);
286 Layouter::PrepareForLayouting(*mpFTArrow);
287 Layouter::PrepareForLayouting(*mpFTEdgeStyle);
288 Layouter::PrepareForLayouting(*mpFTCapStyle);
289 }
290
291
292
~LinePropertyPanel()293 LinePropertyPanel::~LinePropertyPanel()
294 {
295 // Destroy the toolboxes, then their background windows.
296 mpTBWidth.reset();
297 mpTBColor.reset();
298
299 mpTBWidthBackground.reset();
300 mpTBColorBackground.reset();
301 }
302
303
304
Initialize()305 void LinePropertyPanel::Initialize()
306 {
307 mpFTWidth->SetBackground(Wallpaper());
308 mpFTColor->SetBackground(Wallpaper());
309 mpFTStyle->SetBackground(Wallpaper());
310 mpFTTrancparency->SetBackground(Wallpaper());
311 mpFTArrow->SetBackground(Wallpaper());
312 mpFTEdgeStyle->SetBackground(Wallpaper());
313 mpFTCapStyle->SetBackground(Wallpaper());
314
315 mpIMGWidthIcon.reset(new Image[8]);
316 mpIMGWidthIcon[0] = Image(SVX_RES(IMG_WIDTH1_ICON));
317 mpIMGWidthIcon[1] = Image(SVX_RES(IMG_WIDTH2_ICON));
318 mpIMGWidthIcon[2] = Image(SVX_RES(IMG_WIDTH3_ICON));
319 mpIMGWidthIcon[3] = Image(SVX_RES(IMG_WIDTH4_ICON));
320 mpIMGWidthIcon[4] = Image(SVX_RES(IMG_WIDTH5_ICON));
321 mpIMGWidthIcon[5] = Image(SVX_RES(IMG_WIDTH6_ICON));
322 mpIMGWidthIcon[6] = Image(SVX_RES(IMG_WIDTH7_ICON));
323 mpIMGWidthIcon[7] = Image(SVX_RES(IMG_WIDTH8_ICON));
324
325 //high contrast
326 mpIMGWidthIconH.reset(new Image[8]);
327 mpIMGWidthIconH[0] = Image(SVX_RES(IMG_WIDTH1_ICON_H));
328 mpIMGWidthIconH[1] = Image(SVX_RES(IMG_WIDTH2_ICON_H));
329 mpIMGWidthIconH[2] = Image(SVX_RES(IMG_WIDTH3_ICON_H));
330 mpIMGWidthIconH[3] = Image(SVX_RES(IMG_WIDTH4_ICON_H));
331 mpIMGWidthIconH[4] = Image(SVX_RES(IMG_WIDTH5_ICON_H));
332 mpIMGWidthIconH[5] = Image(SVX_RES(IMG_WIDTH6_ICON_H));
333 mpIMGWidthIconH[6] = Image(SVX_RES(IMG_WIDTH7_ICON_H));
334 mpIMGWidthIconH[7] = Image(SVX_RES(IMG_WIDTH8_ICON_H));
335
336 meMapUnit = maWidthControl.GetCoreMetric();
337
338 mpTBColor->SetItemImage(TBI_COLOR, maIMGColor);
339 Size aTbxSize( mpTBColor->CalcWindowSizePixel() );
340 mpTBColor->SetOutputSizePixel( aTbxSize );
341 mpTBColor->SetItemBits( TBI_COLOR, mpTBColor->GetItemBits( TBI_COLOR ) | TIB_DROPDOWNONLY );
342 mpTBColor->SetQuickHelpText(TBI_COLOR,String(SVX_RES(STR_QH_TB_COLOR))); //Add
343 mpTBColor->SetBackground(Wallpaper());
344 mpTBColor->SetPaintTransparent(true);
345 Link aLink = LINK(this, LinePropertyPanel, ToolboxColorSelectHdl);
346 mpTBColor->SetDropdownClickHdl ( aLink );
347 mpTBColor->SetSelectHdl ( aLink );
348
349 FillLineStyleList();
350 SelectLineStyle();
351 aLink = LINK( this, LinePropertyPanel, ChangeLineStyleHdl );
352 mpLBStyle->SetSelectHdl( aLink );
353 mpLBStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Style")));
354 mpLBStyle->AdaptDropDownLineCountToMaximum();
355
356 mpTBWidth->SetItemImage(TBI_WIDTH, mpIMGWidthIcon[0]);
357 aTbxSize = mpTBWidth->CalcWindowSizePixel() ;
358 mpTBWidth->SetOutputSizePixel( aTbxSize );
359 mpTBWidth->SetItemBits( TBI_WIDTH, mpTBWidth->GetItemBits( TBI_WIDTH ) | TIB_DROPDOWNONLY );
360 mpTBWidth->SetQuickHelpText(TBI_WIDTH,String(SVX_RES(STR_QH_TB_WIDTH))); //Add
361 mpTBWidth->SetBackground(Wallpaper());
362 mpTBWidth->SetPaintTransparent(true);
363 aLink = LINK(this, LinePropertyPanel, ToolboxWidthSelectHdl);
364 mpTBWidth->SetDropdownClickHdl ( aLink );
365 mpTBWidth->SetSelectHdl ( aLink );
366
367 FillLineEndList();
368 SelectEndStyle(true);
369 SelectEndStyle(false);
370 aLink = LINK( this, LinePropertyPanel, ChangeStartHdl );
371 mpLBStart->SetSelectHdl( aLink );
372 mpLBStart->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Beginning Style"))); //wj acc
373 mpLBStart->AdaptDropDownLineCountToMaximum();
374 aLink = LINK( this, LinePropertyPanel, ChangeEndHdl );
375 mpLBEnd->SetSelectHdl( aLink );
376 mpLBEnd->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Ending Style"))); //wj acc
377 mpLBEnd->AdaptDropDownLineCountToMaximum();
378
379 aLink = LINK(this, LinePropertyPanel, ChangeTransparentHdl);
380 mpMFTransparent->SetModifyHdl(aLink);
381 mpMFTransparent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency"))); //wj acc
382
383 mpTBWidth->SetAccessibleRelationLabeledBy(mpFTWidth.get());
384 mpTBColor->SetAccessibleRelationLabeledBy(mpFTColor.get());
385 mpLBStyle->SetAccessibleRelationLabeledBy(mpFTStyle.get());
386 mpMFTransparent->SetAccessibleRelationLabeledBy(mpFTTrancparency.get());
387 mpLBStart->SetAccessibleRelationLabeledBy(mpFTArrow.get());
388 mpLBEnd->SetAccessibleRelationLabeledBy(mpLBEnd.get());
389
390 aLink = LINK( this, LinePropertyPanel, ChangeEdgeStyleHdl );
391 mpLBEdgeStyle->SetSelectHdl( aLink );
392 mpLBEdgeStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Corner Style")));
393
394 aLink = LINK( this, LinePropertyPanel, ChangeCapStyleHdl );
395 mpLBCapStyle->SetSelectHdl( aLink );
396 mpLBCapStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cap Style")));
397 }
398
399
400
SetupIcons(void)401 void LinePropertyPanel::SetupIcons(void)
402 {
403 if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons))
404 {
405 // todo
406 }
407 else
408 {
409 // todo
410 }
411 }
412
413
414
Create(Window * pParent,const cssu::Reference<css::frame::XFrame> & rxFrame,SfxBindings * pBindings)415 LinePropertyPanel* LinePropertyPanel::Create (
416 Window* pParent,
417 const cssu::Reference<css::frame::XFrame>& rxFrame,
418 SfxBindings* pBindings)
419 {
420 if (pParent == NULL)
421 throw lang::IllegalArgumentException(A2S("no parent Window given to LinePropertyPanel::Create"), NULL, 0);
422 if ( ! rxFrame.is())
423 throw lang::IllegalArgumentException(A2S("no XFrame given to LinePropertyPanel::Create"), NULL, 1);
424 if (pBindings == NULL)
425 throw lang::IllegalArgumentException(A2S("no SfxBindings given to LinePropertyPanel::Create"), NULL, 2);
426
427 return new LinePropertyPanel(
428 pParent,
429 rxFrame,
430 pBindings);
431 }
432
433
434
435
DataChanged(const DataChangedEvent & rEvent)436 void LinePropertyPanel::DataChanged(
437 const DataChangedEvent& rEvent)
438 {
439 (void)rEvent;
440
441 SetupIcons();
442 }
443
444
445
446
NotifyItemUpdate(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState,const bool bIsEnabled)447 void LinePropertyPanel::NotifyItemUpdate(
448 sal_uInt16 nSID,
449 SfxItemState eState,
450 const SfxPoolItem* pState,
451 const bool bIsEnabled)
452 {
453 (void)bIsEnabled;
454 const bool bDisabled(SFX_ITEM_DISABLED == eState);
455
456 switch(nSID)
457 {
458 case SID_ATTR_LINE_COLOR:
459 {
460 if(bDisabled)
461 {
462 mpFTColor->Disable();
463 mpTBColor->Disable();
464 }
465 else
466 {
467 mpFTColor->Enable();
468 mpTBColor->Enable();
469 }
470
471 if(eState >= SFX_ITEM_DEFAULT)
472 {
473 const XLineColorItem* pItem = dynamic_cast< const XLineColorItem* >(pState);
474 if(pItem)
475 {
476 maColor = pItem->GetColorValue();
477 mbColorAvailable = true;
478 mpColorUpdater->Update(maColor);
479 break;
480 }
481 }
482
483 mbColorAvailable = false;
484 mpColorUpdater->Update(COL_WHITE);
485 break;
486 }
487 case SID_ATTR_LINE_DASH:
488 case SID_ATTR_LINE_STYLE:
489 {
490 if(bDisabled)
491 {
492 mpFTStyle->Disable();
493 mpLBStyle->Disable();
494 }
495 else
496 {
497 mpFTStyle->Enable();
498 mpLBStyle->Enable();
499 }
500
501 if(eState >= SFX_ITEM_DEFAULT)
502 {
503 if(nSID == SID_ATTR_LINE_STYLE)
504 {
505 const XLineStyleItem* pItem = dynamic_cast< const XLineStyleItem* >(pState);
506
507 if(pItem)
508 {
509 mpStyleItem.reset(pState ? (XLineStyleItem*)pItem->Clone() : 0);
510 }
511 }
512 else // if(nSID == SID_ATTR_LINE_DASH)
513 {
514 const XLineDashItem* pItem = dynamic_cast< const XLineDashItem* >(pState);
515
516 if(pItem)
517 {
518 mpDashItem.reset(pState ? (XLineDashItem*)pItem->Clone() : 0);
519 }
520 }
521 }
522 else
523 {
524 if(nSID == SID_ATTR_LINE_STYLE)
525 {
526 mpStyleItem.reset(0);
527 }
528 else
529 {
530 mpDashItem.reset(0);
531 }
532 }
533
534 SelectLineStyle();
535 break;
536 }
537 case SID_ATTR_LINE_TRANSPARENCE:
538 {
539 if(bDisabled)
540 {
541 mpFTTrancparency->Disable();
542 mpMFTransparent->Disable();
543 }
544 else
545 {
546 mpFTTrancparency->Enable();
547 mpMFTransparent->Enable();
548 }
549
550 if(eState >= SFX_ITEM_DEFAULT)
551 {
552 const XLineTransparenceItem* pItem = dynamic_cast< const XLineTransparenceItem* >(pState);
553
554 if(pItem)
555 {
556 mnTrans = pItem->GetValue();
557 mpMFTransparent->SetValue(mnTrans);
558 break;
559 }
560 }
561
562 mpMFTransparent->SetValue(0);//add
563 mpMFTransparent->SetText(String());
564 break;
565 }
566 case SID_ATTR_LINE_WIDTH:
567 {
568 if(bDisabled)
569 {
570 mpTBWidth->Disable();
571 mpFTWidth->Disable();
572 }
573 else
574 {
575 mpTBWidth->Enable();
576 mpFTWidth->Enable();
577 }
578
579 if(eState >= SFX_ITEM_DEFAULT)
580 {
581 const XLineWidthItem* pItem = dynamic_cast< const XLineWidthItem* >(pState);
582
583 if(pItem)
584 {
585 mnWidthCoreValue = pItem->GetValue();
586 mbWidthValuable = true;
587 SetWidthIcon();
588 break;
589 }
590 }
591
592 mbWidthValuable = false;
593 SetWidthIcon();
594 break;
595 }
596 case SID_ATTR_LINE_START:
597 {
598 if(bDisabled)
599 {
600 mpFTArrow->Disable();
601 mpLBStart->Disable();
602 }
603 else
604 {
605 mpFTArrow->Enable();
606 mpLBStart->Enable();
607 }
608
609 if(eState >= SFX_ITEM_DEFAULT)
610 {
611 const XLineStartItem* pItem = dynamic_cast< const XLineStartItem* >(pState);
612
613 if(pItem)
614 {
615 mpStartItem.reset(pItem ? (XLineStartItem*)pItem->Clone() : 0);
616 SelectEndStyle(true);
617 break;
618 }
619 }
620
621 mpStartItem.reset(0);
622 SelectEndStyle(true);
623 break;
624 }
625 case SID_ATTR_LINE_END:
626 {
627 if(bDisabled)
628 {
629 mpFTArrow->Disable();
630 mpLBEnd->Disable();
631 }
632 else
633 {
634 mpFTArrow->Enable();
635 mpLBEnd->Enable();
636 }
637
638 if(eState >= SFX_ITEM_DEFAULT)
639 {
640 const XLineEndItem* pItem = dynamic_cast< const XLineEndItem* >(pState);
641
642 if(pItem)
643 {
644 mpEndItem.reset(pItem ? (XLineEndItem*)pItem->Clone() : 0);
645 SelectEndStyle(false);
646 break;
647 }
648 }
649
650 mpEndItem.reset(0);
651 SelectEndStyle(false);
652 break;
653 }
654 case SID_LINEEND_LIST:
655 {
656 FillLineEndList();
657 SelectEndStyle(true);
658 SelectEndStyle(false);
659 break;
660 }
661 case SID_DASH_LIST:
662 {
663 FillLineStyleList();
664 SelectLineStyle();
665 break;
666 }
667 case SID_ATTR_LINE_JOINT:
668 {
669 if(bDisabled)
670 {
671 mpLBEdgeStyle->Disable();
672 mpFTEdgeStyle->Disable();
673 }
674 else
675 {
676 mpLBEdgeStyle->Enable();
677 mpFTEdgeStyle->Enable();
678 }
679
680 if(eState >= SFX_ITEM_DEFAULT)
681 {
682 const XLineJointItem* pItem = dynamic_cast< const XLineJointItem* >(pState);
683
684 if(pItem)
685 {
686 sal_uInt16 nEntryPos(0);
687
688 switch(pItem->GetValue())
689 {
690 case com::sun::star::drawing::LineJoint_MIDDLE:
691 case com::sun::star::drawing::LineJoint_ROUND:
692 {
693 nEntryPos = 1;
694 break;
695 }
696 case com::sun::star::drawing::LineJoint_NONE:
697 {
698 nEntryPos = 2;
699 break;
700 }
701 case com::sun::star::drawing::LineJoint_MITER:
702 {
703 nEntryPos = 3;
704 break;
705 }
706 case com::sun::star::drawing::LineJoint_BEVEL:
707 {
708 nEntryPos = 4;
709 break;
710 }
711
712 default:
713 break;
714 }
715
716 if(nEntryPos)
717 {
718 mpLBEdgeStyle->SelectEntryPos(nEntryPos - 1);
719 break;
720 }
721 }
722 }
723
724 mpLBEdgeStyle->SetNoSelection();
725 break;
726 }
727 case SID_ATTR_LINE_CAP:
728 {
729 if(bDisabled)
730 {
731 mpLBCapStyle->Disable();
732 mpFTCapStyle->Disable();
733 }
734 else
735 {
736 mpLBCapStyle->Enable();
737 mpLBCapStyle->Enable();
738 }
739
740 if(eState >= SFX_ITEM_DEFAULT)
741 {
742 const XLineCapItem* pItem = dynamic_cast< const XLineCapItem* >(pState);
743
744 if(pItem)
745 {
746 sal_uInt16 nEntryPos(0);
747
748 switch(pItem->GetValue())
749 {
750 case com::sun::star::drawing::LineCap_BUTT:
751 {
752 nEntryPos = 1;
753 break;
754 }
755 case com::sun::star::drawing::LineCap_ROUND:
756 {
757 nEntryPos = 2;
758 break;
759 }
760 case com::sun::star::drawing::LineCap_SQUARE:
761 {
762 nEntryPos = 3;
763 break;
764 }
765
766 default:
767 break;
768 }
769
770 if(nEntryPos)
771 {
772 mpLBCapStyle->SelectEntryPos(nEntryPos - 1);
773 break;
774 }
775 }
776 }
777
778 mpLBCapStyle->SetNoSelection();
779 break;
780 }
781 }
782 }
783
784
785
786
GetBindings()787 SfxBindings* LinePropertyPanel::GetBindings()
788 {
789 return mpBindings;
790 }
791
792
793
IMPL_LINK(LinePropertyPanel,ImplPopupModeEndHdl,FloatingWindow *,EMPTYARG)794 IMPL_LINK( LinePropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
795 {
796 return 0;
797 }
798
799
800
801
IMPL_LINK(LinePropertyPanel,ToolboxColorSelectHdl,ToolBox *,pToolBox)802 IMPL_LINK(LinePropertyPanel, ToolboxColorSelectHdl,ToolBox*, pToolBox)
803 {
804 sal_uInt16 nId = pToolBox->GetCurItemId();
805 if(nId == TBI_COLOR)
806 {
807 maColorPopup.Show(*pToolBox);
808 maColorPopup.SetCurrentColor(maColor, mbColorAvailable);
809 }
810 return 0;
811 }
812
813
814
815
816 IMPL_LINK(LinePropertyPanel, ChangeLineStyleHdl, ToolBox*, /* pToolBox */)
817 {
818 const sal_uInt16 nPos(mpLBStyle->GetSelectEntryPos());
819
820 if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBStyle->GetSavedValue())
821 {
822 if(0 == nPos)
823 {
824 // XLINE_NONE
825 const XLineStyleItem aItem(XLINE_NONE);
826
827 GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L);
828 }
829 else if(1 == nPos)
830 {
831 // XLINE_SOLID
832 const XLineStyleItem aItem(XLINE_SOLID);
833
834 GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L);
835 }
836 else if(maLineStyleList.get() && maLineStyleList->Count() > (long)(nPos - 2))
837 {
838 // XLINE_DASH
839 const XLineStyleItem aItemA(XLINE_DASH);
840 const XDashEntry* pDashEntry = maLineStyleList->GetDash(nPos - 2);
841 OSL_ENSURE(pDashEntry, "OOps, got empty XDash from XDashList (!)");
842 const XLineDashItem aItemB(
843 pDashEntry ? pDashEntry->GetName() : String(),
844 pDashEntry ? pDashEntry->GetDash() : XDash());
845
846 GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItemA, 0L);
847 GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_DASH, SFX_CALLMODE_RECORD, &aItemB, 0L);
848 }
849 }
850
851 return 0;
852 }
853
854
855
IMPL_LINK(LinePropertyPanel,ChangeStartHdl,void *,EMPTYARG)856 IMPL_LINK(LinePropertyPanel, ChangeStartHdl, void*, EMPTYARG)
857 {
858 sal_uInt16 nPos = mpLBStart->GetSelectEntryPos();
859 if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != mpLBStart->GetSavedValue() )
860 {
861 XLineStartItem* pItem = NULL;
862 if( nPos == 0 )
863 pItem = new XLineStartItem();
864 else if( maLineEndList.get() && maLineEndList->Count() > (long) ( nPos - 1 ) )
865 pItem = new XLineStartItem( mpLBStart->GetSelectEntry(),maLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() );
866 GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SFX_CALLMODE_RECORD, pItem, 0L);
867 delete pItem;
868 }
869 return 0;
870 }
871
872
873
874
IMPL_LINK(LinePropertyPanel,ChangeEndHdl,void *,EMPTYARG)875 IMPL_LINK(LinePropertyPanel, ChangeEndHdl, void*, EMPTYARG)
876 {
877 sal_uInt16 nPos = mpLBEnd->GetSelectEntryPos();
878 if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != mpLBEnd->GetSavedValue() )
879 {
880 XLineEndItem* pItem = NULL;
881 if( nPos == 0 )
882 pItem = new XLineEndItem();
883 else if( maLineEndList.get() && maLineEndList->Count() > (long) ( nPos - 1 ) )
884 pItem = new XLineEndItem( mpLBEnd->GetSelectEntry(), maLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() );
885 GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SFX_CALLMODE_RECORD, pItem, 0L);
886 delete pItem;
887 }
888 return 0;
889 }
890
891
892
893
IMPL_LINK(LinePropertyPanel,ChangeEdgeStyleHdl,void *,EMPTYARG)894 IMPL_LINK(LinePropertyPanel, ChangeEdgeStyleHdl, void*, EMPTYARG)
895 {
896 const sal_uInt16 nPos(mpLBEdgeStyle->GetSelectEntryPos());
897
898 if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBEdgeStyle->GetSavedValue())
899 {
900 XLineJointItem* pItem = 0;
901
902 switch(nPos)
903 {
904 case 0: // rounded
905 {
906 pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_ROUND);
907 break;
908 }
909 case 1: // none
910 {
911 pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_NONE);
912 break;
913 }
914 case 2: // mitered
915 {
916 pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_MITER);
917 break;
918 }
919 case 3: // beveled
920 {
921 pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_BEVEL);
922 break;
923 }
924 }
925
926 GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_JOINT, SFX_CALLMODE_RECORD, pItem, 0L);
927 delete pItem;
928 }
929 return 0;
930 }
931
932
933
934
IMPL_LINK(LinePropertyPanel,ChangeCapStyleHdl,void *,EMPTYARG)935 IMPL_LINK(LinePropertyPanel, ChangeCapStyleHdl, void*, EMPTYARG)
936 {
937 const sal_uInt16 nPos(mpLBCapStyle->GetSelectEntryPos());
938
939 if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBCapStyle->GetSavedValue())
940 {
941 XLineCapItem* pItem = 0;
942
943 switch(nPos)
944 {
945 case 0: // flat
946 {
947 pItem = new XLineCapItem(com::sun::star::drawing::LineCap_BUTT);
948 break;
949 }
950 case 1: // round
951 {
952 pItem = new XLineCapItem(com::sun::star::drawing::LineCap_ROUND);
953 break;
954 }
955 case 2: // square
956 {
957 pItem = new XLineCapItem(com::sun::star::drawing::LineCap_SQUARE);
958 break;
959 }
960 }
961
962 GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_CAP, SFX_CALLMODE_RECORD, pItem, 0L);
963 delete pItem;
964 }
965 return 0;
966 }
967
968
969
970
IMPL_LINK(LinePropertyPanel,ToolboxWidthSelectHdl,ToolBox *,pToolBox)971 IMPL_LINK(LinePropertyPanel, ToolboxWidthSelectHdl,ToolBox*, pToolBox)
972 {
973 if (pToolBox->GetCurItemId() == TBI_WIDTH)
974 {
975 maLineWidthPopup.SetWidthSelect(mnWidthCoreValue, mbWidthValuable, meMapUnit);
976 maLineWidthPopup.Show(*pToolBox);
977 }
978 return 0;
979 }
980
981
982
983
IMPL_LINK(LinePropertyPanel,ChangeTransparentHdl,void *,EMPTYARG)984 IMPL_LINK( LinePropertyPanel, ChangeTransparentHdl, void *, EMPTYARG )
985 {
986 sal_uInt16 nVal = (sal_uInt16)mpMFTransparent->GetValue();
987 XLineTransparenceItem aItem( nVal );
988
989 GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L);
990 return( 0L );
991 }
992
993
994
995
996 namespace
997 {
GetTransparentColor(void)998 Color GetTransparentColor (void)
999 {
1000 return COL_TRANSPARENT;
1001 }
1002 } // end of anonymous namespace
1003
CreateColorPopupControl(PopupContainer * pParent)1004 PopupControl* LinePropertyPanel::CreateColorPopupControl (PopupContainer* pParent)
1005 {
1006 return new ColorControl(
1007 pParent,
1008 mpBindings,
1009 SVX_RES(RID_POPUPPANEL_LINEPAGE_COLOR),
1010 SVX_RES(VS_COLOR),
1011 ::boost::bind(GetTransparentColor),
1012 ::boost::bind(&LinePropertyPanel::SetColor, this, _1, _2),
1013 pParent,
1014 0);
1015 }
1016
1017
1018
1019
CreateLineWidthPopupControl(PopupContainer * pParent)1020 PopupControl* LinePropertyPanel::CreateLineWidthPopupControl (PopupContainer* pParent)
1021 {
1022 return new LineWidthControl(pParent, *this);
1023 }
1024
1025
1026
1027
EndLineWidthPopupMode(void)1028 void LinePropertyPanel::EndLineWidthPopupMode (void)
1029 {
1030 maLineWidthPopup.Hide();
1031 }
1032
1033
1034
1035
Resize(void)1036 void LinePropertyPanel::Resize (void)
1037 {
1038 maLayouter.Layout();
1039 }
1040
1041
1042
1043
SetWidthIcon(int n)1044 void LinePropertyPanel::SetWidthIcon(int n)
1045 {
1046 if(n==0)
1047 mpTBWidth->SetItemImage( TBI_WIDTH, maIMGNone);
1048 else
1049 mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[n-1] : mpIMGWidthIcon[n-1]);
1050 }
1051
1052
1053
SetWidthIcon()1054 void LinePropertyPanel::SetWidthIcon()
1055 {
1056 if(!mbWidthValuable)
1057 {
1058 mpTBWidth->SetItemImage( TBI_WIDTH, maIMGNone);
1059 return;
1060 }
1061
1062 long nVal = LogicToLogic(mnWidthCoreValue * 10,(MapUnit)meMapUnit , MAP_POINT);
1063
1064 if(nVal <= 6)
1065 mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[0] : mpIMGWidthIcon[0]);
1066 else if(nVal > 6 && nVal <= 9)
1067 mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[1] : mpIMGWidthIcon[1]);
1068 else if(nVal > 9 && nVal <= 12)
1069 mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[2] : mpIMGWidthIcon[2]);
1070 else if(nVal > 12 && nVal <= 19)
1071 mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[3] : mpIMGWidthIcon[3]);
1072 else if(nVal > 19 && nVal <= 26)
1073 mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[4] : mpIMGWidthIcon[4]);
1074 else if(nVal > 26 && nVal <= 37)
1075 mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[5] : mpIMGWidthIcon[5]);
1076 else if(nVal > 37 && nVal <=52)
1077 mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[6] : mpIMGWidthIcon[6]);
1078 else if(nVal > 52)
1079 mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[7] : mpIMGWidthIcon[7]);
1080
1081 }
1082
1083
1084
SetColor(const String & rsColorName,const Color aColor)1085 void LinePropertyPanel::SetColor (
1086 const String& rsColorName,
1087 const Color aColor)
1088 {
1089 XLineColorItem aColorItem(rsColorName, aColor);
1090 mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
1091 maColor = aColor;
1092 }
1093
1094
1095
SetWidth(long nWidth)1096 void LinePropertyPanel::SetWidth(long nWidth)
1097 {
1098 mnWidthCoreValue = nWidth;
1099 mbWidthValuable = true;
1100 }
1101
1102
1103
FillLineEndList()1104 void LinePropertyPanel::FillLineEndList()
1105 {
1106 SfxObjectShell* pSh = SfxObjectShell::Current();
1107 if ( pSh && pSh->GetItem( SID_LINEEND_LIST ) )
1108 {
1109 mpLBStart->Enable();
1110 SvxLineEndListItem aItem( *(const SvxLineEndListItem*)(pSh->GetItem( SID_LINEEND_LIST ) ) );
1111 maLineEndList = aItem.GetLineEndList();
1112
1113 if(maLineEndList.get())
1114 {
1115 FillLineEndListBox(*mpLBStart, *mpLBEnd, maLineEndList);
1116 }
1117
1118 mpLBStart->SelectEntryPos(0);
1119 mpLBEnd->SelectEntryPos(0);
1120 }
1121 else
1122 {
1123 mpLBStart->Disable();
1124 mpLBEnd->Disable();
1125 }
1126 }
1127
1128
1129
FillLineStyleList()1130 void LinePropertyPanel::FillLineStyleList()
1131 {
1132 SfxObjectShell* pSh = SfxObjectShell::Current();
1133 if ( pSh && pSh->GetItem( SID_DASH_LIST ) )
1134 {
1135 mpLBStyle->Enable();
1136 SvxDashListItem aItem( *(const SvxDashListItem*)(pSh->GetItem( SID_DASH_LIST ) ) );
1137 maLineStyleList = aItem.GetDashList();
1138
1139 if(maLineStyleList.get())
1140 {
1141 FillLineStyleListBox(*mpLBStyle, maLineStyleList);
1142 }
1143
1144 mpLBStyle->SelectEntryPos(0);
1145 }
1146 else
1147 {
1148 mpLBStyle->Disable();
1149 }
1150 }
1151
1152
1153
SelectLineStyle()1154 void LinePropertyPanel::SelectLineStyle()
1155 {
1156 if( !mpStyleItem.get() || !mpDashItem.get() )
1157 {
1158 mpLBStyle->SetNoSelection();
1159 mpLBStyle->Disable();
1160 return;
1161 }
1162
1163 const XLineStyle eXLS(mpStyleItem ? (XLineStyle)mpStyleItem->GetValue() : XLINE_NONE);
1164 bool bSelected(false);
1165
1166 switch(eXLS)
1167 {
1168 case XLINE_NONE:
1169 break;
1170 case XLINE_SOLID:
1171 mpLBStyle->SelectEntryPos(1);
1172 bSelected = true;
1173 break;
1174 default:
1175 if(mpDashItem && maLineStyleList.get())
1176 {
1177 const XDash& rDash = mpDashItem->GetDashValue();
1178 for(sal_Int32 a(0);!bSelected && a < maLineStyleList->Count(); a++)
1179 {
1180 XDashEntry* pEntry = maLineStyleList->GetDash(a);
1181 const XDash& rEntry = pEntry->GetDash();
1182 if(rDash == rEntry)
1183 {
1184 mpLBStyle->SelectEntryPos((sal_uInt16)a + 2);
1185 bSelected = true;
1186 }
1187 }
1188 }
1189 break;
1190 }
1191
1192 if(!bSelected)
1193 mpLBStyle->SelectEntryPos( 0 );
1194 }
1195
SelectEndStyle(bool bStart)1196 void LinePropertyPanel::SelectEndStyle(bool bStart)
1197 {
1198 sal_Bool bSelected(false);
1199
1200 if(bStart)
1201 {
1202 if( !mpStartItem.get() )
1203 {
1204 mpLBStart->SetNoSelection();
1205 mpLBStart->Disable();
1206 return;
1207 }
1208
1209 if(mpStartItem && maLineEndList.get())
1210 {
1211 const basegfx::B2DPolyPolygon& rItemPolygon = mpStartItem->GetLineStartValue();
1212 for(sal_Int32 a(0);!bSelected && a < maLineEndList->Count(); a++)
1213 {
1214 XLineEndEntry* pEntry = maLineEndList->GetLineEnd(a);
1215 const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
1216 if(rItemPolygon == rEntryPolygon)
1217 {
1218 mpLBStart->SelectEntryPos((sal_uInt16)a + 1);
1219 bSelected = true;
1220 }
1221 }
1222 }
1223
1224 if(!bSelected)
1225 {
1226 mpLBStart->SelectEntryPos( 0 );
1227 }
1228 }
1229 else
1230 {
1231 if( !mpEndItem.get() )
1232 {
1233 mpLBEnd->SetNoSelection();
1234 mpLBEnd->Disable();
1235 return;
1236 }
1237
1238 if(mpEndItem && maLineEndList.get())
1239 {
1240 const basegfx::B2DPolyPolygon& rItemPolygon = mpEndItem->GetLineEndValue();
1241 for(sal_Int32 a(0);!bSelected && a < maLineEndList->Count(); a++)
1242 {
1243 XLineEndEntry* pEntry = maLineEndList->GetLineEnd(a);
1244 const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
1245 if(rItemPolygon == rEntryPolygon)
1246 {
1247 mpLBEnd->SelectEntryPos((sal_uInt16)a + 1);
1248 bSelected = true;
1249 }
1250 }
1251 }
1252
1253 if(!bSelected)
1254 {
1255 mpLBEnd->SelectEntryPos( 0 );
1256 }
1257 }
1258 }
1259
1260
1261 } } // end of namespace svx::sidebar
1262
1263 // eof
1264