1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sc.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir //------------------------------------------------------------------ 32*cdf0e10cSrcweir #include <com/sun/star/embed/EmbedMisc.hpp> 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir #include "scitems.hxx" 35*cdf0e10cSrcweir #include <editeng/eeitem.hxx> 36*cdf0e10cSrcweir #include <editeng/sizeitem.hxx> 37*cdf0e10cSrcweir #include <svx/svdpagv.hxx> 38*cdf0e10cSrcweir #include <svx/xdef.hxx> 39*cdf0e10cSrcweir #include <sfx2/app.hxx> 40*cdf0e10cSrcweir #include <sfx2/objsh.hxx> 41*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 42*cdf0e10cSrcweir #include <svl/ptitem.hxx> 43*cdf0e10cSrcweir #include <svl/whiter.hxx> 44*cdf0e10cSrcweir #include <svx/svdobj.hxx> 45*cdf0e10cSrcweir #include <svx/svdouno.hxx> 46*cdf0e10cSrcweir #include <svx/extrusionbar.hxx> 47*cdf0e10cSrcweir #include <svx/fontworkbar.hxx> 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir #include "drawsh.hxx" 50*cdf0e10cSrcweir #include "drawview.hxx" 51*cdf0e10cSrcweir #include "viewdata.hxx" 52*cdf0e10cSrcweir #include "sc.hrc" 53*cdf0e10cSrcweir #include "tabvwsh.hxx" 54*cdf0e10cSrcweir #include "document.hxx" 55*cdf0e10cSrcweir #include "drwlayer.hxx" 56*cdf0e10cSrcweir #include "userdat.hxx" 57*cdf0e10cSrcweir #include <svx/svdoole2.hxx> 58*cdf0e10cSrcweir #include <svx/svdocapt.hxx> 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir sal_uInt16 ScGetFontWorkId(); // in drtxtob 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir using namespace com::sun::star; 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir //------------------------------------------------------------------ 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir ScDrawShell::ScDrawShell( ScViewData* pData ) : 67*cdf0e10cSrcweir SfxShell(pData->GetViewShell()), 68*cdf0e10cSrcweir pViewData( pData ) 69*cdf0e10cSrcweir { 70*cdf0e10cSrcweir SetPool( &pViewData->GetScDrawView()->GetModel()->GetItemPool() ); 71*cdf0e10cSrcweir ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); 72*cdf0e10cSrcweir SetUndoManager( pMgr ); 73*cdf0e10cSrcweir if ( !pViewData->GetDocument()->IsUndoEnabled() ) 74*cdf0e10cSrcweir { 75*cdf0e10cSrcweir pMgr->SetMaxUndoActionCount( 0 ); 76*cdf0e10cSrcweir } 77*cdf0e10cSrcweir SetHelpId( HID_SCSHELL_DRAWSH ); 78*cdf0e10cSrcweir SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Drawing"))); 79*cdf0e10cSrcweir } 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir ScDrawShell::~ScDrawShell() 82*cdf0e10cSrcweir { 83*cdf0e10cSrcweir } 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir void ScDrawShell::GetState( SfxItemSet& rSet ) // Zustaende / Toggles 86*cdf0e10cSrcweir { 87*cdf0e10cSrcweir ScDrawView* pView = pViewData->GetScDrawView(); 88*cdf0e10cSrcweir SdrDragMode eMode = pView->GetDragMode(); 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_OBJECT_ROTATE, eMode == SDRDRAG_ROTATE ) ); 91*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_OBJECT_MIRROR, eMode == SDRDRAG_MIRROR ) ); 92*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_BEZIER_EDIT, !pView->IsFrameDragSingles() ) ); 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir sal_uInt16 nFWId = ScGetFontWorkId(); 95*cdf0e10cSrcweir SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame(); 96*cdf0e10cSrcweir rSet.Put(SfxBoolItem(SID_FONTWORK, pViewFrm->HasChildWindow(nFWId))); 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir // Notes always default to Page anchor. 99*cdf0e10cSrcweir bool bDisableAnchor = false; 100*cdf0e10cSrcweir const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 101*cdf0e10cSrcweir sal_uLong nMarkCount = rMarkList.GetMarkCount(); 102*cdf0e10cSrcweir if ( nMarkCount == 1 ) 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); 105*cdf0e10cSrcweir if( ScDrawLayer::IsNoteCaption( pObj ) ) 106*cdf0e10cSrcweir { 107*cdf0e10cSrcweir bDisableAnchor = true; 108*cdf0e10cSrcweir rSet.DisableItem( SID_ANCHOR_PAGE ); 109*cdf0e10cSrcweir rSet.DisableItem( SID_ANCHOR_CELL ); 110*cdf0e10cSrcweir } 111*cdf0e10cSrcweir } 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir if ( !bDisableAnchor ) 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir switch( pView->GetAnchor() ) 116*cdf0e10cSrcweir { 117*cdf0e10cSrcweir case SCA_PAGE: 118*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ANCHOR_PAGE, sal_True ) ); 119*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ANCHOR_CELL, sal_False ) ); 120*cdf0e10cSrcweir break; 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir case SCA_CELL: 123*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ANCHOR_PAGE, sal_False ) ); 124*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ANCHOR_CELL, sal_True ) ); 125*cdf0e10cSrcweir break; 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir default: 128*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ANCHOR_PAGE, sal_False ) ); 129*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ANCHOR_CELL, sal_False ) ); 130*cdf0e10cSrcweir break; 131*cdf0e10cSrcweir } 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir } 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir void ScDrawShell::GetDrawFuncState( SfxItemSet& rSet ) // Funktionen disablen 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir ScDrawView* pView = pViewData->GetScDrawView(); 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir // #111711# call IsMirrorAllowed first to make sure ForcePossibilities (and thus CheckMarked) 140*cdf0e10cSrcweir // is called before GetMarkCount, so the nMarkCount value is valid for the rest of this method. 141*cdf0e10cSrcweir if (!pView->IsMirrorAllowed(sal_True,sal_True)) 142*cdf0e10cSrcweir { 143*cdf0e10cSrcweir rSet.DisableItem( SID_MIRROR_HORIZONTAL ); 144*cdf0e10cSrcweir rSet.DisableItem( SID_MIRROR_VERTICAL ); 145*cdf0e10cSrcweir } 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 148*cdf0e10cSrcweir sal_uLong nMarkCount = rMarkList.GetMarkCount(); 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir if ( nMarkCount <= 1 || !pView->IsGroupPossible() ) 151*cdf0e10cSrcweir rSet.DisableItem( SID_GROUP ); 152*cdf0e10cSrcweir if ( nMarkCount == 0 || !pView->IsUnGroupPossible() ) 153*cdf0e10cSrcweir rSet.DisableItem( SID_UNGROUP ); 154*cdf0e10cSrcweir if ( nMarkCount != 1 || !pView->IsGroupEnterPossible() ) 155*cdf0e10cSrcweir rSet.DisableItem( SID_ENTER_GROUP ); 156*cdf0e10cSrcweir if ( !pView->IsGroupEntered() ) 157*cdf0e10cSrcweir rSet.DisableItem( SID_LEAVE_GROUP ); 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir if ( nMarkCount <= 1 ) // nichts oder nur ein Objekt selektiert 160*cdf0e10cSrcweir { 161*cdf0e10cSrcweir // Ausrichtung 162*cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_ALIGN_LEFT ); // keine Ausrichtung an der Seite 163*cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_ALIGN_CENTER ); 164*cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_ALIGN_RIGHT ); 165*cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_ALIGN_UP ); 166*cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_ALIGN_MIDDLE ); 167*cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_ALIGN_DOWN ); 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir // pseudo slots for Format menu 170*cdf0e10cSrcweir rSet.DisableItem( SID_ALIGN_ANY_LEFT ); 171*cdf0e10cSrcweir rSet.DisableItem( SID_ALIGN_ANY_HCENTER ); 172*cdf0e10cSrcweir rSet.DisableItem( SID_ALIGN_ANY_RIGHT ); 173*cdf0e10cSrcweir rSet.DisableItem( SID_ALIGN_ANY_TOP ); 174*cdf0e10cSrcweir rSet.DisableItem( SID_ALIGN_ANY_VCENTER ); 175*cdf0e10cSrcweir rSet.DisableItem( SID_ALIGN_ANY_BOTTOM ); 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir // do not change layer of form controls 179*cdf0e10cSrcweir // #158385# #i83729# do not change layer of cell notes (on internal layer) 180*cdf0e10cSrcweir if ( !nMarkCount || pView->HasMarkedControl() || pView->HasMarkedInternal() ) 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_HEAVEN ); 183*cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_HELL ); 184*cdf0e10cSrcweir } 185*cdf0e10cSrcweir else 186*cdf0e10cSrcweir { 187*cdf0e10cSrcweir if(AreAllObjectsOnLayer(SC_LAYER_FRONT,rMarkList)) 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_HEAVEN ); 190*cdf0e10cSrcweir } 191*cdf0e10cSrcweir else if(AreAllObjectsOnLayer(SC_LAYER_BACK,rMarkList)) 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_HELL ); 194*cdf0e10cSrcweir } 195*cdf0e10cSrcweir } 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir sal_Bool bCanRename = sal_False; 198*cdf0e10cSrcweir if ( nMarkCount > 1 ) 199*cdf0e10cSrcweir { 200*cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES 201*cdf0e10cSrcweir // no hypelink options for a selected group 202*cdf0e10cSrcweir rSet.DisableItem( SID_DRAW_HLINK_EDIT ); 203*cdf0e10cSrcweir rSet.DisableItem( SID_DRAW_HLINK_DELETE ); 204*cdf0e10cSrcweir rSet.DisableItem( SID_OPEN_HYPERLINK ); 205*cdf0e10cSrcweir #endif 206*cdf0e10cSrcweir } 207*cdf0e10cSrcweir else if ( nMarkCount == 1 ) 208*cdf0e10cSrcweir { 209*cdf0e10cSrcweir SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); 210*cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES 211*cdf0e10cSrcweir ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj ); 212*cdf0e10cSrcweir if ( !pInfo || (pInfo->GetHlink().getLength() == 0) ) 213*cdf0e10cSrcweir { 214*cdf0e10cSrcweir rSet.DisableItem( SID_DRAW_HLINK_DELETE ); 215*cdf0e10cSrcweir rSet.DisableItem( SID_OPEN_HYPERLINK ); 216*cdf0e10cSrcweir } 217*cdf0e10cSrcweir #endif 218*cdf0e10cSrcweir SdrLayerID nLayerID = pObj->GetLayer(); 219*cdf0e10cSrcweir if ( nLayerID != SC_LAYER_INTERN ) 220*cdf0e10cSrcweir bCanRename = sal_True; // #i51351# anything except internal objects can be renamed 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir // #91929#; don't show original size entry if not possible 223*cdf0e10cSrcweir sal_uInt16 nObjType = pObj->GetObjIdentifier(); 224*cdf0e10cSrcweir if ( nObjType == OBJ_OLE2 ) 225*cdf0e10cSrcweir { 226*cdf0e10cSrcweir SdrOle2Obj* pOleObj = static_cast<SdrOle2Obj*>(rMarkList.GetMark( 0 )->GetMarkedSdrObj()); 227*cdf0e10cSrcweir if (pOleObj->GetObjRef().is() && 228*cdf0e10cSrcweir ((pOleObj->GetObjRef()->getStatus( pOleObj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) ) ) 229*cdf0e10cSrcweir //TODO/LATER: why different slots in Draw and Calc? 230*cdf0e10cSrcweir rSet.DisableItem(SID_ORIGINALSIZE); 231*cdf0e10cSrcweir } 232*cdf0e10cSrcweir else if ( nObjType == OBJ_CAPTION ) 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir if ( nLayerID == SC_LAYER_INTERN ) 235*cdf0e10cSrcweir { 236*cdf0e10cSrcweir // SdrCaptionObj() Notes cannot be cut/copy in isolation from 237*cdf0e10cSrcweir // their cells. 238*cdf0e10cSrcweir rSet.DisableItem( SID_CUT ); 239*cdf0e10cSrcweir rSet.DisableItem( SID_COPY ); 240*cdf0e10cSrcweir // Notes always default to Page anchor. 241*cdf0e10cSrcweir rSet.DisableItem( SID_ANCHOR_TOGGLE ); 242*cdf0e10cSrcweir } 243*cdf0e10cSrcweir } 244*cdf0e10cSrcweir } 245*cdf0e10cSrcweir if ( !bCanRename ) 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir // #i68101# 248*cdf0e10cSrcweir rSet.DisableItem( SID_RENAME_OBJECT ); 249*cdf0e10cSrcweir rSet.DisableItem( SID_TITLE_DESCRIPTION_OBJECT ); 250*cdf0e10cSrcweir } 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir if ( !nMarkCount ) // nichts selektiert 253*cdf0e10cSrcweir { 254*cdf0e10cSrcweir // Anordnung 255*cdf0e10cSrcweir rSet.DisableItem( SID_FRAME_UP ); 256*cdf0e10cSrcweir rSet.DisableItem( SID_FRAME_DOWN ); 257*cdf0e10cSrcweir rSet.DisableItem( SID_FRAME_TO_TOP ); 258*cdf0e10cSrcweir rSet.DisableItem( SID_FRAME_TO_BOTTOM ); 259*cdf0e10cSrcweir // Clipboard / loeschen 260*cdf0e10cSrcweir rSet.DisableItem( SID_DELETE ); 261*cdf0e10cSrcweir rSet.DisableItem( SID_DELETE_CONTENTS ); 262*cdf0e10cSrcweir rSet.DisableItem( SID_CUT ); 263*cdf0e10cSrcweir rSet.DisableItem( SID_COPY ); 264*cdf0e10cSrcweir // sonstiges 265*cdf0e10cSrcweir rSet.DisableItem( SID_ANCHOR_TOGGLE ); 266*cdf0e10cSrcweir rSet.DisableItem( SID_ORIGINALSIZE ); 267*cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_TRANSFORM ); 268*cdf0e10cSrcweir } 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir if ( rSet.GetItemState( SID_ENABLE_HYPHENATION ) != SFX_ITEM_UNKNOWN ) 271*cdf0e10cSrcweir { 272*cdf0e10cSrcweir SfxItemSet aAttrs( pView->GetModel()->GetItemPool() ); 273*cdf0e10cSrcweir pView->GetAttributes( aAttrs ); 274*cdf0e10cSrcweir if( aAttrs.GetItemState( EE_PARA_HYPHENATE ) >= SFX_ITEM_AVAILABLE ) 275*cdf0e10cSrcweir { 276*cdf0e10cSrcweir sal_Bool bValue = ( (const SfxBoolItem&) aAttrs.Get( EE_PARA_HYPHENATE ) ).GetValue(); 277*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ENABLE_HYPHENATION, bValue ) ); 278*cdf0e10cSrcweir } 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir svx::ExtrusionBar::getState( pView, rSet ); 282*cdf0e10cSrcweir svx::FontworkBar::getState( pView, rSet ); 283*cdf0e10cSrcweir } 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir // 286*cdf0e10cSrcweir // Attribute fuer Drawing-Objekte 287*cdf0e10cSrcweir // 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir void ScDrawShell::GetDrawAttrState( SfxItemSet& rSet ) 290*cdf0e10cSrcweir { 291*cdf0e10cSrcweir Point aMousePos = pViewData->GetMousePosPixel(); 292*cdf0e10cSrcweir Window* pWindow = pViewData->GetActiveWin(); 293*cdf0e10cSrcweir ScDrawView* pDrView = pViewData->GetScDrawView(); 294*cdf0e10cSrcweir Point aPos = pWindow->PixelToLogic(aMousePos); 295*cdf0e10cSrcweir sal_Bool bHasMarked = pDrView->AreObjectsMarked(); 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir if( bHasMarked ) 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir rSet.Put( pDrView->GetAttrFromMarked(sal_False) ); 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir // Wenn die View selektierte Objekte besitzt, muessen entspr. Items 302*cdf0e10cSrcweir // von SFX_ITEM_DEFAULT (_ON) auf SFX_ITEM_DISABLED geaendert werden 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir SfxWhichIter aIter( rSet, XATTR_LINE_FIRST, XATTR_FILL_LAST ); 305*cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 306*cdf0e10cSrcweir while( nWhich ) 307*cdf0e10cSrcweir { 308*cdf0e10cSrcweir if( SFX_ITEM_DEFAULT == rSet.GetItemState( nWhich ) ) 309*cdf0e10cSrcweir rSet.DisableItem( nWhich ); 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir nWhich = aIter.NextWhich(); 312*cdf0e10cSrcweir } 313*cdf0e10cSrcweir } 314*cdf0e10cSrcweir else 315*cdf0e10cSrcweir rSet.Put( pDrView->GetDefaultAttr() ); 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir SdrPageView* pPV = pDrView->GetSdrPageView(); 318*cdf0e10cSrcweir if ( pPV ) 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir // #i52073# when a sheet with an active OLE object is deleted, 321*cdf0e10cSrcweir // the slot state is queried without an active page view 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir // Items for position and size (see ScGridWindow::UpdateStatusPosSize, #108137#) 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir // #i34458# The SvxSizeItem in SID_TABLE_CELL is no longer needed by 326*cdf0e10cSrcweir // SvxPosSizeStatusBarControl, it's enough to have it in SID_ATTR_SIZE. 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir sal_Bool bActionItem = sal_False; 329*cdf0e10cSrcweir if ( pDrView->IsAction() ) // action rectangle 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir Rectangle aRect; 332*cdf0e10cSrcweir pDrView->TakeActionRect( aRect ); 333*cdf0e10cSrcweir if ( !aRect.IsEmpty() ) 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir pPV->LogicToPagePos(aRect); 336*cdf0e10cSrcweir rSet.Put( SfxPointItem( SID_ATTR_POSITION, aRect.TopLeft() ) ); 337*cdf0e10cSrcweir Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() ); 338*cdf0e10cSrcweir rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize ) ); 339*cdf0e10cSrcweir bActionItem = sal_True; 340*cdf0e10cSrcweir } 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir if ( !bActionItem ) 343*cdf0e10cSrcweir { 344*cdf0e10cSrcweir if ( pDrView->AreObjectsMarked() ) // selected objects 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir Rectangle aRect = pDrView->GetAllMarkedRect(); 347*cdf0e10cSrcweir pPV->LogicToPagePos(aRect); 348*cdf0e10cSrcweir rSet.Put( SfxPointItem( SID_ATTR_POSITION, aRect.TopLeft() ) ); 349*cdf0e10cSrcweir Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() ); 350*cdf0e10cSrcweir rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize ) ); 351*cdf0e10cSrcweir } 352*cdf0e10cSrcweir else // mouse position 353*cdf0e10cSrcweir { 354*cdf0e10cSrcweir // aPos is initialized above 355*cdf0e10cSrcweir pPV->LogicToPagePos(aPos); 356*cdf0e10cSrcweir rSet.Put( SfxPointItem( SID_ATTR_POSITION, aPos ) ); 357*cdf0e10cSrcweir rSet.Put( SvxSizeItem( SID_ATTR_SIZE, Size( 0, 0 ) ) ); 358*cdf0e10cSrcweir } 359*cdf0e10cSrcweir } 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir void ScDrawShell::GetAttrFuncState(SfxItemSet &rSet) 364*cdf0e10cSrcweir { 365*cdf0e10cSrcweir // Dialoge fuer Draw-Attribute disablen, wenn noetig 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir ScDrawView* pDrView = pViewData->GetScDrawView(); 368*cdf0e10cSrcweir SfxItemSet aViewSet = pDrView->GetAttrFromMarked(sal_False); 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir if ( aViewSet.GetItemState( XATTR_LINESTYLE ) == SFX_ITEM_DEFAULT ) 371*cdf0e10cSrcweir { 372*cdf0e10cSrcweir rSet.DisableItem( SID_ATTRIBUTES_LINE ); 373*cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_LINEEND_STYLE ); // Tbx-Controller 374*cdf0e10cSrcweir } 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir if ( aViewSet.GetItemState( XATTR_FILLSTYLE ) == SFX_ITEM_DEFAULT ) 377*cdf0e10cSrcweir rSet.DisableItem( SID_ATTRIBUTES_AREA ); 378*cdf0e10cSrcweir } 379*cdf0e10cSrcweir 380*cdf0e10cSrcweir sal_Bool ScDrawShell::AreAllObjectsOnLayer(sal_uInt16 nLayerNo,const SdrMarkList& rMark) 381*cdf0e10cSrcweir { 382*cdf0e10cSrcweir sal_Bool bResult=sal_True; 383*cdf0e10cSrcweir sal_uLong nCount = rMark.GetMarkCount(); 384*cdf0e10cSrcweir for (sal_uLong i=0; i<nCount; i++) 385*cdf0e10cSrcweir { 386*cdf0e10cSrcweir SdrObject* pObj = rMark.GetMark(i)->GetMarkedSdrObj(); 387*cdf0e10cSrcweir if ( !pObj->ISA(SdrUnoObj) ) 388*cdf0e10cSrcweir { 389*cdf0e10cSrcweir if(nLayerNo!=pObj->GetLayer()) 390*cdf0e10cSrcweir { 391*cdf0e10cSrcweir bResult=sal_False; 392*cdf0e10cSrcweir break; 393*cdf0e10cSrcweir } 394*cdf0e10cSrcweir } 395*cdf0e10cSrcweir } 396*cdf0e10cSrcweir return bResult; 397*cdf0e10cSrcweir } 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir 400