18dcb2a10SAndre Fischer /************************************************************** 28dcb2a10SAndre Fischer * 38dcb2a10SAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one 48dcb2a10SAndre Fischer * or more contributor license agreements. See the NOTICE file 58dcb2a10SAndre Fischer * distributed with this work for additional information 68dcb2a10SAndre Fischer * regarding copyright ownership. The ASF licenses this file 78dcb2a10SAndre Fischer * to you under the Apache License, Version 2.0 (the 88dcb2a10SAndre Fischer * "License"); you may not use this file except in compliance 98dcb2a10SAndre Fischer * with the License. You may obtain a copy of the License at 108dcb2a10SAndre Fischer * 118dcb2a10SAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0 128dcb2a10SAndre Fischer * 138dcb2a10SAndre Fischer * Unless required by applicable law or agreed to in writing, 148dcb2a10SAndre Fischer * software distributed under the License is distributed on an 158dcb2a10SAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 168dcb2a10SAndre Fischer * KIND, either express or implied. See the License for the 178dcb2a10SAndre Fischer * specific language governing permissions and limitations 188dcb2a10SAndre Fischer * under the License. 198dcb2a10SAndre Fischer * 208dcb2a10SAndre Fischer *************************************************************/ 218dcb2a10SAndre Fischer 228dcb2a10SAndre Fischer #include <sfx2/sidebar/propertypanel.hrc> 238dcb2a10SAndre Fischer #include <sfx2/sidebar/Theme.hxx> 248dcb2a10SAndre Fischer #include <sfx2/sidebar/ControlFactory.hxx> 258dcb2a10SAndre Fischer #include <LinePropertyPanel.hxx> 268dcb2a10SAndre Fischer #include <LinePropertyPanel.hrc> 278dcb2a10SAndre Fischer #include <svx/dialogs.hrc> 288dcb2a10SAndre Fischer #include <svx/dialmgr.hxx> 298dcb2a10SAndre Fischer #include <sfx2/objsh.hxx> 308dcb2a10SAndre Fischer #include <sfx2/bindings.hxx> 318dcb2a10SAndre Fischer #include <sfx2/dispatch.hxx> 328dcb2a10SAndre Fischer #include <svx/xlnclit.hxx> 338dcb2a10SAndre Fischer #include <svx/xtable.hxx> 348dcb2a10SAndre Fischer #include <svx/xdash.hxx> 358dcb2a10SAndre Fischer #include <svx/drawitem.hxx> 368dcb2a10SAndre Fischer #include <svx/svxitems.hrc> 378dcb2a10SAndre Fischer #include <svtools/valueset.hxx> 388dcb2a10SAndre Fischer #include <unotools/pathoptions.hxx> 398dcb2a10SAndre Fischer #include <unotools/viewoptions.hxx> 408dcb2a10SAndre Fischer #include <comphelper/processfactory.hxx> 418dcb2a10SAndre Fischer #include <i18npool/mslangid.hxx> 428dcb2a10SAndre Fischer #include <svx/xlineit0.hxx> 438dcb2a10SAndre Fischer #include <svx/xlndsit.hxx> 448dcb2a10SAndre Fischer #include <vcl/svapp.hxx> 458dcb2a10SAndre Fischer #include <svx/xlnwtit.hxx> 468dcb2a10SAndre Fischer #include <vcl/lstbox.hxx> 478dcb2a10SAndre Fischer #include <svx/tbxcolorupdate.hxx> 488dcb2a10SAndre Fischer #include <vcl/toolbox.hxx> 498dcb2a10SAndre Fischer #include <svx/xlntrit.hxx> 508dcb2a10SAndre Fischer #include <svx/xlnstit.hxx> 518dcb2a10SAndre Fischer #include <svx/xlnedit.hxx> 528dcb2a10SAndre Fischer #include <svx/xlncapit.hxx> 538dcb2a10SAndre Fischer #include <svx/xlinjoit.hxx> 548dcb2a10SAndre Fischer #include "svx/sidebar/PopupContainer.hxx" 558dcb2a10SAndre Fischer #include "svx/sidebar/PopupControl.hxx" 56facb16e7SArmin Le Grand #include <svx/sidebar/ColorControl.hxx> 578dcb2a10SAndre Fischer #include "LineWidthControl.hxx" 588dcb2a10SAndre Fischer #include <boost/bind.hpp> 598dcb2a10SAndre Fischer 608dcb2a10SAndre Fischer using namespace css; 618dcb2a10SAndre Fischer using namespace cssu; 628dcb2a10SAndre Fischer using ::sfx2::sidebar::Theme; 638dcb2a10SAndre Fischer 648dcb2a10SAndre Fischer #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) 658dcb2a10SAndre Fischer 668dcb2a10SAndre Fischer namespace { 678dcb2a10SAndre Fischer short GetItemId_Impl_line( ValueSet& rValueSet, const Color& rCol ) 688dcb2a10SAndre Fischer { 698dcb2a10SAndre Fischer if(rCol == COL_AUTO) 708dcb2a10SAndre Fischer return 0; 718dcb2a10SAndre Fischer 728dcb2a10SAndre Fischer bool bFound = false; 738dcb2a10SAndre Fischer sal_uInt16 nCount = rValueSet.GetItemCount(); 748dcb2a10SAndre Fischer sal_uInt16 n = 1; 758dcb2a10SAndre Fischer 768dcb2a10SAndre Fischer while ( !bFound && n <= nCount ) 778dcb2a10SAndre Fischer { 788dcb2a10SAndre Fischer Color aValCol = rValueSet.GetItemColor(n); 798dcb2a10SAndre Fischer 808dcb2a10SAndre Fischer bFound = ( aValCol.GetRed() == rCol.GetRed() 818dcb2a10SAndre Fischer && aValCol.GetGreen() == rCol.GetGreen() 828dcb2a10SAndre Fischer && aValCol.GetBlue() == rCol.GetBlue() ); 838dcb2a10SAndre Fischer 848dcb2a10SAndre Fischer if ( !bFound ) 858dcb2a10SAndre Fischer n++; 868dcb2a10SAndre Fischer } 878dcb2a10SAndre Fischer return bFound ? n : -1; 888dcb2a10SAndre Fischer } 898dcb2a10SAndre Fischer 90a567bdc8SArmin Le Grand void FillLineEndListBox(ListBox& rListBoxStart, ListBox& rListBoxEnd, const XLineEndList& rList) 91a567bdc8SArmin Le Grand { 92a567bdc8SArmin Le Grand const sal_uInt32 nCount(rList.Count()); 9397e8a929SArmin Le Grand const String sNone(SVX_RES(RID_SVXSTR_NONE)); 9497e8a929SArmin Le Grand 95a567bdc8SArmin Le Grand rListBoxStart.SetUpdateMode(false); 96a567bdc8SArmin Le Grand rListBoxEnd.SetUpdateMode(false); 978dcb2a10SAndre Fischer 9897e8a929SArmin Le Grand rListBoxStart.Clear(); 9997e8a929SArmin Le Grand rListBoxEnd.Clear(); 10097e8a929SArmin Le Grand 10197e8a929SArmin Le Grand // add 'none' entries 10297e8a929SArmin Le Grand rListBoxStart.InsertEntry(sNone); 10397e8a929SArmin Le Grand rListBoxEnd.InsertEntry(sNone); 10497e8a929SArmin Le Grand 105a567bdc8SArmin Le Grand for(sal_uInt32 i(0); i < nCount; i++) 106a567bdc8SArmin Le Grand { 107a567bdc8SArmin Le Grand XLineEndEntry* pEntry = rList.GetLineEnd(i); 10897e8a929SArmin Le Grand const Bitmap aBitmap = const_cast< XLineEndList& >(rList).GetUiBitmap(i); 1098dcb2a10SAndre Fischer 11097e8a929SArmin Le Grand if(!aBitmap.IsEmpty()) 111a567bdc8SArmin Le Grand { 11297e8a929SArmin Le Grand Bitmap aCopyStart(aBitmap); 11397e8a929SArmin Le Grand Bitmap aCopyEnd(aBitmap); 11497e8a929SArmin Le Grand // delete pBitmap; 115a567bdc8SArmin Le Grand const Size aBmpSize(aCopyStart.GetSizePixel()); 116a567bdc8SArmin Le Grand const Rectangle aCropRectStart(Point(), Size(aBmpSize.Width() / 2, aBmpSize.Height())); 117a567bdc8SArmin Le Grand const Rectangle aCropRectEnd(Point(aBmpSize.Width() / 2, 0), Size(aBmpSize.Width() / 2, aBmpSize.Height())); 118a567bdc8SArmin Le Grand 119a567bdc8SArmin Le Grand aCopyStart.Crop(aCropRectStart); 120a567bdc8SArmin Le Grand rListBoxStart.InsertEntry( 121a567bdc8SArmin Le Grand pEntry->GetName(), 122a567bdc8SArmin Le Grand aCopyStart); 123a567bdc8SArmin Le Grand 124a567bdc8SArmin Le Grand aCopyEnd.Crop(aCropRectEnd); 125a567bdc8SArmin Le Grand rListBoxEnd.InsertEntry( 126a567bdc8SArmin Le Grand pEntry->GetName(), 127a567bdc8SArmin Le Grand aCopyEnd); 128a567bdc8SArmin Le Grand } 129a567bdc8SArmin Le Grand else 130a567bdc8SArmin Le Grand { 131a567bdc8SArmin Le Grand rListBoxStart.InsertEntry(pEntry->GetName()); 132a567bdc8SArmin Le Grand rListBoxEnd.InsertEntry(pEntry->GetName()); 133a567bdc8SArmin Le Grand } 134a567bdc8SArmin Le Grand } 1358dcb2a10SAndre Fischer 136a567bdc8SArmin Le Grand rListBoxStart.SetUpdateMode(true); 137a567bdc8SArmin Le Grand rListBoxEnd.SetUpdateMode(true); 138a567bdc8SArmin Le Grand } 13997e8a929SArmin Le Grand 14097e8a929SArmin Le Grand void FillLineStyleListBox(ListBox& rListBox, const XDashList& rList) 14197e8a929SArmin Le Grand { 14297e8a929SArmin Le Grand const sal_uInt32 nCount(rList.Count()); 14397e8a929SArmin Le Grand rListBox.SetUpdateMode(false); 14497e8a929SArmin Le Grand 14597e8a929SArmin Le Grand rListBox.Clear(); 14697e8a929SArmin Le Grand 14797e8a929SArmin Le Grand // entry for 'none' 14897e8a929SArmin Le Grand rListBox.InsertEntry(rList.GetStringForUiNoLine()); 14997e8a929SArmin Le Grand 15097e8a929SArmin Le Grand // entry for solid line 15197e8a929SArmin Le Grand rListBox.InsertEntry(rList.GetStringForUiSolidLine(), rList.GetBitmapForUISolidLine()); 15297e8a929SArmin Le Grand 15397e8a929SArmin Le Grand for(sal_uInt32 i(0); i < nCount; i++) 15497e8a929SArmin Le Grand { 15597e8a929SArmin Le Grand XDashEntry* pEntry = rList.GetDash(i); 15697e8a929SArmin Le Grand const Bitmap aBitmap = const_cast< XDashList& >(rList).GetUiBitmap(i); 15797e8a929SArmin Le Grand 15897e8a929SArmin Le Grand if(!aBitmap.IsEmpty()) 15997e8a929SArmin Le Grand { 16097e8a929SArmin Le Grand rListBox.InsertEntry( 16197e8a929SArmin Le Grand pEntry->GetName(), 16297e8a929SArmin Le Grand aBitmap); 16397e8a929SArmin Le Grand // delete pBitmap; 16497e8a929SArmin Le Grand } 16597e8a929SArmin Le Grand else 16697e8a929SArmin Le Grand { 16797e8a929SArmin Le Grand rListBox.InsertEntry(pEntry->GetName()); 16897e8a929SArmin Le Grand } 16997e8a929SArmin Le Grand } 17097e8a929SArmin Le Grand 17197e8a929SArmin Le Grand rListBox.SetUpdateMode(true); 17297e8a929SArmin Le Grand } 173a567bdc8SArmin Le Grand } // end of anonymous namespace 1748dcb2a10SAndre Fischer 1758dcb2a10SAndre Fischer // namespace open 1768dcb2a10SAndre Fischer 1778dcb2a10SAndre Fischer namespace svx { namespace sidebar { 1788dcb2a10SAndre Fischer 1798dcb2a10SAndre Fischer LinePropertyPanel::LinePropertyPanel( 1808dcb2a10SAndre Fischer Window* pParent, 1818dcb2a10SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame, 1828dcb2a10SAndre Fischer SfxBindings* pBindings) 1838dcb2a10SAndre Fischer : Control( 1848dcb2a10SAndre Fischer pParent, 1858dcb2a10SAndre Fischer SVX_RES(RID_SIDEBAR_LINE_PANEL)), 1868dcb2a10SAndre Fischer mpFTWidth(new FixedText(this, SVX_RES(FT_WIDTH))), 1878dcb2a10SAndre Fischer mpTBWidthBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), 1888dcb2a10SAndre Fischer mpTBWidth(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBWidthBackground.get(), SVX_RES(TB_WIDTH))), 1898dcb2a10SAndre Fischer mpFTColor(new FixedText(this, SVX_RES(FT_COLOR))), 1908dcb2a10SAndre Fischer mpTBColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), 1918dcb2a10SAndre Fischer mpTBColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBColorBackground.get(), SVX_RES(TB_COLOR))), 1928dcb2a10SAndre Fischer mpFTStyle(new FixedText(this, SVX_RES(FT_STYLE))), 19397e8a929SArmin Le Grand mpLBStyle(new ListBox(this, SVX_RES(LB_STYLE))), 1948dcb2a10SAndre Fischer mpFTTrancparency(new FixedText(this, SVX_RES(FT_TRANSPARENT))), 1958dcb2a10SAndre Fischer mpMFTransparent(new MetricField(this, SVX_RES(MF_TRANSPARENT))), 1968dcb2a10SAndre Fischer mpFTArrow(new FixedText(this, SVX_RES(FT_ARROW))), 1971137d172SArmin Le Grand mpLBStart(new ListBox(this, SVX_RES(LB_START))), 1981137d172SArmin Le Grand mpLBEnd(new ListBox(this, SVX_RES(LB_END))), 1998dcb2a10SAndre Fischer mpFTEdgeStyle(new FixedText(this, SVX_RES(FT_EDGESTYLE))), 2008dcb2a10SAndre Fischer mpLBEdgeStyle(new ListBox(this, SVX_RES(LB_EDGESTYLE))), 2018dcb2a10SAndre Fischer mpFTCapStyle(new FixedText(this, SVX_RES(FT_CAPSTYLE))), 2028dcb2a10SAndre Fischer mpLBCapStyle(new ListBox(this, SVX_RES(LB_CAPSTYLE))), 203a567bdc8SArmin Le Grand maStyleControl(SID_ATTR_LINE_STYLE, *pBindings, *this), 204a567bdc8SArmin Le Grand maDashControl (SID_ATTR_LINE_DASH, *pBindings, *this), 205a567bdc8SArmin Le Grand maWidthControl(SID_ATTR_LINE_WIDTH, *pBindings, *this), 206a567bdc8SArmin Le Grand maColorControl(SID_ATTR_LINE_COLOR, *pBindings, *this), 207a567bdc8SArmin Le Grand maStartControl(SID_ATTR_LINE_START, *pBindings, *this), 208a567bdc8SArmin Le Grand maEndControl(SID_ATTR_LINE_END, *pBindings, *this), 209a567bdc8SArmin Le Grand maLineEndListControl(SID_LINEEND_LIST, *pBindings, *this), 21097e8a929SArmin Le Grand maLineStyleListControl(SID_DASH_LIST, *pBindings, *this), 211a567bdc8SArmin Le Grand maTransControl(SID_ATTR_LINE_TRANSPARENCE, *pBindings, *this), 212a567bdc8SArmin Le Grand maEdgeStyle(SID_ATTR_LINE_JOINT, *pBindings, *this), 213a567bdc8SArmin Le Grand maCapStyle(SID_ATTR_LINE_CAP, *pBindings, *this), 2148dcb2a10SAndre Fischer maColor(COL_BLACK), 2158dcb2a10SAndre Fischer mpColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_LINE_COLOR, TBI_COLOR, mpTBColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)), 2168dcb2a10SAndre Fischer mpStyleItem(), 2178dcb2a10SAndre Fischer mpDashItem(), 2188dcb2a10SAndre Fischer mnTrans(0), 2198dcb2a10SAndre Fischer meMapUnit(SFX_MAPUNIT_MM), 2208dcb2a10SAndre Fischer mnWidthCoreValue(0), 2218dcb2a10SAndre Fischer mpLineEndList(0), 22297e8a929SArmin Le Grand mpLineStyleList(0), 2238dcb2a10SAndre Fischer mpStartItem(0), 2248dcb2a10SAndre Fischer mpEndItem(0), 2258dcb2a10SAndre Fischer maColorPopup(this, ::boost::bind(&LinePropertyPanel::CreateColorPopupControl, this, _1)), 2268dcb2a10SAndre Fischer maLineWidthPopup(this, ::boost::bind(&LinePropertyPanel::CreateLineWidthPopupControl, this, _1)), 2278dcb2a10SAndre Fischer maIMGColor(SVX_RES(IMG_COLOR)), 2288dcb2a10SAndre Fischer maIMGNone(SVX_RES(IMG_NONE_ICON)), 2298dcb2a10SAndre Fischer mpIMGWidthIcon(), 2308dcb2a10SAndre Fischer mpIMGWidthIconH(), 2318dcb2a10SAndre Fischer mxFrame(rxFrame), 2328dcb2a10SAndre Fischer mpBindings(pBindings), 2338dcb2a10SAndre Fischer mbColorAvailable(true), 234*2d10cb3dSArmin Le Grand mbWidthValuable(true) 2358dcb2a10SAndre Fischer { 2368dcb2a10SAndre Fischer Initialize(); 2378dcb2a10SAndre Fischer FreeResource(); 2388dcb2a10SAndre Fischer } 2398dcb2a10SAndre Fischer 2408dcb2a10SAndre Fischer 2418dcb2a10SAndre Fischer 2428dcb2a10SAndre Fischer LinePropertyPanel::~LinePropertyPanel() 2438dcb2a10SAndre Fischer { 2448dcb2a10SAndre Fischer // Destroy the toolboxes, then their background windows. 2458dcb2a10SAndre Fischer mpTBWidth.reset(); 2468dcb2a10SAndre Fischer mpTBColor.reset(); 24797e8a929SArmin Le Grand 2488dcb2a10SAndre Fischer mpTBWidthBackground.reset(); 2498dcb2a10SAndre Fischer mpTBColorBackground.reset(); 2508dcb2a10SAndre Fischer } 2518dcb2a10SAndre Fischer 2528dcb2a10SAndre Fischer 2538dcb2a10SAndre Fischer 2548dcb2a10SAndre Fischer void LinePropertyPanel::Initialize() 2558dcb2a10SAndre Fischer { 25637fee4fdSAndre Fischer mpFTWidth->SetBackground(Wallpaper()); 25737fee4fdSAndre Fischer mpFTColor->SetBackground(Wallpaper()); 25837fee4fdSAndre Fischer mpFTStyle->SetBackground(Wallpaper()); 25937fee4fdSAndre Fischer mpFTTrancparency->SetBackground(Wallpaper()); 26037fee4fdSAndre Fischer mpFTArrow->SetBackground(Wallpaper()); 26137fee4fdSAndre Fischer mpFTEdgeStyle->SetBackground(Wallpaper()); 26237fee4fdSAndre Fischer mpFTCapStyle->SetBackground(Wallpaper()); 26337fee4fdSAndre Fischer 2648dcb2a10SAndre Fischer mpIMGWidthIcon.reset(new Image[8]); 265*2d10cb3dSArmin Le Grand mpIMGWidthIcon[0] = Image(SVX_RES(IMG_WIDTH1_ICON)); 266*2d10cb3dSArmin Le Grand mpIMGWidthIcon[1] = Image(SVX_RES(IMG_WIDTH2_ICON)); 267*2d10cb3dSArmin Le Grand mpIMGWidthIcon[2] = Image(SVX_RES(IMG_WIDTH3_ICON)); 268*2d10cb3dSArmin Le Grand mpIMGWidthIcon[3] = Image(SVX_RES(IMG_WIDTH4_ICON)); 269*2d10cb3dSArmin Le Grand mpIMGWidthIcon[4] = Image(SVX_RES(IMG_WIDTH5_ICON)); 270*2d10cb3dSArmin Le Grand mpIMGWidthIcon[5] = Image(SVX_RES(IMG_WIDTH6_ICON)); 271*2d10cb3dSArmin Le Grand mpIMGWidthIcon[6] = Image(SVX_RES(IMG_WIDTH7_ICON)); 272*2d10cb3dSArmin Le Grand mpIMGWidthIcon[7] = Image(SVX_RES(IMG_WIDTH8_ICON)); 273*2d10cb3dSArmin Le Grand 274*2d10cb3dSArmin Le Grand //high contrast 2758dcb2a10SAndre Fischer mpIMGWidthIconH.reset(new Image[8]); 276*2d10cb3dSArmin Le Grand mpIMGWidthIconH[0] = Image(SVX_RES(IMG_WIDTH1_ICON_H)); 277*2d10cb3dSArmin Le Grand mpIMGWidthIconH[1] = Image(SVX_RES(IMG_WIDTH2_ICON_H)); 278*2d10cb3dSArmin Le Grand mpIMGWidthIconH[2] = Image(SVX_RES(IMG_WIDTH3_ICON_H)); 279*2d10cb3dSArmin Le Grand mpIMGWidthIconH[3] = Image(SVX_RES(IMG_WIDTH4_ICON_H)); 280*2d10cb3dSArmin Le Grand mpIMGWidthIconH[4] = Image(SVX_RES(IMG_WIDTH5_ICON_H)); 281*2d10cb3dSArmin Le Grand mpIMGWidthIconH[5] = Image(SVX_RES(IMG_WIDTH6_ICON_H)); 282*2d10cb3dSArmin Le Grand mpIMGWidthIconH[6] = Image(SVX_RES(IMG_WIDTH7_ICON_H)); 283*2d10cb3dSArmin Le Grand mpIMGWidthIconH[7] = Image(SVX_RES(IMG_WIDTH8_ICON_H)); 284*2d10cb3dSArmin Le Grand 285*2d10cb3dSArmin Le Grand meMapUnit = maWidthControl.GetCoreMetric(); 286*2d10cb3dSArmin Le Grand 287*2d10cb3dSArmin Le Grand mpTBColor->SetItemImage(TBI_COLOR, maIMGColor); 288*2d10cb3dSArmin Le Grand Size aTbxSize( mpTBColor->CalcWindowSizePixel() ); 289*2d10cb3dSArmin Le Grand mpTBColor->SetOutputSizePixel( aTbxSize ); 290*2d10cb3dSArmin Le Grand mpTBColor->SetItemBits( TBI_COLOR, mpTBColor->GetItemBits( TBI_COLOR ) | TIB_DROPDOWNONLY ); 291*2d10cb3dSArmin Le Grand mpTBColor->SetQuickHelpText(TBI_COLOR,String(SVX_RES(STR_QH_TB_COLOR))); //Add 292*2d10cb3dSArmin Le Grand mpTBColor->SetBackground(Wallpaper()); 293*2d10cb3dSArmin Le Grand mpTBColor->SetPaintTransparent(true); 294*2d10cb3dSArmin Le Grand Link aLink = LINK(this, LinePropertyPanel, ToolboxColorSelectHdl); 295*2d10cb3dSArmin Le Grand mpTBColor->SetDropdownClickHdl ( aLink ); 296*2d10cb3dSArmin Le Grand mpTBColor->SetSelectHdl ( aLink ); 297*2d10cb3dSArmin Le Grand 298*2d10cb3dSArmin Le Grand FillLineStyleList(); 299*2d10cb3dSArmin Le Grand SelectLineStyle(); 300*2d10cb3dSArmin Le Grand aLink = LINK( this, LinePropertyPanel, ChangeLineStyleHdl ); 301*2d10cb3dSArmin Le Grand mpLBStyle->SetSelectHdl( aLink ); 302*2d10cb3dSArmin Le Grand mpLBStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Style"))); 303a68b38dfSArmin Le Grand mpLBStyle->AdaptDropDownLineCountToMaximum(); 3048dcb2a10SAndre Fischer 305*2d10cb3dSArmin Le Grand mpTBWidth->SetItemImage(TBI_WIDTH, mpIMGWidthIcon[0]); 306*2d10cb3dSArmin Le Grand aTbxSize = mpTBWidth->CalcWindowSizePixel() ; 307*2d10cb3dSArmin Le Grand mpTBWidth->SetOutputSizePixel( aTbxSize ); 308*2d10cb3dSArmin Le Grand mpTBWidth->SetItemBits( TBI_WIDTH, mpTBWidth->GetItemBits( TBI_WIDTH ) | TIB_DROPDOWNONLY ); 309*2d10cb3dSArmin Le Grand mpTBWidth->SetQuickHelpText(TBI_WIDTH,String(SVX_RES(STR_QH_TB_WIDTH))); //Add 310*2d10cb3dSArmin Le Grand mpTBWidth->SetBackground(Wallpaper()); 311*2d10cb3dSArmin Le Grand mpTBWidth->SetPaintTransparent(true); 312*2d10cb3dSArmin Le Grand aLink = LINK(this, LinePropertyPanel, ToolboxWidthSelectHdl); 313*2d10cb3dSArmin Le Grand mpTBWidth->SetDropdownClickHdl ( aLink ); 314*2d10cb3dSArmin Le Grand mpTBWidth->SetSelectHdl ( aLink ); 315*2d10cb3dSArmin Le Grand 316*2d10cb3dSArmin Le Grand FillLineEndList(); 317*2d10cb3dSArmin Le Grand SelectEndStyle(true); 318*2d10cb3dSArmin Le Grand SelectEndStyle(false); 319*2d10cb3dSArmin Le Grand aLink = LINK( this, LinePropertyPanel, ChangeStartHdl ); 320*2d10cb3dSArmin Le Grand mpLBStart->SetSelectHdl( aLink ); 321*2d10cb3dSArmin Le Grand mpLBStart->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Beginning Style"))); //wj acc 322a68b38dfSArmin Le Grand mpLBStart->AdaptDropDownLineCountToMaximum(); 323*2d10cb3dSArmin Le Grand aLink = LINK( this, LinePropertyPanel, ChangeEndHdl ); 324*2d10cb3dSArmin Le Grand mpLBEnd->SetSelectHdl( aLink ); 325*2d10cb3dSArmin Le Grand mpLBEnd->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Ending Style"))); //wj acc 326a68b38dfSArmin Le Grand mpLBEnd->AdaptDropDownLineCountToMaximum(); 3278dcb2a10SAndre Fischer 328*2d10cb3dSArmin Le Grand aLink = LINK(this, LinePropertyPanel, ChangeTransparentHdl); 329*2d10cb3dSArmin Le Grand mpMFTransparent->SetModifyHdl(aLink); 330*2d10cb3dSArmin Le Grand mpMFTransparent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency"))); //wj acc 331*2d10cb3dSArmin Le Grand 332*2d10cb3dSArmin Le Grand mpTBWidth->SetAccessibleRelationLabeledBy(mpFTWidth.get()); 333*2d10cb3dSArmin Le Grand mpTBColor->SetAccessibleRelationLabeledBy(mpFTColor.get()); 33497e8a929SArmin Le Grand mpLBStyle->SetAccessibleRelationLabeledBy(mpFTStyle.get()); 335*2d10cb3dSArmin Le Grand mpMFTransparent->SetAccessibleRelationLabeledBy(mpFTTrancparency.get()); 336*2d10cb3dSArmin Le Grand mpLBStart->SetAccessibleRelationLabeledBy(mpFTArrow.get()); 337*2d10cb3dSArmin Le Grand mpLBEnd->SetAccessibleRelationLabeledBy(mpLBEnd.get()); 3388dcb2a10SAndre Fischer 3398dcb2a10SAndre Fischer aLink = LINK( this, LinePropertyPanel, ChangeEdgeStyleHdl ); 3408dcb2a10SAndre Fischer mpLBEdgeStyle->SetSelectHdl( aLink ); 3418dcb2a10SAndre Fischer mpLBEdgeStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Corner Style"))); 3428dcb2a10SAndre Fischer 3438dcb2a10SAndre Fischer aLink = LINK( this, LinePropertyPanel, ChangeCapStyleHdl ); 3448dcb2a10SAndre Fischer mpLBCapStyle->SetSelectHdl( aLink ); 3458dcb2a10SAndre Fischer mpLBCapStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cap Style"))); 3468dcb2a10SAndre Fischer } 3478dcb2a10SAndre Fischer 3488dcb2a10SAndre Fischer 3498dcb2a10SAndre Fischer 3508dcb2a10SAndre Fischer void LinePropertyPanel::SetupIcons(void) 3518dcb2a10SAndre Fischer { 3528dcb2a10SAndre Fischer if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) 3538dcb2a10SAndre Fischer { 3548dcb2a10SAndre Fischer // todo 3558dcb2a10SAndre Fischer } 3568dcb2a10SAndre Fischer else 3578dcb2a10SAndre Fischer { 3588dcb2a10SAndre Fischer // todo 3598dcb2a10SAndre Fischer } 3608dcb2a10SAndre Fischer } 3618dcb2a10SAndre Fischer 3628dcb2a10SAndre Fischer 3638dcb2a10SAndre Fischer 3648dcb2a10SAndre Fischer LinePropertyPanel* LinePropertyPanel::Create ( 3658dcb2a10SAndre Fischer Window* pParent, 3668dcb2a10SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame, 3678dcb2a10SAndre Fischer SfxBindings* pBindings) 3688dcb2a10SAndre Fischer { 3698dcb2a10SAndre Fischer if (pParent == NULL) 3708dcb2a10SAndre Fischer throw lang::IllegalArgumentException(A2S("no parent Window given to LinePropertyPanel::Create"), NULL, 0); 3718dcb2a10SAndre Fischer if ( ! rxFrame.is()) 3728dcb2a10SAndre Fischer throw lang::IllegalArgumentException(A2S("no XFrame given to LinePropertyPanel::Create"), NULL, 1); 3738dcb2a10SAndre Fischer if (pBindings == NULL) 3748dcb2a10SAndre Fischer throw lang::IllegalArgumentException(A2S("no SfxBindings given to LinePropertyPanel::Create"), NULL, 2); 3758dcb2a10SAndre Fischer 3768dcb2a10SAndre Fischer return new LinePropertyPanel( 3778dcb2a10SAndre Fischer pParent, 3788dcb2a10SAndre Fischer rxFrame, 3798dcb2a10SAndre Fischer pBindings); 3808dcb2a10SAndre Fischer } 3818dcb2a10SAndre Fischer 3828dcb2a10SAndre Fischer 3838dcb2a10SAndre Fischer 38437fee4fdSAndre Fischer 3858dcb2a10SAndre Fischer void LinePropertyPanel::DataChanged( 3868dcb2a10SAndre Fischer const DataChangedEvent& rEvent) 3878dcb2a10SAndre Fischer { 3888dcb2a10SAndre Fischer (void)rEvent; 3898dcb2a10SAndre Fischer 3908dcb2a10SAndre Fischer SetupIcons(); 3918dcb2a10SAndre Fischer } 3928dcb2a10SAndre Fischer 3938dcb2a10SAndre Fischer 3948dcb2a10SAndre Fischer 3958dcb2a10SAndre Fischer 3968dcb2a10SAndre Fischer void LinePropertyPanel::NotifyItemUpdate( 3978dcb2a10SAndre Fischer sal_uInt16 nSID, 3988dcb2a10SAndre Fischer SfxItemState eState, 39945da7d5eSAndre Fischer const SfxPoolItem* pState, 40045da7d5eSAndre Fischer const bool bIsEnabled) 4018dcb2a10SAndre Fischer { 40245da7d5eSAndre Fischer (void)bIsEnabled; 403*2d10cb3dSArmin Le Grand const bool bDisabled(SFX_ITEM_DISABLED == eState); 40445da7d5eSAndre Fischer 405*2d10cb3dSArmin Le Grand switch(nSID) 406*2d10cb3dSArmin Le Grand { 407*2d10cb3dSArmin Le Grand case SID_ATTR_LINE_COLOR: 4088dcb2a10SAndre Fischer { 409*2d10cb3dSArmin Le Grand if(bDisabled) 410*2d10cb3dSArmin Le Grand { 411*2d10cb3dSArmin Le Grand mpFTColor->Disable(); 412*2d10cb3dSArmin Le Grand mpTBColor->Disable(); 413*2d10cb3dSArmin Le Grand } 414*2d10cb3dSArmin Le Grand else 415*2d10cb3dSArmin Le Grand { 416*2d10cb3dSArmin Le Grand mpFTColor->Enable(); 417*2d10cb3dSArmin Le Grand mpTBColor->Enable(); 418*2d10cb3dSArmin Le Grand } 419*2d10cb3dSArmin Le Grand 420*2d10cb3dSArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 421*2d10cb3dSArmin Le Grand { 4228dcb2a10SAndre Fischer const XLineColorItem* pItem = dynamic_cast< const XLineColorItem* >(pState); 423*2d10cb3dSArmin Le Grand if(pItem) 424*2d10cb3dSArmin Le Grand { 425*2d10cb3dSArmin Le Grand maColor = pItem->GetColorValue(); 426*2d10cb3dSArmin Le Grand mbColorAvailable = true; 427*2d10cb3dSArmin Le Grand mpColorUpdater->Update(maColor); 428*2d10cb3dSArmin Le Grand break; 429*2d10cb3dSArmin Le Grand } 430*2d10cb3dSArmin Le Grand } 4318dcb2a10SAndre Fischer 432*2d10cb3dSArmin Le Grand mbColorAvailable = false; 433*2d10cb3dSArmin Le Grand mpColorUpdater->Update(COL_WHITE); 434*2d10cb3dSArmin Le Grand break; 4358dcb2a10SAndre Fischer } 436*2d10cb3dSArmin Le Grand case SID_ATTR_LINE_DASH: 437*2d10cb3dSArmin Le Grand case SID_ATTR_LINE_STYLE: 4388dcb2a10SAndre Fischer { 439*2d10cb3dSArmin Le Grand if(bDisabled) 440*2d10cb3dSArmin Le Grand { 441*2d10cb3dSArmin Le Grand mpFTStyle->Disable(); 44297e8a929SArmin Le Grand mpLBStyle->Disable(); 443*2d10cb3dSArmin Le Grand } 444*2d10cb3dSArmin Le Grand else 445*2d10cb3dSArmin Le Grand { 446*2d10cb3dSArmin Le Grand mpFTStyle->Enable(); 44797e8a929SArmin Le Grand mpLBStyle->Enable(); 448*2d10cb3dSArmin Le Grand } 4498dcb2a10SAndre Fischer 450*2d10cb3dSArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 451*2d10cb3dSArmin Le Grand { 452*2d10cb3dSArmin Le Grand if(nSID == SID_ATTR_LINE_STYLE) 453*2d10cb3dSArmin Le Grand { 454*2d10cb3dSArmin Le Grand const XLineStyleItem* pItem = dynamic_cast< const XLineStyleItem* >(pState); 4558dcb2a10SAndre Fischer 456*2d10cb3dSArmin Le Grand if(pItem) 457*2d10cb3dSArmin Le Grand { 458*2d10cb3dSArmin Le Grand mpStyleItem.reset(pState ? (XLineStyleItem*)pItem->Clone() : 0); 459*2d10cb3dSArmin Le Grand } 460*2d10cb3dSArmin Le Grand } 461*2d10cb3dSArmin Le Grand else // if(nSID == SID_ATTR_LINE_DASH) 462*2d10cb3dSArmin Le Grand { 463*2d10cb3dSArmin Le Grand const XLineDashItem* pItem = dynamic_cast< const XLineDashItem* >(pState); 464*2d10cb3dSArmin Le Grand 465*2d10cb3dSArmin Le Grand if(pItem) 466*2d10cb3dSArmin Le Grand { 467*2d10cb3dSArmin Le Grand mpDashItem.reset(pState ? (XLineDashItem*)pItem->Clone() : 0); 468*2d10cb3dSArmin Le Grand } 469*2d10cb3dSArmin Le Grand } 470*2d10cb3dSArmin Le Grand } 471*2d10cb3dSArmin Le Grand else 472*2d10cb3dSArmin Le Grand { 473*2d10cb3dSArmin Le Grand if(nSID == SID_ATTR_LINE_STYLE) 474*2d10cb3dSArmin Le Grand { 475*2d10cb3dSArmin Le Grand mpStyleItem.reset(0); 476*2d10cb3dSArmin Le Grand } 477*2d10cb3dSArmin Le Grand else 478*2d10cb3dSArmin Le Grand { 479*2d10cb3dSArmin Le Grand mpDashItem.reset(0); 480*2d10cb3dSArmin Le Grand } 481*2d10cb3dSArmin Le Grand } 482*2d10cb3dSArmin Le Grand 483*2d10cb3dSArmin Le Grand SelectLineStyle(); 484*2d10cb3dSArmin Le Grand break; 4858dcb2a10SAndre Fischer } 486*2d10cb3dSArmin Le Grand case SID_ATTR_LINE_TRANSPARENCE: 4878dcb2a10SAndre Fischer { 488*2d10cb3dSArmin Le Grand if(bDisabled) 489*2d10cb3dSArmin Le Grand { 490*2d10cb3dSArmin Le Grand mpFTTrancparency->Disable(); 491*2d10cb3dSArmin Le Grand mpMFTransparent->Disable(); 492*2d10cb3dSArmin Le Grand } 493*2d10cb3dSArmin Le Grand else 494*2d10cb3dSArmin Le Grand { 495*2d10cb3dSArmin Le Grand mpFTTrancparency->Enable(); 496*2d10cb3dSArmin Le Grand mpMFTransparent->Enable(); 497*2d10cb3dSArmin Le Grand } 498*2d10cb3dSArmin Le Grand 499*2d10cb3dSArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 500*2d10cb3dSArmin Le Grand { 5018dcb2a10SAndre Fischer const XLineTransparenceItem* pItem = dynamic_cast< const XLineTransparenceItem* >(pState); 5028dcb2a10SAndre Fischer 503*2d10cb3dSArmin Le Grand if(pItem) 504*2d10cb3dSArmin Le Grand { 505*2d10cb3dSArmin Le Grand mnTrans = pItem->GetValue(); 506*2d10cb3dSArmin Le Grand mpMFTransparent->SetValue(mnTrans); 507*2d10cb3dSArmin Le Grand break; 508*2d10cb3dSArmin Le Grand } 509*2d10cb3dSArmin Le Grand } 510*2d10cb3dSArmin Le Grand 511*2d10cb3dSArmin Le Grand mpMFTransparent->SetValue(0);//add 512*2d10cb3dSArmin Le Grand mpMFTransparent->SetText(String()); 513*2d10cb3dSArmin Le Grand break; 5148dcb2a10SAndre Fischer } 515*2d10cb3dSArmin Le Grand case SID_ATTR_LINE_WIDTH: 5168dcb2a10SAndre Fischer { 517*2d10cb3dSArmin Le Grand if(bDisabled) 518*2d10cb3dSArmin Le Grand { 519*2d10cb3dSArmin Le Grand mpTBWidth->Disable(); 520*2d10cb3dSArmin Le Grand mpFTWidth->Disable(); 521*2d10cb3dSArmin Le Grand } 522*2d10cb3dSArmin Le Grand else 523*2d10cb3dSArmin Le Grand { 524*2d10cb3dSArmin Le Grand mpTBWidth->Enable(); 525*2d10cb3dSArmin Le Grand mpFTWidth->Enable(); 526*2d10cb3dSArmin Le Grand } 527*2d10cb3dSArmin Le Grand 528*2d10cb3dSArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 529*2d10cb3dSArmin Le Grand { 5308dcb2a10SAndre Fischer const XLineWidthItem* pItem = dynamic_cast< const XLineWidthItem* >(pState); 5318dcb2a10SAndre Fischer 532*2d10cb3dSArmin Le Grand if(pItem) 533*2d10cb3dSArmin Le Grand { 534*2d10cb3dSArmin Le Grand mnWidthCoreValue = pItem->GetValue(); 535*2d10cb3dSArmin Le Grand mbWidthValuable = true; 536*2d10cb3dSArmin Le Grand SetWidthIcon(); 537*2d10cb3dSArmin Le Grand break; 538*2d10cb3dSArmin Le Grand } 539*2d10cb3dSArmin Le Grand } 540*2d10cb3dSArmin Le Grand 541*2d10cb3dSArmin Le Grand mbWidthValuable = false; 542*2d10cb3dSArmin Le Grand SetWidthIcon(); 543*2d10cb3dSArmin Le Grand break; 5448dcb2a10SAndre Fischer } 545*2d10cb3dSArmin Le Grand case SID_ATTR_LINE_START: 5468dcb2a10SAndre Fischer { 547*2d10cb3dSArmin Le Grand if(bDisabled) 548*2d10cb3dSArmin Le Grand { 549*2d10cb3dSArmin Le Grand mpFTArrow->Disable(); 550*2d10cb3dSArmin Le Grand mpLBStart->Disable(); 551*2d10cb3dSArmin Le Grand } 552*2d10cb3dSArmin Le Grand else 553*2d10cb3dSArmin Le Grand { 554*2d10cb3dSArmin Le Grand mpFTArrow->Enable(); 555*2d10cb3dSArmin Le Grand mpLBStart->Enable(); 556*2d10cb3dSArmin Le Grand } 5578dcb2a10SAndre Fischer 558*2d10cb3dSArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 559*2d10cb3dSArmin Le Grand { 560a567bdc8SArmin Le Grand const XLineStartItem* pItem = dynamic_cast< const XLineStartItem* >(pState); 561a567bdc8SArmin Le Grand 562a567bdc8SArmin Le Grand if(pItem) 563a567bdc8SArmin Le Grand { 564*2d10cb3dSArmin Le Grand mpStartItem.reset(pItem ? (XLineStartItem*)pItem->Clone() : 0); 565*2d10cb3dSArmin Le Grand SelectEndStyle(true); 566a567bdc8SArmin Le Grand break; 567a567bdc8SArmin Le Grand } 568*2d10cb3dSArmin Le Grand } 569a567bdc8SArmin Le Grand 570*2d10cb3dSArmin Le Grand mpStartItem.reset(0); 571*2d10cb3dSArmin Le Grand SelectEndStyle(true); 572*2d10cb3dSArmin Le Grand break; 5738dcb2a10SAndre Fischer } 574*2d10cb3dSArmin Le Grand case SID_ATTR_LINE_END: 5758dcb2a10SAndre Fischer { 576*2d10cb3dSArmin Le Grand if(bDisabled) 577*2d10cb3dSArmin Le Grand { 578*2d10cb3dSArmin Le Grand mpFTArrow->Disable(); 579*2d10cb3dSArmin Le Grand mpLBEnd->Disable(); 580*2d10cb3dSArmin Le Grand } 581*2d10cb3dSArmin Le Grand else 582*2d10cb3dSArmin Le Grand { 583*2d10cb3dSArmin Le Grand mpFTArrow->Enable(); 584*2d10cb3dSArmin Le Grand mpLBEnd->Enable(); 585*2d10cb3dSArmin Le Grand } 5868dcb2a10SAndre Fischer 587*2d10cb3dSArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 588*2d10cb3dSArmin Le Grand { 589a567bdc8SArmin Le Grand const XLineEndItem* pItem = dynamic_cast< const XLineEndItem* >(pState); 590a567bdc8SArmin Le Grand 591a567bdc8SArmin Le Grand if(pItem) 592a567bdc8SArmin Le Grand { 593*2d10cb3dSArmin Le Grand mpEndItem.reset(pItem ? (XLineEndItem*)pItem->Clone() : 0); 594*2d10cb3dSArmin Le Grand SelectEndStyle(false); 595a567bdc8SArmin Le Grand break; 596a567bdc8SArmin Le Grand } 597*2d10cb3dSArmin Le Grand } 598a567bdc8SArmin Le Grand 599*2d10cb3dSArmin Le Grand mpEndItem.reset(0); 600*2d10cb3dSArmin Le Grand SelectEndStyle(false); 601*2d10cb3dSArmin Le Grand break; 6028dcb2a10SAndre Fischer } 603*2d10cb3dSArmin Le Grand case SID_LINEEND_LIST: 6048dcb2a10SAndre Fischer { 605*2d10cb3dSArmin Le Grand FillLineEndList(); 606*2d10cb3dSArmin Le Grand SelectEndStyle(true); 607*2d10cb3dSArmin Le Grand SelectEndStyle(false); 608*2d10cb3dSArmin Le Grand break; 6098dcb2a10SAndre Fischer } 610*2d10cb3dSArmin Le Grand case SID_DASH_LIST: 61197e8a929SArmin Le Grand { 612*2d10cb3dSArmin Le Grand FillLineStyleList(); 613*2d10cb3dSArmin Le Grand SelectLineStyle(); 614*2d10cb3dSArmin Le Grand break; 61597e8a929SArmin Le Grand } 6168dcb2a10SAndre Fischer case SID_ATTR_LINE_JOINT: 6178dcb2a10SAndre Fischer { 618*2d10cb3dSArmin Le Grand if(bDisabled) 6198dcb2a10SAndre Fischer { 6208dcb2a10SAndre Fischer mpLBEdgeStyle->Disable(); 6218dcb2a10SAndre Fischer } 6228dcb2a10SAndre Fischer else 6238dcb2a10SAndre Fischer { 6248dcb2a10SAndre Fischer mpLBEdgeStyle->Enable(); 625*2d10cb3dSArmin Le Grand } 626*2d10cb3dSArmin Le Grand 627*2d10cb3dSArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 628*2d10cb3dSArmin Le Grand { 6298dcb2a10SAndre Fischer const XLineJointItem* pItem = dynamic_cast< const XLineJointItem* >(pState); 6308dcb2a10SAndre Fischer 631*2d10cb3dSArmin Le Grand if(pItem) 6328dcb2a10SAndre Fischer { 633*2d10cb3dSArmin Le Grand sal_uInt16 nEntryPos(0); 634*2d10cb3dSArmin Le Grand 6358dcb2a10SAndre Fischer switch(pItem->GetValue()) 6368dcb2a10SAndre Fischer { 6378dcb2a10SAndre Fischer case com::sun::star::drawing::LineJoint_MIDDLE: 6388dcb2a10SAndre Fischer case com::sun::star::drawing::LineJoint_ROUND: 6398dcb2a10SAndre Fischer { 6408dcb2a10SAndre Fischer nEntryPos = 1; 6418dcb2a10SAndre Fischer break; 6428dcb2a10SAndre Fischer } 6438dcb2a10SAndre Fischer case com::sun::star::drawing::LineJoint_NONE: 6448dcb2a10SAndre Fischer { 6458dcb2a10SAndre Fischer nEntryPos = 2; 6468dcb2a10SAndre Fischer break; 6478dcb2a10SAndre Fischer } 6488dcb2a10SAndre Fischer case com::sun::star::drawing::LineJoint_MITER: 6498dcb2a10SAndre Fischer { 6508dcb2a10SAndre Fischer nEntryPos = 3; 6518dcb2a10SAndre Fischer break; 6528dcb2a10SAndre Fischer } 6538dcb2a10SAndre Fischer case com::sun::star::drawing::LineJoint_BEVEL: 6548dcb2a10SAndre Fischer { 6558dcb2a10SAndre Fischer nEntryPos = 4; 6568dcb2a10SAndre Fischer break; 6578dcb2a10SAndre Fischer } 6588dcb2a10SAndre Fischer 6598dcb2a10SAndre Fischer default: 6608dcb2a10SAndre Fischer break; 6618dcb2a10SAndre Fischer } 6628dcb2a10SAndre Fischer 663*2d10cb3dSArmin Le Grand if(nEntryPos) 664*2d10cb3dSArmin Le Grand { 665*2d10cb3dSArmin Le Grand mpLBEdgeStyle->SelectEntryPos(nEntryPos - 1); 666*2d10cb3dSArmin Le Grand break; 667*2d10cb3dSArmin Le Grand } 6688dcb2a10SAndre Fischer } 6698dcb2a10SAndre Fischer } 670*2d10cb3dSArmin Le Grand 671*2d10cb3dSArmin Le Grand mpLBEdgeStyle->SetNoSelection(); 6728dcb2a10SAndre Fischer break; 6738dcb2a10SAndre Fischer } 6748dcb2a10SAndre Fischer case SID_ATTR_LINE_CAP: 6758dcb2a10SAndre Fischer { 676*2d10cb3dSArmin Le Grand if(bDisabled) 6778dcb2a10SAndre Fischer { 6788dcb2a10SAndre Fischer mpLBCapStyle->Disable(); 6798dcb2a10SAndre Fischer } 6808dcb2a10SAndre Fischer else 6818dcb2a10SAndre Fischer { 6828dcb2a10SAndre Fischer mpLBCapStyle->Enable(); 683*2d10cb3dSArmin Le Grand } 684*2d10cb3dSArmin Le Grand 685*2d10cb3dSArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 686*2d10cb3dSArmin Le Grand { 6878dcb2a10SAndre Fischer const XLineCapItem* pItem = dynamic_cast< const XLineCapItem* >(pState); 6888dcb2a10SAndre Fischer 689*2d10cb3dSArmin Le Grand if(pItem) 6908dcb2a10SAndre Fischer { 691*2d10cb3dSArmin Le Grand sal_uInt16 nEntryPos(0); 692*2d10cb3dSArmin Le Grand 6938dcb2a10SAndre Fischer switch(pItem->GetValue()) 6948dcb2a10SAndre Fischer { 6958dcb2a10SAndre Fischer case com::sun::star::drawing::LineCap_BUTT: 6968dcb2a10SAndre Fischer { 6978dcb2a10SAndre Fischer nEntryPos = 1; 6988dcb2a10SAndre Fischer break; 6998dcb2a10SAndre Fischer } 7008dcb2a10SAndre Fischer case com::sun::star::drawing::LineCap_ROUND: 7018dcb2a10SAndre Fischer { 7028dcb2a10SAndre Fischer nEntryPos = 2; 7038dcb2a10SAndre Fischer break; 7048dcb2a10SAndre Fischer } 7058dcb2a10SAndre Fischer case com::sun::star::drawing::LineCap_SQUARE: 7068dcb2a10SAndre Fischer { 7078dcb2a10SAndre Fischer nEntryPos = 3; 7088dcb2a10SAndre Fischer break; 7098dcb2a10SAndre Fischer } 7108dcb2a10SAndre Fischer 7118dcb2a10SAndre Fischer default: 7128dcb2a10SAndre Fischer break; 7138dcb2a10SAndre Fischer } 7148dcb2a10SAndre Fischer 715*2d10cb3dSArmin Le Grand if(nEntryPos) 716*2d10cb3dSArmin Le Grand { 717*2d10cb3dSArmin Le Grand mpLBCapStyle->SelectEntryPos(nEntryPos - 1); 718*2d10cb3dSArmin Le Grand break; 719*2d10cb3dSArmin Le Grand } 7208dcb2a10SAndre Fischer } 721*2d10cb3dSArmin Le Grand 722*2d10cb3dSArmin Le Grand mpLBCapStyle->SetNoSelection(); 7238dcb2a10SAndre Fischer } 7248dcb2a10SAndre Fischer break; 7258dcb2a10SAndre Fischer } 7268dcb2a10SAndre Fischer } 7278dcb2a10SAndre Fischer } 7288dcb2a10SAndre Fischer 7298dcb2a10SAndre Fischer 7308dcb2a10SAndre Fischer 73145da7d5eSAndre Fischer 7328dcb2a10SAndre Fischer SfxBindings* LinePropertyPanel::GetBindings() 7338dcb2a10SAndre Fischer { 7348dcb2a10SAndre Fischer return mpBindings; 7358dcb2a10SAndre Fischer } 7368dcb2a10SAndre Fischer 7378dcb2a10SAndre Fischer 7388dcb2a10SAndre Fischer 7398dcb2a10SAndre Fischer IMPL_LINK( LinePropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG ) 7408dcb2a10SAndre Fischer { 741*2d10cb3dSArmin Le Grand return 0; 7428dcb2a10SAndre Fischer } 7438dcb2a10SAndre Fischer 7448dcb2a10SAndre Fischer 7458dcb2a10SAndre Fischer 7468dcb2a10SAndre Fischer 7478dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ToolboxColorSelectHdl,ToolBox*, pToolBox) 7488dcb2a10SAndre Fischer { 749*2d10cb3dSArmin Le Grand sal_uInt16 nId = pToolBox->GetCurItemId(); 750*2d10cb3dSArmin Le Grand if(nId == TBI_COLOR) 751*2d10cb3dSArmin Le Grand { 7528dcb2a10SAndre Fischer maColorPopup.Show(*pToolBox); 7538dcb2a10SAndre Fischer maColorPopup.SetCurrentColor(maColor, mbColorAvailable); 754*2d10cb3dSArmin Le Grand } 755*2d10cb3dSArmin Le Grand return 0; 7568dcb2a10SAndre Fischer } 7578dcb2a10SAndre Fischer 7588dcb2a10SAndre Fischer 7598dcb2a10SAndre Fischer 7608dcb2a10SAndre Fischer 7617134ea5bSPavel Janík IMPL_LINK(LinePropertyPanel, ChangeLineStyleHdl, ToolBox*, /* pToolBox */) 7628dcb2a10SAndre Fischer { 76397e8a929SArmin Le Grand const sal_uInt16 nPos(mpLBStyle->GetSelectEntryPos()); 7648dcb2a10SAndre Fischer 76597e8a929SArmin Le Grand if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBStyle->GetSavedValue()) 76697e8a929SArmin Le Grand { 76797e8a929SArmin Le Grand if(0 == nPos) 76897e8a929SArmin Le Grand { 76997e8a929SArmin Le Grand // XLINE_NONE 77097e8a929SArmin Le Grand const XLineStyleItem aItem(XLINE_NONE); 77197e8a929SArmin Le Grand 77297e8a929SArmin Le Grand GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L); 77397e8a929SArmin Le Grand } 77497e8a929SArmin Le Grand else if(1 == nPos) 77597e8a929SArmin Le Grand { 77697e8a929SArmin Le Grand // XLINE_SOLID 77797e8a929SArmin Le Grand const XLineStyleItem aItem(XLINE_SOLID); 77897e8a929SArmin Le Grand 77997e8a929SArmin Le Grand GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L); 78097e8a929SArmin Le Grand } 78197e8a929SArmin Le Grand else if(mpLineStyleList && mpLineStyleList->Count() > (long)(nPos - 2)) 78297e8a929SArmin Le Grand { 78397e8a929SArmin Le Grand // XLINE_DASH 78497e8a929SArmin Le Grand const XLineStyleItem aItemA(XLINE_DASH); 785c3c0ed1bSArmin Le Grand const XDashEntry* pDashEntry = mpLineStyleList->GetDash(nPos - 2); 786c3c0ed1bSArmin Le Grand OSL_ENSURE(pDashEntry, "OOps, got empty XDash from XDashList (!)"); 787c3c0ed1bSArmin Le Grand const XLineDashItem aItemB( 788c3c0ed1bSArmin Le Grand pDashEntry ? pDashEntry->GetName() : String(), 789c3c0ed1bSArmin Le Grand pDashEntry ? pDashEntry->GetDash() : XDash()); 79097e8a929SArmin Le Grand 79197e8a929SArmin Le Grand GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItemA, 0L); 79297e8a929SArmin Le Grand GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_DASH, SFX_CALLMODE_RECORD, &aItemB, 0L); 79397e8a929SArmin Le Grand } 79497e8a929SArmin Le Grand } 79597e8a929SArmin Le Grand 79697e8a929SArmin Le Grand return 0; 79797e8a929SArmin Le Grand } 7988dcb2a10SAndre Fischer 7998dcb2a10SAndre Fischer 8008dcb2a10SAndre Fischer 8018dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ChangeStartHdl, void*, EMPTYARG) 8028dcb2a10SAndre Fischer { 803*2d10cb3dSArmin Le Grand sal_uInt16 nPos = mpLBStart->GetSelectEntryPos(); 804*2d10cb3dSArmin Le Grand if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != mpLBStart->GetSavedValue() ) 805*2d10cb3dSArmin Le Grand { 806*2d10cb3dSArmin Le Grand XLineStartItem* pItem = NULL; 807*2d10cb3dSArmin Le Grand if( nPos == 0 ) 808*2d10cb3dSArmin Le Grand pItem = new XLineStartItem(); 809*2d10cb3dSArmin Le Grand else if( mpLineEndList && mpLineEndList->Count() > (long) ( nPos - 1 ) ) 810*2d10cb3dSArmin Le Grand pItem = new XLineStartItem( mpLBStart->GetSelectEntry(),mpLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ); 811*2d10cb3dSArmin Le Grand GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SFX_CALLMODE_RECORD, pItem, 0L); 812*2d10cb3dSArmin Le Grand delete pItem; 813*2d10cb3dSArmin Le Grand } 814*2d10cb3dSArmin Le Grand return 0; 8158dcb2a10SAndre Fischer } 8168dcb2a10SAndre Fischer 8178dcb2a10SAndre Fischer 8188dcb2a10SAndre Fischer 8198dcb2a10SAndre Fischer 8208dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ChangeEndHdl, void*, EMPTYARG) 8218dcb2a10SAndre Fischer { 822*2d10cb3dSArmin Le Grand sal_uInt16 nPos = mpLBEnd->GetSelectEntryPos(); 823*2d10cb3dSArmin Le Grand if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != mpLBEnd->GetSavedValue() ) 824*2d10cb3dSArmin Le Grand { 825*2d10cb3dSArmin Le Grand XLineEndItem* pItem = NULL; 826*2d10cb3dSArmin Le Grand if( nPos == 0 ) 827*2d10cb3dSArmin Le Grand pItem = new XLineEndItem(); 828*2d10cb3dSArmin Le Grand else if( mpLineEndList && mpLineEndList->Count() > (long) ( nPos - 1 ) ) 829*2d10cb3dSArmin Le Grand pItem = new XLineEndItem( mpLBEnd->GetSelectEntry(), mpLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ); 830*2d10cb3dSArmin Le Grand GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SFX_CALLMODE_RECORD, pItem, 0L); 831*2d10cb3dSArmin Le Grand delete pItem; 832*2d10cb3dSArmin Le Grand } 833*2d10cb3dSArmin Le Grand return 0; 8348dcb2a10SAndre Fischer } 8358dcb2a10SAndre Fischer 8368dcb2a10SAndre Fischer 8378dcb2a10SAndre Fischer 8388dcb2a10SAndre Fischer 8398dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ChangeEdgeStyleHdl, void*, EMPTYARG) 8408dcb2a10SAndre Fischer { 8418dcb2a10SAndre Fischer const sal_uInt16 nPos(mpLBEdgeStyle->GetSelectEntryPos()); 8428dcb2a10SAndre Fischer 8438dcb2a10SAndre Fischer if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBEdgeStyle->GetSavedValue()) 8448dcb2a10SAndre Fischer { 8458dcb2a10SAndre Fischer XLineJointItem* pItem = 0; 8468dcb2a10SAndre Fischer 8478dcb2a10SAndre Fischer switch(nPos) 8488dcb2a10SAndre Fischer { 8498dcb2a10SAndre Fischer case 0: // rounded 8508dcb2a10SAndre Fischer { 8518dcb2a10SAndre Fischer pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_ROUND); 8528dcb2a10SAndre Fischer break; 8538dcb2a10SAndre Fischer } 8548dcb2a10SAndre Fischer case 1: // none 8558dcb2a10SAndre Fischer { 8568dcb2a10SAndre Fischer pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_NONE); 8578dcb2a10SAndre Fischer break; 8588dcb2a10SAndre Fischer } 8598dcb2a10SAndre Fischer case 2: // mitered 8608dcb2a10SAndre Fischer { 8618dcb2a10SAndre Fischer pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_MITER); 8628dcb2a10SAndre Fischer break; 8638dcb2a10SAndre Fischer } 8648dcb2a10SAndre Fischer case 3: // beveled 8658dcb2a10SAndre Fischer { 8668dcb2a10SAndre Fischer pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_BEVEL); 8678dcb2a10SAndre Fischer break; 8688dcb2a10SAndre Fischer } 8698dcb2a10SAndre Fischer } 8708dcb2a10SAndre Fischer 8718dcb2a10SAndre Fischer GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_JOINT, SFX_CALLMODE_RECORD, pItem, 0L); 8728dcb2a10SAndre Fischer delete pItem; 8738dcb2a10SAndre Fischer } 8748dcb2a10SAndre Fischer return 0; 8758dcb2a10SAndre Fischer } 8768dcb2a10SAndre Fischer 8778dcb2a10SAndre Fischer 8788dcb2a10SAndre Fischer 8798dcb2a10SAndre Fischer 8808dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ChangeCapStyleHdl, void*, EMPTYARG) 8818dcb2a10SAndre Fischer { 8828dcb2a10SAndre Fischer const sal_uInt16 nPos(mpLBCapStyle->GetSelectEntryPos()); 8838dcb2a10SAndre Fischer 8848dcb2a10SAndre Fischer if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBCapStyle->GetSavedValue()) 8858dcb2a10SAndre Fischer { 8868dcb2a10SAndre Fischer XLineCapItem* pItem = 0; 8878dcb2a10SAndre Fischer 8888dcb2a10SAndre Fischer switch(nPos) 8898dcb2a10SAndre Fischer { 8908dcb2a10SAndre Fischer case 0: // flat 8918dcb2a10SAndre Fischer { 8928dcb2a10SAndre Fischer pItem = new XLineCapItem(com::sun::star::drawing::LineCap_BUTT); 8938dcb2a10SAndre Fischer break; 8948dcb2a10SAndre Fischer } 8958dcb2a10SAndre Fischer case 1: // round 8968dcb2a10SAndre Fischer { 8978dcb2a10SAndre Fischer pItem = new XLineCapItem(com::sun::star::drawing::LineCap_ROUND); 8988dcb2a10SAndre Fischer break; 8998dcb2a10SAndre Fischer } 9008dcb2a10SAndre Fischer case 2: // square 9018dcb2a10SAndre Fischer { 9028dcb2a10SAndre Fischer pItem = new XLineCapItem(com::sun::star::drawing::LineCap_SQUARE); 9038dcb2a10SAndre Fischer break; 9048dcb2a10SAndre Fischer } 9058dcb2a10SAndre Fischer } 9068dcb2a10SAndre Fischer 9078dcb2a10SAndre Fischer GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_CAP, SFX_CALLMODE_RECORD, pItem, 0L); 9088dcb2a10SAndre Fischer delete pItem; 9098dcb2a10SAndre Fischer } 9108dcb2a10SAndre Fischer return 0; 9118dcb2a10SAndre Fischer } 9128dcb2a10SAndre Fischer 9138dcb2a10SAndre Fischer 9148dcb2a10SAndre Fischer 9158dcb2a10SAndre Fischer 9168dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ToolboxWidthSelectHdl,ToolBox*, pToolBox) 9178dcb2a10SAndre Fischer { 918*2d10cb3dSArmin Le Grand if (pToolBox->GetCurItemId() == TBI_WIDTH) 919*2d10cb3dSArmin Le Grand { 920*2d10cb3dSArmin Le Grand maLineWidthPopup.SetWidthSelect(mnWidthCoreValue, mbWidthValuable, meMapUnit); 9218dcb2a10SAndre Fischer maLineWidthPopup.Show(*pToolBox); 922*2d10cb3dSArmin Le Grand } 923*2d10cb3dSArmin Le Grand return 0; 9248dcb2a10SAndre Fischer } 9258dcb2a10SAndre Fischer 9268dcb2a10SAndre Fischer 9278dcb2a10SAndre Fischer 9288dcb2a10SAndre Fischer 9298dcb2a10SAndre Fischer IMPL_LINK( LinePropertyPanel, ChangeTransparentHdl, void *, EMPTYARG ) 9308dcb2a10SAndre Fischer { 931*2d10cb3dSArmin Le Grand sal_uInt16 nVal = (sal_uInt16)mpMFTransparent->GetValue(); 932*2d10cb3dSArmin Le Grand XLineTransparenceItem aItem( nVal ); 9338dcb2a10SAndre Fischer 934*2d10cb3dSArmin Le Grand GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L); 935*2d10cb3dSArmin Le Grand return( 0L ); 9368dcb2a10SAndre Fischer } 9378dcb2a10SAndre Fischer 9388dcb2a10SAndre Fischer 9398dcb2a10SAndre Fischer 9408dcb2a10SAndre Fischer 941b7a56e95SArmin Le Grand namespace 942b7a56e95SArmin Le Grand { 943b7a56e95SArmin Le Grand Color GetTransparentColor (void) 944b7a56e95SArmin Le Grand { 945b7a56e95SArmin Le Grand return COL_TRANSPARENT; 946b7a56e95SArmin Le Grand } 947b7a56e95SArmin Le Grand } // end of anonymous namespace 948b7a56e95SArmin Le Grand 9498dcb2a10SAndre Fischer PopupControl* LinePropertyPanel::CreateColorPopupControl (PopupContainer* pParent) 9508dcb2a10SAndre Fischer { 9518dcb2a10SAndre Fischer return new ColorControl( 9528dcb2a10SAndre Fischer pParent, 9538dcb2a10SAndre Fischer mpBindings, 9548dcb2a10SAndre Fischer SVX_RES(RID_POPUPPANEL_LINEPAGE_COLOR), 9558dcb2a10SAndre Fischer SVX_RES(VS_COLOR), 9568dcb2a10SAndre Fischer ::boost::bind(GetTransparentColor), 9578dcb2a10SAndre Fischer ::boost::bind(&LinePropertyPanel::SetColor, this, _1, _2), 9588dcb2a10SAndre Fischer pParent, 959b7a56e95SArmin Le Grand 0); 9608dcb2a10SAndre Fischer } 9618dcb2a10SAndre Fischer 9628dcb2a10SAndre Fischer 9638dcb2a10SAndre Fischer 9648dcb2a10SAndre Fischer 9658dcb2a10SAndre Fischer PopupControl* LinePropertyPanel::CreateLineWidthPopupControl (PopupContainer* pParent) 9668dcb2a10SAndre Fischer { 9678dcb2a10SAndre Fischer return new LineWidthControl(pParent, *this); 9688dcb2a10SAndre Fischer } 9698dcb2a10SAndre Fischer 9708dcb2a10SAndre Fischer 9718dcb2a10SAndre Fischer 9728dcb2a10SAndre Fischer 9738dcb2a10SAndre Fischer void LinePropertyPanel::EndLineWidthPopupMode (void) 9748dcb2a10SAndre Fischer { 9758dcb2a10SAndre Fischer maLineWidthPopup.Hide(); 9768dcb2a10SAndre Fischer } 9778dcb2a10SAndre Fischer 9788dcb2a10SAndre Fischer 9798dcb2a10SAndre Fischer 9808dcb2a10SAndre Fischer 9818dcb2a10SAndre Fischer void LinePropertyPanel::SetWidthIcon(int n) 9828dcb2a10SAndre Fischer { 983*2d10cb3dSArmin Le Grand if(n==0) 984*2d10cb3dSArmin Le Grand mpTBWidth->SetItemImage( TBI_WIDTH, maIMGNone); 985*2d10cb3dSArmin Le Grand else 986*2d10cb3dSArmin Le Grand mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[n-1] : mpIMGWidthIcon[n-1]); 9878dcb2a10SAndre Fischer } 9888dcb2a10SAndre Fischer 9898dcb2a10SAndre Fischer 9908dcb2a10SAndre Fischer 9918dcb2a10SAndre Fischer void LinePropertyPanel::SetWidthIcon() 9928dcb2a10SAndre Fischer { 993*2d10cb3dSArmin Le Grand if(!mbWidthValuable) 994*2d10cb3dSArmin Le Grand { 995*2d10cb3dSArmin Le Grand mpTBWidth->SetItemImage( TBI_WIDTH, maIMGNone); 996*2d10cb3dSArmin Le Grand return; 997*2d10cb3dSArmin Le Grand } 998*2d10cb3dSArmin Le Grand 999*2d10cb3dSArmin Le Grand long nVal = LogicToLogic(mnWidthCoreValue * 10,(MapUnit)meMapUnit , MAP_POINT); 1000*2d10cb3dSArmin Le Grand 1001*2d10cb3dSArmin Le Grand if(nVal <= 6) 1002*2d10cb3dSArmin Le Grand mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[0] : mpIMGWidthIcon[0]); 1003*2d10cb3dSArmin Le Grand else if(nVal > 6 && nVal <= 9) 1004*2d10cb3dSArmin Le Grand mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[1] : mpIMGWidthIcon[1]); 1005*2d10cb3dSArmin Le Grand else if(nVal > 9 && nVal <= 12) 1006*2d10cb3dSArmin Le Grand mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[2] : mpIMGWidthIcon[2]); 1007*2d10cb3dSArmin Le Grand else if(nVal > 12 && nVal <= 19) 1008*2d10cb3dSArmin Le Grand mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[3] : mpIMGWidthIcon[3]); 1009*2d10cb3dSArmin Le Grand else if(nVal > 19 && nVal <= 26) 1010*2d10cb3dSArmin Le Grand mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[4] : mpIMGWidthIcon[4]); 1011*2d10cb3dSArmin Le Grand else if(nVal > 26 && nVal <= 37) 1012*2d10cb3dSArmin Le Grand mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[5] : mpIMGWidthIcon[5]); 1013*2d10cb3dSArmin Le Grand else if(nVal > 37 && nVal <=52) 1014*2d10cb3dSArmin Le Grand mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[6] : mpIMGWidthIcon[6]); 1015*2d10cb3dSArmin Le Grand else if(nVal > 52) 1016*2d10cb3dSArmin Le Grand mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[7] : mpIMGWidthIcon[7]); 10178dcb2a10SAndre Fischer 10188dcb2a10SAndre Fischer } 10198dcb2a10SAndre Fischer 10208dcb2a10SAndre Fischer 10218dcb2a10SAndre Fischer 10228dcb2a10SAndre Fischer void LinePropertyPanel::SetColor ( 10238dcb2a10SAndre Fischer const String& rsColorName, 10248dcb2a10SAndre Fischer const Color aColor) 10258dcb2a10SAndre Fischer { 10268dcb2a10SAndre Fischer XLineColorItem aColorItem(rsColorName, aColor); 10278dcb2a10SAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); 10288dcb2a10SAndre Fischer maColor = aColor; 10298dcb2a10SAndre Fischer } 10308dcb2a10SAndre Fischer 10318dcb2a10SAndre Fischer 10328dcb2a10SAndre Fischer 10338dcb2a10SAndre Fischer void LinePropertyPanel::SetWidth(long nWidth) 10348dcb2a10SAndre Fischer { 10358dcb2a10SAndre Fischer mnWidthCoreValue = nWidth; 10368dcb2a10SAndre Fischer mbWidthValuable = true; 10378dcb2a10SAndre Fischer } 10388dcb2a10SAndre Fischer 10398dcb2a10SAndre Fischer 10408dcb2a10SAndre Fischer 10418dcb2a10SAndre Fischer void LinePropertyPanel::FillLineEndList() 10428dcb2a10SAndre Fischer { 1043*2d10cb3dSArmin Le Grand SfxObjectShell* pSh = SfxObjectShell::Current(); 1044*2d10cb3dSArmin Le Grand if ( pSh && pSh->GetItem( SID_LINEEND_LIST ) ) 1045*2d10cb3dSArmin Le Grand { 1046*2d10cb3dSArmin Le Grand mpLBStart->Enable(); 1047*2d10cb3dSArmin Le Grand SvxLineEndListItem aItem( *(const SvxLineEndListItem*)(pSh->GetItem( SID_LINEEND_LIST ) ) ); 1048*2d10cb3dSArmin Le Grand mpLineEndList = aItem.GetLineEndList(); 1049a567bdc8SArmin Le Grand 10508dcb2a10SAndre Fischer if(mpLineEndList) 1051*2d10cb3dSArmin Le Grand { 1052a567bdc8SArmin Le Grand FillLineEndListBox(*mpLBStart, *mpLBEnd, *mpLineEndList); 1053*2d10cb3dSArmin Le Grand } 1054*2d10cb3dSArmin Le Grand 1055*2d10cb3dSArmin Le Grand mpLBStart->SelectEntryPos(0); 1056*2d10cb3dSArmin Le Grand mpLBEnd->SelectEntryPos(0); 1057*2d10cb3dSArmin Le Grand } 1058*2d10cb3dSArmin Le Grand else 1059*2d10cb3dSArmin Le Grand { 1060*2d10cb3dSArmin Le Grand mpLBStart->Disable(); 1061*2d10cb3dSArmin Le Grand mpLBEnd->Disable(); 1062*2d10cb3dSArmin Le Grand } 10638dcb2a10SAndre Fischer } 10648dcb2a10SAndre Fischer 10658dcb2a10SAndre Fischer 10668dcb2a10SAndre Fischer 106797e8a929SArmin Le Grand void LinePropertyPanel::FillLineStyleList() 106897e8a929SArmin Le Grand { 1069*2d10cb3dSArmin Le Grand SfxObjectShell* pSh = SfxObjectShell::Current(); 1070*2d10cb3dSArmin Le Grand if ( pSh && pSh->GetItem( SID_DASH_LIST ) ) 1071*2d10cb3dSArmin Le Grand { 1072*2d10cb3dSArmin Le Grand mpLBStyle->Enable(); 1073*2d10cb3dSArmin Le Grand SvxDashListItem aItem( *(const SvxDashListItem*)(pSh->GetItem( SID_DASH_LIST ) ) ); 1074*2d10cb3dSArmin Le Grand mpLineStyleList = aItem.GetDashList(); 107597e8a929SArmin Le Grand 107697e8a929SArmin Le Grand if(mpLineStyleList) 1077*2d10cb3dSArmin Le Grand { 107897e8a929SArmin Le Grand FillLineStyleListBox(*mpLBStyle, *mpLineStyleList); 1079*2d10cb3dSArmin Le Grand } 1080*2d10cb3dSArmin Le Grand 1081*2d10cb3dSArmin Le Grand mpLBStyle->SelectEntryPos(0); 1082*2d10cb3dSArmin Le Grand } 1083*2d10cb3dSArmin Le Grand else 1084*2d10cb3dSArmin Le Grand { 1085*2d10cb3dSArmin Le Grand mpLBStyle->Disable(); 1086*2d10cb3dSArmin Le Grand } 108797e8a929SArmin Le Grand } 108897e8a929SArmin Le Grand 108997e8a929SArmin Le Grand 109097e8a929SArmin Le Grand 109197e8a929SArmin Le Grand void LinePropertyPanel::SelectLineStyle() 109297e8a929SArmin Le Grand { 1093*2d10cb3dSArmin Le Grand if( !mpStyleItem.get() || !mpDashItem.get() ) 1094*2d10cb3dSArmin Le Grand { 1095*2d10cb3dSArmin Le Grand mpLBStyle->SetNoSelection(); 1096*2d10cb3dSArmin Le Grand return; 1097*2d10cb3dSArmin Le Grand } 109897e8a929SArmin Le Grand 109997e8a929SArmin Le Grand const XLineStyle eXLS(mpStyleItem ? (XLineStyle)mpStyleItem->GetValue() : XLINE_NONE); 1100*2d10cb3dSArmin Le Grand bool bSelected(false); 110197e8a929SArmin Le Grand 110297e8a929SArmin Le Grand switch(eXLS) 110397e8a929SArmin Le Grand { 110497e8a929SArmin Le Grand case XLINE_NONE: 110597e8a929SArmin Le Grand break; 110697e8a929SArmin Le Grand case XLINE_SOLID: 1107*2d10cb3dSArmin Le Grand mpLBStyle->SelectEntryPos(1); 1108*2d10cb3dSArmin Le Grand bSelected = true; 110997e8a929SArmin Le Grand break; 111097e8a929SArmin Le Grand default: 111197e8a929SArmin Le Grand if(mpDashItem && mpLineStyleList) 1112*2d10cb3dSArmin Le Grand { 1113*2d10cb3dSArmin Le Grand const XDash& rDash = mpDashItem->GetDashValue(); 1114*2d10cb3dSArmin Le Grand for(sal_Int32 a(0);!bSelected && a < mpLineStyleList->Count(); a++) 1115*2d10cb3dSArmin Le Grand { 1116*2d10cb3dSArmin Le Grand XDashEntry* pEntry = mpLineStyleList->GetDash(a); 1117*2d10cb3dSArmin Le Grand const XDash& rEntry = pEntry->GetDash(); 1118*2d10cb3dSArmin Le Grand if(rDash == rEntry) 1119*2d10cb3dSArmin Le Grand { 1120*2d10cb3dSArmin Le Grand mpLBStyle->SelectEntryPos((sal_uInt16)a + 2); 1121*2d10cb3dSArmin Le Grand bSelected = true; 1122*2d10cb3dSArmin Le Grand } 1123*2d10cb3dSArmin Le Grand } 1124*2d10cb3dSArmin Le Grand } 112597e8a929SArmin Le Grand break; 112697e8a929SArmin Le Grand } 1127*2d10cb3dSArmin Le Grand 112897e8a929SArmin Le Grand if(!bSelected) 1129*2d10cb3dSArmin Le Grand mpLBStyle->SelectEntryPos( 0 ); 113097e8a929SArmin Le Grand } 113197e8a929SArmin Le Grand 11328dcb2a10SAndre Fischer void LinePropertyPanel::SelectEndStyle(bool bStart) 11338dcb2a10SAndre Fischer { 1134*2d10cb3dSArmin Le Grand sal_Bool bSelected(false); 1135*2d10cb3dSArmin Le Grand 1136*2d10cb3dSArmin Le Grand if(bStart) 1137*2d10cb3dSArmin Le Grand { 1138*2d10cb3dSArmin Le Grand if( !mpStartItem.get() ) 1139*2d10cb3dSArmin Le Grand { 1140*2d10cb3dSArmin Le Grand mpLBStart->SetNoSelection(); 1141*2d10cb3dSArmin Le Grand return; 1142*2d10cb3dSArmin Le Grand } 1143*2d10cb3dSArmin Le Grand 1144*2d10cb3dSArmin Le Grand if(mpStartItem && mpLineEndList) 1145*2d10cb3dSArmin Le Grand { 1146*2d10cb3dSArmin Le Grand const basegfx::B2DPolyPolygon& rItemPolygon = mpStartItem->GetLineStartValue(); 1147*2d10cb3dSArmin Le Grand for(sal_Int32 a(0);!bSelected && a < mpLineEndList->Count(); a++) 1148*2d10cb3dSArmin Le Grand { 1149*2d10cb3dSArmin Le Grand XLineEndEntry* pEntry = mpLineEndList->GetLineEnd(a); 1150*2d10cb3dSArmin Le Grand const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd(); 1151*2d10cb3dSArmin Le Grand if(rItemPolygon == rEntryPolygon) 1152*2d10cb3dSArmin Le Grand { 1153*2d10cb3dSArmin Le Grand mpLBStart->SelectEntryPos((sal_uInt16)a + 1); 1154*2d10cb3dSArmin Le Grand bSelected = true; 1155*2d10cb3dSArmin Le Grand } 1156*2d10cb3dSArmin Le Grand } 1157*2d10cb3dSArmin Le Grand } 1158*2d10cb3dSArmin Le Grand 1159*2d10cb3dSArmin Le Grand if(!bSelected) 1160*2d10cb3dSArmin Le Grand { 1161*2d10cb3dSArmin Le Grand mpLBStart->SelectEntryPos( 0 ); 1162*2d10cb3dSArmin Le Grand } 1163*2d10cb3dSArmin Le Grand } 1164*2d10cb3dSArmin Le Grand else 1165*2d10cb3dSArmin Le Grand { 1166*2d10cb3dSArmin Le Grand if( !mpEndItem.get() ) 1167*2d10cb3dSArmin Le Grand { 1168*2d10cb3dSArmin Le Grand mpLBEnd->SetNoSelection(); 1169*2d10cb3dSArmin Le Grand return; 1170*2d10cb3dSArmin Le Grand } 1171*2d10cb3dSArmin Le Grand 1172*2d10cb3dSArmin Le Grand if(mpEndItem && mpLineEndList) 1173*2d10cb3dSArmin Le Grand { 1174*2d10cb3dSArmin Le Grand const basegfx::B2DPolyPolygon& rItemPolygon = mpEndItem->GetLineEndValue(); 1175*2d10cb3dSArmin Le Grand for(sal_Int32 a(0);!bSelected && a < mpLineEndList->Count(); a++) 1176*2d10cb3dSArmin Le Grand { 1177*2d10cb3dSArmin Le Grand XLineEndEntry* pEntry = mpLineEndList->GetLineEnd(a); 1178*2d10cb3dSArmin Le Grand const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd(); 1179*2d10cb3dSArmin Le Grand if(rItemPolygon == rEntryPolygon) 1180*2d10cb3dSArmin Le Grand { 1181*2d10cb3dSArmin Le Grand mpLBEnd->SelectEntryPos((sal_uInt16)a + 1); 1182*2d10cb3dSArmin Le Grand bSelected = true; 1183*2d10cb3dSArmin Le Grand } 1184*2d10cb3dSArmin Le Grand } 1185*2d10cb3dSArmin Le Grand } 1186*2d10cb3dSArmin Le Grand 1187*2d10cb3dSArmin Le Grand if(!bSelected) 1188*2d10cb3dSArmin Le Grand { 1189*2d10cb3dSArmin Le Grand mpLBEnd->SelectEntryPos( 0 ); 1190*2d10cb3dSArmin Le Grand } 1191*2d10cb3dSArmin Le Grand } 11928dcb2a10SAndre Fischer } 11938dcb2a10SAndre Fischer 11948dcb2a10SAndre Fischer 11958dcb2a10SAndre Fischer } } // end of namespace svx::sidebar 11964e8031e0SArmin Le Grand 11974e8031e0SArmin Le Grand // eof 1198