summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-04-16 14:46:44 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-04-16 17:13:35 -0400
commitd4126868a37b52574b99dcb3680f534b3b87e537 (patch)
tree6a1f8b2ce8a8d61a3998ea3f4a7b1cd126116e41
parentc29d22ce5d1d8c35218a7bf9939863aa2e058aa7 (diff)
EditRTFParser no longer a friend of ImpEditEngine.
-rw-r--r--editeng/inc/editeng/editeng.hxx48
-rw-r--r--editeng/source/editeng/editeng.cxx83
-rw-r--r--editeng/source/editeng/eertfpar.cxx183
-rw-r--r--editeng/source/editeng/eertfpar.hxx27
-rw-r--r--editeng/source/editeng/impedit.hxx3
-rw-r--r--editeng/source/editeng/impedit2.cxx2
-rw-r--r--editeng/source/editeng/impedit4.cxx2
7 files changed, 237 insertions, 111 deletions
diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx
index 8cdc6ef529c0..e536be9638fe 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 3868601bab3d..aff2f44eae8e 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 9749706b72a6..b8801c0065a4 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 30cb2bef94ec..df27f204b64e 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 2e32318d9799..1a3b47130327 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 ece3367579a7..e899c6594f06 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 28121caa4d0b..5fdfe90723a1 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() ) )
{