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