xref: /AOO41X/main/svx/source/sidebar/line/LinePropertyPanel.cxx (revision c3c0ed1b47c74529fea7df983bc13ba484c533e9)
18dcb2a10SAndre Fischer /**************************************************************
28dcb2a10SAndre Fischer  *
38dcb2a10SAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
48dcb2a10SAndre Fischer  * or more contributor license agreements.  See the NOTICE file
58dcb2a10SAndre Fischer  * distributed with this work for additional information
68dcb2a10SAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
78dcb2a10SAndre Fischer  * to you under the Apache License, Version 2.0 (the
88dcb2a10SAndre Fischer  * "License"); you may not use this file except in compliance
98dcb2a10SAndre Fischer  * with the License.  You may obtain a copy of the License at
108dcb2a10SAndre Fischer  *
118dcb2a10SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
128dcb2a10SAndre Fischer  *
138dcb2a10SAndre Fischer  * Unless required by applicable law or agreed to in writing,
148dcb2a10SAndre Fischer  * software distributed under the License is distributed on an
158dcb2a10SAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
168dcb2a10SAndre Fischer  * KIND, either express or implied.  See the License for the
178dcb2a10SAndre Fischer  * specific language governing permissions and limitations
188dcb2a10SAndre Fischer  * under the License.
198dcb2a10SAndre Fischer  *
208dcb2a10SAndre Fischer  *************************************************************/
218dcb2a10SAndre Fischer 
228dcb2a10SAndre Fischer #include <sfx2/sidebar/propertypanel.hrc>
238dcb2a10SAndre Fischer #include <sfx2/sidebar/Theme.hxx>
248dcb2a10SAndre Fischer #include <sfx2/sidebar/ControlFactory.hxx>
258dcb2a10SAndre Fischer #include <LinePropertyPanel.hxx>
268dcb2a10SAndre Fischer #include <LinePropertyPanel.hrc>
278dcb2a10SAndre Fischer #include <svx/dialogs.hrc>
288dcb2a10SAndre Fischer #include <svx/dialmgr.hxx>
298dcb2a10SAndre Fischer #include <sfx2/objsh.hxx>
308dcb2a10SAndre Fischer #include <sfx2/bindings.hxx>
318dcb2a10SAndre Fischer #include <sfx2/dispatch.hxx>
328dcb2a10SAndre Fischer #include <svx/xlnclit.hxx>
338dcb2a10SAndre Fischer #include <svx/xtable.hxx>
348dcb2a10SAndre Fischer #include <svx/xdash.hxx>
358dcb2a10SAndre Fischer #include <svx/drawitem.hxx>
368dcb2a10SAndre Fischer #include <svx/svxitems.hrc>
378dcb2a10SAndre Fischer #include <svtools/valueset.hxx>
388dcb2a10SAndre Fischer #include <unotools/pathoptions.hxx>
398dcb2a10SAndre Fischer #include <unotools/viewoptions.hxx>
408dcb2a10SAndre Fischer #include <comphelper/processfactory.hxx>
418dcb2a10SAndre Fischer #include <i18npool/mslangid.hxx>
428dcb2a10SAndre Fischer #include <svx/xlineit0.hxx>
438dcb2a10SAndre Fischer #include <svx/xlndsit.hxx>
448dcb2a10SAndre Fischer #include <vcl/svapp.hxx>
458dcb2a10SAndre Fischer #include <svx/xlnwtit.hxx>
468dcb2a10SAndre Fischer #include <vcl/lstbox.hxx>
478dcb2a10SAndre Fischer #include <svx/tbxcolorupdate.hxx>
488dcb2a10SAndre Fischer #include <vcl/toolbox.hxx>
498dcb2a10SAndre Fischer #include <svx/xlntrit.hxx>
508dcb2a10SAndre Fischer #include <svx/xlnstit.hxx>
518dcb2a10SAndre Fischer #include <svx/xlnedit.hxx>
528dcb2a10SAndre Fischer #include <svx/xlncapit.hxx>
538dcb2a10SAndre Fischer #include <svx/xlinjoit.hxx>
548dcb2a10SAndre Fischer #include "svx/sidebar/PopupContainer.hxx"
558dcb2a10SAndre Fischer #include "svx/sidebar/PopupControl.hxx"
56facb16e7SArmin Le Grand #include <svx/sidebar/ColorControl.hxx>
578dcb2a10SAndre Fischer #include "LineWidthControl.hxx"
588dcb2a10SAndre Fischer #include <boost/bind.hpp>
598dcb2a10SAndre Fischer 
608dcb2a10SAndre Fischer using namespace css;
618dcb2a10SAndre Fischer using namespace cssu;
628dcb2a10SAndre Fischer using ::sfx2::sidebar::Theme;
638dcb2a10SAndre Fischer 
648dcb2a10SAndre Fischer #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
658dcb2a10SAndre Fischer 
668dcb2a10SAndre Fischer namespace {
678dcb2a10SAndre Fischer     short GetItemId_Impl_line( ValueSet& rValueSet, const Color& rCol )
688dcb2a10SAndre Fischer     {
698dcb2a10SAndre Fischer         if(rCol == COL_AUTO)
708dcb2a10SAndre Fischer             return 0;
718dcb2a10SAndre Fischer 
728dcb2a10SAndre Fischer         bool	bFound = false;
738dcb2a10SAndre Fischer         sal_uInt16 nCount = rValueSet.GetItemCount();
748dcb2a10SAndre Fischer         sal_uInt16	n	   = 1;
758dcb2a10SAndre Fischer 
768dcb2a10SAndre Fischer         while ( !bFound && n <= nCount )
778dcb2a10SAndre Fischer         {
788dcb2a10SAndre Fischer             Color aValCol = rValueSet.GetItemColor(n);
798dcb2a10SAndre Fischer 
808dcb2a10SAndre Fischer             bFound = (   aValCol.GetRed()   == rCol.GetRed()
818dcb2a10SAndre Fischer                 && aValCol.GetGreen() == rCol.GetGreen()
828dcb2a10SAndre Fischer                 && aValCol.GetBlue()  == rCol.GetBlue() );
838dcb2a10SAndre Fischer 
848dcb2a10SAndre Fischer             if ( !bFound )
858dcb2a10SAndre Fischer                 n++;
868dcb2a10SAndre Fischer         }
878dcb2a10SAndre Fischer         return bFound ? n : -1;
888dcb2a10SAndre Fischer     }
898dcb2a10SAndre Fischer 
908dcb2a10SAndre Fischer     Color GetTransparentColor (void)
918dcb2a10SAndre Fischer     {
928dcb2a10SAndre Fischer         return COL_TRANSPARENT;
938dcb2a10SAndre Fischer     }
948dcb2a10SAndre Fischer 
95a567bdc8SArmin Le Grand     void FillLineEndListBox(ListBox& rListBoxStart, ListBox& rListBoxEnd, const XLineEndList& rList)
968dcb2a10SAndre Fischer     {
97a567bdc8SArmin Le Grand         const sal_uInt32 nCount(rList.Count());
9897e8a929SArmin Le Grand         const String sNone(SVX_RES(RID_SVXSTR_NONE));
9997e8a929SArmin Le Grand 
100a567bdc8SArmin Le Grand         rListBoxStart.SetUpdateMode(false);
101a567bdc8SArmin Le Grand         rListBoxEnd.SetUpdateMode(false);
1028dcb2a10SAndre Fischer 
10397e8a929SArmin Le Grand         rListBoxStart.Clear();
10497e8a929SArmin Le Grand         rListBoxEnd.Clear();
10597e8a929SArmin Le Grand 
10697e8a929SArmin Le Grand         // add 'none' entries
10797e8a929SArmin Le Grand         rListBoxStart.InsertEntry(sNone);
10897e8a929SArmin Le Grand         rListBoxEnd.InsertEntry(sNone);
10997e8a929SArmin Le Grand 
110a567bdc8SArmin Le Grand         for(sal_uInt32 i(0); i < nCount; i++)
1118dcb2a10SAndre Fischer         {
112a567bdc8SArmin Le Grand             XLineEndEntry* pEntry = rList.GetLineEnd(i);
11397e8a929SArmin Le Grand             const Bitmap aBitmap = const_cast< XLineEndList& >(rList).GetUiBitmap(i);
1148dcb2a10SAndre Fischer 
11597e8a929SArmin Le Grand             if(!aBitmap.IsEmpty())
1168dcb2a10SAndre Fischer             {
11797e8a929SArmin Le Grand                 Bitmap aCopyStart(aBitmap);
11897e8a929SArmin Le Grand                 Bitmap aCopyEnd(aBitmap);
11997e8a929SArmin Le Grand                 // delete pBitmap;
120a567bdc8SArmin Le Grand                 const Size aBmpSize(aCopyStart.GetSizePixel());
121a567bdc8SArmin Le Grand                 const Rectangle aCropRectStart(Point(), Size(aBmpSize.Width() / 2, aBmpSize.Height()));
122a567bdc8SArmin Le Grand                 const Rectangle aCropRectEnd(Point(aBmpSize.Width() / 2, 0), Size(aBmpSize.Width() / 2, aBmpSize.Height()));
123a567bdc8SArmin Le Grand 
124a567bdc8SArmin Le Grand                 aCopyStart.Crop(aCropRectStart);
125a567bdc8SArmin Le Grand                 rListBoxStart.InsertEntry(
126a567bdc8SArmin Le Grand                     pEntry->GetName(),
127a567bdc8SArmin Le Grand                     aCopyStart);
128a567bdc8SArmin Le Grand 
129a567bdc8SArmin Le Grand                 aCopyEnd.Crop(aCropRectEnd);
130a567bdc8SArmin Le Grand                 rListBoxEnd.InsertEntry(
131a567bdc8SArmin Le Grand                     pEntry->GetName(),
132a567bdc8SArmin Le Grand                     aCopyEnd);
1338dcb2a10SAndre Fischer             }
1348dcb2a10SAndre Fischer             else
1358dcb2a10SAndre Fischer             {
136a567bdc8SArmin Le Grand                 rListBoxStart.InsertEntry(pEntry->GetName());
137a567bdc8SArmin Le Grand                 rListBoxEnd.InsertEntry(pEntry->GetName());
1388dcb2a10SAndre Fischer             }
1398dcb2a10SAndre Fischer         }
1408dcb2a10SAndre Fischer 
141a567bdc8SArmin Le Grand         rListBoxStart.SetUpdateMode(true);
142a567bdc8SArmin Le Grand         rListBoxEnd.SetUpdateMode(true);
1438dcb2a10SAndre Fischer     }
14497e8a929SArmin Le Grand 
14597e8a929SArmin Le Grand     void FillLineStyleListBox(ListBox& rListBox, const XDashList& rList)
14697e8a929SArmin Le Grand     {
14797e8a929SArmin Le Grand         const sal_uInt32 nCount(rList.Count());
14897e8a929SArmin Le Grand         rListBox.SetUpdateMode(false);
14997e8a929SArmin Le Grand 
15097e8a929SArmin Le Grand         rListBox.Clear();
15197e8a929SArmin Le Grand 
15297e8a929SArmin Le Grand         // entry for 'none'
15397e8a929SArmin Le Grand         rListBox.InsertEntry(rList.GetStringForUiNoLine());
15497e8a929SArmin Le Grand 
15597e8a929SArmin Le Grand         // entry for solid line
15697e8a929SArmin Le Grand         rListBox.InsertEntry(rList.GetStringForUiSolidLine(), rList.GetBitmapForUISolidLine());
15797e8a929SArmin Le Grand 
15897e8a929SArmin Le Grand         for(sal_uInt32 i(0); i < nCount; i++)
15997e8a929SArmin Le Grand         {
16097e8a929SArmin Le Grand             XDashEntry* pEntry = rList.GetDash(i);
16197e8a929SArmin Le Grand             const Bitmap aBitmap = const_cast< XDashList& >(rList).GetUiBitmap(i);
16297e8a929SArmin Le Grand 
16397e8a929SArmin Le Grand             if(!aBitmap.IsEmpty())
16497e8a929SArmin Le Grand             {
16597e8a929SArmin Le Grand                 rListBox.InsertEntry(
16697e8a929SArmin Le Grand                     pEntry->GetName(),
16797e8a929SArmin Le Grand                     aBitmap);
16897e8a929SArmin Le Grand                 // delete pBitmap;
16997e8a929SArmin Le Grand             }
17097e8a929SArmin Le Grand             else
17197e8a929SArmin Le Grand             {
17297e8a929SArmin Le Grand                 rListBox.InsertEntry(pEntry->GetName());
17397e8a929SArmin Le Grand             }
17497e8a929SArmin Le Grand         }
17597e8a929SArmin Le Grand 
17697e8a929SArmin Le Grand         rListBox.SetUpdateMode(true);
17797e8a929SArmin Le Grand     }
178a567bdc8SArmin Le Grand } // end of anonymous namespace
1798dcb2a10SAndre Fischer 
1808dcb2a10SAndre Fischer // namespace open
1818dcb2a10SAndre Fischer 
1828dcb2a10SAndre Fischer namespace svx { namespace sidebar {
1838dcb2a10SAndre Fischer 
1848dcb2a10SAndre Fischer LinePropertyPanel::LinePropertyPanel(
1858dcb2a10SAndre Fischer     Window* pParent,
1868dcb2a10SAndre Fischer     const cssu::Reference<css::frame::XFrame>& rxFrame,
1878dcb2a10SAndre Fischer     SfxBindings* pBindings)
1888dcb2a10SAndre Fischer :   Control(
1898dcb2a10SAndre Fischer         pParent,
1908dcb2a10SAndre Fischer         SVX_RES(RID_SIDEBAR_LINE_PANEL)),
1918dcb2a10SAndre Fischer     mpFTWidth(new FixedText(this, SVX_RES(FT_WIDTH))),
1928dcb2a10SAndre Fischer     mpTBWidthBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
1938dcb2a10SAndre Fischer     mpTBWidth(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBWidthBackground.get(), SVX_RES(TB_WIDTH))),
1948dcb2a10SAndre Fischer     mpFTColor(new FixedText(this, SVX_RES(FT_COLOR))),
1958dcb2a10SAndre Fischer     mpTBColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
1968dcb2a10SAndre Fischer     mpTBColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBColorBackground.get(), SVX_RES(TB_COLOR))),
1978dcb2a10SAndre Fischer     mpFTStyle(new FixedText(this, SVX_RES(FT_STYLE))),
19897e8a929SArmin Le Grand     mpLBStyle(new ListBox(this, SVX_RES(LB_STYLE))),
1998dcb2a10SAndre Fischer     mpFTTrancparency(new FixedText(this, SVX_RES(FT_TRANSPARENT))),
2008dcb2a10SAndre Fischer     mpMFTransparent(new MetricField(this, SVX_RES(MF_TRANSPARENT))),
2018dcb2a10SAndre Fischer     mpFTArrow(new FixedText(this, SVX_RES(FT_ARROW))),
2021137d172SArmin Le Grand     mpLBStart(new ListBox(this, SVX_RES(LB_START))),
2031137d172SArmin Le Grand     mpLBEnd(new ListBox(this, SVX_RES(LB_END))),
2048dcb2a10SAndre Fischer     mpFTEdgeStyle(new FixedText(this, SVX_RES(FT_EDGESTYLE))),
2058dcb2a10SAndre Fischer     mpLBEdgeStyle(new ListBox(this, SVX_RES(LB_EDGESTYLE))),
2068dcb2a10SAndre Fischer     mpFTCapStyle(new FixedText(this, SVX_RES(FT_CAPSTYLE))),
2078dcb2a10SAndre Fischer     mpLBCapStyle(new ListBox(this, SVX_RES(LB_CAPSTYLE))),
208a567bdc8SArmin Le Grand     maStyleControl(SID_ATTR_LINE_STYLE, *pBindings, *this),
209a567bdc8SArmin Le Grand     maDashControl (SID_ATTR_LINE_DASH, *pBindings, *this),
210a567bdc8SArmin Le Grand     maWidthControl(SID_ATTR_LINE_WIDTH, *pBindings, *this),
211a567bdc8SArmin Le Grand     maColorControl(SID_ATTR_LINE_COLOR, *pBindings, *this),
212a567bdc8SArmin Le Grand     maStartControl(SID_ATTR_LINE_START, *pBindings, *this),
213a567bdc8SArmin Le Grand     maEndControl(SID_ATTR_LINE_END, *pBindings, *this),
214a567bdc8SArmin Le Grand     maLineEndListControl(SID_LINEEND_LIST, *pBindings, *this),
21597e8a929SArmin Le Grand     maLineStyleListControl(SID_DASH_LIST, *pBindings, *this),
216a567bdc8SArmin Le Grand     maTransControl(SID_ATTR_LINE_TRANSPARENCE, *pBindings, *this),
217a567bdc8SArmin Le Grand     maEdgeStyle(SID_ATTR_LINE_JOINT, *pBindings, *this),
218a567bdc8SArmin Le Grand     maCapStyle(SID_ATTR_LINE_CAP, *pBindings, *this),
2198dcb2a10SAndre Fischer     maColor(COL_BLACK),
2208dcb2a10SAndre Fischer     mpColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_LINE_COLOR, TBI_COLOR, mpTBColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)),
2218dcb2a10SAndre Fischer     mpStyleItem(),
2228dcb2a10SAndre Fischer     mpDashItem(),
2238dcb2a10SAndre Fischer     mnTrans(0),
2248dcb2a10SAndre Fischer     meMapUnit(SFX_MAPUNIT_MM),
2258dcb2a10SAndre Fischer     mnWidthCoreValue(0),
2268dcb2a10SAndre Fischer     mpLineEndList(0),
22797e8a929SArmin Le Grand     mpLineStyleList(0),
2288dcb2a10SAndre Fischer     mpStartItem(0),
2298dcb2a10SAndre Fischer     mpEndItem(0),
2308dcb2a10SAndre Fischer     maColorPopup(this, ::boost::bind(&LinePropertyPanel::CreateColorPopupControl, this, _1)),
2318dcb2a10SAndre Fischer     maLineWidthPopup(this, ::boost::bind(&LinePropertyPanel::CreateLineWidthPopupControl, this, _1)),
2328dcb2a10SAndre Fischer     maIMGColor(SVX_RES(IMG_COLOR)),
2338dcb2a10SAndre Fischer     maIMGNone(SVX_RES(IMG_NONE_ICON)),
2348dcb2a10SAndre Fischer     mpIMGWidthIcon(),
2358dcb2a10SAndre Fischer     mpIMGWidthIconH(),
2368dcb2a10SAndre Fischer     mxFrame(rxFrame),
2378dcb2a10SAndre Fischer     mpBindings(pBindings),
2388dcb2a10SAndre Fischer     mbColorAvailable(true),
2398dcb2a10SAndre Fischer     mbStyleAvailable(false),
2408dcb2a10SAndre Fischer     mbDashAvailable(false),
2418dcb2a10SAndre Fischer     mbTransAvailable(true),
2428dcb2a10SAndre Fischer     mbWidthValuable(true),
2438dcb2a10SAndre Fischer     mbStartAvailable(true),
2448dcb2a10SAndre Fischer     mbEndAvailable(true)
2458dcb2a10SAndre Fischer {
2468dcb2a10SAndre Fischer     Initialize();
2478dcb2a10SAndre Fischer     FreeResource();
2488dcb2a10SAndre Fischer }
2498dcb2a10SAndre Fischer 
2508dcb2a10SAndre Fischer 
2518dcb2a10SAndre Fischer 
2528dcb2a10SAndre Fischer LinePropertyPanel::~LinePropertyPanel()
2538dcb2a10SAndre Fischer {
2548dcb2a10SAndre Fischer     // Destroy the toolboxes, then their background windows.
2558dcb2a10SAndre Fischer     mpTBWidth.reset();
2568dcb2a10SAndre Fischer     mpTBColor.reset();
25797e8a929SArmin Le Grand 
2588dcb2a10SAndre Fischer     mpTBWidthBackground.reset();
2598dcb2a10SAndre Fischer     mpTBColorBackground.reset();
2608dcb2a10SAndre Fischer }
2618dcb2a10SAndre Fischer 
2628dcb2a10SAndre Fischer 
2638dcb2a10SAndre Fischer 
2648dcb2a10SAndre Fischer void LinePropertyPanel::Initialize()
2658dcb2a10SAndre Fischer {
26637fee4fdSAndre Fischer     mpFTWidth->SetBackground(Wallpaper());
26737fee4fdSAndre Fischer     mpFTColor->SetBackground(Wallpaper());
26837fee4fdSAndre Fischer     mpFTStyle->SetBackground(Wallpaper());
26937fee4fdSAndre Fischer     mpFTTrancparency->SetBackground(Wallpaper());
27037fee4fdSAndre Fischer     mpFTArrow->SetBackground(Wallpaper());
27137fee4fdSAndre Fischer     mpFTEdgeStyle->SetBackground(Wallpaper());
27237fee4fdSAndre Fischer     mpFTCapStyle->SetBackground(Wallpaper());
27337fee4fdSAndre Fischer 
2748dcb2a10SAndre Fischer     mpIMGWidthIcon.reset(new Image[8]);
2758dcb2a10SAndre Fischer 	mpIMGWidthIcon[0] = Image(SVX_RES(IMG_WIDTH1_ICON));
2768dcb2a10SAndre Fischer 	mpIMGWidthIcon[1] = Image(SVX_RES(IMG_WIDTH2_ICON));
2778dcb2a10SAndre Fischer 	mpIMGWidthIcon[2] = Image(SVX_RES(IMG_WIDTH3_ICON));
2788dcb2a10SAndre Fischer 	mpIMGWidthIcon[3] = Image(SVX_RES(IMG_WIDTH4_ICON));
2798dcb2a10SAndre Fischer 	mpIMGWidthIcon[4] = Image(SVX_RES(IMG_WIDTH5_ICON));
2808dcb2a10SAndre Fischer 	mpIMGWidthIcon[5] = Image(SVX_RES(IMG_WIDTH6_ICON));
2818dcb2a10SAndre Fischer 	mpIMGWidthIcon[6] = Image(SVX_RES(IMG_WIDTH7_ICON));
2828dcb2a10SAndre Fischer 	mpIMGWidthIcon[7] = Image(SVX_RES(IMG_WIDTH8_ICON));
2838dcb2a10SAndre Fischer 
2848dcb2a10SAndre Fischer 	//high contrast
2858dcb2a10SAndre Fischer     mpIMGWidthIconH.reset(new Image[8]);
2868dcb2a10SAndre Fischer 	mpIMGWidthIconH[0] = Image(SVX_RES(IMG_WIDTH1_ICON_H));
2878dcb2a10SAndre Fischer 	mpIMGWidthIconH[1] = Image(SVX_RES(IMG_WIDTH2_ICON_H));
2888dcb2a10SAndre Fischer 	mpIMGWidthIconH[2] = Image(SVX_RES(IMG_WIDTH3_ICON_H));
2898dcb2a10SAndre Fischer 	mpIMGWidthIconH[3] = Image(SVX_RES(IMG_WIDTH4_ICON_H));
2908dcb2a10SAndre Fischer 	mpIMGWidthIconH[4] = Image(SVX_RES(IMG_WIDTH5_ICON_H));
2918dcb2a10SAndre Fischer 	mpIMGWidthIconH[5] = Image(SVX_RES(IMG_WIDTH6_ICON_H));
2928dcb2a10SAndre Fischer 	mpIMGWidthIconH[6] = Image(SVX_RES(IMG_WIDTH7_ICON_H));
2938dcb2a10SAndre Fischer 	mpIMGWidthIconH[7] = Image(SVX_RES(IMG_WIDTH8_ICON_H));
2948dcb2a10SAndre Fischer 
2958dcb2a10SAndre Fischer 	meMapUnit = maWidthControl.GetCoreMetric();
2968dcb2a10SAndre Fischer 
2978dcb2a10SAndre Fischer 	mpTBColor->SetItemImage(TBI_COLOR, maIMGColor);
2988dcb2a10SAndre Fischer 	Size aTbxSize( mpTBColor->CalcWindowSizePixel() );
2998dcb2a10SAndre Fischer 	mpTBColor->SetOutputSizePixel( aTbxSize );
3008dcb2a10SAndre Fischer 	mpTBColor->SetItemBits( TBI_COLOR, mpTBColor->GetItemBits( TBI_COLOR ) | TIB_DROPDOWNONLY );
3018dcb2a10SAndre Fischer 	mpTBColor->SetQuickHelpText(TBI_COLOR,String(SVX_RES(STR_QH_TB_COLOR))); //Add
3028dcb2a10SAndre Fischer 	mpTBColor->SetBackground(Wallpaper());
3038dcb2a10SAndre Fischer 	mpTBColor->SetPaintTransparent(true);
3048dcb2a10SAndre Fischer 	Link aLink = LINK(this, LinePropertyPanel, ToolboxColorSelectHdl);
3058dcb2a10SAndre Fischer 	mpTBColor->SetDropdownClickHdl ( aLink );
3068dcb2a10SAndre Fischer 	mpTBColor->SetSelectHdl ( aLink );
3078dcb2a10SAndre Fischer 
30897e8a929SArmin Le Grand 	FillLineStyleList();
30997e8a929SArmin Le Grand 	SelectLineStyle();
31097e8a929SArmin Le Grand 	aLink = LINK( this, LinePropertyPanel, ChangeLineStyleHdl );
31197e8a929SArmin Le Grand 	mpLBStyle->SetSelectHdl( aLink );
31297e8a929SArmin Le Grand 	mpLBStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Style")));
31397e8a929SArmin Le Grand     mpLBStyle->SetDropDownLineCount(std::min(sal_uInt16(20), mpLBStyle->GetEntryCount()));
3148dcb2a10SAndre Fischer 
3158dcb2a10SAndre Fischer 	mpTBWidth->SetItemImage(TBI_WIDTH, mpIMGWidthIcon[0]);
3168dcb2a10SAndre Fischer 	aTbxSize = mpTBWidth->CalcWindowSizePixel() ;
3178dcb2a10SAndre Fischer 	mpTBWidth->SetOutputSizePixel( aTbxSize );
3188dcb2a10SAndre Fischer 	mpTBWidth->SetItemBits( TBI_WIDTH, mpTBWidth->GetItemBits( TBI_WIDTH ) | TIB_DROPDOWNONLY );
3198dcb2a10SAndre Fischer 	mpTBWidth->SetQuickHelpText(TBI_WIDTH,String(SVX_RES(STR_QH_TB_WIDTH))); //Add
3208dcb2a10SAndre Fischer 	mpTBWidth->SetBackground(Wallpaper());
3218dcb2a10SAndre Fischer 	mpTBWidth->SetPaintTransparent(true);
3228dcb2a10SAndre Fischer 	aLink = LINK(this, LinePropertyPanel, ToolboxWidthSelectHdl);
3238dcb2a10SAndre Fischer 	mpTBWidth->SetDropdownClickHdl ( aLink );
3248dcb2a10SAndre Fischer 	mpTBWidth->SetSelectHdl ( aLink );
3258dcb2a10SAndre Fischer 
3268dcb2a10SAndre Fischer 	FillLineEndList();
3278dcb2a10SAndre Fischer 	SelectEndStyle(true);
3288dcb2a10SAndre Fischer 	SelectEndStyle(false);
3298dcb2a10SAndre Fischer 	aLink = LINK( this, LinePropertyPanel, ChangeStartHdl );
3308dcb2a10SAndre Fischer 	mpLBStart->SetSelectHdl( aLink );
3318dcb2a10SAndre Fischer 	mpLBStart->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Beginning Style")));	//wj acc
332df46ddf6SArmin Le Grand     mpLBStart->SetDropDownLineCount(std::min(sal_uInt16(20), mpLBStart->GetEntryCount()));
3338dcb2a10SAndre Fischer 	aLink = LINK( this, LinePropertyPanel, ChangeEndHdl );
3348dcb2a10SAndre Fischer 	mpLBEnd->SetSelectHdl( aLink );
3358dcb2a10SAndre Fischer 	mpLBEnd->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Ending Style")));	//wj acc
336df46ddf6SArmin Le Grand     mpLBEnd->SetDropDownLineCount(std::min(sal_uInt16(20), mpLBEnd->GetEntryCount()));
3378dcb2a10SAndre Fischer 
3388dcb2a10SAndre Fischer 	aLink = LINK(this, LinePropertyPanel, ChangeTransparentHdl);
3398dcb2a10SAndre Fischer 	mpMFTransparent->SetModifyHdl(aLink);
3408dcb2a10SAndre Fischer 	mpMFTransparent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency")));	//wj acc
3418dcb2a10SAndre Fischer 
3428dcb2a10SAndre Fischer 	mpTBWidth->SetAccessibleRelationLabeledBy(mpFTWidth.get());
3438dcb2a10SAndre Fischer 	mpTBColor->SetAccessibleRelationLabeledBy(mpFTColor.get());
34497e8a929SArmin Le Grand     mpLBStyle->SetAccessibleRelationLabeledBy(mpFTStyle.get());
3458dcb2a10SAndre Fischer 	mpMFTransparent->SetAccessibleRelationLabeledBy(mpFTTrancparency.get());
3468dcb2a10SAndre Fischer 	mpLBStart->SetAccessibleRelationLabeledBy(mpFTArrow.get());
3478dcb2a10SAndre Fischer 	mpLBEnd->SetAccessibleRelationLabeledBy(mpLBEnd.get());
3488dcb2a10SAndre Fischer 
3498dcb2a10SAndre Fischer     aLink = LINK( this, LinePropertyPanel, ChangeEdgeStyleHdl );
3508dcb2a10SAndre Fischer     mpLBEdgeStyle->SetSelectHdl( aLink );
3518dcb2a10SAndre Fischer     mpLBEdgeStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Corner Style")));
3528dcb2a10SAndre Fischer 
3538dcb2a10SAndre Fischer     aLink = LINK( this, LinePropertyPanel, ChangeCapStyleHdl );
3548dcb2a10SAndre Fischer     mpLBCapStyle->SetSelectHdl( aLink );
3558dcb2a10SAndre Fischer     mpLBCapStyle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cap Style")));
3568dcb2a10SAndre Fischer }
3578dcb2a10SAndre Fischer 
3588dcb2a10SAndre Fischer 
3598dcb2a10SAndre Fischer 
3608dcb2a10SAndre Fischer void LinePropertyPanel::SetupIcons(void)
3618dcb2a10SAndre Fischer {
3628dcb2a10SAndre Fischer     if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons))
3638dcb2a10SAndre Fischer     {
3648dcb2a10SAndre Fischer         // todo
3658dcb2a10SAndre Fischer     }
3668dcb2a10SAndre Fischer     else
3678dcb2a10SAndre Fischer     {
3688dcb2a10SAndre Fischer         // todo
3698dcb2a10SAndre Fischer     }
3708dcb2a10SAndre Fischer }
3718dcb2a10SAndre Fischer 
3728dcb2a10SAndre Fischer 
3738dcb2a10SAndre Fischer 
3748dcb2a10SAndre Fischer LinePropertyPanel* LinePropertyPanel::Create (
3758dcb2a10SAndre Fischer     Window* pParent,
3768dcb2a10SAndre Fischer     const cssu::Reference<css::frame::XFrame>& rxFrame,
3778dcb2a10SAndre Fischer     SfxBindings* pBindings)
3788dcb2a10SAndre Fischer {
3798dcb2a10SAndre Fischer     if (pParent == NULL)
3808dcb2a10SAndre Fischer         throw lang::IllegalArgumentException(A2S("no parent Window given to LinePropertyPanel::Create"), NULL, 0);
3818dcb2a10SAndre Fischer     if ( ! rxFrame.is())
3828dcb2a10SAndre Fischer         throw lang::IllegalArgumentException(A2S("no XFrame given to LinePropertyPanel::Create"), NULL, 1);
3838dcb2a10SAndre Fischer     if (pBindings == NULL)
3848dcb2a10SAndre Fischer         throw lang::IllegalArgumentException(A2S("no SfxBindings given to LinePropertyPanel::Create"), NULL, 2);
3858dcb2a10SAndre Fischer 
3868dcb2a10SAndre Fischer     return new LinePropertyPanel(
3878dcb2a10SAndre Fischer         pParent,
3888dcb2a10SAndre Fischer         rxFrame,
3898dcb2a10SAndre Fischer         pBindings);
3908dcb2a10SAndre Fischer }
3918dcb2a10SAndre Fischer 
3928dcb2a10SAndre Fischer 
3938dcb2a10SAndre Fischer 
39437fee4fdSAndre Fischer 
3958dcb2a10SAndre Fischer void LinePropertyPanel::DataChanged(
3968dcb2a10SAndre Fischer     const DataChangedEvent& rEvent)
3978dcb2a10SAndre Fischer {
3988dcb2a10SAndre Fischer     (void)rEvent;
3998dcb2a10SAndre Fischer 
4008dcb2a10SAndre Fischer     SetupIcons();
4018dcb2a10SAndre Fischer }
4028dcb2a10SAndre Fischer 
4038dcb2a10SAndre Fischer 
4048dcb2a10SAndre Fischer 
4058dcb2a10SAndre Fischer 
4068dcb2a10SAndre Fischer void LinePropertyPanel::NotifyItemUpdate(
4078dcb2a10SAndre Fischer     sal_uInt16 nSID,
4088dcb2a10SAndre Fischer     SfxItemState eState,
4098dcb2a10SAndre Fischer     const SfxPoolItem* pState)
4108dcb2a10SAndre Fischer {
4118dcb2a10SAndre Fischer 	switch(nSID)
4128dcb2a10SAndre Fischer 	{
4138dcb2a10SAndre Fischer     	case SID_ATTR_LINE_COLOR:
4148dcb2a10SAndre Fischer         {
4158dcb2a10SAndre Fischer 		    if( eState == SFX_ITEM_DISABLED)
4168dcb2a10SAndre Fischer 		    {
4178dcb2a10SAndre Fischer 			    mpFTColor->Disable();
4188dcb2a10SAndre Fischer 			    mpTBColor->Disable();
4198dcb2a10SAndre Fischer 			    mbColorAvailable = false;
4208dcb2a10SAndre Fischer 			    mpColorUpdater->Update(COL_WHITE);
4218dcb2a10SAndre Fischer 		    }
4228dcb2a10SAndre Fischer 		    else
4238dcb2a10SAndre Fischer 		    {
4248dcb2a10SAndre Fischer 			    mpFTColor->Enable();
4258dcb2a10SAndre Fischer 			    mpTBColor->Enable();
4268dcb2a10SAndre Fischer                 const XLineColorItem* pItem = dynamic_cast< const XLineColorItem* >(pState);
4278dcb2a10SAndre Fischer 
4288dcb2a10SAndre Fischer 			    if(eState >= SFX_ITEM_DEFAULT && pItem)
4298dcb2a10SAndre Fischer 			    {
4308dcb2a10SAndre Fischer 				    maColor = pItem->GetColorValue();
4318dcb2a10SAndre Fischer 				    mbColorAvailable = true;
4328dcb2a10SAndre Fischer 				    mpColorUpdater->Update(maColor);
4338dcb2a10SAndre Fischer 			    }
4348dcb2a10SAndre Fischer 			    else
4358dcb2a10SAndre Fischer 			    {
4368dcb2a10SAndre Fischer 				    mbColorAvailable = false;
4378dcb2a10SAndre Fischer 				    mpColorUpdater->Update(COL_WHITE);
4388dcb2a10SAndre Fischer 			    }
4398dcb2a10SAndre Fischer 		    }
4408dcb2a10SAndre Fischer 		    break;
4418dcb2a10SAndre Fischer         }
4428dcb2a10SAndre Fischer 	    case SID_ATTR_LINE_DASH:
44397e8a929SArmin Le Grand 	    case SID_ATTR_LINE_STYLE:
4448dcb2a10SAndre Fischer         {
4458dcb2a10SAndre Fischer 		    if( eState == SFX_ITEM_DISABLED)
4468dcb2a10SAndre Fischer 		    {
4478dcb2a10SAndre Fischer 			    mpFTStyle->Disable();
44897e8a929SArmin Le Grand                 mpLBStyle->Disable();
4498dcb2a10SAndre Fischer 		    }
4508dcb2a10SAndre Fischer 		    else
4518dcb2a10SAndre Fischer 		    {
4528dcb2a10SAndre Fischer 			    mpFTStyle->Enable();
45397e8a929SArmin Le Grand                 mpLBStyle->Enable();
4548dcb2a10SAndre Fischer 			    if( eState  >= SFX_ITEM_DEFAULT )
4558dcb2a10SAndre Fischer 			    {
4568dcb2a10SAndre Fischer 				    if(nSID == SID_ATTR_LINE_STYLE)
4578dcb2a10SAndre Fischer 				    {
4588dcb2a10SAndre Fischer                         const XLineStyleItem* pItem = dynamic_cast< const XLineStyleItem* >(pState);
4598dcb2a10SAndre Fischer 
4608dcb2a10SAndre Fischer                         if(pItem)
4618dcb2a10SAndre Fischer                         {
4628dcb2a10SAndre Fischer 					        mbStyleAvailable =true;
4638dcb2a10SAndre Fischer     					    mpStyleItem.reset(pState ? (XLineStyleItem*)pItem->Clone() : 0);
4648dcb2a10SAndre Fischer                         }
4658dcb2a10SAndre Fischer 				    }
4668dcb2a10SAndre Fischer 				    else if(nSID == SID_ATTR_LINE_DASH)
4678dcb2a10SAndre Fischer 				    {
4688dcb2a10SAndre Fischer                         const XLineDashItem* pItem = dynamic_cast< const XLineDashItem* >(pState);
4698dcb2a10SAndre Fischer 
4708dcb2a10SAndre Fischer                         if(pItem)
4718dcb2a10SAndre Fischer                         {
4728dcb2a10SAndre Fischer     					    mbDashAvailable = true;
4738dcb2a10SAndre Fischer 	    				    mpDashItem.reset(pState ? (XLineDashItem*)pItem->Clone() : 0);
4748dcb2a10SAndre Fischer                         }
4758dcb2a10SAndre Fischer 				    }
4768dcb2a10SAndre Fischer 			    }
4778dcb2a10SAndre Fischer 			    else
4788dcb2a10SAndre Fischer 			    {
4798dcb2a10SAndre Fischer 				    if(nSID == SID_ATTR_LINE_STYLE)
4808dcb2a10SAndre Fischer 					    mbStyleAvailable = false;
4818dcb2a10SAndre Fischer 				    else
4828dcb2a10SAndre Fischer 					    mbDashAvailable = false;
4838dcb2a10SAndre Fischer 			    }
48497e8a929SArmin Le Grand 
48597e8a929SArmin Le Grand                 SelectLineStyle();
4868dcb2a10SAndre Fischer 		    }
4878dcb2a10SAndre Fischer 		    break;
4888dcb2a10SAndre Fischer         }
4898dcb2a10SAndre Fischer     	case SID_ATTR_LINE_TRANSPARENCE:
4908dcb2a10SAndre Fischer         {
4918dcb2a10SAndre Fischer 		    if( eState == SFX_ITEM_DISABLED )
4928dcb2a10SAndre Fischer 		    {
4938dcb2a10SAndre Fischer 			    mpFTTrancparency->Disable();
4948dcb2a10SAndre Fischer 			    mpMFTransparent->Disable();
4958dcb2a10SAndre Fischer 			    mpMFTransparent->SetValue(0);//add
4968dcb2a10SAndre Fischer 			    mpMFTransparent->SetText(String());
4978dcb2a10SAndre Fischer 			    mbTransAvailable = false;
4988dcb2a10SAndre Fischer 		    }
4998dcb2a10SAndre Fischer 		    else
5008dcb2a10SAndre Fischer 		    {
5018dcb2a10SAndre Fischer 			    mpFTTrancparency->Enable();
5028dcb2a10SAndre Fischer 			    mpMFTransparent->Enable();
5038dcb2a10SAndre Fischer 			    mbTransAvailable = true;
5048dcb2a10SAndre Fischer                 const XLineTransparenceItem* pItem = dynamic_cast< const XLineTransparenceItem* >(pState);
5058dcb2a10SAndre Fischer 
5068dcb2a10SAndre Fischer                 if(eState != SFX_ITEM_DONTCARE && pItem)
5078dcb2a10SAndre Fischer 			    {
5088dcb2a10SAndre Fischer 				    mnTrans = pItem->GetValue();
5098dcb2a10SAndre Fischer 				    mpMFTransparent->SetValue(mnTrans);
5108dcb2a10SAndre Fischer 			    }
5118dcb2a10SAndre Fischer 			    else
5128dcb2a10SAndre Fischer 			    {
5138dcb2a10SAndre Fischer 				    mpMFTransparent->SetValue(0);//add
5148dcb2a10SAndre Fischer 				    mpMFTransparent->SetText(String());
5158dcb2a10SAndre Fischer 			    }
5168dcb2a10SAndre Fischer 		    }
5178dcb2a10SAndre Fischer 		    break;
5188dcb2a10SAndre Fischer         }
5198dcb2a10SAndre Fischer     	case SID_ATTR_LINE_WIDTH:
5208dcb2a10SAndre Fischer         {
5218dcb2a10SAndre Fischer 		    if(eState == SFX_ITEM_DISABLED)
5228dcb2a10SAndre Fischer 		    {
5238dcb2a10SAndre Fischer 			    mpTBWidth->Disable();
5248dcb2a10SAndre Fischer 			    mpFTWidth->Disable();
5258dcb2a10SAndre Fischer 		    }
5268dcb2a10SAndre Fischer 		    else
5278dcb2a10SAndre Fischer 		    {
5288dcb2a10SAndre Fischer 			    //enable
5298dcb2a10SAndre Fischer 			    mpTBWidth->Enable();
5308dcb2a10SAndre Fischer 			    mpFTWidth->Enable();
5318dcb2a10SAndre Fischer                 const XLineWidthItem* pItem = dynamic_cast< const XLineWidthItem* >(pState);
5328dcb2a10SAndre Fischer 
5338dcb2a10SAndre Fischer 			    if(eState >= SFX_ITEM_AVAILABLE && pItem)
5348dcb2a10SAndre Fischer 			    {
5358dcb2a10SAndre Fischer 				    mnWidthCoreValue = pItem->GetValue();
5368dcb2a10SAndre Fischer 				    mbWidthValuable = true;
5378dcb2a10SAndre Fischer 			    }
5388dcb2a10SAndre Fischer 			    else
5398dcb2a10SAndre Fischer 			    {
5408dcb2a10SAndre Fischer 				    mbWidthValuable = false;
5418dcb2a10SAndre Fischer 			    }
5428dcb2a10SAndre Fischer 		    }
5438dcb2a10SAndre Fischer 		    SetWidthIcon();
5448dcb2a10SAndre Fischer 		    break;
5458dcb2a10SAndre Fischer         }
5468dcb2a10SAndre Fischer     	case SID_ATTR_LINE_START:
5478dcb2a10SAndre Fischer         {
548a567bdc8SArmin Le Grand 		    mpFTArrow->Enable();
549a567bdc8SArmin Le Grand 		    mpLBStart->Enable();
550a567bdc8SArmin Le Grand 
551a567bdc8SArmin Le Grand 		    if(eState != SFX_ITEM_DONTCARE)
552a567bdc8SArmin Le Grand 		    {
5538dcb2a10SAndre Fischer                 const XLineStartItem* pItem = dynamic_cast< const XLineStartItem* >(pState);
5548dcb2a10SAndre Fischer 
555a567bdc8SArmin Le Grand                 if(pItem)
5568dcb2a10SAndre Fischer                 {
5578dcb2a10SAndre Fischer 			        mbStartAvailable = true;	//add
5588dcb2a10SAndre Fischer 			        mpStartItem.reset(pItem ? (XLineStartItem*)pItem->Clone() : 0);
5598dcb2a10SAndre Fischer 			        SelectEndStyle(true);
560a567bdc8SArmin Le Grand                     break;
5618dcb2a10SAndre Fischer                 }
562a567bdc8SArmin Le Grand 		    }
563a567bdc8SArmin Le Grand 
5648dcb2a10SAndre Fischer             mpLBStart->SetNoSelection();
5658dcb2a10SAndre Fischer 			mbStartAvailable = false;	//add
5668dcb2a10SAndre Fischer 		    break;
5678dcb2a10SAndre Fischer         }
5688dcb2a10SAndre Fischer     	case SID_ATTR_LINE_END:
5698dcb2a10SAndre Fischer         {
5708dcb2a10SAndre Fischer 		    mpFTArrow->Enable();
5718dcb2a10SAndre Fischer 		    mpLBEnd->Enable();
572a567bdc8SArmin Le Grand 
573a567bdc8SArmin Le Grand 		    if(eState != SFX_ITEM_DONTCARE)
574a567bdc8SArmin Le Grand 		    {
5758dcb2a10SAndre Fischer                 const XLineEndItem* pItem = dynamic_cast< const XLineEndItem* >(pState);
5768dcb2a10SAndre Fischer 
577a567bdc8SArmin Le Grand                 if(pItem)
5788dcb2a10SAndre Fischer                 {
5798dcb2a10SAndre Fischer 			        mbEndAvailable = true;		//add
5808dcb2a10SAndre Fischer 			        mpEndItem.reset(pItem ? (XLineEndItem*)pItem->Clone() : 0);
5818dcb2a10SAndre Fischer 			        SelectEndStyle(false);
582a567bdc8SArmin Le Grand                     break;
5838dcb2a10SAndre Fischer                 }
584a567bdc8SArmin Le Grand 		    }
585a567bdc8SArmin Le Grand 
5868dcb2a10SAndre Fischer             mpLBEnd->SetNoSelection();
5878dcb2a10SAndre Fischer 			mbEndAvailable = false;		//add
5888dcb2a10SAndre Fischer 		    break;
5898dcb2a10SAndre Fischer         }
5908dcb2a10SAndre Fischer     	case SID_LINEEND_LIST:
5918dcb2a10SAndre Fischer         {
5928dcb2a10SAndre Fischer 		    FillLineEndList();
5938dcb2a10SAndre Fischer 		    SelectEndStyle(true);
5948dcb2a10SAndre Fischer 		    SelectEndStyle(false);
5958dcb2a10SAndre Fischer 		    break;
5968dcb2a10SAndre Fischer         }
59797e8a929SArmin Le Grand     	case SID_DASH_LIST:
59897e8a929SArmin Le Grand         {
59997e8a929SArmin Le Grand 		    FillLineStyleList();
60097e8a929SArmin Le Grand 		    SelectLineStyle();
60197e8a929SArmin Le Grand 		    break;
60297e8a929SArmin Le Grand         }
6038dcb2a10SAndre Fischer         case SID_ATTR_LINE_JOINT:
6048dcb2a10SAndre Fischer         {
6058dcb2a10SAndre Fischer             if(eState == SFX_ITEM_DISABLED)
6068dcb2a10SAndre Fischer             {
6078dcb2a10SAndre Fischer                 mpLBEdgeStyle->Disable();
6088dcb2a10SAndre Fischer             }
6098dcb2a10SAndre Fischer             else
6108dcb2a10SAndre Fischer             {
6118dcb2a10SAndre Fischer                 mpLBEdgeStyle->Enable();
6128dcb2a10SAndre Fischer                 const XLineJointItem* pItem = dynamic_cast< const XLineJointItem* >(pState);
6138dcb2a10SAndre Fischer                 sal_uInt16 nEntryPos(0);
6148dcb2a10SAndre Fischer 
6158dcb2a10SAndre Fischer                 if(eState >= SFX_ITEM_AVAILABLE && pItem)
6168dcb2a10SAndre Fischer                 {
6178dcb2a10SAndre Fischer                     switch(pItem->GetValue())
6188dcb2a10SAndre Fischer                     {
6198dcb2a10SAndre Fischer                         case com::sun::star::drawing::LineJoint_MIDDLE:
6208dcb2a10SAndre Fischer                         case com::sun::star::drawing::LineJoint_ROUND:
6218dcb2a10SAndre Fischer                         {
6228dcb2a10SAndre Fischer                             nEntryPos = 1;
6238dcb2a10SAndre Fischer                             break;
6248dcb2a10SAndre Fischer                         }
6258dcb2a10SAndre Fischer                         case com::sun::star::drawing::LineJoint_NONE:
6268dcb2a10SAndre Fischer                         {
6278dcb2a10SAndre Fischer                             nEntryPos = 2;
6288dcb2a10SAndre Fischer                             break;
6298dcb2a10SAndre Fischer                         }
6308dcb2a10SAndre Fischer                         case com::sun::star::drawing::LineJoint_MITER:
6318dcb2a10SAndre Fischer                         {
6328dcb2a10SAndre Fischer                             nEntryPos = 3;
6338dcb2a10SAndre Fischer                             break;
6348dcb2a10SAndre Fischer                         }
6358dcb2a10SAndre Fischer                         case com::sun::star::drawing::LineJoint_BEVEL:
6368dcb2a10SAndre Fischer                         {
6378dcb2a10SAndre Fischer                             nEntryPos = 4;
6388dcb2a10SAndre Fischer                             break;
6398dcb2a10SAndre Fischer                         }
6408dcb2a10SAndre Fischer 
6418dcb2a10SAndre Fischer                         default:
6428dcb2a10SAndre Fischer                             break;
6438dcb2a10SAndre Fischer                     }
6448dcb2a10SAndre Fischer                 }
6458dcb2a10SAndre Fischer 
6468dcb2a10SAndre Fischer                 if(nEntryPos)
6478dcb2a10SAndre Fischer                 {
6488dcb2a10SAndre Fischer                     mpLBEdgeStyle->SelectEntryPos(nEntryPos - 1);
6498dcb2a10SAndre Fischer                 }
6508dcb2a10SAndre Fischer                 else
6518dcb2a10SAndre Fischer                 {
6528dcb2a10SAndre Fischer                     mpLBEdgeStyle->SetNoSelection();
6538dcb2a10SAndre Fischer                 }
6548dcb2a10SAndre Fischer             }
6558dcb2a10SAndre Fischer             break;
6568dcb2a10SAndre Fischer         }
6578dcb2a10SAndre Fischer         case SID_ATTR_LINE_CAP:
6588dcb2a10SAndre Fischer         {
6598dcb2a10SAndre Fischer             if(eState == SFX_ITEM_DISABLED)
6608dcb2a10SAndre Fischer             {
6618dcb2a10SAndre Fischer                 mpLBCapStyle->Disable();
6628dcb2a10SAndre Fischer             }
6638dcb2a10SAndre Fischer             else
6648dcb2a10SAndre Fischer             {
6658dcb2a10SAndre Fischer                 mpLBCapStyle->Enable();
6668dcb2a10SAndre Fischer                 const XLineCapItem* pItem = dynamic_cast< const XLineCapItem* >(pState);
6678dcb2a10SAndre Fischer                 sal_uInt16 nEntryPos(0);
6688dcb2a10SAndre Fischer 
6698dcb2a10SAndre Fischer                 if(eState >= SFX_ITEM_AVAILABLE && pItem)
6708dcb2a10SAndre Fischer                 {
6718dcb2a10SAndre Fischer                     switch(pItem->GetValue())
6728dcb2a10SAndre Fischer                     {
6738dcb2a10SAndre Fischer                         case com::sun::star::drawing::LineCap_BUTT:
6748dcb2a10SAndre Fischer                         {
6758dcb2a10SAndre Fischer                             nEntryPos = 1;
6768dcb2a10SAndre Fischer                             break;
6778dcb2a10SAndre Fischer                         }
6788dcb2a10SAndre Fischer                         case com::sun::star::drawing::LineCap_ROUND:
6798dcb2a10SAndre Fischer                         {
6808dcb2a10SAndre Fischer                             nEntryPos = 2;
6818dcb2a10SAndre Fischer                             break;
6828dcb2a10SAndre Fischer                         }
6838dcb2a10SAndre Fischer                         case com::sun::star::drawing::LineCap_SQUARE:
6848dcb2a10SAndre Fischer                         {
6858dcb2a10SAndre Fischer                             nEntryPos = 3;
6868dcb2a10SAndre Fischer                             break;
6878dcb2a10SAndre Fischer                         }
6888dcb2a10SAndre Fischer 
6898dcb2a10SAndre Fischer                         default:
6908dcb2a10SAndre Fischer                             break;
6918dcb2a10SAndre Fischer                     }
6928dcb2a10SAndre Fischer                 }
6938dcb2a10SAndre Fischer 
6948dcb2a10SAndre Fischer                 if(nEntryPos)
6958dcb2a10SAndre Fischer                 {
6968dcb2a10SAndre Fischer                     mpLBCapStyle->SelectEntryPos(nEntryPos - 1);
6978dcb2a10SAndre Fischer                 }
6988dcb2a10SAndre Fischer                 else
6998dcb2a10SAndre Fischer                 {
7008dcb2a10SAndre Fischer                     mpLBCapStyle->SetNoSelection();
7018dcb2a10SAndre Fischer                 }
7028dcb2a10SAndre Fischer             }
7038dcb2a10SAndre Fischer             break;
7048dcb2a10SAndre Fischer         }
7058dcb2a10SAndre Fischer     }
7068dcb2a10SAndre Fischer }
7078dcb2a10SAndre Fischer 
7088dcb2a10SAndre Fischer 
7098dcb2a10SAndre Fischer 
7108dcb2a10SAndre Fischer SfxBindings* LinePropertyPanel::GetBindings()
7118dcb2a10SAndre Fischer {
7128dcb2a10SAndre Fischer     return mpBindings;
7138dcb2a10SAndre Fischer }
7148dcb2a10SAndre Fischer 
7158dcb2a10SAndre Fischer 
7168dcb2a10SAndre Fischer 
7178dcb2a10SAndre Fischer IMPL_LINK( LinePropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
7188dcb2a10SAndre Fischer {
7198dcb2a10SAndre Fischer 	return 0;
7208dcb2a10SAndre Fischer }
7218dcb2a10SAndre Fischer 
7228dcb2a10SAndre Fischer 
7238dcb2a10SAndre Fischer 
7248dcb2a10SAndre Fischer 
7258dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ToolboxColorSelectHdl,ToolBox*, pToolBox)
7268dcb2a10SAndre Fischer {
7278dcb2a10SAndre Fischer 	sal_uInt16 nId = pToolBox->GetCurItemId();
7288dcb2a10SAndre Fischer 	if(nId == TBI_COLOR)
7298dcb2a10SAndre Fischer 	{
7308dcb2a10SAndre Fischer         maColorPopup.Show(*pToolBox);
7318dcb2a10SAndre Fischer         maColorPopup.SetCurrentColor(maColor, mbColorAvailable);
7328dcb2a10SAndre Fischer 	}
7338dcb2a10SAndre Fischer 	return 0;
7348dcb2a10SAndre Fischer }
7358dcb2a10SAndre Fischer 
7368dcb2a10SAndre Fischer 
7378dcb2a10SAndre Fischer 
7388dcb2a10SAndre Fischer 
7397134ea5bSPavel Janík IMPL_LINK(LinePropertyPanel, ChangeLineStyleHdl, ToolBox*, /* pToolBox */)
7408dcb2a10SAndre Fischer {
74197e8a929SArmin Le Grand     const sal_uInt16 nPos(mpLBStyle->GetSelectEntryPos());
74297e8a929SArmin Le Grand 
74397e8a929SArmin Le Grand     if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBStyle->GetSavedValue())
7448dcb2a10SAndre Fischer     {
74597e8a929SArmin Le Grand         if(0 == nPos)
74697e8a929SArmin Le Grand         {
74797e8a929SArmin Le Grand             // XLINE_NONE
74897e8a929SArmin Le Grand             const XLineStyleItem aItem(XLINE_NONE);
74997e8a929SArmin Le Grand 
75097e8a929SArmin Le Grand             GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L);
7518dcb2a10SAndre Fischer         }
75297e8a929SArmin Le Grand         else if(1 == nPos)
75397e8a929SArmin Le Grand         {
75497e8a929SArmin Le Grand             // XLINE_SOLID
75597e8a929SArmin Le Grand             const XLineStyleItem aItem(XLINE_SOLID);
75697e8a929SArmin Le Grand 
75797e8a929SArmin Le Grand             GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L);
75897e8a929SArmin Le Grand         }
75997e8a929SArmin Le Grand         else if(mpLineStyleList && mpLineStyleList->Count() > (long)(nPos - 2))
76097e8a929SArmin Le Grand         {
76197e8a929SArmin Le Grand             // XLINE_DASH
76297e8a929SArmin Le Grand             const XLineStyleItem aItemA(XLINE_DASH);
763*c3c0ed1bSArmin Le Grand             const XDashEntry* pDashEntry = mpLineStyleList->GetDash(nPos - 2);
764*c3c0ed1bSArmin Le Grand             OSL_ENSURE(pDashEntry, "OOps, got empty XDash from XDashList (!)");
765*c3c0ed1bSArmin Le Grand             const XLineDashItem aItemB(
766*c3c0ed1bSArmin Le Grand                 pDashEntry ? pDashEntry->GetName() : String(),
767*c3c0ed1bSArmin Le Grand                 pDashEntry ? pDashEntry->GetDash() : XDash());
76897e8a929SArmin Le Grand 
76997e8a929SArmin Le Grand             GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItemA, 0L);
77097e8a929SArmin Le Grand             GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_DASH, SFX_CALLMODE_RECORD, &aItemB, 0L);
77197e8a929SArmin Le Grand         }
7728dcb2a10SAndre Fischer     }
7738dcb2a10SAndre Fischer 
77497e8a929SArmin Le Grand     return 0;
77597e8a929SArmin Le Grand }
7768dcb2a10SAndre Fischer 
7778dcb2a10SAndre Fischer 
7788dcb2a10SAndre Fischer 
7798dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ChangeStartHdl, void*, EMPTYARG)
7808dcb2a10SAndre Fischer {
7818dcb2a10SAndre Fischer 	sal_uInt16	nPos = mpLBStart->GetSelectEntryPos();
7828dcb2a10SAndre Fischer 	if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != mpLBStart->GetSavedValue() )
7838dcb2a10SAndre Fischer 	{
7848dcb2a10SAndre Fischer 		XLineStartItem* pItem = NULL;
7858dcb2a10SAndre Fischer 		if( nPos == 0 )
7868dcb2a10SAndre Fischer 			pItem = new XLineStartItem();
7878dcb2a10SAndre Fischer 		else if( mpLineEndList && mpLineEndList->Count() > (long) ( nPos - 1 ) )
7888dcb2a10SAndre Fischer 			pItem = new XLineStartItem( mpLBStart->GetSelectEntry(),mpLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() );
7898dcb2a10SAndre Fischer 		GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SFX_CALLMODE_RECORD, pItem,  0L);
7908dcb2a10SAndre Fischer 		delete pItem;
7918dcb2a10SAndre Fischer 	}
7928dcb2a10SAndre Fischer 	return 0;
7938dcb2a10SAndre Fischer }
7948dcb2a10SAndre Fischer 
7958dcb2a10SAndre Fischer 
7968dcb2a10SAndre Fischer 
7978dcb2a10SAndre Fischer 
7988dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ChangeEndHdl, void*, EMPTYARG)
7998dcb2a10SAndre Fischer {
8008dcb2a10SAndre Fischer 	sal_uInt16	nPos = mpLBEnd->GetSelectEntryPos();
8018dcb2a10SAndre Fischer 	if( nPos != LISTBOX_ENTRY_NOTFOUND && nPos != mpLBEnd->GetSavedValue() )
8028dcb2a10SAndre Fischer 	{
8038dcb2a10SAndre Fischer 		XLineEndItem* pItem = NULL;
8048dcb2a10SAndre Fischer 		if( nPos == 0 )
8058dcb2a10SAndre Fischer 			pItem = new XLineEndItem();
8068dcb2a10SAndre Fischer 		else if( mpLineEndList && mpLineEndList->Count() > (long) ( nPos - 1 ) )
8078dcb2a10SAndre Fischer 			pItem = new XLineEndItem( mpLBEnd->GetSelectEntry(), mpLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() );
8088dcb2a10SAndre Fischer 		GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINEEND_STYLE, SFX_CALLMODE_RECORD, pItem,  0L);
8098dcb2a10SAndre Fischer 		delete pItem;
8108dcb2a10SAndre Fischer 	}
8118dcb2a10SAndre Fischer 	return 0;
8128dcb2a10SAndre Fischer }
8138dcb2a10SAndre Fischer 
8148dcb2a10SAndre Fischer 
8158dcb2a10SAndre Fischer 
8168dcb2a10SAndre Fischer 
8178dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ChangeEdgeStyleHdl, void*, EMPTYARG)
8188dcb2a10SAndre Fischer {
8198dcb2a10SAndre Fischer     const sal_uInt16 nPos(mpLBEdgeStyle->GetSelectEntryPos());
8208dcb2a10SAndre Fischer 
8218dcb2a10SAndre Fischer     if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBEdgeStyle->GetSavedValue())
8228dcb2a10SAndre Fischer     {
8238dcb2a10SAndre Fischer         XLineJointItem* pItem = 0;
8248dcb2a10SAndre Fischer 
8258dcb2a10SAndre Fischer         switch(nPos)
8268dcb2a10SAndre Fischer         {
8278dcb2a10SAndre Fischer             case 0: // rounded
8288dcb2a10SAndre Fischer             {
8298dcb2a10SAndre Fischer                 pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_ROUND);
8308dcb2a10SAndre Fischer                 break;
8318dcb2a10SAndre Fischer             }
8328dcb2a10SAndre Fischer             case 1: // none
8338dcb2a10SAndre Fischer             {
8348dcb2a10SAndre Fischer                 pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_NONE);
8358dcb2a10SAndre Fischer                 break;
8368dcb2a10SAndre Fischer             }
8378dcb2a10SAndre Fischer             case 2: // mitered
8388dcb2a10SAndre Fischer             {
8398dcb2a10SAndre Fischer                 pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_MITER);
8408dcb2a10SAndre Fischer                 break;
8418dcb2a10SAndre Fischer             }
8428dcb2a10SAndre Fischer             case 3: // beveled
8438dcb2a10SAndre Fischer             {
8448dcb2a10SAndre Fischer                 pItem = new XLineJointItem(com::sun::star::drawing::LineJoint_BEVEL);
8458dcb2a10SAndre Fischer                 break;
8468dcb2a10SAndre Fischer             }
8478dcb2a10SAndre Fischer         }
8488dcb2a10SAndre Fischer 
8498dcb2a10SAndre Fischer         GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_JOINT, SFX_CALLMODE_RECORD, pItem,  0L);
8508dcb2a10SAndre Fischer         delete pItem;
8518dcb2a10SAndre Fischer     }
8528dcb2a10SAndre Fischer     return 0;
8538dcb2a10SAndre Fischer }
8548dcb2a10SAndre Fischer 
8558dcb2a10SAndre Fischer 
8568dcb2a10SAndre Fischer 
8578dcb2a10SAndre Fischer 
8588dcb2a10SAndre Fischer IMPL_LINK(LinePropertyPanel, ChangeCapStyleHdl, void*, EMPTYARG)
8598dcb2a10SAndre Fischer {
8608dcb2a10SAndre Fischer     const sal_uInt16 nPos(mpLBCapStyle->GetSelectEntryPos());
8618dcb2a10SAndre Fischer 
8628dcb2a10SAndre Fischer     if(LISTBOX_ENTRY_NOTFOUND != nPos && nPos != mpLBCapStyle->GetSavedValue())
8638dcb2a10SAndre Fischer     {
8648dcb2a10SAndre Fischer         XLineCapItem* pItem = 0;
8658dcb2a10SAndre Fischer 
8668dcb2a10SAndre Fischer         switch(nPos)
8678dcb2a10SAndre Fischer         {
8688dcb2a10SAndre Fischer             case 0: // flat
8698dcb2a10SAndre Fischer             {
8708dcb2a10SAndre Fischer                 pItem = new XLineCapItem(com::sun::star::drawing::LineCap_BUTT);
8718dcb2a10SAndre Fischer                 break;
8728dcb2a10SAndre Fischer             }
8738dcb2a10SAndre Fischer             case 1: // round
8748dcb2a10SAndre Fischer             {
8758dcb2a10SAndre Fischer                 pItem = new XLineCapItem(com::sun::star::drawing::LineCap_ROUND);
8768dcb2a10SAndre Fischer                 break;
8778dcb2a10SAndre Fischer             }
8788dcb2a10SAndre Fischer             case 2: // square
8798dcb2a10SAndre Fischer             {
8808dcb2a10SAndre Fischer                 pItem = new XLineCapItem(com::sun::star::drawing::LineCap_SQUARE);
8818dcb2a10SAndre Fischer                 break;
8828dcb2a10SAndre Fischer             }
8838dcb2a10SAndre Fischer         }
8848dcb2a10SAndre Fischer 
8858dcb2a10SAndre Fischer         GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_CAP, 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, ToolboxWidthSelectHdl,ToolBox*, pToolBox)
8958dcb2a10SAndre Fischer {
8968dcb2a10SAndre Fischer 	if (pToolBox->GetCurItemId() == TBI_WIDTH)
8978dcb2a10SAndre Fischer 	{
8988dcb2a10SAndre Fischer 		maLineWidthPopup.SetWidthSelect(mnWidthCoreValue, mbWidthValuable, meMapUnit);
8998dcb2a10SAndre Fischer         maLineWidthPopup.Show(*pToolBox);
9008dcb2a10SAndre Fischer 	}
9018dcb2a10SAndre Fischer 	return 0;
9028dcb2a10SAndre Fischer }
9038dcb2a10SAndre Fischer 
9048dcb2a10SAndre Fischer 
9058dcb2a10SAndre Fischer 
9068dcb2a10SAndre Fischer 
9078dcb2a10SAndre Fischer IMPL_LINK( LinePropertyPanel, ChangeTransparentHdl, void *, EMPTYARG )
9088dcb2a10SAndre Fischer {
9098dcb2a10SAndre Fischer 	sal_uInt16 nVal = (sal_uInt16)mpMFTransparent->GetValue();
9108dcb2a10SAndre Fischer 	XLineTransparenceItem aItem( nVal );
9118dcb2a10SAndre Fischer 
9128dcb2a10SAndre Fischer 	GetBindings()->GetDispatcher()->Execute(SID_ATTR_LINE_STYLE, SFX_CALLMODE_RECORD, &aItem, 0L);
9138dcb2a10SAndre Fischer 	return( 0L );
9148dcb2a10SAndre Fischer }
9158dcb2a10SAndre Fischer 
9168dcb2a10SAndre Fischer 
9178dcb2a10SAndre Fischer 
9188dcb2a10SAndre Fischer 
9198dcb2a10SAndre Fischer PopupControl* LinePropertyPanel::CreateColorPopupControl (PopupContainer* pParent)
9208dcb2a10SAndre Fischer {
9218a383445SArmin Le Grand     const ResId aResId(SVX_RES(STR_AUTOMATICE));
9228a383445SArmin Le Grand 
9238dcb2a10SAndre Fischer     return new ColorControl(
9248dcb2a10SAndre Fischer         pParent,
9258dcb2a10SAndre Fischer         mpBindings,
9268dcb2a10SAndre Fischer         SVX_RES(RID_POPUPPANEL_LINEPAGE_COLOR),
9278dcb2a10SAndre Fischer         SVX_RES(VS_COLOR),
9288dcb2a10SAndre Fischer         ::boost::bind(GetTransparentColor),
9298dcb2a10SAndre Fischer         ::boost::bind(&LinePropertyPanel::SetColor, this, _1, _2),
9308dcb2a10SAndre Fischer         pParent,
9318a383445SArmin Le Grand         &aResId);
9328dcb2a10SAndre Fischer }
9338dcb2a10SAndre Fischer 
9348dcb2a10SAndre Fischer 
9358dcb2a10SAndre Fischer 
9368dcb2a10SAndre Fischer 
9378dcb2a10SAndre Fischer PopupControl* LinePropertyPanel::CreateLineWidthPopupControl (PopupContainer* pParent)
9388dcb2a10SAndre Fischer {
9398dcb2a10SAndre Fischer     return new LineWidthControl(pParent, *this);
9408dcb2a10SAndre Fischer }
9418dcb2a10SAndre Fischer 
9428dcb2a10SAndre Fischer 
9438dcb2a10SAndre Fischer 
9448dcb2a10SAndre Fischer 
9458dcb2a10SAndre Fischer void LinePropertyPanel::EndLineWidthPopupMode (void)
9468dcb2a10SAndre Fischer {
9478dcb2a10SAndre Fischer     maLineWidthPopup.Hide();
9488dcb2a10SAndre Fischer }
9498dcb2a10SAndre Fischer 
9508dcb2a10SAndre Fischer 
9518dcb2a10SAndre Fischer 
9528dcb2a10SAndre Fischer 
9538dcb2a10SAndre Fischer void LinePropertyPanel::SetWidthIcon(int n)
9548dcb2a10SAndre Fischer {
9558dcb2a10SAndre Fischer 	if(n==0)
9568dcb2a10SAndre Fischer 		mpTBWidth->SetItemImage( TBI_WIDTH, maIMGNone);
9578dcb2a10SAndre Fischer 	else
9588dcb2a10SAndre Fischer 		mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[n-1] : mpIMGWidthIcon[n-1]);
9598dcb2a10SAndre Fischer }
9608dcb2a10SAndre Fischer 
9618dcb2a10SAndre Fischer 
9628dcb2a10SAndre Fischer 
9638dcb2a10SAndre Fischer void LinePropertyPanel::SetWidthIcon()
9648dcb2a10SAndre Fischer {
9658dcb2a10SAndre Fischer 	if(!mbWidthValuable)
9668dcb2a10SAndre Fischer 	{
9678dcb2a10SAndre Fischer 		mpTBWidth->SetItemImage( TBI_WIDTH, maIMGNone);
9688dcb2a10SAndre Fischer 		return;
9698dcb2a10SAndre Fischer 	}
9708dcb2a10SAndre Fischer 
9718dcb2a10SAndre Fischer 	long nVal = LogicToLogic(mnWidthCoreValue * 10,(MapUnit)meMapUnit , MAP_POINT);
9728dcb2a10SAndre Fischer 
9738dcb2a10SAndre Fischer 	if(nVal <= 6)
9748dcb2a10SAndre Fischer 		mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[0] : mpIMGWidthIcon[0]);
9758dcb2a10SAndre Fischer 	else if(nVal > 6 && nVal <= 9)
9768dcb2a10SAndre Fischer 		mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[1] : mpIMGWidthIcon[1]);
9778dcb2a10SAndre Fischer 	else if(nVal > 9 && nVal <= 12)
9788dcb2a10SAndre Fischer 		mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[2] : mpIMGWidthIcon[2]);
9798dcb2a10SAndre Fischer 	else if(nVal > 12 && nVal <= 19)
9808dcb2a10SAndre Fischer 		mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[3] : mpIMGWidthIcon[3]);
9818dcb2a10SAndre Fischer 	else if(nVal > 19 && nVal <= 26)
9828dcb2a10SAndre Fischer 		mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[4] : mpIMGWidthIcon[4]);
9838dcb2a10SAndre Fischer 	else if(nVal > 26 && nVal <= 37)
9848dcb2a10SAndre Fischer 		mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[5] : mpIMGWidthIcon[5]);
9858dcb2a10SAndre Fischer 	else if(nVal > 37 && nVal <=52)
9868dcb2a10SAndre Fischer 		mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[6] : mpIMGWidthIcon[6]);
9878dcb2a10SAndre Fischer 	else if(nVal > 52)
9888dcb2a10SAndre Fischer 		mpTBWidth->SetItemImage( TBI_WIDTH, GetDisplayBackground().GetColor().IsDark() ? mpIMGWidthIconH[7] : mpIMGWidthIcon[7]);
9898dcb2a10SAndre Fischer 
9908dcb2a10SAndre Fischer }
9918dcb2a10SAndre Fischer 
9928dcb2a10SAndre Fischer 
9938dcb2a10SAndre Fischer 
9948dcb2a10SAndre Fischer void LinePropertyPanel::SetColor (
9958dcb2a10SAndre Fischer     const String& rsColorName,
9968dcb2a10SAndre Fischer     const Color aColor)
9978dcb2a10SAndre Fischer {
9988dcb2a10SAndre Fischer     XLineColorItem aColorItem(rsColorName, aColor);
9998dcb2a10SAndre Fischer     mpBindings->GetDispatcher()->Execute(SID_ATTR_LINE_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
10008dcb2a10SAndre Fischer     maColor = aColor;
10018dcb2a10SAndre Fischer }
10028dcb2a10SAndre Fischer 
10038dcb2a10SAndre Fischer 
10048dcb2a10SAndre Fischer 
10058dcb2a10SAndre Fischer void LinePropertyPanel::SetWidth(long nWidth)
10068dcb2a10SAndre Fischer {
10078dcb2a10SAndre Fischer     mnWidthCoreValue = nWidth;
10088dcb2a10SAndre Fischer     mbWidthValuable = true;
10098dcb2a10SAndre Fischer }
10108dcb2a10SAndre Fischer 
10118dcb2a10SAndre Fischer 
10128dcb2a10SAndre Fischer 
10138dcb2a10SAndre Fischer void  LinePropertyPanel::FillLineEndList()
10148dcb2a10SAndre Fischer {
10158dcb2a10SAndre Fischer 	SfxObjectShell* pSh = SfxObjectShell::Current();
10168dcb2a10SAndre Fischer 	if ( pSh && pSh->GetItem( SID_LINEEND_LIST ) )
10178dcb2a10SAndre Fischer 	{
10188dcb2a10SAndre Fischer 		mpLBStart->Enable();
10198dcb2a10SAndre Fischer 		SvxLineEndListItem aItem( *(const SvxLineEndListItem*)(pSh->GetItem( SID_LINEEND_LIST ) ) );
10208dcb2a10SAndre Fischer 		mpLineEndList = aItem.GetLineEndList();
10218dcb2a10SAndre Fischer 
10228dcb2a10SAndre Fischer         if(mpLineEndList)
10238dcb2a10SAndre Fischer 		{
1024a567bdc8SArmin Le Grand             FillLineEndListBox(*mpLBStart, *mpLBEnd, *mpLineEndList);
10258dcb2a10SAndre Fischer 		}
1026a567bdc8SArmin Le Grand 
1027a567bdc8SArmin Le Grand 		mpLBStart->SelectEntryPos(0);
1028a567bdc8SArmin Le Grand 		mpLBEnd->SelectEntryPos(0);
10298dcb2a10SAndre Fischer 	}
10308dcb2a10SAndre Fischer 	else
10318dcb2a10SAndre Fischer 	{
10328dcb2a10SAndre Fischer 		mpLBStart->Disable();
10338dcb2a10SAndre Fischer 		mpLBEnd->Disable();
10348dcb2a10SAndre Fischer 	}
10358dcb2a10SAndre Fischer }
10368dcb2a10SAndre Fischer 
10378dcb2a10SAndre Fischer 
10388dcb2a10SAndre Fischer 
103997e8a929SArmin Le Grand void  LinePropertyPanel::FillLineStyleList()
104097e8a929SArmin Le Grand {
104197e8a929SArmin Le Grand 	SfxObjectShell* pSh = SfxObjectShell::Current();
104297e8a929SArmin Le Grand 	if ( pSh && pSh->GetItem( SID_DASH_LIST ) )
104397e8a929SArmin Le Grand 	{
104497e8a929SArmin Le Grand 		mpLBStyle->Enable();
104597e8a929SArmin Le Grand 		SvxDashListItem aItem( *(const SvxDashListItem*)(pSh->GetItem( SID_DASH_LIST ) ) );
104697e8a929SArmin Le Grand 		mpLineStyleList = aItem.GetDashList();
104797e8a929SArmin Le Grand 
104897e8a929SArmin Le Grand         if(mpLineStyleList)
104997e8a929SArmin Le Grand 		{
105097e8a929SArmin Le Grand             FillLineStyleListBox(*mpLBStyle, *mpLineStyleList);
105197e8a929SArmin Le Grand 		}
105297e8a929SArmin Le Grand 
105397e8a929SArmin Le Grand 		mpLBStyle->SelectEntryPos(0);
105497e8a929SArmin Le Grand 	}
105597e8a929SArmin Le Grand 	else
105697e8a929SArmin Le Grand 	{
105797e8a929SArmin Le Grand 		mpLBStyle->Disable();
105897e8a929SArmin Le Grand 	}
105997e8a929SArmin Le Grand }
106097e8a929SArmin Le Grand 
106197e8a929SArmin Le Grand 
106297e8a929SArmin Le Grand 
106397e8a929SArmin Le Grand void LinePropertyPanel::SelectLineStyle()
106497e8a929SArmin Le Grand {
106597e8a929SArmin Le Grand 	if( !mbStyleAvailable || !mbDashAvailable )
106697e8a929SArmin Le Grand 	{
106797e8a929SArmin Le Grand 		mpLBStyle->SetNoSelection();
106897e8a929SArmin Le Grand 		return;
106997e8a929SArmin Le Grand 	}
107097e8a929SArmin Le Grand 
107197e8a929SArmin Le Grand     const XLineStyle eXLS(mpStyleItem ? (XLineStyle)mpStyleItem->GetValue() : XLINE_NONE);
107297e8a929SArmin Le Grand 	bool bSelected(false);
107397e8a929SArmin Le Grand 
107497e8a929SArmin Le Grand     switch(eXLS)
107597e8a929SArmin Le Grand     {
107697e8a929SArmin Le Grand         case XLINE_NONE:
107797e8a929SArmin Le Grand             break;
107897e8a929SArmin Le Grand         case XLINE_SOLID:
107997e8a929SArmin Le Grand 			mpLBStyle->SelectEntryPos(1);
108097e8a929SArmin Le Grand 			bSelected = true;
108197e8a929SArmin Le Grand             break;
108297e8a929SArmin Le Grand         default:
108397e8a929SArmin Le Grand             if(mpDashItem && mpLineStyleList)
108497e8a929SArmin Le Grand 	        {
108597e8a929SArmin Le Grand 		        const XDash& rDash = mpDashItem->GetDashValue();
108697e8a929SArmin Le Grand 		        for(sal_Int32 a(0);!bSelected &&  a < mpLineStyleList->Count(); a++)
108797e8a929SArmin Le Grand 		        {
108897e8a929SArmin Le Grand 			        XDashEntry* pEntry = mpLineStyleList->GetDash(a);
108997e8a929SArmin Le Grand 			        const XDash& rEntry = pEntry->GetDash();
109097e8a929SArmin Le Grand 			        if(rDash == rEntry)
109197e8a929SArmin Le Grand 			        {
109297e8a929SArmin Le Grand 				        mpLBStyle->SelectEntryPos((sal_uInt16)a + 2);
109397e8a929SArmin Le Grand 				        bSelected = true;
109497e8a929SArmin Le Grand 			        }
109597e8a929SArmin Le Grand 		        }
109697e8a929SArmin Le Grand 	        }
109797e8a929SArmin Le Grand             break;
109897e8a929SArmin Le Grand     }
109997e8a929SArmin Le Grand 
110097e8a929SArmin Le Grand     if(!bSelected)
110197e8a929SArmin Le Grand 		mpLBStyle->SelectEntryPos( 0 );
110297e8a929SArmin Le Grand }
110397e8a929SArmin Le Grand 
11048dcb2a10SAndre Fischer void LinePropertyPanel::SelectEndStyle(bool bStart)
11058dcb2a10SAndre Fischer {
11068dcb2a10SAndre Fischer 	sal_Bool bSelected(false);
11078dcb2a10SAndre Fischer 
11088dcb2a10SAndre Fischer 	if(bStart)
11098dcb2a10SAndre Fischer 	{
11108dcb2a10SAndre Fischer 		//<<add
11118dcb2a10SAndre Fischer 		if( !mbStartAvailable )
11128dcb2a10SAndre Fischer 		{
11138dcb2a10SAndre Fischer 			mpLBStart->SetNoSelection();
11148dcb2a10SAndre Fischer 			return;
11158dcb2a10SAndre Fischer 		}
11168dcb2a10SAndre Fischer 		//add end>>
11178dcb2a10SAndre Fischer 		if(mpStartItem && mpLineEndList)
11188dcb2a10SAndre Fischer 		{
11198dcb2a10SAndre Fischer 			const basegfx::B2DPolyPolygon& rItemPolygon = mpStartItem->GetLineStartValue();
11208dcb2a10SAndre Fischer 			for(sal_Int32 a(0);!bSelected &&  a < mpLineEndList->Count(); a++)
11218dcb2a10SAndre Fischer 			{
11228dcb2a10SAndre Fischer 				XLineEndEntry* pEntry = mpLineEndList->GetLineEnd(a);
11238dcb2a10SAndre Fischer 				const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
11248dcb2a10SAndre Fischer 				if(rItemPolygon == rEntryPolygon)
11258dcb2a10SAndre Fischer 				{
11268dcb2a10SAndre Fischer 					mpLBStart->SelectEntryPos((sal_uInt16)a + 1);
11278dcb2a10SAndre Fischer 					bSelected = true;
11288dcb2a10SAndre Fischer 				}
11298dcb2a10SAndre Fischer 			}
11308dcb2a10SAndre Fischer 		}
11318dcb2a10SAndre Fischer 		if(!bSelected)
11328dcb2a10SAndre Fischer 			mpLBStart->SelectEntryPos( 0 );
11338dcb2a10SAndre Fischer 	}
11348dcb2a10SAndre Fischer 	else
11358dcb2a10SAndre Fischer 	{
11368dcb2a10SAndre Fischer 		//<<add
11378dcb2a10SAndre Fischer 		if( !mbEndAvailable )
11388dcb2a10SAndre Fischer 		{
11398dcb2a10SAndre Fischer 			mpLBEnd->SetNoSelection();
11408dcb2a10SAndre Fischer 			return;
11418dcb2a10SAndre Fischer 		}
11428dcb2a10SAndre Fischer 		//add end>>
11438dcb2a10SAndre Fischer 		if(mpEndItem && mpLineEndList)
11448dcb2a10SAndre Fischer 		{
11458dcb2a10SAndre Fischer 			const basegfx::B2DPolyPolygon& rItemPolygon = mpEndItem->GetLineEndValue();
11468dcb2a10SAndre Fischer 			for(sal_Int32 a(0);!bSelected &&  a < mpLineEndList->Count(); a++)
11478dcb2a10SAndre Fischer 			{
11488dcb2a10SAndre Fischer 				XLineEndEntry* pEntry = mpLineEndList->GetLineEnd(a);
11498dcb2a10SAndre Fischer 				const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
11508dcb2a10SAndre Fischer 				if(rItemPolygon == rEntryPolygon)
11518dcb2a10SAndre Fischer 				{
11528dcb2a10SAndre Fischer 					mpLBEnd->SelectEntryPos((sal_uInt16)a + 1);
11538dcb2a10SAndre Fischer 					bSelected = true;
11548dcb2a10SAndre Fischer 				}
11558dcb2a10SAndre Fischer 			}
11568dcb2a10SAndre Fischer 		}
11578dcb2a10SAndre Fischer 		if(!bSelected)
11588dcb2a10SAndre Fischer 			mpLBEnd->SelectEntryPos( 0 );
11598dcb2a10SAndre Fischer 	}
11608dcb2a10SAndre Fischer }
11618dcb2a10SAndre Fischer 
11628dcb2a10SAndre Fischer 
11638dcb2a10SAndre Fischer } } // end of namespace svx::sidebar
11644e8031e0SArmin Le Grand 
11654e8031e0SArmin Le Grand // eof
1166