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