diff options
Diffstat (limited to 'sw/source/ui/shells/annotsh.cxx')
-rw-r--r-- | sw/source/ui/shells/annotsh.cxx | 124 |
1 files changed, 60 insertions, 64 deletions
diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index 61f83828edd7..fa80e015f081 100644 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -160,7 +160,7 @@ SwAnnotationShell::~SwAnnotationShell() { } -SfxUndoManager* SwAnnotationShell::GetUndoManager() +::svl::IUndoManager* SwAnnotationShell::GetUndoManager() { SwPostItMgr* pPostItMgr = rView.GetPostItMgr(); if ( !pPostItMgr || @@ -265,9 +265,9 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) Outliner * pOutliner = pOLV->GetOutliner(); if(pOutliner) { - ULONG nParaCount = pOutliner->GetParagraphCount(); + sal_uLong nParaCount = pOutliner->GetParagraphCount(); if (nParaCount > 0) - pOLV->SelectRange(0L, USHORT(nParaCount) ); + pOLV->SelectRange(0L, sal_uInt16(nParaCount) ); } break; } @@ -362,7 +362,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) { const SfxPoolItem* pItem = 0; if(pNewAttrs) - pNewAttrs->GetItemState(nSlot, FALSE, &pItem ); + pNewAttrs->GetItemState(nSlot, sal_False, &pItem ); if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED) pOLV->InsertText(((const SfxStringItem *)pItem)->GetValue()); break; @@ -414,7 +414,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) SwDocStat aCurr; SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() ); { - SwWait aWait( *rView.GetDocShell(), TRUE ); + SwWait aWait( *rView.GetDocShell(), sal_True ); rSh.StartAction(); rSh.CountWords( aCurr ); rSh.UpdateDocStat( aDocStat ); @@ -452,7 +452,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg( rView.GetWindow(), rView, aDlgAttr, DLG_CHAR,0, sal_True ); OSL_ENSURE(pDlg, "Dialogdiet fail!"); - USHORT nRet = pDlg->Execute(); + sal_uInt16 nRet = pDlg->Execute(); if(RET_OK == nRet ) { rReq.Done( *( pDlg->GetOutputItemSet() ) ); @@ -500,7 +500,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) SfxAbstractTabDialog* pDlg = pFact->CreateSwParaDlg( rView.GetWindow(), rView, aDlgAttr,DLG_STD, DLG_PARA, 0, sal_True ); OSL_ENSURE(pDlg, "Dialogdiet fail!"); - USHORT nRet = pDlg->Execute(); + sal_uInt16 nRet = pDlg->Execute(); if(RET_OK == nRet) { rReq.Done( *( pDlg->GetOutputItemSet() ) ); @@ -526,7 +526,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) sal_Bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT; const SfxPoolItem* pPoolItem; - if( pNewAttrs && SFX_ITEM_SET == pNewAttrs->GetItemState( nSlot, TRUE, &pPoolItem ) ) + if( pNewAttrs && SFX_ITEM_SET == pNewAttrs->GetItemState( nSlot, sal_True, &pPoolItem ) ) { if( !( (SfxBoolItem*)pPoolItem)->GetValue() ) bLeftToRight = !bLeftToRight; @@ -536,8 +536,8 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR, 0 ); - USHORT nAdjust = SVX_ADJUST_LEFT; - if( SFX_ITEM_ON == aEditAttr.GetItemState(EE_PARA_JUST, TRUE, &pPoolItem ) ) + sal_uInt16 nAdjust = SVX_ADJUST_LEFT; + if( SFX_ITEM_ON == aEditAttr.GetItemState(EE_PARA_JUST, sal_True, &pPoolItem ) ) nAdjust = ( (SvxAdjustItem*)pPoolItem)->GetEnumValue(); if( bLeftToRight ) @@ -590,7 +590,7 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) while(nWhich) { sal_uInt16 nEEWhich = 0; - USHORT nSlotId = GetPool().GetSlotId( nWhich ); + sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich ); switch( nSlotId ) { case SID_ATTR_CHAR_FONT: @@ -600,12 +600,12 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) { if ( pOLV ) { - USHORT nScriptType = pOLV->GetSelectedScriptType(); + sal_uInt16 nScriptType = pOLV->GetSelectedScriptType(); SfxItemPool* pSecondPool = aEditAttr.GetPool()->GetSecondaryPool(); if( !pSecondPool ) pSecondPool = aEditAttr.GetPool(); SvxScriptSetItem aSetItem( nSlotId, *pSecondPool ); - aSetItem.GetItemSet().Put( aEditAttr, FALSE ); + aSetItem.GetItemSet().Put( aEditAttr, sal_False ); const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType ); if( pI ) rSet.Put( *pI, nWhich ); @@ -626,7 +626,7 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) case FN_SET_SUPER_SCRIPT: case FN_SET_SUB_SCRIPT: { - USHORT nEsc = 0; + sal_uInt16 nEsc = 0; const SfxPoolItem *pEscItem = 0; if (nWhich==FN_SET_SUPER_SCRIPT) nEsc = SVX_ESCAPEMENT_SUPERSCRIPT; @@ -726,7 +726,7 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) rSet.DisableItem( nWhich ); else { - BOOL bFlag = FALSE; + sal_Bool bFlag = sal_False; switch( ( ( (SvxFrameDirectionItem&) aEditAttr.Get( EE_PARA_WRITINGDIR ) ) ).GetValue() ) { case FRMDIR_HORI_LEFT_TOP: @@ -773,7 +773,7 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) } } -void SwAnnotationShell::ExecSearch(SfxRequest& rReq, BOOL bNoMessage) +void SwAnnotationShell::ExecSearch(SfxRequest& rReq, sal_Bool bNoMessage) { rView.ExecSearch(rReq,bNoMessage); } @@ -821,7 +821,7 @@ void SwAnnotationShell::ExecClpbrd(SfxRequest &rReq) TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( &rView.GetEditWin() ) ); - ULONG nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() ); + sal_uLong nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() ); if (nFormat > 0) { @@ -836,9 +836,9 @@ void SwAnnotationShell::ExecClpbrd(SfxRequest &rReq) } case SID_CLIPBOARD_FORMAT_ITEMS: { - ULONG nFormat = 0; + sal_uLong nFormat = 0; const SfxPoolItem* pItem; - if ( rReq.GetArgs() && rReq.GetArgs()->GetItemState(nSlot, TRUE, &pItem) == SFX_ITEM_SET && + if ( rReq.GetArgs() && rReq.GetArgs()->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET && pItem->ISA(SfxUInt32Item) ) { nFormat = ((const SfxUInt32Item*)pItem)->GetValue(); @@ -915,7 +915,7 @@ void SwAnnotationShell::StateClpbrd(SfxItemSet &rSet) void SwAnnotationShell::StateStatusLine(SfxItemSet &rSet) { SfxWhichIter aIter( rSet ); - USHORT nWhich = aIter.FirstWhich(); + sal_uInt16 nWhich = aIter.FirstWhich(); while( nWhich ) { @@ -1006,7 +1006,6 @@ void SwAnnotationShell::NoteExec(SfxRequest &rReq) case FN_REPLY: case FN_POSTIT: case FN_DELETE_COMMENT: - case FN_DELETE_NOTE: if ( pPostItMgr->HasActiveSidebarWin() ) pPostItMgr->GetActiveSidebarWin()->ExecuteCommand(nSlot); break; @@ -1015,7 +1014,7 @@ void SwAnnotationShell::NoteExec(SfxRequest &rReq) break; case FN_DELETE_NOTE_AUTHOR: { - SFX_REQUEST_ARG( rReq, pItem, SfxStringItem, nSlot, FALSE); + SFX_REQUEST_ARG( rReq, pItem, SfxStringItem, nSlot, sal_False); if ( pItem ) pPostItMgr->Delete( pItem->GetValue() ); break; @@ -1027,7 +1026,7 @@ void SwAnnotationShell::NoteExec(SfxRequest &rReq) break; case FN_HIDE_NOTE_AUTHOR: { - SFX_REQUEST_ARG( rReq, pItem, SfxStringItem, nSlot, FALSE); + SFX_REQUEST_ARG( rReq, pItem, SfxStringItem, nSlot, sal_False); if ( pItem ) pPostItMgr->Hide( pItem->GetValue() ); } @@ -1041,28 +1040,19 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet) sal_uInt16 nWhich = aIter.FirstWhich(); while(nWhich) { - USHORT nSlotId = GetPool().GetSlotId( nWhich ); + sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich ); switch( nSlotId ) { case FN_POSTIT: - case FN_DELETE_NOTE: case FN_DELETE_NOTE_AUTHOR: case FN_DELETE_ALL_NOTES: case FN_HIDE_NOTE: case FN_HIDE_NOTE_AUTHOR: case FN_HIDE_ALL_NOTES: - { - if ( !pPostItMgr || - !pPostItMgr->HasActiveAnnotationWin() ) - { - rSet.DisableItem(nWhich); - } - break; - } case FN_DELETE_COMMENT: { if ( !pPostItMgr || - !pPostItMgr->HasActiveSidebarWin() /*HasActiveRedCommentWin()*/ ) + !pPostItMgr->HasActiveAnnotationWin() ) { rSet.DisableItem(nWhich); } @@ -1095,7 +1085,7 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet) if (pPostItMgr->HasActiveSidebarWin()) { if ( (pPostItMgr->GetActiveSidebarWin()->IsProtected()) && - ( (nSlotId==FN_DELETE_NOTE) || (nSlotId==FN_REPLY) ) ) + ( (nSlotId==FN_DELETE_COMMENT) || (nSlotId==FN_REPLY) ) ) rSet.DisableItem( nWhich ); } nWhich = aIter.NextWhich(); @@ -1269,7 +1259,7 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet) { const SfxPoolItem &rItem = rView.GetWrtShell().GetDoc()->GetDefault( GetWhichOfScript( RES_CHRATR_LANGUAGE, - GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage())) ); + GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage())) ); LanguageType nLang = ((const SvxLanguageItem &) rItem).GetLanguage(); uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); @@ -1355,17 +1345,17 @@ void SwAnnotationShell::ExecTransliteration(SfxRequest &rReq) void SwAnnotationShell::ExecUndo(SfxRequest &rReq) { const SfxItemSet* pArgs = rReq.GetArgs(); - SfxUndoManager* pUndoManager = GetUndoManager(); + ::svl::IUndoManager* pUndoManager = GetUndoManager(); SwWrtShell &rSh = rView.GetWrtShell(); long aOldHeight = rView.GetPostItMgr()->HasActiveSidebarWin() ? rView.GetPostItMgr()->GetActiveSidebarWin()->GetPostItTextHeight() : 0; - USHORT nId = rReq.GetSlot(); + sal_uInt16 nId = rReq.GetSlot(); sal_uInt16 nCnt = 1; const SfxPoolItem* pItem=0; - if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nId, FALSE, &pItem ) ) + if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nId, sal_False, &pItem ) ) nCnt = ((SfxUInt16Item*)pItem)->GetValue(); switch( nId ) { @@ -1384,7 +1374,7 @@ void SwAnnotationShell::ExecUndo(SfxRequest &rReq) nCnt = 0; while( nSteps-- ) - pUndoManager->Undo(0); + pUndoManager->Undo(); } if ( nCnt ) @@ -1408,7 +1398,7 @@ void SwAnnotationShell::ExecUndo(SfxRequest &rReq) nCnt = 0; while( nSteps-- ) - pUndoManager->Redo(0); + pUndoManager->Redo(); } if ( nCnt ) @@ -1431,8 +1421,8 @@ void SwAnnotationShell::StateUndo(SfxItemSet &rSet) return; SfxWhichIter aIter(rSet); - USHORT nWhich = aIter.FirstWhich(); - SfxUndoManager* pUndoManager = GetUndoManager(); + sal_uInt16 nWhich = aIter.FirstWhich(); + ::svl::IUndoManager* pUndoManager = GetUndoManager(); SfxViewFrame *pSfxViewFrame = rView.GetViewFrame(); SwWrtShell &rSh = rView.GetWrtShell(); @@ -1445,8 +1435,10 @@ void SwAnnotationShell::StateUndo(SfxItemSet &rSet) sal_uInt16 nCount = pUndoManager->GetUndoActionCount(); if ( nCount ) pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet ); - else if( rSh.GetUndoIds() ) + else if (rSh.GetLastUndoInfo(0, 0)) + { rSet.Put( SfxStringItem( nWhich, rSh.GetDoString(SwWrtShell::UNDO)) ); + } else rSet.DisableItem(nWhich); break; @@ -1456,8 +1448,10 @@ void SwAnnotationShell::StateUndo(SfxItemSet &rSet) sal_uInt16 nCount = pUndoManager->GetRedoActionCount(); if ( nCount ) pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet ); - else if(rSh.GetRedoIds()) + else if (rSh.GetFirstRedoInfo(0)) + { rSet.Put(SfxStringItem( nWhich, rSh.GetDoString(SwWrtShell::REDO)) ); + } else rSet.DisableItem(nWhich); break; @@ -1467,34 +1461,36 @@ void SwAnnotationShell::StateUndo(SfxItemSet &rSet) { if( pUndoManager ) { - UniString (SfxUndoManager:: *fnGetComment)( USHORT ) const; + UniString (::svl::IUndoManager:: *fnGetComment)( size_t, bool const ) const; sal_uInt16 nCount; if( SID_GETUNDOSTRINGS == nWhich ) { nCount = pUndoManager->GetUndoActionCount(); - fnGetComment = &SfxUndoManager::GetUndoActionComment; + fnGetComment = &::svl::IUndoManager::GetUndoActionComment; } else { nCount = pUndoManager->GetRedoActionCount(); - fnGetComment = &SfxUndoManager::GetRedoActionComment; + fnGetComment = &::svl::IUndoManager::GetRedoActionComment; } String sList; if( nCount ) { for( sal_uInt16 n = 0; n < nCount; ++n ) - ( sList += (pUndoManager->*fnGetComment)( n ) ) + ( sList += (pUndoManager->*fnGetComment)( n, ::svl::IUndoManager::TopLevel ) ) += '\n'; } SfxStringListItem aItem( nWhich ); - if( nWhich == SID_GETUNDOSTRINGS && rSh.GetUndoIds() ) + if ((nWhich == SID_GETUNDOSTRINGS) && + rSh.GetLastUndoInfo(0, 0)) { rSh.GetDoStrings( SwWrtShell::UNDO, aItem ); } - else if( nWhich == SID_GETREDOSTRINGS && rSh.GetRedoIds() ) + else if ((nWhich == SID_GETREDOSTRINGS) && + (rSh.GetFirstRedoInfo(0))) { rSh.GetDoStrings( SwWrtShell::UNDO, aItem ); } @@ -1526,7 +1522,7 @@ void SwAnnotationShell::StateUndo(SfxItemSet &rSet) void SwAnnotationShell::StateDisableItems( SfxItemSet &rSet ) { SfxWhichIter aIter(rSet); - USHORT nWhich = aIter.FirstWhich(); + sal_uInt16 nWhich = aIter.FirstWhich(); while (nWhich) { rSet.DisableItem( nWhich ); @@ -1545,7 +1541,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) const SfxItemSet *pArgs = rReq.GetArgs(); const SfxPoolItem* pItem = 0; if( pArgs ) - pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), FALSE, &pItem); + pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), sal_False, &pItem); String sSym; String sFontName; @@ -1553,25 +1549,25 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) { sSym = ((const SfxStringItem*)pItem)->GetValue(); const SfxPoolItem* pFtItem = NULL; - pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), FALSE, &pFtItem); + pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), sal_False, &pFtItem); const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem ); if ( pFontItem ) sFontName = pFontItem->GetValue(); } SfxItemSet aSet(pOLV->GetAttribs()); - USHORT nScript = pOLV->GetSelectedScriptType(); + sal_uInt16 nScript = pOLV->GetSelectedScriptType(); SvxFontItem aSetDlgFont( RES_CHRATR_FONT ); { SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() ); - aSetItem.GetItemSet().Put( aSet, FALSE ); + aSetItem.GetItemSet().Put( aSet, sal_False ); const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript ); if( pI ) aSetDlgFont = *(SvxFontItem*)pI; else aSetDlgFont = (SvxFontItem&)aSet.Get( GetWhichOfScript( SID_ATTR_CHAR_FONT, - GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() ) )); + GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) )); if (!sFontName.Len()) sFontName = aSetDlgFont.GetFamilyName(); } @@ -1582,7 +1578,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); SfxAllItemSet aAllSet( GetPool() ); - aAllSet.Put( SfxBoolItem( FN_PARAM_1, FALSE ) ); + aAllSet.Put( SfxBoolItem( FN_PARAM_1, sal_False ) ); SwViewOption aOpt(*rView.GetWrtShell().GetViewOptions()); String sSymbolFont = aOpt.GetSymbolFont(); @@ -1595,11 +1591,11 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( rView.GetWindow(), aAllSet, rView.GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP ); - USHORT nResult = pDlg->Execute(); + sal_uInt16 nResult = pDlg->Execute(); if( nResult == RET_OK ) { - SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, FALSE ); - SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, FALSE ); + SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, sal_False ); + SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, sal_False ); if ( pFontItem ) { aFont.SetName( pFontItem->GetFamilyName() ); @@ -1624,7 +1620,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) // nicht flackern pOLV->HideCursor(); Outliner * pOutliner = pOLV->GetOutliner(); - pOutliner->SetUpdateMode(FALSE); + pOutliner->SetUpdateMode(sal_False); SfxItemSet aOldSet( pOLV->GetAttribs() ); SfxItemSet aFontSet( *aOldSet.GetPool(), @@ -1643,7 +1639,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) aFont.GetStyleName(), aFont.GetPitch(), aFont.GetCharSet(), EE_CHAR_FONTINFO ); - USHORT nScriptBreak = pBreakIt->GetAllScriptsOfText( sSym ); + sal_uInt16 nScriptBreak = pBreakIt->GetAllScriptsOfText( sSym ); if( SCRIPTTYPE_LATIN & nScriptBreak ) aSetFont.Put( aFontItem, EE_CHAR_FONTINFO ); if( SCRIPTTYPE_ASIAN & nScriptBreak ) @@ -1662,7 +1658,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) pOLV->SetAttribs( aFontSet ); // ab jetzt wieder anzeigen - pOutliner->SetUpdateMode(TRUE); + pOutliner->SetUpdateMode(sal_True); pOLV->ShowCursor(); rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), sSym ) ); |