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