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 22d29c2fc2SAndre Fischer #include <sfx2/sidebar/ResourceDefinitions.hrc> 238dcb2a10SAndre Fischer #include <sfx2/sidebar/Theme.hxx> 248dcb2a10SAndre Fischer #include <sfx2/sidebar/ControlFactory.hxx> 25*6a606da0SAndre Fischer #include <sfx2/sidebar/Layouter.hxx> 268dcb2a10SAndre Fischer #include <LinePropertyPanel.hxx> 278dcb2a10SAndre Fischer #include <LinePropertyPanel.hrc> 288dcb2a10SAndre Fischer #include <svx/dialogs.hrc> 298dcb2a10SAndre Fischer #include <svx/dialmgr.hxx> 308dcb2a10SAndre Fischer #include <sfx2/objsh.hxx> 318dcb2a10SAndre Fischer #include <sfx2/bindings.hxx> 328dcb2a10SAndre Fischer #include <sfx2/dispatch.hxx> 338dcb2a10SAndre Fischer #include <svx/xlnclit.hxx> 348dcb2a10SAndre Fischer #include <svx/xtable.hxx> 358dcb2a10SAndre Fischer #include <svx/xdash.hxx> 368dcb2a10SAndre Fischer #include <svx/drawitem.hxx> 378dcb2a10SAndre Fischer #include <svx/svxitems.hrc> 388dcb2a10SAndre Fischer #include <svtools/valueset.hxx> 398dcb2a10SAndre Fischer #include <unotools/pathoptions.hxx> 408dcb2a10SAndre Fischer #include <unotools/viewoptions.hxx> 418dcb2a10SAndre Fischer #include <comphelper/processfactory.hxx> 428dcb2a10SAndre Fischer #include <i18npool/mslangid.hxx> 438dcb2a10SAndre Fischer #include <svx/xlineit0.hxx> 448dcb2a10SAndre Fischer #include <svx/xlndsit.hxx> 458dcb2a10SAndre Fischer #include <vcl/svapp.hxx> 468dcb2a10SAndre Fischer #include <svx/xlnwtit.hxx> 478dcb2a10SAndre Fischer #include <vcl/lstbox.hxx> 488dcb2a10SAndre Fischer #include <svx/tbxcolorupdate.hxx> 498dcb2a10SAndre Fischer #include <vcl/toolbox.hxx> 508dcb2a10SAndre Fischer #include <svx/xlntrit.hxx> 518dcb2a10SAndre Fischer #include <svx/xlnstit.hxx> 528dcb2a10SAndre Fischer #include <svx/xlnedit.hxx> 538dcb2a10SAndre Fischer #include <svx/xlncapit.hxx> 548dcb2a10SAndre Fischer #include <svx/xlinjoit.hxx> 558dcb2a10SAndre Fischer #include "svx/sidebar/PopupContainer.hxx" 568dcb2a10SAndre Fischer #include "svx/sidebar/PopupControl.hxx" 57facb16e7SArmin Le Grand #include <svx/sidebar/ColorControl.hxx> 588dcb2a10SAndre Fischer #include "LineWidthControl.hxx" 598dcb2a10SAndre Fischer #include <boost/bind.hpp> 608dcb2a10SAndre Fischer 618dcb2a10SAndre Fischer using namespace css; 628dcb2a10SAndre Fischer using namespace cssu; 63*6a606da0SAndre Fischer using ::sfx2::sidebar::Layouter; 648dcb2a10SAndre Fischer using ::sfx2::sidebar::Theme; 658dcb2a10SAndre Fischer 66*6a606da0SAndre Fischer 678dcb2a10SAndre Fischer #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) 688dcb2a10SAndre Fischer 698dcb2a10SAndre Fischer namespace { 708dcb2a10SAndre Fischer short GetItemId_Impl_line( ValueSet& rValueSet, const Color& rCol ) 718dcb2a10SAndre Fischer { 728dcb2a10SAndre Fischer if(rCol == COL_AUTO) 738dcb2a10SAndre Fischer return 0; 748dcb2a10SAndre Fischer 758dcb2a10SAndre Fischer bool bFound = false; 768dcb2a10SAndre Fischer sal_uInt16 nCount = rValueSet.GetItemCount(); 778dcb2a10SAndre Fischer sal_uInt16 n = 1; 788dcb2a10SAndre Fischer 798dcb2a10SAndre Fischer while ( !bFound && n <= nCount ) 808dcb2a10SAndre Fischer { 818dcb2a10SAndre Fischer Color aValCol = rValueSet.GetItemColor(n); 828dcb2a10SAndre Fischer 838dcb2a10SAndre Fischer bFound = ( aValCol.GetRed() == rCol.GetRed() 848dcb2a10SAndre Fischer && aValCol.GetGreen() == rCol.GetGreen() 858dcb2a10SAndre Fischer && aValCol.GetBlue() == rCol.GetBlue() ); 868dcb2a10SAndre Fischer 878dcb2a10SAndre Fischer if ( !bFound ) 888dcb2a10SAndre Fischer n++; 898dcb2a10SAndre Fischer } 908dcb2a10SAndre Fischer return bFound ? n : -1; 918dcb2a10SAndre Fischer } 928dcb2a10SAndre Fischer 93c7be74b1SArmin Le Grand void FillLineEndListBox(ListBox& rListBoxStart, ListBox& rListBoxEnd, const XLineEndListSharedPtr aList) 948dcb2a10SAndre Fischer { 95c7be74b1SArmin Le Grand const sal_uInt32 nCount(aList.get() ? aList->Count() : 0); 9697e8a929SArmin Le Grand const String sNone(SVX_RES(RID_SVXSTR_NONE)); 9797e8a929SArmin Le Grand 98a567bdc8SArmin Le Grand rListBoxStart.SetUpdateMode(false); 99a567bdc8SArmin Le Grand rListBoxEnd.SetUpdateMode(false); 1008dcb2a10SAndre Fischer 10197e8a929SArmin Le Grand rListBoxStart.Clear(); 10297e8a929SArmin Le Grand rListBoxEnd.Clear(); 10397e8a929SArmin Le Grand 10497e8a929SArmin Le Grand // add 'none' entries 10597e8a929SArmin Le Grand rListBoxStart.InsertEntry(sNone); 10697e8a929SArmin Le Grand rListBoxEnd.InsertEntry(sNone); 10797e8a929SArmin Le Grand 108a567bdc8SArmin Le Grand for(sal_uInt32 i(0); i < nCount; i++) 1098dcb2a10SAndre Fischer { 110c7be74b1SArmin Le Grand XLineEndEntry* pEntry = aList->GetLineEnd(i); 111c7be74b1SArmin Le Grand const Bitmap aBitmap = aList->GetUiBitmap(i); 1128dcb2a10SAndre Fischer 11397e8a929SArmin Le Grand if(!aBitmap.IsEmpty()) 1148dcb2a10SAndre Fischer { 11597e8a929SArmin Le Grand Bitmap aCopyStart(aBitmap); 11697e8a929SArmin Le Grand Bitmap aCopyEnd(aBitmap); 11797e8a929SArmin Le Grand // delete pBitmap; 118a567bdc8SArmin Le Grand const Size aBmpSize(aCopyStart.GetSizePixel()); 119a567bdc8SArmin Le Grand const Rectangle aCropRectStart(Point(), Size(aBmpSize.Width() / 2, aBmpSize.Height())); 120a567bdc8SArmin Le Grand const Rectangle aCropRectEnd(Point(aBmpSize.Width() / 2, 0), Size(aBmpSize.Width() / 2, aBmpSize.Height())); 121a567bdc8SArmin Le Grand 122a567bdc8SArmin Le Grand aCopyStart.Crop(aCropRectStart); 123a567bdc8SArmin Le Grand rListBoxStart.InsertEntry( 124a567bdc8SArmin Le Grand pEntry->GetName(), 125a567bdc8SArmin Le Grand aCopyStart); 126a567bdc8SArmin Le Grand 127a567bdc8SArmin Le Grand aCopyEnd.Crop(aCropRectEnd); 128a567bdc8SArmin Le Grand rListBoxEnd.InsertEntry( 129a567bdc8SArmin Le Grand pEntry->GetName(), 130a567bdc8SArmin Le Grand aCopyEnd); 1318dcb2a10SAndre Fischer } 1328dcb2a10SAndre Fischer else 1338dcb2a10SAndre Fischer { 134a567bdc8SArmin Le Grand rListBoxStart.InsertEntry(pEntry->GetName()); 135a567bdc8SArmin Le Grand rListBoxEnd.InsertEntry(pEntry->GetName()); 1368dcb2a10SAndre Fischer } 1378dcb2a10SAndre Fischer } 1388dcb2a10SAndre Fischer 139a567bdc8SArmin Le Grand rListBoxStart.SetUpdateMode(true); 140a567bdc8SArmin Le Grand rListBoxEnd.SetUpdateMode(true); 1418dcb2a10SAndre Fischer } 14297e8a929SArmin Le Grand 143c7be74b1SArmin Le Grand void FillLineStyleListBox(ListBox& rListBox, const XDashListSharedPtr aList) 14497e8a929SArmin Le Grand { 145c7be74b1SArmin Le Grand const sal_uInt32 nCount(aList.get() ? aList->Count() : 0); 14697e8a929SArmin Le Grand rListBox.SetUpdateMode(false); 14797e8a929SArmin Le Grand 14897e8a929SArmin Le Grand rListBox.Clear(); 14997e8a929SArmin Le Grand 15097e8a929SArmin Le Grand // entry for 'none' 151c7be74b1SArmin Le Grand rListBox.InsertEntry(aList->GetStringForUiNoLine()); 15297e8a929SArmin Le Grand 15397e8a929SArmin Le Grand // entry for solid line 154c7be74b1SArmin Le Grand rListBox.InsertEntry(aList->GetStringForUiSolidLine(), aList->GetBitmapForUISolidLine()); 15597e8a929SArmin Le Grand 15697e8a929SArmin Le Grand for(sal_uInt32 i(0); i < nCount; i++) 15797e8a929SArmin Le Grand { 158c7be74b1SArmin Le Grand XDashEntry* pEntry = aList->GetDash(i); 159c7be74b1SArmin Le Grand const Bitmap aBitmap = aList->GetUiBitmap(i); 16097e8a929SArmin Le Grand 16197e8a929SArmin Le Grand if(!aBitmap.IsEmpty()) 16297e8a929SArmin Le Grand { 16397e8a929SArmin Le Grand rListBox.InsertEntry( 16497e8a929SArmin Le Grand pEntry->GetName(), 16597e8a929SArmin Le Grand aBitmap); 16697e8a929SArmin Le Grand // delete pBitmap; 16797e8a929SArmin Le Grand } 16897e8a929SArmin Le Grand else 16997e8a929SArmin Le Grand { 17097e8a929SArmin Le Grand rListBox.InsertEntry(pEntry->GetName()); 17197e8a929SArmin Le Grand } 17297e8a929SArmin Le Grand } 17397e8a929SArmin Le Grand 17497e8a929SArmin Le Grand rListBox.SetUpdateMode(true); 17597e8a929SArmin Le Grand } 176a567bdc8SArmin Le Grand } // end of anonymous namespace 1778dcb2a10SAndre Fischer 1788dcb2a10SAndre Fischer // namespace open 1798dcb2a10SAndre Fischer 1808dcb2a10SAndre Fischer namespace svx { namespace sidebar { 1818dcb2a10SAndre Fischer 1828dcb2a10SAndre Fischer LinePropertyPanel::LinePropertyPanel( 1838dcb2a10SAndre Fischer Window* pParent, 1848dcb2a10SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame, 1858dcb2a10SAndre Fischer SfxBindings* pBindings) 1868dcb2a10SAndre Fischer : Control( 1878dcb2a10SAndre Fischer pParent, 1888dcb2a10SAndre Fischer SVX_RES(RID_SIDEBAR_LINE_PANEL)), 1898dcb2a10SAndre Fischer mpFTWidth(new FixedText(this, SVX_RES(FT_WIDTH))), 1908dcb2a10SAndre Fischer mpTBWidthBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), 1918dcb2a10SAndre Fischer mpTBWidth(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBWidthBackground.get(), SVX_RES(TB_WIDTH))), 1928dcb2a10SAndre Fischer mpFTColor(new FixedText(this, SVX_RES(FT_COLOR))), 1938dcb2a10SAndre Fischer mpTBColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), 1948dcb2a10SAndre Fischer mpTBColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBColorBackground.get(), SVX_RES(TB_COLOR))), 1958dcb2a10SAndre Fischer mpFTStyle(new FixedText(this, SVX_RES(FT_STYLE))), 19697e8a929SArmin Le Grand mpLBStyle(new ListBox(this, SVX_RES(LB_STYLE))), 1978dcb2a10SAndre Fischer mpFTTrancparency(new FixedText(this, SVX_RES(FT_TRANSPARENT))), 1988dcb2a10SAndre Fischer mpMFTransparent(new MetricField(this, SVX_RES(MF_TRANSPARENT))), 1998dcb2a10SAndre Fischer mpFTArrow(new FixedText(this, SVX_RES(FT_ARROW))), 2001137d172SArmin Le Grand mpLBStart(new ListBox(this, SVX_RES(LB_START))), 2011137d172SArmin Le Grand mpLBEnd(new ListBox(this, SVX_RES(LB_END))), 2028dcb2a10SAndre Fischer mpFTEdgeStyle(new FixedText(this, SVX_RES(FT_EDGESTYLE))), 2038dcb2a10SAndre Fischer mpLBEdgeStyle(new ListBox(this, SVX_RES(LB_EDGESTYLE))), 2048dcb2a10SAndre Fischer mpFTCapStyle(new FixedText(this, SVX_RES(FT_CAPSTYLE))), 2058dcb2a10SAndre Fischer mpLBCapStyle(new ListBox(this, SVX_RES(LB_CAPSTYLE))), 206a567bdc8SArmin Le Grand maStyleControl(SID_ATTR_LINE_STYLE, *pBindings, *this), 207a567bdc8SArmin Le Grand maDashControl (SID_ATTR_LINE_DASH, *pBindings, *this), 208a567bdc8SArmin Le Grand maWidthControl(SID_ATTR_LINE_WIDTH, *pBindings, *this), 209a567bdc8SArmin Le Grand maColorControl(SID_ATTR_LINE_COLOR, *pBindings, *this), 210a567bdc8SArmin Le Grand maStartControl(SID_ATTR_LINE_START, *pBindings, *this), 211a567bdc8SArmin Le Grand maEndControl(SID_ATTR_LINE_END, *pBindings, *this), 212a567bdc8SArmin Le Grand maLineEndListControl(SID_LINEEND_LIST, *pBindings, *this), 21397e8a929SArmin Le Grand maLineStyleListControl(SID_DASH_LIST, *pBindings, *this), 214a567bdc8SArmin Le Grand maTransControl(SID_ATTR_LINE_TRANSPARENCE, *pBindings, *this), 215a567bdc8SArmin Le Grand maEdgeStyle(SID_ATTR_LINE_JOINT, *pBindings, *this), 216a567bdc8SArmin Le Grand maCapStyle(SID_ATTR_LINE_CAP, *pBindings, *this), 2178dcb2a10SAndre Fischer maColor(COL_BLACK), 2188dcb2a10SAndre Fischer mpColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_LINE_COLOR, TBI_COLOR, mpTBColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)), 2198dcb2a10SAndre Fischer mpStyleItem(), 2208dcb2a10SAndre Fischer mpDashItem(), 2218dcb2a10SAndre Fischer mnTrans(0), 2228dcb2a10SAndre Fischer meMapUnit(SFX_MAPUNIT_MM), 2238dcb2a10SAndre Fischer mnWidthCoreValue(0), 224c7be74b1SArmin Le Grand maLineEndList(), 225c7be74b1SArmin Le Grand maLineStyleList(), 2268dcb2a10SAndre Fischer mpStartItem(0), 2278dcb2a10SAndre Fischer mpEndItem(0), 2288dcb2a10SAndre Fischer maColorPopup(this, ::boost::bind(&LinePropertyPanel::CreateColorPopupControl, this, _1)), 2298dcb2a10SAndre Fischer maLineWidthPopup(this, ::boost::bind(&LinePropertyPanel::CreateLineWidthPopupControl, this, _1)), 2308dcb2a10SAndre Fischer maIMGColor(SVX_RES(IMG_COLOR)), 2318dcb2a10SAndre Fischer maIMGNone(SVX_RES(IMG_NONE_ICON)), 2328dcb2a10SAndre Fischer mpIMGWidthIcon(), 2338dcb2a10SAndre Fischer mpIMGWidthIconH(), 2348dcb2a10SAndre Fischer mxFrame(rxFrame), 2358dcb2a10SAndre Fischer mpBindings(pBindings), 2368dcb2a10SAndre Fischer mbColorAvailable(true), 237*6a606da0SAndre Fischer mbWidthValuable(true), 238*6a606da0SAndre Fischer maLayouter(*this) 2398dcb2a10SAndre Fischer { 2408dcb2a10SAndre Fischer Initialize(); 2418dcb2a10SAndre Fischer FreeResource(); 242*6a606da0SAndre Fischer 243*6a606da0SAndre Fischer // Setup the grid layouter. 244*6a606da0SAndre Fischer const sal_Int32 nMappedToolBoxWidth (Layouter::MapWidth(*this, TOOLBOX_WIDTH)); 245*6a606da0SAndre Fischer 246*6a606da0SAndre Fischer maLayouter.GetCell(0,0).SetControl(*mpFTWidth); 247*6a606da0SAndre Fischer maLayouter.GetCell(1,0).SetControl(*mpTBWidthBackground).SetFixedWidth(); 248*6a606da0SAndre Fischer 249*6a606da0SAndre Fischer maLayouter.GetCell(0,2).SetControl(*mpFTColor); 250*6a606da0SAndre Fischer maLayouter.GetCell(1,2).SetControl(*mpTBColorBackground).SetFixedWidth(); 251*6a606da0SAndre Fischer 252*6a606da0SAndre Fischer maLayouter.GetCell(2,0).SetControl(*mpFTStyle); 253*6a606da0SAndre Fischer maLayouter.GetCell(3,0).SetControl(*mpLBStyle); 254*6a606da0SAndre Fischer 255*6a606da0SAndre Fischer maLayouter.GetCell(2,2).SetControl(*mpFTTrancparency); 256*6a606da0SAndre Fischer maLayouter.GetCell(3,2).SetControl(*mpMFTransparent); 257*6a606da0SAndre Fischer 258*6a606da0SAndre Fischer maLayouter.GetCell(4,0).SetControl(*mpFTArrow).SetGridWidth(3); 259*6a606da0SAndre Fischer maLayouter.GetCell(5,0).SetControl(*mpLBStart); 260*6a606da0SAndre Fischer maLayouter.GetCell(5,2).SetControl(*mpLBEnd); 261*6a606da0SAndre Fischer 262*6a606da0SAndre Fischer maLayouter.GetCell(6,0).SetControl(*mpFTEdgeStyle); 263*6a606da0SAndre Fischer maLayouter.GetCell(7,0).SetControl(*mpLBEdgeStyle); 264*6a606da0SAndre Fischer 265*6a606da0SAndre Fischer maLayouter.GetCell(6,2).SetControl(*mpFTCapStyle); 266*6a606da0SAndre Fischer maLayouter.GetCell(7,2).SetControl(*mpLBCapStyle); 267*6a606da0SAndre Fischer 268*6a606da0SAndre Fischer maLayouter.GetColumn(0) 269*6a606da0SAndre Fischer .SetWeight(1) 270*6a606da0SAndre Fischer .SetLeftPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL)) 271*6a606da0SAndre Fischer .SetMinimumWidth(nMappedToolBoxWidth); 272*6a606da0SAndre Fischer maLayouter.GetColumn(1) 273*6a606da0SAndre Fischer .SetWeight(0) 274*6a606da0SAndre Fischer .SetMinimumWidth(Layouter::MapWidth(*this, CONTROL_SPACING_HORIZONTAL)); 275*6a606da0SAndre Fischer maLayouter.GetColumn(2) 276*6a606da0SAndre Fischer .SetWeight(1) 277*6a606da0SAndre Fischer .SetRightPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL)) 278*6a606da0SAndre Fischer .SetMinimumWidth(nMappedToolBoxWidth); 279*6a606da0SAndre Fischer 280*6a606da0SAndre Fischer // Make controls that display text handle short widths more 281*6a606da0SAndre Fischer // graceful. 282*6a606da0SAndre Fischer Layouter::PrepareForLayouting(*mpFTWidth); 283*6a606da0SAndre Fischer Layouter::PrepareForLayouting(*mpFTColor); 284*6a606da0SAndre Fischer Layouter::PrepareForLayouting(*mpFTStyle); 285*6a606da0SAndre Fischer Layouter::PrepareForLayouting(*mpFTTrancparency); 286*6a606da0SAndre Fischer Layouter::PrepareForLayouting(*mpFTArrow); 287*6a606da0SAndre Fischer Layouter::PrepareForLayouting(*mpFTEdgeStyle); 288*6a606da0SAndre Fischer Layouter::PrepareForLayouting(*mpFTCapStyle); 2898dcb2a10SAndre Fischer } 2908dcb2a10SAndre Fischer 2918dcb2a10SAndre Fischer 2928dcb2a10SAndre Fischer 2938dcb2a10SAndre Fischer LinePropertyPanel::~LinePropertyPanel() 2948dcb2a10SAndre Fischer { 2958dcb2a10SAndre Fischer // Destroy the toolboxes, then their background windows. 2968dcb2a10SAndre Fischer mpTBWidth.reset(); 2978dcb2a10SAndre Fischer mpTBColor.reset(); 29897e8a929SArmin Le Grand 2998dcb2a10SAndre Fischer mpTBWidthBackground.reset(); 3008dcb2a10SAndre Fischer mpTBColorBackground.reset(); 3018dcb2a10SAndre Fischer } 3028dcb2a10SAndre Fischer 3038dcb2a10SAndre Fischer 3048dcb2a10SAndre Fischer 3058dcb2a10SAndre Fischer void LinePropertyPanel::Initialize() 3068dcb2a10SAndre Fischer { 30737fee4fdSAndre Fischer mpFTWidth->SetBackground(Wallpaper()); 30837fee4fdSAndre Fischer mpFTColor->SetBackground(Wallpaper()); 30937fee4fdSAndre Fischer mpFTStyle->SetBackground(Wallpaper()); 31037fee4fdSAndre Fischer mpFTTrancparency->SetBackground(Wallpaper()); 31137fee4fdSAndre Fischer mpFTArrow->SetBackground(Wallpaper()); 31237fee4fdSAndre Fischer mpFTEdgeStyle->SetBackground(Wallpaper()); 31337fee4fdSAndre Fischer mpFTCapStyle->SetBackground(Wallpaper()); 31437fee4fdSAndre Fischer 3158dcb2a10SAndre Fischer mpIMGWidthIcon.reset(new Image[8]); 3168dcb2a10SAndre Fischer mpIMGWidthIcon[0] = Image(SVX_RES(IMG_WIDTH1_ICON)); 3178dcb2a10SAndre Fischer mpIMGWidthIcon[1] = Image(SVX_RES(IMG_WIDTH2_ICON)); 3188dcb2a10SAndre Fischer mpIMGWidthIcon[2] = Image(SVX_RES(IMG_WIDTH3_ICON)); 3198dcb2a10SAndre Fischer mpIMGWidthIcon[3] = Image(SVX_RES(IMG_WIDTH4_ICON)); 3208dcb2a10SAndre Fischer mpIMGWidthIcon[4] = Image(SVX_RES(IMG_WIDTH5_ICON)); 3218dcb2a10SAndre Fischer mpIMGWidthIcon[5] = Image(SVX_RES(IMG_WIDTH6_ICON)); 3228dcb2a10SAndre Fischer mpIMGWidthIcon[6] = Image(SVX_RES(IMG_WIDTH7_ICON)); 3238dcb2a10SAndre Fischer mpIMGWidthIcon[7] = Image(SVX_RES(IMG_WIDTH8_ICON)); 3248dcb2a10SAndre Fischer 3258dcb2a10SAndre Fischer //high contrast 3268dcb2a10SAndre Fischer mpIMGWidthIconH.reset(new Image[8]); 3278dcb2a10SAndre Fischer mpIMGWidthIconH[0] = Image(SVX_RES(IMG_WIDTH1_ICON_H)); 3288dcb2a10SAndre Fischer mpIMGWidthIconH[1] = Image(SVX_RES(IMG_WIDTH2_ICON_H)); 3298dcb2a10SAndre Fischer mpIMGWidthIconH[2] = Image(SVX_RES(IMG_WIDTH3_ICON_H)); 3308dcb2a10SAndre Fischer mpIMGWidthIconH[3] = Image(SVX_RES(IMG_WIDTH4_ICON_H)); 3318dcb2a10SAndre Fischer mpIMGWidthIconH[4] = Image(SVX_RES(IMG_WIDTH5_ICON_H)); 3328dcb2a10SAndre Fischer mpIMGWidthIconH[5] = Image(SVX_RES(IMG_WIDTH6_ICON_H)); 3338dcb2a10SAndre Fischer mpIMGWidthIconH[6] = Image(SVX_RES(IMG_WIDTH7_ICON_H)); 3348dcb2a10SAndre Fischer mpIMGWidthIconH[7] = Image(SVX_RES(IMG_WIDTH8_ICON_H)); 3358dcb2a10SAndre Fischer 3368dcb2a10SAndre Fischer meMapUnit = maWidthControl.GetCoreMetric(); 3378dcb2a10SAndre Fischer 3388dcb2a10SAndre Fischer mpTBColor->SetItemImage(TBI_COLOR, maIMGColor); 3398dcb2a10SAndre Fischer Size aTbxSize( mpTBColor->CalcWindowSizePixel() ); 3408dcb2a10SAndre Fischer mpTBColor->SetOutputSizePixel( aTbxSize ); 3418dcb2a10SAndre Fischer mpTBColor->SetItemBits( TBI_COLOR, mpTBColor->GetItemBits( TBI_COLOR ) | TIB_DROPDOWNONLY ); 3428dcb2a10SAndre Fischer mpTBColor->SetQuickHelpText(TBI_COLOR,String(SVX_RES(STR_QH_TB_COLOR))); //Add 3438dcb2a10SAndre Fischer mpTBColor->SetBackground(Wallpaper()); 3448dcb2a10SAndre Fischer mpTBColor->SetPaintTransparent(true); 3458dcb2a10SAndre Fischer Link aLink = LINK(this, LinePropertyPanel, ToolboxColorSelectHdl); 3468dcb2a10SAndre Fischer mpTBColor->SetDropdownClickHdl ( aLink ); 3478dcb2a10SAndre Fischer mpTBColor->SetSelectHdl ( aLink ); 3488dcb2a10SAndre Fischer 34997e8a929SArmin Le Grand FillLineStyleList(); 35097e8a929SArmin Le Grand SelectLineStyle(); 35197e8a929SArmin Le Grand aLink = LINK( this, LinePropertyPanel, ChangeLineStyleHdl ); 35297e8a929SArmin Le Grand mpLBStyle->SetSelectHdl( aLink ); 35397e8a929SArmin Le Grand mpLBStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Style"))); 354a68b38dfSArmin Le Grand mpLBStyle->AdaptDropDownLineCountToMaximum(); 3558dcb2a10SAndre Fischer 3568dcb2a10SAndre Fischer mpTBWidth->SetItemImage(TBI_WIDTH, mpIMGWidthIcon[0]); 3578dcb2a10SAndre Fischer aTbxSize = mpTBWidth->CalcWindowSizePixel() ; 3588dcb2a10SAndre Fischer mpTBWidth->SetOutputSizePixel( aTbxSize ); 3598dcb2a10SAndre Fischer mpTBWidth->SetItemBits( TBI_WIDTH, mpTBWidth->GetItemBits( TBI_WIDTH ) | TIB_DROPDOWNONLY ); 3608dcb2a10SAndre Fischer mpTBWidth->SetQuickHelpText(TBI_WIDTH,String(SVX_RES(STR_QH_TB_WIDTH))); //Add 3618dcb2a10SAndre Fischer mpTBWidth->SetBackground(Wallpaper()); 3628dcb2a10SAndre Fischer mpTBWidth->SetPaintTransparent(true); 3638dcb2a10SAndre Fischer aLink = LINK(this, LinePropertyPanel, ToolboxWidthSelectHdl); 3648dcb2a10SAndre Fischer mpTBWidth->SetDropdownClickHdl ( aLink ); 3658dcb2a10SAndre Fischer mpTBWidth->SetSelectHdl ( aLink ); 3668dcb2a10SAndre Fischer 3678dcb2a10SAndre Fischer FillLineEndList(); 3688dcb2a10SAndre Fischer SelectEndStyle(true); 3698dcb2a10SAndre Fischer SelectEndStyle(false); 3708dcb2a10SAndre Fischer aLink = LINK( this, LinePropertyPanel, ChangeStartHdl ); 3718dcb2a10SAndre Fischer mpLBStart->SetSelectHdl( aLink ); 3728dcb2a10SAndre Fischer mpLBStart->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Beginning Style"))); //wj acc 373a68b38dfSArmin Le Grand mpLBStart->AdaptDropDownLineCountToMaximum(); 3748dcb2a10SAndre Fischer aLink = LINK( this, LinePropertyPanel, ChangeEndHdl ); 3758dcb2a10SAndre Fischer mpLBEnd->SetSelectHdl( aLink ); 3768dcb2a10SAndre Fischer mpLBEnd->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Ending Style"))); //wj acc 377a68b38dfSArmin Le Grand mpLBEnd->AdaptDropDownLineCountToMaximum(); 3788dcb2a10SAndre Fischer 3798dcb2a10SAndre Fischer aLink = LINK(this, LinePropertyPanel, ChangeTransparentHdl); 3808dcb2a10SAndre Fischer mpMFTransparent->SetModifyHdl(aLink); 3818dcb2a10SAndre Fischer mpMFTransparent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency"))); //wj acc 3828dcb2a10SAndre Fischer 3838dcb2a10SAndre Fischer mpTBWidth->SetAccessibleRelationLabeledBy(mpFTWidth.get()); 3848dcb2a10SAndre Fischer mpTBColor->SetAccessibleRelationLabeledBy(mpFTColor.get()); 38597e8a929SArmin Le Grand mpLBStyle->SetAccessibleRelationLabeledBy(mpFTStyle.get()); 3868dcb2a10SAndre Fischer mpMFTransparent->SetAccessibleRelationLabeledBy(mpFTTrancparency.get()); 3878dcb2a10SAndre Fischer mpLBStart->SetAccessibleRelationLabeledBy(mpFTArrow.get()); 3888dcb2a10SAndre Fischer mpLBEnd->SetAccessibleRelationLabeledBy(mpLBEnd.get()); 3898dcb2a10SAndre Fischer 3908dcb2a10SAndre Fischer aLink = LINK( this, LinePropertyPanel, ChangeEdgeStyleHdl ); 3918dcb2a10SAndre Fischer mpLBEdgeStyle->SetSelectHdl( aLink ); 3928dcb2a10SAndre Fischer mpLBEdgeStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Corner Style"))); 3938dcb2a10SAndre Fischer 3948dcb2a10SAndre Fischer aLink = LINK( this, LinePropertyPanel, ChangeCapStyleHdl ); 3958dcb2a10SAndre Fischer mpLBCapStyle->SetSelectHdl( aLink ); 3968dcb2a10SAndre Fischer mpLBCapStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cap Style"))); 3978dcb2a10SAndre Fischer } 3988dcb2a10SAndre Fischer 3998dcb2a10SAndre Fischer 4008dcb2a10SAndre Fischer 4018dcb2a10SAndre Fischer void LinePropertyPanel::SetupIcons(void) 4028dcb2a10SAndre Fischer { 4038dcb2a10SAndre Fischer if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) 4048dcb2a10SAndre Fischer { 4058dcb2a10SAndre Fischer // todo 4068dcb2a10SAndre Fischer } 4078dcb2a10SAndre Fischer else 4088dcb2a10SAndre Fischer { 4098dcb2a10SAndre Fischer // todo 4108dcb2a10SAndre Fischer } 4118dcb2a10SAndre Fischer } 4128dcb2a10SAndre Fischer 4138dcb2a10SAndre Fischer 4148dcb2a10SAndre Fischer 4158dcb2a10SAndre Fischer LinePropertyPanel* LinePropertyPanel::Create ( 4168dcb2a10SAndre Fischer Window* pParent, 4178dcb2a10SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame, 4188dcb2a10SAndre Fischer SfxBindings* pBindings) 4198dcb2a10SAndre Fischer { 4208dcb2a10SAndre Fischer if (pParent == NULL) 4218dcb2a10SAndre Fischer throw lang::IllegalArgumentException(A2S("no parent Window given to LinePropertyPanel::Create"), NULL, 0); 4228dcb2a10SAndre Fischer if ( ! rxFrame.is()) 4238dcb2a10SAndre Fischer throw lang::IllegalArgumentException(A2S("no XFrame given to LinePropertyPanel::Create"), NULL, 1); 4248dcb2a10SAndre Fischer if (pBindings == NULL) 4258dcb2a10SAndre Fischer throw lang::IllegalArgumentException(A2S("no SfxBindings given to LinePropertyPanel::Create"), NULL, 2); 4268dcb2a10SAndre Fischer 4278dcb2a10SAndre Fischer return new LinePropertyPanel( 4288dcb2a10SAndre Fischer pParent, 4298dcb2a10SAndre Fischer rxFrame, 4308dcb2a10SAndre Fischer pBindings); 4318dcb2a10SAndre Fischer } 4328dcb2a10SAndre Fischer 4338dcb2a10SAndre Fischer 4348dcb2a10SAndre Fischer 43537fee4fdSAndre Fischer 4368dcb2a10SAndre Fischer void LinePropertyPanel::DataChanged( 4378dcb2a10SAndre Fischer const DataChangedEvent& rEvent) 4388dcb2a10SAndre Fischer { 4398dcb2a10SAndre Fischer (void)rEvent; 4408dcb2a10SAndre Fischer 4418dcb2a10SAndre Fischer SetupIcons(); 4428dcb2a10SAndre Fischer } 4438dcb2a10SAndre Fischer 4448dcb2a10SAndre Fischer 4458dcb2a10SAndre Fischer 4468dcb2a10SAndre Fischer 4478dcb2a10SAndre Fischer void LinePropertyPanel::NotifyItemUpdate( 4488dcb2a10SAndre Fischer sal_uInt16 nSID, 4498dcb2a10SAndre Fischer SfxItemState eState, 45045da7d5eSAndre Fischer const SfxPoolItem* pState, 45145da7d5eSAndre Fischer const bool bIsEnabled) 4528dcb2a10SAndre Fischer { 45345da7d5eSAndre Fischer (void)bIsEnabled; 4542d10cb3dSArmin Le Grand const bool bDisabled(SFX_ITEM_DISABLED == eState); 45545da7d5eSAndre Fischer 4568dcb2a10SAndre Fischer switch(nSID) 4578dcb2a10SAndre Fischer { 4588dcb2a10SAndre Fischer case SID_ATTR_LINE_COLOR: 4598dcb2a10SAndre Fischer { 4602d10cb3dSArmin Le Grand if(bDisabled) 4618dcb2a10SAndre Fischer { 4628dcb2a10SAndre Fischer mpFTColor->Disable(); 4638dcb2a10SAndre Fischer mpTBColor->Disable(); 4648dcb2a10SAndre Fischer } 4658dcb2a10SAndre Fischer else 4668dcb2a10SAndre Fischer { 4678dcb2a10SAndre Fischer mpFTColor->Enable(); 4688dcb2a10SAndre Fischer mpTBColor->Enable(); 4692d10cb3dSArmin Le Grand } 4708dcb2a10SAndre Fischer 4712d10cb3dSArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 4722d10cb3dSArmin Le Grand { 4732d10cb3dSArmin Le Grand const XLineColorItem* pItem = dynamic_cast< const XLineColorItem* >(pState); 4742d10cb3dSArmin Le Grand if(pItem) 4758dcb2a10SAndre Fischer { 4768dcb2a10SAndre Fischer maColor = pItem->GetColorValue(); 4778dcb2a10SAndre Fischer mbColorAvailable = true; 4788dcb2a10SAndre Fischer mpColorUpdater->Update(maColor); 4792d10cb3dSArmin Le Grand break; 4808dcb2a10SAndre Fischer } 4812d10cb3dSArmin Le Grand } 4822d10cb3dSArmin Le Grand 4838dcb2a10SAndre Fischer mbColorAvailable = false; 4848dcb2a10SAndre Fischer mpColorUpdater->Update(COL_WHITE); 4858dcb2a10SAndre Fischer break; 4868dcb2a10SAndre Fischer } 4878dcb2a10SAndre Fischer case SID_ATTR_LINE_DASH: 48897e8a929SArmin Le Grand case SID_ATTR_LINE_STYLE: 4898dcb2a10SAndre Fischer { 4902d10cb3dSArmin Le Grand if(bDisabled) 4918dcb2a10SAndre Fischer { 4928dcb2a10SAndre Fischer mpFTStyle->Disable(); 49397e8a929SArmin Le Grand mpLBStyle->Disable(); 4948dcb2a10SAndre Fischer } 4958dcb2a10SAndre Fischer else 4968dcb2a10SAndre Fischer { 4978dcb2a10SAndre Fischer mpFTStyle->Enable(); 49897e8a929SArmin Le Grand mpLBStyle->Enable(); 4992d10cb3dSArmin Le Grand } 5002d10cb3dSArmin Le Grand 5018dcb2a10SAndre Fischer if(eState >= SFX_ITEM_DEFAULT) 5028dcb2a10SAndre Fischer { 5038dcb2a10SAndre Fischer if(nSID == SID_ATTR_LINE_STYLE) 5048dcb2a10SAndre Fischer { 5058dcb2a10SAndre Fischer const XLineStyleItem* pItem = dynamic_cast< const XLineStyleItem* >(pState); 5068dcb2a10SAndre Fischer 5078dcb2a10SAndre Fischer if(pItem) 5088dcb2a10SAndre Fischer { 5098dcb2a10SAndre Fischer mpStyleItem.reset(pState ? (XLineStyleItem*)pItem->Clone() : 0); 5108dcb2a10SAndre Fischer } 5118dcb2a10SAndre Fischer } 5122d10cb3dSArmin Le Grand else // if(nSID == SID_ATTR_LINE_DASH) 5138dcb2a10SAndre Fischer { 5148dcb2a10SAndre Fischer const XLineDashItem* pItem = dynamic_cast< const XLineDashItem* >(pState); 5158dcb2a10SAndre Fischer 5168dcb2a10SAndre Fischer if(pItem) 5178dcb2a10SAndre Fischer { 5188dcb2a10SAndre Fischer mpDashItem.reset(pState ? (XLineDashItem*)pItem->Clone() : 0); 5198dcb2a10SAndre Fischer } 5208dcb2a10SAndre Fischer } 5218dcb2a10SAndre Fischer } 5228dcb2a10SAndre Fischer else 5238dcb2a10SAndre Fischer { 5248dcb2a10SAndre Fischer if(nSID == SID_ATTR_LINE_STYLE) 5252d10cb3dSArmin Le Grand { 5262d10cb3dSArmin Le Grand mpStyleItem.reset(0); 5272d10cb3dSArmin Le Grand } 5288dcb2a10SAndre Fischer else 5292d10cb3dSArmin Le Grand { 5302d10cb3dSArmin Le Grand mpDashItem.reset(0); 5312d10cb3dSArmin Le Grand } 5328dcb2a10SAndre Fischer } 53397e8a929SArmin Le Grand 53497e8a929SArmin Le Grand SelectLineStyle(); 5358dcb2a10SAndre Fischer break; 5368dcb2a10SAndre Fischer } 5378dcb2a10SAndre Fischer case SID_ATTR_LINE_TRANSPARENCE: 5388dcb2a10SAndre Fischer { 5392d10cb3dSArmin Le Grand if(bDisabled) 5408dcb2a10SAndre Fischer { 5418dcb2a10SAndre Fischer mpFTTrancparency->Disable(); 5428dcb2a10SAndre Fischer mpMFTransparent->Disable(); 5438dcb2a10SAndre Fischer } 5448dcb2a10SAndre Fischer else 5458dcb2a10SAndre Fischer { 5468dcb2a10SAndre Fischer mpFTTrancparency->Enable(); 5478dcb2a10SAndre Fischer mpMFTransparent->Enable(); 5482d10cb3dSArmin Le Grand } 5492d10cb3dSArmin Le Grand 5502d10cb3dSArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 5512d10cb3dSArmin Le Grand { 5528dcb2a10SAndre Fischer const XLineTransparenceItem* pItem = dynamic_cast< const XLineTransparenceItem* >(pState); 5538dcb2a10SAndre Fischer 5542d10cb3dSArmin Le Grand if(pItem) 5558dcb2a10SAndre Fischer { 5568dcb2a10SAndre Fischer mnTrans = pItem->GetValue(); 5578dcb2a10SAndre Fischer mpMFTransparent->SetValue(mnTrans); 5582d10cb3dSArmin Le Grand break; 5598dcb2a10SAndre Fischer } 5602d10cb3dSArmin Le Grand } 5612d10cb3dSArmin Le Grand 5628dcb2a10SAndre Fischer mpMFTransparent->SetValue(0);//add 5638dcb2a10SAndre Fischer mpMFTransparent->SetText(String()); 5648dcb2a10SAndre Fischer break; 5658dcb2a10SAndre Fischer } 5668dcb2a10SAndre Fischer case SID_ATTR_LINE_WIDTH: 5678dcb2a10SAndre Fischer { 5682d10cb3dSArmin Le Grand if(bDisabled) 5698dcb2a10SAndre Fischer { 5708dcb2a10SAndre Fischer mpTBWidth->Disable(); 5718dcb2a10SAndre Fischer mpFTWidth->Disable(); 5728dcb2a10SAndre Fischer } 5738dcb2a10SAndre Fischer else 5748dcb2a10SAndre Fischer { 5758dcb2a10SAndre Fischer mpTBWidth->Enable(); 5768dcb2a10SAndre Fischer mpFTWidth->Enable(); 5772d10cb3dSArmin Le Grand } 5782d10cb3dSArmin Le Grand 5792d10cb3dSArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 5802d10cb3dSArmin Le Grand { 5818dcb2a10SAndre Fischer const XLineWidthItem* pItem = dynamic_cast< const XLineWidthItem* >(pState); 5828dcb2a10SAndre Fischer 5832d10cb3dSArmin Le Grand if(pItem) 5848dcb2a10SAndre Fischer { 5858dcb2a10SAndre Fischer mnWidthCoreValue = pItem->GetValue(); 5868dcb2a10SAndre Fischer mbWidthValuable = true; 5872d10cb3dSArmin Le Grand SetWidthIcon(); 5882d10cb3dSArmin Le Grand break; 5898dcb2a10SAndre Fischer } 5902d10cb3dSArmin Le Grand } 5912d10cb3dSArmin Le Grand 5928dcb2a10SAndre Fischer mbWidthValuable = false; 5938dcb2a10SAndre Fischer SetWidthIcon(); 5948dcb2a10SAndre Fischer break; 5958dcb2a10SAndre Fischer } 5968dcb2a10SAndre Fischer case SID_ATTR_LINE_START: 5978dcb2a10SAndre Fischer { 5982d10cb3dSArmin Le Grand if(bDisabled) 5992d10cb3dSArmin Le Grand { 6002d10cb3dSArmin Le Grand mpFTArrow->Disable(); 6012d10cb3dSArmin Le Grand mpLBStart->Disable(); 6022d10cb3dSArmin Le Grand } 6032d10cb3dSArmin Le Grand else 6042d10cb3dSArmin Le Grand { 605a567bdc8SArmin Le Grand mpFTArrow->Enable(); 606a567bdc8SArmin Le Grand mpLBStart->Enable(); 6072d10cb3dSArmin Le Grand } 608a567bdc8SArmin Le Grand 6092d10cb3dSArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 610a567bdc8SArmin Le Grand { 6118dcb2a10SAndre Fischer const XLineStartItem* pItem = dynamic_cast< const XLineStartItem* >(pState); 6128dcb2a10SAndre Fischer 613a567bdc8SArmin Le Grand if(pItem) 6148dcb2a10SAndre Fischer { 6158dcb2a10SAndre Fischer mpStartItem.reset(pItem ? (XLineStartItem*)pItem->Clone() : 0); 6168dcb2a10SAndre Fischer SelectEndStyle(true); 617a567bdc8SArmin Le Grand break; 6188dcb2a10SAndre Fischer } 619a567bdc8SArmin Le Grand } 620a567bdc8SArmin Le Grand 6212d10cb3dSArmin Le Grand mpStartItem.reset(0); 6222d10cb3dSArmin Le Grand SelectEndStyle(true); 6238dcb2a10SAndre Fischer break; 6248dcb2a10SAndre Fischer } 6258dcb2a10SAndre Fischer case SID_ATTR_LINE_END: 6268dcb2a10SAndre Fischer { 6272d10cb3dSArmin Le Grand if(bDisabled) 6282d10cb3dSArmin Le Grand { 6292d10cb3dSArmin Le Grand mpFTArrow->Disable(); 6302d10cb3dSArmin Le Grand mpLBEnd->Disable(); 6312d10cb3dSArmin Le Grand } 6322d10cb3dSArmin Le Grand else 6332d10cb3dSArmin Le Grand { 6348dcb2a10SAndre Fischer mpFTArrow->Enable(); 6358dcb2a10SAndre Fischer mpLBEnd->Enable(); 6362d10cb3dSArmin Le Grand } 637a567bdc8SArmin Le Grand 6382d10cb3dSArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 639a567bdc8SArmin Le Grand { 6408dcb2a10SAndre Fischer const XLineEndItem* pItem = dynamic_cast< const XLineEndItem* >(pState); 6418dcb2a10SAndre Fischer 642a567bdc8SArmin Le Grand if(pItem) 6438dcb2a10SAndre Fischer { 6448dcb2a10SAndre Fischer mpEndItem.reset(pItem ? (XLineEndItem*)pItem->Clone() : 0); 6458dcb2a10SAndre Fischer SelectEndStyle(false); 646a567bdc8SArmin Le Grand break; 6478dcb2a10SAndre Fischer } 648a567bdc8SArmin Le Grand } 649a567bdc8SArmin Le Grand 6502d10cb3dSArmin Le Grand mpEndItem.reset(0); 6512d10cb3dSArmin Le Grand SelectEndStyle(false); 6528dcb2a10SAndre Fischer break; 6538dcb2a10SAndre Fischer } 6548dcb2a10SAndre Fischer case SID_LINEEND_LIST: 6558dcb2a10SAndre Fischer { 6568dcb2a10SAndre Fischer FillLineEndList(); 6578dcb2a10SAndre Fischer SelectEndStyle(true); 6588dcb2a10SAndre Fischer SelectEndStyle(false); 6598dcb2a10SAndre Fischer break; 6608dcb2a10SAndre Fischer } 66197e8a929SArmin Le Grand case SID_DASH_LIST: 66297e8a929SArmin Le Grand { 66397e8a929SArmin Le Grand FillLineStyleList(); 66497e8a929SArmin Le Grand SelectLineStyle(); 66597e8a929SArmin Le Grand break; 66697e8a929SArmin Le Grand } 6678dcb2a10SAndre Fischer case SID_ATTR_LINE_JOINT: 6688dcb2a10SAndre Fischer { 6692d10cb3dSArmin Le Grand if(bDisabled) 6708dcb2a10SAndre Fischer { 6718dcb2a10SAndre Fischer mpLBEdgeStyle->Disable(); 67247df10a6SArmin Le Grand mpFTEdgeStyle->Disable(); 6738dcb2a10SAndre Fischer } 6748dcb2a10SAndre Fischer else 6758dcb2a10SAndre Fischer { 6768dcb2a10SAndre Fischer mpLBEdgeStyle->Enable(); 67747df10a6SArmin Le Grand mpFTEdgeStyle->Enable(); 6782d10cb3dSArmin Le Grand } 6792d10cb3dSArmin Le Grand 6802d10cb3dSArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 6812d10cb3dSArmin Le Grand { 6828dcb2a10SAndre Fischer const XLineJointItem* pItem = dynamic_cast< const XLineJointItem* >(pState); 6832d10cb3dSArmin Le Grand 6842d10cb3dSArmin Le Grand if(pItem) 6852d10cb3dSArmin Le Grand { 6868dcb2a10SAndre Fischer sal_uInt16 nEntryPos(0); 6878dcb2a10SAndre Fischer 6888dcb2a10SAndre Fischer switch(pItem->GetValue()) 6898dcb2a10SAndre Fischer { 6908dcb2a10SAndre Fischer case com::sun::star::drawing::LineJoint_MIDDLE: 6918dcb2a10SAndre Fischer case com::sun::star::drawing::LineJoint_ROUND: 6928dcb2a10SAndre Fischer { 6938dcb2a10SAndre Fischer nEntryPos = 1; 6948dcb2a10SAndre Fischer break; 6958dcb2a10SAndre Fischer } 6968dcb2a10SAndre Fischer case com::sun::star::drawing::LineJoint_NONE: 6978dcb2a10SAndre Fischer { 6988dcb2a10SAndre Fischer nEntryPos = 2; 6998dcb2a10SAndre Fischer break; 7008dcb2a10SAndre Fischer } 7018dcb2a10SAndre Fischer case com::sun::star::drawing::LineJoint_MITER: 7028dcb2a10SAndre Fischer { 7038dcb2a10SAndre Fischer nEntryPos = 3; 7048dcb2a10SAndre Fischer break; 7058dcb2a10SAndre Fischer } 7068dcb2a10SAndre Fischer case com::sun::star::drawing::LineJoint_BEVEL: 7078dcb2a10SAndre Fischer { 7088dcb2a10SAndre Fischer nEntryPos = 4; 7098dcb2a10SAndre Fischer break; 7108dcb2a10SAndre Fischer } 7118dcb2a10SAndre Fischer 7128dcb2a10SAndre Fischer default: 7138dcb2a10SAndre Fischer break; 7148dcb2a10SAndre Fischer } 7158dcb2a10SAndre Fischer 7168dcb2a10SAndre Fischer if(nEntryPos) 7178dcb2a10SAndre Fischer { 7188dcb2a10SAndre Fischer mpLBEdgeStyle->SelectEntryPos(nEntryPos - 1); 7192d10cb3dSArmin Le Grand break; 7208dcb2a10SAndre Fischer } 7212d10cb3dSArmin Le Grand } 7222d10cb3dSArmin Le Grand } 7232d10cb3dSArmin Le Grand 7248dcb2a10SAndre Fischer mpLBEdgeStyle->SetNoSelection(); 7258dcb2a10SAndre Fischer break; 7268dcb2a10SAndre Fischer } 7278dcb2a10SAndre Fischer case SID_ATTR_LINE_CAP: 7288dcb2a10SAndre Fischer { 7292d10cb3dSArmin Le Grand if(bDisabled) 7308dcb2a10SAndre Fischer { 7318dcb2a10SAndre Fischer mpLBCapStyle->Disable(); 73247df10a6SArmin Le Grand mpFTCapStyle->Disable(); 7338dcb2a10SAndre Fischer } 7348dcb2a10SAndre Fischer else 7358dcb2a10SAndre Fischer { 7368dcb2a10SAndre Fischer mpLBCapStyle->Enable(); 73747df10a6SArmin Le Grand mpLBCapStyle->Enable(); 7382d10cb3dSArmin Le Grand } 7392d10cb3dSArmin Le Grand 7402d10cb3dSArmin Le Grand if(eState >= SFX_ITEM_DEFAULT) 7412d10cb3dSArmin Le Grand { 7428dcb2a10SAndre Fischer const XLineCapItem* pItem = dynamic_cast< const XLineCapItem* >(pState); 7432d10cb3dSArmin Le Grand 7442d10cb3dSArmin Le Grand if(pItem) 7452d10cb3dSArmin Le Grand { 7468dcb2a10SAndre Fischer sal_uInt16 nEntryPos(0); 7478dcb2a10SAndre Fischer 7488dcb2a10SAndre Fischer switch(pItem->GetValue()) 7498dcb2a10SAndre Fischer { 7508dcb2a10SAndre Fischer case com::sun::star::drawing::LineCap_BUTT: 7518dcb2a10SAndre Fischer { 7528dcb2a10SAndre Fischer nEntryPos = 1; 7538dcb2a10SAndre Fischer break; 7548dcb2a10SAndre Fischer } 7558dcb2a10SAndre Fischer case com::sun::star::drawing::LineCap_ROUND: 7568dcb2a10SAndre Fischer { 7578dcb2a10SAndre Fischer nEntryPos = 2; 7588dcb2a10SAndre Fischer break; 7598dcb2a10SAndre Fischer } 7608dcb2a10SAndre Fischer case com::sun::star::drawing::LineCap_SQUARE: 7618dcb2a10SAndre Fischer { 7628dcb2a10SAndre Fischer nEntryPos = 3; 7638dcb2a10SAndre Fischer break; 7648dcb2a10SAndre Fischer } 7658dcb2a10SAndre Fischer 7668dcb2a10SAndre Fischer default: 7678dcb2a10SAndre Fischer break; 7688dcb2a10SAndre Fischer } 7698dcb2a10SAndre Fischer 7708dcb2a10SAndre Fischer if(nEntryPos) 7718dcb2a10SAndre Fischer { 7728dcb2a10SAndre Fischer mpLBCapStyle->SelectEntryPos(nEntryPos - 1); 7732d10cb3dSArmin Le Grand break; 7748dcb2a10SAndre Fischer } 7752d10cb3dSArmin Le Grand } 776d74d90d6SArmin Le Grand } 7772d10cb3dSArmin Le Grand 7788dcb2a10SAndre Fischer mpLBCapStyle->SetNoSelection(); 7798dcb2a10SAndre Fischer break; 7808dcb2a10SAndre Fischer } 7818dcb2a10SAndre Fischer } 7828dcb2a10SAndre Fischer } 7838dcb2a10SAndre Fischer 7848dcb2a10SAndre Fischer 7858dcb2a10SAndre Fischer 78645da7d5eSAndre Fischer 7878dcb2a10SAndre Fischer SfxBindings* LinePropertyPanel::GetBindings() 7888dcb2a10SAndre Fischer { 7898dcb2a10SAndre Fischer return mpBindings; 7908dcb2a10SAndre Fischer } 7918dcb2a10SAndre Fischer 7928dcb2a10SAndre Fischer 7938dcb2a10SAndre Fischer 7948dcb2a10SAndre Fischer IMPL_LINK( LinePropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG ) 7958dcb2a10SAndre Fischer { 7968dcb2a10SAndre Fischer return 0; 7978dcb2a10SAndre Fischer } 7988dcb2a10SAndre Fischer 7998dcb2a10SAndre Fischer 8008dcb2a10SAndre Fischer 8018dcb2a10SAndre Fischer 8028dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ToolboxColorSelectHdl,ToolBox*, pToolBox) 8038dcb2a10SAndre Fischer { 8048dcb2a10SAndre Fischer sal_uInt16 nId = pToolBox->GetCurItemId(); 8058dcb2a10SAndre Fischer if(nId == TBI_COLOR) 8068dcb2a10SAndre Fischer { 8078dcb2a10SAndre Fischer maColorPopup.Show(*pToolBox); 8088dcb2a10SAndre Fischer maColorPopup.SetCurrentColor(maColor, mbColorAvailable); 8098dcb2a10SAndre Fischer } 8108dcb2a10SAndre Fischer return 0; 8118dcb2a10SAndre Fischer } 8128dcb2a10SAndre Fischer 8138dcb2a10SAndre Fischer 8148dcb2a10SAndre Fischer 8158dcb2a10SAndre Fischer 8167134ea5bSPavel Janík IMPL_LINK(LinePropertyPanel, ChangeLineStyleHdl, ToolBox*, /* pToolBox */) 8178dcb2a10SAndre Fischer { 81897e8a929SArmin Le Grand const sal_uInt16 nPos(mpLBStyle->GetSelectEntryPos()); 81997e8a929SArmin Le Grand 82097e8a929SArmin Le Grand if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBStyle->GetSavedValue()) 8218dcb2a10SAndre Fischer { 82297e8a929SArmin Le Grand if(0 == nPos) 82397e8a929SArmin Le Grand { 82497e8a929SArmin Le Grand // XLINE_NONE 82597e8a929SArmin Le Grand const XLineStyleItem aItem(XLINE_NONE); 82697e8a929SArmin Le Grand 82797e8a929SArmin Le Grand GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L); 8288dcb2a10SAndre Fischer } 82997e8a929SArmin Le Grand else if(1 == nPos) 83097e8a929SArmin Le Grand { 83197e8a929SArmin Le Grand // XLINE_SOLID 83297e8a929SArmin Le Grand const XLineStyleItem aItem(XLINE_SOLID); 83397e8a929SArmin Le Grand 83497e8a929SArmin Le Grand GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L); 83597e8a929SArmin Le Grand } 836c7be74b1SArmin Le Grand else if(maLineStyleList.get() && maLineStyleList->Count() > (long)(nPos - 2)) 83797e8a929SArmin Le Grand { 83897e8a929SArmin Le Grand // XLINE_DASH 83997e8a929SArmin Le Grand const XLineStyleItem aItemA(XLINE_DASH); 840c7be74b1SArmin Le Grand const XDashEntry* pDashEntry = maLineStyleList->GetDash(nPos - 2); 841c3c0ed1bSArmin Le Grand OSL_ENSURE(pDashEntry, "OOps, got empty XDash from XDashList (!)"); 842c3c0ed1bSArmin Le Grand const XLineDashItem aItemB( 843c3c0ed1bSArmin Le Grand pDashEntry ? pDashEntry->GetName() : String(), 844c3c0ed1bSArmin Le Grand pDashEntry ? pDashEntry->GetDash() : XDash()); 84597e8a929SArmin Le Grand 84697e8a929SArmin Le Grand GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItemA, 0L); 84797e8a929SArmin Le Grand GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_DASH, SFX_CALLMODE_RECORD, &aItemB, 0L); 84897e8a929SArmin Le Grand } 8498dcb2a10SAndre Fischer } 8508dcb2a10SAndre Fischer 85197e8a929SArmin Le Grand return 0; 85297e8a929SArmin Le Grand } 8538dcb2a10SAndre Fischer 8548dcb2a10SAndre Fischer 8558dcb2a10SAndre Fischer 8568dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ChangeStartHdl, void*, EMPTYARG) 8578dcb2a10SAndre Fischer { 8588dcb2a10SAndre Fischer sal_uInt16 nPos = mpLBStart->GetSelectEntryPos(); 8598dcb2a10SAndre Fischer if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != mpLBStart->GetSavedValue() ) 8608dcb2a10SAndre Fischer { 8618dcb2a10SAndre Fischer XLineStartItem* pItem = NULL; 8628dcb2a10SAndre Fischer if( nPos == 0 ) 8638dcb2a10SAndre Fischer pItem = new XLineStartItem(); 864c7be74b1SArmin Le Grand else if( maLineEndList.get() && maLineEndList->Count() > (long) ( nPos - 1 ) ) 865c7be74b1SArmin Le Grand pItem = new XLineStartItem( mpLBStart->GetSelectEntry(),maLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ); 8668dcb2a10SAndre Fischer GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SFX_CALLMODE_RECORD, pItem, 0L); 8678dcb2a10SAndre Fischer delete pItem; 8688dcb2a10SAndre Fischer } 8698dcb2a10SAndre Fischer return 0; 8708dcb2a10SAndre Fischer } 8718dcb2a10SAndre Fischer 8728dcb2a10SAndre Fischer 8738dcb2a10SAndre Fischer 8748dcb2a10SAndre Fischer 8758dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ChangeEndHdl, void*, EMPTYARG) 8768dcb2a10SAndre Fischer { 8778dcb2a10SAndre Fischer sal_uInt16 nPos = mpLBEnd->GetSelectEntryPos(); 8788dcb2a10SAndre Fischer if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != mpLBEnd->GetSavedValue() ) 8798dcb2a10SAndre Fischer { 8808dcb2a10SAndre Fischer XLineEndItem* pItem = NULL; 8818dcb2a10SAndre Fischer if( nPos == 0 ) 8828dcb2a10SAndre Fischer pItem = new XLineEndItem(); 883c7be74b1SArmin Le Grand else if( maLineEndList.get() && maLineEndList->Count() > (long) ( nPos - 1 ) ) 884c7be74b1SArmin Le Grand pItem = new XLineEndItem( mpLBEnd->GetSelectEntry(), maLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ); 8858dcb2a10SAndre Fischer GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SFX_CALLMODE_RECORD, pItem, 0L); 8868dcb2a10SAndre Fischer delete pItem; 8878dcb2a10SAndre Fischer } 8888dcb2a10SAndre Fischer return 0; 8898dcb2a10SAndre Fischer } 8908dcb2a10SAndre Fischer 8918dcb2a10SAndre Fischer 8928dcb2a10SAndre Fischer 8938dcb2a10SAndre Fischer 8948dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ChangeEdgeStyleHdl, void*, EMPTYARG) 8958dcb2a10SAndre Fischer { 8968dcb2a10SAndre Fischer const sal_uInt16 nPos(mpLBEdgeStyle->GetSelectEntryPos()); 8978dcb2a10SAndre Fischer 8988dcb2a10SAndre Fischer if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBEdgeStyle->GetSavedValue()) 8998dcb2a10SAndre Fischer { 9008dcb2a10SAndre Fischer XLineJointItem* pItem = 0; 9018dcb2a10SAndre Fischer 9028dcb2a10SAndre Fischer switch(nPos) 9038dcb2a10SAndre Fischer { 9048dcb2a10SAndre Fischer case 0: // rounded 9058dcb2a10SAndre Fischer { 9068dcb2a10SAndre Fischer pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_ROUND); 9078dcb2a10SAndre Fischer break; 9088dcb2a10SAndre Fischer } 9098dcb2a10SAndre Fischer case 1: // none 9108dcb2a10SAndre Fischer { 9118dcb2a10SAndre Fischer pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_NONE); 9128dcb2a10SAndre Fischer break; 9138dcb2a10SAndre Fischer } 9148dcb2a10SAndre Fischer case 2: // mitered 9158dcb2a10SAndre Fischer { 9168dcb2a10SAndre Fischer pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_MITER); 9178dcb2a10SAndre Fischer break; 9188dcb2a10SAndre Fischer } 9198dcb2a10SAndre Fischer case 3: // beveled 9208dcb2a10SAndre Fischer { 9218dcb2a10SAndre Fischer pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_BEVEL); 9228dcb2a10SAndre Fischer break; 9238dcb2a10SAndre Fischer } 9248dcb2a10SAndre Fischer } 9258dcb2a10SAndre Fischer 9268dcb2a10SAndre Fischer GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_JOINT, SFX_CALLMODE_RECORD, pItem, 0L); 9278dcb2a10SAndre Fischer delete pItem; 9288dcb2a10SAndre Fischer } 9298dcb2a10SAndre Fischer return 0; 9308dcb2a10SAndre Fischer } 9318dcb2a10SAndre Fischer 9328dcb2a10SAndre Fischer 9338dcb2a10SAndre Fischer 9348dcb2a10SAndre Fischer 9358dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ChangeCapStyleHdl, void*, EMPTYARG) 9368dcb2a10SAndre Fischer { 9378dcb2a10SAndre Fischer const sal_uInt16 nPos(mpLBCapStyle->GetSelectEntryPos()); 9388dcb2a10SAndre Fischer 9398dcb2a10SAndre Fischer if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBCapStyle->GetSavedValue()) 9408dcb2a10SAndre Fischer { 9418dcb2a10SAndre Fischer XLineCapItem* pItem = 0; 9428dcb2a10SAndre Fischer 9438dcb2a10SAndre Fischer switch(nPos) 9448dcb2a10SAndre Fischer { 9458dcb2a10SAndre Fischer case 0: // flat 9468dcb2a10SAndre Fischer { 9478dcb2a10SAndre Fischer pItem = new XLineCapItem(com::sun::star::drawing::LineCap_BUTT); 9488dcb2a10SAndre Fischer break; 9498dcb2a10SAndre Fischer } 9508dcb2a10SAndre Fischer case 1: // round 9518dcb2a10SAndre Fischer { 9528dcb2a10SAndre Fischer pItem = new XLineCapItem(com::sun::star::drawing::LineCap_ROUND); 9538dcb2a10SAndre Fischer break; 9548dcb2a10SAndre Fischer } 9558dcb2a10SAndre Fischer case 2: // square 9568dcb2a10SAndre Fischer { 9578dcb2a10SAndre Fischer pItem = new XLineCapItem(com::sun::star::drawing::LineCap_SQUARE); 9588dcb2a10SAndre Fischer break; 9598dcb2a10SAndre Fischer } 9608dcb2a10SAndre Fischer } 9618dcb2a10SAndre Fischer 9628dcb2a10SAndre Fischer GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_CAP, SFX_CALLMODE_RECORD, pItem, 0L); 9638dcb2a10SAndre Fischer delete pItem; 9648dcb2a10SAndre Fischer } 9658dcb2a10SAndre Fischer return 0; 9668dcb2a10SAndre Fischer } 9678dcb2a10SAndre Fischer 9688dcb2a10SAndre Fischer 9698dcb2a10SAndre Fischer 9708dcb2a10SAndre Fischer 9718dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ToolboxWidthSelectHdl,ToolBox*, pToolBox) 9728dcb2a10SAndre Fischer { 9738dcb2a10SAndre Fischer if (pToolBox->GetCurItemId() == TBI_WIDTH) 9748dcb2a10SAndre Fischer { 9758dcb2a10SAndre Fischer maLineWidthPopup.SetWidthSelect(mnWidthCoreValue, mbWidthValuable, meMapUnit); 9768dcb2a10SAndre Fischer maLineWidthPopup.Show(*pToolBox); 9778dcb2a10SAndre Fischer } 9788dcb2a10SAndre Fischer return 0; 9798dcb2a10SAndre Fischer } 9808dcb2a10SAndre Fischer 9818dcb2a10SAndre Fischer 9828dcb2a10SAndre Fischer 9838dcb2a10SAndre Fischer 9848dcb2a10SAndre Fischer IMPL_LINK( LinePropertyPanel, ChangeTransparentHdl, void *, EMPTYARG ) 9858dcb2a10SAndre Fischer { 9868dcb2a10SAndre Fischer sal_uInt16 nVal = (sal_uInt16)mpMFTransparent->GetValue(); 9878dcb2a10SAndre Fischer XLineTransparenceItem aItem( nVal ); 9888dcb2a10SAndre Fischer 9898dcb2a10SAndre Fischer GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L); 9908dcb2a10SAndre Fischer return( 0L ); 9918dcb2a10SAndre Fischer } 9928dcb2a10SAndre Fischer 9938dcb2a10SAndre Fischer 9948dcb2a10SAndre Fischer 9958dcb2a10SAndre Fischer 996b7a56e95SArmin Le Grand namespace 997b7a56e95SArmin Le Grand { 998b7a56e95SArmin Le Grand Color GetTransparentColor (void) 999b7a56e95SArmin Le Grand { 1000b7a56e95SArmin Le Grand return COL_TRANSPARENT; 1001b7a56e95SArmin Le Grand } 1002b7a56e95SArmin Le Grand } // end of anonymous namespace 1003b7a56e95SArmin Le Grand 10048dcb2a10SAndre Fischer PopupControl* LinePropertyPanel::CreateColorPopupControl (PopupContainer* pParent) 10058dcb2a10SAndre Fischer { 10068dcb2a10SAndre Fischer return new ColorControl( 10078dcb2a10SAndre Fischer pParent, 10088dcb2a10SAndre Fischer mpBindings, 10098dcb2a10SAndre Fischer SVX_RES(RID_POPUPPANEL_LINEPAGE_COLOR), 10108dcb2a10SAndre Fischer SVX_RES(VS_COLOR), 10118dcb2a10SAndre Fischer ::boost::bind(GetTransparentColor), 10128dcb2a10SAndre Fischer ::boost::bind(&LinePropertyPanel::SetColor, this, _1, _2), 10138dcb2a10SAndre Fischer pParent, 1014b7a56e95SArmin Le Grand 0); 10158dcb2a10SAndre Fischer } 10168dcb2a10SAndre Fischer 10178dcb2a10SAndre Fischer 10188dcb2a10SAndre Fischer 10198dcb2a10SAndre Fischer 10208dcb2a10SAndre Fischer PopupControl* LinePropertyPanel::CreateLineWidthPopupControl (PopupContainer* pParent) 10218dcb2a10SAndre Fischer { 10228dcb2a10SAndre Fischer return new LineWidthControl(pParent, *this); 10238dcb2a10SAndre Fischer } 10248dcb2a10SAndre Fischer 10258dcb2a10SAndre Fischer 10268dcb2a10SAndre Fischer 10278dcb2a10SAndre Fischer 10288dcb2a10SAndre Fischer void LinePropertyPanel::EndLineWidthPopupMode (void) 10298dcb2a10SAndre Fischer { 10308dcb2a10SAndre Fischer maLineWidthPopup.Hide(); 10318dcb2a10SAndre Fischer } 10328dcb2a10SAndre Fischer 10338dcb2a10SAndre Fischer 10348dcb2a10SAndre Fischer 10358dcb2a10SAndre Fischer 1036*6a606da0SAndre Fischer void LinePropertyPanel::Resize (void) 1037*6a606da0SAndre Fischer { 1038*6a606da0SAndre Fischer maLayouter.Layout(); 1039*6a606da0SAndre Fischer } 1040*6a606da0SAndre Fischer 1041*6a606da0SAndre Fischer 1042*6a606da0SAndre Fischer 1043*6a606da0SAndre Fischer 10448dcb2a10SAndre Fischer void LinePropertyPanel::SetWidthIcon(int n) 10458dcb2a10SAndre Fischer { 10468dcb2a10SAndre Fischer if(n==0) 10478dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, maIMGNone); 10488dcb2a10SAndre Fischer else 10498dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[n-1] : mpIMGWidthIcon[n-1]); 10508dcb2a10SAndre Fischer } 10518dcb2a10SAndre Fischer 10528dcb2a10SAndre Fischer 10538dcb2a10SAndre Fischer 10548dcb2a10SAndre Fischer void LinePropertyPanel::SetWidthIcon() 10558dcb2a10SAndre Fischer { 10568dcb2a10SAndre Fischer if(!mbWidthValuable) 10578dcb2a10SAndre Fischer { 10588dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, maIMGNone); 10598dcb2a10SAndre Fischer return; 10608dcb2a10SAndre Fischer } 10618dcb2a10SAndre Fischer 10628dcb2a10SAndre Fischer long nVal = LogicToLogic(mnWidthCoreValue * 10,(MapUnit)meMapUnit , MAP_POINT); 10638dcb2a10SAndre Fischer 10648dcb2a10SAndre Fischer if(nVal <= 6) 10658dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[0] : mpIMGWidthIcon[0]); 10668dcb2a10SAndre Fischer else if(nVal > 6 && nVal <= 9) 10678dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[1] : mpIMGWidthIcon[1]); 10688dcb2a10SAndre Fischer else if(nVal > 9 && nVal <= 12) 10698dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[2] : mpIMGWidthIcon[2]); 10708dcb2a10SAndre Fischer else if(nVal > 12 && nVal <= 19) 10718dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[3] : mpIMGWidthIcon[3]); 10728dcb2a10SAndre Fischer else if(nVal > 19 && nVal <= 26) 10738dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[4] : mpIMGWidthIcon[4]); 10748dcb2a10SAndre Fischer else if(nVal > 26 && nVal <= 37) 10758dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[5] : mpIMGWidthIcon[5]); 10768dcb2a10SAndre Fischer else if(nVal > 37 && nVal <=52) 10778dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[6] : mpIMGWidthIcon[6]); 10788dcb2a10SAndre Fischer else if(nVal > 52) 10798dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[7] : mpIMGWidthIcon[7]); 10808dcb2a10SAndre Fischer 10818dcb2a10SAndre Fischer } 10828dcb2a10SAndre Fischer 10838dcb2a10SAndre Fischer 10848dcb2a10SAndre Fischer 10858dcb2a10SAndre Fischer void LinePropertyPanel::SetColor ( 10868dcb2a10SAndre Fischer const String& rsColorName, 10878dcb2a10SAndre Fischer const Color aColor) 10888dcb2a10SAndre Fischer { 10898dcb2a10SAndre Fischer XLineColorItem aColorItem(rsColorName, aColor); 10908dcb2a10SAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); 10918dcb2a10SAndre Fischer maColor = aColor; 10928dcb2a10SAndre Fischer } 10938dcb2a10SAndre Fischer 10948dcb2a10SAndre Fischer 10958dcb2a10SAndre Fischer 10968dcb2a10SAndre Fischer void LinePropertyPanel::SetWidth(long nWidth) 10978dcb2a10SAndre Fischer { 10988dcb2a10SAndre Fischer mnWidthCoreValue = nWidth; 10998dcb2a10SAndre Fischer mbWidthValuable = true; 11008dcb2a10SAndre Fischer } 11018dcb2a10SAndre Fischer 11028dcb2a10SAndre Fischer 11038dcb2a10SAndre Fischer 11048dcb2a10SAndre Fischer void LinePropertyPanel::FillLineEndList() 11058dcb2a10SAndre Fischer { 11068dcb2a10SAndre Fischer SfxObjectShell* pSh = SfxObjectShell::Current(); 11078dcb2a10SAndre Fischer if ( pSh && pSh->GetItem( SID_LINEEND_LIST ) ) 11088dcb2a10SAndre Fischer { 11098dcb2a10SAndre Fischer mpLBStart->Enable(); 11108dcb2a10SAndre Fischer SvxLineEndListItem aItem( *(const SvxLineEndListItem*)(pSh->GetItem( SID_LINEEND_LIST ) ) ); 1111c7be74b1SArmin Le Grand maLineEndList = aItem.GetLineEndList(); 11128dcb2a10SAndre Fischer 1113c7be74b1SArmin Le Grand if(maLineEndList.get()) 11148dcb2a10SAndre Fischer { 1115c7be74b1SArmin Le Grand FillLineEndListBox(*mpLBStart, *mpLBEnd, maLineEndList); 11168dcb2a10SAndre Fischer } 1117a567bdc8SArmin Le Grand 1118a567bdc8SArmin Le Grand mpLBStart->SelectEntryPos(0); 1119a567bdc8SArmin Le Grand mpLBEnd->SelectEntryPos(0); 11208dcb2a10SAndre Fischer } 11218dcb2a10SAndre Fischer else 11228dcb2a10SAndre Fischer { 11238dcb2a10SAndre Fischer mpLBStart->Disable(); 11248dcb2a10SAndre Fischer mpLBEnd->Disable(); 11258dcb2a10SAndre Fischer } 11268dcb2a10SAndre Fischer } 11278dcb2a10SAndre Fischer 11288dcb2a10SAndre Fischer 11298dcb2a10SAndre Fischer 113097e8a929SArmin Le Grand void LinePropertyPanel::FillLineStyleList() 113197e8a929SArmin Le Grand { 113297e8a929SArmin Le Grand SfxObjectShell* pSh = SfxObjectShell::Current(); 113397e8a929SArmin Le Grand if ( pSh && pSh->GetItem( SID_DASH_LIST ) ) 113497e8a929SArmin Le Grand { 113597e8a929SArmin Le Grand mpLBStyle->Enable(); 113697e8a929SArmin Le Grand SvxDashListItem aItem( *(const SvxDashListItem*)(pSh->GetItem( SID_DASH_LIST ) ) ); 1137c7be74b1SArmin Le Grand maLineStyleList = aItem.GetDashList(); 113897e8a929SArmin Le Grand 1139c7be74b1SArmin Le Grand if(maLineStyleList.get()) 114097e8a929SArmin Le Grand { 1141c7be74b1SArmin Le Grand FillLineStyleListBox(*mpLBStyle, maLineStyleList); 114297e8a929SArmin Le Grand } 114397e8a929SArmin Le Grand 114497e8a929SArmin Le Grand mpLBStyle->SelectEntryPos(0); 114597e8a929SArmin Le Grand } 114697e8a929SArmin Le Grand else 114797e8a929SArmin Le Grand { 114897e8a929SArmin Le Grand mpLBStyle->Disable(); 114997e8a929SArmin Le Grand } 115097e8a929SArmin Le Grand } 115197e8a929SArmin Le Grand 115297e8a929SArmin Le Grand 115397e8a929SArmin Le Grand 115497e8a929SArmin Le Grand void LinePropertyPanel::SelectLineStyle() 115597e8a929SArmin Le Grand { 11562d10cb3dSArmin Le Grand if( !mpStyleItem.get() || !mpDashItem.get() ) 115797e8a929SArmin Le Grand { 115897e8a929SArmin Le Grand mpLBStyle->SetNoSelection(); 115947df10a6SArmin Le Grand mpLBStyle->Disable(); 116097e8a929SArmin Le Grand return; 116197e8a929SArmin Le Grand } 116297e8a929SArmin Le Grand 116397e8a929SArmin Le Grand const XLineStyle eXLS(mpStyleItem ? (XLineStyle)mpStyleItem->GetValue() : XLINE_NONE); 116497e8a929SArmin Le Grand bool bSelected(false); 116597e8a929SArmin Le Grand 116697e8a929SArmin Le Grand switch(eXLS) 116797e8a929SArmin Le Grand { 116897e8a929SArmin Le Grand case XLINE_NONE: 116997e8a929SArmin Le Grand break; 117097e8a929SArmin Le Grand case XLINE_SOLID: 117197e8a929SArmin Le Grand mpLBStyle->SelectEntryPos(1); 117297e8a929SArmin Le Grand bSelected = true; 117397e8a929SArmin Le Grand break; 117497e8a929SArmin Le Grand default: 1175c7be74b1SArmin Le Grand if(mpDashItem && maLineStyleList.get()) 117697e8a929SArmin Le Grand { 117797e8a929SArmin Le Grand const XDash& rDash = mpDashItem->GetDashValue(); 1178c7be74b1SArmin Le Grand for(sal_Int32 a(0);!bSelected && a < maLineStyleList->Count(); a++) 117997e8a929SArmin Le Grand { 1180c7be74b1SArmin Le Grand XDashEntry* pEntry = maLineStyleList->GetDash(a); 118197e8a929SArmin Le Grand const XDash& rEntry = pEntry->GetDash(); 118297e8a929SArmin Le Grand if(rDash == rEntry) 118397e8a929SArmin Le Grand { 118497e8a929SArmin Le Grand mpLBStyle->SelectEntryPos((sal_uInt16)a + 2); 118597e8a929SArmin Le Grand bSelected = true; 118697e8a929SArmin Le Grand } 118797e8a929SArmin Le Grand } 118897e8a929SArmin Le Grand } 118997e8a929SArmin Le Grand break; 119097e8a929SArmin Le Grand } 119197e8a929SArmin Le Grand 119297e8a929SArmin Le Grand if(!bSelected) 119397e8a929SArmin Le Grand mpLBStyle->SelectEntryPos( 0 ); 119497e8a929SArmin Le Grand } 119597e8a929SArmin Le Grand 11968dcb2a10SAndre Fischer void LinePropertyPanel::SelectEndStyle(bool bStart) 11978dcb2a10SAndre Fischer { 11988dcb2a10SAndre Fischer sal_Bool bSelected(false); 11998dcb2a10SAndre Fischer 12008dcb2a10SAndre Fischer if(bStart) 12018dcb2a10SAndre Fischer { 12022d10cb3dSArmin Le Grand if( !mpStartItem.get() ) 12038dcb2a10SAndre Fischer { 12048dcb2a10SAndre Fischer mpLBStart->SetNoSelection(); 120547df10a6SArmin Le Grand mpLBStart->Disable(); 12068dcb2a10SAndre Fischer return; 12078dcb2a10SAndre Fischer } 12082d10cb3dSArmin Le Grand 1209c7be74b1SArmin Le Grand if(mpStartItem && maLineEndList.get()) 12108dcb2a10SAndre Fischer { 12118dcb2a10SAndre Fischer const basegfx::B2DPolyPolygon& rItemPolygon = mpStartItem->GetLineStartValue(); 1212c7be74b1SArmin Le Grand for(sal_Int32 a(0);!bSelected && a < maLineEndList->Count(); a++) 12138dcb2a10SAndre Fischer { 1214c7be74b1SArmin Le Grand XLineEndEntry* pEntry = maLineEndList->GetLineEnd(a); 12158dcb2a10SAndre Fischer const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd(); 12168dcb2a10SAndre Fischer if(rItemPolygon == rEntryPolygon) 12178dcb2a10SAndre Fischer { 12188dcb2a10SAndre Fischer mpLBStart->SelectEntryPos((sal_uInt16)a + 1); 12198dcb2a10SAndre Fischer bSelected = true; 12208dcb2a10SAndre Fischer } 12218dcb2a10SAndre Fischer } 12228dcb2a10SAndre Fischer } 12232d10cb3dSArmin Le Grand 12248dcb2a10SAndre Fischer if(!bSelected) 12252d10cb3dSArmin Le Grand { 12268dcb2a10SAndre Fischer mpLBStart->SelectEntryPos( 0 ); 12278dcb2a10SAndre Fischer } 12282d10cb3dSArmin Le Grand } 12298dcb2a10SAndre Fischer else 12308dcb2a10SAndre Fischer { 12312d10cb3dSArmin Le Grand if( !mpEndItem.get() ) 12328dcb2a10SAndre Fischer { 12338dcb2a10SAndre Fischer mpLBEnd->SetNoSelection(); 123447df10a6SArmin Le Grand mpLBEnd->Disable(); 12358dcb2a10SAndre Fischer return; 12368dcb2a10SAndre Fischer } 12372d10cb3dSArmin Le Grand 1238c7be74b1SArmin Le Grand if(mpEndItem && maLineEndList.get()) 12398dcb2a10SAndre Fischer { 12408dcb2a10SAndre Fischer const basegfx::B2DPolyPolygon& rItemPolygon = mpEndItem->GetLineEndValue(); 1241c7be74b1SArmin Le Grand for(sal_Int32 a(0);!bSelected && a < maLineEndList->Count(); a++) 12428dcb2a10SAndre Fischer { 1243c7be74b1SArmin Le Grand XLineEndEntry* pEntry = maLineEndList->GetLineEnd(a); 12448dcb2a10SAndre Fischer const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd(); 12458dcb2a10SAndre Fischer if(rItemPolygon == rEntryPolygon) 12468dcb2a10SAndre Fischer { 12478dcb2a10SAndre Fischer mpLBEnd->SelectEntryPos((sal_uInt16)a + 1); 12488dcb2a10SAndre Fischer bSelected = true; 12498dcb2a10SAndre Fischer } 12508dcb2a10SAndre Fischer } 12518dcb2a10SAndre Fischer } 12522d10cb3dSArmin Le Grand 12538dcb2a10SAndre Fischer if(!bSelected) 12542d10cb3dSArmin Le Grand { 12558dcb2a10SAndre Fischer mpLBEnd->SelectEntryPos( 0 ); 12568dcb2a10SAndre Fischer } 12578dcb2a10SAndre Fischer } 12582d10cb3dSArmin Le Grand } 12598dcb2a10SAndre Fischer 12608dcb2a10SAndre Fischer 12618dcb2a10SAndre Fischer } } // end of namespace svx::sidebar 12624e8031e0SArmin Le Grand 12634e8031e0SArmin Le Grand // eof 1264