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