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 "LineStyleControl.hxx" 588dcb2a10SAndre Fischer #include "LineWidthControl.hxx" 598dcb2a10SAndre Fischer #include <boost/bind.hpp> 608dcb2a10SAndre Fischer 618dcb2a10SAndre Fischer using namespace css; 628dcb2a10SAndre Fischer using namespace cssu; 638dcb2a10SAndre Fischer using ::sfx2::sidebar::Theme; 648dcb2a10SAndre Fischer 658dcb2a10SAndre Fischer #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) 668dcb2a10SAndre Fischer 678dcb2a10SAndre Fischer namespace { 688dcb2a10SAndre Fischer short GetItemId_Impl_line( ValueSet& rValueSet, const Color& rCol ) 698dcb2a10SAndre Fischer { 708dcb2a10SAndre Fischer if(rCol == COL_AUTO) 718dcb2a10SAndre Fischer return 0; 728dcb2a10SAndre Fischer 738dcb2a10SAndre Fischer bool bFound = false; 748dcb2a10SAndre Fischer sal_uInt16 nCount = rValueSet.GetItemCount(); 758dcb2a10SAndre Fischer sal_uInt16 n = 1; 768dcb2a10SAndre Fischer 778dcb2a10SAndre Fischer while ( !bFound && n <= nCount ) 788dcb2a10SAndre Fischer { 798dcb2a10SAndre Fischer Color aValCol = rValueSet.GetItemColor(n); 808dcb2a10SAndre Fischer 818dcb2a10SAndre Fischer bFound = ( aValCol.GetRed() == rCol.GetRed() 828dcb2a10SAndre Fischer && aValCol.GetGreen() == rCol.GetGreen() 838dcb2a10SAndre Fischer && aValCol.GetBlue() == rCol.GetBlue() ); 848dcb2a10SAndre Fischer 858dcb2a10SAndre Fischer if ( !bFound ) 868dcb2a10SAndre Fischer n++; 878dcb2a10SAndre Fischer } 888dcb2a10SAndre Fischer return bFound ? n : -1; 898dcb2a10SAndre Fischer } 908dcb2a10SAndre Fischer 918dcb2a10SAndre Fischer Color GetTransparentColor (void) 928dcb2a10SAndre Fischer { 938dcb2a10SAndre Fischer return COL_TRANSPARENT; 948dcb2a10SAndre Fischer } 958dcb2a10SAndre Fischer 968dcb2a10SAndre Fischer } // end of anonymous namespace 978dcb2a10SAndre Fischer 988dcb2a10SAndre Fischer 998dcb2a10SAndre Fischer class LineEndLB_LPP : public ListBox 1008dcb2a10SAndre Fischer { 1018dcb2a10SAndre Fischer 1028dcb2a10SAndre Fischer public: 1038dcb2a10SAndre Fischer LineEndLB_LPP( Window* pParent, ResId Id ) : ListBox( pParent, Id ) {} 1048dcb2a10SAndre Fischer LineEndLB_LPP( Window* pParent, WinBits aWB ) : ListBox( pParent, aWB ) {} 1058dcb2a10SAndre Fischer 1068dcb2a10SAndre Fischer void Fill( const XLineEndList* pList, bool bStart = true ); 1078dcb2a10SAndre Fischer 1088dcb2a10SAndre Fischer void Append( XLineEndEntry* pEntry, Bitmap* pBmp = NULL, 1098dcb2a10SAndre Fischer bool bStart = true ); 1108dcb2a10SAndre Fischer void Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp = NULL, 1118dcb2a10SAndre Fischer bool bStart = true ); 1128dcb2a10SAndre Fischer }; 1138dcb2a10SAndre Fischer 1148dcb2a10SAndre Fischer void LineEndLB_LPP::Fill( const XLineEndList* pList, bool bStart ) 1158dcb2a10SAndre Fischer { 1168dcb2a10SAndre Fischer long nCount = pList->Count(); 1178dcb2a10SAndre Fischer XLineEndEntry* pEntry; 1188dcb2a10SAndre Fischer VirtualDevice aVD; 1198dcb2a10SAndre Fischer SetUpdateMode( false ); 1208dcb2a10SAndre Fischer 1218dcb2a10SAndre Fischer for( long i = 0; i < nCount; i++ ) 1228dcb2a10SAndre Fischer { 1238dcb2a10SAndre Fischer pEntry = pList->GetLineEnd( i ); 1248dcb2a10SAndre Fischer Bitmap* pBitmap = const_cast<XLineEndList*>(pList)->CreateBitmapForUI( i ); 1258dcb2a10SAndre Fischer if( pBitmap ) 1268dcb2a10SAndre Fischer { 1278dcb2a10SAndre Fischer Size aBmpSize( pBitmap->GetSizePixel() ); 1288dcb2a10SAndre Fischer aVD.SetOutputSizePixel( aBmpSize, false ); 1298dcb2a10SAndre Fischer aVD.DrawBitmap( Point(), *pBitmap ); 1308dcb2a10SAndre Fischer InsertEntry( pEntry->GetName(), 1318dcb2a10SAndre Fischer aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ), 1328dcb2a10SAndre Fischer Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ) ); 1338dcb2a10SAndre Fischer 1348dcb2a10SAndre Fischer delete pBitmap; 1358dcb2a10SAndre Fischer } 1368dcb2a10SAndre Fischer else 1378dcb2a10SAndre Fischer InsertEntry( pEntry->GetName() ); 1388dcb2a10SAndre Fischer } 1398dcb2a10SAndre Fischer SetUpdateMode( true ); 1408dcb2a10SAndre Fischer } 1418dcb2a10SAndre Fischer 1428dcb2a10SAndre Fischer void LineEndLB_LPP::Append( XLineEndEntry* pEntry, Bitmap* pBmp, bool bStart ) 1438dcb2a10SAndre Fischer { 1448dcb2a10SAndre Fischer if( pBmp ) 1458dcb2a10SAndre Fischer { 1468dcb2a10SAndre Fischer VirtualDevice aVD; 1478dcb2a10SAndre Fischer Size aBmpSize( pBmp->GetSizePixel() ); 1488dcb2a10SAndre Fischer 1498dcb2a10SAndre Fischer aVD.SetOutputSizePixel( aBmpSize, false ); 1508dcb2a10SAndre Fischer aVD.DrawBitmap( Point(), *pBmp ); 1518dcb2a10SAndre Fischer InsertEntry( pEntry->GetName(), 1528dcb2a10SAndre Fischer aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ), 1538dcb2a10SAndre Fischer Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ) ); 1548dcb2a10SAndre Fischer } 1558dcb2a10SAndre Fischer else 1568dcb2a10SAndre Fischer InsertEntry( pEntry->GetName() ); 1578dcb2a10SAndre Fischer } 1588dcb2a10SAndre Fischer 1598dcb2a10SAndre Fischer void LineEndLB_LPP::Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp, bool bStart ) 1608dcb2a10SAndre Fischer { 1618dcb2a10SAndre Fischer RemoveEntry( nPos ); 1628dcb2a10SAndre Fischer 1638dcb2a10SAndre Fischer if( pBmp ) 1648dcb2a10SAndre Fischer { 1658dcb2a10SAndre Fischer VirtualDevice aVD; 1668dcb2a10SAndre Fischer Size aBmpSize( pBmp->GetSizePixel() ); 1678dcb2a10SAndre Fischer 1688dcb2a10SAndre Fischer aVD.SetOutputSizePixel( aBmpSize, false ); 1698dcb2a10SAndre Fischer aVD.DrawBitmap( Point(), *pBmp ); 1708dcb2a10SAndre Fischer InsertEntry( pEntry->GetName(), 1718dcb2a10SAndre Fischer aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ), 1728dcb2a10SAndre Fischer Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ), nPos ); 1738dcb2a10SAndre Fischer } 1748dcb2a10SAndre Fischer else 1758dcb2a10SAndre Fischer InsertEntry( pEntry->GetName(), nPos ); 1768dcb2a10SAndre Fischer } 1778dcb2a10SAndre Fischer 1788dcb2a10SAndre Fischer 1798dcb2a10SAndre Fischer // namespace open 1808dcb2a10SAndre Fischer 1818dcb2a10SAndre Fischer namespace svx { namespace sidebar { 1828dcb2a10SAndre Fischer 1838dcb2a10SAndre Fischer 1848dcb2a10SAndre Fischer 1858dcb2a10SAndre Fischer LinePropertyPanel::LinePropertyPanel( 1868dcb2a10SAndre Fischer Window* pParent, 1878dcb2a10SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame, 1888dcb2a10SAndre Fischer SfxBindings* pBindings) 1898dcb2a10SAndre Fischer : Control( 1908dcb2a10SAndre Fischer pParent, 1918dcb2a10SAndre Fischer SVX_RES(RID_SIDEBAR_LINE_PANEL)), 1928dcb2a10SAndre Fischer mpFTWidth(new FixedText(this, SVX_RES(FT_WIDTH))), 1938dcb2a10SAndre Fischer mpTBWidthBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), 1948dcb2a10SAndre Fischer mpTBWidth(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBWidthBackground.get(), SVX_RES(TB_WIDTH))), 1958dcb2a10SAndre Fischer mpFTColor(new FixedText(this, SVX_RES(FT_COLOR))), 1968dcb2a10SAndre Fischer mpTBColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), 1978dcb2a10SAndre Fischer mpTBColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBColorBackground.get(), SVX_RES(TB_COLOR))), 1988dcb2a10SAndre Fischer mpFTStyle(new FixedText(this, SVX_RES(FT_STYLE))), 1998dcb2a10SAndre Fischer mpTBStyleBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), 2008dcb2a10SAndre Fischer mpTBStyle(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBStyleBackground.get(), SVX_RES(TB_STYLE))), 2018dcb2a10SAndre Fischer mpFTTrancparency(new FixedText(this, SVX_RES(FT_TRANSPARENT))), 2028dcb2a10SAndre Fischer mpMFTransparent(new MetricField(this, SVX_RES(MF_TRANSPARENT))), 2038dcb2a10SAndre Fischer mpFTArrow(new FixedText(this, SVX_RES(FT_ARROW))), 2048dcb2a10SAndre Fischer mpLBStart(new LineEndLB_LPP(this, SVX_RES(LB_START))), 2058dcb2a10SAndre Fischer mpLBEnd(new LineEndLB_LPP(this, SVX_RES(LB_END))), 2068dcb2a10SAndre Fischer mpFTEdgeStyle(new FixedText(this, SVX_RES(FT_EDGESTYLE))), 2078dcb2a10SAndre Fischer mpLBEdgeStyle(new ListBox(this, SVX_RES(LB_EDGESTYLE))), 2088dcb2a10SAndre Fischer mpFTCapStyle(new FixedText(this, SVX_RES(FT_CAPSTYLE))), 2098dcb2a10SAndre Fischer mpLBCapStyle(new ListBox(this, SVX_RES(LB_CAPSTYLE))), 2108dcb2a10SAndre Fischer maStyleControl(SID_ATTR_LINE_STYLE, *pBindings, *this), // ( SID_SVX_START + 169 ) 2118dcb2a10SAndre Fischer maDashControl (SID_ATTR_LINE_DASH, *pBindings, *this), // ( SID_SVX_START + 170 ) 2128dcb2a10SAndre Fischer maWidthControl(SID_ATTR_LINE_WIDTH, *pBindings, *this), // ( SID_SVX_START + 171 ) 2138dcb2a10SAndre Fischer maColorControl(SID_ATTR_LINE_COLOR, *pBindings, *this), // ( SID_SVX_START + 172 ) 2148dcb2a10SAndre Fischer maStartControl(SID_ATTR_LINE_START, *pBindings, *this), // ( SID_SVX_START + 173 ) 2158dcb2a10SAndre Fischer maEndControl(SID_ATTR_LINE_END, *pBindings, *this), // ( SID_SVX_START + 174 ) 2168dcb2a10SAndre Fischer maLineEndListControl(SID_LINEEND_LIST, *pBindings, *this), // ( SID_SVX_START + 184 ) 2178dcb2a10SAndre Fischer maTransControl(SID_ATTR_LINE_TRANSPARENCE, *pBindings, *this), // (SID_SVX_START+1107) 2188dcb2a10SAndre Fischer maEdgeStyle(SID_ATTR_LINE_JOINT, *pBindings, *this), // (SID_SVX_START+1110) 2198dcb2a10SAndre Fischer maCapStyle(SID_ATTR_LINE_CAP, *pBindings, *this), // (SID_SVX_START+1111) 2208dcb2a10SAndre Fischer maColor(COL_BLACK), 2218dcb2a10SAndre Fischer mpColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_LINE_COLOR, TBI_COLOR, mpTBColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)), 2228dcb2a10SAndre Fischer mpStyleItem(), 2238dcb2a10SAndre Fischer mpDashItem(), 2248dcb2a10SAndre Fischer mnTrans(0), 2258dcb2a10SAndre Fischer meMapUnit(SFX_MAPUNIT_MM), 2268dcb2a10SAndre Fischer mnWidthCoreValue(0), 2278dcb2a10SAndre Fischer mpLineEndList(0), 2288dcb2a10SAndre Fischer mpStartItem(0), 2298dcb2a10SAndre Fischer mpEndItem(0), 2308dcb2a10SAndre Fischer maColorPopup(this, ::boost::bind(&LinePropertyPanel::CreateColorPopupControl, this, _1)), 2318dcb2a10SAndre Fischer maLineStylePopup(this, ::boost::bind(&LinePropertyPanel::CreateLineStylePopupControl, this, _1)), 2328dcb2a10SAndre Fischer maLineWidthPopup(this, ::boost::bind(&LinePropertyPanel::CreateLineWidthPopupControl, this, _1)), 2338dcb2a10SAndre Fischer maIMGColor(SVX_RES(IMG_COLOR)), 2348dcb2a10SAndre Fischer maIMGNone(SVX_RES(IMG_NONE_ICON)), 2358dcb2a10SAndre Fischer mpIMGStyleIcon(), 2368dcb2a10SAndre Fischer mpIMGWidthIcon(), 2378dcb2a10SAndre Fischer mpIMGStyleIconH(), 2388dcb2a10SAndre Fischer mpIMGWidthIconH(), 2398dcb2a10SAndre Fischer mxFrame(rxFrame), 2408dcb2a10SAndre Fischer maContext(), 2418dcb2a10SAndre Fischer mpBindings(pBindings), 2428dcb2a10SAndre Fischer mbColorAvailable(true), 2438dcb2a10SAndre Fischer mbStyleAvailable(false), 2448dcb2a10SAndre Fischer mbDashAvailable(false), 2458dcb2a10SAndre Fischer mbTransAvailable(true), 2468dcb2a10SAndre Fischer mbWidthValuable(true), 2478dcb2a10SAndre Fischer mbStartAvailable(true), 2488dcb2a10SAndre Fischer mbEndAvailable(true) 2498dcb2a10SAndre Fischer { 2508dcb2a10SAndre Fischer Initialize(); 2518dcb2a10SAndre Fischer FreeResource(); 2528dcb2a10SAndre Fischer } 2538dcb2a10SAndre Fischer 2548dcb2a10SAndre Fischer 2558dcb2a10SAndre Fischer 2568dcb2a10SAndre Fischer LinePropertyPanel::~LinePropertyPanel() 2578dcb2a10SAndre Fischer { 2588dcb2a10SAndre Fischer // Destroy the toolboxes, then their background windows. 2598dcb2a10SAndre Fischer mpTBWidth.reset(); 2608dcb2a10SAndre Fischer mpTBColor.reset(); 2618dcb2a10SAndre Fischer mpTBStyle.reset(); 2628dcb2a10SAndre Fischer mpTBWidthBackground.reset(); 2638dcb2a10SAndre Fischer mpTBColorBackground.reset(); 2648dcb2a10SAndre Fischer mpTBStyleBackground.reset(); 2658dcb2a10SAndre Fischer } 2668dcb2a10SAndre Fischer 2678dcb2a10SAndre Fischer 2688dcb2a10SAndre Fischer 2698dcb2a10SAndre Fischer void LinePropertyPanel::Initialize() 2708dcb2a10SAndre Fischer { 2718dcb2a10SAndre Fischer mpIMGStyleIcon.reset(new Image[11]); 2728dcb2a10SAndre Fischer mpIMGStyleIcon[0] = Image(SVX_RES(IMG_LINE1_ICON)); 2738dcb2a10SAndre Fischer mpIMGStyleIcon[1] = Image(SVX_RES(IMG_LINE2_ICON)); 2748dcb2a10SAndre Fischer mpIMGStyleIcon[2] = Image(SVX_RES(IMG_LINE3_ICON)); 2758dcb2a10SAndre Fischer mpIMGStyleIcon[3] = Image(SVX_RES(IMG_LINE4_ICON)); 2768dcb2a10SAndre Fischer mpIMGStyleIcon[4] = Image(SVX_RES(IMG_LINE5_ICON)); 2778dcb2a10SAndre Fischer mpIMGStyleIcon[5] = Image(SVX_RES(IMG_LINE6_ICON)); 2788dcb2a10SAndre Fischer mpIMGStyleIcon[6] = Image(SVX_RES(IMG_LINE7_ICON)); 2798dcb2a10SAndre Fischer mpIMGStyleIcon[7] = Image(SVX_RES(IMG_LINE8_ICON)); 2808dcb2a10SAndre Fischer mpIMGStyleIcon[8] = Image(SVX_RES(IMG_LINE9_ICON)); 2818dcb2a10SAndre Fischer mpIMGStyleIcon[9] = Image(SVX_RES(IMG_LINE10_ICON)); 2828dcb2a10SAndre Fischer mpIMGStyleIcon[10] = Image(SVX_RES(IMG_LINE11_ICON)); 2838dcb2a10SAndre Fischer 2848dcb2a10SAndre Fischer mpIMGWidthIcon.reset(new Image[8]); 2858dcb2a10SAndre Fischer mpIMGWidthIcon[0] = Image(SVX_RES(IMG_WIDTH1_ICON)); 2868dcb2a10SAndre Fischer mpIMGWidthIcon[1] = Image(SVX_RES(IMG_WIDTH2_ICON)); 2878dcb2a10SAndre Fischer mpIMGWidthIcon[2] = Image(SVX_RES(IMG_WIDTH3_ICON)); 2888dcb2a10SAndre Fischer mpIMGWidthIcon[3] = Image(SVX_RES(IMG_WIDTH4_ICON)); 2898dcb2a10SAndre Fischer mpIMGWidthIcon[4] = Image(SVX_RES(IMG_WIDTH5_ICON)); 2908dcb2a10SAndre Fischer mpIMGWidthIcon[5] = Image(SVX_RES(IMG_WIDTH6_ICON)); 2918dcb2a10SAndre Fischer mpIMGWidthIcon[6] = Image(SVX_RES(IMG_WIDTH7_ICON)); 2928dcb2a10SAndre Fischer mpIMGWidthIcon[7] = Image(SVX_RES(IMG_WIDTH8_ICON)); 2938dcb2a10SAndre Fischer 2948dcb2a10SAndre Fischer //high contrast 2958dcb2a10SAndre Fischer mpIMGStyleIconH.reset(new Image[11]); 2968dcb2a10SAndre Fischer mpIMGStyleIconH[0] = Image(SVX_RES(IMG_LINE1_ICON_H)); 2978dcb2a10SAndre Fischer mpIMGStyleIconH[1] = Image(SVX_RES(IMG_LINE2_ICON_H)); 2988dcb2a10SAndre Fischer mpIMGStyleIconH[2] = Image(SVX_RES(IMG_LINE3_ICON_H)); 2998dcb2a10SAndre Fischer mpIMGStyleIconH[3] = Image(SVX_RES(IMG_LINE4_ICON_H)); 3008dcb2a10SAndre Fischer mpIMGStyleIconH[4] = Image(SVX_RES(IMG_LINE5_ICON_H)); 3018dcb2a10SAndre Fischer mpIMGStyleIconH[5] = Image(SVX_RES(IMG_LINE6_ICON_H)); 3028dcb2a10SAndre Fischer mpIMGStyleIconH[6] = Image(SVX_RES(IMG_LINE7_ICON_H)); 3038dcb2a10SAndre Fischer mpIMGStyleIconH[7] = Image(SVX_RES(IMG_LINE8_ICON_H)); 3048dcb2a10SAndre Fischer mpIMGStyleIconH[8] = Image(SVX_RES(IMG_LINE9_ICON_H)); 3058dcb2a10SAndre Fischer mpIMGStyleIconH[9] = Image(SVX_RES(IMG_LINE10_ICON_H)); 3068dcb2a10SAndre Fischer mpIMGStyleIconH[10] = Image(SVX_RES(IMG_LINE11_ICON_H)); 3078dcb2a10SAndre Fischer 3088dcb2a10SAndre Fischer mpIMGWidthIconH.reset(new Image[8]); 3098dcb2a10SAndre Fischer mpIMGWidthIconH[0] = Image(SVX_RES(IMG_WIDTH1_ICON_H)); 3108dcb2a10SAndre Fischer mpIMGWidthIconH[1] = Image(SVX_RES(IMG_WIDTH2_ICON_H)); 3118dcb2a10SAndre Fischer mpIMGWidthIconH[2] = Image(SVX_RES(IMG_WIDTH3_ICON_H)); 3128dcb2a10SAndre Fischer mpIMGWidthIconH[3] = Image(SVX_RES(IMG_WIDTH4_ICON_H)); 3138dcb2a10SAndre Fischer mpIMGWidthIconH[4] = Image(SVX_RES(IMG_WIDTH5_ICON_H)); 3148dcb2a10SAndre Fischer mpIMGWidthIconH[5] = Image(SVX_RES(IMG_WIDTH6_ICON_H)); 3158dcb2a10SAndre Fischer mpIMGWidthIconH[6] = Image(SVX_RES(IMG_WIDTH7_ICON_H)); 3168dcb2a10SAndre Fischer mpIMGWidthIconH[7] = Image(SVX_RES(IMG_WIDTH8_ICON_H)); 3178dcb2a10SAndre Fischer //end 3188dcb2a10SAndre Fischer 3198dcb2a10SAndre Fischer meMapUnit = maWidthControl.GetCoreMetric(); 3208dcb2a10SAndre Fischer 3218dcb2a10SAndre Fischer mpTBColor->SetItemImage(TBI_COLOR, maIMGColor); 3228dcb2a10SAndre Fischer Size aTbxSize( mpTBColor->CalcWindowSizePixel() ); 3238dcb2a10SAndre Fischer mpTBColor->SetOutputSizePixel( aTbxSize ); 3248dcb2a10SAndre Fischer mpTBColor->SetItemBits( TBI_COLOR, mpTBColor->GetItemBits( TBI_COLOR ) | TIB_DROPDOWNONLY ); 3258dcb2a10SAndre Fischer mpTBColor->SetQuickHelpText(TBI_COLOR,String(SVX_RES(STR_QH_TB_COLOR))); //Add 3268dcb2a10SAndre Fischer mpTBColor->SetBackground(Wallpaper()); 3278dcb2a10SAndre Fischer mpTBColor->SetPaintTransparent(true); 3288dcb2a10SAndre Fischer Link aLink = LINK(this, LinePropertyPanel, ToolboxColorSelectHdl); 3298dcb2a10SAndre Fischer mpTBColor->SetDropdownClickHdl ( aLink ); 3308dcb2a10SAndre Fischer mpTBColor->SetSelectHdl ( aLink ); 3318dcb2a10SAndre Fischer 3328dcb2a10SAndre Fischer mpTBStyle->SetItemImage(TBI_STYLE, mpIMGStyleIcon[0]); 3338dcb2a10SAndre Fischer aTbxSize = mpTBStyle->CalcWindowSizePixel() ; 3348dcb2a10SAndre Fischer mpTBStyle->SetOutputSizePixel( aTbxSize ); 3358dcb2a10SAndre Fischer mpTBStyle->SetItemBits( TBI_STYLE, mpTBStyle->GetItemBits( TBI_STYLE ) | TIB_DROPDOWNONLY ); 3368dcb2a10SAndre Fischer mpTBStyle->SetQuickHelpText(TBI_STYLE,String(SVX_RES(STR_QH_TB_STYLE))); //Add 3378dcb2a10SAndre Fischer mpTBStyle->SetBackground(Wallpaper()); 3388dcb2a10SAndre Fischer mpTBStyle->SetPaintTransparent(true); 3398dcb2a10SAndre Fischer aLink = LINK(this, LinePropertyPanel, ToolboxStyleSelectHdl); 3408dcb2a10SAndre Fischer mpTBStyle->SetDropdownClickHdl ( aLink ); 3418dcb2a10SAndre Fischer mpTBStyle->SetSelectHdl ( aLink ); 3428dcb2a10SAndre Fischer 3438dcb2a10SAndre Fischer mpTBWidth->SetItemImage(TBI_WIDTH, mpIMGWidthIcon[0]); 3448dcb2a10SAndre Fischer aTbxSize = mpTBWidth->CalcWindowSizePixel() ; 3458dcb2a10SAndre Fischer mpTBWidth->SetOutputSizePixel( aTbxSize ); 3468dcb2a10SAndre Fischer mpTBWidth->SetItemBits( TBI_WIDTH, mpTBWidth->GetItemBits( TBI_WIDTH ) | TIB_DROPDOWNONLY ); 3478dcb2a10SAndre Fischer mpTBWidth->SetQuickHelpText(TBI_WIDTH,String(SVX_RES(STR_QH_TB_WIDTH))); //Add 3488dcb2a10SAndre Fischer mpTBWidth->SetBackground(Wallpaper()); 3498dcb2a10SAndre Fischer mpTBWidth->SetPaintTransparent(true); 3508dcb2a10SAndre Fischer aLink = LINK(this, LinePropertyPanel, ToolboxWidthSelectHdl); 3518dcb2a10SAndre Fischer mpTBWidth->SetDropdownClickHdl ( aLink ); 3528dcb2a10SAndre Fischer mpTBWidth->SetSelectHdl ( aLink ); 3538dcb2a10SAndre Fischer 3548dcb2a10SAndre Fischer FillLineEndList(); 3558dcb2a10SAndre Fischer SelectEndStyle(true); 3568dcb2a10SAndre Fischer SelectEndStyle(false); 3578dcb2a10SAndre Fischer aLink = LINK( this, LinePropertyPanel, ChangeStartHdl ); 3588dcb2a10SAndre Fischer mpLBStart->SetSelectHdl( aLink ); 3598dcb2a10SAndre Fischer mpLBStart->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Beginning Style"))); //wj acc 3608dcb2a10SAndre Fischer aLink = LINK( this, LinePropertyPanel, ChangeEndHdl ); 3618dcb2a10SAndre Fischer mpLBEnd->SetSelectHdl( aLink ); 3628dcb2a10SAndre Fischer mpLBEnd->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Ending Style"))); //wj acc 3638dcb2a10SAndre Fischer 3648dcb2a10SAndre Fischer aLink = LINK(this, LinePropertyPanel, ChangeTransparentHdl); 3658dcb2a10SAndre Fischer mpMFTransparent->SetModifyHdl(aLink); 3668dcb2a10SAndre Fischer mpMFTransparent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency"))); //wj acc 3678dcb2a10SAndre Fischer 3688dcb2a10SAndre Fischer mpTBWidth->SetAccessibleRelationLabeledBy(mpFTWidth.get()); 3698dcb2a10SAndre Fischer mpTBColor->SetAccessibleRelationLabeledBy(mpFTColor.get()); 3708dcb2a10SAndre Fischer mpTBStyle->SetAccessibleRelationLabeledBy(mpFTStyle.get()); 3718dcb2a10SAndre Fischer mpMFTransparent->SetAccessibleRelationLabeledBy(mpFTTrancparency.get()); 3728dcb2a10SAndre Fischer mpLBStart->SetAccessibleRelationLabeledBy(mpFTArrow.get()); 3738dcb2a10SAndre Fischer mpLBEnd->SetAccessibleRelationLabeledBy(mpLBEnd.get()); 3748dcb2a10SAndre Fischer 3758dcb2a10SAndre Fischer aLink = LINK( this, LinePropertyPanel, ChangeEdgeStyleHdl ); 3768dcb2a10SAndre Fischer mpLBEdgeStyle->SetSelectHdl( aLink ); 3778dcb2a10SAndre Fischer mpLBEdgeStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Corner Style"))); 3788dcb2a10SAndre Fischer 3798dcb2a10SAndre Fischer aLink = LINK( this, LinePropertyPanel, ChangeCapStyleHdl ); 3808dcb2a10SAndre Fischer mpLBCapStyle->SetSelectHdl( aLink ); 3818dcb2a10SAndre Fischer mpLBCapStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cap Style"))); 3828dcb2a10SAndre Fischer } 3838dcb2a10SAndre Fischer 3848dcb2a10SAndre Fischer 3858dcb2a10SAndre Fischer 3868dcb2a10SAndre Fischer void LinePropertyPanel::SetupIcons(void) 3878dcb2a10SAndre Fischer { 3888dcb2a10SAndre Fischer if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) 3898dcb2a10SAndre Fischer { 3908dcb2a10SAndre Fischer // todo 3918dcb2a10SAndre Fischer } 3928dcb2a10SAndre Fischer else 3938dcb2a10SAndre Fischer { 3948dcb2a10SAndre Fischer // todo 3958dcb2a10SAndre Fischer } 3968dcb2a10SAndre Fischer } 3978dcb2a10SAndre Fischer 3988dcb2a10SAndre Fischer 3998dcb2a10SAndre Fischer 4008dcb2a10SAndre Fischer LinePropertyPanel* LinePropertyPanel::Create ( 4018dcb2a10SAndre Fischer Window* pParent, 4028dcb2a10SAndre Fischer const cssu::Reference<css::frame::XFrame>& rxFrame, 4038dcb2a10SAndre Fischer SfxBindings* pBindings) 4048dcb2a10SAndre Fischer { 4058dcb2a10SAndre Fischer if (pParent == NULL) 4068dcb2a10SAndre Fischer throw lang::IllegalArgumentException(A2S("no parent Window given to LinePropertyPanel::Create"), NULL, 0); 4078dcb2a10SAndre Fischer if ( ! rxFrame.is()) 4088dcb2a10SAndre Fischer throw lang::IllegalArgumentException(A2S("no XFrame given to LinePropertyPanel::Create"), NULL, 1); 4098dcb2a10SAndre Fischer if (pBindings == NULL) 4108dcb2a10SAndre Fischer throw lang::IllegalArgumentException(A2S("no SfxBindings given to LinePropertyPanel::Create"), NULL, 2); 4118dcb2a10SAndre Fischer 4128dcb2a10SAndre Fischer return new LinePropertyPanel( 4138dcb2a10SAndre Fischer pParent, 4148dcb2a10SAndre Fischer rxFrame, 4158dcb2a10SAndre Fischer pBindings); 4168dcb2a10SAndre Fischer } 4178dcb2a10SAndre Fischer 4188dcb2a10SAndre Fischer 4198dcb2a10SAndre Fischer 4208dcb2a10SAndre Fischer void LinePropertyPanel::DataChanged( 4218dcb2a10SAndre Fischer const DataChangedEvent& rEvent) 4228dcb2a10SAndre Fischer { 4238dcb2a10SAndre Fischer (void)rEvent; 4248dcb2a10SAndre Fischer 4258dcb2a10SAndre Fischer SetupIcons(); 4268dcb2a10SAndre Fischer } 4278dcb2a10SAndre Fischer 4288dcb2a10SAndre Fischer 4298dcb2a10SAndre Fischer 4308dcb2a10SAndre Fischer void LinePropertyPanel::HandleContextChange( 4318dcb2a10SAndre Fischer const ::sfx2::sidebar::EnumContext aContext) 4328dcb2a10SAndre Fischer { 4338dcb2a10SAndre Fischer if(maContext == aContext) 4348dcb2a10SAndre Fischer { 4358dcb2a10SAndre Fischer // Nothing to do. 4368dcb2a10SAndre Fischer return; 4378dcb2a10SAndre Fischer } 4388dcb2a10SAndre Fischer 4398dcb2a10SAndre Fischer maContext = aContext; 4408dcb2a10SAndre Fischer 4418dcb2a10SAndre Fischer 4428dcb2a10SAndre Fischer 4438dcb2a10SAndre Fischer // todo 4448dcb2a10SAndre Fischer } 4458dcb2a10SAndre Fischer 4468dcb2a10SAndre Fischer 4478dcb2a10SAndre Fischer 4488dcb2a10SAndre Fischer void LinePropertyPanel::NotifyItemUpdate( 4498dcb2a10SAndre Fischer sal_uInt16 nSID, 4508dcb2a10SAndre Fischer SfxItemState eState, 4518dcb2a10SAndre Fischer const SfxPoolItem* pState) 4528dcb2a10SAndre Fischer { 4538dcb2a10SAndre Fischer switch(nSID) 4548dcb2a10SAndre Fischer { 4558dcb2a10SAndre Fischer case SID_ATTR_LINE_COLOR: 4568dcb2a10SAndre Fischer { 4578dcb2a10SAndre Fischer if( eState == SFX_ITEM_DISABLED) 4588dcb2a10SAndre Fischer { 4598dcb2a10SAndre Fischer mpFTColor->Disable(); 4608dcb2a10SAndre Fischer mpTBColor->Disable(); 4618dcb2a10SAndre Fischer mbColorAvailable = false; 4628dcb2a10SAndre Fischer mpColorUpdater->Update(COL_WHITE); 4638dcb2a10SAndre Fischer } 4648dcb2a10SAndre Fischer else 4658dcb2a10SAndre Fischer { 4668dcb2a10SAndre Fischer mpFTColor->Enable(); 4678dcb2a10SAndre Fischer mpTBColor->Enable(); 4688dcb2a10SAndre Fischer const XLineColorItem* pItem = dynamic_cast< const XLineColorItem* >(pState); 4698dcb2a10SAndre Fischer 4708dcb2a10SAndre Fischer if(eState >= SFX_ITEM_DEFAULT && pItem) 4718dcb2a10SAndre Fischer { 4728dcb2a10SAndre Fischer maColor = pItem->GetColorValue(); 4738dcb2a10SAndre Fischer mbColorAvailable = true; 4748dcb2a10SAndre Fischer mpColorUpdater->Update(maColor); 4758dcb2a10SAndre Fischer } 4768dcb2a10SAndre Fischer else 4778dcb2a10SAndre Fischer { 4788dcb2a10SAndre Fischer mbColorAvailable = false; 4798dcb2a10SAndre Fischer mpColorUpdater->Update(COL_WHITE); 4808dcb2a10SAndre Fischer } 4818dcb2a10SAndre Fischer } 4828dcb2a10SAndre Fischer break; 4838dcb2a10SAndre Fischer } 4848dcb2a10SAndre Fischer case SID_ATTR_LINE_STYLE: 4858dcb2a10SAndre Fischer case SID_ATTR_LINE_DASH: 4868dcb2a10SAndre Fischer { 4878dcb2a10SAndre Fischer if( eState == SFX_ITEM_DISABLED) 4888dcb2a10SAndre Fischer { 4898dcb2a10SAndre Fischer mpFTStyle->Disable(); 4908dcb2a10SAndre Fischer mpTBStyle->Disable(); 4918dcb2a10SAndre Fischer mpTBStyle->SetItemImage(TBI_STYLE,maIMGNone); 4928dcb2a10SAndre Fischer } 4938dcb2a10SAndre Fischer else 4948dcb2a10SAndre Fischer { 4958dcb2a10SAndre Fischer mpFTStyle->Enable(); 4968dcb2a10SAndre Fischer mpTBStyle->Enable(); 4978dcb2a10SAndre Fischer if( eState >= SFX_ITEM_DEFAULT ) 4988dcb2a10SAndre Fischer { 4998dcb2a10SAndre Fischer if(nSID == SID_ATTR_LINE_STYLE) 5008dcb2a10SAndre Fischer { 5018dcb2a10SAndre Fischer const XLineStyleItem* pItem = dynamic_cast< const XLineStyleItem* >(pState); 5028dcb2a10SAndre Fischer 5038dcb2a10SAndre Fischer if(pItem) 5048dcb2a10SAndre Fischer { 5058dcb2a10SAndre Fischer mbStyleAvailable =true; 5068dcb2a10SAndre Fischer mpStyleItem.reset(pState ? (XLineStyleItem*)pItem->Clone() : 0); 5078dcb2a10SAndre Fischer } 5088dcb2a10SAndre Fischer } 5098dcb2a10SAndre Fischer else if(nSID == SID_ATTR_LINE_DASH) 5108dcb2a10SAndre Fischer { 5118dcb2a10SAndre Fischer const XLineDashItem* pItem = dynamic_cast< const XLineDashItem* >(pState); 5128dcb2a10SAndre Fischer 5138dcb2a10SAndre Fischer if(pItem) 5148dcb2a10SAndre Fischer { 5158dcb2a10SAndre Fischer mbDashAvailable = true; 5168dcb2a10SAndre Fischer mpDashItem.reset(pState ? (XLineDashItem*)pItem->Clone() : 0); 5178dcb2a10SAndre Fischer } 5188dcb2a10SAndre Fischer } 5198dcb2a10SAndre Fischer } 5208dcb2a10SAndre Fischer else 5218dcb2a10SAndre Fischer { 5228dcb2a10SAndre Fischer if(nSID == SID_ATTR_LINE_STYLE) 5238dcb2a10SAndre Fischer mbStyleAvailable = false; 5248dcb2a10SAndre Fischer else 5258dcb2a10SAndre Fischer mbDashAvailable = false; 5268dcb2a10SAndre Fischer } 5278dcb2a10SAndre Fischer SetStyleIcon(); 5288dcb2a10SAndre Fischer } 5298dcb2a10SAndre Fischer break; 5308dcb2a10SAndre Fischer } 5318dcb2a10SAndre Fischer case SID_ATTR_LINE_TRANSPARENCE: 5328dcb2a10SAndre Fischer { 5338dcb2a10SAndre Fischer if( eState == SFX_ITEM_DISABLED ) 5348dcb2a10SAndre Fischer { 5358dcb2a10SAndre Fischer mpFTTrancparency->Disable(); 5368dcb2a10SAndre Fischer mpMFTransparent->Disable(); 5378dcb2a10SAndre Fischer mpMFTransparent->SetValue(0);//add 5388dcb2a10SAndre Fischer mpMFTransparent->SetText(String()); 5398dcb2a10SAndre Fischer mbTransAvailable = false; 5408dcb2a10SAndre Fischer } 5418dcb2a10SAndre Fischer else 5428dcb2a10SAndre Fischer { 5438dcb2a10SAndre Fischer mpFTTrancparency->Enable(); 5448dcb2a10SAndre Fischer mpMFTransparent->Enable(); 5458dcb2a10SAndre Fischer mbTransAvailable = true; 5468dcb2a10SAndre Fischer const XLineTransparenceItem* pItem = dynamic_cast< const XLineTransparenceItem* >(pState); 5478dcb2a10SAndre Fischer 5488dcb2a10SAndre Fischer if(eState != SFX_ITEM_DONTCARE && pItem) 5498dcb2a10SAndre Fischer { 5508dcb2a10SAndre Fischer mnTrans = pItem->GetValue(); 5518dcb2a10SAndre Fischer mpMFTransparent->SetValue(mnTrans); 5528dcb2a10SAndre Fischer } 5538dcb2a10SAndre Fischer else 5548dcb2a10SAndre Fischer { 5558dcb2a10SAndre Fischer mpMFTransparent->SetValue(0);//add 5568dcb2a10SAndre Fischer mpMFTransparent->SetText(String()); 5578dcb2a10SAndre Fischer } 5588dcb2a10SAndre Fischer } 5598dcb2a10SAndre Fischer break; 5608dcb2a10SAndre Fischer } 5618dcb2a10SAndre Fischer case SID_ATTR_LINE_WIDTH: 5628dcb2a10SAndre Fischer { 5638dcb2a10SAndre Fischer if(eState == SFX_ITEM_DISABLED) 5648dcb2a10SAndre Fischer { 5658dcb2a10SAndre Fischer mpTBWidth->Disable(); 5668dcb2a10SAndre Fischer mpFTWidth->Disable(); 5678dcb2a10SAndre Fischer } 5688dcb2a10SAndre Fischer else 5698dcb2a10SAndre Fischer { 5708dcb2a10SAndre Fischer //enable 5718dcb2a10SAndre Fischer mpTBWidth->Enable(); 5728dcb2a10SAndre Fischer mpFTWidth->Enable(); 5738dcb2a10SAndre Fischer const XLineWidthItem* pItem = dynamic_cast< const XLineWidthItem* >(pState); 5748dcb2a10SAndre Fischer 5758dcb2a10SAndre Fischer if(eState >= SFX_ITEM_AVAILABLE && pItem) 5768dcb2a10SAndre Fischer { 5778dcb2a10SAndre Fischer mnWidthCoreValue = pItem->GetValue(); 5788dcb2a10SAndre Fischer mbWidthValuable = true; 5798dcb2a10SAndre Fischer } 5808dcb2a10SAndre Fischer else 5818dcb2a10SAndre Fischer { 5828dcb2a10SAndre Fischer mbWidthValuable = false; 5838dcb2a10SAndre Fischer } 5848dcb2a10SAndre Fischer } 5858dcb2a10SAndre Fischer SetWidthIcon(); 5868dcb2a10SAndre Fischer break; 5878dcb2a10SAndre Fischer } 5888dcb2a10SAndre Fischer case SID_ATTR_LINE_START: 5898dcb2a10SAndre Fischer { 5908dcb2a10SAndre Fischer const XLineStartItem* pItem = dynamic_cast< const XLineStartItem* >(pState); 5918dcb2a10SAndre Fischer 5928dcb2a10SAndre Fischer if(eState != SFX_ITEM_DONTCARE && pItem) 5938dcb2a10SAndre Fischer { 5948dcb2a10SAndre Fischer mbStartAvailable = true; //add 5958dcb2a10SAndre Fischer mpStartItem.reset(pItem ? (XLineStartItem*)pItem->Clone() : 0); 5968dcb2a10SAndre Fischer SelectEndStyle(true); 5978dcb2a10SAndre Fischer } 5988dcb2a10SAndre Fischer else 5998dcb2a10SAndre Fischer { 6008dcb2a10SAndre Fischer mpLBStart->SetNoSelection(); 6018dcb2a10SAndre Fischer mbStartAvailable = false; //add 6028dcb2a10SAndre Fischer } 6038dcb2a10SAndre Fischer break; 6048dcb2a10SAndre Fischer } 6058dcb2a10SAndre Fischer case SID_ATTR_LINE_END: 6068dcb2a10SAndre Fischer { 6078dcb2a10SAndre Fischer mpFTArrow->Enable(); 6088dcb2a10SAndre Fischer mpLBEnd->Enable(); 6098dcb2a10SAndre Fischer const XLineEndItem* pItem = dynamic_cast< const XLineEndItem* >(pState); 6108dcb2a10SAndre Fischer 6118dcb2a10SAndre Fischer if(eState != SFX_ITEM_DONTCARE && pItem) 6128dcb2a10SAndre Fischer { 6138dcb2a10SAndre Fischer mbEndAvailable = true; //add 6148dcb2a10SAndre Fischer mpEndItem.reset(pItem ? (XLineEndItem*)pItem->Clone() : 0); 6158dcb2a10SAndre Fischer SelectEndStyle(false); 6168dcb2a10SAndre Fischer } 6178dcb2a10SAndre Fischer else 6188dcb2a10SAndre Fischer { 6198dcb2a10SAndre Fischer mpLBEnd->SetNoSelection(); 6208dcb2a10SAndre Fischer mbEndAvailable = false; //add 6218dcb2a10SAndre Fischer } 6228dcb2a10SAndre Fischer break; 6238dcb2a10SAndre Fischer } 6248dcb2a10SAndre Fischer case SID_LINEEND_LIST: 6258dcb2a10SAndre Fischer { 6268dcb2a10SAndre Fischer FillLineEndList(); 6278dcb2a10SAndre Fischer SelectEndStyle(true); 6288dcb2a10SAndre Fischer SelectEndStyle(false); 6298dcb2a10SAndre Fischer break; 6308dcb2a10SAndre Fischer } 6318dcb2a10SAndre Fischer case SID_ATTR_LINE_JOINT: 6328dcb2a10SAndre Fischer { 6338dcb2a10SAndre Fischer if(eState == SFX_ITEM_DISABLED) 6348dcb2a10SAndre Fischer { 6358dcb2a10SAndre Fischer mpLBEdgeStyle->Disable(); 6368dcb2a10SAndre Fischer } 6378dcb2a10SAndre Fischer else 6388dcb2a10SAndre Fischer { 6398dcb2a10SAndre Fischer mpLBEdgeStyle->Enable(); 6408dcb2a10SAndre Fischer const XLineJointItem* pItem = dynamic_cast< const XLineJointItem* >(pState); 6418dcb2a10SAndre Fischer sal_uInt16 nEntryPos(0); 6428dcb2a10SAndre Fischer 6438dcb2a10SAndre Fischer if(eState >= SFX_ITEM_AVAILABLE && pItem) 6448dcb2a10SAndre Fischer { 6458dcb2a10SAndre Fischer switch(pItem->GetValue()) 6468dcb2a10SAndre Fischer { 6478dcb2a10SAndre Fischer case com::sun::star::drawing::LineJoint_MIDDLE: 6488dcb2a10SAndre Fischer case com::sun::star::drawing::LineJoint_ROUND: 6498dcb2a10SAndre Fischer { 6508dcb2a10SAndre Fischer nEntryPos = 1; 6518dcb2a10SAndre Fischer break; 6528dcb2a10SAndre Fischer } 6538dcb2a10SAndre Fischer case com::sun::star::drawing::LineJoint_NONE: 6548dcb2a10SAndre Fischer { 6558dcb2a10SAndre Fischer nEntryPos = 2; 6568dcb2a10SAndre Fischer break; 6578dcb2a10SAndre Fischer } 6588dcb2a10SAndre Fischer case com::sun::star::drawing::LineJoint_MITER: 6598dcb2a10SAndre Fischer { 6608dcb2a10SAndre Fischer nEntryPos = 3; 6618dcb2a10SAndre Fischer break; 6628dcb2a10SAndre Fischer } 6638dcb2a10SAndre Fischer case com::sun::star::drawing::LineJoint_BEVEL: 6648dcb2a10SAndre Fischer { 6658dcb2a10SAndre Fischer nEntryPos = 4; 6668dcb2a10SAndre Fischer break; 6678dcb2a10SAndre Fischer } 6688dcb2a10SAndre Fischer 6698dcb2a10SAndre Fischer default: 6708dcb2a10SAndre Fischer break; 6718dcb2a10SAndre Fischer } 6728dcb2a10SAndre Fischer } 6738dcb2a10SAndre Fischer 6748dcb2a10SAndre Fischer if(nEntryPos) 6758dcb2a10SAndre Fischer { 6768dcb2a10SAndre Fischer mpLBEdgeStyle->SelectEntryPos(nEntryPos - 1); 6778dcb2a10SAndre Fischer } 6788dcb2a10SAndre Fischer else 6798dcb2a10SAndre Fischer { 6808dcb2a10SAndre Fischer mpLBEdgeStyle->SetNoSelection(); 6818dcb2a10SAndre Fischer } 6828dcb2a10SAndre Fischer } 6838dcb2a10SAndre Fischer break; 6848dcb2a10SAndre Fischer } 6858dcb2a10SAndre Fischer case SID_ATTR_LINE_CAP: 6868dcb2a10SAndre Fischer { 6878dcb2a10SAndre Fischer if(eState == SFX_ITEM_DISABLED) 6888dcb2a10SAndre Fischer { 6898dcb2a10SAndre Fischer mpLBCapStyle->Disable(); 6908dcb2a10SAndre Fischer } 6918dcb2a10SAndre Fischer else 6928dcb2a10SAndre Fischer { 6938dcb2a10SAndre Fischer mpLBCapStyle->Enable(); 6948dcb2a10SAndre Fischer const XLineCapItem* pItem = dynamic_cast< const XLineCapItem* >(pState); 6958dcb2a10SAndre Fischer sal_uInt16 nEntryPos(0); 6968dcb2a10SAndre Fischer 6978dcb2a10SAndre Fischer if(eState >= SFX_ITEM_AVAILABLE && pItem) 6988dcb2a10SAndre Fischer { 6998dcb2a10SAndre Fischer switch(pItem->GetValue()) 7008dcb2a10SAndre Fischer { 7018dcb2a10SAndre Fischer case com::sun::star::drawing::LineCap_BUTT: 7028dcb2a10SAndre Fischer { 7038dcb2a10SAndre Fischer nEntryPos = 1; 7048dcb2a10SAndre Fischer break; 7058dcb2a10SAndre Fischer } 7068dcb2a10SAndre Fischer case com::sun::star::drawing::LineCap_ROUND: 7078dcb2a10SAndre Fischer { 7088dcb2a10SAndre Fischer nEntryPos = 2; 7098dcb2a10SAndre Fischer break; 7108dcb2a10SAndre Fischer } 7118dcb2a10SAndre Fischer case com::sun::star::drawing::LineCap_SQUARE: 7128dcb2a10SAndre Fischer { 7138dcb2a10SAndre Fischer nEntryPos = 3; 7148dcb2a10SAndre Fischer break; 7158dcb2a10SAndre Fischer } 7168dcb2a10SAndre Fischer 7178dcb2a10SAndre Fischer default: 7188dcb2a10SAndre Fischer break; 7198dcb2a10SAndre Fischer } 7208dcb2a10SAndre Fischer } 7218dcb2a10SAndre Fischer 7228dcb2a10SAndre Fischer if(nEntryPos) 7238dcb2a10SAndre Fischer { 7248dcb2a10SAndre Fischer mpLBCapStyle->SelectEntryPos(nEntryPos - 1); 7258dcb2a10SAndre Fischer } 7268dcb2a10SAndre Fischer else 7278dcb2a10SAndre Fischer { 7288dcb2a10SAndre Fischer mpLBCapStyle->SetNoSelection(); 7298dcb2a10SAndre Fischer } 7308dcb2a10SAndre Fischer } 7318dcb2a10SAndre Fischer break; 7328dcb2a10SAndre Fischer } 7338dcb2a10SAndre Fischer } 7348dcb2a10SAndre Fischer } 7358dcb2a10SAndre Fischer 7368dcb2a10SAndre Fischer 7378dcb2a10SAndre Fischer 7388dcb2a10SAndre Fischer SfxBindings* LinePropertyPanel::GetBindings() 7398dcb2a10SAndre Fischer { 7408dcb2a10SAndre Fischer return mpBindings; 7418dcb2a10SAndre Fischer } 7428dcb2a10SAndre Fischer 7438dcb2a10SAndre Fischer 7448dcb2a10SAndre Fischer 7458dcb2a10SAndre Fischer IMPL_LINK( LinePropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG ) 7468dcb2a10SAndre Fischer { 7478dcb2a10SAndre Fischer return 0; 7488dcb2a10SAndre Fischer } 7498dcb2a10SAndre Fischer 7508dcb2a10SAndre Fischer 7518dcb2a10SAndre Fischer 7528dcb2a10SAndre Fischer 7538dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ToolboxColorSelectHdl,ToolBox*, pToolBox) 7548dcb2a10SAndre Fischer { 7558dcb2a10SAndre Fischer sal_uInt16 nId = pToolBox->GetCurItemId(); 7568dcb2a10SAndre Fischer if(nId == TBI_COLOR) 7578dcb2a10SAndre Fischer { 7588dcb2a10SAndre Fischer maColorPopup.Show(*pToolBox); 7598dcb2a10SAndre Fischer maColorPopup.SetCurrentColor(maColor, mbColorAvailable); 7608dcb2a10SAndre Fischer } 7618dcb2a10SAndre Fischer return 0; 7628dcb2a10SAndre Fischer } 7638dcb2a10SAndre Fischer 7648dcb2a10SAndre Fischer 7658dcb2a10SAndre Fischer 7668dcb2a10SAndre Fischer 7678dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ToolboxStyleSelectHdl,ToolBox*, pToolBox) 7688dcb2a10SAndre Fischer { 7698dcb2a10SAndre Fischer if (pToolBox->GetCurItemId() == TBI_STYLE) 7708dcb2a10SAndre Fischer { 7718dcb2a10SAndre Fischer maLineStylePopup.SetStyleSelect(mpStyleItem.get(), mpDashItem.get(), mbStyleAvailable, mbDashAvailable); 7728dcb2a10SAndre Fischer maLineStylePopup.Show(*pToolBox); 7738dcb2a10SAndre Fischer } 7748dcb2a10SAndre Fischer return 0; 7758dcb2a10SAndre Fischer } 7768dcb2a10SAndre Fischer 7778dcb2a10SAndre Fischer 7788dcb2a10SAndre Fischer 7798dcb2a10SAndre Fischer 7808dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ChangeStartHdl, void*, EMPTYARG) 7818dcb2a10SAndre Fischer { 7828dcb2a10SAndre Fischer sal_uInt16 nPos = mpLBStart->GetSelectEntryPos(); 7838dcb2a10SAndre Fischer if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != mpLBStart->GetSavedValue() ) 7848dcb2a10SAndre Fischer { 7858dcb2a10SAndre Fischer XLineStartItem* pItem = NULL; 7868dcb2a10SAndre Fischer if( nPos == 0 ) 7878dcb2a10SAndre Fischer pItem = new XLineStartItem(); 7888dcb2a10SAndre Fischer else if( mpLineEndList && mpLineEndList->Count() > (long) ( nPos - 1 ) ) 7898dcb2a10SAndre Fischer pItem = new XLineStartItem( mpLBStart->GetSelectEntry(),mpLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ); 7908dcb2a10SAndre Fischer GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SFX_CALLMODE_RECORD, pItem, 0L); 7918dcb2a10SAndre Fischer delete pItem; 7928dcb2a10SAndre Fischer } 7938dcb2a10SAndre Fischer return 0; 7948dcb2a10SAndre Fischer } 7958dcb2a10SAndre Fischer 7968dcb2a10SAndre Fischer 7978dcb2a10SAndre Fischer 7988dcb2a10SAndre Fischer 7998dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ChangeEndHdl, void*, EMPTYARG) 8008dcb2a10SAndre Fischer { 8018dcb2a10SAndre Fischer sal_uInt16 nPos = mpLBEnd->GetSelectEntryPos(); 8028dcb2a10SAndre Fischer if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != mpLBEnd->GetSavedValue() ) 8038dcb2a10SAndre Fischer { 8048dcb2a10SAndre Fischer XLineEndItem* pItem = NULL; 8058dcb2a10SAndre Fischer if( nPos == 0 ) 8068dcb2a10SAndre Fischer pItem = new XLineEndItem(); 8078dcb2a10SAndre Fischer else if( mpLineEndList && mpLineEndList->Count() > (long) ( nPos - 1 ) ) 8088dcb2a10SAndre Fischer pItem = new XLineEndItem( mpLBEnd->GetSelectEntry(), mpLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ); 8098dcb2a10SAndre Fischer GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SFX_CALLMODE_RECORD, pItem, 0L); 8108dcb2a10SAndre Fischer delete pItem; 8118dcb2a10SAndre Fischer } 8128dcb2a10SAndre Fischer return 0; 8138dcb2a10SAndre Fischer } 8148dcb2a10SAndre Fischer 8158dcb2a10SAndre Fischer 8168dcb2a10SAndre Fischer 8178dcb2a10SAndre Fischer 8188dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ChangeEdgeStyleHdl, void*, EMPTYARG) 8198dcb2a10SAndre Fischer { 8208dcb2a10SAndre Fischer const sal_uInt16 nPos(mpLBEdgeStyle->GetSelectEntryPos()); 8218dcb2a10SAndre Fischer 8228dcb2a10SAndre Fischer if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBEdgeStyle->GetSavedValue()) 8238dcb2a10SAndre Fischer { 8248dcb2a10SAndre Fischer XLineJointItem* pItem = 0; 8258dcb2a10SAndre Fischer 8268dcb2a10SAndre Fischer switch(nPos) 8278dcb2a10SAndre Fischer { 8288dcb2a10SAndre Fischer case 0: // rounded 8298dcb2a10SAndre Fischer { 8308dcb2a10SAndre Fischer pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_ROUND); 8318dcb2a10SAndre Fischer break; 8328dcb2a10SAndre Fischer } 8338dcb2a10SAndre Fischer case 1: // none 8348dcb2a10SAndre Fischer { 8358dcb2a10SAndre Fischer pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_NONE); 8368dcb2a10SAndre Fischer break; 8378dcb2a10SAndre Fischer } 8388dcb2a10SAndre Fischer case 2: // mitered 8398dcb2a10SAndre Fischer { 8408dcb2a10SAndre Fischer pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_MITER); 8418dcb2a10SAndre Fischer break; 8428dcb2a10SAndre Fischer } 8438dcb2a10SAndre Fischer case 3: // beveled 8448dcb2a10SAndre Fischer { 8458dcb2a10SAndre Fischer pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_BEVEL); 8468dcb2a10SAndre Fischer break; 8478dcb2a10SAndre Fischer } 8488dcb2a10SAndre Fischer } 8498dcb2a10SAndre Fischer 8508dcb2a10SAndre Fischer GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_JOINT, SFX_CALLMODE_RECORD, pItem, 0L); 8518dcb2a10SAndre Fischer delete pItem; 8528dcb2a10SAndre Fischer } 8538dcb2a10SAndre Fischer return 0; 8548dcb2a10SAndre Fischer } 8558dcb2a10SAndre Fischer 8568dcb2a10SAndre Fischer 8578dcb2a10SAndre Fischer 8588dcb2a10SAndre Fischer 8598dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ChangeCapStyleHdl, void*, EMPTYARG) 8608dcb2a10SAndre Fischer { 8618dcb2a10SAndre Fischer const sal_uInt16 nPos(mpLBCapStyle->GetSelectEntryPos()); 8628dcb2a10SAndre Fischer 8638dcb2a10SAndre Fischer if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBCapStyle->GetSavedValue()) 8648dcb2a10SAndre Fischer { 8658dcb2a10SAndre Fischer XLineCapItem* pItem = 0; 8668dcb2a10SAndre Fischer 8678dcb2a10SAndre Fischer switch(nPos) 8688dcb2a10SAndre Fischer { 8698dcb2a10SAndre Fischer case 0: // flat 8708dcb2a10SAndre Fischer { 8718dcb2a10SAndre Fischer pItem = new XLineCapItem(com::sun::star::drawing::LineCap_BUTT); 8728dcb2a10SAndre Fischer break; 8738dcb2a10SAndre Fischer } 8748dcb2a10SAndre Fischer case 1: // round 8758dcb2a10SAndre Fischer { 8768dcb2a10SAndre Fischer pItem = new XLineCapItem(com::sun::star::drawing::LineCap_ROUND); 8778dcb2a10SAndre Fischer break; 8788dcb2a10SAndre Fischer } 8798dcb2a10SAndre Fischer case 2: // square 8808dcb2a10SAndre Fischer { 8818dcb2a10SAndre Fischer pItem = new XLineCapItem(com::sun::star::drawing::LineCap_SQUARE); 8828dcb2a10SAndre Fischer break; 8838dcb2a10SAndre Fischer } 8848dcb2a10SAndre Fischer } 8858dcb2a10SAndre Fischer 8868dcb2a10SAndre Fischer GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_CAP, SFX_CALLMODE_RECORD, pItem, 0L); 8878dcb2a10SAndre Fischer delete pItem; 8888dcb2a10SAndre Fischer } 8898dcb2a10SAndre Fischer return 0; 8908dcb2a10SAndre Fischer } 8918dcb2a10SAndre Fischer 8928dcb2a10SAndre Fischer 8938dcb2a10SAndre Fischer 8948dcb2a10SAndre Fischer 8958dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ToolboxWidthSelectHdl,ToolBox*, pToolBox) 8968dcb2a10SAndre Fischer { 8978dcb2a10SAndre Fischer if (pToolBox->GetCurItemId() == TBI_WIDTH) 8988dcb2a10SAndre Fischer { 8998dcb2a10SAndre Fischer maLineWidthPopup.SetWidthSelect(mnWidthCoreValue, mbWidthValuable, meMapUnit); 9008dcb2a10SAndre Fischer maLineWidthPopup.Show(*pToolBox); 9018dcb2a10SAndre Fischer } 9028dcb2a10SAndre Fischer return 0; 9038dcb2a10SAndre Fischer } 9048dcb2a10SAndre Fischer 9058dcb2a10SAndre Fischer 9068dcb2a10SAndre Fischer 9078dcb2a10SAndre Fischer 9088dcb2a10SAndre Fischer IMPL_LINK( LinePropertyPanel, ChangeTransparentHdl, void *, EMPTYARG ) 9098dcb2a10SAndre Fischer { 9108dcb2a10SAndre Fischer sal_uInt16 nVal = (sal_uInt16)mpMFTransparent->GetValue(); 9118dcb2a10SAndre Fischer XLineTransparenceItem aItem( nVal ); 9128dcb2a10SAndre Fischer 9138dcb2a10SAndre Fischer GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L); 9148dcb2a10SAndre Fischer return( 0L ); 9158dcb2a10SAndre Fischer } 9168dcb2a10SAndre Fischer 9178dcb2a10SAndre Fischer 9188dcb2a10SAndre Fischer 9198dcb2a10SAndre Fischer 9208dcb2a10SAndre Fischer PopupControl* LinePropertyPanel::CreateColorPopupControl (PopupContainer* pParent) 9218dcb2a10SAndre Fischer { 9228a383445SArmin Le Grand const ResId aResId(SVX_RES(STR_AUTOMATICE)); 9238a383445SArmin Le Grand 9248dcb2a10SAndre Fischer return new ColorControl( 9258dcb2a10SAndre Fischer pParent, 9268dcb2a10SAndre Fischer mpBindings, 9278dcb2a10SAndre Fischer SVX_RES(RID_POPUPPANEL_LINEPAGE_COLOR), 9288dcb2a10SAndre Fischer SVX_RES(VS_COLOR), 9298dcb2a10SAndre Fischer ::boost::bind(GetTransparentColor), 9308dcb2a10SAndre Fischer ::boost::bind(&LinePropertyPanel::SetColor, this, _1, _2), 9318dcb2a10SAndre Fischer pParent, 9328a383445SArmin Le Grand &aResId); 9338dcb2a10SAndre Fischer } 9348dcb2a10SAndre Fischer 9358dcb2a10SAndre Fischer 9368dcb2a10SAndre Fischer 9378dcb2a10SAndre Fischer 9388dcb2a10SAndre Fischer PopupControl* LinePropertyPanel::CreateLineStylePopupControl (PopupContainer* pParent) 9398dcb2a10SAndre Fischer { 9408dcb2a10SAndre Fischer return new LineStyleControl (pParent, *this); 9418dcb2a10SAndre Fischer } 9428dcb2a10SAndre Fischer 9438dcb2a10SAndre Fischer 9448dcb2a10SAndre Fischer 9458dcb2a10SAndre Fischer 9468dcb2a10SAndre Fischer PopupControl* LinePropertyPanel::CreateLineWidthPopupControl (PopupContainer* pParent) 9478dcb2a10SAndre Fischer { 9488dcb2a10SAndre Fischer return new LineWidthControl(pParent, *this); 9498dcb2a10SAndre Fischer } 9508dcb2a10SAndre Fischer 9518dcb2a10SAndre Fischer 9528dcb2a10SAndre Fischer 9538dcb2a10SAndre Fischer 9548dcb2a10SAndre Fischer void LinePropertyPanel::EndLineStylePopupMode (void) 9558dcb2a10SAndre Fischer { 9568dcb2a10SAndre Fischer maLineStylePopup.Hide(); 9578dcb2a10SAndre Fischer } 9588dcb2a10SAndre Fischer 9598dcb2a10SAndre Fischer 9608dcb2a10SAndre Fischer 9618dcb2a10SAndre Fischer 9628dcb2a10SAndre Fischer void LinePropertyPanel::EndLineWidthPopupMode (void) 9638dcb2a10SAndre Fischer { 9648dcb2a10SAndre Fischer maLineWidthPopup.Hide(); 9658dcb2a10SAndre Fischer } 9668dcb2a10SAndre Fischer 9678dcb2a10SAndre Fischer 9688dcb2a10SAndre Fischer 9698dcb2a10SAndre Fischer 9708dcb2a10SAndre Fischer void LinePropertyPanel::SetStyleIcon() 9718dcb2a10SAndre Fischer { 9728dcb2a10SAndre Fischer if(!mbStyleAvailable) 9738dcb2a10SAndre Fischer { //custome style that not listed in panel 9748dcb2a10SAndre Fischer mpTBStyle->SetItemImage(TBI_STYLE,maIMGNone); 9758dcb2a10SAndre Fischer return; 9768dcb2a10SAndre Fischer } 9778dcb2a10SAndre Fischer 9788dcb2a10SAndre Fischer const XLineStyle eXLS(mpStyleItem ? (XLineStyle)mpStyleItem->GetValue() : XLINE_NONE); 9798dcb2a10SAndre Fischer 9808dcb2a10SAndre Fischer switch(eXLS) 9818dcb2a10SAndre Fischer { 9828dcb2a10SAndre Fischer case XLINE_NONE: 9838dcb2a10SAndre Fischer mpTBStyle->SetItemImage(TBI_STYLE,maIMGNone); 9848dcb2a10SAndre Fischer break; 9858dcb2a10SAndre Fischer case XLINE_SOLID: 9868dcb2a10SAndre Fischer mpTBStyle->SetItemImage(TBI_STYLE, GetDisplayBackground().GetColor().IsDark() ? mpIMGStyleIconH[0] : mpIMGStyleIcon[0]); 9878dcb2a10SAndre Fischer break; 9888dcb2a10SAndre Fischer case XLINE_DASH: 9898dcb2a10SAndre Fischer if(mpDashItem && mbDashAvailable) 9908dcb2a10SAndre Fischer { 9918dcb2a10SAndre Fischer XDash aDash = mpDashItem->GetDashValue(); 9928dcb2a10SAndre Fischer sal_uInt16 n = 0; 9938dcb2a10SAndre Fischer for( ; n < 10; n++ ) 9948dcb2a10SAndre Fischer { 9958dcb2a10SAndre Fischer if( Dash_Set[n] == aDash ) 9968dcb2a10SAndre Fischer { 9978dcb2a10SAndre Fischer mpTBStyle->SetItemImage(TBI_STYLE, GetDisplayBackground().GetColor().IsDark() ? mpIMGStyleIconH[n+1] :mpIMGStyleIcon[n+1]); 9988dcb2a10SAndre Fischer break; 9998dcb2a10SAndre Fischer } 10008dcb2a10SAndre Fischer } 10018dcb2a10SAndre Fischer if(n == 10) 10028dcb2a10SAndre Fischer mpTBStyle->SetItemImage(TBI_STYLE,maIMGNone); 10038dcb2a10SAndre Fischer } 10048dcb2a10SAndre Fischer else 10058dcb2a10SAndre Fischer { 10068dcb2a10SAndre Fischer mpTBStyle->SetItemImage(TBI_STYLE,maIMGNone); 10078dcb2a10SAndre Fischer } 10088dcb2a10SAndre Fischer break; 10098dcb2a10SAndre Fischer } 10108dcb2a10SAndre Fischer } 10118dcb2a10SAndre Fischer 10128dcb2a10SAndre Fischer 10138dcb2a10SAndre Fischer 10148dcb2a10SAndre Fischer void LinePropertyPanel::SetWidthIcon(int n) 10158dcb2a10SAndre Fischer { 10168dcb2a10SAndre Fischer if(n==0) 10178dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, maIMGNone); 10188dcb2a10SAndre Fischer else 10198dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[n-1] : mpIMGWidthIcon[n-1]); 10208dcb2a10SAndre Fischer } 10218dcb2a10SAndre Fischer 10228dcb2a10SAndre Fischer 10238dcb2a10SAndre Fischer 10248dcb2a10SAndre Fischer void LinePropertyPanel::SetWidthIcon() 10258dcb2a10SAndre Fischer { 10268dcb2a10SAndre Fischer if(!mbWidthValuable) 10278dcb2a10SAndre Fischer { 10288dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, maIMGNone); 10298dcb2a10SAndre Fischer return; 10308dcb2a10SAndre Fischer } 10318dcb2a10SAndre Fischer 10328dcb2a10SAndre Fischer long nVal = LogicToLogic(mnWidthCoreValue * 10,(MapUnit)meMapUnit , MAP_POINT); 10338dcb2a10SAndre Fischer 10348dcb2a10SAndre Fischer if(nVal <= 6) 10358dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[0] : mpIMGWidthIcon[0]); 10368dcb2a10SAndre Fischer else if(nVal > 6 && nVal <= 9) 10378dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[1] : mpIMGWidthIcon[1]); 10388dcb2a10SAndre Fischer else if(nVal > 9 && nVal <= 12) 10398dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[2] : mpIMGWidthIcon[2]); 10408dcb2a10SAndre Fischer else if(nVal > 12 && nVal <= 19) 10418dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[3] : mpIMGWidthIcon[3]); 10428dcb2a10SAndre Fischer else if(nVal > 19 && nVal <= 26) 10438dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[4] : mpIMGWidthIcon[4]); 10448dcb2a10SAndre Fischer else if(nVal > 26 && nVal <= 37) 10458dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[5] : mpIMGWidthIcon[5]); 10468dcb2a10SAndre Fischer else if(nVal > 37 && nVal <=52) 10478dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[6] : mpIMGWidthIcon[6]); 10488dcb2a10SAndre Fischer else if(nVal > 52) 10498dcb2a10SAndre Fischer mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[7] : mpIMGWidthIcon[7]); 10508dcb2a10SAndre Fischer 10518dcb2a10SAndre Fischer } 10528dcb2a10SAndre Fischer 10538dcb2a10SAndre Fischer 10548dcb2a10SAndre Fischer 10558dcb2a10SAndre Fischer void LinePropertyPanel::SetLineStyleItem(XLineStyleItem* pStyle) 10568dcb2a10SAndre Fischer { 10578dcb2a10SAndre Fischer mpStyleItem.reset(pStyle ? (XLineStyleItem*)pStyle->Clone() : 0); 10588dcb2a10SAndre Fischer } 10598dcb2a10SAndre Fischer 10608dcb2a10SAndre Fischer 10618dcb2a10SAndre Fischer 10628dcb2a10SAndre Fischer void LinePropertyPanel::SetLineDashItem(XLineDashItem* pDash) 10638dcb2a10SAndre Fischer { 10648dcb2a10SAndre Fischer mpDashItem.reset(pDash ? (XLineDashItem*)pDash->Clone() : 0); 10658dcb2a10SAndre Fischer } 10668dcb2a10SAndre Fischer 10678dcb2a10SAndre Fischer 10688dcb2a10SAndre Fischer 10698dcb2a10SAndre Fischer void LinePropertyPanel::SetColor ( 10708dcb2a10SAndre Fischer const String& rsColorName, 10718dcb2a10SAndre Fischer const Color aColor) 10728dcb2a10SAndre Fischer { 10738dcb2a10SAndre Fischer XLineColorItem aColorItem(rsColorName, aColor); 10748dcb2a10SAndre Fischer mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); 10758dcb2a10SAndre Fischer maColor = aColor; 10768dcb2a10SAndre Fischer } 10778dcb2a10SAndre Fischer 10788dcb2a10SAndre Fischer 10798dcb2a10SAndre Fischer 10808dcb2a10SAndre Fischer void LinePropertyPanel::SetWidth(long nWidth) 10818dcb2a10SAndre Fischer { 10828dcb2a10SAndre Fischer mnWidthCoreValue = nWidth; 10838dcb2a10SAndre Fischer mbWidthValuable = true; 10848dcb2a10SAndre Fischer } 10858dcb2a10SAndre Fischer 10868dcb2a10SAndre Fischer 10878dcb2a10SAndre Fischer 10888dcb2a10SAndre Fischer void LinePropertyPanel::FillLineEndList() 10898dcb2a10SAndre Fischer { 10908dcb2a10SAndre Fischer SfxObjectShell* pSh = SfxObjectShell::Current(); 10918dcb2a10SAndre Fischer if ( pSh && pSh->GetItem( SID_LINEEND_LIST ) ) 10928dcb2a10SAndre Fischer { 10938dcb2a10SAndre Fischer mpLBStart->Enable(); 10948dcb2a10SAndre Fischer SvxLineEndListItem aItem( *(const SvxLineEndListItem*)(pSh->GetItem( SID_LINEEND_LIST ) ) ); 10958dcb2a10SAndre Fischer mpLineEndList = aItem.GetLineEndList(); 10968dcb2a10SAndre Fischer String sNone( SVX_RES( RID_SVXSTR_NONE ) ); 10978dcb2a10SAndre Fischer // 10988dcb2a10SAndre Fischer mpLBStart->Clear(); 10998dcb2a10SAndre Fischer mpLBEnd->Clear(); 11008dcb2a10SAndre Fischer 11018dcb2a10SAndre Fischer if(mpLineEndList) 11028dcb2a10SAndre Fischer { 11038dcb2a10SAndre Fischer mpLBStart->InsertEntry( sNone ); 11048dcb2a10SAndre Fischer mpLBStart->Fill( mpLineEndList ); 11058dcb2a10SAndre Fischer mpLBStart->SelectEntryPos(0); 11068dcb2a10SAndre Fischer 11078dcb2a10SAndre Fischer mpLBEnd->InsertEntry( sNone ); 11088dcb2a10SAndre Fischer mpLBEnd->Fill( mpLineEndList, false); 11098dcb2a10SAndre Fischer mpLBEnd->SelectEntryPos(0); 11108dcb2a10SAndre Fischer } 11118dcb2a10SAndre Fischer } 11128dcb2a10SAndre Fischer else 11138dcb2a10SAndre Fischer { 11148dcb2a10SAndre Fischer mpLBStart->Disable(); 11158dcb2a10SAndre Fischer mpLBEnd->Disable(); 11168dcb2a10SAndre Fischer } 11178dcb2a10SAndre Fischer } 11188dcb2a10SAndre Fischer 11198dcb2a10SAndre Fischer 11208dcb2a10SAndre Fischer 11218dcb2a10SAndre Fischer void LinePropertyPanel::SelectEndStyle(bool bStart) 11228dcb2a10SAndre Fischer { 11238dcb2a10SAndre Fischer sal_Bool bSelected(false); 11248dcb2a10SAndre Fischer 11258dcb2a10SAndre Fischer if(bStart) 11268dcb2a10SAndre Fischer { 11278dcb2a10SAndre Fischer //<<add 11288dcb2a10SAndre Fischer if( !mbStartAvailable ) 11298dcb2a10SAndre Fischer { 11308dcb2a10SAndre Fischer mpLBStart->SetNoSelection(); 11318dcb2a10SAndre Fischer return; 11328dcb2a10SAndre Fischer } 11338dcb2a10SAndre Fischer //add end>> 11348dcb2a10SAndre Fischer if(mpStartItem && mpLineEndList) 11358dcb2a10SAndre Fischer { 11368dcb2a10SAndre Fischer const basegfx::B2DPolyPolygon& rItemPolygon = mpStartItem->GetLineStartValue(); 11378dcb2a10SAndre Fischer for(sal_Int32 a(0);!bSelected && a < mpLineEndList->Count(); a++) 11388dcb2a10SAndre Fischer { 11398dcb2a10SAndre Fischer XLineEndEntry* pEntry = mpLineEndList->GetLineEnd(a); 11408dcb2a10SAndre Fischer const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd(); 11418dcb2a10SAndre Fischer if(rItemPolygon == rEntryPolygon) 11428dcb2a10SAndre Fischer { 11438dcb2a10SAndre Fischer mpLBStart->SelectEntryPos((sal_uInt16)a + 1); 11448dcb2a10SAndre Fischer bSelected = true; 11458dcb2a10SAndre Fischer } 11468dcb2a10SAndre Fischer } 11478dcb2a10SAndre Fischer } 11488dcb2a10SAndre Fischer if(!bSelected) 11498dcb2a10SAndre Fischer mpLBStart->SelectEntryPos( 0 ); 11508dcb2a10SAndre Fischer } 11518dcb2a10SAndre Fischer else 11528dcb2a10SAndre Fischer { 11538dcb2a10SAndre Fischer //<<add 11548dcb2a10SAndre Fischer if( !mbEndAvailable ) 11558dcb2a10SAndre Fischer { 11568dcb2a10SAndre Fischer mpLBEnd->SetNoSelection(); 11578dcb2a10SAndre Fischer return; 11588dcb2a10SAndre Fischer } 11598dcb2a10SAndre Fischer //add end>> 11608dcb2a10SAndre Fischer if(mpEndItem && mpLineEndList) 11618dcb2a10SAndre Fischer { 11628dcb2a10SAndre Fischer const basegfx::B2DPolyPolygon& rItemPolygon = mpEndItem->GetLineEndValue(); 11638dcb2a10SAndre Fischer for(sal_Int32 a(0);!bSelected && a < mpLineEndList->Count(); a++) 11648dcb2a10SAndre Fischer { 11658dcb2a10SAndre Fischer XLineEndEntry* pEntry = mpLineEndList->GetLineEnd(a); 11668dcb2a10SAndre Fischer const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd(); 11678dcb2a10SAndre Fischer if(rItemPolygon == rEntryPolygon) 11688dcb2a10SAndre Fischer { 11698dcb2a10SAndre Fischer mpLBEnd->SelectEntryPos((sal_uInt16)a + 1); 11708dcb2a10SAndre Fischer bSelected = true; 11718dcb2a10SAndre Fischer } 11728dcb2a10SAndre Fischer } 11738dcb2a10SAndre Fischer } 11748dcb2a10SAndre Fischer if(!bSelected) 11758dcb2a10SAndre Fischer mpLBEnd->SelectEntryPos( 0 ); 11768dcb2a10SAndre Fischer } 11778dcb2a10SAndre Fischer } 11788dcb2a10SAndre Fischer 11798dcb2a10SAndre Fischer 11808dcb2a10SAndre Fischer } } // end of namespace svx::sidebar 1181*4e8031e0SArmin Le Grand 1182*4e8031e0SArmin Le Grand // eof 1183