diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-17 14:01:01 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-17 14:57:13 -0400 |
commit | 1159a53474549448b0c2d94fb76a9f8cab8c69ea (patch) | |
tree | 71b5b23484c8de1996862f05d6357381a0a21d3c /editeng | |
parent | de7152a8aad3273e40f63247ea146c02fea606c3 (diff) |
Make more methods of ImpEditEngine private to avoid direct access.
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editeng/editeng.hxx | 7 | ||||
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 20 | ||||
-rw-r--r-- | editeng/source/editeng/editview.cxx | 114 | ||||
-rw-r--r-- | editeng/source/editeng/edtspell.cxx | 14 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 58 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 15 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit5.cxx | 3 | ||||
-rw-r--r-- | editeng/source/editeng/textconv.cxx | 16 |
9 files changed, 141 insertions, 108 deletions
diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx index 5cbad78e0d96..f2208a9e5056 100644 --- a/editeng/inc/editeng/editeng.hxx +++ b/editeng/inc/editeng/editeng.hxx @@ -111,6 +111,7 @@ struct PasteOrDropInfos; class Range; struct EPaM; class DeletedNodeInfo; +class ParaPortionList; ////////////////////////////////////////////////////////////////////////////// @@ -517,6 +518,9 @@ public: EditDoc& GetEditDoc(); const EditDoc& GetEditDoc() const; + ParaPortionList& GetParaPortions(); + const ParaPortionList& GetParaPortions() const; + bool IsFormatted() const; bool IsImportHandlerSet() const; bool IsImportRTFStyleSheetsSet() const; @@ -582,6 +586,9 @@ public: void SetUndoMode(bool b); void FormatAndUpdate(EditView* pCurView = NULL); + + bool Undo(EditView* pView); + bool Redo(EditView* pView); }; #endif // _MyEDITENG_HXX diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 83143875c109..4c75f6f8f325 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -832,6 +832,16 @@ void EditEngine::FormatAndUpdate(EditView* pCurView) pImpEditEngine->FormatAndUpdate(pCurView); } +bool EditEngine::Undo(EditView* pView) +{ + return pImpEditEngine->Undo(pView); +} + +bool EditEngine::Redo(EditView* pView) +{ + return pImpEditEngine->Redo(pView); +} + uno::Reference<datatransfer::XTransferable> EditEngine::CreateTransferable(const EditSelection& rSelection) { return pImpEditEngine->CreateTransferable(rSelection); @@ -938,6 +948,16 @@ const EditDoc& EditEngine::GetEditDoc() const return pImpEditEngine->GetEditDoc(); } +ParaPortionList& EditEngine::GetParaPortions() +{ + return pImpEditEngine->GetParaPortions(); +} + +const ParaPortionList& EditEngine::GetParaPortions() const +{ + return pImpEditEngine->GetParaPortions(); +} + void EditEngine::SeekCursor( ContentNode* pNode, sal_uInt16 nPos, SvxFont& rFont, OutputDevice* pOut, sal_uInt16 nIgnoreWhich) { diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index bde47413f3e2..ffe228523bc6 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -72,6 +72,8 @@ #include <com/sun/star/lang/XServiceInfo.hpp> +#define PIMPEE pImpEditView->pEditEngine->pImpEditEngine + using ::rtl::OUString; using namespace com::sun::star; using namespace com::sun::star::uno; @@ -242,14 +244,14 @@ void EditView::SetSelection( const ESelection& rESel ) if ( !pPortion->IsVisible() ) { pPortion = PIMPE->GetPrevVisPortion( pPortion ); - ContentNode* pNode = pPortion ? pPortion->GetNode() : PIMPEE->GetEditDoc().GetObject( 0 ); + ContentNode* pNode = pPortion ? pPortion->GetNode() : PIMPE->GetEditDoc().GetObject( 0 ); aNewSelection.Min() = EditPaM( pNode, pNode->Len() ); } pPortion = PIMPE->FindParaPortion( aNewSelection.Max().GetNode() ); if ( !pPortion->IsVisible() ) { pPortion = PIMPE->GetPrevVisPortion( pPortion ); - ContentNode* pNode = pPortion ? pPortion->GetNode() : PIMPEE->GetEditDoc().GetObject( 0 ); + ContentNode* pNode = pPortion ? pPortion->GetNode() : PIMPE->GetEditDoc().GetObject( 0 ); aNewSelection.Max() = EditPaM( pNode, pNode->Len() ); } @@ -267,8 +269,8 @@ ESelection EditView::GetSelection() const ESelection aSelection; - aSelection.nStartPara = PIMPEE->GetEditDoc().GetPos( pImpEditView->GetEditSelection().Min().GetNode() ); - aSelection.nEndPara = PIMPEE->GetEditDoc().GetPos( pImpEditView->GetEditSelection().Max().GetNode() ); + aSelection.nStartPara = PIMPE->GetEditDoc().GetPos( pImpEditView->GetEditSelection().Min().GetNode() ); + aSelection.nEndPara = PIMPE->GetEditDoc().GetPos( pImpEditView->GetEditSelection().Max().GetNode() ); aSelection.nStartPos = pImpEditView->GetEditSelection().Min().GetIndex(); aSelection.nEndPos = pImpEditView->GetEditSelection().Max().GetIndex(); @@ -309,7 +311,7 @@ void EditView::SetEditEngine( EditEngine* pEditEng ) DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); pImpEditView->pEditEngine = pEditEng; EditSelection aStartSel; - aStartSel = PIMPEE->GetEditDoc().GetStartPaM(); + aStartSel = PIMPE->GetEditDoc().GetStartPaM(); pImpEditView->SetEditSelection( aStartSel ); } @@ -376,30 +378,30 @@ void EditView::InsertText( const XubString& rStr, sal_Bool bSelect ) DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); - ImpEditEngine* pImpEE = PIMPEE; + EditEngine* pEE = PIMPE; pImpEditView->DrawSelection(); EditPaM aPaM1; if ( bSelect ) { EditSelection aTmpSel( pImpEditView->GetEditSelection() ); - aTmpSel.Adjust( pImpEE->GetEditDoc() ); + aTmpSel.Adjust( pEE->GetEditDoc() ); aPaM1 = aTmpSel.Min(); } - pImpEE->UndoActionStart( EDITUNDO_INSERT ); - EditPaM aPaM2( pImpEE->InsertText( pImpEditView->GetEditSelection(), rStr ) ); - pImpEE->UndoActionEnd( EDITUNDO_INSERT ); + pEE->UndoActionStart( EDITUNDO_INSERT ); + EditPaM aPaM2( pEE->InsertText( pImpEditView->GetEditSelection(), rStr ) ); + pEE->UndoActionEnd( EDITUNDO_INSERT ); if ( bSelect ) { - DBG_ASSERT( !aPaM1.DbgIsBuggy( pImpEE->GetEditDoc() ), "Insert: PaM broken" ); + DBG_ASSERT( !aPaM1.DbgIsBuggy( pEE->GetEditDoc() ), "Insert: PaM broken" ); pImpEditView->SetEditSelection( EditSelection( aPaM1, aPaM2 ) ); } else pImpEditView->SetEditSelection( EditSelection( aPaM2, aPaM2 ) ); - pImpEE->FormatAndUpdate( this ); + pEE->FormatAndUpdate( this ); } sal_Bool EditView::PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin ) @@ -468,7 +470,7 @@ const SfxItemSet& EditView::GetEmptyItemSet() { DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); - return PIMPEE->GetEmptyItemSet(); + return PIMPE->GetEmptyItemSet(); } void EditView::SetAttribs( const SfxItemSet& rSet ) @@ -478,8 +480,8 @@ void EditView::SetAttribs( const SfxItemSet& rSet ) DBG_ASSERT( !pImpEditView->aEditSelection.IsInvalid(), "Blind Selection in ...." ); pImpEditView->DrawSelection(); - PIMPEE->SetAttribs( pImpEditView->GetEditSelection(), rSet, ATTRSPECIAL_WHOLEWORD ); - PIMPEE->FormatAndUpdate( this ); + PIMPE->SetAttribs( pImpEditView->GetEditSelection(), rSet, ATTRSPECIAL_WHOLEWORD ); + PIMPE->FormatAndUpdate( this ); } void EditView::RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs ) @@ -488,7 +490,7 @@ void EditView::RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs ) DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); pImpEditView->DrawSelection(); - PIMPEE->UndoActionStart( EDITUNDO_RESETATTRIBS ); + PIMPE->UndoActionStart( EDITUNDO_RESETATTRIBS ); EditSelection aSelection( pImpEditView->GetEditSelection() ); for (sal_uInt16 nWID = EE_ITEMS_START; nWID <= EE_ITEMS_END; ++nWID) @@ -497,11 +499,11 @@ void EditView::RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs ) EE_CHAR_LANGUAGE_CJK == nWID || EE_CHAR_LANGUAGE_CTL == nWID; if (!bIsLang) - PIMPEE->RemoveCharAttribs( aSelection, bRemoveParaAttribs, nWID ); + PIMPE->RemoveCharAttribs( aSelection, bRemoveParaAttribs, nWID ); } - PIMPEE->UndoActionEnd( EDITUNDO_RESETATTRIBS ); - PIMPEE->FormatAndUpdate( this ); + PIMPE->UndoActionEnd( EDITUNDO_RESETATTRIBS ); + PIMPE->FormatAndUpdate( this ); } void EditView::RemoveAttribs( sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ) @@ -510,20 +512,20 @@ void EditView::RemoveAttribs( sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ) DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); pImpEditView->DrawSelection(); - PIMPEE->UndoActionStart( EDITUNDO_RESETATTRIBS ); - PIMPEE->RemoveCharAttribs( pImpEditView->GetEditSelection(), bRemoveParaAttribs, nWhich ); - PIMPEE->UndoActionEnd( EDITUNDO_RESETATTRIBS ); - PIMPEE->FormatAndUpdate( this ); + PIMPE->UndoActionStart( EDITUNDO_RESETATTRIBS ); + PIMPE->RemoveCharAttribs( pImpEditView->GetEditSelection(), bRemoveParaAttribs, nWhich ); + PIMPE->UndoActionEnd( EDITUNDO_RESETATTRIBS ); + PIMPE->FormatAndUpdate( this ); } void EditView::RemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich ) { DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); - PIMPEE->UndoActionStart( EDITUNDO_RESETATTRIBS ); - PIMPEE->RemoveCharAttribs( nPara, nWhich ); - PIMPEE->UndoActionEnd( EDITUNDO_RESETATTRIBS ); - PIMPEE->FormatAndUpdate( this ); + PIMPE->UndoActionStart( EDITUNDO_RESETATTRIBS ); + PIMPE->RemoveCharAttribs( nPara, nWhich ); + PIMPE->UndoActionEnd( EDITUNDO_RESETATTRIBS ); + PIMPE->FormatAndUpdate( this ); } SfxItemSet EditView::GetAttribs() @@ -538,14 +540,14 @@ void EditView::Undo() { DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); - PIMPEE->Undo( this ); + PIMPE->Undo( this ); } void EditView::Redo() { DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); - PIMPEE->Redo( this ); + PIMPE->Redo( this ); } sal_uLong EditView::Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect, SvKeyValueIterator* pHTTPHeaderAttrs ) @@ -560,7 +562,7 @@ sal_uLong EditView::Read( SvStream& rInput, const String& rBaseURL, EETextFormat EditSelection aNewSel( aEndPaM, aEndPaM ); if ( bSelect ) { - aOldSel.Adjust( PIMPEE->GetEditDoc() ); + aOldSel.Adjust( PIMPE->GetEditDoc() ); aNewSel.Min() = aOldSel.Min(); } @@ -690,13 +692,13 @@ void EditView::InsertText( const EditTextObject& rTextObject ) DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); pImpEditView->DrawSelection(); - PIMPEE->UndoActionStart( EDITUNDO_INSERT ); - EditSelection aTextSel( PIMPEE->InsertText( rTextObject, pImpEditView->GetEditSelection() ) ); - PIMPEE->UndoActionEnd( EDITUNDO_INSERT ); + PIMPE->UndoActionStart( EDITUNDO_INSERT ); + EditSelection aTextSel( PIMPE->InsertText( rTextObject, pImpEditView->GetEditSelection() ) ); + PIMPE->UndoActionEnd( EDITUNDO_INSERT ); aTextSel.Min() = aTextSel.Max(); // Selection not retained. pImpEditView->SetEditSelection( aTextSel ); - PIMPEE->FormatAndUpdate( this ); + PIMPE->FormatAndUpdate( this ); } void EditView::InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xDataObj, const String& rBaseURL, sal_Bool bUseSpecial ) @@ -704,15 +706,15 @@ void EditView::InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::d DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); - PIMPEE->UndoActionStart( EDITUNDO_INSERT ); + PIMPE->UndoActionStart( EDITUNDO_INSERT ); pImpEditView->DeleteSelected(); EditSelection aTextSel = PIMPE->InsertText(xDataObj, rBaseURL, pImpEditView->GetEditSelection().Max(), bUseSpecial); - PIMPEE->UndoActionEnd( EDITUNDO_INSERT ); + PIMPE->UndoActionEnd( EDITUNDO_INSERT ); aTextSel.Min() = aTextSel.Max(); // Selection not retained. pImpEditView->SetEditSelection( aTextSel ); - PIMPEE->FormatAndUpdate( this ); + PIMPE->FormatAndUpdate( this ); } void EditView::SetEditEngineUpdateMode( sal_Bool bUpdate ) @@ -736,14 +738,14 @@ SfxStyleSheet* EditView::GetStyleSheet() EditSelection aSel( pImpEditView->GetEditSelection() ); - aSel.Adjust( PIMPEE->GetEditDoc() ); - sal_uInt16 nStartPara = PIMPEE->GetEditDoc().GetPos( aSel.Min().GetNode() ); - sal_uInt16 nEndPara = PIMPEE->GetEditDoc().GetPos( aSel.Max().GetNode() ); + aSel.Adjust( PIMPE->GetEditDoc() ); + sal_uInt16 nStartPara = PIMPE->GetEditDoc().GetPos( aSel.Min().GetNode() ); + sal_uInt16 nEndPara = PIMPE->GetEditDoc().GetPos( aSel.Max().GetNode() ); SfxStyleSheet* pStyle = NULL; for ( sal_uInt16 n = nStartPara; n <= nEndPara; n++ ) { - SfxStyleSheet* pTmpStyle = PIMPEE->GetStyleSheet( n ); + SfxStyleSheet* pTmpStyle = PIMPE->GetStyleSheet( n ); if ( ( n != nStartPara ) && ( pStyle != pTmpStyle ) ) return NULL; // Not unique. pStyle = pTmpStyle; @@ -784,7 +786,7 @@ void EditView::TransliterateText( sal_Int32 nTransliterationMode ) { DBG_CHKTHIS( EditView, 0 ); EditSelection aOldSel( pImpEditView->GetEditSelection() ); - EditSelection aNewSel = PIMPEE->TransliterateText( pImpEditView->GetEditSelection(), nTransliterationMode ); + EditSelection aNewSel = PIMPE->TransliterateText( pImpEditView->GetEditSelection(), nTransliterationMode ); if ( aNewSel != aOldSel ) { pImpEditView->DrawSelection(); @@ -804,8 +806,8 @@ void EditView::CompleteAutoCorrect( Window* pFrameWin ) aSel = PIMPE->EndOfWord( aSel.Max() ); aSel = PIMPEE->AutoCorrect( aSel, 0, !IsInsertMode(), pFrameWin ); pImpEditView->SetEditSelection( aSel ); - if ( PIMPEE->IsModified() ) - PIMPEE->FormatAndUpdate( this ); + if ( PIMPE->IsModified() ) + PIMPE->FormatAndUpdate( this ); } } @@ -1185,14 +1187,14 @@ void EditView::InsertField( const SvxFieldItem& rFld ) DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); - ImpEditEngine* pImpEE = PIMPEE; + EditEngine* pEE = PIMPE; pImpEditView->DrawSelection(); - pImpEE->UndoActionStart( EDITUNDO_INSERT ); - EditPaM aPaM( pImpEE->InsertField( pImpEditView->GetEditSelection(), rFld ) ); - pImpEE->UndoActionEnd( EDITUNDO_INSERT ); + pEE->UndoActionStart( EDITUNDO_INSERT ); + EditPaM aPaM( pEE->InsertField( pImpEditView->GetEditSelection(), rFld ) ); + pEE->UndoActionEnd( EDITUNDO_INSERT ); pImpEditView->SetEditSelection( EditSelection( aPaM, aPaM ) ); - pImpEE->UpdateFields(); - pImpEE->FormatAndUpdate( this ); + pEE->UpdateFields(); + pEE->FormatAndUpdate( this ); } const SvxFieldItem* EditView::GetFieldUnderMousePointer() const @@ -1221,7 +1223,7 @@ const SvxFieldItem* EditView::GetFieldUnderMousePointer( sal_uInt16& nPara, sal_ const SvxFieldItem* EditView::GetFieldAtSelection() const { EditSelection aSel( pImpEditView->GetEditSelection() ); - aSel.Adjust( pImpEditView->pEditEngine->pImpEditEngine->GetEditDoc() ); + aSel.Adjust( pImpEditView->pEditEngine->GetEditDoc() ); // Only when cursor is in font of field, no selection, // or only selecting field if ( ( aSel.Min().GetNode() == aSel.Max().GetNode() ) && @@ -1419,11 +1421,11 @@ String EditView::GetSurroundingText() const DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); EditSelection aSel( pImpEditView->GetEditSelection() ); - aSel.Adjust( PIMPEE->GetEditDoc() ); + aSel.Adjust( PIMPE->GetEditDoc() ); if( HasSelection() ) { - XubString aStr = PIMPEE->GetSelected( aSel ); + String aStr = PIMPE->GetSelected(aSel); // Stop reconversion if the selected text includes a line break. if ( aStr.Search( 0x0A ) == STRING_NOTFOUND ) @@ -1435,7 +1437,7 @@ String EditView::GetSurroundingText() const { aSel.Min().SetIndex( 0 ); aSel.Max().SetIndex( aSel.Max().GetNode()->Len() ); - return PIMPEE->GetSelected( aSel ); + return PIMPE->GetSelected(aSel); } } @@ -1449,8 +1451,8 @@ Selection EditView::GetSurroundingTextSelection() const if( HasSelection() ) { EditSelection aSel( pImpEditView->GetEditSelection() ); - aSel.Adjust( PIMPEE->GetEditDoc() ); - XubString aStr = PIMPEE->GetSelected( aSel ); + aSel.Adjust( PIMPE->GetEditDoc() ); + String aStr = PIMPE->GetSelected(aSel); // Stop reconversion if the selected text includes a line break. if ( aStr.Search( 0x0A ) == STRING_NOTFOUND ) diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx index bb06c8e9885f..738516c6b6bf 100644 --- a/editeng/source/editeng/edtspell.cxx +++ b/editeng/source/editeng/edtspell.cxx @@ -64,6 +64,7 @@ EditSpellWrapper::EditSpellWrapper( Window* _pWin, void EditSpellWrapper::SpellStart( SvxSpellArea eArea ) { + EditEngine* pEE = pEditView->GetEditEngine(); ImpEditEngine* pImpEE = pEditView->GetImpEditEngine(); SpellInfo* pSpellInfo = pImpEE->GetSpellInfo(); @@ -77,13 +78,13 @@ void EditSpellWrapper::SpellStart( SvxSpellArea eArea ) pSpellInfo->bSpellToEnd = sal_False; pSpellInfo->aSpellTo = pSpellInfo->aSpellStart; pEditView->GetImpEditView()->SetEditSelection( - pImpEE->GetEditDoc().GetStartPaM() ); + pEE->GetEditDoc().GetStartPaM() ); } else { pSpellInfo->bSpellToEnd = sal_True; pSpellInfo->aSpellTo = pImpEE->CreateEPaM( - pImpEE->GetEditDoc().GetStartPaM() ); + pEE->GetEditDoc().GetStartPaM() ); } } else if ( eArea == SVX_SPELL_BODY_END ) @@ -95,14 +96,14 @@ void EditSpellWrapper::SpellStart( SvxSpellArea eArea ) { pSpellInfo->bSpellToEnd = sal_True; pSpellInfo->aSpellTo = pImpEE->CreateEPaM( - pImpEE->GetEditDoc().GetEndPaM() ); + pEE->GetEditDoc().GetEndPaM() ); } else { pSpellInfo->bSpellToEnd = sal_False; pSpellInfo->aSpellTo = pSpellInfo->aSpellStart; pEditView->GetImpEditView()->SetEditSelection( - pImpEE->GetEditDoc().GetEndPaM() ); + pEE->GetEditDoc().GetEndPaM() ); } } else if ( eArea == SVX_SPELL_BODY ) @@ -134,19 +135,20 @@ sal_Bool EditSpellWrapper::HasOtherCnt() sal_Bool EditSpellWrapper::SpellMore() { + EditEngine* pEE = pEditView->GetEditEngine(); ImpEditEngine* pImpEE = pEditView->GetImpEditEngine(); SpellInfo* pSpellInfo = pImpEE->GetSpellInfo(); sal_Bool bMore = sal_False; if ( pSpellInfo->bMultipleDoc ) { - bMore = pImpEE->GetEditEnginePtr()->SpellNextDocument(); + bMore = pEE->SpellNextDocument(); if ( bMore ) { // The text has been entered into the engine, when backwords then // it must be behind the selection. Reference< XPropertySet > xProp( SvxGetLinguPropertySet() ); pEditView->GetImpEditView()->SetEditSelection( - pImpEE->GetEditDoc().GetStartPaM() ); + pEE->GetEditDoc().GetStartPaM() ); } } return bMore; diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 3b31282ad07d..51bdc4f44e0a 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -96,8 +96,8 @@ ImpEditView::ImpEditView( EditView* pView, EditEngine* pEng, Window* pWindow ) : nControl = EV_CNTRL_AUTOSCROLL | EV_CNTRL_ENABLEPASTE; bActiveDragAndDropListener = sal_False; - aEditSelection.Min() = pEng->pImpEditEngine->GetEditDoc().GetStartPaM(); - aEditSelection.Max() = pEng->pImpEditEngine->GetEditDoc().GetEndPaM(); + aEditSelection.Min() = pEng->GetEditDoc().GetStartPaM(); + aEditSelection.Max() = pEng->GetEditDoc().GetEndPaM(); } ImpEditView::~ImpEditView() @@ -175,22 +175,22 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion ) } DBG_ASSERT( !pEditEngine->IsIdleFormatterActive(), "DrawSelection: Not formatted!" ); - aTmpSel.Adjust( pEditEngine->pImpEditEngine->GetEditDoc() ); + aTmpSel.Adjust( pEditEngine->GetEditDoc() ); ContentNode* pStartNode = aTmpSel.Min().GetNode(); ContentNode* pEndNode = aTmpSel.Max().GetNode(); - sal_uInt16 nStartPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( pStartNode ); - sal_uInt16 nEndPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( pEndNode ); + sal_uInt16 nStartPara = pEditEngine->GetEditDoc().GetPos( pStartNode ); + sal_uInt16 nEndPara = pEditEngine->GetEditDoc().GetPos( pEndNode ); for ( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++ ) { - ParaPortion* pTmpPortion = pEditEngine->pImpEditEngine->GetParaPortions().SafeGetObject( nPara ); + ParaPortion* pTmpPortion = pEditEngine->GetParaPortions().SafeGetObject( nPara ); DBG_ASSERT( pTmpPortion, "Portion in Selection not found!" ); DBG_ASSERT( !pTmpPortion->IsInvalid(), "Portion in Selection not formatted!" ); if ( !pTmpPortion->IsVisible() || pTmpPortion->IsInvalid() ) continue; - long nParaStart = pEditEngine->pImpEditEngine->GetParaPortions().GetYOffset( pTmpPortion ); + long nParaStart = pEditEngine->GetParaPortions().GetYOffset( pTmpPortion ); if ( ( nParaStart + pTmpPortion->GetHeight() ) < GetVisDocTop() ) continue; if ( nParaStart > GetVisDocBottom() ) @@ -650,7 +650,7 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa if (nPara == USHRT_MAX) // #i94322 return; - const ParaPortion* pParaPortion = pEditEngine->pImpEditEngine->GetParaPortions()[nPara]; + const ParaPortion* pParaPortion = pEditEngine->GetParaPortions()[nPara]; nShowCursorFlags |= nExtraCursorFlags; @@ -1059,7 +1059,7 @@ sal_Bool ImpEditView::MouseButtonDown( const MouseEvent& rMouseEvent ) { pEditEngine->CheckIdleFormatter(); // If fast typing and mouse button downs if ( pEditEngine->GetInternalEditStatus().NotifyCursorMovements() ) - pEditEngine->GetInternalEditStatus().GetPrevParagraph() = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( GetEditSelection().Max().GetNode() ); + pEditEngine->GetInternalEditStatus().GetPrevParagraph() = pEditEngine->GetEditDoc().GetPos( GetEditSelection().Max().GetNode() ); nTravelXPos = TRAVEL_X_DONTKNOW; nExtraCursorFlags = 0; nCursorBidiLevel = CURSOR_BIDILEVEL_DONTKNOW; @@ -1137,7 +1137,7 @@ String ImpEditView::SpellIgnoreOrAddWord( sal_Bool bAdd ) if (xDic.is()) xDic->add( aWord, sal_False, String() ); } - EditDoc& rDoc = pEditEngine->pImpEditEngine->GetEditDoc(); + EditDoc& rDoc = pEditEngine->GetEditDoc(); sal_uInt16 nNodes = rDoc.Count(); for ( sal_uInt16 n = 0; n < nNodes; n++ ) { @@ -1191,7 +1191,7 @@ const SvxFieldItem* ImpEditView::GetField( const Point& rPos, sal_uInt16* pPara, { DBG_ASSERT(dynamic_cast<const SvxFieldItem*>(rAttr.GetItem()), "No FieldItem..."); if ( pPara ) - *pPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aPaM.GetNode() ); + *pPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() ); if ( pPos ) *pPos = rAttr.GetStart(); return static_cast<const SvxFieldItem*>(rAttr.GetItem()); @@ -1217,7 +1217,7 @@ sal_Bool ImpEditView::IsBulletArea( const Point& rPos, sal_uInt16* pPara ) sal_uInt16 nPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() ); Rectangle aBulletArea = pEditEngine->GetBulletArea( nPara ); long nY = pEditEngine->GetDocPosTopLeft( nPara ).Y(); - const ParaPortion* pParaPortion = pEditEngine->pImpEditEngine->GetParaPortions()[nPara]; + const ParaPortion* pParaPortion = pEditEngine->GetParaPortions()[nPara]; nY += pParaPortion->GetFirstLineOffset(); if ( ( aDocPos.Y() > ( nY + aBulletArea.Top() ) ) && ( aDocPos.Y() < ( nY + aBulletArea.Bottom() ) ) && @@ -1328,7 +1328,7 @@ void ImpEditView::Paste( ::com::sun::star::uno::Reference< ::com::sun::star::dat bUseSpecial && pEditEngine->GetInternalEditStatus().AllowPasteSpecial()); } - aPasteOrDropInfos.nEndPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aSel.Max().GetNode() ); + aPasteOrDropInfos.nEndPara = pEditEngine->GetEditDoc().GetPos( aSel.Max().GetNode() ); pEditEngine->HandleEndPasteOrDrop(aPasteOrDropInfos); pEditEngine->pImpEditEngine->UndoActionEnd( EDITUNDO_PASTE ); @@ -1347,11 +1347,11 @@ sal_Bool ImpEditView::IsInSelection( const EditPaM& rPaM ) if ( !aSel.HasRange() ) return sal_False; - aSel.Adjust( pEditEngine->pImpEditEngine->GetEditDoc() ); + aSel.Adjust( pEditEngine->GetEditDoc() ); - sal_uInt16 nStartNode = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aSel.Min().GetNode() ); - sal_uInt16 nEndNode = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aSel.Max().GetNode() ); - sal_uInt16 nCurNode = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( rPaM.GetNode() ); + sal_uInt16 nStartNode = pEditEngine->GetEditDoc().GetPos( aSel.Min().GetNode() ); + sal_uInt16 nEndNode = pEditEngine->GetEditDoc().GetPos( aSel.Max().GetNode() ); + sal_uInt16 nCurNode = pEditEngine->GetEditDoc().GetPos( rPaM.GetNode() ); if ( ( nCurNode > nStartNode ) && ( nCurNode < nEndNode ) ) return sal_True; @@ -1528,7 +1528,7 @@ void ImpEditView::dragGestureRecognized( const ::com::sun::star::datatransfer::d Point aMousePosPixel( rDGE.DragOriginX, rDGE.DragOriginY ); EditSelection aCopySel( GetEditSelection() ); - aCopySel.Adjust( pEditEngine->pImpEditEngine->GetEditDoc() ); + aCopySel.Adjust( pEditEngine->GetEditDoc() ); if ( GetEditSelection().HasRange() && bClickedInSelection ) { @@ -1544,7 +1544,7 @@ void ImpEditView::dragGestureRecognized( const ::com::sun::star::datatransfer::d { pDragAndDropInfo = new DragAndDropInfo(); pDragAndDropInfo->pField = pField; - ContentNode* pNode = pEditEngine->pImpEditEngine->GetEditDoc().GetObject( nPara ); + ContentNode* pNode = pEditEngine->GetEditDoc().GetObject( nPara ); aCopySel = EditSelection( EditPaM( pNode, nPos ), EditPaM( pNode, nPos+1 ) ); GetEditSelection() = aCopySel; DrawSelection(); @@ -1556,15 +1556,15 @@ void ImpEditView::dragGestureRecognized( const ::com::sun::star::datatransfer::d { pDragAndDropInfo = new DragAndDropInfo(); pDragAndDropInfo->bOutlinerMode = sal_True; - EditPaM aStartPaM( pEditEngine->pImpEditEngine->GetEditDoc().GetObject( nPara ), 0 ); + EditPaM aStartPaM( pEditEngine->GetEditDoc().GetObject( nPara ), 0 ); EditPaM aEndPaM( aStartPaM ); const SfxInt16Item& rLevel = (const SfxInt16Item&) pEditEngine->GetParaAttrib( nPara, EE_PARA_OUTLLEVEL ); - for ( sal_uInt16 n = nPara +1; n < pEditEngine->pImpEditEngine->GetEditDoc().Count(); n++ ) + for ( sal_uInt16 n = nPara +1; n < pEditEngine->GetEditDoc().Count(); n++ ) { const SfxInt16Item& rL = (const SfxInt16Item&) pEditEngine->GetParaAttrib( n, EE_PARA_OUTLLEVEL ); if ( rL.GetValue() > rLevel.GetValue() ) { - aEndPaM.SetNode( pEditEngine->pImpEditEngine->GetEditDoc().GetObject( n ) ); + aEndPaM.SetNode( pEditEngine->GetEditDoc().GetObject( n ) ); } else { @@ -1728,13 +1728,13 @@ void ImpEditView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDro PasteOrDropInfos aPasteOrDropInfos; aPasteOrDropInfos.nAction = EE_ACTION_DROP; - aPasteOrDropInfos.nStartPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aPaM.GetNode() ); + aPasteOrDropInfos.nStartPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() ); pEditEngine->HandleBeginPasteOrDrop(aPasteOrDropInfos); EditSelection aNewSel = pEditEngine->InsertText( xDataObj, String(), aPaM, pEditEngine->GetInternalEditStatus().AllowPasteSpecial()); - aPasteOrDropInfos.nEndPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aNewSel.Max().GetNode() ); + aPasteOrDropInfos.nEndPara = pEditEngine->GetEditDoc().GetPos( aNewSel.Max().GetNode() ); pEditEngine->HandleEndPasteOrDrop(aPasteOrDropInfos); SetEditSelection( aNewSel ); @@ -1850,8 +1850,8 @@ void ImpEditView::dragOver( const ::com::sun::star::datatransfer::dnd::DropTarge if ( pDragAndDropInfo->bOutlinerMode ) { sal_uInt16 nPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() ); - ParaPortion* pPPortion = pEditEngine->pImpEditEngine->GetParaPortions().SafeGetObject( nPara ); - long nDestParaStartY = pEditEngine->pImpEditEngine->GetParaPortions().GetYOffset( pPPortion ); + ParaPortion* pPPortion = pEditEngine->GetParaPortions().SafeGetObject( nPara ); + long nDestParaStartY = pEditEngine->GetParaPortions().GetYOffset( pPPortion ); long nRel = aDocPos.Y() - nDestParaStartY; if ( nRel < ( pPPortion->GetHeight() / 2 ) ) { @@ -1886,10 +1886,10 @@ void ImpEditView::dragOver( const ::com::sun::star::datatransfer::dnd::DropTarge if ( pDragAndDropInfo->bOutlinerMode ) { long nDDYPos; - if ( pDragAndDropInfo->nOutlinerDropDest < pEditEngine->pImpEditEngine->GetEditDoc().Count() ) + if ( pDragAndDropInfo->nOutlinerDropDest < pEditEngine->GetEditDoc().Count() ) { - ParaPortion* pPPortion = pEditEngine->pImpEditEngine->GetParaPortions().SafeGetObject( pDragAndDropInfo->nOutlinerDropDest ); - nDDYPos = pEditEngine->pImpEditEngine->GetParaPortions().GetYOffset( pPPortion ); + ParaPortion* pPPortion = pEditEngine->GetParaPortions().SafeGetObject( pDragAndDropInfo->nOutlinerDropDest ); + nDDYPos = pEditEngine->GetParaPortions().GetYOffset( pPPortion ); } else { diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 5ce177611774..4edfee58b6a3 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -65,7 +65,6 @@ DBG_NAMEEX( EditView ) DBG_NAMEEX( EditEngine ) -#define PIMPEE pImpEditView->pEditEngine->pImpEditEngine #define PIMPE pImpEditView->pEditEngine #define DEL_LEFT 1 @@ -674,25 +673,25 @@ private: SpellInfo * CreateSpellInfo( const EditSelection &rSel, bool bMultipleDocs ); ImpEditEngine(); // disabled + ImpEditEngine(EditEngine* pEditEngine, SfxItemPool* pPool); + void InitDoc(bool bKeepParaAttribs); + EditDoc& GetEditDoc() { return aEditDoc; } + const EditDoc& GetEditDoc() const { return aEditDoc; } + + const ParaPortionList& GetParaPortions() const { return aParaPortionList; } + ParaPortionList& GetParaPortions() { return aParaPortionList; } protected: virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); public: - ImpEditEngine( EditEngine* pEditEngine, SfxItemPool* pPool ); ~ImpEditEngine(); - void InitDoc( sal_Bool bKeepParaAttribs ); - EditDoc& GetEditDoc() { return aEditDoc; } - const EditDoc& GetEditDoc() const { return aEditDoc; } - inline EditUndoManager& GetUndoManager(); void SetUpdateMode( sal_Bool bUp, EditView* pCurView = 0, sal_Bool bForceUpdate = sal_False ); bool GetUpdateMode() const { return bUpdate; } - const ParaPortionList& GetParaPortions() const { return aParaPortionList; } - ParaPortionList& GetParaPortions() { return aParaPortionList; } ViewsType& GetEditViews() { return aEditViews; } const ViewsType& GetEditViews() const { return aEditViews; } diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 66671c2bd1d8..202b8fa56a05 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -236,7 +236,7 @@ void ImpEditEngine::SetRefMapMode( const MapMode& rMapMode ) } } -void ImpEditEngine::InitDoc( sal_Bool bKeepParaAttribs ) +void ImpEditEngine::InitDoc(bool bKeepParaAttribs) { sal_uInt16 nParas = aEditDoc.Count(); for ( sal_uInt16 n = bKeepParaAttribs ? 1 : 0; n < nParas; n++ ) diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 2d14262826bf..1da4ef7b5f47 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -442,7 +442,8 @@ SfxItemSet ImpEditEngine::GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_u if ( nFlags & GETATTRIBS_CHARATTRIBS ) { // Make testing easier... - pNode->GetCharAttribs().OptimizeRanges( ((ImpEditEngine*)this)->GetEditDoc().GetItemPool() ); + const SfxItemPool& rPool = GetEditDoc().GetItemPool(); + pNode->GetCharAttribs().OptimizeRanges(const_cast<SfxItemPool&>(rPool)); const CharAttribList::AttribsType& rAttrs = pNode->GetCharAttribs().GetAttribs(); for (size_t nAttr = 0; nAttr < rAttrs.size(); ++nAttr) diff --git a/editeng/source/editeng/textconv.cxx b/editeng/source/editeng/textconv.cxx index a8f46c04cfbf..e444b036daa9 100644 --- a/editeng/source/editeng/textconv.cxx +++ b/editeng/source/editeng/textconv.cxx @@ -163,17 +163,18 @@ sal_Bool TextConvWrapper::ConvMore_impl() { // modified version of SvxSpellWrapper::SpellMore - sal_Bool bMore = sal_False; + bool bMore = false; + EditEngine* pEE = pEditView->GetEditEngine(); ImpEditEngine* pImpEE = pEditView->GetImpEditEngine(); ConvInfo* pConvInfo = pImpEE->GetConvInfo(); if ( pConvInfo->bMultipleDoc ) { - bMore = pImpEE->GetEditEnginePtr()->ConvertNextDocument(); + bMore = pEE->ConvertNextDocument(); if ( bMore ) { // The text has been entered in this engine ... pEditView->GetImpEditView()->SetEditSelection( - pImpEE->GetEditDoc().GetStartPaM() ); + pEE->GetEditDoc().GetStartPaM() ); } } return bMore; @@ -184,6 +185,7 @@ void TextConvWrapper::ConvStart_impl( SvxSpellArea eArea ) { // modified version of EditSpellWrapper::SpellStart + EditEngine* pEE = pEditView->GetEditEngine(); ImpEditEngine* pImpEE = pEditView->GetImpEditEngine(); ConvInfo* pConvInfo = pImpEE->GetConvInfo(); @@ -196,13 +198,13 @@ void TextConvWrapper::ConvStart_impl( SvxSpellArea eArea ) pConvInfo->aConvTo = pConvInfo->aConvStart; pConvInfo->aConvContinue = EPaM( 0, 0 ); pEditView->GetImpEditView()->SetEditSelection( - pImpEE->GetEditDoc().GetStartPaM() ); + pEE->GetEditDoc().GetStartPaM() ); } else { pConvInfo->bConvToEnd = sal_True; pConvInfo->aConvTo = pImpEE->CreateEPaM( - pImpEE->GetEditDoc().GetStartPaM() ); + pEE->GetEditDoc().GetStartPaM() ); } } else if ( eArea == SVX_SPELL_BODY_END ) @@ -220,7 +222,7 @@ void TextConvWrapper::ConvStart_impl( SvxSpellArea eArea ) { // nothing selected: convert to end of document pConvInfo->aConvTo = pImpEE->CreateEPaM( - pImpEE->GetEditDoc().GetEndPaM() ); + pEE->GetEditDoc().GetEndPaM() ); } } else if ( eArea == SVX_SPELL_BODY ) @@ -228,7 +230,7 @@ void TextConvWrapper::ConvStart_impl( SvxSpellArea eArea ) // called by ConvNext_impl... pConvInfo->aConvContinue = pConvInfo->aConvStart; pConvInfo->aConvTo = pImpEE->CreateEPaM( - pImpEE->GetEditDoc().GetEndPaM() ); + pEE->GetEditDoc().GetEndPaM() ); } else { |