xref: /trunk/main/sw/source/ui/shells/basesh.cxx (revision 3f09c2ce83c31bec9519173e2b25b00b5abfc6a1)
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 
22efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <sot/factory.hxx>
28cdf0e10cSrcweir #include <hintids.hxx>
29cdf0e10cSrcweir #include <svl/urihelper.hxx>
30cdf0e10cSrcweir #include <svl/languageoptions.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include <svx/svxids.hrc>
33cdf0e10cSrcweir #include <sfx2/linkmgr.hxx>
34cdf0e10cSrcweir #include <svx/htmlmode.hxx>
35cdf0e10cSrcweir #include <svx/imapdlg.hxx>
36*3f09c2ceSJürgen Schmidt #include <svx/xflclit.hxx>
37cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
38cdf0e10cSrcweir #include <sfx2/docfile.hxx>
39cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
40cdf0e10cSrcweir #include <sfx2/request.hxx>
41cdf0e10cSrcweir #include <svl/whiter.hxx>
42cdf0e10cSrcweir #include <svl/visitem.hxx>
43cdf0e10cSrcweir #include <sfx2/objitem.hxx>
44cdf0e10cSrcweir #include <svtools/filter.hxx>
45cdf0e10cSrcweir #include <svx/gallery.hxx>
46cdf0e10cSrcweir #include <editeng/langitem.hxx>
47cdf0e10cSrcweir #include <svx/clipfmtitem.hxx>
48cdf0e10cSrcweir #include <svx/contdlg.hxx>
49cdf0e10cSrcweir #include <vcl/graph.hxx>
50cdf0e10cSrcweir #include <svl/slstitm.hxx>
51cdf0e10cSrcweir #include <vcl/msgbox.hxx>
52cdf0e10cSrcweir #include <svl/ptitem.hxx>
53cdf0e10cSrcweir #include <svl/itemiter.hxx>
54cdf0e10cSrcweir #include <svl/stritem.hxx>
55cdf0e10cSrcweir #include <editeng/colritem.hxx>
56cdf0e10cSrcweir #include <editeng/shaditem.hxx>
57cdf0e10cSrcweir #include <editeng/boxitem.hxx>
58cdf0e10cSrcweir #include <svl/srchitem.hxx>
59cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
60cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
61cdf0e10cSrcweir #include <editeng/brshitem.hxx>
62cdf0e10cSrcweir #include <editeng/opaqitem.hxx>
63cdf0e10cSrcweir #include <editeng/sizeitem.hxx>
64cdf0e10cSrcweir #include <svx/flagsdef.hxx>
65cdf0e10cSrcweir #include <editeng/scripttypeitem.hxx>
66cdf0e10cSrcweir #include <sfx2/objface.hxx>
67cdf0e10cSrcweir #include <fmturl.hxx>
68cdf0e10cSrcweir #include <fmthdft.hxx>
69cdf0e10cSrcweir #include <fmtclds.hxx>
70cdf0e10cSrcweir #include <docsh.hxx>
71cdf0e10cSrcweir #include <wrtsh.hxx>
72cdf0e10cSrcweir #include <view.hxx>
73cdf0e10cSrcweir #include <swmodule.hxx>
74cdf0e10cSrcweir #include <swundo.hxx>
75cdf0e10cSrcweir #include <fldbas.hxx>
76cdf0e10cSrcweir #include <uitool.hxx>
77cdf0e10cSrcweir #include <basesh.hxx>
78cdf0e10cSrcweir #include <viewopt.hxx>
79cdf0e10cSrcweir #include <fontcfg.hxx>
80cdf0e10cSrcweir #include <docstat.hxx>
81cdf0e10cSrcweir #include <usrfld.hxx>
82cdf0e10cSrcweir #include <expfld.hxx>
83cdf0e10cSrcweir #include <fldmgr.hxx>
84cdf0e10cSrcweir #include <frmmgr.hxx>
85cdf0e10cSrcweir #include <tablemgr.hxx>
86cdf0e10cSrcweir #include <mdiexp.hxx>
87cdf0e10cSrcweir #include <swdtflvr.hxx>
88cdf0e10cSrcweir #include <pagedesc.hxx>
89cdf0e10cSrcweir #include <convert.hxx>
90cdf0e10cSrcweir #include <fmtcol.hxx>
91cdf0e10cSrcweir #include <edtwin.hxx>
92cdf0e10cSrcweir #include <tblafmt.hxx>
93cdf0e10cSrcweir #include <caption.hxx>
94cdf0e10cSrcweir #include <swwait.hxx>
95cdf0e10cSrcweir #include <cmdid.h>
96cdf0e10cSrcweir #include <globals.hrc>
97cdf0e10cSrcweir #include <shells.hrc>
98cdf0e10cSrcweir #include <statstr.hrc>
99cdf0e10cSrcweir #include <globals.h>
100cdf0e10cSrcweir #include <unotxdoc.hxx>
101cdf0e10cSrcweir #include <crsskip.hxx>
102cdf0e10cSrcweir #include <fmtinfmt.hxx>
103cdf0e10cSrcweir #include <doc.hxx>
104cdf0e10cSrcweir 
105cdf0e10cSrcweir #include "swabstdlg.hxx"
106cdf0e10cSrcweir #include "dialog.hrc"
107cdf0e10cSrcweir #include "fldui.hrc"
108cdf0e10cSrcweir #include "table.hrc"
109cdf0e10cSrcweir #include <modcfg.hxx>
110cdf0e10cSrcweir #include <instable.hxx>
111cdf0e10cSrcweir #include <svx/fmshell.hxx> // for FN_XFORMS_DESIGN_MODE
112cdf0e10cSrcweir #include <SwRewriter.hxx>
113cdf0e10cSrcweir #include <comcore.hrc>
114cdf0e10cSrcweir 
115cdf0e10cSrcweir #include <unomid.h>
1169afceb33SAriel Constenla-Haile #include <svx/galleryitem.hxx>
1179afceb33SAriel Constenla-Haile #include <com/sun/star/gallery/GalleryItemType.hpp>
118cdf0e10cSrcweir 
119cdf0e10cSrcweir FlyMode SwBaseShell::eFrameMode = FLY_DRAG_END;
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 
122cdf0e10cSrcweir //Fuer die Erkennung der Id, die variable von Gallery mit SID_GALLERY_BG_BRUSH
123cdf0e10cSrcweir //ankommt.
124cdf0e10cSrcweir static sal_uInt8 nParagraphPos;
125cdf0e10cSrcweir static sal_uInt8 nGraphicPos;
126cdf0e10cSrcweir static sal_uInt8 nOlePos;
127cdf0e10cSrcweir static sal_uInt8 nFramePos;
128cdf0e10cSrcweir static sal_uInt8 nTablePos;
129cdf0e10cSrcweir static sal_uInt8 nTableRowPos;
130cdf0e10cSrcweir static sal_uInt8 nTableCellPos;
131cdf0e10cSrcweir static sal_uInt8 nPagePos;
132cdf0e10cSrcweir static sal_uInt8 nHeaderPos;
133cdf0e10cSrcweir static sal_uInt8 nFooterPos;
134cdf0e10cSrcweir 
135cdf0e10cSrcweir #define SwBaseShell
136cdf0e10cSrcweir #define Shadow
137cdf0e10cSrcweir #include <sfx2/msg.hxx>
138cdf0e10cSrcweir #include "swslots.hxx"
139cdf0e10cSrcweir 
140cdf0e10cSrcweir #define SWCONTOURDLG(rView) ( (SvxContourDlg*) ( rView.GetViewFrame()->GetChildWindow(  \
141cdf0e10cSrcweir                           SvxContourDlgChildWindow::GetChildWindowId() )->  \
142cdf0e10cSrcweir                           GetWindow() ) )
143cdf0e10cSrcweir 
144cdf0e10cSrcweir #define SWIMAPDLG(rView) ( (SvxIMapDlg*) ( rView.GetViewFrame()->GetChildWindow(        \
145cdf0e10cSrcweir                         SvxIMapDlgChildWindow::GetChildWindowId() )->   \
146cdf0e10cSrcweir                         GetWindow() ) )
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 
149cdf0e10cSrcweir using namespace ::com::sun::star;
150cdf0e10cSrcweir using namespace ::com::sun::star::uno;
151cdf0e10cSrcweir using namespace ::com::sun::star::frame;
152cdf0e10cSrcweir using namespace ::com::sun::star::lang;
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 
155cdf0e10cSrcweir SFX_IMPL_INTERFACE(SwBaseShell, SfxShell, SW_RES(0))
156cdf0e10cSrcweir {
157cdf0e10cSrcweir     SFX_CHILDWINDOW_REGISTRATION(SvxIMapDlgChildWindow::GetChildWindowId());
158cdf0e10cSrcweir     SFX_CHILDWINDOW_REGISTRATION(SvxContourDlgChildWindow::GetChildWindowId());
159cdf0e10cSrcweir }
160cdf0e10cSrcweir 
161cdf0e10cSrcweir TYPEINIT1(SwBaseShell,SfxShell)
162cdf0e10cSrcweir 
163cdf0e10cSrcweir /*--------------------------------------------------------------------
164cdf0e10cSrcweir     Beschreibung:   statics
165cdf0e10cSrcweir  --------------------------------------------------------------------*/
166cdf0e10cSrcweir 
167cdf0e10cSrcweir 
168cdf0e10cSrcweir void lcl_UpdateIMapDlg( SwWrtShell& rSh )
169cdf0e10cSrcweir {
170cdf0e10cSrcweir     Graphic aGrf( rSh.GetIMapGraphic() );
171cdf0e10cSrcweir     GraphicType nGrfType = aGrf.GetType();
172cdf0e10cSrcweir     void* pEditObj = GRAPHIC_NONE != nGrfType && GRAPHIC_DEFAULT != nGrfType
173cdf0e10cSrcweir                         ? rSh.GetIMapInventor() : 0;
174cdf0e10cSrcweir     TargetList* pList = new TargetList;
175cdf0e10cSrcweir     rSh.GetView().GetViewFrame()->GetTopFrame().GetTargetList(*pList);
176cdf0e10cSrcweir 
177cdf0e10cSrcweir     SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
178cdf0e10cSrcweir     rSh.GetFlyFrmAttr( aSet );
179cdf0e10cSrcweir     const SwFmtURL &rURL = (SwFmtURL&)aSet.Get( RES_URL );
180cdf0e10cSrcweir     SvxIMapDlgChildWindow::UpdateIMapDlg(
181cdf0e10cSrcweir             aGrf, rURL.GetMap(), pList, pEditObj );
182cdf0e10cSrcweir 
183cdf0e10cSrcweir     sal_uInt16 nCount = (sal_uInt16)pList->Count();
184cdf0e10cSrcweir     if(nCount)
185cdf0e10cSrcweir         for( sal_uInt16 i = nCount; i; i--  )
186cdf0e10cSrcweir         {
187cdf0e10cSrcweir             delete pList->GetObject(i-1);
188cdf0e10cSrcweir         }
189cdf0e10cSrcweir     delete pList;
190cdf0e10cSrcweir }
191cdf0e10cSrcweir 
192cdf0e10cSrcweir 
193cdf0e10cSrcweir sal_Bool lcl_UpdateContourDlg( SwWrtShell &rSh, int nSel )
194cdf0e10cSrcweir {
195cdf0e10cSrcweir     Graphic aGraf( rSh.GetIMapGraphic() );
196cdf0e10cSrcweir     GraphicType nGrfType = aGraf.GetType();
197cdf0e10cSrcweir     sal_Bool bRet = GRAPHIC_NONE != nGrfType && GRAPHIC_DEFAULT != nGrfType;
198cdf0e10cSrcweir     if( bRet )
199cdf0e10cSrcweir     {
200cdf0e10cSrcweir         String aGrfName;
201cdf0e10cSrcweir         if ( nSel & nsSelectionType::SEL_GRF )
202cdf0e10cSrcweir             rSh.GetGrfNms( &aGrfName, 0 );
203cdf0e10cSrcweir 
204cdf0e10cSrcweir         SvxContourDlg *pDlg = SWCONTOURDLG(rSh.GetView());
205cdf0e10cSrcweir         pDlg->Update( aGraf, aGrfName.Len() > 0,
206cdf0e10cSrcweir                   rSh.GetGraphicPolygon(), rSh.GetIMapInventor() );
207cdf0e10cSrcweir     }
208cdf0e10cSrcweir     return bRet;
209cdf0e10cSrcweir }
210cdf0e10cSrcweir 
211cdf0e10cSrcweir /*--------------------------------------------------------------------
212cdf0e10cSrcweir     Beschreibung:   loeschen
213cdf0e10cSrcweir  --------------------------------------------------------------------*/
214cdf0e10cSrcweir 
215cdf0e10cSrcweir void SwBaseShell::ExecDelete(SfxRequest &rReq)
216cdf0e10cSrcweir {
217cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
218cdf0e10cSrcweir     SwEditWin& rTmpEditWin = GetView().GetEditWin();
219cdf0e10cSrcweir     switch(rReq.GetSlot())
220cdf0e10cSrcweir     {
221cdf0e10cSrcweir         case SID_DELETE:
222cdf0e10cSrcweir             rSh.DelRight();
223cdf0e10cSrcweir             break;
224cdf0e10cSrcweir 
225cdf0e10cSrcweir         case FN_BACKSPACE:
226cdf0e10cSrcweir 
227cdf0e10cSrcweir             if( rSh.IsNoNum() )
228cdf0e10cSrcweir             {
229cdf0e10cSrcweir                 rSh.SttCrsrMove();
230cdf0e10cSrcweir                 sal_Bool bLeft = rSh.Left( CRSR_SKIP_CHARS, sal_True, 1, sal_False  );
231cdf0e10cSrcweir                 if( bLeft )
232cdf0e10cSrcweir                 {
233cdf0e10cSrcweir                     // JP 28.03.96: ein Backspace im Absatz ohne Nummer wird zum Delete
234cdf0e10cSrcweir                     //rSh.SwapPam();
235cdf0e10cSrcweir                     //rSh.DelRight( sal_False );
236cdf0e10cSrcweir 
237cdf0e10cSrcweir                     rSh.DelLeft();
238cdf0e10cSrcweir                 }
239cdf0e10cSrcweir                 else
240cdf0e10cSrcweir                     // JP 15.07.96: wenns nicht mehr nach vorne geht, die
241cdf0e10cSrcweir                     //              Numerierung aufheben. Z.B. am Doc-/
242cdf0e10cSrcweir                     //              Rahmen-/Tabellen-/Bereichs-Anfang
243cdf0e10cSrcweir                     rSh.DelNumRules();
244cdf0e10cSrcweir 
245cdf0e10cSrcweir                 rSh.EndCrsrMove();
246cdf0e10cSrcweir                 break;
247cdf0e10cSrcweir             }
248cdf0e10cSrcweir 
249cdf0e10cSrcweir             // ansonsten DelLeft rufen
250cdf0e10cSrcweir         case FN_SHIFT_BACKSPACE:
251cdf0e10cSrcweir             rSh.DelLeft();
252cdf0e10cSrcweir             break;
253cdf0e10cSrcweir         default:
254cdf0e10cSrcweir             DBG_ERROR("falscher Dispatcher");
255cdf0e10cSrcweir             return;
256cdf0e10cSrcweir     }
257cdf0e10cSrcweir     rReq.Done();
258cdf0e10cSrcweir 
259cdf0e10cSrcweir     //#i42732# - notify the edit window that from now on we do not use the input language
260cdf0e10cSrcweir     rTmpEditWin.SetUseInputLanguage( sal_False );
261cdf0e10cSrcweir }
262cdf0e10cSrcweir 
263cdf0e10cSrcweir /*--------------------------------------------------------------------
264cdf0e10cSrcweir     Beschreibung:
265cdf0e10cSrcweir  --------------------------------------------------------------------*/
266cdf0e10cSrcweir 
267cdf0e10cSrcweir void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
268cdf0e10cSrcweir {
269cdf0e10cSrcweir     //Achtung: Suizid gefaehrdet! Nach Paste, Paste special kann der die
270cdf0e10cSrcweir     //Shell zerstoert sein.
271cdf0e10cSrcweir 
272cdf0e10cSrcweir 
273cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
274cdf0e10cSrcweir     sal_uInt16 nId = rReq.GetSlot();
275cdf0e10cSrcweir     sal_Bool bIgnore = sal_False;
276cdf0e10cSrcweir     switch( nId )
277cdf0e10cSrcweir     {
278cdf0e10cSrcweir         case SID_CUT:
279cdf0e10cSrcweir         case SID_COPY:
280cdf0e10cSrcweir             rView.GetEditWin().FlushInBuffer();
281cdf0e10cSrcweir             if ( rSh.HasSelection() )
282cdf0e10cSrcweir             {
283cdf0e10cSrcweir                 SwTransferable* pTransfer = new SwTransferable( rSh );
284cdf0e10cSrcweir /*??*/          uno::Reference< datatransfer::XTransferable > xRef( pTransfer );
285cdf0e10cSrcweir 
286cdf0e10cSrcweir                 if ( nId == SID_CUT && !rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT) )
287cdf0e10cSrcweir                     pTransfer->Cut();
288cdf0e10cSrcweir                 else
289cdf0e10cSrcweir                 {
290cdf0e10cSrcweir                     const sal_Bool bLockedView = rSh.IsViewLocked();
291cdf0e10cSrcweir                     rSh.LockView( sal_True );    //lock visible section
292cdf0e10cSrcweir                     pTransfer->Copy();
293cdf0e10cSrcweir                     rSh.LockView( bLockedView );
294cdf0e10cSrcweir                 }
295cdf0e10cSrcweir                 break;
296cdf0e10cSrcweir             }
297cdf0e10cSrcweir             return;
298cdf0e10cSrcweir 
299cdf0e10cSrcweir         case SID_PASTE:
300cdf0e10cSrcweir             {
301cdf0e10cSrcweir                 TransferableDataHelper aDataHelper(
30269a74367SOliver-Rainer Wittmann                     TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin() ) );
30369a74367SOliver-Rainer Wittmann                 if( aDataHelper.GetXTransferable().is()
30469a74367SOliver-Rainer Wittmann                     && SwTransferable::IsPaste( rSh, aDataHelper )
30569a74367SOliver-Rainer Wittmann                     && !rSh.CrsrInsideInputFld() )
306cdf0e10cSrcweir                 {
307cdf0e10cSrcweir                     // temp. Variablen, da die Shell nach dem Paste schon
308cdf0e10cSrcweir                     // zerstoert sein kann
309cdf0e10cSrcweir                     SwView* pView = &rView;
310cdf0e10cSrcweir                     SwTransferable::Paste( rSh, aDataHelper );
311cdf0e10cSrcweir                     if( rSh.IsFrmSelected() || rSh.IsObjSelected() )
312cdf0e10cSrcweir                         rSh.EnterSelFrmMode();
313cdf0e10cSrcweir                     pView->AttrChangedNotify( &rSh );
314cdf0e10cSrcweir                 }
315cdf0e10cSrcweir                 else
316cdf0e10cSrcweir                     return;
317cdf0e10cSrcweir             }
318cdf0e10cSrcweir             break;
319cdf0e10cSrcweir 
320cdf0e10cSrcweir         case SID_CLIPBOARD_FORMAT_ITEMS:
321cdf0e10cSrcweir             {
322cdf0e10cSrcweir                 const SfxItemSet* pArgs = rReq.GetArgs();
323cdf0e10cSrcweir                 const SfxPoolItem* pFmt;
324cdf0e10cSrcweir                 if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nId, sal_False, &pFmt ) )
325cdf0e10cSrcweir                 {
326cdf0e10cSrcweir                     TransferableDataHelper aDataHelper(
327cdf0e10cSrcweir                         TransferableDataHelper::CreateFromSystemClipboard(
328cdf0e10cSrcweir                                             &rSh.GetView().GetEditWin()) );
329cdf0e10cSrcweir                     if( aDataHelper.GetXTransferable().is()
330cdf0e10cSrcweir                         /*&& SwTransferable::IsPaste( rSh, aDataHelper )*/ )
331cdf0e10cSrcweir                     {
332cdf0e10cSrcweir                         // temp. Variablen, da die Shell nach dem Paste schon
333cdf0e10cSrcweir                         // zerstoert sein kann
334cdf0e10cSrcweir                         SwView* pView = &rView;
335cdf0e10cSrcweir 
336cdf0e10cSrcweir                         SwTransferable::PasteFormat( rSh, aDataHelper,
337cdf0e10cSrcweir                                         ((SfxUInt32Item*)pFmt)->GetValue() );
338cdf0e10cSrcweir 
339cdf0e10cSrcweir                         //Done() has to be called before the shell has been removed
340cdf0e10cSrcweir                         rReq.Done();
341cdf0e10cSrcweir                         bIgnore = sal_True;
342cdf0e10cSrcweir                         if( rSh.IsFrmSelected() || rSh.IsObjSelected())
343cdf0e10cSrcweir                             rSh.EnterSelFrmMode();
344cdf0e10cSrcweir                         pView->AttrChangedNotify( &rSh );
345cdf0e10cSrcweir                     }
346cdf0e10cSrcweir                 }
347cdf0e10cSrcweir             }
348cdf0e10cSrcweir             break;
349cdf0e10cSrcweir 
350cdf0e10cSrcweir         case SID_PASTE_UNFORMATTED:
351cdf0e10cSrcweir             {
352cdf0e10cSrcweir                 TransferableDataHelper aDataHelper(
35369a74367SOliver-Rainer Wittmann                     TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin()) );
35469a74367SOliver-Rainer Wittmann                 if( aDataHelper.GetXTransferable().is()
35569a74367SOliver-Rainer Wittmann                     && SwTransferable::IsPaste( rSh, aDataHelper ) )
356cdf0e10cSrcweir                 {
357cdf0e10cSrcweir                     // temp. Variablen, da die Shell nach dem Paste schon
358cdf0e10cSrcweir                     // zerstoert sein kann
359cdf0e10cSrcweir                     SwView* pView = &rView;
360cdf0e10cSrcweir                     rReq.Ignore();
361cdf0e10cSrcweir                     bIgnore = sal_True;
362cdf0e10cSrcweir                     int nRet = SwTransferable::PasteUnformatted( rSh, aDataHelper );
363cdf0e10cSrcweir                     if(nRet)// && rReq.IsRecording() )
364cdf0e10cSrcweir                     {
365cdf0e10cSrcweir                         SfxViewFrame* pViewFrame = pView->GetViewFrame();
366cdf0e10cSrcweir                         uno::Reference< frame::XDispatchRecorder > xRecorder =
367cdf0e10cSrcweir                             pViewFrame->GetBindings().GetRecorder();
368cdf0e10cSrcweir                         if(xRecorder.is()) {
369cdf0e10cSrcweir                             SfxRequest aReq( pViewFrame, SID_CLIPBOARD_FORMAT_ITEMS );
370cdf0e10cSrcweir                             aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, SOT_FORMAT_STRING ) );
371cdf0e10cSrcweir                             aReq.Done();
372cdf0e10cSrcweir                         }
373cdf0e10cSrcweir                     }
374cdf0e10cSrcweir 
375cdf0e10cSrcweir                     if (rSh.IsFrmSelected() || rSh.IsObjSelected())
376cdf0e10cSrcweir                         rSh.EnterSelFrmMode();
377cdf0e10cSrcweir                     pView->AttrChangedNotify( &rSh );
378cdf0e10cSrcweir                 }
379cdf0e10cSrcweir                 else
380cdf0e10cSrcweir                     return;
381cdf0e10cSrcweir             }
382cdf0e10cSrcweir             break;
383cdf0e10cSrcweir 
384cdf0e10cSrcweir         case SID_PASTE_SPECIAL:
385cdf0e10cSrcweir             {
386cdf0e10cSrcweir                 TransferableDataHelper aDataHelper(
38769a74367SOliver-Rainer Wittmann                     TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin()) );
38869a74367SOliver-Rainer Wittmann                 if( aDataHelper.GetXTransferable().is()
38969a74367SOliver-Rainer Wittmann                     && SwTransferable::IsPaste( rSh, aDataHelper )
39069a74367SOliver-Rainer Wittmann                     && !rSh.CrsrInsideInputFld() )
391cdf0e10cSrcweir                 {
392cdf0e10cSrcweir                     // temp. Variablen, da die Shell nach dem Paste schon
393cdf0e10cSrcweir                     // zerstoert sein kann
394cdf0e10cSrcweir                     SwView* pView = &rView;
395cdf0e10cSrcweir                     sal_uLong nFormatId = 0;
396cdf0e10cSrcweir                     rReq.Ignore();
397cdf0e10cSrcweir                     bIgnore = sal_True;
398cdf0e10cSrcweir                     int nRet = SwTransferable::PasteSpecial( rSh, aDataHelper, nFormatId );
399cdf0e10cSrcweir                     if(nRet)// && rReq.IsRecording() )
400cdf0e10cSrcweir                     {
401cdf0e10cSrcweir                         SfxViewFrame* pViewFrame = pView->GetViewFrame();
402cdf0e10cSrcweir                         uno::Reference< frame::XDispatchRecorder > xRecorder =
403cdf0e10cSrcweir                             pViewFrame->GetBindings().GetRecorder();
404cdf0e10cSrcweir                         if(xRecorder.is()) {
405cdf0e10cSrcweir                             SfxRequest aReq( pViewFrame, SID_CLIPBOARD_FORMAT_ITEMS );
406cdf0e10cSrcweir                             aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, nFormatId ) );
407cdf0e10cSrcweir                             aReq.Done();
408cdf0e10cSrcweir                         }
409cdf0e10cSrcweir                     }
410cdf0e10cSrcweir 
411cdf0e10cSrcweir                     if (rSh.IsFrmSelected() || rSh.IsObjSelected())
412cdf0e10cSrcweir                         rSh.EnterSelFrmMode();
413cdf0e10cSrcweir                     pView->AttrChangedNotify( &rSh );
414cdf0e10cSrcweir                 }
415cdf0e10cSrcweir                 else
416cdf0e10cSrcweir                     return;
417cdf0e10cSrcweir             }
418cdf0e10cSrcweir             break;
41969a74367SOliver-Rainer Wittmann 
420cdf0e10cSrcweir         default:
421cdf0e10cSrcweir             DBG_ERROR("falscher Dispatcher");
422cdf0e10cSrcweir             return;
423cdf0e10cSrcweir     }
424cdf0e10cSrcweir     if(!bIgnore)
425cdf0e10cSrcweir         rReq.Done();
426cdf0e10cSrcweir }
427cdf0e10cSrcweir 
428cdf0e10cSrcweir /*--------------------------------------------------------------------
429cdf0e10cSrcweir     Beschreibung:   ClipBoard-Status
430cdf0e10cSrcweir  --------------------------------------------------------------------*/
431cdf0e10cSrcweir 
432cdf0e10cSrcweir void SwBaseShell::StateClpbrd(SfxItemSet &rSet)
433cdf0e10cSrcweir {
434cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
435cdf0e10cSrcweir     SfxWhichIter aIter(rSet);
436cdf0e10cSrcweir 
437cdf0e10cSrcweir     const sal_Bool bCopy = rSh.HasSelection();
438cdf0e10cSrcweir 
439cdf0e10cSrcweir     sal_uInt16 nWhich = aIter.FirstWhich();
440cdf0e10cSrcweir 
441cdf0e10cSrcweir     while(nWhich)
442cdf0e10cSrcweir     {
443cdf0e10cSrcweir         switch(nWhich)
444cdf0e10cSrcweir         {
445cdf0e10cSrcweir         case SID_CUT:
446cdf0e10cSrcweir             if( 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) )
447cdf0e10cSrcweir             {
448cdf0e10cSrcweir                 rSet.DisableItem( nWhich );
449cdf0e10cSrcweir                 break;
450cdf0e10cSrcweir             }
451cdf0e10cSrcweir         case SID_COPY:
452cdf0e10cSrcweir             if( !bCopy )
453cdf0e10cSrcweir                 rSet.DisableItem( nWhich );
454cdf0e10cSrcweir             break;
455cdf0e10cSrcweir 
456cdf0e10cSrcweir         case SID_PASTE:
45769a74367SOliver-Rainer Wittmann             if( !GetView().IsPasteAllowed()
45869a74367SOliver-Rainer Wittmann                 || rSh.CrsrInsideInputFld() )
45969a74367SOliver-Rainer Wittmann             {
46069a74367SOliver-Rainer Wittmann                 rSet.DisableItem( nWhich );
46169a74367SOliver-Rainer Wittmann             }
462cdf0e10cSrcweir             break;
463cdf0e10cSrcweir 
464cdf0e10cSrcweir         case SID_PASTE_SPECIAL:
46569a74367SOliver-Rainer Wittmann             if( !GetView().IsPasteSpecialAllowed()
46669a74367SOliver-Rainer Wittmann                 || rSh.CrsrInsideInputFld() )
46769a74367SOliver-Rainer Wittmann             {
46869a74367SOliver-Rainer Wittmann                 rSet.DisableItem( nWhich );
46969a74367SOliver-Rainer Wittmann             }
47069a74367SOliver-Rainer Wittmann             break;
47169a74367SOliver-Rainer Wittmann 
47269a74367SOliver-Rainer Wittmann         case SID_PASTE_UNFORMATTED:
473cdf0e10cSrcweir             if( !GetView().IsPasteSpecialAllowed() )
474cdf0e10cSrcweir             {
47569a74367SOliver-Rainer Wittmann                 rSet.DisableItem( nWhich );
476cdf0e10cSrcweir             }
477cdf0e10cSrcweir             break;
478cdf0e10cSrcweir 
479cdf0e10cSrcweir         case SID_CLIPBOARD_FORMAT_ITEMS:
480cdf0e10cSrcweir             {
481cdf0e10cSrcweir                 TransferableDataHelper aDataHelper(
482cdf0e10cSrcweir                     TransferableDataHelper::CreateFromSystemClipboard(
483cdf0e10cSrcweir                                             &rSh.GetView().GetEditWin()) );
484cdf0e10cSrcweir 
485cdf0e10cSrcweir                 SvxClipboardFmtItem aFmtItem( nWhich );
486cdf0e10cSrcweir                 SwTransferable::FillClipFmtItem( rSh, aDataHelper, aFmtItem );
487cdf0e10cSrcweir                 rSet.Put( aFmtItem );
488cdf0e10cSrcweir             }
489cdf0e10cSrcweir             break;
490cdf0e10cSrcweir         }
491cdf0e10cSrcweir         nWhich = aIter.NextWhich();
492cdf0e10cSrcweir     }
493cdf0e10cSrcweir }
494cdf0e10cSrcweir 
495cdf0e10cSrcweir /*--------------------------------------------------------------------
496cdf0e10cSrcweir     Beschreibung:   Undo ausfuehren
497cdf0e10cSrcweir  --------------------------------------------------------------------*/
498cdf0e10cSrcweir 
499cdf0e10cSrcweir void SwBaseShell::ExecUndo(SfxRequest &rReq)
500cdf0e10cSrcweir {
501cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
502cdf0e10cSrcweir 
503cdf0e10cSrcweir     sal_uInt16 nId = rReq.GetSlot(), nCnt = 1;
504cdf0e10cSrcweir     const SfxItemSet* pArgs = rReq.GetArgs();
505cdf0e10cSrcweir     const SfxPoolItem* pItem;
506cdf0e10cSrcweir     if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nId, sal_False, &pItem ))
507cdf0e10cSrcweir         nCnt = ((SfxUInt16Item*)pItem)->GetValue();
508cdf0e10cSrcweir 
509cdf0e10cSrcweir     // #i106349#: save pointer: undo/redo may delete the shell, i.e., this!
510cdf0e10cSrcweir     SfxViewFrame *const pViewFrame( GetView().GetViewFrame() );
511cdf0e10cSrcweir 
512cdf0e10cSrcweir     switch( nId )
513cdf0e10cSrcweir     {
514cdf0e10cSrcweir         case SID_UNDO:
515cdf0e10cSrcweir             rSh.LockPaint();
516cdf0e10cSrcweir             rSh.Do( SwWrtShell::UNDO, nCnt );
517cdf0e10cSrcweir             rSh.UnlockPaint();
518cdf0e10cSrcweir             break;
519cdf0e10cSrcweir 
520cdf0e10cSrcweir         case SID_REDO:
521cdf0e10cSrcweir             rSh.LockPaint();
522cdf0e10cSrcweir             rSh.Do( SwWrtShell::REDO, nCnt );
523cdf0e10cSrcweir             rSh.UnlockPaint();
524cdf0e10cSrcweir             break;
525cdf0e10cSrcweir 
526cdf0e10cSrcweir         case SID_REPEAT:
527cdf0e10cSrcweir             rSh.Do( SwWrtShell::REPEAT );
528cdf0e10cSrcweir             break;
529cdf0e10cSrcweir         default:
530cdf0e10cSrcweir             DBG_ERROR("falscher Dispatcher");
531cdf0e10cSrcweir     }
532cdf0e10cSrcweir 
533cdf0e10cSrcweir     if (pViewFrame) { pViewFrame->GetBindings().InvalidateAll(sal_False); }
534cdf0e10cSrcweir }
535cdf0e10cSrcweir 
536cdf0e10cSrcweir /*--------------------------------------------------------------------
537cdf0e10cSrcweir     Beschreibung:   Zustand Undo
538cdf0e10cSrcweir  --------------------------------------------------------------------*/
539cdf0e10cSrcweir 
540cdf0e10cSrcweir void SwBaseShell::StateUndo(SfxItemSet &rSet)
541cdf0e10cSrcweir {
542cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
543cdf0e10cSrcweir     SfxWhichIter aIter(rSet);
544cdf0e10cSrcweir     sal_uInt16 nWhich = aIter.FirstWhich();
545cdf0e10cSrcweir     while(nWhich)
546cdf0e10cSrcweir     {
547cdf0e10cSrcweir         switch(nWhich)
548cdf0e10cSrcweir         {
549cdf0e10cSrcweir             case SID_UNDO:
550cdf0e10cSrcweir             {
551cdf0e10cSrcweir                 if (rSh.GetLastUndoInfo(0, 0))
552cdf0e10cSrcweir                 {
553cdf0e10cSrcweir                     rSet.Put( SfxStringItem(nWhich,
554cdf0e10cSrcweir                         rSh.GetDoString(SwWrtShell::UNDO)));
555cdf0e10cSrcweir                 }
556cdf0e10cSrcweir                 else
557cdf0e10cSrcweir                     rSet.DisableItem(nWhich);
558cdf0e10cSrcweir                 break;
559cdf0e10cSrcweir             }
560cdf0e10cSrcweir             case SID_REDO:
561cdf0e10cSrcweir             {
562cdf0e10cSrcweir                 if (rSh.GetFirstRedoInfo(0))
563cdf0e10cSrcweir                 {
564cdf0e10cSrcweir                     rSet.Put(SfxStringItem(nWhich,
565cdf0e10cSrcweir                         rSh.GetDoString(SwWrtShell::REDO)));
566cdf0e10cSrcweir                 }
567cdf0e10cSrcweir                 else
568cdf0e10cSrcweir                     rSet.DisableItem(nWhich);
569cdf0e10cSrcweir                 break;
570cdf0e10cSrcweir             }
571cdf0e10cSrcweir             case SID_REPEAT:
572cdf0e10cSrcweir             {   // Repeat nur moeglich wenn kein REDO moeglich - UI-Restriktion
573cdf0e10cSrcweir                 if ((!rSh.GetFirstRedoInfo(0)) &&
574cdf0e10cSrcweir                     !rSh.IsSelFrmMode() &&
575cdf0e10cSrcweir                     (UNDO_EMPTY != rSh.GetRepeatInfo(0)))
576cdf0e10cSrcweir                 {
577cdf0e10cSrcweir                     rSet.Put(SfxStringItem(nWhich, rSh.GetRepeatString()));
578cdf0e10cSrcweir                 }
579cdf0e10cSrcweir                 else
580cdf0e10cSrcweir                     rSet.DisableItem(nWhich);
581cdf0e10cSrcweir                 break;
582cdf0e10cSrcweir             }
583cdf0e10cSrcweir 
584cdf0e10cSrcweir             case SID_GETUNDOSTRINGS:
585cdf0e10cSrcweir                 if (rSh.GetLastUndoInfo(0, 0))
586cdf0e10cSrcweir                 {
587cdf0e10cSrcweir                     SfxStringListItem aStrLst( nWhich );
588cdf0e10cSrcweir                     rSh.GetDoStrings( SwWrtShell::UNDO, aStrLst );
589cdf0e10cSrcweir                     rSet.Put( aStrLst );
590cdf0e10cSrcweir                 }
591cdf0e10cSrcweir                 else
592cdf0e10cSrcweir                     rSet.DisableItem( nWhich );
593cdf0e10cSrcweir                 break;
594cdf0e10cSrcweir 
595cdf0e10cSrcweir             case SID_GETREDOSTRINGS:
596cdf0e10cSrcweir                 if (rSh.GetFirstRedoInfo(0))
597cdf0e10cSrcweir                 {
598cdf0e10cSrcweir                     SfxStringListItem aStrLst( nWhich );
599cdf0e10cSrcweir                     rSh.GetDoStrings( SwWrtShell::REDO, aStrLst );
600cdf0e10cSrcweir                     rSet.Put( aStrLst );
601cdf0e10cSrcweir                 }
602cdf0e10cSrcweir                 else
603cdf0e10cSrcweir                     rSet.DisableItem( nWhich );
604cdf0e10cSrcweir                 break;
605cdf0e10cSrcweir         }
606cdf0e10cSrcweir         nWhich = aIter.NextWhich();
607cdf0e10cSrcweir     }
608cdf0e10cSrcweir }
609cdf0e10cSrcweir 
610cdf0e10cSrcweir /*--------------------------------------------------------------------
611cdf0e10cSrcweir     Beschreibung:   Slot-Id auswerten bzw. Dispatchen
612cdf0e10cSrcweir  --------------------------------------------------------------------*/
613cdf0e10cSrcweir 
614cdf0e10cSrcweir void SwBaseShell::Execute(SfxRequest &rReq)
615cdf0e10cSrcweir {
616cdf0e10cSrcweir     const SfxPoolItem *pItem;
617cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
618cdf0e10cSrcweir     const SfxItemSet* pArgs = rReq.GetArgs();
619cdf0e10cSrcweir     sal_Bool bMore = sal_False;
620cdf0e10cSrcweir 
621cdf0e10cSrcweir     sal_uInt16 nSlot = rReq.GetSlot();
622cdf0e10cSrcweir     switch(nSlot)
623cdf0e10cSrcweir     {
624cdf0e10cSrcweir         case FN_REPAGINATE:
625cdf0e10cSrcweir             {
626cdf0e10cSrcweir                 Reference < XModel > xModel = GetView().GetDocShell()->GetModel();
627cdf0e10cSrcweir                 Reference < XUnoTunnel > xDocTunnel ( xModel, UNO_QUERY );
628cdf0e10cSrcweir                 SwXTextDocument *pDoc = reinterpret_cast < SwXTextDocument * > ( xDocTunnel->getSomething ( SwXTextDocument::getUnoTunnelId() ) );
629cdf0e10cSrcweir                 pDoc->notifyRefreshListeners();
630cdf0e10cSrcweir                 rSh.CalcLayout();
631cdf0e10cSrcweir             }
632cdf0e10cSrcweir             break;
633cdf0e10cSrcweir         case FN_UPDATE_FIELDS:
634cdf0e10cSrcweir             {
635cdf0e10cSrcweir                 SwDocStat aDocStat;
636cdf0e10cSrcweir                 rSh.UpdateDocStat(aDocStat);
637cdf0e10cSrcweir                 rSh.EndAllTblBoxEdit();
638cdf0e10cSrcweir                 rSh.ViewShell::UpdateFlds(sal_True);
639cdf0e10cSrcweir 
640cdf0e10cSrcweir                 if( rSh.IsCrsrInTbl() )
641cdf0e10cSrcweir                 {
642cdf0e10cSrcweir                     if( !rSh.IsTblComplexForChart() )
643cdf0e10cSrcweir                         SwTableFUNC( &rSh, sal_False).UpdateChart();
644cdf0e10cSrcweir                     rSh.ClearTblBoxCntnt();
645cdf0e10cSrcweir                     rSh.SaveTblBoxCntnt();
646cdf0e10cSrcweir                 }
647cdf0e10cSrcweir             }
648cdf0e10cSrcweir             break;
649cdf0e10cSrcweir         case FN_UPDATE_CHARTS:
650cdf0e10cSrcweir             {
6518ef2f12bSOliver-Rainer Wittmann                 SwWait aWait( *rView.GetDocShell(), true );
652cdf0e10cSrcweir                 rSh.UpdateAllCharts();
653cdf0e10cSrcweir             }
654cdf0e10cSrcweir             break;
655cdf0e10cSrcweir 
656cdf0e10cSrcweir         case FN_UPDATE_ALL:
657cdf0e10cSrcweir             {
658cdf0e10cSrcweir                 SwView&  rTempView = GetView();
659cdf0e10cSrcweir                 rSh.EnterStdMode();
660cdf0e10cSrcweir                 if( rSh.GetLinkManager().GetLinks().Count() )
661cdf0e10cSrcweir                 {
662cdf0e10cSrcweir                     rSh.StartAllAction();
663cdf0e10cSrcweir                     rSh.GetLinkManager().UpdateAllLinks( sal_False, sal_True, sal_True );
664cdf0e10cSrcweir                     rSh.EndAllAction();
665cdf0e10cSrcweir                 }
666cdf0e10cSrcweir                 SfxDispatcher &rDis = *rTempView.GetViewFrame()->GetDispatcher();
667cdf0e10cSrcweir                 rDis.Execute( FN_UPDATE_FIELDS );
668cdf0e10cSrcweir                 rDis.Execute( FN_UPDATE_TOX );
669cdf0e10cSrcweir                 rDis.Execute( FN_UPDATE_CHARTS );
670cdf0e10cSrcweir                 rSh.CalcLayout();
671cdf0e10cSrcweir             }
672cdf0e10cSrcweir             break;
673cdf0e10cSrcweir 
674cdf0e10cSrcweir         case FN_UPDATE_INPUTFIELDS:
67569a74367SOliver-Rainer Wittmann             rSh.UpdateInputFlds();
676cdf0e10cSrcweir             break;
67769a74367SOliver-Rainer Wittmann 
678cdf0e10cSrcweir         case FN_PREV_BOOKMARK:
679cdf0e10cSrcweir             rReq.SetReturnValue(SfxBoolItem( nSlot, rSh.GoPrevBookmark()));
680cdf0e10cSrcweir             break;
681cdf0e10cSrcweir         case FN_NEXT_BOOKMARK:
682cdf0e10cSrcweir             rReq.SetReturnValue(SfxBoolItem( nSlot, rSh.GoNextBookmark()));
683cdf0e10cSrcweir             break;
684cdf0e10cSrcweir 
685cdf0e10cSrcweir         case FN_GOTO_NEXT_MARK:
686cdf0e10cSrcweir         case FN_GOTO_PREV_MARK:
687cdf0e10cSrcweir         {
688cdf0e10cSrcweir             SwFldMgr aFldMgr;
689cdf0e10cSrcweir             SwFieldType* pFldType = aFldMgr.GetFldType(RES_JUMPEDITFLD);
690cdf0e10cSrcweir 
691cdf0e10cSrcweir             if (pFldType)
692cdf0e10cSrcweir             {
693cdf0e10cSrcweir                 if (rSh.IsSelFrmMode())
694cdf0e10cSrcweir                 {
695cdf0e10cSrcweir                     rSh.UnSelectFrm();
696cdf0e10cSrcweir                     rSh.LeaveSelFrmMode();
697cdf0e10cSrcweir                 }
698cdf0e10cSrcweir 
699cdf0e10cSrcweir                 if (rSh.HasMark())
700cdf0e10cSrcweir                 {
701cdf0e10cSrcweir                     MV_KONTEXT(&rSh);
702cdf0e10cSrcweir                     if (rSh.IsCrsrPtAtEnd())
703cdf0e10cSrcweir                         rSh.SwapPam();
704cdf0e10cSrcweir                     rSh.ClearMark();
705cdf0e10cSrcweir                     rSh.EndSelect();
706cdf0e10cSrcweir                 }
707cdf0e10cSrcweir                 sal_Bool bRet = rSh.MoveFldType( pFldType, nSlot == FN_GOTO_NEXT_MARK );
708cdf0e10cSrcweir                 SwField* pCurField = bRet ? rSh.GetCurFld() : 0;
709cdf0e10cSrcweir                 if (pCurField)
710cdf0e10cSrcweir                     rSh.ClickToField(*pCurField);
711cdf0e10cSrcweir                 rReq.SetReturnValue(SfxBoolItem( nSlot, bRet));
712cdf0e10cSrcweir             }
713cdf0e10cSrcweir         }
714cdf0e10cSrcweir         break;
715cdf0e10cSrcweir 
716cdf0e10cSrcweir         case FN_START_DOC_DIRECT:
717cdf0e10cSrcweir         case FN_END_DOC_DIRECT:
718cdf0e10cSrcweir         {
719cdf0e10cSrcweir             if (rSh.IsSelFrmMode())
720cdf0e10cSrcweir             {
721cdf0e10cSrcweir                 rSh.UnSelectFrm();
722cdf0e10cSrcweir                 rSh.LeaveSelFrmMode();
723cdf0e10cSrcweir             }
724cdf0e10cSrcweir             rSh.EnterStdMode();
725cdf0e10cSrcweir             nSlot == FN_START_DOC_DIRECT ?
726cdf0e10cSrcweir                 rSh.SttEndDoc(sal_True) :
727cdf0e10cSrcweir                     rSh.SttEndDoc(sal_False);
728cdf0e10cSrcweir         }
729cdf0e10cSrcweir         break;
730cdf0e10cSrcweir         case FN_GOTO_PREV_OBJ:
731cdf0e10cSrcweir         case FN_GOTO_NEXT_OBJ:
732cdf0e10cSrcweir         {
733cdf0e10cSrcweir                 sal_Bool bSuccess = rSh.GotoObj(
734cdf0e10cSrcweir                             nSlot == FN_GOTO_NEXT_OBJ ? sal_True : sal_False);
735cdf0e10cSrcweir                 rReq.SetReturnValue(SfxBoolItem(nSlot, bSuccess));
736cdf0e10cSrcweir                 if (bSuccess && !rSh.IsSelFrmMode())
737cdf0e10cSrcweir                 {
738cdf0e10cSrcweir                     rSh.HideCrsr();
739cdf0e10cSrcweir                     rSh.EnterSelFrmMode();
740cdf0e10cSrcweir                     GetView().AttrChangedNotify( &rSh );
741cdf0e10cSrcweir                 }
742cdf0e10cSrcweir         }
743cdf0e10cSrcweir         break;
744cdf0e10cSrcweir         case SID_GALLERY_FORMATS:
745cdf0e10cSrcweir         {
7469afceb33SAriel Constenla-Haile             SFX_ITEMSET_ARG( pArgs, pGalleryItem, SvxGalleryItem, SID_GALLERY_FORMATS, sal_False );
7479afceb33SAriel Constenla-Haile             if ( !pGalleryItem )
7489afceb33SAriel Constenla-Haile                 break;
7499afceb33SAriel Constenla-Haile 
750cdf0e10cSrcweir             const int nSelType = rSh.GetSelectionType();
7519afceb33SAriel Constenla-Haile             sal_Int8 nGalleryItemType( pGalleryItem->GetType() );
7529afceb33SAriel Constenla-Haile 
753cdf0e10cSrcweir             if ( (!rSh.IsSelFrmMode() || nSelType & nsSelectionType::SEL_GRF) &&
7549afceb33SAriel Constenla-Haile                 nGalleryItemType == com::sun::star::gallery::GalleryItemType::GRAPHIC )
755cdf0e10cSrcweir             {
7568ef2f12bSOliver-Rainer Wittmann                 SwWait aWait( *rView.GetDocShell(), true );
757cdf0e10cSrcweir 
758cdf0e10cSrcweir                 String aGrfName, aFltName;
7599afceb33SAriel Constenla-Haile                 const Graphic aGrf( pGalleryItem->GetGraphic() );
760cdf0e10cSrcweir 
7619afceb33SAriel Constenla-Haile                 if( pGalleryItem->IsLink() )
762cdf0e10cSrcweir                 {
763cdf0e10cSrcweir                     // Verknuepft
7649afceb33SAriel Constenla-Haile                     aGrfName = pGalleryItem->GetURL();
7659afceb33SAriel Constenla-Haile                     aFltName = pGalleryItem->GetFilterName();
766cdf0e10cSrcweir                 }
767cdf0e10cSrcweir 
768cdf0e10cSrcweir                 if ( nSelType & nsSelectionType::SEL_GRF )
769cdf0e10cSrcweir                     rSh.ReRead( aGrfName, aFltName, &aGrf );
770cdf0e10cSrcweir                 else
771cdf0e10cSrcweir                     rSh.Insert( aGrfName, aFltName, aGrf );
772cdf0e10cSrcweir 
773cdf0e10cSrcweir                 GetView().GetEditWin().GrabFocus();
774cdf0e10cSrcweir             }
7759afceb33SAriel Constenla-Haile             else if(!rSh.IsSelFrmMode() &&
7769afceb33SAriel Constenla-Haile                 nGalleryItemType == com::sun::star::gallery::GalleryItemType::MEDIA  )
777cdf0e10cSrcweir             {
7789afceb33SAriel Constenla-Haile                 const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, pGalleryItem->GetURL() );
779cdf0e10cSrcweir                 GetView().GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON, &aMediaURLItem, 0L );
780cdf0e10cSrcweir /*
7819afceb33SAriel Constenla-Haile                 String sURL( pGalleryItem->GetURL().GetMainURL( INetURLObject::NO_DECODE ) );
7829afceb33SAriel Constenla-Haile                 String sLabel( pGalleryItem->GetURL().getBase() );
783cdf0e10cSrcweir                 String sTarget; // empty string!
784cdf0e10cSrcweir 
785cdf0e10cSrcweir                 bool bIsHTMLMode =
786cdf0e10cSrcweir                     0 == ( HTMLMODE_ON &
787cdf0e10cSrcweir                             ::GetHtmlMode( GetView().GetDocShell() ) );
788cdf0e10cSrcweir 
789cdf0e10cSrcweir                 // in Writer, we insert a button which plays the
790cdf0e10cSrcweir                 // sound. In Writer/Web, we just insert a (text) link.
791cdf0e10cSrcweir                 if( bIsHTMLMode )
792cdf0e10cSrcweir                     InsertURLButton( sURL, sTarget, sLabel );
793cdf0e10cSrcweir                 else
794cdf0e10cSrcweir                     rSh.InsertURL( SwFmtINetFmt( sURL, sTarget ), sLabel );
795cdf0e10cSrcweir */
796cdf0e10cSrcweir             }
797cdf0e10cSrcweir         }
798cdf0e10cSrcweir         break;
799cdf0e10cSrcweir         case FN_PAGE_STYLE_SET_COLS:
800cdf0e10cSrcweir         {
801cdf0e10cSrcweir             if (pArgs)
802cdf0e10cSrcweir             {
803cdf0e10cSrcweir                 // aktuellen PageDescriptor ermitteln und damit den Set fuellen
804cdf0e10cSrcweir                 const sal_uInt16 nCurIdx = rSh.GetCurPageDesc();
805cdf0e10cSrcweir                 SwPageDesc aPageDesc(rSh.GetPageDesc(nCurIdx));
806cdf0e10cSrcweir 
807cdf0e10cSrcweir                 SwFrmFmt &rFmt = aPageDesc.GetMaster();
808cdf0e10cSrcweir 
809cdf0e10cSrcweir                 SwFmtCol aFmtCol = rFmt.GetCol();
810cdf0e10cSrcweir 
811cdf0e10cSrcweir                 sal_uInt16 nCount;
812cdf0e10cSrcweir                 if(SFX_ITEM_SET == pArgs->GetItemState(nSlot))
813cdf0e10cSrcweir                     nCount = ((SfxUInt16Item &)pArgs->Get(nSlot)).GetValue();
814cdf0e10cSrcweir                 else
815cdf0e10cSrcweir                     nCount = ((SfxUInt16Item &)pArgs->Get(SID_ATTR_COLUMNS)).GetValue();
816cdf0e10cSrcweir                 sal_uInt16 nGutterWidth = DEF_GUTTER_WIDTH;
817cdf0e10cSrcweir 
818cdf0e10cSrcweir                 aFmtCol.Init(nCount ? nCount : 1, nGutterWidth, USHRT_MAX);
819cdf0e10cSrcweir                 aFmtCol.SetWishWidth(USHRT_MAX);
820cdf0e10cSrcweir                 aFmtCol.SetGutterWidth(nGutterWidth, USHRT_MAX);
821cdf0e10cSrcweir 
822cdf0e10cSrcweir                 rFmt.SetFmtAttr(aFmtCol);
823cdf0e10cSrcweir 
824cdf0e10cSrcweir                 rSh.ChgPageDesc(nCurIdx, aPageDesc);
825cdf0e10cSrcweir             }
826cdf0e10cSrcweir             else
827cdf0e10cSrcweir                 GetView().GetViewFrame()->GetDispatcher()->Execute(FN_FORMAT_PAGE_COLUMN_DLG, sal_False);
828cdf0e10cSrcweir         }
829cdf0e10cSrcweir         break;
830cdf0e10cSrcweir         case FN_CONVERT_TABLE_TO_TEXT:
831cdf0e10cSrcweir         case FN_CONVERT_TEXT_TO_TABLE:
832cdf0e10cSrcweir         case FN_CONVERT_TEXT_TABLE:
833cdf0e10cSrcweir         {
834cdf0e10cSrcweir             sal_Unicode cDelim = 0;
835cdf0e10cSrcweir             bool bToTable = false;
836cdf0e10cSrcweir             if( nSlot == FN_CONVERT_TEXT_TO_TABLE ||
837cdf0e10cSrcweir                 ( nSlot == FN_CONVERT_TEXT_TABLE && 0 == rSh.GetTableFmt() ))
838cdf0e10cSrcweir                 bToTable = true;
839cdf0e10cSrcweir             SwInsertTableOptions aInsTblOpts( tabopts::ALL_TBL_INS_ATTR, 1 );
840cdf0e10cSrcweir             SwTableAutoFmt* pTAFmt = 0;
841cdf0e10cSrcweir             SwTableAutoFmtTbl* pAutoFmtTbl = 0;
842cdf0e10cSrcweir             bool bDeleteFormat = true;
843cdf0e10cSrcweir             if(pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_1, sal_True, &pItem))
844cdf0e10cSrcweir             {
845cdf0e10cSrcweir                 aInsTblOpts.mnInsMode = 0;
846cdf0e10cSrcweir                 //Delimiter
847cdf0e10cSrcweir                 String sDelim = static_cast< const SfxStringItem* >(pItem)->GetValue();
848cdf0e10cSrcweir                 if(sDelim.Len())
849cdf0e10cSrcweir                     cDelim = sDelim.GetChar(0);
850cdf0e10cSrcweir                 //AutoFormat
851cdf0e10cSrcweir                 if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_2, sal_True, &pItem))
852cdf0e10cSrcweir                 {
853cdf0e10cSrcweir                     String sAutoFmt = static_cast< const SfxStringItem* >(pItem)->GetValue();
854cdf0e10cSrcweir 
855cdf0e10cSrcweir                     pAutoFmtTbl = new SwTableAutoFmtTbl;
856cdf0e10cSrcweir                     pAutoFmtTbl->Load();
857cdf0e10cSrcweir 
858cdf0e10cSrcweir                     for( sal_uInt16 i = 0, nCount = pAutoFmtTbl->Count(); i < nCount; i++ )
859cdf0e10cSrcweir                     {
860cdf0e10cSrcweir                         SwTableAutoFmt* pFmt = (*pAutoFmtTbl)[ i ];
861cdf0e10cSrcweir                         if( pFmt->GetName() == sAutoFmt )
862cdf0e10cSrcweir                         {
863cdf0e10cSrcweir                             pTAFmt = pFmt;
864cdf0e10cSrcweir                             bDeleteFormat = false;
865cdf0e10cSrcweir                             break;
866cdf0e10cSrcweir                         }
867cdf0e10cSrcweir                     }
868cdf0e10cSrcweir                 }
869cdf0e10cSrcweir                 //WithHeader
870cdf0e10cSrcweir                 if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_3, sal_True, &pItem) &&
871cdf0e10cSrcweir                             static_cast< const SfxBoolItem* >(pItem)->GetValue())
872cdf0e10cSrcweir                     aInsTblOpts.mnInsMode |= tabopts::HEADLINE;
873cdf0e10cSrcweir                 // RepeatHeaderLines
874cdf0e10cSrcweir                 if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_4, sal_True, &pItem))
875cdf0e10cSrcweir                    aInsTblOpts.mnRowsToRepeat =
876cdf0e10cSrcweir                             (sal_uInt16)static_cast< const SfxInt16Item* >(pItem)->GetValue();
877cdf0e10cSrcweir                 //WithBorder
878cdf0e10cSrcweir                 if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_5, sal_True, &pItem) &&
879cdf0e10cSrcweir                     static_cast< const SfxBoolItem* >(pItem)->GetValue())
880cdf0e10cSrcweir                     aInsTblOpts.mnInsMode |= tabopts::DEFAULT_BORDER;
881cdf0e10cSrcweir                 //DontSplitTable
882cdf0e10cSrcweir                 if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_6, sal_True, &pItem) &&
883cdf0e10cSrcweir                     !static_cast< const SfxBoolItem* >(pItem)->GetValue() )
884cdf0e10cSrcweir                     aInsTblOpts.mnInsMode |= tabopts::SPLIT_LAYOUT;
885cdf0e10cSrcweir             }
886cdf0e10cSrcweir             else
887cdf0e10cSrcweir             {
888cdf0e10cSrcweir                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
889cdf0e10cSrcweir                 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
890cdf0e10cSrcweir 
891cdf0e10cSrcweir                 AbstractSwConvertTableDlg* pDlg = pFact->CreateSwConvertTableDlg(
892cdf0e10cSrcweir                             GetView(),DLG_CONV_TEXT_TABLE , bToTable);
893cdf0e10cSrcweir                 DBG_ASSERT(pDlg, "Dialogdiet fail!");
894cdf0e10cSrcweir                 if( RET_OK == pDlg->Execute() )
895cdf0e10cSrcweir                 {
896cdf0e10cSrcweir                     pDlg->GetValues( cDelim, aInsTblOpts, pTAFmt );
897cdf0e10cSrcweir 
898cdf0e10cSrcweir                 }
899cdf0e10cSrcweir                 delete pDlg;
900cdf0e10cSrcweir             }
901cdf0e10cSrcweir 
902cdf0e10cSrcweir             if( cDelim )
903cdf0e10cSrcweir             {
904cdf0e10cSrcweir                 //Shellwechsel!
905cdf0e10cSrcweir                 SwView& rSaveView = rView;
906cdf0e10cSrcweir                 sal_Bool bInserted = sal_False;
907cdf0e10cSrcweir                 //recording:
908cdf0e10cSrcweir 
909cdf0e10cSrcweir                 SfxViewFrame* pViewFrame = GetView().GetViewFrame();
910cdf0e10cSrcweir                 if( SfxRequest::HasMacroRecorder(pViewFrame) )
911cdf0e10cSrcweir                 {
912cdf0e10cSrcweir                     SfxRequest aReq( pViewFrame, nSlot);
913cdf0e10cSrcweir                     aReq.AppendItem( SfxStringItem( FN_PARAM_1, String(cDelim) ));
914cdf0e10cSrcweir                     if(bToTable)
915cdf0e10cSrcweir                     {
916cdf0e10cSrcweir                         if(pTAFmt)
917cdf0e10cSrcweir                             aReq.AppendItem( SfxStringItem( FN_PARAM_2, pTAFmt->GetName()));
918cdf0e10cSrcweir                         aReq.AppendItem( SfxBoolItem ( FN_PARAM_3, 0 != (aInsTblOpts.mnInsMode & tabopts::HEADLINE)));
919cdf0e10cSrcweir                         aReq.AppendItem( SfxInt16Item( FN_PARAM_4, (short)aInsTblOpts.mnRowsToRepeat ));
920cdf0e10cSrcweir                         aReq.AppendItem( SfxBoolItem ( FN_PARAM_5, 0 != (aInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER) ));
921cdf0e10cSrcweir                         aReq.AppendItem( SfxBoolItem ( FN_PARAM_6, !(aInsTblOpts.mnInsMode & tabopts::SPLIT_LAYOUT)));
922cdf0e10cSrcweir                     }
923cdf0e10cSrcweir                     aReq.Done();
924cdf0e10cSrcweir                 }
925cdf0e10cSrcweir 
926cdf0e10cSrcweir                 if( !bToTable )
927cdf0e10cSrcweir                     rSh.TableToText( cDelim );
928cdf0e10cSrcweir                 else
929cdf0e10cSrcweir                 {
930cdf0e10cSrcweir                     bInserted = rSh.TextToTable( aInsTblOpts, cDelim, text::HoriOrientation::FULL, pTAFmt );
931cdf0e10cSrcweir                 }
932cdf0e10cSrcweir                 rSh.EnterStdMode();
933cdf0e10cSrcweir 
934cdf0e10cSrcweir                 if( bInserted )
935cdf0e10cSrcweir                     rSaveView.AutoCaption( TABLE_CAP );
936cdf0e10cSrcweir             }
937cdf0e10cSrcweir             if(bDeleteFormat)
938cdf0e10cSrcweir                 delete pTAFmt;
939cdf0e10cSrcweir             delete pAutoFmtTbl;
940cdf0e10cSrcweir         }
941cdf0e10cSrcweir         break;
942cdf0e10cSrcweir         case SID_STYLE_WATERCAN:
943cdf0e10cSrcweir         case SID_STYLE_UPDATE_BY_EXAMPLE:
944cdf0e10cSrcweir         case SID_STYLE_NEW_BY_EXAMPLE:
945cdf0e10cSrcweir         case SID_STYLE_APPLY:
946cdf0e10cSrcweir         {
947cdf0e10cSrcweir             ShellModes eMode = GetView().GetShellMode();
948cdf0e10cSrcweir             if ( SHELL_MODE_DRAW != eMode &&
949cdf0e10cSrcweir                  SHELL_MODE_DRAW_CTRL != eMode &&
950cdf0e10cSrcweir                  SHELL_MODE_DRAW_FORM != eMode &&
951cdf0e10cSrcweir                  SHELL_MODE_DRAWTEXT != eMode &&
952cdf0e10cSrcweir                  SHELL_MODE_BEZIER != eMode )
953cdf0e10cSrcweir             {
954cdf0e10cSrcweir                 // oj #107754#
955cdf0e10cSrcweir                 if ( SID_STYLE_WATERCAN == nSlot )
956cdf0e10cSrcweir                 {
957cdf0e10cSrcweir                     const sal_Bool bLockedView = rSh.IsViewLocked();
958cdf0e10cSrcweir                     rSh.LockView( sal_True );    //lock visible section
959cdf0e10cSrcweir 
960cdf0e10cSrcweir                     GetView().GetDocShell()->ExecStyleSheet(rReq);
961cdf0e10cSrcweir 
962cdf0e10cSrcweir                     rSh.LockView( bLockedView );
963cdf0e10cSrcweir                 }
964cdf0e10cSrcweir                 else
965cdf0e10cSrcweir                 // wird von der DocShell aufgezeichnet
966cdf0e10cSrcweir                     GetView().GetDocShell()->ExecStyleSheet(rReq);
967cdf0e10cSrcweir             }
968cdf0e10cSrcweir         }
969cdf0e10cSrcweir         break;
970cdf0e10cSrcweir         case FN_ESCAPE:
971cdf0e10cSrcweir             GetView().ExecuteSlot(rReq);
972cdf0e10cSrcweir         break;
973cdf0e10cSrcweir         case SID_IMAP:
974cdf0e10cSrcweir         {
975cdf0e10cSrcweir             sal_uInt16      nId = SvxIMapDlgChildWindow::GetChildWindowId();
976cdf0e10cSrcweir 
977cdf0e10cSrcweir             SfxViewFrame* pVFrame = GetView().GetViewFrame();
978cdf0e10cSrcweir             pVFrame->ToggleChildWindow( nId );
979cdf0e10cSrcweir             pVFrame->GetBindings().Invalidate( SID_IMAP );
980cdf0e10cSrcweir 
981cdf0e10cSrcweir             if ( pVFrame->HasChildWindow( nId ) && rSh.IsFrmSelected() )
982cdf0e10cSrcweir                 lcl_UpdateIMapDlg( rSh );
983cdf0e10cSrcweir         }
984cdf0e10cSrcweir         break;
985cdf0e10cSrcweir         case SID_IMAP_EXEC:
986cdf0e10cSrcweir         {
987cdf0e10cSrcweir             SvxIMapDlg* pDlg = SWIMAPDLG(GetView());
988cdf0e10cSrcweir 
989cdf0e10cSrcweir             // Kontrolle, ob Zuweisung ueberhaupt sinnvoll/erlaubt
990cdf0e10cSrcweir             if ( rSh.IsFrmSelected() &&
991cdf0e10cSrcweir                  pDlg->GetEditingObject() == rSh.GetIMapInventor() )
992cdf0e10cSrcweir             {
993cdf0e10cSrcweir                     SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
994cdf0e10cSrcweir                     rSh.GetFlyFrmAttr( aSet );
995cdf0e10cSrcweir                     SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
996cdf0e10cSrcweir                     aURL.SetMap( &pDlg->GetImageMap() );
997cdf0e10cSrcweir                     aSet.Put( aURL );
998cdf0e10cSrcweir                     rSh.SetFlyFrmAttr( aSet );
999cdf0e10cSrcweir             }
1000cdf0e10cSrcweir         }
1001cdf0e10cSrcweir         break;
1002cdf0e10cSrcweir         case SID_CONTOUR_DLG:
1003cdf0e10cSrcweir         {
1004cdf0e10cSrcweir             sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
1005cdf0e10cSrcweir 
1006cdf0e10cSrcweir             SfxViewFrame* pVFrame = GetView().GetViewFrame();
1007cdf0e10cSrcweir             pVFrame->ToggleChildWindow( nId );
1008cdf0e10cSrcweir             pVFrame->GetBindings().Invalidate( SID_CONTOUR_DLG );
1009cdf0e10cSrcweir 
1010cdf0e10cSrcweir             int nSel = rSh.GetSelectionType();
1011cdf0e10cSrcweir             if ( pVFrame->HasChildWindow( nId ) &&
1012cdf0e10cSrcweir                  (nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE)) )
1013cdf0e10cSrcweir             {
1014cdf0e10cSrcweir                 lcl_UpdateContourDlg( rSh, nSel );
1015cdf0e10cSrcweir             }
1016cdf0e10cSrcweir         }
1017cdf0e10cSrcweir         break;
1018cdf0e10cSrcweir         case SID_CONTOUR_EXEC:
1019cdf0e10cSrcweir         {
1020cdf0e10cSrcweir             SvxContourDlg *pDlg = SWCONTOURDLG(GetView());
1021cdf0e10cSrcweir 
1022cdf0e10cSrcweir             // Kontrolle, ob Zuweisung ueberhaupt sinnvoll/erlaubt
1023cdf0e10cSrcweir             int nSel = rSh.GetSelectionType();
1024cdf0e10cSrcweir             if ( nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE) )
1025cdf0e10cSrcweir             {
1026cdf0e10cSrcweir                 if ( pDlg->GetEditingObject() == rSh.GetIMapInventor() )
1027cdf0e10cSrcweir                 {
1028cdf0e10cSrcweir                     rSh.StartAction();
1029cdf0e10cSrcweir                     SfxItemSet aSet( rSh.GetAttrPool(), RES_SURROUND, RES_SURROUND);
1030cdf0e10cSrcweir                     rSh.GetFlyFrmAttr( aSet );
1031cdf0e10cSrcweir                     SwFmtSurround aSur( (SwFmtSurround&)aSet.Get( RES_SURROUND ) );
1032cdf0e10cSrcweir                     if ( !aSur.IsContour() )
1033cdf0e10cSrcweir                     {
1034cdf0e10cSrcweir                         aSur.SetContour( sal_True );
1035cdf0e10cSrcweir                         if ( aSur.GetSurround() == SURROUND_NONE )
1036cdf0e10cSrcweir                             aSur.SetSurround( SURROUND_PARALLEL );
1037cdf0e10cSrcweir                         aSet.Put( aSur );
1038cdf0e10cSrcweir                         rSh.SetFlyFrmAttr( aSet );
1039cdf0e10cSrcweir                     }
1040cdf0e10cSrcweir                     const PolyPolygon aPoly( pDlg->GetPolyPolygon() );
1041cdf0e10cSrcweir                     rSh.SetGraphicPolygon( &aPoly );
1042cdf0e10cSrcweir                     if ( pDlg->IsGraphicChanged() )
1043cdf0e10cSrcweir                         rSh.ReRead( aEmptyStr, aEmptyStr, &pDlg->GetGraphic());
1044cdf0e10cSrcweir                     rSh.EndAction();
1045cdf0e10cSrcweir                 }
1046cdf0e10cSrcweir             }
1047cdf0e10cSrcweir         }
1048cdf0e10cSrcweir         break;
1049cdf0e10cSrcweir         case FN_FRAME_TO_ANCHOR:
1050cdf0e10cSrcweir         {
1051cdf0e10cSrcweir             rSh.GotoFlyAnchor();
1052cdf0e10cSrcweir             rSh.EnterStdMode();
1053cdf0e10cSrcweir             rSh.CallChgLnk();
1054cdf0e10cSrcweir         }
1055cdf0e10cSrcweir         break;
1056cdf0e10cSrcweir         case FN_TOOL_ANKER:
1057cdf0e10cSrcweir             break;
1058cdf0e10cSrcweir         case FN_TOOL_ANKER_PAGE:
1059cdf0e10cSrcweir         case FN_TOOL_ANKER_PARAGRAPH:
1060cdf0e10cSrcweir         case FN_TOOL_ANKER_CHAR:
1061cdf0e10cSrcweir         case FN_TOOL_ANKER_AT_CHAR:
1062cdf0e10cSrcweir         case FN_TOOL_ANKER_FRAME:
1063cdf0e10cSrcweir         {
1064cdf0e10cSrcweir             RndStdIds eSet = nSlot == FN_TOOL_ANKER_PAGE
1065cdf0e10cSrcweir                                 ? FLY_AT_PAGE
1066cdf0e10cSrcweir                                 : nSlot == FN_TOOL_ANKER_PARAGRAPH
1067cdf0e10cSrcweir                                     ? FLY_AT_PARA
1068cdf0e10cSrcweir                                     : nSlot == FN_TOOL_ANKER_FRAME
1069cdf0e10cSrcweir                                         ? FLY_AT_FLY
1070cdf0e10cSrcweir                                         : nSlot == FN_TOOL_ANKER_CHAR
1071cdf0e10cSrcweir                                             ? FLY_AS_CHAR
1072cdf0e10cSrcweir                                             : FLY_AT_CHAR;
1073cdf0e10cSrcweir             rSh.StartUndo();
1074cdf0e10cSrcweir             if( rSh.IsObjSelected() )
1075cdf0e10cSrcweir                 rSh.ChgAnchor( eSet );
1076cdf0e10cSrcweir             else if( rSh.IsFrmSelected() )
1077cdf0e10cSrcweir             {
1078cdf0e10cSrcweir                 // Der Set beinhaltet auch VERT/HORI_ORIENT, da in FEShell::
1079cdf0e10cSrcweir                 // SetFlyFrmAttr/SetFlyFrmAnchor ggf. als Folge des Umankerns
1080cdf0e10cSrcweir                 // die Ausrichtungen veraendert werden sollen.
1081cdf0e10cSrcweir                 SfxItemSet aSet( GetPool(), RES_VERT_ORIENT, RES_ANCHOR );
1082cdf0e10cSrcweir                 SwFmtAnchor aAnc( eSet, rSh.GetPhyPageNum() );
1083cdf0e10cSrcweir                 aSet.Put( aAnc );
1084cdf0e10cSrcweir                 rSh.SetFlyFrmAttr(aSet);
1085cdf0e10cSrcweir             }
1086cdf0e10cSrcweir 
1087cdf0e10cSrcweir             // if new anchor is 'as char' and it is a Math object and the usual
1088cdf0e10cSrcweir             // pre-conditions are met then align the formula to the baseline of the text
1089cdf0e10cSrcweir             const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() );
1090cdf0e10cSrcweir             const bool bDoMathBaselineAlignment = xObj.is() && SotExchange::IsMath( xObj->getClassID() )
1091cdf0e10cSrcweir                     && FLY_AS_CHAR == eSet && rSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT );
1092cdf0e10cSrcweir             if (bDoMathBaselineAlignment)
1093cdf0e10cSrcweir                 rSh.AlignFormulaToBaseline( xObj );
1094cdf0e10cSrcweir 
1095cdf0e10cSrcweir             sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
1096cdf0e10cSrcweir             if( nHtmlMode )
1097cdf0e10cSrcweir             {
1098cdf0e10cSrcweir                 SfxItemSet aSet(GetPool(), RES_SURROUND, RES_HORI_ORIENT);
1099cdf0e10cSrcweir                 rSh.GetFlyFrmAttr(aSet);
1100cdf0e10cSrcweir 
1101cdf0e10cSrcweir                 const SwFmtSurround& rSurround = (const SwFmtSurround&)aSet.Get(RES_SURROUND);
1102cdf0e10cSrcweir                 const SwFmtVertOrient& rVert = (const SwFmtVertOrient&)aSet.Get(RES_VERT_ORIENT);
1103cdf0e10cSrcweir                 const SwFmtHoriOrient& rHori = (const SwFmtHoriOrient&)aSet.Get(RES_HORI_ORIENT);
1104cdf0e10cSrcweir                 sal_Int16 eVOrient = rVert.GetVertOrient();
1105cdf0e10cSrcweir                 sal_Int16 eHOrient = rHori.GetHoriOrient();
1106cdf0e10cSrcweir                 SwSurround eSurround = rSurround.GetSurround();
1107cdf0e10cSrcweir 
1108cdf0e10cSrcweir                 switch( eSet )
1109cdf0e10cSrcweir                 {
1110cdf0e10cSrcweir                 case FLY_AT_FLY:
1111cdf0e10cSrcweir                 case FLY_AT_PAGE:
1112cdf0e10cSrcweir 
1113cdf0e10cSrcweir                     //Durchlauf, links oder von links, oben, von oben
1114cdf0e10cSrcweir                     if(eSurround != SURROUND_THROUGHT)
1115cdf0e10cSrcweir                         aSet.Put(SwFmtSurround(SURROUND_THROUGHT));
1116cdf0e10cSrcweir 
1117cdf0e10cSrcweir                     if( eVOrient != text::VertOrientation::TOP && eVOrient != text::VertOrientation::NONE)
1118cdf0e10cSrcweir                         aSet.Put(SwFmtVertOrient(0, text::VertOrientation::TOP));
1119cdf0e10cSrcweir 
1120cdf0e10cSrcweir                     if(eHOrient != text::HoriOrientation::NONE || eHOrient != text::HoriOrientation::LEFT)
1121cdf0e10cSrcweir                         aSet.Put(SwFmtHoriOrient(0, text::HoriOrientation::LEFT));
1122cdf0e10cSrcweir                     break;
1123cdf0e10cSrcweir 
1124cdf0e10cSrcweir                 case FLY_AT_PARA:
1125cdf0e10cSrcweir                     //links, von links, rechts, oben, kein Uml, li+re Umlauf,
1126cdf0e10cSrcweir                     if(eSurround != SURROUND_LEFT || eSurround != SURROUND_RIGHT)
1127cdf0e10cSrcweir                         aSet.Put(SwFmtSurround(SURROUND_LEFT));
1128cdf0e10cSrcweir 
1129cdf0e10cSrcweir                     if( eVOrient != text::VertOrientation::TOP)
1130cdf0e10cSrcweir                         aSet.Put(SwFmtVertOrient(0, text::VertOrientation::TOP));
1131cdf0e10cSrcweir 
1132cdf0e10cSrcweir                     if(eHOrient != text::HoriOrientation::NONE || eHOrient != text::HoriOrientation::LEFT || eHOrient != text::HoriOrientation::RIGHT)
1133cdf0e10cSrcweir                         aSet.Put(SwFmtHoriOrient(0, text::HoriOrientation::LEFT));
1134cdf0e10cSrcweir                     break;
1135cdf0e10cSrcweir 
1136cdf0e10cSrcweir                 case FLY_AT_CHAR:
1137cdf0e10cSrcweir                     //links, von links, rechts, oben,  Durchlauf
1138cdf0e10cSrcweir                     if(eSurround != SURROUND_THROUGHT)
1139cdf0e10cSrcweir                         aSet.Put(SwFmtSurround(SURROUND_THROUGHT));
1140cdf0e10cSrcweir 
1141cdf0e10cSrcweir                     if( eVOrient != text::VertOrientation::TOP)
1142cdf0e10cSrcweir                         aSet.Put(SwFmtVertOrient(0, text::VertOrientation::TOP));
1143cdf0e10cSrcweir 
1144cdf0e10cSrcweir                     if(eHOrient != text::HoriOrientation::NONE || eHOrient != text::HoriOrientation::LEFT || eHOrient != text::HoriOrientation::RIGHT)
1145cdf0e10cSrcweir                         aSet.Put(SwFmtHoriOrient(0, text::HoriOrientation::LEFT));
1146cdf0e10cSrcweir                     break;
1147cdf0e10cSrcweir 
1148cdf0e10cSrcweir                 default:
1149cdf0e10cSrcweir                     ;
1150cdf0e10cSrcweir                 }
1151cdf0e10cSrcweir 
1152cdf0e10cSrcweir                 if( aSet.Count() )
1153cdf0e10cSrcweir                     rSh.SetFlyFrmAttr( aSet );
1154cdf0e10cSrcweir             }
1155cdf0e10cSrcweir             rSh.EndUndo();
1156cdf0e10cSrcweir 
1157cdf0e10cSrcweir             GetView().GetViewFrame()->GetBindings().Invalidate( FN_TOOL_ANKER );
1158cdf0e10cSrcweir         }
1159cdf0e10cSrcweir         break;
1160cdf0e10cSrcweir 
1161cdf0e10cSrcweir         case FN_FRAME_NOWRAP:
1162cdf0e10cSrcweir         case FN_FRAME_WRAP:
1163cdf0e10cSrcweir         case FN_FRAME_WRAP_IDEAL:
1164cdf0e10cSrcweir         case FN_FRAME_WRAPTHRU:
1165cdf0e10cSrcweir         case FN_FRAME_WRAPTHRU_TRANSP:
1166cdf0e10cSrcweir         case FN_FRAME_WRAP_CONTOUR:
1167cdf0e10cSrcweir         case FN_WRAP_ANCHOR_ONLY:
1168cdf0e10cSrcweir         case FN_FRAME_WRAP_LEFT:
1169cdf0e10cSrcweir         case FN_FRAME_WRAP_RIGHT:
1170cdf0e10cSrcweir             SetWrapMode( nSlot );
1171cdf0e10cSrcweir             break;
1172cdf0e10cSrcweir 
1173cdf0e10cSrcweir         case FN_UPDATE_ALL_LINKS:
1174cdf0e10cSrcweir             {
1175cdf0e10cSrcweir                 if( rSh.GetLinkManager().GetLinks().Count() )
1176cdf0e10cSrcweir                 {
1177cdf0e10cSrcweir                     sal_Bool bUpdateGrf = sal_False, bCallErrHdl = sal_False;
1178cdf0e10cSrcweir                     rSh.EnterStdMode();
1179cdf0e10cSrcweir                     rSh.StartAllAction();
1180cdf0e10cSrcweir                     rSh.GetLinkManager().UpdateAllLinks( sal_False, bCallErrHdl, bUpdateGrf );
1181cdf0e10cSrcweir                     rSh.EndAllAction();
1182cdf0e10cSrcweir                 }
1183cdf0e10cSrcweir             }
1184cdf0e10cSrcweir             break;
1185cdf0e10cSrcweir 
1186cdf0e10cSrcweir         case FN_XFORMS_DESIGN_MODE:
1187cdf0e10cSrcweir             if( pArgs != NULL
1188cdf0e10cSrcweir                 && pArgs->GetItemState( nSlot, sal_True, &pItem ) == SFX_ITEM_SET
1189cdf0e10cSrcweir                 && pItem != NULL
1190cdf0e10cSrcweir                 && pItem->ISA( SfxBoolItem ) )
1191cdf0e10cSrcweir             {
1192cdf0e10cSrcweir                 sal_Bool bDesignMode =
1193cdf0e10cSrcweir                     static_cast<const SfxBoolItem*>( pItem )->GetValue();
1194cdf0e10cSrcweir 
1195cdf0e10cSrcweir                 // set form design mode
1196cdf0e10cSrcweir                 DBG_ASSERT( GetView().GetFormShell() != NULL, "form shell?" );
1197cdf0e10cSrcweir                 SfxRequest aReq( GetView().GetViewFrame(), SID_FM_DESIGN_MODE );
1198cdf0e10cSrcweir                 aReq.AppendItem( SfxBoolItem( SID_FM_DESIGN_MODE, bDesignMode ) );
1199cdf0e10cSrcweir                 GetView().GetFormShell()->Execute( aReq );
1200cdf0e10cSrcweir                 aReq.Done();
1201cdf0e10cSrcweir 
1202cdf0e10cSrcweir                 // also set suitable view options
1203cdf0e10cSrcweir                 SwViewOption aViewOption = *rSh.GetViewOptions();
1204cdf0e10cSrcweir                 aViewOption.SetFormView( ! bDesignMode );
1205cdf0e10cSrcweir                 rSh.ApplyViewOptions( aViewOption );
1206cdf0e10cSrcweir             }
1207cdf0e10cSrcweir             break;
1208cdf0e10cSrcweir 
1209cdf0e10cSrcweir         default:
1210cdf0e10cSrcweir             bMore = sal_True;
1211cdf0e10cSrcweir     }
1212cdf0e10cSrcweir     if(bMore && pArgs)
1213cdf0e10cSrcweir     {
1214cdf0e10cSrcweir         pItem = 0;
1215cdf0e10cSrcweir         pArgs->GetItemState(GetPool().GetWhich(nSlot), sal_False, &pItem);
1216cdf0e10cSrcweir         if(pItem)
1217cdf0e10cSrcweir         switch(nSlot)
1218cdf0e10cSrcweir         {
1219cdf0e10cSrcweir         case SID_ATTR_BRUSH:
1220cdf0e10cSrcweir         case SID_ATTR_BORDER_SHADOW:
1221cdf0e10cSrcweir         case RES_SHADOW:
1222cdf0e10cSrcweir         {
1223cdf0e10cSrcweir             rSh.StartAllAction();
1224cdf0e10cSrcweir             SfxItemSet   aSet( rSh.GetAttrPool(),
1225cdf0e10cSrcweir                                 RES_SHADOW, RES_SHADOW,
1226cdf0e10cSrcweir                                 RES_BACKGROUND, RES_BACKGROUND, 0 );
1227cdf0e10cSrcweir 
1228cdf0e10cSrcweir             aSet.Put(*pItem);
1229cdf0e10cSrcweir             // Tabellenzelle(n) selektiert?
1230cdf0e10cSrcweir             if ( rSh.IsTableMode() )
1231cdf0e10cSrcweir             {
1232cdf0e10cSrcweir                 SwFrmFmt *pFmt = rSh.GetTableFmt();
1233cdf0e10cSrcweir                 pFmt->SetFmtAttr( *pItem );
1234cdf0e10cSrcweir             }
1235cdf0e10cSrcweir             else if ( rSh.IsFrmSelected() )
1236cdf0e10cSrcweir             {
1237cdf0e10cSrcweir                 // Umrandungsattribute ueber Frame-Manager setzen
1238cdf0e10cSrcweir                 SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
1239cdf0e10cSrcweir                 aMgr.SetAttrSet( *pArgs );
1240cdf0e10cSrcweir                 aMgr.UpdateFlyFrm();
1241cdf0e10cSrcweir             }
1242cdf0e10cSrcweir             else
1243cdf0e10cSrcweir             {
124469a74367SOliver-Rainer Wittmann                 rSh.SetAttrSet( *pArgs );
1245cdf0e10cSrcweir             }
1246cdf0e10cSrcweir             rSh.EndAllAction();
1247cdf0e10cSrcweir         }
1248cdf0e10cSrcweir         break;
1249cdf0e10cSrcweir         case FN_PAGE_STYLE_SET_LR_MARGIN:
1250cdf0e10cSrcweir         case FN_PAGE_STYLE_SET_UL_MARGIN:
1251cdf0e10cSrcweir         case FN_PAGE_STYLE_SET_NUMBER_FORMAT:
1252cdf0e10cSrcweir         case FN_PAGE_STYLE_SET_PAPER_SIZE:
1253cdf0e10cSrcweir         case FN_PAGE_STYLE_SET_PAPER_BIN:
1254cdf0e10cSrcweir         {
1255cdf0e10cSrcweir             DBG_ERROR("not implemented");
1256cdf0e10cSrcweir         }
1257cdf0e10cSrcweir         break;
1258cdf0e10cSrcweir 
1259cdf0e10cSrcweir         case SID_ATTR_BORDER_OUTER:
1260cdf0e10cSrcweir         {
1261cdf0e10cSrcweir             // Tabellenzelle(n) selektiert?
1262cdf0e10cSrcweir             if ( rSh.IsTableMode() )
1263cdf0e10cSrcweir             {
1264cdf0e10cSrcweir                 // Umrandungattribute Get/SetTabBorders() setzen
1265cdf0e10cSrcweir                 rSh.SetTabBorders(*pArgs);
1266cdf0e10cSrcweir             }
1267cdf0e10cSrcweir             else if ( rSh.IsFrmSelected() )
1268cdf0e10cSrcweir             {
1269cdf0e10cSrcweir                 // Umrandungsattribute ueber Frame-Manager setzen
1270cdf0e10cSrcweir                 SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
1271cdf0e10cSrcweir                 aMgr.SetAttrSet(*pArgs);
1272cdf0e10cSrcweir                 aMgr.UpdateFlyFrm();
1273cdf0e10cSrcweir             }
1274cdf0e10cSrcweir             else
1275cdf0e10cSrcweir             {
1276cdf0e10cSrcweir                 // Umrandungsattribute ganz normal ueber Shell setzen
127769a74367SOliver-Rainer Wittmann                 rSh.SetAttrItem( *pItem );
1278cdf0e10cSrcweir             }
1279cdf0e10cSrcweir         }
1280cdf0e10cSrcweir         break;
1281cdf0e10cSrcweir         default:
1282cdf0e10cSrcweir                 DBG_ERROR("falscher Dispatcher");
1283cdf0e10cSrcweir         }
1284cdf0e10cSrcweir 
1285cdf0e10cSrcweir     }
1286cdf0e10cSrcweir }
1287cdf0e10cSrcweir 
1288cdf0e10cSrcweir /* -----------------14.04.99 15:10-------------------
1289cdf0e10cSrcweir  * Hier wird der State fuer SID_IMAP / SID_CONTOUR behandelt,
1290cdf0e10cSrcweir  * wenn die Grafik ausgeswappt ist
1291cdf0e10cSrcweir  * --------------------------------------------------*/
1292cdf0e10cSrcweir IMPL_LINK(SwBaseShell, GraphicArrivedHdl, SwCrsrShell* , EMPTYARG )
1293cdf0e10cSrcweir {
1294cdf0e10cSrcweir     sal_uInt16 nGrfType;
1295cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
1296cdf0e10cSrcweir     if( CNT_GRF == rSh.SwEditShell::GetCntType() &&
1297cdf0e10cSrcweir         GRAPHIC_NONE != ( nGrfType = rSh.GetGraphicType() ) &&
1298cdf0e10cSrcweir         aGrfUpdateSlots.Count() )
1299cdf0e10cSrcweir     {
1300cdf0e10cSrcweir         sal_Bool bProtect = 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT);
1301cdf0e10cSrcweir         SfxViewFrame* pVFrame = GetView().GetViewFrame();
1302cdf0e10cSrcweir         sal_uInt16 nSlot;
1303cdf0e10cSrcweir         for( sal_uInt16 n = 0; n < aGrfUpdateSlots.Count(); ++n )
1304cdf0e10cSrcweir         {
1305cdf0e10cSrcweir             sal_Bool bSetState = sal_False;
1306cdf0e10cSrcweir             sal_Bool bState = sal_False;
1307cdf0e10cSrcweir             switch( nSlot = aGrfUpdateSlots[ n ] )
1308cdf0e10cSrcweir             {
1309cdf0e10cSrcweir             case SID_IMAP:
1310cdf0e10cSrcweir             case SID_IMAP_EXEC:
1311cdf0e10cSrcweir                 {
1312cdf0e10cSrcweir                     sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
1313cdf0e10cSrcweir                     SvxIMapDlg *pDlg = pVFrame->HasChildWindow( nId ) ?
1314cdf0e10cSrcweir                         (SvxIMapDlg*) ( pVFrame->GetChildWindow( nId )
1315cdf0e10cSrcweir                                             ->GetWindow()) : 0;
1316cdf0e10cSrcweir 
1317cdf0e10cSrcweir                     if( pDlg && ( SID_IMAP_EXEC == nSlot ||
1318cdf0e10cSrcweir                                 ( SID_IMAP == nSlot && !bProtect)) &&
1319cdf0e10cSrcweir                         pDlg->GetEditingObject() != rSh.GetIMapInventor())
1320cdf0e10cSrcweir                             lcl_UpdateIMapDlg( rSh );
1321cdf0e10cSrcweir 
1322cdf0e10cSrcweir                     if( !bProtect && SID_IMAP == nSlot )
1323cdf0e10cSrcweir                         bSetState = sal_True, bState = 0 != pDlg;
1324cdf0e10cSrcweir                 }
1325cdf0e10cSrcweir                 break;
1326cdf0e10cSrcweir 
1327cdf0e10cSrcweir             case SID_CONTOUR_DLG:
1328cdf0e10cSrcweir                 if( !bProtect )
1329cdf0e10cSrcweir                 {
1330cdf0e10cSrcweir                     sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
1331cdf0e10cSrcweir                     SvxIMapDlg *pDlg = pVFrame->HasChildWindow( nId ) ?
1332cdf0e10cSrcweir                         (SvxIMapDlg*) ( pVFrame->GetChildWindow( nId )
1333cdf0e10cSrcweir                                             ->GetWindow()) : 0;
1334cdf0e10cSrcweir                     if( pDlg && pDlg->GetEditingObject() !=
1335cdf0e10cSrcweir                                 rSh.GetIMapInventor() )
1336cdf0e10cSrcweir                         lcl_UpdateContourDlg( rSh, nsSelectionType::SEL_GRF );
1337cdf0e10cSrcweir 
1338cdf0e10cSrcweir                     bSetState = sal_True;
1339cdf0e10cSrcweir                     bState = 0 != pDlg;
1340cdf0e10cSrcweir                 }
1341cdf0e10cSrcweir                 break;
1342cdf0e10cSrcweir 
1343cdf0e10cSrcweir             case FN_FRAME_WRAP_CONTOUR:
1344cdf0e10cSrcweir                 if( !bProtect )
1345cdf0e10cSrcweir                 {
1346cdf0e10cSrcweir                     SfxItemSet aSet(GetPool(), RES_SURROUND, RES_SURROUND);
1347cdf0e10cSrcweir                     rSh.GetFlyFrmAttr(aSet);
1348cdf0e10cSrcweir                     const SwFmtSurround& rWrap = (const SwFmtSurround&)aSet.Get(RES_SURROUND);
1349cdf0e10cSrcweir                     bSetState = sal_True;
1350cdf0e10cSrcweir                     bState = rWrap.IsContour();
1351cdf0e10cSrcweir                 }
1352cdf0e10cSrcweir                 break;
1353cdf0e10cSrcweir 
1354cdf0e10cSrcweir             case SID_GRFFILTER:
1355cdf0e10cSrcweir             case SID_GRFFILTER_INVERT:
1356cdf0e10cSrcweir             case SID_GRFFILTER_SMOOTH:
1357cdf0e10cSrcweir             case SID_GRFFILTER_SHARPEN:
1358cdf0e10cSrcweir             case SID_GRFFILTER_REMOVENOISE:
1359cdf0e10cSrcweir             case SID_GRFFILTER_SOBEL:
1360cdf0e10cSrcweir             case SID_GRFFILTER_MOSAIC:
1361cdf0e10cSrcweir             case SID_GRFFILTER_EMBOSS:
1362cdf0e10cSrcweir             case SID_GRFFILTER_POSTER:
1363cdf0e10cSrcweir             case SID_GRFFILTER_POPART:
1364cdf0e10cSrcweir             case SID_GRFFILTER_SEPIA:
1365cdf0e10cSrcweir             case SID_GRFFILTER_SOLARIZE:
1366cdf0e10cSrcweir                 bSetState = bState = GRAPHIC_BITMAP == nGrfType;
1367cdf0e10cSrcweir                 break;
1368cdf0e10cSrcweir             }
1369cdf0e10cSrcweir 
1370cdf0e10cSrcweir             if( bSetState )
1371cdf0e10cSrcweir             {
1372cdf0e10cSrcweir                 SfxBoolItem aBool( nSlot, bState );
1373cdf0e10cSrcweir                 if( pGetStateSet )
1374cdf0e10cSrcweir                     pGetStateSet->Put( aBool );
1375cdf0e10cSrcweir                 else
1376cdf0e10cSrcweir                     pVFrame->GetBindings().SetState( aBool );
1377cdf0e10cSrcweir             }
1378cdf0e10cSrcweir         }
1379cdf0e10cSrcweir         aGrfUpdateSlots.RemoveAt( 0, aGrfUpdateSlots.Count() );
1380cdf0e10cSrcweir     }
1381cdf0e10cSrcweir     return 0;
1382cdf0e10cSrcweir }
1383cdf0e10cSrcweir 
1384cdf0e10cSrcweir void SwBaseShell::GetState( SfxItemSet &rSet )
1385cdf0e10cSrcweir {
1386cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
1387cdf0e10cSrcweir     SfxViewFrame* pVFrame = GetView().GetViewFrame();
1388cdf0e10cSrcweir     SfxWhichIter aIter( rSet );
1389cdf0e10cSrcweir     sal_uInt16 nWhich = aIter.FirstWhich();
1390cdf0e10cSrcweir     pGetStateSet = &rSet;
1391cdf0e10cSrcweir     while ( nWhich )
1392cdf0e10cSrcweir     {
1393cdf0e10cSrcweir         switch ( nWhich )
1394cdf0e10cSrcweir         {
1395cdf0e10cSrcweir             case SID_GALLERY_FORMATS:
1396cdf0e10cSrcweir                 if ( rSh.IsObjSelected() ||
1397cdf0e10cSrcweir                      (rSh.IsSelFrmMode() &&
1398cdf0e10cSrcweir                       !(rSh.GetSelectionType() & nsSelectionType::SEL_GRF)) )
1399cdf0e10cSrcweir                     rSet.DisableItem( nWhich );
1400cdf0e10cSrcweir                 break;
1401cdf0e10cSrcweir             case SID_GALLERY_ENABLE_ADDCOPY:
1402cdf0e10cSrcweir                 // #108230# allow copy from gallery in Writer AND Writer/Web!
1403cdf0e10cSrcweir                 rSet.Put( SfxBoolItem( SID_GALLERY_ENABLE_ADDCOPY, sal_True ) );
1404cdf0e10cSrcweir                 break;
1405cdf0e10cSrcweir             case FN_EDIT_REGION:
1406cdf0e10cSrcweir                 if( !rSh.IsAnySectionInDoc() )
1407cdf0e10cSrcweir                     rSet.DisableItem(nWhich);
1408cdf0e10cSrcweir                 break;
1409cdf0e10cSrcweir 
1410cdf0e10cSrcweir             case FN_INSERT_REGION:
141169a74367SOliver-Rainer Wittmann                 if( rSh.CrsrInsideInputFld()
141269a74367SOliver-Rainer Wittmann                     || rSh.IsSelFrmMode()
141369a74367SOliver-Rainer Wittmann                     || !rSh.IsInsRegionAvailable() )
141469a74367SOliver-Rainer Wittmann                 {
1415cdf0e10cSrcweir                     rSet.DisableItem( nWhich );
141669a74367SOliver-Rainer Wittmann                 }
1417cdf0e10cSrcweir                 break;
141869a74367SOliver-Rainer Wittmann 
1419cdf0e10cSrcweir             case FN_CONVERT_TABLE_TO_TEXT:
1420cdf0e10cSrcweir             {
1421cdf0e10cSrcweir                 sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_True);
1422cdf0e10cSrcweir                 if( (eFrmType & FRMTYPE_FOOTNOTE) ||
1423cdf0e10cSrcweir                     !rSh.GetTableFmt() )
1424cdf0e10cSrcweir                     rSet.DisableItem( nWhich );
1425cdf0e10cSrcweir             }
1426cdf0e10cSrcweir             break;
1427cdf0e10cSrcweir             case FN_CONVERT_TEXT_TO_TABLE:
1428cdf0e10cSrcweir             {
1429cdf0e10cSrcweir                 sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_True);
1430cdf0e10cSrcweir                 if( (eFrmType & FRMTYPE_FOOTNOTE) ||
1431cdf0e10cSrcweir                     !rSh.IsTextToTableAvailable()  )
1432cdf0e10cSrcweir                     rSet.DisableItem( nWhich );
1433cdf0e10cSrcweir             }
1434cdf0e10cSrcweir             break;
1435cdf0e10cSrcweir             case FN_CONVERT_TEXT_TABLE:
1436cdf0e10cSrcweir             {
1437cdf0e10cSrcweir                 sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_True);
1438cdf0e10cSrcweir                 if( (eFrmType & FRMTYPE_FOOTNOTE) ||
1439cdf0e10cSrcweir                     (!rSh.GetTableFmt() && !rSh.IsTextToTableAvailable() ) )
1440cdf0e10cSrcweir                     rSet.DisableItem( nWhich );
1441cdf0e10cSrcweir             }
1442cdf0e10cSrcweir             break;
1443cdf0e10cSrcweir             case RES_SHADOW:
1444cdf0e10cSrcweir             {
1445cdf0e10cSrcweir                 SfxItemSet   aSet( rSh.GetAttrPool(),
1446cdf0e10cSrcweir                                     RES_SHADOW, RES_SHADOW );
1447cdf0e10cSrcweir 
1448cdf0e10cSrcweir                 // Tabellenzelle(n) selektiert?
1449cdf0e10cSrcweir                 if ( rSh.IsTableMode() )
1450cdf0e10cSrcweir                 {
1451cdf0e10cSrcweir                     SwFrmFmt *pFmt = rSh.GetTableFmt();
1452cdf0e10cSrcweir                     aSet.Put(pFmt->GetFmtAttr( nWhich, sal_True ));
1453cdf0e10cSrcweir                 }
1454cdf0e10cSrcweir                 else if( rSh.IsFrmSelected() )
1455cdf0e10cSrcweir                 {
1456cdf0e10cSrcweir                     SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
1457cdf0e10cSrcweir                     aSet.Put( aMgr.GetAttrSet() );
1458cdf0e10cSrcweir                 }
1459cdf0e10cSrcweir                 else
1460cdf0e10cSrcweir                     rSh.GetCurAttr( aSet );
1461cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
1462cdf0e10cSrcweir 
1463cdf0e10cSrcweir                 const SvxShadowItem& rShItem = (const SvxShadowItem&)aSet.Get(nWhich);
1464cdf0e10cSrcweir                 rSet.Put(rShItem);
1465cdf0e10cSrcweir #else
1466cdf0e10cSrcweir                 rSet.Put((const SvxShadowItem&)aSet.Get(nWhich));
1467cdf0e10cSrcweir #endif
1468cdf0e10cSrcweir             }
1469cdf0e10cSrcweir             break;
1470cdf0e10cSrcweir             case SID_IMAP:
1471cdf0e10cSrcweir             {
1472cdf0e10cSrcweir                 // --> OD 2006-11-08 #i59688#
1473cdf0e10cSrcweir                 // improve efficiency:
1474cdf0e10cSrcweir                 // If selected object is protected, item has to disabled.
1475cdf0e10cSrcweir                 const sal_Bool bProtect = 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT);
1476cdf0e10cSrcweir                 if ( bProtect )
1477cdf0e10cSrcweir                 {
1478cdf0e10cSrcweir                     rSet.DisableItem( nWhich );
1479cdf0e10cSrcweir                 }
1480cdf0e10cSrcweir                 else
1481cdf0e10cSrcweir                 {
1482cdf0e10cSrcweir                     const sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
1483cdf0e10cSrcweir                     const sal_Bool bHas = pVFrame->HasChildWindow( nId );
1484cdf0e10cSrcweir                     const sal_Bool bFrmSel = rSh.IsFrmSelected();
1485cdf0e10cSrcweir                     const sal_Bool bIsGraphicSelection =
1486cdf0e10cSrcweir                                 rSh.GetSelectionType() == nsSelectionType::SEL_GRF;
1487cdf0e10cSrcweir 
1488cdf0e10cSrcweir                     // --> OD 2006-11-08 #i59688#
1489cdf0e10cSrcweir                     // avoid unnecessary loading of selected graphic.
1490cdf0e10cSrcweir                     // The graphic is only needed, if the dialog is open.
1491cdf0e10cSrcweir                     //wenn die Grafik ausgeswappt ist, dann muss der
1492cdf0e10cSrcweir                     //Status asynchron ermittelt werden
1493cdf0e10cSrcweir                     //bis dahin wird der Slot disabled
1494cdf0e10cSrcweir                     if ( bHas && bIsGraphicSelection && rSh.IsGrfSwapOut( sal_True ) )
1495cdf0e10cSrcweir                     {
1496cdf0e10cSrcweir                         if( AddGrfUpdateSlot( nWhich ))
1497cdf0e10cSrcweir                             rSh.GetGraphic(sal_False);  // start the loading
1498cdf0e10cSrcweir                     }
1499cdf0e10cSrcweir                     else
1500cdf0e10cSrcweir                     {
1501cdf0e10cSrcweir                         if ( !bHas &&
1502cdf0e10cSrcweir                              ( !bFrmSel ||
1503cdf0e10cSrcweir                                ( bIsGraphicSelection &&
1504cdf0e10cSrcweir                                  rSh.GetGraphicType() == GRAPHIC_NONE ) ) )
1505cdf0e10cSrcweir                         {
1506cdf0e10cSrcweir                             rSet.DisableItem( nWhich );
1507cdf0e10cSrcweir                         }
1508cdf0e10cSrcweir                         else
1509cdf0e10cSrcweir                         {
1510cdf0e10cSrcweir                             SfxBoolItem aBool(nWhich, bHas);
1511cdf0e10cSrcweir                             if ( bHas && bFrmSel )
1512cdf0e10cSrcweir                                 lcl_UpdateIMapDlg( rSh );
1513cdf0e10cSrcweir                             rSet.Put(aBool);
1514cdf0e10cSrcweir                         }
1515cdf0e10cSrcweir                     }
1516cdf0e10cSrcweir                     // <--
1517cdf0e10cSrcweir                 }
1518cdf0e10cSrcweir                 // <--
1519cdf0e10cSrcweir             }
1520cdf0e10cSrcweir             break;
1521cdf0e10cSrcweir             case SID_IMAP_EXEC:
1522cdf0e10cSrcweir             {
1523cdf0e10cSrcweir                 sal_Bool bDisable = sal_False;
1524cdf0e10cSrcweir                 if( !rSh.IsFrmSelected())
1525cdf0e10cSrcweir                     bDisable = sal_True;
1526cdf0e10cSrcweir                 sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
1527cdf0e10cSrcweir                 if(!bDisable && pVFrame->HasChildWindow( nId ))
1528cdf0e10cSrcweir                 {
1529cdf0e10cSrcweir                     if(rSh.GetSelectionType() == nsSelectionType::SEL_GRF
1530cdf0e10cSrcweir                                     && rSh.IsGrfSwapOut(sal_True))
1531cdf0e10cSrcweir                     {
1532cdf0e10cSrcweir                         if( AddGrfUpdateSlot( nWhich ))
1533cdf0e10cSrcweir                             rSh.GetGraphic(sal_False);  // start the loading
1534cdf0e10cSrcweir                     }
1535cdf0e10cSrcweir                     else
1536cdf0e10cSrcweir                     {
1537cdf0e10cSrcweir                         SvxIMapDlg *pDlg = SWIMAPDLG(GetView());
1538cdf0e10cSrcweir                         if( pDlg->GetEditingObject() != rSh.GetIMapInventor() )
1539cdf0e10cSrcweir                             lcl_UpdateIMapDlg( rSh );
1540cdf0e10cSrcweir                     }
1541cdf0e10cSrcweir                 }
1542cdf0e10cSrcweir                 rSet.Put(SfxBoolItem(nWhich, bDisable));
1543cdf0e10cSrcweir             }
1544cdf0e10cSrcweir             break;
154523d8f725SOliver-Rainer Wittmann 
1546cdf0e10cSrcweir             case FN_BACKSPACE:
1547cdf0e10cSrcweir             case SID_DELETE:
154823d8f725SOliver-Rainer Wittmann                 if ( ( rSh.HasReadonlySel() && !rSh.CrsrInsideInputFld() )
154923d8f725SOliver-Rainer Wittmann                      || rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0 )
155023d8f725SOliver-Rainer Wittmann                 {
1551cdf0e10cSrcweir                     rSet.DisableItem( nWhich );
155223d8f725SOliver-Rainer Wittmann                 }
1553cdf0e10cSrcweir                 break;
155423d8f725SOliver-Rainer Wittmann 
1555cdf0e10cSrcweir             case SID_CONTOUR_DLG:
1556cdf0e10cSrcweir             {
1557cdf0e10cSrcweir                 sal_Bool bParentCntProt = 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT );
1558cdf0e10cSrcweir 
1559cdf0e10cSrcweir                 if( bParentCntProt || 0 != (HTMLMODE_ON & ::GetHtmlMode(
1560cdf0e10cSrcweir                                             GetView().GetDocShell() )) )
1561cdf0e10cSrcweir                     rSet.DisableItem( nWhich );
1562cdf0e10cSrcweir                 else
1563cdf0e10cSrcweir                 {
1564cdf0e10cSrcweir                     sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
1565cdf0e10cSrcweir                     sal_Bool bHas = GetView().GetViewFrame()->HasChildWindow( nId );
1566cdf0e10cSrcweir                     int nSel = rSh.GetSelectionType();
1567cdf0e10cSrcweir                     sal_Bool bOk = 0 != (nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE));
1568cdf0e10cSrcweir 
1569cdf0e10cSrcweir                     sal_Bool bDisable = sal_False;
1570cdf0e10cSrcweir                     if( !bHas && !bOk )
1571cdf0e10cSrcweir                         bDisable = sal_True;
1572cdf0e10cSrcweir                     // --> OD 2006-11-08 #i59688#
1573cdf0e10cSrcweir                     // avoid unnecessary loading of selected graphic.
1574cdf0e10cSrcweir                     // The graphic is only needed, if the dialog is open.
1575cdf0e10cSrcweir                     // wenn die Grafik ausgeswappt ist, dann muss der Status
1576cdf0e10cSrcweir                     // asynchron ermittelt werden bis dahin wird der Slot
1577cdf0e10cSrcweir                     // disabled
1578cdf0e10cSrcweir                     else if ( bHas && (nSel & nsSelectionType::SEL_GRF) &&
1579cdf0e10cSrcweir                               rSh.IsGrfSwapOut(sal_True) )
1580cdf0e10cSrcweir                     {
1581cdf0e10cSrcweir                         if( AddGrfUpdateSlot( nWhich ))
1582cdf0e10cSrcweir                             rSh.GetGraphic(sal_False);  // start the loading
1583cdf0e10cSrcweir                         // --> OD 2007-07-04 #i75481#
1584cdf0e10cSrcweir                         bDisable = sal_True;
1585cdf0e10cSrcweir                         // <--
1586cdf0e10cSrcweir                     }
1587cdf0e10cSrcweir                     else if( bHas && bOk )
1588cdf0e10cSrcweir                         bDisable = !lcl_UpdateContourDlg( rSh, nSel );
1589cdf0e10cSrcweir                     else if( bOk )
1590cdf0e10cSrcweir                     {
1591cdf0e10cSrcweir                         // --> OD 2007-07-04 #i75481#
1592cdf0e10cSrcweir                         // apply fix #i59688# only for selected graphics
1593cdf0e10cSrcweir                         if ( nSel & nsSelectionType::SEL_GRF )
1594cdf0e10cSrcweir                             bDisable = GRAPHIC_NONE == rSh.GetGraphicType();
1595cdf0e10cSrcweir                         else
1596cdf0e10cSrcweir                             bDisable = GRAPHIC_NONE == rSh.GetIMapGraphic().GetType();
1597cdf0e10cSrcweir                         // <--
1598cdf0e10cSrcweir                     }
1599cdf0e10cSrcweir                     // <--
1600cdf0e10cSrcweir 
1601cdf0e10cSrcweir                     if( bDisable )
1602cdf0e10cSrcweir                         rSet.DisableItem( nWhich );
1603cdf0e10cSrcweir                     else
1604cdf0e10cSrcweir                         rSet.Put( SfxBoolItem(nWhich, bHas) );
1605cdf0e10cSrcweir                 }
1606cdf0e10cSrcweir             }
1607cdf0e10cSrcweir             break;
1608cdf0e10cSrcweir             case SID_CONTOUR_EXEC:
1609cdf0e10cSrcweir             {
1610cdf0e10cSrcweir                 sal_Bool bDisable = sal_False;
1611cdf0e10cSrcweir                 int nSel = rSh.GetSelectionType();
1612cdf0e10cSrcweir                 if( !(nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE)) )
1613cdf0e10cSrcweir                     bDisable = sal_True;
1614cdf0e10cSrcweir                 sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
1615cdf0e10cSrcweir                 if( !bDisable && GetView().GetViewFrame()->HasChildWindow( nId ))
1616cdf0e10cSrcweir                 {
1617cdf0e10cSrcweir                     SvxContourDlg *pDlg = SWCONTOURDLG(GetView());
1618cdf0e10cSrcweir                     if( pDlg->GetEditingObject() != rSh.GetIMapInventor() )
1619cdf0e10cSrcweir                         bDisable = sal_True;
1620cdf0e10cSrcweir                 }
1621cdf0e10cSrcweir                 rSet.Put(SfxBoolItem(nWhich, bDisable));
1622cdf0e10cSrcweir             }
1623cdf0e10cSrcweir             break;
1624cdf0e10cSrcweir 
1625cdf0e10cSrcweir             case FN_TOOL_ANKER:
1626cdf0e10cSrcweir             case FN_TOOL_ANKER_PAGE:
1627cdf0e10cSrcweir             case FN_TOOL_ANKER_PARAGRAPH:
1628cdf0e10cSrcweir             case FN_TOOL_ANKER_CHAR:
1629cdf0e10cSrcweir             case FN_TOOL_ANKER_AT_CHAR:
1630cdf0e10cSrcweir             case FN_TOOL_ANKER_FRAME:
1631cdf0e10cSrcweir             {
1632cdf0e10cSrcweir                 sal_Bool bObj = 0 != rSh.IsObjSelected();
1633cdf0e10cSrcweir                 sal_Bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
1634cdf0e10cSrcweir 
1635cdf0e10cSrcweir                 if( !bParentCntProt && (bObj || rSh.IsFrmSelected()))
1636cdf0e10cSrcweir                 {
1637cdf0e10cSrcweir                     SfxItemSet aSet(GetPool(), RES_ANCHOR, RES_ANCHOR);
1638cdf0e10cSrcweir                     if(bObj)
1639cdf0e10cSrcweir                         rSh.GetObjAttr(aSet);
1640cdf0e10cSrcweir                     else
1641cdf0e10cSrcweir                         rSh.GetFlyFrmAttr(aSet);
1642cdf0e10cSrcweir                     RndStdIds eSet = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId();
1643cdf0e10cSrcweir                     const sal_Bool bSet =
1644cdf0e10cSrcweir                            ((nWhich == FN_TOOL_ANKER_PAGE) &&
1645cdf0e10cSrcweir                             (eSet == FLY_AT_PAGE))
1646cdf0e10cSrcweir                         || ((nWhich == FN_TOOL_ANKER_PARAGRAPH) &&
1647cdf0e10cSrcweir                             (eSet == FLY_AT_PARA))
1648cdf0e10cSrcweir                         || ((nWhich == FN_TOOL_ANKER_FRAME) &&
1649cdf0e10cSrcweir                             (eSet == FLY_AT_FLY))
1650cdf0e10cSrcweir                         || ((nWhich == FN_TOOL_ANKER_AT_CHAR) &&
1651cdf0e10cSrcweir                             (eSet == FLY_AT_CHAR))
1652cdf0e10cSrcweir                         || ((nWhich == FN_TOOL_ANKER_CHAR) &&
1653cdf0e10cSrcweir                             (eSet == FLY_AS_CHAR));
1654cdf0e10cSrcweir                     if(nWhich != FN_TOOL_ANKER)
1655cdf0e10cSrcweir                     {
1656cdf0e10cSrcweir                         sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
1657cdf0e10cSrcweir                         if( ( nWhich == FN_TOOL_ANKER_PAGE &&
1658cdf0e10cSrcweir                               ((HTMLMODE_ON & nHtmlMode) && (0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS)))) ||
1659cdf0e10cSrcweir                             ( nWhich == FN_TOOL_ANKER_FRAME && !rSh.IsFlyInFly() ) )
1660cdf0e10cSrcweir                             rSet.DisableItem(nWhich);
1661cdf0e10cSrcweir                         else
1662cdf0e10cSrcweir                             rSet.Put(SfxBoolItem(nWhich, bSet));
1663cdf0e10cSrcweir                     }
1664cdf0e10cSrcweir                     else
1665cdf0e10cSrcweir                     {
1666cdf0e10cSrcweir                         sal_uInt16 nSlotId = 0;
1667cdf0e10cSrcweir 
1668cdf0e10cSrcweir                         switch (eSet)
1669cdf0e10cSrcweir                         {
1670cdf0e10cSrcweir                             case FLY_AT_PAGE:
1671cdf0e10cSrcweir                                 nSlotId = FN_TOOL_ANKER_PAGE;
1672cdf0e10cSrcweir                             break;
1673cdf0e10cSrcweir                             case FLY_AT_PARA:
1674cdf0e10cSrcweir                                 nSlotId = FN_TOOL_ANKER_PARAGRAPH;
1675cdf0e10cSrcweir                             break;
1676cdf0e10cSrcweir                             case FLY_AS_CHAR:
1677cdf0e10cSrcweir                                 nSlotId = FN_TOOL_ANKER_CHAR;
1678cdf0e10cSrcweir                             break;
1679cdf0e10cSrcweir                             case FLY_AT_CHAR:
1680cdf0e10cSrcweir                                 nSlotId = FN_TOOL_ANKER_AT_CHAR;
1681cdf0e10cSrcweir                             break;
1682cdf0e10cSrcweir                             case FLY_AT_FLY:
1683cdf0e10cSrcweir                                 nSlotId = FN_TOOL_ANKER_FRAME;
1684cdf0e10cSrcweir                             break;
1685cdf0e10cSrcweir                             default:
1686cdf0e10cSrcweir                                 ;
1687cdf0e10cSrcweir                         }
1688cdf0e10cSrcweir                         rSet.Put(SfxUInt16Item(nWhich, nSlotId));
1689cdf0e10cSrcweir                     }
1690cdf0e10cSrcweir                 }
1691cdf0e10cSrcweir                 else
1692cdf0e10cSrcweir                     rSet.DisableItem( nWhich );
1693cdf0e10cSrcweir             }
1694cdf0e10cSrcweir             break;
1695cdf0e10cSrcweir             case FN_FRAME_NOWRAP:
1696cdf0e10cSrcweir             case FN_FRAME_WRAP:
1697cdf0e10cSrcweir             case FN_FRAME_WRAP_IDEAL:
1698cdf0e10cSrcweir             case FN_FRAME_WRAPTHRU:
1699cdf0e10cSrcweir             case FN_FRAME_WRAPTHRU_TRANSP:
1700cdf0e10cSrcweir             case FN_FRAME_WRAP_CONTOUR:
1701cdf0e10cSrcweir             case FN_WRAP_ANCHOR_ONLY:
1702cdf0e10cSrcweir             case FN_FRAME_WRAP_LEFT:
1703cdf0e10cSrcweir             case FN_FRAME_WRAP_RIGHT:
1704cdf0e10cSrcweir             {
1705cdf0e10cSrcweir                 sal_Bool bObj = 0 != rSh.IsObjSelected();
1706cdf0e10cSrcweir                 sal_Bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
1707cdf0e10cSrcweir 
1708cdf0e10cSrcweir                 if( !bParentCntProt && (bObj || rSh.IsFrmSelected()))
1709cdf0e10cSrcweir                 {
1710cdf0e10cSrcweir                     SfxItemSet aSet(GetPool(), RES_OPAQUE, RES_ANCHOR);
1711cdf0e10cSrcweir                     int nAnchorType;
1712cdf0e10cSrcweir                     if(bObj)
1713cdf0e10cSrcweir                     {
1714cdf0e10cSrcweir                         rSh.GetObjAttr(aSet);
1715cdf0e10cSrcweir                         nAnchorType = rSh.GetAnchorId();
1716cdf0e10cSrcweir                     }
1717cdf0e10cSrcweir                     else
1718cdf0e10cSrcweir                     {
1719cdf0e10cSrcweir                         rSh.GetFlyFrmAttr(aSet);
1720cdf0e10cSrcweir                         nAnchorType = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId();
1721cdf0e10cSrcweir                     }
1722cdf0e10cSrcweir                     const SwFmtSurround& rWrap = (const SwFmtSurround&)aSet.Get(RES_SURROUND);
1723cdf0e10cSrcweir 
1724cdf0e10cSrcweir                     const SvxOpaqueItem& rOpaque = (const SvxOpaqueItem&)aSet.Get(RES_OPAQUE);
1725cdf0e10cSrcweir                     sal_Bool bOpaque = rOpaque.GetValue();
1726cdf0e10cSrcweir                     SwSurround nSurround = rWrap.GetSurround();
1727cdf0e10cSrcweir                     sal_Bool bSet = sal_False;
1728cdf0e10cSrcweir 
1729cdf0e10cSrcweir                     bool bDisable =
1730cdf0e10cSrcweir                         (nAnchorType == - 1) || (nAnchorType == FLY_AS_CHAR);
1731cdf0e10cSrcweir                     const bool bHtmlMode =
1732cdf0e10cSrcweir                         0 != ::GetHtmlMode(GetView().GetDocShell());
1733cdf0e10cSrcweir 
1734cdf0e10cSrcweir                     switch( nWhich )
1735cdf0e10cSrcweir                     {
1736cdf0e10cSrcweir                         case FN_FRAME_NOWRAP:
1737cdf0e10cSrcweir                             bDisable |=
1738cdf0e10cSrcweir                                 (   (nAnchorType != FLY_AT_PARA)
1739cdf0e10cSrcweir                                  && (nAnchorType != FLY_AT_CHAR)
1740cdf0e10cSrcweir                                  && (nAnchorType != FLY_AT_PAGE));
1741cdf0e10cSrcweir                             bSet = nSurround == SURROUND_NONE;
1742cdf0e10cSrcweir                         break;
1743cdf0e10cSrcweir                         case FN_FRAME_WRAP:
1744cdf0e10cSrcweir                             bDisable |= bHtmlMode;
1745cdf0e10cSrcweir                             bSet = nSurround == SURROUND_PARALLEL;
1746cdf0e10cSrcweir                         break;
1747cdf0e10cSrcweir                         case FN_FRAME_WRAP_IDEAL:
1748cdf0e10cSrcweir                             bDisable |= bHtmlMode;
1749cdf0e10cSrcweir                             bSet = nSurround == SURROUND_IDEAL;
1750cdf0e10cSrcweir                         break;
1751cdf0e10cSrcweir                         case FN_FRAME_WRAPTHRU:
1752cdf0e10cSrcweir                             bDisable |= (bHtmlMode ||
1753cdf0e10cSrcweir                                 (   (nAnchorType != FLY_AT_PARA)
1754cdf0e10cSrcweir                                  && (nAnchorType != FLY_AT_CHAR)
1755cdf0e10cSrcweir                                  && (nAnchorType != FLY_AT_PAGE)));
1756cdf0e10cSrcweir                             if(bObj)
1757cdf0e10cSrcweir                                 bSet = nSurround == SURROUND_THROUGHT && rSh.GetLayerId();
1758cdf0e10cSrcweir                             else
1759cdf0e10cSrcweir                                 bSet = nSurround == SURROUND_THROUGHT && bOpaque;
1760cdf0e10cSrcweir                         break;
1761cdf0e10cSrcweir                         case FN_FRAME_WRAPTHRU_TRANSP:
1762cdf0e10cSrcweir                             bDisable |= bHtmlMode;
1763cdf0e10cSrcweir                             if(bObj)
1764cdf0e10cSrcweir                                 bSet = nSurround == SURROUND_THROUGHT && !rSh.GetLayerId();
1765cdf0e10cSrcweir                             else
1766cdf0e10cSrcweir                                 bSet = nSurround == SURROUND_THROUGHT && !bOpaque;
1767cdf0e10cSrcweir                         break;
1768cdf0e10cSrcweir                         case FN_FRAME_WRAP_CONTOUR:
1769cdf0e10cSrcweir                             bDisable |= bHtmlMode;
1770cdf0e10cSrcweir                             //no contour available whenn no wrap or wrap through is set
1771cdf0e10cSrcweir                             bDisable |= (nSurround == SURROUND_NONE || nSurround == SURROUND_THROUGHT);
1772cdf0e10cSrcweir                             bSet = rWrap.IsContour();
1773cdf0e10cSrcweir                             if( !bDisable )
1774cdf0e10cSrcweir                             {
1775cdf0e10cSrcweir                                 int nSel = rSh.GetSelectionType();
1776cdf0e10cSrcweir                                 if( (nSel & nsSelectionType::SEL_GRF) &&
1777cdf0e10cSrcweir                                             rSh.IsGrfSwapOut(sal_True))
1778cdf0e10cSrcweir                                 {
1779cdf0e10cSrcweir                                     if( AddGrfUpdateSlot( nWhich ))
1780cdf0e10cSrcweir                                         rSh.GetGraphic(sal_False);  // start the loading
1781cdf0e10cSrcweir                                 }
1782cdf0e10cSrcweir                                 else if( rSh.IsFrmSelected() )
1783cdf0e10cSrcweir                                 {
1784cdf0e10cSrcweir                                     // #i102253# applied patch from OD (see task)
1785cdf0e10cSrcweir                                     bDisable =
1786cdf0e10cSrcweir                                         nSel & nsSelectionType::SEL_FRM ||
1787cdf0e10cSrcweir                                         GRAPHIC_NONE == rSh.GetIMapGraphic().GetType();
1788cdf0e10cSrcweir                                 }
1789cdf0e10cSrcweir                             }
1790cdf0e10cSrcweir                             bSet = bDisable ? sal_False : rWrap.IsContour();
1791cdf0e10cSrcweir 
1792cdf0e10cSrcweir                         break;
1793cdf0e10cSrcweir                         case FN_WRAP_ANCHOR_ONLY:
1794cdf0e10cSrcweir                             bDisable |= (bHtmlMode ||
1795cdf0e10cSrcweir                                 (nAnchorType != FLY_AT_PARA));
1796cdf0e10cSrcweir                             bSet = rWrap.IsAnchorOnly();
1797cdf0e10cSrcweir                         break;
1798cdf0e10cSrcweir                         case FN_FRAME_WRAP_LEFT:
1799cdf0e10cSrcweir                             bSet = nSurround == SURROUND_LEFT;
1800cdf0e10cSrcweir                         break;
1801cdf0e10cSrcweir                         case FN_FRAME_WRAP_RIGHT:
1802cdf0e10cSrcweir                             bSet = nSurround == SURROUND_RIGHT;
1803cdf0e10cSrcweir                         break;
1804cdf0e10cSrcweir                     }
1805cdf0e10cSrcweir 
1806cdf0e10cSrcweir                     if(bDisable)
1807cdf0e10cSrcweir                         rSet.DisableItem(nWhich);
1808cdf0e10cSrcweir                     else
1809cdf0e10cSrcweir                         rSet.Put(SfxBoolItem(nWhich, bSet));
1810cdf0e10cSrcweir                 }
1811cdf0e10cSrcweir                 else
1812cdf0e10cSrcweir                     rSet.DisableItem(nWhich);
1813cdf0e10cSrcweir             }
1814cdf0e10cSrcweir             break;
1815cdf0e10cSrcweir             case FN_UPDATE_CHARTS:
1816cdf0e10cSrcweir                 if( !rSh.HasCharts() )
1817cdf0e10cSrcweir                     rSet.DisableItem( nWhich );
1818cdf0e10cSrcweir                 break;
1819cdf0e10cSrcweir             case FN_UPDATE_ALL_LINKS:
1820cdf0e10cSrcweir                 if ( !rSh.GetLinkManager().GetLinks().Count() )
1821cdf0e10cSrcweir                     rSet.DisableItem(nWhich);
1822cdf0e10cSrcweir                 break;
1823cdf0e10cSrcweir             case FN_XFORMS_DESIGN_MODE:
1824cdf0e10cSrcweir                 // enable if in XForms document
1825cdf0e10cSrcweir                 if( rSh.GetDoc()->isXForms() )
1826cdf0e10cSrcweir                 {
1827cdf0e10cSrcweir                     // determine current state from view options
1828cdf0e10cSrcweir                     sal_Bool bValue = ! rSh.GetViewOptions()->IsFormView();
1829cdf0e10cSrcweir                     rSet.Put( SfxBoolItem( nWhich, bValue ) );
1830cdf0e10cSrcweir                 }
1831cdf0e10cSrcweir                 else
1832cdf0e10cSrcweir                     rSet.Put( SfxVisibilityItem( nWhich, sal_False ) );
1833cdf0e10cSrcweir                 break;
1834cdf0e10cSrcweir         }
1835cdf0e10cSrcweir         nWhich = aIter.NextWhich();
1836cdf0e10cSrcweir     }
1837cdf0e10cSrcweir     pGetStateSet = 0;
1838cdf0e10cSrcweir }
1839cdf0e10cSrcweir 
1840cdf0e10cSrcweir /*--------------------------------------------------------------------
1841cdf0e10cSrcweir     Beschreibung:   Slots mit dieser Statusmethode disablen
1842cdf0e10cSrcweir  --------------------------------------------------------------------*/
1843cdf0e10cSrcweir 
1844cdf0e10cSrcweir 
1845cdf0e10cSrcweir void SwBaseShell::StateDisableItems( SfxItemSet &rSet )
1846cdf0e10cSrcweir {
1847cdf0e10cSrcweir     SfxWhichIter aIter(rSet);
1848cdf0e10cSrcweir     sal_uInt16 nWhich = aIter.FirstWhich();
1849cdf0e10cSrcweir 
1850cdf0e10cSrcweir     while (nWhich)
1851cdf0e10cSrcweir     {
1852cdf0e10cSrcweir         rSet.DisableItem( nWhich );
1853cdf0e10cSrcweir         nWhich = aIter.NextWhich();
1854cdf0e10cSrcweir     }
1855cdf0e10cSrcweir }
1856cdf0e10cSrcweir 
1857cdf0e10cSrcweir /*--------------------------------------------------------------------
1858cdf0e10cSrcweir     Beschreibung:   Slots mit dieser Statusmethode disablen
1859cdf0e10cSrcweir  --------------------------------------------------------------------*/
1860cdf0e10cSrcweir 
1861cdf0e10cSrcweir 
1862cdf0e10cSrcweir void SwBaseShell::StateStyle( SfxItemSet &rSet )
1863cdf0e10cSrcweir {
1864cdf0e10cSrcweir     sal_Bool bParentCntProt = GetShell().IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
1865cdf0e10cSrcweir     ShellModes eMode = GetView().GetShellMode();
1866cdf0e10cSrcweir 
1867cdf0e10cSrcweir     if ( bParentCntProt ||
1868cdf0e10cSrcweir          SHELL_MODE_DRAW == eMode ||
1869cdf0e10cSrcweir          SHELL_MODE_DRAW_CTRL == eMode ||
1870cdf0e10cSrcweir          SHELL_MODE_DRAW_FORM == eMode ||
1871cdf0e10cSrcweir          SHELL_MODE_DRAWTEXT == eMode ||
1872cdf0e10cSrcweir          SHELL_MODE_BEZIER == eMode )
1873cdf0e10cSrcweir     {
1874cdf0e10cSrcweir         SfxWhichIter aIter( rSet );
1875cdf0e10cSrcweir         sal_uInt16 nWhich = aIter.FirstWhich();
1876cdf0e10cSrcweir         while ( nWhich )
1877cdf0e10cSrcweir         {
1878cdf0e10cSrcweir             rSet.DisableItem( nWhich );
1879cdf0e10cSrcweir             nWhich = aIter.NextWhich();
1880cdf0e10cSrcweir         }
1881cdf0e10cSrcweir     }
1882cdf0e10cSrcweir     else
1883cdf0e10cSrcweir         GetView().GetDocShell()->StateStyleSheet(rSet, &GetShell());
1884cdf0e10cSrcweir }
1885cdf0e10cSrcweir 
1886cdf0e10cSrcweir /*--------------------------------------------------------------------
1887cdf0e10cSrcweir     Beschreibung:
1888cdf0e10cSrcweir  --------------------------------------------------------------------*/
1889cdf0e10cSrcweir 
1890cdf0e10cSrcweir 
1891cdf0e10cSrcweir void SwBaseShell::SetWrapMode( sal_uInt16 nSlot )
1892cdf0e10cSrcweir {
1893cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
1894cdf0e10cSrcweir     sal_Bool bObj = 0 != rSh.IsObjSelected();
1895cdf0e10cSrcweir     if( bObj || rSh.IsFrmSelected())
1896cdf0e10cSrcweir     {
1897cdf0e10cSrcweir         SfxItemSet aSet(GetPool(), RES_OPAQUE, RES_SURROUND);
1898cdf0e10cSrcweir         if(bObj)
1899cdf0e10cSrcweir             rSh.GetObjAttr(aSet);
1900cdf0e10cSrcweir         else
1901cdf0e10cSrcweir             rSh.GetFlyFrmAttr(aSet);
1902cdf0e10cSrcweir         SwFmtSurround aWrap( (SwFmtSurround&)aSet.Get(RES_SURROUND) );
1903cdf0e10cSrcweir         SwSurround nOldSurround(aWrap.GetSurround());
1904cdf0e10cSrcweir         SwSurround nSurround = SURROUND_PARALLEL;
1905cdf0e10cSrcweir 
1906cdf0e10cSrcweir         switch (nSlot)
1907cdf0e10cSrcweir         {
1908cdf0e10cSrcweir             case FN_FRAME_NOWRAP:
1909cdf0e10cSrcweir                 nSurround = SURROUND_NONE;
1910cdf0e10cSrcweir                 if (aWrap.IsContour())
1911cdf0e10cSrcweir                     aWrap.SetContour(sal_False);
1912cdf0e10cSrcweir                 break;
1913cdf0e10cSrcweir             case FN_FRAME_WRAP_IDEAL:
1914cdf0e10cSrcweir                 nSurround = SURROUND_IDEAL;
1915cdf0e10cSrcweir                 break;
1916cdf0e10cSrcweir             case FN_WRAP_ANCHOR_ONLY:
1917cdf0e10cSrcweir                 aWrap.SetAnchorOnly(!aWrap.IsAnchorOnly());
1918cdf0e10cSrcweir                 // --> OD 2006-06-02 #b6432130#
1919cdf0e10cSrcweir                 // keep previous wrapping
1920cdf0e10cSrcweir                 // --> OD 2006-09-21 #138144# - adjust fix #b6432130#
1921cdf0e10cSrcweir                 // switch to wrap SURROUND_PARALLEL, if previous wrap is SURROUND_NONE
1922cdf0e10cSrcweir                 if ( nOldSurround != SURROUND_NONE )
1923cdf0e10cSrcweir                 {
1924cdf0e10cSrcweir                     nSurround = nOldSurround;
1925cdf0e10cSrcweir                 }
1926cdf0e10cSrcweir                 // <--
1927cdf0e10cSrcweir                 break;
1928cdf0e10cSrcweir             case FN_FRAME_WRAP_CONTOUR:
1929cdf0e10cSrcweir                 aWrap.SetContour(!aWrap.IsContour());
1930cdf0e10cSrcweir                 if (nSurround == SURROUND_THROUGHT)
1931cdf0e10cSrcweir                     nSurround = SURROUND_PARALLEL;
1932cdf0e10cSrcweir                 break;
1933cdf0e10cSrcweir             case FN_FRAME_WRAPTHRU_TRANSP:
1934cdf0e10cSrcweir                 if (aWrap.IsContour())
1935cdf0e10cSrcweir                     aWrap.SetContour(sal_False);
1936cdf0e10cSrcweir                 // kein break!!!
1937cdf0e10cSrcweir             case FN_FRAME_WRAPTHRU:
1938cdf0e10cSrcweir                 nSurround = SURROUND_THROUGHT;
1939cdf0e10cSrcweir                 break;
1940cdf0e10cSrcweir 
1941cdf0e10cSrcweir             case FN_FRAME_WRAP_LEFT:
1942cdf0e10cSrcweir                 nSurround = SURROUND_LEFT;
1943cdf0e10cSrcweir                 break;
1944cdf0e10cSrcweir 
1945cdf0e10cSrcweir             case FN_FRAME_WRAP_RIGHT:
1946cdf0e10cSrcweir                 nSurround = SURROUND_RIGHT;
1947cdf0e10cSrcweir                 break;
1948cdf0e10cSrcweir 
1949cdf0e10cSrcweir             default:
1950cdf0e10cSrcweir                 break;
1951cdf0e10cSrcweir         }
1952cdf0e10cSrcweir         aWrap.SetSurround(nSurround);
1953cdf0e10cSrcweir 
1954cdf0e10cSrcweir         if (nSlot != FN_FRAME_WRAP_CONTOUR)
1955cdf0e10cSrcweir         {
1956cdf0e10cSrcweir             // Konturumfluss bei Draw-Objekten defaulten
1957cdf0e10cSrcweir             if (bObj && nOldSurround != nSurround &&
1958cdf0e10cSrcweir                 (nOldSurround == SURROUND_NONE || nOldSurround == SURROUND_THROUGHT))
1959cdf0e10cSrcweir             {
1960cdf0e10cSrcweir                 aWrap.SetContour(sal_True);
1961cdf0e10cSrcweir             }
1962cdf0e10cSrcweir         }
1963cdf0e10cSrcweir 
1964cdf0e10cSrcweir         aSet.Put( aWrap );
1965cdf0e10cSrcweir         aSet.Put(SvxOpaqueItem(RES_OPAQUE, nSlot != FN_FRAME_WRAPTHRU_TRANSP));
1966cdf0e10cSrcweir         if(bObj)
1967cdf0e10cSrcweir         {
1968cdf0e10cSrcweir             rSh.SetObjAttr(aSet);
1969cdf0e10cSrcweir             if (nSlot != FN_FRAME_WRAPTHRU_TRANSP)
1970cdf0e10cSrcweir                 rSh.SelectionToHeaven();
1971cdf0e10cSrcweir             else
1972cdf0e10cSrcweir                 rSh.SelectionToHell();
1973cdf0e10cSrcweir         }
1974cdf0e10cSrcweir         else
1975cdf0e10cSrcweir             rSh.SetFlyFrmAttr(aSet);
1976cdf0e10cSrcweir     }
1977cdf0e10cSrcweir }
1978cdf0e10cSrcweir 
1979cdf0e10cSrcweir /*--------------------------------------------------------------------
1980cdf0e10cSrcweir     Beschreibung:   Update der Statuszeile erzwingen
1981cdf0e10cSrcweir  --------------------------------------------------------------------*/
1982cdf0e10cSrcweir 
1983cdf0e10cSrcweir void SwBaseShell::SetFrmMode(FlyMode eMode, SwWrtShell *pSh )
1984cdf0e10cSrcweir {
1985cdf0e10cSrcweir     eFrameMode = eMode;
1986cdf0e10cSrcweir     SfxBindings &rBnd = pSh->GetView().GetViewFrame()->GetBindings();
1987cdf0e10cSrcweir 
1988cdf0e10cSrcweir     if( eMode == FLY_DRAG ||
1989cdf0e10cSrcweir         (pSh && (pSh->IsFrmSelected() || pSh->IsObjSelected())) )
1990cdf0e10cSrcweir     {
1991cdf0e10cSrcweir         const SfxPointItem aTmp1( SID_ATTR_POSITION, pSh->GetAnchorObjDiff());
1992cdf0e10cSrcweir         const SvxSizeItem  aTmp2( SID_ATTR_SIZE,     pSh->GetObjSize());
1993cdf0e10cSrcweir         rBnd.SetState( aTmp1 );
1994cdf0e10cSrcweir         rBnd.SetState( aTmp2 );
1995cdf0e10cSrcweir     }
1996cdf0e10cSrcweir     else if( eMode == FLY_DRAG_END )
1997cdf0e10cSrcweir     {
1998cdf0e10cSrcweir         static sal_uInt16 __READONLY_DATA aInval[] =
1999cdf0e10cSrcweir         {
2000cdf0e10cSrcweir             SID_ATTR_POSITION, SID_ATTR_SIZE, 0
2001cdf0e10cSrcweir         };
2002cdf0e10cSrcweir         rBnd.Invalidate(aInval);
2003cdf0e10cSrcweir     }
2004cdf0e10cSrcweir }
2005cdf0e10cSrcweir 
2006cdf0e10cSrcweir /*--------------------------------------------------------------------
2007cdf0e10cSrcweir     Beschreibung:   Ctor
2008cdf0e10cSrcweir  --------------------------------------------------------------------*/
2009cdf0e10cSrcweir 
2010cdf0e10cSrcweir SwBaseShell::SwBaseShell(SwView& rVw) :
2011cdf0e10cSrcweir     SfxShell( &rVw ),
2012cdf0e10cSrcweir     rView(rVw),
2013cdf0e10cSrcweir     pGetStateSet(0)
2014cdf0e10cSrcweir {
2015cdf0e10cSrcweir     SwWrtShell& rWrtSh = rView.GetWrtShell();
2016cdf0e10cSrcweir 
2017cdf0e10cSrcweir     SetPool(&rWrtSh.GetAttrPool());
2018cdf0e10cSrcweir     SetName(C2S("Base"));
2019cdf0e10cSrcweir     rWrtSh.SetGrfArrivedLnk( LINK( this, SwBaseShell, GraphicArrivedHdl));
2020cdf0e10cSrcweir }
2021cdf0e10cSrcweir 
2022cdf0e10cSrcweir 
2023cdf0e10cSrcweir SwBaseShell::~SwBaseShell()
2024cdf0e10cSrcweir {
2025cdf0e10cSrcweir     if( rView.GetCurShell() == this )
2026cdf0e10cSrcweir         rView.ResetSubShell();
2027cdf0e10cSrcweir 
2028cdf0e10cSrcweir     Link aTmp( LINK( this, SwBaseShell, GraphicArrivedHdl));
2029cdf0e10cSrcweir     if( aTmp == rView.GetWrtShell().GetGrfArrivedLnk() )
2030cdf0e10cSrcweir         rView.GetWrtShell().SetGrfArrivedLnk( Link() );
2031cdf0e10cSrcweir }
2032cdf0e10cSrcweir 
2033cdf0e10cSrcweir /*--------------------------------------------------------------------
2034cdf0e10cSrcweir     Beschreibung:
2035cdf0e10cSrcweir  --------------------------------------------------------------------*/
2036cdf0e10cSrcweir 
2037cdf0e10cSrcweir void SwBaseShell::ExecTxtCtrl( SfxRequest& rReq )
2038cdf0e10cSrcweir {
2039cdf0e10cSrcweir     const SfxItemSet *pArgs = rReq.GetArgs();
2040cdf0e10cSrcweir 
2041cdf0e10cSrcweir     if( pArgs)
2042cdf0e10cSrcweir     {
2043cdf0e10cSrcweir         SwWrtShell &rSh = GetShell();
2044cdf0e10cSrcweir         SvxScriptSetItem* pSSetItem = 0;
2045cdf0e10cSrcweir         sal_uInt16 nSlot = rReq.GetSlot();
2046cdf0e10cSrcweir         SfxItemPool& rPool = rSh.GetAttrPool();
2047cdf0e10cSrcweir         sal_uInt16 nWhich = rPool.GetWhich( nSlot );
2048cdf0e10cSrcweir         sal_uInt16 nScripts = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
2049cdf0e10cSrcweir         SfxItemSet aHeightSet( GetPool(),  RES_CHRATR_FONTSIZE, RES_CHRATR_FONTSIZE,
2050cdf0e10cSrcweir                                             RES_CHRATR_CJK_FONTSIZE, RES_CHRATR_CJK_FONTSIZE,
2051cdf0e10cSrcweir                                             RES_CHRATR_CTL_FONTSIZE, RES_CHRATR_CTL_FONTSIZE,
2052cdf0e10cSrcweir                                         0L);
2053cdf0e10cSrcweir 
2054cdf0e10cSrcweir         switch( nSlot )
2055cdf0e10cSrcweir         {
2056cdf0e10cSrcweir             case SID_ATTR_CHAR_FONT:
2057cdf0e10cSrcweir             {
2058cdf0e10cSrcweir                 nScripts = rSh.GetScriptType();
2059cdf0e10cSrcweir                 // #i42732# input language should be preferred over
2060cdf0e10cSrcweir                 // current cursor position to detect script type
2061cdf0e10cSrcweir                 if(!rSh.HasSelection())
2062cdf0e10cSrcweir                 {
2063cdf0e10cSrcweir                     LanguageType nInputLang = GetView().GetEditWin().GetInputLanguage();
2064cdf0e10cSrcweir                     if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
2065cdf0e10cSrcweir                         nScripts = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
2066cdf0e10cSrcweir                 }
2067cdf0e10cSrcweir             }
2068cdf0e10cSrcweir             case SID_ATTR_CHAR_POSTURE:
2069cdf0e10cSrcweir             case SID_ATTR_CHAR_WEIGHT:
2070cdf0e10cSrcweir             {
2071cdf0e10cSrcweir                 pSSetItem = new SvxScriptSetItem( nSlot, rPool );
2072cdf0e10cSrcweir                 pSSetItem->PutItemForScriptType( nScripts, pArgs->Get( nWhich ));
2073cdf0e10cSrcweir                 pArgs = &pSSetItem->GetItemSet();
2074cdf0e10cSrcweir             }
2075cdf0e10cSrcweir             break;
2076cdf0e10cSrcweir             case SID_ATTR_CHAR_FONTHEIGHT:
2077cdf0e10cSrcweir             {
2078cdf0e10cSrcweir                 if(rSh.HasSelection())
2079cdf0e10cSrcweir                 {
2080cdf0e10cSrcweir                     pSSetItem = new SvxScriptSetItem( nSlot, rPool );
2081cdf0e10cSrcweir                     pSSetItem->PutItemForScriptType( nScripts, pArgs->Get( nWhich ));
2082cdf0e10cSrcweir                     pArgs = &pSSetItem->GetItemSet();
2083cdf0e10cSrcweir                 }
2084cdf0e10cSrcweir                 else
2085cdf0e10cSrcweir                 {
2086cdf0e10cSrcweir                     nScripts = rSh.GetScriptType();
2087cdf0e10cSrcweir                     LanguageType nInputLang = GetView().GetEditWin().GetInputLanguage();
2088cdf0e10cSrcweir                     if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
2089cdf0e10cSrcweir                         nScripts = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
2090cdf0e10cSrcweir                     sal_uInt32 nHeight = static_cast< const SvxFontHeightItem& >(pArgs->Get( nWhich )).GetHeight();
2091cdf0e10cSrcweir                     SwStdFontConfig* pStdFont = SW_MOD()->GetStdFontConfig();
2092cdf0e10cSrcweir 
2093cdf0e10cSrcweir                     SfxItemSet aLangSet( GetPool(), RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
2094cdf0e10cSrcweir                                                     RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
2095cdf0e10cSrcweir                                                     RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
2096cdf0e10cSrcweir                                                     0L);
2097cdf0e10cSrcweir                     rSh.GetCurAttr( aLangSet );
2098cdf0e10cSrcweir 
2099cdf0e10cSrcweir                     sal_Int32 nWesternSize =
2100cdf0e10cSrcweir                             pStdFont->GetFontHeight(FONT_STANDARD, FONT_GROUP_DEFAULT,
2101cdf0e10cSrcweir                             static_cast<const SvxLanguageItem&>(aLangSet.Get( RES_CHRATR_LANGUAGE)).GetLanguage());
2102cdf0e10cSrcweir                     sal_Int32 nCJKSize =
2103cdf0e10cSrcweir                             pStdFont->GetFontHeight(FONT_STANDARD, FONT_GROUP_CJK,
2104cdf0e10cSrcweir                             static_cast<const SvxLanguageItem&>(aLangSet.Get( RES_CHRATR_CJK_LANGUAGE)).GetLanguage());
2105cdf0e10cSrcweir                     sal_Int32 nCTLSize =
2106cdf0e10cSrcweir                             pStdFont->GetFontHeight(FONT_STANDARD, FONT_GROUP_CTL,
2107cdf0e10cSrcweir                             static_cast<const SvxLanguageItem&>(aLangSet.Get( RES_CHRATR_CTL_LANGUAGE)).GetLanguage());
2108cdf0e10cSrcweir 
2109cdf0e10cSrcweir                     switch(nScripts)
2110cdf0e10cSrcweir                     {
2111cdf0e10cSrcweir                         case SCRIPTTYPE_LATIN:
2112cdf0e10cSrcweir                             nCJKSize = nHeight * nCJKSize / nWesternSize;
2113cdf0e10cSrcweir                             nCTLSize = nHeight * nCTLSize / nWesternSize;
2114cdf0e10cSrcweir                             nWesternSize = (sal_Int32) nHeight;
2115cdf0e10cSrcweir                         break;
2116cdf0e10cSrcweir                         case SCRIPTTYPE_ASIAN:
2117cdf0e10cSrcweir                             nCTLSize = nHeight* nCTLSize / nCJKSize;
2118cdf0e10cSrcweir                             nWesternSize = nHeight * nWesternSize / nCJKSize;
2119cdf0e10cSrcweir                             nCJKSize = (sal_Int32) nHeight;
2120cdf0e10cSrcweir                         break;
2121cdf0e10cSrcweir                         case SCRIPTTYPE_COMPLEX:
2122cdf0e10cSrcweir                             nCJKSize = nHeight * nCJKSize / nCTLSize;
2123cdf0e10cSrcweir                             nWesternSize = nHeight * nWesternSize / nCTLSize;
2124cdf0e10cSrcweir                             nCTLSize = (sal_Int32) nHeight;
2125cdf0e10cSrcweir                         break;
2126cdf0e10cSrcweir                     }
2127cdf0e10cSrcweir                     aHeightSet.Put( SvxFontHeightItem( (sal_uInt32)nWesternSize, 100, RES_CHRATR_FONTSIZE ));
2128cdf0e10cSrcweir                     aHeightSet.Put( SvxFontHeightItem( (sal_uInt32)nCJKSize, 100, RES_CHRATR_CJK_FONTSIZE ));
2129cdf0e10cSrcweir                     aHeightSet.Put( SvxFontHeightItem( (sal_uInt32)nCTLSize, 100, RES_CHRATR_CTL_FONTSIZE ));
2130cdf0e10cSrcweir                     pArgs = &aHeightSet;
2131cdf0e10cSrcweir                 }
2132cdf0e10cSrcweir             }
2133cdf0e10cSrcweir             break;
2134cdf0e10cSrcweir         }
2135cdf0e10cSrcweir 
2136cdf0e10cSrcweir         if( pArgs )
2137cdf0e10cSrcweir         {
2138cdf0e10cSrcweir             bool bAuto = false;
2139cdf0e10cSrcweir             if ( !isCHRATR(nWhich) ||
2140cdf0e10cSrcweir                  ( rSh.HasSelection() && rSh.IsSelFullPara() ) )
2141cdf0e10cSrcweir             {
2142cdf0e10cSrcweir                 SwTxtFmtColl * pColl = rSh.GetCurTxtFmtColl();
2143cdf0e10cSrcweir                 if ( pColl && pColl->IsAutoUpdateFmt() )
2144cdf0e10cSrcweir                 {
2145cdf0e10cSrcweir                     rSh.AutoUpdatePara( pColl, *pArgs );
2146cdf0e10cSrcweir                     bAuto = true;
2147cdf0e10cSrcweir                 }
2148cdf0e10cSrcweir             }
2149cdf0e10cSrcweir 
2150cdf0e10cSrcweir             if (!bAuto)
2151cdf0e10cSrcweir             {
215269a74367SOliver-Rainer Wittmann                 rSh.SetAttrSet( *pArgs );
2153cdf0e10cSrcweir             }
2154cdf0e10cSrcweir         }
2155cdf0e10cSrcweir         delete pSSetItem;
2156cdf0e10cSrcweir     }
2157cdf0e10cSrcweir     else
2158cdf0e10cSrcweir         GetView().GetViewFrame()->GetDispatcher()->Execute( SID_CHAR_DLG, sal_False);
2159cdf0e10cSrcweir     rReq.Done();
2160cdf0e10cSrcweir }
2161cdf0e10cSrcweir 
2162cdf0e10cSrcweir /*--------------------------------------------------------------------
2163cdf0e10cSrcweir     Beschreibung:
2164cdf0e10cSrcweir  --------------------------------------------------------------------*/
2165cdf0e10cSrcweir 
2166cdf0e10cSrcweir void SwBaseShell::GetTxtCtrlState( SfxItemSet& rSet )
2167cdf0e10cSrcweir {
2168cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
2169cdf0e10cSrcweir     rSh.GetCurAttr( rSet );
2170cdf0e10cSrcweir }
2171cdf0e10cSrcweir 
2172cdf0e10cSrcweir void SwBaseShell::GetTxtFontCtrlState( SfxItemSet& rSet )
2173cdf0e10cSrcweir {
2174cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
2175cdf0e10cSrcweir     sal_Bool bFirst = sal_True;
2176cdf0e10cSrcweir     SfxItemSet* pFntCoreSet = 0;
2177cdf0e10cSrcweir     sal_uInt16 nScriptType = SCRIPTTYPE_LATIN;
2178cdf0e10cSrcweir     SfxWhichIter aIter( rSet );
2179cdf0e10cSrcweir     sal_uInt16 nWhich = aIter.FirstWhich();
2180cdf0e10cSrcweir     while( nWhich )
2181cdf0e10cSrcweir     {
2182cdf0e10cSrcweir         switch( nWhich )
2183cdf0e10cSrcweir         {
2184cdf0e10cSrcweir         case RES_CHRATR_FONT:
2185cdf0e10cSrcweir         case RES_CHRATR_FONTSIZE:
2186cdf0e10cSrcweir         case RES_CHRATR_WEIGHT:
2187cdf0e10cSrcweir         case RES_CHRATR_POSTURE:
2188cdf0e10cSrcweir             {
2189cdf0e10cSrcweir                 if( !pFntCoreSet )
2190cdf0e10cSrcweir                 {
2191cdf0e10cSrcweir                     pFntCoreSet = new SfxItemSet( *rSet.GetPool(),
2192cdf0e10cSrcweir                                     RES_CHRATR_BEGIN, RES_CHRATR_END-1 );
2193cdf0e10cSrcweir                     rSh.GetCurAttr( *pFntCoreSet );
2194cdf0e10cSrcweir                     nScriptType = rSh.GetScriptType();
2195cdf0e10cSrcweir                     // #i42732# input language should be preferred over
2196cdf0e10cSrcweir                     // current cursor position to detect script type
2197cdf0e10cSrcweir                     SwEditWin& rEditWin = GetView().GetEditWin();
2198cdf0e10cSrcweir                     if( rEditWin.IsUseInputLanguage() )
2199cdf0e10cSrcweir                     {
2200cdf0e10cSrcweir                         if(!rSh.HasSelection() && (
2201cdf0e10cSrcweir                             nWhich == RES_CHRATR_FONT ||
2202cdf0e10cSrcweir                             nWhich == RES_CHRATR_FONTSIZE ))
2203cdf0e10cSrcweir                         {
2204cdf0e10cSrcweir                             LanguageType nInputLang = rEditWin.GetInputLanguage();
2205cdf0e10cSrcweir                             if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
2206cdf0e10cSrcweir                                 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
2207cdf0e10cSrcweir                         }
2208cdf0e10cSrcweir                     }
2209cdf0e10cSrcweir                 }
2210cdf0e10cSrcweir                 SfxItemPool& rPool = *rSet.GetPool();
2211cdf0e10cSrcweir                 SvxScriptSetItem aSetItem( rPool.GetSlotId( nWhich ), rPool );
2212cdf0e10cSrcweir                 aSetItem.GetItemSet().Put( *pFntCoreSet, sal_False );
2213cdf0e10cSrcweir                 const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
2214cdf0e10cSrcweir                 if( pI )
2215cdf0e10cSrcweir                     rSet.Put( *pI, nWhich );
2216cdf0e10cSrcweir                 else
2217cdf0e10cSrcweir                     rSet.InvalidateItem( nWhich );
2218cdf0e10cSrcweir                 //set input context of the SwEditWin according to the selected font and script type
2219cdf0e10cSrcweir                 if(RES_CHRATR_FONT == nWhich)
2220cdf0e10cSrcweir                 {
2221cdf0e10cSrcweir                     Font aFont;
2222cdf0e10cSrcweir                     if(pI && pI->ISA(SvxFontItem))
2223cdf0e10cSrcweir                     {
2224cdf0e10cSrcweir                         aFont.SetName( ((const SvxFontItem*)pI)->GetFamilyName());
2225cdf0e10cSrcweir                         aFont.SetStyleName(((const SvxFontItem*)pI)->GetStyleName());
2226cdf0e10cSrcweir                         aFont.SetFamily(((const SvxFontItem*)pI)->GetFamily());
2227cdf0e10cSrcweir                         aFont.SetPitch(((const SvxFontItem*)pI)->GetPitch());
2228cdf0e10cSrcweir                         aFont.SetCharSet(((const SvxFontItem*)pI)->GetCharSet());
2229cdf0e10cSrcweir                     }
2230cdf0e10cSrcweir 
2231cdf0e10cSrcweir                     sal_Bool bVertical = rSh.IsInVerticalText();
2232cdf0e10cSrcweir                     aFont.SetOrientation(bVertical ? 2700 : 0);
2233cdf0e10cSrcweir                     aFont.SetVertical(bVertical);
2234cdf0e10cSrcweir                     GetView().GetEditWin().SetInputContext( InputContext( aFont, INPUTCONTEXT_TEXT |
2235cdf0e10cSrcweir                                                         INPUTCONTEXT_EXTTEXTINPUT ) );
2236cdf0e10cSrcweir                 }
2237cdf0e10cSrcweir             }
2238cdf0e10cSrcweir             break;
2239cdf0e10cSrcweir 
2240cdf0e10cSrcweir         default:
2241cdf0e10cSrcweir             if( bFirst )
2242cdf0e10cSrcweir             {
2243cdf0e10cSrcweir                 rSh.GetCurAttr( rSet );
2244cdf0e10cSrcweir                 bFirst = sal_False;
2245cdf0e10cSrcweir             }
2246cdf0e10cSrcweir         }
2247cdf0e10cSrcweir         nWhich = aIter.NextWhich();
2248cdf0e10cSrcweir     }
2249cdf0e10cSrcweir     delete pFntCoreSet;
2250cdf0e10cSrcweir }
2251cdf0e10cSrcweir 
2252cdf0e10cSrcweir /*--------------------------------------------------------------------
2253cdf0e10cSrcweir     Beschreibung:
2254cdf0e10cSrcweir  --------------------------------------------------------------------*/
2255cdf0e10cSrcweir 
2256cdf0e10cSrcweir void SwBaseShell::GetBckColState(SfxItemSet &rSet)
2257cdf0e10cSrcweir {
2258cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
2259cdf0e10cSrcweir     SfxWhichIter aIter( rSet );
2260cdf0e10cSrcweir     sal_uInt16 nWhich = aIter.FirstWhich();
2261cdf0e10cSrcweir     int nSelType = rSh.GetSelectionType();
2262cdf0e10cSrcweir 
2263cdf0e10cSrcweir //  if ( nSelType & nsSelectionType::SEL_GRF ||
2264cdf0e10cSrcweir     if( nSelType & nsSelectionType::SEL_OLE )
2265cdf0e10cSrcweir     {
2266cdf0e10cSrcweir         rSet.DisableItem( SID_BACKGROUND_COLOR );
2267cdf0e10cSrcweir         return;
2268cdf0e10cSrcweir     }
2269cdf0e10cSrcweir 
2270cdf0e10cSrcweir     if ( nSelType & nsSelectionType::SEL_FRM )
2271cdf0e10cSrcweir     {
2272cdf0e10cSrcweir         sal_Bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
2273cdf0e10cSrcweir         if (bParentCntProt)
2274cdf0e10cSrcweir         {
2275cdf0e10cSrcweir             rSet.DisableItem( SID_BACKGROUND_COLOR );
2276cdf0e10cSrcweir             return;
2277cdf0e10cSrcweir         }
2278cdf0e10cSrcweir     }
2279cdf0e10cSrcweir 
2280cdf0e10cSrcweir     SvxBrushItem aBrushItem( RES_BACKGROUND );
2281cdf0e10cSrcweir 
2282cdf0e10cSrcweir     if( nsSelectionType::SEL_TBL_CELLS & nSelType )
228364b14621SArmin Le Grand     {
2284cdf0e10cSrcweir         rSh.GetBoxBackground( aBrushItem );
228564b14621SArmin Le Grand     }
228664b14621SArmin Le Grand     else
228764b14621SArmin Le Grand     {
228864b14621SArmin Le Grand         //UUUU
228964b14621SArmin Le Grand         if(nSelType & nsSelectionType::SEL_GRF)
229064b14621SArmin Le Grand         {
229164b14621SArmin Le Grand             SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);
229264b14621SArmin Le Grand 
229364b14621SArmin Le Grand             rSh.GetFlyFrmAttr( aCoreSet );
229464b14621SArmin Le Grand             aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND);
229564b14621SArmin Le Grand         }
229664b14621SArmin Le Grand         else if(nsSelectionType::SEL_FRM & nSelType)
229764b14621SArmin Le Grand         {
229864b14621SArmin Le Grand             SfxItemSet aCoreSet(GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);
229964b14621SArmin Le Grand             const XFillStyleItem& rXFillStyleItem(static_cast< const XFillStyleItem&  >(aCoreSet.Get(XATTR_FILLSTYLE)));
230064b14621SArmin Le Grand 
230164b14621SArmin Le Grand             if(XFILL_SOLID == rXFillStyleItem.GetValue())
230264b14621SArmin Le Grand             {
230364b14621SArmin Le Grand                 const Color aFillColor(static_cast< const XFillColorItem& >(aCoreSet.Get(XATTR_FILLCOLOR)).GetColorValue());
230464b14621SArmin Le Grand 
230564b14621SArmin Le Grand                 aBrushItem.SetColor(aFillColor);
230664b14621SArmin Le Grand             }
230764b14621SArmin Le Grand             else
230864b14621SArmin Le Grand             {
230964b14621SArmin Le Grand                 // keep default in SvxBrushItem which equals no fill
231064b14621SArmin Le Grand             }
231164b14621SArmin Le Grand         }
2312cdf0e10cSrcweir         else
2313cdf0e10cSrcweir         {
2314cdf0e10cSrcweir             SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);
231564b14621SArmin Le Grand 
2316cdf0e10cSrcweir             rSh.GetCurAttr( aCoreSet );
2317cdf0e10cSrcweir             aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND);
2318cdf0e10cSrcweir         }
231964b14621SArmin Le Grand     }
2320cdf0e10cSrcweir 
2321cdf0e10cSrcweir     while ( nWhich )
2322cdf0e10cSrcweir     {
2323cdf0e10cSrcweir         switch(nWhich)
2324cdf0e10cSrcweir         {
2325cdf0e10cSrcweir             case SID_BACKGROUND_COLOR  :
2326cdf0e10cSrcweir             {
2327cdf0e10cSrcweir                 SvxColorItem aColorItem(aBrushItem.GetColor(), SID_BACKGROUND_COLOR);
2328cdf0e10cSrcweir                 rSet.Put( aColorItem, SID_BACKGROUND_COLOR );
2329cdf0e10cSrcweir             }
2330cdf0e10cSrcweir             break;
2331cdf0e10cSrcweir             case SID_ATTR_BRUSH:
2332cdf0e10cSrcweir             case RES_BACKGROUND:
2333cdf0e10cSrcweir                 rSet.Put( aBrushItem, GetPool().GetWhich(nWhich) );
2334cdf0e10cSrcweir             break;
2335cdf0e10cSrcweir         }
2336cdf0e10cSrcweir         nWhich = aIter.NextWhich();
2337cdf0e10cSrcweir     }
2338cdf0e10cSrcweir }
2339cdf0e10cSrcweir 
2340cdf0e10cSrcweir /*--------------------------------------------------------------------
2341cdf0e10cSrcweir     Beschreibung:
2342cdf0e10cSrcweir  --------------------------------------------------------------------*/
2343cdf0e10cSrcweir 
2344cdf0e10cSrcweir void SwBaseShell::ExecBckCol(SfxRequest& rReq)
2345cdf0e10cSrcweir {
2346cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
2347cdf0e10cSrcweir     int nSelType = rSh.GetSelectionType();
2348cdf0e10cSrcweir     if ( nSelType & nsSelectionType::SEL_OLE )
2349cdf0e10cSrcweir     {
2350cdf0e10cSrcweir         return;
2351cdf0e10cSrcweir     }
2352cdf0e10cSrcweir 
2353cdf0e10cSrcweir     const SfxItemSet* pArgs = rReq.GetArgs();
2354cdf0e10cSrcweir     sal_uInt16 nSlot = rReq.GetSlot();
2355cdf0e10cSrcweir     if( !pArgs  && nSlot != SID_BACKGROUND_COLOR)
2356cdf0e10cSrcweir         return ;
2357cdf0e10cSrcweir 
2358cdf0e10cSrcweir     SvxBrushItem aBrushItem( RES_BACKGROUND );
2359cdf0e10cSrcweir 
2360cdf0e10cSrcweir     if( nsSelectionType::SEL_TBL_CELLS & nSelType )
2361cdf0e10cSrcweir     {
2362cdf0e10cSrcweir         rSh.GetBoxBackground( aBrushItem );
2363cdf0e10cSrcweir     }
2364cdf0e10cSrcweir     else
2365cdf0e10cSrcweir     {
236664b14621SArmin Le Grand         //UUUU
236764b14621SArmin Le Grand         if(nSelType & nsSelectionType::SEL_GRF)
236864b14621SArmin Le Grand         {
2369cdf0e10cSrcweir             SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);
237064b14621SArmin Le Grand 
2371cdf0e10cSrcweir             rSh.GetFlyFrmAttr( aCoreSet );
237264b14621SArmin Le Grand             aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND);
237364b14621SArmin Le Grand         }
237464b14621SArmin Le Grand         else if(nsSelectionType::SEL_FRM & nSelType)
237564b14621SArmin Le Grand         {
237664b14621SArmin Le Grand             SfxItemSet aCoreSet(GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);
237764b14621SArmin Le Grand             const XFillStyleItem& rXFillStyleItem(static_cast< const XFillStyleItem&  >(aCoreSet.Get(XATTR_FILLSTYLE)));
237864b14621SArmin Le Grand 
237964b14621SArmin Le Grand             if(XFILL_SOLID == rXFillStyleItem.GetValue())
238064b14621SArmin Le Grand             {
238164b14621SArmin Le Grand                 const Color aFillColor(static_cast< const XFillColorItem& >(aCoreSet.Get(XATTR_FILLCOLOR)).GetColorValue());
238264b14621SArmin Le Grand 
238364b14621SArmin Le Grand                 aBrushItem.SetColor(aFillColor);
238464b14621SArmin Le Grand             }
2385cdf0e10cSrcweir             else
238664b14621SArmin Le Grand             {
238764b14621SArmin Le Grand                 // keep default in SvxBrushItem which equals no fill
238864b14621SArmin Le Grand             }
238964b14621SArmin Le Grand         }
239064b14621SArmin Le Grand         else
239164b14621SArmin Le Grand         {
239264b14621SArmin Le Grand             SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);
239364b14621SArmin Le Grand 
2394cdf0e10cSrcweir             rSh.GetCurAttr( aCoreSet );
2395cdf0e10cSrcweir             aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND);
2396cdf0e10cSrcweir         }
239764b14621SArmin Le Grand     }
2398cdf0e10cSrcweir 
2399cdf0e10cSrcweir //  sal_Bool bMsgOk = sal_False;
2400cdf0e10cSrcweir 
2401cdf0e10cSrcweir     switch (nSlot)
2402cdf0e10cSrcweir     {
2403cdf0e10cSrcweir         // RES_BACKGROUND (=SID_ATTR_BRUSH) muss ueber zwei IDs
2404cdf0e10cSrcweir         // gesetzt werden:
2405cdf0e10cSrcweir         case SID_BACKGROUND_COLOR:
2406cdf0e10cSrcweir             {
2407cdf0e10cSrcweir                 aBrushItem.SetGraphicPos(GPOS_NONE);
2408cdf0e10cSrcweir 
2409cdf0e10cSrcweir                 //Brush &rBrush = aBrushItem.GetBrush();
2410cdf0e10cSrcweir                 if(pArgs)
2411cdf0e10cSrcweir                 {
2412cdf0e10cSrcweir                     const SvxColorItem& rNewColorItem = (const SvxColorItem&)
2413cdf0e10cSrcweir                                             pArgs->Get(SID_BACKGROUND_COLOR);
2414cdf0e10cSrcweir                     const Color& rNewColor = rNewColorItem.GetValue();
2415cdf0e10cSrcweir                     aBrushItem.SetColor( rNewColor );
2416cdf0e10cSrcweir                     GetView().GetViewFrame()->GetBindings().SetState(rNewColorItem);
2417cdf0e10cSrcweir                 }
2418cdf0e10cSrcweir                 else
2419cdf0e10cSrcweir                 {
2420cdf0e10cSrcweir                     aBrushItem.SetColor( COL_TRANSPARENT );
2421cdf0e10cSrcweir                     rReq.AppendItem( SvxColorItem( Color( COL_TRANSPARENT ), nSlot ) );
2422cdf0e10cSrcweir                 }
2423cdf0e10cSrcweir             }
2424cdf0e10cSrcweir             break;
2425cdf0e10cSrcweir 
2426cdf0e10cSrcweir         case SID_ATTR_BRUSH:
2427cdf0e10cSrcweir         case RES_BACKGROUND:
2428cdf0e10cSrcweir         {
2429cdf0e10cSrcweir             const SvxBrushItem& rNewBrushItem = (const SvxBrushItem&)
2430cdf0e10cSrcweir                                     pArgs->Get( GetPool().GetWhich(nSlot) );
2431cdf0e10cSrcweir             aBrushItem = rNewBrushItem;
2432cdf0e10cSrcweir         }
2433cdf0e10cSrcweir         break;
2434cdf0e10cSrcweir         default:
2435cdf0e10cSrcweir //          bMsgOk = sal_False;
2436cdf0e10cSrcweir             rReq.Ignore();
2437cdf0e10cSrcweir             DBG_ERROR( "Unbekannte Message bei ExecuteAttr!" );
2438cdf0e10cSrcweir             return;
2439cdf0e10cSrcweir     }
2440cdf0e10cSrcweir 
2441cdf0e10cSrcweir     if( nsSelectionType::SEL_TBL_CELLS & nSelType )
2442cdf0e10cSrcweir     {
2443cdf0e10cSrcweir         rSh.SetBoxBackground( aBrushItem );
2444cdf0e10cSrcweir     }
244564b14621SArmin Le Grand     //UUUU
244664b14621SArmin Le Grand     else if(nsSelectionType::SEL_GRF & nSelType)
2447cdf0e10cSrcweir     {
2448cdf0e10cSrcweir         SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);
2449cdf0e10cSrcweir         aCoreSet.Put( aBrushItem );
2450cdf0e10cSrcweir         // Vorlagen-AutoUpdate
2451cdf0e10cSrcweir         SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
2452cdf0e10cSrcweir         if(pFmt && pFmt->IsAutoUpdateFmt())
2453cdf0e10cSrcweir             rSh.AutoUpdateFrame( pFmt, aCoreSet);
2454cdf0e10cSrcweir         else
2455cdf0e10cSrcweir             rSh.SetFlyFrmAttr( aCoreSet );
2456cdf0e10cSrcweir     }
245764b14621SArmin Le Grand     else if(nsSelectionType::SEL_FRM & nSelType)
245864b14621SArmin Le Grand     {
245964b14621SArmin Le Grand         SfxItemSet aCoreSet(GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);
246064b14621SArmin Le Grand         const XubString aNullStr;
246164b14621SArmin Le Grand 
246264b14621SArmin Le Grand         // set FillStyle and color when applying
246364b14621SArmin Le Grand         aCoreSet.Put(XFillStyleItem(XFILL_SOLID));
246464b14621SArmin Le Grand         aCoreSet.Put(XFillColorItem(aNullStr, aBrushItem.GetColor()));
246564b14621SArmin Le Grand 
246664b14621SArmin Le Grand         // Vorlagen-AutoUpdate
246764b14621SArmin Le Grand         SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
246864b14621SArmin Le Grand 
246964b14621SArmin Le Grand         if(pFmt && pFmt->IsAutoUpdateFmt())
247064b14621SArmin Le Grand         {
247164b14621SArmin Le Grand             rSh.AutoUpdateFrame( pFmt, aCoreSet);
247264b14621SArmin Le Grand         }
247364b14621SArmin Le Grand         else
247464b14621SArmin Le Grand         {
247564b14621SArmin Le Grand             rSh.SetFlyFrmAttr( aCoreSet );
247664b14621SArmin Le Grand         }
247764b14621SArmin Le Grand     }
2478cdf0e10cSrcweir     else
2479cdf0e10cSrcweir     {
2480cdf0e10cSrcweir         SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl();
2481cdf0e10cSrcweir         if( pColl && pColl->IsAutoUpdateFmt())
2482cdf0e10cSrcweir         {
2483cdf0e10cSrcweir             SfxItemSet aSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND );
2484cdf0e10cSrcweir             aSet.Put(aBrushItem);
2485cdf0e10cSrcweir             rSh.AutoUpdatePara( pColl, aSet);
2486cdf0e10cSrcweir         }
2487cdf0e10cSrcweir         else
248869a74367SOliver-Rainer Wittmann             rSh.SetAttrItem( aBrushItem );
2489cdf0e10cSrcweir     }
2490cdf0e10cSrcweir 
2491cdf0e10cSrcweir     rReq.Done();
2492cdf0e10cSrcweir }
2493cdf0e10cSrcweir 
2494cdf0e10cSrcweir /*--------------------------------------------------------------------
2495cdf0e10cSrcweir     Beschreibung:
2496cdf0e10cSrcweir  --------------------------------------------------------------------*/
2497cdf0e10cSrcweir 
2498cdf0e10cSrcweir 
2499cdf0e10cSrcweir void SwBaseShell::GetBorderState(SfxItemSet &rSet)
2500cdf0e10cSrcweir {
2501cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
2502cdf0e10cSrcweir     // Tabellenzelle(n) selektiert?
2503cdf0e10cSrcweir     sal_Bool bPrepare = sal_True;
2504cdf0e10cSrcweir     sal_Bool bTableMode = rSh.IsTableMode();
2505cdf0e10cSrcweir     if ( bTableMode )
2506cdf0e10cSrcweir     {
2507cdf0e10cSrcweir         SfxItemSet aCoreSet( GetPool(),
2508cdf0e10cSrcweir                              RES_BOX, RES_BOX,
2509cdf0e10cSrcweir                              SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 );
2510cdf0e10cSrcweir         SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
2511cdf0e10cSrcweir         aCoreSet.Put( aBoxInfo );
2512cdf0e10cSrcweir         rSh.GetTabBorders( aCoreSet );
2513cdf0e10cSrcweir         rSet.Put( aCoreSet );
2514cdf0e10cSrcweir     }
2515cdf0e10cSrcweir     else if ( rSh.IsFrmSelected() )
2516cdf0e10cSrcweir     {
2517cdf0e10cSrcweir         SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
2518cdf0e10cSrcweir         rSet.Put( aMgr.GetAttrSet() );
2519cdf0e10cSrcweir         bPrepare = sal_False;
2520cdf0e10cSrcweir     }
2521cdf0e10cSrcweir     else
2522cdf0e10cSrcweir         // Umrandungsattribute ganz normal ueber Shell holen
2523cdf0e10cSrcweir         rSh.GetCurAttr( rSet );
2524cdf0e10cSrcweir     if ( bPrepare )
2525cdf0e10cSrcweir         ::PrepareBoxInfo( rSet, rSh );
2526cdf0e10cSrcweir     // switch the border toolbox controller mode
2527cdf0e10cSrcweir     rSet.Put( SfxBoolItem( SID_BORDER_REDUCED_MODE, !bTableMode ));
2528cdf0e10cSrcweir }
2529cdf0e10cSrcweir 
2530cdf0e10cSrcweir /*--------------------------------------------------------------------
2531cdf0e10cSrcweir     Beschreibung:
2532cdf0e10cSrcweir  --------------------------------------------------------------------*/
2533cdf0e10cSrcweir 
2534cdf0e10cSrcweir 
2535cdf0e10cSrcweir void SwBaseShell::ExecDlg(SfxRequest &rReq)
2536cdf0e10cSrcweir {
2537cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
2538cdf0e10cSrcweir     Window *pMDI = &GetView().GetViewFrame()->GetWindow();
2539cdf0e10cSrcweir     //Damit aus dem Basic keine Dialoge fuer Hintergrund-Views aufgerufen werden:
2540cdf0e10cSrcweir     sal_Bool bBackground = (&GetView() != GetActiveView());
2541cdf0e10cSrcweir     const SfxPoolItem* pItem = 0;
2542cdf0e10cSrcweir     const SfxItemSet* pArgs = rReq.GetArgs();
2543cdf0e10cSrcweir 
2544cdf0e10cSrcweir     sal_uInt16 nSlot = rReq.GetSlot();
2545cdf0e10cSrcweir     const SfxItemSet* pOutSet = 0;
2546cdf0e10cSrcweir     bool bDone = false;
2547cdf0e10cSrcweir     if(pArgs)
2548cdf0e10cSrcweir         pArgs->GetItemState( GetPool().GetWhich(nSlot), sal_False, &pItem );
2549cdf0e10cSrcweir 
2550cdf0e10cSrcweir     switch ( nSlot )
2551cdf0e10cSrcweir     {
2552cdf0e10cSrcweir         case FN_FORMAT_PAGE_DLG:
2553ff0525f2SOliver-Rainer Wittmann         case FN_FORMAT_PAGE_COLUMN_DLG:
2554ff0525f2SOliver-Rainer Wittmann         case FN_FORMAT_PAGE_SETTING_DLG:
2555cdf0e10cSrcweir         {
2556cdf0e10cSrcweir             if( !bBackground )
2557cdf0e10cSrcweir             {
2558cdf0e10cSrcweir                 const sal_uInt16 nCurIdx = rSh.GetCurPageDesc();
2559cdf0e10cSrcweir                 const SwPageDesc& rPageDesc = rSh.GetPageDesc( nCurIdx );
2560cdf0e10cSrcweir                 //temp. View, weil die Shell nach dem Dialog nicht mehr gueltig sein muss
2561cdf0e10cSrcweir                 //z.B. Kopfzeile ausschalten
2562cdf0e10cSrcweir                 SwView& rTempView = GetView();
2563ff0525f2SOliver-Rainer Wittmann                 rTempView.GetDocShell()->FormatPage(
2564ff0525f2SOliver-Rainer Wittmann                     rPageDesc.GetName(),
2565ff0525f2SOliver-Rainer Wittmann                     nSlot,
2566ff0525f2SOliver-Rainer Wittmann                     rSh );
2567cdf0e10cSrcweir                 rTempView.InvalidateRulerPos();
2568cdf0e10cSrcweir             }
2569cdf0e10cSrcweir         }
2570cdf0e10cSrcweir         break;
2571cdf0e10cSrcweir         case FN_FORMAT_BORDER_DLG:
2572cdf0e10cSrcweir         {
2573cdf0e10cSrcweir             SfxItemSet   aSet( rSh.GetAttrPool(),
2574cdf0e10cSrcweir                                RES_BOX              , RES_SHADOW,
2575cdf0e10cSrcweir                                SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
2576cdf0e10cSrcweir                                0 );
2577cdf0e10cSrcweir             SfxAbstractDialog * pDlg = 0;
2578cdf0e10cSrcweir             // Tabellenzelle(n) selektiert?
2579cdf0e10cSrcweir             if ( rSh.IsTableMode() )
2580cdf0e10cSrcweir             {
2581cdf0e10cSrcweir                 // Umrandungattribute Get/SetTabBorders() setzen
2582cdf0e10cSrcweir                 ::PrepareBoxInfo( aSet, rSh );
2583cdf0e10cSrcweir                 rSh.GetTabBorders( aSet );
2584cdf0e10cSrcweir                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
2585cdf0e10cSrcweir                 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
2586cdf0e10cSrcweir 
2587cdf0e10cSrcweir                 pDlg = pFact->CreateSwBorderDlg( pMDI, aSet, SW_BORDER_MODE_TABLE, RC_DLG_SWBORDERDLG );
2588cdf0e10cSrcweir                 DBG_ASSERT(pDlg, "Dialogdiet fail!");
2589cdf0e10cSrcweir                 if ( pDlg->Execute() == RET_OK )
2590cdf0e10cSrcweir                 {
2591cdf0e10cSrcweir                     rSh.SetTabBorders( *pDlg->GetOutputItemSet() );
2592cdf0e10cSrcweir                     pOutSet = pDlg->GetOutputItemSet();
2593cdf0e10cSrcweir                 }
2594cdf0e10cSrcweir             }
2595cdf0e10cSrcweir             else if ( rSh.IsFrmSelected() )
2596cdf0e10cSrcweir             {
2597cdf0e10cSrcweir                 // Umrandungsattribute ueber Frame-Manager setzen
2598cdf0e10cSrcweir                 SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
2599cdf0e10cSrcweir                 aSet.Put( aMgr.GetAttrSet() );
2600cdf0e10cSrcweir 
2601cdf0e10cSrcweir                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
2602cdf0e10cSrcweir                 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
2603cdf0e10cSrcweir 
2604cdf0e10cSrcweir                 pDlg = pFact->CreateSwBorderDlg( pMDI, aSet, SW_BORDER_MODE_FRAME, RC_DLG_SWBORDERDLG );
2605cdf0e10cSrcweir                 DBG_ASSERT(pDlg, "Dialogdiet fail!");
2606cdf0e10cSrcweir                 if ( pDlg->Execute() == RET_OK )
2607cdf0e10cSrcweir                 {
2608cdf0e10cSrcweir                     aMgr.SetAttrSet( *pDlg->GetOutputItemSet() );
2609cdf0e10cSrcweir                     aMgr.UpdateFlyFrm();
2610cdf0e10cSrcweir                     pOutSet = pDlg->GetOutputItemSet();
2611cdf0e10cSrcweir                 }
2612cdf0e10cSrcweir             }
2613cdf0e10cSrcweir             else
2614cdf0e10cSrcweir             {
2615cdf0e10cSrcweir                 // Umrandungsattribute ganz normal ueber Shell setzen
2616cdf0e10cSrcweir                 rSh.GetCurAttr( aSet );
2617cdf0e10cSrcweir                 ::PrepareBoxInfo( aSet, rSh );
2618cdf0e10cSrcweir 
2619cdf0e10cSrcweir                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
2620cdf0e10cSrcweir                 DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
2621cdf0e10cSrcweir 
2622cdf0e10cSrcweir                 pDlg = pFact->CreateSwBorderDlg( pMDI, aSet, SW_BORDER_MODE_PARA, RC_DLG_SWBORDERDLG );
2623cdf0e10cSrcweir                 DBG_ASSERT(pDlg, "Dialogdiet fail!");
2624cdf0e10cSrcweir                 if ( pDlg->Execute() == RET_OK )
2625cdf0e10cSrcweir                 {
262669a74367SOliver-Rainer Wittmann                     rSh.SetAttrSet( *pDlg->GetOutputItemSet() );
2627cdf0e10cSrcweir                     pOutSet = pDlg->GetOutputItemSet();
2628cdf0e10cSrcweir                 }
2629cdf0e10cSrcweir             }
2630cdf0e10cSrcweir             if(pOutSet)
2631cdf0e10cSrcweir             {
2632cdf0e10cSrcweir                 rReq.Done(*pOutSet);
2633cdf0e10cSrcweir                 bDone = true;
2634cdf0e10cSrcweir             }
2635cdf0e10cSrcweir             delete pDlg;
2636cdf0e10cSrcweir         }
2637cdf0e10cSrcweir         break;
2638cdf0e10cSrcweir         case FN_FORMAT_BACKGROUND_DLG:
2639cdf0e10cSrcweir         {
2640cdf0e10cSrcweir             SfxItemSet aSet( rSh.GetAttrPool(),
2641cdf0e10cSrcweir                              RES_BACKGROUND, RES_BACKGROUND );
2642cdf0e10cSrcweir 
2643cdf0e10cSrcweir             SfxAbstractDialog * pDlg = 0;
2644cdf0e10cSrcweir             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
2645cdf0e10cSrcweir             DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
2646cdf0e10cSrcweir 
2647cdf0e10cSrcweir 
2648cdf0e10cSrcweir             // Tabellenzelle(n) selektiert?
2649cdf0e10cSrcweir             if ( rSh.IsTableMode() )
2650cdf0e10cSrcweir             {
2651cdf0e10cSrcweir                 //Hintergrundattribute der Tabelle holen und in den Set packen
2652cdf0e10cSrcweir                 SvxBrushItem aBrush(RES_BACKGROUND);
2653cdf0e10cSrcweir                 rSh.GetBoxBackground( aBrush );
2654cdf0e10cSrcweir                 pDlg = pFact->CreateSfxDialog( pMDI, aSet,
2655cdf0e10cSrcweir                     rView.GetViewFrame()->GetFrame().GetFrameInterface(),
2656cdf0e10cSrcweir                     RC_SWDLG_BACKGROUND );
2657cdf0e10cSrcweir                 DBG_ASSERT(pDlg, "Dialogdiet fail!");
2658cdf0e10cSrcweir                 aSet.Put( aBrush );
2659cdf0e10cSrcweir                 if ( pDlg->Execute() == RET_OK )
2660cdf0e10cSrcweir                 {
2661cdf0e10cSrcweir                     //aBrush = (SvxBrushItem) pDlg->GetOutputItemSet()->Get( RES_BACKGROUND );
2662cdf0e10cSrcweir 
2663cdf0e10cSrcweir                     rSh.SetBoxBackground( (SvxBrushItem&)
2664cdf0e10cSrcweir                         pDlg->GetOutputItemSet()->Get( RES_BACKGROUND ));
2665cdf0e10cSrcweir                     pOutSet = pDlg->GetOutputItemSet();
2666cdf0e10cSrcweir                 }
2667cdf0e10cSrcweir             }
2668cdf0e10cSrcweir             else if ( rSh.IsFrmSelected() )
2669cdf0e10cSrcweir             {
2670cdf0e10cSrcweir 
2671cdf0e10cSrcweir                 rSh.GetFlyFrmAttr( aSet );
2672cdf0e10cSrcweir 
2673cdf0e10cSrcweir                 pDlg = pFact->CreateSfxDialog( pMDI, aSet,
2674cdf0e10cSrcweir                     rView.GetViewFrame()->GetFrame().GetFrameInterface(),
2675cdf0e10cSrcweir                     RC_SWDLG_BACKGROUND );
2676cdf0e10cSrcweir                 DBG_ASSERT(pDlg, "Dialogdiet fail!");
2677cdf0e10cSrcweir                 if ( pDlg->Execute() == RET_OK )
2678cdf0e10cSrcweir                 {
2679cdf0e10cSrcweir                     rSh.SetFlyFrmAttr((SfxItemSet &) *pDlg->GetOutputItemSet() );
2680cdf0e10cSrcweir                     pOutSet = pDlg->GetOutputItemSet();
2681cdf0e10cSrcweir                 }
2682cdf0e10cSrcweir             }
2683cdf0e10cSrcweir             else
2684cdf0e10cSrcweir             {
2685cdf0e10cSrcweir                 // Umrandungsattribute ganz normal ueber Shell setzen
2686cdf0e10cSrcweir                 rSh.GetCurAttr( aSet );
2687cdf0e10cSrcweir 
2688cdf0e10cSrcweir                 pDlg = pFact->CreateSfxDialog( pMDI, aSet,
2689cdf0e10cSrcweir                     rView.GetViewFrame()->GetFrame().GetFrameInterface(),
2690cdf0e10cSrcweir                     RC_SWDLG_BACKGROUND );
2691cdf0e10cSrcweir                 DBG_ASSERT(pDlg, "Dialogdiet fail!");
2692cdf0e10cSrcweir                 if ( pDlg->Execute() == RET_OK )
2693cdf0e10cSrcweir                 {
269469a74367SOliver-Rainer Wittmann                     rSh.SetAttrSet( *pDlg->GetOutputItemSet() );
2695cdf0e10cSrcweir                     pOutSet = pDlg->GetOutputItemSet();
2696cdf0e10cSrcweir                 }
2697cdf0e10cSrcweir             }
2698cdf0e10cSrcweir             if(pOutSet)
2699cdf0e10cSrcweir             {
2700cdf0e10cSrcweir                 rReq.Done(*pOutSet);
2701cdf0e10cSrcweir                 bDone = true;
2702cdf0e10cSrcweir             }
2703cdf0e10cSrcweir             delete pDlg;
2704cdf0e10cSrcweir 
2705cdf0e10cSrcweir         }
2706cdf0e10cSrcweir         break;
2707cdf0e10cSrcweir         default:DBG_ERROR("falscher Dispatcher (basesh.cxx)");
2708cdf0e10cSrcweir     }
2709cdf0e10cSrcweir     if(!bDone)
2710cdf0e10cSrcweir         rReq.Done();
2711cdf0e10cSrcweir }
2712cdf0e10cSrcweir 
2713cdf0e10cSrcweir // ----------------------------------------------------------------------------
2714cdf0e10cSrcweir 
2715cdf0e10cSrcweir 
2716cdf0e10cSrcweir SwWrtShell& SwBaseShell::GetShell()
2717cdf0e10cSrcweir {
2718cdf0e10cSrcweir     return rView.GetWrtShell();
2719cdf0e10cSrcweir }
2720cdf0e10cSrcweir 
2721cdf0e10cSrcweir // ----------------------------------------------------------------------------
2722cdf0e10cSrcweir 
2723cdf0e10cSrcweir SwWrtShell* SwBaseShell::GetShellPtr()
2724cdf0e10cSrcweir {
2725cdf0e10cSrcweir     return rView.GetWrtShellPtr();
2726cdf0e10cSrcweir }
2727cdf0e10cSrcweir 
2728cdf0e10cSrcweir // ----------------------------------------------------------------------------
2729cdf0e10cSrcweir 
2730cdf0e10cSrcweir void SwBaseShell::InsertTable( SfxRequest& _rRequest )
2731cdf0e10cSrcweir {
2732cdf0e10cSrcweir     const SfxItemSet* pArgs = _rRequest.GetArgs();
2733cdf0e10cSrcweir     SwWrtShell& rSh = GetShell();
2734cdf0e10cSrcweir 
2735cdf0e10cSrcweir     if ( !( rSh.GetFrmType( 0, sal_True ) & FRMTYPE_FOOTNOTE ) )
2736cdf0e10cSrcweir     {
2737cdf0e10cSrcweir         SwView &rTempView = GetView(); // Da GetView() nach Shellwechsel nicht mehr geht
2738cdf0e10cSrcweir         sal_Bool bHTMLMode = 0 != (::GetHtmlMode(rTempView.GetDocShell())&HTMLMODE_ON);
2739cdf0e10cSrcweir         sal_Bool bCallEndUndo = sal_False;
2740cdf0e10cSrcweir 
2741cdf0e10cSrcweir         if( !pArgs && rSh.IsSelection() && !rSh.IsInClickToEdit() &&
2742cdf0e10cSrcweir             !rSh.IsTableMode() )
2743cdf0e10cSrcweir         {
2744cdf0e10cSrcweir             const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
2745cdf0e10cSrcweir             SwInsertTableOptions aInsTblOpts = pModOpt->GetInsTblFlags(bHTMLMode);
2746cdf0e10cSrcweir 
2747cdf0e10cSrcweir             rSh.StartUndo(UNDO_INSTABLE);
2748cdf0e10cSrcweir             bCallEndUndo = sal_True;
2749cdf0e10cSrcweir 
2750cdf0e10cSrcweir             sal_Bool bInserted = rSh.TextToTable( aInsTblOpts, '\t', text::HoriOrientation::FULL );
2751cdf0e10cSrcweir             rSh.EnterStdMode();
2752cdf0e10cSrcweir             if (bInserted)
2753cdf0e10cSrcweir                 rTempView.AutoCaption(TABLE_CAP);
2754cdf0e10cSrcweir             _rRequest.Done();
2755cdf0e10cSrcweir         }
2756cdf0e10cSrcweir         else
2757cdf0e10cSrcweir         {
2758cdf0e10cSrcweir             sal_uInt16 nCols = 0;
2759cdf0e10cSrcweir             sal_uInt16 nRows = 0;
2760cdf0e10cSrcweir             SwInsertTableOptions aInsTblOpts( tabopts::ALL_TBL_INS_ATTR, 1 );
2761cdf0e10cSrcweir             String aTableName, aAutoName;
2762cdf0e10cSrcweir             SwTableAutoFmt* pTAFmt = 0;
2763cdf0e10cSrcweir 
2764cdf0e10cSrcweir             if( pArgs && pArgs->Count() >= 2 )
2765cdf0e10cSrcweir             {
2766cdf0e10cSrcweir                 SFX_REQUEST_ARG( _rRequest, pName, SfxStringItem, FN_INSERT_TABLE, sal_False );
2767cdf0e10cSrcweir                 SFX_REQUEST_ARG( _rRequest, pCols, SfxUInt16Item, SID_ATTR_TABLE_COLUMN, sal_False );
2768cdf0e10cSrcweir                 SFX_REQUEST_ARG( _rRequest, pRows, SfxUInt16Item, SID_ATTR_TABLE_ROW, sal_False );
2769cdf0e10cSrcweir                 SFX_REQUEST_ARG( _rRequest, pFlags, SfxInt32Item, FN_PARAM_1, sal_False );
2770cdf0e10cSrcweir                 SFX_REQUEST_ARG( _rRequest, pAuto, SfxStringItem, FN_PARAM_2, sal_False );
2771cdf0e10cSrcweir 
2772cdf0e10cSrcweir                 if ( pName )
2773cdf0e10cSrcweir                     aTableName = pName->GetValue();
2774cdf0e10cSrcweir                 if ( pCols )
2775cdf0e10cSrcweir                     nCols = pCols->GetValue();
2776cdf0e10cSrcweir                 if ( pRows )
2777cdf0e10cSrcweir                     nRows = pRows->GetValue();
2778cdf0e10cSrcweir                 if ( pAuto )
2779cdf0e10cSrcweir                 {
2780cdf0e10cSrcweir                     aAutoName = pAuto->GetValue();
2781cdf0e10cSrcweir                     if ( aAutoName.Len() )
2782cdf0e10cSrcweir                     {
2783cdf0e10cSrcweir                         SwTableAutoFmtTbl aTableTbl;
2784cdf0e10cSrcweir                         aTableTbl.Load();
2785cdf0e10cSrcweir                         for ( sal_uInt16 n=0; n<aTableTbl.Count(); n++ )
2786cdf0e10cSrcweir                         {
2787cdf0e10cSrcweir                             if ( aTableTbl[n]->GetName() == aAutoName )
2788cdf0e10cSrcweir                             {
2789cdf0e10cSrcweir                                 pTAFmt = new SwTableAutoFmt( *aTableTbl[n] );
2790cdf0e10cSrcweir                                 break;
2791cdf0e10cSrcweir                             }
2792cdf0e10cSrcweir                         }
2793cdf0e10cSrcweir                     }
2794cdf0e10cSrcweir                 }
2795cdf0e10cSrcweir 
2796cdf0e10cSrcweir                 if ( pFlags )
2797cdf0e10cSrcweir                     aInsTblOpts.mnInsMode = (sal_uInt16) pFlags->GetValue();
2798cdf0e10cSrcweir                 else
2799cdf0e10cSrcweir                 {
2800cdf0e10cSrcweir                     const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
2801cdf0e10cSrcweir                     aInsTblOpts = pModOpt->GetInsTblFlags(bHTMLMode);
2802cdf0e10cSrcweir                 }
2803cdf0e10cSrcweir             }
2804cdf0e10cSrcweir 
2805cdf0e10cSrcweir             if( !nCols || !nRows )
2806cdf0e10cSrcweir             {
2807cdf0e10cSrcweir                 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
2808cdf0e10cSrcweir                 DBG_ASSERT(pFact, "Dialogdiet fail!");
2809cdf0e10cSrcweir                 AbstractInsTableDlg* pDlg = pFact->CreateInsTableDlg( DLG_INSERT_TABLE, rTempView );
2810cdf0e10cSrcweir                 DBG_ASSERT(pDlg, "Dialogdiet fail!");
2811cdf0e10cSrcweir                 if( RET_OK == pDlg->Execute() )
2812cdf0e10cSrcweir                 {
2813cdf0e10cSrcweir                     pDlg->GetValues( aTableName, nRows, nCols, aInsTblOpts, aAutoName, pTAFmt );
2814cdf0e10cSrcweir                 }
2815cdf0e10cSrcweir                 else
2816cdf0e10cSrcweir                     _rRequest.Ignore();
2817cdf0e10cSrcweir                 delete pDlg;
2818cdf0e10cSrcweir             }
2819cdf0e10cSrcweir 
2820cdf0e10cSrcweir             if( nCols && nRows )
2821cdf0e10cSrcweir             {
2822cdf0e10cSrcweir                 // record before shell change
2823cdf0e10cSrcweir                 _rRequest.AppendItem( SfxStringItem( FN_INSERT_TABLE, aTableName ) );
2824cdf0e10cSrcweir                 if ( aAutoName.Len() )
2825cdf0e10cSrcweir                     _rRequest.AppendItem( SfxStringItem( FN_PARAM_2, aAutoName ) );
2826cdf0e10cSrcweir                 _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_COLUMN, nCols ) );
2827cdf0e10cSrcweir                 _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_ROW, nRows ) );
2828cdf0e10cSrcweir                 _rRequest.AppendItem( SfxInt32Item( FN_PARAM_1, (sal_Int32) aInsTblOpts.mnInsMode ) );
2829cdf0e10cSrcweir                 _rRequest.Done();
2830cdf0e10cSrcweir 
2831cdf0e10cSrcweir                 rSh.StartUndo(UNDO_INSTABLE);
2832cdf0e10cSrcweir                 bCallEndUndo = sal_True;
2833cdf0e10cSrcweir 
2834cdf0e10cSrcweir                 rSh.StartAllAction();
2835cdf0e10cSrcweir                 if( rSh.HasSelection() )
2836cdf0e10cSrcweir                     rSh.DelRight();
2837cdf0e10cSrcweir 
2838cdf0e10cSrcweir                 rSh.InsertTable( aInsTblOpts, nRows, nCols, text::HoriOrientation::FULL, pTAFmt );
2839cdf0e10cSrcweir                 rSh.MoveTable( fnTablePrev, fnTableStart );
2840cdf0e10cSrcweir 
2841cdf0e10cSrcweir                 if( aTableName.Len() && !rSh.GetTblStyle( aTableName ) )
2842cdf0e10cSrcweir                     rSh.GetTableFmt()->SetName( aTableName );
2843cdf0e10cSrcweir 
2844cdf0e10cSrcweir                 rSh.EndAllAction();
2845cdf0e10cSrcweir                 rTempView.AutoCaption(TABLE_CAP);
2846cdf0e10cSrcweir             }
2847cdf0e10cSrcweir             delete pTAFmt;
2848cdf0e10cSrcweir         }
2849cdf0e10cSrcweir 
2850cdf0e10cSrcweir         if( bCallEndUndo )
2851cdf0e10cSrcweir         {
2852cdf0e10cSrcweir             SwRewriter aRewriter;
2853cdf0e10cSrcweir 
2854cdf0e10cSrcweir             if (rSh.GetTableFmt())
2855cdf0e10cSrcweir             {
2856cdf0e10cSrcweir                 aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_START_QUOTE));
2857cdf0e10cSrcweir                 aRewriter.AddRule(UNDO_ARG2, rSh.GetTableFmt()->GetName());
2858cdf0e10cSrcweir                 aRewriter.AddRule(UNDO_ARG3, SW_RES(STR_END_QUOTE));
2859cdf0e10cSrcweir 
2860cdf0e10cSrcweir             }
2861cdf0e10cSrcweir             rSh.EndUndo(UNDO_INSTABLE, &aRewriter); // wegen moegl. Shellwechsel
2862cdf0e10cSrcweir         }
2863cdf0e10cSrcweir     }
2864cdf0e10cSrcweir }
2865cdf0e10cSrcweir 
2866cdf0e10cSrcweir // ----------------------------------------------------------------------------
2867cdf0e10cSrcweir 
2868cdf0e10cSrcweir void SwBaseShell::GetGalleryState( SfxItemSet &rSet )
2869cdf0e10cSrcweir {
2870cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
2871cdf0e10cSrcweir     SfxWhichIter aIter( rSet );
2872cdf0e10cSrcweir     sal_uInt16 nWhich = aIter.FirstWhich();
2873cdf0e10cSrcweir     switch ( nWhich )
2874cdf0e10cSrcweir     {
2875cdf0e10cSrcweir         case SID_GALLERY_BG_BRUSH:
2876cdf0e10cSrcweir         {
2877cdf0e10cSrcweir             int nSel = rSh.GetSelectionType();
2878cdf0e10cSrcweir             SfxStringListItem aLst( nWhich );
2879cdf0e10cSrcweir             List *pLst = aLst.GetList();
2880cdf0e10cSrcweir             nParagraphPos = nGraphicPos = nOlePos = nFramePos = nTablePos =
2881cdf0e10cSrcweir             nTableRowPos  = nTableCellPos = nPagePos =
2882cdf0e10cSrcweir             nHeaderPos    = nFooterPos = 0;
2883cdf0e10cSrcweir             sal_uInt8 nPos = 1;
2884cdf0e10cSrcweir             pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_PAGE ), pLst->Count() );
2885cdf0e10cSrcweir             nPagePos = nPos++;
2886cdf0e10cSrcweir             sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
2887cdf0e10cSrcweir             sal_Bool bHtmlMode = 0 != (nHtmlMode & HTMLMODE_ON);
2888cdf0e10cSrcweir 
2889cdf0e10cSrcweir             if ( (!bHtmlMode || (nHtmlMode & HTMLMODE_FULL_STYLES)) &&
2890cdf0e10cSrcweir                  (nSel & nsSelectionType::SEL_TXT) )
2891cdf0e10cSrcweir             {
2892cdf0e10cSrcweir                 pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_PARAGRAPH ), pLst->Count() );
2893cdf0e10cSrcweir                 nParagraphPos = nPos++;
2894cdf0e10cSrcweir             }
2895cdf0e10cSrcweir             if ( (!bHtmlMode || (nHtmlMode & HTMLMODE_SOME_STYLES)) &&
2896cdf0e10cSrcweir                     nSel & (nsSelectionType::SEL_TBL|nsSelectionType::SEL_TBL_CELLS) )
2897cdf0e10cSrcweir             {
2898cdf0e10cSrcweir                 pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_TABLE ), pLst->Count() );
2899cdf0e10cSrcweir                 nTablePos = nPos++;
2900cdf0e10cSrcweir 
2901cdf0e10cSrcweir                 if(!bHtmlMode)
2902cdf0e10cSrcweir                 {
2903cdf0e10cSrcweir                     pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_TABLE_ROW ), pLst->Count() );
2904cdf0e10cSrcweir                     nTableRowPos = nPos++;
2905cdf0e10cSrcweir                 }
2906cdf0e10cSrcweir 
2907cdf0e10cSrcweir                 pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_TABLE_CELL), pLst->Count() );
2908cdf0e10cSrcweir                 nTableCellPos = nPos++;
2909cdf0e10cSrcweir             }
2910cdf0e10cSrcweir             if(!bHtmlMode)
2911cdf0e10cSrcweir             {
2912cdf0e10cSrcweir                 if ( nSel & nsSelectionType::SEL_FRM )
2913cdf0e10cSrcweir                 {
2914cdf0e10cSrcweir                     pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_FRAME ), pLst->Count() );
2915cdf0e10cSrcweir                     nFramePos = nPos++;
2916cdf0e10cSrcweir                 }
2917cdf0e10cSrcweir                 if ( nSel & nsSelectionType::SEL_GRF )
2918cdf0e10cSrcweir                 {
2919cdf0e10cSrcweir                     pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_GRAPHIC ), pLst->Count() );
2920cdf0e10cSrcweir                     nGraphicPos = nPos++;
2921cdf0e10cSrcweir                 }
2922cdf0e10cSrcweir                 if ( nSel & nsSelectionType::SEL_OLE )
2923cdf0e10cSrcweir                 {
2924cdf0e10cSrcweir                     pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_OLE ), pLst->Count() );
2925cdf0e10cSrcweir                     nOlePos = nPos++;
2926cdf0e10cSrcweir                 }
2927cdf0e10cSrcweir                 const sal_uInt16 nType = rSh.GetFrmType(0,sal_True);
2928cdf0e10cSrcweir                 if ( nType & FRMTYPE_HEADER )
2929cdf0e10cSrcweir                 {
2930cdf0e10cSrcweir                     pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_HEADER ), pLst->Count() );
2931cdf0e10cSrcweir                     nHeaderPos = nPos++;
2932cdf0e10cSrcweir                 }
2933cdf0e10cSrcweir                 if ( nType & FRMTYPE_FOOTER )
2934cdf0e10cSrcweir                 {
2935cdf0e10cSrcweir                     pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_FOOTER ), pLst->Count() );
2936cdf0e10cSrcweir                     nFooterPos = nPos;
2937cdf0e10cSrcweir                 }
2938cdf0e10cSrcweir             }
2939cdf0e10cSrcweir             if ( pLst->Count() )
2940cdf0e10cSrcweir                 rSet.Put( aLst );
2941cdf0e10cSrcweir             else
2942cdf0e10cSrcweir                 rSet.DisableItem( nWhich );
2943cdf0e10cSrcweir             break;
2944cdf0e10cSrcweir         }
2945cdf0e10cSrcweir     }
2946cdf0e10cSrcweir }
2947cdf0e10cSrcweir 
2948cdf0e10cSrcweir 
2949cdf0e10cSrcweir void SwBaseShell::ExecuteGallery(SfxRequest &rReq)
2950cdf0e10cSrcweir {
2951cdf0e10cSrcweir     SwWrtShell &rSh = GetShell();
2952cdf0e10cSrcweir     rSh.StartAction();
2953cdf0e10cSrcweir     const SfxItemSet* pArgs = rReq.GetArgs();
2954cdf0e10cSrcweir     sal_uInt16 nSlot = rReq.GetSlot();
2955cdf0e10cSrcweir     switch(nSlot)
2956cdf0e10cSrcweir     {
2957cdf0e10cSrcweir         case SID_GALLERY_BG_BRUSH:
2958cdf0e10cSrcweir         {
29599afceb33SAriel Constenla-Haile             if ( !pArgs )
29609afceb33SAriel Constenla-Haile                 break;
29619afceb33SAriel Constenla-Haile 
2962cdf0e10cSrcweir             int nSel = rSh.GetSelectionType();
2963cdf0e10cSrcweir             if ( nSel & nsSelectionType::SEL_DRW_TXT )
2964cdf0e10cSrcweir                 break;
2965cdf0e10cSrcweir 
29669afceb33SAriel Constenla-Haile             SFX_REQUEST_ARG( rReq, pPos, SfxUInt16Item, SID_GALLERY_BG_POS, sal_False );
29679afceb33SAriel Constenla-Haile             SFX_REQUEST_ARG( rReq, pBrush, SvxBrushItem, SID_GALLERY_BG_BRUSH, sal_False );
29689afceb33SAriel Constenla-Haile             if ( !pPos || !pBrush )
29699afceb33SAriel Constenla-Haile                 break;
29709afceb33SAriel Constenla-Haile 
29719afceb33SAriel Constenla-Haile             sal_uInt8 nPos = pPos->GetValue();
2972cdf0e10cSrcweir             ++nPos;
2973cdf0e10cSrcweir 
29749afceb33SAriel Constenla-Haile             SvxBrushItem aBrush( *pBrush );
2975cdf0e10cSrcweir             aBrush.SetWhich( RES_BACKGROUND );
2976cdf0e10cSrcweir             if ( nPos == nParagraphPos )
297769a74367SOliver-Rainer Wittmann                 rSh.SetAttrItem( aBrush );
2978cdf0e10cSrcweir             else if ( nPos == nTablePos )
2979cdf0e10cSrcweir                 rSh.SetTabBackground( aBrush );
2980cdf0e10cSrcweir             else if ( nPos == nTableRowPos )
2981cdf0e10cSrcweir                 rSh.SetRowBackground( aBrush );
2982cdf0e10cSrcweir             else if ( nPos == nTableCellPos )
2983cdf0e10cSrcweir                 rSh.SetBoxBackground( aBrush );
2984cdf0e10cSrcweir             else if ( nPos == nFramePos || nPos == nGraphicPos || nPos == nOlePos )
2985cdf0e10cSrcweir             {
2986cdf0e10cSrcweir                 SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);
2987cdf0e10cSrcweir                 aCoreSet.Put( aBrush );
2988cdf0e10cSrcweir                 rSh.SetFlyFrmAttr( aCoreSet );
2989cdf0e10cSrcweir             }
2990cdf0e10cSrcweir             else if ( nPos == nPagePos || nPos == nHeaderPos || nPos == nFooterPos )
2991cdf0e10cSrcweir             {
2992cdf0e10cSrcweir                 sal_uInt16 nDesc = rSh.GetCurPageDesc();
2993cdf0e10cSrcweir                 SwPageDesc aDesc( rSh.GetPageDesc( nDesc ) );
2994cdf0e10cSrcweir                 if ( nPos == nPagePos )
2995cdf0e10cSrcweir                     aDesc.GetMaster().SetFmtAttr( aBrush );
2996cdf0e10cSrcweir                 else if ( nPos == nHeaderPos )
2997cdf0e10cSrcweir                 {
2998cdf0e10cSrcweir                     SwFmtHeader aHead( aDesc.GetMaster().GetHeader() );
2999cdf0e10cSrcweir                     aHead.GetHeaderFmt()->SetFmtAttr( aBrush );
3000cdf0e10cSrcweir                     aDesc.GetMaster().SetFmtAttr( aHead );
3001cdf0e10cSrcweir                 }
3002cdf0e10cSrcweir                 else if ( nPos == nFooterPos )
3003cdf0e10cSrcweir                 {
3004cdf0e10cSrcweir                     SwFmtFooter aFoot( aDesc.GetMaster().GetFooter() );
3005cdf0e10cSrcweir                     aFoot.GetFooterFmt()->SetFmtAttr( aBrush );
3006cdf0e10cSrcweir                     aDesc.GetMaster().SetFmtAttr( aFoot );
3007cdf0e10cSrcweir                 }
3008cdf0e10cSrcweir                 rSh.ChgPageDesc( nDesc, aDesc );
3009cdf0e10cSrcweir             }
3010cdf0e10cSrcweir             break;
3011cdf0e10cSrcweir         }
3012cdf0e10cSrcweir     }
3013cdf0e10cSrcweir     rSh.EndAction();
3014cdf0e10cSrcweir     rReq.Done();
3015cdf0e10cSrcweir }
3016cdf0e10cSrcweir 
3017cdf0e10cSrcweir void SwBaseShell::ExecField( SfxRequest& rReq )
3018cdf0e10cSrcweir {
3019cdf0e10cSrcweir     sal_uInt16 nSlot = rReq.GetSlot();
3020cdf0e10cSrcweir     switch( nSlot )
3021cdf0e10cSrcweir     {
3022cdf0e10cSrcweir         case FN_CHANGE_DBFIELD:
3023cdf0e10cSrcweir         {
3024cdf0e10cSrcweir             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
3025cdf0e10cSrcweir             DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
3026cdf0e10cSrcweir 
3027cdf0e10cSrcweir             VclAbstractDialog* pDlg = pFact->CreateSwChangeDBDlg(GetView(), DLG_CHANGE_DB );
3028cdf0e10cSrcweir             DBG_ASSERT(pDlg, "Dialogdiet fail!");
3029cdf0e10cSrcweir             pDlg->Execute();
3030cdf0e10cSrcweir             delete pDlg;
3031cdf0e10cSrcweir         }
3032cdf0e10cSrcweir         break;
3033cdf0e10cSrcweir         default:
3034cdf0e10cSrcweir             ASSERT(sal_False, falscher Dispatcher);
3035cdf0e10cSrcweir     }
3036cdf0e10cSrcweir }
3037cdf0e10cSrcweir 
3038