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