xref: /aoo42x/main/cui/source/tabpages/tpline.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_cui.hxx"
30 
31 // include ---------------------------------------------------------------
32 
33 #ifndef _SVX_SIZEITEM_HXX //autogen
34 
35 #include <editeng/sizeitem.hxx>
36 #endif
37 #include <tools/shl.hxx>
38 #include <tools/urlobj.hxx>
39 #include <sfx2/app.hxx>
40 #include <sfx2/module.hxx>
41 
42 #define _SVX_TPLINE_CXX
43 
44 #include <cuires.hrc>
45 #include "tabline.hrc"
46 #include "svx/xattr.hxx"
47 #include <svx/xpool.hxx>
48 #include <svx/xtable.hxx>
49 #include "svx/drawitem.hxx"
50 #include "cuitabline.hxx"
51 #include "dlgname.hxx"
52 #include <dialmgr.hxx>
53 #include "svx/dlgutil.hxx"
54 #include <svx/svdmodel.hxx>
55 #include "svx/svxgrahicitem.hxx"
56 //#include "linectrl.hrc"
57 #include <sfx2/request.hxx>
58 #include "svx/ofaitem.hxx"
59 #include <svx/svdobj.hxx>
60 #include <svx/svdview.hxx>
61 #include <svx/svdmodel.hxx>
62 #include <svx/numvset.hxx>
63 #include <vcl/msgbox.hxx>
64 #include <editeng/numitem.hxx>
65 #include <editeng/svxenum.hxx>
66 #include <sfx2/objsh.hxx>
67 #include <editeng/brshitem.hxx>
68 #include <svx/gallery.hxx>
69 #include <svx/xbitmap.hxx>
70 #include <unotools/localfilehelper.hxx>
71 #include "paragrph.hrc"
72 #include "sfx2/opengrf.hxx"
73 #include <svx/dialmgr.hxx>
74 #include <svx/dialogs.hrc>
75 
76 #define MAX_BMP_WIDTH 	16
77 #define MAX_BMP_HEIGHT  16
78 // define ----------------------------------------------------------------
79 
80 #define DLGWIN this->GetParent()->GetParent()
81 
82 #define BITMAP_WIDTH   32
83 #define BITMAP_HEIGHT  12
84 #define XOUT_WIDTH    150
85 
86 // static ----------------------------------------------------------------
87 
88 static sal_uInt16 pLineRanges[] =
89 {
90 	XATTR_LINETRANSPARENCE,
91 	XATTR_LINETRANSPARENCE,
92 	SID_ATTR_LINE_STYLE,
93 	SID_ATTR_LINE_ENDCENTER,
94 	0
95 };
96 
97 /*************************************************************************
98 |*
99 |*	Dialog zum Aendern der Linien
100 |*
101 \************************************************************************/
102 
103 SvxLineTabPage::SvxLineTabPage
104 (
105 	Window* pParent,
106 	const SfxItemSet& rInAttrs
107 ) :
108 	SvxTabPage			( pParent, CUI_RES( RID_SVXPAGE_LINE ), rInAttrs ),
109     aFlLine             ( this, CUI_RES( FL_LINE ) ),
110     aFtLineStyle        ( this, CUI_RES( FT_LINE_STYLE ) ),
111     aLbLineStyle        ( this, CUI_RES( LB_LINE_STYLE ) ),
112     aFtColor            ( this, CUI_RES( FT_COLOR ) ),
113     aLbColor            ( this, CUI_RES( LB_COLOR ) ),
114     aFtLineWidth        ( this, CUI_RES( FT_LINE_WIDTH ) ),
115     aMtrLineWidth       ( this, CUI_RES( MTR_FLD_LINE_WIDTH ) ),
116     aFtTransparent      ( this, CUI_RES( FT_TRANSPARENT ) ),
117     aMtrTransparent     ( this, CUI_RES( MTR_LINE_TRANSPARENT ) ),
118     aFlLineEnds         ( this, CUI_RES( FL_LINE_ENDS ) ),
119     aLbStartStyle       ( this, CUI_RES( LB_START_STYLE ) ),
120     aMtrStartWidth      ( this, CUI_RES( MTR_FLD_START_WIDTH ) ),
121     aTsbCenterStart     ( this, CUI_RES( TSB_CENTER_START ) ),
122     aFtLineEndsStyle    ( this, CUI_RES( FT_LINE_ENDS_STYLE ) ),
123     aLbEndStyle         ( this, CUI_RES( LB_END_STYLE ) ),
124 	aFtLineEndsWidth    ( this, CUI_RES( FT_LINE_ENDS_WIDTH ) ),
125     aMtrEndWidth        ( this, CUI_RES( MTR_FLD_END_WIDTH ) ),
126     aTsbCenterEnd       ( this, CUI_RES( TSB_CENTER_END ) ),
127     aCbxSynchronize     ( this, CUI_RES( CBX_SYNCHRONIZE ) ),
128     aFLSeparator        ( this, CUI_RES( FL_SEPARATOR ) ),
129     aCtlPreview         ( this, CUI_RES( CTL_PREVIEW ) ),
130 
131     // #116827#
132     maFLEdgeStyle       ( this, CUI_RES( FL_EDGE_STYLE ) ),
133     maFTEdgeStyle       ( this, CUI_RES( FT_EDGE_STYLE ) ),
134     maLBEdgeStyle       ( this, CUI_RES( LB_EDGE_STYLE ) ),
135 
136     pSymbolList(NULL),
137     bNewSize(false),
138     nNumMenuGalleryItems(0),
139     nSymbolType(SVX_SYMBOLTYPE_UNKNOWN), //unbekannt bzw. unchanged
140     pSymbolAttr(NULL),
141     //#58425# Symbole auf einer Linie (z.B. StarChart)
142     aFlSymbol           ( this, CUI_RES(FL_SYMBOL_FORMAT)),
143     aSymbolMB           ( this, CUI_RES(MB_SYMBOL_BITMAP)),
144     aSymbolWidthFT      ( this, CUI_RES(FT_SYMBOL_WIDTH)),
145 	aSymbolWidthMF		( this, CUI_RES(MF_SYMBOL_WIDTH)),
146 	aSymbolHeightFT		( this, CUI_RES(FT_SYMBOL_HEIGHT)),
147 	aSymbolHeightMF		( this, CUI_RES(MF_SYMBOL_HEIGHT)),
148     aSymbolRatioCB      ( this, CUI_RES(CB_SYMBOL_RATIO)),
149 
150     bLastWidthModified(sal_False),
151     aSymbolLastSize(Size(0,0)),
152     bSymbols(sal_False),
153 
154     rOutAttrs           ( rInAttrs ),
155     bObjSelected( sal_False ),
156 
157     pXPool              ( (XOutdevItemPool*) rInAttrs.GetPool() ),
158     aXLStyle            ( XLINE_DASH ),
159     aXWidth             ( 1 ),
160     aXDash              ( String(), XDash( XDASH_RECT, 3, 7, 2, 40, 15 ) ),
161     aXColor             ( String(), COL_LIGHTRED ),
162     aXLineAttr          ( pXPool ),
163     rXLSet              ( aXLineAttr.GetItemSet() ),
164  	pnLineEndListState( 0 ),
165 	pnDashListState( 0 ),
166 	pnColorTableState( 0 ),
167    nPageType           ( 0 )//CHINA001 pPageType           ( NULL ),
168 {
169 	aLbEndStyle.SetAccessibleName(String(CUI_RES(STR_STYLE)));
170 	aLbStartStyle.SetAccessibleName(String(CUI_RES( STR_LB_START_STYLE ) ) );
171 	aMtrStartWidth.SetAccessibleName(String(CUI_RES( STR_MTR_FLD_START_WIDTH ) ) );
172 	aLbEndStyle.SetAccessibleName(String(CUI_RES( STR_LB_END_STYLE ) ) );
173 	aMtrEndWidth.SetAccessibleName(String(CUI_RES( STR_MTR_FLD_END_WIDTH ) ) );
174 	aTsbCenterStart.SetAccessibleName(String(CUI_RES( STR_CENTER_START ) ) );
175 	aTsbCenterEnd.SetAccessibleName(String(CUI_RES( STR_CENTER_END ) ) );
176 
177 	FreeResource();
178 
179 	aCtlPreview.SetAccessibleName(String(CUI_RES(STR_EXAMPLE)));
180 
181 	// diese Page braucht ExchangeSupport
182 	SetExchangeSupport();
183 
184 	// Metrik einstellen
185 	FieldUnit eFUnit = GetModuleFieldUnit( rInAttrs );
186 
187 	switch ( eFUnit )
188 	{
189 		case FUNIT_M:
190 		case FUNIT_KM:
191 			eFUnit = FUNIT_MM;
192 			// no break -> we now have mm
193 		case FUNIT_MM:
194 			aMtrLineWidth.SetSpinSize( 50 );
195 			aMtrStartWidth.SetSpinSize( 50 );
196 			aMtrEndWidth.SetSpinSize( 50 );
197 			break;
198 
199 			case FUNIT_INCH:
200 			aMtrLineWidth.SetSpinSize( 2 );
201 			aMtrStartWidth.SetSpinSize( 2 );
202 			aMtrEndWidth.SetSpinSize( 2 );
203 			break;
204             default: ;//prevent warning
205 	}
206 	SetFieldUnit( aMtrLineWidth, eFUnit );
207 	SetFieldUnit( aMtrStartWidth, eFUnit );
208 	SetFieldUnit( aMtrEndWidth, eFUnit );
209 
210 	// PoolUnit ermitteln
211 	SfxItemPool* pPool = rOutAttrs.GetPool();
212 	DBG_ASSERT( pPool, "Wo ist der Pool?" );
213 	ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH );
214 
215 	aLbLineStyle.SetSelectHdl(
216 		LINK( this, SvxLineTabPage, ClickInvisibleHdl_Impl ) );
217 	aLbColor.SetSelectHdl(
218 		LINK( this, SvxLineTabPage, ChangePreviewHdl_Impl ) );
219 	aMtrLineWidth.SetModifyHdl(
220 		LINK( this, SvxLineTabPage, ChangePreviewHdl_Impl ) );
221 	aMtrTransparent.SetModifyHdl(
222 		LINK( this, SvxLineTabPage, ChangeTransparentHdl_Impl ) );
223 
224 	Link aStart = LINK( this, SvxLineTabPage, ChangeStartHdl_Impl );
225 	Link aEnd = LINK( this, SvxLineTabPage, ChangeEndHdl_Impl );
226 	aLbStartStyle.SetSelectHdl( aStart );
227 	aLbEndStyle.SetSelectHdl( aEnd );
228 	aMtrStartWidth.SetModifyHdl( aStart );
229 	aMtrEndWidth.SetModifyHdl( aEnd );
230 	aTsbCenterStart.SetClickHdl( aStart );
231 	aTsbCenterEnd.SetClickHdl( aEnd );
232 
233 	pColorTab = NULL;
234 	pDashList = NULL;
235 	pLineEndList = NULL;
236 
237 	// #116827#
238 	Link aEdgeStyle = LINK( this, SvxLineTabPage, ChangeEdgeStyleHdl_Impl );
239 	maLBEdgeStyle.SetSelectHdl( aEdgeStyle );
240 
241 	//#58425# Symbole auf einer Linie (z.B. StarChart) , MB-Handler setzen
242 	aSymbolMB.SetSelectHdl(LINK(this, SvxLineTabPage, GraphicHdl_Impl));
243     aSymbolMB.SetActivateHdl(LINK(this, SvxLineTabPage, MenuCreateHdl_Impl));
244 	aSymbolWidthMF.SetModifyHdl(LINK(this, SvxLineTabPage, SizeHdl_Impl));
245 	aSymbolHeightMF.SetModifyHdl(LINK(this, SvxLineTabPage, SizeHdl_Impl));
246 	aSymbolRatioCB.SetClickHdl(LINK(this, SvxLineTabPage, RatioHdl_Impl));
247 
248 	aSymbolRatioCB.Check(sal_True);
249 	ShowSymbolControls(sal_False);
250 
251 	// #63083#
252 	nActLineWidth = -1;
253 }
254 //#58425# Symbole auf einer Linie (z.B. StarChart) , Symbol-Controls aktivieren
255 void SvxLineTabPage::ShowSymbolControls(sal_Bool bOn)
256 {
257 	bSymbols=bOn;
258 	aSymbolWidthFT.Show(bOn);
259 	aSymbolWidthMF.Show(bOn);
260 	aSymbolHeightFT.Show(bOn);
261 	aSymbolHeightMF.Show(bOn);
262 	aFlSymbol.Show(bOn);
263 	aSymbolRatioCB.Show(bOn);
264 	aSymbolMB.Show(bOn);
265 	aCtlPreview.ShowSymbol(bOn);
266 }
267 // -----------------------------------------------------------------------
268 //#58425# Symbole auf einer Linie (z.B. StarChart) , dtor neu!
269 SvxLineTabPage::~SvxLineTabPage()
270 {
271 	delete aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
272 
273 	if(pSymbolList)
274 		delete aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_SYMBOLS );
275 
276 	String* pStr = (String*)aGrfNames.First();
277 	while( pStr )
278 	{
279 		delete pStr;
280 		pStr = (String*)aGrfNames.Next();
281 	}
282 	SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)aGrfBrushItems.First();
283 	while( pInfo )
284 	{
285 		delete pInfo->pBrushItem;
286 		delete pInfo;
287 		pInfo = (SvxBmpItemInfo*)aGrfBrushItems.Next();
288 	}
289 }
290 void SvxLineTabPage::Construct()
291 {
292 	// Farbtabelle
293 	aLbColor.Fill( pColorTab );
294 	FillListboxes();
295 }
296 
297 void SvxLineTabPage::FillListboxes()
298 {
299 	// Linienstile
300 	sal_uInt16 nOldSelect = aLbLineStyle.GetSelectEntryPos();
301 	aLbLineStyle.FillStyles();
302 	aLbLineStyle.Fill( pDashList );
303 	aLbLineStyle.SelectEntryPos( nOldSelect );
304 
305 	// LinienEndenStile
306 	String sNone( SVX_RES( RID_SVXSTR_NONE ) );
307 	nOldSelect = aLbStartStyle.GetSelectEntryPos();
308 	aLbStartStyle.Clear();
309 	aLbStartStyle.InsertEntry( sNone );
310 	aLbStartStyle.Fill( pLineEndList );
311 	aLbStartStyle.SelectEntryPos( nOldSelect );
312 	nOldSelect = aLbEndStyle.GetSelectEntryPos();
313 	aLbEndStyle.Clear();
314 	aLbEndStyle.InsertEntry( sNone );
315 	aLbEndStyle.Fill( pLineEndList, sal_False );
316 	aLbEndStyle.SelectEntryPos( nOldSelect );
317 }
318 
319 // -----------------------------------------------------------------------
320 
321 void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet )
322 {
323 	SFX_ITEMSET_ARG (&rSet,pPageTypeItem,CntUInt16Item,SID_PAGE_TYPE,sal_False); //add CHINA001 begin
324 	if (pPageTypeItem)
325 		SetPageType(pPageTypeItem->GetValue());	//add CHINA001 end
326 	if( nDlgType == 0 && pDashList )  //CHINA001 if( *pDlgType == 0 && pDashList ) // Linien-Dialog
327 	{
328 		sal_uInt16 nPos;
329 		sal_uInt16 nCount;
330 
331 		// Dashliste
332 		if( ( *pnDashListState & CT_MODIFIED ) ||
333 			( *pnDashListState & CT_CHANGED ) )
334 		{
335 			if( *pnDashListState & CT_CHANGED )
336 				pDashList = ( (SvxLineTabDialog*) DLGWIN )->
337 										GetNewDashList();
338 			*pnDashListState = CT_NONE;
339 
340 			// Styleliste
341 			nPos = aLbLineStyle.GetSelectEntryPos();
342 
343 			aLbLineStyle.Clear();
344 			aLbLineStyle.InsertEntry(
345 				SVX_RESSTR( RID_SVXSTR_INVISIBLE ) );
346 			aLbLineStyle.InsertEntry(
347 				SVX_RESSTR( RID_SVXSTR_SOLID ) );
348 			aLbLineStyle.Fill( pDashList );
349 			nCount = aLbLineStyle.GetEntryCount();
350 
351 			if ( nCount == 0 )
352 				; // Dieser Fall sollte nicht auftreten
353 			else if( nCount <= nPos )
354 				aLbLineStyle.SelectEntryPos( 0 );
355 			else
356 				aLbLineStyle.SelectEntryPos( nPos );
357 			// SelectStyleHdl_Impl( this );
358 		}
359 
360 		INetURLObject	aDashURL( pDashList->GetPath() );
361 
362 		aDashURL.Append( pDashList->GetName() );
363 		DBG_ASSERT( aDashURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
364 /*		// Ermitteln (evtl. abschneiden) des Namens und in
365 		// der GroupBox darstellen
366 		String			aString( ResId( RID_SVXSTR_TABLE, pMgr ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
367 
368 		if ( aDashURL.getBase().Len() > 18 )
369 		{
370 			aString += aDashURL.getBase().Copy( 0, 15 );
371 			aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
372 		}
373 		else
374 			aString += aDashURL.getBase();
375 
376 		aGrpLine.SetText( aString );
377 */
378 		// LineEndliste
379 		if( ( *pnLineEndListState & CT_MODIFIED ) ||
380 			( *pnLineEndListState & CT_CHANGED ) )
381 		{
382 			if( *pnLineEndListState & CT_CHANGED )
383 				pLineEndList = ( (SvxLineTabDialog*) DLGWIN )->
384 										GetNewLineEndList();
385 			*pnLineEndListState = CT_NONE;
386 
387 			nPos = aLbLineStyle.GetSelectEntryPos();
388 			String sNone( SVX_RES( RID_SVXSTR_NONE ) );
389 			aLbStartStyle.Clear();
390 			aLbStartStyle.InsertEntry( sNone );
391 
392 			aLbStartStyle.Fill( pLineEndList );
393 			nCount = aLbStartStyle.GetEntryCount();
394 			if( nCount == 0 )
395 				; // Dieser Fall sollte nicht auftreten
396 			else if( nCount <= nPos )
397 				aLbStartStyle.SelectEntryPos( 0 );
398 			else
399 				aLbStartStyle.SelectEntryPos( nPos );
400 
401 			aLbEndStyle.Clear();
402 			aLbEndStyle.InsertEntry( sNone );
403 
404 			aLbEndStyle.Fill( pLineEndList, sal_False );
405 			nCount = aLbEndStyle.GetEntryCount();
406 
407 			if( nCount == 0 )
408 				; // Dieser Fall sollte nicht auftreten
409 			else if( nCount <= nPos )
410 				aLbEndStyle.SelectEntryPos( 0 );
411 			else
412 				aLbEndStyle.SelectEntryPos( nPos );
413 		}
414 		INetURLObject aLineURL( pLineEndList->GetPath() );
415 
416 		aLineURL.Append( pLineEndList->GetName() );
417 		DBG_ASSERT( aLineURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
418 /*		// Ermitteln (evtl. abschneiden) des Namens und in
419 		// der GroupBox darstellen
420 		aString = String( ResId( RID_SVXSTR_TABLE, pMgr ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
421 
422 		if ( aLineURL.getBase().Len() > 18 )
423 		{
424 			aString += aLineURL.getBase().Copy( 0, 15 );
425 			aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
426 		}
427 		else
428 			aString += aLineURL.getBase();
429 
430 		aGrpLineEnds.SetText( aString );
431 */
432 		// Auswertung, ob von einer anderen TabPage ein anderer Fuelltyp gesetzt wurde
433 		if( aLbLineStyle.GetSelectEntryPos() != 0 )
434 		{
435 			if( nPageType == 2 ) // 1//CHINA001 if( *pPageType == 2 ) // 1
436 			{
437 				aLbLineStyle.SelectEntryPos( *pPosDashLb + 2 ); // +2 wegen SOLID und INVLISIBLE
438 				ChangePreviewHdl_Impl( this );
439 			}
440 			if( nPageType == 3 )//CHINA001 if( *pPageType == 3 )
441 			{
442 				aLbStartStyle.SelectEntryPos( *pPosLineEndLb + 1 );// +1 wegen SOLID
443 				aLbEndStyle.SelectEntryPos( *pPosLineEndLb + 1 );// +1 wegen SOLID
444 				ChangePreviewHdl_Impl( this );
445 			}
446 		}
447 
448 			// ColorTable
449 			if( *pnColorTableState )
450 			{
451 				if( *pnColorTableState & CT_CHANGED )
452 					pColorTab = ( (SvxLineTabDialog*) DLGWIN )->
453 											GetNewColorTable();
454 				// aLbColor
455                 sal_uInt16 nColorPos = aLbColor.GetSelectEntryPos();
456 				aLbColor.Clear();
457 				aLbColor.Fill( pColorTab );
458 				nCount = aLbColor.GetEntryCount();
459 				if( nCount == 0 )
460 					; // This case should never occur
461                 else if( nCount <= nColorPos )
462 					aLbColor.SelectEntryPos( 0 );
463 				else
464                     aLbColor.SelectEntryPos( nColorPos );
465 
466 				ChangePreviewHdl_Impl( this );
467 			}
468 
469 		nPageType = 0;//CHINA001 *pPageType = 0;
470 	}
471 	// Seite existiert im Ctor noch nicht, deswegen hier!
472 
473 	else if ( nDlgType == 1100 || // Chart-Dialog//CHINA001 else if ( *pDlgType == 1100 || // Chart-Dialog
474 			  nDlgType == 1101 )//CHINA001 *pDlgType == 1101 )
475 	{
476 		aFtLineEndsStyle.Hide();
477 		aFtLineEndsWidth.Hide();
478 		aLbStartStyle.Hide();
479 		aMtrStartWidth.Hide();
480 		aTsbCenterStart.Hide();
481 		aLbEndStyle.Hide();
482 		aMtrEndWidth.Hide();
483 		aTsbCenterEnd.Hide();
484 		aCbxSynchronize.Hide();
485 		aFlLineEnds.Hide();
486 
487 		// #116827#
488 		maFLEdgeStyle.Hide();
489 		maFTEdgeStyle.Hide();
490 		maLBEdgeStyle.Hide();
491 	}
492 }
493 
494 // -----------------------------------------------------------------------
495 
496 int SvxLineTabPage::DeactivatePage( SfxItemSet* _pSet )
497 {
498 	if( nDlgType == 0 ) // Linien-Dialog//CHINA001 if( *pDlgType == 0 ) // Linien-Dialog
499 	{
500 		nPageType = 1; // evtl. fuer Erweiterungen//CHINA001 *pPageType = 1; // evtl. fuer Erweiterungen
501 		*pPosDashLb = aLbLineStyle.GetSelectEntryPos() - 2;// erster Eintrag SOLID !!!
502 		sal_uInt16 nPos = aLbStartStyle.GetSelectEntryPos();
503 		if( nPos != LISTBOX_ENTRY_NOTFOUND )
504 			nPos--;
505 		*pPosLineEndLb = nPos;
506 	}
507 
508     if( _pSet )
509         FillItemSet( *_pSet );
510 
511 	return( LEAVE_PAGE );
512 }
513 
514 // -----------------------------------------------------------------------
515 
516 sal_Bool SvxLineTabPage::FillItemSet( SfxItemSet& rAttrs )
517 {
518 	const SfxPoolItem* pOld = NULL;
519 	sal_uInt16	nPos;
520 	sal_Bool	bModified = sal_False;
521 
522 	// Um evtl. Modifikationen der Liste vorzubeugen
523 	// werden Items anderer Seiten nicht gesetzt
524 	if( nDlgType != 0 || nPageType != 2 )//CHINA001 if( *pDlgType != 0 || *pPageType != 2 )
525 	{
526 		nPos = aLbLineStyle.GetSelectEntryPos();
527 		if( nPos != LISTBOX_ENTRY_NOTFOUND &&
528 			nPos != aLbLineStyle.GetSavedValue() )
529 		{
530 			XLineStyleItem*	pStyleItem = NULL;
531 
532 			if( nPos == 0 )
533 				pStyleItem = new XLineStyleItem( XLINE_NONE );
534 			else if( nPos == 1 )
535 				pStyleItem = new XLineStyleItem( XLINE_SOLID );
536 			else
537 			{
538 				pStyleItem = new XLineStyleItem( XLINE_DASH );
539 
540 				// Zusaetzliche Sicherheit
541 				if( pDashList->Count() > (long) ( nPos - 2 ) )
542 				{
543 					XLineDashItem aDashItem( aLbLineStyle.GetSelectEntry(),
544                                         pDashList->GetDash( nPos - 2 )->GetDash() );
545 					pOld = GetOldItem( rAttrs, XATTR_LINEDASH );
546 					if ( !pOld || !( *(const XLineDashItem*)pOld == aDashItem ) )
547 					{
548 						rAttrs.Put( aDashItem );
549 						bModified = sal_True;
550 					}
551 				}
552 			}
553 			pOld = GetOldItem( rAttrs, XATTR_LINESTYLE );
554 			if ( !pOld || !( *(const XLineStyleItem*)pOld == *pStyleItem ) )
555 			{
556 				rAttrs.Put( *pStyleItem );
557 				bModified = sal_True;
558 			}
559 			delete pStyleItem;
560 		}
561 	}
562 	// Linienbreite
563 	// GetSavedValue() liefert String!
564 	if( aMtrLineWidth.GetText() != aMtrLineWidth.GetSavedValue() )
565 	{
566 		XLineWidthItem aItem( GetCoreValue( aMtrLineWidth, ePoolUnit ) );
567 		pOld = GetOldItem( rAttrs, XATTR_LINEWIDTH );
568 		if ( !pOld || !( *(const XLineWidthItem*)pOld == aItem ) )
569 		{
570 			rAttrs.Put( aItem );
571 			bModified = sal_True;
572 		}
573 	}
574 	//Breite Linienanfang
575 	if( aMtrStartWidth.GetText() != aMtrStartWidth.GetSavedValue() )
576 	{
577 		XLineStartWidthItem aItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) );
578 		pOld = GetOldItem( rAttrs, XATTR_LINESTARTWIDTH );
579 		if ( !pOld || !( *(const XLineStartWidthItem*)pOld == aItem ) )
580 		{
581 			rAttrs.Put( aItem );
582 			bModified = sal_True;
583 		}
584 	}
585 	//Breite Linienende
586 	if( aMtrEndWidth.GetText() != aMtrEndWidth.GetSavedValue() )
587 	{
588 		XLineEndWidthItem aItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) );
589 		pOld = GetOldItem( rAttrs, XATTR_LINEENDWIDTH );
590 		if ( !pOld || !( *(const XLineEndWidthItem*)pOld == aItem ) )
591 		{
592 			rAttrs.Put( aItem );
593 			bModified = sal_True;
594 		}
595 	}
596 
597 	// Linienfarbe
598 	if( aLbColor.GetSelectEntryPos() != aLbColor.GetSavedValue() )
599 	{
600 		XLineColorItem aItem( aLbColor.GetSelectEntry(),
601 							  aLbColor.GetSelectEntryColor() );
602 		pOld = GetOldItem( rAttrs, XATTR_LINECOLOR );
603 		if ( !pOld || !( *(const XLineColorItem*)pOld == aItem ) )
604 		{
605 			rAttrs.Put( aItem );
606 			bModified = sal_True;
607 		}
608 	}
609 
610 	if( nDlgType != 0 || nPageType != 3 )//CHINA001 if( *pDlgType != 0 || *pPageType != 3 )
611 	{
612 		// Linienanfang
613 		nPos = aLbStartStyle.GetSelectEntryPos();
614 		if( nPos != LISTBOX_ENTRY_NOTFOUND &&
615 			nPos != aLbStartStyle.GetSavedValue() )
616 		{
617 			XLineStartItem* pItem = NULL;
618 			if( nPos == 0 )
619 				pItem = new XLineStartItem();
620 			else if( pLineEndList->Count() > (long) ( nPos - 1 ) )
621 				pItem = new XLineStartItem( aLbStartStyle.GetSelectEntry(),
622                             pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() );
623 			pOld = GetOldItem( rAttrs, XATTR_LINESTART );
624 			if( pItem &&
625 				( !pOld || !( *(const XLineEndItem*)pOld == *pItem ) ) )
626 			{
627 				rAttrs.Put( *pItem );
628 				bModified = sal_True;
629 			}
630 			delete pItem;
631 		}
632 		// Linienende
633 		nPos = aLbEndStyle.GetSelectEntryPos();
634 		if( nPos != LISTBOX_ENTRY_NOTFOUND &&
635 			nPos != aLbEndStyle.GetSavedValue() )
636 		{
637 			XLineEndItem* pItem = NULL;
638 			if( nPos == 0 )
639 				pItem = new XLineEndItem();
640 			else if( pLineEndList->Count() > (long) ( nPos - 1 ) )
641 				pItem = new XLineEndItem( aLbEndStyle.GetSelectEntry(),
642                             pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() );
643 			pOld = GetOldItem( rAttrs, XATTR_LINEEND );
644 			if( pItem &&
645 				( !pOld || !( *(const XLineEndItem*)pOld == *pItem ) ) )
646 			{
647 				rAttrs.Put( *pItem );
648 				bModified = sal_True;
649 			}
650 			delete pItem;
651 		}
652 	}
653 
654 	// Linienenden zentriert
655 	TriState eState = aTsbCenterStart.GetState();
656 	if( eState != aTsbCenterStart.GetSavedValue() )
657 	{
658 		XLineStartCenterItem aItem( sal::static_int_cast< sal_Bool >( eState ) );
659 		pOld = GetOldItem( rAttrs, XATTR_LINESTARTCENTER );
660 		if ( !pOld || !( *(const XLineStartCenterItem*)pOld == aItem ) )
661 		{
662 			rAttrs.Put( aItem );
663 			bModified = sal_True;
664 		}
665 	}
666 	eState = aTsbCenterEnd.GetState();
667 	if( eState != aTsbCenterEnd.GetSavedValue() )
668 	{
669 		XLineEndCenterItem aItem( sal::static_int_cast< sal_Bool >( eState ) );
670 		pOld = GetOldItem( rAttrs, XATTR_LINEENDCENTER );
671 		if ( !pOld || !( *(const XLineEndCenterItem*)pOld == aItem ) )
672 		{
673 			rAttrs.Put( aItem );
674 			bModified = sal_True;
675 		}
676 	}
677 
678 	//Breite Linienanfang
679 	if( aMtrStartWidth.GetText() != aMtrStartWidth.GetSavedValue() )
680 	{
681 		XLineStartWidthItem aItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) );
682 		pOld = GetOldItem( rAttrs, XATTR_LINESTARTWIDTH );
683 		if ( !pOld || !( *(const XLineStartWidthItem*)pOld == aItem ) )
684 		{
685 			rAttrs.Put( aItem );
686 			bModified = sal_True;
687 		}
688 	}
689 	//Breite Linienende
690 	if( aMtrEndWidth.GetText() != aMtrEndWidth.GetSavedValue() )
691 	{
692 		XLineEndWidthItem aItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) );
693 		pOld = GetOldItem( rAttrs, XATTR_LINEENDWIDTH );
694 		if ( !pOld || !( *(const XLineEndWidthItem*)pOld == aItem ) )
695 		{
696 			rAttrs.Put( aItem );
697 			bModified = sal_True;
698 		}
699 	}
700 
701 	// Transparenz
702 	sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue();
703 	if( nVal != (sal_uInt16)aMtrTransparent.GetSavedValue().ToInt32() )
704 	{
705 		XLineTransparenceItem aItem( nVal );
706 		pOld = GetOldItem( rAttrs, XATTR_LINETRANSPARENCE );
707 		if ( !pOld || !( *(const XLineTransparenceItem*)pOld == aItem ) )
708 		{
709 			rAttrs.Put( aItem );
710 			bModified = sal_True;
711 		}
712 	}
713 
714 	// #116827#
715 	nPos = maLBEdgeStyle.GetSelectEntryPos();
716 	if( LISTBOX_ENTRY_NOTFOUND != nPos && nPos != maLBEdgeStyle.GetSavedValue() )
717 	{
718 		XLineJointItem* pNew = 0L;
719 
720 		switch(nPos)
721 		{
722 			case 0: // Rounded, default
723 			{
724 				pNew = new XLineJointItem(XLINEJOINT_ROUND);
725 				break;
726 			}
727 			case 1: // - none -
728 			{
729 				pNew = new XLineJointItem(XLINEJOINT_NONE);
730 				break;
731 			}
732 			case 2: // Miter
733 			{
734 				pNew = new XLineJointItem(XLINEJOINT_MITER);
735 				break;
736 			}
737 			case 3: // Bevel
738 			{
739 				pNew = new XLineJointItem(XLINEJOINT_BEVEL);
740 				break;
741 			}
742 		}
743 
744 		if(pNew)
745 		{
746 			pOld = GetOldItem( rAttrs, XATTR_LINEJOINT );
747 
748 			if(!pOld || !(*(const XLineJointItem*)pOld == *pNew))
749 			{
750 				rAttrs.Put( *pNew );
751 				bModified = sal_True;
752 			}
753 
754 			delete pNew;
755 		}
756 	}
757 
758 	if(nSymbolType!=SVX_SYMBOLTYPE_UNKNOWN || bNewSize)
759 	{
760 		//wurde also per Auswahl gesetzt oder Gr��e ist anders
761 		SvxSizeItem  aSItem(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),aSymbolSize);
762 		const SfxPoolItem* pSOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE) );
763 		bNewSize  = pSOld ? *(const SvxSizeItem *)pSOld != aSItem : bNewSize ;
764 		if(bNewSize)
765 		{
766 			rAttrs.Put(aSItem);
767 			bModified=sal_True;
768 		}
769 
770 		SfxInt32Item aTItem(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),nSymbolType);
771 		const SfxPoolItem* pTOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE) );
772 		bool bNewType = pTOld == NULL || *(const SfxInt32Item*)pTOld != aTItem;
773 		if(bNewType && nSymbolType==SVX_SYMBOLTYPE_UNKNOWN)
774 			bNewType=false;//kleine Korrektur, Typ wurde garnicht gesetzt -> kein Type-Item erzeugen!
775 		if(bNewType)
776 		{
777 			rAttrs.Put(aTItem);
778 			bModified=sal_True;
779 		}
780 
781 		if(nSymbolType!=SVX_SYMBOLTYPE_NONE)
782 		{
783 			SvxBrushItem aBItem(aSymbolGraphic,GPOS_MM,rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH));
784 			const SfxPoolItem* pBOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH) );
785 			bool bNewBrush =
786                 pBOld == NULL || *(const SvxBrushItem*)pBOld != aBItem;
787 			if(bNewBrush)
788 			{
789 				rAttrs.Put(aBItem);
790 				bModified=sal_True;
791 			}
792 		}
793 	}
794 	rAttrs.Put (CntUInt16Item(SID_PAGE_TYPE,nPageType));//add CHINA001
795 	return( bModified );
796 }
797 
798 // -----------------------------------------------------------------------
799 
800 sal_Bool SvxLineTabPage::FillXLSet_Impl()
801 {
802 	sal_uInt16 nPos;
803 
804 	if( aLbLineStyle.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND )
805 	{
806 		//rXLSet.Put( XLineDashItem ( rOutAttrs.Get( GetWhich( XATTR_LINEDASH ) ) ) );
807 		rXLSet.Put( XLineStyleItem( XLINE_NONE ) );
808 	}
809 	else if( aLbLineStyle.IsEntryPosSelected( 0 ) )
810 		rXLSet.Put( XLineStyleItem( XLINE_NONE ) );
811 	else if( aLbLineStyle.IsEntryPosSelected( 1 ) )
812 		rXLSet.Put( XLineStyleItem( XLINE_SOLID ) );
813 	else
814 	{
815 		rXLSet.Put( XLineStyleItem( XLINE_DASH ) );
816 
817 		nPos = aLbLineStyle.GetSelectEntryPos();
818 		if( nPos != LISTBOX_ENTRY_NOTFOUND )
819 		{
820 			rXLSet.Put( XLineDashItem( aLbLineStyle.GetSelectEntry(),
821                             pDashList->GetDash( nPos - 2 )->GetDash() ) );
822 		}
823 	}
824 
825 	nPos = aLbStartStyle.GetSelectEntryPos();
826 	if( nPos != LISTBOX_ENTRY_NOTFOUND )
827 	{
828 		if( nPos == 0 )
829 			rXLSet.Put( XLineStartItem() );
830 		else
831 			rXLSet.Put( XLineStartItem( aLbStartStyle.GetSelectEntry(),
832                         pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) );
833 	}
834 	nPos = aLbEndStyle.GetSelectEntryPos();
835 	if( nPos != LISTBOX_ENTRY_NOTFOUND )
836 	{
837 		if( nPos == 0 )
838 			rXLSet.Put( XLineEndItem() );
839 		else
840 			rXLSet.Put( XLineEndItem( aLbEndStyle.GetSelectEntry(),
841                         pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) );
842 	}
843 
844 	// #116827#
845 	nPos = maLBEdgeStyle.GetSelectEntryPos();
846 	if(LISTBOX_ENTRY_NOTFOUND != nPos)
847 	{
848 		switch(nPos)
849 		{
850 			case 0: // Rounded, default
851 			{
852 				rXLSet.Put(XLineJointItem(XLINEJOINT_ROUND));
853 				break;
854 			}
855 			case 1: // - none -
856 			{
857 				rXLSet.Put(XLineJointItem(XLINEJOINT_NONE));
858 				break;
859 			}
860 			case 2: // Miter
861 			{
862 				rXLSet.Put(XLineJointItem(XLINEJOINT_MITER));
863 				break;
864 			}
865 			case 3: // Bevel
866 			{
867 				rXLSet.Put(XLineJointItem(XLINEJOINT_BEVEL));
868 				break;
869 			}
870 		}
871 	}
872 
873 	rXLSet.Put( XLineStartWidthItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) ) );
874 	rXLSet.Put( XLineEndWidthItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) ) );
875 
876 	rXLSet.Put( XLineWidthItem( GetCoreValue( aMtrLineWidth, ePoolUnit ) ) );
877 	rXLSet.Put( XLineColorItem( aLbColor.GetSelectEntry(),
878 									aLbColor.GetSelectEntryColor() ) );
879 
880 	// Linienenden zentriert
881 	if( aTsbCenterStart.GetState() == STATE_CHECK )
882 		rXLSet.Put( XLineStartCenterItem( sal_True ) );
883 	else if( aTsbCenterStart.GetState() == STATE_NOCHECK )
884 		rXLSet.Put( XLineStartCenterItem( sal_False ) );
885 
886 	if( aTsbCenterEnd.GetState() == STATE_CHECK )
887 		rXLSet.Put( XLineEndCenterItem( sal_True ) );
888 	else if( aTsbCenterEnd.GetState() == STATE_NOCHECK )
889 		rXLSet.Put( XLineEndCenterItem( sal_False ) );
890 
891 	// Transparenz
892 	sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue();
893 	rXLSet.Put( XLineTransparenceItem( nVal ) );
894 
895 	// #116827#
896 	aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
897 
898 	return( sal_True );
899 }
900 
901 // -----------------------------------------------------------------------
902 
903 void SvxLineTabPage::Reset( const SfxItemSet& rAttrs )
904 {
905 	String		aString;
906 	XLineStyle	eXLS; // XLINE_NONE, XLINE_SOLID, XLINE_DASH
907 
908 	// Linienstil
909 /*
910 	if( bObjSelected &&
911 		rAttrs.GetItemState( GetWhich( XATTR_LINESTYLE ) ) == SFX_ITEM_DEFAULT )
912 	{
913 		aLbLineStyle.Disable();
914 	}
915 */
916 	const SfxPoolItem *pPoolItem;
917 	long nSymType=SVX_SYMBOLTYPE_UNKNOWN;
918 	sal_Bool bPrevSym=sal_False;
919 	sal_Bool bEnable=sal_True;
920 	sal_Bool bIgnoreGraphic=sal_False;
921 	sal_Bool bIgnoreSize=sal_False;
922 	if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),sal_True,&pPoolItem) == SFX_ITEM_SET)
923 	{
924 		nSymType=((const SfxInt32Item *)pPoolItem)->GetValue();
925 	}
926 
927 	if(nSymType == SVX_SYMBOLTYPE_AUTO)
928 	{
929 		aSymbolGraphic=aAutoSymbolGraphic;
930 		aSymbolSize=aSymbolLastSize=aAutoSymbolGraphic.GetPrefSize();
931 		bPrevSym=sal_True;
932 	}
933 	else if(nSymType == SVX_SYMBOLTYPE_NONE)
934 	{
935 		bEnable=sal_False;
936 		bIgnoreGraphic=sal_True;
937 		bIgnoreSize=sal_True;
938 	}
939 	else if(nSymType >= 0)
940 	{
941 		VirtualDevice aVDev;
942 		aVDev.SetMapMode(MapMode(MAP_100TH_MM));
943 
944 		SdrModel* pModel = new SdrModel(NULL, NULL, LOADREFCOUNTS);
945 		pModel->GetItemPool().FreezeIdRanges();
946 		SdrPage* pPage = new SdrPage( *pModel, sal_False );
947 		pPage->SetSize(Size(1000,1000));
948 		pModel->InsertPage( pPage, 0 );
949 		SdrView* pView = new SdrView( pModel, &aVDev );
950 		pView->hideMarkHandles();
951 		SdrPageView* pPageView = pView->ShowSdrPage(pPage);
952 //		SdrPageView* pPageView = pView->ShowSdrPage(pPage, Point());
953 		SdrObject *pObj=NULL;
954 		long nSymTmp=nSymType;
955 		if(pSymbolList)
956 		{
957 			if(pSymbolList->GetObjCount())
958 			{
959 				nSymTmp=nSymTmp%pSymbolList->GetObjCount(); //Liste wird als cyclisch betrachtet!!!
960 				pObj=pSymbolList->GetObj(nSymTmp);
961 				if(pObj)
962 				{
963 					pObj=pObj->Clone();
964 					pPage->NbcInsertObject(pObj);
965 					pView->MarkObj(pObj,pPageView);
966 					if(pSymbolAttr)
967 					{
968 						pObj->SetMergedItemSet(*pSymbolAttr);
969 					}
970 					else
971 					{
972 						pObj->SetMergedItemSet(rOutAttrs);
973 					}
974 					GDIMetaFile aMeta(pView->GetAllMarkedMetaFile());
975 
976 					aSymbolGraphic=Graphic(aMeta);
977 					aSymbolSize=pObj->GetSnapRect().GetSize();
978 					aSymbolGraphic.SetPrefSize(aSymbolSize);
979 					aSymbolGraphic.SetPrefMapMode(MAP_100TH_MM);
980 					bPrevSym=sal_True;
981 					bEnable=sal_True;
982 					bIgnoreGraphic=sal_True;
983 
984 					pView->UnmarkAll();
985 					pObj=pPage->RemoveObject(0);
986                     SdrObject::Free( pObj );
987 				}
988 			}
989 		}
990 		delete pView;
991 		delete pModel;
992 	}
993 	if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH),sal_True,&pPoolItem) == SFX_ITEM_SET)
994 	{
995 		const Graphic* pGraphic = ((const SvxBrushItem *)pPoolItem)->GetGraphic();
996 		if( pGraphic )
997         {
998             if(!bIgnoreGraphic)
999 		    {
1000 			    aSymbolGraphic=*pGraphic;
1001 		    }
1002 		    if(!bIgnoreSize)
1003 		    {
1004 			    aSymbolSize=OutputDevice::LogicToLogic( pGraphic->GetPrefSize(),
1005 													    pGraphic->GetPrefMapMode(),
1006 													    MAP_100TH_MM );
1007 		    }
1008 		    bPrevSym=sal_True;
1009         }
1010 	}
1011 	if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),sal_True,&pPoolItem) == SFX_ITEM_SET)
1012 	{
1013 		aSymbolSize = ((const SvxSizeItem *)pPoolItem)->GetSize();
1014 	}
1015 
1016 
1017 	aSymbolRatioCB.Enable(bEnable);
1018 	aSymbolHeightFT.Enable(bEnable);
1019 	aSymbolWidthFT.Enable(bEnable);
1020 	aSymbolWidthMF.Enable(bEnable);
1021 	aSymbolHeightMF.Enable(bEnable);
1022 	if(bPrevSym)
1023 	{
1024 		SetMetricValue(aSymbolWidthMF,  aSymbolSize.Width(), ePoolUnit);
1025 		SetMetricValue(aSymbolHeightMF, aSymbolSize.Height(),ePoolUnit);
1026 		aCtlPreview.SetSymbol(&aSymbolGraphic,aSymbolSize);
1027 		aSymbolLastSize=aSymbolSize;
1028 	}
1029 
1030 	if( rAttrs.GetItemState( XATTR_LINESTYLE ) != SFX_ITEM_DONTCARE )
1031 	{
1032 		eXLS = (XLineStyle) ( ( const XLineStyleItem& ) rAttrs.Get( XATTR_LINESTYLE ) ).GetValue();
1033 
1034 		switch( eXLS )
1035 		{
1036 			case XLINE_NONE:
1037 				aLbLineStyle.SelectEntryPos( 0 );
1038 				break;
1039 			case XLINE_SOLID:
1040 				aLbLineStyle.SelectEntryPos( 1 );
1041 				break;
1042 
1043 			case XLINE_DASH:
1044 				aLbLineStyle.SetNoSelection();
1045 				aLbLineStyle.SelectEntry( ( ( const XLineDashItem& ) rAttrs.
1046 								Get( XATTR_LINEDASH ) ).GetName() );
1047 				break;
1048 
1049 			default:
1050 				break;
1051 		}
1052 	}
1053 	else
1054 	{
1055 		aLbLineStyle.SetNoSelection();
1056 	}
1057 
1058 	// Linienstaerke
1059 /*
1060 	if( bObjSelected &&
1061 		rAttrs.GetItemState( GetWhich( XATTR_LINEWIDTH ) ) == SFX_ITEM_DEFAULT )
1062 	{
1063 		aMtrLineWidth.Disable();
1064 	}
1065 */
1066 	if( rAttrs.GetItemState( XATTR_LINEWIDTH ) != SFX_ITEM_DONTCARE )
1067 	{
1068 		SetMetricValue( aMtrLineWidth, ( ( const XLineWidthItem& ) rAttrs.
1069 							Get( XATTR_LINEWIDTH ) ).GetValue(), ePoolUnit );
1070 	}
1071 	else
1072 		aMtrLineWidth.SetText( String() );
1073 
1074 	// Linienfarbe
1075 /*
1076 	if( bObjSelected &&
1077 		rAttrs.GetItemState( GetWhich( XATTR_LINECOLOR ) ) == SFX_ITEM_DEFAULT )
1078 	{
1079 		aLbColor.Disable();
1080 	}
1081 */
1082 	aLbColor.SetNoSelection();
1083 
1084 	if ( rAttrs.GetItemState( XATTR_LINECOLOR ) != SFX_ITEM_DONTCARE )
1085 	{
1086         Color aCol = ( ( const XLineColorItem& ) rAttrs.Get( XATTR_LINECOLOR ) ).GetColorValue();
1087 		aLbColor.SelectEntry( aCol );
1088 		if( aLbColor.GetSelectEntryCount() == 0 )
1089 		{
1090 			aLbColor.InsertEntry( aCol, String() );
1091 			aLbColor.SelectEntry( aCol );
1092 		}
1093 	}
1094 
1095 	// LinienAnfang
1096 	if( bObjSelected &&
1097 		rAttrs.GetItemState( XATTR_LINESTART ) == SFX_ITEM_DEFAULT )
1098 	{
1099 		aLbStartStyle.Disable();
1100 	}
1101 	else if( rAttrs.GetItemState( XATTR_LINESTART ) != SFX_ITEM_DONTCARE )
1102 	{
1103 		// #86265# select entry using list and polygon, not string
1104 		sal_Bool bSelected(sal_False);
1105 		const basegfx::B2DPolyPolygon& rItemPolygon = ((const XLineStartItem&)rAttrs.Get(XATTR_LINESTART)).GetLineStartValue();
1106 
1107 		for(sal_Int32 a(0);!bSelected &&  a < pLineEndList->Count(); a++)
1108 		{
1109 			XLineEndEntry* pEntry = pLineEndList->GetLineEnd(a);
1110 			const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
1111 
1112 			if(rItemPolygon == rEntryPolygon)
1113 			{
1114 				// select this entry
1115 				aLbStartStyle.SelectEntryPos((sal_uInt16)a + 1);
1116 				bSelected = sal_True;
1117 			}
1118 		}
1119 
1120 		if(!bSelected)
1121 			aLbStartStyle.SelectEntryPos( 0 );
1122 	}
1123 	else
1124 	{
1125 		aLbStartStyle.SetNoSelection();
1126 	}
1127 
1128 	// LinienEnde
1129 	if( bObjSelected &&
1130 		rAttrs.GetItemState( XATTR_LINEEND ) == SFX_ITEM_DEFAULT )
1131 	{
1132 		aLbEndStyle.Disable();
1133 	}
1134 	else if( rAttrs.GetItemState( XATTR_LINEEND ) != SFX_ITEM_DONTCARE )
1135 	{
1136 		// #86265# select entry using list and polygon, not string
1137 		sal_Bool bSelected(sal_False);
1138 		const basegfx::B2DPolyPolygon& rItemPolygon = ((const XLineEndItem&)rAttrs.Get(XATTR_LINEEND)).GetLineEndValue();
1139 
1140 		for(sal_Int32 a(0);!bSelected &&  a < pLineEndList->Count(); a++)
1141 		{
1142 			XLineEndEntry* pEntry = pLineEndList->GetLineEnd(a);
1143 			const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
1144 
1145 			if(rItemPolygon == rEntryPolygon)
1146 			{
1147 				// select this entry
1148 				aLbEndStyle.SelectEntryPos((sal_uInt16)a + 1);
1149 				bSelected = sal_True;
1150 			}
1151 		}
1152 
1153 		if(!bSelected)
1154 			aLbEndStyle.SelectEntryPos( 0 );
1155 	}
1156 	else
1157 	{
1158 		aLbEndStyle.SetNoSelection();
1159 	}
1160 
1161 	// LinienAnfang St"arke
1162 	if( bObjSelected &&
1163 		rAttrs.GetItemState( XATTR_LINESTARTWIDTH ) == SFX_ITEM_DEFAULT )
1164 	{
1165 		aMtrStartWidth.Disable();
1166 	}
1167 	else if( rAttrs.GetItemState( XATTR_LINESTARTWIDTH ) != SFX_ITEM_DONTCARE )
1168 	{
1169 		SetMetricValue( aMtrStartWidth, ( ( const XLineStartWidthItem& ) rAttrs.
1170 							Get( XATTR_LINESTARTWIDTH ) ).GetValue(), ePoolUnit );
1171 	}
1172 	else
1173 		aMtrStartWidth.SetText( String() );
1174 
1175 	// LinienEnde St"arke
1176 	if( bObjSelected &&
1177 		rAttrs.GetItemState( XATTR_LINEENDWIDTH ) == SFX_ITEM_DEFAULT )
1178 	{
1179 		aMtrEndWidth.Disable();
1180 	}
1181 	else if( rAttrs.GetItemState( XATTR_LINEENDWIDTH ) != SFX_ITEM_DONTCARE )
1182 	{
1183 		SetMetricValue( aMtrEndWidth, ( ( const XLineEndWidthItem& ) rAttrs.
1184 							Get( XATTR_LINEENDWIDTH ) ).GetValue(), ePoolUnit );
1185 	}
1186 	else
1187 		aMtrEndWidth.SetText( String() );
1188 
1189 	// Linienenden zentriert (Start)
1190 	if( bObjSelected &&
1191 		rAttrs.GetItemState( XATTR_LINESTARTCENTER ) == SFX_ITEM_DEFAULT )
1192 	{
1193 		aTsbCenterStart.Disable();
1194 	}
1195 	else if( rAttrs.GetItemState( XATTR_LINESTARTCENTER ) != SFX_ITEM_DONTCARE )
1196 	{
1197 		aTsbCenterStart.EnableTriState( sal_False );
1198 
1199 		if( ( ( const XLineStartCenterItem& ) rAttrs.Get( XATTR_LINESTARTCENTER ) ).GetValue() )
1200 			aTsbCenterStart.SetState( STATE_CHECK );
1201 		else
1202 			aTsbCenterStart.SetState( STATE_NOCHECK );
1203 	}
1204 	else
1205 	{
1206 		aTsbCenterStart.SetState( STATE_DONTKNOW );
1207 	}
1208 
1209 	// Linienenden zentriert (Ende)
1210 	if( bObjSelected &&
1211 		rAttrs.GetItemState( XATTR_LINEENDCENTER ) == SFX_ITEM_DEFAULT )
1212 	{
1213 		aTsbCenterEnd.Disable();
1214 	}
1215 	else if( rAttrs.GetItemState( XATTR_LINEENDCENTER ) != SFX_ITEM_DONTCARE )
1216 	{
1217 		aTsbCenterEnd.EnableTriState( sal_False );
1218 
1219 		if( ( ( const XLineEndCenterItem& ) rAttrs.Get( XATTR_LINEENDCENTER ) ).GetValue() )
1220 			aTsbCenterEnd.SetState( STATE_CHECK );
1221 		else
1222 			aTsbCenterEnd.SetState( STATE_NOCHECK );
1223 	}
1224 	else
1225 	{
1226 		aTsbCenterEnd.SetState( STATE_DONTKNOW );
1227 	}
1228 
1229 	// Transparenz
1230 	if( rAttrs.GetItemState( XATTR_LINETRANSPARENCE ) != SFX_ITEM_DONTCARE )
1231 	{
1232 		sal_uInt16 nTransp = ( ( const XLineTransparenceItem& ) rAttrs.
1233 								Get( XATTR_LINETRANSPARENCE ) ).GetValue();
1234 		aMtrTransparent.SetValue( nTransp );
1235 		ChangeTransparentHdl_Impl( NULL );
1236 	}
1237 	else
1238 		aMtrTransparent.SetText( String() );
1239 
1240 	if( !aLbStartStyle.IsEnabled()	&&
1241 		!aLbEndStyle.IsEnabled()	&&
1242 		!aMtrStartWidth.IsEnabled() &&
1243 		!aMtrEndWidth.IsEnabled()	&&
1244 		!aTsbCenterStart.IsEnabled()&&
1245 		!aTsbCenterEnd.IsEnabled() )
1246 	{
1247 		aCbxSynchronize.Disable();
1248 		aFtLineEndsStyle.Disable();
1249 		aFtLineEndsWidth.Disable();
1250 		aFlLineEnds.Disable();
1251 	}
1252 
1253 	// Synchronisieren
1254 	// Jetzt wird der Wert aus der INI-Datei geholt (#42258#)
1255 	String aStr = GetUserData();
1256 	aCbxSynchronize.Check( (sal_Bool)aStr.ToInt32() );
1257 
1258 	// #116827#
1259 	if(bObjSelected && SFX_ITEM_DEFAULT == rAttrs.GetItemState(XATTR_LINEJOINT))
1260 	{
1261 		maFTEdgeStyle.Disable();
1262 		maLBEdgeStyle.Disable();
1263 	}
1264 	else if(SFX_ITEM_DONTCARE != rAttrs.GetItemState(XATTR_LINEJOINT))
1265 	{
1266 		XLineJoint eLineJoint = ((const XLineJointItem&)(rAttrs.Get(XATTR_LINEJOINT))).GetValue();
1267 
1268 		switch(eLineJoint)
1269 		{
1270 			case XLINEJOINT_ROUND : maLBEdgeStyle.SelectEntryPos(0); break;
1271 			case XLINEJOINT_NONE : maLBEdgeStyle.SelectEntryPos(1); break;
1272 			case XLINEJOINT_MITER : maLBEdgeStyle.SelectEntryPos(2); break;
1273 			case XLINEJOINT_BEVEL : maLBEdgeStyle.SelectEntryPos(3); break;
1274             case XLINEJOINT_MIDDLE : break;
1275 		}
1276 	}
1277 	else
1278 	{
1279 		maLBEdgeStyle.SetNoSelection();
1280 	}
1281 
1282 	/*
1283 	if( aLbStartStyle.GetSelectEntryPos() == aLbEndStyle.GetSelectEntryPos() &&
1284 		aMtrStartWidth.GetValue() == aMtrEndWidth.GetValue() &&
1285 		aTsbCenterStart.GetState() == aTsbCenterEnd.GetState() )
1286 	{
1287 		aCbxSynchronize.Check();
1288 	}
1289 	*/
1290 
1291 	// Werte sichern
1292 	aLbLineStyle.SaveValue();
1293 	aMtrLineWidth.SaveValue();
1294 	aLbColor.SaveValue();
1295 	aLbStartStyle.SaveValue();
1296 	aLbEndStyle.SaveValue();
1297 	aMtrStartWidth.SaveValue();
1298 	aMtrEndWidth.SaveValue();
1299 	aTsbCenterStart.SaveValue();
1300 	aTsbCenterEnd.SaveValue();
1301 	aMtrTransparent.SaveValue();
1302 
1303 	// #116827#
1304 	maLBEdgeStyle.SaveValue();
1305 
1306 	ClickInvisibleHdl_Impl( this );
1307 	//ClickMeasuringHdl_Impl( this );
1308 	//aCtlPosition.Reset();
1309 
1310 	ChangePreviewHdl_Impl( NULL );
1311 }
1312 
1313 // -----------------------------------------------------------------------
1314 
1315 SfxTabPage* SvxLineTabPage::Create( Window* pWindow,
1316 				const SfxItemSet& rAttrs )
1317 {
1318 	return( new SvxLineTabPage( pWindow, rAttrs ) );
1319 }
1320 
1321 //------------------------------------------------------------------------
1322 
1323 sal_uInt16*	SvxLineTabPage::GetRanges()
1324 {
1325 	return( pLineRanges );
1326 }
1327 
1328 //------------------------------------------------------------------------
1329 
1330 IMPL_LINK( SvxLineTabPage, ChangePreviewHdl_Impl, void *, pCntrl )
1331 {
1332 	if(pCntrl == &aMtrLineWidth)
1333 	{
1334 		// Linienbreite und Start/EndBreite
1335 		sal_Int32 nNewLineWidth = GetCoreValue( aMtrLineWidth, ePoolUnit );
1336 		if(nActLineWidth == -1)
1337 		{
1338 			// Noch nicht initialisiert, hole den Startwert
1339 			const SfxPoolItem* pOld = GetOldItem( rXLSet, XATTR_LINEWIDTH );
1340 			sal_Int32 nStartLineWidth = 0;
1341 			if(pOld)
1342 				nStartLineWidth = (( const XLineWidthItem *)pOld)->GetValue();
1343 			nActLineWidth = nStartLineWidth;
1344 		}
1345 
1346 		if(nActLineWidth != nNewLineWidth)
1347 		{
1348 			// Anpassungen Start/EndWidth #63083#
1349 			sal_Int32 nValAct = GetCoreValue( aMtrStartWidth, ePoolUnit );
1350 			sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
1351 			if(nValNew < 0)
1352 				nValNew = 0;
1353 			SetMetricValue( aMtrStartWidth, nValNew, ePoolUnit );
1354 
1355 			nValAct = GetCoreValue( aMtrEndWidth, ePoolUnit );
1356 			nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
1357 			if(nValNew < 0)
1358 				nValNew = 0;
1359 			SetMetricValue( aMtrEndWidth, nValNew, ePoolUnit );
1360 		}
1361 
1362 		// Aktuellen Wert merken
1363 		nActLineWidth = nNewLineWidth;
1364 	}
1365 
1366 	FillXLSet_Impl();
1367 	aCtlPreview.Invalidate();
1368 
1369 	// Transparenz entspr. zugaenglich machen
1370 	if( aLbLineStyle.GetSelectEntryPos() == 0 ) // unsichtbar
1371 	{
1372 		aFtTransparent.Disable();
1373 		aMtrTransparent.Disable();
1374 	}
1375 	else
1376 	{
1377 		aFtTransparent.Enable();
1378 		aMtrTransparent.Enable();
1379 	}
1380 
1381 	const bool bHasLineStart = aLbStartStyle.GetSelectEntryPos() != 0;
1382 	const bool bHasLineEnd = aLbEndStyle.GetSelectEntryPos() != 0;
1383 
1384     aFtLineEndsWidth.Enable( bHasLineStart || bHasLineEnd );
1385     aMtrStartWidth.Enable( bHasLineStart );
1386     aTsbCenterStart.Enable( bHasLineStart );
1387     aMtrEndWidth.Enable( bHasLineEnd );
1388     aTsbCenterEnd.Enable( bHasLineEnd );
1389 
1390 	return( 0L );
1391 }
1392 
1393 //------------------------------------------------------------------------
1394 
1395 IMPL_LINK( SvxLineTabPage, ChangeStartHdl_Impl, void *, p )
1396 {
1397 	if( aCbxSynchronize.IsChecked() )
1398 	{
1399 		if( p == &aMtrStartWidth )
1400 			aMtrEndWidth.SetValue( aMtrStartWidth.GetValue() );
1401 		if( p == &aLbStartStyle )
1402 			aLbEndStyle.SelectEntryPos( aLbStartStyle.GetSelectEntryPos() );
1403 		if( p == &aTsbCenterStart )
1404 			aTsbCenterEnd.SetState( aTsbCenterStart.GetState() );
1405 	}
1406 
1407 	ChangePreviewHdl_Impl( this );
1408 
1409 	return( 0L );
1410 }
1411 
1412 //------------------------------------------------------------------------
1413 // #116827#
1414 
1415 IMPL_LINK( SvxLineTabPage, ChangeEdgeStyleHdl_Impl, void *, EMPTYARG )
1416 {
1417 	ChangePreviewHdl_Impl( this );
1418 
1419 	return( 0L );
1420 }
1421 
1422 //------------------------------------------------------------------------
1423 
1424 IMPL_LINK( SvxLineTabPage, ClickInvisibleHdl_Impl, void *, EMPTYARG )
1425 {
1426 	if( aLbLineStyle.GetSelectEntryPos() == 0 ) // unsichtbar
1427 	{
1428 		aFtColor.Disable();
1429         if(!bSymbols)
1430 		    aLbColor.Disable();
1431 		aFtLineWidth.Disable();
1432 		aMtrLineWidth.Disable();
1433 
1434 		if( aFlLineEnds.IsEnabled() )
1435 		{
1436 			aFtLineEndsStyle.Disable();
1437 			aFtLineEndsWidth.Disable();
1438 			aLbStartStyle.Disable();
1439 			aMtrStartWidth.Disable();
1440 			aTsbCenterStart.Disable();
1441 			aLbEndStyle.Disable();
1442 			aMtrEndWidth.Disable();
1443 			aTsbCenterEnd.Disable();
1444 			aCbxSynchronize.Disable();
1445 
1446 			// #116827#
1447 			maFTEdgeStyle.Disable();
1448 			maLBEdgeStyle.Disable();
1449 		}
1450 	}
1451 	else
1452 	{
1453 		aFtColor.Enable();
1454 		aLbColor.Enable();
1455 		aFtLineWidth.Enable();
1456 		aMtrLineWidth.Enable();
1457 
1458 		if( aFlLineEnds.IsEnabled() )
1459 		{
1460 			aFtLineEndsStyle.Enable();
1461 			aFtLineEndsWidth.Enable();
1462 			aLbStartStyle.Enable();
1463 			aMtrStartWidth.Enable();
1464 			aTsbCenterStart.Enable();
1465 			aLbEndStyle.Enable();
1466 			aMtrEndWidth.Enable();
1467 			aTsbCenterEnd.Enable();
1468 			aCbxSynchronize.Enable();
1469 
1470 			// #116827#
1471 			maFTEdgeStyle.Enable();
1472 			maLBEdgeStyle.Enable();
1473 		}
1474 	}
1475 	ChangePreviewHdl_Impl( NULL );
1476 
1477 	return( 0L );
1478 }
1479 
1480 //------------------------------------------------------------------------
1481 
1482 IMPL_LINK( SvxLineTabPage, ChangeEndHdl_Impl, void *, p )
1483 {
1484 	if( aCbxSynchronize.IsChecked() )
1485 	{
1486 		if( p == &aMtrEndWidth )
1487 			aMtrStartWidth.SetValue( aMtrEndWidth.GetValue() );
1488 		if( p == &aLbEndStyle )
1489 			aLbStartStyle.SelectEntryPos( aLbEndStyle.GetSelectEntryPos() );
1490 		if( p == &aTsbCenterEnd )
1491 			aTsbCenterStart.SetState( aTsbCenterEnd.GetState() );
1492 	}
1493 
1494 	ChangePreviewHdl_Impl( this );
1495 
1496 	return( 0L );
1497 }
1498 
1499 //------------------------------------------------------------------------
1500 /*
1501 
1502 long SvxLineTabPage::ClickMeasuringHdl_Impl( void* )
1503 {
1504 	if( aTsbShowMeasuring.GetState() == STATE_NOCHECK )
1505 	{
1506 		aFtPosition.Disable();
1507 		aCtlPosition.Disable();
1508 	}
1509 	else
1510 	{
1511 		aFtPosition.Enable();
1512 		aCtlPosition.Enable();
1513 	}
1514 	aCtlPosition.Invalidate();
1515 
1516 	return( 0L );
1517 }
1518 */
1519 //------------------------------------------------------------------------
1520 
1521 IMPL_LINK( SvxLineTabPage, ChangeTransparentHdl_Impl, void *, EMPTYARG )
1522 {
1523 	sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue();
1524 	XLineTransparenceItem aItem( nVal );
1525 
1526 	rXLSet.Put( XLineTransparenceItem( aItem ) );
1527 
1528 	// #116827#
1529 	FillXLSet_Impl();
1530 
1531 	aCtlPreview.Invalidate();
1532 
1533 	return( 0L );
1534 }
1535 
1536 //------------------------------------------------------------------------
1537 
1538 void SvxLineTabPage::PointChanged( Window*, RECT_POINT eRcPt )
1539 {
1540 	eRP = eRcPt;
1541 }
1542 
1543 //------------------------------------------------------------------------
1544 
1545 void SvxLineTabPage::FillUserData()
1546 {
1547 	// Abgleich wird in der Ini-Datei festgehalten
1548 	UniString aStrUserData = UniString::CreateFromInt32( (sal_Int32) aCbxSynchronize.IsChecked() );
1549 	SetUserData( aStrUserData );
1550 }
1551 
1552 
1553 //#58425# Symbole auf einer Linie (z.B. StarChart)
1554 //Handler f�r Popup-Menue der Symbolauswahl (NumMenueButton)
1555 //der folgende Link stammt urspruenglich aus SvxNumOptionsTabPage
1556 IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton )
1557 {
1558 	//Popup initialisieren
1559 	if(!pButton->GetPopupMenu()->GetPopupMenu( MN_GALLERY ))
1560 	{
1561 		// Gallery-Eintraege besorgen
1562 		GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames);
1563 
1564 		PopupMenu* pPopup = new PopupMenu;
1565 		String aEmptyStr;
1566 
1567 		nNumMenuGalleryItems=aGrfNames.Count();
1568 		for(long i = 0; i < nNumMenuGalleryItems; i++)
1569 		{
1570             const String* pGrfName = (const String*)aGrfNames.GetObject(i);
1571             const String* pUIName = pGrfName;
1572 
1573             // convert URL encodings to UI characters (eg %20 for spaces)
1574             String aPhysicalName;
1575             if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( *pGrfName, aPhysicalName ))
1576                 pUIName = &aPhysicalName;
1577 
1578             SvxBrushItem* pBrushItem = new SvxBrushItem(*pGrfName, aEmptyStr, GPOS_AREA, SID_ATTR_BRUSH);
1579 			pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl));
1580 
1581 			SvxBmpItemInfo* pInfo = new SvxBmpItemInfo();
1582 			pInfo->pBrushItem = pBrushItem;
1583 			pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i);
1584 			aGrfBrushItems.Insert(pInfo, i);
1585 			const Graphic* pGraphic = pBrushItem->GetGraphic();
1586 
1587 			if(pGraphic)
1588 			{
1589 				Bitmap aBitmap(pGraphic->GetBitmap());
1590 				Size aSize(aBitmap.GetSizePixel());
1591 				if(aSize.Width()  > MAX_BMP_WIDTH ||
1592 				   aSize.Height() > MAX_BMP_HEIGHT)
1593 				{
1594 					sal_Bool bWidth = aSize.Width() > aSize.Height();
1595 					double nScale = bWidth ?
1596 										(double)MAX_BMP_WIDTH / (double)aSize.Width():
1597 										(double)MAX_BMP_HEIGHT / (double)aSize.Height();
1598 					aBitmap.Scale(nScale, nScale);
1599 
1600 				}
1601 				Image aImage(aBitmap);
1602 				pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage );
1603 			}
1604 			else
1605 			{
1606 				Image aImage;
1607 				pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage );
1608 			}
1609 		}
1610 		aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup );
1611 		if(!aGrfNames.Count())
1612 			aSymbolMB.GetPopupMenu()->EnableItem(MN_GALLERY, sal_False);
1613 	}
1614 
1615 	if(!pButton->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS ) && pSymbolList)
1616 	{
1617 		VirtualDevice aVDev;
1618 		aVDev.SetMapMode(MapMode(MAP_100TH_MM));
1619 		SdrModel* pModel = new SdrModel(NULL, NULL, LOADREFCOUNTS);
1620 		pModel->GetItemPool().FreezeIdRanges();
1621 		// Page
1622 		SdrPage* pPage = new SdrPage( *pModel, sal_False );
1623 		pPage->SetSize(Size(1000,1000));
1624 		pModel->InsertPage( pPage, 0 );
1625 		// 3D View
1626 		SdrView* pView = new SdrView( pModel, &aVDev );
1627 		pView->hideMarkHandles();
1628 //		SdrPageView* pPageView = pView->ShowSdrPage(pPage, Point());
1629 		SdrPageView* pPageView = pView->ShowSdrPage(pPage);
1630 
1631 		PopupMenu* pPopup = new PopupMenu;
1632 		String aEmptyStr;
1633 		for(long i=0;; ++i)
1634 		{
1635             SdrObject *pObj=pSymbolList->GetObj(i);
1636             if(pObj==NULL)
1637                 break;
1638 			pObj=pObj->Clone();
1639 			//const String* pGrfName = (const String*)aGrfNames.GetObject(i);
1640 			String *pStr=new String();//String(i));
1641 			aGrfNames.Insert(pStr,LIST_APPEND);
1642 			//Rectangle aRect(pObj->GetLogicRect());
1643 			pPage->NbcInsertObject(pObj);
1644 			pView->MarkObj(pObj,pPageView);
1645 			if(pSymbolAttr)
1646 			{
1647 				pObj->SetMergedItemSet(*pSymbolAttr);
1648 			}
1649 			else
1650 			{
1651 				pObj->SetMergedItemSet(rOutAttrs);
1652 			}
1653 
1654 			Bitmap aBitmap(pView->GetAllMarkedBitmap());
1655 			GDIMetaFile aMeta(pView->GetAllMarkedMetaFile());
1656 			pView->UnmarkAll();
1657 			pObj=pPage->RemoveObject(0);
1658             SdrObject::Free(pObj);
1659 
1660             SvxBrushItem* pBrushItem = new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH);
1661 			pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl));
1662 
1663 			SvxBmpItemInfo* pInfo = new SvxBmpItemInfo();
1664 			pInfo->pBrushItem = pBrushItem;
1665 			pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i + nNumMenuGalleryItems);
1666 			aGrfBrushItems.Insert(pInfo, nNumMenuGalleryItems + i);
1667 
1668 			Size aSize(aBitmap.GetSizePixel());
1669 			if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT)
1670 			{
1671 				sal_Bool bWidth = aSize.Width() > aSize.Height();
1672 				double nScale = bWidth ?
1673 									(double)MAX_BMP_WIDTH / (double)aSize.Width():
1674 									(double)MAX_BMP_HEIGHT / (double)aSize.Height();
1675 				aBitmap.Scale(nScale, nScale);
1676 			}
1677 			Image aImage(aBitmap);
1678 			pPopup->InsertItem(pInfo->nItemId,*pStr,aImage);
1679 		}
1680 		aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_SYMBOLS, pPopup );
1681 		if(!aGrfNames.Count())
1682 			aSymbolMB.GetPopupMenu()->EnableItem(MN_SYMBOLS, sal_False);
1683 
1684 		delete pView;
1685 		delete pModel;
1686 	}
1687 	return 0;
1688 }
1689 //#58425# Symbole auf einer Linie (z.B. StarChart)
1690 //Handler f�r Popup-Menue der Symbolauswahl (NumMenueButton)
1691 //der folgende Link stammt urspruenglich aus SvxNumOptionsTabPage:
1692 IMPL_STATIC_LINK(SvxLineTabPage, GraphicArrivedHdl_Impl, SvxBrushItem*, pItem)
1693 {
1694 	PopupMenu* pPopup = pThis->aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
1695 
1696 	SvxBmpItemInfo* pBmpInfo = 0;
1697 	for ( sal_uInt16 i = 0; i < pThis->aGrfBrushItems.Count(); i++ )
1698 	{
1699 		SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)pThis->aGrfBrushItems.GetObject(i);
1700 		if( pInfo->pBrushItem == pItem )
1701 		{
1702 			pBmpInfo = pInfo; break;
1703 		}
1704 	}
1705 	if( pBmpInfo )
1706 	{
1707         if( pItem->GetGraphic() )
1708         {
1709             Bitmap aBitmap(pItem->GetGraphic()->GetBitmap());
1710             Size aSize(aBitmap.GetSizePixel());
1711             if(aSize.Width()  > MAX_BMP_WIDTH ||
1712                aSize.Height() > MAX_BMP_HEIGHT)
1713             {
1714                 sal_Bool bWidth = aSize.Width() > aSize.Height();
1715                 double nScale = bWidth ?
1716                     (double)MAX_BMP_WIDTH / (double)aSize.Width():
1717                     (double)MAX_BMP_HEIGHT / (double)aSize.Height();
1718                 aBitmap.Scale(nScale, nScale);
1719             }
1720             Image aImage(aBitmap);
1721             pPopup->SetItemImage( pBmpInfo->nItemId, aImage );
1722         }
1723 	}
1724 
1725 	return 0;
1726 }
1727 
1728 //#58425# Symbole auf einer Linie (z.B. StarChart)
1729 //Handler f�r Menuebutton
1730 IMPL_LINK( SvxLineTabPage, GraphicHdl_Impl, MenuButton *, pButton )
1731 {
1732 	sal_uInt16 nItemId = pButton->GetCurItemId();
1733 	const Graphic* pGraphic = 0;
1734 	Graphic aGraphic;
1735 	String aGrfName;
1736 	sal_Bool bResetSize = sal_False;
1737 	sal_Bool bEnable=sal_True;
1738     long nPreviousSymbolType = nSymbolType;
1739 
1740 	if(nItemId >= MN_GALLERY_ENTRY)
1741 	{
1742 		if( (nItemId-MN_GALLERY_ENTRY) >= nNumMenuGalleryItems)
1743 		{
1744 			nSymbolType=nItemId-MN_GALLERY_ENTRY-nNumMenuGalleryItems; //Index der Liste
1745 		}
1746 		else
1747 		{
1748 			nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM;
1749             bResetSize = sal_True;
1750 		}
1751 		SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)aGrfBrushItems.GetObject(nItemId - MN_GALLERY_ENTRY);
1752 		pGraphic = pInfo->pBrushItem->GetGraphic();
1753 	}
1754 	else switch(nItemId)
1755 	{
1756 		case MN_SYMBOLS_AUTO:
1757 		{
1758 			pGraphic=&aAutoSymbolGraphic;
1759 			aAutoSymbolGraphic.SetPrefSize( Size(253,253) );
1760 			nSymbolType=SVX_SYMBOLTYPE_AUTO;
1761 		}
1762 		break;
1763 
1764 		case MN_SYMBOLS_NONE:
1765 		{
1766 			nSymbolType=SVX_SYMBOLTYPE_NONE;
1767 			pGraphic=NULL;
1768 			bEnable=sal_False;
1769 		}
1770 		break;
1771 		default:
1772 		{
1773 			SvxOpenGraphicDialog aGrfDlg(CUI_RES(RID_STR_EDIT_GRAPHIC));
1774 			aGrfDlg.EnableLink(sal_False);
1775 			aGrfDlg.AsLink(sal_False);
1776 			if( !aGrfDlg.Execute() )
1777 			{
1778 				// ausgewaehlten Filter merken
1779 				aGrfName = aGrfDlg.GetPath();
1780 				if( !aGrfDlg.GetGraphic(aGraphic) )
1781                 {
1782                     nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM;
1783 					pGraphic = &aGraphic;
1784                     bResetSize = sal_True;
1785                 }
1786 			}
1787             if( !pGraphic )
1788                 return 0;
1789 		}
1790 		break;
1791 	}
1792 
1793 	if(pGraphic)
1794 	{
1795 		Size aSize = SvxNumberFormat::GetGraphicSizeMM100(pGraphic);
1796 		aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)ePoolUnit);
1797 		aSymbolGraphic=*pGraphic;
1798 		if( bResetSize )
1799 		{
1800 			aSymbolSize=aSize;
1801 		}
1802         else if( nPreviousSymbolType == SVX_SYMBOLTYPE_BRUSHITEM )
1803         {   //#i31097# Data Point Symbol size changes when a different symbol is choosen(maoyg)
1804             if( aSymbolSize.Width() != aSymbolSize.Height() )
1805             {
1806                 aSize.setWidth( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 );
1807                 aSize.setHeight( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 );
1808                 aSymbolSize = aSize;
1809             }
1810         }
1811 		aCtlPreview.SetSymbol(&aSymbolGraphic,aSymbolSize);
1812 	}
1813 	else
1814 	{
1815 		aSymbolGraphic=Graphic();
1816 		aCtlPreview.SetSymbol(NULL,aSymbolSize);
1817 		bEnable=sal_False;
1818 	}
1819 	aSymbolLastSize=aSymbolSize;
1820 	SetMetricValue(aSymbolWidthMF,  aSymbolSize.Width(), ePoolUnit);
1821 	SetMetricValue(aSymbolHeightMF, aSymbolSize.Height(), ePoolUnit);
1822 	aSymbolRatioCB.Enable(bEnable);
1823 	aSymbolHeightFT.Enable(bEnable);
1824 	aSymbolWidthFT.Enable(bEnable);
1825 	aSymbolWidthMF.Enable(bEnable);
1826 	aSymbolHeightMF.Enable(bEnable);
1827 	aCtlPreview.Invalidate();
1828 
1829 	return 0;
1830 }
1831 IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, MetricField *, pField)
1832 {
1833 	bNewSize=true;
1834 	sal_Bool bWidth = (sal_Bool)(pField == &aSymbolWidthMF);
1835 	bLastWidthModified = bWidth;
1836 	sal_Bool bRatio = aSymbolRatioCB.IsChecked();
1837 	long nWidthVal = static_cast<long>(aSymbolWidthMF.Denormalize(aSymbolWidthMF.GetValue(FUNIT_100TH_MM)));
1838 	long nHeightVal= static_cast<long>(aSymbolHeightMF.Denormalize(aSymbolHeightMF.GetValue(FUNIT_100TH_MM)));
1839 	nWidthVal = OutputDevice::LogicToLogic(nWidthVal,MAP_100TH_MM,(MapUnit)ePoolUnit );
1840 	nHeightVal = OutputDevice::LogicToLogic(nHeightVal,MAP_100TH_MM,(MapUnit)ePoolUnit);
1841 	aSymbolSize=Size(nWidthVal,nHeightVal);
1842 	double	fSizeRatio = (double)1;
1843 
1844 	if(bRatio)
1845 	{
1846 		if (aSymbolLastSize.Height() && aSymbolLastSize.Width())
1847 			fSizeRatio = (double)aSymbolLastSize.Width() / aSymbolLastSize.Height();
1848 	}
1849 
1850 	//Size aSymbolSize(aSymbolLastSize);
1851 
1852 	if(bWidth)
1853 	{
1854 		long nDelta = nWidthVal - aSymbolLastSize.Width();
1855 		aSymbolSize.Width() = nWidthVal;
1856 		if (bRatio)
1857 		{
1858 			aSymbolSize.Height() = aSymbolLastSize.Height() + (long)((double)nDelta / fSizeRatio);
1859 			aSymbolSize.Height() = OutputDevice::LogicToLogic( aSymbolSize.Height(),(MapUnit)ePoolUnit, MAP_100TH_MM );
1860 			aSymbolHeightMF.SetUserValue(aSymbolHeightMF.Normalize(aSymbolSize.Height()), FUNIT_100TH_MM);
1861 		}
1862 	}
1863 	else
1864 	{
1865 		long nDelta = nHeightVal - aSymbolLastSize.Height();
1866 		aSymbolSize.Height() = nHeightVal;
1867 		if (bRatio)
1868 		{
1869 			aSymbolSize.Width() = aSymbolLastSize.Width() + (long)((double)nDelta * fSizeRatio);
1870 			aSymbolSize.Width() = OutputDevice::LogicToLogic( aSymbolSize.Width(),
1871 								(MapUnit)ePoolUnit, MAP_100TH_MM );
1872 			aSymbolWidthMF.SetUserValue(aSymbolWidthMF.Normalize(aSymbolSize.Width()), FUNIT_100TH_MM);
1873 		}
1874 	}
1875 	aCtlPreview.ResizeSymbol(aSymbolSize);
1876 	aSymbolLastSize=aSymbolSize;
1877 	return 0;
1878 }
1879 IMPL_LINK( SvxLineTabPage, RatioHdl_Impl, CheckBox *, pBox )
1880 {
1881 	if (pBox->IsChecked())
1882 	{
1883 		if (bLastWidthModified)
1884 			SizeHdl_Impl(&aSymbolWidthMF);
1885 		else
1886 			SizeHdl_Impl(&aSymbolHeightMF);
1887 	}
1888 	return 0;
1889 }
1890 
1891 
1892 void SvxLineTabPage::DataChanged( const DataChangedEvent& rDCEvt )
1893 {
1894 	SvxTabPage::DataChanged( rDCEvt );
1895 
1896 	if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
1897 	{
1898 		FillListboxes();
1899 	}
1900 }
1901 
1902 void SvxLineTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
1903 {
1904 	SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False);
1905 	SFX_ITEMSET_ARG (&aSet,pDashListItem,SvxDashListItem,SID_DASH_LIST,sal_False);
1906 	SFX_ITEMSET_ARG (&aSet,pLineEndListItem,SvxLineEndListItem,SID_LINEEND_LIST,sal_False);
1907 	SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
1908 	SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False);
1909 	SFX_ITEMSET_ARG (&aSet,pSdrObjListItem,OfaPtrItem,SID_OBJECT_LIST,sal_False);
1910 	SFX_ITEMSET_ARG (&aSet,pSymbolAttrItem,SfxTabDialogItem,SID_ATTR_SET,sal_False);
1911 	SFX_ITEMSET_ARG (&aSet,pGraphicItem,SvxGraphicItem,SID_GRAPHIC,sal_False);
1912 
1913 	if (pColorTabItem)
1914 		SetColorTable(pColorTabItem->GetColorTable());
1915 	if (pDashListItem)
1916 		SetDashList(pDashListItem->GetDashList());
1917 	if (pLineEndListItem)
1918 		SetLineEndList(pLineEndListItem->GetLineEndList());
1919 	if (pPageTypeItem)
1920 		SetPageType(pPageTypeItem->GetValue());
1921 	if (pDlgTypeItem)
1922 		SetDlgType(pDlgTypeItem->GetValue());
1923 	Construct();
1924 
1925 	if(pSdrObjListItem) //symbols
1926 	{
1927 		ShowSymbolControls(sal_True);
1928 		pSymbolList = static_cast<SdrObjList*>(pSdrObjListItem->GetValue());
1929 		if (pSymbolAttrItem)
1930 			pSymbolAttr = new SfxItemSet(pSymbolAttrItem->GetItemSet());
1931 		if(pGraphicItem)
1932 			aAutoSymbolGraphic = pGraphicItem->GetGraphic();
1933 	}
1934 }
1935