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