1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: drawsh5.cxx,v $
10 * $Revision: 1.37.128.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
36 //------------------------------------------------------------------
38 #include <svx/eeitem.hxx>
40 #include <sfx2/viewfrm.hxx>
41 #include <sfx2/request.hxx>
42 #include <sfx2/bindings.hxx>
43 #include <tools/urlobj.hxx>
44 //CHINA001 #include <svx/dlgname.hxx>
45 #include <svx/svxdlg.hxx> //CHINA001
46 #include <svx/dialogs.hrc> //CHINA001
47 #include <svx/fmglob.hxx>
48 #include <svx/hlnkitem.hxx>
49 #include <svx/fontwork.hxx>
50 #include <svx/svdocapt.hxx>
51 #include <svx/svdoole2.hxx>
52 #include <svx/svdouno.hxx>
53 #include <svx/svdpage.hxx>
54 #include <svx/svdundo.hxx>
55 #include <svx/xdef.hxx>
56 #include <svx/xftsfit.hxx>
57 #include <vcl/msgbox.hxx>
58 #include <svx/extrusionbar.hxx>
59 #include <svx/fontworkbar.hxx>
60 #include <sfx2/docfile.hxx>
62 #include <com/sun/star/form/FormButtonType.hpp>
63 #include <com/sun/star/beans/XPropertySet.hpp>
64 #include <com/sun/star/beans/XPropertySetInfo.hpp>
65 #include <com/sun/star/awt/XControlModel.hpp>
68 #include "drawview.hxx"
69 #include "viewdata.hxx"
70 #include "tabvwsh.hxx"
72 //CHINA001 #include "strindlg.hxx"
73 #include "scresid.hxx"
74 #include "undotab.hxx"
75 #include "drwlayer.hxx"
76 #include "userdat.hxx"
81 using namespace com::sun::star
;
83 //------------------------------------------------------------------
85 void ScDrawShell::GetHLinkState( SfxItemSet
& rSet
) // Hyperlink
87 ScDrawView
* pView
= pViewData
->GetScDrawView();
88 const SdrMarkList
& rMarkList
= pView
->GetMarkedObjectList();
89 ULONG nMarkCount
= rMarkList
.GetMarkCount();
93 SvxHyperlinkItem aHLinkItem
;
95 if ( nMarkCount
== 1 ) // URL-Button markiert ?
97 SdrObject
* pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
98 ScMacroInfo
* pInfo
= ScDrawLayer::GetMacroInfo( pObj
);
99 if ( pInfo
&& (pInfo
->GetHlink().getLength() > 0) )
101 aHLinkItem
.SetURL( pInfo
->GetHlink() );
102 aHLinkItem
.SetInsertMode(HLINK_FIELD
);
104 SdrUnoObj
* pUnoCtrl
= PTR_CAST(SdrUnoObj
, pObj
);
105 if (pUnoCtrl
&& FmFormInventor
== pUnoCtrl
->GetObjInventor())
107 uno::Reference
<awt::XControlModel
> xControlModel
= pUnoCtrl
->GetUnoControlModel();
108 DBG_ASSERT( xControlModel
.is(), "UNO-Control ohne Model" );
109 if( !xControlModel
.is() )
112 uno::Reference
< beans::XPropertySet
> xPropSet( xControlModel
, uno::UNO_QUERY
);
113 uno::Reference
< beans::XPropertySetInfo
> xInfo
= xPropSet
->getPropertySetInfo();
115 rtl::OUString sPropButtonType
= rtl::OUString::createFromAscii( "ButtonType" );
116 rtl::OUString sPropTargetURL
= rtl::OUString::createFromAscii( "TargetURL" );
117 rtl::OUString sPropTargetFrame
= rtl::OUString::createFromAscii( "TargetFrame" );
118 rtl::OUString sPropLabel
= rtl::OUString::createFromAscii( "Label" );
120 if(xInfo
->hasPropertyByName( sPropButtonType
))
122 uno::Any aAny
= xPropSet
->getPropertyValue( sPropButtonType
);
123 form::FormButtonType eTmp
;
124 if ( (aAny
>>= eTmp
) && eTmp
== form::FormButtonType_URL
)
128 if(xInfo
->hasPropertyByName( sPropLabel
))
130 aAny
= xPropSet
->getPropertyValue( sPropLabel
);
131 if ( (aAny
>>= sTmp
) && sTmp
.getLength() )
133 aHLinkItem
.SetName(sTmp
);
137 if(xInfo
->hasPropertyByName( sPropTargetURL
))
139 aAny
= xPropSet
->getPropertyValue( sPropTargetURL
);
140 if ( (aAny
>>= sTmp
) && sTmp
.getLength() )
142 aHLinkItem
.SetURL(sTmp
);
146 if(xInfo
->hasPropertyByName( sPropTargetFrame
))
148 aAny
= xPropSet
->getPropertyValue( sPropTargetFrame
);
149 if ( (aAny
>>= sTmp
) && sTmp
.getLength() )
151 aHLinkItem
.SetTargetFrame(sTmp
);
154 aHLinkItem
.SetInsertMode(HLINK_BUTTON
);
160 rSet
.Put(aHLinkItem
);
163 void ScDrawShell::ExecuteHLink( SfxRequest
& rReq
)
165 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
167 USHORT nSlot
= rReq
.GetSlot();
170 case SID_HYPERLINK_SETLINK
:
173 const SfxPoolItem
* pItem
;
174 if ( pReqArgs
->GetItemState( SID_HYPERLINK_SETLINK
, TRUE
, &pItem
) == SFX_ITEM_SET
)
176 const SvxHyperlinkItem
* pHyper
= (const SvxHyperlinkItem
*) pItem
;
177 const String
& rName
= pHyper
->GetName();
178 const String
& rURL
= pHyper
->GetURL();
179 const String
& rTarget
= pHyper
->GetTargetFrame();
180 SvxLinkInsertMode eMode
= pHyper
->GetInsertMode();
183 if ( eMode
== HLINK_FIELD
|| eMode
== HLINK_BUTTON
)
185 ScDrawView
* pView
= pViewData
->GetScDrawView();
186 const SdrMarkList
& rMarkList
= pView
->GetMarkedObjectList();
187 if ( rMarkList
.GetMarkCount() == 1 )
189 SdrObject
* pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
190 SdrUnoObj
* pUnoCtrl
= PTR_CAST(SdrUnoObj
, pObj
);
191 if (pUnoCtrl
&& FmFormInventor
== pUnoCtrl
->GetObjInventor())
193 uno::Reference
<awt::XControlModel
> xControlModel
=
194 pUnoCtrl
->GetUnoControlModel();
195 DBG_ASSERT( xControlModel
.is(), "UNO-Control ohne Model" );
196 if( !xControlModel
.is() )
199 uno::Reference
< beans::XPropertySet
> xPropSet( xControlModel
, uno::UNO_QUERY
);
200 uno::Reference
< beans::XPropertySetInfo
> xInfo
= xPropSet
->getPropertySetInfo();
202 rtl::OUString sPropTargetURL
=
203 rtl::OUString::createFromAscii( "TargetURL" );
205 // Darf man eine URL an dem Objekt setzen?
206 if (xInfo
->hasPropertyByName( sPropTargetURL
))
210 rtl::OUString sPropButtonType
=
211 rtl::OUString::createFromAscii( "ButtonType" );
212 rtl::OUString sPropTargetFrame
=
213 rtl::OUString::createFromAscii( "TargetFrame" );
214 rtl::OUString sPropLabel
=
215 rtl::OUString::createFromAscii( "Label" );
218 if ( xInfo
->hasPropertyByName( sPropLabel
) )
220 aAny
<<= rtl::OUString(rName
);
221 xPropSet
->setPropertyValue( sPropLabel
, aAny
);
224 ::rtl::OUString aTmp
= INetURLObject::GetAbsURL( pViewData
->GetDocShell()->GetMedium()->GetBaseURL(), rURL
);
226 xPropSet
->setPropertyValue( sPropTargetURL
, aAny
);
228 if( rTarget
.Len() && xInfo
->hasPropertyByName( sPropTargetFrame
) )
230 aAny
<<= rtl::OUString(rTarget
);
231 xPropSet
->setPropertyValue( sPropTargetFrame
, aAny
);
234 if ( xInfo
->hasPropertyByName( sPropButtonType
) )
236 form::FormButtonType eButtonType
= form::FormButtonType_URL
;
237 aAny
<<= eButtonType
;
238 xPropSet
->setPropertyValue( sPropButtonType
, aAny
);
242 pViewData
->GetDocShell()->SetDocumentModified();
248 SetHlinkForObject( pObj
, rURL
);
255 pViewData
->GetViewShell()->
256 InsertURL( rName
, rURL
, rTarget
, (USHORT
) eMode
);
258 // InsertURL an der ViewShell schaltet bei "Text" die DrawShell ab !!!
263 DBG_ERROR("falscher Slot");
267 USHORT
ScGetFontWorkId(); // wegen CLOOKs - in drtxtob2
269 //------------------------------------------------------------------
272 // Funktionen auf Drawing-Objekten
275 void ScDrawShell::ExecDrawFunc( SfxRequest
& rReq
)
277 SfxBindings
& rBindings
= pViewData
->GetBindings();
278 ScTabView
* pTabView
= pViewData
->GetView();
279 ScDrawView
* pView
= pTabView
->GetScDrawView();
280 const SfxItemSet
*pArgs
= rReq
.GetArgs();
281 USHORT nSlotId
= rReq
.GetSlot();
284 // wer weiss, wie lange das funktioniert? (->vom Abreisscontrol funktioniert es)
286 if (nSlotId
== SID_OBJECT_ALIGN
&& pArgs
)
287 nSlotId
= SID_OBJECT_ALIGN
+ ((SfxEnumItem
&)pArgs
->Get(SID_OBJECT_ALIGN
)).GetValue() + 1;
291 case SID_OBJECT_HEAVEN
:
292 pView
->SetMarkedToLayer( SC_LAYER_FRONT
);
293 rBindings
.Invalidate(SID_OBJECT_HEAVEN
);
294 rBindings
.Invalidate(SID_OBJECT_HELL
);
296 case SID_OBJECT_HELL
:
297 pView
->SetMarkedToLayer( SC_LAYER_BACK
);
298 rBindings
.Invalidate(SID_OBJECT_HEAVEN
);
299 rBindings
.Invalidate(SID_OBJECT_HELL
);
300 // leave draw shell if nothing selected (layer may be locked)
301 if ( pView
->GetMarkedObjectList().GetMarkCount() == 0 )
302 pViewData
->GetViewShell()->SetDrawShell( FALSE
);
305 case SID_FRAME_TO_TOP
:
306 pView
->PutMarkedToTop();
308 case SID_FRAME_TO_BOTTOM
:
309 pView
->PutMarkedToBtm();
312 pView
->MovMarkedToTop();
315 pView
->MovMarkedToBtm();
319 pView
->GroupMarked();
322 pView
->UnGroupMarked();
324 case SID_ENTER_GROUP
:
325 pView
->EnterMarkedGroup();
327 case SID_LEAVE_GROUP
:
328 pView
->LeaveOneGroup();
331 case SID_MIRROR_HORIZONTAL
:
332 pView
->MirrorAllMarkedHorizontal();
334 case SID_MIRROR_VERTICAL
:
335 pView
->MirrorAllMarkedVertical();
338 case SID_OBJECT_ALIGN_LEFT
:
339 case SID_ALIGN_ANY_LEFT
:
340 if (pView
->IsAlignPossible())
341 pView
->AlignMarkedObjects(SDRHALIGN_LEFT
, SDRVALIGN_NONE
);
343 case SID_OBJECT_ALIGN_CENTER
:
344 case SID_ALIGN_ANY_HCENTER
:
345 if (pView
->IsAlignPossible())
346 pView
->AlignMarkedObjects(SDRHALIGN_CENTER
, SDRVALIGN_NONE
);
348 case SID_OBJECT_ALIGN_RIGHT
:
349 case SID_ALIGN_ANY_RIGHT
:
350 if (pView
->IsAlignPossible())
351 pView
->AlignMarkedObjects(SDRHALIGN_RIGHT
, SDRVALIGN_NONE
);
353 case SID_OBJECT_ALIGN_UP
:
354 case SID_ALIGN_ANY_TOP
:
355 if (pView
->IsAlignPossible())
356 pView
->AlignMarkedObjects(SDRHALIGN_NONE
, SDRVALIGN_TOP
);
358 case SID_OBJECT_ALIGN_MIDDLE
:
359 case SID_ALIGN_ANY_VCENTER
:
360 if (pView
->IsAlignPossible())
361 pView
->AlignMarkedObjects(SDRHALIGN_NONE
, SDRVALIGN_CENTER
);
363 case SID_OBJECT_ALIGN_DOWN
:
364 case SID_ALIGN_ANY_BOTTOM
:
365 if (pView
->IsAlignPossible())
366 pView
->AlignMarkedObjects(SDRHALIGN_NONE
, SDRVALIGN_BOTTOM
);
370 case SID_DELETE_CONTENTS
:
371 pView
->DeleteMarked();
372 if (!pTabView
->IsDrawSelMode())
373 pViewData
->GetViewShell()->SetDrawShell( FALSE
);
378 if (!pTabView
->IsDrawSelMode())
379 pViewData
->GetViewShell()->SetDrawShell( FALSE
);
387 DBG_ERROR( "SdrView::PasteClipboard not supported anymore" );
388 // pView->PasteClipboard( pWin );
395 case SID_ANCHOR_PAGE
:
396 pView
->SetAnchor( SCA_PAGE
);
397 rBindings
.Invalidate( SID_ANCHOR_PAGE
);
398 rBindings
.Invalidate( SID_ANCHOR_CELL
);
401 case SID_ANCHOR_CELL
:
402 pView
->SetAnchor( SCA_CELL
);
403 rBindings
.Invalidate( SID_ANCHOR_PAGE
);
404 rBindings
.Invalidate( SID_ANCHOR_CELL
);
407 case SID_ANCHOR_TOGGLE
:
409 switch( pView
->GetAnchor() )
412 pView
->SetAnchor( SCA_PAGE
);
415 pView
->SetAnchor( SCA_CELL
);
419 rBindings
.Invalidate( SID_ANCHOR_PAGE
);
420 rBindings
.Invalidate( SID_ANCHOR_CELL
);
423 case SID_OBJECT_ROTATE
:
426 if (pView
->GetDragMode() == SDRDRAG_ROTATE
)
427 eMode
= SDRDRAG_MOVE
;
429 eMode
= SDRDRAG_ROTATE
;
430 pView
->SetDragMode( eMode
);
431 rBindings
.Invalidate( SID_OBJECT_ROTATE
);
432 rBindings
.Invalidate( SID_OBJECT_MIRROR
);
433 if (eMode
== SDRDRAG_ROTATE
&& !pView
->IsFrameDragSingles())
435 pView
->SetFrameDragSingles( TRUE
);
436 rBindings
.Invalidate( SID_BEZIER_EDIT
);
440 case SID_OBJECT_MIRROR
:
443 if (pView
->GetDragMode() == SDRDRAG_MIRROR
)
444 eMode
= SDRDRAG_MOVE
;
446 eMode
= SDRDRAG_MIRROR
;
447 pView
->SetDragMode( eMode
);
448 rBindings
.Invalidate( SID_OBJECT_ROTATE
);
449 rBindings
.Invalidate( SID_OBJECT_MIRROR
);
450 if (eMode
== SDRDRAG_MIRROR
&& !pView
->IsFrameDragSingles())
452 pView
->SetFrameDragSingles( TRUE
);
453 rBindings
.Invalidate( SID_BEZIER_EDIT
);
457 case SID_BEZIER_EDIT
:
459 BOOL bOld
= pView
->IsFrameDragSingles();
460 pView
->SetFrameDragSingles( !bOld
);
461 rBindings
.Invalidate( SID_BEZIER_EDIT
);
462 if (bOld
&& pView
->GetDragMode() != SDRDRAG_MOVE
)
464 pView
->SetDragMode( SDRDRAG_MOVE
);
465 rBindings
.Invalidate( SID_OBJECT_ROTATE
);
466 rBindings
.Invalidate( SID_OBJECT_MIRROR
);
473 USHORT nId
= ScGetFontWorkId();
474 SfxViewFrame
* pViewFrm
= pViewData
->GetViewShell()->GetViewFrame();
476 if ( rReq
.GetArgs() )
477 pViewFrm
->SetChildWindow( nId
,
478 ((const SfxBoolItem
&)
479 (rReq
.GetArgs()->Get(SID_FONTWORK
))).
482 pViewFrm
->ToggleChildWindow( nId
);
484 rBindings
.Invalidate( SID_FONTWORK
);
489 case SID_ORIGINALSIZE
:
490 pView
->SetMarkedOriginalSize();
493 case SID_ENABLE_HYPHENATION
:
495 SFX_REQUEST_ARG( rReq
, pItem
, SfxBoolItem
, SID_ENABLE_HYPHENATION
, FALSE
);
498 SfxItemSet
aSet( GetPool(), EE_PARA_HYPHENATE
, EE_PARA_HYPHENATE
);
499 BOOL bValue
= ( (const SfxBoolItem
*) pItem
)->GetValue();
500 aSet
.Put( SfxBoolItem( EE_PARA_HYPHENATE
, bValue
) );
501 pView
->SetAttributes( aSet
);
507 case SID_RENAME_OBJECT
:
509 if(1L == pView
->GetMarkedObjectCount())
512 SdrObject
* pSelected
= pView
->GetMarkedObjectByIndex(0L);
513 OSL_ENSURE(pSelected
, "ScDrawShell::ExecDrawFunc: nMarkCount, but no object (!)");
515 if(SC_LAYER_INTERN
!= pSelected
->GetLayer())
517 String
aName(pSelected
->GetName());
519 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
520 OSL_ENSURE(pFact
, "Dialogdiet fail!");
521 AbstractSvxObjectNameDialog
* pDlg
= pFact
->CreateSvxObjectNameDialog(NULL
, aName
, RID_SVXDLG_OBJECT_NAME
);
522 OSL_ENSURE(pDlg
, "Dialogdiet fail!");
524 pDlg
->SetCheckNameHdl(LINK(this, ScDrawShell
, NameObjectHdl
));
526 if(RET_OK
== pDlg
->Execute())
528 ScDocShell
* pDocSh
= pViewData
->GetDocShell();
529 pDlg
->GetName(aName
);
531 if(aName
!= pSelected
->GetName())
533 // handle name change
534 const sal_uInt16
nObjType(pSelected
->GetObjIdentifier());
536 if(OBJ_GRAF
== nObjType
&& 0L == aName
.Len())
538 // graphics objects must have names
539 // (all graphics are supposed to be in the navigator)
540 ScDrawLayer
* pModel
= pViewData
->GetDocument()->GetDrawLayer();
544 aName
= pModel
->GetNewGraphicName();
548 // An undo action for renaming is missing in svdraw (99363).
549 // For OLE objects (which can be identified using the persist name),
550 // ScUndoRenameObject can be used until there is a common action for all objects.
551 if(OBJ_OLE2
== nObjType
)
553 const String aPersistName
= static_cast<SdrOle2Obj
*>(pSelected
)->GetPersistName();
555 if(aPersistName
.Len())
557 pDocSh
->GetUndoManager()->AddUndoAction(
558 new ScUndoRenameObject(pDocSh
, aPersistName
, pSelected
->GetName(), aName
));
563 pSelected
->SetName(aName
);
566 // ChartListenerCollectionNeedsUpdate is needed for Navigator update
567 pDocSh
->GetDocument()->SetChartListenerCollectionNeedsUpdate( TRUE
);
568 pDocSh
->SetDrawModified();
578 case SID_TITLE_DESCRIPTION_OBJECT
:
580 if(1L == pView
->GetMarkedObjectCount())
582 SdrObject
* pSelected
= pView
->GetMarkedObjectByIndex(0L);
583 OSL_ENSURE(pSelected
, "ScDrawShell::ExecDrawFunc: nMarkCount, but no object (!)");
585 if(SC_LAYER_INTERN
!= pSelected
->GetLayer())
587 String
aTitle(pSelected
->GetTitle());
588 String
aDescription(pSelected
->GetDescription());
590 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
591 OSL_ENSURE(pFact
, "Dialogdiet fail!");
592 AbstractSvxObjectTitleDescDialog
* pDlg
= pFact
->CreateSvxObjectTitleDescDialog(NULL
, aTitle
, aDescription
, RID_SVXDLG_OBJECT_TITLE_DESC
);
593 OSL_ENSURE(pDlg
, "Dialogdiet fail!");
595 if(RET_OK
== pDlg
->Execute())
597 ScDocShell
* pDocSh
= pViewData
->GetDocShell();
599 // handle Title and Description
600 pDlg
->GetTitle(aTitle
);
601 pDlg
->GetDescription(aDescription
);
602 pSelected
->SetTitle(aTitle
);
603 pSelected
->SetDescription(aDescription
);
605 // ChartListenerCollectionNeedsUpdate is needed for Navigator update
606 pDocSh
->GetDocument()->SetChartListenerCollectionNeedsUpdate( TRUE
);
607 pDocSh
->SetDrawModified();
616 case SID_EXTRUSION_TOOGLE
:
617 case SID_EXTRUSION_TILT_DOWN
:
618 case SID_EXTRUSION_TILT_UP
:
619 case SID_EXTRUSION_TILT_LEFT
:
620 case SID_EXTRUSION_TILT_RIGHT
:
621 case SID_EXTRUSION_3D_COLOR
:
622 case SID_EXTRUSION_DEPTH
:
623 case SID_EXTRUSION_DIRECTION
:
624 case SID_EXTRUSION_PROJECTION
:
625 case SID_EXTRUSION_LIGHTING_DIRECTION
:
626 case SID_EXTRUSION_LIGHTING_INTENSITY
:
627 case SID_EXTRUSION_SURFACE
:
628 case SID_EXTRUSION_DEPTH_FLOATER
:
629 case SID_EXTRUSION_DIRECTION_FLOATER
:
630 case SID_EXTRUSION_LIGHTING_FLOATER
:
631 case SID_EXTRUSION_SURFACE_FLOATER
:
632 case SID_EXTRUSION_DEPTH_DIALOG
:
633 svx::ExtrusionBar::execute( pView
, rReq
, rBindings
);
637 case SID_FONTWORK_SHAPE
:
638 case SID_FONTWORK_SHAPE_TYPE
:
639 case SID_FONTWORK_ALIGNMENT
:
640 case SID_FONTWORK_SAME_LETTER_HEIGHTS
:
641 case SID_FONTWORK_CHARACTER_SPACING
:
642 case SID_FONTWORK_KERN_CHARACTER_PAIRS
:
643 case SID_FONTWORK_CHARACTER_SPACING_FLOATER
:
644 case SID_FONTWORK_ALIGNMENT_FLOATER
:
645 case SID_FONTWORK_CHARACTER_SPACING_DIALOG
:
646 svx::FontworkBar::execute( pView
, rReq
, rBindings
);
655 IMPL_LINK( ScDrawShell
, NameObjectHdl
, AbstractSvxNameDialog
*, pDialog
)
660 pDialog
->GetName( aName
);
662 ScDrawLayer
* pModel
= pViewData
->GetDocument()->GetDrawLayer();
663 if ( aName
.Len() && pModel
)
666 if ( pModel
->GetNamedObject( aName
, 0, nDummyTab
) )
668 // existing object found -> name invalid
673 return 1; // name is valid
676 //------------------------------------------------------------------
678 void ScDrawShell::ExecFormText(SfxRequest
& rReq
)
680 ScDrawView
* pDrView
= pViewData
->GetScDrawView();
681 const SdrMarkList
& rMarkList
= pDrView
->GetMarkedObjectList();
683 if ( rMarkList
.GetMarkCount() == 1 && rReq
.GetArgs() )
685 const SfxItemSet
& rSet
= *rReq
.GetArgs();
686 const SfxPoolItem
* pItem
;
688 if ( pDrView
->IsTextEdit() )
689 pDrView
->ScEndTextEdit();
692 rSet
.GetItemState(XATTR_FORMTXTSTDFORM
, TRUE
, &pItem
)
694 ((const XFormTextStdFormItem
*) pItem
)->GetValue() )
697 USHORT nId
= SvxFontWorkChildWindow::GetChildWindowId();
698 SfxViewFrame
* pViewFrm
= pViewData
->GetViewShell()->GetViewFrame();
699 SvxFontWorkDialog
* pDlg
= (SvxFontWorkDialog
*)
701 GetChildWindow(nId
)->GetWindow());
703 pDlg
->CreateStdFormObj(*pDrView
, *pDrView
->GetSdrPageView(),
704 rSet
, *rMarkList
.GetMark(0)->GetMarkedSdrObj(),
705 ((const XFormTextStdFormItem
*) pItem
)->
709 pDrView
->SetAttributes(rSet
);
713 //------------------------------------------------------------------
715 void ScDrawShell::ExecFormatPaintbrush( SfxRequest
& rReq
)
717 ScViewFunc
* pView
= pViewData
->GetView();
718 if ( pView
->HasPaintBrush() )
720 // cancel paintbrush mode
721 pView
->ResetBrushDocument();
726 const SfxItemSet
*pArgs
= rReq
.GetArgs();
727 if( pArgs
&& pArgs
->Count() >= 1 )
728 bLock
= static_cast<const SfxBoolItem
&>(pArgs
->Get(SID_FORMATPAINTBRUSH
)).GetValue();
730 ScDrawView
* pDrawView
= pViewData
->GetScDrawView();
731 if ( pDrawView
&& pDrawView
->AreObjectsMarked() )
733 BOOL bOnlyHardAttr
= TRUE
;
734 SfxItemSet
* pItemSet
= new SfxItemSet( pDrawView
->GetAttrFromMarked(bOnlyHardAttr
) );
735 pView
->SetDrawBrushSet( pItemSet
, bLock
);
740 void ScDrawShell::StateFormatPaintbrush( SfxItemSet
& rSet
)
742 ScDrawView
* pDrawView
= pViewData
->GetScDrawView();
743 BOOL bSelection
= pDrawView
&& pDrawView
->AreObjectsMarked();
744 BOOL bHasPaintBrush
= pViewData
->GetView()->HasPaintBrush();
746 if ( !bHasPaintBrush
&& !bSelection
)
747 rSet
.DisableItem( SID_FORMATPAINTBRUSH
);
749 rSet
.Put( SfxBoolItem( SID_FORMATPAINTBRUSH
, bHasPaintBrush
) );
752 ScDrawView
* ScDrawShell::GetDrawView()
754 return pViewData
->GetView()->GetScDrawView();