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