diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-13 16:32:05 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-13 23:35:50 -0400 |
commit | e95eb1b22126db5b73fba1ff9a80dbce524ab1c7 (patch) | |
tree | e0df400f68ab6999966c9033f447b32f28870666 /editeng | |
parent | ff887e882164ed8b5c8f08b4db48c99146c15b9c (diff) |
EditView is no longer a friend of ImpEditEngine.
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editeng/editeng.hxx | 99 | ||||
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 63 | ||||
-rw-r--r-- | editeng/source/editeng/editview.cxx | 28 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 2 |
4 files changed, 144 insertions, 48 deletions
diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx index 6b6ea94ce0c3..0983ea0f1fb0 100644 --- a/editeng/inc/editeng/editeng.hxx +++ b/editeng/inc/editeng/editeng.hxx @@ -29,6 +29,41 @@ #ifndef _MyEDITENG_HXX #define _MyEDITENG_HXX +#include <rtl/ref.hxx> +#include <vector> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/i18n/WordType.hpp> + +#include <rsc/rscsfx.hxx> +#include <editeng/editdata.hxx> +#include <i18npool/lang.h> +#include "editeng/editengdllapi.h" + +#include <tools/rtti.hxx> // due to typedef TypeId + +#include <editeng/eedata.hxx> + +namespace com { namespace sun { namespace star { + namespace linguistic2 { + class XSpellChecker1; + class XHyphenator; + } + namespace datatransfer { + class XTransferable; + } + namespace lang { + struct Locale; + } +}}} + +namespace svx { +struct SpellPortion; +typedef std::vector<SpellPortion> SpellPortions; +} + +namespace svl { class IUndoManager; } +namespace basegfx { class B2DPolyPolygon; } + class ImpEditEngine; class EditView; class OutputDevice; @@ -62,41 +97,11 @@ class SvKeyValueIterator; class SvxForbiddenCharactersTable; class SvxNumberFormat; class FontList; - -#include <rtl/ref.hxx> -#include <vector> -#include <com/sun/star/uno/Reference.h> - -namespace com { namespace sun { namespace star { - namespace linguistic2 { - class XSpellChecker1; - class XHyphenator; - } - namespace datatransfer { - class XTransferable; - } - namespace lang { - struct Locale; - } -}}} -namespace svx{ -struct SpellPortion; -typedef std::vector<SpellPortion> SpellPortions; -} -namespace svl{ -class IUndoManager; -} - -namespace basegfx { class B2DPolyPolygon; } -#include <rsc/rscsfx.hxx> -#include <editeng/editdata.hxx> -#include <i18npool/lang.h> -#include "editeng/editengdllapi.h" - -#include <tools/rtti.hxx> // due to typedef TypeId - -#include <editeng/eedata.hxx> class SvxFieldData; +class ContentNode; +class ParaPortion; +class EditSelection; +class EditPaM; ////////////////////////////////////////////////////////////////////////////// @@ -125,6 +130,32 @@ private: EDITENG_DLLPRIVATE EditEngine& operator=( const EditEngine& ); EDITENG_DLLPRIVATE sal_uInt8 PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pView, Window* pFrameWin = NULL ); + EDITENG_DLLPRIVATE void CursorMoved(ContentNode* pPrevNode); + EDITENG_DLLPRIVATE void CheckIdleFormatter(); + EDITENG_DLLPRIVATE ParaPortion* FindParaPortion(ContentNode* pNode); + EDITENG_DLLPRIVATE const ParaPortion* FindParaPortion(ContentNode* pNode) const; + EDITENG_DLLPRIVATE const ParaPortion* GetPrevVisPortion(const ParaPortion* pCurPortion) const; + EDITENG_DLLPRIVATE const ParaPortion* GetNextVisPortion(const ParaPortion* pCurPortion) const; + EDITENG_DLLPRIVATE sal_uInt16 GetScriptType(const EditSelection& rSel) const; + + EDITENG_DLLPRIVATE com::sun::star::uno::Reference< + com::sun::star::datatransfer::XTransferable> + CreateTransferable(const EditSelection& rSelection); + + EDITENG_DLLPRIVATE EditSelection InsertText( + com::sun::star::uno::Reference<com::sun::star::datatransfer::XTransferable >& rxDataObj, + const String& rBaseURL, const EditPaM& rPaM, bool bUseSpecial); + + EDITENG_DLLPRIVATE EditPaM EndOfWord( + const EditPaM& rPaM, sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES); + + EDITENG_DLLPRIVATE EditPaM GetPaM(const Point& aDocPos, bool bSmart = true); + + EDITENG_DLLPRIVATE EditSelection SelectWord( + const EditSelection& rCurSelection, + sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES, + bool bAcceptStartOfWord = true); + protected: diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 558852f50791..3eabb7511bdf 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -683,6 +683,69 @@ ESelection EditEngine::GetWord( const ESelection& rSelection, sal_uInt16 nWordTy return pE->pImpEditEngine->CreateESel( aSel ); } +void EditEngine::CursorMoved(ContentNode* pPrevNode) +{ + pImpEditEngine->CursorMoved(pPrevNode); +} + +void EditEngine::CheckIdleFormatter() +{ + pImpEditEngine->CheckIdleFormatter(); +} + +ParaPortion* EditEngine::FindParaPortion(ContentNode* pNode) +{ + return pImpEditEngine->FindParaPortion(pNode); +} + +const ParaPortion* EditEngine::FindParaPortion(ContentNode* pNode) const +{ + return pImpEditEngine->FindParaPortion(pNode); +} + +const ParaPortion* EditEngine::GetPrevVisPortion(const ParaPortion* pCurPortion) const +{ + return pImpEditEngine->GetPrevVisPortion(pCurPortion); +} + +const ParaPortion* EditEngine::GetNextVisPortion(const ParaPortion* pCurPortion) const +{ + return pImpEditEngine->GetNextVisPortion(pCurPortion); +} + +sal_uInt16 EditEngine::GetScriptType(const EditSelection& rSel) const +{ + return pImpEditEngine->GetScriptType(rSel); +} + +uno::Reference<datatransfer::XTransferable> EditEngine::CreateTransferable(const EditSelection& rSelection) +{ + return pImpEditEngine->CreateTransferable(rSelection); +} + +EditSelection EditEngine::InsertText( + uno::Reference<datatransfer::XTransferable >& rxDataObj, + const String& rBaseURL, const EditPaM& rPaM, bool bUseSpecial) +{ + return pImpEditEngine->InsertText(rxDataObj, rBaseURL, rPaM, bUseSpecial); +} + +EditPaM EditEngine::EndOfWord(const EditPaM& rPaM, sal_Int16 nWordType) +{ + return pImpEditEngine->EndOfWord(rPaM, nWordType); +} + +EditPaM EditEngine::GetPaM(const Point& aDocPos, bool bSmart) +{ + return pImpEditEngine->GetPaM(aDocPos, bSmart); +} + +EditSelection EditEngine::SelectWord( + const EditSelection& rCurSelection, sal_Int16 nWordType, bool bAcceptStartOfWord) +{ + return pImpEditEngine->SelectWord(rCurSelection, nWordType, bAcceptStartOfWord); +} + sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, Window* pFrameWin ) { DBG_CHKTHIS( EditEngine, 0 ); diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 81f028465290..bde47413f3e2 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -230,25 +230,25 @@ void EditView::SetSelection( const ESelection& rESel ) if ( !pImpEditView->GetEditSelection().HasRange() ) { ContentNode* pNode = pImpEditView->GetEditSelection().Max().GetNode(); - PIMPEE->CursorMoved( pNode ); + PIMPE->CursorMoved( pNode ); } EditSelection aNewSelection( PIMPEE->ConvertSelection( rESel.nStartPara, rESel.nStartPos, rESel.nEndPara, rESel.nEndPos ) ); // If the selection is manipulated after a KeyInput: - PIMPEE->CheckIdleFormatter(); + PIMPE->CheckIdleFormatter(); // Selection may not start/end at an invisible paragraph: - const ParaPortion* pPortion = PIMPEE->FindParaPortion( aNewSelection.Min().GetNode() ); + const ParaPortion* pPortion = PIMPE->FindParaPortion( aNewSelection.Min().GetNode() ); if ( !pPortion->IsVisible() ) { - pPortion = PIMPEE->GetPrevVisPortion( pPortion ); + pPortion = PIMPE->GetPrevVisPortion( pPortion ); ContentNode* pNode = pPortion ? pPortion->GetNode() : PIMPEE->GetEditDoc().GetObject( 0 ); aNewSelection.Min() = EditPaM( pNode, pNode->Len() ); } - pPortion = PIMPEE->FindParaPortion( aNewSelection.Max().GetNode() ); + pPortion = PIMPE->FindParaPortion( aNewSelection.Max().GetNode() ); if ( !pPortion->IsVisible() ) { - pPortion = PIMPEE->GetPrevVisPortion( pPortion ); + pPortion = PIMPE->GetPrevVisPortion( pPortion ); ContentNode* pNode = pPortion ? pPortion->GetNode() : PIMPEE->GetEditDoc().GetObject( 0 ); aNewSelection.Max() = EditPaM( pNode, pNode->Len() ); } @@ -293,7 +293,7 @@ sal_uInt16 EditView::GetSelectedScriptType() const { DBG_CHKTHIS( EditView, 0 ); DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); - return PIMPEE->GetScriptType( pImpEditView->GetEditSelection() ); + return PIMPE->GetScriptType( pImpEditView->GetEditSelection() ); } void EditView::Paint( const Rectangle& rRect ) @@ -580,7 +580,8 @@ void EditView::Cut() ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > EditView::GetTransferable() { - uno::Reference< datatransfer::XTransferable > xData = GetEditEngine()->pImpEditEngine->CreateTransferable( pImpEditView->GetEditSelection() ); + uno::Reference< datatransfer::XTransferable > xData = + GetEditEngine()->CreateTransferable( pImpEditView->GetEditSelection() ); return xData; } @@ -705,7 +706,8 @@ void EditView::InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::d PIMPEE->UndoActionStart( EDITUNDO_INSERT ); pImpEditView->DeleteSelected(); - EditSelection aTextSel( PIMPEE->InsertText( xDataObj, rBaseURL, pImpEditView->GetEditSelection().Max(), bUseSpecial ) ); + EditSelection aTextSel = + PIMPE->InsertText(xDataObj, rBaseURL, pImpEditView->GetEditSelection().Max(), bUseSpecial); PIMPEE->UndoActionEnd( EDITUNDO_INSERT ); aTextSel.Min() = aTextSel.Max(); // Selection not retained. @@ -799,7 +801,7 @@ void EditView::CompleteAutoCorrect( Window* pFrameWin ) { pImpEditView->DrawSelection(); EditSelection aSel = pImpEditView->GetEditSelection(); - aSel = PIMPEE->EndOfWord( aSel.Max() ); + aSel = PIMPE->EndOfWord( aSel.Max() ); aSel = PIMPEE->AutoCorrect( aSel, 0, !IsInsertMode(), pFrameWin ); pImpEditView->SetEditSelection( aSel ); if ( PIMPEE->IsModified() ) @@ -864,7 +866,7 @@ sal_Bool EditView::IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMa DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); Point aPos ( pImpEditView->GetWindow()->PixelToLogic( rPosPixel ) ); aPos = pImpEditView->GetDocPos( aPos ); - EditPaM aPaM = pImpEditView->pEditEngine->pImpEditEngine->GetPaM( aPos, sal_False ); + EditPaM aPaM = pImpEditView->pEditEngine->GetPaM(aPos, false); return pImpEditView->IsWrongSpelledWord( aPaM , bMarkIfWrong ); } @@ -895,7 +897,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) Point aPos ( pImpEditView->GetWindow()->PixelToLogic( rPosPixel ) ); aPos = pImpEditView->GetDocPos( aPos ); - EditPaM aPaM = pImpEditView->pEditEngine->pImpEditEngine->GetPaM( aPos, sal_False ); + EditPaM aPaM = pImpEditView->pEditEngine->GetPaM(aPos, false); Reference< XSpellChecker1 > xSpeller( PIMPEE->GetSpeller() ); ESelection aOldSel = GetSelection(); if ( xSpeller.is() && pImpEditView->IsWrongSpelledWord( aPaM, sal_True ) ) @@ -1171,7 +1173,7 @@ sal_Bool EditView::SelectCurrentWord( sal_Int16 nWordType ) DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); EditSelection aCurSel( pImpEditView->GetEditSelection() ); pImpEditView->DrawSelection(); - aCurSel = PIMPEE->SelectWord( aCurSel.Max(), nWordType ); + aCurSel = PIMPE->SelectWord(aCurSel.Max(), nWordType); pImpEditView->SetEditSelection( aCurSel ); pImpEditView->DrawSelection(); ShowCursor( sal_True, sal_False ); diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 28e1d0b72d79..c2f9a46b5d14 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -65,6 +65,7 @@ DBG_NAMEEX( EditView ) DBG_NAMEEX( EditEngine ) #define PIMPEE pImpEditView->pEditEngine->pImpEditEngine +#define PIMPE pImpEditView->pEditEngine #define DEL_LEFT 1 #define DEL_RIGHT 2 @@ -392,7 +393,6 @@ class ImpEditEngine : public SfxListener, boost::noncopyable friend class EditUndoInsertFeature; friend class EditUndoMoveParagraphs; - friend class EditView; friend class ImpEditView; friend class EditEngine; // For access to Imp-Methods friend class EditRTFParser; // For access to Imp-Methods |