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_svx.hxx" 26 #include <editeng/eeitem.hxx> 27 28 #include "svdibrow.hxx" 29 30 #ifndef _STDLIB_H 31 #include <stdlib.h> 32 #define _STDLIB_H 33 #endif 34 35 #include "svx/svditext.hxx" 36 #include <editeng/flditem.hxx> 37 #include <editeng/editdata.hxx> 38 #include <svx/svdpool.hxx> 39 #include <svx/svdattr.hxx> 40 #include <svx/svdattrx.hxx> 41 #include <svx/svdview.hxx> 42 #include <svx/xenum.hxx> 43 #include <svx/xlineit0.hxx> 44 #include <svx/xlnstwit.hxx> 45 #include <svx/xlnedwit.hxx> 46 #include <svx/xfillit0.hxx> 47 #include <svx/xflbmtit.hxx> 48 #include <svx/xtextit0.hxx> 49 #include <svx/xflbstit.hxx> 50 #include <svx/xflbtoxy.hxx> 51 #include <svx/xftshit.hxx> 52 #include <editeng/colritem.hxx> 53 54 55 #include "editeng/fontitem.hxx" 56 #include <editeng/fhgtitem.hxx> 57 58 #include <editeng/charscaleitem.hxx> 59 #include <svl/whiter.hxx> 60 #include <svl/flagitem.hxx> 61 #include <svl/ptitem.hxx> 62 #include <svl/rectitem.hxx> 63 64 #include <svl/rngitem.hxx> 65 #include <svx/sdrpaintwindow.hxx> 66 67 //////////////////////////////////////////////////////////////////////////////////////////////////// 68 69 #define ITEMBROWSER_WHICHCOL_ID 1 70 #define ITEMBROWSER_STATECOL_ID 2 71 #define ITEMBROWSER_TYPECOL_ID 3 72 #define ITEMBROWSER_NAMECOL_ID 4 73 #define ITEMBROWSER_VALUECOL_ID 5 74 75 enum ItemType { 76 ITEM_DONTKNOW, ITEM_BYTE, ITEM_INT16, ITEM_UINT16, ITEM_INT32, ITEM_UINT32, 77 ITEM_ENUM, ITEM_BOOL, ITEM_FLAG, ITEM_STRING, ITEM_POINT, ITEM_RECT, ITEM_RANGE, ITEM_LRANGE, 78 ITEM_FRACTION, 79 ITEM_XCOLOR, 80 ITEM_COLOR, 81 ITEM_FONT, ITEM_FONTHEIGHT, ITEM_FONTWIDTH, ITEM_FIELD 82 }; 83 84 class ImpItemListRow 85 { 86 public: 87 XubString aName; 88 XubString aValue; 89 SfxItemState eState; 90 sal_uInt16 nWhichId; 91 92 TypeId pType; 93 ItemType eItemType; 94 95 sal_Int32 nVal; 96 sal_Int32 nMin; 97 sal_Int32 nMax; 98 99 sal_Bool bComment; 100 sal_Bool bIsNum; 101 sal_Bool bCanNum; 102 103 public: 104 ImpItemListRow() 105 : eState(SFX_ITEM_UNKNOWN), 106 nWhichId(0), 107 pType(NULL), 108 eItemType(ITEM_DONTKNOW), 109 nVal(0), 110 nMin(0), 111 nMax(0), 112 bComment(sal_False), 113 bIsNum(sal_False), 114 bCanNum(sal_False) 115 {} 116 117 XubString GetItemTypeStr() const; 118 sal_Bool operator==(const ImpItemListRow& rEntry) const; 119 sal_Bool operator!=(const ImpItemListRow& rEntry) const { return !operator==(rEntry); } 120 }; 121 122 XubString ImpItemListRow::GetItemTypeStr() const 123 { 124 XubString aStr; 125 126 switch(eItemType) 127 { 128 case ITEM_BYTE : aStr.AppendAscii("Byte"); break; 129 case ITEM_INT16 : aStr.AppendAscii("Int16"); break; 130 case ITEM_UINT16 : aStr.AppendAscii("UInt16"); break; 131 case ITEM_INT32 : aStr.AppendAscii("Int32"); break; 132 case ITEM_UINT32 : aStr.AppendAscii("UInt32"); break; 133 case ITEM_ENUM : aStr.AppendAscii("Enum"); break; 134 case ITEM_BOOL : aStr.AppendAscii("Bool"); break; 135 case ITEM_FLAG : aStr.AppendAscii("Flag"); break; 136 case ITEM_STRING : aStr.AppendAscii("String"); break; 137 case ITEM_POINT : aStr.AppendAscii("Point"); break; 138 case ITEM_RECT : aStr.AppendAscii("Rectangle");break; 139 case ITEM_RANGE : aStr.AppendAscii("Range"); break; 140 case ITEM_LRANGE : aStr.AppendAscii("LRange"); break; 141 case ITEM_FRACTION : aStr.AppendAscii("Fraction"); break; 142 case ITEM_XCOLOR : aStr.AppendAscii("XColor"); break; 143 case ITEM_COLOR : aStr.AppendAscii("Color"); break; 144 case ITEM_FONT : aStr.AppendAscii("Font"); break; 145 case ITEM_FONTHEIGHT:aStr.AppendAscii("FontHeight");break; 146 case ITEM_FONTWIDTH :aStr.AppendAscii("FontWidth"); break; 147 case ITEM_FIELD :aStr.AppendAscii("Field"); break; 148 default: break; 149 } 150 151 return aStr; 152 } 153 154 sal_Bool ImpItemListRow::operator==(const ImpItemListRow& rEntry) const 155 { 156 return (aName.Equals(rEntry.aName) 157 && aValue.Equals(rEntry.aValue) 158 && eState==rEntry.eState 159 && nWhichId==rEntry.nWhichId 160 && bComment==rEntry.bComment 161 && bIsNum==rEntry.bIsNum 162 && bCanNum==rEntry.bCanNum 163 && pType==rEntry.pType 164 && eItemType==rEntry.eItemType 165 && nVal==rEntry.nVal 166 && nMin==rEntry.nMin 167 && nMax==rEntry.nMax); 168 } 169 170 //////////////////////////////////////////////////////////////////////////////////////////////////// 171 172 class ImpItemEdit: public Edit 173 { 174 _SdrItemBrowserControl* pBrowse; 175 176 public: 177 ImpItemEdit(Window* pParent, _SdrItemBrowserControl* pBrowse_, WinBits nBits=0) 178 : Edit(pParent, nBits), 179 pBrowse(pBrowse_) 180 {} 181 182 virtual ~ImpItemEdit(); 183 virtual void KeyInput(const KeyEvent& rEvt); 184 }; 185 186 __EXPORT ImpItemEdit::~ImpItemEdit() 187 { 188 } 189 190 void __EXPORT ImpItemEdit::KeyInput(const KeyEvent& rKEvt) 191 { 192 _SdrItemBrowserControl* pBrowseMerk = pBrowse; 193 194 sal_uInt16 nKeyCode(rKEvt.GetKeyCode().GetCode() + rKEvt.GetKeyCode().GetModifier()); 195 196 if(nKeyCode == KEY_RETURN) 197 { 198 pBrowseMerk->EndChangeEntry(); 199 pBrowseMerk->GrabFocus(); 200 } 201 else if(nKeyCode == KEY_ESCAPE) 202 { 203 pBrowseMerk->BrkChangeEntry(); 204 pBrowseMerk->GrabFocus(); 205 } 206 else if(nKeyCode == KEY_UP || nKeyCode == KEY_DOWN) 207 { 208 pBrowseMerk->EndChangeEntry(); 209 pBrowseMerk->GrabFocus(); 210 pBrowseMerk->KeyInput(rKEvt); 211 } 212 else 213 Edit::KeyInput(rKEvt); 214 } 215 216 //////////////////////////////////////////////////////////////////////////////////////////////////// 217 218 #define MYBROWSEMODE (BROWSER_THUMBDRAGGING|BROWSER_KEEPHIGHLIGHT|BROWSER_NO_HSCROLL|BROWSER_HIDECURSOR) 219 220 _SdrItemBrowserControl::_SdrItemBrowserControl(Window* pParent, WinBits nBits): 221 BrowseBox(pParent,nBits,MYBROWSEMODE), 222 aList(1024,16,16) 223 { 224 ImpCtor(); 225 } 226 227 __EXPORT _SdrItemBrowserControl::~_SdrItemBrowserControl() 228 { 229 if(pEditControl) 230 delete pEditControl; 231 232 if(pAktChangeEntry) 233 delete pAktChangeEntry; 234 235 Clear(); 236 } 237 238 void _SdrItemBrowserControl::ImpCtor() 239 { 240 pEditControl = NULL; 241 pAktChangeEntry = NULL; 242 nLastWhichOfs = 0; 243 nLastWhich = 0; 244 nLastWhichOben = 0; // not implemented yet 245 nLastWhichUnten = 0; // not implemented yet 246 bWhichesButNames = sal_False; 247 bDontHideIneffectiveItems = sal_False; 248 bDontSortItems = sal_False; 249 bShowWhichIds = sal_False; 250 bShowRealValues = sal_False; 251 bShowWhichIds = sal_True; // not implemented yet 252 bShowRealValues = sal_True; // not implemented yet 253 254 rtl_TextEncoding aTextEncoding = gsl_getSystemTextEncoding(); 255 256 InsertDataColumn( 257 ITEMBROWSER_WHICHCOL_ID, 258 String("Which", aTextEncoding), 259 GetTextWidth(String(" Which ", aTextEncoding)) + 2); 260 InsertDataColumn( 261 ITEMBROWSER_STATECOL_ID, 262 String("State", aTextEncoding), 263 Max(GetTextWidth(String(" State ", aTextEncoding)) + 2 , 264 GetTextWidth(String("DontCare", aTextEncoding)) + 2)); 265 InsertDataColumn( 266 ITEMBROWSER_TYPECOL_ID , 267 String("Type", aTextEncoding), 268 GetTextWidth(String(" Type_ ", aTextEncoding)) + 2); 269 InsertDataColumn( 270 ITEMBROWSER_NAMECOL_ID , 271 String("Name", aTextEncoding), 272 150); 273 InsertDataColumn( 274 ITEMBROWSER_VALUECOL_ID, 275 String("Value", aTextEncoding), 276 GetTextWidth(String("12345678901234567890", aTextEncoding))); 277 SetDataRowHeight( 278 GetTextHeight()); 279 280 long nWdt=GetColumnWidth(ITEMBROWSER_WHICHCOL_ID)+ 281 GetColumnWidth(ITEMBROWSER_STATECOL_ID)+ 282 GetColumnWidth(ITEMBROWSER_TYPECOL_ID )+ 283 GetColumnWidth(ITEMBROWSER_NAMECOL_ID )+ 284 GetColumnWidth(ITEMBROWSER_VALUECOL_ID); 285 286 long nHgt=GetTitleHeight()+16*GetDataRowHeight(); 287 288 SetOutputSizePixel(Size(nWdt,nHgt)); 289 } 290 291 void _SdrItemBrowserControl::Clear() 292 { 293 sal_uIntPtr nAnz=aList.Count(); 294 for (sal_uIntPtr nNum=0; nNum<nAnz; nNum++) { 295 delete ImpGetEntry(nNum); 296 } 297 aList.Clear(); 298 BrowseBox::Clear(); 299 } 300 301 long __EXPORT _SdrItemBrowserControl::GetRowCount() const 302 { 303 return aList.Count(); 304 } 305 306 sal_Bool __EXPORT _SdrItemBrowserControl::SeekRow(long nRow) 307 { 308 nAktPaintRow=nRow; 309 return sal_True; 310 } 311 312 String _SdrItemBrowserControl::GetCellText(long _nRow, sal_uInt16 _nColId) const 313 { 314 String sRet; 315 if ( _nRow >= 0 && _nRow < (sal_Int32)aList.Count() ) 316 { 317 ImpItemListRow* pEntry = ImpGetEntry(_nRow); 318 if ( pEntry ) 319 { 320 if ( pEntry->bComment ) 321 { 322 if (_nColId == ITEMBROWSER_NAMECOL_ID) 323 sRet = pEntry->aName; 324 } 325 else 326 { 327 rtl_TextEncoding aTextEncoding = gsl_getSystemTextEncoding(); 328 329 sRet = XubString("???", aTextEncoding); 330 switch (_nColId) 331 { 332 case ITEMBROWSER_WHICHCOL_ID: 333 sRet = UniString::CreateFromInt32(pEntry->nWhichId); break; 334 case ITEMBROWSER_STATECOL_ID: 335 { 336 switch (pEntry->eState) 337 { 338 case SFX_ITEM_UNKNOWN : sRet=String("Uknown", aTextEncoding); break; 339 case SFX_ITEM_DISABLED: sRet=String("Disabled", aTextEncoding); break; 340 case SFX_ITEM_DONTCARE: sRet=String("DontCare", aTextEncoding); break; 341 case SFX_ITEM_SET : sRet=String("Set", aTextEncoding); break; 342 case SFX_ITEM_DEFAULT : sRet=String("Default", aTextEncoding); break; 343 } // switch 344 } break; 345 case ITEMBROWSER_TYPECOL_ID: sRet = pEntry->GetItemTypeStr(); break; 346 case ITEMBROWSER_NAMECOL_ID: sRet = pEntry->aName; break; 347 case ITEMBROWSER_VALUECOL_ID: sRet = pEntry->aValue; break; 348 } // switch 349 } 350 } 351 } 352 return sRet; 353 } 354 355 void __EXPORT _SdrItemBrowserControl::PaintField(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId) const 356 { 357 if (nAktPaintRow<0 || (sal_uIntPtr)nAktPaintRow>=aList.Count()) { 358 return; 359 } 360 Rectangle aR(rRect); 361 aR.Bottom()++; 362 ImpItemListRow* pEntry=ImpGetEntry(nAktPaintRow); 363 if (pEntry->bComment) 364 { 365 if (nColumnId==ITEMBROWSER_NAMECOL_ID) 366 { 367 rDev.SetLineColor(); 368 rDev.SetFillColor( Color( COL_LIGHTGRAY ) ); 369 aR.Left()=0; 370 aR.Right()=rDev.GetOutputSize().Width(); 371 rDev.DrawRect(aR); 372 rDev.DrawText(rRect.TopLeft(),pEntry->aName); 373 } 374 } else { 375 rDev.SetClipRegion(aR); 376 rDev.DrawText(aR.TopLeft(),GetCellText(nAktPaintRow,nColumnId)); 377 rDev.SetClipRegion(); 378 } 379 } 380 381 sal_uIntPtr _SdrItemBrowserControl::GetCurrentPos() const 382 { 383 sal_uIntPtr nRet=CONTAINER_ENTRY_NOTFOUND; 384 if (GetSelectRowCount()==1) { 385 long nPos=((BrowseBox*)this)->FirstSelectedRow(); 386 if (nPos>=0 && (sal_uIntPtr)nPos<aList.Count()) { 387 nRet=(sal_uIntPtr)nPos; 388 } 389 } 390 return nRet; 391 } 392 393 sal_uInt16 _SdrItemBrowserControl::GetCurrentWhich() const 394 { 395 sal_uInt16 nRet=0; 396 sal_uIntPtr nPos=GetCurrentPos(); 397 if (nPos!=CONTAINER_ENTRY_NOTFOUND) { 398 nRet=ImpGetEntry(nPos)->nWhichId; 399 } 400 return nRet; 401 } 402 403 void __EXPORT _SdrItemBrowserControl::DoubleClick(const BrowserMouseEvent&) 404 { 405 sal_uIntPtr nPos=GetCurrentPos(); 406 if (nPos!=CONTAINER_ENTRY_NOTFOUND) { 407 BegChangeEntry(nPos); 408 } 409 } 410 411 void __EXPORT _SdrItemBrowserControl::KeyInput(const KeyEvent& rKEvt) 412 { 413 sal_uInt16 nKeyCode=rKEvt.GetKeyCode().GetCode()+rKEvt.GetKeyCode().GetModifier(); 414 FASTBOOL bAusgewertet=sal_False; 415 sal_uIntPtr nPos=GetCurrentPos(); 416 if (nPos!=CONTAINER_ENTRY_NOTFOUND) { 417 if (nKeyCode==KEY_RETURN) { 418 if (BegChangeEntry(nPos)) bAusgewertet=sal_True; 419 } else if (nKeyCode==KEY_ESCAPE) { 420 // ... 421 } else if (rKEvt.GetKeyCode().GetModifier()==KEY_SHIFT+KEY_MOD1+KEY_MOD2) { // Strg 422 if (nKeyCode==KEY_SHIFT+KEY_MOD1+KEY_MOD2+KEY_W) { 423 bWhichesButNames=!bWhichesButNames; 424 SetDirty(); 425 } 426 if (nKeyCode==KEY_SHIFT+KEY_MOD1+KEY_MOD2+KEY_I) { 427 bDontHideIneffectiveItems=!bDontHideIneffectiveItems; 428 SetDirty(); 429 } 430 if (nKeyCode==KEY_SHIFT+KEY_MOD1+KEY_MOD2+KEY_S) { 431 bDontSortItems=!bDontSortItems; 432 SetDirty(); 433 } 434 } 435 } 436 if (!bAusgewertet) BrowseBox::KeyInput(rKEvt); 437 } 438 439 void _SdrItemBrowserControl::SetDirty() 440 { 441 aSetDirtyHdl.Call(this); 442 } 443 444 Rectangle _SdrItemBrowserControl::GetFieldCharacterBounds(sal_Int32 /*_nRow*/,sal_Int32 /*_nColumnPos*/,sal_Int32 /*nIndex*/) 445 { 446 // no accessibility implementation required 447 return Rectangle(); 448 } 449 450 sal_Int32 _SdrItemBrowserControl::GetFieldIndexAtPoint(sal_Int32 /*_nRow*/,sal_Int32 /*_nColumnPos*/,const Point& /*_rPoint*/) 451 { 452 // no accessibility implementation required 453 return -1; 454 } 455 456 void __EXPORT _SdrItemBrowserControl::Select() 457 { 458 EndChangeEntry(); 459 BrowseBox::Select(); 460 ImpSaveWhich(); 461 } 462 463 void _SdrItemBrowserControl::ImpSaveWhich() 464 { 465 sal_uInt16 nWh=GetCurrentWhich(); 466 if (nWh!=0) { 467 long nPos=GetCurrentPos(); 468 long nTop=GetTopRow(); 469 long nBtm=GetTopRow()+GetVisibleRows()+1; 470 nLastWhich=nWh; 471 nLastWhichOfs=nPos-nTop; 472 if (nTop<0) nTop=0; 473 if (nBtm>=(long)aList.Count()) nBtm=aList.Count()-1; 474 nLastWhichOben=ImpGetEntry(nTop)->nWhichId; 475 nLastWhichUnten=ImpGetEntry(nBtm)->nWhichId; 476 } 477 } 478 479 void _SdrItemBrowserControl::ImpRestoreWhich() 480 { 481 if (nLastWhich!=0) { 482 FASTBOOL bFnd=sal_False; 483 sal_uInt16 nBestMinWh=0,nBestMaxWh=0xFFFF; // not implemented yet 484 sal_uIntPtr nBestMinPos=0,nBestMaxPos=0xFFFFFFFF; // not implemented yet 485 sal_uIntPtr nAnz=aList.Count(); 486 sal_uIntPtr nNum; 487 for (nNum=0; nNum<nAnz && !bFnd; nNum++) { 488 ImpItemListRow* pEntry=ImpGetEntry(nNum); 489 if (!pEntry->bComment) { 490 sal_uInt16 nWh=pEntry->nWhichId; 491 if (nWh==nLastWhich) bFnd=sal_True; 492 else if (nWh<nLastWhich && nWh>nBestMinWh) nBestMinPos=nNum; 493 else if (nWh>nLastWhich && nWh<nBestMaxWh) nBestMaxPos=nNum; 494 } 495 } 496 if (bFnd) { 497 long nPos=nNum-1; 498 long nWhichOfs=nPos-GetTopRow(); 499 if (nWhichOfs!=nLastWhichOfs) { 500 ScrollRows(nWhichOfs-nLastWhichOfs); 501 } 502 GoToRow(nPos); 503 } 504 } 505 } 506 507 FASTBOOL _SdrItemBrowserControl::BegChangeEntry(sal_uIntPtr nPos) 508 { 509 BrkChangeEntry(); 510 FASTBOOL bRet=sal_False; 511 ImpItemListRow* pEntry=ImpGetEntry(nPos); 512 if (pEntry!=NULL && !pEntry->bComment) { 513 SetMode(MYBROWSEMODE & ~BROWSER_KEEPHIGHLIGHT); 514 pEditControl=new ImpItemEdit(&GetDataWindow(),this,0/*|WB_BORDER|WB_3DLOOK*/); 515 Rectangle aRect(GetFieldRectPixel(nPos,ITEMBROWSER_VALUECOL_ID,sal_False)); 516 aRect.Left()+=2; // Kleiner Offset fuer's Edit, damit's pixelgenau stimmt 517 aRect.Right()--; 518 pEditControl->SetPosSizePixel(aRect.TopLeft(),aRect.GetSize()); 519 pEditControl->SetText(pEntry->aValue); 520 pEditControl->SetBackground( Wallpaper(Color(COL_LIGHTGRAY))); 521 Font aFont(pEditControl->GetFont()); 522 aFont.SetFillColor(Color(COL_LIGHTGRAY)); 523 pEditControl->SetFont(aFont); 524 pEditControl->Show(); 525 pEditControl->GrabFocus(); 526 pEditControl->SetSelection(Selection(SELECTION_MIN,SELECTION_MAX)); 527 Window* pParent=GetParent(); 528 aWNamMerk=pParent->GetText(); 529 XubString aNeuNam(aWNamMerk); 530 aNeuNam += sal_Unicode(' '); 531 aNeuNam += pEntry->GetItemTypeStr(); 532 if (pEntry->bCanNum) { 533 aNeuNam.AppendAscii(": "); 534 aNeuNam += UniString::CreateFromInt32(pEntry->nMin); 535 aNeuNam.AppendAscii(".."); 536 aNeuNam += UniString::CreateFromInt32(pEntry->nMax); 537 } 538 aNeuNam.AppendAscii(" - Type 'del' to reset to default."); 539 pParent->SetText(aNeuNam); 540 pAktChangeEntry=new ImpItemListRow(*pEntry); 541 bRet=sal_True; 542 } 543 return bRet; 544 } 545 546 FASTBOOL _SdrItemBrowserControl::EndChangeEntry() 547 { 548 FASTBOOL bRet=sal_False; 549 if (pEditControl!=NULL) { 550 aEntryChangedHdl.Call(this); 551 delete pEditControl; 552 pEditControl=NULL; 553 delete pAktChangeEntry; 554 pAktChangeEntry=NULL; 555 Window* pParent=GetParent(); 556 pParent->SetText(aWNamMerk); 557 SetMode(MYBROWSEMODE); 558 bRet=sal_True; 559 } 560 return bRet; 561 } 562 563 void _SdrItemBrowserControl::BrkChangeEntry() 564 { 565 if (pEditControl!=NULL) { 566 delete pEditControl; 567 pEditControl=NULL; 568 delete pAktChangeEntry; 569 pAktChangeEntry=NULL; 570 Window* pParent=GetParent(); 571 pParent->SetText(aWNamMerk); 572 SetMode(MYBROWSEMODE); 573 } 574 } 575 576 void _SdrItemBrowserControl::ImpSetEntry(const ImpItemListRow& rEntry, sal_uIntPtr nEntryNum) 577 { 578 ImpItemListRow* pAktEntry=ImpGetEntry(nEntryNum); 579 if (pAktEntry==NULL) { 580 aList.Insert(new ImpItemListRow(rEntry),CONTAINER_APPEND); 581 RowInserted(nEntryNum); 582 } else if (*pAktEntry!=rEntry) { 583 FASTBOOL bStateDiff=rEntry.eState!=pAktEntry->eState; 584 FASTBOOL bValueDiff=!rEntry.aValue.Equals(pAktEntry->aValue); 585 FASTBOOL bAllDiff=sal_True; 586 if (bStateDiff || bValueDiff) { 587 // Checken, ob nur State und/oder Value geaendert 588 ImpItemListRow aTest(rEntry); 589 aTest.eState=pAktEntry->eState; 590 aTest.aValue=pAktEntry->aValue; 591 if (aTest==*pAktEntry) bAllDiff=sal_False; 592 } 593 *pAktEntry=rEntry; 594 if (bAllDiff) { 595 RowModified(nEntryNum); 596 } else { 597 if (bStateDiff) RowModified(nEntryNum,ITEMBROWSER_STATECOL_ID); 598 if (bValueDiff) RowModified(nEntryNum,ITEMBROWSER_VALUECOL_ID); 599 } 600 } 601 } 602 603 FASTBOOL ImpGetItem(const SfxItemSet& rSet, sal_uInt16 nWhich, const SfxPoolItem*& rpItem) 604 { 605 SfxItemState eState=rSet.GetItemState(nWhich,sal_True,&rpItem); 606 if (eState==SFX_ITEM_DEFAULT) { 607 rpItem=&rSet.Get(nWhich); 608 } 609 return (eState==SFX_ITEM_DEFAULT || eState==SFX_ITEM_SET) && rpItem!=NULL; 610 } 611 612 FASTBOOL IsItemIneffective(sal_uInt16 nWhich, const SfxItemSet* pSet, sal_uInt16& rIndent) 613 { 614 rIndent=0; 615 if (pSet==NULL) return sal_False; 616 const SfxPoolItem* pItem=NULL; 617 FASTBOOL bRet=sal_False; 618 switch (nWhich) { 619 case XATTR_LINEDASH : 620 case XATTR_LINEWIDTH : 621 case XATTR_LINECOLOR : 622 case XATTR_LINESTART : 623 case XATTR_LINEEND : 624 case XATTR_LINESTARTWIDTH : 625 case XATTR_LINEENDWIDTH : 626 case XATTR_LINESTARTCENTER : 627 case XATTR_LINEENDCENTER : 628 case XATTR_LINETRANSPARENCE : { 629 rIndent=1; 630 if (ImpGetItem(*pSet,XATTR_LINESTYLE,pItem)) { 631 XLineStyle eLineStyle=((const XLineStyleItem*)pItem)->GetValue(); 632 if (eLineStyle==XLINE_NONE) return sal_True; 633 if (eLineStyle!=XLINE_DASH && nWhich==XATTR_LINEDASH) return sal_True; 634 } 635 if (nWhich==XATTR_LINESTART || nWhich==XATTR_LINESTARTCENTER) { 636 rIndent=2; 637 if (ImpGetItem(*pSet,XATTR_LINESTARTWIDTH,pItem)) { 638 sal_Int32 nWdt=((const XLineStartWidthItem*)pItem)->GetValue(); 639 if (nWdt==0) return sal_True; 640 } 641 } 642 if (nWhich==XATTR_LINEEND || nWhich==XATTR_LINEENDCENTER) { 643 rIndent=2; 644 if (ImpGetItem(*pSet,XATTR_LINEENDWIDTH,pItem)) { 645 sal_Int32 nWdt=((const XLineEndWidthItem*)pItem)->GetValue(); 646 if (nWdt==0) return sal_True; 647 } 648 } 649 } break; 650 case XATTR_FILLCOLOR : /*nur bei Style=Color*/ 651 case XATTR_FILLGRADIENT : /*nur bei Style=Gradient*/ 652 case XATTR_FILLHATCH : /*nur bei Style=Hatch*/ 653 case XATTR_FILLTRANSPARENCE : /*nur bei Style=Color*/ 654 case XATTR_GRADIENTSTEPCOUNT : /*nur bei Style=Gradient*/ 655 case XATTR_FILLBACKGROUND : /*nur bei Style=Hatch*/ 656 { 657 rIndent=1; 658 if (ImpGetItem(*pSet,XATTR_FILLSTYLE,pItem)) { 659 XFillStyle eFillStyle=((const XFillStyleItem*)pItem)->GetValue(); 660 if (eFillStyle==XFILL_NONE) return sal_True; 661 // Transparenz z.Zt. nur fuer SolidFill 662 if (eFillStyle!=XFILL_SOLID && (nWhich==XATTR_FILLCOLOR || nWhich==XATTR_FILLTRANSPARENCE)) return sal_True; 663 if (eFillStyle!=XFILL_GRADIENT && (nWhich==XATTR_FILLGRADIENT || nWhich==XATTR_GRADIENTSTEPCOUNT)) return sal_True; 664 if (eFillStyle!=XFILL_HATCH && (nWhich==XATTR_FILLHATCH || nWhich==XATTR_FILLBACKGROUND)) return sal_True; 665 } 666 } break; 667 case XATTR_FILLBITMAP : 668 case XATTR_FILLBMP_TILE : 669 case XATTR_FILLBMP_POS : /* z.Zt. nur wenn TILE=sal_True */ 670 case XATTR_FILLBMP_SIZEX : /* nur wenn nicht Stretch */ 671 case XATTR_FILLBMP_SIZEY : /* nur wenn nicht Stretch */ 672 case XATTR_FILLBMP_SIZELOG : /* nur wenn SIZELOG=sal_False zum ruecksetzen auf sal_True (alt) -> doch noch in Gebrauch */ 673 case XATTR_FILLBMP_TILEOFFSETX : /* nur wenn TILE=sal_True */ 674 case XATTR_FILLBMP_TILEOFFSETY : /* nur wenn TILE=sal_True */ 675 case XATTR_FILLBMP_STRETCH : /* nur wenn TILE=sal_False */ 676 case XATTR_FILLBMP_POSOFFSETX : /* nur wenn TILE=sal_True*/ 677 case XATTR_FILLBMP_POSOFFSETY : { /* nur wenn TILE=sal_True*/ 678 rIndent=1; 679 if (ImpGetItem(*pSet,XATTR_FILLSTYLE,pItem)) { 680 XFillStyle eFillStyle=((const XFillStyleItem*)pItem)->GetValue(); 681 if (eFillStyle!=XFILL_BITMAP) return sal_True; 682 } 683 if (nWhich==XATTR_FILLBITMAP || nWhich==XATTR_FILLBMP_TILE) { 684 return sal_False; // immer anwaehlbar 685 } 686 FASTBOOL bTileTRUE=sal_False; 687 FASTBOOL bTileFALSE=sal_False; 688 FASTBOOL bStretchTRUE=sal_False; 689 FASTBOOL bStretchFALSE=sal_False; 690 if (ImpGetItem(*pSet,XATTR_FILLBMP_TILE,pItem)) { 691 bTileTRUE=((const XFillBmpTileItem*)pItem)->GetValue(); 692 bTileFALSE=!bTileTRUE; 693 } 694 if (ImpGetItem(*pSet,XATTR_FILLBMP_STRETCH,pItem)) { 695 bStretchTRUE=((const XFillBmpStretchItem*)pItem)->GetValue(); 696 bStretchFALSE=!bStretchTRUE; 697 } 698 // Stretch nicht anwaehlbar, wenn Tile=TRUE 699 if (nWhich==XATTR_FILLBMP_STRETCH) return bTileTRUE; 700 // und uebrig bleiben 7+1 Item (Unterattribute) 701 rIndent=2; 702 // Pos (enum) nicht anwaehlbar, wenn Tile=FALSE 703 if (nWhich==XATTR_FILLBMP_POS) return bTileFALSE; 704 // SizeXY nicht anwaehlbar bei Stretch=TRUE 705 if (nWhich==XATTR_FILLBMP_SIZEX || nWhich==XATTR_FILLBMP_SIZEY) { 706 return bTileFALSE && bStretchTRUE; 707 } 708 // 2 Items speziell fuer Tile 709 if (nWhich==XATTR_FILLBMP_POSOFFSETX || nWhich==XATTR_FILLBMP_POSOFFSETY) { 710 return bTileFALSE; 711 } 712 // Noch 2 Items speziell fuer Tile die sich jedoch gegenseitig ausschliessen 713 if (nWhich==XATTR_FILLBMP_TILEOFFSETX || nWhich==XATTR_FILLBMP_TILEOFFSETY) { 714 if (bTileFALSE) return sal_True; 715 sal_uInt16 nX=0,nY=0; 716 FASTBOOL bX=sal_False,bY=sal_False; 717 if (ImpGetItem(*pSet,XATTR_FILLBMP_TILEOFFSETX,pItem)) { 718 nX=((const XFillBmpTileOffsetXItem*)pItem)->GetValue(); 719 bX=sal_True; 720 } 721 if (ImpGetItem(*pSet,XATTR_FILLBMP_TILEOFFSETY,pItem)) { 722 nY=((const XFillBmpTileOffsetYItem*)pItem)->GetValue(); 723 bY=sal_True; 724 } 725 if (nWhich==XATTR_FILLBMP_TILEOFFSETX) { 726 if (nX!=0 || !bX) return sal_False; 727 if (nY!=0) return sal_True; 728 } else { 729 if (nY!=0 || !bY) return sal_False; 730 if (nX!=0) return sal_True; 731 } 732 } 733 // SizeLog nicht anwaehlbar bei Stretch=TRUE 734 // und sonst auch nur wenn es auf SizeLog=sal_False gesetzt ist. 735 // -> wohl doch noch in Gebrauch 736 // (sal_True ist der statische PoolDefault) 737 if (nWhich==XATTR_FILLBMP_SIZELOG) { 738 if (bTileFALSE && bStretchTRUE) return sal_True; 739 } 740 } break; 741 742 case XATTR_FORMTXTADJUST : 743 case XATTR_FORMTXTDISTANCE : 744 case XATTR_FORMTXTSTART : 745 case XATTR_FORMTXTMIRROR : 746 case XATTR_FORMTXTOUTLINE : 747 case XATTR_FORMTXTSHADOW : 748 case XATTR_FORMTXTSHDWCOLOR : 749 case XATTR_FORMTXTSHDWXVAL : 750 case XATTR_FORMTXTSHDWYVAL : 751 case XATTR_FORMTXTSTDFORM : 752 case XATTR_FORMTXTHIDEFORM : 753 case XATTR_FORMTXTSHDWTRANSP: { 754 rIndent=1; 755 if (ImpGetItem(*pSet,XATTR_FORMTXTSTYLE,pItem)) { 756 XFormTextStyle eStyle=((const XFormTextStyleItem*)pItem)->GetValue(); 757 if (eStyle==XFT_NONE) return sal_True; 758 } 759 if ((nWhich>=XATTR_FORMTXTSHDWCOLOR && nWhich<=XATTR_FORMTXTSHDWYVAL) || nWhich>=XATTR_FORMTXTSHDWTRANSP) { 760 rIndent=2; 761 if (ImpGetItem(*pSet,XATTR_FORMTXTSHADOW,pItem)) { 762 XFormTextShadow eShadow=((const XFormTextShadowItem*)pItem)->GetValue(); 763 if (eShadow==XFTSHADOW_NONE) return sal_True; 764 } 765 } 766 } break; 767 768 case SDRATTR_SHADOWCOLOR : 769 case SDRATTR_SHADOWXDIST : 770 case SDRATTR_SHADOWYDIST : 771 case SDRATTR_SHADOWTRANSPARENCE: 772 case SDRATTR_SHADOW3D : 773 case SDRATTR_SHADOWPERSP : { 774 rIndent=1; 775 if (ImpGetItem(*pSet,SDRATTR_SHADOW,pItem)) { 776 FASTBOOL bShadow=((const SdrShadowItem*)pItem)->GetValue(); 777 if (!bShadow) return sal_True; 778 } 779 } break; 780 781 case SDRATTR_CAPTIONANGLE: { 782 rIndent=1; 783 if (ImpGetItem(*pSet,SDRATTR_CAPTIONFIXEDANGLE,pItem)) { 784 FASTBOOL bFixed=((const SdrCaptionFixedAngleItem*)pItem)->GetValue(); 785 if (!bFixed) return sal_True; 786 } 787 } break; 788 case SDRATTR_CAPTIONESCREL: 789 case SDRATTR_CAPTIONESCABS: { 790 rIndent=1; 791 if (ImpGetItem(*pSet,SDRATTR_CAPTIONESCISREL,pItem)) { 792 FASTBOOL bRel=((const SdrCaptionEscIsRelItem*)pItem)->GetValue(); 793 if (bRel && nWhich==SDRATTR_CAPTIONESCABS) return sal_True; 794 if (!bRel && nWhich==SDRATTR_CAPTIONESCREL) return sal_True; 795 } 796 } break; 797 case SDRATTR_CAPTIONLINELEN: { 798 rIndent=1; 799 if (ImpGetItem(*pSet,SDRATTR_CAPTIONFITLINELEN,pItem)) { 800 FASTBOOL bFit=((const SdrCaptionFitLineLenItem*)pItem)->GetValue(); 801 if (bFit) return sal_True; 802 } 803 } break; 804 805 case SDRATTR_TEXT_MINFRAMEHEIGHT: 806 case SDRATTR_TEXT_MAXFRAMEHEIGHT: { 807 rIndent=1; 808 if (ImpGetItem(*pSet,SDRATTR_TEXT_AUTOGROWHEIGHT,pItem)) { 809 FASTBOOL bAutoGrow=((const SdrTextAutoGrowHeightItem*)pItem)->GetValue(); 810 if (!bAutoGrow) return sal_True; 811 } 812 } break; 813 case SDRATTR_TEXT_MINFRAMEWIDTH: 814 case SDRATTR_TEXT_MAXFRAMEWIDTH: { 815 rIndent=1; 816 if (ImpGetItem(*pSet,SDRATTR_TEXT_AUTOGROWWIDTH,pItem)) { 817 FASTBOOL bAutoGrow=((const SdrTextAutoGrowWidthItem*)pItem)->GetValue(); 818 if (!bAutoGrow) return sal_True; 819 } 820 } break; 821 case SDRATTR_TEXT_VERTADJUST: 822 case SDRATTR_TEXT_HORZADJUST: { 823 if (ImpGetItem(*pSet,SDRATTR_TEXT_FITTOSIZE,pItem)) { 824 SdrFitToSizeType eFit=((const SdrTextFitToSizeTypeItem*)pItem)->GetValue(); 825 if (eFit!=SDRTEXTFIT_NONE) return sal_True; 826 } 827 } break; 828 829 case SDRATTR_TEXT_ANIDIRECTION : 830 case SDRATTR_TEXT_ANISTARTINSIDE: 831 case SDRATTR_TEXT_ANISTOPINSIDE : 832 case SDRATTR_TEXT_ANICOUNT : 833 case SDRATTR_TEXT_ANIDELAY : 834 case SDRATTR_TEXT_ANIAMOUNT : { 835 rIndent=1; 836 if (ImpGetItem(*pSet,SDRATTR_TEXT_ANIKIND,pItem)) { 837 SdrTextAniKind eAniKind=((const SdrTextAniKindItem*)pItem)->GetValue(); 838 if (eAniKind==SDRTEXTANI_NONE) return sal_True; 839 if (eAniKind==SDRTEXTANI_BLINK && (nWhich==SDRATTR_TEXT_ANIDIRECTION || nWhich==SDRATTR_TEXT_ANIAMOUNT)) return sal_True; 840 if (eAniKind==SDRTEXTANI_SLIDE && (nWhich==SDRATTR_TEXT_ANISTARTINSIDE || nWhich==SDRATTR_TEXT_ANISTOPINSIDE)) return sal_True; 841 } 842 } break; 843 844 case SDRATTR_EDGELINEDELTAANZ: return sal_True; 845 case SDRATTR_EDGELINE1DELTA: 846 case SDRATTR_EDGELINE2DELTA: 847 case SDRATTR_EDGELINE3DELTA: { 848 if (ImpGetItem(*pSet,SDRATTR_EDGEKIND,pItem)) { 849 SdrEdgeKind eKind=((const SdrEdgeKindItem*)pItem)->GetValue(); 850 if (eKind==SDREDGE_THREELINES) { 851 if (nWhich>SDRATTR_EDGELINE2DELTA) return sal_True; 852 else return sal_False; 853 } 854 if (eKind!=SDREDGE_ORTHOLINES && eKind!=SDREDGE_BEZIER) return sal_True; 855 } 856 if (ImpGetItem(*pSet,SDRATTR_EDGELINEDELTAANZ,pItem)) { 857 sal_uInt16 nAnz=((const SdrEdgeLineDeltaAnzItem*)pItem)->GetValue(); 858 if (nAnz==0) return sal_True; 859 if (nAnz==1 && nWhich>SDRATTR_EDGELINE1DELTA) return sal_True; 860 if (nAnz==2 && nWhich>SDRATTR_EDGELINE2DELTA) return sal_True; 861 if (nAnz==3 && nWhich>SDRATTR_EDGELINE3DELTA) return sal_True; 862 } 863 } break; 864 865 case SDRATTR_CIRCSTARTANGLE: 866 case SDRATTR_CIRCENDANGLE : { 867 rIndent=1; 868 if (ImpGetItem(*pSet,SDRATTR_CIRCKIND,pItem)) { 869 SdrCircKind eKind=((const SdrCircKindItem*)pItem)->GetValue(); 870 if (eKind==SDRCIRC_FULL) return sal_True; 871 } 872 } break; 873 } // switch 874 return bRet; 875 } 876 877 sal_uInt16 ImpSortWhich(sal_uInt16 nWhich) 878 { 879 switch (nWhich) { 880 // Line 881 case XATTR_LINESTART : nWhich=XATTR_LINETRANSPARENCE ; break; 882 case XATTR_LINEEND : nWhich=XATTR_LINESTARTWIDTH ; break; 883 case XATTR_LINESTARTWIDTH : nWhich=XATTR_LINESTART ; break; 884 case XATTR_LINEENDWIDTH : nWhich=XATTR_LINESTARTCENTER ; break; 885 case XATTR_LINESTARTCENTER : nWhich=XATTR_LINEENDWIDTH ; break; 886 case XATTR_LINEENDCENTER : nWhich=XATTR_LINEEND ; break; 887 case XATTR_LINETRANSPARENCE : nWhich=XATTR_LINEENDCENTER ; break; 888 889 // Fill 890 case XATTR_FILLBMP_POS : nWhich=XATTR_FILLBMP_STRETCH ; break; 891 case XATTR_FILLBMP_SIZEX : nWhich=XATTR_FILLBMP_POS ; break; 892 case XATTR_FILLBMP_SIZEY : nWhich=XATTR_FILLBMP_SIZEX ; break; 893 case XATTR_FILLBMP_SIZELOG : nWhich=XATTR_FILLBMP_SIZEY ; break; 894 case XATTR_FILLBMP_TILEOFFSETX : nWhich=XATTR_FILLBMP_SIZELOG ; break; 895 case XATTR_FILLBMP_TILEOFFSETY : nWhich=XATTR_FILLBMP_TILEOFFSETX ; break; 896 case XATTR_FILLBMP_STRETCH : nWhich=XATTR_FILLBMP_TILEOFFSETY ; break; 897 898 // Fontwork 899 case XATTR_FORMTXTSHADOW : nWhich=XATTR_FORMTXTSTDFORM ; break; 900 case XATTR_FORMTXTSHDWCOLOR : nWhich=XATTR_FORMTXTHIDEFORM ; break; 901 case XATTR_FORMTXTSHDWXVAL : nWhich=XATTR_FORMTXTSHADOW ; break; 902 case XATTR_FORMTXTSHDWYVAL : nWhich=XATTR_FORMTXTSHDWCOLOR ; break; 903 case XATTR_FORMTXTSTDFORM : nWhich=XATTR_FORMTXTSHDWXVAL ; break; 904 case XATTR_FORMTXTHIDEFORM : nWhich=XATTR_FORMTXTSHDWYVAL ; break; 905 906 // Misc 907 case SDRATTR_TEXT_MINFRAMEHEIGHT: nWhich=SDRATTR_TEXT_FITTOSIZE ; break; 908 case SDRATTR_TEXT_AUTOGROWHEIGHT: nWhich=SDRATTR_TEXT_LEFTDIST ; break; 909 case SDRATTR_TEXT_FITTOSIZE : nWhich=SDRATTR_TEXT_RIGHTDIST ; break; 910 case SDRATTR_TEXT_LEFTDIST : nWhich=SDRATTR_TEXT_UPPERDIST ; break; 911 case SDRATTR_TEXT_RIGHTDIST : nWhich=SDRATTR_TEXT_LOWERDIST ; break; 912 case SDRATTR_TEXT_UPPERDIST : nWhich=SDRATTR_TEXT_AUTOGROWWIDTH ; break; 913 case SDRATTR_TEXT_LOWERDIST : nWhich=SDRATTR_TEXT_MINFRAMEWIDTH ; break; 914 case SDRATTR_TEXT_VERTADJUST : nWhich=SDRATTR_TEXT_MAXFRAMEWIDTH ; break; 915 case SDRATTR_TEXT_MAXFRAMEHEIGHT: nWhich=SDRATTR_TEXT_AUTOGROWHEIGHT; break; 916 case SDRATTR_TEXT_MINFRAMEWIDTH : nWhich=SDRATTR_TEXT_MINFRAMEHEIGHT; break; 917 case SDRATTR_TEXT_MAXFRAMEWIDTH : nWhich=SDRATTR_TEXT_MAXFRAMEHEIGHT; break; 918 case SDRATTR_TEXT_AUTOGROWWIDTH : nWhich=SDRATTR_TEXT_HORZADJUST ; break; 919 case SDRATTR_TEXT_HORZADJUST : nWhich=SDRATTR_TEXT_VERTADJUST ; break; 920 } // switch 921 return nWhich; 922 } 923 924 #define INSERTCOMMENT(nStartId,nEndId,aStr) \ 925 { if (nWhich0<nStartId && nWhich>=nStartId && nWhich<=nEndId) aCommentStr=aStr; } 926 927 void _SdrItemBrowserControl::SetAttributes(const SfxItemSet* pSet, const SfxItemSet* p2ndSet) 928 { 929 SetMode(MYBROWSEMODE & ~BROWSER_KEEPHIGHLIGHT); 930 if (pSet!=NULL) { 931 rtl_TextEncoding aTextEncoding = gsl_getSystemTextEncoding(); 932 sal_uInt16 nEntryNum=0; 933 SfxWhichIter aIter(*pSet); 934 const SfxItemPool* pPool=pSet->GetPool(); 935 sal_uInt16 nWhich0=0; 936 sal_uInt16 nWhich=aIter.FirstWhich(); 937 while (nWhich!=0) { 938 // Nun erstmal etwas umsortieren 939 // Geht nur, solange keine InvalidItems, d.h. keine Luecken 940 // an dieser Stelle im Set sind 941 if (!bDontSortItems) nWhich=ImpSortWhich(nWhich); 942 SfxItemState eState=pSet->GetItemState(nWhich); 943 if (p2ndSet!=NULL) { 944 SfxItemState e2ndState=p2ndSet->GetItemState(nWhich); 945 if (eState==SFX_ITEM_DEFAULT) eState=SFX_ITEM_DISABLED; 946 else if (e2ndState==SFX_ITEM_DEFAULT) eState=SFX_ITEM_DEFAULT; 947 } 948 if (eState!=SFX_ITEM_DISABLED) { 949 const SfxPoolItem& rItem=pSet->Get(nWhich); 950 sal_uInt16 nIndent=0; 951 if (!HAS_BASE(SfxVoidItem,&rItem) && !HAS_BASE(SfxSetItem,&rItem) && (!IsItemIneffective(nWhich,pSet,nIndent) || bDontHideIneffectiveItems)) { 952 XubString aCommentStr; 953 954 INSERTCOMMENT(XATTR_LINE_FIRST,XATTR_LINE_LAST,String("L I N I E", aTextEncoding)); 955 INSERTCOMMENT(XATTR_FILL_FIRST,XATTR_FILL_LAST,String("F L � C H E", aTextEncoding)); 956 INSERTCOMMENT(XATTR_TEXT_FIRST,XATTR_TEXT_LAST,String("F O N T W O R K", aTextEncoding)); 957 INSERTCOMMENT(SDRATTR_SHADOW_FIRST,SDRATTR_SHADOW_LAST,String("S C H A T T E N", aTextEncoding)); 958 INSERTCOMMENT(SDRATTR_CAPTION_FIRST,SDRATTR_CAPTION_LAST,String("L E G E N D E", aTextEncoding)); 959 INSERTCOMMENT(SDRATTR_MISC_FIRST,SDRATTR_MISC_LAST,String("V E R S C H I E D E N E S", aTextEncoding)); 960 INSERTCOMMENT(SDRATTR_EDGE_FIRST,SDRATTR_EDGE_LAST,String("V E R B I N D E R", aTextEncoding)); 961 INSERTCOMMENT(SDRATTR_MEASURE_FIRST,SDRATTR_MEASURE_LAST,String("B E M A S S U N G", aTextEncoding)); 962 INSERTCOMMENT(SDRATTR_CIRC_FIRST,SDRATTR_CIRC_LAST,String("K R E I S", aTextEncoding)); 963 INSERTCOMMENT(SDRATTR_NOTPERSIST_FIRST,SDRATTR_NOTPERSIST_LAST,String("N O T P E R S I S T", aTextEncoding)); 964 INSERTCOMMENT(SDRATTR_MOVEX,SDRATTR_VERTSHEARONE,String("Transformationen auf alle Objekte einzeln", aTextEncoding)); 965 INSERTCOMMENT(SDRATTR_RESIZEXALL,SDRATTR_VERTSHEARALL,String("Transformationen auf alle Objekte gemeinsam", aTextEncoding)); 966 INSERTCOMMENT(SDRATTR_TRANSFORMREF1X,SDRATTR_TRANSFORMREF2Y,String("View-Referenzpunkte", aTextEncoding)); 967 INSERTCOMMENT(SDRATTR_GRAF_FIRST,SDRATTR_GRAF_LAST,String("G R A F I K", aTextEncoding)); 968 INSERTCOMMENT(EE_ITEMS_START,EE_ITEMS_END,String("E D I T E N G I N E", aTextEncoding)); 969 INSERTCOMMENT(EE_ITEMS_END+1,EE_ITEMS_END+1,String("... by Joe Merten, JME Engineering Berlin ...", aTextEncoding)); 970 971 if(aCommentStr.Len()) 972 { 973 ImpItemListRow aEntry; 974 aEntry.bComment=sal_True; 975 aEntry.aName=aCommentStr; 976 ImpSetEntry(aEntry,nEntryNum); 977 nEntryNum++; 978 } 979 nWhich0=nWhich; 980 ImpItemListRow aEntry; 981 SdrItemPool::TakeItemName(nWhich, aEntry.aName); 982 nIndent*=2; 983 984 while(nIndent > 0) 985 { 986 aEntry.aName.Insert(sal_Unicode(' '), 0); 987 nIndent--; 988 } 989 990 aEntry.eState=eState; 991 aEntry.nWhichId=nWhich; 992 if (!IsInvalidItem(&rItem)) { 993 aEntry.pType=rItem.Type(); 994 aEntry.nMax=0x7FFFFFFF; 995 aEntry.nMin=-aEntry.nMax; 996 aEntry.nVal=-4711; 997 if (HAS_BASE(SfxByteItem ,&rItem)) aEntry.eItemType=ITEM_BYTE; 998 else if (HAS_BASE(SfxInt16Item ,&rItem)) aEntry.eItemType=ITEM_INT16; 999 else if (HAS_BASE(SfxUInt16Item ,&rItem)) aEntry.eItemType=ITEM_UINT16; 1000 else if (HAS_BASE(SfxInt32Item ,&rItem)) aEntry.eItemType=ITEM_INT32; 1001 else if (HAS_BASE(SfxUInt32Item ,&rItem)) aEntry.eItemType=ITEM_UINT32; 1002 else if (HAS_BASE(SfxEnumItemInterface,&rItem)) aEntry.eItemType=ITEM_ENUM; 1003 else if (HAS_BASE(SfxBoolItem ,&rItem)) aEntry.eItemType=ITEM_BOOL; 1004 else if (HAS_BASE(SfxFlagItem ,&rItem)) aEntry.eItemType=ITEM_FLAG; 1005 else if (HAS_BASE(XColorItem ,&rItem)) aEntry.eItemType=ITEM_XCOLOR; 1006 else if (HAS_BASE(SfxStringItem ,&rItem)) aEntry.eItemType=ITEM_STRING; 1007 else if (HAS_BASE(SfxPointItem ,&rItem)) aEntry.eItemType=ITEM_POINT; 1008 else if (HAS_BASE(SfxRectangleItem,&rItem)) aEntry.eItemType=ITEM_RECT; 1009 else if (HAS_BASE(SfxRangeItem ,&rItem)) aEntry.eItemType=ITEM_RANGE; 1010 else if (HAS_BASE(SdrFractionItem ,&rItem)) aEntry.eItemType=ITEM_FRACTION; 1011 else if (HAS_BASE(SvxColorItem ,&rItem)) aEntry.eItemType=ITEM_COLOR; 1012 else if (HAS_BASE(SvxFontItem ,&rItem)) aEntry.eItemType=ITEM_FONT; 1013 else if (HAS_BASE(SvxFontHeightItem,&rItem))aEntry.eItemType=ITEM_FONTHEIGHT; 1014 else if (HAS_BASE(SvxCharScaleWidthItem,&rItem)) aEntry.eItemType=ITEM_FONTWIDTH; 1015 else if (HAS_BASE(SvxFieldItem ,&rItem)) aEntry.eItemType=ITEM_FIELD; 1016 switch (aEntry.eItemType) { 1017 case ITEM_BYTE : aEntry.bIsNum=sal_True; aEntry.nVal=((SfxByteItem &)rItem).GetValue(); aEntry.nMin=0; aEntry.nMax=255; break; 1018 case ITEM_INT16 : aEntry.bIsNum=sal_True; aEntry.nVal=((SfxInt16Item &)rItem).GetValue(); aEntry.nMin=-32767; aEntry.nMax=32767; break; 1019 case ITEM_UINT16 : aEntry.bIsNum=sal_True; aEntry.nVal=((SfxUInt16Item&)rItem).GetValue(); aEntry.nMin=0; aEntry.nMax=65535; break; 1020 case ITEM_INT32 : aEntry.bIsNum=sal_True; aEntry.nVal=((SfxInt32Item &)rItem).GetValue(); break; 1021 case ITEM_UINT32 : aEntry.bIsNum=sal_True; aEntry.nVal=((SfxUInt32Item&)rItem).GetValue(); aEntry.nMin=0; /*aEntry.nMax=0xFF...*/;break; 1022 case ITEM_ENUM : aEntry.bCanNum=sal_True; aEntry.nVal=((SfxEnumItemInterface&)rItem).GetEnumValue(); aEntry.nMin=0; aEntry.nMax=((SfxEnumItemInterface&)rItem).GetValueCount()-1; break; 1023 case ITEM_BOOL : aEntry.bCanNum=sal_True; aEntry.nVal=((SfxBoolItem &)rItem).GetValue(); aEntry.nMin=0; aEntry.nMax=1; break; 1024 case ITEM_FLAG : aEntry.bCanNum=sal_True; aEntry.nVal=((SfxFlagItem &)rItem).GetValue(); aEntry.nMin=0; aEntry.nMax=0xFFFF; break; 1025 case ITEM_FONTHEIGHT: aEntry.bCanNum=sal_True; aEntry.nVal=((SvxFontHeightItem&)rItem).GetHeight(); aEntry.nMin=0; break; 1026 case ITEM_FONTWIDTH : aEntry.bCanNum=sal_True; aEntry.nVal=((SvxCharScaleWidthItem&)rItem).GetValue(); aEntry.nMin=0; aEntry.nMax=0xFFFF;break; 1027 default: break; 1028 } // switch 1029 if (aEntry.bIsNum) aEntry.bCanNum=sal_True; 1030 FASTBOOL bGetPres=sal_True; 1031 if (bGetPres) { 1032 rItem.GetPresentation(SFX_ITEM_PRESENTATION_NAMELESS, 1033 pPool->GetMetric(nWhich), 1034 SFX_MAPUNIT_MM,aEntry.aValue); 1035 if (aEntry.bCanNum) { 1036 aEntry.aValue.InsertAscii(": ",0); 1037 aEntry.aValue.Insert(UniString::CreateFromInt32(aEntry.nVal),0); 1038 } 1039 } else { 1040 if (aEntry.eItemType==ITEM_BOOL) aEntry.aValue.AppendAscii(aEntry.nVal!=0 ? "True" : "False"); 1041 else if (aEntry.bCanNum) aEntry.aValue = UniString::CreateFromInt32(aEntry.nVal); 1042 else if (aEntry.eItemType==ITEM_STRING) aEntry.aValue=((SfxStringItem&)rItem).GetValue(); 1043 else if (aEntry.eItemType==ITEM_ENUM && nWhich!=EE_CHAR_WEIGHT) aEntry.aValue=((SfxEnumItemInterface&)rItem).GetValueTextByPos((sal_Bool)aEntry.nVal); 1044 else aEntry.aValue = String("GPF", aTextEncoding); 1045 } 1046 } else { 1047 aEntry.aValue = String("InvalidItem", aTextEncoding); 1048 } 1049 ImpSetEntry(aEntry,nEntryNum); 1050 nEntryNum++; 1051 } 1052 } 1053 nWhich=aIter.NextWhich(); 1054 } // while 1055 1056 if (aList.Count()>nEntryNum) { // evtl. noch zuviele Eintraege 1057 sal_uIntPtr nTooMuch=aList.Count()-nEntryNum; 1058 for (sal_uIntPtr nNum=0; nNum<nTooMuch; nNum++) { 1059 delete ImpGetEntry(nEntryNum); 1060 aList.Remove(nEntryNum); 1061 } 1062 RowRemoved(nEntryNum,nTooMuch); 1063 } 1064 } else { 1065 Clear(); // wenn pSet==NULL 1066 } 1067 ImpRestoreWhich(); 1068 SetMode(MYBROWSEMODE); 1069 } 1070 1071 //////////////////////////////////////////////////////////////////////////////////////////////////// 1072 1073 _SdrItemBrowserWindow::_SdrItemBrowserWindow(Window* pParent, WinBits nBits): 1074 FloatingWindow(pParent,nBits), 1075 aBrowse(this) 1076 { 1077 SetOutputSizePixel(aBrowse.GetSizePixel()); 1078 SetText(String("Joe's ItemBrowser", gsl_getSystemTextEncoding())); 1079 aBrowse.Show(); 1080 } 1081 1082 __EXPORT _SdrItemBrowserWindow::~_SdrItemBrowserWindow() 1083 { 1084 } 1085 1086 void __EXPORT _SdrItemBrowserWindow::Resize() 1087 { 1088 aBrowse.SetSizePixel(GetOutputSizePixel()); 1089 } 1090 1091 void __EXPORT _SdrItemBrowserWindow::GetFocus() 1092 { 1093 aBrowse.GrabFocus(); 1094 } 1095 1096 //////////////////////////////////////////////////////////////////////////////////////////////////// 1097 1098 SdrItemBrowser::SdrItemBrowser(SdrView& rView): 1099 _SdrItemBrowserWindow(ImpGetViewWin(rView)), 1100 pView(&rView), 1101 bDirty(sal_False) 1102 { 1103 aIdleTimer.SetTimeoutHdl(LINK(this,SdrItemBrowser,IdleHdl)); 1104 GetBrowserControl().SetEntryChangedHdl(LINK(this,SdrItemBrowser,ChangedHdl)); 1105 GetBrowserControl().SetSetDirtyHdl(LINK(this,SdrItemBrowser,SetDirtyHdl)); 1106 SetDirty(); 1107 } 1108 1109 Window* SdrItemBrowser::ImpGetViewWin(SdrView& rView) 1110 { 1111 const sal_uInt32 nWinCount(rView.PaintWindowCount()); 1112 1113 for(sal_uInt32 a(0L); a < nWinCount; a++) 1114 { 1115 SdrPaintWindow* pCandidate = rView.GetPaintWindow(a); 1116 1117 if(OUTDEV_WINDOW == pCandidate->GetOutputDevice().GetOutDevType()) 1118 { 1119 return (Window*)(&pCandidate->GetOutputDevice()); 1120 } 1121 } 1122 1123 return 0L; 1124 } 1125 1126 void SdrItemBrowser::ForceParent() 1127 { 1128 Window* pWin=ImpGetViewWin(*pView); 1129 if (pWin!=NULL) SetParent(pWin); 1130 } 1131 1132 void SdrItemBrowser::SetDirty() 1133 { 1134 if (!bDirty) { 1135 bDirty=sal_True; 1136 aIdleTimer.SetTimeout(1); 1137 aIdleTimer.Start(); 1138 } 1139 } 1140 1141 void SdrItemBrowser::Undirty() 1142 { 1143 aIdleTimer.Stop(); 1144 bDirty = sal_False; 1145 1146 // SfxItemSet aSet(pView->GetAttributes()); 1147 SfxItemSet aSet(pView->GetModel()->GetItemPool()); 1148 pView->GetAttributes(aSet); 1149 1150 if(pView->AreObjectsMarked()) 1151 { 1152 // SfxItemSet a2ndSet(pView->GetAttributes(sal_True)); 1153 SfxItemSet a2ndSet(pView->GetModel()->GetItemPool()); 1154 pView->GetAttributes(a2ndSet, sal_True); 1155 1156 SetAttributes(&aSet,&a2ndSet); 1157 } 1158 else 1159 { 1160 SetAttributes(&aSet); 1161 } 1162 } 1163 1164 IMPL_LINK(SdrItemBrowser,IdleHdl,Timer*,EMPTYARG) 1165 { 1166 Undirty(); 1167 return 0; 1168 } 1169 1170 IMPL_LINK(SdrItemBrowser,ChangedHdl,_SdrItemBrowserControl*,pBrowse) 1171 { 1172 const ImpItemListRow* pEntry=pBrowse->GetAktChangeEntry(); 1173 if (pEntry!=NULL) 1174 { 1175 // SfxItemSet aSet(pView->GetAttributes()); 1176 SfxItemSet aSet(pView->GetModel()->GetItemPool()); 1177 pView->GetAttributes(aSet); 1178 1179 SfxItemSet aNewSet(*aSet.GetPool(),pEntry->nWhichId,pEntry->nWhichId); 1180 XubString aNewText(pBrowse->GetNewEntryValue()); 1181 sal_Bool bDel( aNewText.EqualsAscii("del") 1182 || aNewText.EqualsAscii("Del") 1183 || aNewText.EqualsAscii("DEL") 1184 || aNewText.EqualsAscii("default") 1185 || aNewText.EqualsAscii("Default") 1186 || aNewText.EqualsAscii("DEFAULT")); 1187 1188 if (!bDel) { 1189 SfxPoolItem* pNewItem=aSet.Get(pEntry->nWhichId).Clone(); 1190 long nLongVal=0; 1191 nLongVal = aNewText.ToInt32(); 1192 if (pEntry->bCanNum) { 1193 if (nLongVal>pEntry->nMax) nLongVal=pEntry->nMax; 1194 if (nLongVal<pEntry->nMin) nLongVal=pEntry->nMin; 1195 } 1196 FASTBOOL bPair=sal_False; 1197 FASTBOOL bPairX=sal_True; 1198 FASTBOOL bPairY=sal_False; 1199 sal_uInt16 nSepLen=1; 1200 long nLongX = aNewText.ToInt32(); 1201 long nLongY=0; 1202 xub_StrLen nPos = aNewText.Search(sal_Unicode('/')); 1203 if (nPos==STRING_NOTFOUND) nPos=aNewText.Search(sal_Unicode(':')); 1204 if (nPos==STRING_NOTFOUND) nPos=aNewText.Search(sal_Unicode(' ')); 1205 if (nPos==STRING_NOTFOUND) { nPos=aNewText.SearchAscii(".."); if (nPos!=STRING_NOTFOUND) nSepLen=2; } 1206 if (nPos!=STRING_NOTFOUND) { 1207 bPair=sal_True; 1208 bPairX=nPos>0; 1209 XubString s(aNewText); 1210 s.Erase(0,nPos+nSepLen); 1211 bPairY = (sal_Bool)aNewText.Len(); 1212 nLongY = s.ToInt32(); 1213 } 1214 switch (pEntry->eItemType) { 1215 case ITEM_BYTE : ((SfxByteItem *)pNewItem)->SetValue((sal_uInt8 )nLongVal); break; 1216 case ITEM_INT16 : ((SfxInt16Item *)pNewItem)->SetValue((sal_Int16 )nLongVal); break; 1217 case ITEM_UINT16: ((SfxUInt16Item*)pNewItem)->SetValue((sal_uInt16)nLongVal); break; 1218 case ITEM_INT32: { 1219 if(HAS_BASE(SdrAngleItem, pNewItem)) 1220 { 1221 aNewText.SearchAndReplace(sal_Unicode(','), sal_Unicode('.')); 1222 double nVal = aNewText.ToFloat(); 1223 nLongVal = (long)(nVal * 100 + 0.5); 1224 } 1225 ((SfxInt32Item *)pNewItem)->SetValue((sal_Int32)nLongVal); 1226 } break; 1227 case ITEM_UINT32: ((SfxUInt32Item*)pNewItem)->SetValue(aNewText.ToInt32()); break; 1228 case ITEM_ENUM : ((SfxEnumItemInterface*)pNewItem)->SetEnumValue((sal_uInt16)nLongVal); break; 1229 case ITEM_BOOL: { 1230 aNewText.ToUpperAscii(); 1231 if (aNewText.EqualsAscii("TRUE")) nLongVal=1; 1232 if (aNewText.EqualsAscii("JA")) nLongVal=1; 1233 if (aNewText.EqualsAscii("AN")) nLongVal=1; 1234 if (aNewText.EqualsAscii("EIN")) nLongVal=1; 1235 if (aNewText.EqualsAscii("ON")) nLongVal=1; 1236 if (aNewText.EqualsAscii("YES")) nLongVal=1; 1237 ((SfxBoolItem*)pNewItem)->SetValue((sal_Bool)nLongVal); 1238 } break; 1239 case ITEM_FLAG : ((SfxFlagItem *)pNewItem)->SetValue((sal_uInt16)nLongVal); break; 1240 case ITEM_STRING: ((SfxStringItem*)pNewItem)->SetValue(aNewText); break; 1241 case ITEM_POINT : ((SfxPointItem*)pNewItem)->SetValue(Point(nLongX,nLongY)); break; 1242 case ITEM_RECT : break; 1243 case ITEM_RANGE : { 1244 ((SfxRangeItem*)pNewItem)->From()=(sal_uInt16)nLongX; 1245 ((SfxRangeItem*)pNewItem)->From()=(sal_uInt16)nLongY; 1246 } break; 1247 case ITEM_LRANGE : { 1248 } break; 1249 case ITEM_FRACTION: { 1250 if (!bPairX) nLongX=1; 1251 if (!bPairY) nLongY=1; 1252 ((SdrFractionItem*)pNewItem)->SetValue(Fraction(nLongX,nLongY)); 1253 } break; 1254 case ITEM_XCOLOR: break; 1255 case ITEM_COLOR: break; 1256 case ITEM_FONT: { 1257 ((SvxFontItem*)pNewItem)->SetFamily( FAMILY_DONTKNOW ); 1258 ((SvxFontItem*)pNewItem)->SetFamilyName(aNewText); 1259 ((SvxFontItem*)pNewItem)->SetStyleName( String() ); 1260 } break; 1261 case ITEM_FONTHEIGHT: { 1262 sal_uIntPtr nHgt=0; 1263 sal_uInt16 nProp=100; 1264 if (aNewText.Search(sal_Unicode('%'))!=STRING_NOTFOUND) { 1265 nProp=(sal_uInt16)nLongVal; 1266 } else { 1267 nHgt=nLongVal; 1268 } 1269 ((SvxFontHeightItem*)pNewItem)->SetHeight(nHgt,nProp); 1270 } break; 1271 case ITEM_FONTWIDTH: { 1272 sal_uInt16 nProp=100; 1273 if (aNewText.Search(sal_Unicode('%'))!=STRING_NOTFOUND) { 1274 nProp=(sal_uInt16)nLongVal; 1275 } 1276 ((SvxCharScaleWidthItem*)pNewItem)->SetValue(nProp); 1277 } break; 1278 case ITEM_FIELD: break; 1279 default: break; 1280 } // switch 1281 aNewSet.Put(*pNewItem); 1282 delete pNewItem; 1283 } 1284 pView->SetAttributes(aNewSet,bDel); 1285 } 1286 return 0; 1287 } 1288 1289 IMPL_LINK(SdrItemBrowser,SetDirtyHdl,_SdrItemBrowserControl*,EMPTYARG) 1290 { 1291 SetDirty(); 1292 return 0; 1293 } 1294 1295 1296