masterfix DEV300: #i10000# build fix
[LibreOffice.git] / cui / source / tabpages / tpline.cxx
blob7c4eea588c86a737fb9b94aaab1a072fae59391c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_cui.hxx"
31 // include ---------------------------------------------------------------
33 #ifndef _SVX_SIZEITEM_HXX //autogen
35 #include <editeng/sizeitem.hxx>
36 #endif
37 #include <tools/shl.hxx>
38 #include <tools/urlobj.hxx>
39 #include <sfx2/app.hxx>
40 #include <sfx2/module.hxx>
42 #define _SVX_TPLINE_CXX
44 #include <cuires.hrc>
45 #include "tabline.hrc"
46 #include "svx/xattr.hxx"
47 #include <svx/xpool.hxx>
48 #include <svx/xtable.hxx>
49 #include "svx/drawitem.hxx"
50 #include "cuitabline.hxx"
51 #include "dlgname.hxx"
52 #include <dialmgr.hxx>
53 #include "svx/dlgutil.hxx"
54 #include <svx/svdmodel.hxx>
55 #include "svx/svxgrahicitem.hxx"
56 //#include "linectrl.hrc"
57 #include <sfx2/request.hxx>
58 #include "svx/ofaitem.hxx"
59 #include <svx/svdobj.hxx>
60 #include <svx/svdview.hxx>
61 #include <svx/svdmodel.hxx>
62 #include <svx/numvset.hxx>
63 #include <vcl/msgbox.hxx>
64 #include <editeng/numitem.hxx>
65 #include <editeng/svxenum.hxx>
66 #include <sfx2/objsh.hxx>
67 #include <editeng/brshitem.hxx>
68 #include <svx/gallery.hxx>
69 #include <svx/xbitmap.hxx>
70 #include <unotools/localfilehelper.hxx>
71 #include "paragrph.hrc"
72 #include "sfx2/opengrf.hxx"
73 #include <svx/dialmgr.hxx>
74 #include <svx/dialogs.hrc>
76 #define MAX_BMP_WIDTH 16
77 #define MAX_BMP_HEIGHT 16
78 // define ----------------------------------------------------------------
80 #define DLGWIN this->GetParent()->GetParent()
82 #define BITMAP_WIDTH 32
83 #define BITMAP_HEIGHT 12
84 #define XOUT_WIDTH 150
86 // static ----------------------------------------------------------------
88 static sal_uInt16 pLineRanges[] =
90 XATTR_LINETRANSPARENCE,
91 XATTR_LINETRANSPARENCE,
92 SID_ATTR_LINE_STYLE,
93 SID_ATTR_LINE_ENDCENTER,
97 /*************************************************************************
99 |* Dialog zum Aendern der Linien
101 \************************************************************************/
103 SvxLineTabPage::SvxLineTabPage
105 Window* pParent,
106 const SfxItemSet& rInAttrs
108 SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_LINE ), rInAttrs ),
109 aFlLine ( this, CUI_RES( FL_LINE ) ),
110 aFtLineStyle ( this, CUI_RES( FT_LINE_STYLE ) ),
111 aLbLineStyle ( this, CUI_RES( LB_LINE_STYLE ) ),
112 aFtColor ( this, CUI_RES( FT_COLOR ) ),
113 aLbColor ( this, CUI_RES( LB_COLOR ) ),
114 aFtLineWidth ( this, CUI_RES( FT_LINE_WIDTH ) ),
115 aMtrLineWidth ( this, CUI_RES( MTR_FLD_LINE_WIDTH ) ),
116 aFtTransparent ( this, CUI_RES( FT_TRANSPARENT ) ),
117 aMtrTransparent ( this, CUI_RES( MTR_LINE_TRANSPARENT ) ),
118 aFlLineEnds ( this, CUI_RES( FL_LINE_ENDS ) ),
119 aLbStartStyle ( this, CUI_RES( LB_START_STYLE ) ),
120 aMtrStartWidth ( this, CUI_RES( MTR_FLD_START_WIDTH ) ),
121 aTsbCenterStart ( this, CUI_RES( TSB_CENTER_START ) ),
122 aFtLineEndsStyle ( this, CUI_RES( FT_LINE_ENDS_STYLE ) ),
123 aLbEndStyle ( this, CUI_RES( LB_END_STYLE ) ),
124 aFtLineEndsWidth ( this, CUI_RES( FT_LINE_ENDS_WIDTH ) ),
125 aMtrEndWidth ( this, CUI_RES( MTR_FLD_END_WIDTH ) ),
126 aTsbCenterEnd ( this, CUI_RES( TSB_CENTER_END ) ),
127 aCbxSynchronize ( this, CUI_RES( CBX_SYNCHRONIZE ) ),
128 aFLSeparator ( this, CUI_RES( FL_SEPARATOR ) ),
129 aCtlPreview ( this, CUI_RES( CTL_PREVIEW ) ),
131 // #116827#
132 maFLEdgeStyle ( this, CUI_RES( FL_EDGE_STYLE ) ),
133 maFTEdgeStyle ( this, CUI_RES( FT_EDGE_STYLE ) ),
134 maLBEdgeStyle ( this, CUI_RES( LB_EDGE_STYLE ) ),
136 pSymbolList(NULL),
137 bNewSize(false),
138 nNumMenuGalleryItems(0),
139 nSymbolType(SVX_SYMBOLTYPE_UNKNOWN), //unbekannt bzw. unchanged
140 pSymbolAttr(NULL),
141 //#58425# Symbole auf einer Linie (z.B. StarChart)
142 aFlSymbol ( this, CUI_RES(FL_SYMBOL_FORMAT)),
143 aSymbolMB ( this, CUI_RES(MB_SYMBOL_BITMAP)),
144 aSymbolWidthFT ( this, CUI_RES(FT_SYMBOL_WIDTH)),
145 aSymbolWidthMF ( this, CUI_RES(MF_SYMBOL_WIDTH)),
146 aSymbolHeightFT ( this, CUI_RES(FT_SYMBOL_HEIGHT)),
147 aSymbolHeightMF ( this, CUI_RES(MF_SYMBOL_HEIGHT)),
148 aSymbolRatioCB ( this, CUI_RES(CB_SYMBOL_RATIO)),
150 bLastWidthModified(sal_False),
151 aSymbolLastSize(Size(0,0)),
152 bSymbols(sal_False),
154 rOutAttrs ( rInAttrs ),
155 bObjSelected( sal_False ),
157 pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ),
158 aXLStyle ( XLINE_DASH ),
159 aXWidth ( 1 ),
160 aXDash ( String(), XDash( XDASH_RECT, 3, 7, 2, 40, 15 ) ),
161 aXColor ( String(), COL_LIGHTRED ),
162 aXLineAttr ( pXPool ),
163 rXLSet ( aXLineAttr.GetItemSet() ),
164 pnLineEndListState( 0 ),
165 pnDashListState( 0 ),
166 pnColorTableState( 0 ),
167 nPageType ( 0 )//CHINA001 pPageType ( NULL ),
169 aLbEndStyle.SetAccessibleName(String(CUI_RES(STR_STYLE)));
170 aLbStartStyle.SetAccessibleName(String(CUI_RES( STR_LB_START_STYLE ) ) );
171 aMtrStartWidth.SetAccessibleName(String(CUI_RES( STR_MTR_FLD_START_WIDTH ) ) );
172 aLbEndStyle.SetAccessibleName(String(CUI_RES( STR_LB_END_STYLE ) ) );
173 aMtrEndWidth.SetAccessibleName(String(CUI_RES( STR_MTR_FLD_END_WIDTH ) ) );
174 aTsbCenterStart.SetAccessibleName(String(CUI_RES( STR_CENTER_START ) ) );
175 aTsbCenterEnd.SetAccessibleName(String(CUI_RES( STR_CENTER_END ) ) );
177 FreeResource();
179 aCtlPreview.SetAccessibleName(String(CUI_RES(STR_EXAMPLE)));
181 // diese Page braucht ExchangeSupport
182 SetExchangeSupport();
184 // Metrik einstellen
185 FieldUnit eFUnit = GetModuleFieldUnit( rInAttrs );
187 switch ( eFUnit )
189 case FUNIT_M:
190 case FUNIT_KM:
191 eFUnit = FUNIT_MM;
192 // no break -> we now have mm
193 case FUNIT_MM:
194 aMtrLineWidth.SetSpinSize( 50 );
195 aMtrStartWidth.SetSpinSize( 50 );
196 aMtrEndWidth.SetSpinSize( 50 );
197 break;
199 case FUNIT_INCH:
200 aMtrLineWidth.SetSpinSize( 2 );
201 aMtrStartWidth.SetSpinSize( 2 );
202 aMtrEndWidth.SetSpinSize( 2 );
203 break;
204 default: ;//prevent warning
206 SetFieldUnit( aMtrLineWidth, eFUnit );
207 SetFieldUnit( aMtrStartWidth, eFUnit );
208 SetFieldUnit( aMtrEndWidth, eFUnit );
210 // PoolUnit ermitteln
211 SfxItemPool* pPool = rOutAttrs.GetPool();
212 DBG_ASSERT( pPool, "Wo ist der Pool?" );
213 ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH );
215 aLbLineStyle.SetSelectHdl(
216 LINK( this, SvxLineTabPage, ClickInvisibleHdl_Impl ) );
217 aLbColor.SetSelectHdl(
218 LINK( this, SvxLineTabPage, ChangePreviewHdl_Impl ) );
219 aMtrLineWidth.SetModifyHdl(
220 LINK( this, SvxLineTabPage, ChangePreviewHdl_Impl ) );
221 aMtrTransparent.SetModifyHdl(
222 LINK( this, SvxLineTabPage, ChangeTransparentHdl_Impl ) );
224 Link aStart = LINK( this, SvxLineTabPage, ChangeStartHdl_Impl );
225 Link aEnd = LINK( this, SvxLineTabPage, ChangeEndHdl_Impl );
226 aLbStartStyle.SetSelectHdl( aStart );
227 aLbEndStyle.SetSelectHdl( aEnd );
228 aMtrStartWidth.SetModifyHdl( aStart );
229 aMtrEndWidth.SetModifyHdl( aEnd );
230 aTsbCenterStart.SetClickHdl( aStart );
231 aTsbCenterEnd.SetClickHdl( aEnd );
233 pColorTab = NULL;
234 pDashList = NULL;
235 pLineEndList = NULL;
237 // #116827#
238 Link aEdgeStyle = LINK( this, SvxLineTabPage, ChangeEdgeStyleHdl_Impl );
239 maLBEdgeStyle.SetSelectHdl( aEdgeStyle );
241 //#58425# Symbole auf einer Linie (z.B. StarChart) , MB-Handler setzen
242 aSymbolMB.SetSelectHdl(LINK(this, SvxLineTabPage, GraphicHdl_Impl));
243 aSymbolMB.SetActivateHdl(LINK(this, SvxLineTabPage, MenuCreateHdl_Impl));
244 aSymbolWidthMF.SetModifyHdl(LINK(this, SvxLineTabPage, SizeHdl_Impl));
245 aSymbolHeightMF.SetModifyHdl(LINK(this, SvxLineTabPage, SizeHdl_Impl));
246 aSymbolRatioCB.SetClickHdl(LINK(this, SvxLineTabPage, RatioHdl_Impl));
248 aSymbolRatioCB.Check(sal_True);
249 ShowSymbolControls(sal_False);
251 // #63083#
252 nActLineWidth = -1;
254 //#58425# Symbole auf einer Linie (z.B. StarChart) , Symbol-Controls aktivieren
255 void SvxLineTabPage::ShowSymbolControls(sal_Bool bOn)
257 bSymbols=bOn;
258 aSymbolWidthFT.Show(bOn);
259 aSymbolWidthMF.Show(bOn);
260 aSymbolHeightFT.Show(bOn);
261 aSymbolHeightMF.Show(bOn);
262 aFlSymbol.Show(bOn);
263 aSymbolRatioCB.Show(bOn);
264 aSymbolMB.Show(bOn);
265 aCtlPreview.ShowSymbol(bOn);
267 // -----------------------------------------------------------------------
268 //#58425# Symbole auf einer Linie (z.B. StarChart) , dtor neu!
269 SvxLineTabPage::~SvxLineTabPage()
271 delete aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
273 if(pSymbolList)
274 delete aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_SYMBOLS );
276 String* pStr = (String*)aGrfNames.First();
277 while( pStr )
279 delete pStr;
280 pStr = (String*)aGrfNames.Next();
282 SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)aGrfBrushItems.First();
283 while( pInfo )
285 delete pInfo->pBrushItem;
286 delete pInfo;
287 pInfo = (SvxBmpItemInfo*)aGrfBrushItems.Next();
290 void SvxLineTabPage::Construct()
292 // Farbtabelle
293 aLbColor.Fill( pColorTab );
294 FillListboxes();
297 void SvxLineTabPage::FillListboxes()
299 // Linienstile
300 sal_uInt16 nOldSelect = aLbLineStyle.GetSelectEntryPos();
301 aLbLineStyle.FillStyles();
302 aLbLineStyle.Fill( pDashList );
303 aLbLineStyle.SelectEntryPos( nOldSelect );
305 // LinienEndenStile
306 String sNone( SVX_RES( RID_SVXSTR_NONE ) );
307 nOldSelect = aLbStartStyle.GetSelectEntryPos();
308 aLbStartStyle.Clear();
309 aLbStartStyle.InsertEntry( sNone );
310 aLbStartStyle.Fill( pLineEndList );
311 aLbStartStyle.SelectEntryPos( nOldSelect );
312 nOldSelect = aLbEndStyle.GetSelectEntryPos();
313 aLbEndStyle.Clear();
314 aLbEndStyle.InsertEntry( sNone );
315 aLbEndStyle.Fill( pLineEndList, sal_False );
316 aLbEndStyle.SelectEntryPos( nOldSelect );
319 // -----------------------------------------------------------------------
321 void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet )
323 SFX_ITEMSET_ARG (&rSet,pPageTypeItem,CntUInt16Item,SID_PAGE_TYPE,sal_False); //add CHINA001 begin
324 if (pPageTypeItem)
325 SetPageType(pPageTypeItem->GetValue()); //add CHINA001 end
326 if( nDlgType == 0 && pDashList ) //CHINA001 if( *pDlgType == 0 && pDashList ) // Linien-Dialog
328 sal_uInt16 nPos;
329 sal_uInt16 nCount;
331 // Dashliste
332 if( ( *pnDashListState & CT_MODIFIED ) ||
333 ( *pnDashListState & CT_CHANGED ) )
335 if( *pnDashListState & CT_CHANGED )
336 pDashList = ( (SvxLineTabDialog*) DLGWIN )->
337 GetNewDashList();
338 *pnDashListState = CT_NONE;
340 // Styleliste
341 nPos = aLbLineStyle.GetSelectEntryPos();
343 aLbLineStyle.Clear();
344 aLbLineStyle.InsertEntry(
345 SVX_RESSTR( RID_SVXSTR_INVISIBLE ) );
346 aLbLineStyle.InsertEntry(
347 SVX_RESSTR( RID_SVXSTR_SOLID ) );
348 aLbLineStyle.Fill( pDashList );
349 nCount = aLbLineStyle.GetEntryCount();
351 if ( nCount == 0 )
352 ; // Dieser Fall sollte nicht auftreten
353 else if( nCount <= nPos )
354 aLbLineStyle.SelectEntryPos( 0 );
355 else
356 aLbLineStyle.SelectEntryPos( nPos );
357 // SelectStyleHdl_Impl( this );
360 INetURLObject aDashURL( pDashList->GetPath() );
362 aDashURL.Append( pDashList->GetName() );
363 DBG_ASSERT( aDashURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
364 /* // Ermitteln (evtl. abschneiden) des Namens und in
365 // der GroupBox darstellen
366 String aString( ResId( RID_SVXSTR_TABLE, pMgr ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
368 if ( aDashURL.getBase().Len() > 18 )
370 aString += aDashURL.getBase().Copy( 0, 15 );
371 aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
373 else
374 aString += aDashURL.getBase();
376 aGrpLine.SetText( aString );
378 // LineEndliste
379 if( ( *pnLineEndListState & CT_MODIFIED ) ||
380 ( *pnLineEndListState & CT_CHANGED ) )
382 if( *pnLineEndListState & CT_CHANGED )
383 pLineEndList = ( (SvxLineTabDialog*) DLGWIN )->
384 GetNewLineEndList();
385 *pnLineEndListState = CT_NONE;
387 nPos = aLbLineStyle.GetSelectEntryPos();
388 String sNone( SVX_RES( RID_SVXSTR_NONE ) );
389 aLbStartStyle.Clear();
390 aLbStartStyle.InsertEntry( sNone );
392 aLbStartStyle.Fill( pLineEndList );
393 nCount = aLbStartStyle.GetEntryCount();
394 if( nCount == 0 )
395 ; // Dieser Fall sollte nicht auftreten
396 else if( nCount <= nPos )
397 aLbStartStyle.SelectEntryPos( 0 );
398 else
399 aLbStartStyle.SelectEntryPos( nPos );
401 aLbEndStyle.Clear();
402 aLbEndStyle.InsertEntry( sNone );
404 aLbEndStyle.Fill( pLineEndList, sal_False );
405 nCount = aLbEndStyle.GetEntryCount();
407 if( nCount == 0 )
408 ; // Dieser Fall sollte nicht auftreten
409 else if( nCount <= nPos )
410 aLbEndStyle.SelectEntryPos( 0 );
411 else
412 aLbEndStyle.SelectEntryPos( nPos );
414 INetURLObject aLineURL( pLineEndList->GetPath() );
416 aLineURL.Append( pLineEndList->GetName() );
417 DBG_ASSERT( aLineURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
418 /* // Ermitteln (evtl. abschneiden) des Namens und in
419 // der GroupBox darstellen
420 aString = String( ResId( RID_SVXSTR_TABLE, pMgr ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
422 if ( aLineURL.getBase().Len() > 18 )
424 aString += aLineURL.getBase().Copy( 0, 15 );
425 aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
427 else
428 aString += aLineURL.getBase();
430 aGrpLineEnds.SetText( aString );
432 // Auswertung, ob von einer anderen TabPage ein anderer Fuelltyp gesetzt wurde
433 if( aLbLineStyle.GetSelectEntryPos() != 0 )
435 if( nPageType == 2 ) // 1//CHINA001 if( *pPageType == 2 ) // 1
437 aLbLineStyle.SelectEntryPos( *pPosDashLb + 2 ); // +2 wegen SOLID und INVLISIBLE
438 ChangePreviewHdl_Impl( this );
440 if( nPageType == 3 )//CHINA001 if( *pPageType == 3 )
442 aLbStartStyle.SelectEntryPos( *pPosLineEndLb + 1 );// +1 wegen SOLID
443 aLbEndStyle.SelectEntryPos( *pPosLineEndLb + 1 );// +1 wegen SOLID
444 ChangePreviewHdl_Impl( this );
448 // ColorTable
449 if( *pnColorTableState )
451 if( *pnColorTableState & CT_CHANGED )
452 pColorTab = ( (SvxLineTabDialog*) DLGWIN )->
453 GetNewColorTable();
454 // aLbColor
455 sal_uInt16 nColorPos = aLbColor.GetSelectEntryPos();
456 aLbColor.Clear();
457 aLbColor.Fill( pColorTab );
458 nCount = aLbColor.GetEntryCount();
459 if( nCount == 0 )
460 ; // This case should never occur
461 else if( nCount <= nColorPos )
462 aLbColor.SelectEntryPos( 0 );
463 else
464 aLbColor.SelectEntryPos( nColorPos );
466 ChangePreviewHdl_Impl( this );
469 nPageType = 0;//CHINA001 *pPageType = 0;
471 // Seite existiert im Ctor noch nicht, deswegen hier!
473 else if ( nDlgType == 1100 || // Chart-Dialog//CHINA001 else if ( *pDlgType == 1100 || // Chart-Dialog
474 nDlgType == 1101 )//CHINA001 *pDlgType == 1101 )
476 aFtLineEndsStyle.Hide();
477 aFtLineEndsWidth.Hide();
478 aLbStartStyle.Hide();
479 aMtrStartWidth.Hide();
480 aTsbCenterStart.Hide();
481 aLbEndStyle.Hide();
482 aMtrEndWidth.Hide();
483 aTsbCenterEnd.Hide();
484 aCbxSynchronize.Hide();
485 aFlLineEnds.Hide();
487 // #116827#
488 maFLEdgeStyle.Hide();
489 maFTEdgeStyle.Hide();
490 maLBEdgeStyle.Hide();
494 // -----------------------------------------------------------------------
496 int SvxLineTabPage::DeactivatePage( SfxItemSet* _pSet )
498 if( nDlgType == 0 ) // Linien-Dialog//CHINA001 if( *pDlgType == 0 ) // Linien-Dialog
500 nPageType = 1; // evtl. fuer Erweiterungen//CHINA001 *pPageType = 1; // evtl. fuer Erweiterungen
501 *pPosDashLb = aLbLineStyle.GetSelectEntryPos() - 2;// erster Eintrag SOLID !!!
502 sal_uInt16 nPos = aLbStartStyle.GetSelectEntryPos();
503 if( nPos != LISTBOX_ENTRY_NOTFOUND )
504 nPos--;
505 *pPosLineEndLb = nPos;
508 if( _pSet )
509 FillItemSet( *_pSet );
511 return( LEAVE_PAGE );
514 // -----------------------------------------------------------------------
516 sal_Bool SvxLineTabPage::FillItemSet( SfxItemSet& rAttrs )
518 const SfxPoolItem* pOld = NULL;
519 sal_uInt16 nPos;
520 sal_Bool bModified = sal_False;
522 // Um evtl. Modifikationen der Liste vorzubeugen
523 // werden Items anderer Seiten nicht gesetzt
524 if( nDlgType != 0 || nPageType != 2 )//CHINA001 if( *pDlgType != 0 || *pPageType != 2 )
526 nPos = aLbLineStyle.GetSelectEntryPos();
527 if( nPos != LISTBOX_ENTRY_NOTFOUND &&
528 nPos != aLbLineStyle.GetSavedValue() )
530 XLineStyleItem* pStyleItem = NULL;
532 if( nPos == 0 )
533 pStyleItem = new XLineStyleItem( XLINE_NONE );
534 else if( nPos == 1 )
535 pStyleItem = new XLineStyleItem( XLINE_SOLID );
536 else
538 pStyleItem = new XLineStyleItem( XLINE_DASH );
540 // Zusaetzliche Sicherheit
541 if( pDashList->Count() > (long) ( nPos - 2 ) )
543 XLineDashItem aDashItem( aLbLineStyle.GetSelectEntry(),
544 pDashList->GetDash( nPos - 2 )->GetDash() );
545 pOld = GetOldItem( rAttrs, XATTR_LINEDASH );
546 if ( !pOld || !( *(const XLineDashItem*)pOld == aDashItem ) )
548 rAttrs.Put( aDashItem );
549 bModified = sal_True;
553 pOld = GetOldItem( rAttrs, XATTR_LINESTYLE );
554 if ( !pOld || !( *(const XLineStyleItem*)pOld == *pStyleItem ) )
556 rAttrs.Put( *pStyleItem );
557 bModified = sal_True;
559 delete pStyleItem;
562 // Linienbreite
563 // GetSavedValue() liefert String!
564 if( aMtrLineWidth.GetText() != aMtrLineWidth.GetSavedValue() )
566 XLineWidthItem aItem( GetCoreValue( aMtrLineWidth, ePoolUnit ) );
567 pOld = GetOldItem( rAttrs, XATTR_LINEWIDTH );
568 if ( !pOld || !( *(const XLineWidthItem*)pOld == aItem ) )
570 rAttrs.Put( aItem );
571 bModified = sal_True;
574 //Breite Linienanfang
575 if( aMtrStartWidth.GetText() != aMtrStartWidth.GetSavedValue() )
577 XLineStartWidthItem aItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) );
578 pOld = GetOldItem( rAttrs, XATTR_LINESTARTWIDTH );
579 if ( !pOld || !( *(const XLineStartWidthItem*)pOld == aItem ) )
581 rAttrs.Put( aItem );
582 bModified = sal_True;
585 //Breite Linienende
586 if( aMtrEndWidth.GetText() != aMtrEndWidth.GetSavedValue() )
588 XLineEndWidthItem aItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) );
589 pOld = GetOldItem( rAttrs, XATTR_LINEENDWIDTH );
590 if ( !pOld || !( *(const XLineEndWidthItem*)pOld == aItem ) )
592 rAttrs.Put( aItem );
593 bModified = sal_True;
597 // Linienfarbe
598 if( aLbColor.GetSelectEntryPos() != aLbColor.GetSavedValue() )
600 XLineColorItem aItem( aLbColor.GetSelectEntry(),
601 aLbColor.GetSelectEntryColor() );
602 pOld = GetOldItem( rAttrs, XATTR_LINECOLOR );
603 if ( !pOld || !( *(const XLineColorItem*)pOld == aItem ) )
605 rAttrs.Put( aItem );
606 bModified = sal_True;
610 if( nDlgType != 0 || nPageType != 3 )//CHINA001 if( *pDlgType != 0 || *pPageType != 3 )
612 // Linienanfang
613 nPos = aLbStartStyle.GetSelectEntryPos();
614 if( nPos != LISTBOX_ENTRY_NOTFOUND &&
615 nPos != aLbStartStyle.GetSavedValue() )
617 XLineStartItem* pItem = NULL;
618 if( nPos == 0 )
619 pItem = new XLineStartItem();
620 else if( pLineEndList->Count() > (long) ( nPos - 1 ) )
621 pItem = new XLineStartItem( aLbStartStyle.GetSelectEntry(),
622 pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() );
623 pOld = GetOldItem( rAttrs, XATTR_LINESTART );
624 if( pItem &&
625 ( !pOld || !( *(const XLineEndItem*)pOld == *pItem ) ) )
627 rAttrs.Put( *pItem );
628 bModified = sal_True;
630 delete pItem;
632 // Linienende
633 nPos = aLbEndStyle.GetSelectEntryPos();
634 if( nPos != LISTBOX_ENTRY_NOTFOUND &&
635 nPos != aLbEndStyle.GetSavedValue() )
637 XLineEndItem* pItem = NULL;
638 if( nPos == 0 )
639 pItem = new XLineEndItem();
640 else if( pLineEndList->Count() > (long) ( nPos - 1 ) )
641 pItem = new XLineEndItem( aLbEndStyle.GetSelectEntry(),
642 pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() );
643 pOld = GetOldItem( rAttrs, XATTR_LINEEND );
644 if( pItem &&
645 ( !pOld || !( *(const XLineEndItem*)pOld == *pItem ) ) )
647 rAttrs.Put( *pItem );
648 bModified = sal_True;
650 delete pItem;
654 // Linienenden zentriert
655 TriState eState = aTsbCenterStart.GetState();
656 if( eState != aTsbCenterStart.GetSavedValue() )
658 XLineStartCenterItem aItem( sal::static_int_cast< sal_Bool >( eState ) );
659 pOld = GetOldItem( rAttrs, XATTR_LINESTARTCENTER );
660 if ( !pOld || !( *(const XLineStartCenterItem*)pOld == aItem ) )
662 rAttrs.Put( aItem );
663 bModified = sal_True;
666 eState = aTsbCenterEnd.GetState();
667 if( eState != aTsbCenterEnd.GetSavedValue() )
669 XLineEndCenterItem aItem( sal::static_int_cast< sal_Bool >( eState ) );
670 pOld = GetOldItem( rAttrs, XATTR_LINEENDCENTER );
671 if ( !pOld || !( *(const XLineEndCenterItem*)pOld == aItem ) )
673 rAttrs.Put( aItem );
674 bModified = sal_True;
678 //Breite Linienanfang
679 if( aMtrStartWidth.GetText() != aMtrStartWidth.GetSavedValue() )
681 XLineStartWidthItem aItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) );
682 pOld = GetOldItem( rAttrs, XATTR_LINESTARTWIDTH );
683 if ( !pOld || !( *(const XLineStartWidthItem*)pOld == aItem ) )
685 rAttrs.Put( aItem );
686 bModified = sal_True;
689 //Breite Linienende
690 if( aMtrEndWidth.GetText() != aMtrEndWidth.GetSavedValue() )
692 XLineEndWidthItem aItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) );
693 pOld = GetOldItem( rAttrs, XATTR_LINEENDWIDTH );
694 if ( !pOld || !( *(const XLineEndWidthItem*)pOld == aItem ) )
696 rAttrs.Put( aItem );
697 bModified = sal_True;
701 // Transparenz
702 sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue();
703 if( nVal != (sal_uInt16)aMtrTransparent.GetSavedValue().ToInt32() )
705 XLineTransparenceItem aItem( nVal );
706 pOld = GetOldItem( rAttrs, XATTR_LINETRANSPARENCE );
707 if ( !pOld || !( *(const XLineTransparenceItem*)pOld == aItem ) )
709 rAttrs.Put( aItem );
710 bModified = sal_True;
714 // #116827#
715 nPos = maLBEdgeStyle.GetSelectEntryPos();
716 if( LISTBOX_ENTRY_NOTFOUND != nPos && nPos != maLBEdgeStyle.GetSavedValue() )
718 XLineJointItem* pNew = 0L;
720 switch(nPos)
722 case 0: // Rounded, default
724 pNew = new XLineJointItem(XLINEJOINT_ROUND);
725 break;
727 case 1: // - none -
729 pNew = new XLineJointItem(XLINEJOINT_NONE);
730 break;
732 case 2: // Miter
734 pNew = new XLineJointItem(XLINEJOINT_MITER);
735 break;
737 case 3: // Bevel
739 pNew = new XLineJointItem(XLINEJOINT_BEVEL);
740 break;
744 if(pNew)
746 pOld = GetOldItem( rAttrs, XATTR_LINEJOINT );
748 if(!pOld || !(*(const XLineJointItem*)pOld == *pNew))
750 rAttrs.Put( *pNew );
751 bModified = sal_True;
754 delete pNew;
758 if(nSymbolType!=SVX_SYMBOLTYPE_UNKNOWN || bNewSize)
760 //wurde also per Auswahl gesetzt oder Gr��e ist anders
761 SvxSizeItem aSItem(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),aSymbolSize);
762 const SfxPoolItem* pSOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE) );
763 bNewSize = pSOld ? *(const SvxSizeItem *)pSOld != aSItem : bNewSize ;
764 if(bNewSize)
766 rAttrs.Put(aSItem);
767 bModified=sal_True;
770 SfxInt32Item aTItem(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),nSymbolType);
771 const SfxPoolItem* pTOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE) );
772 bool bNewType = pTOld == NULL || *(const SfxInt32Item*)pTOld != aTItem;
773 if(bNewType && nSymbolType==SVX_SYMBOLTYPE_UNKNOWN)
774 bNewType=false;//kleine Korrektur, Typ wurde garnicht gesetzt -> kein Type-Item erzeugen!
775 if(bNewType)
777 rAttrs.Put(aTItem);
778 bModified=sal_True;
781 if(nSymbolType!=SVX_SYMBOLTYPE_NONE)
783 SvxBrushItem aBItem(aSymbolGraphic,GPOS_MM,rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH));
784 const SfxPoolItem* pBOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH) );
785 bool bNewBrush =
786 pBOld == NULL || *(const SvxBrushItem*)pBOld != aBItem;
787 if(bNewBrush)
789 rAttrs.Put(aBItem);
790 bModified=sal_True;
794 rAttrs.Put (CntUInt16Item(SID_PAGE_TYPE,nPageType));//add CHINA001
795 return( bModified );
798 // -----------------------------------------------------------------------
800 sal_Bool SvxLineTabPage::FillXLSet_Impl()
802 sal_uInt16 nPos;
804 if( aLbLineStyle.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND )
806 //rXLSet.Put( XLineDashItem ( rOutAttrs.Get( GetWhich( XATTR_LINEDASH ) ) ) );
807 rXLSet.Put( XLineStyleItem( XLINE_NONE ) );
809 else if( aLbLineStyle.IsEntryPosSelected( 0 ) )
810 rXLSet.Put( XLineStyleItem( XLINE_NONE ) );
811 else if( aLbLineStyle.IsEntryPosSelected( 1 ) )
812 rXLSet.Put( XLineStyleItem( XLINE_SOLID ) );
813 else
815 rXLSet.Put( XLineStyleItem( XLINE_DASH ) );
817 nPos = aLbLineStyle.GetSelectEntryPos();
818 if( nPos != LISTBOX_ENTRY_NOTFOUND )
820 rXLSet.Put( XLineDashItem( aLbLineStyle.GetSelectEntry(),
821 pDashList->GetDash( nPos - 2 )->GetDash() ) );
825 nPos = aLbStartStyle.GetSelectEntryPos();
826 if( nPos != LISTBOX_ENTRY_NOTFOUND )
828 if( nPos == 0 )
829 rXLSet.Put( XLineStartItem() );
830 else
831 rXLSet.Put( XLineStartItem( aLbStartStyle.GetSelectEntry(),
832 pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) );
834 nPos = aLbEndStyle.GetSelectEntryPos();
835 if( nPos != LISTBOX_ENTRY_NOTFOUND )
837 if( nPos == 0 )
838 rXLSet.Put( XLineEndItem() );
839 else
840 rXLSet.Put( XLineEndItem( aLbEndStyle.GetSelectEntry(),
841 pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) );
844 // #116827#
845 nPos = maLBEdgeStyle.GetSelectEntryPos();
846 if(LISTBOX_ENTRY_NOTFOUND != nPos)
848 switch(nPos)
850 case 0: // Rounded, default
852 rXLSet.Put(XLineJointItem(XLINEJOINT_ROUND));
853 break;
855 case 1: // - none -
857 rXLSet.Put(XLineJointItem(XLINEJOINT_NONE));
858 break;
860 case 2: // Miter
862 rXLSet.Put(XLineJointItem(XLINEJOINT_MITER));
863 break;
865 case 3: // Bevel
867 rXLSet.Put(XLineJointItem(XLINEJOINT_BEVEL));
868 break;
873 rXLSet.Put( XLineStartWidthItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) ) );
874 rXLSet.Put( XLineEndWidthItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) ) );
876 rXLSet.Put( XLineWidthItem( GetCoreValue( aMtrLineWidth, ePoolUnit ) ) );
877 rXLSet.Put( XLineColorItem( aLbColor.GetSelectEntry(),
878 aLbColor.GetSelectEntryColor() ) );
880 // Linienenden zentriert
881 if( aTsbCenterStart.GetState() == STATE_CHECK )
882 rXLSet.Put( XLineStartCenterItem( sal_True ) );
883 else if( aTsbCenterStart.GetState() == STATE_NOCHECK )
884 rXLSet.Put( XLineStartCenterItem( sal_False ) );
886 if( aTsbCenterEnd.GetState() == STATE_CHECK )
887 rXLSet.Put( XLineEndCenterItem( sal_True ) );
888 else if( aTsbCenterEnd.GetState() == STATE_NOCHECK )
889 rXLSet.Put( XLineEndCenterItem( sal_False ) );
891 // Transparenz
892 sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue();
893 rXLSet.Put( XLineTransparenceItem( nVal ) );
895 // #116827#
896 aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
898 return( sal_True );
901 // -----------------------------------------------------------------------
903 void SvxLineTabPage::Reset( const SfxItemSet& rAttrs )
905 String aString;
906 XLineStyle eXLS; // XLINE_NONE, XLINE_SOLID, XLINE_DASH
908 // Linienstil
910 if( bObjSelected &&
911 rAttrs.GetItemState( GetWhich( XATTR_LINESTYLE ) ) == SFX_ITEM_DEFAULT )
913 aLbLineStyle.Disable();
916 const SfxPoolItem *pPoolItem;
917 long nSymType=SVX_SYMBOLTYPE_UNKNOWN;
918 sal_Bool bPrevSym=sal_False;
919 sal_Bool bEnable=sal_True;
920 sal_Bool bIgnoreGraphic=sal_False;
921 sal_Bool bIgnoreSize=sal_False;
922 if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),sal_True,&pPoolItem) == SFX_ITEM_SET)
924 nSymType=((const SfxInt32Item *)pPoolItem)->GetValue();
927 if(nSymType == SVX_SYMBOLTYPE_AUTO)
929 aSymbolGraphic=aAutoSymbolGraphic;
930 aSymbolSize=aSymbolLastSize=aAutoSymbolGraphic.GetPrefSize();
931 bPrevSym=sal_True;
933 else if(nSymType == SVX_SYMBOLTYPE_NONE)
935 bEnable=sal_False;
936 bIgnoreGraphic=sal_True;
937 bIgnoreSize=sal_True;
939 else if(nSymType >= 0)
941 VirtualDevice aVDev;
942 aVDev.SetMapMode(MapMode(MAP_100TH_MM));
944 SdrModel* pModel = new SdrModel(NULL, NULL, LOADREFCOUNTS);
945 pModel->GetItemPool().FreezeIdRanges();
946 SdrPage* pPage = new SdrPage( *pModel, sal_False );
947 pPage->SetSize(Size(1000,1000));
948 pModel->InsertPage( pPage, 0 );
949 SdrView* pView = new SdrView( pModel, &aVDev );
950 pView->hideMarkHandles();
951 SdrPageView* pPageView = pView->ShowSdrPage(pPage);
952 // SdrPageView* pPageView = pView->ShowSdrPage(pPage, Point());
953 SdrObject *pObj=NULL;
954 long nSymTmp=nSymType;
955 if(pSymbolList)
957 if(pSymbolList->GetObjCount())
959 nSymTmp=nSymTmp%pSymbolList->GetObjCount(); //Liste wird als cyclisch betrachtet!!!
960 pObj=pSymbolList->GetObj(nSymTmp);
961 if(pObj)
963 pObj=pObj->Clone();
964 pPage->NbcInsertObject(pObj);
965 pView->MarkObj(pObj,pPageView);
966 if(pSymbolAttr)
968 pObj->SetMergedItemSet(*pSymbolAttr);
970 else
972 pObj->SetMergedItemSet(rOutAttrs);
974 GDIMetaFile aMeta(pView->GetAllMarkedMetaFile());
976 aSymbolGraphic=Graphic(aMeta);
977 aSymbolSize=pObj->GetSnapRect().GetSize();
978 aSymbolGraphic.SetPrefSize(aSymbolSize);
979 aSymbolGraphic.SetPrefMapMode(MAP_100TH_MM);
980 bPrevSym=sal_True;
981 bEnable=sal_True;
982 bIgnoreGraphic=sal_True;
984 pView->UnmarkAll();
985 pObj=pPage->RemoveObject(0);
986 SdrObject::Free( pObj );
990 delete pView;
991 delete pModel;
993 if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH),sal_True,&pPoolItem) == SFX_ITEM_SET)
995 const Graphic* pGraphic = ((const SvxBrushItem *)pPoolItem)->GetGraphic();
996 if( pGraphic )
998 if(!bIgnoreGraphic)
1000 aSymbolGraphic=*pGraphic;
1002 if(!bIgnoreSize)
1004 aSymbolSize=OutputDevice::LogicToLogic( pGraphic->GetPrefSize(),
1005 pGraphic->GetPrefMapMode(),
1006 MAP_100TH_MM );
1008 bPrevSym=sal_True;
1011 if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),sal_True,&pPoolItem) == SFX_ITEM_SET)
1013 aSymbolSize = ((const SvxSizeItem *)pPoolItem)->GetSize();
1017 aSymbolRatioCB.Enable(bEnable);
1018 aSymbolHeightFT.Enable(bEnable);
1019 aSymbolWidthFT.Enable(bEnable);
1020 aSymbolWidthMF.Enable(bEnable);
1021 aSymbolHeightMF.Enable(bEnable);
1022 if(bPrevSym)
1024 SetMetricValue(aSymbolWidthMF, aSymbolSize.Width(), ePoolUnit);
1025 SetMetricValue(aSymbolHeightMF, aSymbolSize.Height(),ePoolUnit);
1026 aCtlPreview.SetSymbol(&aSymbolGraphic,aSymbolSize);
1027 aSymbolLastSize=aSymbolSize;
1030 if( rAttrs.GetItemState( XATTR_LINESTYLE ) != SFX_ITEM_DONTCARE )
1032 eXLS = (XLineStyle) ( ( const XLineStyleItem& ) rAttrs.Get( XATTR_LINESTYLE ) ).GetValue();
1034 switch( eXLS )
1036 case XLINE_NONE:
1037 aLbLineStyle.SelectEntryPos( 0 );
1038 break;
1039 case XLINE_SOLID:
1040 aLbLineStyle.SelectEntryPos( 1 );
1041 break;
1043 case XLINE_DASH:
1044 aLbLineStyle.SetNoSelection();
1045 aLbLineStyle.SelectEntry( ( ( const XLineDashItem& ) rAttrs.
1046 Get( XATTR_LINEDASH ) ).GetName() );
1047 break;
1049 default:
1050 break;
1053 else
1055 aLbLineStyle.SetNoSelection();
1058 // Linienstaerke
1060 if( bObjSelected &&
1061 rAttrs.GetItemState( GetWhich( XATTR_LINEWIDTH ) ) == SFX_ITEM_DEFAULT )
1063 aMtrLineWidth.Disable();
1066 if( rAttrs.GetItemState( XATTR_LINEWIDTH ) != SFX_ITEM_DONTCARE )
1068 SetMetricValue( aMtrLineWidth, ( ( const XLineWidthItem& ) rAttrs.
1069 Get( XATTR_LINEWIDTH ) ).GetValue(), ePoolUnit );
1071 else
1072 aMtrLineWidth.SetText( String() );
1074 // Linienfarbe
1076 if( bObjSelected &&
1077 rAttrs.GetItemState( GetWhich( XATTR_LINECOLOR ) ) == SFX_ITEM_DEFAULT )
1079 aLbColor.Disable();
1082 aLbColor.SetNoSelection();
1084 if ( rAttrs.GetItemState( XATTR_LINECOLOR ) != SFX_ITEM_DONTCARE )
1086 Color aCol = ( ( const XLineColorItem& ) rAttrs.Get( XATTR_LINECOLOR ) ).GetColorValue();
1087 aLbColor.SelectEntry( aCol );
1088 if( aLbColor.GetSelectEntryCount() == 0 )
1090 aLbColor.InsertEntry( aCol, String() );
1091 aLbColor.SelectEntry( aCol );
1095 // LinienAnfang
1096 if( bObjSelected &&
1097 rAttrs.GetItemState( XATTR_LINESTART ) == SFX_ITEM_DEFAULT )
1099 aLbStartStyle.Disable();
1101 else if( rAttrs.GetItemState( XATTR_LINESTART ) != SFX_ITEM_DONTCARE )
1103 // #86265# select entry using list and polygon, not string
1104 sal_Bool bSelected(sal_False);
1105 const basegfx::B2DPolyPolygon& rItemPolygon = ((const XLineStartItem&)rAttrs.Get(XATTR_LINESTART)).GetLineStartValue();
1107 for(sal_Int32 a(0);!bSelected && a < pLineEndList->Count(); a++)
1109 XLineEndEntry* pEntry = pLineEndList->GetLineEnd(a);
1110 const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
1112 if(rItemPolygon == rEntryPolygon)
1114 // select this entry
1115 aLbStartStyle.SelectEntryPos((sal_uInt16)a + 1);
1116 bSelected = sal_True;
1120 if(!bSelected)
1121 aLbStartStyle.SelectEntryPos( 0 );
1123 else
1125 aLbStartStyle.SetNoSelection();
1128 // LinienEnde
1129 if( bObjSelected &&
1130 rAttrs.GetItemState( XATTR_LINEEND ) == SFX_ITEM_DEFAULT )
1132 aLbEndStyle.Disable();
1134 else if( rAttrs.GetItemState( XATTR_LINEEND ) != SFX_ITEM_DONTCARE )
1136 // #86265# select entry using list and polygon, not string
1137 sal_Bool bSelected(sal_False);
1138 const basegfx::B2DPolyPolygon& rItemPolygon = ((const XLineEndItem&)rAttrs.Get(XATTR_LINEEND)).GetLineEndValue();
1140 for(sal_Int32 a(0);!bSelected && a < pLineEndList->Count(); a++)
1142 XLineEndEntry* pEntry = pLineEndList->GetLineEnd(a);
1143 const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
1145 if(rItemPolygon == rEntryPolygon)
1147 // select this entry
1148 aLbEndStyle.SelectEntryPos((sal_uInt16)a + 1);
1149 bSelected = sal_True;
1153 if(!bSelected)
1154 aLbEndStyle.SelectEntryPos( 0 );
1156 else
1158 aLbEndStyle.SetNoSelection();
1161 // LinienAnfang St"arke
1162 if( bObjSelected &&
1163 rAttrs.GetItemState( XATTR_LINESTARTWIDTH ) == SFX_ITEM_DEFAULT )
1165 aMtrStartWidth.Disable();
1167 else if( rAttrs.GetItemState( XATTR_LINESTARTWIDTH ) != SFX_ITEM_DONTCARE )
1169 SetMetricValue( aMtrStartWidth, ( ( const XLineStartWidthItem& ) rAttrs.
1170 Get( XATTR_LINESTARTWIDTH ) ).GetValue(), ePoolUnit );
1172 else
1173 aMtrStartWidth.SetText( String() );
1175 // LinienEnde St"arke
1176 if( bObjSelected &&
1177 rAttrs.GetItemState( XATTR_LINEENDWIDTH ) == SFX_ITEM_DEFAULT )
1179 aMtrEndWidth.Disable();
1181 else if( rAttrs.GetItemState( XATTR_LINEENDWIDTH ) != SFX_ITEM_DONTCARE )
1183 SetMetricValue( aMtrEndWidth, ( ( const XLineEndWidthItem& ) rAttrs.
1184 Get( XATTR_LINEENDWIDTH ) ).GetValue(), ePoolUnit );
1186 else
1187 aMtrEndWidth.SetText( String() );
1189 // Linienenden zentriert (Start)
1190 if( bObjSelected &&
1191 rAttrs.GetItemState( XATTR_LINESTARTCENTER ) == SFX_ITEM_DEFAULT )
1193 aTsbCenterStart.Disable();
1195 else if( rAttrs.GetItemState( XATTR_LINESTARTCENTER ) != SFX_ITEM_DONTCARE )
1197 aTsbCenterStart.EnableTriState( sal_False );
1199 if( ( ( const XLineStartCenterItem& ) rAttrs.Get( XATTR_LINESTARTCENTER ) ).GetValue() )
1200 aTsbCenterStart.SetState( STATE_CHECK );
1201 else
1202 aTsbCenterStart.SetState( STATE_NOCHECK );
1204 else
1206 aTsbCenterStart.SetState( STATE_DONTKNOW );
1209 // Linienenden zentriert (Ende)
1210 if( bObjSelected &&
1211 rAttrs.GetItemState( XATTR_LINEENDCENTER ) == SFX_ITEM_DEFAULT )
1213 aTsbCenterEnd.Disable();
1215 else if( rAttrs.GetItemState( XATTR_LINEENDCENTER ) != SFX_ITEM_DONTCARE )
1217 aTsbCenterEnd.EnableTriState( sal_False );
1219 if( ( ( const XLineEndCenterItem& ) rAttrs.Get( XATTR_LINEENDCENTER ) ).GetValue() )
1220 aTsbCenterEnd.SetState( STATE_CHECK );
1221 else
1222 aTsbCenterEnd.SetState( STATE_NOCHECK );
1224 else
1226 aTsbCenterEnd.SetState( STATE_DONTKNOW );
1229 // Transparenz
1230 if( rAttrs.GetItemState( XATTR_LINETRANSPARENCE ) != SFX_ITEM_DONTCARE )
1232 sal_uInt16 nTransp = ( ( const XLineTransparenceItem& ) rAttrs.
1233 Get( XATTR_LINETRANSPARENCE ) ).GetValue();
1234 aMtrTransparent.SetValue( nTransp );
1235 ChangeTransparentHdl_Impl( NULL );
1237 else
1238 aMtrTransparent.SetText( String() );
1240 if( !aLbStartStyle.IsEnabled() &&
1241 !aLbEndStyle.IsEnabled() &&
1242 !aMtrStartWidth.IsEnabled() &&
1243 !aMtrEndWidth.IsEnabled() &&
1244 !aTsbCenterStart.IsEnabled()&&
1245 !aTsbCenterEnd.IsEnabled() )
1247 aCbxSynchronize.Disable();
1248 aFtLineEndsStyle.Disable();
1249 aFtLineEndsWidth.Disable();
1250 aFlLineEnds.Disable();
1253 // Synchronisieren
1254 // Jetzt wird der Wert aus der INI-Datei geholt (#42258#)
1255 String aStr = GetUserData();
1256 aCbxSynchronize.Check( (sal_Bool)aStr.ToInt32() );
1258 // #116827#
1259 if(bObjSelected && SFX_ITEM_DEFAULT == rAttrs.GetItemState(XATTR_LINEJOINT))
1261 maFTEdgeStyle.Disable();
1262 maLBEdgeStyle.Disable();
1264 else if(SFX_ITEM_DONTCARE != rAttrs.GetItemState(XATTR_LINEJOINT))
1266 XLineJoint eLineJoint = ((const XLineJointItem&)(rAttrs.Get(XATTR_LINEJOINT))).GetValue();
1268 switch(eLineJoint)
1270 case XLINEJOINT_ROUND : maLBEdgeStyle.SelectEntryPos(0); break;
1271 case XLINEJOINT_NONE : maLBEdgeStyle.SelectEntryPos(1); break;
1272 case XLINEJOINT_MITER : maLBEdgeStyle.SelectEntryPos(2); break;
1273 case XLINEJOINT_BEVEL : maLBEdgeStyle.SelectEntryPos(3); break;
1274 case XLINEJOINT_MIDDLE : break;
1277 else
1279 maLBEdgeStyle.SetNoSelection();
1283 if( aLbStartStyle.GetSelectEntryPos() == aLbEndStyle.GetSelectEntryPos() &&
1284 aMtrStartWidth.GetValue() == aMtrEndWidth.GetValue() &&
1285 aTsbCenterStart.GetState() == aTsbCenterEnd.GetState() )
1287 aCbxSynchronize.Check();
1291 // Werte sichern
1292 aLbLineStyle.SaveValue();
1293 aMtrLineWidth.SaveValue();
1294 aLbColor.SaveValue();
1295 aLbStartStyle.SaveValue();
1296 aLbEndStyle.SaveValue();
1297 aMtrStartWidth.SaveValue();
1298 aMtrEndWidth.SaveValue();
1299 aTsbCenterStart.SaveValue();
1300 aTsbCenterEnd.SaveValue();
1301 aMtrTransparent.SaveValue();
1303 // #116827#
1304 maLBEdgeStyle.SaveValue();
1306 ClickInvisibleHdl_Impl( this );
1307 //ClickMeasuringHdl_Impl( this );
1308 //aCtlPosition.Reset();
1310 ChangePreviewHdl_Impl( NULL );
1313 // -----------------------------------------------------------------------
1315 SfxTabPage* SvxLineTabPage::Create( Window* pWindow,
1316 const SfxItemSet& rAttrs )
1318 return( new SvxLineTabPage( pWindow, rAttrs ) );
1321 //------------------------------------------------------------------------
1323 sal_uInt16* SvxLineTabPage::GetRanges()
1325 return( pLineRanges );
1328 //------------------------------------------------------------------------
1330 IMPL_LINK( SvxLineTabPage, ChangePreviewHdl_Impl, void *, pCntrl )
1332 if(pCntrl == &aMtrLineWidth)
1334 // Linienbreite und Start/EndBreite
1335 sal_Int32 nNewLineWidth = GetCoreValue( aMtrLineWidth, ePoolUnit );
1336 if(nActLineWidth == -1)
1338 // Noch nicht initialisiert, hole den Startwert
1339 const SfxPoolItem* pOld = GetOldItem( rXLSet, XATTR_LINEWIDTH );
1340 sal_Int32 nStartLineWidth = 0;
1341 if(pOld)
1342 nStartLineWidth = (( const XLineWidthItem *)pOld)->GetValue();
1343 nActLineWidth = nStartLineWidth;
1346 if(nActLineWidth != nNewLineWidth)
1348 // Anpassungen Start/EndWidth #63083#
1349 sal_Int32 nValAct = GetCoreValue( aMtrStartWidth, ePoolUnit );
1350 sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
1351 if(nValNew < 0)
1352 nValNew = 0;
1353 SetMetricValue( aMtrStartWidth, nValNew, ePoolUnit );
1355 nValAct = GetCoreValue( aMtrEndWidth, ePoolUnit );
1356 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
1357 if(nValNew < 0)
1358 nValNew = 0;
1359 SetMetricValue( aMtrEndWidth, nValNew, ePoolUnit );
1362 // Aktuellen Wert merken
1363 nActLineWidth = nNewLineWidth;
1366 FillXLSet_Impl();
1367 aCtlPreview.Invalidate();
1369 // Transparenz entspr. zugaenglich machen
1370 if( aLbLineStyle.GetSelectEntryPos() == 0 ) // unsichtbar
1372 aFtTransparent.Disable();
1373 aMtrTransparent.Disable();
1375 else
1377 aFtTransparent.Enable();
1378 aMtrTransparent.Enable();
1381 const bool bHasLineStart = aLbStartStyle.GetSelectEntryPos() != 0;
1382 const bool bHasLineEnd = aLbEndStyle.GetSelectEntryPos() != 0;
1384 aFtLineEndsWidth.Enable( bHasLineStart || bHasLineEnd );
1385 aMtrStartWidth.Enable( bHasLineStart );
1386 aTsbCenterStart.Enable( bHasLineStart );
1387 aMtrEndWidth.Enable( bHasLineEnd );
1388 aTsbCenterEnd.Enable( bHasLineEnd );
1390 return( 0L );
1393 //------------------------------------------------------------------------
1395 IMPL_LINK( SvxLineTabPage, ChangeStartHdl_Impl, void *, p )
1397 if( aCbxSynchronize.IsChecked() )
1399 if( p == &aMtrStartWidth )
1400 aMtrEndWidth.SetValue( aMtrStartWidth.GetValue() );
1401 if( p == &aLbStartStyle )
1402 aLbEndStyle.SelectEntryPos( aLbStartStyle.GetSelectEntryPos() );
1403 if( p == &aTsbCenterStart )
1404 aTsbCenterEnd.SetState( aTsbCenterStart.GetState() );
1407 ChangePreviewHdl_Impl( this );
1409 return( 0L );
1412 //------------------------------------------------------------------------
1413 // #116827#
1415 IMPL_LINK( SvxLineTabPage, ChangeEdgeStyleHdl_Impl, void *, EMPTYARG )
1417 ChangePreviewHdl_Impl( this );
1419 return( 0L );
1422 //------------------------------------------------------------------------
1424 IMPL_LINK( SvxLineTabPage, ClickInvisibleHdl_Impl, void *, EMPTYARG )
1426 if( aLbLineStyle.GetSelectEntryPos() == 0 ) // unsichtbar
1428 aFtColor.Disable();
1429 if(!bSymbols)
1430 aLbColor.Disable();
1431 aFtLineWidth.Disable();
1432 aMtrLineWidth.Disable();
1434 if( aFlLineEnds.IsEnabled() )
1436 aFtLineEndsStyle.Disable();
1437 aFtLineEndsWidth.Disable();
1438 aLbStartStyle.Disable();
1439 aMtrStartWidth.Disable();
1440 aTsbCenterStart.Disable();
1441 aLbEndStyle.Disable();
1442 aMtrEndWidth.Disable();
1443 aTsbCenterEnd.Disable();
1444 aCbxSynchronize.Disable();
1446 // #116827#
1447 maFTEdgeStyle.Disable();
1448 maLBEdgeStyle.Disable();
1451 else
1453 aFtColor.Enable();
1454 aLbColor.Enable();
1455 aFtLineWidth.Enable();
1456 aMtrLineWidth.Enable();
1458 if( aFlLineEnds.IsEnabled() )
1460 aFtLineEndsStyle.Enable();
1461 aFtLineEndsWidth.Enable();
1462 aLbStartStyle.Enable();
1463 aMtrStartWidth.Enable();
1464 aTsbCenterStart.Enable();
1465 aLbEndStyle.Enable();
1466 aMtrEndWidth.Enable();
1467 aTsbCenterEnd.Enable();
1468 aCbxSynchronize.Enable();
1470 // #116827#
1471 maFTEdgeStyle.Enable();
1472 maLBEdgeStyle.Enable();
1475 ChangePreviewHdl_Impl( NULL );
1477 return( 0L );
1480 //------------------------------------------------------------------------
1482 IMPL_LINK( SvxLineTabPage, ChangeEndHdl_Impl, void *, p )
1484 if( aCbxSynchronize.IsChecked() )
1486 if( p == &aMtrEndWidth )
1487 aMtrStartWidth.SetValue( aMtrEndWidth.GetValue() );
1488 if( p == &aLbEndStyle )
1489 aLbStartStyle.SelectEntryPos( aLbEndStyle.GetSelectEntryPos() );
1490 if( p == &aTsbCenterEnd )
1491 aTsbCenterStart.SetState( aTsbCenterEnd.GetState() );
1494 ChangePreviewHdl_Impl( this );
1496 return( 0L );
1499 //------------------------------------------------------------------------
1502 long SvxLineTabPage::ClickMeasuringHdl_Impl( void* )
1504 if( aTsbShowMeasuring.GetState() == STATE_NOCHECK )
1506 aFtPosition.Disable();
1507 aCtlPosition.Disable();
1509 else
1511 aFtPosition.Enable();
1512 aCtlPosition.Enable();
1514 aCtlPosition.Invalidate();
1516 return( 0L );
1519 //------------------------------------------------------------------------
1521 IMPL_LINK( SvxLineTabPage, ChangeTransparentHdl_Impl, void *, EMPTYARG )
1523 sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue();
1524 XLineTransparenceItem aItem( nVal );
1526 rXLSet.Put( XLineTransparenceItem( aItem ) );
1528 // #116827#
1529 FillXLSet_Impl();
1531 aCtlPreview.Invalidate();
1533 return( 0L );
1536 //------------------------------------------------------------------------
1538 void SvxLineTabPage::PointChanged( Window*, RECT_POINT eRcPt )
1540 eRP = eRcPt;
1543 //------------------------------------------------------------------------
1545 void SvxLineTabPage::FillUserData()
1547 // Abgleich wird in der Ini-Datei festgehalten
1548 UniString aStrUserData = UniString::CreateFromInt32( (sal_Int32) aCbxSynchronize.IsChecked() );
1549 SetUserData( aStrUserData );
1553 //#58425# Symbole auf einer Linie (z.B. StarChart)
1554 //Handler f�r Popup-Menue der Symbolauswahl (NumMenueButton)
1555 //der folgende Link stammt urspruenglich aus SvxNumOptionsTabPage
1556 IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton )
1558 //Popup initialisieren
1559 if(!pButton->GetPopupMenu()->GetPopupMenu( MN_GALLERY ))
1561 // Gallery-Eintraege besorgen
1562 GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames);
1564 PopupMenu* pPopup = new PopupMenu;
1565 String aEmptyStr;
1567 nNumMenuGalleryItems=aGrfNames.Count();
1568 for(long i = 0; i < nNumMenuGalleryItems; i++)
1570 const String* pGrfName = (const String*)aGrfNames.GetObject(i);
1571 const String* pUIName = pGrfName;
1573 // convert URL encodings to UI characters (eg %20 for spaces)
1574 String aPhysicalName;
1575 if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( *pGrfName, aPhysicalName ))
1576 pUIName = &aPhysicalName;
1578 SvxBrushItem* pBrushItem = new SvxBrushItem(*pGrfName, aEmptyStr, GPOS_AREA, SID_ATTR_BRUSH);
1579 pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl));
1581 SvxBmpItemInfo* pInfo = new SvxBmpItemInfo();
1582 pInfo->pBrushItem = pBrushItem;
1583 pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i);
1584 aGrfBrushItems.Insert(pInfo, i);
1585 const Graphic* pGraphic = pBrushItem->GetGraphic();
1587 if(pGraphic)
1589 Bitmap aBitmap(pGraphic->GetBitmap());
1590 Size aSize(aBitmap.GetSizePixel());
1591 if(aSize.Width() > MAX_BMP_WIDTH ||
1592 aSize.Height() > MAX_BMP_HEIGHT)
1594 sal_Bool bWidth = aSize.Width() > aSize.Height();
1595 double nScale = bWidth ?
1596 (double)MAX_BMP_WIDTH / (double)aSize.Width():
1597 (double)MAX_BMP_HEIGHT / (double)aSize.Height();
1598 aBitmap.Scale(nScale, nScale);
1601 Image aImage(aBitmap);
1602 pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage );
1604 else
1606 Image aImage;
1607 pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage );
1610 aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup );
1611 if(!aGrfNames.Count())
1612 aSymbolMB.GetPopupMenu()->EnableItem(MN_GALLERY, sal_False);
1615 if(!pButton->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS ) && pSymbolList)
1617 VirtualDevice aVDev;
1618 aVDev.SetMapMode(MapMode(MAP_100TH_MM));
1619 SdrModel* pModel = new SdrModel(NULL, NULL, LOADREFCOUNTS);
1620 pModel->GetItemPool().FreezeIdRanges();
1621 // Page
1622 SdrPage* pPage = new SdrPage( *pModel, sal_False );
1623 pPage->SetSize(Size(1000,1000));
1624 pModel->InsertPage( pPage, 0 );
1625 // 3D View
1626 SdrView* pView = new SdrView( pModel, &aVDev );
1627 pView->hideMarkHandles();
1628 // SdrPageView* pPageView = pView->ShowSdrPage(pPage, Point());
1629 SdrPageView* pPageView = pView->ShowSdrPage(pPage);
1631 PopupMenu* pPopup = new PopupMenu;
1632 String aEmptyStr;
1633 for(long i=0;; ++i)
1635 SdrObject *pObj=pSymbolList->GetObj(i);
1636 if(pObj==NULL)
1637 break;
1638 pObj=pObj->Clone();
1639 //const String* pGrfName = (const String*)aGrfNames.GetObject(i);
1640 String *pStr=new String();//String(i));
1641 aGrfNames.Insert(pStr,LIST_APPEND);
1642 //Rectangle aRect(pObj->GetLogicRect());
1643 pPage->NbcInsertObject(pObj);
1644 pView->MarkObj(pObj,pPageView);
1645 if(pSymbolAttr)
1647 pObj->SetMergedItemSet(*pSymbolAttr);
1649 else
1651 pObj->SetMergedItemSet(rOutAttrs);
1654 Bitmap aBitmap(pView->GetAllMarkedBitmap());
1655 GDIMetaFile aMeta(pView->GetAllMarkedMetaFile());
1656 pView->UnmarkAll();
1657 pObj=pPage->RemoveObject(0);
1658 SdrObject::Free(pObj);
1660 SvxBrushItem* pBrushItem = new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH);
1661 pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl));
1663 SvxBmpItemInfo* pInfo = new SvxBmpItemInfo();
1664 pInfo->pBrushItem = pBrushItem;
1665 pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i + nNumMenuGalleryItems);
1666 aGrfBrushItems.Insert(pInfo, nNumMenuGalleryItems + i);
1668 Size aSize(aBitmap.GetSizePixel());
1669 if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT)
1671 sal_Bool bWidth = aSize.Width() > aSize.Height();
1672 double nScale = bWidth ?
1673 (double)MAX_BMP_WIDTH / (double)aSize.Width():
1674 (double)MAX_BMP_HEIGHT / (double)aSize.Height();
1675 aBitmap.Scale(nScale, nScale);
1677 Image aImage(aBitmap);
1678 pPopup->InsertItem(pInfo->nItemId,*pStr,aImage);
1680 aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_SYMBOLS, pPopup );
1681 if(!aGrfNames.Count())
1682 aSymbolMB.GetPopupMenu()->EnableItem(MN_SYMBOLS, sal_False);
1684 delete pView;
1685 delete pModel;
1687 return 0;
1689 //#58425# Symbole auf einer Linie (z.B. StarChart)
1690 //Handler f�r Popup-Menue der Symbolauswahl (NumMenueButton)
1691 //der folgende Link stammt urspruenglich aus SvxNumOptionsTabPage:
1692 IMPL_STATIC_LINK(SvxLineTabPage, GraphicArrivedHdl_Impl, SvxBrushItem*, pItem)
1694 PopupMenu* pPopup = pThis->aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
1696 SvxBmpItemInfo* pBmpInfo = 0;
1697 for ( sal_uInt16 i = 0; i < pThis->aGrfBrushItems.Count(); i++ )
1699 SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)pThis->aGrfBrushItems.GetObject(i);
1700 if( pInfo->pBrushItem == pItem )
1702 pBmpInfo = pInfo; break;
1705 if( pBmpInfo )
1707 if( pItem->GetGraphic() )
1709 Bitmap aBitmap(pItem->GetGraphic()->GetBitmap());
1710 Size aSize(aBitmap.GetSizePixel());
1711 if(aSize.Width() > MAX_BMP_WIDTH ||
1712 aSize.Height() > MAX_BMP_HEIGHT)
1714 sal_Bool bWidth = aSize.Width() > aSize.Height();
1715 double nScale = bWidth ?
1716 (double)MAX_BMP_WIDTH / (double)aSize.Width():
1717 (double)MAX_BMP_HEIGHT / (double)aSize.Height();
1718 aBitmap.Scale(nScale, nScale);
1720 Image aImage(aBitmap);
1721 pPopup->SetItemImage( pBmpInfo->nItemId, aImage );
1725 return 0;
1728 //#58425# Symbole auf einer Linie (z.B. StarChart)
1729 //Handler f�r Menuebutton
1730 IMPL_LINK( SvxLineTabPage, GraphicHdl_Impl, MenuButton *, pButton )
1732 sal_uInt16 nItemId = pButton->GetCurItemId();
1733 const Graphic* pGraphic = 0;
1734 Graphic aGraphic;
1735 String aGrfName;
1736 sal_Bool bResetSize = sal_False;
1737 sal_Bool bEnable=sal_True;
1738 long nPreviousSymbolType = nSymbolType;
1740 if(nItemId >= MN_GALLERY_ENTRY)
1742 if( (nItemId-MN_GALLERY_ENTRY) >= nNumMenuGalleryItems)
1744 nSymbolType=nItemId-MN_GALLERY_ENTRY-nNumMenuGalleryItems; //Index der Liste
1746 else
1748 nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM;
1749 bResetSize = sal_True;
1751 SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)aGrfBrushItems.GetObject(nItemId - MN_GALLERY_ENTRY);
1752 pGraphic = pInfo->pBrushItem->GetGraphic();
1754 else switch(nItemId)
1756 case MN_SYMBOLS_AUTO:
1758 pGraphic=&aAutoSymbolGraphic;
1759 aAutoSymbolGraphic.SetPrefSize( Size(253,253) );
1760 nSymbolType=SVX_SYMBOLTYPE_AUTO;
1762 break;
1764 case MN_SYMBOLS_NONE:
1766 nSymbolType=SVX_SYMBOLTYPE_NONE;
1767 pGraphic=NULL;
1768 bEnable=sal_False;
1770 break;
1771 default:
1773 SvxOpenGraphicDialog aGrfDlg(CUI_RES(RID_STR_EDIT_GRAPHIC));
1774 aGrfDlg.EnableLink(sal_False);
1775 aGrfDlg.AsLink(sal_False);
1776 if( !aGrfDlg.Execute() )
1778 // ausgewaehlten Filter merken
1779 aGrfName = aGrfDlg.GetPath();
1780 if( !aGrfDlg.GetGraphic(aGraphic) )
1782 nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM;
1783 pGraphic = &aGraphic;
1784 bResetSize = sal_True;
1787 if( !pGraphic )
1788 return 0;
1790 break;
1793 if(pGraphic)
1795 Size aSize = SvxNumberFormat::GetGraphicSizeMM100(pGraphic);
1796 aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)ePoolUnit);
1797 aSymbolGraphic=*pGraphic;
1798 if( bResetSize )
1800 aSymbolSize=aSize;
1802 else if( nPreviousSymbolType == SVX_SYMBOLTYPE_BRUSHITEM )
1803 { //#i31097# Data Point Symbol size changes when a different symbol is choosen(maoyg)
1804 if( aSymbolSize.Width() != aSymbolSize.Height() )
1806 aSize.setWidth( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 );
1807 aSize.setHeight( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 );
1808 aSymbolSize = aSize;
1811 aCtlPreview.SetSymbol(&aSymbolGraphic,aSymbolSize);
1813 else
1815 aSymbolGraphic=Graphic();
1816 aCtlPreview.SetSymbol(NULL,aSymbolSize);
1817 bEnable=sal_False;
1819 aSymbolLastSize=aSymbolSize;
1820 SetMetricValue(aSymbolWidthMF, aSymbolSize.Width(), ePoolUnit);
1821 SetMetricValue(aSymbolHeightMF, aSymbolSize.Height(), ePoolUnit);
1822 aSymbolRatioCB.Enable(bEnable);
1823 aSymbolHeightFT.Enable(bEnable);
1824 aSymbolWidthFT.Enable(bEnable);
1825 aSymbolWidthMF.Enable(bEnable);
1826 aSymbolHeightMF.Enable(bEnable);
1827 aCtlPreview.Invalidate();
1829 return 0;
1831 IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, MetricField *, pField)
1833 bNewSize=true;
1834 sal_Bool bWidth = (sal_Bool)(pField == &aSymbolWidthMF);
1835 bLastWidthModified = bWidth;
1836 sal_Bool bRatio = aSymbolRatioCB.IsChecked();
1837 long nWidthVal = static_cast<long>(aSymbolWidthMF.Denormalize(aSymbolWidthMF.GetValue(FUNIT_100TH_MM)));
1838 long nHeightVal= static_cast<long>(aSymbolHeightMF.Denormalize(aSymbolHeightMF.GetValue(FUNIT_100TH_MM)));
1839 nWidthVal = OutputDevice::LogicToLogic(nWidthVal,MAP_100TH_MM,(MapUnit)ePoolUnit );
1840 nHeightVal = OutputDevice::LogicToLogic(nHeightVal,MAP_100TH_MM,(MapUnit)ePoolUnit);
1841 aSymbolSize=Size(nWidthVal,nHeightVal);
1842 double fSizeRatio = (double)1;
1844 if(bRatio)
1846 if (aSymbolLastSize.Height() && aSymbolLastSize.Width())
1847 fSizeRatio = (double)aSymbolLastSize.Width() / aSymbolLastSize.Height();
1850 //Size aSymbolSize(aSymbolLastSize);
1852 if(bWidth)
1854 long nDelta = nWidthVal - aSymbolLastSize.Width();
1855 aSymbolSize.Width() = nWidthVal;
1856 if (bRatio)
1858 aSymbolSize.Height() = aSymbolLastSize.Height() + (long)((double)nDelta / fSizeRatio);
1859 aSymbolSize.Height() = OutputDevice::LogicToLogic( aSymbolSize.Height(),(MapUnit)ePoolUnit, MAP_100TH_MM );
1860 aSymbolHeightMF.SetUserValue(aSymbolHeightMF.Normalize(aSymbolSize.Height()), FUNIT_100TH_MM);
1863 else
1865 long nDelta = nHeightVal - aSymbolLastSize.Height();
1866 aSymbolSize.Height() = nHeightVal;
1867 if (bRatio)
1869 aSymbolSize.Width() = aSymbolLastSize.Width() + (long)((double)nDelta * fSizeRatio);
1870 aSymbolSize.Width() = OutputDevice::LogicToLogic( aSymbolSize.Width(),
1871 (MapUnit)ePoolUnit, MAP_100TH_MM );
1872 aSymbolWidthMF.SetUserValue(aSymbolWidthMF.Normalize(aSymbolSize.Width()), FUNIT_100TH_MM);
1875 aCtlPreview.ResizeSymbol(aSymbolSize);
1876 aSymbolLastSize=aSymbolSize;
1877 return 0;
1879 IMPL_LINK( SvxLineTabPage, RatioHdl_Impl, CheckBox *, pBox )
1881 if (pBox->IsChecked())
1883 if (bLastWidthModified)
1884 SizeHdl_Impl(&aSymbolWidthMF);
1885 else
1886 SizeHdl_Impl(&aSymbolHeightMF);
1888 return 0;
1892 void SvxLineTabPage::DataChanged( const DataChangedEvent& rDCEvt )
1894 SvxTabPage::DataChanged( rDCEvt );
1896 if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
1898 FillListboxes();
1902 void SvxLineTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
1904 SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False);
1905 SFX_ITEMSET_ARG (&aSet,pDashListItem,SvxDashListItem,SID_DASH_LIST,sal_False);
1906 SFX_ITEMSET_ARG (&aSet,pLineEndListItem,SvxLineEndListItem,SID_LINEEND_LIST,sal_False);
1907 SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
1908 SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False);
1909 SFX_ITEMSET_ARG (&aSet,pSdrObjListItem,OfaPtrItem,SID_OBJECT_LIST,sal_False);
1910 SFX_ITEMSET_ARG (&aSet,pSymbolAttrItem,SfxTabDialogItem,SID_ATTR_SET,sal_False);
1911 SFX_ITEMSET_ARG (&aSet,pGraphicItem,SvxGraphicItem,SID_GRAPHIC,sal_False);
1913 if (pColorTabItem)
1914 SetColorTable(pColorTabItem->GetColorTable());
1915 if (pDashListItem)
1916 SetDashList(pDashListItem->GetDashList());
1917 if (pLineEndListItem)
1918 SetLineEndList(pLineEndListItem->GetLineEndList());
1919 if (pPageTypeItem)
1920 SetPageType(pPageTypeItem->GetValue());
1921 if (pDlgTypeItem)
1922 SetDlgType(pDlgTypeItem->GetValue());
1923 Construct();
1925 if(pSdrObjListItem) //symbols
1927 ShowSymbolControls(sal_True);
1928 pSymbolList = static_cast<SdrObjList*>(pSdrObjListItem->GetValue());
1929 if (pSymbolAttrItem)
1930 pSymbolAttr = new SfxItemSet(pSymbolAttrItem->GetItemSet());
1931 if(pGraphicItem)
1932 aAutoSymbolGraphic = pGraphicItem->GetGraphic();