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_sw.hxx" 26 27 28 #include <hintids.hxx> 29 #include <svl/whiter.hxx> 30 #include <svtools/imapobj.hxx> 31 #include <svl/srchitem.hxx> 32 #include <svtools/imap.hxx> 33 #include <sfx2/viewfrm.hxx> 34 #include <basic/sbstar.hxx> 35 #include <svl/rectitem.hxx> 36 #include <svl/ptitem.hxx> 37 #include <svl/stritem.hxx> 38 #include <editeng/colritem.hxx> 39 #include <editeng/bolnitem.hxx> 40 #include <editeng/boxitem.hxx> 41 #include <editeng/protitem.hxx> 42 #include <sfx2/dispatch.hxx> 43 #include <sfx2/request.hxx> 44 #include <sfx2/objface.hxx> 45 #include <sfx2/sidebar/EnumContext.hxx> 46 #include <svx/hlnkitem.hxx> 47 // --> OD 2009-07-07 #i73249# 48 #include <svx/svdview.hxx> 49 #include <vcl/msgbox.hxx> 50 // <-- 51 52 #include <doc.hxx> 53 #include <fmturl.hxx> 54 #include <fmtclds.hxx> 55 #include <fmtcnct.hxx> 56 #include <swmodule.hxx> 57 #include <wrtsh.hxx> 58 #include <wview.hxx> 59 #include <frmatr.hxx> 60 #include <uitool.hxx> 61 #include <frmfmt.hxx> 62 #include <frmsh.hxx> 63 #include <frmmgr.hxx> 64 #include <frmdlg.hxx> 65 #include <swevent.hxx> 66 #include <usrpref.hxx> 67 #include <edtwin.hxx> 68 #include <swdtflvr.hxx> 69 #include <swwait.hxx> 70 #include <docstat.hxx> 71 #include <IDocumentStatistics.hxx> 72 73 #include <comphelper/processfactory.hxx> 74 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> 75 76 #include <helpid.h> 77 #include <cmdid.h> 78 #include <cfgitems.hxx> 79 #include <globals.hrc> 80 #include <popup.hrc> 81 #include <shells.hrc> 82 #include "swabstdlg.hxx" 83 #include "misc.hrc" 84 // --> OD 2009-07-14 #i73249# 85 #include <svx/dialogs.hrc> 86 // <-- 87 88 using namespace ::com::sun::star; 89 using namespace ::com::sun::star::uno; 90 91 // Prototypen ------------------------------------------------------------ 92 93 void lcl_FrmGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine); 94 const SwFrmFmt* lcl_GetFrmFmtByName(SwWrtShell& rSh, const String& rName) 95 { 96 sal_uInt16 nCount = rSh.GetFlyCount(FLYCNTTYPE_FRM); 97 for( sal_uInt16 i = 0; i < nCount; i++) 98 { 99 const SwFrmFmt* pFmt = rSh.GetFlyNum(i, FLYCNTTYPE_FRM); 100 if(pFmt->GetName() == rName) 101 return pFmt; 102 } 103 return 0; 104 } 105 106 #define SwFrameShell 107 #include <sfx2/msg.hxx> 108 #include "swslots.hxx" 109 110 SFX_IMPL_INTERFACE(SwFrameShell, SwBaseShell, SW_RES(STR_SHELLNAME_FRAME)) 111 { 112 SFX_POPUPMENU_REGISTRATION(SW_RES(MN_FRM_POPUPMENU)); 113 SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_FRAME_TOOLBOX)); 114 } 115 116 117 118 void SwFrameShell::Execute(SfxRequest &rReq) 119 { 120 //Erstmal die, die keinen FrmMgr benoetigen. 121 SwWrtShell &rSh = GetShell(); 122 sal_Bool bMore = sal_False; 123 const SfxItemSet* pArgs = rReq.GetArgs(); 124 const SfxPoolItem* pItem; 125 sal_uInt16 nSlot = rReq.GetSlot(); 126 127 switch ( nSlot ) 128 { 129 case FN_FRAME_TO_ANCHOR: 130 if ( rSh.IsFrmSelected() ) 131 { 132 rSh.GotoFlyAnchor(); 133 rSh.EnterStdMode(); 134 rSh.CallChgLnk(); 135 } 136 break; 137 case SID_FRAME_TO_TOP: 138 rSh.SelectionToTop(); 139 break; 140 141 case SID_FRAME_TO_BOTTOM: 142 rSh.SelectionToBottom(); 143 break; 144 145 case FN_FRAME_UP: 146 rSh.SelectionToTop( sal_False ); 147 break; 148 149 case FN_FRAME_DOWN: 150 rSh.SelectionToBottom( sal_False ); 151 break; 152 case FN_INSERT_FRAME: 153 if (!pArgs) 154 { 155 // Rahmen existiert bereits, Rahmendialog zur Bearbeitung oeffnen 156 SfxUInt16Item aDefPage(FN_FORMAT_FRAME_DLG, TP_COLUMN); 157 rSh.GetView().GetViewFrame()->GetDispatcher()->Execute( FN_FORMAT_FRAME_DLG, 158 SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, 159 &aDefPage, 0L ); 160 161 } 162 else 163 { 164 // Rahmen existiert bereits, nur Spaltenanzahl wird geaendert 165 sal_uInt16 nCols = 1; 166 if(pArgs->GetItemState(SID_ATTR_COLUMNS, sal_False, &pItem) == SFX_ITEM_SET) 167 nCols = ((SfxUInt16Item *)pItem)->GetValue(); 168 169 SfxItemSet aSet(GetPool(),RES_COL,RES_COL); 170 rSh.GetFlyFrmAttr( aSet ); 171 SwFmtCol aCol((const SwFmtCol&)aSet.Get(RES_COL)); 172 // GutterWidth wird nicht immer uebergeben, daher erst besorgen (siehe view2: Execute auf diesen Slot) 173 sal_uInt16 nGutterWidth = aCol.GetGutterWidth(); 174 if(!nCols ) 175 nCols++; 176 aCol.Init(nCols, nGutterWidth, aCol.GetWishWidth()); 177 aSet.Put(aCol); 178 // Vorlagen-AutoUpdate 179 SwFrmFmt* pFmt = rSh.GetCurFrmFmt(); 180 if(pFmt && pFmt->IsAutoUpdateFmt()) 181 { 182 rSh.AutoUpdateFrame(pFmt, aSet); 183 } 184 else 185 { 186 rSh.StartAllAction(); 187 rSh.SetFlyFrmAttr( aSet ); 188 rSh.SetModified(); 189 rSh.EndAllAction(); 190 } 191 192 } 193 return; 194 195 case SID_HYPERLINK_SETLINK: 196 { 197 if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_HYPERLINK_SETLINK, sal_False, &pItem)) 198 { 199 const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem; 200 const String& rURL = rHLinkItem.GetURL(); 201 const String& rTarget = rHLinkItem.GetTargetFrame(); 202 203 SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL ); 204 rSh.GetFlyFrmAttr( aSet ); 205 SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) ); 206 207 String sOldName(rHLinkItem.GetName()); 208 String sFlyName(rSh.GetFlyName()); 209 if (sOldName.ToUpperAscii() != sFlyName.ToUpperAscii()) 210 { 211 String sName(sOldName); 212 sal_uInt16 i = 1; 213 while (rSh.FindFlyByName(sName)) 214 { 215 sName = sOldName; 216 sName += '_'; 217 sName += String::CreateFromInt32(i++); 218 } 219 rSh.SetFlyName(sName); 220 } 221 aURL.SetURL( rURL, sal_False ); 222 aURL.SetTargetFrameName(rTarget); 223 224 aSet.Put( aURL ); 225 rSh.SetFlyFrmAttr( aSet ); 226 } 227 } 228 break; 229 230 case FN_FRAME_CHAIN: 231 rSh.GetView().GetEditWin().SetChainMode( !rSh.GetView().GetEditWin().IsChainMode() ); 232 break; 233 234 case FN_FRAME_UNCHAIN: 235 rSh.Unchain( (SwFrmFmt&)*rSh.GetFlyFrmFmt() ); 236 GetView().GetViewFrame()->GetBindings().Invalidate(FN_FRAME_CHAIN); 237 break; 238 case FN_FORMAT_FOOTNOTE_DLG: 239 { 240 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 241 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 242 243 VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( GetView().GetWindow(), GetView().GetWrtShell(), DLG_DOC_FOOTNOTE ); 244 DBG_ASSERT(pDlg, "Dialogdiet fail!"); 245 pDlg->Execute(); 246 delete pDlg; 247 break; 248 } 249 case FN_NUMBERING_OUTLINE_DLG: 250 { 251 SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1); 252 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 253 DBG_ASSERT(pFact, "Dialogdiet fail!"); 254 SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE, 255 GetView().GetWindow(), &aTmp, GetView().GetWrtShell()); 256 DBG_ASSERT(pDlg, "Dialogdiet fail!"); 257 pDlg->Execute(); 258 delete pDlg; 259 rReq.Done(); 260 break; 261 } 262 case SID_OPEN_XML_FILTERSETTINGS: 263 { 264 try 265 { 266 uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.comp.ui.XSLTFilterDialog")), uno::UNO_QUERY); 267 if( xDialog.is() ) 268 { 269 xDialog->execute(); 270 } 271 } 272 catch( uno::Exception& ) 273 { 274 } 275 rReq.Ignore (); 276 } 277 break; 278 case FN_WORDCOUNT_DIALOG: 279 { 280 SwDocStat aCurr; 281 SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() ); 282 { 283 SwWait aWait( *GetView().GetDocShell(), sal_True ); 284 rSh.StartAction(); 285 rSh.CountWords( aCurr ); 286 rSh.UpdateDocStat( aDocStat ); 287 rSh.EndAction(); 288 } 289 290 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 291 DBG_ASSERT(pFact, "Dialogdiet fail!"); 292 AbstractSwWordCountDialog* pDialog = pFact->CreateSwWordCountDialog( GetView().GetWindow() ); 293 pDialog->SetValues(aCurr, aDocStat ); 294 pDialog->Execute(); 295 delete pDialog; 296 } 297 break; 298 default: bMore = sal_True; 299 } 300 301 if ( !bMore ) 302 { 303 return; 304 } 305 306 SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE ); 307 sal_Bool bUpdateMgr = sal_True; 308 sal_Bool bCopyToFmt = sal_False; 309 switch ( nSlot ) 310 { 311 case SID_OBJECT_ALIGN_MIDDLE: 312 case FN_FRAME_ALIGN_VERT_CENTER: 313 aMgr.SetVertOrientation( text::VertOrientation::CENTER ); 314 break; 315 case SID_OBJECT_ALIGN_DOWN : 316 case FN_FRAME_ALIGN_VERT_BOTTOM: 317 aMgr.SetVertOrientation( text::VertOrientation::BOTTOM ); 318 break; 319 case SID_OBJECT_ALIGN_UP : 320 case FN_FRAME_ALIGN_VERT_TOP: 321 aMgr.SetVertOrientation( text::VertOrientation::TOP ); 322 break; 323 324 case FN_FRAME_ALIGN_VERT_CHAR_CENTER: 325 aMgr.SetVertOrientation( text::VertOrientation::CHAR_CENTER ); 326 break; 327 328 case FN_FRAME_ALIGN_VERT_CHAR_BOTTOM: 329 aMgr.SetVertOrientation( text::VertOrientation::CHAR_BOTTOM ); 330 break; 331 332 case FN_FRAME_ALIGN_VERT_CHAR_TOP: 333 aMgr.SetVertOrientation( text::VertOrientation::CHAR_TOP ); 334 break; 335 336 case FN_FRAME_ALIGN_VERT_ROW_CENTER: 337 aMgr.SetVertOrientation( text::VertOrientation::LINE_CENTER ); 338 break; 339 340 case FN_FRAME_ALIGN_VERT_ROW_BOTTOM: 341 aMgr.SetVertOrientation( text::VertOrientation::LINE_BOTTOM ); 342 break; 343 344 case FN_FRAME_ALIGN_VERT_ROW_TOP: 345 aMgr.SetVertOrientation( text::VertOrientation::LINE_TOP ); 346 break; 347 case SID_OBJECT_ALIGN_CENTER : 348 case FN_FRAME_ALIGN_HORZ_CENTER: 349 aMgr.SetHorzOrientation( text::HoriOrientation::CENTER ); 350 break; 351 case SID_OBJECT_ALIGN_RIGHT: 352 case FN_FRAME_ALIGN_HORZ_RIGHT: 353 aMgr.SetHorzOrientation( text::HoriOrientation::RIGHT ); 354 break; 355 case SID_OBJECT_ALIGN_LEFT: 356 case FN_FRAME_ALIGN_HORZ_LEFT: 357 aMgr.SetHorzOrientation( text::HoriOrientation::LEFT ); 358 break; 359 360 case FN_SET_FRM_POSITION: 361 { 362 aMgr.SetAbsPos(((SfxPointItem &)pArgs->Get 363 (FN_SET_FRM_POSITION)).GetValue()); 364 } 365 break; 366 case SID_ATTR_BRUSH: 367 { 368 if(pArgs) 369 { 370 aMgr.SetAttrSet( *pArgs ); 371 bCopyToFmt = sal_True; 372 } 373 } 374 break; 375 case SID_ATTR_ULSPACE: 376 case SID_ATTR_LRSPACE: 377 { 378 if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(GetPool().GetWhich(nSlot), sal_False, &pItem)) 379 { 380 aMgr.SetAttrSet( *pArgs ); 381 if(SID_ATTR_ULSPACE == nSlot && SID_ATTR_ULSPACE == nSlot) 382 bCopyToFmt = sal_True; 383 } 384 } 385 break; 386 case FN_FORMAT_FRAME_DLG: 387 case FN_PROPERTY_WRAP_DLG: 388 { 389 const int nSel = rSh.GetSelectionType(); 390 if (nSel & nsSelectionType::SEL_GRF) 391 { 392 rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(FN_FORMAT_GRAFIC_DLG); 393 bUpdateMgr = sal_False; 394 } 395 else 396 { 397 SfxItemSet aSet(GetPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1, 398 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 399 FN_GET_PRINT_AREA, FN_GET_PRINT_AREA, 400 SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE, 401 SID_ATTR_BRUSH, SID_ATTR_BRUSH, 402 SID_ATTR_LRSPACE, SID_ATTR_ULSPACE, 403 FN_SURROUND, FN_HORI_ORIENT, 404 FN_SET_FRM_NAME, FN_SET_FRM_NAME, 405 FN_KEEP_ASPECT_RATIO, FN_KEEP_ASPECT_RATIO, 406 SID_DOCFRAME, SID_DOCFRAME, 407 SID_HTML_MODE, SID_HTML_MODE, 408 FN_SET_FRM_ALT_NAME, FN_SET_FRM_ALT_NAME, 409 FN_PARAM_CHAIN_PREVIOUS, FN_PARAM_CHAIN_NEXT, 410 FN_OLE_IS_MATH, FN_OLE_IS_MATH, 411 FN_MATH_BASELINE_ALIGNMENT, FN_MATH_BASELINE_ALIGNMENT, 412 0); 413 414 const SwViewOption* pVOpt = rSh.GetViewOptions(); 415 if(nSel & nsSelectionType::SEL_OLE) 416 aSet.Put( SfxBoolItem(FN_KEEP_ASPECT_RATIO, pVOpt->IsKeepRatio()) ); 417 aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell()))); 418 aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName())); 419 if( nSel & nsSelectionType::SEL_OLE ) 420 { 421 aSet.Put( SfxStringItem( FN_SET_FRM_ALT_NAME, rSh.GetObjTitle() ) ); 422 } 423 424 const SwRect &rPg = rSh.GetAnyCurRect(RECT_PAGE); 425 SwFmtFrmSize aFrmSize(ATT_VAR_SIZE, rPg.Width(), rPg.Height()); 426 aFrmSize.SetWhich(GetPool().GetWhich(SID_ATTR_PAGE_SIZE)); 427 aSet.Put(aFrmSize); 428 429 const SwRect &rPr = rSh.GetAnyCurRect(RECT_PAGE_PRT); 430 SwFmtFrmSize aPrtSize(ATT_VAR_SIZE, rPr.Width(), rPr.Height()); 431 aPrtSize.SetWhich(GetPool().GetWhich(FN_GET_PRINT_AREA)); 432 aSet.Put(aPrtSize); 433 434 aSet.Put(aMgr.GetAttrSet()); 435 aSet.SetParent( aMgr.GetAttrSet().GetParent() ); 436 437 // Bei %-Werten Groesse initialisieren 438 SwFmtFrmSize& rSize = (SwFmtFrmSize&)aSet.Get(RES_FRM_SIZE); 439 if (rSize.GetWidthPercent() && rSize.GetWidthPercent() != 0xff) 440 rSize.SetWidth(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Width()); 441 if (rSize.GetHeightPercent() && rSize.GetHeightPercent() != 0xff) 442 rSize.SetHeight(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Height()); 443 444 // disable vertical positioning for Math Objects anchored 'as char' if baseline alignment is activated 445 aSet.Put( SfxBoolItem( FN_MATH_BASELINE_ALIGNMENT, 446 rSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) ) ); 447 const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() ); 448 aSet.Put( SfxBoolItem( FN_OLE_IS_MATH, xObj.is() && SotExchange::IsMath( xObj->getClassID() ) ) ); 449 450 sal_uInt16 nDefPage = 0; 451 if(pArgs && pArgs->GetItemState(FN_FORMAT_FRAME_DLG, sal_False, &pItem) == SFX_ITEM_SET) 452 nDefPage = ((SfxUInt16Item *)pItem)->GetValue(); 453 454 aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame()->GetTopFrame())); 455 FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView())); 456 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric) )); 457 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 458 DBG_ASSERT(pFact, "Dialogdiet fail!"); 459 SfxAbstractTabDialog* pDlg = pFact->CreateFrmTabDialog( DLG_FRM_STD, 460 GetView().GetViewFrame(), 461 GetView().GetWindow(), 462 aSet, sal_False, 463 nSel & nsSelectionType::SEL_GRF ? DLG_FRM_GRF : 464 nSel & nsSelectionType::SEL_OLE ? DLG_FRM_OLE : 465 DLG_FRM_STD, 466 sal_False, 467 nDefPage); 468 DBG_ASSERT(pDlg, "Dialogdiet fail!"); 469 470 if ( nSlot == FN_PROPERTY_WRAP_DLG ) 471 { 472 pDlg->SetCurPageId(TP_FRM_WRAP); 473 } 474 475 if ( pDlg->Execute() ) 476 { 477 const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); 478 if(pOutSet) 479 { 480 rReq.Done(*pOutSet); 481 if(nSel & nsSelectionType::SEL_OLE && 482 SFX_ITEM_SET == pOutSet->GetItemState(FN_KEEP_ASPECT_RATIO, sal_True, &pItem)) 483 { 484 SwViewOption aUsrPref( *pVOpt ); 485 aUsrPref.SetKeepRatio(((const SfxBoolItem*)pItem)->GetValue()); 486 SW_MOD()->ApplyUsrPref(aUsrPref, &GetView()); 487 } 488 if (SFX_ITEM_SET == pOutSet->GetItemState(FN_SET_FRM_ALT_NAME, sal_True, &pItem)) 489 { 490 // --> OD 2009-07-13 #i73249# 491 // rSh.SetAlternateText(((const SfxStringItem*)pItem)->GetValue()); 492 rSh.SetObjTitle(((const SfxStringItem*)pItem)->GetValue()); 493 // <-- 494 } 495 // Vorlagen-AutoUpdate 496 SwFrmFmt* pFmt = rSh.GetCurFrmFmt(); 497 if(pFmt && pFmt->IsAutoUpdateFmt()) 498 { 499 rSh.AutoUpdateFrame(pFmt, *pOutSet); 500 // alles, dass das Format nicht kann, muss hart 501 // gesetzt werden 502 if(SFX_ITEM_SET == pOutSet->GetItemState(FN_SET_FRM_NAME, sal_False, &pItem)) 503 rSh.SetFlyName(((SfxStringItem*)pItem)->GetValue()); 504 SfxItemSet aShellSet(GetPool(), RES_FRM_SIZE, RES_FRM_SIZE, 505 RES_SURROUND, RES_SURROUND, 506 RES_ANCHOR, RES_ANCHOR, 507 RES_VERT_ORIENT,RES_HORI_ORIENT, 508 0); 509 aShellSet.Put(*pOutSet); 510 aMgr.SetAttrSet(aShellSet); 511 if(SFX_ITEM_SET == pOutSet->GetItemState(FN_SET_FRM_NAME, sal_False, &pItem)) 512 rSh.SetFlyName(((SfxStringItem*)pItem)->GetValue()); 513 } 514 else 515 aMgr.SetAttrSet( *pOutSet ); 516 517 const SwFrmFmt* pCurrFlyFmt = rSh.GetFlyFrmFmt(); 518 if(SFX_ITEM_SET == 519 pOutSet->GetItemState(FN_PARAM_CHAIN_PREVIOUS, 520 sal_False, &pItem)) 521 { 522 rSh.HideChainMarker(); 523 524 String sPrevName = 525 ((const SfxStringItem*)pItem)->GetValue(); 526 const SwFmtChain &rChain = pCurrFlyFmt->GetChain(); 527 //needs cast - no non-const method available 528 SwFlyFrmFmt* pFlyFmt = 529 (SwFlyFrmFmt*)rChain.GetPrev(); 530 if(pFlyFmt) 531 { 532 if (pFlyFmt->GetName() != sPrevName) 533 { 534 rSh.Unchain(*pFlyFmt); 535 } 536 else 537 sPrevName.Erase(); 538 } 539 540 if(sPrevName.Len()) 541 { 542 //needs cast - no non-const method available 543 SwFrmFmt* pPrevFmt = (SwFrmFmt*) 544 lcl_GetFrmFmtByName(rSh, sPrevName); 545 DBG_ASSERT(pPrevFmt, "No frame found!"); 546 if(pPrevFmt) 547 { 548 rSh.Chain(*pPrevFmt, *pCurrFlyFmt); 549 } 550 } 551 rSh.SetChainMarker(); 552 } 553 if(SFX_ITEM_SET == 554 pOutSet->GetItemState(FN_PARAM_CHAIN_NEXT, sal_False, 555 &pItem)) 556 { 557 rSh.HideChainMarker(); 558 String sNextName = 559 ((const SfxStringItem*)pItem)->GetValue(); 560 const SwFmtChain &rChain = pCurrFlyFmt->GetChain(); 561 //needs cast - no non-const method available 562 SwFlyFrmFmt* pFlyFmt = 563 (SwFlyFrmFmt*)rChain.GetNext(); 564 if(pFlyFmt) 565 { 566 if (pFlyFmt->GetName() != sNextName) 567 { 568 rSh.Unchain(*((SwFlyFrmFmt*) pCurrFlyFmt)); 569 } 570 else 571 sNextName.Erase(); 572 } 573 574 if(sNextName.Len()) 575 { 576 //needs cast - no non-const method available 577 SwFrmFmt* pNextFmt = (SwFrmFmt*) 578 lcl_GetFrmFmtByName(rSh, sNextName); 579 DBG_ASSERT(pNextFmt, "No frame found!"); 580 if(pNextFmt) 581 { 582 rSh.Chain(*(SwFrmFmt*) 583 pCurrFlyFmt, *pNextFmt); 584 } 585 } 586 rSh.SetChainMarker(); 587 } 588 } 589 } 590 else 591 bUpdateMgr = sal_False; 592 delete pDlg; 593 } 594 } 595 break; 596 case FN_FRAME_MIRROR_ON_EVEN_PAGES: 597 { 598 SwFmtHoriOrient aHori(aMgr.GetHoriOrient()); 599 sal_Bool bMirror = !aHori.IsPosToggle(); 600 aHori.SetPosToggle(bMirror); 601 SfxItemSet aSet(GetPool(), RES_HORI_ORIENT, RES_HORI_ORIENT); 602 aSet.Put(aHori); 603 aMgr.SetAttrSet(aSet); 604 bCopyToFmt = sal_True; 605 rReq.SetReturnValue(SfxBoolItem(nSlot, bMirror)); 606 } 607 break; 608 // --> OD 2009-07-14 #i73249# 609 case FN_TITLE_DESCRIPTION_SHAPE: 610 { 611 bUpdateMgr = sal_False; 612 SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList(); 613 if ( pSdrView && 614 pSdrView->GetMarkedObjectCount() == 1 ) 615 { 616 String aDescription(rSh.GetObjDescription()); 617 String aTitle(rSh.GetObjTitle()); 618 619 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 620 OSL_ENSURE(pFact, "Dialogdiet fail!"); 621 AbstractSvxObjectTitleDescDialog* pDlg = 622 pFact->CreateSvxObjectTitleDescDialog( NULL, 623 aTitle, 624 aDescription ); 625 OSL_ENSURE(pDlg, "Dialogdiet fail!"); 626 627 if ( pDlg->Execute() == RET_OK ) 628 { 629 pDlg->GetDescription(aDescription); 630 pDlg->GetTitle(aTitle); 631 632 rSh.SetObjDescription(aDescription); 633 rSh.SetObjTitle(aTitle); 634 } 635 636 delete pDlg; 637 } 638 } 639 break; 640 // <-- 641 default: 642 ASSERT( !this, "falscher Dispatcher" ); 643 return; 644 } 645 // Vorlagen-AutoUpdate 646 SwFrmFmt* pFmt = rSh.GetCurFrmFmt(); 647 if ( bUpdateMgr ) 648 { 649 if(bCopyToFmt && pFmt && pFmt->IsAutoUpdateFmt()) 650 { 651 rSh.AutoUpdateFrame(pFmt, aMgr.GetAttrSet()); 652 } 653 else 654 aMgr.UpdateFlyFrm(); 655 } 656 657 } 658 659 /*-------------------------------------------------------------------- 660 Beschreibung: 661 --------------------------------------------------------------------*/ 662 663 664 void SwFrameShell::GetState(SfxItemSet& rSet) 665 { 666 SwWrtShell &rSh = GetShell(); 667 sal_Bool bHtmlMode = 0 != ::GetHtmlMode(rSh.GetView().GetDocShell()); 668 if (rSh.IsFrmSelected()) 669 { 670 SfxItemSet aSet( rSh.GetAttrPool(), 671 RES_LR_SPACE, RES_UL_SPACE, 672 RES_PROTECT, RES_HORI_ORIENT, 673 RES_OPAQUE, RES_OPAQUE, 674 RES_PRINT, RES_OPAQUE, 675 0 ); 676 rSh.GetFlyFrmAttr( aSet ); 677 678 sal_Bool bProtect = rSh.IsSelObjProtected(FLYPROTECT_POS); 679 sal_Bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0; 680 681 bProtect |= bParentCntProt; 682 683 const sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_True); 684 SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE ); 685 686 SfxWhichIter aIter( rSet ); 687 sal_uInt16 nWhich = aIter.FirstWhich(); 688 while ( nWhich ) 689 { 690 switch ( nWhich ) 691 { 692 case RES_FRM_SIZE: 693 { 694 SwFmtFrmSize aSz(aMgr.GetFrmSize()); 695 rSet.Put(aSz); 696 } 697 break; 698 case RES_VERT_ORIENT: 699 case RES_HORI_ORIENT: 700 case SID_ATTR_ULSPACE: 701 case SID_ATTR_LRSPACE: 702 case RES_LR_SPACE: 703 case RES_UL_SPACE: 704 case RES_PROTECT: 705 case RES_OPAQUE: 706 case RES_PRINT: 707 case RES_SURROUND: 708 { 709 rSet.Put(aSet.Get(GetPool().GetWhich(nWhich), sal_True )); 710 } 711 break; 712 case SID_OBJECT_ALIGN_LEFT : 713 case SID_OBJECT_ALIGN_CENTER : 714 case SID_OBJECT_ALIGN_RIGHT : 715 case FN_FRAME_ALIGN_HORZ_CENTER: 716 case FN_FRAME_ALIGN_HORZ_RIGHT: 717 case FN_FRAME_ALIGN_HORZ_LEFT: 718 if ( (eFrmType & FRMTYPE_FLY_INCNT) || 719 bProtect || 720 ((nWhich == FN_FRAME_ALIGN_HORZ_CENTER || nWhich == SID_OBJECT_ALIGN_CENTER)&& bHtmlMode) ) 721 rSet.DisableItem( nWhich ); 722 break; 723 case FN_FRAME_ALIGN_VERT_ROW_TOP: 724 case FN_FRAME_ALIGN_VERT_ROW_CENTER: 725 case FN_FRAME_ALIGN_VERT_ROW_BOTTOM: 726 case FN_FRAME_ALIGN_VERT_CHAR_TOP: 727 case FN_FRAME_ALIGN_VERT_CHAR_CENTER: 728 case FN_FRAME_ALIGN_VERT_CHAR_BOTTOM: 729 if ( !(eFrmType & FRMTYPE_FLY_INCNT) || bProtect 730 || (bHtmlMode && FN_FRAME_ALIGN_VERT_CHAR_BOTTOM == nWhich) ) 731 rSet.DisableItem( nWhich ); 732 break; 733 734 case SID_OBJECT_ALIGN_UP : 735 case SID_OBJECT_ALIGN_MIDDLE : 736 case SID_OBJECT_ALIGN_DOWN : 737 738 case FN_FRAME_ALIGN_VERT_TOP: 739 case FN_FRAME_ALIGN_VERT_CENTER: 740 case FN_FRAME_ALIGN_VERT_BOTTOM: 741 if ( bProtect || (bHtmlMode && eFrmType & FRMTYPE_FLY_ATCNT) ) 742 rSet.DisableItem( nWhich ); 743 else 744 { 745 sal_uInt16 nId = 0; 746 if (eFrmType & FRMTYPE_FLY_INCNT) 747 { 748 switch (nWhich) 749 { 750 case SID_OBJECT_ALIGN_UP : 751 case FN_FRAME_ALIGN_VERT_TOP: 752 nId = STR_TOP_BASE; break; 753 case SID_OBJECT_ALIGN_MIDDLE : 754 case FN_FRAME_ALIGN_VERT_CENTER: 755 nId = STR_CENTER_BASE; break; 756 case SID_OBJECT_ALIGN_DOWN : 757 case FN_FRAME_ALIGN_VERT_BOTTOM: 758 if(!bHtmlMode) 759 nId = STR_BOTTOM_BASE; 760 else 761 rSet.DisableItem( nWhich ); 762 break; 763 } 764 } 765 else 766 { 767 if (nWhich != FN_FRAME_ALIGN_VERT_TOP && 768 nWhich != SID_OBJECT_ALIGN_UP ) 769 { 770 if (aMgr.GetAnchor() == FLY_AT_FLY) 771 { 772 const SwFrmFmt* pFmt = rSh.IsFlyInFly(); 773 if (pFmt) 774 { 775 const SwFmtFrmSize& rFrmSz = pFmt->GetFrmSize(); 776 if (rFrmSz.GetHeightSizeType() != ATT_FIX_SIZE) 777 { 778 rSet.DisableItem( nWhich ); 779 break; 780 } 781 } 782 } 783 } 784 switch (nWhich) 785 { 786 case SID_OBJECT_ALIGN_UP : 787 case FN_FRAME_ALIGN_VERT_TOP: 788 nId = STR_TOP; break; 789 case SID_OBJECT_ALIGN_MIDDLE: 790 case FN_FRAME_ALIGN_VERT_CENTER: 791 nId = STR_CENTER_VERT; break; 792 case SID_OBJECT_ALIGN_DOWN: 793 case FN_FRAME_ALIGN_VERT_BOTTOM: 794 nId = STR_BOTTOM; break; 795 } 796 } 797 if ( nId ) 798 rSet.Put( SfxStringItem( nWhich, SW_RES(nId) )); 799 } 800 break; 801 case SID_HYPERLINK_GETLINK: 802 { 803 String sURL; 804 SvxHyperlinkItem aHLinkItem; 805 const SfxPoolItem* pItem; 806 807 SfxItemSet aURLSet(GetPool(), RES_URL, RES_URL); 808 rSh.GetFlyFrmAttr( aURLSet ); 809 810 if(SFX_ITEM_SET == aURLSet.GetItemState(RES_URL, sal_True, &pItem)) 811 { 812 const SwFmtURL* pFmtURL = (const SwFmtURL*)pItem; 813 aHLinkItem.SetURL(pFmtURL->GetURL()); 814 aHLinkItem.SetTargetFrame(pFmtURL->GetTargetFrameName()); 815 aHLinkItem.SetName(rSh.GetFlyName()); 816 } 817 818 aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() | 819 (bHtmlMode ? HLINK_HTMLMODE : 0))); 820 821 rSet.Put(aHLinkItem); 822 } 823 break; 824 825 case FN_FRAME_CHAIN: 826 { 827 const int nSel = rSh.GetSelectionType(); 828 if (nSel & nsSelectionType::SEL_GRF || nSel & nsSelectionType::SEL_OLE) 829 rSet.DisableItem( FN_FRAME_CHAIN ); 830 else 831 { 832 const SwFrmFmt *pFmt = rSh.GetFlyFrmFmt(); 833 if ( bParentCntProt || rSh.GetView().GetEditWin().GetApplyTemplate() || 834 !pFmt || pFmt->GetChain().GetNext() ) 835 { 836 rSet.DisableItem( FN_FRAME_CHAIN ); 837 } 838 else 839 { 840 sal_Bool bChainMode = rSh.GetView().GetEditWin().IsChainMode(); 841 rSet.Put( SfxBoolItem( FN_FRAME_CHAIN, bChainMode ) ); 842 } 843 } 844 } 845 break; 846 case FN_FRAME_UNCHAIN: 847 { 848 const int nSel = rSh.GetSelectionType(); 849 if (nSel & nsSelectionType::SEL_GRF || nSel & nsSelectionType::SEL_OLE) 850 rSet.DisableItem( FN_FRAME_UNCHAIN ); 851 else 852 { 853 const SwFrmFmt *pFmt = rSh.GetFlyFrmFmt(); 854 if ( bParentCntProt || rSh.GetView().GetEditWin().GetApplyTemplate() || 855 !pFmt || !pFmt->GetChain().GetNext() ) 856 { 857 rSet.DisableItem( FN_FRAME_UNCHAIN ); 858 } 859 } 860 } 861 break; 862 case SID_FRAME_TO_TOP: 863 case SID_FRAME_TO_BOTTOM: 864 case FN_FRAME_UP: 865 case FN_FRAME_DOWN: 866 if ( bParentCntProt ) 867 rSet.DisableItem( nWhich ); 868 break; 869 case FN_FORMAT_FRAME_DLG: 870 { 871 const int nSel = rSh.GetSelectionType(); 872 if ( bParentCntProt || nSel & nsSelectionType::SEL_GRF) 873 rSet.DisableItem( nWhich ); 874 } 875 break; 876 // --> OD 2009-07-07 #i73249# 877 case FN_TITLE_DESCRIPTION_SHAPE: 878 { 879 SwWrtShell &rWrtSh = GetShell(); 880 SdrView* pSdrView = rWrtSh.GetDrawViewWithValidMarkList(); 881 if ( !pSdrView || 882 pSdrView->GetMarkedObjectCount() != 1 ) 883 { 884 rSet.DisableItem( nWhich ); 885 } 886 887 } 888 break; 889 // <-- 890 default: 891 /* do nothing */; 892 break; 893 } 894 nWhich = aIter.NextWhich(); 895 } 896 } 897 } 898 899 /*-------------------------------------------------------------------- 900 Beschreibung: Ctor fuer FrameShell 901 --------------------------------------------------------------------*/ 902 903 904 SwFrameShell::SwFrameShell(SwView &_rView) : 905 SwBaseShell( _rView ) 906 { 907 SetName(String::CreateFromAscii("Frame")); 908 SetHelpId(SW_FRAMESHELL); 909 910 /* #96392# Use this to announce it is the frame shell who creates the 911 selection. */ 912 SwTransferable::CreateSelection( _rView.GetWrtShell(), (ViewShell *) this ); 913 914 SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Frame)); 915 } 916 917 SwFrameShell::~SwFrameShell() 918 { 919 /* #96392# Only clear the selection if it was this frame shell who created 920 it. */ 921 SwTransferable::ClearSelection( GetShell(), (ViewShell *) this ); 922 } 923 924 /*-------------------------------------------------------------------- 925 Beschreibung: 926 --------------------------------------------------------------------*/ 927 928 929 930 void SwFrameShell::ExecFrameStyle(SfxRequest& rReq) 931 { 932 SwWrtShell &rSh = GetShell(); 933 sal_Bool bDefault = sal_False; 934 if (!rSh.IsFrmSelected()) 935 return; 936 937 // Erst Default-BoxItem aus Pool holen. Wenn ungleich normalem Boxitem, 938 // dann ist es bereits geaendert worden (neues ist kein Default). 939 const SvxBoxItem* pPoolBoxItem = (const SvxBoxItem*)::GetDfltAttr(RES_BOX); 940 941 const SfxItemSet *pArgs = rReq.GetArgs(); 942 SfxItemSet aFrameSet(rSh.GetAttrPool(), RES_BOX, RES_BOX); 943 944 rSh.GetFlyFrmAttr( aFrameSet ); 945 const SvxBoxItem& rBoxItem = (const SvxBoxItem&)aFrameSet.Get(RES_BOX); 946 947 if (pPoolBoxItem == &rBoxItem) 948 bDefault = sal_True; 949 950 SvxBoxItem aBoxItem(rBoxItem); 951 952 SvxBorderLine aBorderLine; 953 const SfxPoolItem *pItem = 0; 954 955 if(pArgs) //irgendein Controller kann auch mal nichts liefern #48169# 956 { 957 switch (rReq.GetSlot()) 958 { 959 case SID_ATTR_BORDER: 960 { 961 if (pArgs->GetItemState(RES_BOX, sal_True, &pItem) == SFX_ITEM_SET) 962 { 963 SvxBoxItem aNewBox(*((SvxBoxItem *)pItem)); 964 const SvxBorderLine* pBorderLine; 965 966 if ((pBorderLine = aBoxItem.GetTop()) != NULL) 967 lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine); 968 if ((pBorderLine = aBoxItem.GetBottom()) != NULL) 969 lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine); 970 if ((pBorderLine = aBoxItem.GetLeft()) != NULL) 971 lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine); 972 if ((pBorderLine = aBoxItem.GetRight()) != NULL) 973 lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine); 974 975 if(aBorderLine.GetOutWidth() == 0) 976 { 977 aBorderLine.SetInWidth(0); 978 aBorderLine.SetOutWidth(DEF_LINE_WIDTH_0); 979 aBorderLine.SetDistance(0); 980 } 981 //Distance nur setzen, wenn der Request vom Controller kommt 982 983 if(!StarBASIC::IsRunning()) 984 { 985 aNewBox.SetDistance( rBoxItem.GetDistance() ); 986 } 987 988 aBoxItem = aNewBox; 989 SvxBorderLine aDestBorderLine; 990 991 if ((pBorderLine = aBoxItem.GetTop()) != NULL) 992 aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP); 993 if ((pBorderLine = aBoxItem.GetBottom()) != NULL) 994 aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM); 995 if ((pBorderLine = aBoxItem.GetLeft()) != NULL) 996 aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT); 997 if ((pBorderLine = aBoxItem.GetRight()) != NULL) 998 aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT); 999 } 1000 } 1001 break; 1002 1003 case SID_FRAME_LINESTYLE: 1004 { 1005 if (pArgs->GetItemState(SID_FRAME_LINESTYLE, sal_False, &pItem) == SFX_ITEM_SET) 1006 { 1007 const SvxLineItem* pLineItem = 1008 (const SvxLineItem*)pItem; 1009 1010 if ( pLineItem->GetLine() ) 1011 { 1012 aBorderLine = *(pLineItem->GetLine()); 1013 1014 if (!aBoxItem.GetTop() && !aBoxItem.GetBottom() && 1015 !aBoxItem.GetLeft() && !aBoxItem.GetRight()) 1016 { 1017 aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP); 1018 aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM); 1019 aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT); 1020 aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT); 1021 } 1022 else 1023 { 1024 if( aBoxItem.GetTop() ) 1025 { 1026 aBorderLine.SetColor( aBoxItem.GetTop()->GetColor() ); 1027 aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP); 1028 } 1029 if( aBoxItem.GetBottom() ) 1030 { 1031 aBorderLine.SetColor( aBoxItem.GetBottom()->GetColor()); 1032 aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM); 1033 } 1034 if( aBoxItem.GetLeft() ) 1035 { 1036 aBorderLine.SetColor( aBoxItem.GetLeft()->GetColor()); 1037 aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT); 1038 } 1039 if( aBoxItem.GetRight() ) 1040 { 1041 aBorderLine.SetColor(aBoxItem.GetRight()->GetColor()); 1042 aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT); 1043 } 1044 } 1045 } 1046 else 1047 { 1048 aBoxItem.SetLine(0, BOX_LINE_TOP); 1049 aBoxItem.SetLine(0, BOX_LINE_BOTTOM); 1050 aBoxItem.SetLine(0, BOX_LINE_LEFT); 1051 aBoxItem.SetLine(0, BOX_LINE_RIGHT); 1052 } 1053 } 1054 } 1055 break; 1056 1057 case SID_FRAME_LINECOLOR: 1058 { 1059 if (pArgs->GetItemState(SID_FRAME_LINECOLOR, sal_False, &pItem) == SFX_ITEM_SET) 1060 { 1061 const Color& rNewColor = ((const SvxColorItem*)pItem)->GetValue(); 1062 1063 if (!aBoxItem.GetTop() && !aBoxItem.GetBottom() && 1064 !aBoxItem.GetLeft() && !aBoxItem.GetRight()) 1065 { 1066 aBorderLine.SetColor( rNewColor ); 1067 aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP); 1068 aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM); 1069 aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT); 1070 aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT); 1071 } 1072 else 1073 { 1074 if ( aBoxItem.GetTop() ) 1075 ((SvxBorderLine*)aBoxItem.GetTop())->SetColor( rNewColor ); 1076 if ( aBoxItem.GetBottom() ) 1077 ((SvxBorderLine*)aBoxItem.GetBottom())->SetColor( rNewColor ); 1078 if ( aBoxItem.GetLeft() ) 1079 ((SvxBorderLine*)aBoxItem.GetLeft())->SetColor( rNewColor ); 1080 if ( aBoxItem.GetRight() ) 1081 ((SvxBorderLine*)aBoxItem.GetRight())->SetColor( rNewColor ); 1082 } 1083 } 1084 } 1085 break; 1086 } 1087 } 1088 if (bDefault && (aBoxItem.GetTop() || aBoxItem.GetBottom() || 1089 aBoxItem.GetLeft() || aBoxItem.GetRight())) 1090 { 1091 aBoxItem.SetDistance(MIN_BORDER_DIST); 1092 } 1093 aFrameSet.Put( aBoxItem ); 1094 // Vorlagen-AutoUpdate 1095 SwFrmFmt* pFmt = rSh.GetCurFrmFmt(); 1096 if(pFmt && pFmt->IsAutoUpdateFmt()) 1097 { 1098 rSh.AutoUpdateFrame(pFmt, aFrameSet); 1099 } 1100 else 1101 rSh.SetFlyFrmAttr( aFrameSet ); 1102 1103 } 1104 1105 1106 1107 void lcl_FrmGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine) 1108 { 1109 if(pBorderLine->GetInWidth() > rBorderLine.GetInWidth()) 1110 rBorderLine.SetInWidth(pBorderLine->GetInWidth()); 1111 1112 if(pBorderLine->GetOutWidth() > rBorderLine.GetOutWidth()) 1113 rBorderLine.SetOutWidth(pBorderLine->GetOutWidth()); 1114 1115 if(pBorderLine->GetDistance() > rBorderLine.GetDistance()) 1116 rBorderLine.SetDistance(pBorderLine->GetDistance()); 1117 1118 rBorderLine.SetColor(pBorderLine->GetColor()); 1119 } 1120 1121 1122 1123 void SwFrameShell::GetLineStyleState(SfxItemSet &rSet) 1124 { 1125 SwWrtShell &rSh = GetShell(); 1126 sal_Bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0; 1127 1128 if (bParentCntProt) 1129 { 1130 if (rSh.IsFrmSelected()) 1131 rSet.DisableItem( SID_FRAME_LINECOLOR ); 1132 1133 rSet.DisableItem( SID_ATTR_BORDER ); 1134 rSet.DisableItem( SID_FRAME_LINESTYLE ); 1135 } 1136 else 1137 { 1138 if (rSh.IsFrmSelected()) 1139 { 1140 SfxItemSet aFrameSet( rSh.GetAttrPool(), RES_BOX, RES_BOX ); 1141 1142 rSh.GetFlyFrmAttr(aFrameSet); 1143 1144 const SvxBorderLine* pLine = ((const SvxBoxItem&)aFrameSet.Get(RES_BOX)).GetTop(); 1145 rSet.Put(SvxColorItem(pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR)); 1146 } 1147 } 1148 } 1149 1150 void SwFrameShell::StateInsert(SfxItemSet &rSet) 1151 { 1152 const int nSel = GetShell().GetSelectionType(); 1153 1154 if ((nSel & nsSelectionType::SEL_GRF) || (nSel & nsSelectionType::SEL_OLE)) 1155 rSet.DisableItem(FN_INSERT_FRAME); 1156 } 1157