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