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