xref: /aoo42x/main/cui/source/tabpages/tpline.cxx (revision 3a5971bb)
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 					if(pSymbolAttr)
1035 					{
1036 						pObj->SetMergedItemSet(*pSymbolAttr);
1037 					}
1038 					else
1039 					{
1040 						pObj->SetMergedItemSet(rOutAttrs);
1041 					}
1042 
1043                     pPage->NbcInsertObject(pObj);
1044 
1045                     // Generate invisible square to give all symbol types a
1046                     // bitmap size, which is indepedent from specific glyph
1047                     SdrObject *pInvisibleSquare=pSymbolList->GetObj(0);
1048                     pInvisibleSquare=pInvisibleSquare->Clone();
1049                     pPage->NbcInsertObject(pInvisibleSquare);
1050                     pInvisibleSquare->SetMergedItem(XFillTransparenceItem(100));
1051                     pInvisibleSquare->SetMergedItem(XLineTransparenceItem(100));
1052 
1053                     pView->MarkAll();
1054 					GDIMetaFile aMeta(pView->GetMarkedObjMetaFile());
1055 
1056 					aSymbolGraphic=Graphic(aMeta);
1057 					aSymbolSize=pObj->GetSnapRect().GetSize();
1058                     aSymbolGraphic.SetPrefSize(pInvisibleSquare->GetSnapRect().GetSize());
1059 					aSymbolGraphic.SetPrefMapMode(MAP_100TH_MM);
1060 					bPrevSym=sal_True;
1061 					bEnable=sal_True;
1062 					bIgnoreGraphic=sal_True;
1063 
1064 					pView->UnmarkAll();
1065                     pInvisibleSquare=pPage->RemoveObject(1);
1066                     SdrObject::Free( pInvisibleSquare);
1067 					pObj=pPage->RemoveObject(0);
1068                     SdrObject::Free( pObj );
1069 				}
1070 			}
1071 		}
1072 		delete pView;
1073 		delete pModel;
1074 	}
1075 	if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH),sal_True,&pPoolItem) == SFX_ITEM_SET)
1076 	{
1077 		const Graphic* pGraphic = ((const SvxBrushItem *)pPoolItem)->GetGraphic();
1078 		if( pGraphic )
1079         {
1080             if(!bIgnoreGraphic)
1081 		    {
1082 			    aSymbolGraphic=*pGraphic;
1083 		    }
1084 		    if(!bIgnoreSize)
1085 		    {
1086 			    aSymbolSize=OutputDevice::LogicToLogic( pGraphic->GetPrefSize(),
1087 													    pGraphic->GetPrefMapMode(),
1088 													    MAP_100TH_MM );
1089 		    }
1090 		    bPrevSym=sal_True;
1091         }
1092 	}
1093 
1094 	if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),sal_True,&pPoolItem) == SFX_ITEM_SET)
1095 	{
1096 		aSymbolSize = ((const SvxSizeItem *)pPoolItem)->GetSize();
1097 	}
1098 
1099 	aSymbolRatioCB.Enable(bEnable);
1100 	aSymbolHeightFT.Enable(bEnable);
1101 	aSymbolWidthFT.Enable(bEnable);
1102 	aSymbolWidthMF.Enable(bEnable);
1103 	aSymbolHeightMF.Enable(bEnable);
1104 	if(bPrevSym)
1105 	{
1106 		SetMetricValue(aSymbolWidthMF,  aSymbolSize.Width(), ePoolUnit);
1107 		SetMetricValue(aSymbolHeightMF, aSymbolSize.Height(),ePoolUnit);
1108 		aCtlPreview.SetSymbol(&aSymbolGraphic,aSymbolSize);
1109 		aSymbolLastSize=aSymbolSize;
1110 	}
1111 
1112 	if( rAttrs.GetItemState( XATTR_LINESTYLE ) != SFX_ITEM_DONTCARE )
1113 	{
1114 		eXLS = (XLineStyle) ( ( const XLineStyleItem& ) rAttrs.Get( XATTR_LINESTYLE ) ).GetValue();
1115 
1116 		switch( eXLS )
1117 		{
1118 			case XLINE_NONE:
1119 				aLbLineStyle.SelectEntryPos( 0 );
1120 				break;
1121 			case XLINE_SOLID:
1122 				aLbLineStyle.SelectEntryPos( 1 );
1123 				break;
1124 
1125 			case XLINE_DASH:
1126 				aLbLineStyle.SetNoSelection();
1127 				aLbLineStyle.SelectEntry( ( ( const XLineDashItem& ) rAttrs.
1128 								Get( XATTR_LINEDASH ) ).GetName() );
1129 				break;
1130 
1131 			default:
1132 				break;
1133 		}
1134 	}
1135 	else
1136 	{
1137 		aLbLineStyle.SetNoSelection();
1138 	}
1139 
1140 	// Linienstaerke
1141 /*
1142 	if( bObjSelected &&
1143 		rAttrs.GetItemState( GetWhich( XATTR_LINEWIDTH ) ) == SFX_ITEM_DEFAULT )
1144 	{
1145 		aMtrLineWidth.Disable();
1146 	}
1147 */
1148 	if( rAttrs.GetItemState( XATTR_LINEWIDTH ) != SFX_ITEM_DONTCARE )
1149 	{
1150 		SetMetricValue( aMtrLineWidth, ( ( const XLineWidthItem& ) rAttrs.
1151 							Get( XATTR_LINEWIDTH ) ).GetValue(), ePoolUnit );
1152 	}
1153 	else
1154 		aMtrLineWidth.SetText( String() );
1155 
1156 	// Linienfarbe
1157 /*
1158 	if( bObjSelected &&
1159 		rAttrs.GetItemState( GetWhich( XATTR_LINECOLOR ) ) == SFX_ITEM_DEFAULT )
1160 	{
1161 		aLbColor.Disable();
1162 	}
1163 */
1164 	aLbColor.SetNoSelection();
1165 
1166 	if ( rAttrs.GetItemState( XATTR_LINECOLOR ) != SFX_ITEM_DONTCARE )
1167 	{
1168         Color aCol = ( ( const XLineColorItem& ) rAttrs.Get( XATTR_LINECOLOR ) ).GetColorValue();
1169 		aLbColor.SelectEntry( aCol );
1170 		if( aLbColor.GetSelectEntryCount() == 0 )
1171 		{
1172 			aLbColor.InsertEntry( aCol, String() );
1173 			aLbColor.SelectEntry( aCol );
1174 		}
1175 	}
1176 
1177 	// LinienAnfang
1178 	if( bObjSelected &&
1179 		rAttrs.GetItemState( XATTR_LINESTART ) == SFX_ITEM_DEFAULT )
1180 	{
1181 		aLbStartStyle.Disable();
1182 	}
1183 	else if( rAttrs.GetItemState( XATTR_LINESTART ) != SFX_ITEM_DONTCARE )
1184 	{
1185 		// #86265# select entry using list and polygon, not string
1186 		sal_Bool bSelected(sal_False);
1187 		const basegfx::B2DPolyPolygon& rItemPolygon = ((const XLineStartItem&)rAttrs.Get(XATTR_LINESTART)).GetLineStartValue();
1188 
1189 		for(sal_Int32 a(0);!bSelected &&  a < pLineEndList->Count(); a++)
1190 		{
1191 			XLineEndEntry* pEntry = pLineEndList->GetLineEnd(a);
1192 			const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
1193 
1194 			if(rItemPolygon == rEntryPolygon)
1195 			{
1196 				// select this entry
1197 				aLbStartStyle.SelectEntryPos((sal_uInt16)a + 1);
1198 				bSelected = sal_True;
1199 			}
1200 		}
1201 
1202 		if(!bSelected)
1203 			aLbStartStyle.SelectEntryPos( 0 );
1204 	}
1205 	else
1206 	{
1207 		aLbStartStyle.SetNoSelection();
1208 	}
1209 
1210 	// LinienEnde
1211 	if( bObjSelected &&
1212 		rAttrs.GetItemState( XATTR_LINEEND ) == SFX_ITEM_DEFAULT )
1213 	{
1214 		aLbEndStyle.Disable();
1215 	}
1216 	else if( rAttrs.GetItemState( XATTR_LINEEND ) != SFX_ITEM_DONTCARE )
1217 	{
1218 		// #86265# select entry using list and polygon, not string
1219 		sal_Bool bSelected(sal_False);
1220 		const basegfx::B2DPolyPolygon& rItemPolygon = ((const XLineEndItem&)rAttrs.Get(XATTR_LINEEND)).GetLineEndValue();
1221 
1222 		for(sal_Int32 a(0);!bSelected &&  a < pLineEndList->Count(); a++)
1223 		{
1224 			XLineEndEntry* pEntry = pLineEndList->GetLineEnd(a);
1225 			const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
1226 
1227 			if(rItemPolygon == rEntryPolygon)
1228 			{
1229 				// select this entry
1230 				aLbEndStyle.SelectEntryPos((sal_uInt16)a + 1);
1231 				bSelected = sal_True;
1232 			}
1233 		}
1234 
1235 		if(!bSelected)
1236 			aLbEndStyle.SelectEntryPos( 0 );
1237 	}
1238 	else
1239 	{
1240 		aLbEndStyle.SetNoSelection();
1241 	}
1242 
1243 	// LinienAnfang St"arke
1244 	if( bObjSelected &&
1245 		rAttrs.GetItemState( XATTR_LINESTARTWIDTH ) == SFX_ITEM_DEFAULT )
1246 	{
1247 		aMtrStartWidth.Disable();
1248 	}
1249 	else if( rAttrs.GetItemState( XATTR_LINESTARTWIDTH ) != SFX_ITEM_DONTCARE )
1250 	{
1251 		SetMetricValue( aMtrStartWidth, ( ( const XLineStartWidthItem& ) rAttrs.
1252 							Get( XATTR_LINESTARTWIDTH ) ).GetValue(), ePoolUnit );
1253 	}
1254 	else
1255 		aMtrStartWidth.SetText( String() );
1256 
1257 	// LinienEnde St"arke
1258 	if( bObjSelected &&
1259 		rAttrs.GetItemState( XATTR_LINEENDWIDTH ) == SFX_ITEM_DEFAULT )
1260 	{
1261 		aMtrEndWidth.Disable();
1262 	}
1263 	else if( rAttrs.GetItemState( XATTR_LINEENDWIDTH ) != SFX_ITEM_DONTCARE )
1264 	{
1265 		SetMetricValue( aMtrEndWidth, ( ( const XLineEndWidthItem& ) rAttrs.
1266 							Get( XATTR_LINEENDWIDTH ) ).GetValue(), ePoolUnit );
1267 	}
1268 	else
1269 		aMtrEndWidth.SetText( String() );
1270 
1271 	// Linienenden zentriert (Start)
1272 	if( bObjSelected &&
1273 		rAttrs.GetItemState( XATTR_LINESTARTCENTER ) == SFX_ITEM_DEFAULT )
1274 	{
1275 		aTsbCenterStart.Disable();
1276 	}
1277 	else if( rAttrs.GetItemState( XATTR_LINESTARTCENTER ) != SFX_ITEM_DONTCARE )
1278 	{
1279 		aTsbCenterStart.EnableTriState( sal_False );
1280 
1281 		if( ( ( const XLineStartCenterItem& ) rAttrs.Get( XATTR_LINESTARTCENTER ) ).GetValue() )
1282 			aTsbCenterStart.SetState( STATE_CHECK );
1283 		else
1284 			aTsbCenterStart.SetState( STATE_NOCHECK );
1285 	}
1286 	else
1287 	{
1288 		aTsbCenterStart.SetState( STATE_DONTKNOW );
1289 	}
1290 
1291 	// Linienenden zentriert (Ende)
1292 	if( bObjSelected &&
1293 		rAttrs.GetItemState( XATTR_LINEENDCENTER ) == SFX_ITEM_DEFAULT )
1294 	{
1295 		aTsbCenterEnd.Disable();
1296 	}
1297 	else if( rAttrs.GetItemState( XATTR_LINEENDCENTER ) != SFX_ITEM_DONTCARE )
1298 	{
1299 		aTsbCenterEnd.EnableTriState( sal_False );
1300 
1301 		if( ( ( const XLineEndCenterItem& ) rAttrs.Get( XATTR_LINEENDCENTER ) ).GetValue() )
1302 			aTsbCenterEnd.SetState( STATE_CHECK );
1303 		else
1304 			aTsbCenterEnd.SetState( STATE_NOCHECK );
1305 	}
1306 	else
1307 	{
1308 		aTsbCenterEnd.SetState( STATE_DONTKNOW );
1309 	}
1310 
1311 	// Transparenz
1312 	if( rAttrs.GetItemState( XATTR_LINETRANSPARENCE ) != SFX_ITEM_DONTCARE )
1313 	{
1314 		sal_uInt16 nTransp = ( ( const XLineTransparenceItem& ) rAttrs.
1315 								Get( XATTR_LINETRANSPARENCE ) ).GetValue();
1316 		aMtrTransparent.SetValue( nTransp );
1317 		ChangeTransparentHdl_Impl( NULL );
1318 	}
1319 	else
1320 		aMtrTransparent.SetText( String() );
1321 
1322 	if( !aLbStartStyle.IsEnabled()	&&
1323 		!aLbEndStyle.IsEnabled()	&&
1324 		!aMtrStartWidth.IsEnabled() &&
1325 		!aMtrEndWidth.IsEnabled()	&&
1326 		!aTsbCenterStart.IsEnabled()&&
1327 		!aTsbCenterEnd.IsEnabled() )
1328 	{
1329 		aCbxSynchronize.Disable();
1330 		aFtLineEndsStyle.Disable();
1331 		aFtLineEndsWidth.Disable();
1332 		aFlLineEnds.Disable();
1333 	}
1334 
1335 	// Synchronisieren
1336 	// Jetzt wird der Wert aus der INI-Datei geholt (#42258#)
1337 	String aStr = GetUserData();
1338 	aCbxSynchronize.Check( (sal_Bool)aStr.ToInt32() );
1339 
1340 	// #116827#
1341 	if(bObjSelected && SFX_ITEM_DEFAULT == rAttrs.GetItemState(XATTR_LINEJOINT))
1342 	{
1343 		maFTEdgeStyle.Disable();
1344 		maLBEdgeStyle.Disable();
1345 	}
1346 	else if(SFX_ITEM_DONTCARE != rAttrs.GetItemState(XATTR_LINEJOINT))
1347 	{
1348 		XLineJoint eLineJoint = ((const XLineJointItem&)(rAttrs.Get(XATTR_LINEJOINT))).GetValue();
1349 
1350 		switch(eLineJoint)
1351 		{
1352 			case XLINEJOINT_ROUND : maLBEdgeStyle.SelectEntryPos(0); break;
1353 			case XLINEJOINT_NONE : maLBEdgeStyle.SelectEntryPos(1); break;
1354 			case XLINEJOINT_MITER : maLBEdgeStyle.SelectEntryPos(2); break;
1355 			case XLINEJOINT_BEVEL : maLBEdgeStyle.SelectEntryPos(3); break;
1356             case XLINEJOINT_MIDDLE : break;
1357 		}
1358 	}
1359 	else
1360 	{
1361 		maLBEdgeStyle.SetNoSelection();
1362 	}
1363 
1364 	/*
1365 	if( aLbStartStyle.GetSelectEntryPos() == aLbEndStyle.GetSelectEntryPos() &&
1366 		aMtrStartWidth.GetValue() == aMtrEndWidth.GetValue() &&
1367 		aTsbCenterStart.GetState() == aTsbCenterEnd.GetState() )
1368 	{
1369 		aCbxSynchronize.Check();
1370 	}
1371 	*/
1372 
1373     // fdo#43209
1374     if(bObjSelected && SFX_ITEM_DEFAULT == rAttrs.GetItemState(XATTR_LINECAP))
1375     {
1376         maFTCapStyle.Disable();
1377         maLBCapStyle.Disable();
1378     }
1379     else if(SFX_ITEM_DONTCARE != rAttrs.GetItemState(XATTR_LINECAP))
1380     {
1381         const com::sun::star::drawing::LineCap eLineCap(((const XLineCapItem&)(rAttrs.Get(XATTR_LINECAP))).GetValue());
1382 
1383         switch(eLineCap)
1384         {
1385             case com::sun::star::drawing::LineCap_ROUND: maLBCapStyle.SelectEntryPos(1); break;
1386             case com::sun::star::drawing::LineCap_SQUARE : maLBCapStyle.SelectEntryPos(2); break;
1387             default /*com::sun::star::drawing::LineCap_BUTT*/: maLBCapStyle.SelectEntryPos(0); break;
1388         }
1389     }
1390     else
1391     {
1392         maLBCapStyle.SetNoSelection();
1393     }
1394 
1395 	// Werte sichern
1396 	aLbLineStyle.SaveValue();
1397 	aMtrLineWidth.SaveValue();
1398 	aLbColor.SaveValue();
1399 	aLbStartStyle.SaveValue();
1400 	aLbEndStyle.SaveValue();
1401 	aMtrStartWidth.SaveValue();
1402 	aMtrEndWidth.SaveValue();
1403 	aTsbCenterStart.SaveValue();
1404 	aTsbCenterEnd.SaveValue();
1405 	aMtrTransparent.SaveValue();
1406 
1407 	// #116827#
1408 	maLBEdgeStyle.SaveValue();
1409 
1410     // LineCaps
1411     maLBCapStyle.SaveValue();
1412 
1413 	ClickInvisibleHdl_Impl( this );
1414 	//ClickMeasuringHdl_Impl( this );
1415 	//aCtlPosition.Reset();
1416 
1417 	ChangePreviewHdl_Impl( NULL );
1418 }
1419 
1420 // -----------------------------------------------------------------------
1421 
1422 SfxTabPage* SvxLineTabPage::Create( Window* pWindow,
1423 				const SfxItemSet& rAttrs )
1424 {
1425 	return( new SvxLineTabPage( pWindow, rAttrs ) );
1426 }
1427 
1428 //------------------------------------------------------------------------
1429 
1430 sal_uInt16*	SvxLineTabPage::GetRanges()
1431 {
1432 	return( pLineRanges );
1433 }
1434 
1435 //------------------------------------------------------------------------
1436 
1437 IMPL_LINK( SvxLineTabPage, ChangePreviewHdl_Impl, void *, pCntrl )
1438 {
1439 	if(pCntrl == &aMtrLineWidth)
1440 	{
1441 		// Linienbreite und Start/EndBreite
1442 		sal_Int32 nNewLineWidth = GetCoreValue( aMtrLineWidth, ePoolUnit );
1443 		if(nActLineWidth == -1)
1444 		{
1445 			// Noch nicht initialisiert, hole den Startwert
1446 			const SfxPoolItem* pOld = GetOldItem( rXLSet, XATTR_LINEWIDTH );
1447 			sal_Int32 nStartLineWidth = 0;
1448 			if(pOld)
1449 				nStartLineWidth = (( const XLineWidthItem *)pOld)->GetValue();
1450 			nActLineWidth = nStartLineWidth;
1451 		}
1452 
1453 		if(nActLineWidth != nNewLineWidth)
1454 		{
1455 			// Anpassungen Start/EndWidth #63083#
1456 			sal_Int32 nValAct = GetCoreValue( aMtrStartWidth, ePoolUnit );
1457 			sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
1458 			if(nValNew < 0)
1459 				nValNew = 0;
1460 			SetMetricValue( aMtrStartWidth, nValNew, ePoolUnit );
1461 
1462 			nValAct = GetCoreValue( aMtrEndWidth, ePoolUnit );
1463 			nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
1464 			if(nValNew < 0)
1465 				nValNew = 0;
1466 			SetMetricValue( aMtrEndWidth, nValNew, ePoolUnit );
1467 		}
1468 
1469 		// Aktuellen Wert merken
1470 		nActLineWidth = nNewLineWidth;
1471 	}
1472 
1473 	FillXLSet_Impl();
1474 	aCtlPreview.Invalidate();
1475 
1476 	// Transparenz entspr. zugaenglich machen
1477 	if( aLbLineStyle.GetSelectEntryPos() == 0 ) // unsichtbar
1478 	{
1479 		aFtTransparent.Disable();
1480 		aMtrTransparent.Disable();
1481 	}
1482 	else
1483 	{
1484 		aFtTransparent.Enable();
1485 		aMtrTransparent.Enable();
1486 	}
1487 
1488 	const bool bHasLineStart = aLbStartStyle.GetSelectEntryPos() != 0;
1489 	const bool bHasLineEnd = aLbEndStyle.GetSelectEntryPos() != 0;
1490 
1491     aFtLineEndsWidth.Enable( bHasLineStart || bHasLineEnd );
1492     aMtrStartWidth.Enable( bHasLineStart );
1493     aTsbCenterStart.Enable( bHasLineStart );
1494     aMtrEndWidth.Enable( bHasLineEnd );
1495     aTsbCenterEnd.Enable( bHasLineEnd );
1496 
1497 	return( 0L );
1498 }
1499 
1500 //------------------------------------------------------------------------
1501 
1502 IMPL_LINK( SvxLineTabPage, ChangeStartHdl_Impl, void *, p )
1503 {
1504 	if( aCbxSynchronize.IsChecked() )
1505 	{
1506 		if( p == &aMtrStartWidth )
1507 			aMtrEndWidth.SetValue( aMtrStartWidth.GetValue() );
1508 		if( p == &aLbStartStyle )
1509 			aLbEndStyle.SelectEntryPos( aLbStartStyle.GetSelectEntryPos() );
1510 		if( p == &aTsbCenterStart )
1511 			aTsbCenterEnd.SetState( aTsbCenterStart.GetState() );
1512 	}
1513 
1514 	ChangePreviewHdl_Impl( this );
1515 
1516 	return( 0L );
1517 }
1518 
1519 //------------------------------------------------------------------------
1520 // #116827#
1521 
1522 IMPL_LINK( SvxLineTabPage, ChangeEdgeStyleHdl_Impl, void *, EMPTYARG )
1523 {
1524 	ChangePreviewHdl_Impl( this );
1525 
1526 	return( 0L );
1527 }
1528 
1529 //------------------------------------------------------------------------
1530 // fdo#43209
1531 
1532 IMPL_LINK( SvxLineTabPage, ChangeCapStyleHdl_Impl, void *, EMPTYARG )
1533 {
1534     ChangePreviewHdl_Impl( this );
1535 
1536     return( 0L );
1537 }
1538 //------------------------------------------------------------------------
1539 
1540 IMPL_LINK( SvxLineTabPage, ClickInvisibleHdl_Impl, void *, EMPTYARG )
1541 {
1542 	if( aLbLineStyle.GetSelectEntryPos() == 0 ) // unsichtbar
1543 	{
1544 		aFtColor.Disable();
1545         if(!bSymbols)
1546 		    aLbColor.Disable();
1547 		aFtLineWidth.Disable();
1548 		aMtrLineWidth.Disable();
1549 
1550 		if( aFlLineEnds.IsEnabled() )
1551 		{
1552 			aFtLineEndsStyle.Disable();
1553 			aFtLineEndsWidth.Disable();
1554 			aLbStartStyle.Disable();
1555 			aMtrStartWidth.Disable();
1556 			aTsbCenterStart.Disable();
1557 			aLbEndStyle.Disable();
1558 			aMtrEndWidth.Disable();
1559 			aTsbCenterEnd.Disable();
1560 			aCbxSynchronize.Disable();
1561 
1562 			// #116827#
1563 			maFTEdgeStyle.Disable();
1564 			maLBEdgeStyle.Disable();
1565 
1566             // LineCaps
1567             maFTCapStyle.Disable();
1568             maLBCapStyle.Disable();
1569 		}
1570 	}
1571 	else
1572 	{
1573 		aFtColor.Enable();
1574 		aLbColor.Enable();
1575 		aFtLineWidth.Enable();
1576 		aMtrLineWidth.Enable();
1577 
1578 		if( aFlLineEnds.IsEnabled() )
1579 		{
1580 			aFtLineEndsStyle.Enable();
1581 			aFtLineEndsWidth.Enable();
1582 			aLbStartStyle.Enable();
1583 			aMtrStartWidth.Enable();
1584 			aTsbCenterStart.Enable();
1585 			aLbEndStyle.Enable();
1586 			aMtrEndWidth.Enable();
1587 			aTsbCenterEnd.Enable();
1588 			aCbxSynchronize.Enable();
1589 
1590 			// #116827#
1591 			maFTEdgeStyle.Enable();
1592 			maLBEdgeStyle.Enable();
1593 
1594             // LineCaps
1595             maFTCapStyle.Enable();
1596             maLBCapStyle.Enable();
1597 		}
1598 	}
1599 	ChangePreviewHdl_Impl( NULL );
1600 
1601 	return( 0L );
1602 }
1603 
1604 //------------------------------------------------------------------------
1605 
1606 IMPL_LINK( SvxLineTabPage, ChangeEndHdl_Impl, void *, p )
1607 {
1608 	if( aCbxSynchronize.IsChecked() )
1609 	{
1610 		if( p == &aMtrEndWidth )
1611 			aMtrStartWidth.SetValue( aMtrEndWidth.GetValue() );
1612 		if( p == &aLbEndStyle )
1613 			aLbStartStyle.SelectEntryPos( aLbEndStyle.GetSelectEntryPos() );
1614 		if( p == &aTsbCenterEnd )
1615 			aTsbCenterStart.SetState( aTsbCenterEnd.GetState() );
1616 	}
1617 
1618 	ChangePreviewHdl_Impl( this );
1619 
1620 	return( 0L );
1621 }
1622 
1623 //------------------------------------------------------------------------
1624 /*
1625 
1626 long SvxLineTabPage::ClickMeasuringHdl_Impl( void* )
1627 {
1628 	if( aTsbShowMeasuring.GetState() == STATE_NOCHECK )
1629 	{
1630 		aFtPosition.Disable();
1631 		aCtlPosition.Disable();
1632 	}
1633 	else
1634 	{
1635 		aFtPosition.Enable();
1636 		aCtlPosition.Enable();
1637 	}
1638 	aCtlPosition.Invalidate();
1639 
1640 	return( 0L );
1641 }
1642 */
1643 //------------------------------------------------------------------------
1644 
1645 IMPL_LINK( SvxLineTabPage, ChangeTransparentHdl_Impl, void *, EMPTYARG )
1646 {
1647 	sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue();
1648 	XLineTransparenceItem aItem( nVal );
1649 
1650 	rXLSet.Put( XLineTransparenceItem( aItem ) );
1651 
1652 	// #116827#
1653 	FillXLSet_Impl();
1654 
1655 	aCtlPreview.Invalidate();
1656 
1657 	return( 0L );
1658 }
1659 
1660 //------------------------------------------------------------------------
1661 
1662 void SvxLineTabPage::PointChanged( Window*, RECT_POINT eRcPt )
1663 {
1664 	eRP = eRcPt;
1665 }
1666 
1667 //------------------------------------------------------------------------
1668 
1669 void SvxLineTabPage::FillUserData()
1670 {
1671 	// Abgleich wird in der Ini-Datei festgehalten
1672 	UniString aStrUserData = UniString::CreateFromInt32( (sal_Int32) aCbxSynchronize.IsChecked() );
1673 	SetUserData( aStrUserData );
1674 }
1675 
1676 
1677 //#58425# Symbole auf einer Linie (z.B. StarChart)
1678 //Handler f�r Popup-Menue der Symbolauswahl (NumMenueButton)
1679 //der folgende Link stammt urspruenglich aus SvxNumOptionsTabPage
1680 IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton )
1681 {
1682 	//Popup initialisieren
1683 	if(!pButton->GetPopupMenu()->GetPopupMenu( MN_GALLERY ))
1684 	{
1685 		// Gallery-Eintraege besorgen
1686 		GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames);
1687 
1688 		PopupMenu* pPopup = new PopupMenu;
1689 		String aEmptyStr;
1690 
1691 		nNumMenuGalleryItems=aGrfNames.Count();
1692 		for(long i = 0; i < nNumMenuGalleryItems; i++)
1693 		{
1694             const String* pGrfName = (const String*)aGrfNames.GetObject(i);
1695             const String* pUIName = pGrfName;
1696 
1697             // convert URL encodings to UI characters (eg %20 for spaces)
1698             String aPhysicalName;
1699             if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( *pGrfName, aPhysicalName ))
1700                 pUIName = &aPhysicalName;
1701 
1702             SvxBrushItem* pBrushItem = new SvxBrushItem(*pGrfName, aEmptyStr, GPOS_AREA, SID_ATTR_BRUSH);
1703 			pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl));
1704 
1705 			SvxBmpItemInfo* pInfo = new SvxBmpItemInfo();
1706 			pInfo->pBrushItem = pBrushItem;
1707 			pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i);
1708 			aGrfBrushItems.Insert(pInfo, i);
1709 			const Graphic* pGraphic = pBrushItem->GetGraphic();
1710 
1711 			if(pGraphic)
1712 			{
1713 				Bitmap aBitmap(pGraphic->GetBitmap());
1714 				Size aSize(aBitmap.GetSizePixel());
1715 				if(aSize.Width()  > MAX_BMP_WIDTH ||
1716 				   aSize.Height() > MAX_BMP_HEIGHT)
1717 				{
1718 					sal_Bool bWidth = aSize.Width() > aSize.Height();
1719 					double nScale = bWidth ?
1720 										(double)MAX_BMP_WIDTH / (double)aSize.Width():
1721 										(double)MAX_BMP_HEIGHT / (double)aSize.Height();
1722 					aBitmap.Scale(nScale, nScale);
1723 
1724 				}
1725 				Image aImage(aBitmap);
1726 				pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage );
1727 			}
1728 			else
1729 			{
1730 				Image aImage;
1731 				pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage );
1732 			}
1733 		}
1734 		aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup );
1735 		if(!aGrfNames.Count())
1736 			aSymbolMB.GetPopupMenu()->EnableItem(MN_GALLERY, sal_False);
1737 	}
1738 
1739 	if(!pButton->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS ) && pSymbolList)
1740 	{
1741 		VirtualDevice aVDev;
1742 		aVDev.SetMapMode(MapMode(MAP_100TH_MM));
1743 		SdrModel* pModel = new SdrModel(NULL, NULL, LOADREFCOUNTS);
1744 		pModel->GetItemPool().FreezeIdRanges();
1745 		// Page
1746 		SdrPage* pPage = new SdrPage( *pModel, sal_False );
1747 		pPage->SetSize(Size(1000,1000));
1748 		pModel->InsertPage( pPage, 0 );
1749 		// 3D View
1750 		SdrView* pView = new SdrView( pModel, &aVDev );
1751 		pView->hideMarkHandles();
1752 //		SdrPageView* pPageView = pView->ShowSdrPage(pPage, Point());
1753 		SdrPageView* pPageView = pView->ShowSdrPage(pPage);
1754 
1755 		PopupMenu* pPopup = new PopupMenu;
1756 		String aEmptyStr;
1757 
1758         // Generate invisible square to give all symbols a
1759         // bitmap size, which is indepedent from specific glyph
1760         SdrObject *pInvisibleSquare=pSymbolList->GetObj(0);
1761         pInvisibleSquare=pInvisibleSquare->Clone();
1762         pPage->NbcInsertObject(pInvisibleSquare);
1763         pInvisibleSquare->SetMergedItem(XFillTransparenceItem(100));
1764         pInvisibleSquare->SetMergedItem(XLineTransparenceItem(100));
1765 
1766 		for(long i=0;; ++i)
1767 		{
1768             SdrObject *pObj=pSymbolList->GetObj(i);
1769             if(pObj==NULL)
1770                 break;
1771 			pObj=pObj->Clone();
1772 			//const String* pGrfName = (const String*)aGrfNames.GetObject(i);
1773 			String *pStr=new String();//String(i));
1774 			aGrfNames.Insert(pStr,LIST_APPEND);
1775 			//Rectangle aRect(pObj->GetLogicRect());
1776 			pPage->NbcInsertObject(pObj);
1777 			if(pSymbolAttr)
1778 			{
1779 				pObj->SetMergedItemSet(*pSymbolAttr);
1780 			}
1781 			else
1782 			{
1783 				pObj->SetMergedItemSet(rOutAttrs);
1784 			}
1785             pView->MarkAll();
1786 			BitmapEx aBitmapEx(pView->GetMarkedObjBitmapEx());
1787 			GDIMetaFile aMeta(pView->GetMarkedObjMetaFile());
1788 			pView->UnmarkAll();
1789 			pObj=pPage->RemoveObject(1);
1790             SdrObject::Free(pObj);
1791 
1792             SvxBrushItem* pBrushItem = new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH);
1793 			pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl));
1794 
1795 			SvxBmpItemInfo* pInfo = new SvxBmpItemInfo();
1796 			pInfo->pBrushItem = pBrushItem;
1797 			pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i + nNumMenuGalleryItems);
1798 			aGrfBrushItems.Insert(pInfo, nNumMenuGalleryItems + i);
1799 
1800 			Size aSize(aBitmapEx.GetSizePixel());
1801 			if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT)
1802 			{
1803 				sal_Bool bWidth = aSize.Width() > aSize.Height();
1804 				double nScale = bWidth ?
1805 									(double)MAX_BMP_WIDTH / (double)aSize.Width():
1806 									(double)MAX_BMP_HEIGHT / (double)aSize.Height();
1807 				aBitmapEx.Scale(nScale, nScale);
1808 			}
1809 			Image aImage(aBitmapEx);
1810 			pPopup->InsertItem(pInfo->nItemId,*pStr,aImage);
1811 		}
1812         pInvisibleSquare=pPage->RemoveObject(0);
1813         SdrObject::Free(pInvisibleSquare);
1814 
1815 		aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_SYMBOLS, pPopup );
1816 		if(!aGrfNames.Count())
1817 			aSymbolMB.GetPopupMenu()->EnableItem(MN_SYMBOLS, sal_False);
1818 
1819 		delete pView;
1820 		delete pModel;
1821 	}
1822 	return 0;
1823 }
1824 //#58425# Symbole auf einer Linie (z.B. StarChart)
1825 //Handler f�r Popup-Menue der Symbolauswahl (NumMenueButton)
1826 //der folgende Link stammt urspruenglich aus SvxNumOptionsTabPage:
1827 IMPL_STATIC_LINK(SvxLineTabPage, GraphicArrivedHdl_Impl, SvxBrushItem*, pItem)
1828 {
1829 	PopupMenu* pPopup = pThis->aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
1830 
1831 	SvxBmpItemInfo* pBmpInfo = 0;
1832 	for ( sal_uInt16 i = 0; i < pThis->aGrfBrushItems.Count(); i++ )
1833 	{
1834 		SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)pThis->aGrfBrushItems.GetObject(i);
1835 		if( pInfo->pBrushItem == pItem )
1836 		{
1837 			pBmpInfo = pInfo; break;
1838 		}
1839 	}
1840 	if( pBmpInfo )
1841 	{
1842         if( pItem->GetGraphic() )
1843         {
1844             Bitmap aBitmap(pItem->GetGraphic()->GetBitmap());
1845             Size aSize(aBitmap.GetSizePixel());
1846             if(aSize.Width()  > MAX_BMP_WIDTH ||
1847                aSize.Height() > MAX_BMP_HEIGHT)
1848             {
1849                 sal_Bool bWidth = aSize.Width() > aSize.Height();
1850                 double nScale = bWidth ?
1851                     (double)MAX_BMP_WIDTH / (double)aSize.Width():
1852                     (double)MAX_BMP_HEIGHT / (double)aSize.Height();
1853                 aBitmap.Scale(nScale, nScale);
1854             }
1855             Image aImage(aBitmap);
1856             pPopup->SetItemImage( pBmpInfo->nItemId, aImage );
1857         }
1858 	}
1859 
1860 	return 0;
1861 }
1862 
1863 //#58425# Symbole auf einer Linie (z.B. StarChart)
1864 //Handler f�r Menuebutton
1865 IMPL_LINK( SvxLineTabPage, GraphicHdl_Impl, MenuButton *, pButton )
1866 {
1867 	sal_uInt16 nItemId = pButton->GetCurItemId();
1868 	const Graphic* pGraphic = 0;
1869 	Graphic aGraphic;
1870 	String aGrfName;
1871 	sal_Bool bResetSize = sal_False;
1872 	sal_Bool bEnable=sal_True;
1873     long nPreviousSymbolType = nSymbolType;
1874 
1875 	if(nItemId >= MN_GALLERY_ENTRY)
1876 	{
1877 		if( (nItemId-MN_GALLERY_ENTRY) >= nNumMenuGalleryItems)
1878 		{
1879 			nSymbolType=nItemId-MN_GALLERY_ENTRY-nNumMenuGalleryItems; //Index der Liste
1880 		}
1881 		else
1882 		{
1883 			nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM;
1884             bResetSize = sal_True;
1885 		}
1886 		SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)aGrfBrushItems.GetObject(nItemId - MN_GALLERY_ENTRY);
1887 		pGraphic = pInfo->pBrushItem->GetGraphic();
1888 	}
1889 	else switch(nItemId)
1890 	{
1891 		case MN_SYMBOLS_AUTO:
1892 		{
1893 			pGraphic=&aAutoSymbolGraphic;
1894 			aAutoSymbolGraphic.SetPrefSize( Size(253,253) );
1895 			nSymbolType=SVX_SYMBOLTYPE_AUTO;
1896 		}
1897 		break;
1898 
1899 		case MN_SYMBOLS_NONE:
1900 		{
1901 			nSymbolType=SVX_SYMBOLTYPE_NONE;
1902 			pGraphic=NULL;
1903 			bEnable=sal_False;
1904 		}
1905 		break;
1906 		default:
1907 		{
1908 			SvxOpenGraphicDialog aGrfDlg(CUI_RES(RID_STR_EDIT_GRAPHIC));
1909 			aGrfDlg.EnableLink(sal_False);
1910 			aGrfDlg.AsLink(sal_False);
1911 			if( !aGrfDlg.Execute() )
1912 			{
1913 				// ausgewaehlten Filter merken
1914 				aGrfName = aGrfDlg.GetPath();
1915 				if( !aGrfDlg.GetGraphic(aGraphic) )
1916                 {
1917                     nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM;
1918 					pGraphic = &aGraphic;
1919                     bResetSize = sal_True;
1920                 }
1921 			}
1922             if( !pGraphic )
1923                 return 0;
1924 		}
1925 		break;
1926 	}
1927 
1928 	if(pGraphic)
1929 	{
1930 		Size aSize = SvxNumberFormat::GetGraphicSizeMM100(pGraphic);
1931 		aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)ePoolUnit);
1932 		aSymbolGraphic=*pGraphic;
1933 		if( bResetSize )
1934 		{
1935 			aSymbolSize=aSize;
1936 		}
1937         else if( nPreviousSymbolType == SVX_SYMBOLTYPE_BRUSHITEM )
1938         {   //#i31097# Data Point Symbol size changes when a different symbol is choosen(maoyg)
1939             if( aSymbolSize.Width() != aSymbolSize.Height() )
1940             {
1941                 aSize.setWidth( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 );
1942                 aSize.setHeight( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 );
1943                 aSymbolSize = aSize;
1944             }
1945         }
1946 		aCtlPreview.SetSymbol(&aSymbolGraphic,aSymbolSize);
1947 	}
1948 	else
1949 	{
1950 		aSymbolGraphic=Graphic();
1951 		aCtlPreview.SetSymbol(NULL,aSymbolSize);
1952 		bEnable=sal_False;
1953 	}
1954 	aSymbolLastSize=aSymbolSize;
1955 	SetMetricValue(aSymbolWidthMF,  aSymbolSize.Width(), ePoolUnit);
1956 	SetMetricValue(aSymbolHeightMF, aSymbolSize.Height(), ePoolUnit);
1957 	aSymbolRatioCB.Enable(bEnable);
1958 	aSymbolHeightFT.Enable(bEnable);
1959 	aSymbolWidthFT.Enable(bEnable);
1960 	aSymbolWidthMF.Enable(bEnable);
1961 	aSymbolHeightMF.Enable(bEnable);
1962 	aCtlPreview.Invalidate();
1963 
1964 	return 0;
1965 }
1966 IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, MetricField *, pField)
1967 {
1968 	bNewSize=true;
1969 	sal_Bool bWidth = (sal_Bool)(pField == &aSymbolWidthMF);
1970 	bLastWidthModified = bWidth;
1971 	sal_Bool bRatio = aSymbolRatioCB.IsChecked();
1972 	long nWidthVal = static_cast<long>(aSymbolWidthMF.Denormalize(aSymbolWidthMF.GetValue(FUNIT_100TH_MM)));
1973 	long nHeightVal= static_cast<long>(aSymbolHeightMF.Denormalize(aSymbolHeightMF.GetValue(FUNIT_100TH_MM)));
1974 	nWidthVal = OutputDevice::LogicToLogic(nWidthVal,MAP_100TH_MM,(MapUnit)ePoolUnit );
1975 	nHeightVal = OutputDevice::LogicToLogic(nHeightVal,MAP_100TH_MM,(MapUnit)ePoolUnit);
1976 	aSymbolSize=Size(nWidthVal,nHeightVal);
1977 	double	fSizeRatio = (double)1;
1978 
1979 	if(bRatio)
1980 	{
1981 		if (aSymbolLastSize.Height() && aSymbolLastSize.Width())
1982 			fSizeRatio = (double)aSymbolLastSize.Width() / aSymbolLastSize.Height();
1983 	}
1984 
1985 	//Size aSymbolSize(aSymbolLastSize);
1986 
1987 	if(bWidth)
1988 	{
1989 		long nDelta = nWidthVal - aSymbolLastSize.Width();
1990 		aSymbolSize.Width() = nWidthVal;
1991 		if (bRatio)
1992 		{
1993 			aSymbolSize.Height() = aSymbolLastSize.Height() + (long)((double)nDelta / fSizeRatio);
1994 			aSymbolSize.Height() = OutputDevice::LogicToLogic( aSymbolSize.Height(),(MapUnit)ePoolUnit, MAP_100TH_MM );
1995 			aSymbolHeightMF.SetUserValue(aSymbolHeightMF.Normalize(aSymbolSize.Height()), FUNIT_100TH_MM);
1996 		}
1997 	}
1998 	else
1999 	{
2000 		long nDelta = nHeightVal - aSymbolLastSize.Height();
2001 		aSymbolSize.Height() = nHeightVal;
2002 		if (bRatio)
2003 		{
2004 			aSymbolSize.Width() = aSymbolLastSize.Width() + (long)((double)nDelta * fSizeRatio);
2005 			aSymbolSize.Width() = OutputDevice::LogicToLogic( aSymbolSize.Width(),
2006 								(MapUnit)ePoolUnit, MAP_100TH_MM );
2007 			aSymbolWidthMF.SetUserValue(aSymbolWidthMF.Normalize(aSymbolSize.Width()), FUNIT_100TH_MM);
2008 		}
2009 	}
2010 	aCtlPreview.ResizeSymbol(aSymbolSize);
2011 	aSymbolLastSize=aSymbolSize;
2012 	return 0;
2013 }
2014 IMPL_LINK( SvxLineTabPage, RatioHdl_Impl, CheckBox *, pBox )
2015 {
2016 	if (pBox->IsChecked())
2017 	{
2018 		if (bLastWidthModified)
2019 			SizeHdl_Impl(&aSymbolWidthMF);
2020 		else
2021 			SizeHdl_Impl(&aSymbolHeightMF);
2022 	}
2023 	return 0;
2024 }
2025 
2026 
2027 void SvxLineTabPage::DataChanged( const DataChangedEvent& rDCEvt )
2028 {
2029 	SvxTabPage::DataChanged( rDCEvt );
2030 
2031 	if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
2032 	{
2033 		FillListboxes();
2034 	}
2035 }
2036 
2037 void SvxLineTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
2038 {
2039 	SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False);
2040 	SFX_ITEMSET_ARG (&aSet,pDashListItem,SvxDashListItem,SID_DASH_LIST,sal_False);
2041 	SFX_ITEMSET_ARG (&aSet,pLineEndListItem,SvxLineEndListItem,SID_LINEEND_LIST,sal_False);
2042 	SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
2043 	SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False);
2044 	SFX_ITEMSET_ARG (&aSet,pSdrObjListItem,OfaPtrItem,SID_OBJECT_LIST,sal_False);
2045 	SFX_ITEMSET_ARG (&aSet,pSymbolAttrItem,SfxTabDialogItem,SID_ATTR_SET,sal_False);
2046 	SFX_ITEMSET_ARG (&aSet,pGraphicItem,SvxGraphicItem,SID_GRAPHIC,sal_False);
2047 
2048 	if (pColorTabItem)
2049 		SetColorTable(pColorTabItem->GetColorTable());
2050 	if (pDashListItem)
2051 		SetDashList(pDashListItem->GetDashList());
2052 	if (pLineEndListItem)
2053 		SetLineEndList(pLineEndListItem->GetLineEndList());
2054 	if (pPageTypeItem)
2055 		SetPageType(pPageTypeItem->GetValue());
2056 	if (pDlgTypeItem)
2057 		SetDlgType(pDlgTypeItem->GetValue());
2058 	Construct();
2059 
2060 	if(pSdrObjListItem) //symbols
2061 	{
2062 		ShowSymbolControls(sal_True);
2063 		pSymbolList = static_cast<SdrObjList*>(pSdrObjListItem->GetValue());
2064 		if (pSymbolAttrItem)
2065 			pSymbolAttr = new SfxItemSet(pSymbolAttrItem->GetItemSet());
2066 		if(pGraphicItem)
2067 			aAutoSymbolGraphic = pGraphicItem->GetGraphic();
2068 	}
2069 }
2070