xref: /trunk/main/sw/source/ui/shells/frmsh.cxx (revision 64b1462124697ddee7e7eda36bfbb70d1b558cff)
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
10cdf0e10cSrcweir  *
11efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
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.
19cdf0e10cSrcweir  *
20efeef26fSAndrew Rist  *************************************************************/
21efeef26fSAndrew Rist 
22cdf0e10cSrcweir  // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_sw.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include <hintids.hxx>
26cdf0e10cSrcweir #include <svl/whiter.hxx>
27cdf0e10cSrcweir #include <svtools/imapobj.hxx>
28cdf0e10cSrcweir #include <svl/srchitem.hxx>
29cdf0e10cSrcweir #include <svtools/imap.hxx>
30cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
31cdf0e10cSrcweir #include <basic/sbstar.hxx>
32cdf0e10cSrcweir #include <svl/rectitem.hxx>
33cdf0e10cSrcweir #include <svl/ptitem.hxx>
34cdf0e10cSrcweir #include <svl/stritem.hxx>
350c259c9fSOliver-Rainer Wittmann #include <svl/intitem.hxx>
360c259c9fSOliver-Rainer Wittmann #include <svl/eitem.hxx>
37cdf0e10cSrcweir #include <editeng/colritem.hxx>
38cdf0e10cSrcweir #include <editeng/bolnitem.hxx>
39cdf0e10cSrcweir #include <editeng/boxitem.hxx>
40cdf0e10cSrcweir #include <editeng/protitem.hxx>
41cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
42cdf0e10cSrcweir #include <sfx2/request.hxx>
43cdf0e10cSrcweir #include <sfx2/objface.hxx>
44f120fe41SAndre Fischer #include <sfx2/sidebar/EnumContext.hxx>
45cdf0e10cSrcweir #include <svx/hlnkitem.hxx>
46cdf0e10cSrcweir #include <svx/svdview.hxx>
47cdf0e10cSrcweir #include <vcl/msgbox.hxx>
48cdf0e10cSrcweir #include <doc.hxx>
49cdf0e10cSrcweir #include <fmturl.hxx>
50cdf0e10cSrcweir #include <fmtclds.hxx>
51cdf0e10cSrcweir #include <fmtcnct.hxx>
52cdf0e10cSrcweir #include <swmodule.hxx>
53cdf0e10cSrcweir #include <wrtsh.hxx>
54cdf0e10cSrcweir #include <wview.hxx>
55cdf0e10cSrcweir #include <frmatr.hxx>
56cdf0e10cSrcweir #include <uitool.hxx>
57cdf0e10cSrcweir #include <frmfmt.hxx>
58cdf0e10cSrcweir #include <frmsh.hxx>
59cdf0e10cSrcweir #include <frmmgr.hxx>
60cdf0e10cSrcweir #include <frmdlg.hxx>
61cdf0e10cSrcweir #include <swevent.hxx>
62cdf0e10cSrcweir #include <usrpref.hxx>
63cdf0e10cSrcweir #include <edtwin.hxx>
64cdf0e10cSrcweir #include <swdtflvr.hxx>
65cdf0e10cSrcweir #include <swwait.hxx>
66cdf0e10cSrcweir #include <docstat.hxx>
67cdf0e10cSrcweir #include <IDocumentStatistics.hxx>
68cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
69cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
70cdf0e10cSrcweir #include <helpid.h>
71cdf0e10cSrcweir #include <cmdid.h>
72cdf0e10cSrcweir #include <cfgitems.hxx>
73cdf0e10cSrcweir #include <globals.hrc>
74cdf0e10cSrcweir #include <popup.hrc>
75cdf0e10cSrcweir #include <shells.hrc>
76cdf0e10cSrcweir #include "swabstdlg.hxx"
77cdf0e10cSrcweir #include "misc.hrc"
78cdf0e10cSrcweir #include <svx/dialogs.hrc>
79*64b14621SArmin Le Grand 
80*64b14621SArmin Le Grand #include <docsh.hxx>
81*64b14621SArmin Le Grand #include <svx/drawitem.hxx>
82cdf0e10cSrcweir 
83cdf0e10cSrcweir using namespace ::com::sun::star;
84cdf0e10cSrcweir using namespace ::com::sun::star::uno;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir // Prototypen ------------------------------------------------------------
87cdf0e10cSrcweir 
88cdf0e10cSrcweir void lcl_FrmGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine);
89cdf0e10cSrcweir const SwFrmFmt* lcl_GetFrmFmtByName(SwWrtShell& rSh, const String& rName)
90cdf0e10cSrcweir {
91cdf0e10cSrcweir     sal_uInt16 nCount = rSh.GetFlyCount(FLYCNTTYPE_FRM);
92cdf0e10cSrcweir     for( sal_uInt16 i = 0; i < nCount; i++)
93cdf0e10cSrcweir     {
94cdf0e10cSrcweir         const SwFrmFmt* pFmt = rSh.GetFlyNum(i, FLYCNTTYPE_FRM);
95cdf0e10cSrcweir         if(pFmt->GetName() == rName)
96cdf0e10cSrcweir             return pFmt;
97cdf0e10cSrcweir     }
98cdf0e10cSrcweir     return 0;
99cdf0e10cSrcweir }
100cdf0e10cSrcweir 
101cdf0e10cSrcweir #define SwFrameShell
102cdf0e10cSrcweir #include <sfx2/msg.hxx>
103cdf0e10cSrcweir #include "swslots.hxx"
104cdf0e10cSrcweir 
105cdf0e10cSrcweir SFX_IMPL_INTERFACE(SwFrameShell, SwBaseShell, SW_RES(STR_SHELLNAME_FRAME))
106cdf0e10cSrcweir {
107cdf0e10cSrcweir     SFX_POPUPMENU_REGISTRATION(SW_RES(MN_FRM_POPUPMENU));
108cdf0e10cSrcweir     SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_FRAME_TOOLBOX));
109cdf0e10cSrcweir }
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 
113cdf0e10cSrcweir void SwFrameShell::Execute(SfxRequest &rReq)
114cdf0e10cSrcweir {
115cdf0e10cSrcweir     //Erstmal die, die keinen FrmMgr benoetigen.
116cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
117cdf0e10cSrcweir     sal_Bool bMore = sal_False;
118cdf0e10cSrcweir     const SfxItemSet* pArgs = rReq.GetArgs();
119cdf0e10cSrcweir     const SfxPoolItem* pItem;
120cdf0e10cSrcweir     sal_uInt16 nSlot = rReq.GetSlot();
121cdf0e10cSrcweir 
122cdf0e10cSrcweir     switch ( nSlot )
123cdf0e10cSrcweir     {
124cdf0e10cSrcweir         case FN_FRAME_TO_ANCHOR:
125cdf0e10cSrcweir             if ( rSh.IsFrmSelected() )
126cdf0e10cSrcweir             {
127cdf0e10cSrcweir                 rSh.GotoFlyAnchor();
128cdf0e10cSrcweir                 rSh.EnterStdMode();
129cdf0e10cSrcweir                 rSh.CallChgLnk();
130cdf0e10cSrcweir             }
131cdf0e10cSrcweir             break;
132cdf0e10cSrcweir         case SID_FRAME_TO_TOP:
133cdf0e10cSrcweir             rSh.SelectionToTop();
134cdf0e10cSrcweir             break;
135cdf0e10cSrcweir 
136cdf0e10cSrcweir         case SID_FRAME_TO_BOTTOM:
137cdf0e10cSrcweir             rSh.SelectionToBottom();
138cdf0e10cSrcweir             break;
139cdf0e10cSrcweir 
140cdf0e10cSrcweir         case FN_FRAME_UP:
141cdf0e10cSrcweir             rSh.SelectionToTop( sal_False );
142cdf0e10cSrcweir             break;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir         case FN_FRAME_DOWN:
145cdf0e10cSrcweir             rSh.SelectionToBottom( sal_False );
146cdf0e10cSrcweir             break;
147cdf0e10cSrcweir         case FN_INSERT_FRAME:
148cdf0e10cSrcweir             if (!pArgs)
149cdf0e10cSrcweir             {
150cdf0e10cSrcweir                 // Rahmen existiert bereits, Rahmendialog zur Bearbeitung oeffnen
151cdf0e10cSrcweir                 SfxUInt16Item aDefPage(FN_FORMAT_FRAME_DLG, TP_COLUMN);
152cdf0e10cSrcweir                 rSh.GetView().GetViewFrame()->GetDispatcher()->Execute( FN_FORMAT_FRAME_DLG,
153cdf0e10cSrcweir                                 SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD,
154cdf0e10cSrcweir                                 &aDefPage, 0L );
155cdf0e10cSrcweir 
156cdf0e10cSrcweir             }
157cdf0e10cSrcweir             else
158cdf0e10cSrcweir             {
159cdf0e10cSrcweir                 // Rahmen existiert bereits, nur Spaltenanzahl wird geaendert
160cdf0e10cSrcweir                 sal_uInt16 nCols = 1;
161cdf0e10cSrcweir                 if(pArgs->GetItemState(SID_ATTR_COLUMNS, sal_False, &pItem) == SFX_ITEM_SET)
162cdf0e10cSrcweir                     nCols = ((SfxUInt16Item *)pItem)->GetValue();
163cdf0e10cSrcweir 
164cdf0e10cSrcweir                 SfxItemSet aSet(GetPool(),RES_COL,RES_COL);
165cdf0e10cSrcweir                 rSh.GetFlyFrmAttr( aSet );
166cdf0e10cSrcweir                 SwFmtCol aCol((const SwFmtCol&)aSet.Get(RES_COL));
167cdf0e10cSrcweir                 // GutterWidth wird nicht immer uebergeben, daher erst besorgen (siehe view2: Execute auf diesen Slot)
168cdf0e10cSrcweir                 sal_uInt16 nGutterWidth = aCol.GetGutterWidth();
169cdf0e10cSrcweir                 if(!nCols )
170cdf0e10cSrcweir                     nCols++;
171cdf0e10cSrcweir                 aCol.Init(nCols, nGutterWidth, aCol.GetWishWidth());
172cdf0e10cSrcweir                 aSet.Put(aCol);
173cdf0e10cSrcweir                 // Vorlagen-AutoUpdate
174cdf0e10cSrcweir                 SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
175cdf0e10cSrcweir                 if(pFmt && pFmt->IsAutoUpdateFmt())
176cdf0e10cSrcweir                 {
177cdf0e10cSrcweir                     rSh.AutoUpdateFrame(pFmt, aSet);
178cdf0e10cSrcweir                 }
179cdf0e10cSrcweir                 else
180cdf0e10cSrcweir                 {
181cdf0e10cSrcweir                     rSh.StartAllAction();
182cdf0e10cSrcweir                     rSh.SetFlyFrmAttr( aSet );
183cdf0e10cSrcweir                     rSh.SetModified();
184cdf0e10cSrcweir                     rSh.EndAllAction();
185cdf0e10cSrcweir                 }
186cdf0e10cSrcweir 
187cdf0e10cSrcweir             }
188cdf0e10cSrcweir             return;
189cdf0e10cSrcweir 
190cdf0e10cSrcweir         case SID_HYPERLINK_SETLINK:
191cdf0e10cSrcweir         {
192cdf0e10cSrcweir             if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_HYPERLINK_SETLINK, sal_False, &pItem))
193cdf0e10cSrcweir             {
194cdf0e10cSrcweir                 const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem;
195cdf0e10cSrcweir                 const String& rURL = rHLinkItem.GetURL();
196cdf0e10cSrcweir                 const String& rTarget = rHLinkItem.GetTargetFrame();
197cdf0e10cSrcweir 
198cdf0e10cSrcweir                 SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
199cdf0e10cSrcweir                 rSh.GetFlyFrmAttr( aSet );
200cdf0e10cSrcweir                 SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
201cdf0e10cSrcweir 
202cdf0e10cSrcweir                 String sOldName(rHLinkItem.GetName());
203cdf0e10cSrcweir                 String sFlyName(rSh.GetFlyName());
204cdf0e10cSrcweir                 if (sOldName.ToUpperAscii() != sFlyName.ToUpperAscii())
205cdf0e10cSrcweir                 {
206cdf0e10cSrcweir                     String sName(sOldName);
207cdf0e10cSrcweir                     sal_uInt16 i = 1;
208cdf0e10cSrcweir                     while (rSh.FindFlyByName(sName))
209cdf0e10cSrcweir                     {
210cdf0e10cSrcweir                         sName = sOldName;
211cdf0e10cSrcweir                         sName += '_';
212cdf0e10cSrcweir                         sName += String::CreateFromInt32(i++);
213cdf0e10cSrcweir                     }
214cdf0e10cSrcweir                     rSh.SetFlyName(sName);
215cdf0e10cSrcweir                 }
216cdf0e10cSrcweir                 aURL.SetURL( rURL, sal_False );
217cdf0e10cSrcweir                 aURL.SetTargetFrameName(rTarget);
218cdf0e10cSrcweir 
219cdf0e10cSrcweir                 aSet.Put( aURL );
220cdf0e10cSrcweir                 rSh.SetFlyFrmAttr( aSet );
221cdf0e10cSrcweir             }
222cdf0e10cSrcweir         }
223cdf0e10cSrcweir         break;
224cdf0e10cSrcweir 
225cdf0e10cSrcweir         case FN_FRAME_CHAIN:
226cdf0e10cSrcweir             rSh.GetView().GetEditWin().SetChainMode( !rSh.GetView().GetEditWin().IsChainMode() );
227cdf0e10cSrcweir             break;
228cdf0e10cSrcweir 
229cdf0e10cSrcweir         case FN_FRAME_UNCHAIN:
230cdf0e10cSrcweir             rSh.Unchain( (SwFrmFmt&)*rSh.GetFlyFrmFmt() );
231cdf0e10cSrcweir             GetView().GetViewFrame()->GetBindings().Invalidate(FN_FRAME_CHAIN);
232cdf0e10cSrcweir             break;
233cdf0e10cSrcweir         case FN_FORMAT_FOOTNOTE_DLG:
234cdf0e10cSrcweir         {
235cdf0e10cSrcweir             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
236cdf0e10cSrcweir             DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
237cdf0e10cSrcweir 
238cdf0e10cSrcweir             VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( GetView().GetWindow(), GetView().GetWrtShell(), DLG_DOC_FOOTNOTE );
239cdf0e10cSrcweir             DBG_ASSERT(pDlg, "Dialogdiet fail!");
240cdf0e10cSrcweir             pDlg->Execute();
241cdf0e10cSrcweir             delete pDlg;
242cdf0e10cSrcweir             break;
243cdf0e10cSrcweir         }
244cdf0e10cSrcweir         case FN_NUMBERING_OUTLINE_DLG:
245cdf0e10cSrcweir         {
246cdf0e10cSrcweir             SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
247cdf0e10cSrcweir             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
248cdf0e10cSrcweir             DBG_ASSERT(pFact, "Dialogdiet fail!");
249cdf0e10cSrcweir             SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
250cdf0e10cSrcweir                                                         GetView().GetWindow(), &aTmp, GetView().GetWrtShell());
251cdf0e10cSrcweir             DBG_ASSERT(pDlg, "Dialogdiet fail!");
252cdf0e10cSrcweir             pDlg->Execute();
253cdf0e10cSrcweir             delete pDlg;
254cdf0e10cSrcweir             rReq.Done();
255cdf0e10cSrcweir             break;
256cdf0e10cSrcweir         }
257cdf0e10cSrcweir         case SID_OPEN_XML_FILTERSETTINGS:
258cdf0e10cSrcweir         {
259cdf0e10cSrcweir             try
260cdf0e10cSrcweir             {
261cdf0e10cSrcweir                 uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.comp.ui.XSLTFilterDialog")), uno::UNO_QUERY);
262cdf0e10cSrcweir                 if( xDialog.is() )
263cdf0e10cSrcweir                 {
264cdf0e10cSrcweir                     xDialog->execute();
265cdf0e10cSrcweir                 }
266cdf0e10cSrcweir             }
267cdf0e10cSrcweir             catch( uno::Exception& )
268cdf0e10cSrcweir             {
269cdf0e10cSrcweir             }
270cdf0e10cSrcweir             rReq.Ignore ();
271cdf0e10cSrcweir         }
272cdf0e10cSrcweir         break;
273cdf0e10cSrcweir         case FN_WORDCOUNT_DIALOG:
274cdf0e10cSrcweir         {
275cdf0e10cSrcweir             SwDocStat aCurr;
276cdf0e10cSrcweir             SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() );
277cdf0e10cSrcweir             {
278cdf0e10cSrcweir                 SwWait aWait( *GetView().GetDocShell(), sal_True );
279cdf0e10cSrcweir                 rSh.StartAction();
280cdf0e10cSrcweir                 rSh.CountWords( aCurr );
281cdf0e10cSrcweir                 rSh.UpdateDocStat( aDocStat );
282cdf0e10cSrcweir                 rSh.EndAction();
283cdf0e10cSrcweir             }
284cdf0e10cSrcweir 
285cdf0e10cSrcweir             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
286cdf0e10cSrcweir             DBG_ASSERT(pFact, "Dialogdiet fail!");
287cdf0e10cSrcweir             AbstractSwWordCountDialog* pDialog = pFact->CreateSwWordCountDialog( GetView().GetWindow() );
288cdf0e10cSrcweir             pDialog->SetValues(aCurr, aDocStat );
289cdf0e10cSrcweir             pDialog->Execute();
290cdf0e10cSrcweir             delete pDialog;
291cdf0e10cSrcweir         }
292cdf0e10cSrcweir         break;
293cdf0e10cSrcweir         default: bMore = sal_True;
294cdf0e10cSrcweir     }
295cdf0e10cSrcweir 
296cdf0e10cSrcweir     if ( !bMore )
297cdf0e10cSrcweir     {
298cdf0e10cSrcweir         return;
299cdf0e10cSrcweir     }
300cdf0e10cSrcweir 
301cdf0e10cSrcweir     SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
302cdf0e10cSrcweir     sal_Bool bUpdateMgr = sal_True;
303cdf0e10cSrcweir     sal_Bool bCopyToFmt = sal_False;
304cdf0e10cSrcweir     switch ( nSlot )
305cdf0e10cSrcweir     {
306cdf0e10cSrcweir         case SID_OBJECT_ALIGN_MIDDLE:
307cdf0e10cSrcweir         case FN_FRAME_ALIGN_VERT_CENTER:
308cdf0e10cSrcweir             aMgr.SetVertOrientation( text::VertOrientation::CENTER );
309cdf0e10cSrcweir             break;
310cdf0e10cSrcweir         case SID_OBJECT_ALIGN_DOWN :
311cdf0e10cSrcweir         case FN_FRAME_ALIGN_VERT_BOTTOM:
312cdf0e10cSrcweir             aMgr.SetVertOrientation( text::VertOrientation::BOTTOM );
313cdf0e10cSrcweir             break;
314cdf0e10cSrcweir         case SID_OBJECT_ALIGN_UP :
315cdf0e10cSrcweir         case FN_FRAME_ALIGN_VERT_TOP:
316cdf0e10cSrcweir             aMgr.SetVertOrientation( text::VertOrientation::TOP );
317cdf0e10cSrcweir             break;
318cdf0e10cSrcweir 
319cdf0e10cSrcweir         case FN_FRAME_ALIGN_VERT_CHAR_CENTER:
320cdf0e10cSrcweir             aMgr.SetVertOrientation( text::VertOrientation::CHAR_CENTER );
321cdf0e10cSrcweir             break;
322cdf0e10cSrcweir 
323cdf0e10cSrcweir         case FN_FRAME_ALIGN_VERT_CHAR_BOTTOM:
324cdf0e10cSrcweir             aMgr.SetVertOrientation( text::VertOrientation::CHAR_BOTTOM );
325cdf0e10cSrcweir             break;
326cdf0e10cSrcweir 
327cdf0e10cSrcweir         case FN_FRAME_ALIGN_VERT_CHAR_TOP:
328cdf0e10cSrcweir             aMgr.SetVertOrientation( text::VertOrientation::CHAR_TOP );
329cdf0e10cSrcweir             break;
330cdf0e10cSrcweir 
331cdf0e10cSrcweir         case FN_FRAME_ALIGN_VERT_ROW_CENTER:
332cdf0e10cSrcweir             aMgr.SetVertOrientation( text::VertOrientation::LINE_CENTER );
333cdf0e10cSrcweir             break;
334cdf0e10cSrcweir 
335cdf0e10cSrcweir         case FN_FRAME_ALIGN_VERT_ROW_BOTTOM:
336cdf0e10cSrcweir             aMgr.SetVertOrientation( text::VertOrientation::LINE_BOTTOM );
337cdf0e10cSrcweir             break;
338cdf0e10cSrcweir 
339cdf0e10cSrcweir         case FN_FRAME_ALIGN_VERT_ROW_TOP:
340cdf0e10cSrcweir             aMgr.SetVertOrientation( text::VertOrientation::LINE_TOP );
341cdf0e10cSrcweir             break;
342cdf0e10cSrcweir         case SID_OBJECT_ALIGN_CENTER :
343cdf0e10cSrcweir         case FN_FRAME_ALIGN_HORZ_CENTER:
344cdf0e10cSrcweir             aMgr.SetHorzOrientation( text::HoriOrientation::CENTER );
345cdf0e10cSrcweir             break;
346cdf0e10cSrcweir         case SID_OBJECT_ALIGN_RIGHT:
347cdf0e10cSrcweir         case FN_FRAME_ALIGN_HORZ_RIGHT:
348cdf0e10cSrcweir             aMgr.SetHorzOrientation( text::HoriOrientation::RIGHT );
349cdf0e10cSrcweir             break;
350cdf0e10cSrcweir         case SID_OBJECT_ALIGN_LEFT:
351cdf0e10cSrcweir         case FN_FRAME_ALIGN_HORZ_LEFT:
352cdf0e10cSrcweir             aMgr.SetHorzOrientation( text::HoriOrientation::LEFT );
353cdf0e10cSrcweir             break;
354cdf0e10cSrcweir 
355cdf0e10cSrcweir         case FN_SET_FRM_POSITION:
356cdf0e10cSrcweir         {
357cdf0e10cSrcweir             aMgr.SetAbsPos(((SfxPointItem &)pArgs->Get
358cdf0e10cSrcweir                                 (FN_SET_FRM_POSITION)).GetValue());
359cdf0e10cSrcweir         }
360cdf0e10cSrcweir         break;
361cdf0e10cSrcweir         case SID_ATTR_BRUSH:
362cdf0e10cSrcweir         {
363cdf0e10cSrcweir             if(pArgs)
364cdf0e10cSrcweir             {
365cdf0e10cSrcweir                 aMgr.SetAttrSet( *pArgs );
366cdf0e10cSrcweir                 bCopyToFmt = sal_True;
367cdf0e10cSrcweir             }
368cdf0e10cSrcweir         }
369cdf0e10cSrcweir         break;
370cdf0e10cSrcweir         case SID_ATTR_ULSPACE:
371cdf0e10cSrcweir         case SID_ATTR_LRSPACE:
372cdf0e10cSrcweir         {
373cdf0e10cSrcweir             if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(GetPool().GetWhich(nSlot), sal_False, &pItem))
374cdf0e10cSrcweir             {
375cdf0e10cSrcweir                 aMgr.SetAttrSet( *pArgs );
376cdf0e10cSrcweir                 if(SID_ATTR_ULSPACE == nSlot && SID_ATTR_ULSPACE == nSlot)
377cdf0e10cSrcweir                     bCopyToFmt = sal_True;
378cdf0e10cSrcweir             }
379cdf0e10cSrcweir         }
380cdf0e10cSrcweir         break;
3810c259c9fSOliver-Rainer Wittmann 
3820c259c9fSOliver-Rainer Wittmann         case SID_ATTR_TRANSFORM:
3830c259c9fSOliver-Rainer Wittmann         {
3840c259c9fSOliver-Rainer Wittmann             bool bApplyNewSize = false;
3850c259c9fSOliver-Rainer Wittmann 
3860c259c9fSOliver-Rainer Wittmann             Size aNewSize = aMgr.GetSize();
3871ff378efSZheng Fan             if ( SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_TRANSFORM_WIDTH, sal_False, &pItem ) )
3880c259c9fSOliver-Rainer Wittmann             {
3890c259c9fSOliver-Rainer Wittmann                 aNewSize.setWidth( static_cast< const SfxUInt32Item* >(pItem)->GetValue() );
3900c259c9fSOliver-Rainer Wittmann                 bApplyNewSize = true;
3910c259c9fSOliver-Rainer Wittmann             }
3920c259c9fSOliver-Rainer Wittmann 
3931ff378efSZheng Fan             if ( SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_TRANSFORM_HEIGHT, sal_False, &pItem ) )
3940c259c9fSOliver-Rainer Wittmann             {
3950c259c9fSOliver-Rainer Wittmann                 aNewSize.setHeight( static_cast< const SfxUInt32Item* >(pItem)->GetValue() );
3960c259c9fSOliver-Rainer Wittmann                 bApplyNewSize = true;
3970c259c9fSOliver-Rainer Wittmann             }
3980c259c9fSOliver-Rainer Wittmann 
3990c259c9fSOliver-Rainer Wittmann             if ( bApplyNewSize )
4000c259c9fSOliver-Rainer Wittmann             {
4010c259c9fSOliver-Rainer Wittmann                 aMgr.SetSize( aNewSize );
4020c259c9fSOliver-Rainer Wittmann             }
4030c259c9fSOliver-Rainer Wittmann             else
4040c259c9fSOliver-Rainer Wittmann             {
4050c259c9fSOliver-Rainer Wittmann                 bUpdateMgr = sal_False;
4060c259c9fSOliver-Rainer Wittmann             }
4070c259c9fSOliver-Rainer Wittmann 
4080c259c9fSOliver-Rainer Wittmann         }
4090c259c9fSOliver-Rainer Wittmann         break;
4100c259c9fSOliver-Rainer Wittmann 
411cdf0e10cSrcweir         case FN_FORMAT_FRAME_DLG:
412395b75f9SOliver-Rainer Wittmann         case FN_DRAW_WRAP_DLG:
413cdf0e10cSrcweir         {
414cdf0e10cSrcweir             const int nSel = rSh.GetSelectionType();
415cdf0e10cSrcweir             if (nSel & nsSelectionType::SEL_GRF)
416cdf0e10cSrcweir             {
417cdf0e10cSrcweir                 rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(FN_FORMAT_GRAFIC_DLG);
418cdf0e10cSrcweir                 bUpdateMgr = sal_False;
419cdf0e10cSrcweir             }
420cdf0e10cSrcweir             else
421cdf0e10cSrcweir             {
422*64b14621SArmin Le Grand                 SfxItemSet aSet(GetPool(),  //UUUU sorted by indices
423*64b14621SArmin Le Grand                     RES_FRMATR_BEGIN,       RES_FRMATR_END-1,                       // [82
424*64b14621SArmin Le Grand 
425*64b14621SArmin Le Grand                     //UUUU FillAttribute support
426*64b14621SArmin Le Grand                     XATTR_FILL_FIRST,       XATTR_FILL_LAST,                        // [1014
427*64b14621SArmin Le Grand 
428*64b14621SArmin Le Grand                     SID_DOCFRAME,           SID_DOCFRAME,                           // [5598
429*64b14621SArmin Le Grand 
430*64b14621SArmin Le Grand                     SID_ATTR_BRUSH,         SID_ATTR_BRUSH,                         // [10001
431*64b14621SArmin Le Grand                     SID_ATTR_BORDER_INNER,  SID_ATTR_BORDER_INNER,                  // [10023
432*64b14621SArmin Le Grand                     SID_ATTR_LRSPACE,       SID_ATTR_ULSPACE,                       // [10048
433*64b14621SArmin Le Grand                     SID_ATTR_PAGE_SIZE,     SID_ATTR_PAGE_SIZE,                     // [10051
434*64b14621SArmin Le Grand 
435*64b14621SArmin Le Grand                     //UUUU items to hand over XPropertyList things like
436*64b14621SArmin Le Grand                     // XColorList, XHatchList, XGradientList and XBitmapList
437*64b14621SArmin Le Grand                     // to the Area TabPage
438*64b14621SArmin Le Grand                     SID_COLOR_TABLE,        SID_BITMAP_LIST,                        // [10179
439*64b14621SArmin Le Grand 
440*64b14621SArmin Le Grand                     SID_HTML_MODE,          SID_HTML_MODE,                          // [10414
441*64b14621SArmin Le Grand                     FN_GET_PRINT_AREA,      FN_GET_PRINT_AREA,                      // [21032
442*64b14621SArmin Le Grand                     FN_SURROUND,            FN_HORI_ORIENT,                         // [21303
443*64b14621SArmin Le Grand                     FN_SET_FRM_NAME,        FN_SET_FRM_NAME,                        // [21306
444*64b14621SArmin Le Grand                     FN_KEEP_ASPECT_RATIO,   FN_KEEP_ASPECT_RATIO,                   // [21307
445*64b14621SArmin Le Grand                     FN_SET_FRM_ALT_NAME,    FN_SET_FRM_ALT_NAME,                    // [21318
446*64b14621SArmin Le Grand                     FN_OLE_IS_MATH,         FN_OLE_IS_MATH,                         // [22314
447*64b14621SArmin Le Grand                     FN_MATH_BASELINE_ALIGNMENT, FN_MATH_BASELINE_ALIGNMENT,         // [22315
448*64b14621SArmin Le Grand                     FN_PARAM_CHAIN_PREVIOUS, FN_PARAM_CHAIN_NEXT,                   // [22420
449*64b14621SArmin Le Grand 
450cdf0e10cSrcweir                     0);
451cdf0e10cSrcweir 
452*64b14621SArmin Le Grand                 //UUUU create needed items for XPropertyList entries from the DrawModel so that
453*64b14621SArmin Le Grand                 // the Area TabPage can access them
454*64b14621SArmin Le Grand                 const SdrModel* pDrawModel = rSh.GetView().GetDocShell()->GetDoc()->GetDrawModel();
455*64b14621SArmin Le Grand 
456*64b14621SArmin Le Grand                 aSet.Put(SvxColorTableItem(pDrawModel->GetColorTableFromSdrModel(), SID_COLOR_TABLE));
457*64b14621SArmin Le Grand                 aSet.Put(SvxGradientListItem(pDrawModel->GetGradientListFromSdrModel(), SID_GRADIENT_LIST));
458*64b14621SArmin Le Grand                 aSet.Put(SvxHatchListItem(pDrawModel->GetHatchListFromSdrModel(), SID_HATCH_LIST));
459*64b14621SArmin Le Grand                 aSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapListFromSdrModel(), SID_BITMAP_LIST));
460*64b14621SArmin Le Grand 
461cdf0e10cSrcweir                 const SwViewOption* pVOpt = rSh.GetViewOptions();
462cdf0e10cSrcweir                 if(nSel & nsSelectionType::SEL_OLE)
463cdf0e10cSrcweir                     aSet.Put( SfxBoolItem(FN_KEEP_ASPECT_RATIO, pVOpt->IsKeepRatio()) );
464cdf0e10cSrcweir                 aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
465cdf0e10cSrcweir                 aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName()));
466cdf0e10cSrcweir                 if( nSel & nsSelectionType::SEL_OLE )
467cdf0e10cSrcweir                 {
468cdf0e10cSrcweir                     aSet.Put( SfxStringItem( FN_SET_FRM_ALT_NAME, rSh.GetObjTitle() ) );
469cdf0e10cSrcweir                 }
470cdf0e10cSrcweir 
471cdf0e10cSrcweir                 const SwRect &rPg = rSh.GetAnyCurRect(RECT_PAGE);
472cdf0e10cSrcweir                 SwFmtFrmSize aFrmSize(ATT_VAR_SIZE, rPg.Width(), rPg.Height());
473cdf0e10cSrcweir                 aFrmSize.SetWhich(GetPool().GetWhich(SID_ATTR_PAGE_SIZE));
474cdf0e10cSrcweir                 aSet.Put(aFrmSize);
475cdf0e10cSrcweir 
476cdf0e10cSrcweir                 const SwRect &rPr = rSh.GetAnyCurRect(RECT_PAGE_PRT);
477cdf0e10cSrcweir                 SwFmtFrmSize aPrtSize(ATT_VAR_SIZE, rPr.Width(), rPr.Height());
478cdf0e10cSrcweir                 aPrtSize.SetWhich(GetPool().GetWhich(FN_GET_PRINT_AREA));
479cdf0e10cSrcweir                 aSet.Put(aPrtSize);
480cdf0e10cSrcweir 
481cdf0e10cSrcweir                 aSet.Put(aMgr.GetAttrSet());
482cdf0e10cSrcweir                 aSet.SetParent( aMgr.GetAttrSet().GetParent() );
483cdf0e10cSrcweir 
484cdf0e10cSrcweir                 // Bei %-Werten Groesse initialisieren
485cdf0e10cSrcweir                 SwFmtFrmSize& rSize = (SwFmtFrmSize&)aSet.Get(RES_FRM_SIZE);
486cdf0e10cSrcweir                 if (rSize.GetWidthPercent() && rSize.GetWidthPercent() != 0xff)
487cdf0e10cSrcweir                     rSize.SetWidth(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Width());
488cdf0e10cSrcweir                 if (rSize.GetHeightPercent() && rSize.GetHeightPercent() != 0xff)
489cdf0e10cSrcweir                     rSize.SetHeight(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Height());
490cdf0e10cSrcweir 
491cdf0e10cSrcweir                 // disable vertical positioning for Math Objects anchored 'as char' if baseline alignment is activated
492cdf0e10cSrcweir                 aSet.Put( SfxBoolItem( FN_MATH_BASELINE_ALIGNMENT,
493cdf0e10cSrcweir                         rSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) ) );
494cdf0e10cSrcweir                 const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() );
495cdf0e10cSrcweir                 aSet.Put( SfxBoolItem( FN_OLE_IS_MATH, xObj.is() && SotExchange::IsMath( xObj->getClassID() ) ) );
496cdf0e10cSrcweir 
497cdf0e10cSrcweir                 sal_uInt16 nDefPage = 0;
498cdf0e10cSrcweir                 if(pArgs && pArgs->GetItemState(FN_FORMAT_FRAME_DLG, sal_False, &pItem) == SFX_ITEM_SET)
499cdf0e10cSrcweir                     nDefPage = ((SfxUInt16Item *)pItem)->GetValue();
500cdf0e10cSrcweir 
501cdf0e10cSrcweir                 aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame()->GetTopFrame()));
502cdf0e10cSrcweir                 FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView()));
503cdf0e10cSrcweir                 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric) ));
504cdf0e10cSrcweir                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
505cdf0e10cSrcweir                 DBG_ASSERT(pFact, "Dialogdiet fail!");
506cdf0e10cSrcweir                 SfxAbstractTabDialog* pDlg = pFact->CreateFrmTabDialog( DLG_FRM_STD,
507cdf0e10cSrcweir                                                         GetView().GetViewFrame(),
508cdf0e10cSrcweir                                                         GetView().GetWindow(),
509cdf0e10cSrcweir                                                         aSet, sal_False,
510cdf0e10cSrcweir                                                         nSel & nsSelectionType::SEL_GRF ? DLG_FRM_GRF :
511cdf0e10cSrcweir                                                         nSel & nsSelectionType::SEL_OLE ? DLG_FRM_OLE :
512cdf0e10cSrcweir                                                                                         DLG_FRM_STD,
513cdf0e10cSrcweir                                                         sal_False,
514cdf0e10cSrcweir                                                         nDefPage);
515cdf0e10cSrcweir                 DBG_ASSERT(pDlg, "Dialogdiet fail!");
516cdf0e10cSrcweir 
517395b75f9SOliver-Rainer Wittmann                 if ( nSlot == FN_DRAW_WRAP_DLG )
518721f296aSOliver-Rainer Wittmann                 {
519721f296aSOliver-Rainer Wittmann                     pDlg->SetCurPageId(TP_FRM_WRAP);
520721f296aSOliver-Rainer Wittmann                 }
521721f296aSOliver-Rainer Wittmann 
522cdf0e10cSrcweir                 if ( pDlg->Execute() )
523cdf0e10cSrcweir                 {
524cdf0e10cSrcweir                     const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
525cdf0e10cSrcweir                     if(pOutSet)
526cdf0e10cSrcweir                     {
527cdf0e10cSrcweir                         rReq.Done(*pOutSet);
528cdf0e10cSrcweir                         if(nSel & nsSelectionType::SEL_OLE &&
529cdf0e10cSrcweir                         SFX_ITEM_SET == pOutSet->GetItemState(FN_KEEP_ASPECT_RATIO, sal_True, &pItem))
530cdf0e10cSrcweir                         {
531cdf0e10cSrcweir                             SwViewOption aUsrPref( *pVOpt );
532cdf0e10cSrcweir                             aUsrPref.SetKeepRatio(((const SfxBoolItem*)pItem)->GetValue());
533cdf0e10cSrcweir                             SW_MOD()->ApplyUsrPref(aUsrPref, &GetView());
534cdf0e10cSrcweir                         }
535cdf0e10cSrcweir                         if (SFX_ITEM_SET == pOutSet->GetItemState(FN_SET_FRM_ALT_NAME, sal_True, &pItem))
536cdf0e10cSrcweir                         {
537cdf0e10cSrcweir                             // --> OD 2009-07-13 #i73249#
538cdf0e10cSrcweir //                            rSh.SetAlternateText(((const SfxStringItem*)pItem)->GetValue());
539cdf0e10cSrcweir                             rSh.SetObjTitle(((const SfxStringItem*)pItem)->GetValue());
540cdf0e10cSrcweir                             // <--
541cdf0e10cSrcweir                         }
542cdf0e10cSrcweir                         // Vorlagen-AutoUpdate
543cdf0e10cSrcweir                         SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
544cdf0e10cSrcweir                         if(pFmt && pFmt->IsAutoUpdateFmt())
545cdf0e10cSrcweir                         {
546cdf0e10cSrcweir                             rSh.AutoUpdateFrame(pFmt, *pOutSet);
547cdf0e10cSrcweir                             // alles, dass das Format nicht kann, muss hart
548cdf0e10cSrcweir                             // gesetzt werden
549cdf0e10cSrcweir                             if(SFX_ITEM_SET == pOutSet->GetItemState(FN_SET_FRM_NAME, sal_False, &pItem))
550cdf0e10cSrcweir                                 rSh.SetFlyName(((SfxStringItem*)pItem)->GetValue());
551cdf0e10cSrcweir                             SfxItemSet aShellSet(GetPool(), RES_FRM_SIZE,   RES_FRM_SIZE,
552cdf0e10cSrcweir                                                             RES_SURROUND,   RES_SURROUND,
553cdf0e10cSrcweir                                                             RES_ANCHOR,     RES_ANCHOR,
554cdf0e10cSrcweir                                                             RES_VERT_ORIENT,RES_HORI_ORIENT,
555cdf0e10cSrcweir                                                             0);
556cdf0e10cSrcweir                             aShellSet.Put(*pOutSet);
557cdf0e10cSrcweir                             aMgr.SetAttrSet(aShellSet);
558cdf0e10cSrcweir                             if(SFX_ITEM_SET == pOutSet->GetItemState(FN_SET_FRM_NAME, sal_False, &pItem))
559cdf0e10cSrcweir                                 rSh.SetFlyName(((SfxStringItem*)pItem)->GetValue());
560cdf0e10cSrcweir                         }
561cdf0e10cSrcweir                         else
562cdf0e10cSrcweir                             aMgr.SetAttrSet( *pOutSet );
563cdf0e10cSrcweir 
564cdf0e10cSrcweir                         const SwFrmFmt* pCurrFlyFmt = rSh.GetFlyFrmFmt();
565cdf0e10cSrcweir                         if(SFX_ITEM_SET ==
566cdf0e10cSrcweir                            pOutSet->GetItemState(FN_PARAM_CHAIN_PREVIOUS,
567cdf0e10cSrcweir                                                  sal_False, &pItem))
568cdf0e10cSrcweir                         {
569cdf0e10cSrcweir                             rSh.HideChainMarker();
570cdf0e10cSrcweir 
571cdf0e10cSrcweir                             String sPrevName =
572cdf0e10cSrcweir                                 ((const SfxStringItem*)pItem)->GetValue();
573cdf0e10cSrcweir                             const SwFmtChain &rChain = pCurrFlyFmt->GetChain();
574cdf0e10cSrcweir                             //needs cast - no non-const method available
575cdf0e10cSrcweir                             SwFlyFrmFmt* pFlyFmt =
576cdf0e10cSrcweir                                 (SwFlyFrmFmt*)rChain.GetPrev();
577cdf0e10cSrcweir                             if(pFlyFmt)
578cdf0e10cSrcweir                             {
579cdf0e10cSrcweir                                 if (pFlyFmt->GetName() != sPrevName)
580cdf0e10cSrcweir                                 {
581cdf0e10cSrcweir                                     rSh.Unchain(*pFlyFmt);
582cdf0e10cSrcweir                                 }
583cdf0e10cSrcweir                                 else
584cdf0e10cSrcweir                                     sPrevName.Erase();
585cdf0e10cSrcweir                             }
586cdf0e10cSrcweir 
587cdf0e10cSrcweir                             if(sPrevName.Len())
588cdf0e10cSrcweir                             {
589cdf0e10cSrcweir                                 //needs cast - no non-const method available
590cdf0e10cSrcweir                                 SwFrmFmt* pPrevFmt = (SwFrmFmt*)
591cdf0e10cSrcweir                                     lcl_GetFrmFmtByName(rSh, sPrevName);
592cdf0e10cSrcweir                                 DBG_ASSERT(pPrevFmt, "No frame found!");
593cdf0e10cSrcweir                                 if(pPrevFmt)
594cdf0e10cSrcweir                                 {
595cdf0e10cSrcweir                                     rSh.Chain(*pPrevFmt, *pCurrFlyFmt);
596cdf0e10cSrcweir                                 }
597cdf0e10cSrcweir                             }
598cdf0e10cSrcweir                             rSh.SetChainMarker();
599cdf0e10cSrcweir                         }
600cdf0e10cSrcweir                         if(SFX_ITEM_SET ==
601cdf0e10cSrcweir                            pOutSet->GetItemState(FN_PARAM_CHAIN_NEXT, sal_False,
602cdf0e10cSrcweir                                                  &pItem))
603cdf0e10cSrcweir                         {
604cdf0e10cSrcweir                             rSh.HideChainMarker();
605cdf0e10cSrcweir                             String sNextName =
606cdf0e10cSrcweir                                 ((const SfxStringItem*)pItem)->GetValue();
607cdf0e10cSrcweir                             const SwFmtChain &rChain = pCurrFlyFmt->GetChain();
608cdf0e10cSrcweir                             //needs cast - no non-const method available
609cdf0e10cSrcweir                             SwFlyFrmFmt* pFlyFmt =
610cdf0e10cSrcweir                                 (SwFlyFrmFmt*)rChain.GetNext();
611cdf0e10cSrcweir                             if(pFlyFmt)
612cdf0e10cSrcweir                             {
613cdf0e10cSrcweir                                 if (pFlyFmt->GetName() != sNextName)
614cdf0e10cSrcweir                                 {
615cdf0e10cSrcweir                                     rSh.Unchain(*((SwFlyFrmFmt*) pCurrFlyFmt));
616cdf0e10cSrcweir                                 }
617cdf0e10cSrcweir                                 else
618cdf0e10cSrcweir                                     sNextName.Erase();
619cdf0e10cSrcweir                             }
620cdf0e10cSrcweir 
621cdf0e10cSrcweir                             if(sNextName.Len())
622cdf0e10cSrcweir                             {
623cdf0e10cSrcweir                                 //needs cast - no non-const method available
624cdf0e10cSrcweir                                 SwFrmFmt* pNextFmt = (SwFrmFmt*)
625cdf0e10cSrcweir                                     lcl_GetFrmFmtByName(rSh, sNextName);
626cdf0e10cSrcweir                                 DBG_ASSERT(pNextFmt, "No frame found!");
627cdf0e10cSrcweir                                 if(pNextFmt)
628cdf0e10cSrcweir                                 {
629cdf0e10cSrcweir                                     rSh.Chain(*(SwFrmFmt*)
630cdf0e10cSrcweir                                               pCurrFlyFmt, *pNextFmt);
631cdf0e10cSrcweir                                 }
632cdf0e10cSrcweir                             }
633cdf0e10cSrcweir                             rSh.SetChainMarker();
634cdf0e10cSrcweir                         }
635cdf0e10cSrcweir                     }
636cdf0e10cSrcweir                 }
637cdf0e10cSrcweir                 else
638cdf0e10cSrcweir                     bUpdateMgr = sal_False;
639cdf0e10cSrcweir                 delete pDlg;
640cdf0e10cSrcweir             }
641cdf0e10cSrcweir         }
642cdf0e10cSrcweir         break;
643cdf0e10cSrcweir         case FN_FRAME_MIRROR_ON_EVEN_PAGES:
644cdf0e10cSrcweir         {
645cdf0e10cSrcweir             SwFmtHoriOrient aHori(aMgr.GetHoriOrient());
646cdf0e10cSrcweir             sal_Bool bMirror = !aHori.IsPosToggle();
647cdf0e10cSrcweir             aHori.SetPosToggle(bMirror);
648cdf0e10cSrcweir             SfxItemSet aSet(GetPool(), RES_HORI_ORIENT, RES_HORI_ORIENT);
649cdf0e10cSrcweir             aSet.Put(aHori);
650cdf0e10cSrcweir             aMgr.SetAttrSet(aSet);
651cdf0e10cSrcweir             bCopyToFmt = sal_True;
652cdf0e10cSrcweir             rReq.SetReturnValue(SfxBoolItem(nSlot, bMirror));
653cdf0e10cSrcweir         }
654cdf0e10cSrcweir         break;
655cdf0e10cSrcweir         // --> OD 2009-07-14 #i73249#
656cdf0e10cSrcweir         case FN_TITLE_DESCRIPTION_SHAPE:
657cdf0e10cSrcweir         {
658cdf0e10cSrcweir             bUpdateMgr = sal_False;
659cdf0e10cSrcweir             SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
660cdf0e10cSrcweir             if ( pSdrView &&
661cdf0e10cSrcweir                  pSdrView->GetMarkedObjectCount() == 1 )
662cdf0e10cSrcweir             {
663cdf0e10cSrcweir                 String aDescription(rSh.GetObjDescription());
664cdf0e10cSrcweir                 String aTitle(rSh.GetObjTitle());
665cdf0e10cSrcweir 
666cdf0e10cSrcweir                 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
667cdf0e10cSrcweir                 OSL_ENSURE(pFact, "Dialogdiet fail!");
668cdf0e10cSrcweir                 AbstractSvxObjectTitleDescDialog* pDlg =
669cdf0e10cSrcweir                     pFact->CreateSvxObjectTitleDescDialog( NULL,
670cdf0e10cSrcweir                                                            aTitle,
671cdf0e10cSrcweir                                                            aDescription );
672cdf0e10cSrcweir                 OSL_ENSURE(pDlg, "Dialogdiet fail!");
673cdf0e10cSrcweir 
674cdf0e10cSrcweir                 if ( pDlg->Execute() == RET_OK )
675cdf0e10cSrcweir                 {
676cdf0e10cSrcweir                     pDlg->GetDescription(aDescription);
677cdf0e10cSrcweir                     pDlg->GetTitle(aTitle);
678cdf0e10cSrcweir 
679cdf0e10cSrcweir                     rSh.SetObjDescription(aDescription);
680cdf0e10cSrcweir                     rSh.SetObjTitle(aTitle);
681cdf0e10cSrcweir                 }
682cdf0e10cSrcweir 
683cdf0e10cSrcweir                 delete pDlg;
684cdf0e10cSrcweir             }
685cdf0e10cSrcweir         }
686cdf0e10cSrcweir         break;
687cdf0e10cSrcweir         // <--
688cdf0e10cSrcweir         default:
689cdf0e10cSrcweir             ASSERT( !this, "falscher Dispatcher" );
690cdf0e10cSrcweir             return;
691cdf0e10cSrcweir     }
692cdf0e10cSrcweir     if ( bUpdateMgr )
693cdf0e10cSrcweir     {
6940c259c9fSOliver-Rainer Wittmann         SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
695cdf0e10cSrcweir         if ( bCopyToFmt && pFmt && pFmt->IsAutoUpdateFmt() )
696cdf0e10cSrcweir         {
697cdf0e10cSrcweir             rSh.AutoUpdateFrame(pFmt, aMgr.GetAttrSet());
698cdf0e10cSrcweir         }
699cdf0e10cSrcweir         else
7000c259c9fSOliver-Rainer Wittmann         {
701cdf0e10cSrcweir             aMgr.UpdateFlyFrm();
702cdf0e10cSrcweir         }
7030c259c9fSOliver-Rainer Wittmann     }
704cdf0e10cSrcweir 
705cdf0e10cSrcweir }
706cdf0e10cSrcweir 
707cdf0e10cSrcweir /*--------------------------------------------------------------------
708cdf0e10cSrcweir     Beschreibung:
709cdf0e10cSrcweir  --------------------------------------------------------------------*/
710cdf0e10cSrcweir 
711cdf0e10cSrcweir 
712cdf0e10cSrcweir void SwFrameShell::GetState(SfxItemSet& rSet)
713cdf0e10cSrcweir {
714cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
715cdf0e10cSrcweir     sal_Bool bHtmlMode = 0 != ::GetHtmlMode(rSh.GetView().GetDocShell());
716cdf0e10cSrcweir     if (rSh.IsFrmSelected())
717cdf0e10cSrcweir     {
718cdf0e10cSrcweir         SfxItemSet aSet( rSh.GetAttrPool(),
719cdf0e10cSrcweir                             RES_LR_SPACE, RES_UL_SPACE,
720cdf0e10cSrcweir                             RES_PROTECT, RES_HORI_ORIENT,
721cdf0e10cSrcweir                             RES_OPAQUE, RES_OPAQUE,
722cdf0e10cSrcweir                             RES_PRINT, RES_OPAQUE,
723cdf0e10cSrcweir                             0 );
724cdf0e10cSrcweir         rSh.GetFlyFrmAttr( aSet );
725cdf0e10cSrcweir 
726cdf0e10cSrcweir         sal_Bool bProtect = rSh.IsSelObjProtected(FLYPROTECT_POS);
727cdf0e10cSrcweir         sal_Bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
728cdf0e10cSrcweir 
729cdf0e10cSrcweir         bProtect |= bParentCntProt;
730cdf0e10cSrcweir 
731cdf0e10cSrcweir         const sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_True);
732cdf0e10cSrcweir         SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
733cdf0e10cSrcweir 
734cdf0e10cSrcweir         SfxWhichIter aIter( rSet );
735cdf0e10cSrcweir         sal_uInt16 nWhich = aIter.FirstWhich();
736cdf0e10cSrcweir         while ( nWhich )
737cdf0e10cSrcweir         {
738cdf0e10cSrcweir             switch ( nWhich )
739cdf0e10cSrcweir             {
740cdf0e10cSrcweir                 case RES_FRM_SIZE:
741cdf0e10cSrcweir                 {
742cdf0e10cSrcweir                     SwFmtFrmSize aSz(aMgr.GetFrmSize());
743cdf0e10cSrcweir                     rSet.Put(aSz);
744cdf0e10cSrcweir                 }
745cdf0e10cSrcweir                 break;
746cdf0e10cSrcweir                 case RES_VERT_ORIENT:
747cdf0e10cSrcweir                 case RES_HORI_ORIENT:
748cdf0e10cSrcweir                 case SID_ATTR_ULSPACE:
749cdf0e10cSrcweir                 case SID_ATTR_LRSPACE:
750cdf0e10cSrcweir                 case RES_LR_SPACE:
751cdf0e10cSrcweir                 case RES_UL_SPACE:
752cdf0e10cSrcweir                 case RES_PROTECT:
753cdf0e10cSrcweir                 case RES_OPAQUE:
754cdf0e10cSrcweir                 case RES_PRINT:
755cdf0e10cSrcweir                 case RES_SURROUND:
756cdf0e10cSrcweir                 {
757cdf0e10cSrcweir                     rSet.Put(aSet.Get(GetPool().GetWhich(nWhich), sal_True ));
758cdf0e10cSrcweir                 }
759cdf0e10cSrcweir                 break;
760cdf0e10cSrcweir                 case SID_OBJECT_ALIGN_LEFT   :
761cdf0e10cSrcweir                 case SID_OBJECT_ALIGN_CENTER :
762cdf0e10cSrcweir                 case SID_OBJECT_ALIGN_RIGHT  :
763cdf0e10cSrcweir                 case FN_FRAME_ALIGN_HORZ_CENTER:
764cdf0e10cSrcweir                 case FN_FRAME_ALIGN_HORZ_RIGHT:
765cdf0e10cSrcweir                 case FN_FRAME_ALIGN_HORZ_LEFT:
766cdf0e10cSrcweir                     if ( (eFrmType & FRMTYPE_FLY_INCNT) ||
767cdf0e10cSrcweir                             bProtect ||
768cdf0e10cSrcweir                             ((nWhich == FN_FRAME_ALIGN_HORZ_CENTER  || nWhich == SID_OBJECT_ALIGN_CENTER)&& bHtmlMode) )
769cdf0e10cSrcweir                         rSet.DisableItem( nWhich );
770cdf0e10cSrcweir                 break;
771cdf0e10cSrcweir                 case FN_FRAME_ALIGN_VERT_ROW_TOP:
772cdf0e10cSrcweir                 case FN_FRAME_ALIGN_VERT_ROW_CENTER:
773cdf0e10cSrcweir                 case FN_FRAME_ALIGN_VERT_ROW_BOTTOM:
774cdf0e10cSrcweir                 case FN_FRAME_ALIGN_VERT_CHAR_TOP:
775cdf0e10cSrcweir                 case FN_FRAME_ALIGN_VERT_CHAR_CENTER:
776cdf0e10cSrcweir                 case FN_FRAME_ALIGN_VERT_CHAR_BOTTOM:
777cdf0e10cSrcweir                     if ( !(eFrmType & FRMTYPE_FLY_INCNT) || bProtect
778cdf0e10cSrcweir                             || (bHtmlMode && FN_FRAME_ALIGN_VERT_CHAR_BOTTOM == nWhich) )
779cdf0e10cSrcweir                         rSet.DisableItem( nWhich );
780cdf0e10cSrcweir                 break;
781cdf0e10cSrcweir 
782cdf0e10cSrcweir                 case SID_OBJECT_ALIGN_UP     :
783cdf0e10cSrcweir                 case SID_OBJECT_ALIGN_MIDDLE :
784cdf0e10cSrcweir                 case SID_OBJECT_ALIGN_DOWN :
785cdf0e10cSrcweir 
786cdf0e10cSrcweir                 case FN_FRAME_ALIGN_VERT_TOP:
787cdf0e10cSrcweir                 case FN_FRAME_ALIGN_VERT_CENTER:
788cdf0e10cSrcweir                 case FN_FRAME_ALIGN_VERT_BOTTOM:
789cdf0e10cSrcweir                     if ( bProtect || (bHtmlMode && eFrmType & FRMTYPE_FLY_ATCNT) )
790cdf0e10cSrcweir                         rSet.DisableItem( nWhich );
791cdf0e10cSrcweir                     else
792cdf0e10cSrcweir                     {
793cdf0e10cSrcweir                         sal_uInt16 nId = 0;
794cdf0e10cSrcweir                         if (eFrmType & FRMTYPE_FLY_INCNT)
795cdf0e10cSrcweir                         {
796cdf0e10cSrcweir                             switch (nWhich)
797cdf0e10cSrcweir                             {
798cdf0e10cSrcweir                                 case SID_OBJECT_ALIGN_UP     :
799cdf0e10cSrcweir                                 case FN_FRAME_ALIGN_VERT_TOP:
800cdf0e10cSrcweir                                     nId = STR_TOP_BASE; break;
801cdf0e10cSrcweir                                 case SID_OBJECT_ALIGN_MIDDLE :
802cdf0e10cSrcweir                                 case FN_FRAME_ALIGN_VERT_CENTER:
803cdf0e10cSrcweir                                     nId = STR_CENTER_BASE;  break;
804cdf0e10cSrcweir                                 case SID_OBJECT_ALIGN_DOWN :
805cdf0e10cSrcweir                                 case FN_FRAME_ALIGN_VERT_BOTTOM:
806cdf0e10cSrcweir                                     if(!bHtmlMode)
807cdf0e10cSrcweir                                         nId = STR_BOTTOM_BASE;
808cdf0e10cSrcweir                                     else
809cdf0e10cSrcweir                                         rSet.DisableItem( nWhich );
810cdf0e10cSrcweir                                 break;
811cdf0e10cSrcweir                             }
812cdf0e10cSrcweir                         }
813cdf0e10cSrcweir                         else
814cdf0e10cSrcweir                         {
815cdf0e10cSrcweir                             if (nWhich != FN_FRAME_ALIGN_VERT_TOP &&
816cdf0e10cSrcweir                                     nWhich != SID_OBJECT_ALIGN_UP )
817cdf0e10cSrcweir                             {
818cdf0e10cSrcweir                                 if (aMgr.GetAnchor() == FLY_AT_FLY)
819cdf0e10cSrcweir                                 {
820cdf0e10cSrcweir                                     const SwFrmFmt* pFmt = rSh.IsFlyInFly();
821cdf0e10cSrcweir                                     if (pFmt)
822cdf0e10cSrcweir                                     {
823cdf0e10cSrcweir                                         const SwFmtFrmSize& rFrmSz = pFmt->GetFrmSize();
824cdf0e10cSrcweir                                         if (rFrmSz.GetHeightSizeType() != ATT_FIX_SIZE)
825cdf0e10cSrcweir                                         {
826cdf0e10cSrcweir                                             rSet.DisableItem( nWhich );
827cdf0e10cSrcweir                                             break;
828cdf0e10cSrcweir                                         }
829cdf0e10cSrcweir                                     }
830cdf0e10cSrcweir                                 }
831cdf0e10cSrcweir                             }
832cdf0e10cSrcweir                             switch (nWhich)
833cdf0e10cSrcweir                             {
834cdf0e10cSrcweir                                 case SID_OBJECT_ALIGN_UP :
835cdf0e10cSrcweir                                 case FN_FRAME_ALIGN_VERT_TOP:
836cdf0e10cSrcweir                                     nId = STR_TOP; break;
837cdf0e10cSrcweir                                 case SID_OBJECT_ALIGN_MIDDLE:
838cdf0e10cSrcweir                                 case FN_FRAME_ALIGN_VERT_CENTER:
839cdf0e10cSrcweir                                     nId = STR_CENTER_VERT; break;
840cdf0e10cSrcweir                                 case SID_OBJECT_ALIGN_DOWN:
841cdf0e10cSrcweir                                 case FN_FRAME_ALIGN_VERT_BOTTOM:
842cdf0e10cSrcweir                                     nId = STR_BOTTOM; break;
843cdf0e10cSrcweir                             }
844cdf0e10cSrcweir                         }
845cdf0e10cSrcweir                         if ( nId )
846cdf0e10cSrcweir                             rSet.Put( SfxStringItem( nWhich, SW_RES(nId) ));
847cdf0e10cSrcweir                     }
848cdf0e10cSrcweir                 break;
849cdf0e10cSrcweir                 case SID_HYPERLINK_GETLINK:
850cdf0e10cSrcweir                 {
851cdf0e10cSrcweir                     String sURL;
852cdf0e10cSrcweir                     SvxHyperlinkItem aHLinkItem;
853cdf0e10cSrcweir                     const SfxPoolItem* pItem;
854cdf0e10cSrcweir 
855cdf0e10cSrcweir                     SfxItemSet aURLSet(GetPool(), RES_URL, RES_URL);
856cdf0e10cSrcweir                     rSh.GetFlyFrmAttr( aURLSet );
857cdf0e10cSrcweir 
858cdf0e10cSrcweir                     if(SFX_ITEM_SET == aURLSet.GetItemState(RES_URL, sal_True, &pItem))
859cdf0e10cSrcweir                     {
860cdf0e10cSrcweir                         const SwFmtURL* pFmtURL = (const SwFmtURL*)pItem;
861cdf0e10cSrcweir                         aHLinkItem.SetURL(pFmtURL->GetURL());
862cdf0e10cSrcweir                         aHLinkItem.SetTargetFrame(pFmtURL->GetTargetFrameName());
863cdf0e10cSrcweir                         aHLinkItem.SetName(rSh.GetFlyName());
864cdf0e10cSrcweir                     }
865cdf0e10cSrcweir 
866cdf0e10cSrcweir                     aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
867cdf0e10cSrcweir                         (bHtmlMode ? HLINK_HTMLMODE : 0)));
868cdf0e10cSrcweir 
869cdf0e10cSrcweir                     rSet.Put(aHLinkItem);
870cdf0e10cSrcweir                 }
871cdf0e10cSrcweir                 break;
872cdf0e10cSrcweir 
873cdf0e10cSrcweir                 case FN_FRAME_CHAIN:
874cdf0e10cSrcweir                 {
875cdf0e10cSrcweir                     const int nSel = rSh.GetSelectionType();
876cdf0e10cSrcweir                     if (nSel & nsSelectionType::SEL_GRF || nSel & nsSelectionType::SEL_OLE)
877cdf0e10cSrcweir                         rSet.DisableItem( FN_FRAME_CHAIN );
878cdf0e10cSrcweir                     else
879cdf0e10cSrcweir                     {
880cdf0e10cSrcweir                         const SwFrmFmt *pFmt = rSh.GetFlyFrmFmt();
881cdf0e10cSrcweir                         if ( bParentCntProt || rSh.GetView().GetEditWin().GetApplyTemplate() ||
882cdf0e10cSrcweir                             !pFmt || pFmt->GetChain().GetNext() )
883cdf0e10cSrcweir                         {
884cdf0e10cSrcweir                             rSet.DisableItem( FN_FRAME_CHAIN );
885cdf0e10cSrcweir                         }
886cdf0e10cSrcweir                         else
887cdf0e10cSrcweir                         {
888cdf0e10cSrcweir                             sal_Bool bChainMode = rSh.GetView().GetEditWin().IsChainMode();
889cdf0e10cSrcweir                             rSet.Put( SfxBoolItem( FN_FRAME_CHAIN, bChainMode ) );
890cdf0e10cSrcweir                         }
891cdf0e10cSrcweir                     }
892cdf0e10cSrcweir                 }
893cdf0e10cSrcweir                 break;
894cdf0e10cSrcweir                 case FN_FRAME_UNCHAIN:
895cdf0e10cSrcweir                 {
896cdf0e10cSrcweir                     const int nSel = rSh.GetSelectionType();
897cdf0e10cSrcweir                     if (nSel & nsSelectionType::SEL_GRF || nSel & nsSelectionType::SEL_OLE)
898cdf0e10cSrcweir                         rSet.DisableItem( FN_FRAME_UNCHAIN );
899cdf0e10cSrcweir                     else
900cdf0e10cSrcweir                     {
901cdf0e10cSrcweir                         const SwFrmFmt *pFmt = rSh.GetFlyFrmFmt();
902cdf0e10cSrcweir                         if ( bParentCntProt || rSh.GetView().GetEditWin().GetApplyTemplate() ||
903cdf0e10cSrcweir                             !pFmt || !pFmt->GetChain().GetNext() )
904cdf0e10cSrcweir                         {
905cdf0e10cSrcweir                             rSet.DisableItem( FN_FRAME_UNCHAIN );
906cdf0e10cSrcweir                         }
907cdf0e10cSrcweir                     }
908cdf0e10cSrcweir                 }
909cdf0e10cSrcweir                 break;
910cdf0e10cSrcweir                 case SID_FRAME_TO_TOP:
911cdf0e10cSrcweir                 case SID_FRAME_TO_BOTTOM:
912cdf0e10cSrcweir                 case FN_FRAME_UP:
913cdf0e10cSrcweir                 case FN_FRAME_DOWN:
914cdf0e10cSrcweir                     if ( bParentCntProt )
915cdf0e10cSrcweir                         rSet.DisableItem( nWhich );
916cdf0e10cSrcweir                 break;
9170c259c9fSOliver-Rainer Wittmann 
9180c259c9fSOliver-Rainer Wittmann                 case SID_ATTR_TRANSFORM:
9190c259c9fSOliver-Rainer Wittmann                 {
9200c259c9fSOliver-Rainer Wittmann                     rSet.DisableItem( nWhich );
9210c259c9fSOliver-Rainer Wittmann                 }
9220c259c9fSOliver-Rainer Wittmann                 break;
9230c259c9fSOliver-Rainer Wittmann 
9240c259c9fSOliver-Rainer Wittmann                 case SID_ATTR_TRANSFORM_PROTECT_SIZE:
9250c259c9fSOliver-Rainer Wittmann                 {
9260c259c9fSOliver-Rainer Wittmann                     const sal_uInt8 eProtection = rSh.IsSelObjProtected( FLYPROTECT_SIZE );
9270c259c9fSOliver-Rainer Wittmann                     if ( ( eProtection & FLYPROTECT_CONTENT ) ||
9280c259c9fSOliver-Rainer Wittmann                          ( eProtection & FLYPROTECT_SIZE ) )
9290c259c9fSOliver-Rainer Wittmann                     {
9300c259c9fSOliver-Rainer Wittmann                         rSet.Put( SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE, sal_True ) );
9310c259c9fSOliver-Rainer Wittmann                     }
9320c259c9fSOliver-Rainer Wittmann                     else
9330c259c9fSOliver-Rainer Wittmann                     {
9340c259c9fSOliver-Rainer Wittmann                         rSet.Put( SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE, sal_False ) );
9350c259c9fSOliver-Rainer Wittmann                     }
9360c259c9fSOliver-Rainer Wittmann                 }
9370c259c9fSOliver-Rainer Wittmann                 break;
9380c259c9fSOliver-Rainer Wittmann 
9390c259c9fSOliver-Rainer Wittmann                 case SID_ATTR_TRANSFORM_WIDTH:
9400c259c9fSOliver-Rainer Wittmann                 {
9410c259c9fSOliver-Rainer Wittmann                     rSet.Put( SfxUInt32Item( SID_ATTR_TRANSFORM_WIDTH, aMgr.GetSize().getWidth() ) );
9420c259c9fSOliver-Rainer Wittmann                 }
9430c259c9fSOliver-Rainer Wittmann                 break;
9440c259c9fSOliver-Rainer Wittmann 
9450c259c9fSOliver-Rainer Wittmann                 case SID_ATTR_TRANSFORM_HEIGHT:
9460c259c9fSOliver-Rainer Wittmann                 {
9470c259c9fSOliver-Rainer Wittmann                     rSet.Put( SfxUInt32Item( SID_ATTR_TRANSFORM_HEIGHT, aMgr.GetSize().getHeight() ) );
9480c259c9fSOliver-Rainer Wittmann                 }
9490c259c9fSOliver-Rainer Wittmann                 break;
9500c259c9fSOliver-Rainer Wittmann 
951cdf0e10cSrcweir                 case FN_FORMAT_FRAME_DLG:
952cdf0e10cSrcweir                 {
953cdf0e10cSrcweir                     const int nSel = rSh.GetSelectionType();
954cdf0e10cSrcweir                     if ( bParentCntProt || nSel & nsSelectionType::SEL_GRF)
955cdf0e10cSrcweir                         rSet.DisableItem( nWhich );
956cdf0e10cSrcweir                 }
957cdf0e10cSrcweir                 break;
9580c259c9fSOliver-Rainer Wittmann 
959cdf0e10cSrcweir                 case FN_TITLE_DESCRIPTION_SHAPE:
960cdf0e10cSrcweir                 {
961cdf0e10cSrcweir                     SwWrtShell &rWrtSh = GetShell();
962cdf0e10cSrcweir                     SdrView* pSdrView = rWrtSh.GetDrawViewWithValidMarkList();
963cdf0e10cSrcweir                     if ( !pSdrView ||
964cdf0e10cSrcweir                          pSdrView->GetMarkedObjectCount() != 1 )
965cdf0e10cSrcweir                     {
966cdf0e10cSrcweir                         rSet.DisableItem( nWhich );
967cdf0e10cSrcweir                     }
968cdf0e10cSrcweir 
969cdf0e10cSrcweir                 }
970cdf0e10cSrcweir                 break;
9710c259c9fSOliver-Rainer Wittmann 
972cdf0e10cSrcweir                 default:
973cdf0e10cSrcweir                     /* do nothing */;
974cdf0e10cSrcweir                     break;
975cdf0e10cSrcweir             }
976cdf0e10cSrcweir             nWhich = aIter.NextWhich();
977cdf0e10cSrcweir         }
978cdf0e10cSrcweir     }
979cdf0e10cSrcweir }
980cdf0e10cSrcweir 
981cdf0e10cSrcweir /*--------------------------------------------------------------------
982cdf0e10cSrcweir     Beschreibung:   Ctor fuer FrameShell
983cdf0e10cSrcweir  --------------------------------------------------------------------*/
984cdf0e10cSrcweir 
985cdf0e10cSrcweir 
986cdf0e10cSrcweir SwFrameShell::SwFrameShell(SwView &_rView) :
987cdf0e10cSrcweir     SwBaseShell( _rView )
988cdf0e10cSrcweir {
989cdf0e10cSrcweir     SetName(String::CreateFromAscii("Frame"));
990cdf0e10cSrcweir     SetHelpId(SW_FRAMESHELL);
991cdf0e10cSrcweir 
992cdf0e10cSrcweir     /* #96392# Use this to announce it is the frame shell who creates the
993cdf0e10cSrcweir        selection. */
994cdf0e10cSrcweir     SwTransferable::CreateSelection( _rView.GetWrtShell(), (ViewShell *) this );
995f120fe41SAndre Fischer 
996f120fe41SAndre Fischer     SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Frame));
997cdf0e10cSrcweir }
998cdf0e10cSrcweir 
999cdf0e10cSrcweir SwFrameShell::~SwFrameShell()
1000cdf0e10cSrcweir {
1001cdf0e10cSrcweir     /* #96392# Only clear the selection if it was this frame shell who created
1002cdf0e10cSrcweir        it. */
1003cdf0e10cSrcweir     SwTransferable::ClearSelection( GetShell(), (ViewShell *) this );
1004cdf0e10cSrcweir }
1005cdf0e10cSrcweir 
1006cdf0e10cSrcweir /*--------------------------------------------------------------------
1007cdf0e10cSrcweir     Beschreibung:
1008cdf0e10cSrcweir  --------------------------------------------------------------------*/
1009cdf0e10cSrcweir 
1010cdf0e10cSrcweir 
1011cdf0e10cSrcweir 
1012cdf0e10cSrcweir void SwFrameShell::ExecFrameStyle(SfxRequest& rReq)
1013cdf0e10cSrcweir {
1014cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
1015cdf0e10cSrcweir     sal_Bool bDefault = sal_False;
1016cdf0e10cSrcweir     if (!rSh.IsFrmSelected())
1017cdf0e10cSrcweir         return;
1018cdf0e10cSrcweir 
1019cdf0e10cSrcweir     // Erst Default-BoxItem aus Pool holen. Wenn ungleich normalem Boxitem,
1020cdf0e10cSrcweir     // dann ist es bereits geaendert worden (neues ist kein Default).
1021cdf0e10cSrcweir     const SvxBoxItem* pPoolBoxItem = (const SvxBoxItem*)::GetDfltAttr(RES_BOX);
1022cdf0e10cSrcweir 
1023cdf0e10cSrcweir     const SfxItemSet *pArgs = rReq.GetArgs();
1024cdf0e10cSrcweir     SfxItemSet aFrameSet(rSh.GetAttrPool(), RES_BOX, RES_BOX);
1025cdf0e10cSrcweir 
1026cdf0e10cSrcweir     rSh.GetFlyFrmAttr( aFrameSet );
1027cdf0e10cSrcweir     const SvxBoxItem& rBoxItem = (const SvxBoxItem&)aFrameSet.Get(RES_BOX);
1028cdf0e10cSrcweir 
1029cdf0e10cSrcweir     if (pPoolBoxItem == &rBoxItem)
1030cdf0e10cSrcweir         bDefault = sal_True;
1031cdf0e10cSrcweir 
1032cdf0e10cSrcweir     SvxBoxItem aBoxItem(rBoxItem);
1033cdf0e10cSrcweir 
1034cdf0e10cSrcweir     SvxBorderLine aBorderLine;
1035cdf0e10cSrcweir     const SfxPoolItem *pItem = 0;
1036cdf0e10cSrcweir 
1037cdf0e10cSrcweir     if(pArgs)    //irgendein Controller kann auch mal nichts liefern #48169#
1038cdf0e10cSrcweir     {
1039cdf0e10cSrcweir         switch (rReq.GetSlot())
1040cdf0e10cSrcweir         {
1041cdf0e10cSrcweir             case SID_ATTR_BORDER:
1042cdf0e10cSrcweir             {
1043cdf0e10cSrcweir                 if (pArgs->GetItemState(RES_BOX, sal_True, &pItem) == SFX_ITEM_SET)
1044cdf0e10cSrcweir                 {
1045cdf0e10cSrcweir                     SvxBoxItem aNewBox(*((SvxBoxItem *)pItem));
1046cdf0e10cSrcweir                     const SvxBorderLine* pBorderLine;
1047cdf0e10cSrcweir 
1048cdf0e10cSrcweir                     if ((pBorderLine = aBoxItem.GetTop()) != NULL)
1049cdf0e10cSrcweir                         lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine);
1050cdf0e10cSrcweir                     if ((pBorderLine = aBoxItem.GetBottom()) != NULL)
1051cdf0e10cSrcweir                         lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine);
1052cdf0e10cSrcweir                     if ((pBorderLine = aBoxItem.GetLeft()) != NULL)
1053cdf0e10cSrcweir                         lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine);
1054cdf0e10cSrcweir                     if ((pBorderLine = aBoxItem.GetRight()) != NULL)
1055cdf0e10cSrcweir                         lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine);
1056cdf0e10cSrcweir 
1057cdf0e10cSrcweir                     if(aBorderLine.GetOutWidth() == 0)
1058cdf0e10cSrcweir                     {
1059cdf0e10cSrcweir                         aBorderLine.SetInWidth(0);
1060cdf0e10cSrcweir                         aBorderLine.SetOutWidth(DEF_LINE_WIDTH_0);
1061cdf0e10cSrcweir                         aBorderLine.SetDistance(0);
1062cdf0e10cSrcweir                     }
1063cdf0e10cSrcweir                     //Distance nur setzen, wenn der Request vom Controller kommt
1064cdf0e10cSrcweir 
1065cdf0e10cSrcweir                     if(!StarBASIC::IsRunning())
1066cdf0e10cSrcweir                     {
1067cdf0e10cSrcweir                         aNewBox.SetDistance( rBoxItem.GetDistance() );
1068cdf0e10cSrcweir                     }
1069cdf0e10cSrcweir 
1070cdf0e10cSrcweir                     aBoxItem = aNewBox;
1071cdf0e10cSrcweir                     SvxBorderLine aDestBorderLine;
1072cdf0e10cSrcweir 
1073cdf0e10cSrcweir                     if ((pBorderLine = aBoxItem.GetTop()) != NULL)
1074cdf0e10cSrcweir                         aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP);
1075cdf0e10cSrcweir                     if ((pBorderLine = aBoxItem.GetBottom()) != NULL)
1076cdf0e10cSrcweir                         aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM);
1077cdf0e10cSrcweir                     if ((pBorderLine = aBoxItem.GetLeft()) != NULL)
1078cdf0e10cSrcweir                         aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT);
1079cdf0e10cSrcweir                     if ((pBorderLine = aBoxItem.GetRight()) != NULL)
1080cdf0e10cSrcweir                         aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT);
1081cdf0e10cSrcweir                 }
1082cdf0e10cSrcweir             }
1083cdf0e10cSrcweir             break;
1084cdf0e10cSrcweir 
1085cdf0e10cSrcweir             case SID_FRAME_LINESTYLE:
1086cdf0e10cSrcweir             {
1087cdf0e10cSrcweir                 if (pArgs->GetItemState(SID_FRAME_LINESTYLE, sal_False, &pItem) == SFX_ITEM_SET)
1088cdf0e10cSrcweir                 {
1089cdf0e10cSrcweir                     const SvxLineItem* pLineItem =
1090cdf0e10cSrcweir                             (const SvxLineItem*)pItem;
1091cdf0e10cSrcweir 
1092cdf0e10cSrcweir                     if ( pLineItem->GetLine() )
1093cdf0e10cSrcweir                     {
1094cdf0e10cSrcweir                         aBorderLine = *(pLineItem->GetLine());
1095cdf0e10cSrcweir 
1096cdf0e10cSrcweir                         if (!aBoxItem.GetTop() && !aBoxItem.GetBottom() &&
1097cdf0e10cSrcweir                             !aBoxItem.GetLeft() && !aBoxItem.GetRight())
1098cdf0e10cSrcweir                         {
1099cdf0e10cSrcweir                             aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP);
1100cdf0e10cSrcweir                             aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM);
1101cdf0e10cSrcweir                             aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT);
1102cdf0e10cSrcweir                             aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT);
1103cdf0e10cSrcweir                         }
1104cdf0e10cSrcweir                         else
1105cdf0e10cSrcweir                         {
1106cdf0e10cSrcweir                             if( aBoxItem.GetTop() )
1107cdf0e10cSrcweir                             {
1108cdf0e10cSrcweir                                 aBorderLine.SetColor( aBoxItem.GetTop()->GetColor() );
1109cdf0e10cSrcweir                                 aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP);
1110cdf0e10cSrcweir                             }
1111cdf0e10cSrcweir                             if( aBoxItem.GetBottom() )
1112cdf0e10cSrcweir                             {
1113cdf0e10cSrcweir                                 aBorderLine.SetColor( aBoxItem.GetBottom()->GetColor());
1114cdf0e10cSrcweir                                 aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM);
1115cdf0e10cSrcweir                             }
1116cdf0e10cSrcweir                             if( aBoxItem.GetLeft() )
1117cdf0e10cSrcweir                             {
1118cdf0e10cSrcweir                                 aBorderLine.SetColor( aBoxItem.GetLeft()->GetColor());
1119cdf0e10cSrcweir                                 aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT);
1120cdf0e10cSrcweir                             }
1121cdf0e10cSrcweir                             if( aBoxItem.GetRight() )
1122cdf0e10cSrcweir                             {
1123cdf0e10cSrcweir                                 aBorderLine.SetColor(aBoxItem.GetRight()->GetColor());
1124cdf0e10cSrcweir                                 aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT);
1125cdf0e10cSrcweir                             }
1126cdf0e10cSrcweir                         }
1127cdf0e10cSrcweir                     }
1128cdf0e10cSrcweir                     else
1129cdf0e10cSrcweir                     {
1130cdf0e10cSrcweir                         aBoxItem.SetLine(0, BOX_LINE_TOP);
1131cdf0e10cSrcweir                         aBoxItem.SetLine(0, BOX_LINE_BOTTOM);
1132cdf0e10cSrcweir                         aBoxItem.SetLine(0, BOX_LINE_LEFT);
1133cdf0e10cSrcweir                         aBoxItem.SetLine(0, BOX_LINE_RIGHT);
1134cdf0e10cSrcweir                     }
1135cdf0e10cSrcweir                 }
1136cdf0e10cSrcweir             }
1137cdf0e10cSrcweir             break;
1138cdf0e10cSrcweir 
1139cdf0e10cSrcweir             case SID_FRAME_LINECOLOR:
1140cdf0e10cSrcweir             {
1141cdf0e10cSrcweir                 if (pArgs->GetItemState(SID_FRAME_LINECOLOR, sal_False, &pItem) == SFX_ITEM_SET)
1142cdf0e10cSrcweir                 {
1143cdf0e10cSrcweir                     const Color& rNewColor = ((const SvxColorItem*)pItem)->GetValue();
1144cdf0e10cSrcweir 
1145cdf0e10cSrcweir                     if (!aBoxItem.GetTop() && !aBoxItem.GetBottom() &&
1146cdf0e10cSrcweir                         !aBoxItem.GetLeft() && !aBoxItem.GetRight())
1147cdf0e10cSrcweir                     {
1148cdf0e10cSrcweir                         aBorderLine.SetColor( rNewColor );
1149cdf0e10cSrcweir                         aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP);
1150cdf0e10cSrcweir                         aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM);
1151cdf0e10cSrcweir                         aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT);
1152cdf0e10cSrcweir                         aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT);
1153cdf0e10cSrcweir                     }
1154cdf0e10cSrcweir                     else
1155cdf0e10cSrcweir                     {
1156cdf0e10cSrcweir                         if ( aBoxItem.GetTop() )
1157cdf0e10cSrcweir                             ((SvxBorderLine*)aBoxItem.GetTop())->SetColor( rNewColor );
1158cdf0e10cSrcweir                         if ( aBoxItem.GetBottom() )
1159cdf0e10cSrcweir                             ((SvxBorderLine*)aBoxItem.GetBottom())->SetColor( rNewColor );
1160cdf0e10cSrcweir                         if ( aBoxItem.GetLeft() )
1161cdf0e10cSrcweir                             ((SvxBorderLine*)aBoxItem.GetLeft())->SetColor( rNewColor );
1162cdf0e10cSrcweir                         if ( aBoxItem.GetRight() )
1163cdf0e10cSrcweir                             ((SvxBorderLine*)aBoxItem.GetRight())->SetColor( rNewColor );
1164cdf0e10cSrcweir                     }
1165cdf0e10cSrcweir                 }
1166cdf0e10cSrcweir             }
1167cdf0e10cSrcweir             break;
1168cdf0e10cSrcweir         }
1169cdf0e10cSrcweir     }
1170cdf0e10cSrcweir     if (bDefault && (aBoxItem.GetTop() || aBoxItem.GetBottom() ||
1171cdf0e10cSrcweir         aBoxItem.GetLeft() || aBoxItem.GetRight()))
1172cdf0e10cSrcweir     {
1173cdf0e10cSrcweir         aBoxItem.SetDistance(MIN_BORDER_DIST);
1174cdf0e10cSrcweir     }
1175cdf0e10cSrcweir     aFrameSet.Put( aBoxItem );
1176cdf0e10cSrcweir     // Vorlagen-AutoUpdate
1177cdf0e10cSrcweir     SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
1178cdf0e10cSrcweir     if(pFmt && pFmt->IsAutoUpdateFmt())
1179cdf0e10cSrcweir     {
1180cdf0e10cSrcweir         rSh.AutoUpdateFrame(pFmt, aFrameSet);
1181cdf0e10cSrcweir     }
1182cdf0e10cSrcweir     else
1183cdf0e10cSrcweir         rSh.SetFlyFrmAttr( aFrameSet );
1184cdf0e10cSrcweir 
1185cdf0e10cSrcweir }
1186cdf0e10cSrcweir 
1187cdf0e10cSrcweir 
1188cdf0e10cSrcweir 
1189cdf0e10cSrcweir void lcl_FrmGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine)
1190cdf0e10cSrcweir {
1191cdf0e10cSrcweir     if(pBorderLine->GetInWidth() > rBorderLine.GetInWidth())
1192cdf0e10cSrcweir         rBorderLine.SetInWidth(pBorderLine->GetInWidth());
1193cdf0e10cSrcweir 
1194cdf0e10cSrcweir     if(pBorderLine->GetOutWidth() > rBorderLine.GetOutWidth())
1195cdf0e10cSrcweir         rBorderLine.SetOutWidth(pBorderLine->GetOutWidth());
1196cdf0e10cSrcweir 
1197cdf0e10cSrcweir     if(pBorderLine->GetDistance() > rBorderLine.GetDistance())
1198cdf0e10cSrcweir         rBorderLine.SetDistance(pBorderLine->GetDistance());
1199cdf0e10cSrcweir 
1200cdf0e10cSrcweir     rBorderLine.SetColor(pBorderLine->GetColor());
1201cdf0e10cSrcweir }
1202cdf0e10cSrcweir 
1203cdf0e10cSrcweir 
1204cdf0e10cSrcweir 
1205cdf0e10cSrcweir void SwFrameShell::GetLineStyleState(SfxItemSet &rSet)
1206cdf0e10cSrcweir {
1207cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
1208cdf0e10cSrcweir     sal_Bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
1209cdf0e10cSrcweir 
1210cdf0e10cSrcweir     if (bParentCntProt)
1211cdf0e10cSrcweir     {
1212cdf0e10cSrcweir         if (rSh.IsFrmSelected())
1213cdf0e10cSrcweir             rSet.DisableItem( SID_FRAME_LINECOLOR );
1214cdf0e10cSrcweir 
1215cdf0e10cSrcweir         rSet.DisableItem( SID_ATTR_BORDER );
1216cdf0e10cSrcweir         rSet.DisableItem( SID_FRAME_LINESTYLE );
1217cdf0e10cSrcweir     }
1218cdf0e10cSrcweir     else
1219cdf0e10cSrcweir     {
1220cdf0e10cSrcweir         if (rSh.IsFrmSelected())
1221cdf0e10cSrcweir         {
1222cdf0e10cSrcweir             SfxItemSet aFrameSet( rSh.GetAttrPool(), RES_BOX, RES_BOX );
1223cdf0e10cSrcweir 
1224cdf0e10cSrcweir             rSh.GetFlyFrmAttr(aFrameSet);
1225cdf0e10cSrcweir 
1226cdf0e10cSrcweir             const SvxBorderLine* pLine = ((const SvxBoxItem&)aFrameSet.Get(RES_BOX)).GetTop();
1227cdf0e10cSrcweir             rSet.Put(SvxColorItem(pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR));
1228cdf0e10cSrcweir         }
1229cdf0e10cSrcweir     }
1230cdf0e10cSrcweir }
1231cdf0e10cSrcweir 
1232cdf0e10cSrcweir void  SwFrameShell::StateInsert(SfxItemSet &rSet)
1233cdf0e10cSrcweir {
1234cdf0e10cSrcweir     const int nSel = GetShell().GetSelectionType();
123569a74367SOliver-Rainer Wittmann     if ( (nSel & nsSelectionType::SEL_GRF)
123669a74367SOliver-Rainer Wittmann         || (nSel & nsSelectionType::SEL_OLE) )
123769a74367SOliver-Rainer Wittmann     {
1238cdf0e10cSrcweir         rSet.DisableItem(FN_INSERT_FRAME);
1239cdf0e10cSrcweir     }
124069a74367SOliver-Rainer Wittmann     else if ( GetShell().CrsrInsideInputFld() )
124169a74367SOliver-Rainer Wittmann     {
124269a74367SOliver-Rainer Wittmann         rSet.DisableItem(FN_INSERT_FRAME);
124369a74367SOliver-Rainer Wittmann     }
124469a74367SOliver-Rainer Wittmann }
1245*64b14621SArmin Le Grand 
1246*64b14621SArmin Le Grand //UUUU
1247*64b14621SArmin Le Grand void SwFrameShell::GetDrawAttrStateTextFrame(SfxItemSet &rSet)
1248*64b14621SArmin Le Grand {
1249*64b14621SArmin Le Grand     SwWrtShell &rSh = GetShell();
1250*64b14621SArmin Le Grand 
1251*64b14621SArmin Le Grand     if(rSh.IsFrmSelected())
1252*64b14621SArmin Le Grand     {
1253*64b14621SArmin Le Grand         rSh.GetFlyFrmAttr(rSet);
1254*64b14621SArmin Le Grand     }
1255*64b14621SArmin Le Grand     else
1256*64b14621SArmin Le Grand     {
1257*64b14621SArmin Le Grand         SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
1258*64b14621SArmin Le Grand 
1259*64b14621SArmin Le Grand         if(pSdrView)
1260*64b14621SArmin Le Grand         {
1261*64b14621SArmin Le Grand             rSet.Put(pSdrView->GetDefaultAttr());
1262*64b14621SArmin Le Grand         }
1263*64b14621SArmin Le Grand     }
1264*64b14621SArmin Le Grand }
1265*64b14621SArmin Le Grand 
1266*64b14621SArmin Le Grand //UUUU
1267*64b14621SArmin Le Grand void SwFrameShell::ExecDrawAttrArgsTextFrame(SfxRequest& rReq)
1268*64b14621SArmin Le Grand {
1269*64b14621SArmin Le Grand     const SfxItemSet* pArgs = rReq.GetArgs();
1270*64b14621SArmin Le Grand     SwWrtShell& rSh = GetShell();
1271*64b14621SArmin Le Grand 
1272*64b14621SArmin Le Grand     if(pArgs)
1273*64b14621SArmin Le Grand     {
1274*64b14621SArmin Le Grand         if(rSh.IsFrmSelected())
1275*64b14621SArmin Le Grand         {
1276*64b14621SArmin Le Grand             rSh.SetFlyFrmAttr(const_cast< SfxItemSet& >(*pArgs));
1277*64b14621SArmin Le Grand         }
1278*64b14621SArmin Le Grand         else
1279*64b14621SArmin Le Grand         {
1280*64b14621SArmin Le Grand             SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
1281*64b14621SArmin Le Grand 
1282*64b14621SArmin Le Grand             if(pSdrView)
1283*64b14621SArmin Le Grand             {
1284*64b14621SArmin Le Grand                 pSdrView->SetDefaultAttr(*pArgs, sal_False);
1285*64b14621SArmin Le Grand             }
1286*64b14621SArmin Le Grand         }
1287*64b14621SArmin Le Grand     }
1288*64b14621SArmin Le Grand     else
1289*64b14621SArmin Le Grand     {
1290*64b14621SArmin Le Grand         SfxDispatcher* pDis = rSh.GetView().GetViewFrame()->GetDispatcher();
1291*64b14621SArmin Le Grand 
1292*64b14621SArmin Le Grand         switch(rReq.GetSlot())
1293*64b14621SArmin Le Grand         {
1294*64b14621SArmin Le Grand             case SID_ATTR_FILL_STYLE:
1295*64b14621SArmin Le Grand             case SID_ATTR_FILL_COLOR:
1296*64b14621SArmin Le Grand             case SID_ATTR_FILL_GRADIENT:
1297*64b14621SArmin Le Grand             case SID_ATTR_FILL_HATCH:
1298*64b14621SArmin Le Grand             case SID_ATTR_FILL_BITMAP:
1299*64b14621SArmin Le Grand             case SID_ATTR_FILL_TRANSPARENCE:
1300*64b14621SArmin Le Grand             case SID_ATTR_FILL_FLOATTRANSPARENCE:
1301*64b14621SArmin Le Grand             {
1302*64b14621SArmin Le Grand                 pDis->Execute(SID_ATTRIBUTES_AREA, sal_False);
1303*64b14621SArmin Le Grand                 break;
1304*64b14621SArmin Le Grand             }
1305*64b14621SArmin Le Grand         }
1306*64b14621SArmin Le Grand     }
1307*64b14621SArmin Le Grand }
1308*64b14621SArmin Le Grand 
1309*64b14621SArmin Le Grand //UUUU
1310*64b14621SArmin Le Grand void SwFrameShell::ExecDrawDlgTextFrame(SfxRequest& rReq)
1311*64b14621SArmin Le Grand {
1312*64b14621SArmin Le Grand     switch(rReq.GetSlot())
1313*64b14621SArmin Le Grand     {
1314*64b14621SArmin Le Grand         case SID_ATTRIBUTES_AREA:
1315*64b14621SArmin Le Grand         {
1316*64b14621SArmin Le Grand             SwWrtShell& rSh = GetShell();
1317*64b14621SArmin Le Grand 
1318*64b14621SArmin Le Grand             if(rSh.IsFrmSelected())
1319*64b14621SArmin Le Grand             {
1320*64b14621SArmin Le Grand                 SdrView* pView = rSh.GetDrawView();
1321*64b14621SArmin Le Grand                 SdrModel* pDoc = pView->GetModel();
1322*64b14621SArmin Le Grand                 SfxItemSet aNewAttr(pDoc->GetItemPool());
1323*64b14621SArmin Le Grand 
1324*64b14621SArmin Le Grand                 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
1325*64b14621SArmin Le Grand                 DBG_ASSERT(pFact, "Dialogdiet Factory fail!");
1326*64b14621SArmin Le Grand                 AbstractSvxAreaTabDialog * pDlg = pFact->CreateSvxAreaTabDialog(
1327*64b14621SArmin Le Grand                     NULL,
1328*64b14621SArmin Le Grand                     &aNewAttr,
1329*64b14621SArmin Le Grand                     pDoc,
1330*64b14621SArmin Le Grand false);
1331*64b14621SArmin Le Grand                 DBG_ASSERT(pDlg, "Dialogdiet fail!");
1332*64b14621SArmin Le Grand 
1333*64b14621SArmin Le Grand                 if(RET_OK == pDlg->Execute())
1334*64b14621SArmin Le Grand                 {
1335*64b14621SArmin Le Grand                     rSh.SetFlyFrmAttr(const_cast< SfxItemSet& >(*pDlg->GetOutputItemSet()));
1336*64b14621SArmin Le Grand 
1337*64b14621SArmin Le Grand                     static sal_uInt16 __READONLY_DATA aInval[] =
1338*64b14621SArmin Le Grand                     {
1339*64b14621SArmin Le Grand                         SID_ATTR_FILL_STYLE,
1340*64b14621SArmin Le Grand                         SID_ATTR_FILL_COLOR,
1341*64b14621SArmin Le Grand                         SID_ATTR_FILL_TRANSPARENCE,
1342*64b14621SArmin Le Grand                         SID_ATTR_FILL_FLOATTRANSPARENCE,
1343*64b14621SArmin Le Grand                         0
1344*64b14621SArmin Le Grand                     };
1345*64b14621SArmin Le Grand 
1346*64b14621SArmin Le Grand                     SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
1347*64b14621SArmin Le Grand 
1348*64b14621SArmin Le Grand                     rBnd.Invalidate(aInval);
1349*64b14621SArmin Le Grand                     rBnd.Update(SID_ATTR_FILL_STYLE);
1350*64b14621SArmin Le Grand                     rBnd.Update(SID_ATTR_FILL_COLOR);
1351*64b14621SArmin Le Grand                     rBnd.Update(SID_ATTR_FILL_TRANSPARENCE);
1352*64b14621SArmin Le Grand                     rBnd.Update(SID_ATTR_FILL_FLOATTRANSPARENCE);
1353*64b14621SArmin Le Grand                 }
1354*64b14621SArmin Le Grand 
1355*64b14621SArmin Le Grand                 delete pDlg;
1356*64b14621SArmin Le Grand             }
1357*64b14621SArmin Le Grand 
1358*64b14621SArmin Le Grand             break;
1359*64b14621SArmin Le Grand         }
1360*64b14621SArmin Le Grand     }
1361*64b14621SArmin Le Grand }
1362*64b14621SArmin Le Grand 
1363*64b14621SArmin Le Grand //UUUU
1364*64b14621SArmin Le Grand void SwFrameShell::DisableStateTextFrame(SfxItemSet &rSet)
1365*64b14621SArmin Le Grand {
1366*64b14621SArmin Le Grand     SfxWhichIter aIter(rSet);
1367*64b14621SArmin Le Grand     sal_uInt16 nWhich(aIter.FirstWhich());
1368*64b14621SArmin Le Grand 
1369*64b14621SArmin Le Grand     while(nWhich)
1370*64b14621SArmin Le Grand     {
1371*64b14621SArmin Le Grand         switch(nWhich)
1372*64b14621SArmin Le Grand         {
1373*64b14621SArmin Le Grand             case SID_ATTRIBUTES_AREA:
1374*64b14621SArmin Le Grand             {
1375*64b14621SArmin Le Grand                 SwWrtShell& rSh = GetShell();
1376*64b14621SArmin Le Grand 
1377*64b14621SArmin Le Grand                 if(!rSh.IsFrmSelected())
1378*64b14621SArmin Le Grand                 {
1379*64b14621SArmin Le Grand                     rSet.DisableItem(nWhich);
1380*64b14621SArmin Le Grand                 }
1381*64b14621SArmin Le Grand 
1382*64b14621SArmin Le Grand                 break;
1383*64b14621SArmin Le Grand             }
1384*64b14621SArmin Le Grand             default:
1385*64b14621SArmin Le Grand             {
1386*64b14621SArmin Le Grand                 rSet.DisableItem(nWhich);
1387*64b14621SArmin Le Grand                 break;
1388*64b14621SArmin Le Grand             }
1389*64b14621SArmin Le Grand         }
1390*64b14621SArmin Le Grand 
1391*64b14621SArmin Le Grand         nWhich = aIter.NextWhich();
1392*64b14621SArmin Le Grand     }
1393*64b14621SArmin Le Grand }
1394*64b14621SArmin Le Grand 
1395*64b14621SArmin Le Grand // eof
1396