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