summaryrefslogtreecommitdiff
path: root/sw/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui')
-rw-r--r--sw/source/ui/app/docsh.cxx79
-rw-r--r--sw/source/ui/app/docsh2.cxx19
-rw-r--r--sw/source/ui/app/swmodule.cxx5
-rw-r--r--sw/source/ui/dbui/dbmgr.cxx18
-rw-r--r--sw/source/ui/dbui/mmoutputpage.cxx4
-rw-r--r--sw/source/ui/docvw/srcedtw.cxx12
-rw-r--r--sw/source/ui/inc/wrtsh.hxx2
-rwxr-xr-xsw/source/ui/shells/annotsh.cxx12
-rw-r--r--sw/source/ui/shells/basesh.cxx14
-rw-r--r--sw/source/ui/shells/drwtxtex.cxx13
-rw-r--r--sw/source/ui/shells/drwtxtsh.cxx1
-rw-r--r--sw/source/ui/uiview/pview.cxx8
-rw-r--r--sw/source/ui/uiview/srcview.cxx15
-rw-r--r--sw/source/ui/uiview/uivwimp.cxx38
-rw-r--r--sw/source/ui/uiview/view.cxx2
-rw-r--r--sw/source/ui/uiview/view2.cxx2
-rw-r--r--sw/source/ui/uiview/viewprt.cxx20
-rw-r--r--sw/source/ui/uno/unomailmerge.cxx4
-rw-r--r--sw/source/ui/wrtsh/select.cxx20
19 files changed, 155 insertions, 133 deletions
diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx
index dd5ecb185c2d..06289c10f38a 100644
--- a/sw/source/ui/app/docsh.cxx
+++ b/sw/source/ui/app/docsh.cxx
@@ -1083,15 +1083,10 @@ void SwDocShell::GetState(SfxItemSet& rSet)
break;
case SID_SOURCEVIEW:
{
- if(IsLoading())
- rSet.DisableItem(nWhich);
- else
- {
- SfxViewShell* pCurrView = GetView() ? (SfxViewShell*)GetView()
- : SfxViewShell::Current();
- BOOL bSourceView = 0 != PTR_CAST(SwSrcView, pCurrView);
- rSet.Put(SfxBoolItem(SID_SOURCEVIEW, bSourceView));
- }
+ SfxViewShell* pCurrView = GetView() ? (SfxViewShell*)GetView()
+ : SfxViewShell::Current();
+ BOOL bSourceView = 0 != PTR_CAST(SwSrcView, pCurrView);
+ rSet.Put(SfxBoolItem(SID_SOURCEVIEW, bSourceView));
}
break;
case SID_HTML_MODE:
@@ -1116,18 +1111,10 @@ void SwDocShell::GetState(SfxItemSet& rSet)
case SID_BROWSER_MODE:
case FN_PRINT_LAYOUT:
{
- SfxViewShell* pViewShell = SfxViewShell::Current();
- BOOL bDisable = 0 != PTR_CAST(SwPagePreView, pViewShell) ||
- 0 != PTR_CAST(SwSrcView, pViewShell);
- if (bDisable)
- rSet.DisableItem( nWhich );
- else
- {
- sal_Bool bState = GetDoc()->get(IDocumentSettingAccess::BROWSE_MODE);
- if(FN_PRINT_LAYOUT == nWhich)
- bState = !bState;
- rSet.Put( SfxBoolItem( nWhich, bState));
- }
+ sal_Bool bState = GetDoc()->get(IDocumentSettingAccess::BROWSE_MODE);
+ if(FN_PRINT_LAYOUT == nWhich)
+ bState = !bState;
+ rSet.Put( SfxBoolItem( nWhich, bState));
}
break;
@@ -1337,44 +1324,42 @@ uno::Reference< frame::XController >
/* -----------------------------12.02.01 12:08--------------------------------
---------------------------------------------------------------------------*/
+static const char* pEventNames[] =
+{
+ "OnPageCountChange",
+ "OnMailMerge",
+ "OnMailMergeFinished",
+ "OnFieldMerge",
+ "OnFieldMergeFinished",
+ "OnLayoutFinished"
+};
+
Sequence< OUString > SwDocShell::GetEventNames()
{
Sequence< OUString > aRet = SfxObjectShell::GetEventNames();
sal_Int32 nLen = aRet.getLength();
- aRet.realloc(nLen + 2);
+ aRet.realloc(nLen + 6);
OUString* pNames = aRet.getArray();
- pNames[nLen++] = OUString::createFromAscii("OnMailMerge");
- pNames[nLen] = OUString::createFromAscii("OnPageCountChange");
+ pNames[nLen++] = GetEventName(0);
+ pNames[nLen++] = GetEventName(1);
+ pNames[nLen++] = GetEventName(2);
+ pNames[nLen++] = GetEventName(3);
+ pNames[nLen++] = GetEventName(4);
+ pNames[nLen] = GetEventName(5);
+
return aRet;
}
-/*
-void SwTmpPersist::FillClass( SvGlobalName * pClassName,
- ULONG * pClipFormat,
- String * pAppName,
- String * pLongUserName,
- String * pUserName,
- sal_Int32 nFileFormat ) const
-{
- pDShell->SwDocShell::FillClass( pClassName, pClipFormat, pAppName,
- pLongUserName, pUserName, nFileFormat );
-}
-BOOL SwTmpPersist::Save()
-{
- if( SaveChilds() )
- return SvPersist::Save();
- return FALSE;
-}
+static sal_Int32 nEvents=13;
-BOOL SwTmpPersist::SaveCompleted( SvStorage * pStor )
+rtl::OUString SwDocShell::GetEventName( sal_Int32 nIndex )
{
- if( SaveCompletedChilds( pStor ) )
- return SvPersist::SaveCompleted( pStor );
- return FALSE;
-} */
+ if ( nIndex<nEvents )
+ return ::rtl::OUString::createFromAscii(pEventNames[nIndex]);
+ return rtl::OUString();
+}
const ::sfx2::IXmlIdRegistry* SwDocShell::GetXmlIdRegistry() const
{
return pDoc ? &pDoc->GetXmlIdRegistry() : 0;
}
-
diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx
index 182bda09d7b8..3fd1e879b063 100644
--- a/sw/source/ui/app/docsh2.cxx
+++ b/sw/source/ui/app/docsh2.cxx
@@ -943,10 +943,10 @@ void SwDocShell::Execute(SfxRequest& rReq)
bDone = TRUE;
SfxEventConfiguration* pEvent = SFX_APP()->GetEventConfig();
SvxMacro aMac(aEmptyStr, aEmptyStr, STARBASIC);
- pEvent->ConfigureEvent(SFX_EVENT_OPENDOC, aMac, this);
- pEvent->ConfigureEvent(SFX_EVENT_CLOSEDOC, aMac, this);
- pEvent->ConfigureEvent(SFX_EVENT_ACTIVATEDOC, aMac, this);
- pEvent->ConfigureEvent(SFX_EVENT_DEACTIVATEDOC, aMac, this);
+ pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_OPENDOC ), aMac, this);
+ pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEDOC ), aMac, this);
+ pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_ACTIVATEDOC ), aMac, this);
+ pEvent->ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_DEACTIVATEDOC ), aMac, this);
ReloadFromHtml(aTempFile.GetURL(), pSrcView);
nSlot = 0;
}
@@ -983,6 +983,8 @@ void SwDocShell::Execute(SfxRequest& rReq)
//pSavePrinter darf nicht wieder geloescht werden
}
pViewFrm->GetBindings().SetState(SfxBoolItem(SID_SOURCEVIEW, nSlot == SID_VIEWSHELL2));
+ pViewFrm->GetBindings().Invalidate( SID_BROWSER_MODE );
+ pViewFrm->GetBindings().Invalidate( FN_PRINT_LAYOUT );
}
break;
case SID_GET_COLORTABLE:
@@ -1780,7 +1782,10 @@ void SwDocShell::ToggleBrowserMode(BOOL bSet, SwView* _pView )
SwView* pTempView = _pView ? _pView : (SwView*)GetView();
if( pTempView )
{
- pTempView->GetViewFrame()->GetBindings().Invalidate(FN_SHADOWCURSOR);
+ SfxBindings& rBind = pTempView->GetViewFrame()->GetBindings();
+ rBind.Invalidate(FN_SHADOWCURSOR);
+ rBind.Invalidate(SID_BROWSER_MODE);
+ rBind.Invalidate(FN_PRINT_LAYOUT);
if( !GetDoc()->getPrinter( false ) )
{
@@ -1793,8 +1798,8 @@ void SwDocShell::ToggleBrowserMode(BOOL bSet, SwView* _pView )
GetDoc()->CheckDefaultPageFmt();
// <--
- //Wenn wir die BrowseView einschalten, darf es nur diese eine
- //Sicht auf das Dokument geben, alle anderen werden geschlossen.
+ // Currently there can be only one view (layout) if the document is viewed in Web layout
+ // So if there are more views we are in print layout and for toggling to Web layout all other views must be closed
SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this, 0, FALSE);
do {
if( pTmpFrm != pTempView->GetViewFrame() )
diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx
index 694c2514ef93..c84273770667 100644
--- a/sw/source/ui/app/swmodule.cxx
+++ b/sw/source/ui/app/swmodule.cxx
@@ -221,11 +221,6 @@ SwModule::SwModule( SfxObjectFactory* pWebFact,
ERRCODE_AREA_SW_END,
pSwResMgr );
- SfxEventConfiguration::RegisterEvent(SW_EVENT_MAIL_MERGE, SW_RES(STR_PRINT_MERGE_MACRO), String::CreateFromAscii("OnMailMerge"));
- SfxEventConfiguration::RegisterEvent(SW_EVENT_MAIL_MERGE_END, SW_RES(STR_PRINT_MERGE_MACRO), String::CreateFromAscii("OnMailMergeFinished"));
- SfxEventConfiguration::RegisterEvent(SW_EVENT_FIELD_MERGE, String(), String::CreateFromAscii("OnFieldMerge"));
- SfxEventConfiguration::RegisterEvent(SW_EVENT_FIELD_MERGE_FINISHED, String(), String::CreateFromAscii("OnFieldMergeFinished"));
- SfxEventConfiguration::RegisterEvent(SW_EVENT_PAGE_COUNT, SW_RES(STR_PAGE_COUNT_MACRO), String::CreateFromAscii("OnPageCountChange"));
pModuleConfig = new SwModuleOptions;
//Die brauchen wie sowieso
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index 202df0a8e027..603af1c31111 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -932,9 +932,9 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView,
do {
nStartRow = pImpl->pMergeData ? pImpl->pMergeData->xResultSet->getRow() : 0;
{
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, pSh->GetView().GetViewFrame()->GetObjectShell()));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE), pSh->GetView().GetViewFrame()->GetObjectShell()));
pSh->ViewShell::UpdateFlds();
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, pSh->GetView().GetViewFrame()->GetObjectShell()));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE_FINISHED), pSh->GetView().GetViewFrame()->GetObjectShell()));
++rOpt.nMergeAct;
// launch MailMergeEvent if required
@@ -1455,9 +1455,9 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell,
SwDoc* pWorkDoc = ((SwDocShell*)(&xWorkDocSh))->GetDoc();
SwNewDBMgr* pOldDBMgr = pWorkDoc->GetNewDBMgr();
pWorkDoc->SetNewDBMgr( this );
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, xWorkDocSh));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE), xWorkDocSh));
pWorkDoc->UpdateFlds(NULL, false);
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, xWorkDocSh));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE_FINISHED), xWorkDocSh));
// alle versteckten Felder/Bereiche entfernen
pWorkDoc->RemoveInvisibleContent();
@@ -2858,7 +2858,7 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh,
aDescriptor[daCursor] <<= xResSet;
SfxObjectShellRef xDocShell = rSh.GetView().GetViewFrame()->GetObjectShell();
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, xDocShell));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), xDocShell));
{
//copy rSh to aTempFile
::rtl::OUString sTempURL;
@@ -2924,7 +2924,7 @@ void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh,
//remove the temporary file
SWUnoHelper::UCB_DeleteFile( sTempURL );
}
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, rSh.GetView().GetViewFrame()->GetObjectShell()));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), rSh.GetView().GetViewFrame()->GetObjectShell()));
// reset the cursor inside
xResSet = NULL;
@@ -3260,9 +3260,9 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig,
// create a layout
rWorkShell.CalcLayout();
rWorkShell.UnlockExpFlds();
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, rWorkShell.GetView().GetViewFrame()->GetObjectShell()));
- rWorkShell.ViewShell::UpdateFlds();
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, rWorkShell.GetView().GetViewFrame()->GetObjectShell()));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE), rWorkShell.GetView().GetViewFrame()->GetObjectShell()));
+ rWorkShell.ViewShell::UpdateFlds();
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE_FINISHED), rWorkShell.GetView().GetViewFrame()->GetObjectShell()));
// strip invisible content and convert fields to text
rWorkShell.RemoveInvisibleContent();
diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx
index 72fc1e122a8e..eb1f75d57979 100644
--- a/sw/source/ui/dbui/mmoutputpage.cxx
+++ b/sw/source/ui/dbui/mmoutputpage.cxx
@@ -1000,14 +1000,14 @@ IMPL_LINK(SwMailMergeOutputPage, PrintHdl_Impl, PushButton*, EMPTYARG)
}
SfxObjectShell* pObjSh = pTargetView->GetViewFrame()->GetObjectShell();
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, pObjSh));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), pObjSh));
rSh.GetNewDBMgr()->SetMergeType( DBMGR_MERGE_DOCUMENTS );
SfxDispatcher *pDis = pTargetView->GetViewFrame()->GetDispatcher();
SfxBoolItem aMergeSilent(SID_SILENT, sal_False);
m_pWizard->enableButtons(WZB_CANCEL, sal_False);
pDis->Execute(SID_PRINTDOCDIRECT,
SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, &aMergeSilent, 0L);
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, pObjSh));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), pObjSh));
pTargetView->SetMailMergeConfigItem(0, 0, sal_False);
m_pWizard->enableButtons(WZB_CANCEL, sal_True);
diff --git a/sw/source/ui/docvw/srcedtw.cxx b/sw/source/ui/docvw/srcedtw.cxx
index 85036cad7130..19ba5aefdf25 100644
--- a/sw/source/ui/docvw/srcedtw.cxx
+++ b/sw/source/ui/docvw/srcedtw.cxx
@@ -395,8 +395,10 @@ void TextViewOutWin::MouseButtonUp( const MouseEvent &rEvt )
if ( pTextView )
{
pTextView->MouseButtonUp( rEvt );
- ((SwSrcEditWindow*)GetParent())->GetSrcView()->GetViewFrame()->
- GetBindings().Invalidate( SID_TABLE_CELL );
+ SfxBindings& rBindings = ((SwSrcEditWindow*)GetParent())->GetSrcView()->GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_TABLE_CELL );
+ rBindings.Invalidate( SID_CUT );
+ rBindings.Invalidate( SID_COPY );
}
}
@@ -459,6 +461,7 @@ void TextViewOutWin::KeyInput( const KeyEvent& rKEvt )
if(bChange)
bDone = pTextView->KeyInput( rKEvt );
+ SfxBindings& rBindings = ((SwSrcEditWindow*)GetParent())->GetSrcView()->GetViewFrame()->GetBindings();
if ( !bDone )
{
if ( !SfxViewShell::Current()->KeyInput( rKEvt ) )
@@ -466,7 +469,6 @@ void TextViewOutWin::KeyInput( const KeyEvent& rKEvt )
}
else
{
- SfxBindings& rBindings = ((SwSrcEditWindow*)GetParent())->GetSrcView()->GetViewFrame()->GetBindings();
rBindings.Invalidate( SID_TABLE_CELL );
if ( rKEvt.GetKeyCode().GetGroup() == KEYGROUP_CURSOR )
rBindings.Update( SID_BASICIDE_STAT_POS );
@@ -478,6 +480,10 @@ void TextViewOutWin::KeyInput( const KeyEvent& rKEvt )
if( rKEvt.GetKeyCode().GetCode() == KEY_INSERT )
rBindings.Invalidate( SID_ATTR_INSERT );
}
+
+ rBindings.Invalidate( SID_CUT );
+ rBindings.Invalidate( SID_COPY );
+
SwDocShell* pDocShell = pSrcEditWin->GetSrcView()->GetDocShell();
if(pSrcEditWin->GetTextEngine()->IsModified())
{
diff --git a/sw/source/ui/inc/wrtsh.hxx b/sw/source/ui/inc/wrtsh.hxx
index 5656f6df1ab4..3c526c11d193 100644
--- a/sw/source/ui/inc/wrtsh.hxx
+++ b/sw/source/ui/inc/wrtsh.hxx
@@ -165,6 +165,8 @@ public:
// Selektion von Rahmen aufheben
void UnSelectFrm();
+ void Invalidate();
+
// Tabellenzellen selektieren fuer Bearbeiten von Formeln in der Ribbonbar
inline void SelTblCells( const Link &rLink, BOOL bMark = TRUE );
inline void EndSelTblCells();
diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx
index 9bfc00b21660..1a34e2972956 100755
--- a/sw/source/ui/shells/annotsh.cxx
+++ b/sw/source/ui/shells/annotsh.cxx
@@ -799,16 +799,18 @@ void SwAnnotationShell::ExecClpbrd(SfxRequest &rReq)
switch (nSlot)
{
case SID_CUT:
- pOLV->Cut();
+ if ( (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED) && pOLV->HasSelection() )
+ pOLV->Cut();
break;
case SID_COPY:
- pOLV->Copy();
+ if( pOLV->HasSelection() )
+ pOLV->Copy();
break;
case SID_PASTE:
if (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED)
pOLV->Paste();
break;
- case FN_PASTESPECIAL:
+ case SID_PASTE_SPECIAL:
{
if (pPostItMgr->GetActivePostIt()->GetStatus()!=SwPostItHelper::DELETED)
{
@@ -886,7 +888,7 @@ void SwAnnotationShell::StateClpbrd(SfxItemSet &rSet)
break;
}
case SID_PASTE:
- case FN_PASTESPECIAL:
+ case SID_PASTE_SPECIAL:
{
if( !bPastePossible )
rSet.DisableItem( nWhich );
@@ -1380,6 +1382,8 @@ void SwAnnotationShell::ExecUndo(SfxRequest &rReq)
}
}
+ rView.GetViewFrame()->GetBindings().InvalidateAll(sal_False);
+
if (rView.GetPostItMgr()->GetActivePostIt())
rView.GetPostItMgr()->GetActivePostIt()->ResizeIfNeccessary(aOldHeight,rView.GetPostItMgr()->GetActivePostIt()->GetPostItTextHeight());
}
diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx
index 0c17c85dd301..9f5ee6195e81 100644
--- a/sw/source/ui/shells/basesh.cxx
+++ b/sw/source/ui/shells/basesh.cxx
@@ -301,11 +301,9 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
if ( rSh.HasSelection() )
{
SwTransferable* pTransfer = new SwTransferable( rSh );
-/*??*/ uno::Reference<
- datatransfer::XTransferable > xRef(
- pTransfer );
+/*??*/ uno::Reference< datatransfer::XTransferable > xRef( pTransfer );
- if ( nId == SID_CUT )
+ if ( nId == SID_CUT && !rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT) )
pTransfer->Cut();
else
{
@@ -405,7 +403,7 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
}
break;
- case FN_PASTESPECIAL:
+ case SID_PASTE_SPECIAL:
{
TransferableDataHelper aDataHelper(
TransferableDataHelper::CreateFromSystemClipboard(
@@ -481,10 +479,10 @@ void SwBaseShell::StateClpbrd(SfxItemSet &rSet)
rSet.DisableItem( SID_PASTE );
break;
- case FN_PASTESPECIAL:
+ case SID_PASTE_SPECIAL:
if( !GetView().IsPasteSpecialAllowed() )
{
- rSet.DisableItem( FN_PASTESPECIAL );
+ rSet.DisableItem( SID_PASTE_SPECIAL );
rSet.DisableItem( SID_PASTE_UNFORMATTED );
}
break;
@@ -539,6 +537,8 @@ void SwBaseShell::ExecUndo(SfxRequest &rReq)
default:
DBG_ERROR("falscher Dispatcher");
}
+
+ GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False);
}
/*--------------------------------------------------------------------
diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx
index d56cb88e9db8..11874ca5b151 100644
--- a/sw/source/ui/shells/drwtxtex.cxx
+++ b/sw/source/ui/shells/drwtxtex.cxx
@@ -828,15 +828,20 @@ void SwDrawTextShell::ExecClpbrd(SfxRequest &rReq)
return;
OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+
+ ESelection aSel(pOLV->GetSelection());
+ const sal_Bool bCopy = (aSel.nStartPara != aSel.nEndPara) || (aSel.nStartPos != aSel.nEndPos);
sal_uInt16 nId = rReq.GetSlot();
switch( nId )
{
case SID_CUT:
- pOLV->Cut();
+ if (bCopy)
+ pOLV->Cut();
return;
case SID_COPY:
- pOLV->Copy();
+ if (bCopy)
+ pOLV->Copy();
return;
case SID_PASTE:
@@ -888,8 +893,8 @@ void SwDrawTextShell::StateClpbrd(SfxItemSet &rSet)
}
break;
- case FN_PASTESPECIAL:
- rSet.DisableItem( FN_PASTESPECIAL );
+ case SID_PASTE_SPECIAL:
+ rSet.DisableItem( SID_PASTE_SPECIAL );
break;
// --> OD 2008-06-20 #151110#
case SID_CLIPBOARD_FORMAT_ITEMS:
diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx
index 85b9fa48447b..9f1d49ebe067 100644
--- a/sw/source/ui/shells/drwtxtsh.cxx
+++ b/sw/source/ui/shells/drwtxtsh.cxx
@@ -640,6 +640,7 @@ void SwDrawTextShell::ExecUndo(SfxRequest &rReq)
pUndoManager->Redo(0);
}
bCallBase = FALSE;
+ GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False);
}
break;
}
diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx
index bd1a00c2f120..93ae56fbca73 100644
--- a/sw/source/ui/uiview/pview.cxx
+++ b/sw/source/ui/uiview/pview.cxx
@@ -1580,6 +1580,10 @@ void SwPagePreView::GetState( SfxItemSet& rSet )
{
switch(nWhich)
{
+ case SID_BROWSER_MODE:
+ case FN_PRINT_LAYOUT:
+ rSet.DisableItem(nWhich);
+ break;
case FN_START_OF_DOCUMENT:
{
if ( pPagePrevwLay->IsPageVisible( 1 ) )
@@ -2491,6 +2495,10 @@ SfxPrinter* SwPagePreView::GetPrinter( BOOL bCreate )
USHORT SwPagePreView::SetPrinter( SfxPrinter *pNew, USHORT nDiffFlags, bool )
{
ViewShell &rSh = *GetViewShell();
+ SfxPrinter* pOld = rSh.getIDocumentDeviceAccess()->getPrinter( false );
+ if ( pOld && pOld->IsPrinting() )
+ return SFX_PRINTERROR_BUSY;
+
SwEditShell &rESh = (SwEditShell&)rSh; //Buh...
if( ( SFX_PRINTER_PRINTER | SFX_PRINTER_JOBSETUP ) & nDiffFlags )
{
diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx
index 34cfebe663a1..d30e85c5ee71 100644
--- a/sw/source/ui/uiview/srcview.cxx
+++ b/sw/source/ui/uiview/srcview.cxx
@@ -57,6 +57,7 @@
#include <sfx2/app.hxx>
#include <sfx2/objface.hxx>
#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
#include <sfx2/docfilt.hxx>
#include <sfx2/fcontnr.hxx>
#include <sfx2/request.hxx>
@@ -457,17 +458,21 @@ void SwSrcView::Execute(SfxRequest& rReq)
break;
case SID_UNDO:
pTextView->Undo();
+ GetViewFrame()->GetBindings().InvalidateAll(FALSE);
break;
case SID_REDO:
pTextView->Redo();
+ GetViewFrame()->GetBindings().InvalidateAll(FALSE);
break;
case SID_REPEAT:
break;
case SID_CUT:
- pTextView->Cut();
+ if(pTextView->HasSelection())
+ pTextView->Cut();
break;
case SID_COPY:
- pTextView->Copy();
+ if(pTextView->HasSelection())
+ pTextView->Copy();
break;
case SID_PASTE:
pTextView->Paste();
@@ -588,6 +593,8 @@ void SwSrcView::GetState(SfxItemSet& rSet)
case SID_DIRECTEXPORTDOCASPDF:
case SID_EXPORTDOC:
case SID_REPEAT:
+ case SID_BROWSER_MODE:
+ case FN_PRINT_LAYOUT:
rSet.DisableItem(nWhich);
break;
case SID_CUT:
@@ -731,6 +738,10 @@ USHORT SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem,
USHORT SwSrcView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool )
{
SwDocShell* pDocSh = GetDocShell();
+ SfxPrinter* pOld = pDocSh->GetDoc()->getPrinter( false );
+ if ( pOld && pOld->IsPrinting() )
+ return SFX_PRINTERROR_BUSY;
+
if ( (SFX_PRINTER_JOBSETUP | SFX_PRINTER_PRINTER) & nDiffFlags )
{
pDocSh->GetDoc()->setPrinter( pNew, true, true );
diff --git a/sw/source/ui/uiview/uivwimp.cxx b/sw/source/ui/uiview/uivwimp.cxx
index d9634fc301ec..4154139f6ee1 100644
--- a/sw/source/ui/uiview/uivwimp.cxx
+++ b/sw/source/ui/uiview/uivwimp.cxx
@@ -335,48 +335,14 @@ void SAL_CALL SwClipboardChangeListener::changedContents( const CLIP_NMSPC::Clip
SfxBindings& rBind = pView->GetViewFrame()->GetBindings();
rBind.Invalidate( SID_PASTE );
- rBind.Invalidate( FN_PASTESPECIAL );
+ rBind.Invalidate( SID_PASTE_SPECIAL );
rBind.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
}
}
void SwClipboardChangeListener::AddRemoveListener( BOOL bAdd )
{
- try
- {
- do {
-
-#ifdef _DONT_WORD_FOR_WEBTOP_
-JP 4.7.2001: change for WebTop - get Clipboard from the Window.
- Reference< XMultiServiceFactory > xFact(
- ::comphelper::getProcessServiceFactory() );
- if( !xFact.is() )
- break;
- Reference< XClipboard > xClipboard( xFact->createInstance(
- ::rtl::OUString::createFromAscii(
- "com.sun.star.datatransfer.clipboard.SystemClipboard" )),
- UNO_QUERY );
-#else
- Reference< XClipboard > xClipboard(
- pView->GetEditWin().GetClipboard() );
-#endif
- if( !xClipboard.is() )
- break;
-
- Reference< XClipboardNotifier > xClpbrdNtfr( xClipboard, UNO_QUERY );
- if( xClpbrdNtfr.is() )
- {
- Reference< XClipboardListener > xClipEvtLstnr( this );
- if( bAdd )
- xClpbrdNtfr->addClipboardListener( xClipEvtLstnr );
- else
- xClpbrdNtfr->removeClipboardListener( xClipEvtLstnr );
- }
- } while ( FALSE );
- }
- catch( const uno::Exception& )
- {
- }
+ pView->AddRemoveClipboardListener( Reference< XClipboardListener >( this ), bAdd );
}
diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index 6678275cd865..a13f25d8933e 100644
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -624,7 +624,7 @@ void SwView::_CheckReadonlyState()
SID_UNDO,
SID_REDO, SID_REPEAT, SID_PASTE,
SID_PASTE_UNFORMATTED,
- FN_PASTESPECIAL, SID_SBA_BRW_INSERT,
+ SID_PASTE_SPECIAL, SID_SBA_BRW_INSERT,
SID_BACKGROUND_COLOR, FN_INSERT_BOOKMARK,
SID_CHARMAP, FN_INSERT_SOFT_HYPHEN,
FN_INSERT_HARDHYPHEN, FN_INSERT_HARD_SPACE, FN_INSERT_BREAK,
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index 6a03909d92f9..77c06f44c494 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -1233,7 +1233,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet)
if (nPageCnt != nCnt) // Basic benachrichtigen
{
nPageCnt = nCnt;
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_PAGE_COUNT, GetViewFrame()->GetObjectShell()), FALSE);
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_PAGE_COUNT, SwDocShell::GetEventName(STR_SW_EVENT_PAGE_COUNT), GetViewFrame()->GetObjectShell()), FALSE);
}
}
break;
diff --git a/sw/source/ui/uiview/viewprt.cxx b/sw/source/ui/uiview/viewprt.cxx
index 6d219e71ab30..5e45f9a9a48c 100644
--- a/sw/source/ui/uiview/viewprt.cxx
+++ b/sw/source/ui/uiview/viewprt.cxx
@@ -141,6 +141,10 @@ void SetPrinter( IDocumentDeviceAccess* pIDDA, SfxPrinter* pNew, BOOL bWeb )
USHORT __EXPORT SwView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool )
{
SwWrtShell &rSh = GetWrtShell();
+ SfxPrinter* pOld = rSh.getIDocumentDeviceAccess()->getPrinter( false );
+ if ( pOld && pOld->IsPrinting() )
+ return SFX_PRINTERROR_BUSY;
+
if ( (SFX_PRINTER_JOBSETUP | SFX_PRINTER_PRINTER) & nDiffFlags )
{
rSh.getIDocumentDeviceAccess()->setPrinter( pNew, true, true );
@@ -431,9 +435,19 @@ ErrCode SwView::DoPrint( SfxPrinter *pPrinter, PrintDialog *pDlg, BOOL bSilent,
}
pProgress->Stop();
- pProgress->DeleteOnEndPrint();
- pPrinter->EndJob();
- return pPrinter->GetError();
+ if ( pPrinter->IsJobActive() )
+ {
+ pProgress->DeleteOnEndPrint();
+ pPrinter->EndJob();
+ return pPrinter->GetError();
+ }
+ else
+ {
+ // the next call might destroy pPrinter (in case it is not the usual document printer); so get the error before
+ ULONG nError = pPrinter->GetError();
+ pProgress->DeleteOnEndPrint();
+ return nError;
+ }
}
diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx
index 3acb1e25bd31..fed4c2b201cf 100644
--- a/sw/source/ui/uno/unomailmerge.cxx
+++ b/sw/source/ui/uno/unomailmerge.cxx
@@ -830,9 +830,9 @@ uno::Any SAL_CALL SwXMailMerge::execute(
DBG_ASSERT( !pOldSrc || pOldSrc == this, "Ooops... different event source already set." );
pMgr->SetMailMergeEvtSrc( this ); // launch events for listeners
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, xCurDocSh));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), xCurDocSh));
BOOL bSucc = pMgr->MergeNew( aMergeDesc );
- SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, xCurDocSh));
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), xCurDocSh));
pMgr->SetMailMergeEvtSrc( pOldSrc );
diff --git a/sw/source/ui/wrtsh/select.cxx b/sw/source/ui/wrtsh/select.cxx
index 89b0635815d6..b46cbdb3a1a5 100644
--- a/sw/source/ui/wrtsh/select.cxx
+++ b/sw/source/ui/wrtsh/select.cxx
@@ -73,6 +73,13 @@ using namespace ::com::sun::star::util;
static long nStartDragX = 0, nStartDragY = 0;
static BOOL bStartDrag = FALSE;
+void SwWrtShell::Invalidate()
+{
+ // to avoid making the slot volatile, invalidate it everytime if something could have been changed
+ // this is still much cheaper than asking for the state every 200 ms (and avoid background processing)
+ GetView().GetViewFrame()->GetBindings().Invalidate( FN_STAT_SELMODE );
+}
+
BOOL SwWrtShell::SelNearestWrd()
{
MV_KONTEXT(this);
@@ -375,6 +382,7 @@ long SwWrtShell::ResetSelect(const Point *,BOOL)
*/
GetChgLnk().Call(this);
}
+ Invalidate();
SwTransferable::ClearSelection( *this );
return 1;
}
@@ -409,6 +417,7 @@ void SwWrtShell::SttSelect()
fnKillSel = &SwWrtShell::Ignore;
fnSetCrsr = &SwWrtShell::SetCrsr;
bInSelect = TRUE;
+ Invalidate();
SwTransferable::CreateSelection( *this );
}
/*
@@ -577,6 +586,7 @@ void SwWrtShell::EnterStdMode()
fnKillSel = &SwWrtShell::ResetSelect;
}
}
+ Invalidate();
SwTransferable::ClearSelection( *this );
}
@@ -655,6 +665,7 @@ void SwWrtShell::EnterAddMode()
bExtMode = FALSE;
if(SwCrsrShell::HasSelection())
CreateCrsr();
+ Invalidate();
}
@@ -665,6 +676,7 @@ void SwWrtShell::LeaveAddMode()
fnKillSel = &SwWrtShell::ResetSelect;
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
bAddMode = FALSE;
+ Invalidate();
}
/*
@@ -677,6 +689,7 @@ void SwWrtShell::EnterBlockMode()
EnterStdMode();
bBlockMode = TRUE;
CrsrToBlockCrsr();
+ Invalidate();
}
@@ -686,6 +699,7 @@ void SwWrtShell::LeaveBlockMode()
bBlockMode = FALSE;
BlockCrsrToCrsr();
EndSelect();
+ Invalidate();
}
// Einfuegemodus
@@ -700,6 +714,7 @@ void SwWrtShell::SetInsMode( BOOL bOn )
GetView().GetViewFrame()->GetBindings().SetState( aTmp );
StartAction();
EndAction();
+ Invalidate();
}
//Overwrite mode is incompatible with red-lining
void SwWrtShell::SetRedlineModeAndCheckInsMode( USHORT eMode )
@@ -744,6 +759,7 @@ void SwWrtShell::EnterSelFrmMode(const Point *pPos)
fnDrag = &SwWrtShell::BeginFrmDrag;
fnEndDrag = &SwWrtShell::UpdateLayoutFrm;
SwBaseShell::SetFrmMode( FLY_DRAG_START, this );
+ Invalidate();
}
@@ -756,6 +772,7 @@ void SwWrtShell::LeaveSelFrmMode()
bStartDrag = FALSE;
Edit();
SwBaseShell::SetFrmMode( FLY_DRAG_END, this );
+ Invalidate();
}
/*------------------------------------------------------------------------
Beschreibung: Rahmengebundenes Macro ausfuehren
@@ -799,6 +816,7 @@ long SwWrtShell::UpdateLayoutFrm(const Point *pPt, BOOL )
long SwWrtShell::ToggleAddMode()
{
bAddMode ? LeaveAddMode(): EnterAddMode();
+ Invalidate();
return !bAddMode;
}
@@ -806,6 +824,7 @@ long SwWrtShell::ToggleAddMode()
long SwWrtShell::ToggleBlockMode()
{
bBlockMode ? LeaveBlockMode(): EnterBlockMode();
+ Invalidate();
return !bBlockMode;
}
@@ -813,6 +832,7 @@ long SwWrtShell::ToggleBlockMode()
long SwWrtShell::ToggleExtMode()
{
bExtMode ? LeaveExtMode() : EnterExtMode();
+ Invalidate();
return !bExtMode;
}
/*