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
10b3f79822SAndrew Rist *
11b3f79822SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12b3f79822SAndrew Rist *
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.
19b3f79822SAndrew Rist *
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>
44f120fe41SAndre Fischer #include <svx/sidebar/SelectionChangeHandler.hxx>
45f120fe41SAndre Fischer #include <svx/sidebar/SelectionAnalyzer.hxx>
46*2a3f8a0eSAndre Fischer #include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
47cdf0e10cSrcweir
48cdf0e10cSrcweir #include "drawsh.hxx"
49cdf0e10cSrcweir #include "drawview.hxx"
50cdf0e10cSrcweir #include "viewdata.hxx"
51cdf0e10cSrcweir #include "sc.hrc"
52cdf0e10cSrcweir #include "tabvwsh.hxx"
53cdf0e10cSrcweir #include "document.hxx"
54cdf0e10cSrcweir #include "drwlayer.hxx"
55cdf0e10cSrcweir #include "userdat.hxx"
56cdf0e10cSrcweir #include <svx/svdoole2.hxx>
57cdf0e10cSrcweir #include <svx/svdocapt.hxx>
58cdf0e10cSrcweir
59f120fe41SAndre Fischer #include <boost/bind.hpp>
60f120fe41SAndre Fischer
61f120fe41SAndre Fischer
62cdf0e10cSrcweir sal_uInt16 ScGetFontWorkId(); // in drtxtob
63cdf0e10cSrcweir
64cdf0e10cSrcweir using namespace com::sun::star;
65cdf0e10cSrcweir
66f120fe41SAndre Fischer
67cdf0e10cSrcweir //------------------------------------------------------------------
68cdf0e10cSrcweir
ScDrawShell(ScViewData * pData)69cdf0e10cSrcweir ScDrawShell::ScDrawShell( ScViewData* pData ) :
70cdf0e10cSrcweir SfxShell(pData->GetViewShell()),
71f120fe41SAndre Fischer pViewData( pData ),
72f120fe41SAndre Fischer mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler(
73*2a3f8a0eSAndre Fischer ::boost::bind(&ScDrawShell::GetSidebarContextName, this),
74f120fe41SAndre Fischer GetFrame()->GetFrame().GetController(),
75f120fe41SAndre Fischer sfx2::sidebar::EnumContext::Context_Cell))
76cdf0e10cSrcweir {
77cdf0e10cSrcweir SetPool( &pViewData->GetScDrawView()->GetModel()->GetItemPool() );
78cdf0e10cSrcweir ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager();
79cdf0e10cSrcweir SetUndoManager( pMgr );
80cdf0e10cSrcweir if ( !pViewData->GetDocument()->IsUndoEnabled() )
81cdf0e10cSrcweir {
82cdf0e10cSrcweir pMgr->SetMaxUndoActionCount( 0 );
83cdf0e10cSrcweir }
84cdf0e10cSrcweir SetHelpId( HID_SCSHELL_DRAWSH );
85cdf0e10cSrcweir SetName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("Drawing")));
86f120fe41SAndre Fischer
87f120fe41SAndre Fischer mpSelectionChangeHandler->Connect();
88cdf0e10cSrcweir }
89cdf0e10cSrcweir
~ScDrawShell()90cdf0e10cSrcweir ScDrawShell::~ScDrawShell()
91cdf0e10cSrcweir {
92f120fe41SAndre Fischer mpSelectionChangeHandler->Disconnect();
93cdf0e10cSrcweir }
94cdf0e10cSrcweir
GetState(SfxItemSet & rSet)95cdf0e10cSrcweir void ScDrawShell::GetState( SfxItemSet& rSet ) // Zustaende / Toggles
96cdf0e10cSrcweir {
97cdf0e10cSrcweir ScDrawView* pView = pViewData->GetScDrawView();
98cdf0e10cSrcweir SdrDragMode eMode = pView->GetDragMode();
99cdf0e10cSrcweir
100cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_OBJECT_ROTATE, eMode == SDRDRAG_ROTATE ) );
101cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_OBJECT_MIRROR, eMode == SDRDRAG_MIRROR ) );
102cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_BEZIER_EDIT, !pView->IsFrameDragSingles() ) );
103cdf0e10cSrcweir
104cdf0e10cSrcweir sal_uInt16 nFWId = ScGetFontWorkId();
105cdf0e10cSrcweir SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame();
106cdf0e10cSrcweir rSet.Put(SfxBoolItem(SID_FONTWORK, pViewFrm->HasChildWindow(nFWId)));
107cdf0e10cSrcweir
108cdf0e10cSrcweir // Notes always default to Page anchor.
109cdf0e10cSrcweir bool bDisableAnchor = false;
110cdf0e10cSrcweir const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
111cdf0e10cSrcweir sal_uLong nMarkCount = rMarkList.GetMarkCount();
112cdf0e10cSrcweir if ( nMarkCount == 1 )
113cdf0e10cSrcweir {
114cdf0e10cSrcweir SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
115cdf0e10cSrcweir if( ScDrawLayer::IsNoteCaption( pObj ) )
116cdf0e10cSrcweir {
117cdf0e10cSrcweir bDisableAnchor = true;
118cdf0e10cSrcweir rSet.DisableItem( SID_ANCHOR_PAGE );
119cdf0e10cSrcweir rSet.DisableItem( SID_ANCHOR_CELL );
120cdf0e10cSrcweir }
121cdf0e10cSrcweir }
122cdf0e10cSrcweir
123cdf0e10cSrcweir if ( !bDisableAnchor )
124cdf0e10cSrcweir {
125cdf0e10cSrcweir switch( pView->GetAnchor() )
126cdf0e10cSrcweir {
127cdf0e10cSrcweir case SCA_PAGE:
128cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ANCHOR_PAGE, sal_True ) );
129cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ANCHOR_CELL, sal_False ) );
130cdf0e10cSrcweir break;
131cdf0e10cSrcweir
132cdf0e10cSrcweir case SCA_CELL:
133cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ANCHOR_PAGE, sal_False ) );
134cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ANCHOR_CELL, sal_True ) );
135cdf0e10cSrcweir break;
136cdf0e10cSrcweir
137cdf0e10cSrcweir default:
138cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ANCHOR_PAGE, sal_False ) );
139cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ANCHOR_CELL, sal_False ) );
140cdf0e10cSrcweir break;
141cdf0e10cSrcweir }
142cdf0e10cSrcweir }
143cdf0e10cSrcweir }
144cdf0e10cSrcweir
GetDrawFuncState(SfxItemSet & rSet)145cdf0e10cSrcweir void ScDrawShell::GetDrawFuncState( SfxItemSet& rSet ) // Funktionen disablen
146cdf0e10cSrcweir {
147cdf0e10cSrcweir ScDrawView* pView = pViewData->GetScDrawView();
148cdf0e10cSrcweir
149cdf0e10cSrcweir // #111711# call IsMirrorAllowed first to make sure ForcePossibilities (and thus CheckMarked)
150cdf0e10cSrcweir // is called before GetMarkCount, so the nMarkCount value is valid for the rest of this method.
151cdf0e10cSrcweir if (!pView->IsMirrorAllowed(sal_True,sal_True))
152cdf0e10cSrcweir {
153cdf0e10cSrcweir rSet.DisableItem( SID_MIRROR_HORIZONTAL );
154cdf0e10cSrcweir rSet.DisableItem( SID_MIRROR_VERTICAL );
155ee093554SAndre Fischer rSet.DisableItem( SID_FLIP_HORIZONTAL );
156ee093554SAndre Fischer rSet.DisableItem( SID_FLIP_VERTICAL );
157cdf0e10cSrcweir }
158cdf0e10cSrcweir
159cdf0e10cSrcweir const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
160cdf0e10cSrcweir sal_uLong nMarkCount = rMarkList.GetMarkCount();
161cdf0e10cSrcweir
162cdf0e10cSrcweir if ( nMarkCount <= 1 || !pView->IsGroupPossible() )
163cdf0e10cSrcweir rSet.DisableItem( SID_GROUP );
164cdf0e10cSrcweir if ( nMarkCount == 0 || !pView->IsUnGroupPossible() )
165cdf0e10cSrcweir rSet.DisableItem( SID_UNGROUP );
166cdf0e10cSrcweir if ( nMarkCount != 1 || !pView->IsGroupEnterPossible() )
167cdf0e10cSrcweir rSet.DisableItem( SID_ENTER_GROUP );
168cdf0e10cSrcweir if ( !pView->IsGroupEntered() )
169cdf0e10cSrcweir rSet.DisableItem( SID_LEAVE_GROUP );
170cdf0e10cSrcweir
171cdf0e10cSrcweir if ( nMarkCount <= 1 ) // nichts oder nur ein Objekt selektiert
172cdf0e10cSrcweir {
173cdf0e10cSrcweir // Ausrichtung
174cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_ALIGN_LEFT ); // keine Ausrichtung an der Seite
175cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_ALIGN_CENTER );
176cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_ALIGN_RIGHT );
177cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_ALIGN_UP );
178cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_ALIGN_MIDDLE );
179cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_ALIGN_DOWN );
180cdf0e10cSrcweir
181cdf0e10cSrcweir // pseudo slots for Format menu
182cdf0e10cSrcweir rSet.DisableItem( SID_ALIGN_ANY_LEFT );
183cdf0e10cSrcweir rSet.DisableItem( SID_ALIGN_ANY_HCENTER );
184cdf0e10cSrcweir rSet.DisableItem( SID_ALIGN_ANY_RIGHT );
185cdf0e10cSrcweir rSet.DisableItem( SID_ALIGN_ANY_TOP );
186cdf0e10cSrcweir rSet.DisableItem( SID_ALIGN_ANY_VCENTER );
187cdf0e10cSrcweir rSet.DisableItem( SID_ALIGN_ANY_BOTTOM );
188cdf0e10cSrcweir }
189cdf0e10cSrcweir
190cdf0e10cSrcweir // do not change layer of form controls
191cdf0e10cSrcweir // #158385# #i83729# do not change layer of cell notes (on internal layer)
192cdf0e10cSrcweir if ( !nMarkCount || pView->HasMarkedControl() || pView->HasMarkedInternal() )
193cdf0e10cSrcweir {
194cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_HEAVEN );
195cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_HELL );
196cdf0e10cSrcweir }
197cdf0e10cSrcweir else
198cdf0e10cSrcweir {
199cdf0e10cSrcweir if(AreAllObjectsOnLayer(SC_LAYER_FRONT,rMarkList))
200cdf0e10cSrcweir {
201cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_HEAVEN );
202cdf0e10cSrcweir }
203cdf0e10cSrcweir else if(AreAllObjectsOnLayer(SC_LAYER_BACK,rMarkList))
204cdf0e10cSrcweir {
205cdf0e10cSrcweir rSet.DisableItem( SID_OBJECT_HELL );
206cdf0e10cSrcweir }
207cdf0e10cSrcweir }
208cdf0e10cSrcweir
209cdf0e10cSrcweir sal_Bool bCanRename = sal_False;
210cdf0e10cSrcweir if ( nMarkCount > 1 )
211cdf0e10cSrcweir {
212cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES
213cdf0e10cSrcweir // no hypelink options for a selected group
214cdf0e10cSrcweir rSet.DisableItem( SID_DRAW_HLINK_EDIT );
215cdf0e10cSrcweir rSet.DisableItem( SID_DRAW_HLINK_DELETE );
216cdf0e10cSrcweir rSet.DisableItem( SID_OPEN_HYPERLINK );
217cdf0e10cSrcweir #endif
218cdf0e10cSrcweir }
219cdf0e10cSrcweir else if ( nMarkCount == 1 )
220cdf0e10cSrcweir {
221cdf0e10cSrcweir SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
222cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES
223cdf0e10cSrcweir ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj );
224cdf0e10cSrcweir if ( !pInfo || (pInfo->GetHlink().getLength() == 0) )
225cdf0e10cSrcweir {
226cdf0e10cSrcweir rSet.DisableItem( SID_DRAW_HLINK_DELETE );
227cdf0e10cSrcweir rSet.DisableItem( SID_OPEN_HYPERLINK );
228cdf0e10cSrcweir }
229cdf0e10cSrcweir #endif
230cdf0e10cSrcweir SdrLayerID nLayerID = pObj->GetLayer();
231cdf0e10cSrcweir if ( nLayerID != SC_LAYER_INTERN )
232cdf0e10cSrcweir bCanRename = sal_True; // #i51351# anything except internal objects can be renamed
233cdf0e10cSrcweir
234cdf0e10cSrcweir // #91929#; don't show original size entry if not possible
235cdf0e10cSrcweir sal_uInt16 nObjType = pObj->GetObjIdentifier();
236cdf0e10cSrcweir if ( nObjType == OBJ_OLE2 )
237cdf0e10cSrcweir {
238cdf0e10cSrcweir SdrOle2Obj* pOleObj = static_cast<SdrOle2Obj*>(rMarkList.GetMark( 0 )->GetMarkedSdrObj());
239cdf0e10cSrcweir if (pOleObj->GetObjRef().is() &&
240cdf0e10cSrcweir ((pOleObj->GetObjRef()->getStatus( pOleObj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE) ) )
241cdf0e10cSrcweir //TODO/LATER: why different slots in Draw and Calc?
242cdf0e10cSrcweir rSet.DisableItem(SID_ORIGINALSIZE);
243cdf0e10cSrcweir }
244cdf0e10cSrcweir else if ( nObjType == OBJ_CAPTION )
245cdf0e10cSrcweir {
246cdf0e10cSrcweir if ( nLayerID == SC_LAYER_INTERN )
247cdf0e10cSrcweir {
248cdf0e10cSrcweir // SdrCaptionObj() Notes cannot be cut/copy in isolation from
249cdf0e10cSrcweir // their cells.
250cdf0e10cSrcweir rSet.DisableItem( SID_CUT );
251cdf0e10cSrcweir rSet.DisableItem( SID_COPY );
252cdf0e10cSrcweir // Notes always default to Page anchor.
253cdf0e10cSrcweir rSet.DisableItem( SID_ANCHOR_TOGGLE );
254cdf0e10cSrcweir }
255cdf0e10cSrcweir }
256cdf0e10cSrcweir }
257cdf0e10cSrcweir if ( !bCanRename )
258cdf0e10cSrcweir {
259cdf0e10cSrcweir // #i68101#
260cdf0e10cSrcweir rSet.DisableItem( SID_RENAME_OBJECT );
261cdf0e10cSrcweir rSet.DisableItem( SID_TITLE_DESCRIPTION_OBJECT );
262cdf0e10cSrcweir }
263cdf0e10cSrcweir
264cdf0e10cSrcweir if ( !nMarkCount ) // nichts selektiert
265cdf0e10cSrcweir {
266cdf0e10cSrcweir // Anordnung
267cdf0e10cSrcweir rSet.DisableItem( SID_FRAME_UP );
268cdf0e10cSrcweir rSet.DisableItem( SID_FRAME_DOWN );
269cdf0e10cSrcweir rSet.DisableItem( SID_FRAME_TO_TOP );
270cdf0e10cSrcweir rSet.DisableItem( SID_FRAME_TO_BOTTOM );
271cdf0e10cSrcweir // Clipboard / loeschen
272cdf0e10cSrcweir rSet.DisableItem( SID_DELETE );
273cdf0e10cSrcweir rSet.DisableItem( SID_DELETE_CONTENTS );
274cdf0e10cSrcweir rSet.DisableItem( SID_CUT );
275cdf0e10cSrcweir rSet.DisableItem( SID_COPY );
276cdf0e10cSrcweir // sonstiges
277cdf0e10cSrcweir rSet.DisableItem( SID_ANCHOR_TOGGLE );
278cdf0e10cSrcweir rSet.DisableItem( SID_ORIGINALSIZE );
279cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_TRANSFORM );
280cdf0e10cSrcweir }
281cdf0e10cSrcweir
282cdf0e10cSrcweir if ( rSet.GetItemState( SID_ENABLE_HYPHENATION ) != SFX_ITEM_UNKNOWN )
283cdf0e10cSrcweir {
284cdf0e10cSrcweir SfxItemSet aAttrs( pView->GetModel()->GetItemPool() );
285cdf0e10cSrcweir pView->GetAttributes( aAttrs );
286cdf0e10cSrcweir if( aAttrs.GetItemState( EE_PARA_HYPHENATE ) >= SFX_ITEM_AVAILABLE )
287cdf0e10cSrcweir {
288cdf0e10cSrcweir sal_Bool bValue = ( (const SfxBoolItem&) aAttrs.Get( EE_PARA_HYPHENATE ) ).GetValue();
289cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_ENABLE_HYPHENATION, bValue ) );
290cdf0e10cSrcweir }
291cdf0e10cSrcweir }
292cdf0e10cSrcweir
293cdf0e10cSrcweir svx::ExtrusionBar::getState( pView, rSet );
294cdf0e10cSrcweir svx::FontworkBar::getState( pView, rSet );
295cdf0e10cSrcweir }
296cdf0e10cSrcweir
297cdf0e10cSrcweir //
298cdf0e10cSrcweir // Attribute fuer Drawing-Objekte
299cdf0e10cSrcweir //
300cdf0e10cSrcweir
GetDrawAttrState(SfxItemSet & rSet)301cdf0e10cSrcweir void ScDrawShell::GetDrawAttrState( SfxItemSet& rSet )
302cdf0e10cSrcweir {
303cdf0e10cSrcweir Point aMousePos = pViewData->GetMousePosPixel();
304cdf0e10cSrcweir Window* pWindow = pViewData->GetActiveWin();
305cdf0e10cSrcweir ScDrawView* pDrView = pViewData->GetScDrawView();
306cdf0e10cSrcweir Point aPos = pWindow->PixelToLogic(aMousePos);
307cdf0e10cSrcweir sal_Bool bHasMarked = pDrView->AreObjectsMarked();
308cdf0e10cSrcweir
309cdf0e10cSrcweir if( bHasMarked )
310cdf0e10cSrcweir {
311d7c3c182SArmin Le Grand rSet.Put( pDrView->GetAttrFromMarked(sal_False), false );
312cdf0e10cSrcweir }
313cdf0e10cSrcweir else
314d7c3c182SArmin Le Grand {
315cdf0e10cSrcweir rSet.Put( pDrView->GetDefaultAttr() );
316d7c3c182SArmin Le Grand }
317cdf0e10cSrcweir
318cdf0e10cSrcweir SdrPageView* pPV = pDrView->GetSdrPageView();
319cdf0e10cSrcweir if ( pPV )
320cdf0e10cSrcweir {
321cdf0e10cSrcweir // #i52073# when a sheet with an active OLE object is deleted,
322cdf0e10cSrcweir // the slot state is queried without an active page view
323cdf0e10cSrcweir
324cdf0e10cSrcweir // Items for position and size (see ScGridWindow::UpdateStatusPosSize, #108137#)
325cdf0e10cSrcweir
326cdf0e10cSrcweir // #i34458# The SvxSizeItem in SID_TABLE_CELL is no longer needed by
327cdf0e10cSrcweir // SvxPosSizeStatusBarControl, it's enough to have it in SID_ATTR_SIZE.
328cdf0e10cSrcweir
329cdf0e10cSrcweir sal_Bool bActionItem = sal_False;
330cdf0e10cSrcweir if ( pDrView->IsAction() ) // action rectangle
331cdf0e10cSrcweir {
332cdf0e10cSrcweir Rectangle aRect;
333cdf0e10cSrcweir pDrView->TakeActionRect( aRect );
334cdf0e10cSrcweir if ( !aRect.IsEmpty() )
335cdf0e10cSrcweir {
336cdf0e10cSrcweir pPV->LogicToPagePos(aRect);
337cdf0e10cSrcweir rSet.Put( SfxPointItem( SID_ATTR_POSITION, aRect.TopLeft() ) );
338cdf0e10cSrcweir Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() );
339cdf0e10cSrcweir rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize ) );
340cdf0e10cSrcweir bActionItem = sal_True;
341cdf0e10cSrcweir }
342cdf0e10cSrcweir }
343cdf0e10cSrcweir if ( !bActionItem )
344cdf0e10cSrcweir {
345cdf0e10cSrcweir if ( pDrView->AreObjectsMarked() ) // selected objects
346cdf0e10cSrcweir {
347cdf0e10cSrcweir Rectangle aRect = pDrView->GetAllMarkedRect();
348cdf0e10cSrcweir pPV->LogicToPagePos(aRect);
349cdf0e10cSrcweir rSet.Put( SfxPointItem( SID_ATTR_POSITION, aRect.TopLeft() ) );
350cdf0e10cSrcweir Size aSize( aRect.Right() - aRect.Left(), aRect.Bottom() - aRect.Top() );
351cdf0e10cSrcweir rSet.Put( SvxSizeItem( SID_ATTR_SIZE, aSize ) );
352cdf0e10cSrcweir }
353cdf0e10cSrcweir else // mouse position
354cdf0e10cSrcweir {
355cdf0e10cSrcweir // aPos is initialized above
356cdf0e10cSrcweir pPV->LogicToPagePos(aPos);
357cdf0e10cSrcweir rSet.Put( SfxPointItem( SID_ATTR_POSITION, aPos ) );
358cdf0e10cSrcweir rSet.Put( SvxSizeItem( SID_ATTR_SIZE, Size( 0, 0 ) ) );
359cdf0e10cSrcweir }
360cdf0e10cSrcweir }
361cdf0e10cSrcweir }
362cdf0e10cSrcweir }
363cdf0e10cSrcweir
GetAttrFuncState(SfxItemSet & rSet)364cdf0e10cSrcweir void ScDrawShell::GetAttrFuncState(SfxItemSet &rSet)
365cdf0e10cSrcweir {
366cdf0e10cSrcweir // Dialoge fuer Draw-Attribute disablen, wenn noetig
367cdf0e10cSrcweir
368cdf0e10cSrcweir ScDrawView* pDrView = pViewData->GetScDrawView();
369cdf0e10cSrcweir SfxItemSet aViewSet = pDrView->GetAttrFromMarked(sal_False);
370cdf0e10cSrcweir
371cdf0e10cSrcweir if ( aViewSet.GetItemState( XATTR_LINESTYLE ) == SFX_ITEM_DEFAULT )
372cdf0e10cSrcweir {
373cdf0e10cSrcweir rSet.DisableItem( SID_ATTRIBUTES_LINE );
374cdf0e10cSrcweir rSet.DisableItem( SID_ATTR_LINEEND_STYLE ); // Tbx-Controller
375cdf0e10cSrcweir }
376cdf0e10cSrcweir
377cdf0e10cSrcweir if ( aViewSet.GetItemState( XATTR_FILLSTYLE ) == SFX_ITEM_DEFAULT )
378cdf0e10cSrcweir rSet.DisableItem( SID_ATTRIBUTES_AREA );
379cdf0e10cSrcweir }
380cdf0e10cSrcweir
AreAllObjectsOnLayer(sal_uInt16 nLayerNo,const SdrMarkList & rMark)381cdf0e10cSrcweir sal_Bool ScDrawShell::AreAllObjectsOnLayer(sal_uInt16 nLayerNo,const SdrMarkList& rMark)
382cdf0e10cSrcweir {
383cdf0e10cSrcweir sal_Bool bResult=sal_True;
384cdf0e10cSrcweir sal_uLong nCount = rMark.GetMarkCount();
385cdf0e10cSrcweir for (sal_uLong i=0; i<nCount; i++)
386cdf0e10cSrcweir {
387cdf0e10cSrcweir SdrObject* pObj = rMark.GetMark(i)->GetMarkedSdrObj();
388cdf0e10cSrcweir if ( !pObj->ISA(SdrUnoObj) )
389cdf0e10cSrcweir {
390cdf0e10cSrcweir if(nLayerNo!=pObj->GetLayer())
391cdf0e10cSrcweir {
392cdf0e10cSrcweir bResult=sal_False;
393cdf0e10cSrcweir break;
394cdf0e10cSrcweir }
395cdf0e10cSrcweir }
396cdf0e10cSrcweir }
397cdf0e10cSrcweir return bResult;
398cdf0e10cSrcweir }
399cdf0e10cSrcweir
GetDrawAttrStateForIFBX(SfxItemSet & rSet)400ee093554SAndre Fischer void ScDrawShell::GetDrawAttrStateForIFBX( SfxItemSet& rSet )
401ee093554SAndre Fischer {
402ee093554SAndre Fischer ScDrawView* pView = pViewData->GetScDrawView();
403ee093554SAndre Fischer const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
404ee093554SAndre Fischer
405ee093554SAndre Fischer if( rMarkList.GetMark(0) != 0 )
406ee093554SAndre Fischer {
407ee093554SAndre Fischer SfxItemSet aNewAttr(pView->GetGeoAttrFromMarked());
408ee093554SAndre Fischer rSet.Put(aNewAttr, sal_False);
409ee093554SAndre Fischer }
410ee093554SAndre Fischer }
411f120fe41SAndre Fischer
412*2a3f8a0eSAndre Fischer
413*2a3f8a0eSAndre Fischer
414*2a3f8a0eSAndre Fischer
Activate(const sal_Bool bMDI)415*2a3f8a0eSAndre Fischer void ScDrawShell::Activate (const sal_Bool bMDI)
416*2a3f8a0eSAndre Fischer {
417*2a3f8a0eSAndre Fischer (void)bMDI;
418*2a3f8a0eSAndre Fischer
419*2a3f8a0eSAndre Fischer ContextChangeEventMultiplexer::NotifyContextChange(
420*2a3f8a0eSAndre Fischer GetFrame()->GetFrame().GetController(),
421*2a3f8a0eSAndre Fischer ::sfx2::sidebar::EnumContext::GetContextEnum(
422*2a3f8a0eSAndre Fischer GetSidebarContextName()));
423*2a3f8a0eSAndre Fischer }
424*2a3f8a0eSAndre Fischer
425*2a3f8a0eSAndre Fischer
426*2a3f8a0eSAndre Fischer
427*2a3f8a0eSAndre Fischer
GetSidebarContextName(void)428*2a3f8a0eSAndre Fischer ::rtl::OUString ScDrawShell::GetSidebarContextName (void)
429f120fe41SAndre Fischer {
430*2a3f8a0eSAndre Fischer return sfx2::sidebar::EnumContext::GetContextName(
431*2a3f8a0eSAndre Fischer ::svx::sidebar::SelectionAnalyzer::GetContextForSelection_SC(
432*2a3f8a0eSAndre Fischer GetDrawView()->GetMarkedObjectList()));
433f120fe41SAndre Fischer }
434