[Libreoffice-commits] .: 5 commits - editeng/inc editeng/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Mon Apr 16 14:12:54 PDT 2012
editeng/inc/editeng/editeng.hxx | 55 ++++++++--
editeng/source/editeng/editeng.cxx | 98 +++++++++++++++++++
editeng/source/editeng/edtspell.cxx | 68 ++++++-------
editeng/source/editeng/edtspell.hxx | 8 -
editeng/source/editeng/eehtml.cxx | 85 ++++++++--------
editeng/source/editeng/eehtml.hxx | 13 --
editeng/source/editeng/eertfpar.cxx | 183 +++++++++++++++++++-----------------
editeng/source/editeng/eertfpar.hxx | 31 ++----
editeng/source/editeng/impedit.hxx | 5
editeng/source/editeng/impedit2.cxx | 4
editeng/source/editeng/impedit4.cxx | 7 -
11 files changed, 347 insertions(+), 210 deletions(-)
New commits:
commit 29e7777de5ee60e794ea521c7fdefb527dbf10c7
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 16 16:52:03 2012 -0400
EdtAutoCorrDoc no longer a friend of ImpEditEngine.
diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx
index e536be9..8bfe3f4 100644
--- a/editeng/inc/editeng/editeng.hxx
+++ b/editeng/inc/editeng/editeng.hxx
@@ -144,7 +144,6 @@ private:
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>
@@ -228,6 +227,7 @@ public:
EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const;
sal_uInt16 GetScriptType( const ESelection& rSelection ) const;
+ LanguageType GetLanguage(const EditPaM& rPaM) const;
LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const;
void TransliterateText( const ESelection& rSelection, sal_Int32 nTransliterationMode );
@@ -310,6 +310,7 @@ public:
::svl::IUndoManager&
GetUndoManager();
void UndoActionStart( sal_uInt16 nId );
+ void UndoActionStart(sal_uInt16 nId, const ESelection& rSel);
void UndoActionEnd( sal_uInt16 nId );
sal_Bool IsInUndo();
@@ -542,6 +543,10 @@ public:
const SfxItemSet& GetBaseParaAttribs(sal_uInt16 nPara) const;
void SetParaAttribsOnly(sal_uInt16 nPara, const SfxItemSet& rSet);
void SetAttribs(const EditSelection& rSel, const SfxItemSet& rSet, sal_uInt8 nSpecial = 0);
+
+ String GetSelected(const EditSelection& rSel, const LineEnd eParaSep = LINEEND_LF) const;
+
+ sal_uInt16 GetScriptType(const EditSelection& rSel) const;
};
#endif // _MyEDITENG_HXX
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index aff2f44..c5e1e5a 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -153,6 +153,11 @@ void EditEngine::UndoActionStart( sal_uInt16 nId )
pImpEditEngine->UndoActionStart( nId );
}
+void EditEngine::UndoActionStart(sal_uInt16 nId, const ESelection& rSel)
+{
+ pImpEditEngine->UndoActionStart(nId, rSel);
+}
+
void EditEngine::UndoActionEnd( sal_uInt16 nId )
{
DBG_CHKTHIS( EditEngine, 0 );
@@ -509,6 +514,11 @@ sal_uInt16 EditEngine::GetScriptType( const ESelection& rSelection ) const
return pImpEditEngine->GetScriptType( aSel );
}
+LanguageType EditEngine::GetLanguage(const EditPaM& rPaM) const
+{
+ return pImpEditEngine->GetLanguage(rPaM);
+}
+
LanguageType EditEngine::GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const
{
DBG_CHKTHIS( EditEngine, 0 );
@@ -859,6 +869,11 @@ void EditEngine::SetAttribs(const EditSelection& rSel, const SfxItemSet& rSet, s
pImpEditEngine->SetAttribs(rSel, rSet, nSpecial);
}
+String EditEngine::GetSelected(const EditSelection& rSel, const LineEnd eParaSep) const
+{
+ return pImpEditEngine->GetSelected(rSel, eParaSep);
+}
+
void EditEngine::HandleBeginPasteOrDrop(PasteOrDropInfos& rInfos)
{
pImpEditEngine->aBeginPasteOrDropHdl.Call(&rInfos);
diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx
index a79443d..bb06c8e 100644
--- a/editeng/source/editeng/edtspell.cxx
+++ b/editeng/source/editeng/edtspell.cxx
@@ -574,27 +574,24 @@ sal_Bool WrongList::DbgIsBuggy() const
//////////////////////////////////////////////////////////////////////
-EdtAutoCorrDoc::EdtAutoCorrDoc( ImpEditEngine* pE, ContentNode* pN,
- sal_uInt16 nCrsr, xub_Unicode cIns )
-{
- pImpEE = pE;
- pCurNode = pN;
- nCursor = nCrsr;
-
- bUndoAction = sal_False;
- bAllowUndoAction = cIns ? sal_True : sal_False;
-}
+EdtAutoCorrDoc::EdtAutoCorrDoc(
+ EditEngine* pE, ContentNode* pN, sal_uInt16 nCrsr, sal_Unicode cIns) :
+ mpEditEngine(pE),
+ pCurNode(pN),
+ nCursor(nCrsr),
+ bAllowUndoAction(cIns != 0),
+ bUndoAction(false) {}
EdtAutoCorrDoc::~EdtAutoCorrDoc()
{
if ( bUndoAction )
- pImpEE->UndoActionEnd( EDITUNDO_INSERT );
+ mpEditEngine->UndoActionEnd( EDITUNDO_INSERT );
}
sal_Bool EdtAutoCorrDoc::Delete( sal_uInt16 nStt, sal_uInt16 nEnd )
{
EditSelection aSel( EditPaM( pCurNode, nStt ), EditPaM( pCurNode, nEnd ) );
- pImpEE->ImpDeleteSelection( aSel );
+ mpEditEngine->DeleteSelection(aSel);
SAL_WARN_IF(nCursor < nEnd, "editeng",
"Cursor in the heart of the action?!");
nCursor -= ( nEnd-nStt );
@@ -605,7 +602,7 @@ sal_Bool EdtAutoCorrDoc::Delete( sal_uInt16 nStt, sal_uInt16 nEnd )
sal_Bool EdtAutoCorrDoc::Insert( sal_uInt16 nPos, const String& rTxt )
{
EditSelection aSel = EditPaM( pCurNode, nPos );
- pImpEE->ImpInsertText( aSel, rTxt );
+ mpEditEngine->InsertText(aSel, rTxt);
SAL_WARN_IF(nCursor < nPos, "editeng",
"Cursor in the heart of the action?!");
nCursor = nCursor + rTxt.Len();
@@ -630,8 +627,9 @@ sal_Bool EdtAutoCorrDoc::ReplaceRange( xub_StrLen nPos, xub_StrLen nSourceLength
nEnd = pCurNode->Len();
// #i5925# First insert new text behind to be deleted text, for keeping attributes.
- pImpEE->ImpInsertText( EditSelection( EditPaM( pCurNode, nEnd ) ), rTxt );
- pImpEE->ImpDeleteSelection( EditSelection( EditPaM( pCurNode, nPos ), EditPaM( pCurNode, nEnd ) ) );
+ mpEditEngine->InsertText(EditSelection(EditPaM(pCurNode, nEnd)), rTxt);
+ mpEditEngine->DeleteSelection(
+ EditSelection(EditPaM(pCurNode, nPos), EditPaM(pCurNode, nEnd)));
if ( nPos == nCursor )
nCursor = nCursor + rTxt.Len();
@@ -647,7 +645,7 @@ sal_Bool EdtAutoCorrDoc::ReplaceRange( xub_StrLen nPos, xub_StrLen nSourceLength
sal_Bool EdtAutoCorrDoc::SetAttr( sal_uInt16 nStt, sal_uInt16 nEnd,
sal_uInt16 nSlotId, SfxPoolItem& rItem )
{
- SfxItemPool* pPool = &pImpEE->GetEditDoc().GetItemPool();
+ SfxItemPool* pPool = &mpEditEngine->GetEditDoc().GetItemPool();
while ( pPool->GetSecondaryPool() &&
!pPool->GetName().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("EditEngineItemPool")) )
{
@@ -659,13 +657,13 @@ sal_Bool EdtAutoCorrDoc::SetAttr( sal_uInt16 nStt, sal_uInt16 nEnd,
{
rItem.SetWhich( nWhich );
- SfxItemSet aSet( pImpEE->GetEmptyItemSet() );
+ SfxItemSet aSet = mpEditEngine->GetEmptyItemSet();
aSet.Put( rItem );
EditSelection aSel( EditPaM( pCurNode, nStt ), EditPaM( pCurNode, nEnd ) );
aSel.Max().SetIndex( nEnd ); // ???
- pImpEE->SetAttribs( aSel, aSet, ATTRSPECIAL_EDGE );
- bAllowUndoAction = sal_False;
+ mpEditEngine->SetAttribs( aSel, aSet, ATTRSPECIAL_EDGE );
+ bAllowUndoAction = false;
}
return sal_True;
}
@@ -675,23 +673,23 @@ sal_Bool EdtAutoCorrDoc::SetINetAttr( sal_uInt16 nStt, sal_uInt16 nEnd,
{
// Turn the Text into a command field ...
EditSelection aSel( EditPaM( pCurNode, nStt ), EditPaM( pCurNode, nEnd ) );
- String aText = pImpEE->GetSelected( aSel );
- aSel = pImpEE->ImpDeleteSelection( aSel );
+ String aText = mpEditEngine->GetSelected(aSel);
+ aSel = mpEditEngine->DeleteSelection(aSel);
SAL_WARN_IF(nCursor < nEnd, "editeng",
"Cursor in the heart of the action?!");
nCursor -= ( nEnd-nStt );
SvxFieldItem aField( SvxURLField( rURL, aText, SVXURLFORMAT_REPR ),
EE_FEATURE_FIELD );
- pImpEE->InsertField( aSel, aField );
+ mpEditEngine->InsertField(aSel, aField);
nCursor++;
- pImpEE->UpdateFields();
- bAllowUndoAction = sal_False;
+ mpEditEngine->UpdateFieldsOnly();
+ bAllowUndoAction = false;
return sal_True;
}
sal_Bool EdtAutoCorrDoc::HasSymbolChars( sal_uInt16 nStt, sal_uInt16 nEnd )
{
- sal_uInt16 nScriptType = pImpEE->GetScriptType( EditPaM( pCurNode, nStt ) );
+ sal_uInt16 nScriptType = mpEditEngine->GetScriptType( EditPaM( pCurNode, nStt ) );
sal_uInt16 nScriptFontInfoItemId = GetScriptItemId( EE_CHAR_FONTINFO, nScriptType );
const CharAttribList::AttribsType& rAttribs = pCurNode->GetCharAttribs().GetAttribs();
@@ -720,18 +718,18 @@ const String* EdtAutoCorrDoc::GetPrevPara( sal_Bool )
bAllowUndoAction = sal_False; // Not anymore ...
- EditDoc& rNodes = pImpEE->GetEditDoc();
+ EditDoc& rNodes = mpEditEngine->GetEditDoc();
sal_uInt16 nPos = rNodes.GetPos( pCurNode );
// Special case: Bullet => Paragraph start => simply return NULL...
const SfxBoolItem& rBulletState = (const SfxBoolItem&)
- pImpEE->GetParaAttrib( nPos, EE_PARA_BULLETSTATE );
+ mpEditEngine->GetParaAttrib( nPos, EE_PARA_BULLETSTATE );
sal_Bool bBullet = rBulletState.GetValue() ? sal_True : sal_False;
- if ( !bBullet && ( pImpEE->aStatus.GetControlWord() & EE_CNTRL_OUTLINER ) )
+ if ( !bBullet && (mpEditEngine->GetControlWord() & EE_CNTRL_OUTLINER) )
{
// The Outliner has still a Bullet at Level 0.
const SfxInt16Item& rLevel = (const SfxInt16Item&)
- pImpEE->GetParaAttrib( nPos, EE_PARA_OUTLLEVEL );
+ mpEditEngine->GetParaAttrib( nPos, EE_PARA_OUTLLEVEL );
if ( rLevel.GetValue() == 0 )
bBullet = sal_True;
}
@@ -763,18 +761,18 @@ sal_Bool EdtAutoCorrDoc::ChgAutoCorrWord( sal_uInt16& rSttPos,
if( !aShort.Len() )
return bRet;
- LanguageType eLang = pImpEE->GetLanguage( EditPaM( pCurNode, rSttPos+1 ) );
+ LanguageType eLang = mpEditEngine->GetLanguage( EditPaM( pCurNode, rSttPos+1 ) );
const SvxAutocorrWord* pFnd = rACorrect.SearchWordsInList(pCurNode->GetString(), rSttPos, nEndPos, *this, eLang);
if( pFnd && pFnd->IsTextOnly() )
{
// then replace
EditSelection aSel( EditPaM( pCurNode, rSttPos ),
EditPaM( pCurNode, nEndPos ) );
- aSel = pImpEE->ImpDeleteSelection( aSel );
+ aSel = mpEditEngine->DeleteSelection(aSel);
SAL_WARN_IF(nCursor < nEndPos, "editeng",
"Cursor in the heart of the action?!");
nCursor -= ( nEndPos-rSttPos );
- pImpEE->ImpInsertText( aSel, pFnd->GetLong() );
+ mpEditEngine->InsertText(aSel, pFnd->GetLong());
nCursor = nCursor + pFnd->GetLong().Len();
if( ppPara )
*ppPara = &pCurNode->GetString();
@@ -786,14 +784,14 @@ sal_Bool EdtAutoCorrDoc::ChgAutoCorrWord( sal_uInt16& rSttPos,
LanguageType EdtAutoCorrDoc::GetLanguage( sal_uInt16 nPos, sal_Bool ) const
{
- return pImpEE->GetLanguage( EditPaM( pCurNode, nPos+1 ) );
+ return mpEditEngine->GetLanguage( EditPaM( pCurNode, nPos+1 ) );
}
void EdtAutoCorrDoc::ImplStartUndoAction()
{
- sal_uInt16 nPara = pImpEE->GetEditDoc().GetPos( pCurNode );
+ sal_uInt16 nPara = mpEditEngine->GetEditDoc().GetPos( pCurNode );
ESelection aSel( nPara, nCursor, nPara, nCursor );
- pImpEE->UndoActionStart( EDITUNDO_INSERT, aSel );
+ mpEditEngine->UndoActionStart( EDITUNDO_INSERT, aSel );
bUndoAction = sal_True;
bAllowUndoAction = sal_False;
}
diff --git a/editeng/source/editeng/edtspell.hxx b/editeng/source/editeng/edtspell.hxx
index 52d1bbd..cd72c62 100644
--- a/editeng/source/editeng/edtspell.hxx
+++ b/editeng/source/editeng/edtspell.hxx
@@ -42,7 +42,7 @@ namespace com { namespace sun { namespace star { namespace linguistic2 {
class EditView;
-class ImpEditEngine;
+class EditEngine;
class ContentNode;
class EditSpellWrapper : public SvxSpellWrapper
@@ -136,7 +136,7 @@ public:
class EdtAutoCorrDoc : public SvxAutoCorrDoc
{
- ImpEditEngine* pImpEE;
+ EditEngine* mpEditEngine;
ContentNode* pCurNode;
sal_uInt16 nCursor;
@@ -147,8 +147,8 @@ protected:
void ImplStartUndoAction();
public:
- EdtAutoCorrDoc( ImpEditEngine* pImpEE, ContentNode* pCurNode, sal_uInt16 nCrsr, xub_Unicode cIns );
- ~EdtAutoCorrDoc();
+ EdtAutoCorrDoc(EditEngine* pE, ContentNode* pCurNode, sal_uInt16 nCrsr, sal_Unicode cIns);
+ ~EdtAutoCorrDoc();
virtual sal_Bool Delete( sal_uInt16 nStt, sal_uInt16 nEnd );
virtual sal_Bool Insert( sal_uInt16 nPos, const String& rTxt );
diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx
index 1fd928b..d1eb4f0 100644
--- a/editeng/source/editeng/eehtml.cxx
+++ b/editeng/source/editeng/eehtml.cxx
@@ -86,7 +86,7 @@ EditHTMLParser::~EditHTMLParser()
SvParserState EditHTMLParser::CallParser(EditEngine* pEE, const EditPaM& rPaM)
{
- DBG_ASSERT( pImpEE, "CallParser: ImpEditEngine ?!" );
+ DBG_ASSERT(pEE, "CallParser: ImpEditEngine ?!");
mpEditEngine = pEE;
SvParserState _eState = SVPAR_NOTSTARTED;
if ( mpEditEngine )
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index fa2ec50..1f77f88 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -391,7 +391,6 @@ class ImpEditEngine : public SfxListener, boost::noncopyable
friend class EditUndoMoveParagraphs;
friend class EditEngine; // For access to Imp-Methods
- friend class EdtAutoCorrDoc; // For access to Imp-Methods
friend class EditDbg; // Debug Routines
public:
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index e899c65..4c1f1a8 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2573,7 +2573,7 @@ EditPaM ImpEditEngine::AutoCorrect( const EditSelection& rCurSel, xub_Unicode c,
ContentNode* pNode = aSel.Max().GetNode();
sal_uInt16 nIndex = aSel.Max().GetIndex();
- EdtAutoCorrDoc aAuto( this, pNode, nIndex, c );
+ EdtAutoCorrDoc aAuto(pEditEngine, pNode, nIndex, c);
pAutoCorrect->AutoCorrect(
aAuto, pNode->GetString(), nIndex, c, !bOverwrite, pFrameWin );
aSel.Max().SetIndex( aAuto.GetCursor() );
commit e1520a9d6a9f9bcfcaa332d54892040fe54776c2
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 16 16:14:11 2012 -0400
Let's use boost::scoped_ptr for this.
diff --git a/editeng/source/editeng/eehtml.hxx b/editeng/source/editeng/eehtml.hxx
index 71f61c8..c74f91e 100644
--- a/editeng/source/editeng/eehtml.hxx
+++ b/editeng/source/editeng/eehtml.hxx
@@ -92,9 +92,6 @@ public:
const EditSelection& GetCurSelection() const { return aCurSel; }
};
-SV_DECL_REF( EditHTMLParser )
-SV_IMPL_REF( EditHTMLParser );
-
#endif // _EEHTML_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index ea8ac7c..2b991e9 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -194,7 +194,7 @@ EditPaM ImpEditEngine::ReadHTML( SvStream& rInput, const String& rBaseURL, EditS
if ( aSel.HasRange() )
aSel = ImpDeleteSelection( aSel );
- EditHTMLParserRef xPrsr = new EditHTMLParser( rInput, rBaseURL, pHTTPHeaderAttrs );
+ boost::scoped_ptr<EditHTMLParser> xPrsr(new EditHTMLParser(rInput, rBaseURL, pHTTPHeaderAttrs));
SvParserState eState = xPrsr->CallParser(pEditEngine, aSel.Max());
if ( ( eState != SVPAR_ACCEPTED ) && ( !rInput.GetError() ) )
{
commit 09cc69d0993a887a37ae438bc63d4d530388bd29
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 16 16:12:16 2012 -0400
EditHTMLParser is no loger a friend of ImpEditEngine.
diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx
index 6a4a2f7..1fd928b 100644
--- a/editeng/source/editeng/eehtml.cxx
+++ b/editeng/source/editeng/eehtml.cxx
@@ -32,7 +32,6 @@
#include <vcl/msgbox.hxx>
#include <vcl/svapp.hxx>
#include <eehtml.hxx>
-#include <impedit.hxx>
#include <editeng/adjitem.hxx>
#include <editeng/flditem.hxx>
#include <tools/urlobj.hxx>
@@ -44,6 +43,8 @@
#include <svtools/htmlkywd.hxx>
#include <tools/tenccvt.hxx>
+#include "editeng/editeng.hxx"
+
#define ACTION_INSERTTEXT 1
#define ACTION_INSERTPARABRK 2
@@ -52,7 +53,7 @@
EditHTMLParser::EditHTMLParser( SvStream& rIn, const String& rBaseURL, SvKeyValueIterator* pHTTPHeaderAttrs )
: HTMLParser( rIn, true ),
aBaseURL( rBaseURL ),
- pImpEditEngine(NULL),
+ mpEditEngine(NULL),
pCurAnchor(NULL),
bInPara(false),
bWasInPara(false),
@@ -83,33 +84,33 @@ EditHTMLParser::~EditHTMLParser()
delete pCurAnchor;
}
-SvParserState EditHTMLParser::CallParser( ImpEditEngine* pImpEE, const EditPaM& rPaM )
+SvParserState EditHTMLParser::CallParser(EditEngine* pEE, const EditPaM& rPaM)
{
DBG_ASSERT( pImpEE, "CallParser: ImpEditEngine ?!" );
- pImpEditEngine = pImpEE;
+ mpEditEngine = pEE;
SvParserState _eState = SVPAR_NOTSTARTED;
- if ( pImpEditEngine )
+ if ( mpEditEngine )
{
// Build in wrap mimic in RTF import?
aCurSel = EditSelection( rPaM, rPaM );
- if ( pImpEditEngine->aImportHdl.IsSet() )
+ if (mpEditEngine->IsImportHandlerSet())
{
- ImportInfo aImportInfo( HTMLIMP_START, this, pImpEditEngine->CreateESel( aCurSel ) );
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
+ ImportInfo aImportInfo(HTMLIMP_START, this, mpEditEngine->CreateESelection(aCurSel));
+ mpEditEngine->CallImportHandler(aImportInfo);
}
ImpSetStyleSheet( 0 );
_eState = HTMLParser::CallParser();
- if ( pImpEditEngine->aImportHdl.IsSet() )
+ if (mpEditEngine->IsImportHandlerSet())
{
- ImportInfo aImportInfo( HTMLIMP_END, this, pImpEditEngine->CreateESel( aCurSel ) );
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
+ ImportInfo aImportInfo(HTMLIMP_END, this, mpEditEngine->CreateESelection(aCurSel));
+ mpEditEngine->CallImportHandler(aImportInfo);
}
if ( bFieldsInserted )
- pImpEditEngine->UpdateFields();
+ mpEditEngine->UpdateFieldsOnly();
}
return _eState;
}
@@ -233,12 +234,12 @@ void EditHTMLParser::NextToken( int nToken )
case HTML_CENTER_ON:
case HTML_CENTER_OFF:
{
- sal_uInt16 nNode = pImpEditEngine->GetEditDoc().GetPos( aCurSel.Max().GetNode() );
+ sal_uInt16 nNode = mpEditEngine->GetEditDoc().GetPos( aCurSel.Max().GetNode() );
SfxItemSet aItems( aCurSel.Max().GetNode()->GetContentAttribs().GetItems() );
aItems.ClearItem( EE_PARA_JUST );
if ( nToken == HTML_CENTER_ON )
aItems.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) );
- pImpEditEngine->SetParaAttribs( nNode, aItems );
+ mpEditEngine->SetParaAttribsOnly(nNode, aItems);
}
break;
@@ -511,28 +512,28 @@ void EditHTMLParser::NextToken( int nToken )
}
} // SWITCH
- if ( pImpEditEngine->aImportHdl.IsSet() )
+ if (mpEditEngine->IsImportHandlerSet())
{
- ImportInfo aImportInfo( HTMLIMP_NEXTTOKEN, this, pImpEditEngine->CreateESel( aCurSel ) );
+ ImportInfo aImportInfo(HTMLIMP_NEXTTOKEN, this, mpEditEngine->CreateESelection(aCurSel));
aImportInfo.nToken = nToken;
aImportInfo.nTokenValue = (short)nTokenValue;
if ( nToken == HTML_TEXTTOKEN )
aImportInfo.aText = aToken;
else if (nToken == HTML_STYLE_OFF)
aImportInfo.aText = maStyleSource.makeStringAndClear();
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
+ mpEditEngine->CallImportHandler(aImportInfo);
}
}
void EditHTMLParser::ImpInsertParaBreak()
{
- if ( pImpEditEngine->aImportHdl.IsSet() )
+ if (mpEditEngine->IsImportHandlerSet())
{
- ImportInfo aImportInfo( HTMLIMP_INSERTPARA, this, pImpEditEngine->CreateESel( aCurSel ) );
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
+ ImportInfo aImportInfo(HTMLIMP_INSERTPARA, this, mpEditEngine->CreateESelection(aCurSel));
+ mpEditEngine->CallImportHandler(aImportInfo);
}
- aCurSel = pImpEditEngine->ImpInsertParaBreak( aCurSel );
+ aCurSel = mpEditEngine->InsertParaBreak(aCurSel);
}
void EditHTMLParser::ImpSetAttribs( const SfxItemSet& rItems, EditSelection* pSel )
@@ -550,16 +551,16 @@ void EditHTMLParser::ImpSetAttribs( const SfxItemSet& rItems, EditSelection* pSe
aEndPaM.SetIndex( aEndPaM.GetNode()->Len() );
}
- if ( pImpEditEngine->aImportHdl.IsSet() )
+ if (mpEditEngine->IsImportHandlerSet())
{
EditSelection aSel( aStartPaM, aEndPaM );
- ImportInfo aImportInfo( HTMLIMP_SETATTR, this, pImpEditEngine->CreateESel( aSel ) );
+ ImportInfo aImportInfo(HTMLIMP_SETATTR, this, mpEditEngine->CreateESelection(aSel));
aImportInfo.pAttrs = (void*)&rItems;
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
+ mpEditEngine->CallImportHandler(aImportInfo);
}
ContentNode* pSN = aStartPaM.GetNode();
- sal_uInt16 nStartNode = pImpEditEngine->GetEditDoc().GetPos( pSN );
+ sal_uInt16 nStartNode = mpEditEngine->GetEditDoc().GetPos( pSN );
// If an attribute goes from 0 to current Paragraph length,
// then it should be a paragraph attribute!
@@ -570,19 +571,19 @@ void EditHTMLParser::ImpSetAttribs( const SfxItemSet& rItems, EditSelection* pSe
// not really HTML:
#ifdef DBG_UTIL
ContentNode* pEN = aEndPaM.GetNode();
- sal_uInt16 nEndNode = pImpEditEngine->GetEditDoc().GetPos( pEN );
+ sal_uInt16 nEndNode = mpEditEngine->GetEditDoc().GetPos( pEN );
DBG_ASSERT( nStartNode == nEndNode, "ImpSetAttribs: Several paragraphs?" );
#endif
if ( ( aStartPaM.GetIndex() == 0 ) && ( aEndPaM.GetIndex() == aEndPaM.GetNode()->Len() ) )
{
// Has to be merged:
- SfxItemSet aItems( pImpEditEngine->GetParaAttribs( nStartNode ) );
+ SfxItemSet aItems = mpEditEngine->GetBaseParaAttribs(nStartNode);
aItems.Put( rItems );
- pImpEditEngine->SetParaAttribs( nStartNode, aItems );
+ mpEditEngine->SetParaAttribsOnly(nStartNode, aItems);
}
else
- pImpEditEngine->SetAttribs( EditSelection( aStartPaM, aEndPaM ), rItems );
+ mpEditEngine->SetAttribs( EditSelection( aStartPaM, aEndPaM ), rItems );
}
void EditHTMLParser::ImpSetStyleSheet( sal_uInt16 nHLevel )
@@ -596,7 +597,7 @@ void EditHTMLParser::ImpSetStyleSheet( sal_uInt16 nHLevel )
// Enough for Calc, would have to be clarified with StyleSheets
// that they should also be in the app so that when they are feed
// in a different engine still are here ...
- sal_uInt16 nNode = pImpEditEngine->GetEditDoc().GetPos( aCurSel.Max().GetNode() );
+ sal_uInt16 nNode = mpEditEngine->GetEditDoc().GetPos( aCurSel.Max().GetNode() );
SfxItemSet aItems( aCurSel.Max().GetNode()->GetContentAttribs().GetItems() );
@@ -628,7 +629,7 @@ void EditHTMLParser::ImpSetStyleSheet( sal_uInt16 nHLevel )
}
// Font hight and margins, when LogicToLogic is possible:
- MapUnit eUnit = pImpEditEngine->GetRefMapMode().GetMapUnit();
+ MapUnit eUnit = mpEditEngine->GetRefMapMode().GetMapUnit();
if ( ( eUnit != MAP_PIXEL ) && ( eUnit != MAP_SYSFONT ) &&
( eUnit != MAP_APPFONT ) && ( eUnit != MAP_RELATIVE ) )
{
@@ -677,20 +678,20 @@ void EditHTMLParser::ImpSetStyleSheet( sal_uInt16 nHLevel )
aItems.Put( aFontItemCTL );
}
- pImpEditEngine->SetParaAttribs( nNode, aItems );
+ mpEditEngine->SetParaAttribsOnly(nNode, aItems);
}
void EditHTMLParser::ImpInsertText( const String& rText )
{
String aText( rText );
- if ( pImpEditEngine->aImportHdl.IsSet() )
+ if (mpEditEngine->IsImportHandlerSet())
{
- ImportInfo aImportInfo( HTMLIMP_INSERTTEXT, this, pImpEditEngine->CreateESel( aCurSel ) );
+ ImportInfo aImportInfo(HTMLIMP_INSERTTEXT, this, mpEditEngine->CreateESelection(aCurSel));
aImportInfo.aText = aText;
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
+ mpEditEngine->CallImportHandler(aImportInfo);
}
- aCurSel = pImpEditEngine->ImpInsertText( aCurSel, aText );
+ aCurSel = mpEditEngine->InsertText(aCurSel, aText);
}
void EditHTMLParser::SkipGroup( int nEndToken )
@@ -742,7 +743,7 @@ void EditHTMLParser::StartPara( bool bReal )
break;
}
}
- SfxItemSet aItemSet( pImpEditEngine->GetEmptyItemSet() );
+ SfxItemSet aItemSet = mpEditEngine->GetEmptyItemSet();
aItemSet.Put( SvxAdjustItem( eAdjust, EE_PARA_JUST ) );
ImpSetAttribs( aItemSet );
}
@@ -816,15 +817,15 @@ void EditHTMLParser::AnchorEnd()
{
// Insert as URL-Field...
SvxFieldItem aFld( SvxURLField( pCurAnchor->aHRef, pCurAnchor->aText, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD );
- aCurSel = pImpEditEngine->InsertField( aCurSel, aFld );
+ aCurSel = mpEditEngine->InsertField(aCurSel, aFld);
bFieldsInserted = true;
delete pCurAnchor;
pCurAnchor = NULL;
- if ( pImpEditEngine->aImportHdl.IsSet() )
+ if (mpEditEngine->IsImportHandlerSet())
{
- ImportInfo aImportInfo( HTMLIMP_INSERTFIELD, this, pImpEditEngine->CreateESel( aCurSel ) );
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
+ ImportInfo aImportInfo(HTMLIMP_INSERTFIELD, this, mpEditEngine->CreateESelection(aCurSel));
+ mpEditEngine->CallImportHandler(aImportInfo);
}
}
}
diff --git a/editeng/source/editeng/eehtml.hxx b/editeng/source/editeng/eehtml.hxx
index 9390805..71f61c8 100644
--- a/editeng/source/editeng/eehtml.hxx
+++ b/editeng/source/editeng/eehtml.hxx
@@ -34,7 +34,7 @@
#include <editdoc.hxx>
#include <svtools/parhtml.hxx>
-class ImpEditEngine;
+class EditEngine;
#define MAX_NUMBERLEVEL 10
@@ -51,7 +51,7 @@ private:
::rtl::OUStringBuffer maStyleSource;
EditSelection aCurSel;
String aBaseURL;
- ImpEditEngine* pImpEditEngine;
+ EditEngine* mpEditEngine;
AnchorInfo* pCurAnchor;
bool bInPara:1;
@@ -84,10 +84,10 @@ protected:
virtual void NextToken( int nToken );
public:
- EditHTMLParser( SvStream& rIn, const String& rBaseURL, SvKeyValueIterator* pHTTPHeaderAttrs );
- ~EditHTMLParser();
+ EditHTMLParser(SvStream& rIn, const String& rBaseURL, SvKeyValueIterator* pHTTPHeaderAttrs);
+ ~EditHTMLParser();
- virtual SvParserState CallParser( ImpEditEngine* pImpEE, const EditPaM& rPaM );
+ SvParserState CallParser(EditEngine* pEE, const EditPaM& rPaM);
const EditSelection& GetCurSelection() const { return aCurSel; }
};
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 1a3b471..fa2ec50 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -391,7 +391,6 @@ class ImpEditEngine : public SfxListener, boost::noncopyable
friend class EditUndoMoveParagraphs;
friend class EditEngine; // For access to Imp-Methods
- friend class EditHTMLParser; // For access to Imp-Methods
friend class EdtAutoCorrDoc; // For access to Imp-Methods
friend class EditDbg; // Debug Routines
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index c8f7a7f..ea8ac7c 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -195,7 +195,7 @@ EditPaM ImpEditEngine::ReadHTML( SvStream& rInput, const String& rBaseURL, EditS
aSel = ImpDeleteSelection( aSel );
EditHTMLParserRef xPrsr = new EditHTMLParser( rInput, rBaseURL, pHTTPHeaderAttrs );
- SvParserState eState = xPrsr->CallParser( this, aSel.Max() );
+ SvParserState eState = xPrsr->CallParser(pEditEngine, aSel.Max());
if ( ( eState != SVPAR_ACCEPTED ) && ( !rInput.GetError() ) )
{
rInput.SetError( EE_READWRITE_WRONGFORMAT );
commit a4bc804627b8b21506e9b86fa54d2f7d2525e43e
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 16 15:02:58 2012 -0400
Use boost::scoped_ptr for this.
diff --git a/editeng/source/editeng/eertfpar.hxx b/editeng/source/editeng/eertfpar.hxx
index df27f20..5b69074 100644
--- a/editeng/source/editeng/eertfpar.hxx
+++ b/editeng/source/editeng/eertfpar.hxx
@@ -120,10 +120,6 @@ public:
EditPaM GetCurPaM() const { return aCurSel.Max(); }
};
-SV_DECL_REF( EditRTFParser )
-SV_IMPL_REF( EditRTFParser );
-
-
#endif //_EERTFPAR_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 5fdfe90..c8f7a7f 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -86,6 +86,7 @@
#include <editeng/edtdlg.hxx>
#include <vector>
+#include <boost/scoped_ptr.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -178,7 +179,7 @@ EditPaM ImpEditEngine::ReadRTF( SvStream& rInput, EditSelection aSel )
DBG_ASSERT(pPool && pPool->GetName().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("EditEngineItemPool")),
"ReadRTF: no EditEnginePool!");
- EditRTFParserRef xPrsr = new EditRTFParser(rInput, aSel, *pPool, pEditEngine);
+ boost::scoped_ptr<EditRTFParser> xPrsr(new EditRTFParser(rInput, aSel, *pPool, pEditEngine));
SvParserState eState = xPrsr->CallParser();
if ( ( eState != SVPAR_ACCEPTED ) && ( !rInput.GetError() ) )
{
commit d4126868a37b52574b99dcb3680f534b3b87e537
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Apr 16 14:46:44 2012 -0400
EditRTFParser no longer a friend of ImpEditEngine.
diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx
index 8cdc6ef..e536be9 100644
--- a/editeng/inc/editeng/editeng.hxx
+++ b/editeng/inc/editeng/editeng.hxx
@@ -150,7 +150,6 @@ private:
com::sun::star::datatransfer::XTransferable>
CreateTransferable(const EditSelection& rSelection);
- EDITENG_DLLPRIVATE EditPaM InsertText(const EditSelection& aCurEditSelection, const String& rStr);
EDITENG_DLLPRIVATE EditSelection InsertText(
com::sun::star::uno::Reference<com::sun::star::datatransfer::XTransferable >& rxDataObj,
const String& rBaseURL, const EditPaM& rPaM, bool bUseSpecial);
@@ -173,17 +172,9 @@ private:
EDITENG_DLLPRIVATE bool IsFormatted() const;
- EDITENG_DLLPRIVATE EditPaM CursorRight(
- const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = com::sun::star::i18n::CharacterIteratorMode::SKIPCELL);
-
EDITENG_DLLPRIVATE sal_uInt16 GetOnePixelInRef() const;
EDITENG_DLLPRIVATE InternalEditStatus& GetInternalEditStatus();
- EDITENG_DLLPRIVATE EditDoc& GetEditDoc();
- EDITENG_DLLPRIVATE void SeekCursor(
- ContentNode* pNode, sal_uInt16 nPos, SvxFont& rFont, OutputDevice* pOut = NULL, sal_uInt16 nIgnoreWhich = 0);
-
- EDITENG_DLLPRIVATE EditPaM DeleteSelection(const EditSelection& rSel);
EDITENG_DLLPRIVATE void HandleBeginPasteOrDrop(PasteOrDropInfos& rInfos);
EDITENG_DLLPRIVATE void HandleEndPasteOrDrop(PasteOrDropInfos& rInfos);
EDITENG_DLLPRIVATE bool HasText() const;
@@ -392,6 +383,7 @@ public:
void SetStyleSheetPool( SfxStyleSheetPool* pSPool );
SfxStyleSheetPool* GetStyleSheetPool();
+ void SetStyleSheet(const EditSelection& aSel, SfxStyleSheet* pStyle);
void SetStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pStyle );
const SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara ) const;
SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara );
@@ -436,7 +428,8 @@ public:
sal_Bool HasConvertibleTextPortion( LanguageType nLang );
virtual sal_Bool ConvertNextDocument();
- sal_Bool UpdateFields();
+ bool UpdateFields();
+ bool UpdateFieldsOnly();
void RemoveFields( sal_Bool bKeepFieldText, TypeId aType = NULL );
sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const;
@@ -514,6 +507,41 @@ public:
/// specifies if auto-correction should capitalize the first word or not (default is on)
void SetFirstWordCapitalization( sal_Bool bCapitalize );
+
+ EditDoc& GetEditDoc();
+ const EditDoc& GetEditDoc() const;
+
+ bool IsImportHandlerSet() const;
+ bool IsImportRTFStyleSheetsSet() const;
+
+ void CallImportHandler(ImportInfo& rInfo);
+
+ void ParaAttribsToCharAttribs(ContentNode* pNode);
+
+ EditPaM ConnectParagraphs(
+ ContentNode* pLeft, ContentNode* pRight, bool bBackward = false);
+
+ EditPaM InsertField(const EditSelection& rEditSelection, const SvxFieldItem& rFld);
+ EditPaM InsertText(const EditSelection& aCurEditSelection, const String& rStr);
+ EditPaM InsertParaBreak(
+ const EditSelection& rEditSelection, bool bKeepEndingAttribs = true);
+ EditPaM InsertLineBreak(const EditSelection& rEditSelection);
+
+ EditPaM CursorLeft(
+ const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = com::sun::star::i18n::CharacterIteratorMode::SKIPCELL);
+ EditPaM CursorRight(
+ const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = com::sun::star::i18n::CharacterIteratorMode::SKIPCELL);
+
+ void SeekCursor(
+ ContentNode* pNode, sal_uInt16 nPos, SvxFont& rFont, OutputDevice* pOut = NULL, sal_uInt16 nIgnoreWhich = 0);
+
+ EditPaM DeleteSelection(const EditSelection& rSel);
+
+ ESelection CreateESelection(const EditSelection& rSel);
+
+ const SfxItemSet& GetBaseParaAttribs(sal_uInt16 nPara) const;
+ void SetParaAttribsOnly(sal_uInt16 nPara, const SfxItemSet& rSet);
+ void SetAttribs(const EditSelection& rSel, const SfxItemSet& rSet, sal_uInt8 nSpecial = 0);
};
#endif // _MyEDITENG_HXX
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 3868601..aff2f44 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -737,6 +737,22 @@ uno::Reference<datatransfer::XTransferable> EditEngine::CreateTransferable(const
return pImpEditEngine->CreateTransferable(rSelection);
}
+void EditEngine::ParaAttribsToCharAttribs(ContentNode* pNode)
+{
+ pImpEditEngine->ParaAttribsToCharAttribs(pNode);
+}
+
+EditPaM EditEngine::ConnectParagraphs(
+ ContentNode* pLeft, ContentNode* pRight, bool bBackward)
+{
+ return pImpEditEngine->ImpConnectParagraphs(pLeft, pRight, bBackward);
+}
+
+EditPaM EditEngine::InsertField(const EditSelection& rEditSelection, const SvxFieldItem& rFld)
+{
+ return pImpEditEngine->InsertField(rEditSelection, rFld);
+}
+
EditPaM EditEngine::InsertText(const EditSelection& aCurEditSelection, const String& rStr)
{
return pImpEditEngine->InsertText(aCurEditSelection, rStr);
@@ -782,6 +798,11 @@ bool EditEngine::IsFormatted() const
return pImpEditEngine->IsFormatted();
}
+EditPaM EditEngine::CursorLeft(const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode)
+{
+ return pImpEditEngine->CursorLeft(rPaM, nCharacterIteratorMode);
+}
+
EditPaM EditEngine::CursorRight(const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode)
{
return pImpEditEngine->CursorRight(rPaM, nCharacterIteratorMode);
@@ -802,6 +823,11 @@ EditDoc& EditEngine::GetEditDoc()
return pImpEditEngine->GetEditDoc();
}
+const EditDoc& EditEngine::GetEditDoc() const
+{
+ return pImpEditEngine->GetEditDoc();
+}
+
void EditEngine::SeekCursor(
ContentNode* pNode, sal_uInt16 nPos, SvxFont& rFont, OutputDevice* pOut, sal_uInt16 nIgnoreWhich)
{
@@ -813,6 +839,26 @@ EditPaM EditEngine::DeleteSelection(const EditSelection& rSel)
return pImpEditEngine->ImpDeleteSelection(rSel);
}
+ESelection EditEngine::CreateESelection(const EditSelection& rSel)
+{
+ return pImpEditEngine->CreateESel(rSel);
+}
+
+const SfxItemSet& EditEngine::GetBaseParaAttribs(sal_uInt16 nPara) const
+{
+ return pImpEditEngine->GetParaAttribs(nPara);
+}
+
+void EditEngine::SetParaAttribsOnly(sal_uInt16 nPara, const SfxItemSet& rSet)
+{
+ pImpEditEngine->SetParaAttribs(nPara, rSet);
+}
+
+void EditEngine::SetAttribs(const EditSelection& rSel, const SfxItemSet& rSet, sal_uInt8 nSpecial)
+{
+ pImpEditEngine->SetAttribs(rSel, rSet, nSpecial);
+}
+
void EditEngine::HandleBeginPasteOrDrop(PasteOrDropInfos& rInfos)
{
pImpEditEngine->aBeginPasteOrDropHdl.Call(&rInfos);
@@ -2030,6 +2076,11 @@ void EditEngine::QuickRemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich )
pImpEditEngine->RemoveCharAttribs( nPara, nWhich );
}
+void EditEngine::SetStyleSheet(const EditSelection& aSel, SfxStyleSheet* pStyle)
+{
+ pImpEditEngine->SetStyleSheet(aSel, pStyle);
+}
+
void EditEngine::SetStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pStyle )
{
DBG_CHKTHIS( EditEngine, 0 );
@@ -2245,7 +2296,7 @@ EFieldInfo EditEngine::GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const
}
-sal_Bool EditEngine::UpdateFields()
+bool EditEngine::UpdateFields()
{
DBG_CHKTHIS( EditEngine, 0 );
sal_Bool bChanges = pImpEditEngine->UpdateFields();
@@ -2254,6 +2305,11 @@ sal_Bool EditEngine::UpdateFields()
return bChanges;
}
+bool EditEngine::UpdateFieldsOnly()
+{
+ return pImpEditEngine->UpdateFields();
+}
+
void EditEngine::RemoveFields( sal_Bool bKeepFieldText, TypeId aType )
{
DBG_CHKTHIS( EditEngine, 0 );
@@ -2719,6 +2775,31 @@ void EditEngine::SetFirstWordCapitalization( sal_Bool bCapitalize )
pImpEditEngine->SetFirstWordCapitalization( bCapitalize );
}
+bool EditEngine::IsImportHandlerSet() const
+{
+ return pImpEditEngine->aImportHdl.IsSet();
+}
+
+bool EditEngine::IsImportRTFStyleSheetsSet() const
+{
+ return pImpEditEngine->GetStatus().DoImportRTFStyleSheets();
+}
+
+void EditEngine::CallImportHandler(ImportInfo& rInfo)
+{
+ pImpEditEngine->aImportHdl.Call(&rInfo);
+}
+
+EditPaM EditEngine::InsertParaBreak(
+ const EditSelection& rEditSelection, bool bKeepEndingAttribs)
+{
+ return pImpEditEngine->ImpInsertParaBreak(rEditSelection, bKeepEndingAttribs);
+}
+
+EditPaM EditEngine::InsertLineBreak(const EditSelection& rEditSelection)
+{
+ return pImpEditEngine->InsertLineBreak(rEditSelection);
+}
EFieldInfo::EFieldInfo()
{
diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx
index 9749706..b8801c0 100644
--- a/editeng/source/editeng/eertfpar.cxx
+++ b/editeng/source/editeng/eertfpar.cxx
@@ -39,9 +39,12 @@
#include <editeng/fhgtitem.hxx>
#include <editeng/fontitem.hxx>
#include <editeng/flditem.hxx>
+#include "editeng/editeng.hxx"
#include <svtools/rtftoken.h>
+using namespace com::sun::star;
+
// Set all values to defaultt; is called after loading the bitmap!
void SvxRTFPictureType::ResetValues()
{ // Set all values RTF-Defaults
@@ -71,11 +74,12 @@ ImportInfo::~ImportInfo()
{
}
-EditRTFParser::EditRTFParser( SvStream& rIn, EditSelection aSel, SfxItemPool& rAttrPool, ImpEditEngine* pImpEE )
- : SvxRTFParser( rAttrPool, rIn, 0 ), aRTFMapMode( MAP_TWIP )
+EditRTFParser::EditRTFParser(
+ SvStream& rIn, EditSelection aSel, SfxItemPool& rAttrPool, EditEngine* pEditEngine) :
+ SvxRTFParser(rAttrPool, rIn, 0),
+ mpEditEngine(pEditEngine),
+ aRTFMapMode(MAP_TWIP)
{
-
- pImpEditEngine = pImpEE;
aCurSel = aSel;
eDestCharSet = RTL_TEXTENCODING_DONTKNOW;
nDefFont = 0;
@@ -83,13 +87,13 @@ EditRTFParser::EditRTFParser( SvStream& rIn, EditSelection aSel, SfxItemPool& rA
nLastAction = 0;
nDefFontHeight = 0;
- SetInsPos( EditPosition( pImpEditEngine, &aCurSel ) );
+ SetInsPos(EditPosition(mpEditEngine, &aCurSel));
// Convert the twips values ...
- SetCalcValue( sal_True );
- SetChkStyleAttr( pImpEE->GetStatus().DoImportRTFStyleSheets() );
- SetNewDoc( sal_False ); // So that the Pool-Defaults are not overwritten...
- aEditMapMode = MapMode( pImpEE->GetRefDevice()->GetMapMode().GetMapUnit() );
+ SetCalcValue(true);
+ SetChkStyleAttr(mpEditEngine->IsImportRTFStyleSheetsSet());
+ SetNewDoc(false); // So that the Pool-Defaults are not overwritten...
+ aEditMapMode = MapMode(mpEditEngine->GetRefDevice()->GetMapMode().GetMapUnit());
}
EditRTFParser::~EditRTFParser()
@@ -106,38 +110,38 @@ SvParserState EditRTFParser::CallParser()
// aStart2PaM: First position of the imported content
// aEnd2PaM: Last position of the imported content
EditPaM aStart1PaM( aCurSel.Min().GetNode(), aCurSel.Min().GetIndex() );
- aCurSel = pImpEditEngine->ImpInsertParaBreak( aCurSel );
+ aCurSel = mpEditEngine->InsertParaBreak(aCurSel);
EditPaM aStart2PaM = aCurSel.Min();
// Useful or not?
aStart2PaM.GetNode()->GetContentAttribs().GetItems().ClearItem();
AddRTFDefaultValues( aStart2PaM, aStart2PaM );
- EditPaM aEnd1PaM( pImpEditEngine->ImpInsertParaBreak( aCurSel.Max() ) );
+ EditPaM aEnd1PaM = mpEditEngine->InsertParaBreak(aCurSel.Max());
// aCurCel now points to the gap
- if ( pImpEditEngine->aImportHdl.IsSet() )
+ if (mpEditEngine->IsImportHandlerSet())
{
- ImportInfo aImportInfo( RTFIMP_START, this, pImpEditEngine->CreateESel( aCurSel ) );
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
+ ImportInfo aImportInfo(RTFIMP_START, this, mpEditEngine->CreateESelection(aCurSel));
+ mpEditEngine->CallImportHandler(aImportInfo);
}
SvParserState _eState = SvxRTFParser::CallParser();
- if ( pImpEditEngine->aImportHdl.IsSet() )
+ if (mpEditEngine->IsImportHandlerSet())
{
- ImportInfo aImportInfo( RTFIMP_END, this, pImpEditEngine->CreateESel( aCurSel ) );
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
+ ImportInfo aImportInfo(RTFIMP_END, this, mpEditEngine->CreateESelection(aCurSel));
+ mpEditEngine->CallImportHandler(aImportInfo);
}
if ( nLastAction == ACTION_INSERTPARABRK )
{
ContentNode* pCurNode = aCurSel.Max().GetNode();
- sal_uInt16 nPara = pImpEditEngine->GetEditDoc().GetPos( pCurNode );
- ContentNode* pPrevNode = pImpEditEngine->GetEditDoc().GetObject( nPara-1 );
+ sal_uInt16 nPara = mpEditEngine->GetEditDoc().GetPos(pCurNode);
+ ContentNode* pPrevNode = mpEditEngine->GetEditDoc().GetObject(nPara-1);
DBG_ASSERT( pPrevNode, "Invalid RTF-Document?!" );
EditSelection aSel;
aSel.Min() = EditPaM( pPrevNode, pPrevNode->Len() );
aSel.Max() = EditPaM( pCurNode, 0 );
- aCurSel.Max() = pImpEditEngine->ImpDeleteSelection( aSel );
+ aCurSel.Max() = mpEditEngine->DeleteSelection(aSel);
}
EditPaM aEnd2PaM( aCurSel.Max() );
//AddRTFDefaultValues( aStart2PaM, aEnd2PaM );
@@ -148,14 +152,14 @@ SvParserState EditRTFParser::CallParser()
sal_Bool bSpecialBackward = aStart1PaM.GetNode()->Len() ? sal_False : sal_True;
if ( bOnlyOnePara || aStart1PaM.GetNode()->Len() )
- pImpEditEngine->ParaAttribsToCharAttribs( aStart2PaM.GetNode() );
- aCurSel.Min() = pImpEditEngine->ImpConnectParagraphs(
+ mpEditEngine->ParaAttribsToCharAttribs( aStart2PaM.GetNode() );
+ aCurSel.Min() = mpEditEngine->ConnectParagraphs(
aStart1PaM.GetNode(), aStart2PaM.GetNode(), bSpecialBackward );
bSpecialBackward = aEnd1PaM.GetNode()->Len() ? sal_True : sal_False;
// when bOnlyOnePara, then the node is gone on Connect.
if ( !bOnlyOnePara && aEnd1PaM.GetNode()->Len() )
- pImpEditEngine->ParaAttribsToCharAttribs( aEnd2PaM.GetNode() );
- aCurSel.Max() = pImpEditEngine->ImpConnectParagraphs(
+ mpEditEngine->ParaAttribsToCharAttribs( aEnd2PaM.GetNode() );
+ aCurSel.Max() = mpEditEngine->ConnectParagraphs(
( bOnlyOnePara ? aStart1PaM.GetNode() : aEnd2PaM.GetNode() ),
aEnd1PaM.GetNode(), bSpecialBackward );
@@ -167,18 +171,18 @@ void EditRTFParser::AddRTFDefaultValues( const EditPaM& rStart, const EditPaM& r
// Problem: DefFont and DefFontHeight
Size aSz( 12, 0 );
MapMode aPntMode( MAP_POINT );
- MapMode _aEditMapMode( pImpEditEngine->GetRefDevice()->GetMapMode().GetMapUnit() );
- aSz = pImpEditEngine->GetRefDevice()->LogicToLogic( aSz, &aPntMode, &_aEditMapMode );
+ MapMode _aEditMapMode(mpEditEngine->GetRefDevice()->GetMapMode().GetMapUnit());
+ aSz = mpEditEngine->GetRefDevice()->LogicToLogic(aSz, &aPntMode, &_aEditMapMode);
SvxFontHeightItem aFontHeightItem( aSz.Width(), 100, EE_CHAR_FONTHEIGHT );
Font aDefFont( GetDefFont() );
SvxFontItem aFontItem( aDefFont.GetFamily(), aDefFont.GetName(),
aDefFont.GetStyleName(), aDefFont.GetPitch(), aDefFont.GetCharSet(), EE_CHAR_FONTINFO );
- sal_uInt16 nStartPara = pImpEditEngine->GetEditDoc().GetPos( rStart.GetNode() );
- sal_uInt16 nEndPara = pImpEditEngine->GetEditDoc().GetPos( rEnd.GetNode() );
+ sal_uInt16 nStartPara = mpEditEngine->GetEditDoc().GetPos( rStart.GetNode() );
+ sal_uInt16 nEndPara = mpEditEngine->GetEditDoc().GetPos( rEnd.GetNode() );
for ( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++ )
{
- ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( nPara );
+ ContentNode* pNode = mpEditEngine->GetEditDoc().GetObject( nPara );
DBG_ASSERT( pNode, "AddRTFDefaultValues - No paragraph?!" );
if ( !pNode->GetContentAttribs().HasItem( EE_CHAR_FONTINFO ) )
pNode->GetContentAttribs().GetItems().Put( aFontItem );
@@ -203,12 +207,12 @@ void EditRTFParser::NextToken( int nToken )
break;
case RTF_CELL:
{
- aCurSel = pImpEditEngine->ImpInsertParaBreak( aCurSel );
+ aCurSel = mpEditEngine->InsertParaBreak(aCurSel);
}
break;
case RTF_LINE:
{
- aCurSel = pImpEditEngine->InsertLineBreak( aCurSel );
+ aCurSel = mpEditEngine->InsertLineBreak(aCurSel);
}
break;
case RTF_FIELD:
@@ -230,12 +234,12 @@ void EditRTFParser::NextToken( int nToken )
}
break;
}
- if ( pImpEditEngine->aImportHdl.IsSet() )
+ if (mpEditEngine->IsImportHandlerSet())
{
- ImportInfo aImportInfo( RTFIMP_NEXTTOKEN, this, pImpEditEngine->CreateESel( aCurSel ) );
+ ImportInfo aImportInfo(RTFIMP_NEXTTOKEN, this, mpEditEngine->CreateESelection(aCurSel));
aImportInfo.nToken = nToken;
aImportInfo.nTokenValue = short(nTokenValue);
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
+ mpEditEngine->CallImportHandler(aImportInfo);
}
}
@@ -243,45 +247,47 @@ void EditRTFParser::UnknownAttrToken( int nToken, SfxItemSet* )
{
// for Tokens which are not evaluated in ReadAttr
// Actually, only for Calc (RTFTokenHdl), so that RTF_INTBL
- if ( pImpEditEngine->aImportHdl.IsSet() )
+ if (mpEditEngine->IsImportHandlerSet())
{
- ImportInfo aImportInfo( RTFIMP_UNKNOWNATTR, this, pImpEditEngine->CreateESel( aCurSel ) );
+ ImportInfo aImportInfo(RTFIMP_UNKNOWNATTR, this, mpEditEngine->CreateESelection(aCurSel));
aImportInfo.nToken = nToken;
aImportInfo.nTokenValue = short(nTokenValue);
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
+ mpEditEngine->CallImportHandler(aImportInfo);
}
}
void EditRTFParser::InsertText()
{
String aText( aToken );
- if ( pImpEditEngine->aImportHdl.IsSet() )
+ if (mpEditEngine->IsImportHandlerSet())
{
- ImportInfo aImportInfo( RTFIMP_INSERTTEXT, this, pImpEditEngine->CreateESel( aCurSel ) );
+ ImportInfo aImportInfo(RTFIMP_INSERTTEXT, this, mpEditEngine->CreateESelection(aCurSel));
aImportInfo.aText = aText;
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
+ mpEditEngine->CallImportHandler(aImportInfo);
}
- aCurSel = pImpEditEngine->ImpInsertText( aCurSel, aText );
+ aCurSel = mpEditEngine->InsertText(aCurSel, aText);
nLastAction = ACTION_INSERTTEXT;
}
void EditRTFParser::InsertPara()
{
- if ( pImpEditEngine->aImportHdl.IsSet() )
+ if (mpEditEngine->IsImportHandlerSet())
{
- ImportInfo aImportInfo( RTFIMP_INSERTPARA, this, pImpEditEngine->CreateESel( aCurSel ) );
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
+ ImportInfo aImportInfo(RTFIMP_INSERTPARA, this, mpEditEngine->CreateESelection(aCurSel));
+ mpEditEngine->CallImportHandler(aImportInfo);
}
- aCurSel = pImpEditEngine->ImpInsertParaBreak( aCurSel );
+ aCurSel = mpEditEngine->InsertParaBreak(aCurSel);
nLastAction = ACTION_INSERTPARABRK;
}
void EditRTFParser::MovePos( int bForward )
{
if( bForward )
- aCurSel = pImpEditEngine->CursorRight( aCurSel.Max(), ::com::sun::star::i18n::CharacterIteratorMode::SKIPCHARACTER );
+ aCurSel = mpEditEngine->CursorRight(
+ aCurSel.Max(), i18n::CharacterIteratorMode::SKIPCHARACTER);
else
- aCurSel = pImpEditEngine->CursorLeft( aCurSel.Max(), ::com::sun::star::i18n::CharacterIteratorMode::SKIPCHARACTER );
+ aCurSel = mpEditEngine->CursorLeft(
+ aCurSel.Max(), i18n::CharacterIteratorMode::SKIPCHARACTER);
}
void EditRTFParser::SetEndPrevPara( SvxNodeIdx*& rpNodePos,
@@ -292,13 +298,13 @@ void EditRTFParser::SetEndPrevPara( SvxNodeIdx*& rpNodePos,
// This "\pard" always apply on the right paragraph.
ContentNode* pN = aCurSel.Max().GetNode();
- sal_uInt16 nCurPara = pImpEditEngine->GetEditDoc().GetPos( pN );
+ sal_uInt16 nCurPara = mpEditEngine->GetEditDoc().GetPos( pN );
DBG_ASSERT( nCurPara != 0, "Paragraph equal to 0: SetEnfPrevPara" );
if ( nCurPara )
nCurPara--;
- ContentNode* pPrevNode = pImpEditEngine->GetEditDoc().GetObject( nCurPara );
+ ContentNode* pPrevNode = mpEditEngine->GetEditDoc().GetObject( nCurPara );
DBG_ASSERT( pPrevNode, "pPrevNode = 0!" );
- rpNodePos = new EditNodeIdx( pImpEditEngine, pPrevNode );
+ rpNodePos = new EditNodeIdx(mpEditEngine, pPrevNode);
rCntPos = pPrevNode->Len();
}
@@ -319,7 +325,7 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
const SfxPoolItem* pItem;
// #i66167# adapt font heights to destination MapUnit if necessary
- const MapUnit eDestUnit = ( MapUnit )( pImpEditEngine->GetEditDoc().GetItemPool().GetMetric(0) );
+ const MapUnit eDestUnit = (MapUnit)(mpEditEngine->GetEditDoc().GetItemPool().GetMetric(0));
const MapUnit eSrcUnit = aRTFMapMode.GetMapUnit();
if (eDestUnit != eSrcUnit)
{
@@ -330,7 +336,7 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
{
sal_uInt32 nHeight = ((SvxFontHeightItem*)pItem)->GetHeight();
long nNewHeight;
- nNewHeight = pImpEditEngine->GetRefDevice()->LogicToLogic( (long)nHeight, eSrcUnit, eDestUnit );
+ nNewHeight = mpEditEngine->GetRefDevice()->LogicToLogic( (long)nHeight, eSrcUnit, eDestUnit );
SvxFontHeightItem aFntHeightItem( nNewHeight, ((SvxFontHeightItem*)pItem)->GetProp(), aFntHeightIems[i] );
rSet.GetAttrSet().Put( aFntHeightItem );
@@ -347,7 +353,7 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
{
nEsc *= 10; //HalPoints => Twips was embezzled in RTFITEM.CXX!
SvxFont aFont;
- pImpEditEngine->SeekCursor( aStartPaM.GetNode(), aStartPaM.GetIndex()+1, aFont );
+ mpEditEngine->SeekCursor(aStartPaM.GetNode(), aStartPaM.GetIndex()+1, aFont);
nEsc = nEsc * 100 / aFont.GetSize().Height();
SvxEscapementItem aEscItem( (short) nEsc, ((SvxEscapementItem*)pItem)->GetProp(), EE_CHAR_ESCAPEMENT );
@@ -355,28 +361,30 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
}
}
- if ( pImpEditEngine->aImportHdl.IsSet() )
+ if (mpEditEngine->IsImportHandlerSet())
{
EditSelection aSel( aStartPaM, aEndPaM );
- ImportInfo aImportInfo( RTFIMP_SETATTR, this, pImpEditEngine->CreateESel( aSel ) );
+ ImportInfo aImportInfo(RTFIMP_SETATTR, this, mpEditEngine->CreateESelection(aSel));
aImportInfo.pAttrs = &rSet;
- pImpEditEngine->aImportHdl.Call( &aImportInfo );
+ mpEditEngine->CallImportHandler(aImportInfo);
}
ContentNode* pSN = aStartPaM.GetNode();
ContentNode* pEN = aEndPaM.GetNode();
- sal_uInt16 nStartNode = pImpEditEngine->GetEditDoc().GetPos( pSN );
- sal_uInt16 nEndNode = pImpEditEngine->GetEditDoc().GetPos( pEN );
+ sal_uInt16 nStartNode = mpEditEngine->GetEditDoc().GetPos( pSN );
+ sal_uInt16 nEndNode = mpEditEngine->GetEditDoc().GetPos( pEN );
sal_Int16 nOutlLevel = 0xff;
- if ( rSet.StyleNo() && pImpEditEngine->GetStyleSheetPool() && pImpEditEngine->GetStatus().DoImportRTFStyleSheets() )
+ if (rSet.StyleNo() && mpEditEngine->GetStyleSheetPool() && mpEditEngine->IsImportRTFStyleSheetsSet())
{
SvxRTFStyleTbl::iterator it = GetStyleTbl().find( rSet.StyleNo() );
DBG_ASSERT( it != GetStyleTbl().end(), "Template not defined in RTF!" );
if ( it != GetStyleTbl().end() )
{
SvxRTFStyleType* pS = it->second;
- pImpEditEngine->SetStyleSheet( EditSelection( aStartPaM, aEndPaM ), (SfxStyleSheet*)pImpEditEngine->GetStyleSheetPool()->Find( pS->sName, SFX_STYLE_FAMILY_ALL ) );
+ mpEditEngine->SetStyleSheet(
+ EditSelection(aStartPaM, aEndPaM),
+ (SfxStyleSheet*)mpEditEngine->GetStyleSheetPool()->Find(pS->sName, SFX_STYLE_FAMILY_ALL));
nOutlLevel = pS->nOutlineNo;
}
}
@@ -388,36 +396,39 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
// All Complete paragraphs are paragraph attributes ...
for ( sal_uInt16 z = nStartNode+1; z < nEndNode; z++ )
{
- DBG_ASSERT( pImpEditEngine->GetEditDoc().GetObject( z ), "Node does not exist yet(RTF)" );
- pImpEditEngine->SetParaAttribs( z, rSet.GetAttrSet() );
+ DBG_ASSERT(mpEditEngine->GetEditDoc().GetObject(z), "Node does not exist yet(RTF)");
+ mpEditEngine->SetParaAttribsOnly(z, rSet.GetAttrSet());
}
if ( aStartPaM.GetNode() != aEndPaM.GetNode() )
{
// The rest dof the StartNodes...
if ( aStartPaM.GetIndex() == 0 )
- pImpEditEngine->SetParaAttribs( nStartNode, rSet.GetAttrSet() );
+ mpEditEngine->SetParaAttribsOnly(nStartNode, rSet.GetAttrSet());
else
- pImpEditEngine->SetAttribs( EditSelection( aStartPaM, EditPaM( aStartPaM.GetNode(), aStartPaM.GetNode()->Len() ) ), rSet.GetAttrSet() );
+ mpEditEngine->SetAttribs(
+ EditSelection(aStartPaM, EditPaM(aStartPaM.GetNode(), aStartPaM.GetNode()->Len())), rSet.GetAttrSet());
// the beginning of the EndNodes....
if ( aEndPaM.GetIndex() == aEndPaM.GetNode()->Len() )
- pImpEditEngine->SetParaAttribs( nEndNode, rSet.GetAttrSet() );
+ mpEditEngine->SetParaAttribsOnly(nEndNode, rSet.GetAttrSet());
else
- pImpEditEngine->SetAttribs( EditSelection( EditPaM( aEndPaM.GetNode(), 0 ), aEndPaM ), rSet.GetAttrSet() );
+ mpEditEngine->SetAttribs(
+ EditSelection(EditPaM(aEndPaM.GetNode(), 0), aEndPaM), rSet.GetAttrSet());
}
else
{
if ( ( aStartPaM.GetIndex() == 0 ) && ( aEndPaM.GetIndex() == aEndPaM.GetNode()->Len() ) )
{
// When settings char attribs as para attribs, we must merge with existing attribs, not overwrite the ItemSet!
- SfxItemSet aAttrs = pImpEditEngine->GetParaAttribs( nStartNode );
+ SfxItemSet aAttrs = mpEditEngine->GetBaseParaAttribs(nStartNode);
aAttrs.Put( rSet.GetAttrSet() );
- pImpEditEngine->SetParaAttribs( nStartNode, aAttrs );
+ mpEditEngine->SetParaAttribsOnly(nStartNode, aAttrs);
}
else
{
- pImpEditEngine->SetAttribs( EditSelection( aStartPaM, aEndPaM ), rSet.GetAttrSet() );
+ mpEditEngine->SetAttribs(
+ EditSelection(aStartPaM, aEndPaM), rSet.GetAttrSet());
}
}
@@ -426,7 +437,7 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
{
for ( sal_uInt16 n = nStartNode; n <= nEndNode; n++ )
{
- ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( n );
+ ContentNode* pNode = mpEditEngine->GetEditDoc().GetObject( n );
pNode->GetContentAttribs().GetItems().Put( SfxInt16Item( EE_PARA_OUTLLEVEL, nOutlLevel ) );
}
}
@@ -447,7 +458,7 @@ SvxRTFStyleType* EditRTFParser::FindStyleSheet( const XubString& rName )
SfxStyleSheet* EditRTFParser::CreateStyleSheet( SvxRTFStyleType* pRTFStyle )
{
// Check if a template exists, then it will not be changed!
- SfxStyleSheet* pStyle = (SfxStyleSheet*)pImpEditEngine->GetStyleSheetPool()->Find( pRTFStyle->sName, SFX_STYLE_FAMILY_ALL );
+ SfxStyleSheet* pStyle = (SfxStyleSheet*)mpEditEngine->GetStyleSheetPool()->Find( pRTFStyle->sName, SFX_STYLE_FAMILY_ALL );
if ( pStyle )
return pStyle;
@@ -464,7 +475,7 @@ SfxStyleSheet* EditRTFParser::CreateStyleSheet( SvxRTFStyleType* pRTFStyle )
}
}
- pStyle = (SfxStyleSheet*) &pImpEditEngine->GetStyleSheetPool()->Make( aName, SFX_STYLE_FAMILY_PARA );
+ pStyle = (SfxStyleSheet*) &mpEditEngine->GetStyleSheetPool()->Make( aName, SFX_STYLE_FAMILY_PARA );
// 1) convert and take over Items ...
ConvertAndPutItems( pStyle->GetItemSet(), pRTFStyle->aAttrSet );
@@ -472,7 +483,7 @@ SfxStyleSheet* EditRTFParser::CreateStyleSheet( SvxRTFStyleType* pRTFStyle )
// 2) As long as Parent is not in the pool, also create this ...
if ( aParent.Len() && ( aParent != aName ) )
{
- SfxStyleSheet* pS = (SfxStyleSheet*)pImpEditEngine->GetStyleSheetPool()->Find( aParent, SFX_STYLE_FAMILY_ALL );
+ SfxStyleSheet* pS = (SfxStyleSheet*)mpEditEngine->GetStyleSheetPool()->Find( aParent, SFX_STYLE_FAMILY_ALL );
if ( !pS )
{
// If not found anywhere, create from RTF ...
@@ -490,7 +501,7 @@ SfxStyleSheet* EditRTFParser::CreateStyleSheet( SvxRTFStyleType* pRTFStyle )
void EditRTFParser::CreateStyleSheets()
{
// the SvxRTFParser haa now created the template...
- if ( pImpEditEngine->GetStyleSheetPool() && pImpEditEngine->GetStatus().DoImportRTFStyleSheets() )
+ if (mpEditEngine->GetStyleSheetPool() && mpEditEngine->IsImportRTFStyleSheetsSet())
{
for (SvxRTFStyleTbl::iterator it = GetStyleTbl().begin(); it != GetStyleTbl().end(); ++it)
{
@@ -569,8 +580,8 @@ void EditRTFParser::ReadField()
aFldRslt = aFldInst;
SvxFieldItem aField( SvxURLField( aFldInst, aFldRslt, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD );
- aCurSel = pImpEditEngine->InsertField( aCurSel, aField );
- pImpEditEngine->UpdateFields();
+ aCurSel = mpEditEngine->InsertField(aCurSel, aField);
+ mpEditEngine->UpdateFieldsOnly();
nLastAction = ACTION_INSERTTEXT;
}
}
@@ -603,35 +614,41 @@ void EditRTFParser::SkipGroup()
SkipToken( -1 ); // the closing brace is evaluated "above"
}
+EditNodeIdx::EditNodeIdx(EditEngine* pEE, ContentNode* pNd) :
+ mpEditEngine(pEE), mpNode(pNd) {}
+
sal_uLong EditNodeIdx::GetIdx() const
{
- return pImpEditEngine->GetEditDoc().GetPos( pNode );
+ return mpEditEngine->GetEditDoc().GetPos(mpNode);
}
SvxNodeIdx* EditNodeIdx::Clone() const
{
- return new EditNodeIdx( pImpEditEngine, pNode );
+ return new EditNodeIdx(mpEditEngine, mpNode);
}
+EditPosition::EditPosition(EditEngine* pEE, EditSelection* pSel) :
+ mpEditEngine(pEE), mpCurSel(pSel) {}
+
SvxPosition* EditPosition::Clone() const
{
- return new EditPosition( pImpEditEngine, pCurSel );
+ return new EditPosition(mpEditEngine, mpCurSel);
}
SvxNodeIdx* EditPosition::MakeNodeIdx() const
{
- return new EditNodeIdx( pImpEditEngine, pCurSel->Max().GetNode() );
+ return new EditNodeIdx(mpEditEngine, mpCurSel->Max().GetNode());
}
sal_uLong EditPosition::GetNodeIdx() const
{
- ContentNode* pN = pCurSel->Max().GetNode();
- return pImpEditEngine->GetEditDoc().GetPos( pN );
+ ContentNode* pN = mpCurSel->Max().GetNode();
+ return mpEditEngine->GetEditDoc().GetPos(pN);
}
sal_uInt16 EditPosition::GetCntIdx() const
{
- return pCurSel->Max().GetIndex();
+ return mpCurSel->Max().GetIndex();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/eertfpar.hxx b/editeng/source/editeng/eertfpar.hxx
index 30cb2be..df27f20 100644
--- a/editeng/source/editeng/eertfpar.hxx
+++ b/editeng/source/editeng/eertfpar.hxx
@@ -33,29 +33,30 @@
#include <editdoc.hxx>
#include <impedit.hxx>
+class EditEngine;
+
class EditNodeIdx : public SvxNodeIdx
{
private:
- ContentNode* pNode;
- ImpEditEngine* pImpEditEngine;
+ EditEngine* mpEditEngine;
+ ContentNode* mpNode;
public:
- EditNodeIdx( ImpEditEngine* pIEE, ContentNode* pNd = 0)
- { pImpEditEngine = pIEE; pNode = pNd; }
- virtual sal_uLong GetIdx() const;
+ EditNodeIdx(EditEngine* pEE, ContentNode* pNd = NULL);
+
+ virtual sal_uLong GetIdx() const;
virtual SvxNodeIdx* Clone() const;
- ContentNode* GetNode() { return pNode; }
+ ContentNode* GetNode() { return mpNode; }
};
class EditPosition : public SvxPosition
{
private:
- EditSelection* pCurSel;
- ImpEditEngine* pImpEditEngine;
+ EditEngine* mpEditEngine;
+ EditSelection* mpCurSel;
public:
- EditPosition( ImpEditEngine* pIEE, EditSelection* pSel )
- { pImpEditEngine = pIEE; pCurSel = pSel; }
+ EditPosition(EditEngine* pIEE, EditSelection* pSel);
virtual sal_uLong GetNodeIdx() const;
virtual sal_uInt16 GetCntIdx() const;
@@ -74,7 +75,7 @@ class EditRTFParser : public SvxRTFParser
{
private:
EditSelection aCurSel;
- ImpEditEngine* pImpEditEngine;
+ EditEngine* mpEditEngine;
CharSet eDestCharSet;
MapMode aRTFMapMode;
MapMode aEditMapMode;
@@ -104,8 +105,8 @@ protected:
void SkipGroup();
public:
- EditRTFParser( SvStream& rIn, EditSelection aCurSel, SfxItemPool& rAttrPool, ImpEditEngine* pImpEditEngine );
- ~EditRTFParser();
+ EditRTFParser(SvStream& rIn, EditSelection aCurSel, SfxItemPool& rAttrPool, EditEngine* pEditEngine);
+ ~EditRTFParser();
virtual SvParserState CallParser();
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 2e32318..1a3b471 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -391,7 +391,6 @@ class ImpEditEngine : public SfxListener, boost::noncopyable
friend class EditUndoMoveParagraphs;
friend class EditEngine; // For access to Imp-Methods
- friend class EditRTFParser; // For access to Imp-Methods
friend class EditHTMLParser; // For access to Imp-Methods
friend class EdtAutoCorrDoc; // For access to Imp-Methods
friend class EditDbg; // Debug Routines
@@ -772,7 +771,7 @@ public:
EditPaM AutoCorrect( const EditSelection& rCurEditSelection, sal_Unicode c, sal_Bool bOverwrite, Window* pFrameWin = NULL );
EditPaM DeleteLeftOrRight( const EditSelection& rEditSelection, sal_uInt8 nMode, sal_uInt8 nDelMode = DELMODE_SIMPLE );
EditPaM InsertParaBreak( EditSelection aEditSelection );
- EditPaM InsertLineBreak( EditSelection aEditSelection );
+ EditPaM InsertLineBreak(const EditSelection& aEditSelection);
EditPaM InsertTab( EditSelection aEditSelection );
EditPaM InsertField( EditSelection aEditSelection, const SvxFieldItem& rFld );
sal_Bool UpdateFields();
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index ece3367..e899c65 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -3018,7 +3018,7 @@ sal_Bool ImpEditEngine::UpdateFields()
return bChanges;
}
-EditPaM ImpEditEngine::InsertLineBreak( EditSelection aCurSel )
+EditPaM ImpEditEngine::InsertLineBreak(const EditSelection& aCurSel)
{
EditPaM aPaM( ImpInsertFeature( aCurSel, SfxVoidItem( EE_FEATURE_LINEBR ) ) );
return aPaM;
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 28121ca..5fdfe90 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -178,7 +178,7 @@ EditPaM ImpEditEngine::ReadRTF( SvStream& rInput, EditSelection aSel )
DBG_ASSERT(pPool && pPool->GetName().equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("EditEngineItemPool")),
"ReadRTF: no EditEnginePool!");
- EditRTFParserRef xPrsr = new EditRTFParser( rInput, aSel, *pPool, this );
+ EditRTFParserRef xPrsr = new EditRTFParser(rInput, aSel, *pPool, pEditEngine);
SvParserState eState = xPrsr->CallParser();
if ( ( eState != SVPAR_ACCEPTED ) && ( !rInput.GetError() ) )
{
More information about the Libreoffice-commits
mailing list