merge the formfield patch from ooo-build
[ooovba.git] / svx / source / cui / tpline.cxx
blob497d628fa32de03eb277de29e7556f2cc1c86ba7
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tpline.cxx,v $
10 * $Revision: 1.45 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #ifdef SVX_DLLIMPLEMENTATION
35 #undef SVX_DLLIMPLEMENTATION
36 #endif
38 // include ---------------------------------------------------------------
40 #ifndef _SVX_SIZEITEM_HXX //autogen
42 #include <svx/sizeitem.hxx>
43 #endif
44 #include <tools/shl.hxx>
45 #include <tools/urlobj.hxx>
46 #include <sfx2/app.hxx>
47 #include <sfx2/module.hxx>
49 #define _SVX_TPLINE_CXX
51 #include <svx/dialogs.hrc>
52 #include "tabline.hrc"
53 #include "dlgname.hrc"
59 #include "xattr.hxx"
60 #include <svx/xpool.hxx>
61 #include <svx/xtable.hxx>
63 #include "drawitem.hxx"
64 #include "cuitabline.hxx"
65 #include "dlgname.hxx"
66 #include <svx/dialmgr.hxx>
67 #include "dlgutil.hxx"
68 #include <svx/svdmodel.hxx>
69 #include "svxgrahicitem.hxx"
70 #include "linectrl.hrc"
71 #include <sfx2/request.hxx> //add CHINA001
72 #include "ofaitem.hxx" //add CHINA001
73 //#58425# Symbole auf einer Linie (z.B. StarChart) Includes:
74 #include <svx/svdobj.hxx>
75 #include <svx/svdview.hxx>
76 #include <svx/svdmodel.hxx>
77 #include <numvset.hxx>
78 #include <vcl/msgbox.hxx>
79 #include <svx/numitem.hxx>
80 #include <svx/svxenum.hxx>
81 #include <sfx2/objsh.hxx>
82 #include <svx/brshitem.hxx>
83 #include <gallery.hxx>
84 #include <svx/xbitmap.hxx>
85 #include <unotools/localfilehelper.hxx>
87 #include "opengrf.hxx"
89 #define MAX_BMP_WIDTH 16
90 #define MAX_BMP_HEIGHT 16
91 // define ----------------------------------------------------------------
93 #define DLGWIN this->GetParent()->GetParent()
95 #define BITMAP_WIDTH 32
96 #define BITMAP_HEIGHT 12
97 #define XOUT_WIDTH 150
99 // static ----------------------------------------------------------------
101 static USHORT pLineRanges[] =
103 XATTR_LINETRANSPARENCE,
104 XATTR_LINETRANSPARENCE,
105 SID_ATTR_LINE_STYLE,
106 SID_ATTR_LINE_ENDCENTER,
110 /*************************************************************************
112 |* Dialog zum Aendern der Linien
114 \************************************************************************/
116 SvxLineTabPage::SvxLineTabPage
118 Window* pParent,
119 const SfxItemSet& rInAttrs
121 SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_LINE ), rInAttrs ),
122 aFtLineStyle ( this, SVX_RES( FT_LINE_STYLE ) ),
123 aLbLineStyle ( this, SVX_RES( LB_LINE_STYLE ) ),
124 aFtColor ( this, SVX_RES( FT_COLOR ) ),
125 aLbColor ( this, SVX_RES( LB_COLOR ) ),
126 aFtLineWidth ( this, SVX_RES( FT_LINE_WIDTH ) ),
127 aMtrLineWidth ( this, SVX_RES( MTR_FLD_LINE_WIDTH ) ),
128 aFtTransparent ( this, SVX_RES( FT_TRANSPARENT ) ),
129 aMtrTransparent ( this, SVX_RES( MTR_LINE_TRANSPARENT ) ),
130 aFlLine ( this, SVX_RES( FL_LINE ) ),
131 aFtLineEndsStyle ( this, SVX_RES( FT_LINE_ENDS_STYLE ) ),
132 aLbStartStyle ( this, SVX_RES( LB_START_STYLE ) ),
133 aFtLineEndsWidth ( this, SVX_RES( FT_LINE_ENDS_WIDTH ) ),
134 aMtrStartWidth ( this, SVX_RES( MTR_FLD_START_WIDTH ) ),
135 aTsbCenterStart ( this, SVX_RES( TSB_CENTER_START ) ),
136 aLbEndStyle ( this, SVX_RES( LB_END_STYLE ) ),
137 aMtrEndWidth ( this, SVX_RES( MTR_FLD_END_WIDTH ) ),
138 aTsbCenterEnd ( this, SVX_RES( TSB_CENTER_END ) ),
139 aCbxSynchronize ( this, SVX_RES( CBX_SYNCHRONIZE ) ),
140 aFlLineEnds ( this, SVX_RES( FL_LINE_ENDS ) ),
141 aCtlPreview ( this, SVX_RES( CTL_PREVIEW ) ),
142 aFLSeparator ( this, SVX_RES( FL_SEPARATOR ) ),
144 // #116827#
145 maFLEdgeStyle ( this, SVX_RES( FL_EDGE_STYLE ) ),
146 maFTEdgeStyle ( this, SVX_RES( FT_EDGE_STYLE ) ),
147 maLBEdgeStyle ( this, SVX_RES( LB_EDGE_STYLE ) ),
149 pSymbolList(NULL),
150 bNewSize(false),
151 nNumMenuGalleryItems(0),
152 nSymbolType(SVX_SYMBOLTYPE_UNKNOWN), //unbekannt bzw. unchanged
153 pSymbolAttr(NULL),
154 //#58425# Symbole auf einer Linie (z.B. StarChart)
155 aFlSymbol ( this, SVX_RES(FL_SYMBOL_FORMAT)),
156 aSymbolMB ( this, SVX_RES(MB_SYMBOL_BITMAP)),
157 aSymbolWidthFT ( this, SVX_RES(FT_SYMBOL_WIDTH)),
158 aSymbolWidthMF ( this, SVX_RES(MF_SYMBOL_WIDTH)),
159 aSymbolHeightFT ( this, SVX_RES(FT_SYMBOL_HEIGHT)),
160 aSymbolHeightMF ( this, SVX_RES(MF_SYMBOL_HEIGHT)),
161 aSymbolRatioCB ( this, SVX_RES(CB_SYMBOL_RATIO)),
163 bLastWidthModified(FALSE),
164 aSymbolLastSize(Size(0,0)),
165 bSymbols(FALSE),
167 rOutAttrs ( rInAttrs ),
168 bObjSelected( sal_False ),
170 pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ),
171 aXLStyle ( XLINE_DASH ),
172 aXWidth ( 1 ),
173 aXDash ( String(), XDash( XDASH_RECT, 3, 7, 2, 40, 15 ) ),
174 aXColor ( String(), COL_LIGHTRED ),
175 aXLineAttr ( pXPool ),
176 rXLSet ( aXLineAttr.GetItemSet() ),
177 pnLineEndListState( 0 ),
178 pnDashListState( 0 ),
179 pnColorTableState( 0 ),
180 nPageType ( 0 )//CHINA001 pPageType ( NULL ),
182 FreeResource();
184 // diese Page braucht ExchangeSupport
185 SetExchangeSupport();
187 // Metrik einstellen
188 FieldUnit eFUnit = GetModuleFieldUnit( &rInAttrs );
190 switch ( eFUnit )
192 case FUNIT_M:
193 case FUNIT_KM:
194 eFUnit = FUNIT_MM;
195 // no break -> we now have mm
196 case FUNIT_MM:
197 aMtrLineWidth.SetSpinSize( 50 );
198 aMtrStartWidth.SetSpinSize( 50 );
199 aMtrEndWidth.SetSpinSize( 50 );
200 break;
202 case FUNIT_INCH:
203 aMtrLineWidth.SetSpinSize( 2 );
204 aMtrStartWidth.SetSpinSize( 2 );
205 aMtrEndWidth.SetSpinSize( 2 );
206 break;
207 default: ;//prevent warning
209 SetFieldUnit( aMtrLineWidth, eFUnit );
210 SetFieldUnit( aMtrStartWidth, eFUnit );
211 SetFieldUnit( aMtrEndWidth, eFUnit );
213 // PoolUnit ermitteln
214 SfxItemPool* pPool = rOutAttrs.GetPool();
215 DBG_ASSERT( pPool, "Wo ist der Pool?" );
216 ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH );
218 aLbLineStyle.SetSelectHdl(
219 LINK( this, SvxLineTabPage, ClickInvisibleHdl_Impl ) );
220 aLbColor.SetSelectHdl(
221 LINK( this, SvxLineTabPage, ChangePreviewHdl_Impl ) );
222 aMtrLineWidth.SetModifyHdl(
223 LINK( this, SvxLineTabPage, ChangePreviewHdl_Impl ) );
224 aMtrTransparent.SetModifyHdl(
225 LINK( this, SvxLineTabPage, ChangeTransparentHdl_Impl ) );
227 Link aStart = LINK( this, SvxLineTabPage, ChangeStartHdl_Impl );
228 Link aEnd = LINK( this, SvxLineTabPage, ChangeEndHdl_Impl );
229 aLbStartStyle.SetSelectHdl( aStart );
230 aLbEndStyle.SetSelectHdl( aEnd );
231 aMtrStartWidth.SetModifyHdl( aStart );
232 aMtrEndWidth.SetModifyHdl( aEnd );
233 aTsbCenterStart.SetClickHdl( aStart );
234 aTsbCenterEnd.SetClickHdl( aEnd );
236 pColorTab = NULL;
237 pDashList = NULL;
238 pLineEndList = NULL;
240 // #116827#
241 Link aEdgeStyle = LINK( this, SvxLineTabPage, ChangeEdgeStyleHdl_Impl );
242 maLBEdgeStyle.SetSelectHdl( aEdgeStyle );
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));
251 aSymbolRatioCB.Check(TRUE);
252 ShowSymbolControls(FALSE);
254 // #63083#
255 nActLineWidth = -1;
257 //#58425# Symbole auf einer Linie (z.B. StarChart) , Symbol-Controls aktivieren
258 void SvxLineTabPage::ShowSymbolControls(BOOL bOn)
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);
270 // -----------------------------------------------------------------------
271 //#58425# Symbole auf einer Linie (z.B. StarChart) , dtor neu!
272 SvxLineTabPage::~SvxLineTabPage()
274 delete aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
276 if(pSymbolList)
277 delete aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_SYMBOLS );
279 String* pStr = (String*)aGrfNames.First();
280 while( pStr )
282 delete pStr;
283 pStr = (String*)aGrfNames.Next();
285 SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)aGrfBrushItems.First();
286 while( pInfo )
288 delete pInfo->pBrushItem;
289 delete pInfo;
290 pInfo = (SvxBmpItemInfo*)aGrfBrushItems.Next();
293 void SvxLineTabPage::Construct()
295 // Farbtabelle
296 aLbColor.Fill( pColorTab );
297 FillListboxes();
300 void SvxLineTabPage::FillListboxes()
302 // aCtlPreview.SetDrawMode( GetDisplayBackground().GetColor().IsDark() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR );
304 ResMgr& rMgr = DIALOG_MGR();
306 // Linienstile
307 USHORT nOldSelect = aLbLineStyle.GetSelectEntryPos();
308 aLbLineStyle.Clear();
309 aLbLineStyle.InsertEntry( String( ResId( RID_SVXSTR_INVISIBLE, rMgr ) ) );
311 const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
312 Bitmap aBitmap ( SVX_RES ( RID_SVXCTRL_LINECTRL ) );
313 Color aSourceColors[2];
314 Color aDestColors[2];
316 aSourceColors[0] = Color( COL_WHITE );
317 aSourceColors[1] = Color( COL_BLACK );
319 aDestColors[0] = rStyles.GetFieldColor();
320 aDestColors[1] = rStyles.GetFieldTextColor();
322 aBitmap.Replace ( aSourceColors, aDestColors, 2 );
323 Image aSolidLine ( aBitmap );
324 aLbLineStyle.InsertEntry( String( ResId( RID_SVXSTR_SOLID, rMgr ) ), aSolidLine );
325 aLbLineStyle.Fill( pDashList );
326 aLbLineStyle.SelectEntryPos( nOldSelect );
328 // LinienEndenStile
329 String sNone( ResId( RID_SVXSTR_NONE, rMgr ) );
330 nOldSelect = aLbStartStyle.GetSelectEntryPos();
331 aLbStartStyle.Clear();
332 aLbStartStyle.InsertEntry( sNone );
333 aLbStartStyle.Fill( pLineEndList );
334 aLbStartStyle.SelectEntryPos( nOldSelect );
335 nOldSelect = aLbEndStyle.GetSelectEntryPos();
336 aLbEndStyle.Clear();
337 aLbEndStyle.InsertEntry( sNone );
338 aLbEndStyle.Fill( pLineEndList, FALSE );
339 aLbEndStyle.SelectEntryPos( nOldSelect );
342 // -----------------------------------------------------------------------
344 void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet )
346 SFX_ITEMSET_ARG (&rSet,pPageTypeItem,CntUInt16Item,SID_PAGE_TYPE,sal_False); //add CHINA001 begin
347 if (pPageTypeItem)
348 SetPageType(pPageTypeItem->GetValue()); //add CHINA001 end
349 if( nDlgType == 0 && pDashList ) //CHINA001 if( *pDlgType == 0 && pDashList ) // Linien-Dialog
351 ResMgr& rMgr = DIALOG_MGR();
352 USHORT nPos;
353 USHORT nCount;
355 // Dashliste
356 if( ( *pnDashListState & CT_MODIFIED ) ||
357 ( *pnDashListState & CT_CHANGED ) )
359 if( *pnDashListState & CT_CHANGED )
360 pDashList = ( (SvxLineTabDialog*) DLGWIN )->
361 GetNewDashList();
362 *pnDashListState = CT_NONE;
364 // Styleliste
365 nPos = aLbLineStyle.GetSelectEntryPos();
367 aLbLineStyle.Clear();
368 aLbLineStyle.InsertEntry(
369 String( ResId( RID_SVXSTR_INVISIBLE, rMgr ) ) );
370 aLbLineStyle.InsertEntry(
371 String( ResId( RID_SVXSTR_SOLID, rMgr ) ) );
372 aLbLineStyle.Fill( pDashList );
373 nCount = aLbLineStyle.GetEntryCount();
375 if ( nCount == 0 )
376 ; // Dieser Fall sollte nicht auftreten
377 else if( nCount <= nPos )
378 aLbLineStyle.SelectEntryPos( 0 );
379 else
380 aLbLineStyle.SelectEntryPos( nPos );
381 // SelectStyleHdl_Impl( this );
384 INetURLObject aDashURL( pDashList->GetPath() );
386 aDashURL.Append( pDashList->GetName() );
387 DBG_ASSERT( aDashURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
388 /* // Ermitteln (evtl. abschneiden) des Namens und in
389 // der GroupBox darstellen
390 String aString( ResId( RID_SVXSTR_TABLE, pMgr ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
392 if ( aDashURL.getBase().Len() > 18 )
394 aString += aDashURL.getBase().Copy( 0, 15 );
395 aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
397 else
398 aString += aDashURL.getBase();
400 aGrpLine.SetText( aString );
402 // LineEndliste
403 if( ( *pnLineEndListState & CT_MODIFIED ) ||
404 ( *pnLineEndListState & CT_CHANGED ) )
406 if( *pnLineEndListState & CT_CHANGED )
407 pLineEndList = ( (SvxLineTabDialog*) DLGWIN )->
408 GetNewLineEndList();
409 *pnLineEndListState = CT_NONE;
411 nPos = aLbLineStyle.GetSelectEntryPos();
412 String sNone( ResId( RID_SVXSTR_NONE, rMgr ) );
413 aLbStartStyle.Clear();
414 aLbStartStyle.InsertEntry( sNone );
416 aLbStartStyle.Fill( pLineEndList );
417 nCount = aLbStartStyle.GetEntryCount();
418 if( nCount == 0 )
419 ; // Dieser Fall sollte nicht auftreten
420 else if( nCount <= nPos )
421 aLbStartStyle.SelectEntryPos( 0 );
422 else
423 aLbStartStyle.SelectEntryPos( nPos );
425 aLbEndStyle.Clear();
426 aLbEndStyle.InsertEntry( sNone );
428 aLbEndStyle.Fill( pLineEndList, FALSE );
429 nCount = aLbEndStyle.GetEntryCount();
431 if( nCount == 0 )
432 ; // Dieser Fall sollte nicht auftreten
433 else if( nCount <= nPos )
434 aLbEndStyle.SelectEntryPos( 0 );
435 else
436 aLbEndStyle.SelectEntryPos( nPos );
438 INetURLObject aLineURL( pLineEndList->GetPath() );
440 aLineURL.Append( pLineEndList->GetName() );
441 DBG_ASSERT( aLineURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
442 /* // Ermitteln (evtl. abschneiden) des Namens und in
443 // der GroupBox darstellen
444 aString = String( ResId( RID_SVXSTR_TABLE, pMgr ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
446 if ( aLineURL.getBase().Len() > 18 )
448 aString += aLineURL.getBase().Copy( 0, 15 );
449 aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
451 else
452 aString += aLineURL.getBase();
454 aGrpLineEnds.SetText( aString );
456 // Auswertung, ob von einer anderen TabPage ein anderer Fuelltyp gesetzt wurde
457 if( aLbLineStyle.GetSelectEntryPos() != 0 )
459 if( nPageType == 2 ) // 1//CHINA001 if( *pPageType == 2 ) // 1
461 aLbLineStyle.SelectEntryPos( *pPosDashLb + 2 ); // +2 wegen SOLID und INVLISIBLE
462 ChangePreviewHdl_Impl( this );
464 if( nPageType == 3 )//CHINA001 if( *pPageType == 3 )
466 aLbStartStyle.SelectEntryPos( *pPosLineEndLb + 1 );// +1 wegen SOLID
467 aLbEndStyle.SelectEntryPos( *pPosLineEndLb + 1 );// +1 wegen SOLID
468 ChangePreviewHdl_Impl( this );
472 // ColorTable
473 if( *pnColorTableState )
475 if( *pnColorTableState & CT_CHANGED )
476 pColorTab = ( (SvxLineTabDialog*) DLGWIN )->
477 GetNewColorTable();
478 // aLbColor
479 sal_uInt16 nColorPos = aLbColor.GetSelectEntryPos();
480 aLbColor.Clear();
481 aLbColor.Fill( pColorTab );
482 nCount = aLbColor.GetEntryCount();
483 if( nCount == 0 )
484 ; // This case should never occur
485 else if( nCount <= nColorPos )
486 aLbColor.SelectEntryPos( 0 );
487 else
488 aLbColor.SelectEntryPos( nColorPos );
490 ChangePreviewHdl_Impl( this );
493 nPageType = 0;//CHINA001 *pPageType = 0;
495 // Seite existiert im Ctor noch nicht, deswegen hier!
497 else if ( nDlgType == 1100 || // Chart-Dialog//CHINA001 else if ( *pDlgType == 1100 || // Chart-Dialog
498 nDlgType == 1101 )//CHINA001 *pDlgType == 1101 )
500 aFtLineEndsStyle.Hide();
501 aFtLineEndsWidth.Hide();
502 aLbStartStyle.Hide();
503 aMtrStartWidth.Hide();
504 aTsbCenterStart.Hide();
505 aLbEndStyle.Hide();
506 aMtrEndWidth.Hide();
507 aTsbCenterEnd.Hide();
508 aCbxSynchronize.Hide();
509 aFlLineEnds.Hide();
511 // #116827#
512 maFLEdgeStyle.Hide();
513 maFTEdgeStyle.Hide();
514 maLBEdgeStyle.Hide();
518 // -----------------------------------------------------------------------
520 int SvxLineTabPage::DeactivatePage( SfxItemSet* _pSet )
522 if( nDlgType == 0 ) // Linien-Dialog//CHINA001 if( *pDlgType == 0 ) // Linien-Dialog
524 nPageType = 1; // evtl. fuer Erweiterungen//CHINA001 *pPageType = 1; // evtl. fuer Erweiterungen
525 *pPosDashLb = aLbLineStyle.GetSelectEntryPos() - 2;// erster Eintrag SOLID !!!
526 USHORT nPos = aLbStartStyle.GetSelectEntryPos();
527 if( nPos != LISTBOX_ENTRY_NOTFOUND )
528 nPos--;
529 *pPosLineEndLb = nPos;
532 if( _pSet )
533 FillItemSet( *_pSet );
535 return( LEAVE_PAGE );
538 // -----------------------------------------------------------------------
540 BOOL SvxLineTabPage::FillItemSet( SfxItemSet& rAttrs )
542 const SfxPoolItem* pOld = NULL;
543 USHORT nPos;
544 BOOL bModified = FALSE;
546 // Um evtl. Modifikationen der Liste vorzubeugen
547 // werden Items anderer Seiten nicht gesetzt
548 if( nDlgType != 0 || nPageType != 2 )//CHINA001 if( *pDlgType != 0 || *pPageType != 2 )
550 nPos = aLbLineStyle.GetSelectEntryPos();
551 if( nPos != LISTBOX_ENTRY_NOTFOUND &&
552 nPos != aLbLineStyle.GetSavedValue() )
554 XLineStyleItem* pStyleItem = NULL;
556 if( nPos == 0 )
557 pStyleItem = new XLineStyleItem( XLINE_NONE );
558 else if( nPos == 1 )
559 pStyleItem = new XLineStyleItem( XLINE_SOLID );
560 else
562 pStyleItem = new XLineStyleItem( XLINE_DASH );
564 // Zusaetzliche Sicherheit
565 if( pDashList->Count() > (long) ( nPos - 2 ) )
567 XLineDashItem aDashItem( aLbLineStyle.GetSelectEntry(),
568 pDashList->GetDash( nPos - 2 )->GetDash() );
569 pOld = GetOldItem( rAttrs, XATTR_LINEDASH );
570 if ( !pOld || !( *(const XLineDashItem*)pOld == aDashItem ) )
572 rAttrs.Put( aDashItem );
573 bModified = TRUE;
577 pOld = GetOldItem( rAttrs, XATTR_LINESTYLE );
578 if ( !pOld || !( *(const XLineStyleItem*)pOld == *pStyleItem ) )
580 rAttrs.Put( *pStyleItem );
581 bModified = TRUE;
583 delete pStyleItem;
586 // Linienbreite
587 // GetSavedValue() liefert String!
588 if( aMtrLineWidth.GetText() != aMtrLineWidth.GetSavedValue() )
590 XLineWidthItem aItem( GetCoreValue( aMtrLineWidth, ePoolUnit ) );
591 pOld = GetOldItem( rAttrs, XATTR_LINEWIDTH );
592 if ( !pOld || !( *(const XLineWidthItem*)pOld == aItem ) )
594 rAttrs.Put( aItem );
595 bModified = TRUE;
598 //Breite Linienanfang
599 if( aMtrStartWidth.GetText() != aMtrStartWidth.GetSavedValue() )
601 XLineStartWidthItem aItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) );
602 pOld = GetOldItem( rAttrs, XATTR_LINESTARTWIDTH );
603 if ( !pOld || !( *(const XLineStartWidthItem*)pOld == aItem ) )
605 rAttrs.Put( aItem );
606 bModified = TRUE;
609 //Breite Linienende
610 if( aMtrEndWidth.GetText() != aMtrEndWidth.GetSavedValue() )
612 XLineEndWidthItem aItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) );
613 pOld = GetOldItem( rAttrs, XATTR_LINEENDWIDTH );
614 if ( !pOld || !( *(const XLineEndWidthItem*)pOld == aItem ) )
616 rAttrs.Put( aItem );
617 bModified = TRUE;
621 // Linienfarbe
622 if( aLbColor.GetSelectEntryPos() != aLbColor.GetSavedValue() )
624 XLineColorItem aItem( aLbColor.GetSelectEntry(),
625 aLbColor.GetSelectEntryColor() );
626 pOld = GetOldItem( rAttrs, XATTR_LINECOLOR );
627 if ( !pOld || !( *(const XLineColorItem*)pOld == aItem ) )
629 rAttrs.Put( aItem );
630 bModified = TRUE;
634 if( nDlgType != 0 || nPageType != 3 )//CHINA001 if( *pDlgType != 0 || *pPageType != 3 )
636 // Linienanfang
637 nPos = aLbStartStyle.GetSelectEntryPos();
638 if( nPos != LISTBOX_ENTRY_NOTFOUND &&
639 nPos != aLbStartStyle.GetSavedValue() )
641 XLineStartItem* pItem = NULL;
642 if( nPos == 0 )
643 pItem = new XLineStartItem();
644 else if( pLineEndList->Count() > (long) ( nPos - 1 ) )
645 pItem = new XLineStartItem( aLbStartStyle.GetSelectEntry(),
646 pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() );
647 pOld = GetOldItem( rAttrs, XATTR_LINESTART );
648 if( pItem &&
649 ( !pOld || !( *(const XLineEndItem*)pOld == *pItem ) ) )
651 rAttrs.Put( *pItem );
652 bModified = TRUE;
654 delete pItem;
656 // Linienende
657 nPos = aLbEndStyle.GetSelectEntryPos();
658 if( nPos != LISTBOX_ENTRY_NOTFOUND &&
659 nPos != aLbEndStyle.GetSavedValue() )
661 XLineEndItem* pItem = NULL;
662 if( nPos == 0 )
663 pItem = new XLineEndItem();
664 else if( pLineEndList->Count() > (long) ( nPos - 1 ) )
665 pItem = new XLineEndItem( aLbEndStyle.GetSelectEntry(),
666 pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() );
667 pOld = GetOldItem( rAttrs, XATTR_LINEEND );
668 if( pItem &&
669 ( !pOld || !( *(const XLineEndItem*)pOld == *pItem ) ) )
671 rAttrs.Put( *pItem );
672 bModified = TRUE;
674 delete pItem;
678 // Linienenden zentriert
679 TriState eState = aTsbCenterStart.GetState();
680 if( eState != aTsbCenterStart.GetSavedValue() )
682 XLineStartCenterItem aItem( sal::static_int_cast< BOOL >( eState ) );
683 pOld = GetOldItem( rAttrs, XATTR_LINESTARTCENTER );
684 if ( !pOld || !( *(const XLineStartCenterItem*)pOld == aItem ) )
686 rAttrs.Put( aItem );
687 bModified = TRUE;
690 eState = aTsbCenterEnd.GetState();
691 if( eState != aTsbCenterEnd.GetSavedValue() )
693 XLineEndCenterItem aItem( sal::static_int_cast< BOOL >( eState ) );
694 pOld = GetOldItem( rAttrs, XATTR_LINEENDCENTER );
695 if ( !pOld || !( *(const XLineEndCenterItem*)pOld == aItem ) )
697 rAttrs.Put( aItem );
698 bModified = TRUE;
702 //Breite Linienanfang
703 if( aMtrStartWidth.GetText() != aMtrStartWidth.GetSavedValue() )
705 XLineStartWidthItem aItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) );
706 pOld = GetOldItem( rAttrs, XATTR_LINESTARTWIDTH );
707 if ( !pOld || !( *(const XLineStartWidthItem*)pOld == aItem ) )
709 rAttrs.Put( aItem );
710 bModified = TRUE;
713 //Breite Linienende
714 if( aMtrEndWidth.GetText() != aMtrEndWidth.GetSavedValue() )
716 XLineEndWidthItem aItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) );
717 pOld = GetOldItem( rAttrs, XATTR_LINEENDWIDTH );
718 if ( !pOld || !( *(const XLineEndWidthItem*)pOld == aItem ) )
720 rAttrs.Put( aItem );
721 bModified = TRUE;
725 // Transparenz
726 UINT16 nVal = (UINT16)aMtrTransparent.GetValue();
727 if( nVal != (UINT16)aMtrTransparent.GetSavedValue().ToInt32() )
729 XLineTransparenceItem aItem( nVal );
730 pOld = GetOldItem( rAttrs, XATTR_LINETRANSPARENCE );
731 if ( !pOld || !( *(const XLineTransparenceItem*)pOld == aItem ) )
733 rAttrs.Put( aItem );
734 bModified = TRUE;
738 // #116827#
739 nPos = maLBEdgeStyle.GetSelectEntryPos();
740 if( LISTBOX_ENTRY_NOTFOUND != nPos && nPos != maLBEdgeStyle.GetSavedValue() )
742 XLineJointItem* pNew = 0L;
744 switch(nPos)
746 case 0: // Rounded, default
748 pNew = new XLineJointItem(XLINEJOINT_ROUND);
749 break;
751 case 1: // - none -
753 pNew = new XLineJointItem(XLINEJOINT_NONE);
754 break;
756 case 2: // Miter
758 pNew = new XLineJointItem(XLINEJOINT_MITER);
759 break;
761 case 3: // Bevel
763 pNew = new XLineJointItem(XLINEJOINT_BEVEL);
764 break;
768 if(pNew)
770 pOld = GetOldItem( rAttrs, XATTR_LINEJOINT );
772 if(!pOld || !(*(const XLineJointItem*)pOld == *pNew))
774 rAttrs.Put( *pNew );
775 bModified = TRUE;
778 delete pNew;
782 if(nSymbolType!=SVX_SYMBOLTYPE_UNKNOWN || bNewSize)
784 //wurde also per Auswahl gesetzt oder Gr��e ist anders
785 SvxSizeItem aSItem(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),aSymbolSize);
786 const SfxPoolItem* pSOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE) );
787 bNewSize = pSOld ? *(const SvxSizeItem *)pSOld != aSItem : bNewSize ;
788 if(bNewSize)
790 rAttrs.Put(aSItem);
791 bModified=TRUE;
794 SfxInt32Item aTItem(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),nSymbolType);
795 const SfxPoolItem* pTOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE) );
796 bool bNewType = pTOld == NULL || *(const SfxInt32Item*)pTOld != aTItem;
797 if(bNewType && nSymbolType==SVX_SYMBOLTYPE_UNKNOWN)
798 bNewType=false;//kleine Korrektur, Typ wurde garnicht gesetzt -> kein Type-Item erzeugen!
799 if(bNewType)
801 rAttrs.Put(aTItem);
802 bModified=TRUE;
805 if(nSymbolType!=SVX_SYMBOLTYPE_NONE)
807 SvxBrushItem aBItem(aSymbolGraphic,GPOS_MM,rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH));
808 const SfxPoolItem* pBOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH) );
809 bool bNewBrush =
810 pBOld == NULL || *(const SvxBrushItem*)pBOld != aBItem;
811 if(bNewBrush)
813 rAttrs.Put(aBItem);
814 bModified=TRUE;
818 rAttrs.Put (CntUInt16Item(SID_PAGE_TYPE,nPageType));//add CHINA001
819 return( bModified );
822 // -----------------------------------------------------------------------
824 BOOL SvxLineTabPage::FillXLSet_Impl()
826 USHORT nPos;
828 if( aLbLineStyle.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND )
830 //rXLSet.Put( XLineDashItem ( rOutAttrs.Get( GetWhich( XATTR_LINEDASH ) ) ) );
831 rXLSet.Put( XLineStyleItem( XLINE_NONE ) );
833 else if( aLbLineStyle.IsEntryPosSelected( 0 ) )
834 rXLSet.Put( XLineStyleItem( XLINE_NONE ) );
835 else if( aLbLineStyle.IsEntryPosSelected( 1 ) )
836 rXLSet.Put( XLineStyleItem( XLINE_SOLID ) );
837 else
839 rXLSet.Put( XLineStyleItem( XLINE_DASH ) );
841 nPos = aLbLineStyle.GetSelectEntryPos();
842 if( nPos != LISTBOX_ENTRY_NOTFOUND )
844 rXLSet.Put( XLineDashItem( aLbLineStyle.GetSelectEntry(),
845 pDashList->GetDash( nPos - 2 )->GetDash() ) );
849 nPos = aLbStartStyle.GetSelectEntryPos();
850 if( nPos != LISTBOX_ENTRY_NOTFOUND )
852 if( nPos == 0 )
853 rXLSet.Put( XLineStartItem() );
854 else
855 rXLSet.Put( XLineStartItem( aLbStartStyle.GetSelectEntry(),
856 pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) );
858 nPos = aLbEndStyle.GetSelectEntryPos();
859 if( nPos != LISTBOX_ENTRY_NOTFOUND )
861 if( nPos == 0 )
862 rXLSet.Put( XLineEndItem() );
863 else
864 rXLSet.Put( XLineEndItem( aLbEndStyle.GetSelectEntry(),
865 pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) );
868 // #116827#
869 nPos = maLBEdgeStyle.GetSelectEntryPos();
870 if(LISTBOX_ENTRY_NOTFOUND != nPos)
872 switch(nPos)
874 case 0: // Rounded, default
876 rXLSet.Put(XLineJointItem(XLINEJOINT_ROUND));
877 break;
879 case 1: // - none -
881 rXLSet.Put(XLineJointItem(XLINEJOINT_NONE));
882 break;
884 case 2: // Miter
886 rXLSet.Put(XLineJointItem(XLINEJOINT_MITER));
887 break;
889 case 3: // Bevel
891 rXLSet.Put(XLineJointItem(XLINEJOINT_BEVEL));
892 break;
897 rXLSet.Put( XLineStartWidthItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) ) );
898 rXLSet.Put( XLineEndWidthItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) ) );
900 rXLSet.Put( XLineWidthItem( GetCoreValue( aMtrLineWidth, ePoolUnit ) ) );
901 rXLSet.Put( XLineColorItem( aLbColor.GetSelectEntry(),
902 aLbColor.GetSelectEntryColor() ) );
904 // Linienenden zentriert
905 if( aTsbCenterStart.GetState() == STATE_CHECK )
906 rXLSet.Put( XLineStartCenterItem( TRUE ) );
907 else if( aTsbCenterStart.GetState() == STATE_NOCHECK )
908 rXLSet.Put( XLineStartCenterItem( FALSE ) );
910 if( aTsbCenterEnd.GetState() == STATE_CHECK )
911 rXLSet.Put( XLineEndCenterItem( TRUE ) );
912 else if( aTsbCenterEnd.GetState() == STATE_NOCHECK )
913 rXLSet.Put( XLineEndCenterItem( FALSE ) );
915 // Transparenz
916 UINT16 nVal = (UINT16)aMtrTransparent.GetValue();
917 rXLSet.Put( XLineTransparenceItem( nVal ) );
919 // #116827#
920 aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
922 return( TRUE );
925 // -----------------------------------------------------------------------
927 void SvxLineTabPage::Reset( const SfxItemSet& rAttrs )
929 String aString;
930 XLineStyle eXLS; // XLINE_NONE, XLINE_SOLID, XLINE_DASH
932 // Linienstil
934 if( bObjSelected &&
935 rAttrs.GetItemState( GetWhich( XATTR_LINESTYLE ) ) == SFX_ITEM_DEFAULT )
937 aLbLineStyle.Disable();
940 const SfxPoolItem *pPoolItem;
941 long nSymType=SVX_SYMBOLTYPE_UNKNOWN;
942 BOOL bPrevSym=FALSE;
943 BOOL bEnable=TRUE;
944 BOOL bIgnoreGraphic=FALSE;
945 BOOL bIgnoreSize=FALSE;
946 if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),TRUE,&pPoolItem) == SFX_ITEM_SET)
948 nSymType=((const SfxInt32Item *)pPoolItem)->GetValue();
951 if(nSymType == SVX_SYMBOLTYPE_AUTO)
953 aSymbolGraphic=aAutoSymbolGraphic;
954 aSymbolSize=aSymbolLastSize=aAutoSymbolGraphic.GetPrefSize();
955 bPrevSym=TRUE;
957 else if(nSymType == SVX_SYMBOLTYPE_NONE)
959 bEnable=FALSE;
960 bIgnoreGraphic=TRUE;
961 bIgnoreSize=TRUE;
963 else if(nSymType >= 0)
965 VirtualDevice aVDev;
966 aVDev.SetMapMode(MapMode(MAP_100TH_MM));
968 SdrModel* pModel = new SdrModel(NULL, NULL, LOADREFCOUNTS);
969 pModel->GetItemPool().FreezeIdRanges();
970 SdrPage* pPage = new SdrPage( *pModel, FALSE );
971 pPage->SetSize(Size(1000,1000));
972 pModel->InsertPage( pPage, 0 );
973 SdrView* pView = new SdrView( pModel, &aVDev );
974 pView->hideMarkHandles();
975 SdrPageView* pPageView = pView->ShowSdrPage(pPage);
976 // SdrPageView* pPageView = pView->ShowSdrPage(pPage, Point());
977 SdrObject *pObj=NULL;
978 long nSymTmp=nSymType;
979 if(pSymbolList)
981 if(pSymbolList->GetObjCount())
983 nSymTmp=nSymTmp%pSymbolList->GetObjCount(); //Liste wird als cyclisch betrachtet!!!
984 pObj=pSymbolList->GetObj(nSymTmp);
985 if(pObj)
987 pObj=pObj->Clone();
988 pPage->NbcInsertObject(pObj);
989 pView->MarkObj(pObj,pPageView);
990 if(pSymbolAttr)
992 pObj->SetMergedItemSet(*pSymbolAttr);
994 else
996 pObj->SetMergedItemSet(rOutAttrs);
998 GDIMetaFile aMeta(pView->GetAllMarkedMetaFile());
1000 aSymbolGraphic=Graphic(aMeta);
1001 aSymbolSize=pObj->GetSnapRect().GetSize();
1002 aSymbolGraphic.SetPrefSize(aSymbolSize);
1003 aSymbolGraphic.SetPrefMapMode(MAP_100TH_MM);
1004 bPrevSym=TRUE;
1005 bEnable=TRUE;
1006 bIgnoreGraphic=TRUE;
1008 pView->UnmarkAll();
1009 pObj=pPage->RemoveObject(0);
1010 SdrObject::Free( pObj );
1014 delete pView;
1015 delete pModel;
1017 if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH),TRUE,&pPoolItem) == SFX_ITEM_SET)
1019 const Graphic* pGraphic = ((const SvxBrushItem *)pPoolItem)->GetGraphic();
1020 if( pGraphic )
1022 if(!bIgnoreGraphic)
1024 aSymbolGraphic=*pGraphic;
1026 if(!bIgnoreSize)
1028 aSymbolSize=OutputDevice::LogicToLogic( pGraphic->GetPrefSize(),
1029 pGraphic->GetPrefMapMode(),
1030 MAP_100TH_MM );
1032 bPrevSym=TRUE;
1035 if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),TRUE,&pPoolItem) == SFX_ITEM_SET)
1037 aSymbolSize = ((const SvxSizeItem *)pPoolItem)->GetSize();
1041 aSymbolRatioCB.Enable(bEnable);
1042 aSymbolHeightFT.Enable(bEnable);
1043 aSymbolWidthFT.Enable(bEnable);
1044 aSymbolWidthMF.Enable(bEnable);
1045 aSymbolHeightMF.Enable(bEnable);
1046 if(bPrevSym)
1048 SetMetricValue(aSymbolWidthMF, aSymbolSize.Width(), ePoolUnit);
1049 SetMetricValue(aSymbolHeightMF, aSymbolSize.Height(),ePoolUnit);
1050 aCtlPreview.SetSymbol(&aSymbolGraphic,aSymbolSize);
1051 aSymbolLastSize=aSymbolSize;
1054 if( rAttrs.GetItemState( XATTR_LINESTYLE ) != SFX_ITEM_DONTCARE )
1056 eXLS = (XLineStyle) ( ( const XLineStyleItem& ) rAttrs.Get( XATTR_LINESTYLE ) ).GetValue();
1058 switch( eXLS )
1060 case XLINE_NONE:
1061 aLbLineStyle.SelectEntryPos( 0 );
1062 break;
1063 case XLINE_SOLID:
1064 aLbLineStyle.SelectEntryPos( 1 );
1065 break;
1067 case XLINE_DASH:
1068 aLbLineStyle.SetNoSelection();
1069 aLbLineStyle.SelectEntry( ( ( const XLineDashItem& ) rAttrs.
1070 Get( XATTR_LINEDASH ) ).GetName() );
1071 break;
1073 default:
1074 break;
1077 else
1079 aLbLineStyle.SetNoSelection();
1082 // Linienstaerke
1084 if( bObjSelected &&
1085 rAttrs.GetItemState( GetWhich( XATTR_LINEWIDTH ) ) == SFX_ITEM_DEFAULT )
1087 aMtrLineWidth.Disable();
1090 if( rAttrs.GetItemState( XATTR_LINEWIDTH ) != SFX_ITEM_DONTCARE )
1092 SetMetricValue( aMtrLineWidth, ( ( const XLineWidthItem& ) rAttrs.
1093 Get( XATTR_LINEWIDTH ) ).GetValue(), ePoolUnit );
1095 else
1096 aMtrLineWidth.SetText( String() );
1098 // Linienfarbe
1100 if( bObjSelected &&
1101 rAttrs.GetItemState( GetWhich( XATTR_LINECOLOR ) ) == SFX_ITEM_DEFAULT )
1103 aLbColor.Disable();
1106 aLbColor.SetNoSelection();
1108 if ( rAttrs.GetItemState( XATTR_LINECOLOR ) != SFX_ITEM_DONTCARE )
1110 Color aCol = ( ( const XLineColorItem& ) rAttrs.Get( XATTR_LINECOLOR ) ).GetColorValue();
1111 aLbColor.SelectEntry( aCol );
1112 if( aLbColor.GetSelectEntryCount() == 0 )
1114 aLbColor.InsertEntry( aCol, String() );
1115 aLbColor.SelectEntry( aCol );
1119 // LinienAnfang
1120 if( bObjSelected &&
1121 rAttrs.GetItemState( XATTR_LINESTART ) == SFX_ITEM_DEFAULT )
1123 aLbStartStyle.Disable();
1125 else if( rAttrs.GetItemState( XATTR_LINESTART ) != SFX_ITEM_DONTCARE )
1127 // #86265# select entry using list and polygon, not string
1128 sal_Bool bSelected(FALSE);
1129 const basegfx::B2DPolyPolygon& rItemPolygon = ((const XLineStartItem&)rAttrs.Get(XATTR_LINESTART)).GetLineStartValue();
1131 for(sal_Int32 a(0);!bSelected && a < pLineEndList->Count(); a++)
1133 XLineEndEntry* pEntry = pLineEndList->GetLineEnd(a);
1134 const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
1136 if(rItemPolygon == rEntryPolygon)
1138 // select this entry
1139 aLbStartStyle.SelectEntryPos((sal_uInt16)a + 1);
1140 bSelected = TRUE;
1144 if(!bSelected)
1145 aLbStartStyle.SelectEntryPos( 0 );
1147 else
1149 aLbStartStyle.SetNoSelection();
1152 // LinienEnde
1153 if( bObjSelected &&
1154 rAttrs.GetItemState( XATTR_LINEEND ) == SFX_ITEM_DEFAULT )
1156 aLbEndStyle.Disable();
1158 else if( rAttrs.GetItemState( XATTR_LINEEND ) != SFX_ITEM_DONTCARE )
1160 // #86265# select entry using list and polygon, not string
1161 sal_Bool bSelected(FALSE);
1162 const basegfx::B2DPolyPolygon& rItemPolygon = ((const XLineEndItem&)rAttrs.Get(XATTR_LINEEND)).GetLineEndValue();
1164 for(sal_Int32 a(0);!bSelected && a < pLineEndList->Count(); a++)
1166 XLineEndEntry* pEntry = pLineEndList->GetLineEnd(a);
1167 const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
1169 if(rItemPolygon == rEntryPolygon)
1171 // select this entry
1172 aLbEndStyle.SelectEntryPos((sal_uInt16)a + 1);
1173 bSelected = TRUE;
1177 if(!bSelected)
1178 aLbEndStyle.SelectEntryPos( 0 );
1180 else
1182 aLbEndStyle.SetNoSelection();
1185 // LinienAnfang St"arke
1186 if( bObjSelected &&
1187 rAttrs.GetItemState( XATTR_LINESTARTWIDTH ) == SFX_ITEM_DEFAULT )
1189 aMtrStartWidth.Disable();
1191 else if( rAttrs.GetItemState( XATTR_LINESTARTWIDTH ) != SFX_ITEM_DONTCARE )
1193 SetMetricValue( aMtrStartWidth, ( ( const XLineStartWidthItem& ) rAttrs.
1194 Get( XATTR_LINESTARTWIDTH ) ).GetValue(), ePoolUnit );
1196 else
1197 aMtrStartWidth.SetText( String() );
1199 // LinienEnde St"arke
1200 if( bObjSelected &&
1201 rAttrs.GetItemState( XATTR_LINEENDWIDTH ) == SFX_ITEM_DEFAULT )
1203 aMtrEndWidth.Disable();
1205 else if( rAttrs.GetItemState( XATTR_LINEENDWIDTH ) != SFX_ITEM_DONTCARE )
1207 SetMetricValue( aMtrEndWidth, ( ( const XLineEndWidthItem& ) rAttrs.
1208 Get( XATTR_LINEENDWIDTH ) ).GetValue(), ePoolUnit );
1210 else
1211 aMtrEndWidth.SetText( String() );
1213 // Linienenden zentriert (Start)
1214 if( bObjSelected &&
1215 rAttrs.GetItemState( XATTR_LINESTARTCENTER ) == SFX_ITEM_DEFAULT )
1217 aTsbCenterStart.Disable();
1219 else if( rAttrs.GetItemState( XATTR_LINESTARTCENTER ) != SFX_ITEM_DONTCARE )
1221 aTsbCenterStart.EnableTriState( FALSE );
1223 if( ( ( const XLineStartCenterItem& ) rAttrs.Get( XATTR_LINESTARTCENTER ) ).GetValue() )
1224 aTsbCenterStart.SetState( STATE_CHECK );
1225 else
1226 aTsbCenterStart.SetState( STATE_NOCHECK );
1228 else
1230 aTsbCenterStart.SetState( STATE_DONTKNOW );
1233 // Linienenden zentriert (Ende)
1234 if( bObjSelected &&
1235 rAttrs.GetItemState( XATTR_LINEENDCENTER ) == SFX_ITEM_DEFAULT )
1237 aTsbCenterEnd.Disable();
1239 else if( rAttrs.GetItemState( XATTR_LINEENDCENTER ) != SFX_ITEM_DONTCARE )
1241 aTsbCenterEnd.EnableTriState( FALSE );
1243 if( ( ( const XLineEndCenterItem& ) rAttrs.Get( XATTR_LINEENDCENTER ) ).GetValue() )
1244 aTsbCenterEnd.SetState( STATE_CHECK );
1245 else
1246 aTsbCenterEnd.SetState( STATE_NOCHECK );
1248 else
1250 aTsbCenterEnd.SetState( STATE_DONTKNOW );
1253 // Transparenz
1254 if( rAttrs.GetItemState( XATTR_LINETRANSPARENCE ) != SFX_ITEM_DONTCARE )
1256 USHORT nTransp = ( ( const XLineTransparenceItem& ) rAttrs.
1257 Get( XATTR_LINETRANSPARENCE ) ).GetValue();
1258 aMtrTransparent.SetValue( nTransp );
1259 ChangeTransparentHdl_Impl( NULL );
1261 else
1262 aMtrTransparent.SetText( String() );
1264 if( !aLbStartStyle.IsEnabled() &&
1265 !aLbEndStyle.IsEnabled() &&
1266 !aMtrStartWidth.IsEnabled() &&
1267 !aMtrEndWidth.IsEnabled() &&
1268 !aTsbCenterStart.IsEnabled()&&
1269 !aTsbCenterEnd.IsEnabled() )
1271 aCbxSynchronize.Disable();
1272 aFtLineEndsStyle.Disable();
1273 aFtLineEndsWidth.Disable();
1274 aFlLineEnds.Disable();
1277 // Synchronisieren
1278 // Jetzt wird der Wert aus der INI-Datei geholt (#42258#)
1279 String aStr = GetUserData();
1280 aCbxSynchronize.Check( (BOOL)aStr.ToInt32() );
1282 // #116827#
1283 if(bObjSelected && SFX_ITEM_DEFAULT == rAttrs.GetItemState(XATTR_LINEJOINT))
1285 maFTEdgeStyle.Disable();
1286 maLBEdgeStyle.Disable();
1288 else if(SFX_ITEM_DONTCARE != rAttrs.GetItemState(XATTR_LINEJOINT))
1290 XLineJoint eLineJoint = ((const XLineJointItem&)(rAttrs.Get(XATTR_LINEJOINT))).GetValue();
1292 switch(eLineJoint)
1294 case XLINEJOINT_ROUND : maLBEdgeStyle.SelectEntryPos(0); break;
1295 case XLINEJOINT_NONE : maLBEdgeStyle.SelectEntryPos(1); break;
1296 case XLINEJOINT_MITER : maLBEdgeStyle.SelectEntryPos(2); break;
1297 case XLINEJOINT_BEVEL : maLBEdgeStyle.SelectEntryPos(3); break;
1298 case XLINEJOINT_MIDDLE : break;
1301 else
1303 maLBEdgeStyle.SetNoSelection();
1307 if( aLbStartStyle.GetSelectEntryPos() == aLbEndStyle.GetSelectEntryPos() &&
1308 aMtrStartWidth.GetValue() == aMtrEndWidth.GetValue() &&
1309 aTsbCenterStart.GetState() == aTsbCenterEnd.GetState() )
1311 aCbxSynchronize.Check();
1315 // Werte sichern
1316 aLbLineStyle.SaveValue();
1317 aMtrLineWidth.SaveValue();
1318 aLbColor.SaveValue();
1319 aLbStartStyle.SaveValue();
1320 aLbEndStyle.SaveValue();
1321 aMtrStartWidth.SaveValue();
1322 aMtrEndWidth.SaveValue();
1323 aTsbCenterStart.SaveValue();
1324 aTsbCenterEnd.SaveValue();
1325 aMtrTransparent.SaveValue();
1327 // #116827#
1328 maLBEdgeStyle.SaveValue();
1330 ClickInvisibleHdl_Impl( this );
1331 //ClickMeasuringHdl_Impl( this );
1332 //aCtlPosition.Reset();
1334 ChangePreviewHdl_Impl( NULL );
1337 // -----------------------------------------------------------------------
1339 SfxTabPage* SvxLineTabPage::Create( Window* pWindow,
1340 const SfxItemSet& rAttrs )
1342 return( new SvxLineTabPage( pWindow, rAttrs ) );
1345 //------------------------------------------------------------------------
1347 USHORT* SvxLineTabPage::GetRanges()
1349 return( pLineRanges );
1352 //------------------------------------------------------------------------
1354 IMPL_LINK( SvxLineTabPage, ChangePreviewHdl_Impl, void *, pCntrl )
1356 if(pCntrl == &aMtrLineWidth)
1358 // Linienbreite und Start/EndBreite
1359 INT32 nNewLineWidth = GetCoreValue( aMtrLineWidth, ePoolUnit );
1360 if(nActLineWidth == -1)
1362 // Noch nicht initialisiert, hole den Startwert
1363 const SfxPoolItem* pOld = GetOldItem( rXLSet, XATTR_LINEWIDTH );
1364 INT32 nStartLineWidth = 0;
1365 if(pOld)
1366 nStartLineWidth = (( const XLineWidthItem *)pOld)->GetValue();
1367 nActLineWidth = nStartLineWidth;
1370 if(nActLineWidth != nNewLineWidth)
1372 // Anpassungen Start/EndWidth #63083#
1373 INT32 nValAct = GetCoreValue( aMtrStartWidth, ePoolUnit );
1374 INT32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
1375 if(nValNew < 0)
1376 nValNew = 0;
1377 SetMetricValue( aMtrStartWidth, nValNew, ePoolUnit );
1379 nValAct = GetCoreValue( aMtrEndWidth, ePoolUnit );
1380 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
1381 if(nValNew < 0)
1382 nValNew = 0;
1383 SetMetricValue( aMtrEndWidth, nValNew, ePoolUnit );
1386 // Aktuellen Wert merken
1387 nActLineWidth = nNewLineWidth;
1390 FillXLSet_Impl();
1391 aCtlPreview.Invalidate();
1393 // Transparenz entspr. zugaenglich machen
1394 if( aLbLineStyle.GetSelectEntryPos() == 0 ) // unsichtbar
1396 aFtTransparent.Disable();
1397 aMtrTransparent.Disable();
1399 else
1401 aFtTransparent.Enable();
1402 aMtrTransparent.Enable();
1405 const bool bHasLineStart = aLbStartStyle.GetSelectEntryPos() != 0;
1406 const bool bHasLineEnd = aLbEndStyle.GetSelectEntryPos() != 0;
1408 aFtLineEndsWidth.Enable( bHasLineStart || bHasLineEnd );
1409 aMtrStartWidth.Enable( bHasLineStart );
1410 aTsbCenterStart.Enable( bHasLineStart );
1411 aMtrEndWidth.Enable( bHasLineEnd );
1412 aTsbCenterEnd.Enable( bHasLineEnd );
1414 return( 0L );
1417 //------------------------------------------------------------------------
1419 IMPL_LINK( SvxLineTabPage, ChangeStartHdl_Impl, void *, p )
1421 if( aCbxSynchronize.IsChecked() )
1423 if( p == &aMtrStartWidth )
1424 aMtrEndWidth.SetValue( aMtrStartWidth.GetValue() );
1425 if( p == &aLbStartStyle )
1426 aLbEndStyle.SelectEntryPos( aLbStartStyle.GetSelectEntryPos() );
1427 if( p == &aTsbCenterStart )
1428 aTsbCenterEnd.SetState( aTsbCenterStart.GetState() );
1431 ChangePreviewHdl_Impl( this );
1433 return( 0L );
1436 //------------------------------------------------------------------------
1437 // #116827#
1439 IMPL_LINK( SvxLineTabPage, ChangeEdgeStyleHdl_Impl, void *, EMPTYARG )
1441 ChangePreviewHdl_Impl( this );
1443 return( 0L );
1446 //------------------------------------------------------------------------
1448 IMPL_LINK( SvxLineTabPage, ClickInvisibleHdl_Impl, void *, EMPTYARG )
1450 if( aLbLineStyle.GetSelectEntryPos() == 0 ) // unsichtbar
1452 aFtColor.Disable();
1453 if(!bSymbols)
1454 aLbColor.Disable();
1455 aFtLineWidth.Disable();
1456 aMtrLineWidth.Disable();
1458 if( aFlLineEnds.IsEnabled() )
1460 aFtLineEndsStyle.Disable();
1461 aFtLineEndsWidth.Disable();
1462 aLbStartStyle.Disable();
1463 aMtrStartWidth.Disable();
1464 aTsbCenterStart.Disable();
1465 aLbEndStyle.Disable();
1466 aMtrEndWidth.Disable();
1467 aTsbCenterEnd.Disable();
1468 aCbxSynchronize.Disable();
1470 // #116827#
1471 maFTEdgeStyle.Disable();
1472 maLBEdgeStyle.Disable();
1475 else
1477 aFtColor.Enable();
1478 aLbColor.Enable();
1479 aFtLineWidth.Enable();
1480 aMtrLineWidth.Enable();
1482 if( aFlLineEnds.IsEnabled() )
1484 aFtLineEndsStyle.Enable();
1485 aFtLineEndsWidth.Enable();
1486 aLbStartStyle.Enable();
1487 aMtrStartWidth.Enable();
1488 aTsbCenterStart.Enable();
1489 aLbEndStyle.Enable();
1490 aMtrEndWidth.Enable();
1491 aTsbCenterEnd.Enable();
1492 aCbxSynchronize.Enable();
1494 // #116827#
1495 maFTEdgeStyle.Enable();
1496 maLBEdgeStyle.Enable();
1499 ChangePreviewHdl_Impl( NULL );
1501 return( 0L );
1504 //------------------------------------------------------------------------
1506 IMPL_LINK( SvxLineTabPage, ChangeEndHdl_Impl, void *, p )
1508 if( aCbxSynchronize.IsChecked() )
1510 if( p == &aMtrEndWidth )
1511 aMtrStartWidth.SetValue( aMtrEndWidth.GetValue() );
1512 if( p == &aLbEndStyle )
1513 aLbStartStyle.SelectEntryPos( aLbEndStyle.GetSelectEntryPos() );
1514 if( p == &aTsbCenterEnd )
1515 aTsbCenterStart.SetState( aTsbCenterEnd.GetState() );
1518 ChangePreviewHdl_Impl( this );
1520 return( 0L );
1523 //------------------------------------------------------------------------
1526 long SvxLineTabPage::ClickMeasuringHdl_Impl( void* )
1528 if( aTsbShowMeasuring.GetState() == STATE_NOCHECK )
1530 aFtPosition.Disable();
1531 aCtlPosition.Disable();
1533 else
1535 aFtPosition.Enable();
1536 aCtlPosition.Enable();
1538 aCtlPosition.Invalidate();
1540 return( 0L );
1543 //------------------------------------------------------------------------
1545 IMPL_LINK( SvxLineTabPage, ChangeTransparentHdl_Impl, void *, EMPTYARG )
1547 UINT16 nVal = (UINT16)aMtrTransparent.GetValue();
1548 XLineTransparenceItem aItem( nVal );
1550 rXLSet.Put( XLineTransparenceItem( aItem ) );
1552 // #116827#
1553 FillXLSet_Impl();
1555 aCtlPreview.Invalidate();
1557 return( 0L );
1560 //------------------------------------------------------------------------
1562 void SvxLineTabPage::PointChanged( Window*, RECT_POINT eRcPt )
1564 eRP = eRcPt;
1567 //------------------------------------------------------------------------
1569 void SvxLineTabPage::FillUserData()
1571 // Abgleich wird in der Ini-Datei festgehalten
1572 UniString aStrUserData = UniString::CreateFromInt32( (sal_Int32) aCbxSynchronize.IsChecked() );
1573 SetUserData( aStrUserData );
1577 //#58425# Symbole auf einer Linie (z.B. StarChart)
1578 //Handler f�r Popup-Menue der Symbolauswahl (NumMenueButton)
1579 //der folgende Link stammt urspruenglich aus SvxNumOptionsTabPage
1580 IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton )
1582 //Popup initialisieren
1583 if(!pButton->GetPopupMenu()->GetPopupMenu( MN_GALLERY ))
1585 // Gallery-Eintraege besorgen
1586 GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames);
1588 PopupMenu* pPopup = new PopupMenu;
1589 String aEmptyStr;
1590 SfxObjectShell *pDocSh = SfxObjectShell::Current();
1592 nNumMenuGalleryItems=aGrfNames.Count();
1593 for(long i = 0; i < nNumMenuGalleryItems; i++)
1595 const String* pGrfName = (const String*)aGrfNames.GetObject(i);
1596 const String* pUIName = pGrfName;
1598 // convert URL encodings to UI characters (eg %20 for spaces)
1599 String aPhysicalName;
1600 if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( *pGrfName, aPhysicalName ))
1601 pUIName = &aPhysicalName;
1603 SvxBrushItem* pBrushItem = new SvxBrushItem(*pGrfName, aEmptyStr, GPOS_AREA, SID_ATTR_BRUSH);
1604 pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl));
1606 SvxBmpItemInfo* pInfo = new SvxBmpItemInfo();
1607 pInfo->pBrushItem = pBrushItem;
1608 pInfo->nItemId = (UINT16)(MN_GALLERY_ENTRY + i);
1609 aGrfBrushItems.Insert(pInfo, i);
1610 const Graphic* pGraphic = pBrushItem->GetGraphic(pDocSh);
1612 if(pGraphic)
1614 Bitmap aBitmap(pGraphic->GetBitmap());
1615 Size aSize(aBitmap.GetSizePixel());
1616 if(aSize.Width() > MAX_BMP_WIDTH ||
1617 aSize.Height() > MAX_BMP_HEIGHT)
1619 BOOL bWidth = aSize.Width() > aSize.Height();
1620 double nScale = bWidth ?
1621 (double)MAX_BMP_WIDTH / (double)aSize.Width():
1622 (double)MAX_BMP_HEIGHT / (double)aSize.Height();
1623 aBitmap.Scale(nScale, nScale);
1626 Image aImage(aBitmap);
1627 pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage );
1629 else
1631 Image aImage;
1632 pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage );
1635 aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup );
1636 if(!aGrfNames.Count())
1637 aSymbolMB.GetPopupMenu()->EnableItem(MN_GALLERY, FALSE);
1640 if(!pButton->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS ) && pSymbolList)
1642 VirtualDevice aVDev;
1643 aVDev.SetMapMode(MapMode(MAP_100TH_MM));
1644 SdrModel* pModel = new SdrModel(NULL, NULL, LOADREFCOUNTS);
1645 pModel->GetItemPool().FreezeIdRanges();
1646 // Page
1647 SdrPage* pPage = new SdrPage( *pModel, FALSE );
1648 pPage->SetSize(Size(1000,1000));
1649 pModel->InsertPage( pPage, 0 );
1650 // 3D View
1651 SdrView* pView = new SdrView( pModel, &aVDev );
1652 pView->hideMarkHandles();
1653 // SdrPageView* pPageView = pView->ShowSdrPage(pPage, Point());
1654 SdrPageView* pPageView = pView->ShowSdrPage(pPage);
1656 PopupMenu* pPopup = new PopupMenu;
1657 String aEmptyStr;
1658 for(long i=0;; ++i)
1660 SdrObject *pObj=pSymbolList->GetObj(i);
1661 if(pObj==NULL)
1662 break;
1663 pObj=pObj->Clone();
1664 //const String* pGrfName = (const String*)aGrfNames.GetObject(i);
1665 String *pStr=new String();//String(i));
1666 aGrfNames.Insert(pStr,LIST_APPEND);
1667 //Rectangle aRect(pObj->GetLogicRect());
1668 pPage->NbcInsertObject(pObj);
1669 pView->MarkObj(pObj,pPageView);
1670 if(pSymbolAttr)
1672 pObj->SetMergedItemSet(*pSymbolAttr);
1674 else
1676 pObj->SetMergedItemSet(rOutAttrs);
1679 Bitmap aBitmap(pView->GetAllMarkedBitmap());
1680 GDIMetaFile aMeta(pView->GetAllMarkedMetaFile());
1681 pView->UnmarkAll();
1682 pObj=pPage->RemoveObject(0);
1683 SdrObject::Free(pObj);
1685 SvxBrushItem* pBrushItem = new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH);
1686 pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl));
1688 SvxBmpItemInfo* pInfo = new SvxBmpItemInfo();
1689 pInfo->pBrushItem = pBrushItem;
1690 pInfo->nItemId = (UINT16)(MN_GALLERY_ENTRY + i + nNumMenuGalleryItems);
1691 aGrfBrushItems.Insert(pInfo, nNumMenuGalleryItems + i);
1693 Size aSize(aBitmap.GetSizePixel());
1694 if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT)
1696 BOOL bWidth = aSize.Width() > aSize.Height();
1697 double nScale = bWidth ?
1698 (double)MAX_BMP_WIDTH / (double)aSize.Width():
1699 (double)MAX_BMP_HEIGHT / (double)aSize.Height();
1700 aBitmap.Scale(nScale, nScale);
1702 Image aImage(aBitmap);
1703 pPopup->InsertItem(pInfo->nItemId,*pStr,aImage);
1705 aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_SYMBOLS, pPopup );
1706 if(!aGrfNames.Count())
1707 aSymbolMB.GetPopupMenu()->EnableItem(MN_SYMBOLS, FALSE);
1709 delete pView;
1710 delete pModel;
1712 return 0;
1714 //#58425# Symbole auf einer Linie (z.B. StarChart)
1715 //Handler f�r Popup-Menue der Symbolauswahl (NumMenueButton)
1716 //der folgende Link stammt urspruenglich aus SvxNumOptionsTabPage:
1717 IMPL_STATIC_LINK(SvxLineTabPage, GraphicArrivedHdl_Impl, SvxBrushItem*, pItem)
1719 PopupMenu* pPopup = pThis->aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
1721 SvxBmpItemInfo* pBmpInfo = 0;
1722 for ( USHORT i = 0; i < pThis->aGrfBrushItems.Count(); i++ )
1724 SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)pThis->aGrfBrushItems.GetObject(i);
1725 if( pInfo->pBrushItem == pItem )
1727 pBmpInfo = pInfo; break;
1730 if( pBmpInfo )
1732 if( pItem->GetGraphic() )
1734 Bitmap aBitmap(pItem->GetGraphic()->GetBitmap());
1735 Size aSize(aBitmap.GetSizePixel());
1736 if(aSize.Width() > MAX_BMP_WIDTH ||
1737 aSize.Height() > MAX_BMP_HEIGHT)
1739 BOOL bWidth = aSize.Width() > aSize.Height();
1740 double nScale = bWidth ?
1741 (double)MAX_BMP_WIDTH / (double)aSize.Width():
1742 (double)MAX_BMP_HEIGHT / (double)aSize.Height();
1743 aBitmap.Scale(nScale, nScale);
1745 Image aImage(aBitmap);
1746 pPopup->SetItemImage( pBmpInfo->nItemId, aImage );
1750 return 0;
1753 //#58425# Symbole auf einer Linie (z.B. StarChart)
1754 //Handler f�r Menuebutton
1755 IMPL_LINK( SvxLineTabPage, GraphicHdl_Impl, MenuButton *, pButton )
1757 USHORT nItemId = pButton->GetCurItemId();
1758 const Graphic* pGraphic = 0;
1759 Graphic aGraphic;
1760 String aGrfName;
1761 BOOL bResetSize = FALSE;
1762 BOOL bEnable=TRUE;
1763 long nPreviousSymbolType = nSymbolType;
1765 if(nItemId >= MN_GALLERY_ENTRY)
1767 if( (nItemId-MN_GALLERY_ENTRY) >= nNumMenuGalleryItems)
1769 nSymbolType=nItemId-MN_GALLERY_ENTRY-nNumMenuGalleryItems; //Index der Liste
1771 else
1773 nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM;
1774 bResetSize = TRUE;
1776 SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)aGrfBrushItems.GetObject(nItemId - MN_GALLERY_ENTRY);
1777 pGraphic = pInfo->pBrushItem->GetGraphic();
1779 else switch(nItemId)
1781 case MN_SYMBOLS_AUTO:
1783 pGraphic=&aAutoSymbolGraphic;
1784 aAutoSymbolGraphic.SetPrefSize( Size(253,253) );
1785 nSymbolType=SVX_SYMBOLTYPE_AUTO;
1787 break;
1789 case MN_SYMBOLS_NONE:
1791 nSymbolType=SVX_SYMBOLTYPE_NONE;
1792 pGraphic=NULL;
1793 bEnable=FALSE;
1795 break;
1796 default:
1798 SvxOpenGraphicDialog aGrfDlg(SVX_RES(RID_STR_EDIT_GRAPHIC));
1799 aGrfDlg.EnableLink(sal_False);
1800 aGrfDlg.AsLink(sal_False);
1801 if( !aGrfDlg.Execute() )
1803 // ausgewaehlten Filter merken
1804 aGrfName = aGrfDlg.GetPath();
1805 if( !aGrfDlg.GetGraphic(aGraphic) )
1807 nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM;
1808 pGraphic = &aGraphic;
1809 bResetSize = TRUE;
1812 if( !pGraphic )
1813 return 0;
1815 break;
1818 if(pGraphic)
1820 Size aSize = SvxNumberFormat::GetGraphicSizeMM100(pGraphic);
1821 aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)ePoolUnit);
1822 aSymbolGraphic=*pGraphic;
1823 if( bResetSize )
1825 aSymbolSize=aSize;
1827 else if( nPreviousSymbolType == SVX_SYMBOLTYPE_BRUSHITEM )
1828 { //#i31097# Data Point Symbol size changes when a different symbol is choosen(maoyg)
1829 if( aSymbolSize.Width() != aSymbolSize.Height() )
1831 aSize.setWidth( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 );
1832 aSize.setHeight( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 );
1833 aSymbolSize = aSize;
1836 aCtlPreview.SetSymbol(&aSymbolGraphic,aSymbolSize);
1838 else
1840 aSymbolGraphic=Graphic();
1841 aCtlPreview.SetSymbol(NULL,aSymbolSize);
1842 bEnable=FALSE;
1844 aSymbolLastSize=aSymbolSize;
1845 SetMetricValue(aSymbolWidthMF, aSymbolSize.Width(), ePoolUnit);
1846 SetMetricValue(aSymbolHeightMF, aSymbolSize.Height(), ePoolUnit);
1847 aSymbolRatioCB.Enable(bEnable);
1848 aSymbolHeightFT.Enable(bEnable);
1849 aSymbolWidthFT.Enable(bEnable);
1850 aSymbolWidthMF.Enable(bEnable);
1851 aSymbolHeightMF.Enable(bEnable);
1852 aCtlPreview.Invalidate();
1854 return 0;
1856 IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, MetricField *, pField)
1858 bNewSize=true;
1859 BOOL bWidth = (BOOL)(pField == &aSymbolWidthMF);
1860 bLastWidthModified = bWidth;
1861 BOOL bRatio = aSymbolRatioCB.IsChecked();
1862 long nWidthVal = static_cast<long>(aSymbolWidthMF.Denormalize(aSymbolWidthMF.GetValue(FUNIT_100TH_MM)));
1863 long nHeightVal= static_cast<long>(aSymbolHeightMF.Denormalize(aSymbolHeightMF.GetValue(FUNIT_100TH_MM)));
1864 nWidthVal = OutputDevice::LogicToLogic(nWidthVal,MAP_100TH_MM,(MapUnit)ePoolUnit );
1865 nHeightVal = OutputDevice::LogicToLogic(nHeightVal,MAP_100TH_MM,(MapUnit)ePoolUnit);
1866 aSymbolSize=Size(nWidthVal,nHeightVal);
1867 double fSizeRatio = (double)1;
1869 if(bRatio)
1871 if (aSymbolLastSize.Height() && aSymbolLastSize.Width())
1872 fSizeRatio = (double)aSymbolLastSize.Width() / aSymbolLastSize.Height();
1875 //Size aSymbolSize(aSymbolLastSize);
1877 if(bWidth)
1879 long nDelta = nWidthVal - aSymbolLastSize.Width();
1880 aSymbolSize.Width() = nWidthVal;
1881 if (bRatio)
1883 aSymbolSize.Height() = aSymbolLastSize.Height() + (long)((double)nDelta / fSizeRatio);
1884 aSymbolSize.Height() = OutputDevice::LogicToLogic( aSymbolSize.Height(),(MapUnit)ePoolUnit, MAP_100TH_MM );
1885 aSymbolHeightMF.SetUserValue(aSymbolHeightMF.Normalize(aSymbolSize.Height()), FUNIT_100TH_MM);
1888 else
1890 long nDelta = nHeightVal - aSymbolLastSize.Height();
1891 aSymbolSize.Height() = nHeightVal;
1892 if (bRatio)
1894 aSymbolSize.Width() = aSymbolLastSize.Width() + (long)((double)nDelta * fSizeRatio);
1895 aSymbolSize.Width() = OutputDevice::LogicToLogic( aSymbolSize.Width(),
1896 (MapUnit)ePoolUnit, MAP_100TH_MM );
1897 aSymbolWidthMF.SetUserValue(aSymbolWidthMF.Normalize(aSymbolSize.Width()), FUNIT_100TH_MM);
1900 aCtlPreview.ResizeSymbol(aSymbolSize);
1901 aSymbolLastSize=aSymbolSize;
1902 return 0;
1904 IMPL_LINK( SvxLineTabPage, RatioHdl_Impl, CheckBox *, pBox )
1906 if (pBox->IsChecked())
1908 if (bLastWidthModified)
1909 SizeHdl_Impl(&aSymbolWidthMF);
1910 else
1911 SizeHdl_Impl(&aSymbolHeightMF);
1913 return 0;
1917 void SvxLineTabPage::DataChanged( const DataChangedEvent& rDCEvt )
1919 SvxTabPage::DataChanged( rDCEvt );
1921 if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
1923 FillListboxes();
1927 void SvxLineTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
1929 SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False);
1930 SFX_ITEMSET_ARG (&aSet,pDashListItem,SvxDashListItem,SID_DASH_LIST,sal_False);
1931 SFX_ITEMSET_ARG (&aSet,pLineEndListItem,SvxLineEndListItem,SID_LINEEND_LIST,sal_False);
1932 SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
1933 SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False);
1934 SFX_ITEMSET_ARG (&aSet,pSdrObjListItem,OfaPtrItem,SID_OBJECT_LIST,sal_False);
1935 SFX_ITEMSET_ARG (&aSet,pSymbolAttrItem,SfxTabDialogItem,SID_ATTR_SET,sal_False);
1936 SFX_ITEMSET_ARG (&aSet,pGraphicItem,SvxGraphicItem,SID_GRAPHIC,sal_False);
1938 if (pColorTabItem)
1939 SetColorTable(pColorTabItem->GetColorTable());
1940 if (pDashListItem)
1941 SetDashList(pDashListItem->GetDashList());
1942 if (pLineEndListItem)
1943 SetLineEndList(pLineEndListItem->GetLineEndList());
1944 if (pPageTypeItem)
1945 SetPageType(pPageTypeItem->GetValue());
1946 if (pDlgTypeItem)
1947 SetDlgType(pDlgTypeItem->GetValue());
1948 Construct();
1950 if(pSdrObjListItem) //symbols
1952 ShowSymbolControls(TRUE);
1953 pSymbolList = static_cast<SdrObjList*>(pSdrObjListItem->GetValue());
1954 if (pSymbolAttrItem)
1955 pSymbolAttr = new SfxItemSet(pSymbolAttrItem->GetItemSet());
1956 if(pGraphicItem)
1957 aAutoSymbolGraphic = pGraphicItem->GetGraphic();