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 10cdf0e10cSrcweir * 11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 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. 19cdf0e10cSrcweir * 20efeef26fSAndrew Rist *************************************************************/ 21efeef26fSAndrew Rist 22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 23cdf0e10cSrcweir #include "precompiled_sw.hxx" 24cdf0e10cSrcweir 25cdf0e10cSrcweir #include <tools/shl.hxx> 26cdf0e10cSrcweir #include <hintids.hxx> 27cdf0e10cSrcweir #include <helpid.h> 28cdf0e10cSrcweir #include <swtypes.hxx> 29cdf0e10cSrcweir #include <sfx2/objface.hxx> 30cdf0e10cSrcweir #include <sfx2/request.hxx> 31cdf0e10cSrcweir #include <sfx2/bindings.hxx> 32cdf0e10cSrcweir #include <svl/aeitem.hxx> 33cdf0e10cSrcweir #include <svx/svdview.hxx> 34cdf0e10cSrcweir #include <vcl/msgbox.hxx> 35cdf0e10cSrcweir #include <svl/srchitem.hxx> 36cdf0e10cSrcweir #include <svl/whiter.hxx> 37cdf0e10cSrcweir #include <svx/swframevalidation.hxx> 38cdf0e10cSrcweir #include <svx/anchorid.hxx> 39cdf0e10cSrcweir #include <svx/htmlmode.hxx> 40cdf0e10cSrcweir #include <uitool.hxx> 41cdf0e10cSrcweir #include <fmtornt.hxx> 42cdf0e10cSrcweir #include <cmdid.h> 43cdf0e10cSrcweir #include <swmodule.hxx> 44cdf0e10cSrcweir #include <wrtsh.hxx> 45cdf0e10cSrcweir #include <wview.hxx> 46cdf0e10cSrcweir #include <edtwin.hxx> 47cdf0e10cSrcweir #include <viewopt.hxx> 48cdf0e10cSrcweir #include <dcontact.hxx> 49cdf0e10cSrcweir #include <frmfmt.hxx> 50cdf0e10cSrcweir #include <wrap.hxx> 51cdf0e10cSrcweir #include <drawbase.hxx> 52cdf0e10cSrcweir #include <drwbassh.hxx> 53cdf0e10cSrcweir #include <swdtflvr.hxx> 54cdf0e10cSrcweir #include <svx/svdogrp.hxx> 55cdf0e10cSrcweir #include <svx/svdpage.hxx> 56cdf0e10cSrcweir #include <svx/svditer.hxx> 57cdf0e10cSrcweir #include <shells.hrc> 58cdf0e10cSrcweir #define SwDrawBaseShell 59cdf0e10cSrcweir #include <sfx2/msg.hxx> 60cdf0e10cSrcweir #include <swslots.hxx> 61cdf0e10cSrcweir #include <svx/svxdlg.hxx> 62cdf0e10cSrcweir #include <svx/dialogs.hrc> 63cdf0e10cSrcweir #include "swabstdlg.hxx" 64cdf0e10cSrcweir #include "dialog.hrc" 65cdf0e10cSrcweir #include <swundo.hxx> 66cdf0e10cSrcweir #include <com/sun/star/text/HoriOrientation.hpp> 67cdf0e10cSrcweir #include <com/sun/star/text/VertOrientation.hpp> 68cdf0e10cSrcweir #include <com/sun/star/text/RelOrientation.hpp> 69cdf0e10cSrcweir #include <IDocumentDrawModelAccess.hxx> 70*26ea3662SArmin Le Grand #include <drawdoc.hxx> 71cdf0e10cSrcweir 72cdf0e10cSrcweir using namespace ::com::sun::star; 73cdf0e10cSrcweir 74cdf0e10cSrcweir SFX_IMPL_INTERFACE(SwDrawBaseShell, SwBaseShell, SW_RES(0)) 75cdf0e10cSrcweir { 76cdf0e10cSrcweir } 77cdf0e10cSrcweir 78cdf0e10cSrcweir TYPEINIT1(SwDrawBaseShell,SwBaseShell) 79cdf0e10cSrcweir 80cdf0e10cSrcweir /*-------------------------------------------------------------------- 81cdf0e10cSrcweir Beschreibung: 82cdf0e10cSrcweir --------------------------------------------------------------------*/ 83cdf0e10cSrcweir 84cdf0e10cSrcweir 85cdf0e10cSrcweir SwDrawBaseShell::SwDrawBaseShell(SwView &_rView): 86cdf0e10cSrcweir SwBaseShell( _rView ) 87cdf0e10cSrcweir { 88cdf0e10cSrcweir GetShell().NoEdit(sal_True); 89cdf0e10cSrcweir 90cdf0e10cSrcweir SwEditWin& rWin = GetView().GetEditWin(); 91cdf0e10cSrcweir 92cdf0e10cSrcweir rWin.SetBezierMode(SID_BEZIER_MOVE); 93cdf0e10cSrcweir 94cdf0e10cSrcweir if ( !_rView.GetDrawFuncPtr() ) 95cdf0e10cSrcweir _rView.GetEditWin().StdDrawMode( OBJ_NONE, sal_True ); 96cdf0e10cSrcweir 97cdf0e10cSrcweir SwTransferable::CreateSelection( GetShell() ); 98cdf0e10cSrcweir } 99cdf0e10cSrcweir 100cdf0e10cSrcweir /*-------------------------------------------------------------------- 101cdf0e10cSrcweir Beschreibung: 102cdf0e10cSrcweir --------------------------------------------------------------------*/ 103cdf0e10cSrcweir 104cdf0e10cSrcweir 105cdf0e10cSrcweir SwDrawBaseShell::~SwDrawBaseShell() 106cdf0e10cSrcweir { 107cdf0e10cSrcweir GetView().ExitDraw(); 108cdf0e10cSrcweir GetShell().Edit(); 109cdf0e10cSrcweir SwTransferable::ClearSelection( GetShell() ); 110cdf0e10cSrcweir } 111cdf0e10cSrcweir 112cdf0e10cSrcweir /*-------------------------------------------------------------------- 113cdf0e10cSrcweir Beschreibung: 114cdf0e10cSrcweir --------------------------------------------------------------------*/ 115cdf0e10cSrcweir 116cdf0e10cSrcweir 117cdf0e10cSrcweir void SwDrawBaseShell::Execute(SfxRequest &rReq) 118cdf0e10cSrcweir { 119cdf0e10cSrcweir SwWrtShell *pSh = &GetShell(); 120cdf0e10cSrcweir SdrView* pSdrView = pSh->GetDrawView(); 121cdf0e10cSrcweir const SfxItemSet *pArgs = rReq.GetArgs(); 122cdf0e10cSrcweir sal_uInt16 nSlotId = rReq.GetSlot(); 123cdf0e10cSrcweir sal_Bool bChanged = pSdrView->GetModel()->IsChanged(); 124cdf0e10cSrcweir pSdrView->GetModel()->SetChanged(sal_False); 125cdf0e10cSrcweir const SfxPoolItem* pItem = 0; 126cdf0e10cSrcweir if(pArgs) 127cdf0e10cSrcweir pArgs->GetItemState(nSlotId, sal_False, &pItem); 128cdf0e10cSrcweir 129cdf0e10cSrcweir //Sonderfall Align per Menue 130cdf0e10cSrcweir if(pItem && nSlotId == SID_OBJECT_ALIGN) 131cdf0e10cSrcweir { 132cdf0e10cSrcweir DBG_ASSERT(PTR_CAST(SfxEnumItem, pItem),"SfxEnumItem erwartet"); 133cdf0e10cSrcweir nSlotId = nSlotId + ((const SfxEnumItem*)pItem)->GetValue(); 134cdf0e10cSrcweir nSlotId++; 135cdf0e10cSrcweir } 136cdf0e10cSrcweir 137cdf0e10cSrcweir sal_Bool bAlignPossible = pSh->IsAlignPossible(); 138cdf0e10cSrcweir 139cdf0e10cSrcweir sal_Bool bTopParam = sal_True, bBottomParam = sal_True; 140cdf0e10cSrcweir sal_Bool bNotify = sal_False; 141cdf0e10cSrcweir sal_Bool bDone = sal_False; 142cdf0e10cSrcweir SfxBindings& rBind = GetView().GetViewFrame()->GetBindings(); 143cdf0e10cSrcweir 144cdf0e10cSrcweir switch (nSlotId) 145cdf0e10cSrcweir { 146cdf0e10cSrcweir case FN_DRAW_WRAP_DLG: 147cdf0e10cSrcweir { 148cdf0e10cSrcweir if(pSdrView->AreObjectsMarked()) 149cdf0e10cSrcweir { 150cdf0e10cSrcweir if(!pArgs) 151cdf0e10cSrcweir { 152cdf0e10cSrcweir const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); 153cdf0e10cSrcweir if( rMarkList.GetMark(0) != 0 ) 154cdf0e10cSrcweir { 155cdf0e10cSrcweir SfxItemSet aSet(GetPool(), RES_SURROUND, RES_SURROUND, 156cdf0e10cSrcweir RES_ANCHOR, RES_ANCHOR, 157cdf0e10cSrcweir RES_LR_SPACE, RES_UL_SPACE, 158cdf0e10cSrcweir SID_HTML_MODE, SID_HTML_MODE, 159cdf0e10cSrcweir FN_DRAW_WRAP_DLG, FN_DRAW_WRAP_DLG, 160cdf0e10cSrcweir 0); 161cdf0e10cSrcweir 162cdf0e10cSrcweir aSet.Put(SfxBoolItem(SID_HTML_MODE, 163cdf0e10cSrcweir 0 != ::GetHtmlMode(pSh->GetView().GetDocShell()))); 164cdf0e10cSrcweir 165cdf0e10cSrcweir aSet.Put(SfxInt16Item(FN_DRAW_WRAP_DLG, pSh->GetLayerId())); 166cdf0e10cSrcweir 167cdf0e10cSrcweir pSh->GetObjAttr(aSet); 168cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 169cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 170cdf0e10cSrcweir 171cdf0e10cSrcweir SfxAbstractDialog* pDlg = pFact->CreateSwWrapDlg( GetView().GetWindow(), aSet, pSh, sal_True, RC_DLG_SWWRAPDLG ); 172cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 173cdf0e10cSrcweir 174cdf0e10cSrcweir if (pDlg->Execute() == RET_OK) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir const SfxPoolItem* pWrapItem; 177cdf0e10cSrcweir const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); 178cdf0e10cSrcweir if(SFX_ITEM_SET == pOutSet->GetItemState(FN_DRAW_WRAP_DLG, sal_False, &pWrapItem)) 179cdf0e10cSrcweir { 180cdf0e10cSrcweir short nLayer = ((const SfxInt16Item*)pWrapItem)->GetValue(); 181cdf0e10cSrcweir if (nLayer == 1) 182cdf0e10cSrcweir pSh->SelectionToHeaven(); 183cdf0e10cSrcweir else 184cdf0e10cSrcweir pSh->SelectionToHell(); 185cdf0e10cSrcweir } 186cdf0e10cSrcweir 187cdf0e10cSrcweir pSh->SetObjAttr(*pOutSet); 188cdf0e10cSrcweir } 189cdf0e10cSrcweir delete pDlg; 190cdf0e10cSrcweir } 191cdf0e10cSrcweir } 192cdf0e10cSrcweir } 193cdf0e10cSrcweir } 194cdf0e10cSrcweir break; 195cdf0e10cSrcweir 196cdf0e10cSrcweir case SID_ATTR_TRANSFORM: 197cdf0e10cSrcweir { 198cdf0e10cSrcweir if(pSdrView->AreObjectsMarked()) 199cdf0e10cSrcweir { 200cdf0e10cSrcweir if(!pArgs) 201cdf0e10cSrcweir { 202cdf0e10cSrcweir const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); 203cdf0e10cSrcweir if( rMarkList.GetMark(0) != 0 ) 204cdf0e10cSrcweir { 205cdf0e10cSrcweir SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 206cdf0e10cSrcweir SfxAbstractTabDialog *pDlg=NULL; 207cdf0e10cSrcweir sal_Bool bCaption = sal_False; 208cdf0e10cSrcweir 209cdf0e10cSrcweir // Erlaubte Verankerungen: 210cdf0e10cSrcweir short nAnchor = pSh->GetAnchorId(); 211cdf0e10cSrcweir sal_uInt16 nAllowedAnchors = SVX_OBJ_AT_CNTNT|SVX_OBJ_IN_CNTNT; 212cdf0e10cSrcweir sal_uInt16 nHtmlMode = ::GetHtmlMode(pSh->GetView().GetDocShell()); 213cdf0e10cSrcweir 214cdf0e10cSrcweir if( !((HTMLMODE_ON & nHtmlMode) && (0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS))) ) 215cdf0e10cSrcweir nAllowedAnchors |= SVX_OBJ_PAGE; 216cdf0e10cSrcweir if ( pSh->IsFlyInFly() ) 217cdf0e10cSrcweir nAllowedAnchors |= SVX_OBJ_AT_FLY; 218cdf0e10cSrcweir 219cdf0e10cSrcweir if (pObj->GetObjIdentifier() == OBJ_CAPTION ) 220cdf0e10cSrcweir bCaption = sal_True; 221cdf0e10cSrcweir 222cdf0e10cSrcweir if (bCaption) 223cdf0e10cSrcweir { 224cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 225cdf0e10cSrcweir if ( pFact ) 226cdf0e10cSrcweir { 227cdf0e10cSrcweir AbstractSvxCaptionDialog* pCaptionDlg = 228cdf0e10cSrcweir pFact->CreateCaptionDialog( NULL, pSdrView, nAllowedAnchors ); 229cdf0e10cSrcweir pCaptionDlg->SetValidateFramePosLink( LINK(this, SwDrawBaseShell, ValidatePosition) ); 230cdf0e10cSrcweir pDlg = pCaptionDlg; 231cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 232cdf0e10cSrcweir } 233cdf0e10cSrcweir } 234cdf0e10cSrcweir else 235cdf0e10cSrcweir { 236cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 237cdf0e10cSrcweir if ( pFact ) 238cdf0e10cSrcweir { 239cdf0e10cSrcweir 240cdf0e10cSrcweir AbstractSvxTransformTabDialog* pTransform = 241cdf0e10cSrcweir pFact->CreateSvxTransformTabDialog( NULL, NULL, pSdrView, nAllowedAnchors ); 242cdf0e10cSrcweir pTransform->SetValidateFramePosLink( LINK(this, SwDrawBaseShell, ValidatePosition) ); 243cdf0e10cSrcweir pDlg = pTransform; 244cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 245cdf0e10cSrcweir } 246cdf0e10cSrcweir } 247cdf0e10cSrcweir SfxItemSet aNewAttr(pSdrView->GetGeoAttrFromMarked()); 248cdf0e10cSrcweir 249cdf0e10cSrcweir const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() ); 250cdf0e10cSrcweir SfxItemSet aSet( *aNewAttr.GetPool(), pRange ); 251cdf0e10cSrcweir FieldUnit eMetric = ::GetDfltMetric(0 != dynamic_cast<SwWebView*>(&GetView())); 252cdf0e10cSrcweir SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) ); 253cdf0e10cSrcweir 254cdf0e10cSrcweir aSet.Put( aNewAttr, sal_False ); 255cdf0e10cSrcweir 256cdf0e10cSrcweir if (bCaption) 257cdf0e10cSrcweir pSdrView->GetAttributes( aSet ); 258cdf0e10cSrcweir 259cdf0e10cSrcweir aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_ANCHOR, nAnchor)); 260cdf0e10cSrcweir sal_Bool bRTL; 261cdf0e10cSrcweir sal_Bool bVertL2R; 262cdf0e10cSrcweir aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_IN_VERTICAL_TEXT, pSh->IsFrmVertical(sal_True, bRTL, bVertL2R))); 263cdf0e10cSrcweir aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_IN_RTL_TEXT, bRTL)); 264cdf0e10cSrcweir 265cdf0e10cSrcweir SwFrmFmt* pFrmFmt = FindFrmFmt( pObj ); 266cdf0e10cSrcweir 267cdf0e10cSrcweir aSet.Put( pFrmFmt->GetFmtAttr(RES_FOLLOW_TEXT_FLOW) ); 268cdf0e10cSrcweir 269cdf0e10cSrcweir SwFmtVertOrient aVOrient((const SwFmtVertOrient&)pFrmFmt->GetFmtAttr(RES_VERT_ORIENT)); 270cdf0e10cSrcweir aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_ORIENT, aVOrient.GetVertOrient())); 271cdf0e10cSrcweir aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_RELATION, aVOrient.GetRelationOrient() )); 272cdf0e10cSrcweir aSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_VERT_POSITION, aVOrient.GetPos())); 273cdf0e10cSrcweir 274cdf0e10cSrcweir SwFmtHoriOrient aHOrient((const SwFmtHoriOrient&)pFrmFmt->GetFmtAttr(RES_HORI_ORIENT)); 275cdf0e10cSrcweir aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_ORIENT, aHOrient.GetHoriOrient())); 276cdf0e10cSrcweir aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_RELATION, aHOrient.GetRelationOrient() )); 277cdf0e10cSrcweir aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_HORI_MIRROR, aHOrient.IsPosToggle())); 278cdf0e10cSrcweir aSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_HORI_POSITION, aHOrient.GetPos())); 279cdf0e10cSrcweir 280cdf0e10cSrcweir aSet.Put(SfxUInt16Item(SID_HTML_MODE, nHtmlMode)); 281cdf0e10cSrcweir 282cdf0e10cSrcweir pDlg->SetInputSet( &aSet ); 283cdf0e10cSrcweir 284cdf0e10cSrcweir if (pDlg->Execute() == RET_OK) 285cdf0e10cSrcweir { 286cdf0e10cSrcweir const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); 287cdf0e10cSrcweir pSh->StartAllAction(); 288cdf0e10cSrcweir 289cdf0e10cSrcweir // --> OD 2004-07-14 #i30451# 290cdf0e10cSrcweir pSh->StartUndo(UNDO_INSFMTATTR); 291cdf0e10cSrcweir 292cdf0e10cSrcweir pSdrView->SetGeoAttrToMarked(*pOutSet); 293cdf0e10cSrcweir 294cdf0e10cSrcweir if (bCaption) 295cdf0e10cSrcweir pSdrView->SetAttributes(*pOutSet); 296cdf0e10cSrcweir 297cdf0e10cSrcweir sal_Bool bPosCorr = 298cdf0e10cSrcweir SFX_ITEM_SET != pOutSet->GetItemState( 299cdf0e10cSrcweir SID_ATTR_TRANSFORM_POS_X, sal_False ) && 300cdf0e10cSrcweir SFX_ITEM_SET != pOutSet->GetItemState( 301cdf0e10cSrcweir SID_ATTR_TRANSFORM_POS_Y, sal_False ); 302cdf0e10cSrcweir 303cdf0e10cSrcweir SfxItemSet aFrmAttrSet(GetPool(), RES_FRMATR_BEGIN, RES_FRMATR_END - 1); 304cdf0e10cSrcweir 305cdf0e10cSrcweir bool bSingleSelection = rMarkList.GetMarkCount() == 1; 306cdf0e10cSrcweir 307cdf0e10cSrcweir const SfxPoolItem* pAnchorItem; 308cdf0e10cSrcweir if(SFX_ITEM_SET == pOutSet->GetItemState( 309cdf0e10cSrcweir SID_ATTR_TRANSFORM_ANCHOR, sal_False, &pAnchorItem)) 310cdf0e10cSrcweir { 311cdf0e10cSrcweir if(!bSingleSelection) 312cdf0e10cSrcweir pSh->ChgAnchor(((const SfxInt16Item*)pAnchorItem) 313cdf0e10cSrcweir ->GetValue(), sal_False, bPosCorr ); 314cdf0e10cSrcweir else 315cdf0e10cSrcweir { 316cdf0e10cSrcweir SwFmtAnchor aAnchor(pFrmFmt->GetAnchor()); 317cdf0e10cSrcweir aAnchor.SetType((RndStdIds)((const SfxInt16Item*)pAnchorItem)->GetValue()); 318cdf0e10cSrcweir aFrmAttrSet.Put( aAnchor ); 319cdf0e10cSrcweir } 320cdf0e10cSrcweir } 321cdf0e10cSrcweir const SfxPoolItem* pHoriOrient = 0; 322cdf0e10cSrcweir const SfxPoolItem* pHoriRelation = 0; 323cdf0e10cSrcweir const SfxPoolItem* pHoriPosition = 0; 324cdf0e10cSrcweir const SfxPoolItem* pHoriMirror = 0; 325cdf0e10cSrcweir pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_ORIENT, sal_False, &pHoriOrient); 326cdf0e10cSrcweir pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_RELATION, sal_False, &pHoriRelation); 327cdf0e10cSrcweir pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_POSITION, sal_False, &pHoriPosition); 328cdf0e10cSrcweir pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_MIRROR, sal_False, &pHoriMirror); 329cdf0e10cSrcweir if(pHoriOrient || pHoriRelation || pHoriPosition || pHoriMirror) 330cdf0e10cSrcweir { 331cdf0e10cSrcweir if(pHoriOrient) 332cdf0e10cSrcweir aHOrient.SetHoriOrient( 333cdf0e10cSrcweir static_cast<const SfxInt16Item*>(pHoriOrient)->GetValue()); 334cdf0e10cSrcweir if(pHoriRelation) 335cdf0e10cSrcweir aHOrient.SetRelationOrient( 336cdf0e10cSrcweir static_cast<const SfxInt16Item*>(pHoriRelation)->GetValue()); 337cdf0e10cSrcweir if(pHoriPosition) 338cdf0e10cSrcweir aHOrient.SetPos( static_cast<const SfxInt32Item*>(pHoriPosition)->GetValue()); 339cdf0e10cSrcweir if(pHoriMirror) 340cdf0e10cSrcweir aHOrient.SetPosToggle( static_cast<const SfxBoolItem*>(pHoriMirror)->GetValue()); 341cdf0e10cSrcweir aFrmAttrSet.Put(aHOrient); 342cdf0e10cSrcweir } 343cdf0e10cSrcweir 344cdf0e10cSrcweir const SfxPoolItem* pVertOrient = 0; 345cdf0e10cSrcweir const SfxPoolItem* pVertRelation = 0; 346cdf0e10cSrcweir const SfxPoolItem* pVertPosition = 0; 347cdf0e10cSrcweir pOutSet->GetItemState(SID_ATTR_TRANSFORM_VERT_ORIENT, sal_False, &pVertOrient); 348cdf0e10cSrcweir pOutSet->GetItemState(SID_ATTR_TRANSFORM_VERT_RELATION, sal_False, &pVertRelation); 349cdf0e10cSrcweir pOutSet->GetItemState(SID_ATTR_TRANSFORM_VERT_POSITION, sal_False, &pVertPosition); 350cdf0e10cSrcweir if(pVertOrient || pVertRelation || pVertPosition ) 351cdf0e10cSrcweir { 352cdf0e10cSrcweir if(pVertOrient) 353cdf0e10cSrcweir aVOrient.SetVertOrient( 354cdf0e10cSrcweir static_cast<const SfxInt16Item*>(pVertOrient)->GetValue()); 355cdf0e10cSrcweir if(pVertRelation) 356cdf0e10cSrcweir aVOrient.SetRelationOrient( 357cdf0e10cSrcweir static_cast<const SfxInt16Item*>(pVertRelation)->GetValue()); 358cdf0e10cSrcweir if(pVertPosition) 359cdf0e10cSrcweir aVOrient.SetPos( static_cast<const SfxInt32Item*>(pVertPosition)->GetValue()); 360cdf0e10cSrcweir aFrmAttrSet.Put( aVOrient ); 361cdf0e10cSrcweir } 362cdf0e10cSrcweir const SfxPoolItem* pFollowItem = 0; 363cdf0e10cSrcweir pOutSet->GetItemState(RES_FOLLOW_TEXT_FLOW, sal_False, &pFollowItem); 364cdf0e10cSrcweir if(pFollowItem) 365cdf0e10cSrcweir aFrmAttrSet.Put(*pFollowItem); 366cdf0e10cSrcweir 367cdf0e10cSrcweir if(aFrmAttrSet.Count()) 368cdf0e10cSrcweir pSh->SetDrawingAttr(aFrmAttrSet); 369cdf0e10cSrcweir 370cdf0e10cSrcweir rBind.InvalidateAll(sal_False); 371cdf0e10cSrcweir 372cdf0e10cSrcweir // --> OD 2004-07-14 #i30451# 373cdf0e10cSrcweir pSh->EndUndo( UNDO_INSFMTATTR ); 374cdf0e10cSrcweir 375cdf0e10cSrcweir pSh->EndAllAction(); 376cdf0e10cSrcweir } 377cdf0e10cSrcweir delete pDlg; 378cdf0e10cSrcweir 379cdf0e10cSrcweir } 380cdf0e10cSrcweir } 381ee093554SAndre Fischer else 382ee093554SAndre Fischer { 383ee093554SAndre Fischer pSdrView->SetGeoAttrToMarked( *pArgs ); 384ee093554SAndre Fischer } 385cdf0e10cSrcweir } 386cdf0e10cSrcweir } 387cdf0e10cSrcweir break; 388cdf0e10cSrcweir 389cdf0e10cSrcweir case SID_DELETE: 390cdf0e10cSrcweir case FN_BACKSPACE: 391cdf0e10cSrcweir if (pSh->IsObjSelected() && !pSdrView->IsTextEdit()) 392cdf0e10cSrcweir { 393cdf0e10cSrcweir bDone = sal_True; 394cdf0e10cSrcweir 395cdf0e10cSrcweir if( GetView().IsDrawRotate() ) 396cdf0e10cSrcweir { 397cdf0e10cSrcweir pSh->SetDragMode( SDRDRAG_MOVE ); 398cdf0e10cSrcweir GetView().FlipDrawRotate(); 399cdf0e10cSrcweir } 400cdf0e10cSrcweir 401cdf0e10cSrcweir pSh->SetModified(); 402cdf0e10cSrcweir pSh->DelSelectedObj(); 403cdf0e10cSrcweir 404cdf0e10cSrcweir if (rReq.IsAPI() || 405cdf0e10cSrcweir GetView().GetEditWin().IsObjectSelect() ) 406cdf0e10cSrcweir { 407cdf0e10cSrcweir // Wenn Basic-Aufruf, dann zurueck in die Textshell, da das 408cdf0e10cSrcweir // Basic sonst keine Rueckkehrmoeglichkeit hat. 409cdf0e10cSrcweir if (GetView().GetDrawFuncPtr()) 410cdf0e10cSrcweir { 411cdf0e10cSrcweir GetView().GetDrawFuncPtr()->Deactivate(); 412cdf0e10cSrcweir GetView().SetDrawFuncPtr(NULL); 413cdf0e10cSrcweir } 414cdf0e10cSrcweir GetView().LeaveDrawCreate(); // In Selektionsmode wechseln 415cdf0e10cSrcweir } 416cdf0e10cSrcweir 417cdf0e10cSrcweir if (pSh->IsSelFrmMode()) 418cdf0e10cSrcweir { 419cdf0e10cSrcweir pSh->LeaveSelFrmMode(); 420cdf0e10cSrcweir // #105852# FME 421cdf0e10cSrcweir // pSh->NoEdit(); 422cdf0e10cSrcweir } 423cdf0e10cSrcweir bNotify = sal_True; 424cdf0e10cSrcweir } 425cdf0e10cSrcweir break; 426cdf0e10cSrcweir 427cdf0e10cSrcweir case SID_GROUP: 428cdf0e10cSrcweir if (pSh->IsObjSelected() > 1 && pSh->IsGroupAllowed()) 429cdf0e10cSrcweir { 430cdf0e10cSrcweir pSh->GroupSelection(); // Objekt gruppieren 431cdf0e10cSrcweir rBind.Invalidate(SID_UNGROUP); 432cdf0e10cSrcweir } 433cdf0e10cSrcweir break; 434cdf0e10cSrcweir 435cdf0e10cSrcweir case SID_UNGROUP: 436cdf0e10cSrcweir if (pSh->IsGroupSelected()) 437cdf0e10cSrcweir { 438cdf0e10cSrcweir pSh->UnGroupSelection(); // Objektgruppierung aufheben 439cdf0e10cSrcweir rBind.Invalidate(SID_GROUP); 440cdf0e10cSrcweir } 441cdf0e10cSrcweir break; 442cdf0e10cSrcweir 443cdf0e10cSrcweir case SID_ENTER_GROUP: 444cdf0e10cSrcweir if (pSh->IsGroupSelected()) 445cdf0e10cSrcweir { 446cdf0e10cSrcweir pSdrView->EnterMarkedGroup(); 447cdf0e10cSrcweir rBind.InvalidateAll(sal_False); 448cdf0e10cSrcweir } 449cdf0e10cSrcweir break; 450cdf0e10cSrcweir 451cdf0e10cSrcweir case SID_LEAVE_GROUP: 452cdf0e10cSrcweir if (pSdrView->IsGroupEntered()) 453cdf0e10cSrcweir { 454cdf0e10cSrcweir pSdrView->LeaveOneGroup(); 455cdf0e10cSrcweir rBind.Invalidate(SID_ENTER_GROUP); 456cdf0e10cSrcweir rBind.Invalidate(SID_UNGROUP); 457cdf0e10cSrcweir } 458cdf0e10cSrcweir break; 459cdf0e10cSrcweir 460cdf0e10cSrcweir case SID_OBJECT_ALIGN_LEFT: 461cdf0e10cSrcweir case SID_OBJECT_ALIGN_CENTER: 462cdf0e10cSrcweir case SID_OBJECT_ALIGN_RIGHT: 463cdf0e10cSrcweir case SID_OBJECT_ALIGN_UP: 464cdf0e10cSrcweir case SID_OBJECT_ALIGN_MIDDLE: 465cdf0e10cSrcweir case SID_OBJECT_ALIGN_DOWN: 466cdf0e10cSrcweir { 467cdf0e10cSrcweir if ( bAlignPossible ) 468cdf0e10cSrcweir { 469cdf0e10cSrcweir const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); 470cdf0e10cSrcweir if( rMarkList.GetMarkCount() == 1 && bAlignPossible ) 471cdf0e10cSrcweir { // Objekte nicht aneinander ausrichten 472cdf0e10cSrcweir 473cdf0e10cSrcweir sal_uInt16 nAnchor = pSh->GetAnchorId(); 474cdf0e10cSrcweir if (nAnchor == FLY_AS_CHAR) 475cdf0e10cSrcweir { 476cdf0e10cSrcweir sal_Int16 nVertOrient = -1; 477cdf0e10cSrcweir 478cdf0e10cSrcweir switch (nSlotId) 479cdf0e10cSrcweir { 480cdf0e10cSrcweir case SID_OBJECT_ALIGN_UP: 481cdf0e10cSrcweir nVertOrient = text::VertOrientation::TOP; 482cdf0e10cSrcweir break; 483cdf0e10cSrcweir case SID_OBJECT_ALIGN_MIDDLE: 484cdf0e10cSrcweir nVertOrient = text::VertOrientation::CENTER; 485cdf0e10cSrcweir break; 486cdf0e10cSrcweir case SID_OBJECT_ALIGN_DOWN: 487cdf0e10cSrcweir nVertOrient = text::VertOrientation::BOTTOM; 488cdf0e10cSrcweir break; 489cdf0e10cSrcweir default: 490cdf0e10cSrcweir break; 491cdf0e10cSrcweir } 492cdf0e10cSrcweir if (nVertOrient != -1) 493cdf0e10cSrcweir { 494cdf0e10cSrcweir pSh->StartAction(); 495cdf0e10cSrcweir SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 496cdf0e10cSrcweir SwFrmFmt* pFrmFmt = FindFrmFmt( pObj ); 497cdf0e10cSrcweir SwFmtVertOrient aVOrient((SwFmtVertOrient&)pFrmFmt->GetFmtAttr(RES_VERT_ORIENT)); 498cdf0e10cSrcweir aVOrient.SetVertOrient( nVertOrient ); 499cdf0e10cSrcweir pFrmFmt->SetFmtAttr(aVOrient); 500cdf0e10cSrcweir pSh->EndAction(); 501cdf0e10cSrcweir } 502cdf0e10cSrcweir break; 503cdf0e10cSrcweir } 504cdf0e10cSrcweir if (nAnchor == FLY_AT_PARA) 505cdf0e10cSrcweir break; // Absatzverankerte Rahmen nicht ausrichten 506cdf0e10cSrcweir } 507cdf0e10cSrcweir 508cdf0e10cSrcweir pSh->StartAction(); 509cdf0e10cSrcweir switch (nSlotId) 510cdf0e10cSrcweir { 511cdf0e10cSrcweir case SID_OBJECT_ALIGN_LEFT: 512cdf0e10cSrcweir pSdrView->AlignMarkedObjects(SDRHALIGN_LEFT, SDRVALIGN_NONE); 513cdf0e10cSrcweir break; 514cdf0e10cSrcweir case SID_OBJECT_ALIGN_CENTER: 515cdf0e10cSrcweir pSdrView->AlignMarkedObjects(SDRHALIGN_CENTER, SDRVALIGN_NONE); 516cdf0e10cSrcweir break; 517cdf0e10cSrcweir case SID_OBJECT_ALIGN_RIGHT: 518cdf0e10cSrcweir pSdrView->AlignMarkedObjects(SDRHALIGN_RIGHT, SDRVALIGN_NONE); 519cdf0e10cSrcweir break; 520cdf0e10cSrcweir case SID_OBJECT_ALIGN_UP: 521cdf0e10cSrcweir pSdrView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_TOP); 522cdf0e10cSrcweir break; 523cdf0e10cSrcweir case SID_OBJECT_ALIGN_MIDDLE: 524cdf0e10cSrcweir pSdrView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_CENTER); 525cdf0e10cSrcweir break; 526cdf0e10cSrcweir case SID_OBJECT_ALIGN_DOWN: 527cdf0e10cSrcweir pSdrView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_BOTTOM); 528cdf0e10cSrcweir break; 529cdf0e10cSrcweir } 530cdf0e10cSrcweir pSh->EndAction(); 531cdf0e10cSrcweir } 532cdf0e10cSrcweir } 533cdf0e10cSrcweir break; 534cdf0e10cSrcweir 535cdf0e10cSrcweir case FN_FRAME_UP: 536cdf0e10cSrcweir bTopParam = sal_False; 537cdf0e10cSrcweir /* no break */ 538cdf0e10cSrcweir case SID_FRAME_TO_TOP: 539cdf0e10cSrcweir pSh->SelectionToTop( bTopParam ); 540cdf0e10cSrcweir break; 541cdf0e10cSrcweir 542cdf0e10cSrcweir case FN_FRAME_DOWN: 543cdf0e10cSrcweir bBottomParam = sal_False; 544cdf0e10cSrcweir /* no break */ 545cdf0e10cSrcweir case SID_FRAME_TO_BOTTOM: 546cdf0e10cSrcweir pSh->SelectionToBottom( bBottomParam ); 547cdf0e10cSrcweir break; 548cdf0e10cSrcweir 549cdf0e10cSrcweir case FN_NAME_SHAPE: 550cdf0e10cSrcweir { 551cdf0e10cSrcweir bDone = sal_True; 552cdf0e10cSrcweir 553cdf0e10cSrcweir if(1L == pSdrView->GetMarkedObjectCount()) 554cdf0e10cSrcweir { 555cdf0e10cSrcweir // #i68101# 556cdf0e10cSrcweir SdrObject* pSelected = pSdrView->GetMarkedObjectByIndex(0L); 557cdf0e10cSrcweir OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)"); 558cdf0e10cSrcweir String aName(pSelected->GetName()); 559cdf0e10cSrcweir 560cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 561cdf0e10cSrcweir OSL_ENSURE(pFact, "Dialogdiet fail!"); 562cdf0e10cSrcweir AbstractSvxObjectNameDialog* pDlg = pFact->CreateSvxObjectNameDialog(NULL, aName); 563cdf0e10cSrcweir OSL_ENSURE(pDlg, "Dialogdiet fail!"); 564cdf0e10cSrcweir 565cdf0e10cSrcweir pDlg->SetCheckNameHdl(LINK(this, SwDrawBaseShell, CheckGroupShapeNameHdl)); 566cdf0e10cSrcweir 567cdf0e10cSrcweir if(RET_OK == pDlg->Execute()) 568cdf0e10cSrcweir { 569cdf0e10cSrcweir pDlg->GetName(aName); 570cdf0e10cSrcweir pSelected->SetName(aName); 571cdf0e10cSrcweir pSh->SetModified(); 572cdf0e10cSrcweir } 573cdf0e10cSrcweir 574cdf0e10cSrcweir delete pDlg; 575cdf0e10cSrcweir } 576cdf0e10cSrcweir 577cdf0e10cSrcweir break; 578cdf0e10cSrcweir } 579cdf0e10cSrcweir 580cdf0e10cSrcweir // #i68101# 581cdf0e10cSrcweir case FN_TITLE_DESCRIPTION_SHAPE: 582cdf0e10cSrcweir { 583cdf0e10cSrcweir bDone = sal_True; 584cdf0e10cSrcweir 585cdf0e10cSrcweir if(1L == pSdrView->GetMarkedObjectCount()) 586cdf0e10cSrcweir { 587cdf0e10cSrcweir SdrObject* pSelected = pSdrView->GetMarkedObjectByIndex(0L); 588cdf0e10cSrcweir OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)"); 589cdf0e10cSrcweir String aTitle(pSelected->GetTitle()); 590cdf0e10cSrcweir String aDescription(pSelected->GetDescription()); 591cdf0e10cSrcweir 592cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 593cdf0e10cSrcweir OSL_ENSURE(pFact, "Dialogdiet fail!"); 594cdf0e10cSrcweir AbstractSvxObjectTitleDescDialog* pDlg = pFact->CreateSvxObjectTitleDescDialog(NULL, aTitle, aDescription); 595cdf0e10cSrcweir OSL_ENSURE(pDlg, "Dialogdiet fail!"); 596cdf0e10cSrcweir 597cdf0e10cSrcweir if(RET_OK == pDlg->Execute()) 598cdf0e10cSrcweir { 599cdf0e10cSrcweir pDlg->GetTitle(aTitle); 600cdf0e10cSrcweir pDlg->GetDescription(aDescription); 601cdf0e10cSrcweir 602cdf0e10cSrcweir pSelected->SetTitle(aTitle); 603cdf0e10cSrcweir pSelected->SetDescription(aDescription); 604cdf0e10cSrcweir 605cdf0e10cSrcweir pSh->SetModified(); 606cdf0e10cSrcweir } 607cdf0e10cSrcweir 608cdf0e10cSrcweir delete pDlg; 609cdf0e10cSrcweir } 610cdf0e10cSrcweir 611cdf0e10cSrcweir break; 612cdf0e10cSrcweir } 613cdf0e10cSrcweir 614cdf0e10cSrcweir default: 615cdf0e10cSrcweir DBG_ASSERT(!this, "falscher Dispatcher"); 616cdf0e10cSrcweir return; 617cdf0e10cSrcweir } 618cdf0e10cSrcweir if(!bDone) 619cdf0e10cSrcweir { 620cdf0e10cSrcweir if(nSlotId >= SID_OBJECT_ALIGN_LEFT && nSlotId <= SID_OBJECT_ALIGN_DOWN) 621cdf0e10cSrcweir rBind.Invalidate(SID_ATTR_LONG_LRSPACE); 622cdf0e10cSrcweir if (pSdrView->GetModel()->IsChanged()) 623cdf0e10cSrcweir pSh->SetModified(); 624cdf0e10cSrcweir else if (bChanged) 625cdf0e10cSrcweir pSdrView->GetModel()->SetChanged(sal_True); 626cdf0e10cSrcweir // 40220: Nach dem Loeschen von DrawObjekten ueber die API GPF durch Selbstzerstoerung 627cdf0e10cSrcweir if(bNotify) 628cdf0e10cSrcweir GetView().AttrChangedNotify(pSh); // ggf Shellwechsel... 629cdf0e10cSrcweir } 630cdf0e10cSrcweir } 631cdf0e10cSrcweir /* -----------------------------27.02.2002 15:27------------------------------ 632cdf0e10cSrcweir Checks whether a given name is allowed for a group shape 633cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 634cdf0e10cSrcweir IMPL_LINK( SwDrawBaseShell, CheckGroupShapeNameHdl, AbstractSvxNameDialog*, pNameDialog ) 635cdf0e10cSrcweir { 636cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 637cdf0e10cSrcweir SdrView *pSdrView = rSh.GetDrawView(); 638cdf0e10cSrcweir const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); 639cdf0e10cSrcweir DBG_ASSERT(rMarkList.GetMarkCount() == 1, "wrong draw selection"); 640cdf0e10cSrcweir SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 641cdf0e10cSrcweir const String sCurrentName = pObj->GetName(); 642cdf0e10cSrcweir String sNewName; 643cdf0e10cSrcweir pNameDialog->GetName(sNewName); 644cdf0e10cSrcweir long nRet = 0; 645cdf0e10cSrcweir if(!sNewName.Len() || sCurrentName == sNewName) 646cdf0e10cSrcweir nRet = 1; 647cdf0e10cSrcweir else 648cdf0e10cSrcweir { 649cdf0e10cSrcweir nRet = 1; 650*26ea3662SArmin Le Grand SwDrawModel* pModel = rSh.getIDocumentDrawModelAccess()->GetDrawModel(); 651cdf0e10cSrcweir // --> OD 2006-03-09 #i51726# - all drawing objects can be named now. 652cdf0e10cSrcweir // consider also drawing objects inside group objects 653cdf0e10cSrcweir // SdrPage* pPage = pModel->GetPage(0); 654cdf0e10cSrcweir // sal_uInt32 nCount = pPage->GetObjCount(); 655cdf0e10cSrcweir // for( sal_uInt32 i=0; i< nCount; i++ ) 656cdf0e10cSrcweir // { 657cdf0e10cSrcweir // SdrObject* pTemp = pPage->GetObj(i); 658cdf0e10cSrcweir // if(pObj != pTemp && pTemp->ISA(SdrObjGroup) && pTemp->GetName() == sNewName) 659cdf0e10cSrcweir // { 660cdf0e10cSrcweir // nRet = 0; 661cdf0e10cSrcweir // break; 662cdf0e10cSrcweir // } 663cdf0e10cSrcweir // } 664cdf0e10cSrcweir SdrObjListIter aIter( *(pModel->GetPage(0)), IM_DEEPWITHGROUPS ); 665cdf0e10cSrcweir while( aIter.IsMore() ) 666cdf0e10cSrcweir { 667cdf0e10cSrcweir SdrObject* pTempObj = aIter.Next(); 668cdf0e10cSrcweir if ( pObj != pTempObj && pTempObj->GetName() == sNewName ) 669cdf0e10cSrcweir { 670cdf0e10cSrcweir nRet = 0; 671cdf0e10cSrcweir break; 672cdf0e10cSrcweir } 673cdf0e10cSrcweir } 674cdf0e10cSrcweir // <-- 675cdf0e10cSrcweir } 676cdf0e10cSrcweir return nRet; 677cdf0e10cSrcweir } 678cdf0e10cSrcweir /*-------------------------------------------------------------------- 679cdf0e10cSrcweir Beschreibung: 680cdf0e10cSrcweir --------------------------------------------------------------------*/ 681cdf0e10cSrcweir void SwDrawBaseShell::GetState(SfxItemSet& rSet) 682cdf0e10cSrcweir { 683cdf0e10cSrcweir SwWrtShell &rSh = GetShell(); 684cdf0e10cSrcweir SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList(); 685cdf0e10cSrcweir SfxWhichIter aIter( rSet ); 686cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 687cdf0e10cSrcweir sal_Bool bProtected = rSh.IsSelObjProtected(FLYPROTECT_CONTENT); 688cdf0e10cSrcweir 689cdf0e10cSrcweir if (!bProtected) // Im Parent nachsehen 690cdf0e10cSrcweir bProtected |= rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0; 691cdf0e10cSrcweir 692cdf0e10cSrcweir while( nWhich ) 693cdf0e10cSrcweir { 694cdf0e10cSrcweir switch( nWhich ) 695cdf0e10cSrcweir { 696cdf0e10cSrcweir case FN_DRAW_WRAP_DLG: 697cdf0e10cSrcweir case SID_ATTR_TRANSFORM: 698cdf0e10cSrcweir case SID_FRAME_TO_TOP: 699cdf0e10cSrcweir case SID_FRAME_TO_BOTTOM: 700cdf0e10cSrcweir case FN_FRAME_UP: 701cdf0e10cSrcweir case FN_FRAME_DOWN: 702cdf0e10cSrcweir case SID_DELETE: 703cdf0e10cSrcweir case FN_BACKSPACE: 704cdf0e10cSrcweir if( bProtected || !rSh.IsObjSelected() ) 705cdf0e10cSrcweir rSet.DisableItem( nWhich ); 706cdf0e10cSrcweir break; 707cdf0e10cSrcweir case SID_GROUP: 708cdf0e10cSrcweir if ( rSh.IsObjSelected() < 2 || bProtected || !rSh.IsGroupAllowed() ) 709cdf0e10cSrcweir rSet.DisableItem( nWhich ); 710cdf0e10cSrcweir break; 711cdf0e10cSrcweir case SID_UNGROUP: 712cdf0e10cSrcweir if ( !rSh.IsGroupSelected() || bProtected ) 713cdf0e10cSrcweir rSet.DisableItem( nWhich ); 714cdf0e10cSrcweir break; 715cdf0e10cSrcweir case SID_ENTER_GROUP: 716cdf0e10cSrcweir if ( !rSh.IsGroupSelected() ) 717cdf0e10cSrcweir rSet.DisableItem( nWhich ); 718cdf0e10cSrcweir break; 719cdf0e10cSrcweir case SID_LEAVE_GROUP: 720cdf0e10cSrcweir if ( !pSdrView->IsGroupEntered() ) 721cdf0e10cSrcweir rSet.DisableItem( nWhich ); 722cdf0e10cSrcweir break; 723cdf0e10cSrcweir case SID_OBJECT_ALIGN_LEFT: 724cdf0e10cSrcweir case SID_OBJECT_ALIGN_CENTER: 725cdf0e10cSrcweir case SID_OBJECT_ALIGN_RIGHT: 726cdf0e10cSrcweir case SID_OBJECT_ALIGN_UP: 727cdf0e10cSrcweir case SID_OBJECT_ALIGN_MIDDLE: 728cdf0e10cSrcweir case SID_OBJECT_ALIGN_DOWN: 729cdf0e10cSrcweir case SID_OBJECT_ALIGN: 730cdf0e10cSrcweir if ( !rSh.IsAlignPossible() || bProtected ) 731cdf0e10cSrcweir rSet.DisableItem( nWhich ); 732cdf0e10cSrcweir else 733cdf0e10cSrcweir { 734cdf0e10cSrcweir SfxAllEnumItem aEnumItem(nWhich, USHRT_MAX); 735cdf0e10cSrcweir const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); 736cdf0e10cSrcweir //if only one object is selected it can only be vertically 737cdf0e10cSrcweir // aligned because it is character bound 738cdf0e10cSrcweir if( rMarkList.GetMarkCount() == 1 ) 739cdf0e10cSrcweir { 740cdf0e10cSrcweir aEnumItem.DisableValue(SID_OBJECT_ALIGN_LEFT); 741cdf0e10cSrcweir aEnumItem.DisableValue(SID_OBJECT_ALIGN_CENTER); 742cdf0e10cSrcweir aEnumItem.DisableValue(SID_OBJECT_ALIGN_RIGHT); 743cdf0e10cSrcweir } 744cdf0e10cSrcweir rSet.Put(aEnumItem); 745cdf0e10cSrcweir } 746cdf0e10cSrcweir break; 747cdf0e10cSrcweir 748cdf0e10cSrcweir case FN_NAME_SHAPE : 749cdf0e10cSrcweir { 750cdf0e10cSrcweir if(1L != pSdrView->GetMarkedObjectCount()) 751cdf0e10cSrcweir { 752cdf0e10cSrcweir rSet.DisableItem( nWhich ); 753cdf0e10cSrcweir } 754cdf0e10cSrcweir } 755cdf0e10cSrcweir break; 756cdf0e10cSrcweir 757cdf0e10cSrcweir // #i68101# 758cdf0e10cSrcweir case FN_TITLE_DESCRIPTION_SHAPE: 759cdf0e10cSrcweir { 760cdf0e10cSrcweir const bool bIsWebView(NULL != dynamic_cast<SwWebView*>(&GetView())); 761cdf0e10cSrcweir 762cdf0e10cSrcweir if(!bIsWebView && 1L != pSdrView->GetMarkedObjectCount()) 763cdf0e10cSrcweir { 764cdf0e10cSrcweir rSet.DisableItem( nWhich ); 765cdf0e10cSrcweir } 766cdf0e10cSrcweir } 767cdf0e10cSrcweir break; 768cdf0e10cSrcweir } 769cdf0e10cSrcweir nWhich = aIter.NextWhich(); 770cdf0e10cSrcweir } 771cdf0e10cSrcweir } 772cdf0e10cSrcweir 773ee093554SAndre Fischer 774ee093554SAndre Fischer void SwDrawBaseShell::GetDrawAttrStateForIFBX( SfxItemSet& rSet ) 775ee093554SAndre Fischer { 776ee093554SAndre Fischer SwWrtShell *pSh = &GetShell(); 777ee093554SAndre Fischer SdrView* pSdrView = pSh->GetDrawView(); 778ee093554SAndre Fischer const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); 779ee093554SAndre Fischer if( rMarkList.GetMark(0) != 0 ) 780ee093554SAndre Fischer { 781cb0cd92eSPavel Janík // SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();//OST_IFBX@WL2 782ee093554SAndre Fischer SfxItemSet aNewAttr(pSdrView->GetGeoAttrFromMarked()); 783ee093554SAndre Fischer rSet.Put(aNewAttr,false); 784ee093554SAndre Fischer } 785ee093554SAndre Fischer } 786cdf0e10cSrcweir 787cdf0e10cSrcweir 788cdf0e10cSrcweir sal_Bool SwDrawBaseShell::Disable(SfxItemSet& rSet, sal_uInt16 nWhich) 789cdf0e10cSrcweir { 790cdf0e10cSrcweir sal_Bool bDisable = GetShell().IsSelObjProtected(FLYPROTECT_CONTENT); 791cdf0e10cSrcweir 792cdf0e10cSrcweir if (bDisable) 793cdf0e10cSrcweir { 794cdf0e10cSrcweir if (nWhich) 795cdf0e10cSrcweir rSet.DisableItem( nWhich ); 796cdf0e10cSrcweir else 797cdf0e10cSrcweir { 798cdf0e10cSrcweir SfxWhichIter aIter( rSet ); 799cdf0e10cSrcweir nWhich = aIter.FirstWhich(); 800cdf0e10cSrcweir while (nWhich) 801cdf0e10cSrcweir { 802cdf0e10cSrcweir rSet.DisableItem( nWhich ); 803cdf0e10cSrcweir nWhich = aIter.NextWhich(); 804cdf0e10cSrcweir } 805cdf0e10cSrcweir } 806cdf0e10cSrcweir } 807cdf0e10cSrcweir 808cdf0e10cSrcweir return bDisable; 809cdf0e10cSrcweir } 810cdf0e10cSrcweir 811cdf0e10cSrcweir /*-- 09.03.2004 13:15:03--------------------------------------------------- 812cdf0e10cSrcweir Validate of drawing positions 813cdf0e10cSrcweir -----------------------------------------------------------------------*/ 814cdf0e10cSrcweir IMPL_LINK(SwDrawBaseShell, ValidatePosition, SvxSwFrameValidation*, pValidation ) 815cdf0e10cSrcweir { 816cdf0e10cSrcweir SwWrtShell *pSh = &GetShell(); 817cdf0e10cSrcweir pValidation->nMinHeight = MINFLY; 818cdf0e10cSrcweir pValidation->nMinWidth = MINFLY; 819cdf0e10cSrcweir 820cdf0e10cSrcweir SwRect aBoundRect; 821cdf0e10cSrcweir 822cdf0e10cSrcweir // OD 18.09.2003 #i18732# - adjustment for allowing vertical position 823cdf0e10cSrcweir // aligned to page for fly frame anchored to paragraph or to character. 824cdf0e10cSrcweir const RndStdIds eAnchorType = static_cast<RndStdIds >(pValidation->nAnchorType); 825cdf0e10cSrcweir const SwPosition* pCntntPos = 0; 826cdf0e10cSrcweir SdrView* pSdrView = pSh->GetDrawView(); 827cdf0e10cSrcweir const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); 828cdf0e10cSrcweir if( rMarkList.GetMarkCount() == 1 ) 829cdf0e10cSrcweir { 830cdf0e10cSrcweir SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 831cdf0e10cSrcweir SwFrmFmt* pFrmFmt = FindFrmFmt( pObj ); 832cdf0e10cSrcweir pCntntPos = pFrmFmt->GetAnchor().GetCntntAnchor(); 833cdf0e10cSrcweir } 834cdf0e10cSrcweir 835cdf0e10cSrcweir pSh->CalcBoundRect( aBoundRect, eAnchorType, 836cdf0e10cSrcweir pValidation->nHRelOrient, 837cdf0e10cSrcweir pValidation->nVRelOrient, 838cdf0e10cSrcweir pCntntPos, 839cdf0e10cSrcweir pValidation->bFollowTextFlow, 840cdf0e10cSrcweir pValidation->bMirror, NULL, &pValidation->aPercentSize); 841cdf0e10cSrcweir 842cdf0e10cSrcweir sal_Bool bIsInVertical( sal_False ); 843cdf0e10cSrcweir { 844cdf0e10cSrcweir sal_Bool bRTL; 845cdf0e10cSrcweir sal_Bool bVertL2R; 846cdf0e10cSrcweir bIsInVertical = pSh->IsFrmVertical(sal_True, bRTL, bVertL2R); 847cdf0e10cSrcweir } 848cdf0e10cSrcweir if(bIsInVertical) 849cdf0e10cSrcweir { 850cdf0e10cSrcweir Point aPos(aBoundRect.Pos()); 851cdf0e10cSrcweir long nTmp = aPos.X(); 852cdf0e10cSrcweir aPos.X() = aPos.Y(); 853cdf0e10cSrcweir aPos.Y() = nTmp; 854cdf0e10cSrcweir Size aSize(aBoundRect.SSize()); 855cdf0e10cSrcweir nTmp = aSize.Width(); 856cdf0e10cSrcweir aSize.Width() = aSize.Height(); 857cdf0e10cSrcweir aSize.Height() = nTmp; 858cdf0e10cSrcweir aBoundRect.Chg( aPos, aSize ); 859cdf0e10cSrcweir //exchange width/height to enable correct values 860cdf0e10cSrcweir nTmp = pValidation->nWidth; 861cdf0e10cSrcweir pValidation->nWidth = pValidation->nHeight; 862cdf0e10cSrcweir pValidation->nHeight = nTmp; 863cdf0e10cSrcweir } 864cdf0e10cSrcweir if ((eAnchorType == FLY_AT_PAGE) || (eAnchorType == FLY_AT_FLY)) 865cdf0e10cSrcweir { 866cdf0e10cSrcweir // MinimalPosition 867cdf0e10cSrcweir pValidation->nMinHPos = aBoundRect.Left(); 868cdf0e10cSrcweir pValidation->nMinVPos = aBoundRect.Top(); 869cdf0e10cSrcweir SwTwips nH = pValidation->nHPos; 870cdf0e10cSrcweir SwTwips nV = pValidation->nVPos; 871cdf0e10cSrcweir 872cdf0e10cSrcweir if (pValidation->nHPos + pValidation->nWidth > aBoundRect.Right()) 873cdf0e10cSrcweir { 874cdf0e10cSrcweir if (pValidation->nHoriOrient == text::HoriOrientation::NONE) 875cdf0e10cSrcweir { 876cdf0e10cSrcweir pValidation->nHPos -= ((pValidation->nHPos + pValidation->nWidth) - aBoundRect.Right()); 877cdf0e10cSrcweir nH = pValidation->nHPos; 878cdf0e10cSrcweir } 879cdf0e10cSrcweir else 880cdf0e10cSrcweir pValidation->nWidth = aBoundRect.Right() - pValidation->nHPos; 881cdf0e10cSrcweir } 882cdf0e10cSrcweir 883cdf0e10cSrcweir if (pValidation->nHPos + pValidation->nWidth > aBoundRect.Right()) 884cdf0e10cSrcweir pValidation->nWidth = aBoundRect.Right() - pValidation->nHPos; 885cdf0e10cSrcweir 886cdf0e10cSrcweir if (pValidation->nVPos + pValidation->nHeight > aBoundRect.Bottom()) 887cdf0e10cSrcweir { 888cdf0e10cSrcweir if (pValidation->nVertOrient == text::VertOrientation::NONE) 889cdf0e10cSrcweir { 890cdf0e10cSrcweir pValidation->nVPos -= ((pValidation->nVPos + pValidation->nHeight) - aBoundRect.Bottom()); 891cdf0e10cSrcweir nV = pValidation->nVPos; 892cdf0e10cSrcweir } 893cdf0e10cSrcweir else 894cdf0e10cSrcweir pValidation->nHeight = aBoundRect.Bottom() - pValidation->nVPos; 895cdf0e10cSrcweir } 896cdf0e10cSrcweir 897cdf0e10cSrcweir if (pValidation->nVPos + pValidation->nHeight > aBoundRect.Bottom()) 898cdf0e10cSrcweir pValidation->nHeight = aBoundRect.Bottom() - pValidation->nVPos; 899cdf0e10cSrcweir 900cdf0e10cSrcweir if ( pValidation->nVertOrient != text::VertOrientation::NONE ) 901cdf0e10cSrcweir nV = aBoundRect.Top(); 902cdf0e10cSrcweir 903cdf0e10cSrcweir if ( pValidation->nHoriOrient != text::HoriOrientation::NONE ) 904cdf0e10cSrcweir nH = aBoundRect.Left(); 905cdf0e10cSrcweir 906cdf0e10cSrcweir pValidation->nMaxHPos = aBoundRect.Right() - pValidation->nWidth; 907cdf0e10cSrcweir pValidation->nMaxHeight = aBoundRect.Bottom() - nV; 908cdf0e10cSrcweir 909cdf0e10cSrcweir pValidation->nMaxVPos = aBoundRect.Bottom() - pValidation->nHeight; 910cdf0e10cSrcweir pValidation->nMaxWidth = aBoundRect.Right() - nH; 911cdf0e10cSrcweir } 912cdf0e10cSrcweir else if ((eAnchorType == FLY_AT_PARA) || (eAnchorType == FLY_AT_CHAR)) 913cdf0e10cSrcweir { 914cdf0e10cSrcweir if (pValidation->nHPos + pValidation->nWidth > aBoundRect.Right()) 915cdf0e10cSrcweir { 916cdf0e10cSrcweir if (pValidation->nHoriOrient == text::HoriOrientation::NONE) 917cdf0e10cSrcweir { 918cdf0e10cSrcweir pValidation->nHPos -= ((pValidation->nHPos + pValidation->nWidth) - aBoundRect.Right()); 919cdf0e10cSrcweir } 920cdf0e10cSrcweir else 921cdf0e10cSrcweir pValidation->nWidth = aBoundRect.Right() - pValidation->nHPos; 922cdf0e10cSrcweir } 923cdf0e10cSrcweir 924cdf0e10cSrcweir // OD 29.09.2003 #i17567#, #i18732# - consider following the text flow 925cdf0e10cSrcweir // and alignment at page areas. 926cdf0e10cSrcweir const bool bMaxVPosAtBottom = !pValidation->bFollowTextFlow || 927cdf0e10cSrcweir pValidation->nVRelOrient == text::RelOrientation::PAGE_FRAME || 928cdf0e10cSrcweir pValidation->nVRelOrient == text::RelOrientation::PAGE_PRINT_AREA; 929cdf0e10cSrcweir { 930cdf0e10cSrcweir SwTwips nTmpMaxVPos = ( bMaxVPosAtBottom 931cdf0e10cSrcweir ? aBoundRect.Bottom() 932cdf0e10cSrcweir : aBoundRect.Height() ) - 933cdf0e10cSrcweir pValidation->nHeight; 934cdf0e10cSrcweir if ( pValidation->nVPos > nTmpMaxVPos ) 935cdf0e10cSrcweir { 936cdf0e10cSrcweir if (pValidation->nVertOrient == text::VertOrientation::NONE) 937cdf0e10cSrcweir { 938cdf0e10cSrcweir pValidation->nVPos = nTmpMaxVPos; 939cdf0e10cSrcweir } 940cdf0e10cSrcweir else 941cdf0e10cSrcweir { 942cdf0e10cSrcweir pValidation->nHeight = ( bMaxVPosAtBottom 943cdf0e10cSrcweir ? aBoundRect.Bottom() 944cdf0e10cSrcweir : aBoundRect.Height() ) - pValidation->nVPos; 945cdf0e10cSrcweir } 946cdf0e10cSrcweir } 947cdf0e10cSrcweir } 948cdf0e10cSrcweir 949cdf0e10cSrcweir pValidation->nMinHPos = aBoundRect.Left(); 950cdf0e10cSrcweir pValidation->nMaxHPos = aBoundRect.Right() - pValidation->nWidth; 951cdf0e10cSrcweir 952cdf0e10cSrcweir pValidation->nMinVPos = aBoundRect.Top(); 953cdf0e10cSrcweir // OD 26.09.2003 #i17567#, #i18732# - determine maximum vertical position 954cdf0e10cSrcweir if ( bMaxVPosAtBottom ) 955cdf0e10cSrcweir { 956cdf0e10cSrcweir pValidation->nMaxVPos = aBoundRect.Bottom() - pValidation->nHeight; 957cdf0e10cSrcweir } 958cdf0e10cSrcweir else 959cdf0e10cSrcweir { 960cdf0e10cSrcweir pValidation->nMaxVPos = aBoundRect.Height() - pValidation->nHeight; 961cdf0e10cSrcweir } 962cdf0e10cSrcweir 963cdf0e10cSrcweir // Maximale Breite Hoehe 964cdf0e10cSrcweir const SwTwips nH = ( pValidation->nHoriOrient != text::HoriOrientation::NONE ) 965cdf0e10cSrcweir ? aBoundRect.Left() 966cdf0e10cSrcweir : pValidation->nHPos; 967cdf0e10cSrcweir const SwTwips nV = ( pValidation->nVertOrient != text::VertOrientation::NONE ) 968cdf0e10cSrcweir ? aBoundRect.Top() 969cdf0e10cSrcweir : pValidation->nVPos; 970cdf0e10cSrcweir pValidation->nMaxHeight = pValidation->nMaxVPos + pValidation->nHeight - nV; 971cdf0e10cSrcweir pValidation->nMaxWidth = pValidation->nMaxHPos + pValidation->nWidth - nH; 972cdf0e10cSrcweir } 973cdf0e10cSrcweir else if (eAnchorType == FLY_AS_CHAR) 974cdf0e10cSrcweir { 975cdf0e10cSrcweir pValidation->nMinHPos = 0; 976cdf0e10cSrcweir pValidation->nMaxHPos = 0; 977cdf0e10cSrcweir 978cdf0e10cSrcweir pValidation->nMaxHeight = aBoundRect.Height(); 979cdf0e10cSrcweir pValidation->nMaxWidth = aBoundRect.Width(); 980cdf0e10cSrcweir 981cdf0e10cSrcweir pValidation->nMaxVPos = aBoundRect.Height(); 982cdf0e10cSrcweir pValidation->nMinVPos = -aBoundRect.Height() + pValidation->nHeight; 983cdf0e10cSrcweir if (pValidation->nMaxVPos < pValidation->nMinVPos) 984cdf0e10cSrcweir { 985cdf0e10cSrcweir pValidation->nMinVPos = pValidation->nMaxVPos; 986cdf0e10cSrcweir pValidation->nMaxVPos = -aBoundRect.Height(); 987cdf0e10cSrcweir } 988cdf0e10cSrcweir } 989cdf0e10cSrcweir if(bIsInVertical) 990cdf0e10cSrcweir { 991cdf0e10cSrcweir //restore width/height exchange 992cdf0e10cSrcweir long nTmp = pValidation->nWidth; 993cdf0e10cSrcweir pValidation->nWidth = pValidation->nHeight; 994cdf0e10cSrcweir pValidation->nHeight = nTmp; 995cdf0e10cSrcweir } 996cdf0e10cSrcweir 997cdf0e10cSrcweir if (pValidation->nMaxWidth < pValidation->nWidth) 998cdf0e10cSrcweir pValidation->nWidth = pValidation->nMaxWidth; 999cdf0e10cSrcweir if (pValidation->nMaxHeight < pValidation->nHeight) 1000cdf0e10cSrcweir pValidation->nHeight = pValidation->nMaxHeight; 1001cdf0e10cSrcweir return 0; 1002cdf0e10cSrcweir } 1003