summaryrefslogtreecommitdiffstats
path: root/sw/source/ui/shells
diff options
context:
space:
mode:
authorOliver-Rainer Wittmann <orw@apache.org>2013-11-18 11:29:24 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-11-19 15:51:27 +0000
commitc2b5521921b806ff7b04cdacebde3834d2aafd4b (patch)
treeb38392e0a7d40b58487ea4a72a5ddc748b8cb5b3 /sw/source/ui/shells
parentneed a String::EraseAllChars-alike for OUStringBuffer (diff)
downloadcore-c2b5521921b806ff7b04cdacebde3834d2aafd4b.tar.gz
core-c2b5521921b806ff7b04cdacebde3834d2aafd4b.zip
Resolves: #i33737# enable in-place editing of Input Fields
(cherry picked from commit c2afeb1c3f11e8f420b59f3786eb8626c99ff595) Conflicts: sw/inc/IDocumentContentOperations.hxx sw/inc/crsrsh.hxx sw/inc/doc.hxx sw/inc/editsh.hxx sw/inc/expfld.hxx sw/inc/fldbas.hxx sw/inc/fmtfld.hxx sw/inc/hintids.hxx sw/inc/ndtxt.hxx sw/inc/txatbase.hxx sw/inc/txtfld.hxx sw/inc/txtrfmrk.hxx sw/inc/txttxmrk.hxx sw/inc/viscrs.hxx sw/source/core/bastyp/init.cxx sw/source/core/crsr/crsrsh.cxx sw/source/core/crsr/crstrvl.cxx sw/source/core/crsr/findattr.cxx sw/source/core/crsr/findtxt.cxx sw/source/core/crsr/swcrsr.cxx sw/source/core/crsr/viscrs.cxx sw/source/core/doc/dbgoutsw.cxx sw/source/core/doc/doc.cxx sw/source/core/doc/docfld.cxx sw/source/core/doc/docfmt.cxx sw/source/core/doc/docnum.cxx sw/source/core/doc/docredln.cxx sw/source/core/doc/docruby.cxx sw/source/core/doc/doctxm.cxx sw/source/core/doc/visiturl.cxx sw/source/core/docnode/nodes.cxx sw/source/core/edit/edatmisc.cxx sw/source/core/edit/edattr.cxx sw/source/core/edit/edfld.cxx sw/source/core/edit/edfldexp.cxx sw/source/core/edit/editsh.cxx sw/source/core/edit/edlingu.cxx sw/source/core/edit/ednumber.cxx sw/source/core/fields/expfld.cxx sw/source/core/fields/fldbas.cxx sw/source/core/fields/reffld.cxx sw/source/core/frmedt/fefly1.cxx sw/source/core/inc/docfld.hxx sw/source/core/inc/rolbck.hxx sw/source/core/inc/swfont.hxx sw/source/core/layout/flycnt.cxx sw/source/core/layout/laycache.cxx sw/source/core/layout/trvlfrm.cxx sw/source/core/text/atrhndl.hxx sw/source/core/text/atrstck.cxx sw/source/core/text/inftxt.cxx sw/source/core/text/porfld.cxx sw/source/core/text/porfld.hxx sw/source/core/text/txtfld.cxx sw/source/core/tox/tox.cxx sw/source/core/tox/txmsrt.cxx sw/source/core/txtnode/atrfld.cxx sw/source/core/txtnode/ndhints.cxx sw/source/core/txtnode/ndtxt.cxx sw/source/core/txtnode/thints.cxx sw/source/core/txtnode/txatbase.cxx sw/source/core/txtnode/txatritr.cxx sw/source/core/txtnode/txtedt.cxx sw/source/core/undo/SwUndoField.cxx sw/source/core/undo/rolbck.cxx sw/source/core/undo/unsect.cxx sw/source/core/undo/untbl.cxx sw/source/core/unocore/unocrsrhelper.cxx sw/source/core/unocore/unofield.cxx sw/source/core/unocore/unoframe.cxx sw/source/core/unocore/unorefmk.cxx sw/source/core/view/vprint.cxx sw/source/filter/ascii/ascatr.cxx sw/source/filter/html/htmlatr.cxx sw/source/filter/rtf/rtffly.cxx sw/source/filter/ww1/fltshell.cxx sw/source/filter/ww1/w1filter.cxx sw/source/filter/ww8/wrtw8esh.cxx sw/source/filter/ww8/wrtw8nds.cxx sw/source/filter/ww8/ww8atr.cxx sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par3.cxx sw/source/filter/ww8/ww8par5.cxx sw/source/ui/app/applab.cxx sw/source/ui/docvw/edtwin.cxx sw/source/ui/docvw/edtwin2.cxx sw/source/ui/envelp/envfmt.cxx sw/source/ui/fldui/fldedt.cxx sw/source/ui/fldui/fldmgr.cxx sw/source/ui/inc/wrtsh.hxx sw/source/ui/lingu/hhcwrp.cxx sw/source/ui/shells/basesh.cxx sw/source/ui/shells/drwtxtex.cxx sw/source/ui/shells/grfsh.cxx sw/source/ui/shells/tabsh.cxx sw/source/ui/shells/textfld.cxx sw/source/ui/shells/textidx.cxx sw/source/ui/shells/textsh.cxx sw/source/ui/shells/textsh1.cxx sw/source/ui/shells/txtattr.cxx sw/source/ui/uiview/formatclipboard.cxx sw/source/ui/uiview/view.cxx sw/source/ui/uiview/view2.cxx sw/source/ui/uiview/viewsrch.cxx sw/source/ui/uiview/viewstat.cxx sw/source/ui/uiview/viewtab.cxx sw/source/ui/wrtsh/wrtsh1.cxx sw/source/ui/wrtsh/wrtsh2.cxx Change-Id: I6758d6719e1fd523797cc6ee2648ffcb47d52595
Diffstat (limited to 'sw/source/ui/shells')
-rw-r--r--sw/source/ui/shells/annotsh.cxx36
-rw-r--r--sw/source/ui/shells/basesh.cxx70
-rw-r--r--sw/source/ui/shells/drwtxtex.cxx43
-rw-r--r--sw/source/ui/shells/frmsh.cxx10
-rw-r--r--sw/source/ui/shells/grfsh.cxx15
-rw-r--r--sw/source/ui/shells/langhelper.cxx6
-rw-r--r--sw/source/ui/shells/listsh.cxx7
-rw-r--r--sw/source/ui/shells/tabsh.cxx6
-rw-r--r--sw/source/ui/shells/textfld.cxx144
-rw-r--r--sw/source/ui/shells/textidx.cxx9
-rw-r--r--sw/source/ui/shells/textsh.cxx149
-rw-r--r--sw/source/ui/shells/textsh1.cxx121
-rw-r--r--sw/source/ui/shells/txtattr.cxx20
13 files changed, 412 insertions, 224 deletions
diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx
index 40bb4b81eab3..1106013b376e 100644
--- a/sw/source/ui/shells/annotsh.cxx
+++ b/sw/source/ui/shells/annotsh.cxx
@@ -1080,13 +1080,14 @@ void SwAnnotationShell::NoteExec(SfxRequest &rReq)
sal_uInt16 nSlot = rReq.GetSlot();
switch (nSlot)
{
- case FN_REPLY:
- case FN_POSTIT:
- case FN_DELETE_COMMENT:
- if ( pPostItMgr->HasActiveSidebarWin() )
- pPostItMgr->GetActiveSidebarWin()->ExecuteCommand(nSlot);
- break;
- case FN_DELETE_ALL_NOTES:
+ case FN_REPLY:
+ case FN_POSTIT:
+ case FN_DELETE_COMMENT:
+ if ( pPostItMgr->HasActiveSidebarWin() )
+ pPostItMgr->GetActiveSidebarWin()->ExecuteCommand(nSlot);
+ break;
+
+ case FN_DELETE_ALL_NOTES:
pPostItMgr->Delete();
break;
case FN_DELETE_NOTE_AUTHOR:
@@ -1120,22 +1121,23 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet)
sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich );
switch( nSlotId )
{
- case FN_POSTIT:
- case FN_DELETE_NOTE_AUTHOR:
- case FN_DELETE_ALL_NOTES:
- case FN_HIDE_NOTE:
- case FN_HIDE_NOTE_AUTHOR:
- case FN_HIDE_ALL_NOTES:
- case FN_DELETE_COMMENT:
+ case FN_POSTIT:
+ case FN_DELETE_NOTE_AUTHOR:
+ case FN_DELETE_ALL_NOTES:
+ case FN_HIDE_NOTE:
+ case FN_HIDE_NOTE_AUTHOR:
+ case FN_HIDE_ALL_NOTES:
+ case FN_DELETE_COMMENT:
{
- if ( !pPostItMgr ||
- !pPostItMgr->HasActiveAnnotationWin() )
+ if( !pPostItMgr
+ || !pPostItMgr->HasActiveAnnotationWin() )
{
rSet.DisableItem(nWhich);
}
break;
}
- case FN_REPLY:
+
+ case FN_REPLY:
{
if ( !pPostItMgr ||
!pPostItMgr->HasActiveAnnotationWin() )
diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx
index c1493584cf22..4b5d9f80aa4c 100644
--- a/sw/source/ui/shells/basesh.cxx
+++ b/sw/source/ui/shells/basesh.cxx
@@ -265,11 +265,10 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
case SID_PASTE:
{
TransferableDataHelper aDataHelper(
- TransferableDataHelper::CreateFromSystemClipboard(
- &rSh.GetView().GetEditWin() ) );
-
- if( aDataHelper.GetXTransferable().is() &&
- SwTransferable::IsPaste( rSh, aDataHelper ))
+ TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin() ) );
+ if( aDataHelper.GetXTransferable().is()
+ && SwTransferable::IsPaste( rSh, aDataHelper )
+ && !rSh.CrsrInsideInputFld() )
{
// Temporary variables, because the shell could already be
// destroyed after the paste.
@@ -317,10 +316,9 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
case SID_PASTE_UNFORMATTED:
{
TransferableDataHelper aDataHelper(
- TransferableDataHelper::CreateFromSystemClipboard(
- &rSh.GetView().GetEditWin()) );
- if( aDataHelper.GetXTransferable().is() &&
- SwTransferable::IsPaste( rSh, aDataHelper ))
+ TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin()) );
+ if( aDataHelper.GetXTransferable().is()
+ && SwTransferable::IsPaste( rSh, aDataHelper ) )
{
// Temporary variables, because the shell could already be
// destroyed after the paste.
@@ -352,10 +350,10 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
case SID_PASTE_SPECIAL:
{
TransferableDataHelper aDataHelper(
- TransferableDataHelper::CreateFromSystemClipboard(
- &rSh.GetView().GetEditWin()) );
- if( aDataHelper.GetXTransferable().is() &&
- SwTransferable::IsPaste( rSh, aDataHelper ))
+ TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin()) );
+ if( aDataHelper.GetXTransferable().is()
+ && SwTransferable::IsPaste( rSh, aDataHelper )
+ && !rSh.CrsrInsideInputFld() )
{
// Temporary variables, because the shell could already be
// destroyed after the paste.
@@ -368,7 +366,7 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
{
SfxViewFrame* pViewFrame = pView->GetViewFrame();
uno::Reference< frame::XDispatchRecorder > xRecorder =
- pViewFrame->GetBindings().GetRecorder();
+ pViewFrame->GetBindings().GetRecorder();
if(xRecorder.is()) {
SfxRequest aReq( pViewFrame, SID_CLIPBOARD_FORMAT_ITEMS );
aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, nFormatId ) );
@@ -384,6 +382,7 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
return;
}
break;
+
default:
OSL_FAIL("wrong Dispatcher");
return;
@@ -419,15 +418,25 @@ void SwBaseShell::StateClpbrd(SfxItemSet &rSet)
break;
case SID_PASTE:
- if( !GetView().IsPasteAllowed() )
- rSet.DisableItem( SID_PASTE );
+ if( !GetView().IsPasteAllowed()
+ || rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem( nWhich );
+ }
break;
case SID_PASTE_SPECIAL:
+ if( !GetView().IsPasteSpecialAllowed()
+ || rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ break;
+
+ case SID_PASTE_UNFORMATTED:
if( !GetView().IsPasteSpecialAllowed() )
{
- rSet.DisableItem( SID_PASTE_SPECIAL );
- rSet.DisableItem( SID_PASTE_UNFORMATTED );
+ rSet.DisableItem( nWhich );
}
break;
@@ -620,8 +629,9 @@ void SwBaseShell::Execute(SfxRequest &rReq)
break;
case FN_UPDATE_INPUTFIELDS:
- rSh.UpdateInputFlds(NULL, sal_False);
+ rSh.UpdateInputFlds();
break;
+
case FN_PREV_BOOKMARK:
rReq.SetReturnValue(SfxBoolItem( nSlot, rSh.GoPrevBookmark()));
break;
@@ -651,7 +661,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
rSh.ClearMark();
rSh.EndSelect();
}
- sal_Bool bRet = rSh.MoveFldType(pFldType, nSlot == FN_GOTO_NEXT_MARK);
+ sal_Bool bRet = rSh.MoveFldType( pFldType, nSlot == FN_GOTO_NEXT_MARK );
SwField* pCurField = bRet ? rSh.GetCurFld() : 0;
if (pCurField)
rSh.ClickToField(*pCurField);
@@ -1159,7 +1169,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
}
else
{
- rSh.SetAttr( *pArgs );
+ rSh.SetAttrSet( *pArgs );
}
rSh.EndAllAction();
}
@@ -1192,7 +1202,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
else
{
// Set border attributes via shell quite normally.
- rSh.SetAttr( *pItem );
+ rSh.SetAttrItem( *pItem );
}
}
break;
@@ -1326,10 +1336,14 @@ void SwBaseShell::GetState( SfxItemSet &rSet )
break;
case FN_INSERT_REGION:
- if( rSh.IsSelFrmMode() ||
- !rSh.IsInsRegionAvailable() )
+ if( rSh.CrsrInsideInputFld()
+ || rSh.IsSelFrmMode()
+ || !rSh.IsInsRegionAvailable() )
+ {
rSet.DisableItem( nWhich );
+ }
break;
+
case FN_CONVERT_TABLE_TO_TEXT:
{
sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_True);
@@ -2023,7 +2037,7 @@ void SwBaseShell::ExecTxtCtrl( SfxRequest& rReq )
if (!bAuto)
{
- rSh.SetAttr( *pArgs );
+ rSh.SetAttrSet( *pArgs );
}
}
delete pSSetItem;
@@ -2268,7 +2282,7 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq)
rSh.AutoUpdatePara( pColl, aSet);
}
else
- rSh.SetAttr( aBrushItem );
+ rSh.SetAttrItem( aBrushItem );
}
rReq.Done();
@@ -2414,7 +2428,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq)
OSL_ENSURE(pDlg, "Dialogdiet fail!");
if ( pDlg->Execute() == RET_OK )
{
- rSh.SetAttr( *pDlg->GetOutputItemSet() );
+ rSh.SetAttrSet( *pDlg->GetOutputItemSet() );
pOutSet = pDlg->GetOutputItemSet();
}
}
@@ -2688,7 +2702,7 @@ void SwBaseShell::ExecuteGallery(SfxRequest &rReq)
SvxBrushItem aBrush( *pBrush );
aBrush.SetWhich( RES_BACKGROUND );
if ( nPos == nParagraphPos )
- rSh.SetAttr( aBrush );
+ rSh.SetAttrItem( aBrush );
else if ( nPos == nTablePos )
rSh.SetTabBackground( aBrush );
else if ( nPos == nTableRowPos )
diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx
index 1d2a9828b984..56f4184df969 100644
--- a/sw/source/ui/shells/drwtxtex.cxx
+++ b/sw/source/ui/shells/drwtxtex.cxx
@@ -937,7 +937,7 @@ void SwDrawTextShell::StateClpbrd(SfxItemSet &rSet)
OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
ESelection aSel(pOLV->GetSelection());
const bool bCopy = (aSel.nStartPara != aSel.nEndPara) ||
- (aSel.nStartPos != aSel.nEndPos);
+ (aSel.nStartPos != aSel.nEndPos);
SfxWhichIter aIter(rSet);
@@ -947,32 +947,31 @@ void SwDrawTextShell::StateClpbrd(SfxItemSet &rSet)
{
switch(nWhich)
{
- case SID_CUT:
- case SID_COPY:
- if( !bCopy )
- rSet.DisableItem( nWhich );
- break;
+ case SID_CUT:
+ case SID_COPY:
+ if( !bCopy )
+ rSet.DisableItem( nWhich );
+ break;
- case SID_PASTE:
- {
- TransferableDataHelper aDataHelper(
- TransferableDataHelper::CreateFromSystemClipboard(
- &GetView().GetEditWin() ) );
+ case SID_PASTE:
+ {
+ TransferableDataHelper aDataHelper(
+ TransferableDataHelper::CreateFromSystemClipboard( &GetView().GetEditWin() ) );
- if( !aDataHelper.GetXTransferable().is() ||
- !SwTransferable::IsPaste( GetShell(), aDataHelper ))
- rSet.DisableItem( SID_PASTE );
+ if( !aDataHelper.GetXTransferable().is()
+ || !SwTransferable::IsPaste( GetShell(), aDataHelper ) )
+ {
+ rSet.DisableItem( nWhich );
}
- break;
+ }
+ break;
- case SID_PASTE_SPECIAL:
- rSet.DisableItem( SID_PASTE_SPECIAL );
- break;
- // #151110#
- case SID_CLIPBOARD_FORMAT_ITEMS:
- rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS );
- break;
+ case SID_PASTE_SPECIAL:
+ case SID_CLIPBOARD_FORMAT_ITEMS:
+ rSet.DisableItem( nWhich );
+ break;
}
+
nWhich = aIter.NextWhich();
}
}
diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx
index 299d3fc43983..8ffa207c3a74 100644
--- a/sw/source/ui/shells/frmsh.cxx
+++ b/sw/source/ui/shells/frmsh.cxx
@@ -1172,9 +1172,15 @@ void SwFrameShell::GetLineStyleState(SfxItemSet &rSet)
void SwFrameShell::StateInsert(SfxItemSet &rSet)
{
const int nSel = GetShell().GetSelectionType();
-
- if ((nSel & nsSelectionType::SEL_GRF) || (nSel & nsSelectionType::SEL_OLE))
+ if ( (nSel & nsSelectionType::SEL_GRF)
+ || (nSel & nsSelectionType::SEL_OLE) )
+ {
+ rSet.DisableItem(FN_INSERT_FRAME);
+ }
+ else if ( GetShell().CrsrInsideInputFld() )
+ {
rSet.DisableItem(FN_INSERT_FRAME);
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx
index 949c7e639701..00e49bf7ac27 100644
--- a/sw/source/ui/shells/grfsh.cxx
+++ b/sw/source/ui/shells/grfsh.cxx
@@ -163,7 +163,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
Graphic aCompressedGraphic( aDialog.GetCompressedGraphic() );
rSh.ReRead(aEmptyOUStr, aEmptyOUStr, (const Graphic*) &aCompressedGraphic);
- rSh.SetAttr(aCrop);
+ rSh.SetAttrItem(aCrop);
rSh.EndUndo(UNDO_END);
rSh.EndAllAction();
@@ -417,7 +417,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
RES_GRFATR_END-1 );
aGrfSet.Put( *pSet );
if( aGrfSet.Count() )
- rSh.SetAttr( aGrfSet );
+ rSh.SetAttrSet( aGrfSet );
rSh.EndUndo(UNDO_END);
rSh.EndAllAction();
@@ -432,7 +432,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
rSh.GetCurAttr( aSet );
SwMirrorGrf aGrf((const SwMirrorGrf &)aSet.Get(RES_GRFATR_MIRRORGRF));
aGrf.SetGrfToggle(!aGrf.IsGrfToggle());
- rSh.SetAttr(aGrf);
+ rSh.SetAttrItem(aGrf);
}
break;
@@ -590,7 +590,7 @@ void SwGrfShell::ExecAttr( SfxRequest &rReq )
}
if( aGrfSet.Count() )
- GetShell().SetAttr( aGrfSet );
+ GetShell().SetAttrSet( aGrfSet );
}
GetView().GetViewFrame()->GetBindings().Invalidate(rReq.GetSlot());
}
@@ -617,6 +617,11 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet)
case SID_TWAIN_TRANSFER:
if( bParentCntProt || !bIsGrfCntnt )
bDisable = true;
+ else if ( nWhich == SID_INSERT_GRAPHIC
+ && rSh.CrsrInsideInputFld() )
+ {
+ bDisable = true;
+ }
break;
case SID_SAVE_GRAPHIC:
@@ -822,7 +827,7 @@ void SwGrfShell::ExecuteRotation(SfxRequest &rReq)
aCrop.SetBottom( aCropRectangle.Right() );
}
- rShell.SetAttr(aCrop);
+ rShell.SetAttrItem(aCrop);
rShell.EndUndo(UNDO_END);
rShell.EndAllAction();
diff --git a/sw/source/ui/shells/langhelper.cxx b/sw/source/ui/shells/langhelper.cxx
index 85e30b529e30..d3055a297f95 100644
--- a/sw/source/ui/shells/langhelper.cxx
+++ b/sw/source/ui/shells/langhelper.cxx
@@ -274,7 +274,7 @@ namespace SwLangHelper
{
rWrtSh.GetCurAttr( rCoreSet );
rCoreSet.Put( SvxLanguageItem( nLang, nLangWhichId ));
- rWrtSh.SetAttr( rCoreSet );
+ rWrtSh.SetAttrSet( rCoreSet );
}
}
else // change language for all text
@@ -308,7 +308,7 @@ namespace SwLangHelper
// #i102191: hard set respective language attribute in text document
// (for all text in the document - which should be selected by now...)
- rWrtSh.SetAttr( SvxLanguageItem( nLang, nLangWhichId ) );
+ rWrtSh.SetAttrItem( SvxLanguageItem( nLang, nLangWhichId ) );
}
}
}
@@ -356,7 +356,7 @@ namespace SwLangHelper
rWrtSh.GetCurAttr( rCoreSet );
for (sal_uInt16 i = 0; i < 3; ++i)
rCoreSet.Put( SvxLanguageItem( LANGUAGE_NONE, aLangWhichId_Writer[i] ));
- rWrtSh.SetAttr( rCoreSet );
+ rWrtSh.SetAttrSet( rCoreSet );
}
}
else // change language for all text
diff --git a/sw/source/ui/shells/listsh.cxx b/sw/source/ui/shells/listsh.cxx
index ddbc1b371dd7..dd21ec6b1b4f 100644
--- a/sw/source/ui/shells/listsh.cxx
+++ b/sw/source/ui/shells/listsh.cxx
@@ -259,6 +259,13 @@ void SwListShell::GetState(SfxItemSet &rSet)
if(nCurrentNumLevel == (MAXLEVEL - 1))
rSet.DisableItem(nWhich);
break;
+
+ case FN_NUM_BULLET_NONUM:
+ if ( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem(nWhich);
+ }
+ break;
}
nWhich = aIter.NextWhich();
}
diff --git a/sw/source/ui/shells/tabsh.cxx b/sw/source/ui/shells/tabsh.cxx
index 81dd8c334590..17d7a315c4c4 100644
--- a/sw/source/ui/shells/tabsh.cxx
+++ b/sw/source/ui/shells/tabsh.cxx
@@ -1205,8 +1205,10 @@ void SwTableShell::GetState(SfxItemSet &rSet)
break;
case FN_INSERT_TABLE:
- // Put any value, so that the controller remains enabled.
- // Instead "Insert:Table" appears "Format:Table".
+ if ( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem( nSlot );
+ }
break;
case FN_TABLE_OPTIMAL_HEIGHT:
diff --git a/sw/source/ui/shells/textfld.cxx b/sw/source/ui/shells/textfld.cxx
index 5e562ed73dd0..a7050c4d1fdc 100644
--- a/sw/source/ui/shells/textfld.cxx
+++ b/sw/source/ui/shells/textfld.cxx
@@ -41,6 +41,7 @@
#include <fldwrap.hxx>
#include <redline.hxx>
#include <view.hxx>
+#include <viewopt.hxx>
#include <wrtsh.hxx>
#include <basesh.hxx>
#include <flddat.hxx>
@@ -164,11 +165,26 @@ void SwTextShell::ExecField(SfxRequest &rReq)
{
sal_Bool bRet = sal_False;
SwFieldType* pFld = rSh.GetFldType( 0, RES_INPUTFLD );
- if( pFld && rSh.MoveFldType( pFld,
- FN_GOTO_NEXT_INPUTFLD == nSlot ))
+ const bool bAddSetExpressionFlds = !( rSh.GetViewOptions()->IsReadonly() );
+ if ( pFld != NULL
+ && rSh.MoveFldType(
+ pFld,
+ FN_GOTO_NEXT_INPUTFLD == nSlot,
+ USHRT_MAX,
+ bAddSetExpressionFlds ) )
{
rSh.ClearMark();
- rSh.StartInputFldDlg( rSh.GetCurFld(), sal_False );
+ if ( dynamic_cast<SwInputField*>(rSh.GetCurFld( true )) != NULL )
+ {
+ rSh.SttSelect();
+ rSh.SelectTxt(
+ rSh.StartOfInputFldAtPos( *(rSh.GetCrsr()->Start()) ) + 1,
+ rSh.EndOfInputFldAtPos( *(rSh.GetCrsr()->Start()) ) - 1 );
+ }
+ else
+ {
+ rSh.StartInputFldDlg( rSh.GetCurFld( true ), sal_False );
+ }
bRet = sal_True;
}
@@ -332,7 +348,7 @@ void SwTextShell::ExecField(SfxRequest &rReq)
break;
case FN_POSTIT:
{
- SwPostItField* pPostIt = (SwPostItField*)aFldMgr.GetCurFld();
+ SwPostItField* pPostIt = dynamic_cast<SwPostItField*>(aFldMgr.GetCurFld());
bool bNew = !(pPostIt && pPostIt->GetTyp()->Which() == RES_POSTITFLD);
if (bNew || GetView().GetPostItMgr()->IsAnswer())
{
@@ -610,26 +626,26 @@ void SwTextShell::StateField( SfxItemSet &rSet )
{
switch (nWhich)
{
- case FN_DELETE_COMMENT:
- case FN_DELETE_NOTE_AUTHOR:
- case FN_DELETE_ALL_NOTES:
- case FN_HIDE_NOTE:
- case FN_HIDE_NOTE_AUTHOR:
- case FN_HIDE_ALL_NOTES:
+ case FN_DELETE_COMMENT:
+ case FN_DELETE_NOTE_AUTHOR:
+ case FN_DELETE_ALL_NOTES:
+ case FN_HIDE_NOTE:
+ case FN_HIDE_NOTE_AUTHOR:
+ case FN_HIDE_ALL_NOTES:
+ {
+ SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
+ if ( !pPostItMgr )
+ rSet.InvalidateItem( nWhich );
+ else if ( !pPostItMgr->HasActiveSidebarWin() )
{
- SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
- if ( !pPostItMgr )
- rSet.InvalidateItem( nWhich );
- else if ( !pPostItMgr->HasActiveSidebarWin() )
- {
- rSet.InvalidateItem( FN_DELETE_COMMENT );
- rSet.InvalidateItem( FN_HIDE_NOTE );
- }
+ rSet.InvalidateItem( FN_DELETE_COMMENT );
+ rSet.InvalidateItem( FN_HIDE_NOTE );
}
+ }
break;
- case FN_EDIT_FIELD:
- {
+ case FN_EDIT_FIELD:
+ {
if( !bGetField )
{
pField = rSh.GetCurFld();
@@ -643,14 +659,15 @@ void SwTextShell::StateField( SfxItemSet &rSet )
RES_AUTHORITY == nTempWhich )
rSet.DisableItem( nWhich );
else if( RES_DDEFLD == nTempWhich &&
- !((SwDDEFieldType*)pField->GetTyp())->GetBaseLink().IsVisible())
+ !((SwDDEFieldType*)pField->GetTyp())->GetBaseLink().IsVisible())
{
// nested links cannot be edited
rSet.DisableItem( nWhich );
}
}
break;
- case FN_EXECUTE_MACROFIELD:
+
+ case FN_EXECUTE_MACROFIELD:
{
if(!bGetField)
{
@@ -662,43 +679,88 @@ void SwTextShell::StateField( SfxItemSet &rSet )
}
break;
- case FN_INSERT_FIELD:
+ case FN_INSERT_FIELD:
{
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
- if(!pVFrame->IsInModalMode() &&
- pVFrame->KnowsChildWindow(FN_INSERT_FIELD) && !pVFrame->HasChildWindow(FN_INSERT_FIELD_DATA_ONLY) )
- rSet.Put(SfxBoolItem( FN_INSERT_FIELD, pVFrame->HasChildWindow(nWhich)));
+ if ( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem(nWhich);
+ }
else
- rSet.DisableItem(FN_INSERT_FIELD);
+ {
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
+ if(!pVFrame->IsInModalMode() &&
+ pVFrame->KnowsChildWindow(FN_INSERT_FIELD) && !pVFrame->HasChildWindow(FN_INSERT_FIELD_DATA_ONLY) )
+ rSet.Put(SfxBoolItem( FN_INSERT_FIELD, pVFrame->HasChildWindow(nWhich)));
+ else
+ rSet.DisableItem(FN_INSERT_FIELD);
+ }
}
break;
- case FN_INSERT_REF_FIELD:
+
+ case FN_INSERT_REF_FIELD:
{
SfxViewFrame* pVFrame = GetView().GetViewFrame();
- if (!pVFrame->KnowsChildWindow(FN_INSERT_FIELD))
+ if ( !pVFrame->KnowsChildWindow(FN_INSERT_FIELD)
+ || rSh.CrsrInsideInputFld() )
+ {
rSet.DisableItem(FN_INSERT_REF_FIELD);
+ }
}
break;
- case FN_INSERT_FIELD_CTRL:
- rSet.Put(SfxBoolItem( nWhich, GetView().GetViewFrame()->HasChildWindow(FN_INSERT_FIELD)));
- break;
- case FN_REDLINE_COMMENT:
- if (!rSh.GetCurrRedline())
+
+ case FN_INSERT_FIELD_CTRL:
+ if ( rSh.CrsrInsideInputFld() )
+ {
rSet.DisableItem(nWhich);
- break;
- case FN_POSTIT :
- case FN_JAVAEDIT :
- bool bCurField = false;
+ }
+ else
+ {
+ rSet.Put(SfxBoolItem( nWhich, GetView().GetViewFrame()->HasChildWindow(FN_INSERT_FIELD)));
+ }
+ break;
+
+ case FN_REDLINE_COMMENT:
+ if (!rSh.GetCurrRedline())
+ rSet.DisableItem(nWhich);
+ break;
+
+ case FN_POSTIT :
+ case FN_JAVAEDIT :
+ {
+ sal_Bool bCurField = sal_False;
pField = rSh.GetCurFld();
if(nWhich == FN_POSTIT)
bCurField = pField && pField->GetTyp()->Which() == RES_POSTITFLD;
else
bCurField = pField && pField->GetTyp()->Which() == RES_SCRIPTFLD;
- if(!bCurField && rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel() )
+ if( !bCurField && rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel() )
+ {
rSet.DisableItem(nWhich);
+ }
+ else if ( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem(nWhich);
+ }
+ }
+
break;
+
+ case FN_INSERT_FLD_AUTHOR:
+ case FN_INSERT_FLD_DATE:
+ case FN_INSERT_FLD_PGCOUNT:
+ case FN_INSERT_FLD_PGNUMBER:
+ case FN_INSERT_FLD_TIME:
+ case FN_INSERT_FLD_TITLE:
+ case FN_INSERT_FLD_TOPIC:
+ case FN_INSERT_DBFIELD:
+ if ( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem(nWhich);
+ }
+ break;
+
}
nWhich = aIter.NextWhich();
}
diff --git a/sw/source/ui/shells/textidx.cxx b/sw/source/ui/shells/textidx.cxx
index 054bbcfe61b4..46531183d2ea 100644
--- a/sw/source/ui/shells/textidx.cxx
+++ b/sw/source/ui/shells/textidx.cxx
@@ -199,6 +199,15 @@ void SwTextShell::GetIdxState(SfxItemSet &rSet)
rSet.Put(SfxBoolItem(FN_INSERT_AUTH_ENTRY_DLG, sal_True));
}
+ else if ( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem( FN_INSERT_IDX_ENTRY_DLG );
+ rSet.DisableItem( FN_INSERT_AUTH_ENTRY_DLG );
+ rSet.DisableItem( FN_EDIT_AUTH_ENTRY_DLG );
+ rSet.DisableItem( FN_EDIT_IDX_ENTRY_DLG );
+ rSet.DisableItem( FN_INSERT_MULTI_TOX );
+ rSet.DisableItem( FN_REMOVE_CUR_TOX );
+ }
else
{
diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx
index 65b6b222d516..efc5ae3a32b8 100644
--- a/sw/source/ui/shells/textsh.cxx
+++ b/sw/source/ui/shells/textsh.cxx
@@ -144,7 +144,8 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
case FN_INSERT_STRING:
if( pItem )
rSh.InsertByWord(((const SfxStringItem *)pItem)->GetValue());
- break;
+ break;
+
case FN_INSERT_SOFT_HYPHEN:
if( CHAR_SOFTHYPHEN != rSh.SwCrsrShell::GetChar( sal_True, 0 ) &&
CHAR_SOFTHYPHEN != rSh.SwCrsrShell::GetChar( sal_True, -1 ))
@@ -154,20 +155,23 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
case FN_INSERT_HARDHYPHEN:
case FN_INSERT_HARD_SPACE:
{
- sal_Unicode cIns = FN_INSERT_HARD_SPACE == nSlot ? CHAR_HARDBLANK
- : CHAR_HARDHYPHEN;
+ const sal_Unicode cIns = FN_INSERT_HARD_SPACE == nSlot ? CHAR_HARDBLANK : CHAR_HARDHYPHEN;
SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();
SvxAutoCorrect* pACorr = rACfg.GetAutoCorrect();
- if( pACorr && rACfg.IsAutoFmtByInput() &&
- pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd |
- AddNonBrkSpace | ChgOrdinalNumber |
- ChgToEnEmDash | SetINetAttr | Autocorrect ))
+ if( pACorr && rACfg.IsAutoFmtByInput()
+ && pACorr->IsAutoCorrFlag(
+ CptlSttSntnc | CptlSttWrd | AddNonBrkSpace | ChgOrdinalNumber | ChgToEnEmDash | SetINetAttr | Autocorrect ) )
+ {
rSh.AutoCorrect( *pACorr, cIns );
+ }
else
+ {
rSh.Insert( OUString( cIns ) );
+ }
}
break;
+
case SID_INSERT_RLM :
case SID_INSERT_LRM :
case SID_INSERT_ZWNBSP :
@@ -184,30 +188,46 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
rSh.Insert( OUString( cIns ) );
}
break;
+
case FN_INSERT_BREAK:
- rSh.SplitNode();
+ {
+ if( !rSh.CrsrInsideInputFld() )
+ {
+ rSh.SplitNode();
+ }
+ else
+ {
+ rSh.InsertLineBreak();
+ }
+ }
rReq.Done();
- break;
+ break;
+
case FN_INSERT_PAGEBREAK:
rSh.InsertPageBreak();
rReq.Done();
- break;
+ break;
+
case FN_INSERT_LINEBREAK:
rSh.InsertLineBreak();
rReq.Done();
- break;
+ break;
+
case FN_INSERT_COLUMN_BREAK:
rSh.InsertColumnBreak();
rReq.Done();
- break;
+ break;
+
case SID_HYPERLINK_SETLINK:
if (pItem)
InsertHyperlink(*((const SvxHyperlinkItem *)pItem));
rReq.Done();
break;
+
case SID_INSERT_AVMEDIA:
rReq.SetReturnValue(SfxBoolItem(nSlot, InsertMediaDlg( rReq )));
break;
+
case SID_INSERT_SOUND:
case SID_INSERT_VIDEO:
{
@@ -247,6 +267,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
}
}
break;
+
case SID_INSERT_OBJECT:
case SID_INSERT_PLUGIN:
{
@@ -666,37 +687,39 @@ void SwTextShell::StateInsert( SfxItemSet &rSet )
rSh.Push();
const sal_Bool bCrsrInHidden = rSh.SelectHiddenRange();
- // #i103839#
- // Do not call method <SwCrsrShell::Pop(..)> with 1st parameter = <sal_False>
- // in order to avoid that the view jumps to the visible cursor.
rSh.Pop();
while ( nWhich )
{
switch ( nWhich )
{
- case SID_INSERT_SOUND:
- case SID_INSERT_VIDEO:
- /*!SvxPluginFileDlg::IsAvailable( nWhich ) ||
-
- discussed with mba: for performance reasons we skip the IsAvailable call here
- */
- if ( GetShell().IsSelFrmMode() ||
- SFX_CREATE_MODE_EMBEDDED == eCreateMode || bCrsrInHidden )
- {
- rSet.DisableItem( nWhich );
- }
- break;
+ case SID_INSERT_AVMEDIA:
+ case SID_INSERT_SOUND:
+ case SID_INSERT_VIDEO:
+ if ( GetShell().IsSelFrmMode()
+ || GetShell().CrsrInsideInputFld()
+ || SFX_CREATE_MODE_EMBEDDED == eCreateMode
+ || bCrsrInHidden )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ break;
- case SID_INSERT_DIAGRAM:
- if( !aMOpt.IsChart() || eCreateMode == SFX_CREATE_MODE_EMBEDDED || bCrsrInHidden )
- {
- rSet.DisableItem( nWhich );
- }
- break;
+ case SID_INSERT_DIAGRAM:
+ if( !aMOpt.IsChart()
+ || GetShell().CrsrInsideInputFld()
+ || eCreateMode == SFX_CREATE_MODE_EMBEDDED
+ || bCrsrInHidden )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ break;
case FN_INSERT_SMA:
- if( !aMOpt.IsMath() || eCreateMode == SFX_CREATE_MODE_EMBEDDED || bCrsrInHidden )
+ if( !aMOpt.IsMath()
+ || eCreateMode == SFX_CREATE_MODE_EMBEDDED
+ || bCrsrInHidden
+ || rSh.CrsrInsideInputFld() )
{
rSet.DisableItem( nWhich );
}
@@ -705,29 +728,36 @@ void SwTextShell::StateInsert( SfxItemSet &rSet )
case SID_INSERT_FLOATINGFRAME:
case SID_INSERT_OBJECT:
case SID_INSERT_PLUGIN:
- {
- if( eCreateMode == SFX_CREATE_MODE_EMBEDDED || bCrsrInHidden )
{
- rSet.DisableItem( nWhich );
+ if( eCreateMode == SFX_CREATE_MODE_EMBEDDED || bCrsrInHidden )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ else if( GetShell().IsSelFrmMode()
+ || GetShell().CrsrInsideInputFld() )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ else if(SID_INSERT_FLOATINGFRAME == nWhich && nHtmlMode&HTMLMODE_ON)
+ {
+ SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
+ sal_uInt16 nExport = rHtmlOpt.GetExportMode();
+ if(HTML_CFG_MSIE != nExport && HTML_CFG_WRITER != nExport )
+ rSet.DisableItem(nWhich);
+ }
}
- else if( GetShell().IsSelFrmMode())
- rSet.DisableItem( nWhich );
- else if(SID_INSERT_FLOATINGFRAME == nWhich && nHtmlMode&HTMLMODE_ON)
+ break;
+
+ case FN_INSERT_FRAME_INTERACT_NOCOL :
+ case FN_INSERT_FRAME_INTERACT:
{
- SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
- sal_uInt16 nExport = rHtmlOpt.GetExportMode();
- if(HTML_CFG_MSIE != nExport && HTML_CFG_WRITER != nExport )
+ if( GetShell().IsSelFrmMode()
+ || GetShell().CrsrInsideInputFld()
+ || bCrsrInHidden )
rSet.DisableItem(nWhich);
}
- }
- break;
- case FN_INSERT_FRAME_INTERACT_NOCOL :
- case FN_INSERT_FRAME_INTERACT:
- {
- if ( GetShell().IsSelFrmMode() || bCrsrInHidden )
- rSet.DisableItem(nWhich);
- }
- break;
+ break;
+
case SID_HYPERLINK_GETLINK:
{
SfxItemSet aSet(GetPool(), RES_TXTATR_INETFMT, RES_TXTATR_INETFMT);
@@ -773,20 +803,25 @@ void SwTextShell::StateInsert( SfxItemSet &rSet )
aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0)));
aHLinkItem.SetMacroEvents ( HYPERDLG_EVENT_MOUSEOVER_OBJECT|
- HYPERDLG_EVENT_MOUSECLICK_OBJECT | HYPERDLG_EVENT_MOUSEOUT_OBJECT );
+ HYPERDLG_EVENT_MOUSECLICK_OBJECT | HYPERDLG_EVENT_MOUSEOUT_OBJECT );
rSet.Put(aHLinkItem);
}
break;
case FN_INSERT_FRAME:
- if(rSh.IsSelFrmMode())
+ if (rSh.IsSelFrmMode() )
{
const int nSel = rSh.GetSelectionType();
if( ((nsSelectionType::SEL_GRF | nsSelectionType::SEL_OLE ) & nSel ) || bCrsrInHidden )
rSet.DisableItem(nWhich);
}
- break;
+ else if ( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem(nWhich);
+ }
+ break;
+
case FN_FORMAT_COLUMN :
{
//#i80458# column dialog cannot work if the selection contains different page styles and different sections
@@ -1064,7 +1099,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq )
rSh.SetMark();
rSh.ExtendSelection( sal_False, aChars.getLength() );
- rSh.SetAttr( aSet, nsSetAttrMode::SETATTR_DONTEXPAND | nsSetAttrMode::SETATTR_NOFORMATATTR );
+ rSh.SetAttrSet( aSet, nsSetAttrMode::SETATTR_DONTEXPAND | nsSetAttrMode::SETATTR_NOFORMATATTR );
if( !rSh.IsCrsrPtAtEnd() )
rSh.SwapPam();
@@ -1074,7 +1109,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq )
// SETATTR_DONTEXPAND does not work if there are already hard attributes.
// Therefore we have to restore the font attributes.
rSh.SetMark();
- rSh.SetAttr( aRestoreSet );
+ rSh.SetAttrSet( aRestoreSet );
rSh.ClearMark();
rSh.UpdateAttr();
diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx
index c8e3c94ab190..547657534fcb 100644
--- a/sw/source/ui/shells/textsh1.cxx
+++ b/sw/source/ui/shells/textsh1.cxx
@@ -228,7 +228,7 @@ void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const
rWrtSh.AutoUpdatePara(pColl, aTmpSet);
}
else
- rWrtSh.SetAttr( aTmpSet );
+ rWrtSh.SetAttrSet( aTmpSet );
if (pReq)
pReq->Done(aTmpSet);
if(bInsert)
@@ -433,7 +433,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
SvxFontItem &rFont = (SvxFontItem &) aSet.Get( RES_CHRATR_FONT );
SvxFontItem aFont( rFont.GetFamily(), pFont->GetValue(),
rFont.GetStyleName(), rFont.GetPitch(), RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT );
- rWrtSh.SetAttr( aSet, nsSetAttrMode::SETATTR_DONTEXPAND );
+ rWrtSh.SetAttrSet( aSet, nsSetAttrMode::SETATTR_DONTEXPAND );
rWrtSh.ResetSelect(0, sal_False);
rWrtSh.EndSelect();
rWrtSh.GotoFtnTxt();
@@ -1027,7 +1027,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
if ( !((SfxStringItem*)pItem)->GetValue().isEmpty() )
rWrtSh.ReplaceDropTxt(((SfxStringItem*)pItem)->GetValue(), pPaM);
}
- rWrtSh.SetAttr( *pSet, 0, pPaM );
+ rWrtSh.SetAttrSet( *pSet, 0, pPaM );
rWrtSh.EndAction();
SwTxtFmtColl* pColl = rWrtSh.GetPaMTxtFmtColl( pPaM );
if(pColl && pColl->IsAutoUpdateFmt())
@@ -1125,7 +1125,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
// otherwise, it'll be the color for the next text to be typed
if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_EXT)
{
- rWrtSh.SetAttr(SvxColorItem (aSet, RES_CHRATR_COLOR));
+ rWrtSh.SetAttrItem(SvxColorItem (aSet, RES_CHRATR_COLOR));
}
rReq.Done();
@@ -1152,7 +1152,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
aBrushItem.SetColor(aSet); //set the selected color
else
aBrushItem.SetColor(Color(COL_TRANSPARENT));//set "no fill" color
- rWrtSh.SetAttr( aBrushItem );
+ rWrtSh.SetAttrItem( aBrushItem );
}
else if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_BACKGROUND_EXT)
{
@@ -1175,12 +1175,12 @@ void SwTextShell::Execute(SfxRequest &rReq)
if(nSlot == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT)
{
- rWrtSh.SetAttr( SvxBrushItem(
- rEdtWin.GetTextBackColor(), RES_CHRATR_BACKGROUND) );
+ rWrtSh.SetAttrItem(
+ SvxBrushItem( rEdtWin.GetTextBackColor(), RES_CHRATR_BACKGROUND) );
}
else
- rWrtSh.SetAttr( SvxColorItem( rEdtWin.GetTextColor(),
- RES_CHRATR_COLOR) );
+ rWrtSh.SetAttrItem(
+ SvxColorItem( rEdtWin.GetTextColor(), RES_CHRATR_COLOR) );
}
else
{
@@ -1406,6 +1406,7 @@ void SwTextShell::GetState( SfxItemSet &rSet )
rSet.Put(SfxBoolItem(FN_NUMBER_NEWSTART,
rSh.IsNumRuleStart()));
break;
+
case FN_EDIT_FORMULA:
case SID_CHARMAP:
{
@@ -1413,7 +1414,14 @@ void SwTextShell::GetState( SfxItemSet &rSet )
if (!(nType & nsSelectionType::SEL_TXT) &&
!(nType & nsSelectionType::SEL_TBL) &&
!(nType & nsSelectionType::SEL_NUM))
+ {
rSet.DisableItem(nWhich);
+ }
+ else if ( nWhich == FN_EDIT_FORMULA
+ && rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem( nWhich );
+ }
}
break;
@@ -1421,16 +1429,35 @@ void SwTextShell::GetState( SfxItemSet &rSet )
case FN_INSERT_FOOTNOTE:
case FN_INSERT_FOOTNOTE_DLG:
{
- const sal_uInt16 nNoType = FRMTYPE_FLY_ANY | FRMTYPE_HEADER |
- FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE;
+ const sal_uInt16 nNoType =
+ FRMTYPE_FLY_ANY | FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE;
if ( (rSh.GetFrmType(0,sal_True) & nNoType) )
rSet.DisableItem(nWhich);
+
+ if ( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ }
+ break;
+
+ case FN_INSERT_HYPERLINK:
+ case SID_INSERTDOC:
+ case FN_INSERT_GLOSSARY:
+ case FN_EXPAND_GLOSSARY:
+ if ( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem( nWhich );
}
break;
+
case FN_INSERT_TABLE:
- if ( rSh.GetTableFmt() ||
- (rSh.GetFrmType(0,sal_True) & FRMTYPE_FOOTNOTE) )
+ if ( rSh.CrsrInsideInputFld()
+ || rSh.GetTableFmt()
+ || (rSh.GetFrmType(0,sal_True) & FRMTYPE_FOOTNOTE) )
+ {
rSet.DisableItem( nWhich );
+ }
break;
case FN_CALCULATE:
@@ -1494,9 +1521,22 @@ void SwTextShell::GetState( SfxItemSet &rSet )
rSet.Put(SfxBoolItem(nWhich, pApply && pApply->nColor == nWhich));
}
break;
+
case FN_INSERT_BOOKMARK:
- if( rSh.IsTableMode() )
+ if( rSh.IsTableMode()
+ || rSh.CrsrInsideInputFld() )
+ {
rSet.DisableItem( nWhich );
+ }
+ break;
+
+ case FN_INSERT_BREAK_DLG:
+ case FN_INSERT_COLUMN_BREAK:
+ case FN_INSERT_PAGEBREAK:
+ if( rSh.CrsrInsideInputFld() )
+ {
+ rSet.DisableItem( nWhich );
+ }
break;
case FN_INSERT_PAGEHEADER:
@@ -1511,40 +1551,47 @@ void SwTextShell::GetState( SfxItemSet &rSet )
(FN_TABLE_SORT_DIALOG == nWhich && !rSh.GetTableFmt()))
rSet.DisableItem( nWhich );
break;
+
case SID_RUBY_DIALOG:
- {
- SvtCJKOptions aCJKOptions;
- if(!aCJKOptions.IsRubyEnabled())
{
- GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
- rSet.DisableItem(nWhich);
+ SvtCJKOptions aCJKOptions;
+ if( !aCJKOptions.IsRubyEnabled()
+ || rSh.CrsrInsideInputFld() )
+ {
+ GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
+ rSet.DisableItem(nWhich);
+ }
+ else
+ GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
}
- else
- GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
break;
- }
- //no break!
+
case SID_HYPERLINK_DIALOG:
- if( GetView().GetDocShell()->IsReadOnly() ||
- (!GetView().GetViewFrame()->HasChildWindow(nWhich) &&
- rSh.HasReadonlySel()) )
+ if( GetView().GetDocShell()->IsReadOnly()
+ || ( !GetView().GetViewFrame()->HasChildWindow(nWhich)
+ && rSh.HasReadonlySel() )
+ || rSh.CrsrInsideInputFld() )
+ {
rSet.DisableItem(nWhich);
+ }
else
- rSet.Put(SfxBoolItem( nWhich, 0 != GetView().
- GetViewFrame()->GetChildWindow( nWhich ) ));
+ {
+ rSet.Put(SfxBoolItem( nWhich, 0 != GetView().GetViewFrame()->GetChildWindow( nWhich ) ));
+ }
break;
+
case FN_EDIT_HYPERLINK:
case FN_COPY_HYPERLINK_LOCATION:
- {
- SfxItemSet aSet(GetPool(),
- RES_TXTATR_INETFMT,
- RES_TXTATR_INETFMT);
- rSh.GetCurAttr(aSet);
- if(SFX_ITEM_SET > aSet.GetItemState( RES_TXTATR_INETFMT, sal_True ) || rSh.HasReadonlySel())
{
- rSet.DisableItem(nWhich);
+ SfxItemSet aSet(GetPool(),
+ RES_TXTATR_INETFMT,
+ RES_TXTATR_INETFMT);
+ rSh.GetCurAttr(aSet);
+ if(SFX_ITEM_SET > aSet.GetItemState( RES_TXTATR_INETFMT, sal_True ) || rSh.HasReadonlySel())
+ {
+ rSet.DisableItem(nWhich);
+ }
}
- }
break;
case FN_REMOVE_HYPERLINK:
{
@@ -1553,7 +1600,7 @@ void SwTextShell::GetState( SfxItemSet &rSet )
RES_TXTATR_INETFMT);
rSh.GetCurAttr(aSet);
- // If a hyperlink is selected, either alone or along with other text...
+ // If a hyperlink is selected, either alone or along with other text...
if( ((SFX_ITEM_DONTCARE & aSet.GetItemState( RES_TXTATR_INETFMT, sal_True )) == 0) || rSh.HasReadonlySel())
{
rSet.DisableItem(nWhich);
diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx
index 347966092828..706df6231e60 100644
--- a/sw/source/ui/shells/txtattr.cxx
+++ b/sw/source/ui/shells/txtattr.cxx
@@ -124,7 +124,7 @@ void SwTextShell::ExecCharAttr(SfxRequest &rReq)
aEscape.GetEsc() = DFLT_ESC_AUTO_SUPER;
else if(eEscape == SVX_ESCAPEMENT_SUBSCRIPT)
aEscape.GetEsc() = DFLT_ESC_AUTO_SUB;
- rSh.SetAttr( aEscape );
+ rSh.SetAttrItem( aEscape );
rReq.AppendItem( aEscape );
rReq.Done();
}
@@ -153,7 +153,7 @@ void SwTextShell::ExecCharAttr(SfxRequest &rReq)
break;
}
SvxUnderlineItem aUnderline(eUnderline, RES_CHRATR_UNDERLINE );
- rSh.SetAttr( aUnderline );
+ rSh.SetAttrItem( aUnderline );
rReq.AppendItem( aUnderline );
rReq.Done();
}
@@ -209,7 +209,7 @@ void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq)
if ( pColl )
pColl->SetFmtAttr( aINetFmt );
- else rWrtSh.SetAttr( aINetFmt );
+ else rWrtSh.SetAttrItem( aINetFmt );
rReq.Done();
}
break;
@@ -256,7 +256,7 @@ void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq)
if( pColl )
pColl->SetFmtAttr( aAttrSet );
else
- rWrtSh.SetAttr( aAttrSet );
+ rWrtSh.SetAttrSet( aAttrSet );
}
rReq.Done();
}
@@ -405,7 +405,7 @@ SET_LINESPACE:
rWrtSh.AutoUpdatePara(pColl, aSet);
}
else
- rWrtSh.SetAttr( aSet );
+ rWrtSh.SetAttrSet( aSet );
rReq.Done();
}
@@ -432,14 +432,14 @@ void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq)
pFmt = rSh.FindCharFmtByName( sCharStyleName );
aDropItem.SetCharFmt( pFmt );
aSet.Put(aDropItem);
- rSh.SetAttr(aSet);
+ rSh.SetAttrSet(aSet);
}
break;
case FN_FORMAT_DROPCAPS:
{
if(pItem)
{
- rSh.SetAttr(*pItem);
+ rSh.SetAttrItem(*pItem);
rReq.Done();
}
else
@@ -462,7 +462,7 @@ void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq)
if ( !((SfxStringItem*)pItem)->GetValue().isEmpty() )
rSh.ReplaceDropTxt(((SfxStringItem*)pItem)->GetValue());
}
- rSh.SetAttr(*pDlg->GetOutputItemSet());
+ rSh.SetAttrSet(*pDlg->GetOutputItemSet());
rSh.StartUndo( UNDO_END );
rSh.EndAction();
rReq.Done(*pDlg->GetOutputItemSet());
@@ -474,7 +474,7 @@ void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq)
case SID_ATTR_PARA_PAGEBREAK:
if(pItem)
{
- rSh.SetAttr( *pItem );
+ rSh.SetAttrItem( *pItem );
rReq.Done();
}
break;
@@ -487,7 +487,7 @@ void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq)
SID_ATTR_PARA_MODEL, SID_ATTR_PARA_MODEL, 0);
aCoreSet.Put(*pItem);
SfxToSwPageDescAttr( rSh, aCoreSet);
- rSh.SetAttr(aCoreSet);
+ rSh.SetAttrSet(aCoreSet);
rReq.Done();
}
}