1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: basesh.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #include <sot/factory.hxx>
34 #include <hintids.hxx>
35 #include <svtools/urihelper.hxx>
36 #include <svtools/languageoptions.hxx>
38 #ifndef _SVX_SVXIDS_HRC
39 #include <svx/svxids.hrc>
41 #include <svx/linkmgr.hxx>
42 #include <svx/htmlmode.hxx>
43 #include <svx/imapdlg.hxx>
44 #include <sfx2/dispatch.hxx>
45 #include <sfx2/docfile.hxx>
46 #include <sfx2/viewfrm.hxx>
47 #include <sfx2/request.hxx>
48 #include <svtools/whiter.hxx>
49 #include <svtools/visitem.hxx>
50 #include <sfx2/objitem.hxx>
51 #include <svtools/filter.hxx>
52 #include <svx/gallery.hxx>
53 #include <svx/langitem.hxx>
54 #include <svx/clipfmtitem.hxx>
55 #include <svx/contdlg.hxx>
56 #include <vcl/graph.hxx>
57 #include <svx/impgrf.hxx>
58 #include <svtools/slstitm.hxx>
59 #include <vcl/msgbox.hxx>
60 #include <svtools/ptitem.hxx>
61 #include <svtools/itemiter.hxx>
62 #include <svtools/stritem.hxx>
63 #include <svx/colritem.hxx>
64 #include <svx/shaditem.hxx>
65 #include <svx/boxitem.hxx>
66 #include <svx/srchitem.hxx>
67 #include <svx/ulspitem.hxx>
68 #include <svx/lrspitem.hxx>
69 #include <svx/brshitem.hxx>
70 #include <svx/opaqitem.hxx>
71 #include <svx/sizeitem.hxx>
72 #include <svx/flagsdef.hxx>
73 #include <svx/scripttypeitem.hxx>
74 #include <sfx2/objface.hxx>
76 #include <fmthdft.hxx>
77 #include <fmtclds.hxx>
81 #include <swmodule.hxx>
86 #include <viewopt.hxx>
87 #include <fontcfg.hxx>
88 #include <docstat.hxx>
93 #include <tablemgr.hxx>
95 #include <swdtflvr.hxx>
96 #include <pagedesc.hxx>
97 #include <convert.hxx>
100 #include <tblafmt.hxx>
101 #include <caption.hxx>
102 #include <swwait.hxx>
107 #include <globals.hrc>
110 #include <shells.hrc>
113 #include <statstr.hrc>
116 #include <unotxdoc.hxx>
117 #include <crsskip.hxx>
118 #include <fmtinfmt.hxx>
121 #include "swabstdlg.hxx"
122 #include "dialog.hrc"
125 #include <modcfg.hxx>
126 #include <instable.hxx>
127 #include <svx/fmshell.hxx> // for FN_XFORMS_DESIGN_MODE
128 #include <SwRewriter.hxx>
129 #include <undobj.hxx>
131 #include <comcore.hrc>
136 FlyMode
SwBaseShell::eFrameMode
= FLY_DRAG_END
;
139 //Fuer die Erkennung der Id, die variable von Gallery mit SID_GALLERY_BG_BRUSH
141 static BYTE nParagraphPos
;
142 static BYTE nGraphicPos
;
144 static BYTE nFramePos
;
145 static BYTE nTablePos
;
146 static BYTE nTableRowPos
;
147 static BYTE nTableCellPos
;
148 static BYTE nPagePos
;
149 static BYTE nHeaderPos
;
150 static BYTE nFooterPos
;
153 #include <svx/svxslots.hxx>
157 #include <sfx2/msg.hxx>
158 #include "swslots.hxx"
160 #define SWCONTOURDLG(rView) ( (SvxContourDlg*) ( rView.GetViewFrame()->GetChildWindow( \
161 SvxContourDlgChildWindow::GetChildWindowId() )-> \
164 #define SWIMAPDLG(rView) ( (SvxIMapDlg*) ( rView.GetViewFrame()->GetChildWindow( \
165 SvxIMapDlgChildWindow::GetChildWindowId() )-> \
169 using namespace ::com::sun::star
;
170 using namespace ::com::sun::star::uno
;
171 using namespace ::com::sun::star::frame
;
172 using namespace ::com::sun::star::lang
;
175 SFX_IMPL_INTERFACE(SwBaseShell
, SfxShell
, SW_RES(0))
177 SFX_CHILDWINDOW_REGISTRATION(SvxIMapDlgChildWindow::GetChildWindowId());
178 SFX_CHILDWINDOW_REGISTRATION(SvxContourDlgChildWindow::GetChildWindowId());
181 TYPEINIT1(SwBaseShell
,SfxShell
)
183 /*--------------------------------------------------------------------
184 Beschreibung: statics
185 --------------------------------------------------------------------*/
188 void lcl_UpdateIMapDlg( SwWrtShell
& rSh
)
190 Graphic
aGrf( rSh
.GetIMapGraphic() );
191 GraphicType nGrfType
= aGrf
.GetType();
192 void* pEditObj
= GRAPHIC_NONE
!= nGrfType
&& GRAPHIC_DEFAULT
!= nGrfType
193 ? rSh
.GetIMapInventor() : 0;
194 TargetList
* pList
= new TargetList
;
195 rSh
.GetView().GetViewFrame()->GetTopFrame()->GetTargetList(*pList
);
197 SfxItemSet
aSet( rSh
.GetAttrPool(), RES_URL
, RES_URL
);
198 rSh
.GetFlyFrmAttr( aSet
);
199 const SwFmtURL
&rURL
= (SwFmtURL
&)aSet
.Get( RES_URL
);
200 SvxIMapDlgChildWindow::UpdateIMapDlg(
201 aGrf
, rURL
.GetMap(), pList
, pEditObj
);
203 USHORT nCount
= (USHORT
)pList
->Count();
205 for( USHORT i
= nCount
; i
; i
-- )
207 delete pList
->GetObject(i
-1);
213 BOOL
lcl_UpdateContourDlg( SwWrtShell
&rSh
, int nSel
)
215 Graphic
aGraf( rSh
.GetIMapGraphic() );
216 GraphicType nGrfType
= aGraf
.GetType();
217 BOOL bRet
= GRAPHIC_NONE
!= nGrfType
&& GRAPHIC_DEFAULT
!= nGrfType
;
221 if ( nSel
& nsSelectionType::SEL_GRF
)
222 rSh
.GetGrfNms( &aGrfName
, 0 );
224 SvxContourDlg
*pDlg
= SWCONTOURDLG(rSh
.GetView());
225 pDlg
->Update( aGraf
, aGrfName
.Len() > 0,
226 rSh
.GetGraphicPolygon(), rSh
.GetIMapInventor() );
231 /*--------------------------------------------------------------------
232 Beschreibung: loeschen
233 --------------------------------------------------------------------*/
235 void SwBaseShell::ExecDelete(SfxRequest
&rReq
)
237 SwWrtShell
&rSh
= GetShell();
238 SwEditWin
& rTmpEditWin
= GetView().GetEditWin();
239 switch(rReq
.GetSlot())
250 BOOL bLeft
= rSh
.Left( CRSR_SKIP_CHARS
, TRUE
, 1, FALSE
);
253 // JP 28.03.96: ein Backspace im Absatz ohne Nummer wird zum Delete
255 //rSh.DelRight( FALSE );
260 // JP 15.07.96: wenns nicht mehr nach vorne geht, die
261 // Numerierung aufheben. Z.B. am Doc-/
262 // Rahmen-/Tabellen-/Bereichs-Anfang
269 // ansonsten DelLeft rufen
270 case FN_SHIFT_BACKSPACE
:
274 DBG_ERROR("falscher Dispatcher");
279 //#i42732# - notify the edit window that from now on we do not use the input language
280 rTmpEditWin
.SetUseInputLanguage( sal_False
);
283 /*--------------------------------------------------------------------
285 --------------------------------------------------------------------*/
287 void SwBaseShell::ExecClpbrd(SfxRequest
&rReq
)
289 //Achtung: Suizid gefaehrdet! Nach Paste, Paste special kann der die
290 //Shell zerstoert sein.
293 SwWrtShell
&rSh
= GetShell();
294 USHORT nId
= rReq
.GetSlot();
295 sal_Bool bIgnore
= sal_False
;
300 rView
.GetEditWin().FlushInBuffer();
301 if ( rSh
.HasSelection() )
303 SwTransferable
* pTransfer
= new SwTransferable( rSh
);
304 /*??*/ uno::Reference
<
305 datatransfer::XTransferable
> xRef(
308 if ( nId
== SID_CUT
)
312 const BOOL bLockedView
= rSh
.IsViewLocked();
313 rSh
.LockView( TRUE
); //lock visible section
315 rSh
.LockView( bLockedView
);
323 TransferableDataHelper
aDataHelper(
324 TransferableDataHelper::CreateFromSystemClipboard(
325 &rSh
.GetView().GetEditWin() ) );
327 if( aDataHelper
.GetXTransferable().is() &&
328 SwTransferable::IsPaste( rSh
, aDataHelper
))
330 // temp. Variablen, da die Shell nach dem Paste schon
331 // zerstoert sein kann
332 SwView
* pView
= &rView
;
333 SwTransferable::Paste( rSh
, aDataHelper
);
334 if( rSh
.IsFrmSelected() || rSh
.IsObjSelected() )
335 rSh
.EnterSelFrmMode();
336 pView
->AttrChangedNotify( &rSh
);
343 case SID_CLIPBOARD_FORMAT_ITEMS
:
345 const SfxItemSet
* pArgs
= rReq
.GetArgs();
346 const SfxPoolItem
* pFmt
;
347 if( pArgs
&& SFX_ITEM_SET
== pArgs
->GetItemState( nId
, FALSE
, &pFmt
) )
349 TransferableDataHelper
aDataHelper(
350 TransferableDataHelper::CreateFromSystemClipboard(
351 &rSh
.GetView().GetEditWin()) );
352 if( aDataHelper
.GetXTransferable().is()
353 /*&& SwTransferable::IsPaste( rSh, aDataHelper )*/ )
355 // temp. Variablen, da die Shell nach dem Paste schon
356 // zerstoert sein kann
357 SwView
* pView
= &rView
;
359 SwTransferable::PasteFormat( rSh
, aDataHelper
,
360 ((SfxUInt32Item
*)pFmt
)->GetValue() );
362 //Done() has to be called before the shell has been removed
365 if( rSh
.IsFrmSelected() || rSh
.IsObjSelected())
366 rSh
.EnterSelFrmMode();
367 pView
->AttrChangedNotify( &rSh
);
373 case SID_PASTE_UNFORMATTED
:
375 TransferableDataHelper
aDataHelper(
376 TransferableDataHelper::CreateFromSystemClipboard(
377 &rSh
.GetView().GetEditWin()) );
378 if( aDataHelper
.GetXTransferable().is() &&
379 SwTransferable::IsPaste( rSh
, aDataHelper
))
381 // temp. Variablen, da die Shell nach dem Paste schon
382 // zerstoert sein kann
383 SwView
* pView
= &rView
;
386 int nRet
= SwTransferable::PasteUnformatted( rSh
, aDataHelper
);
387 if(nRet
)// && rReq.IsRecording() )
389 SfxViewFrame
* pViewFrame
= pView
->GetViewFrame();
390 uno::Reference
< frame::XDispatchRecorder
> xRecorder
=
391 pViewFrame
->GetBindings().GetRecorder();
393 SfxRequest
aReq( pViewFrame
, SID_CLIPBOARD_FORMAT_ITEMS
);
394 aReq
.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS
, SOT_FORMAT_STRING
) );
399 if (rSh
.IsFrmSelected() || rSh
.IsObjSelected())
400 rSh
.EnterSelFrmMode();
401 pView
->AttrChangedNotify( &rSh
);
408 case FN_PASTESPECIAL
:
410 TransferableDataHelper
aDataHelper(
411 TransferableDataHelper::CreateFromSystemClipboard(
412 &rSh
.GetView().GetEditWin()) );
413 if( aDataHelper
.GetXTransferable().is() &&
414 SwTransferable::IsPaste( rSh
, aDataHelper
))
416 // temp. Variablen, da die Shell nach dem Paste schon
417 // zerstoert sein kann
418 SwView
* pView
= &rView
;
422 int nRet
= SwTransferable::PasteSpecial( rSh
, aDataHelper
, nFormatId
);
423 if(nRet
)// && rReq.IsRecording() )
425 SfxViewFrame
* pViewFrame
= pView
->GetViewFrame();
426 uno::Reference
< frame::XDispatchRecorder
> xRecorder
=
427 pViewFrame
->GetBindings().GetRecorder();
429 SfxRequest
aReq( pViewFrame
, SID_CLIPBOARD_FORMAT_ITEMS
);
430 aReq
.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS
, nFormatId
) );
435 if (rSh
.IsFrmSelected() || rSh
.IsObjSelected())
436 rSh
.EnterSelFrmMode();
437 pView
->AttrChangedNotify( &rSh
);
444 DBG_ERROR("falscher Dispatcher");
451 /*--------------------------------------------------------------------
452 Beschreibung: ClipBoard-Status
453 --------------------------------------------------------------------*/
455 void SwBaseShell::StateClpbrd(SfxItemSet
&rSet
)
457 SwWrtShell
&rSh
= GetShell();
458 SfxWhichIter
aIter(rSet
);
460 const BOOL bCopy
= rSh
.HasSelection();
462 USHORT nWhich
= aIter
.FirstWhich();
469 if( 0 != rSh
.IsSelObjProtected(FLYPROTECT_CONTENT
|FLYPROTECT_PARENT
) )
471 rSet
.DisableItem( nWhich
);
476 rSet
.DisableItem( nWhich
);
480 if( !GetView().IsPasteAllowed() )
481 rSet
.DisableItem( SID_PASTE
);
484 case FN_PASTESPECIAL
:
485 if( !GetView().IsPasteSpecialAllowed() )
487 rSet
.DisableItem( FN_PASTESPECIAL
);
488 rSet
.DisableItem( SID_PASTE_UNFORMATTED
);
492 case SID_CLIPBOARD_FORMAT_ITEMS
:
494 TransferableDataHelper
aDataHelper(
495 TransferableDataHelper::CreateFromSystemClipboard(
496 &rSh
.GetView().GetEditWin()) );
498 SvxClipboardFmtItem
aFmtItem( nWhich
);
499 SwTransferable::FillClipFmtItem( rSh
, aDataHelper
, aFmtItem
);
500 rSet
.Put( aFmtItem
);
504 nWhich
= aIter
.NextWhich();
508 /*--------------------------------------------------------------------
509 Beschreibung: Undo ausfuehren
510 --------------------------------------------------------------------*/
512 void SwBaseShell::ExecUndo(SfxRequest
&rReq
)
514 SwWrtShell
&rSh
= GetShell();
516 USHORT nId
= rReq
.GetSlot(), nCnt
= 1;
517 const SfxItemSet
* pArgs
= rReq
.GetArgs();
518 const SfxPoolItem
* pItem
;
519 if( pArgs
&& SFX_ITEM_SET
== pArgs
->GetItemState( nId
, FALSE
, &pItem
))
520 nCnt
= ((SfxUInt16Item
*)pItem
)->GetValue();
526 rSh
.Do( SwWrtShell::UNDO
, nCnt
);
532 rSh
.Do( SwWrtShell::REDO
, nCnt
);
537 rSh
.Do( SwWrtShell::REPEAT
);
540 DBG_ERROR("falscher Dispatcher");
544 /*--------------------------------------------------------------------
545 Beschreibung: Zustand Undo
546 --------------------------------------------------------------------*/
548 void SwBaseShell::StateUndo(SfxItemSet
&rSet
)
550 SwWrtShell
&rSh
= GetShell();
551 SfxWhichIter
aIter(rSet
);
552 USHORT nWhich
= aIter
.FirstWhich();
559 if( rSh
.GetUndoIds() )
560 rSet
.Put( SfxStringItem(nWhich
,
561 rSh
.GetDoString(SwWrtShell::UNDO
)));
563 rSet
.DisableItem(nWhich
);
569 rSet
.Put(SfxStringItem(nWhich
,
570 rSh
.GetDoString(SwWrtShell::REDO
)));
572 rSet
.DisableItem(nWhich
);
576 { // Repeat nur moeglich wenn kein REDO moeglich - UI-Restriktion
577 if(rSh
.GetRedoIds() == UNDO_EMPTY
&&
578 !rSh
.IsSelFrmMode() &&
580 rSet
.Put(SfxStringItem(nWhich
, rSh
.GetRepeatString()));
582 rSet
.DisableItem(nWhich
);
586 case SID_GETUNDOSTRINGS
:
587 if( rSh
.GetUndoIds() )
589 SfxStringListItem
aStrLst( nWhich
);
590 rSh
.GetDoStrings( SwWrtShell::UNDO
, aStrLst
);
594 rSet
.DisableItem( nWhich
);
597 case SID_GETREDOSTRINGS
:
598 if( rSh
.GetRedoIds() )
600 SfxStringListItem
aStrLst( nWhich
);
601 rSh
.GetDoStrings( SwWrtShell::REDO
, aStrLst
);
605 rSet
.DisableItem( nWhich
);
608 nWhich
= aIter
.NextWhich();
612 /*--------------------------------------------------------------------
613 Beschreibung: Slot-Id auswerten bzw. Dispatchen
614 --------------------------------------------------------------------*/
616 void SwBaseShell::Execute(SfxRequest
&rReq
)
618 const SfxPoolItem
*pItem
;
619 SwWrtShell
&rSh
= GetShell();
620 const SfxItemSet
* pArgs
= rReq
.GetArgs();
623 USHORT nSlot
= rReq
.GetSlot();
628 Reference
< XModel
> xModel
= GetView().GetDocShell()->GetModel();
629 Reference
< XUnoTunnel
> xDocTunnel ( xModel
, UNO_QUERY
);
630 SwXTextDocument
*pDoc
= reinterpret_cast < SwXTextDocument
* > ( xDocTunnel
->getSomething ( SwXTextDocument::getUnoTunnelId() ) );
631 pDoc
->notifyRefreshListeners();
635 case FN_UPDATE_FIELDS
:
638 rSh
.UpdateDocStat(aDocStat
);
639 rSh
.EndAllTblBoxEdit();
640 rSh
.ViewShell::UpdateFlds(TRUE
);
642 if( rSh
.IsCrsrInTbl() )
644 if( !rSh
.IsTblComplexForChart() )
645 SwTableFUNC( &rSh
, FALSE
).UpdateChart();
646 rSh
.ClearTblBoxCntnt();
647 rSh
.SaveTblBoxCntnt();
651 case FN_UPDATE_CHARTS
:
653 SwWait
aWait( *rView
.GetDocShell(), TRUE
);
654 rSh
.UpdateAllCharts();
660 SwView
& rTempView
= GetView();
662 if( rSh
.GetLinkManager().GetLinks().Count() )
664 rSh
.StartAllAction();
665 rSh
.GetLinkManager().UpdateAllLinks( FALSE
, TRUE
, TRUE
);
668 SfxDispatcher
&rDis
= *rTempView
.GetViewFrame()->GetDispatcher();
669 rDis
.Execute( FN_UPDATE_FIELDS
);
670 rDis
.Execute( FN_UPDATE_TOX
);
671 rDis
.Execute( FN_UPDATE_CHARTS
);
676 case FN_UPDATE_INPUTFIELDS
:
677 rSh
.UpdateInputFlds(NULL
, FALSE
);
679 case FN_PREV_BOOKMARK
:
680 rReq
.SetReturnValue(SfxBoolItem( nSlot
, rSh
.GoPrevBookmark()));
682 case FN_NEXT_BOOKMARK
:
683 rReq
.SetReturnValue(SfxBoolItem( nSlot
, rSh
.GoNextBookmark()));
686 case FN_GOTO_NEXT_MARK
:
687 case FN_GOTO_PREV_MARK
:
690 SwFieldType
* pFldType
= aFldMgr
.GetFldType(RES_JUMPEDITFLD
);
694 if (rSh
.IsSelFrmMode())
697 rSh
.LeaveSelFrmMode();
703 if (rSh
.IsCrsrPtAtEnd())
708 BOOL bRet
= rSh
.MoveFldType(pFldType
, nSlot
== FN_GOTO_NEXT_MARK
);
710 rSh
.ClickToField(*rSh
.GetCurFld());
711 rReq
.SetReturnValue(SfxBoolItem( nSlot
, bRet
));
716 case FN_START_DOC_DIRECT
:
717 case FN_END_DOC_DIRECT
:
719 if (rSh
.IsSelFrmMode())
722 rSh
.LeaveSelFrmMode();
725 nSlot
== FN_START_DOC_DIRECT
?
726 rSh
.SttEndDoc(TRUE
) :
727 rSh
.SttEndDoc(FALSE
);
730 case FN_GOTO_PREV_OBJ
:
731 case FN_GOTO_NEXT_OBJ
:
733 BOOL bSuccess
= rSh
.GotoObj(
734 nSlot
== FN_GOTO_NEXT_OBJ
? TRUE
: FALSE
);
735 rReq
.SetReturnValue(SfxBoolItem(nSlot
, bSuccess
));
736 if (bSuccess
&& !rSh
.IsSelFrmMode())
739 rSh
.EnterSelFrmMode();
740 GetView().AttrChangedNotify( &rSh
);
744 case SID_GALLERY_FORMATS
:
746 const int nSelType
= rSh
.GetSelectionType();
747 if(SFX_ITEM_SET
== pArgs
->GetItemState( nSlot
, TRUE
, &pItem
))
749 GalleryExplorer
* pGal
= 0;
750 if ( (!rSh
.IsSelFrmMode() || nSelType
& nsSelectionType::SEL_GRF
) &&
751 0!= (pGal
= SVX_GALLERY())&&
752 0 != (SGA_FORMAT_GRAPHIC
& ((SfxUInt32Item
*)pItem
)->GetValue()))
754 SwWait
aWait( *rView
.GetDocShell(), TRUE
);
756 String aGrfName
, aFltName
;
757 const Graphic
aGrf( pGal
->GetGraphic() );
759 if( pGal
->IsLinkage() )
762 aGrfName
= pGal
->GetURL().GetMainURL(INetURLObject::NO_DECODE
);
763 aFltName
= pGal
->GetFilterName();
766 if ( nSelType
& nsSelectionType::SEL_GRF
)
767 rSh
.ReRead( aGrfName
, aFltName
, &aGrf
);
769 rSh
.Insert( aGrfName
, aFltName
, aGrf
);
771 GetView().GetEditWin().GrabFocus();
773 else if(!rSh
.IsSelFrmMode() && SGA_FORMAT_SOUND
& ((SfxUInt32Item
*)pItem
)->GetValue())
775 const SfxStringItem
aMediaURLItem( SID_INSERT_AVMEDIA
, pGal
->GetURL().GetMainURL( INetURLObject::NO_DECODE
) );
776 GetView().GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_AVMEDIA
, SFX_CALLMODE_SYNCHRON
, &aMediaURLItem
, 0L );
778 String sURL( pGal->GetURL().GetMainURL( INetURLObject::NO_DECODE ) );
779 String sLabel( pGal->GetURL().getBase() );
780 String sTarget; // empty string!
784 ::GetHtmlMode( GetView().GetDocShell() ) );
786 // in Writer, we insert a button which plays the
787 // sound. In Writer/Web, we just insert a (text) link.
789 InsertURLButton( sURL, sTarget, sLabel );
791 rSh.InsertURL( SwFmtINetFmt( sURL, sTarget ), sLabel );
797 case FN_PAGE_STYLE_SET_COLS
:
801 // aktuellen PageDescriptor ermitteln und damit den Set fuellen
802 const USHORT nCurIdx
= rSh
.GetCurPageDesc();
803 SwPageDesc
aPageDesc(rSh
.GetPageDesc(nCurIdx
));
805 SwFrmFmt
&rFmt
= aPageDesc
.GetMaster();
807 SwFmtCol aFmtCol
= rFmt
.GetCol();
810 if(SFX_ITEM_SET
== pArgs
->GetItemState(nSlot
))
811 nCount
= ((SfxUInt16Item
&)pArgs
->Get(nSlot
)).GetValue();
813 nCount
= ((SfxUInt16Item
&)pArgs
->Get(SID_ATTR_COLUMNS
)).GetValue();
814 USHORT nGutterWidth
= DEF_GUTTER_WIDTH
;
816 aFmtCol
.Init(nCount
? nCount
: 1, nGutterWidth
, USHRT_MAX
);
817 aFmtCol
.SetWishWidth(USHRT_MAX
);
818 aFmtCol
.SetGutterWidth(nGutterWidth
, USHRT_MAX
);
820 rFmt
.SetFmtAttr(aFmtCol
);
822 rSh
.ChgPageDesc(nCurIdx
, aPageDesc
);
825 GetView().GetViewFrame()->GetDispatcher()->Execute(FN_FORMAT_PAGE_COLUMN_DLG
, FALSE
);
828 case FN_CONVERT_TABLE_TO_TEXT
:
829 case FN_CONVERT_TEXT_TO_TABLE
:
830 case FN_CONVERT_TEXT_TABLE
:
832 sal_Unicode cDelim
= 0;
833 bool bToTable
= false;
834 if( nSlot
== FN_CONVERT_TEXT_TO_TABLE
||
835 ( nSlot
== FN_CONVERT_TEXT_TABLE
&& 0 == rSh
.GetTableFmt() ))
837 SwInsertTableOptions
aInsTblOpts( tabopts::ALL_TBL_INS_ATTR
, 1 );
838 SwTableAutoFmt
* pTAFmt
= 0;
839 SwTableAutoFmtTbl
* pAutoFmtTbl
= 0;
840 bool bDeleteFormat
= true;
841 if(pArgs
&& SFX_ITEM_SET
== pArgs
->GetItemState( FN_PARAM_1
, TRUE
, &pItem
))
843 aInsTblOpts
.mnInsMode
= 0;
845 String sDelim
= static_cast< const SfxStringItem
* >(pItem
)->GetValue();
847 cDelim
= sDelim
.GetChar(0);
849 if(SFX_ITEM_SET
== pArgs
->GetItemState( FN_PARAM_2
, TRUE
, &pItem
))
851 String sAutoFmt
= static_cast< const SfxStringItem
* >(pItem
)->GetValue();
853 pAutoFmtTbl
= new SwTableAutoFmtTbl
;
856 for( USHORT i
= 0, nCount
= pAutoFmtTbl
->Count(); i
< nCount
; i
++ )
858 SwTableAutoFmt
* pFmt
= (*pAutoFmtTbl
)[ i
];
859 if( pFmt
->GetName() == sAutoFmt
)
862 bDeleteFormat
= false;
868 if(SFX_ITEM_SET
== pArgs
->GetItemState( FN_PARAM_3
, TRUE
, &pItem
) &&
869 static_cast< const SfxBoolItem
* >(pItem
)->GetValue())
870 aInsTblOpts
.mnInsMode
|= tabopts::HEADLINE
;
872 if(SFX_ITEM_SET
== pArgs
->GetItemState( FN_PARAM_4
, TRUE
, &pItem
))
873 aInsTblOpts
.mnRowsToRepeat
=
874 (USHORT
)static_cast< const SfxInt16Item
* >(pItem
)->GetValue();
876 if(SFX_ITEM_SET
== pArgs
->GetItemState( FN_PARAM_5
, TRUE
, &pItem
) &&
877 static_cast< const SfxBoolItem
* >(pItem
)->GetValue())
878 aInsTblOpts
.mnInsMode
|= tabopts::DEFAULT_BORDER
;
880 if(SFX_ITEM_SET
== pArgs
->GetItemState( FN_PARAM_6
, TRUE
, &pItem
) &&
881 !static_cast< const SfxBoolItem
* >(pItem
)->GetValue() )
882 aInsTblOpts
.mnInsMode
|= tabopts::SPLIT_LAYOUT
;
886 SwAbstractDialogFactory
* pFact
= SwAbstractDialogFactory::Create();
887 DBG_ASSERT(pFact
, "SwAbstractDialogFactory fail!");
889 AbstractSwConvertTableDlg
* pDlg
= pFact
->CreateSwConvertTableDlg(
890 GetView(),DLG_CONV_TEXT_TABLE
, bToTable
);
891 DBG_ASSERT(pDlg
, "Dialogdiet fail!");
892 if( RET_OK
== pDlg
->Execute() )
894 pDlg
->GetValues( cDelim
, aInsTblOpts
, pTAFmt
);
903 SwView
& rSaveView
= rView
;
904 BOOL bInserted
= FALSE
;
907 SfxViewFrame
* pViewFrame
= GetView().GetViewFrame();
908 if( SfxRequest::HasMacroRecorder(pViewFrame
) )
910 SfxRequest
aReq( pViewFrame
, nSlot
);
911 aReq
.AppendItem( SfxStringItem( FN_PARAM_1
, String(cDelim
) ));
915 aReq
.AppendItem( SfxStringItem( FN_PARAM_2
, pTAFmt
->GetName()));
916 aReq
.AppendItem( SfxBoolItem ( FN_PARAM_3
, 0 != (aInsTblOpts
.mnInsMode
& tabopts::HEADLINE
)));
917 aReq
.AppendItem( SfxInt16Item( FN_PARAM_4
, (short)aInsTblOpts
.mnRowsToRepeat
));
918 aReq
.AppendItem( SfxBoolItem ( FN_PARAM_5
, 0 != (aInsTblOpts
.mnInsMode
& tabopts::DEFAULT_BORDER
) ));
919 aReq
.AppendItem( SfxBoolItem ( FN_PARAM_6
, !(aInsTblOpts
.mnInsMode
& tabopts::SPLIT_LAYOUT
)));
925 rSh
.TableToText( cDelim
);
928 bInserted
= rSh
.TextToTable( aInsTblOpts
, cDelim
, text::HoriOrientation::FULL
, pTAFmt
);
933 rSaveView
.AutoCaption( TABLE_CAP
);
940 case SID_STYLE_WATERCAN
:
941 case SID_STYLE_UPDATE_BY_EXAMPLE
:
942 case SID_STYLE_NEW_BY_EXAMPLE
:
943 case SID_STYLE_APPLY
:
945 ShellModes eMode
= GetView().GetShellMode();
946 if ( SHELL_MODE_DRAW
!= eMode
&&
947 SHELL_MODE_DRAW_CTRL
!= eMode
&&
948 SHELL_MODE_DRAW_FORM
!= eMode
&&
949 SHELL_MODE_DRAWTEXT
!= eMode
&&
950 SHELL_MODE_BEZIER
!= eMode
)
953 if ( SID_STYLE_WATERCAN
== nSlot
)
955 const BOOL bLockedView
= rSh
.IsViewLocked();
956 rSh
.LockView( TRUE
); //lock visible section
958 GetView().GetDocShell()->ExecStyleSheet(rReq
);
960 rSh
.LockView( bLockedView
);
963 // wird von der DocShell aufgezeichnet
964 GetView().GetDocShell()->ExecStyleSheet(rReq
);
969 GetView().ExecuteSlot(rReq
);
973 USHORT nId
= SvxIMapDlgChildWindow::GetChildWindowId();
975 SfxViewFrame
* pVFrame
= GetView().GetViewFrame();
976 pVFrame
->ToggleChildWindow( nId
);
977 pVFrame
->GetBindings().Invalidate( SID_IMAP
);
979 if ( pVFrame
->HasChildWindow( nId
) && rSh
.IsFrmSelected() )
980 lcl_UpdateIMapDlg( rSh
);
985 SvxIMapDlg
* pDlg
= SWIMAPDLG(GetView());
987 // Kontrolle, ob Zuweisung ueberhaupt sinnvoll/erlaubt
988 if ( rSh
.IsFrmSelected() &&
989 pDlg
->GetEditingObject() == rSh
.GetIMapInventor() )
991 SfxItemSet
aSet( rSh
.GetAttrPool(), RES_URL
, RES_URL
);
992 rSh
.GetFlyFrmAttr( aSet
);
993 SwFmtURL
aURL( (SwFmtURL
&)aSet
.Get( RES_URL
) );
994 aURL
.SetMap( &pDlg
->GetImageMap() );
996 rSh
.SetFlyFrmAttr( aSet
);
1000 case SID_CONTOUR_DLG
:
1002 USHORT nId
= SvxContourDlgChildWindow::GetChildWindowId();
1004 SfxViewFrame
* pVFrame
= GetView().GetViewFrame();
1005 pVFrame
->ToggleChildWindow( nId
);
1006 pVFrame
->GetBindings().Invalidate( SID_CONTOUR_DLG
);
1008 int nSel
= rSh
.GetSelectionType();
1009 if ( pVFrame
->HasChildWindow( nId
) &&
1010 (nSel
& (nsSelectionType::SEL_GRF
|nsSelectionType::SEL_OLE
)) )
1012 lcl_UpdateContourDlg( rSh
, nSel
);
1016 case SID_CONTOUR_EXEC
:
1018 SvxContourDlg
*pDlg
= SWCONTOURDLG(GetView());
1020 // Kontrolle, ob Zuweisung ueberhaupt sinnvoll/erlaubt
1021 int nSel
= rSh
.GetSelectionType();
1022 if ( nSel
& (nsSelectionType::SEL_GRF
|nsSelectionType::SEL_OLE
) )
1024 if ( pDlg
->GetEditingObject() == rSh
.GetIMapInventor() )
1027 SfxItemSet
aSet( rSh
.GetAttrPool(), RES_SURROUND
, RES_SURROUND
);
1028 rSh
.GetFlyFrmAttr( aSet
);
1029 SwFmtSurround
aSur( (SwFmtSurround
&)aSet
.Get( RES_SURROUND
) );
1030 if ( !aSur
.IsContour() )
1032 aSur
.SetContour( TRUE
);
1033 if ( aSur
.GetSurround() == SURROUND_NONE
)
1034 aSur
.SetSurround( SURROUND_PARALLEL
);
1036 rSh
.SetFlyFrmAttr( aSet
);
1038 const PolyPolygon
aPoly( pDlg
->GetPolyPolygon() );
1039 rSh
.SetGraphicPolygon( &aPoly
);
1040 if ( pDlg
->IsGraphicChanged() )
1041 rSh
.ReRead( aEmptyStr
, aEmptyStr
, &pDlg
->GetGraphic());
1047 case FN_FRAME_TO_ANCHOR
:
1049 rSh
.GotoFlyAnchor();
1056 case FN_TOOL_ANKER_PAGE
:
1057 case FN_TOOL_ANKER_PARAGRAPH
:
1058 case FN_TOOL_ANKER_CHAR
:
1059 case FN_TOOL_ANKER_AT_CHAR
:
1060 case FN_TOOL_ANKER_FRAME
:
1062 RndStdIds eSet
= nSlot
== FN_TOOL_ANKER_PAGE
1064 : nSlot
== FN_TOOL_ANKER_PARAGRAPH
1066 : nSlot
== FN_TOOL_ANKER_FRAME
1068 : nSlot
== FN_TOOL_ANKER_CHAR
1072 if( rSh
.IsObjSelected() )
1073 rSh
.ChgAnchor( eSet
);
1074 else if( rSh
.IsFrmSelected() )
1076 // Der Set beinhaltet auch VERT/HORI_ORIENT, da in FEShell::
1077 // SetFlyFrmAttr/SetFlyFrmAnchor ggf. als Folge des Umankerns
1078 // die Ausrichtungen veraendert werden sollen.
1079 SfxItemSet
aSet( GetPool(), RES_VERT_ORIENT
, RES_ANCHOR
);
1080 SwFmtAnchor
aAnc( eSet
, rSh
.GetPhyPageNum() );
1082 rSh
.SetFlyFrmAttr(aSet
);
1085 USHORT nHtmlMode
= ::GetHtmlMode(GetView().GetDocShell());
1088 SfxItemSet
aSet(GetPool(), RES_SURROUND
, RES_HORI_ORIENT
);
1089 rSh
.GetFlyFrmAttr(aSet
);
1091 const SwFmtSurround
& rSurround
= (const SwFmtSurround
&)aSet
.Get(RES_SURROUND
);
1092 const SwFmtVertOrient
& rVert
= (const SwFmtVertOrient
&)aSet
.Get(RES_VERT_ORIENT
);
1093 const SwFmtHoriOrient
& rHori
= (const SwFmtHoriOrient
&)aSet
.Get(RES_HORI_ORIENT
);
1094 sal_Int16 eVOrient
= rVert
.GetVertOrient();
1095 sal_Int16 eHOrient
= rHori
.GetHoriOrient();
1096 SwSurround eSurround
= rSurround
.GetSurround();
1103 //Durchlauf, links oder von links, oben, von oben
1104 if(eSurround
!= SURROUND_THROUGHT
)
1105 aSet
.Put(SwFmtSurround(SURROUND_THROUGHT
));
1107 if( eVOrient
!= text::VertOrientation::TOP
&& eVOrient
!= text::VertOrientation::NONE
)
1108 aSet
.Put(SwFmtVertOrient(0, text::VertOrientation::TOP
));
1110 if(eHOrient
!= text::HoriOrientation::NONE
|| eHOrient
!= text::HoriOrientation::LEFT
)
1111 aSet
.Put(SwFmtHoriOrient(0, text::HoriOrientation::LEFT
));
1115 //links, von links, rechts, oben, kein Uml, li+re Umlauf,
1116 if(eSurround
!= SURROUND_LEFT
|| eSurround
!= SURROUND_RIGHT
)
1117 aSet
.Put(SwFmtSurround(SURROUND_LEFT
));
1119 if( eVOrient
!= text::VertOrientation::TOP
)
1120 aSet
.Put(SwFmtVertOrient(0, text::VertOrientation::TOP
));
1122 if(eHOrient
!= text::HoriOrientation::NONE
|| eHOrient
!= text::HoriOrientation::LEFT
|| eHOrient
!= text::HoriOrientation::RIGHT
)
1123 aSet
.Put(SwFmtHoriOrient(0, text::HoriOrientation::LEFT
));
1126 case FLY_AUTO_CNTNT
:
1127 //links, von links, rechts, oben, Durchlauf
1128 if(eSurround
!= SURROUND_THROUGHT
)
1129 aSet
.Put(SwFmtSurround(SURROUND_THROUGHT
));
1131 if( eVOrient
!= text::VertOrientation::TOP
)
1132 aSet
.Put(SwFmtVertOrient(0, text::VertOrientation::TOP
));
1134 if(eHOrient
!= text::HoriOrientation::NONE
|| eHOrient
!= text::HoriOrientation::LEFT
|| eHOrient
!= text::HoriOrientation::RIGHT
)
1135 aSet
.Put(SwFmtHoriOrient(0, text::HoriOrientation::LEFT
));
1143 rSh
.SetFlyFrmAttr( aSet
);
1147 GetView().GetViewFrame()->GetBindings().Invalidate( FN_TOOL_ANKER
);
1151 case FN_FRAME_NOWRAP
:
1153 case FN_FRAME_WRAP_IDEAL
:
1154 case FN_FRAME_WRAPTHRU
:
1155 case FN_FRAME_WRAPTHRU_TRANSP
:
1156 case FN_FRAME_WRAP_CONTOUR
:
1157 case FN_WRAP_ANCHOR_ONLY
:
1158 case FN_FRAME_WRAP_LEFT
:
1159 case FN_FRAME_WRAP_RIGHT
:
1160 SetWrapMode( nSlot
);
1163 case FN_UPDATE_ALL_LINKS
:
1165 if( rSh
.GetLinkManager().GetLinks().Count() )
1167 BOOL bUpdateGrf
= FALSE
, bCallErrHdl
= FALSE
;
1169 rSh
.StartAllAction();
1170 rSh
.GetLinkManager().UpdateAllLinks( FALSE
, bCallErrHdl
, bUpdateGrf
);
1176 case FN_XFORMS_DESIGN_MODE
:
1178 && pArgs
->GetItemState( nSlot
, TRUE
, &pItem
) == SFX_ITEM_SET
1180 && pItem
->ISA( SfxBoolItem
) )
1183 static_cast<const SfxBoolItem
*>( pItem
)->GetValue();
1185 // set form design mode
1186 DBG_ASSERT( GetView().GetFormShell() != NULL
, "form shell?" );
1187 SfxRequest
aReq( GetView().GetViewFrame(), SID_FM_DESIGN_MODE
);
1188 aReq
.AppendItem( SfxBoolItem( SID_FM_DESIGN_MODE
, bDesignMode
) );
1189 GetView().GetFormShell()->Execute( aReq
);
1192 // also set suitable view options
1193 SwViewOption aViewOption
= *rSh
.GetViewOptions();
1194 aViewOption
.SetFormView( ! bDesignMode
);
1195 rSh
.ApplyViewOptions( aViewOption
);
1205 pArgs
->GetItemState(GetPool().GetWhich(nSlot
), FALSE
, &pItem
);
1209 case SID_ATTR_BRUSH
:
1210 case SID_ATTR_BORDER_SHADOW
:
1213 rSh
.StartAllAction();
1214 SfxItemSet
aSet( rSh
.GetAttrPool(),
1215 RES_SHADOW
, RES_SHADOW
,
1216 RES_BACKGROUND
, RES_BACKGROUND
, 0 );
1219 // Tabellenzelle(n) selektiert?
1220 if ( rSh
.IsTableMode() )
1222 SwFrmFmt
*pFmt
= rSh
.GetTableFmt();
1223 pFmt
->SetFmtAttr( *pItem
);
1225 else if ( rSh
.IsFrmSelected() )
1227 // Umrandungsattribute ueber Frame-Manager setzen
1228 SwFlyFrmAttrMgr
aMgr( FALSE
, &rSh
, FRMMGR_TYPE_NONE
);
1229 aMgr
.SetAttrSet( *pArgs
);
1230 aMgr
.UpdateFlyFrm();
1234 rSh
.SetAttr( *pArgs
);
1239 case FN_PAGE_STYLE_SET_LR_MARGIN
:
1240 case FN_PAGE_STYLE_SET_UL_MARGIN
:
1241 case FN_PAGE_STYLE_SET_NUMBER_FORMAT
:
1242 case FN_PAGE_STYLE_SET_PAPER_SIZE
:
1243 case FN_PAGE_STYLE_SET_PAPER_BIN
:
1245 DBG_ERROR("not implemented");
1249 case SID_ATTR_BORDER_OUTER
:
1251 // Tabellenzelle(n) selektiert?
1252 if ( rSh
.IsTableMode() )
1254 // Umrandungattribute Get/SetTabBorders() setzen
1255 rSh
.SetTabBorders(*pArgs
);
1257 else if ( rSh
.IsFrmSelected() )
1259 // Umrandungsattribute ueber Frame-Manager setzen
1260 SwFlyFrmAttrMgr
aMgr( FALSE
, &rSh
, FRMMGR_TYPE_NONE
);
1261 aMgr
.SetAttrSet(*pArgs
);
1262 aMgr
.UpdateFlyFrm();
1266 // Umrandungsattribute ganz normal ueber Shell setzen
1267 rSh
.SetAttr( *pItem
);
1272 DBG_ERROR("falscher Dispatcher");
1278 /* -----------------14.04.99 15:10-------------------
1279 * Hier wird der State fuer SID_IMAP / SID_CONTOUR behandelt,
1280 * wenn die Grafik ausgeswappt ist
1281 * --------------------------------------------------*/
1282 IMPL_LINK(SwBaseShell
, GraphicArrivedHdl
, SwCrsrShell
* , EMPTYARG
)
1285 SwWrtShell
&rSh
= GetShell();
1286 if( CNT_GRF
== rSh
.SwEditShell::GetCntType() &&
1287 GRAPHIC_NONE
!= ( nGrfType
= rSh
.GetGraphicType() ) &&
1288 aGrfUpdateSlots
.Count() )
1290 BOOL bProtect
= 0 != rSh
.IsSelObjProtected(FLYPROTECT_CONTENT
|FLYPROTECT_PARENT
);
1291 SfxViewFrame
* pVFrame
= GetView().GetViewFrame();
1293 for( USHORT n
= 0; n
< aGrfUpdateSlots
.Count(); ++n
)
1295 BOOL bSetState
= FALSE
;
1296 BOOL bState
= FALSE
;
1297 switch( nSlot
= aGrfUpdateSlots
[ n
] )
1302 USHORT nId
= SvxIMapDlgChildWindow::GetChildWindowId();
1303 SvxIMapDlg
*pDlg
= pVFrame
->HasChildWindow( nId
) ?
1304 (SvxIMapDlg
*) ( pVFrame
->GetChildWindow( nId
)
1307 if( pDlg
&& ( SID_IMAP_EXEC
== nSlot
||
1308 ( SID_IMAP
== nSlot
&& !bProtect
)) &&
1309 pDlg
->GetEditingObject() != rSh
.GetIMapInventor())
1310 lcl_UpdateIMapDlg( rSh
);
1312 if( !bProtect
&& SID_IMAP
== nSlot
)
1313 bSetState
= TRUE
, bState
= 0 != pDlg
;
1317 case SID_CONTOUR_DLG
:
1320 USHORT nId
= SvxContourDlgChildWindow::GetChildWindowId();
1321 SvxIMapDlg
*pDlg
= pVFrame
->HasChildWindow( nId
) ?
1322 (SvxIMapDlg
*) ( pVFrame
->GetChildWindow( nId
)
1324 if( pDlg
&& pDlg
->GetEditingObject() !=
1325 rSh
.GetIMapInventor() )
1326 lcl_UpdateContourDlg( rSh
, nsSelectionType::SEL_GRF
);
1333 case FN_FRAME_WRAP_CONTOUR
:
1336 SfxItemSet
aSet(GetPool(), RES_SURROUND
, RES_SURROUND
);
1337 rSh
.GetFlyFrmAttr(aSet
);
1338 const SwFmtSurround
& rWrap
= (const SwFmtSurround
&)aSet
.Get(RES_SURROUND
);
1340 bState
= rWrap
.IsContour();
1345 case SID_GRFFILTER_INVERT
:
1346 case SID_GRFFILTER_SMOOTH
:
1347 case SID_GRFFILTER_SHARPEN
:
1348 case SID_GRFFILTER_REMOVENOISE
:
1349 case SID_GRFFILTER_SOBEL
:
1350 case SID_GRFFILTER_MOSAIC
:
1351 case SID_GRFFILTER_EMBOSS
:
1352 case SID_GRFFILTER_POSTER
:
1353 case SID_GRFFILTER_POPART
:
1354 case SID_GRFFILTER_SEPIA
:
1355 case SID_GRFFILTER_SOLARIZE
:
1356 bSetState
= bState
= GRAPHIC_BITMAP
== nGrfType
;
1362 SfxBoolItem
aBool( nSlot
, bState
);
1364 pGetStateSet
->Put( aBool
);
1366 pVFrame
->GetBindings().SetState( aBool
);
1369 aGrfUpdateSlots
.RemoveAt( 0, aGrfUpdateSlots
.Count() );
1374 void SwBaseShell::GetState( SfxItemSet
&rSet
)
1376 SwWrtShell
&rSh
= GetShell();
1377 SfxViewFrame
* pVFrame
= GetView().GetViewFrame();
1378 SfxWhichIter
aIter( rSet
);
1379 USHORT nWhich
= aIter
.FirstWhich();
1380 pGetStateSet
= &rSet
;
1385 case SID_GALLERY_FORMATS
:
1386 if ( rSh
.IsObjSelected() ||
1387 (rSh
.IsSelFrmMode() &&
1388 !(rSh
.GetSelectionType() & nsSelectionType::SEL_GRF
)) )
1389 rSet
.DisableItem( nWhich
);
1391 case SID_GALLERY_ENABLE_ADDCOPY
:
1392 // #108230# allow copy from gallery in Writer AND Writer/Web!
1393 rSet
.Put( SfxBoolItem( SID_GALLERY_ENABLE_ADDCOPY
, TRUE
) );
1395 case FN_EDIT_REGION
:
1396 if( !rSh
.IsAnySectionInDoc() )
1397 rSet
.DisableItem(nWhich
);
1400 case FN_INSERT_REGION
:
1401 if( rSh
.IsSelFrmMode() ||
1402 !rSh
.IsInsRegionAvailable() )
1403 rSet
.DisableItem( nWhich
);
1405 case FN_CONVERT_TABLE_TO_TEXT
:
1407 USHORT eFrmType
= rSh
.GetFrmType(0,TRUE
);
1408 if( (eFrmType
& FRMTYPE_FOOTNOTE
) ||
1409 !rSh
.GetTableFmt() )
1410 rSet
.DisableItem( nWhich
);
1413 case FN_CONVERT_TEXT_TO_TABLE
:
1415 USHORT eFrmType
= rSh
.GetFrmType(0,TRUE
);
1416 if( (eFrmType
& FRMTYPE_FOOTNOTE
) ||
1417 !rSh
.IsTextToTableAvailable() )
1418 rSet
.DisableItem( nWhich
);
1421 case FN_CONVERT_TEXT_TABLE
:
1423 USHORT eFrmType
= rSh
.GetFrmType(0,TRUE
);
1424 if( (eFrmType
& FRMTYPE_FOOTNOTE
) ||
1425 (!rSh
.GetTableFmt() && !rSh
.IsTextToTableAvailable() ) )
1426 rSet
.DisableItem( nWhich
);
1431 SfxItemSet
aSet( rSh
.GetAttrPool(),
1432 RES_SHADOW
, RES_SHADOW
);
1434 // Tabellenzelle(n) selektiert?
1435 if ( rSh
.IsTableMode() )
1437 SwFrmFmt
*pFmt
= rSh
.GetTableFmt();
1438 aSet
.Put(pFmt
->GetFmtAttr( nWhich
, TRUE
));
1440 else if( rSh
.IsFrmSelected() )
1442 SwFlyFrmAttrMgr
aMgr( FALSE
, &rSh
, FRMMGR_TYPE_NONE
);
1443 aSet
.Put( aMgr
.GetAttrSet() );
1446 rSh
.GetCurAttr( aSet
);
1447 #if OSL_DEBUG_LEVEL > 1
1449 const SvxShadowItem
& rShItem
= (const SvxShadowItem
&)aSet
.Get(nWhich
);
1452 rSet
.Put((const SvxShadowItem
&)aSet
.Get(nWhich
));
1458 // --> OD 2006-11-08 #i59688#
1459 // improve efficiency:
1460 // If selected object is protected, item has to disabled.
1461 const BOOL bProtect
= 0 != rSh
.IsSelObjProtected(FLYPROTECT_CONTENT
|FLYPROTECT_PARENT
);
1464 rSet
.DisableItem( nWhich
);
1468 const USHORT nId
= SvxIMapDlgChildWindow::GetChildWindowId();
1469 const BOOL bHas
= pVFrame
->HasChildWindow( nId
);
1470 const BOOL bFrmSel
= rSh
.IsFrmSelected();
1471 const BOOL bIsGraphicSelection
=
1472 rSh
.GetSelectionType() == nsSelectionType::SEL_GRF
;
1474 // --> OD 2006-11-08 #i59688#
1475 // avoid unnecessary loading of selected graphic.
1476 // The graphic is only needed, if the dialog is open.
1477 //wenn die Grafik ausgeswappt ist, dann muss der
1478 //Status asynchron ermittelt werden
1479 //bis dahin wird der Slot disabled
1480 if ( bHas
&& bIsGraphicSelection
&& rSh
.IsGrfSwapOut( TRUE
) )
1482 if( AddGrfUpdateSlot( nWhich
))
1483 rSh
.GetGraphic(FALSE
); // start the loading
1489 ( bIsGraphicSelection
&&
1490 rSh
.GetGraphicType() == GRAPHIC_NONE
) ) )
1492 rSet
.DisableItem( nWhich
);
1496 SfxBoolItem
aBool(nWhich
, bHas
);
1497 if ( bHas
&& bFrmSel
)
1498 lcl_UpdateIMapDlg( rSh
);
1509 BOOL bDisable
= FALSE
;
1510 if( !rSh
.IsFrmSelected())
1512 USHORT nId
= SvxIMapDlgChildWindow::GetChildWindowId();
1513 if(!bDisable
&& pVFrame
->HasChildWindow( nId
))
1515 if(rSh
.GetSelectionType() == nsSelectionType::SEL_GRF
1516 && rSh
.IsGrfSwapOut(TRUE
))
1518 if( AddGrfUpdateSlot( nWhich
))
1519 rSh
.GetGraphic(FALSE
); // start the loading
1523 SvxIMapDlg
*pDlg
= SWIMAPDLG(GetView());
1524 if( pDlg
->GetEditingObject() != rSh
.GetIMapInventor() )
1525 lcl_UpdateIMapDlg( rSh
);
1528 rSet
.Put(SfxBoolItem(nWhich
, bDisable
));
1533 if (rSh
.IsSelObjProtected( FLYPROTECT_CONTENT
|FLYPROTECT_PARENT
) != 0)
1534 rSet
.DisableItem( nWhich
);
1536 case SID_CONTOUR_DLG
:
1538 BOOL bParentCntProt
= 0 != rSh
.IsSelObjProtected(FLYPROTECT_CONTENT
|FLYPROTECT_PARENT
);
1540 if( bParentCntProt
|| 0 != (HTMLMODE_ON
& ::GetHtmlMode(
1541 GetView().GetDocShell() )) )
1542 rSet
.DisableItem( nWhich
);
1545 USHORT nId
= SvxContourDlgChildWindow::GetChildWindowId();
1546 BOOL bHas
= GetView().GetViewFrame()->HasChildWindow( nId
);
1547 int nSel
= rSh
.GetSelectionType();
1548 BOOL bOk
= 0 != (nSel
& (nsSelectionType::SEL_GRF
|nsSelectionType::SEL_OLE
));
1550 BOOL bDisable
= FALSE
;
1553 // --> OD 2006-11-08 #i59688#
1554 // avoid unnecessary loading of selected graphic.
1555 // The graphic is only needed, if the dialog is open.
1556 // wenn die Grafik ausgeswappt ist, dann muss der Status
1557 // asynchron ermittelt werden bis dahin wird der Slot
1559 else if ( bHas
&& (nSel
& nsSelectionType::SEL_GRF
) &&
1560 rSh
.IsGrfSwapOut(TRUE
) )
1562 if( AddGrfUpdateSlot( nWhich
))
1563 rSh
.GetGraphic(FALSE
); // start the loading
1564 // --> OD 2007-07-04 #i75481#
1568 else if( bHas
&& bOk
)
1569 bDisable
= !lcl_UpdateContourDlg( rSh
, nSel
);
1572 // --> OD 2007-07-04 #i75481#
1573 // apply fix #i59688# only for selected graphics
1574 if ( nSel
& nsSelectionType::SEL_GRF
)
1575 bDisable
= GRAPHIC_NONE
== rSh
.GetGraphicType();
1577 bDisable
= GRAPHIC_NONE
== rSh
.GetIMapGraphic().GetType();
1583 rSet
.DisableItem( nWhich
);
1585 rSet
.Put( SfxBoolItem(nWhich
, bHas
) );
1589 case SID_CONTOUR_EXEC
:
1591 BOOL bDisable
= FALSE
;
1592 int nSel
= rSh
.GetSelectionType();
1593 if( !(nSel
& (nsSelectionType::SEL_GRF
|nsSelectionType::SEL_OLE
)) )
1595 USHORT nId
= SvxContourDlgChildWindow::GetChildWindowId();
1596 if( !bDisable
&& GetView().GetViewFrame()->HasChildWindow( nId
))
1598 SvxContourDlg
*pDlg
= SWCONTOURDLG(GetView());
1599 if( pDlg
->GetEditingObject() != rSh
.GetIMapInventor() )
1602 rSet
.Put(SfxBoolItem(nWhich
, bDisable
));
1607 case FN_TOOL_ANKER_PAGE
:
1608 case FN_TOOL_ANKER_PARAGRAPH
:
1609 case FN_TOOL_ANKER_CHAR
:
1610 case FN_TOOL_ANKER_AT_CHAR
:
1611 case FN_TOOL_ANKER_FRAME
:
1613 BOOL bObj
= 0 != rSh
.IsObjSelected();
1614 BOOL bParentCntProt
= rSh
.IsSelObjProtected( FLYPROTECT_CONTENT
|FLYPROTECT_PARENT
) != 0;
1616 if( !bParentCntProt
&& (bObj
|| rSh
.IsFrmSelected()))
1618 SfxItemSet
aSet(GetPool(), RES_ANCHOR
, RES_ANCHOR
);
1620 rSh
.GetObjAttr(aSet
);
1622 rSh
.GetFlyFrmAttr(aSet
);
1623 RndStdIds eSet
= ((SwFmtAnchor
&)aSet
.Get(RES_ANCHOR
)).GetAnchorId();
1625 bSet
= (nWhich
== FN_TOOL_ANKER_PAGE
&& eSet
== FLY_PAGE
) ||
1626 (nWhich
== FN_TOOL_ANKER_PARAGRAPH
&& eSet
== FLY_AT_CNTNT
) ||
1627 (nWhich
== FN_TOOL_ANKER_FRAME
&& eSet
== FLY_AT_FLY
) ||
1628 (nWhich
== FN_TOOL_ANKER_AT_CHAR
&& eSet
== FLY_AUTO_CNTNT
) ||
1629 (nWhich
== FN_TOOL_ANKER_CHAR
&& eSet
== FLY_IN_CNTNT
);
1630 if(nWhich
!= FN_TOOL_ANKER
)
1632 USHORT nHtmlMode
= ::GetHtmlMode(GetView().GetDocShell());
1633 if( ( nWhich
== FN_TOOL_ANKER_PAGE
&&
1634 ((HTMLMODE_ON
& nHtmlMode
) && (0 == (nHtmlMode
& HTMLMODE_SOME_ABS_POS
)))) ||
1635 ( nWhich
== FN_TOOL_ANKER_FRAME
&& !rSh
.IsFlyInFly() ) )
1636 rSet
.DisableItem(nWhich
);
1638 rSet
.Put(SfxBoolItem(nWhich
, bSet
));
1647 nSlotId
= FN_TOOL_ANKER_PAGE
;
1650 nSlotId
= FN_TOOL_ANKER_PARAGRAPH
;
1653 nSlotId
= FN_TOOL_ANKER_CHAR
;
1655 case FLY_AUTO_CNTNT
:
1656 nSlotId
= FN_TOOL_ANKER_AT_CHAR
;
1659 nSlotId
= FN_TOOL_ANKER_FRAME
;
1664 rSet
.Put(SfxUInt16Item(nWhich
, nSlotId
));
1668 rSet
.DisableItem( nWhich
);
1671 case FN_FRAME_NOWRAP
:
1673 case FN_FRAME_WRAP_IDEAL
:
1674 case FN_FRAME_WRAPTHRU
:
1675 case FN_FRAME_WRAPTHRU_TRANSP
:
1676 case FN_FRAME_WRAP_CONTOUR
:
1677 case FN_WRAP_ANCHOR_ONLY
:
1678 case FN_FRAME_WRAP_LEFT
:
1679 case FN_FRAME_WRAP_RIGHT
:
1681 BOOL bObj
= 0 != rSh
.IsObjSelected();
1682 BOOL bParentCntProt
= rSh
.IsSelObjProtected( FLYPROTECT_CONTENT
|FLYPROTECT_PARENT
) != 0;
1684 if( !bParentCntProt
&& (bObj
|| rSh
.IsFrmSelected()))
1686 SfxItemSet
aSet(GetPool(), RES_OPAQUE
, RES_ANCHOR
);
1690 rSh
.GetObjAttr(aSet
);
1691 nAnchorType
= rSh
.GetAnchorId();
1695 rSh
.GetFlyFrmAttr(aSet
);
1696 nAnchorType
= ((SwFmtAnchor
&)aSet
.Get(RES_ANCHOR
)).GetAnchorId();
1698 const SwFmtSurround
& rWrap
= (const SwFmtSurround
&)aSet
.Get(RES_SURROUND
);
1700 const SvxOpaqueItem
& rOpaque
= (const SvxOpaqueItem
&)aSet
.Get(RES_OPAQUE
);
1701 BOOL bOpaque
= rOpaque
.GetValue();
1702 SwSurround nSurround
= rWrap
.GetSurround();
1705 BOOL bDisable
= nAnchorType
== - 1 || nAnchorType
== FLY_IN_CNTNT
;
1706 BOOL bHtmlMode
= 0 != ::GetHtmlMode(GetView().GetDocShell());
1710 case FN_FRAME_NOWRAP
:
1712 ( nAnchorType
!= FLY_AT_CNTNT
&&
1713 nAnchorType
!= FLY_AUTO_CNTNT
&& nAnchorType
!= FLY_PAGE
);
1714 bSet
= nSurround
== SURROUND_NONE
;
1717 bDisable
|= bHtmlMode
;
1718 bSet
= nSurround
== SURROUND_PARALLEL
;
1720 case FN_FRAME_WRAP_IDEAL
:
1721 bDisable
|= bHtmlMode
;
1722 bSet
= nSurround
== SURROUND_IDEAL
;
1724 case FN_FRAME_WRAPTHRU
:
1725 bDisable
|= (bHtmlMode
||
1726 (nAnchorType
!= FLY_AT_CNTNT
&& nAnchorType
!= FLY_AUTO_CNTNT
&& nAnchorType
!= FLY_PAGE
));
1728 bSet
= nSurround
== SURROUND_THROUGHT
&& rSh
.GetLayerId();
1730 bSet
= nSurround
== SURROUND_THROUGHT
&& bOpaque
;
1732 case FN_FRAME_WRAPTHRU_TRANSP
:
1733 bDisable
|= bHtmlMode
;
1735 bSet
= nSurround
== SURROUND_THROUGHT
&& !rSh
.GetLayerId();
1737 bSet
= nSurround
== SURROUND_THROUGHT
&& !bOpaque
;
1739 case FN_FRAME_WRAP_CONTOUR
:
1740 bDisable
|= bHtmlMode
;
1741 //no contour available whenn no wrap or wrap through is set
1742 bDisable
|= (nSurround
== SURROUND_NONE
|| nSurround
== SURROUND_THROUGHT
);
1743 bSet
= rWrap
.IsContour();
1746 int nSel
= rSh
.GetSelectionType();
1747 if( (nSel
& nsSelectionType::SEL_GRF
) &&
1748 rSh
.IsGrfSwapOut(TRUE
))
1750 if( AddGrfUpdateSlot( nWhich
))
1751 rSh
.GetGraphic(FALSE
); // start the loading
1753 else if( rSh
.IsFrmSelected() )
1755 // #i102253# applied patch from OD (see task)
1757 nSel
& nsSelectionType::SEL_FRM
||
1758 GRAPHIC_NONE
== rSh
.GetIMapGraphic().GetType();
1761 bSet
= bDisable
? FALSE
: rWrap
.IsContour();
1764 case FN_WRAP_ANCHOR_ONLY
:
1765 bDisable
|= (bHtmlMode
||
1766 (nAnchorType
!= FLY_AT_CNTNT
));
1767 bSet
= rWrap
.IsAnchorOnly();
1769 case FN_FRAME_WRAP_LEFT
:
1770 bSet
= nSurround
== SURROUND_LEFT
;
1772 case FN_FRAME_WRAP_RIGHT
:
1773 bSet
= nSurround
== SURROUND_RIGHT
;
1778 rSet
.DisableItem(nWhich
);
1780 rSet
.Put(SfxBoolItem(nWhich
, bSet
));
1783 rSet
.DisableItem(nWhich
);
1786 case FN_UPDATE_CHARTS
:
1787 if( !rSh
.HasCharts() )
1788 rSet
.DisableItem( nWhich
);
1790 case FN_UPDATE_ALL_LINKS
:
1791 if ( !rSh
.GetLinkManager().GetLinks().Count() )
1792 rSet
.DisableItem(nWhich
);
1794 case FN_XFORMS_DESIGN_MODE
:
1795 // enable if in XForms document
1796 if( rSh
.GetDoc()->isXForms() )
1798 // determine current state from view options
1799 sal_Bool bValue
= ! rSh
.GetViewOptions()->IsFormView();
1800 rSet
.Put( SfxBoolItem( nWhich
, bValue
) );
1803 rSet
.Put( SfxVisibilityItem( nWhich
, sal_False
) );
1806 nWhich
= aIter
.NextWhich();
1811 /*--------------------------------------------------------------------
1812 Beschreibung: Slots mit dieser Statusmethode disablen
1813 --------------------------------------------------------------------*/
1816 void SwBaseShell::StateDisableItems( SfxItemSet
&rSet
)
1818 SfxWhichIter
aIter(rSet
);
1819 USHORT nWhich
= aIter
.FirstWhich();
1823 rSet
.DisableItem( nWhich
);
1824 nWhich
= aIter
.NextWhich();
1828 /*--------------------------------------------------------------------
1829 Beschreibung: Slots mit dieser Statusmethode disablen
1830 --------------------------------------------------------------------*/
1833 void SwBaseShell::StateStyle( SfxItemSet
&rSet
)
1835 BOOL bParentCntProt
= GetShell().IsSelObjProtected( FLYPROTECT_CONTENT
|FLYPROTECT_PARENT
) != 0;
1836 ShellModes eMode
= GetView().GetShellMode();
1838 if ( bParentCntProt
||
1839 SHELL_MODE_DRAW
== eMode
||
1840 SHELL_MODE_DRAW_CTRL
== eMode
||
1841 SHELL_MODE_DRAW_FORM
== eMode
||
1842 SHELL_MODE_DRAWTEXT
== eMode
||
1843 SHELL_MODE_BEZIER
== eMode
)
1845 SfxWhichIter
aIter( rSet
);
1846 USHORT nWhich
= aIter
.FirstWhich();
1849 rSet
.DisableItem( nWhich
);
1850 nWhich
= aIter
.NextWhich();
1854 GetView().GetDocShell()->StateStyleSheet(rSet
, &GetShell());
1857 /*--------------------------------------------------------------------
1859 --------------------------------------------------------------------*/
1862 void SwBaseShell::SetWrapMode( USHORT nSlot
)
1864 SwWrtShell
&rSh
= GetShell();
1865 BOOL bObj
= 0 != rSh
.IsObjSelected();
1866 if( bObj
|| rSh
.IsFrmSelected())
1868 SfxItemSet
aSet(GetPool(), RES_OPAQUE
, RES_SURROUND
);
1870 rSh
.GetObjAttr(aSet
);
1872 rSh
.GetFlyFrmAttr(aSet
);
1873 SwFmtSurround
aWrap( (SwFmtSurround
&)aSet
.Get(RES_SURROUND
) );
1874 SwSurround
nOldSurround(aWrap
.GetSurround());
1875 SwSurround nSurround
= SURROUND_PARALLEL
;
1879 case FN_FRAME_NOWRAP
:
1880 nSurround
= SURROUND_NONE
;
1881 if (aWrap
.IsContour())
1882 aWrap
.SetContour(FALSE
);
1884 case FN_FRAME_WRAP_IDEAL
:
1885 nSurround
= SURROUND_IDEAL
;
1887 case FN_WRAP_ANCHOR_ONLY
:
1888 aWrap
.SetAnchorOnly(!aWrap
.IsAnchorOnly());
1889 // --> OD 2006-06-02 #b6432130#
1890 // keep previous wrapping
1891 // --> OD 2006-09-21 #138144# - adjust fix #b6432130#
1892 // switch to wrap SURROUND_PARALLEL, if previous wrap is SURROUND_NONE
1893 if ( nOldSurround
!= SURROUND_NONE
)
1895 nSurround
= nOldSurround
;
1899 case FN_FRAME_WRAP_CONTOUR
:
1900 aWrap
.SetContour(!aWrap
.IsContour());
1901 if (nSurround
== SURROUND_THROUGHT
)
1902 nSurround
= SURROUND_PARALLEL
;
1904 case FN_FRAME_WRAPTHRU_TRANSP
:
1905 if (aWrap
.IsContour())
1906 aWrap
.SetContour(FALSE
);
1908 case FN_FRAME_WRAPTHRU
:
1909 nSurround
= SURROUND_THROUGHT
;
1912 case FN_FRAME_WRAP_LEFT
:
1913 nSurround
= SURROUND_LEFT
;
1916 case FN_FRAME_WRAP_RIGHT
:
1917 nSurround
= SURROUND_RIGHT
;
1923 aWrap
.SetSurround(nSurround
);
1925 if (nSlot
!= FN_FRAME_WRAP_CONTOUR
)
1927 // Konturumfluss bei Draw-Objekten defaulten
1928 if (bObj
&& nOldSurround
!= nSurround
&&
1929 (nOldSurround
== SURROUND_NONE
|| nOldSurround
== SURROUND_THROUGHT
))
1931 aWrap
.SetContour(TRUE
);
1936 aSet
.Put(SvxOpaqueItem(RES_OPAQUE
, nSlot
!= FN_FRAME_WRAPTHRU_TRANSP
));
1939 rSh
.SetObjAttr(aSet
);
1940 if (nSlot
!= FN_FRAME_WRAPTHRU_TRANSP
)
1941 rSh
.SelectionToHeaven();
1943 rSh
.SelectionToHell();
1946 rSh
.SetFlyFrmAttr(aSet
);
1950 /*--------------------------------------------------------------------
1951 Beschreibung: Update der Statuszeile erzwingen
1952 --------------------------------------------------------------------*/
1954 void SwBaseShell::SetFrmMode(FlyMode eMode
, SwWrtShell
*pSh
)
1957 SfxBindings
&rBnd
= pSh
->GetView().GetViewFrame()->GetBindings();
1959 if( eMode
== FLY_DRAG
||
1960 (pSh
&& (pSh
->IsFrmSelected() || pSh
->IsObjSelected())) )
1962 const SfxPointItem
aTmp1( SID_ATTR_POSITION
, pSh
->GetAnchorObjDiff());
1963 const SvxSizeItem
aTmp2( SID_ATTR_SIZE
, pSh
->GetObjSize());
1964 rBnd
.SetState( aTmp1
);
1965 rBnd
.SetState( aTmp2
);
1967 else if( eMode
== FLY_DRAG_END
)
1969 static USHORT __READONLY_DATA aInval
[] =
1971 SID_ATTR_POSITION
, SID_ATTR_SIZE
, 0
1973 rBnd
.Invalidate(aInval
);
1977 /*--------------------------------------------------------------------
1979 --------------------------------------------------------------------*/
1981 SwBaseShell::SwBaseShell(SwView
& rVw
) :
1986 SwWrtShell
& rWrtSh
= rView
.GetWrtShell();
1988 SetPool(&rWrtSh
.GetAttrPool());
1989 SetName(C2S("Base"));
1990 rWrtSh
.SetGrfArrivedLnk( LINK( this, SwBaseShell
, GraphicArrivedHdl
));
1994 SwBaseShell::~SwBaseShell()
1996 if( rView
.GetCurShell() == this )
1997 rView
.ResetSubShell();
1999 Link
aTmp( LINK( this, SwBaseShell
, GraphicArrivedHdl
));
2000 if( aTmp
== rView
.GetWrtShell().GetGrfArrivedLnk() )
2001 rView
.GetWrtShell().SetGrfArrivedLnk( Link() );
2004 /*--------------------------------------------------------------------
2006 --------------------------------------------------------------------*/
2008 void SwBaseShell::ExecTxtCtrl( SfxRequest
& rReq
)
2010 const SfxItemSet
*pArgs
= rReq
.GetArgs();
2014 SwWrtShell
&rSh
= GetShell();
2015 SvxScriptSetItem
* pSSetItem
= 0;
2016 USHORT nSlot
= rReq
.GetSlot();
2017 SfxItemPool
& rPool
= rSh
.GetAttrPool();
2018 USHORT nWhich
= rPool
.GetWhich( nSlot
);
2019 USHORT nScripts
= SCRIPTTYPE_LATIN
| SCRIPTTYPE_ASIAN
| SCRIPTTYPE_COMPLEX
;
2020 SfxItemSet
aHeightSet( GetPool(), RES_CHRATR_FONTSIZE
, RES_CHRATR_FONTSIZE
,
2021 RES_CHRATR_CJK_FONTSIZE
, RES_CHRATR_CJK_FONTSIZE
,
2022 RES_CHRATR_CTL_FONTSIZE
, RES_CHRATR_CTL_FONTSIZE
,
2027 case SID_ATTR_CHAR_FONT
:
2029 nScripts
= rSh
.GetScriptType();
2030 // #i42732# input language should be preferred over
2031 // current cursor position to detect script type
2032 if(!rSh
.HasSelection())
2034 LanguageType nInputLang
= GetView().GetEditWin().GetInputLanguage();
2035 if(nInputLang
!= LANGUAGE_DONTKNOW
&& nInputLang
!= LANGUAGE_SYSTEM
)
2036 nScripts
= SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang
);
2039 case SID_ATTR_CHAR_POSTURE
:
2040 case SID_ATTR_CHAR_WEIGHT
:
2042 pSSetItem
= new SvxScriptSetItem( nSlot
, rPool
);
2043 pSSetItem
->PutItemForScriptType( nScripts
, pArgs
->Get( nWhich
));
2044 pArgs
= &pSSetItem
->GetItemSet();
2047 case SID_ATTR_CHAR_FONTHEIGHT
:
2049 if(rSh
.HasSelection())
2051 pSSetItem
= new SvxScriptSetItem( nSlot
, rPool
);
2052 pSSetItem
->PutItemForScriptType( nScripts
, pArgs
->Get( nWhich
));
2053 pArgs
= &pSSetItem
->GetItemSet();
2057 nScripts
= rSh
.GetScriptType();
2058 LanguageType nInputLang
= GetView().GetEditWin().GetInputLanguage();
2059 if(nInputLang
!= LANGUAGE_DONTKNOW
&& nInputLang
!= LANGUAGE_SYSTEM
)
2060 nScripts
= SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang
);
2061 UINT32 nHeight
= static_cast< const SvxFontHeightItem
& >(pArgs
->Get( nWhich
)).GetHeight();
2062 SwStdFontConfig
* pStdFont
= SW_MOD()->GetStdFontConfig();
2064 SfxItemSet
aLangSet( GetPool(), RES_CHRATR_LANGUAGE
, RES_CHRATR_LANGUAGE
,
2065 RES_CHRATR_CJK_LANGUAGE
, RES_CHRATR_CJK_LANGUAGE
,
2066 RES_CHRATR_CTL_LANGUAGE
, RES_CHRATR_CTL_LANGUAGE
,
2068 rSh
.GetCurAttr( aLangSet
);
2070 sal_Int32 nWesternSize
=
2071 pStdFont
->GetFontHeight(FONT_STANDARD
, FONT_GROUP_DEFAULT
,
2072 static_cast<const SvxLanguageItem
&>(aLangSet
.Get( RES_CHRATR_LANGUAGE
)).GetLanguage());
2073 sal_Int32 nCJKSize
=
2074 pStdFont
->GetFontHeight(FONT_STANDARD
, FONT_GROUP_CJK
,
2075 static_cast<const SvxLanguageItem
&>(aLangSet
.Get( RES_CHRATR_CJK_LANGUAGE
)).GetLanguage());
2076 sal_Int32 nCTLSize
=
2077 pStdFont
->GetFontHeight(FONT_STANDARD
, FONT_GROUP_CTL
,
2078 static_cast<const SvxLanguageItem
&>(aLangSet
.Get( RES_CHRATR_CTL_LANGUAGE
)).GetLanguage());
2082 case SCRIPTTYPE_LATIN
:
2083 nCJKSize
= nHeight
* nCJKSize
/ nWesternSize
;
2084 nCTLSize
= nHeight
* nCTLSize
/ nWesternSize
;
2085 nWesternSize
= (sal_Int32
) nHeight
;
2087 case SCRIPTTYPE_ASIAN
:
2088 nCTLSize
= nHeight
* nCTLSize
/ nCJKSize
;
2089 nWesternSize
= nHeight
* nWesternSize
/ nCJKSize
;
2090 nCJKSize
= (sal_Int32
) nHeight
;
2092 case SCRIPTTYPE_COMPLEX
:
2093 nCJKSize
= nHeight
* nCJKSize
/ nCTLSize
;
2094 nWesternSize
= nHeight
* nWesternSize
/ nCTLSize
;
2095 nCTLSize
= (sal_Int32
) nHeight
;
2098 aHeightSet
.Put( SvxFontHeightItem( (UINT32
)nWesternSize
, 100, RES_CHRATR_FONTSIZE
));
2099 aHeightSet
.Put( SvxFontHeightItem( (UINT32
)nCJKSize
, 100, RES_CHRATR_CJK_FONTSIZE
));
2100 aHeightSet
.Put( SvxFontHeightItem( (UINT32
)nCTLSize
, 100, RES_CHRATR_CTL_FONTSIZE
));
2101 pArgs
= &aHeightSet
;
2110 if ( !isCHRATR(nWhich
) ||
2111 ( rSh
.HasSelection() && rSh
.IsSelFullPara() ) )
2113 SwTxtFmtColl
* pColl
= rSh
.GetCurTxtFmtColl();
2114 if ( pColl
&& pColl
->IsAutoUpdateFmt() )
2116 rSh
.AutoUpdatePara( pColl
, *pArgs
);
2123 rSh
.SetAttr( *pArgs
);
2129 GetView().GetViewFrame()->GetDispatcher()->Execute( SID_CHAR_DLG
, FALSE
);
2133 /*--------------------------------------------------------------------
2135 --------------------------------------------------------------------*/
2137 void SwBaseShell::GetTxtCtrlState( SfxItemSet
& rSet
)
2139 SwWrtShell
&rSh
= GetShell();
2140 rSh
.GetCurAttr( rSet
);
2143 void SwBaseShell::GetTxtFontCtrlState( SfxItemSet
& rSet
)
2145 SwWrtShell
&rSh
= GetShell();
2147 SfxItemSet
* pFntCoreSet
= 0;
2148 USHORT nScriptType
= SCRIPTTYPE_LATIN
;
2149 SfxWhichIter
aIter( rSet
);
2150 USHORT nWhich
= aIter
.FirstWhich();
2155 case RES_CHRATR_FONT
:
2156 case RES_CHRATR_FONTSIZE
:
2157 case RES_CHRATR_WEIGHT
:
2158 case RES_CHRATR_POSTURE
:
2162 pFntCoreSet
= new SfxItemSet( *rSet
.GetPool(),
2163 RES_CHRATR_BEGIN
, RES_CHRATR_END
-1 );
2164 rSh
.GetCurAttr( *pFntCoreSet
);
2165 nScriptType
= rSh
.GetScriptType();
2166 // #i42732# input language should be preferred over
2167 // current cursor position to detect script type
2168 SwEditWin
& rEditWin
= GetView().GetEditWin();
2169 if( rEditWin
.IsUseInputLanguage() )
2171 if(!rSh
.HasSelection() && (
2172 nWhich
== RES_CHRATR_FONT
||
2173 nWhich
== RES_CHRATR_FONTSIZE
))
2175 LanguageType nInputLang
= rEditWin
.GetInputLanguage();
2176 if(nInputLang
!= LANGUAGE_DONTKNOW
&& nInputLang
!= LANGUAGE_SYSTEM
)
2177 nScriptType
= SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang
);
2181 SfxItemPool
& rPool
= *rSet
.GetPool();
2182 SvxScriptSetItem
aSetItem( rPool
.GetSlotId( nWhich
), rPool
);
2183 aSetItem
.GetItemSet().Put( *pFntCoreSet
, FALSE
);
2184 const SfxPoolItem
* pI
= aSetItem
.GetItemOfScript( nScriptType
);
2186 rSet
.Put( *pI
, nWhich
);
2188 rSet
.InvalidateItem( nWhich
);
2189 //set input context of the SwEditWin according to the selected font and script type
2190 if(RES_CHRATR_FONT
== nWhich
)
2193 if(pI
&& pI
->ISA(SvxFontItem
))
2195 aFont
.SetName( ((const SvxFontItem
*)pI
)->GetFamilyName());
2196 aFont
.SetStyleName(((const SvxFontItem
*)pI
)->GetStyleName());
2197 aFont
.SetFamily(((const SvxFontItem
*)pI
)->GetFamily());
2198 aFont
.SetPitch(((const SvxFontItem
*)pI
)->GetPitch());
2199 aFont
.SetCharSet(((const SvxFontItem
*)pI
)->GetCharSet());
2202 BOOL bVertical
= rSh
.IsInVerticalText();
2203 aFont
.SetOrientation(bVertical
? 2700 : 0);
2204 aFont
.SetVertical(bVertical
);
2205 GetView().GetEditWin().SetInputContext( InputContext( aFont
, INPUTCONTEXT_TEXT
|
2206 INPUTCONTEXT_EXTTEXTINPUT
) );
2214 rSh
.GetCurAttr( rSet
);
2218 nWhich
= aIter
.NextWhich();
2223 /*--------------------------------------------------------------------
2225 --------------------------------------------------------------------*/
2227 void SwBaseShell::GetBckColState(SfxItemSet
&rSet
)
2229 SwWrtShell
&rSh
= GetShell();
2230 SfxWhichIter
aIter( rSet
);
2231 USHORT nWhich
= aIter
.FirstWhich();
2232 int nSelType
= rSh
.GetSelectionType();
2234 // if ( nSelType & nsSelectionType::SEL_GRF ||
2235 if( nSelType
& nsSelectionType::SEL_OLE
)
2237 rSet
.DisableItem( SID_BACKGROUND_COLOR
);
2241 if ( nSelType
& nsSelectionType::SEL_FRM
)
2243 BOOL bParentCntProt
= rSh
.IsSelObjProtected( FLYPROTECT_CONTENT
|FLYPROTECT_PARENT
) != 0;
2246 rSet
.DisableItem( SID_BACKGROUND_COLOR
);
2251 SvxBrushItem
aBrushItem( RES_BACKGROUND
);
2253 if( nsSelectionType::SEL_TBL_CELLS
& nSelType
)
2254 rSh
.GetBoxBackground( aBrushItem
);
2257 SfxItemSet
aCoreSet(GetPool(), RES_BACKGROUND
, RES_BACKGROUND
);
2258 if( nSelType
& nsSelectionType::SEL_GRF
|| nsSelectionType::SEL_FRM
& nSelType
)
2259 rSh
.GetFlyFrmAttr( aCoreSet
);
2261 rSh
.GetCurAttr( aCoreSet
);
2262 aBrushItem
= (const SvxBrushItem
&)aCoreSet
.Get(RES_BACKGROUND
);
2269 case SID_BACKGROUND_COLOR
:
2271 SvxColorItem
aColorItem(aBrushItem
.GetColor(), SID_BACKGROUND_COLOR
);
2272 rSet
.Put( aColorItem
, SID_BACKGROUND_COLOR
);
2275 case SID_ATTR_BRUSH
:
2276 case RES_BACKGROUND
:
2277 rSet
.Put( aBrushItem
, GetPool().GetWhich(nWhich
) );
2280 nWhich
= aIter
.NextWhich();
2284 /*--------------------------------------------------------------------
2286 --------------------------------------------------------------------*/
2288 void SwBaseShell::ExecBckCol(SfxRequest
& rReq
)
2290 SwWrtShell
&rSh
= GetShell();
2291 int nSelType
= rSh
.GetSelectionType();
2292 if ( nSelType
& nsSelectionType::SEL_OLE
)
2297 const SfxItemSet
* pArgs
= rReq
.GetArgs();
2298 USHORT nSlot
= rReq
.GetSlot();
2299 if( !pArgs
&& nSlot
!= SID_BACKGROUND_COLOR
)
2302 SvxBrushItem
aBrushItem( RES_BACKGROUND
);
2304 if( nsSelectionType::SEL_TBL_CELLS
& nSelType
)
2306 rSh
.GetBoxBackground( aBrushItem
);
2310 SfxItemSet
aCoreSet(GetPool(), RES_BACKGROUND
, RES_BACKGROUND
);
2311 if( (nsSelectionType::SEL_FRM
& nSelType
) || (nsSelectionType::SEL_GRF
& nSelType
) )
2312 rSh
.GetFlyFrmAttr( aCoreSet
);
2314 rSh
.GetCurAttr( aCoreSet
);
2315 aBrushItem
= (const SvxBrushItem
&)aCoreSet
.Get(RES_BACKGROUND
);
2318 // BOOL bMsgOk = FALSE;
2322 // RES_BACKGROUND (=SID_ATTR_BRUSH) muss ueber zwei IDs
2324 case SID_BACKGROUND_COLOR
:
2326 aBrushItem
.SetGraphicPos(GPOS_NONE
);
2328 //Brush &rBrush = aBrushItem.GetBrush();
2331 const SvxColorItem
& rNewColorItem
= (const SvxColorItem
&)
2332 pArgs
->Get(SID_BACKGROUND_COLOR
);
2333 const Color
& rNewColor
= rNewColorItem
.GetValue();
2334 aBrushItem
.SetColor( rNewColor
);
2335 GetView().GetViewFrame()->GetBindings().SetState(rNewColorItem
);
2339 aBrushItem
.SetColor( COL_TRANSPARENT
);
2340 rReq
.AppendItem( SvxColorItem( Color( COL_TRANSPARENT
), nSlot
) );
2345 case SID_ATTR_BRUSH
:
2346 case RES_BACKGROUND
:
2348 const SvxBrushItem
& rNewBrushItem
= (const SvxBrushItem
&)
2349 pArgs
->Get( GetPool().GetWhich(nSlot
) );
2350 aBrushItem
= rNewBrushItem
;
2356 DBG_ERROR( "Unbekannte Message bei ExecuteAttr!" );
2360 if( nsSelectionType::SEL_TBL_CELLS
& nSelType
)
2362 rSh
.SetBoxBackground( aBrushItem
);
2364 else if( (nsSelectionType::SEL_FRM
& nSelType
) ||
2365 (nsSelectionType::SEL_GRF
& nSelType
) )
2367 SfxItemSet
aCoreSet(GetPool(), RES_BACKGROUND
, RES_BACKGROUND
);
2368 aCoreSet
.Put( aBrushItem
);
2369 // Vorlagen-AutoUpdate
2370 SwFrmFmt
* pFmt
= rSh
.GetCurFrmFmt();
2371 if(pFmt
&& pFmt
->IsAutoUpdateFmt())
2372 rSh
.AutoUpdateFrame( pFmt
, aCoreSet
);
2374 rSh
.SetFlyFrmAttr( aCoreSet
);
2378 SwTxtFmtColl
* pColl
= rSh
.GetCurTxtFmtColl();
2379 if( pColl
&& pColl
->IsAutoUpdateFmt())
2381 SfxItemSet
aSet(GetPool(), RES_BACKGROUND
, RES_BACKGROUND
);
2382 aSet
.Put(aBrushItem
);
2383 rSh
.AutoUpdatePara( pColl
, aSet
);
2386 rSh
.SetAttr( aBrushItem
);
2392 /*--------------------------------------------------------------------
2394 --------------------------------------------------------------------*/
2397 void SwBaseShell::GetBorderState(SfxItemSet
&rSet
)
2399 SwWrtShell
&rSh
= GetShell();
2400 // Tabellenzelle(n) selektiert?
2401 BOOL bPrepare
= TRUE
;
2402 BOOL bTableMode
= rSh
.IsTableMode();
2405 SfxItemSet
aCoreSet( GetPool(),
2407 SID_ATTR_BORDER_INNER
, SID_ATTR_BORDER_INNER
, 0 );
2408 SvxBoxInfoItem
aBoxInfo( SID_ATTR_BORDER_INNER
);
2409 aCoreSet
.Put( aBoxInfo
);
2410 rSh
.GetTabBorders( aCoreSet
);
2411 rSet
.Put( aCoreSet
);
2413 else if ( rSh
.IsFrmSelected() )
2415 SwFlyFrmAttrMgr
aMgr( FALSE
, &rSh
, FRMMGR_TYPE_NONE
);
2416 rSet
.Put( aMgr
.GetAttrSet() );
2420 // Umrandungsattribute ganz normal ueber Shell holen
2421 rSh
.GetCurAttr( rSet
);
2423 ::PrepareBoxInfo( rSet
, rSh
);
2424 // switch the border toolbox controller mode
2425 rSet
.Put( SfxBoolItem( SID_BORDER_REDUCED_MODE
, !bTableMode
));
2428 /*--------------------------------------------------------------------
2430 --------------------------------------------------------------------*/
2433 void SwBaseShell::ExecDlg(SfxRequest
&rReq
)
2435 SwWrtShell
&rSh
= GetShell();
2436 Window
*pMDI
= &GetView().GetViewFrame()->GetWindow();
2437 //Damit aus dem Basic keine Dialoge fuer Hintergrund-Views aufgerufen werden:
2438 BOOL bBackground
= (&GetView() != GetActiveView());
2439 const SfxPoolItem
* pItem
= 0;
2440 const SfxItemSet
* pArgs
= rReq
.GetArgs();
2442 USHORT nSlot
= rReq
.GetSlot();
2443 const SfxItemSet
* pOutSet
= 0;
2446 pArgs
->GetItemState( GetPool().GetWhich(nSlot
), FALSE
, &pItem
);
2450 case FN_FORMAT_PAGE_COLUMN_DLG
:
2451 case FN_FORMAT_PAGE_DLG
:
2455 const USHORT nCurIdx
= rSh
.GetCurPageDesc();
2456 const SwPageDesc
& rPageDesc
= rSh
.GetPageDesc( nCurIdx
);
2457 //temp. View, weil die Shell nach dem Dialog nicht mehr gueltig sein muss
2458 //z.B. Kopfzeile ausschalten
2459 SwView
& rTempView
= GetView();
2460 rTempView
.GetDocShell()->FormatPage(rPageDesc
.GetName(),
2461 nSlot
== FN_FORMAT_PAGE_COLUMN_DLG
,
2463 rTempView
.InvalidateRulerPos();
2467 case FN_FORMAT_BORDER_DLG
:
2469 SfxItemSet
aSet( rSh
.GetAttrPool(),
2470 RES_BOX
, RES_SHADOW
,
2471 SID_ATTR_BORDER_INNER
, SID_ATTR_BORDER_INNER
,
2473 SfxAbstractDialog
* pDlg
= 0;
2474 // Tabellenzelle(n) selektiert?
2475 if ( rSh
.IsTableMode() )
2477 // Umrandungattribute Get/SetTabBorders() setzen
2478 ::PrepareBoxInfo( aSet
, rSh
);
2479 rSh
.GetTabBorders( aSet
);
2480 SwAbstractDialogFactory
* pFact
= SwAbstractDialogFactory::Create();
2481 DBG_ASSERT(pFact
, "SwAbstractDialogFactory fail!");
2483 pDlg
= pFact
->CreateSwBorderDlg( pMDI
, aSet
, SW_BORDER_MODE_TABLE
, RC_DLG_SWBORDERDLG
);
2484 DBG_ASSERT(pDlg
, "Dialogdiet fail!");
2485 if ( pDlg
->Execute() == RET_OK
)
2487 rSh
.SetTabBorders( *pDlg
->GetOutputItemSet() );
2488 pOutSet
= pDlg
->GetOutputItemSet();
2491 else if ( rSh
.IsFrmSelected() )
2493 // Umrandungsattribute ueber Frame-Manager setzen
2494 SwFlyFrmAttrMgr
aMgr( FALSE
, &rSh
, FRMMGR_TYPE_NONE
);
2495 aSet
.Put( aMgr
.GetAttrSet() );
2497 SwAbstractDialogFactory
* pFact
= SwAbstractDialogFactory::Create();
2498 DBG_ASSERT(pFact
, "SwAbstractDialogFactory fail!");
2500 pDlg
= pFact
->CreateSwBorderDlg( pMDI
, aSet
, SW_BORDER_MODE_FRAME
, RC_DLG_SWBORDERDLG
);
2501 DBG_ASSERT(pDlg
, "Dialogdiet fail!");
2502 if ( pDlg
->Execute() == RET_OK
)
2504 aMgr
.SetAttrSet( *pDlg
->GetOutputItemSet() );
2505 aMgr
.UpdateFlyFrm();
2506 pOutSet
= pDlg
->GetOutputItemSet();
2511 // Umrandungsattribute ganz normal ueber Shell setzen
2512 rSh
.GetCurAttr( aSet
);
2513 ::PrepareBoxInfo( aSet
, rSh
);
2515 SwAbstractDialogFactory
* pFact
= SwAbstractDialogFactory::Create();
2516 DBG_ASSERT(pFact
, "SwAbstractDialogFactory fail!");
2518 pDlg
= pFact
->CreateSwBorderDlg( pMDI
, aSet
, SW_BORDER_MODE_PARA
, RC_DLG_SWBORDERDLG
);
2519 DBG_ASSERT(pDlg
, "Dialogdiet fail!");
2520 if ( pDlg
->Execute() == RET_OK
)
2522 rSh
.SetAttr( *pDlg
->GetOutputItemSet() );
2523 pOutSet
= pDlg
->GetOutputItemSet();
2528 rReq
.Done(*pOutSet
);
2534 case FN_FORMAT_BACKGROUND_DLG
:
2536 SfxItemSet
aSet( rSh
.GetAttrPool(),
2537 RES_BACKGROUND
, RES_BACKGROUND
);
2539 SfxAbstractDialog
* pDlg
= 0;
2540 SwAbstractDialogFactory
* pFact
= SwAbstractDialogFactory::Create();
2541 DBG_ASSERT(pFact
, "SwAbstractDialogFactory fail!");
2544 // Tabellenzelle(n) selektiert?
2545 if ( rSh
.IsTableMode() )
2547 //Hintergrundattribute der Tabelle holen und in den Set packen
2548 SvxBrushItem
aBrush(RES_BACKGROUND
);
2549 rSh
.GetBoxBackground( aBrush
);
2550 pDlg
= pFact
->CreateSfxDialog( pMDI
, aSet
,
2551 rView
.GetViewFrame()->GetFrame()->GetFrameInterface(),
2552 RC_SWDLG_BACKGROUND
);
2553 DBG_ASSERT(pDlg
, "Dialogdiet fail!");
2555 if ( pDlg
->Execute() == RET_OK
)
2557 //aBrush = (SvxBrushItem) pDlg->GetOutputItemSet()->Get( RES_BACKGROUND );
2559 rSh
.SetBoxBackground( (SvxBrushItem
&)
2560 pDlg
->GetOutputItemSet()->Get( RES_BACKGROUND
));
2561 pOutSet
= pDlg
->GetOutputItemSet();
2564 else if ( rSh
.IsFrmSelected() )
2567 rSh
.GetFlyFrmAttr( aSet
);
2569 pDlg
= pFact
->CreateSfxDialog( pMDI
, aSet
,
2570 rView
.GetViewFrame()->GetFrame()->GetFrameInterface(),
2571 RC_SWDLG_BACKGROUND
);
2572 DBG_ASSERT(pDlg
, "Dialogdiet fail!");
2573 if ( pDlg
->Execute() == RET_OK
)
2575 rSh
.SetFlyFrmAttr((SfxItemSet
&) *pDlg
->GetOutputItemSet() );
2576 pOutSet
= pDlg
->GetOutputItemSet();
2581 // Umrandungsattribute ganz normal ueber Shell setzen
2582 rSh
.GetCurAttr( aSet
);
2584 pDlg
= pFact
->CreateSfxDialog( pMDI
, aSet
,
2585 rView
.GetViewFrame()->GetFrame()->GetFrameInterface(),
2586 RC_SWDLG_BACKGROUND
);
2587 DBG_ASSERT(pDlg
, "Dialogdiet fail!");
2588 if ( pDlg
->Execute() == RET_OK
)
2590 rSh
.SetAttr( *pDlg
->GetOutputItemSet() );
2591 pOutSet
= pDlg
->GetOutputItemSet();
2596 rReq
.Done(*pOutSet
);
2603 default:DBG_ERROR("falscher Dispatcher (basesh.cxx)");
2609 // ----------------------------------------------------------------------------
2612 SwWrtShell
& SwBaseShell::GetShell()
2614 return rView
.GetWrtShell();
2617 // ----------------------------------------------------------------------------
2619 SwWrtShell
* SwBaseShell::GetShellPtr()
2621 return rView
.GetWrtShellPtr();
2624 // ----------------------------------------------------------------------------
2626 void SwBaseShell::InsertTable( SfxRequest
& _rRequest
)
2628 const SfxItemSet
* pArgs
= _rRequest
.GetArgs();
2629 SwWrtShell
& rSh
= GetShell();
2631 if ( !( rSh
.GetFrmType( 0, TRUE
) & FRMTYPE_FOOTNOTE
) )
2633 SwView
&rTempView
= GetView(); // Da GetView() nach Shellwechsel nicht mehr geht
2634 BOOL bHTMLMode
= 0 != (::GetHtmlMode(rTempView
.GetDocShell())&HTMLMODE_ON
);
2635 BOOL bCallEndUndo
= FALSE
;
2637 if( !pArgs
&& rSh
.IsSelection() && !rSh
.IsInClickToEdit() &&
2638 !rSh
.IsTableMode() )
2640 const SwModuleOptions
* pModOpt
= SW_MOD()->GetModuleConfig();
2641 SwInsertTableOptions aInsTblOpts
= pModOpt
->GetInsTblFlags(bHTMLMode
);
2643 rSh
.StartUndo(UNDO_INSTABLE
);
2644 bCallEndUndo
= TRUE
;
2646 BOOL bInserted
= rSh
.TextToTable( aInsTblOpts
, '\t', text::HoriOrientation::FULL
);
2649 rTempView
.AutoCaption(TABLE_CAP
);
2656 SwInsertTableOptions
aInsTblOpts( tabopts::ALL_TBL_INS_ATTR
, 1 );
2657 String aTableName
, aAutoName
;
2658 SwTableAutoFmt
* pTAFmt
= 0;
2660 if( pArgs
&& pArgs
->Count() >= 2 )
2662 SFX_REQUEST_ARG( _rRequest
, pName
, SfxStringItem
, FN_INSERT_TABLE
, sal_False
);
2663 SFX_REQUEST_ARG( _rRequest
, pCols
, SfxUInt16Item
, SID_ATTR_TABLE_COLUMN
, sal_False
);
2664 SFX_REQUEST_ARG( _rRequest
, pRows
, SfxUInt16Item
, SID_ATTR_TABLE_ROW
, sal_False
);
2665 SFX_REQUEST_ARG( _rRequest
, pFlags
, SfxInt32Item
, FN_PARAM_1
, sal_False
);
2666 SFX_REQUEST_ARG( _rRequest
, pAuto
, SfxStringItem
, FN_PARAM_2
, sal_False
);
2669 aTableName
= pName
->GetValue();
2671 nCols
= pCols
->GetValue();
2673 nRows
= pRows
->GetValue();
2676 aAutoName
= pAuto
->GetValue();
2677 if ( aAutoName
.Len() )
2679 SwTableAutoFmtTbl aTableTbl
;
2681 for ( USHORT n
=0; n
<aTableTbl
.Count(); n
++ )
2683 if ( aTableTbl
[n
]->GetName() == aAutoName
)
2685 pTAFmt
= new SwTableAutoFmt( *aTableTbl
[n
] );
2693 aInsTblOpts
.mnInsMode
= (USHORT
) pFlags
->GetValue();
2696 const SwModuleOptions
* pModOpt
= SW_MOD()->GetModuleConfig();
2697 aInsTblOpts
= pModOpt
->GetInsTblFlags(bHTMLMode
);
2701 if( !nCols
|| !nRows
)
2703 SwAbstractDialogFactory
* pFact
= SwAbstractDialogFactory::Create();
2704 DBG_ASSERT(pFact
, "Dialogdiet fail!");
2705 AbstractInsTableDlg
* pDlg
= pFact
->CreateInsTableDlg( DLG_INSERT_TABLE
, rTempView
);
2706 DBG_ASSERT(pDlg
, "Dialogdiet fail!");
2707 if( RET_OK
== pDlg
->Execute() )
2709 pDlg
->GetValues( aTableName
, nRows
, nCols
, aInsTblOpts
, aAutoName
, pTAFmt
);
2716 if( nCols
&& nRows
)
2718 // record before shell change
2719 _rRequest
.AppendItem( SfxStringItem( FN_INSERT_TABLE
, aTableName
) );
2720 if ( aAutoName
.Len() )
2721 _rRequest
.AppendItem( SfxStringItem( FN_PARAM_2
, aAutoName
) );
2722 _rRequest
.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_COLUMN
, nCols
) );
2723 _rRequest
.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_ROW
, nRows
) );
2724 _rRequest
.AppendItem( SfxInt32Item( FN_PARAM_1
, (sal_Int32
) aInsTblOpts
.mnInsMode
) );
2727 rSh
.StartUndo(UNDO_INSTABLE
);
2728 bCallEndUndo
= TRUE
;
2730 rSh
.StartAllAction();
2731 if( rSh
.HasSelection() )
2734 rSh
.InsertTable( aInsTblOpts
, nRows
, nCols
, text::HoriOrientation::FULL
, pTAFmt
);
2735 rSh
.MoveTable( fnTablePrev
, fnTableStart
);
2737 if( aTableName
.Len() && !rSh
.GetTblStyle( aTableName
) )
2738 rSh
.GetTableFmt()->SetName( aTableName
);
2741 rTempView
.AutoCaption(TABLE_CAP
);
2748 SwRewriter aRewriter
;
2750 if (rSh
.GetTableFmt())
2752 aRewriter
.AddRule(UNDO_ARG1
, SW_RES(STR_START_QUOTE
));
2753 aRewriter
.AddRule(UNDO_ARG2
, rSh
.GetTableFmt()->GetName());
2754 aRewriter
.AddRule(UNDO_ARG3
, SW_RES(STR_END_QUOTE
));
2757 rSh
.EndUndo(UNDO_INSTABLE
, &aRewriter
); // wegen moegl. Shellwechsel
2762 // ----------------------------------------------------------------------------
2764 void SwBaseShell::GetGalleryState( SfxItemSet
&rSet
)
2766 SwWrtShell
&rSh
= GetShell();
2767 SfxWhichIter
aIter( rSet
);
2768 USHORT nWhich
= aIter
.FirstWhich();
2771 case SID_GALLERY_BG_BRUSH
:
2773 int nSel
= rSh
.GetSelectionType();
2774 SfxStringListItem
aLst( nWhich
);
2775 List
*pLst
= aLst
.GetList();
2776 nParagraphPos
= nGraphicPos
= nOlePos
= nFramePos
= nTablePos
=
2777 nTableRowPos
= nTableCellPos
= nPagePos
=
2778 nHeaderPos
= nFooterPos
= 0;
2780 pLst
->Insert( (void*) new SW_RESSTR( STR_SWBG_PAGE
), pLst
->Count() );
2782 USHORT nHtmlMode
= ::GetHtmlMode(GetView().GetDocShell());
2783 BOOL bHtmlMode
= 0 != (nHtmlMode
& HTMLMODE_ON
);
2785 if ( (!bHtmlMode
|| (nHtmlMode
& HTMLMODE_FULL_STYLES
)) &&
2786 (nSel
& nsSelectionType::SEL_TXT
) )
2788 pLst
->Insert( (void*) new SW_RESSTR( STR_SWBG_PARAGRAPH
), pLst
->Count() );
2789 nParagraphPos
= nPos
++;
2791 if ( (!bHtmlMode
|| (nHtmlMode
& HTMLMODE_SOME_STYLES
)) &&
2792 nSel
& (nsSelectionType::SEL_TBL
|nsSelectionType::SEL_TBL_CELLS
) )
2794 pLst
->Insert( (void*) new SW_RESSTR( STR_SWBG_TABLE
), pLst
->Count() );
2799 pLst
->Insert( (void*) new SW_RESSTR( STR_SWBG_TABLE_ROW
), pLst
->Count() );
2800 nTableRowPos
= nPos
++;
2803 pLst
->Insert( (void*) new SW_RESSTR( STR_SWBG_TABLE_CELL
), pLst
->Count() );
2804 nTableCellPos
= nPos
++;
2808 if ( nSel
& nsSelectionType::SEL_FRM
)
2810 pLst
->Insert( (void*) new SW_RESSTR( STR_SWBG_FRAME
), pLst
->Count() );
2813 if ( nSel
& nsSelectionType::SEL_GRF
)
2815 pLst
->Insert( (void*) new SW_RESSTR( STR_SWBG_GRAPHIC
), pLst
->Count() );
2816 nGraphicPos
= nPos
++;
2818 if ( nSel
& nsSelectionType::SEL_OLE
)
2820 pLst
->Insert( (void*) new SW_RESSTR( STR_SWBG_OLE
), pLst
->Count() );
2823 const USHORT nType
= rSh
.GetFrmType(0,TRUE
);
2824 if ( nType
& FRMTYPE_HEADER
)
2826 pLst
->Insert( (void*) new SW_RESSTR( STR_SWBG_HEADER
), pLst
->Count() );
2827 nHeaderPos
= nPos
++;
2829 if ( nType
& FRMTYPE_FOOTER
)
2831 pLst
->Insert( (void*) new SW_RESSTR( STR_SWBG_FOOTER
), pLst
->Count() );
2835 if ( pLst
->Count() )
2838 rSet
.DisableItem( nWhich
);
2845 void SwBaseShell::ExecuteGallery(SfxRequest
&rReq
)
2847 SwWrtShell
&rSh
= GetShell();
2849 const SfxItemSet
* pArgs
= rReq
.GetArgs();
2850 USHORT nSlot
= rReq
.GetSlot();
2853 case SID_GALLERY_BG_BRUSH
:
2855 int nSel
= rSh
.GetSelectionType();
2856 if ( nSel
& nsSelectionType::SEL_DRW_TXT
)
2859 BYTE nPos
= (BYTE
)((SfxUInt16Item
&)pArgs
->Get(SID_GALLERY_BG_POS
)).GetValue();
2862 SvxBrushItem
aBrush( (SvxBrushItem
&)pArgs
->Get(SID_GALLERY_BG_BRUSH
));
2863 aBrush
.SetWhich( RES_BACKGROUND
);
2864 if ( nPos
== nParagraphPos
)
2865 rSh
.SetAttr( aBrush
);
2866 else if ( nPos
== nTablePos
)
2867 rSh
.SetTabBackground( aBrush
);
2868 else if ( nPos
== nTableRowPos
)
2869 rSh
.SetRowBackground( aBrush
);
2870 else if ( nPos
== nTableCellPos
)
2871 rSh
.SetBoxBackground( aBrush
);
2872 else if ( nPos
== nFramePos
|| nPos
== nGraphicPos
|| nPos
== nOlePos
)
2874 SfxItemSet
aCoreSet(GetPool(), RES_BACKGROUND
, RES_BACKGROUND
);
2875 aCoreSet
.Put( aBrush
);
2876 rSh
.SetFlyFrmAttr( aCoreSet
);
2878 else if ( nPos
== nPagePos
|| nPos
== nHeaderPos
|| nPos
== nFooterPos
)
2880 USHORT nDesc
= rSh
.GetCurPageDesc();
2881 SwPageDesc
aDesc( rSh
.GetPageDesc( nDesc
) );
2882 if ( nPos
== nPagePos
)
2883 aDesc
.GetMaster().SetFmtAttr( aBrush
);
2884 else if ( nPos
== nHeaderPos
)
2886 SwFmtHeader
aHead( aDesc
.GetMaster().GetHeader() );
2887 aHead
.GetHeaderFmt()->SetFmtAttr( aBrush
);
2888 aDesc
.GetMaster().SetFmtAttr( aHead
);
2890 else if ( nPos
== nFooterPos
)
2892 SwFmtFooter
aFoot( aDesc
.GetMaster().GetFooter() );
2893 aFoot
.GetFooterFmt()->SetFmtAttr( aBrush
);
2894 aDesc
.GetMaster().SetFmtAttr( aFoot
);
2896 rSh
.ChgPageDesc( nDesc
, aDesc
);
2905 void SwBaseShell::ExecField( SfxRequest
& rReq
)
2907 USHORT nSlot
= rReq
.GetSlot();
2910 case FN_CHANGE_DBFIELD
:
2912 SwAbstractDialogFactory
* pFact
= SwAbstractDialogFactory::Create();
2913 DBG_ASSERT(pFact
, "SwAbstractDialogFactory fail!");
2915 VclAbstractDialog
* pDlg
= pFact
->CreateSwChangeDBDlg(GetView(), DLG_CHANGE_DB
);
2916 DBG_ASSERT(pDlg
, "Dialogdiet fail!");
2922 ASSERT(FALSE
, falscher Dispatcher
);