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