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 } 1348 } 1349 else 1350 { 1351 maLBEdgeStyle.SetNoSelection(); 1352 } 1353 1354 /* 1355 if( aLbStartStyle.GetSelectEntryPos() == aLbEndStyle.GetSelectEntryPos() && 1356 aMtrStartWidth.GetValue() == aMtrEndWidth.GetValue() && 1357 aTsbCenterStart.GetState() == aTsbCenterEnd.GetState() ) 1358 { 1359 aCbxSynchronize.Check(); 1360 } 1361 */ 1362 1363 // fdo#43209 1364 if(bObjSelected && SFX_ITEM_DEFAULT == rAttrs.GetItemState(XATTR_LINECAP)) 1365 { 1366 maFTCapStyle.Disable(); 1367 maLBCapStyle.Disable(); 1368 } 1369 else if(SFX_ITEM_DONTCARE != rAttrs.GetItemState(XATTR_LINECAP)) 1370 { 1371 const com::sun::star::drawing::LineCap eLineCap(((const XLineCapItem&)(rAttrs.Get(XATTR_LINECAP))).GetValue()); 1372 1373 switch(eLineCap) 1374 { 1375 case com::sun::star::drawing::LineCap_ROUND: maLBCapStyle.SelectEntryPos(1); break; 1376 case com::sun::star::drawing::LineCap_SQUARE : maLBCapStyle.SelectEntryPos(2); break; 1377 default /*com::sun::star::drawing::LineCap_BUTT*/: maLBCapStyle.SelectEntryPos(0); break; 1378 } 1379 } 1380 else 1381 { 1382 maLBCapStyle.SetNoSelection(); 1383 } 1384 1385 // Werte sichern 1386 aLbLineStyle.SaveValue(); 1387 aMtrLineWidth.SaveValue(); 1388 aLbColor.SaveValue(); 1389 aLbStartStyle.SaveValue(); 1390 aLbEndStyle.SaveValue(); 1391 aMtrStartWidth.SaveValue(); 1392 aMtrEndWidth.SaveValue(); 1393 aTsbCenterStart.SaveValue(); 1394 aTsbCenterEnd.SaveValue(); 1395 aMtrTransparent.SaveValue(); 1396 1397 // #116827# 1398 maLBEdgeStyle.SaveValue(); 1399 1400 // LineCaps 1401 maLBCapStyle.SaveValue(); 1402 1403 ClickInvisibleHdl_Impl( this ); 1404 //ClickMeasuringHdl_Impl( this ); 1405 //aCtlPosition.Reset(); 1406 1407 ChangePreviewHdl_Impl( NULL ); 1408 } 1409 1410 // ----------------------------------------------------------------------- 1411 1412 SfxTabPage* SvxLineTabPage::Create( Window* pWindow, 1413 const SfxItemSet& rAttrs ) 1414 { 1415 return( new SvxLineTabPage( pWindow, rAttrs ) ); 1416 } 1417 1418 //------------------------------------------------------------------------ 1419 1420 sal_uInt16* SvxLineTabPage::GetRanges() 1421 { 1422 return( pLineRanges ); 1423 } 1424 1425 //------------------------------------------------------------------------ 1426 1427 IMPL_LINK( SvxLineTabPage, ChangePreviewHdl_Impl, void *, pCntrl ) 1428 { 1429 if(pCntrl == &aMtrLineWidth) 1430 { 1431 // Linienbreite und Start/EndBreite 1432 sal_Int32 nNewLineWidth = GetCoreValue( aMtrLineWidth, ePoolUnit ); 1433 if(nActLineWidth == -1) 1434 { 1435 // Noch nicht initialisiert, hole den Startwert 1436 const SfxPoolItem* pOld = GetOldItem( rXLSet, XATTR_LINEWIDTH ); 1437 sal_Int32 nStartLineWidth = 0; 1438 if(pOld) 1439 nStartLineWidth = (( const XLineWidthItem *)pOld)->GetValue(); 1440 nActLineWidth = nStartLineWidth; 1441 } 1442 1443 if(nActLineWidth != nNewLineWidth) 1444 { 1445 // Anpassungen Start/EndWidth #63083# 1446 sal_Int32 nValAct = GetCoreValue( aMtrStartWidth, ePoolUnit ); 1447 sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10); 1448 if(nValNew < 0) 1449 nValNew = 0; 1450 SetMetricValue( aMtrStartWidth, nValNew, ePoolUnit ); 1451 1452 nValAct = GetCoreValue( aMtrEndWidth, ePoolUnit ); 1453 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10); 1454 if(nValNew < 0) 1455 nValNew = 0; 1456 SetMetricValue( aMtrEndWidth, nValNew, ePoolUnit ); 1457 } 1458 1459 // Aktuellen Wert merken 1460 nActLineWidth = nNewLineWidth; 1461 } 1462 1463 FillXLSet_Impl(); 1464 aCtlPreview.Invalidate(); 1465 1466 // Transparenz entspr. zugaenglich machen 1467 if( aLbLineStyle.GetSelectEntryPos() == 0 ) // unsichtbar 1468 { 1469 aFtTransparent.Disable(); 1470 aMtrTransparent.Disable(); 1471 } 1472 else 1473 { 1474 aFtTransparent.Enable(); 1475 aMtrTransparent.Enable(); 1476 } 1477 1478 const bool bHasLineStart = aLbStartStyle.GetSelectEntryPos() != 0; 1479 const bool bHasLineEnd = aLbEndStyle.GetSelectEntryPos() != 0; 1480 1481 aFtLineEndsWidth.Enable( bHasLineStart || bHasLineEnd ); 1482 aMtrStartWidth.Enable( bHasLineStart ); 1483 aTsbCenterStart.Enable( bHasLineStart ); 1484 aMtrEndWidth.Enable( bHasLineEnd ); 1485 aTsbCenterEnd.Enable( bHasLineEnd ); 1486 1487 return( 0L ); 1488 } 1489 1490 //------------------------------------------------------------------------ 1491 1492 IMPL_LINK( SvxLineTabPage, ChangeStartHdl_Impl, void *, p ) 1493 { 1494 if( aCbxSynchronize.IsChecked() ) 1495 { 1496 if( p == &aMtrStartWidth ) 1497 aMtrEndWidth.SetValue( aMtrStartWidth.GetValue() ); 1498 if( p == &aLbStartStyle ) 1499 aLbEndStyle.SelectEntryPos( aLbStartStyle.GetSelectEntryPos() ); 1500 if( p == &aTsbCenterStart ) 1501 aTsbCenterEnd.SetState( aTsbCenterStart.GetState() ); 1502 } 1503 1504 ChangePreviewHdl_Impl( this ); 1505 1506 return( 0L ); 1507 } 1508 1509 //------------------------------------------------------------------------ 1510 // #116827# 1511 1512 IMPL_LINK( SvxLineTabPage, ChangeEdgeStyleHdl_Impl, void *, EMPTYARG ) 1513 { 1514 ChangePreviewHdl_Impl( this ); 1515 1516 return( 0L ); 1517 } 1518 1519 //------------------------------------------------------------------------ 1520 // fdo#43209 1521 1522 IMPL_LINK( SvxLineTabPage, ChangeCapStyleHdl_Impl, void *, EMPTYARG ) 1523 { 1524 ChangePreviewHdl_Impl( this ); 1525 1526 return( 0L ); 1527 } 1528 //------------------------------------------------------------------------ 1529 1530 IMPL_LINK( SvxLineTabPage, ClickInvisibleHdl_Impl, void *, EMPTYARG ) 1531 { 1532 if( aLbLineStyle.GetSelectEntryPos() == 0 ) // unsichtbar 1533 { 1534 aFtColor.Disable(); 1535 if(!bSymbols) 1536 aLbColor.Disable(); 1537 aFtLineWidth.Disable(); 1538 aMtrLineWidth.Disable(); 1539 1540 if( aFlLineEnds.IsEnabled() ) 1541 { 1542 aFtLineEndsStyle.Disable(); 1543 aFtLineEndsWidth.Disable(); 1544 aLbStartStyle.Disable(); 1545 aMtrStartWidth.Disable(); 1546 aTsbCenterStart.Disable(); 1547 aLbEndStyle.Disable(); 1548 aMtrEndWidth.Disable(); 1549 aTsbCenterEnd.Disable(); 1550 aCbxSynchronize.Disable(); 1551 1552 // #116827# 1553 maFTEdgeStyle.Disable(); 1554 maLBEdgeStyle.Disable(); 1555 1556 // LineCaps 1557 maFTCapStyle.Disable(); 1558 maLBCapStyle.Disable(); 1559 } 1560 } 1561 else 1562 { 1563 aFtColor.Enable(); 1564 aLbColor.Enable(); 1565 aFtLineWidth.Enable(); 1566 aMtrLineWidth.Enable(); 1567 1568 if( aFlLineEnds.IsEnabled() ) 1569 { 1570 aFtLineEndsStyle.Enable(); 1571 aFtLineEndsWidth.Enable(); 1572 aLbStartStyle.Enable(); 1573 aMtrStartWidth.Enable(); 1574 aTsbCenterStart.Enable(); 1575 aLbEndStyle.Enable(); 1576 aMtrEndWidth.Enable(); 1577 aTsbCenterEnd.Enable(); 1578 aCbxSynchronize.Enable(); 1579 1580 // #116827# 1581 maFTEdgeStyle.Enable(); 1582 maLBEdgeStyle.Enable(); 1583 1584 // LineCaps 1585 maFTCapStyle.Enable(); 1586 maLBCapStyle.Enable(); 1587 } 1588 } 1589 ChangePreviewHdl_Impl( NULL ); 1590 1591 return( 0L ); 1592 } 1593 1594 //------------------------------------------------------------------------ 1595 1596 IMPL_LINK( SvxLineTabPage, ChangeEndHdl_Impl, void *, p ) 1597 { 1598 if( aCbxSynchronize.IsChecked() ) 1599 { 1600 if( p == &aMtrEndWidth ) 1601 aMtrStartWidth.SetValue( aMtrEndWidth.GetValue() ); 1602 if( p == &aLbEndStyle ) 1603 aLbStartStyle.SelectEntryPos( aLbEndStyle.GetSelectEntryPos() ); 1604 if( p == &aTsbCenterEnd ) 1605 aTsbCenterStart.SetState( aTsbCenterEnd.GetState() ); 1606 } 1607 1608 ChangePreviewHdl_Impl( this ); 1609 1610 return( 0L ); 1611 } 1612 1613 //------------------------------------------------------------------------ 1614 /* 1615 1616 long SvxLineTabPage::ClickMeasuringHdl_Impl( void* ) 1617 { 1618 if( aTsbShowMeasuring.GetState() == STATE_NOCHECK ) 1619 { 1620 aFtPosition.Disable(); 1621 aCtlPosition.Disable(); 1622 } 1623 else 1624 { 1625 aFtPosition.Enable(); 1626 aCtlPosition.Enable(); 1627 } 1628 aCtlPosition.Invalidate(); 1629 1630 return( 0L ); 1631 } 1632 */ 1633 //------------------------------------------------------------------------ 1634 1635 IMPL_LINK( SvxLineTabPage, ChangeTransparentHdl_Impl, void *, EMPTYARG ) 1636 { 1637 sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue(); 1638 XLineTransparenceItem aItem( nVal ); 1639 1640 rXLSet.Put( XLineTransparenceItem( aItem ) ); 1641 1642 // #116827# 1643 FillXLSet_Impl(); 1644 1645 aCtlPreview.Invalidate(); 1646 1647 return( 0L ); 1648 } 1649 1650 //------------------------------------------------------------------------ 1651 1652 void SvxLineTabPage::PointChanged( Window*, RECT_POINT eRcPt ) 1653 { 1654 eRP = eRcPt; 1655 } 1656 1657 //------------------------------------------------------------------------ 1658 1659 void SvxLineTabPage::FillUserData() 1660 { 1661 // Abgleich wird in der Ini-Datei festgehalten 1662 UniString aStrUserData = UniString::CreateFromInt32( (sal_Int32) aCbxSynchronize.IsChecked() ); 1663 SetUserData( aStrUserData ); 1664 } 1665 1666 1667 //#58425# Symbole auf einer Linie (z.B. StarChart) 1668 //Handler f�r Popup-Menue der Symbolauswahl (NumMenueButton) 1669 //der folgende Link stammt urspruenglich aus SvxNumOptionsTabPage 1670 IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton ) 1671 { 1672 //Popup initialisieren 1673 if(!pButton->GetPopupMenu()->GetPopupMenu( MN_GALLERY )) 1674 { 1675 // Gallery-Eintraege besorgen 1676 GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames); 1677 1678 PopupMenu* pPopup = new PopupMenu; 1679 String aEmptyStr; 1680 1681 nNumMenuGalleryItems=aGrfNames.Count(); 1682 for(long i = 0; i < nNumMenuGalleryItems; i++) 1683 { 1684 const String* pGrfName = (const String*)aGrfNames.GetObject(i); 1685 const String* pUIName = pGrfName; 1686 1687 // convert URL encodings to UI characters (eg %20 for spaces) 1688 String aPhysicalName; 1689 if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( *pGrfName, aPhysicalName )) 1690 pUIName = &aPhysicalName; 1691 1692 SvxBrushItem* pBrushItem = new SvxBrushItem(*pGrfName, aEmptyStr, GPOS_AREA, SID_ATTR_BRUSH); 1693 pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl)); 1694 1695 SvxBmpItemInfo* pInfo = new SvxBmpItemInfo(); 1696 pInfo->pBrushItem = pBrushItem; 1697 pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i); 1698 aGrfBrushItems.Insert(pInfo, i); 1699 const Graphic* pGraphic = pBrushItem->GetGraphic(); 1700 1701 if(pGraphic) 1702 { 1703 Bitmap aBitmap(pGraphic->GetBitmap()); 1704 Size aSize(aBitmap.GetSizePixel()); 1705 if(aSize.Width() > MAX_BMP_WIDTH || 1706 aSize.Height() > MAX_BMP_HEIGHT) 1707 { 1708 sal_Bool bWidth = aSize.Width() > aSize.Height(); 1709 double nScale = bWidth ? 1710 (double)MAX_BMP_WIDTH / (double)aSize.Width(): 1711 (double)MAX_BMP_HEIGHT / (double)aSize.Height(); 1712 aBitmap.Scale(nScale, nScale); 1713 1714 } 1715 Image aImage(aBitmap); 1716 pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage ); 1717 } 1718 else 1719 { 1720 Image aImage; 1721 pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage ); 1722 } 1723 } 1724 aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup ); 1725 if(!aGrfNames.Count()) 1726 aSymbolMB.GetPopupMenu()->EnableItem(MN_GALLERY, sal_False); 1727 } 1728 1729 if(!pButton->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS ) && pSymbolList) 1730 { 1731 VirtualDevice aVDev; 1732 aVDev.SetMapMode(MapMode(MAP_100TH_MM)); 1733 SdrModel* pModel = new SdrModel(NULL, NULL, LOADREFCOUNTS); 1734 pModel->GetItemPool().FreezeIdRanges(); 1735 // Page 1736 SdrPage* pPage = new SdrPage( *pModel, sal_False ); 1737 pPage->SetSize(Size(1000,1000)); 1738 pModel->InsertPage( pPage, 0 ); 1739 // 3D View 1740 SdrView* pView = new SdrView( pModel, &aVDev ); 1741 pView->hideMarkHandles(); 1742 /*SdrPageView* pPageView = */pView->ShowSdrPage(pPage); 1743 1744 PopupMenu* pPopup = new PopupMenu; 1745 String aEmptyStr; 1746 1747 // Generate invisible square to give all symbols a 1748 // bitmap size, which is indepedent from specific glyph 1749 SdrObject *pInvisibleSquare=pSymbolList->GetObj(0); 1750 pInvisibleSquare=pInvisibleSquare->Clone(); 1751 pPage->NbcInsertObject(pInvisibleSquare); 1752 pInvisibleSquare->SetMergedItem(XFillTransparenceItem(100)); 1753 pInvisibleSquare->SetMergedItem(XLineTransparenceItem(100)); 1754 1755 for(long i=0;; ++i) 1756 { 1757 SdrObject *pObj=pSymbolList->GetObj(i); 1758 if(pObj==NULL) 1759 break; 1760 pObj=pObj->Clone(); 1761 //const String* pGrfName = (const String*)aGrfNames.GetObject(i); 1762 String *pStr=new String();//String(i)); 1763 aGrfNames.Insert(pStr,LIST_APPEND); 1764 //Rectangle aRect(pObj->GetLogicRect()); 1765 pPage->NbcInsertObject(pObj); 1766 if(pSymbolAttr) 1767 { 1768 pObj->SetMergedItemSet(*pSymbolAttr); 1769 } 1770 else 1771 { 1772 pObj->SetMergedItemSet(rOutAttrs); 1773 } 1774 pView->MarkAll(); 1775 BitmapEx aBitmapEx(pView->GetMarkedObjBitmapEx()); 1776 GDIMetaFile aMeta(pView->GetMarkedObjMetaFile()); 1777 pView->UnmarkAll(); 1778 pObj=pPage->RemoveObject(1); 1779 SdrObject::Free(pObj); 1780 1781 SvxBrushItem* pBrushItem = new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH); 1782 pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl)); 1783 1784 SvxBmpItemInfo* pInfo = new SvxBmpItemInfo(); 1785 pInfo->pBrushItem = pBrushItem; 1786 pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i + nNumMenuGalleryItems); 1787 aGrfBrushItems.Insert(pInfo, nNumMenuGalleryItems + i); 1788 1789 Size aSize(aBitmapEx.GetSizePixel()); 1790 if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT) 1791 { 1792 sal_Bool bWidth = aSize.Width() > aSize.Height(); 1793 double nScale = bWidth ? 1794 (double)MAX_BMP_WIDTH / (double)aSize.Width(): 1795 (double)MAX_BMP_HEIGHT / (double)aSize.Height(); 1796 aBitmapEx.Scale(nScale, nScale); 1797 } 1798 Image aImage(aBitmapEx); 1799 pPopup->InsertItem(pInfo->nItemId,*pStr,aImage); 1800 } 1801 pInvisibleSquare=pPage->RemoveObject(0); 1802 SdrObject::Free(pInvisibleSquare); 1803 1804 aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_SYMBOLS, pPopup ); 1805 if(!aGrfNames.Count()) 1806 aSymbolMB.GetPopupMenu()->EnableItem(MN_SYMBOLS, sal_False); 1807 1808 delete pView; 1809 delete pModel; 1810 } 1811 return 0; 1812 } 1813 //#58425# Symbole auf einer Linie (z.B. StarChart) 1814 //Handler f�r Popup-Menue der Symbolauswahl (NumMenueButton) 1815 //der folgende Link stammt urspruenglich aus SvxNumOptionsTabPage: 1816 IMPL_STATIC_LINK(SvxLineTabPage, GraphicArrivedHdl_Impl, SvxBrushItem*, pItem) 1817 { 1818 PopupMenu* pPopup = pThis->aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY ); 1819 1820 SvxBmpItemInfo* pBmpInfo = 0; 1821 for ( sal_uInt16 i = 0; i < pThis->aGrfBrushItems.Count(); i++ ) 1822 { 1823 SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)pThis->aGrfBrushItems.GetObject(i); 1824 if( pInfo->pBrushItem == pItem ) 1825 { 1826 pBmpInfo = pInfo; break; 1827 } 1828 } 1829 if( pBmpInfo ) 1830 { 1831 if( pItem->GetGraphic() ) 1832 { 1833 Bitmap aBitmap(pItem->GetGraphic()->GetBitmap()); 1834 Size aSize(aBitmap.GetSizePixel()); 1835 if(aSize.Width() > MAX_BMP_WIDTH || 1836 aSize.Height() > MAX_BMP_HEIGHT) 1837 { 1838 sal_Bool bWidth = aSize.Width() > aSize.Height(); 1839 double nScale = bWidth ? 1840 (double)MAX_BMP_WIDTH / (double)aSize.Width(): 1841 (double)MAX_BMP_HEIGHT / (double)aSize.Height(); 1842 aBitmap.Scale(nScale, nScale); 1843 } 1844 Image aImage(aBitmap); 1845 pPopup->SetItemImage( pBmpInfo->nItemId, aImage ); 1846 } 1847 } 1848 1849 return 0; 1850 } 1851 1852 //#58425# Symbole auf einer Linie (z.B. StarChart) 1853 //Handler f�r Menuebutton 1854 IMPL_LINK( SvxLineTabPage, GraphicHdl_Impl, MenuButton *, pButton ) 1855 { 1856 sal_uInt16 nItemId = pButton->GetCurItemId(); 1857 const Graphic* pGraphic = 0; 1858 Graphic aGraphic; 1859 String aGrfName; 1860 sal_Bool bResetSize = sal_False; 1861 sal_Bool bEnable=sal_True; 1862 long nPreviousSymbolType = nSymbolType; 1863 1864 if(nItemId >= MN_GALLERY_ENTRY) 1865 { 1866 if( (nItemId-MN_GALLERY_ENTRY) >= nNumMenuGalleryItems) 1867 { 1868 nSymbolType=nItemId-MN_GALLERY_ENTRY-nNumMenuGalleryItems; //Index der Liste 1869 } 1870 else 1871 { 1872 nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM; 1873 bResetSize = sal_True; 1874 } 1875 SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)aGrfBrushItems.GetObject(nItemId - MN_GALLERY_ENTRY); 1876 pGraphic = pInfo->pBrushItem->GetGraphic(); 1877 } 1878 else switch(nItemId) 1879 { 1880 case MN_SYMBOLS_AUTO: 1881 { 1882 pGraphic=&aAutoSymbolGraphic; 1883 aAutoSymbolGraphic.SetPrefSize( Size(253,253) ); 1884 nSymbolType=SVX_SYMBOLTYPE_AUTO; 1885 } 1886 break; 1887 1888 case MN_SYMBOLS_NONE: 1889 { 1890 nSymbolType=SVX_SYMBOLTYPE_NONE; 1891 pGraphic=NULL; 1892 bEnable=sal_False; 1893 } 1894 break; 1895 default: 1896 { 1897 SvxOpenGraphicDialog aGrfDlg(CUI_RES(RID_STR_EDIT_GRAPHIC)); 1898 aGrfDlg.EnableLink(sal_False); 1899 aGrfDlg.AsLink(sal_False); 1900 if( !aGrfDlg.Execute() ) 1901 { 1902 // ausgewaehlten Filter merken 1903 aGrfName = aGrfDlg.GetPath(); 1904 if( !aGrfDlg.GetGraphic(aGraphic) ) 1905 { 1906 nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM; 1907 pGraphic = &aGraphic; 1908 bResetSize = sal_True; 1909 } 1910 } 1911 if( !pGraphic ) 1912 return 0; 1913 } 1914 break; 1915 } 1916 1917 if(pGraphic) 1918 { 1919 Size aSize = SvxNumberFormat::GetGraphicSizeMM100(pGraphic); 1920 aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)ePoolUnit); 1921 aSymbolGraphic=*pGraphic; 1922 if( bResetSize ) 1923 { 1924 aSymbolSize=aSize; 1925 } 1926 else if( nPreviousSymbolType == SVX_SYMBOLTYPE_BRUSHITEM ) 1927 { //#i31097# Data Point Symbol size changes when a different symbol is choosen(maoyg) 1928 if( aSymbolSize.Width() != aSymbolSize.Height() ) 1929 { 1930 aSize.setWidth( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 ); 1931 aSize.setHeight( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 ); 1932 aSymbolSize = aSize; 1933 } 1934 } 1935 aCtlPreview.SetSymbol(&aSymbolGraphic,aSymbolSize); 1936 } 1937 else 1938 { 1939 aSymbolGraphic=Graphic(); 1940 aCtlPreview.SetSymbol(NULL,aSymbolSize); 1941 bEnable=sal_False; 1942 } 1943 aSymbolLastSize=aSymbolSize; 1944 SetMetricValue(aSymbolWidthMF, aSymbolSize.Width(), ePoolUnit); 1945 SetMetricValue(aSymbolHeightMF, aSymbolSize.Height(), ePoolUnit); 1946 aSymbolRatioCB.Enable(bEnable); 1947 aSymbolHeightFT.Enable(bEnable); 1948 aSymbolWidthFT.Enable(bEnable); 1949 aSymbolWidthMF.Enable(bEnable); 1950 aSymbolHeightMF.Enable(bEnable); 1951 aCtlPreview.Invalidate(); 1952 1953 return 0; 1954 } 1955 IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, MetricField *, pField) 1956 { 1957 bNewSize=true; 1958 sal_Bool bWidth = (sal_Bool)(pField == &aSymbolWidthMF); 1959 bLastWidthModified = bWidth; 1960 sal_Bool bRatio = aSymbolRatioCB.IsChecked(); 1961 long nWidthVal = static_cast<long>(aSymbolWidthMF.Denormalize(aSymbolWidthMF.GetValue(FUNIT_100TH_MM))); 1962 long nHeightVal= static_cast<long>(aSymbolHeightMF.Denormalize(aSymbolHeightMF.GetValue(FUNIT_100TH_MM))); 1963 nWidthVal = OutputDevice::LogicToLogic(nWidthVal,MAP_100TH_MM,(MapUnit)ePoolUnit ); 1964 nHeightVal = OutputDevice::LogicToLogic(nHeightVal,MAP_100TH_MM,(MapUnit)ePoolUnit); 1965 aSymbolSize=Size(nWidthVal,nHeightVal); 1966 double fSizeRatio = (double)1; 1967 1968 if(bRatio) 1969 { 1970 if (aSymbolLastSize.Height() && aSymbolLastSize.Width()) 1971 fSizeRatio = (double)aSymbolLastSize.Width() / aSymbolLastSize.Height(); 1972 } 1973 1974 //Size aSymbolSize(aSymbolLastSize); 1975 1976 if(bWidth) 1977 { 1978 long nDelta = nWidthVal - aSymbolLastSize.Width(); 1979 aSymbolSize.Width() = nWidthVal; 1980 if (bRatio) 1981 { 1982 aSymbolSize.Height() = aSymbolLastSize.Height() + (long)((double)nDelta / fSizeRatio); 1983 aSymbolSize.Height() = OutputDevice::LogicToLogic( aSymbolSize.Height(),(MapUnit)ePoolUnit, MAP_100TH_MM ); 1984 aSymbolHeightMF.SetUserValue(aSymbolHeightMF.Normalize(aSymbolSize.Height()), FUNIT_100TH_MM); 1985 } 1986 } 1987 else 1988 { 1989 long nDelta = nHeightVal - aSymbolLastSize.Height(); 1990 aSymbolSize.Height() = nHeightVal; 1991 if (bRatio) 1992 { 1993 aSymbolSize.Width() = aSymbolLastSize.Width() + (long)((double)nDelta * fSizeRatio); 1994 aSymbolSize.Width() = OutputDevice::LogicToLogic( aSymbolSize.Width(), 1995 (MapUnit)ePoolUnit, MAP_100TH_MM ); 1996 aSymbolWidthMF.SetUserValue(aSymbolWidthMF.Normalize(aSymbolSize.Width()), FUNIT_100TH_MM); 1997 } 1998 } 1999 aCtlPreview.ResizeSymbol(aSymbolSize); 2000 aSymbolLastSize=aSymbolSize; 2001 return 0; 2002 } 2003 IMPL_LINK( SvxLineTabPage, RatioHdl_Impl, CheckBox *, pBox ) 2004 { 2005 if (pBox->IsChecked()) 2006 { 2007 if (bLastWidthModified) 2008 SizeHdl_Impl(&aSymbolWidthMF); 2009 else 2010 SizeHdl_Impl(&aSymbolHeightMF); 2011 } 2012 return 0; 2013 } 2014 2015 2016 void SvxLineTabPage::DataChanged( const DataChangedEvent& rDCEvt ) 2017 { 2018 SvxTabPage::DataChanged( rDCEvt ); 2019 2020 if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) 2021 { 2022 FillListboxes(); 2023 } 2024 } 2025 2026 void SvxLineTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001 2027 { 2028 SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False); 2029 SFX_ITEMSET_ARG (&aSet,pDashListItem,SvxDashListItem,SID_DASH_LIST,sal_False); 2030 SFX_ITEMSET_ARG (&aSet,pLineEndListItem,SvxLineEndListItem,SID_LINEEND_LIST,sal_False); 2031 SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); 2032 SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False); 2033 SFX_ITEMSET_ARG (&aSet,pSdrObjListItem,OfaPtrItem,SID_OBJECT_LIST,sal_False); 2034 SFX_ITEMSET_ARG (&aSet,pSymbolAttrItem,SfxTabDialogItem,SID_ATTR_SET,sal_False); 2035 SFX_ITEMSET_ARG (&aSet,pGraphicItem,SvxGraphicItem,SID_GRAPHIC,sal_False); 2036 2037 if (pColorTabItem) 2038 SetColorTable(pColorTabItem->GetColorTable()); 2039 if (pDashListItem) 2040 SetDashList(pDashListItem->GetDashList()); 2041 if (pLineEndListItem) 2042 SetLineEndList(pLineEndListItem->GetLineEndList()); 2043 if (pPageTypeItem) 2044 SetPageType(pPageTypeItem->GetValue()); 2045 if (pDlgTypeItem) 2046 SetDlgType(pDlgTypeItem->GetValue()); 2047 Construct(); 2048 2049 if(pSdrObjListItem) //symbols 2050 { 2051 ShowSymbolControls(sal_True); 2052 pSymbolList = static_cast<SdrObjList*>(pSdrObjListItem->GetValue()); 2053 if (pSymbolAttrItem) 2054 pSymbolAttr = new SfxItemSet(pSymbolAttrItem->GetItemSet()); 2055 if(pGraphicItem) 2056 aAutoSymbolGraphic = pGraphicItem->GetGraphic(); 2057 } 2058 } 2059