summaryrefslogtreecommitdiff
path: root/editeng/source/editeng/editview.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'editeng/source/editeng/editview.cxx')
-rw-r--r--editeng/source/editeng/editview.cxx814
1 files changed, 464 insertions, 350 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index fe6711ff6eaf..81fbd2d10b39 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -19,12 +19,10 @@
#include <memory>
-#include <sal/macros.h>
#include <vcl/image.hxx>
#include <com/sun/star/i18n/WordType.hpp>
#include <com/sun/star/i18n/ScriptType.hpp>
-#include <vcl/metric.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <i18nlangtag/mslangid.hxx>
@@ -36,6 +34,7 @@
#include <svl/srchitem.hxx>
#include "impedit.hxx"
+#include <comphelper/propertyvalue.hxx>
#include <editeng/editeng.hxx>
#include <editeng/editview.hxx>
#include <editeng/flditem.hxx>
@@ -50,7 +49,6 @@
#include <vcl/window.hxx>
#include <editeng/acorrcfg.hxx>
#include <editeng/unolingu.hxx>
-#include <editeng/fontitem.hxx>
#include <unotools/lingucfg.hxx>
#include <com/sun/star/frame/XStorable.hpp>
@@ -62,9 +60,9 @@
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <comphelper/lok.hxx>
#include <sfx2/viewsh.hxx>
+#include <sfx2/lokhelper.hxx>
#include <osl/diagnose.h>
#include <boost/property_tree/json_parser.hpp>
-#include <sfx2/dispatch.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -90,7 +88,7 @@ LanguageType EditView::CheckLanguage(
// If the result from language guessing does not provide a 'Country'
// part, try to get it by looking up the locale setting of the office,
- // "Tools/Options - Language Settings - Languages: Locale setting", if
+ // "Tools/Options - Languages and Locales - General: Locale setting", if
// the language matches.
if ( aGuessTag.getCountry().isEmpty() )
{
@@ -117,16 +115,16 @@ LanguageType EditView::CheckLanguage(
const AllSettings& rSettings = Application::GetSettings();
SvtLinguOptions aLinguOpt;
SvtLinguConfig().GetOptions( aLinguOpt );
- // The default document language from "Tools/Options - Language Settings - Languages: Western"
+ // The default document language from "Tools/Options - Languages and Locales - General: Western"
aLangList[0] = MsLangId::resolveSystemLanguageByScriptType( aLinguOpt.nDefaultLanguage,
css::i18n::ScriptType::LATIN);
- // The one from "Tools/Options - Language Settings - Languages: User interface"
+ // The one from "Tools/Options - Languages and Locales - General: User interface"
aLangList[1] = rSettings.GetUILanguageTag().getLanguageType();
- // The one from "Tools/Options - Language Settings - Languages: Locale setting"
+ // The one from "Tools/Options - Languages and Locales - General: Locale setting"
aLangList[2] = rSettings.GetLanguageTag().getLanguageType();
// en-US
aLangList[3] = LANGUAGE_ENGLISH_US;
-#ifdef DEBUG
+#if OSL_DEBUG_LEVEL >= 2
lang::Locale a0( LanguageTag::convertToLocale( aLangList[0] ) );
lang::Locale a1( LanguageTag::convertToLocale( aLangList[1] ) );
lang::Locale a2( LanguageTag::convertToLocale( aLangList[2] ) );
@@ -154,9 +152,11 @@ EditViewCallbacks::~EditViewCallbacks()
{
}
-EditView::EditView( EditEngine* pEng, vcl::Window* pWindow )
+EditView::EditView(EditEngine* pEditEngine, vcl::Window* pWindow)
+ : mpImpEditView(new ImpEditView(this, pEditEngine, pWindow))
{
- pImpEditView.reset( new ImpEditView( this, pEng, pWindow ) );
+ assert(pEditEngine);
+ getImpl().mbReadOnly = getImpl().mbReadOnly || SfxViewShell::IsCurrentLokViewReadOnly();
}
EditView::~EditView()
@@ -165,32 +165,32 @@ EditView::~EditView()
void EditView::setEditViewCallbacks(EditViewCallbacks* pEditViewCallbacks)
{
- pImpEditView->setEditViewCallbacks(pEditViewCallbacks);
+ getImpl().setEditViewCallbacks(pEditViewCallbacks);
}
EditViewCallbacks* EditView::getEditViewCallbacks() const
{
- return pImpEditView->getEditViewCallbacks();
+ return getImpl().getEditViewCallbacks();
}
-ImpEditEngine* EditView::GetImpEditEngine() const
+ImpEditEngine& EditView::getImpEditEngine() const
{
- return pImpEditView->pEditEngine->pImpEditEngine.get();
+ return getImpl().getImpEditEngine();
}
-EditEngine* EditView::GetEditEngine() const
+EditEngine& EditView::getEditEngine() const
{
- return pImpEditView->pEditEngine;
+ return getImpl().getEditEngine();
}
tools::Rectangle EditView::GetInvalidateRect() const
{
- if ( !pImpEditView->DoInvalidateMore() )
- return pImpEditView->aOutArea;
+ if (!getImpl().DoInvalidateMore())
+ return getImpl().maOutputArea;
else
{
- tools::Rectangle aRect( pImpEditView->aOutArea );
- tools::Long nMore = pImpEditView->GetOutputDevice().PixelToLogic( Size( pImpEditView->GetInvalidateMore(), 0 ) ).Width();
+ tools::Rectangle aRect(getImpl().maOutputArea);
+ tools::Long nMore = getImpl().GetOutputDevice().PixelToLogic( Size( getImpl().GetInvalidateMore(), 0 ) ).Width();
aRect.AdjustLeft( -nMore );
aRect.AdjustRight(nMore );
aRect.AdjustTop( -nMore );
@@ -199,20 +199,31 @@ tools::Rectangle EditView::GetInvalidateRect() const
}
}
+namespace {
+
+tools::Rectangle lcl_negateRectX(const tools::Rectangle& rRect)
+{
+ return tools::Rectangle(-rRect.Right(), rRect.Top(), -rRect.Left(), rRect.Bottom());
+}
+
+}
+
void EditView::InvalidateWindow(const tools::Rectangle& rClipRect)
{
- if (EditViewCallbacks* pEditViewCallbacks = pImpEditView->getEditViewCallbacks())
+ LOKEditViewHistory::Update();
+ bool bNegativeX = IsNegativeX();
+ if (EditViewCallbacks* pEditViewCallbacks = getImpl().getEditViewCallbacks())
{
// do not invalidate and trigger a global repaint, but forward
// the need for change to the applied EditViewCallback, can e.g.
// be used to visualize the active edit text in an OverlayObject
- pEditViewCallbacks->EditViewInvalidate(rClipRect);
+ pEditViewCallbacks->EditViewInvalidate(bNegativeX ? lcl_negateRectX(rClipRect) : rClipRect);
}
else
{
// classic mode: invalidate and trigger full repaint
// of the changed area
- GetWindow()->Invalidate(rClipRect);
+ GetWindow()->Invalidate(bNegativeX ? lcl_negateRectX(rClipRect) : rClipRect);
}
}
@@ -220,10 +231,14 @@ void EditView::InvalidateOtherViewWindows( const tools::Rectangle& rInvRect )
{
if (comphelper::LibreOfficeKit::isActive())
{
- for (auto& pWin : pImpEditView->aOutWindowSet)
+ bool bNegativeX = IsNegativeX();
+ for (auto& pWin : getImpl().maOutWindowSet)
{
if (pWin)
- pWin->Invalidate( rInvRect );
+ {
+ if (!pWin->InvalidateByForeignEditView(this))
+ pWin->Invalidate( bNegativeX ? lcl_negateRectX(rInvRect) : rInvRect );
+ }
}
}
}
@@ -231,18 +246,20 @@ void EditView::InvalidateOtherViewWindows( const tools::Rectangle& rInvRect )
void EditView::Invalidate()
{
const tools::Rectangle& rInvRect = GetInvalidateRect();
- pImpEditView->InvalidateAtWindow(rInvRect);
+
+ LOKEditViewHistory::Update();
+ getImpl().InvalidateAtWindow(rInvRect);
InvalidateOtherViewWindows(rInvRect);
}
void EditView::SetReadOnly( bool bReadOnly )
{
- pImpEditView->bReadOnly = bReadOnly;
+ getImpl().mbReadOnly = bReadOnly || SfxViewShell::IsCurrentLokViewReadOnly();
}
bool EditView::IsReadOnly() const
{
- return pImpEditView->bReadOnly;
+ return getImpl().mbReadOnly;
}
void EditView::SetSelection( const ESelection& rESel )
@@ -253,35 +270,35 @@ void EditView::SetSelection( const ESelection& rESel )
{
// tdf#113591 Get node from EditDoc, as the selection might have a pointer to an
// already deleted node.
- const ContentNode* pNode = pImpEditView->pEditEngine->GetEditDoc().GetEndPaM().GetNode();
- pImpEditView->pEditEngine->CursorMoved( pNode );
+ const ContentNode* pNode(getEditEngine().GetEditDoc().GetEndPaM().GetNode());
+ if (nullptr != pNode)
+ pNode->checkAndDeleteEmptyAttribs();
}
- EditSelection aNewSelection( pImpEditView->pEditEngine->pImpEditEngine->ConvertSelection(
- rESel.nStartPara, rESel.nStartPos, rESel.nEndPara, rESel.nEndPos ) );
+ EditSelection aNewSelection(getImpEditEngine().ConvertSelection(rESel.nStartPara, rESel.nStartPos, rESel.nEndPara, rESel.nEndPos));
// If the selection is manipulated after a KeyInput:
- pImpEditView->pEditEngine->CheckIdleFormatter();
+ getEditEngine().CheckIdleFormatter();
// Selection may not start/end at an invisible paragraph:
- const ParaPortion* pPortion = pImpEditView->pEditEngine->FindParaPortion( aNewSelection.Min().GetNode() );
+ const ParaPortion* pPortion = getEditEngine().FindParaPortion( aNewSelection.Min().GetNode() );
if ( !pPortion->IsVisible() )
{
- pPortion = pImpEditView->pEditEngine->GetPrevVisPortion( pPortion );
- ContentNode* pNode = pPortion ? pPortion->GetNode() : pImpEditView->pEditEngine->GetEditDoc().GetObject( 0 );
+ pPortion = getEditEngine().GetPrevVisPortion( pPortion );
+ ContentNode* pNode = pPortion ? pPortion->GetNode() : getEditEngine().GetEditDoc().GetObject( 0 );
aNewSelection.Min() = EditPaM( pNode, pNode->Len() );
}
- pPortion = pImpEditView->pEditEngine->FindParaPortion( aNewSelection.Max().GetNode() );
+ pPortion = getEditEngine().FindParaPortion( aNewSelection.Max().GetNode() );
if ( !pPortion->IsVisible() )
{
- pPortion = pImpEditView->pEditEngine->GetPrevVisPortion( pPortion );
- ContentNode* pNode = pPortion ? pPortion->GetNode() : pImpEditView->pEditEngine->GetEditDoc().GetObject( 0 );
+ pPortion = getEditEngine().GetPrevVisPortion( pPortion );
+ ContentNode* pNode = pPortion ? pPortion->GetNode() : getEditEngine().GetEditDoc().GetObject( 0 );
aNewSelection.Max() = EditPaM( pNode, pNode->Len() );
}
- pImpEditView->DrawSelectionXOR();
- pImpEditView->SetEditSelection( aNewSelection );
- pImpEditView->DrawSelectionXOR();
- bool bGotoCursor = pImpEditView->DoAutoScroll();
+ getImpl().DrawSelectionXOR();
+ getImpl().SetEditSelection( aNewSelection );
+ getImpl().DrawSelectionXOR();
+ bool bGotoCursor = getImpl().DoAutoScroll();
// comments section in Writer:
// don't scroll to the selection if it is
@@ -294,66 +311,78 @@ ESelection EditView::GetSelection() const
{
ESelection aSelection;
- aSelection.nStartPara = pImpEditView->pEditEngine->GetEditDoc().GetPos( pImpEditView->GetEditSelection().Min().GetNode() );
- aSelection.nEndPara = pImpEditView->pEditEngine->GetEditDoc().GetPos( pImpEditView->GetEditSelection().Max().GetNode() );
+ aSelection.nStartPara = getEditEngine().GetEditDoc().GetPos( getImpl().GetEditSelection().Min().GetNode() );
+ aSelection.nEndPara = getEditEngine().GetEditDoc().GetPos( getImpl().GetEditSelection().Max().GetNode() );
- aSelection.nStartPos = pImpEditView->GetEditSelection().Min().GetIndex();
- aSelection.nEndPos = pImpEditView->GetEditSelection().Max().GetIndex();
+ aSelection.nStartPos = getImpl().GetEditSelection().Min().GetIndex();
+ aSelection.nEndPos = getImpl().GetEditSelection().Max().GetIndex();
return aSelection;
}
bool EditView::HasSelection() const
{
- return pImpEditView->HasSelection();
+ return getImpl().HasSelection();
+}
+
+bool EditView::IsSelectionFullPara() const
+{
+ return getImpl().IsSelectionFullPara();
+}
+
+bool EditView::IsSelectionWithinSinglePara() const
+{
+ return getImpl().IsSelectionInSinglePara();
}
bool EditView::IsSelectionAtPoint(const Point& rPointPixel)
{
- return pImpEditView->IsSelectionAtPoint(rPointPixel);
+ return getImpl().IsSelectionAtPoint(rPointPixel);
}
void EditView::DeleteSelected()
{
- pImpEditView->DeleteSelected();
+ getImpl().DeleteSelected();
}
SvtScriptType EditView::GetSelectedScriptType() const
{
- return pImpEditView->pEditEngine->GetScriptType( pImpEditView->GetEditSelection() );
+ return getEditEngine().GetScriptType( getImpl().GetEditSelection() );
}
void EditView::GetSelectionRectangles(std::vector<tools::Rectangle>& rLogicRects) const
{
- return pImpEditView->GetSelectionRectangles(pImpEditView->GetEditSelection(), rLogicRects);
+ return getImpl().GetSelectionRectangles(getImpl().GetEditSelection(), rLogicRects);
}
void EditView::Paint( const tools::Rectangle& rRect, OutputDevice* pTargetDevice )
{
- pImpEditView->pEditEngine->pImpEditEngine->Paint( pImpEditView.get(), rRect, pTargetDevice );
+ getImpEditEngine().Paint(&getImpl(), rRect, pTargetDevice);
}
-void EditView::SetEditEngine( EditEngine* pEditEng )
+void EditView::setEditEngine(EditEngine* pEditEngine)
{
- pImpEditView->pEditEngine = pEditEng;
- EditSelection aStartSel = pImpEditView->pEditEngine->GetEditDoc().GetStartPaM();
- pImpEditView->SetEditSelection( aStartSel );
+ assert(pEditEngine);
+
+ getImpl().mpEditEngine = pEditEngine;
+ EditSelection aStartSel = getEditEngine().GetEditDoc().GetStartPaM();
+ getImpl().SetEditSelection( aStartSel );
}
-void EditView::SetWindow( vcl::Window* pWin )
+void EditView::SetWindow(vcl::Window* pWindow)
{
- pImpEditView->pOutWin = pWin;
- pImpEditView->pEditEngine->pImpEditEngine->GetSelEngine().Reset();
+ getImpl().mpOutputWindow = pWindow;
+ getImpEditEngine().GetSelEngine().Reset();
}
vcl::Window* EditView::GetWindow() const
{
- return pImpEditView->pOutWin;
+ return getImpl().mpOutputWindow;
}
OutputDevice& EditView::GetOutputDevice() const
{
- return pImpEditView->GetOutputDevice();
+ return getImpl().GetOutputDevice();
}
LanguageType EditView::GetInputLanguage() const
@@ -366,7 +395,7 @@ LanguageType EditView::GetInputLanguage() const
bool EditView::HasOtherViewWindow( vcl::Window* pWin )
{
- OutWindowSet& rOutWindowSet = pImpEditView->aOutWindowSet;
+ OutWindowSet& rOutWindowSet = getImpl().maOutWindowSet;
auto found = std::find(rOutWindowSet.begin(), rOutWindowSet.end(), pWin);
return (found != rOutWindowSet.end());
}
@@ -375,13 +404,13 @@ bool EditView::AddOtherViewWindow( vcl::Window* pWin )
{
if (HasOtherViewWindow(pWin))
return false;
- pImpEditView->aOutWindowSet.emplace_back(pWin);
+ getImpl().maOutWindowSet.emplace_back(pWin);
return true;
}
bool EditView::RemoveOtherViewWindow( vcl::Window* pWin )
{
- OutWindowSet& rOutWindowSet = pImpEditView->aOutWindowSet;
+ OutWindowSet& rOutWindowSet = getImpl().maOutWindowSet;
auto found = std::find(rOutWindowSet.begin(), rOutWindowSet.end(), pWin);
if (found == rOutWindowSet.end())
return false;
@@ -391,180 +420,180 @@ bool EditView::RemoveOtherViewWindow( vcl::Window* pWin )
void EditView::SetVisArea( const tools::Rectangle& rRect )
{
- pImpEditView->SetVisDocStartPos( rRect.TopLeft() );
+ getImpl().SetVisDocStartPos( rRect.TopLeft() );
}
tools::Rectangle EditView::GetVisArea() const
{
- return pImpEditView->GetVisDocArea();
+ return getImpl().GetVisDocArea();
}
void EditView::SetOutputArea( const tools::Rectangle& rRect )
{
- pImpEditView->SetOutputArea( rRect );
+ getImpl().SetOutputArea( rRect );
// the rest here only if it is an API call:
- pImpEditView->CalcAnchorPoint();
- if ( pImpEditView->pEditEngine->pImpEditEngine->GetStatus().AutoPageSize() )
- pImpEditView->RecalcOutputArea();
- pImpEditView->ShowCursor( false, false );
+ getImpl().CalcAnchorPoint();
+ if (getImpEditEngine().GetStatus().AutoPageSize() )
+ getImpl().RecalcOutputArea();
+ getImpl().ShowCursor( false, false );
}
const tools::Rectangle& EditView::GetOutputArea() const
{
- return pImpEditView->GetOutputArea();
+ return getImpl().GetOutputArea();
}
PointerStyle EditView::GetPointer() const
{
- return pImpEditView->GetPointer();
+ return getImpl().GetPointer();
}
vcl::Cursor* EditView::GetCursor() const
{
- return pImpEditView->pCursor.get();
+ return getImpl().GetCursor();
}
void EditView::InsertText( const OUString& rStr, bool bSelect, bool bLOKShowSelect )
{
- EditEngine* pEE = pImpEditView->pEditEngine;
+ EditEngine& rEditEngine = getEditEngine();
if (bLOKShowSelect)
- pImpEditView->DrawSelectionXOR();
+ getImpl().DrawSelectionXOR();
EditPaM aPaM1;
if ( bSelect )
{
- EditSelection aTmpSel( pImpEditView->GetEditSelection() );
- aTmpSel.Adjust( pEE->GetEditDoc() );
+ EditSelection aTmpSel( getImpl().GetEditSelection() );
+ aTmpSel.Adjust(rEditEngine.GetEditDoc());
aPaM1 = aTmpSel.Min();
}
- pEE->UndoActionStart( EDITUNDO_INSERT );
- EditPaM aPaM2( pEE->InsertText( pImpEditView->GetEditSelection(), rStr ) );
- pEE->UndoActionEnd();
+ rEditEngine.UndoActionStart( EDITUNDO_INSERT );
+ EditPaM aPaM2(rEditEngine.InsertText( getImpl().GetEditSelection(), rStr ) );
+ rEditEngine.UndoActionEnd();
if ( bSelect )
{
- DBG_ASSERT( !aPaM1.DbgIsBuggy( pEE->GetEditDoc() ), "Insert: PaM broken" );
- pImpEditView->SetEditSelection( EditSelection( aPaM1, aPaM2 ) );
+ DBG_ASSERT( !aPaM1.DbgIsBuggy(rEditEngine.GetEditDoc()), "Insert: PaM broken" );
+ getImpl().SetEditSelection( EditSelection( aPaM1, aPaM2 ) );
}
else
- pImpEditView->SetEditSelection( EditSelection( aPaM2, aPaM2 ) );
+ getImpl().SetEditSelection( EditSelection( aPaM2, aPaM2 ) );
if (bLOKShowSelect)
- pEE->FormatAndLayout( this );
+ rEditEngine.FormatAndLayout( this );
}
bool EditView::PostKeyEvent( const KeyEvent& rKeyEvent, vcl::Window const * pFrameWin )
{
- return pImpEditView->PostKeyEvent( rKeyEvent, pFrameWin );
+ return getImpl().PostKeyEvent( rKeyEvent, pFrameWin );
}
bool EditView::MouseButtonUp( const MouseEvent& rMouseEvent )
{
- return pImpEditView->MouseButtonUp( rMouseEvent );
+ return getImpl().MouseButtonUp( rMouseEvent );
}
void EditView::ReleaseMouse()
{
- return pImpEditView->ReleaseMouse();
+ return getImpl().ReleaseMouse();
}
bool EditView::MouseButtonDown( const MouseEvent& rMouseEvent )
{
- return pImpEditView->MouseButtonDown( rMouseEvent );
+ return getImpl().MouseButtonDown( rMouseEvent );
}
bool EditView::MouseMove( const MouseEvent& rMouseEvent )
{
- return pImpEditView->MouseMove( rMouseEvent );
+ return getImpl().MouseMove( rMouseEvent );
}
bool EditView::Command(const CommandEvent& rCEvt)
{
- return pImpEditView->Command(rCEvt);
+ return getImpl().Command(rCEvt);
}
void EditView::SetBroadcastLOKViewCursor(bool bSet)
{
- pImpEditView->SetBroadcastLOKViewCursor(bSet);
+ getImpl().SetBroadcastLOKViewCursor(bSet);
}
tools::Rectangle EditView::GetEditCursor() const
{
- return pImpEditView->GetEditCursor();
+ return getImpl().GetEditCursor();
}
void EditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, bool bActivate )
{
- if ( !pImpEditView->pEditEngine->HasView( this ) )
+ if (!getEditEngine().HasView(this))
return;
// The control word is more important:
- if ( !pImpEditView->DoAutoScroll() )
+ if ( !getImpl().DoAutoScroll() )
bGotoCursor = false;
- pImpEditView->ShowCursor( bGotoCursor, bForceVisCursor );
+ getImpl().ShowCursor( bGotoCursor, bForceVisCursor );
- if (pImpEditView->mpViewShell && !bActivate)
+ if (getImpl().mpViewShell && !bActivate)
{
- if (!pImpEditView->pOutWin)
+ if (!getImpl().mpOutputWindow)
return;
- VclPtr<vcl::Window> pParent = pImpEditView->pOutWin->GetParentWithLOKNotifier();
+ VclPtr<vcl::Window> pParent = getImpl().mpOutputWindow->GetParentWithLOKNotifier();
if (pParent && pParent->GetLOKWindowId() != 0)
return;
static const OString aPayload = OString::boolean(true);
- pImpEditView->mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload.getStr());
- pImpEditView->mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", aPayload);
+ getImpl().mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload);
+ getImpl().mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible"_ostr, aPayload);
}
}
void EditView::HideCursor(bool bDeactivate)
{
- pImpEditView->GetCursor()->Hide();
+ getImpl().GetCursor()->Hide();
- if (pImpEditView->mpViewShell && !bDeactivate)
+ if (getImpl().mpViewShell && !bDeactivate)
{
- if (!pImpEditView->pOutWin)
+ if (!getImpl().mpOutputWindow)
return;
- VclPtr<vcl::Window> pParent = pImpEditView->pOutWin->GetParentWithLOKNotifier();
+ VclPtr<vcl::Window> pParent = getImpl().mpOutputWindow->GetParentWithLOKNotifier();
if (pParent && pParent->GetLOKWindowId() != 0)
return;
OString aPayload = OString::boolean(false);
- pImpEditView->mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload.getStr());
- pImpEditView->mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible", aPayload);
+ getImpl().mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, aPayload);
+ getImpl().mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, "visible"_ostr, aPayload);
}
}
Pair EditView::Scroll( tools::Long ndX, tools::Long ndY, ScrollRangeCheck nRangeCheck )
{
- return pImpEditView->Scroll( ndX, ndY, nRangeCheck );
+ return getImpl().Scroll( ndX, ndY, nRangeCheck );
}
const SfxItemSet& EditView::GetEmptyItemSet() const
{
- return pImpEditView->pEditEngine->GetEmptyItemSet();
+ return getEditEngine().GetEmptyItemSet();
}
void EditView::SetAttribs( const SfxItemSet& rSet )
{
- DBG_ASSERT( !pImpEditView->aEditSelection.IsInvalid(), "Blind Selection in..." );
+ DBG_ASSERT(!getImpl().maEditSelection.IsInvalid(), "Blind Selection in...");
- pImpEditView->DrawSelectionXOR();
- pImpEditView->pEditEngine->SetAttribs( pImpEditView->GetEditSelection(), rSet, SetAttribsMode::WholeWord );
- if (pImpEditView->pEditEngine->IsUpdateLayout())
- pImpEditView->pEditEngine->FormatAndLayout( this );
+ getImpl().DrawSelectionXOR();
+ getEditEngine().SetAttribs( getImpl().GetEditSelection(), rSet, SetAttribsMode::WholeWord );
+ if (getEditEngine().IsUpdateLayout())
+ getEditEngine().FormatAndLayout( this );
}
void EditView::RemoveAttribsKeepLanguages( bool bRemoveParaAttribs )
{
- pImpEditView->DrawSelectionXOR();
- pImpEditView->pEditEngine->UndoActionStart( EDITUNDO_RESETATTRIBS );
- EditSelection aSelection( pImpEditView->GetEditSelection() );
+ getImpl().DrawSelectionXOR();
+ getEditEngine().UndoActionStart( EDITUNDO_RESETATTRIBS );
+ EditSelection aSelection( getImpl().GetEditSelection() );
for (sal_uInt16 nWID = EE_ITEMS_START; nWID <= EE_ITEMS_END; ++nWID)
{
@@ -572,12 +601,12 @@ void EditView::RemoveAttribsKeepLanguages( bool bRemoveParaAttribs )
EE_CHAR_LANGUAGE_CJK == nWID ||
EE_CHAR_LANGUAGE_CTL == nWID;
if (!bIsLang)
- pImpEditView->pEditEngine->RemoveCharAttribs( aSelection, bRemoveParaAttribs, nWID );
+ getEditEngine().RemoveCharAttribs( aSelection, bRemoveParaAttribs, nWID );
}
- pImpEditView->pEditEngine->UndoActionEnd();
- if (pImpEditView->pEditEngine->IsUpdateLayout())
- pImpEditView->pEditEngine->FormatAndLayout( this );
+ getEditEngine().UndoActionEnd();
+ if (getEditEngine().IsUpdateLayout())
+ getEditEngine().FormatAndLayout( this );
}
void EditView::RemoveAttribs( bool bRemoveParaAttribs, sal_uInt16 nWhich )
@@ -588,50 +617,50 @@ void EditView::RemoveAttribs( bool bRemoveParaAttribs, sal_uInt16 nWhich )
void EditView::RemoveAttribs( EERemoveParaAttribsMode eMode, sal_uInt16 nWhich )
{
- pImpEditView->DrawSelectionXOR();
- pImpEditView->pEditEngine->UndoActionStart( EDITUNDO_RESETATTRIBS );
- pImpEditView->pEditEngine->RemoveCharAttribs( pImpEditView->GetEditSelection(), eMode, nWhich );
- pImpEditView->pEditEngine->UndoActionEnd();
- if (pImpEditView->pEditEngine->IsUpdateLayout())
- pImpEditView->pEditEngine->FormatAndLayout( this );
+ getImpl().DrawSelectionXOR();
+ getEditEngine().UndoActionStart( EDITUNDO_RESETATTRIBS );
+ getEditEngine().RemoveCharAttribs( getImpl().GetEditSelection(), eMode, nWhich );
+ getEditEngine().UndoActionEnd();
+ if (getEditEngine().IsUpdateLayout())
+ getEditEngine().FormatAndLayout( this );
}
void EditView::RemoveCharAttribs( sal_Int32 nPara, sal_uInt16 nWhich )
{
- pImpEditView->pEditEngine->UndoActionStart( EDITUNDO_RESETATTRIBS );
- pImpEditView->pEditEngine->RemoveCharAttribs( nPara, nWhich );
- pImpEditView->pEditEngine->UndoActionEnd();
- if (pImpEditView->pEditEngine->IsUpdateLayout())
- pImpEditView->pEditEngine->FormatAndLayout( this );
+ getEditEngine().UndoActionStart( EDITUNDO_RESETATTRIBS );
+ getEditEngine().RemoveCharAttribs( nPara, nWhich );
+ getEditEngine().UndoActionEnd();
+ if (getEditEngine().IsUpdateLayout())
+ getEditEngine().FormatAndLayout( this );
}
SfxItemSet EditView::GetAttribs()
{
- DBG_ASSERT( !pImpEditView->aEditSelection.IsInvalid(), "Blind Selection in..." );
- return pImpEditView->pEditEngine->pImpEditEngine->GetAttribs( pImpEditView->GetEditSelection() );
+ DBG_ASSERT(!getImpl().maEditSelection.IsInvalid(), "Blind Selection in...");
+ return getImpEditEngine().GetAttribs( getImpl().GetEditSelection() );
}
void EditView::Undo()
{
- pImpEditView->pEditEngine->Undo( this );
+ getEditEngine().Undo( this );
}
void EditView::Redo()
{
- pImpEditView->pEditEngine->Redo( this );
+ getEditEngine().Redo( this );
}
ErrCode EditView::Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs )
{
- EditSelection aOldSel( pImpEditView->GetEditSelection() );
- pImpEditView->DrawSelectionXOR();
- pImpEditView->pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_READ );
- EditPaM aEndPaM = pImpEditView->pEditEngine->pImpEditEngine->Read( rInput, "", eFormat, aOldSel, pHTTPHeaderAttrs );
- pImpEditView->pEditEngine->pImpEditEngine->UndoActionEnd();
+ EditSelection aOldSel( getImpl().GetEditSelection() );
+ getImpl().DrawSelectionXOR();
+ getImpEditEngine().UndoActionStart( EDITUNDO_READ );
+ EditPaM aEndPaM = getImpEditEngine().Read( rInput, "", eFormat, aOldSel, pHTTPHeaderAttrs );
+ getImpEditEngine().UndoActionEnd();
EditSelection aNewSel( aEndPaM, aEndPaM );
- pImpEditView->SetEditSelection( aNewSel );
- bool bGotoCursor = pImpEditView->DoAutoScroll();
+ getImpl().SetEditSelection( aNewSel );
+ bool bGotoCursor = getImpl().DoAutoScroll();
ShowCursor( bGotoCursor );
return rInput.GetError();
@@ -640,158 +669,158 @@ ErrCode EditView::Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueIterat
void EditView::Cut()
{
Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(GetClipboard());
- pImpEditView->CutCopy( aClipBoard, true );
+ getImpl().CutCopy( aClipBoard, true );
}
Reference<css::datatransfer::clipboard::XClipboard> EditView::GetClipboard() const
{
- return pImpEditView->GetClipboard();
+ return getImpl().GetClipboard();
}
css::uno::Reference< css::datatransfer::XTransferable > EditView::GetTransferable() const
{
- uno::Reference< datatransfer::XTransferable > xData =
- GetEditEngine()->CreateTransferable( pImpEditView->GetEditSelection() );
+ uno::Reference< datatransfer::XTransferable > xData = getEditEngine().CreateTransferable( getImpl().GetEditSelection() );
return xData;
}
void EditView::Copy()
{
Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(GetClipboard());
- pImpEditView->CutCopy( aClipBoard, false );
+ getImpl().CutCopy( aClipBoard, false );
}
void EditView::Paste()
{
Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(GetClipboard());
- pImpEditView->Paste( aClipBoard );
+ getImpl().Paste( aClipBoard );
}
-void EditView::PasteSpecial()
+void EditView::PasteSpecial(SotClipboardFormatId format)
{
Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(GetClipboard());
- pImpEditView->Paste(aClipBoard, true );
+ getImpl().Paste(aClipBoard, true, format );
}
Point EditView::GetWindowPosTopLeft( sal_Int32 nParagraph )
{
- Point aDocPos( pImpEditView->pEditEngine->GetDocPosTopLeft( nParagraph ) );
- return pImpEditView->GetWindowPos( aDocPos );
+ Point aDocPos(getEditEngine().GetDocPosTopLeft(nParagraph));
+ return getImpl().GetWindowPos( aDocPos );
}
void EditView::SetSelectionMode( EESelectionMode eMode )
{
- pImpEditView->SetSelectionMode( eMode );
+ getImpl().SetSelectionMode( eMode );
}
OUString EditView::GetSelected() const
{
- return pImpEditView->pEditEngine->pImpEditEngine->GetSelected( pImpEditView->GetEditSelection() );
+ return getImpEditEngine().GetSelected( getImpl().GetEditSelection() );
}
void EditView::MoveParagraphs( Range aParagraphs, sal_Int32 nNewPos )
{
- pImpEditView->pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_MOVEPARAS );
- pImpEditView->pEditEngine->pImpEditEngine->MoveParagraphs( aParagraphs, nNewPos, this );
- pImpEditView->pEditEngine->pImpEditEngine->UndoActionEnd();
+ getImpEditEngine().UndoActionStart( EDITUNDO_MOVEPARAS );
+ getImpEditEngine().MoveParagraphs( aParagraphs, nNewPos, this );
+ getImpEditEngine().UndoActionEnd();
}
void EditView::MoveParagraphs( tools::Long nDiff )
{
ESelection aSel = GetSelection();
Range aRange( aSel.nStartPara, aSel.nEndPara );
- aRange.Justify();
+ aRange.Normalize();
tools::Long nDest = ( nDiff > 0 ? aRange.Max() : aRange.Min() ) + nDiff;
if ( nDiff > 0 )
nDest++;
- DBG_ASSERT( ( nDest >= 0 ) && ( nDest <= pImpEditView->pEditEngine->GetParagraphCount() ), "MoveParagraphs - wrong Parameters!" );
+ DBG_ASSERT( ( nDest >= 0 ) && ( nDest <= getEditEngine().GetParagraphCount() ), "MoveParagraphs - wrong Parameters!" );
MoveParagraphs( aRange, sal::static_int_cast< sal_Int32 >( nDest ) );
}
void EditView::SetBackgroundColor( const Color& rColor )
{
- pImpEditView->SetBackgroundColor( rColor );
+ getImpl().SetBackgroundColor( rColor );
+ getEditEngine().SetBackgroundColor( rColor );
}
Color const & EditView::GetBackgroundColor() const
{
- return pImpEditView->GetBackgroundColor();
+ return getImpl().GetBackgroundColor();
}
void EditView::RegisterViewShell(OutlinerViewShell* pViewShell)
{
- pImpEditView->RegisterViewShell(pViewShell);
+ getImpl().RegisterViewShell(pViewShell);
}
void EditView::RegisterOtherShell(OutlinerViewShell* pOtherShell)
{
- pImpEditView->RegisterOtherShell(pOtherShell);
+ getImpl().RegisterOtherShell(pOtherShell);
}
void EditView::SetControlWord( EVControlBits nWord )
{
- pImpEditView->nControl = nWord;
+ getImpl().mnControl = nWord;
}
EVControlBits EditView::GetControlWord() const
{
- return pImpEditView->nControl;
+ return getImpl().mnControl;
}
std::unique_ptr<EditTextObject> EditView::CreateTextObject()
{
- return pImpEditView->pEditEngine->pImpEditEngine->CreateTextObject( pImpEditView->GetEditSelection() );
+ return getImpEditEngine().CreateTextObject( getImpl().GetEditSelection() );
}
void EditView::InsertText( const EditTextObject& rTextObject )
{
- pImpEditView->DrawSelectionXOR();
+ getImpl().DrawSelectionXOR();
- pImpEditView->pEditEngine->UndoActionStart( EDITUNDO_INSERT );
- EditSelection aTextSel( pImpEditView->pEditEngine->InsertText( rTextObject, pImpEditView->GetEditSelection() ) );
- pImpEditView->pEditEngine->UndoActionEnd();
+ getEditEngine().UndoActionStart( EDITUNDO_INSERT );
+ EditSelection aTextSel(getEditEngine().InsertText(rTextObject, getImpl().GetEditSelection()));
+ getEditEngine().UndoActionEnd();
aTextSel.Min() = aTextSel.Max(); // Selection not retained.
- pImpEditView->SetEditSelection( aTextSel );
- if (pImpEditView->pEditEngine->IsUpdateLayout())
- pImpEditView->pEditEngine->FormatAndLayout( this );
+ getImpl().SetEditSelection( aTextSel );
+ if (getEditEngine().IsUpdateLayout())
+ getEditEngine().FormatAndLayout( this );
}
void EditView::InsertText( css::uno::Reference< css::datatransfer::XTransferable > const & xDataObj, const OUString& rBaseURL, bool bUseSpecial )
{
- pImpEditView->pEditEngine->UndoActionStart( EDITUNDO_INSERT );
- pImpEditView->DeleteSelected();
+ getEditEngine().UndoActionStart( EDITUNDO_INSERT );
+ getImpl().DeleteSelected();
EditSelection aTextSel =
- pImpEditView->pEditEngine->InsertText(xDataObj, rBaseURL, pImpEditView->GetEditSelection().Max(), bUseSpecial);
- pImpEditView->pEditEngine->UndoActionEnd();
+ getEditEngine().InsertText(xDataObj, rBaseURL, getImpl().GetEditSelection().Max(), bUseSpecial);
+ getEditEngine().UndoActionEnd();
aTextSel.Min() = aTextSel.Max(); // Selection not retained.
- pImpEditView->SetEditSelection( aTextSel );
- if (pImpEditView->pEditEngine->IsUpdateLayout())
- pImpEditView->pEditEngine->FormatAndLayout( this );
+ getImpl().SetEditSelection( aTextSel );
+ if (getEditEngine().IsUpdateLayout())
+ getEditEngine().FormatAndLayout( this );
}
bool EditView::SetEditEngineUpdateLayout( bool bUpdate )
{
- return pImpEditView->pEditEngine->pImpEditEngine->SetUpdateLayout( bUpdate, this );
+ return getImpEditEngine().SetUpdateLayout( bUpdate, this );
}
void EditView::ForceLayoutCalculation()
{
- pImpEditView->pEditEngine->pImpEditEngine->SetUpdateLayout( true, this, true );
+ getImpEditEngine().SetUpdateLayout( true, this, true );
}
SfxStyleSheet* EditView::GetStyleSheet()
{
- EditSelection aSel( pImpEditView->GetEditSelection() );
- aSel.Adjust( pImpEditView->pEditEngine->GetEditDoc() );
- sal_Int32 nStartPara = pImpEditView->pEditEngine->GetEditDoc().GetPos( aSel.Min().GetNode() );
- sal_Int32 nEndPara = pImpEditView->pEditEngine->GetEditDoc().GetPos( aSel.Max().GetNode() );
+ EditSelection aSel( getImpl().GetEditSelection() );
+ aSel.Adjust(getEditEngine().GetEditDoc());
+ sal_Int32 nStartPara = getEditEngine().GetEditDoc().GetPos( aSel.Min().GetNode() );
+ sal_Int32 nEndPara = getEditEngine().GetEditDoc().GetPos( aSel.Max().GetNode() );
SfxStyleSheet* pStyle = nullptr;
for ( sal_Int32 n = nStartPara; n <= nEndPara; n++ )
{
- SfxStyleSheet* pTmpStyle = pImpEditView->pEditEngine->GetStyleSheet( n );
+ SfxStyleSheet* pTmpStyle = getEditEngine().GetStyleSheet( n );
if ( ( n != nStartPara ) && ( pStyle != pTmpStyle ) )
return nullptr; // Not unique.
pStyle = pTmpStyle;
@@ -806,76 +835,76 @@ const SfxStyleSheet* EditView::GetStyleSheet() const
bool EditView::IsInsertMode() const
{
- return pImpEditView->IsInsertMode();
+ return getImpl().IsInsertMode();
}
void EditView::SetInsertMode( bool bInsert )
{
- pImpEditView->SetInsertMode( bInsert );
+ getImpl().SetInsertMode( bInsert );
}
void EditView::SetAnchorMode( EEAnchorMode eMode )
{
- pImpEditView->SetAnchorMode( eMode );
+ getImpl().SetAnchorMode( eMode );
}
EEAnchorMode EditView::GetAnchorMode() const
{
- return pImpEditView->GetAnchorMode();
+ return getImpl().GetAnchorMode();
}
void EditView::TransliterateText( TransliterationFlags nTransliterationMode )
{
- EditSelection aOldSel( pImpEditView->GetEditSelection() );
- EditSelection aNewSel = pImpEditView->pEditEngine->TransliterateText( pImpEditView->GetEditSelection(), nTransliterationMode );
+ EditSelection aOldSel( getImpl().GetEditSelection() );
+ EditSelection aNewSel = getEditEngine().TransliterateText( getImpl().GetEditSelection(), nTransliterationMode );
if ( aNewSel != aOldSel )
{
- pImpEditView->DrawSelectionXOR();
- pImpEditView->SetEditSelection( aNewSel );
- pImpEditView->DrawSelectionXOR();
+ getImpl().DrawSelectionXOR();
+ getImpl().SetEditSelection( aNewSel );
+ getImpl().DrawSelectionXOR();
}
}
void EditView::CompleteAutoCorrect( vcl::Window const * pFrameWin )
{
- if ( !HasSelection() && pImpEditView->pEditEngine->pImpEditEngine->GetStatus().DoAutoCorrect() )
+ if ( !HasSelection() && getImpEditEngine().GetStatus().DoAutoCorrect() )
{
- pImpEditView->DrawSelectionXOR();
- EditSelection aSel = pImpEditView->GetEditSelection();
- aSel = pImpEditView->pEditEngine->EndOfWord( aSel.Max() );
- aSel = pImpEditView->pEditEngine->pImpEditEngine->AutoCorrect( aSel, 0, !IsInsertMode(), pFrameWin );
- pImpEditView->SetEditSelection( aSel );
- if ( pImpEditView->pEditEngine->IsModified() )
- pImpEditView->pEditEngine->FormatAndLayout( this );
+ getImpl().DrawSelectionXOR();
+ EditSelection aSel = getImpl().GetEditSelection();
+ aSel = getEditEngine().EndOfWord( aSel.Max() );
+ aSel = getImpEditEngine().AutoCorrect( aSel, 0, !IsInsertMode(), pFrameWin );
+ getImpl().SetEditSelection( aSel );
+ if (getEditEngine().IsModified())
+ getEditEngine().FormatAndLayout( this );
}
}
EESpellState EditView::StartSpeller(weld::Widget* pDialogParent, bool bMultipleDoc)
{
- if ( !pImpEditView->pEditEngine->pImpEditEngine->GetSpeller().is() )
+ if (!getImpEditEngine().GetSpeller().is())
return EESpellState::NoSpeller;
- return pImpEditView->pEditEngine->pImpEditEngine->Spell(this, pDialogParent, bMultipleDoc);
+ return getImpEditEngine().Spell(this, pDialogParent, bMultipleDoc);
}
EESpellState EditView::StartThesaurus(weld::Widget* pDialogParent)
{
- if ( !pImpEditView->pEditEngine->pImpEditEngine->GetSpeller().is() )
+ if (!getImpEditEngine().GetSpeller().is())
return EESpellState::NoSpeller;
- return pImpEditView->pEditEngine->pImpEditEngine->StartThesaurus(this, pDialogParent);
+ return getImpEditEngine().StartThesaurus(this, pDialogParent);
}
void EditView::StartTextConversion(weld::Widget* pDialogParent,
LanguageType nSrcLang, LanguageType nDestLang, const vcl::Font *pDestFont,
sal_Int32 nOptions, bool bIsInteractive, bool bMultipleDoc )
{
- pImpEditView->pEditEngine->pImpEditEngine->Convert(this, pDialogParent, nSrcLang, nDestLang, pDestFont, nOptions, bIsInteractive, bMultipleDoc);
+ getImpEditEngine().Convert(this, pDialogParent, nSrcLang, nDestLang, pDestFont, nOptions, bIsInteractive, bMultipleDoc);
}
sal_Int32 EditView::StartSearchAndReplace( const SvxSearchItem& rSearchItem )
{
- return pImpEditView->pEditEngine->pImpEditEngine->StartSearchAndReplace( this, rSearchItem );
+ return getImpEditEngine().StartSearchAndReplace( this, rSearchItem );
}
bool EditView::IsCursorAtWrongSpelledWord()
@@ -883,18 +912,18 @@ bool EditView::IsCursorAtWrongSpelledWord()
bool bIsWrong = false;
if ( !HasSelection() )
{
- EditPaM aPaM = pImpEditView->GetEditSelection().Max();
- bIsWrong = pImpEditView->IsWrongSpelledWord( aPaM, false/*bMarkIfWrong*/ );
+ EditPaM aPaM = getImpl().GetEditSelection().Max();
+ bIsWrong = getImpl().IsWrongSpelledWord( aPaM, false/*bMarkIfWrong*/ );
}
return bIsWrong;
}
bool EditView::IsWrongSpelledWordAtPos( const Point& rPosPixel, bool bMarkIfWrong )
{
- Point aPos(pImpEditView->GetOutputDevice().PixelToLogic(rPosPixel));
- aPos = pImpEditView->GetDocPos( aPos );
- EditPaM aPaM = pImpEditView->pEditEngine->GetPaM(aPos, false);
- return pImpEditView->IsWrongSpelledWord( aPaM , bMarkIfWrong );
+ Point aPos(getImpl().GetOutputDevice().PixelToLogic(rPosPixel));
+ aPos = getImpl().GetDocPos( aPos );
+ EditPaM aPaM = getEditEngine().GetPaM(aPos, false);
+ return getImpl().IsWrongSpelledWord( aPaM , bMarkIfWrong );
}
static void LOKSendSpellPopupMenu(const weld::Menu& rMenu, LanguageType nGuessLangWord,
@@ -915,7 +944,7 @@ static void LOKSendSpellPopupMenu(const weld::Menu& rMenu, LanguageType nGuessLa
{
for(int i = 0; i < nSuggestions; ++i)
{
- OString sItemId = OString::number(MN_ALTSTART + i);
+ OUString sItemId = OUString::number(MN_ALTSTART + i);
OUString sText = rMenu.get_label(sItemId);
aItemTree.put("text", sText.toUtf8().getStr());
aItemTree.put("type", "command");
@@ -967,28 +996,28 @@ static void LOKSendSpellPopupMenu(const weld::Menu& rMenu, LanguageType nGuessLa
std::stringstream aStream;
boost::property_tree::write_json(aStream, aRoot, true);
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, aStream.str().c_str());
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, OString(aStream.str()));
}
-void EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbackInfo&,void> &rCallBack)
+bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbackInfo&,void> &rCallBack)
{
- OutputDevice& rDevice = pImpEditView->GetOutputDevice();
+ OutputDevice& rDevice = getImpl().GetOutputDevice();
Point aPos(rDevice.PixelToLogic(rPosPixel));
- aPos = pImpEditView->GetDocPos( aPos );
- EditPaM aPaM = pImpEditView->pEditEngine->GetPaM(aPos, false);
- Reference< linguistic2::XSpellChecker1 > xSpeller( pImpEditView->pEditEngine->pImpEditEngine->GetSpeller() );
+ aPos = getImpl().GetDocPos( aPos );
+ EditPaM aPaM = getEditEngine().GetPaM(aPos, false);
+ Reference< linguistic2::XSpellChecker1 > xSpeller(getImpEditEngine().GetSpeller());
ESelection aOldSel = GetSelection();
- if ( !(xSpeller.is() && pImpEditView->IsWrongSpelledWord( aPaM, true )) )
- return;
+ if ( !(xSpeller.is() && getImpl().IsWrongSpelledWord( aPaM, true )) )
+ return false;
// PaMtoEditCursor returns Logical units
- tools::Rectangle aTempRect = pImpEditView->pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM, GetCursorFlags::TextOnly );
+ tools::Rectangle aTempRect = getImpEditEngine().PaMtoEditCursor(aPaM, CursorFlags{ .bTextOnly = true });
// GetWindowPos works in Logical units
- aTempRect = pImpEditView->GetWindowPos(aTempRect);
+ aTempRect = getImpl().GetWindowPos(aTempRect);
// Convert to pixels
aTempRect = rDevice.LogicToPixel(aTempRect);
- weld::Widget* pPopupParent = pImpEditView->GetPopupParent(aTempRect);
+ weld::Widget* pPopupParent = getImpl().GetPopupParent(aTempRect);
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pPopupParent, "editeng/ui/spellmenu.ui"));
std::unique_ptr<weld::Menu> xPopupMenu(xBuilder->weld_menu("editviewspellmenu"));
std::unique_ptr<weld::Menu> xInsertMenu(xBuilder->weld_menu("insertmenu")); // add word to user-dictionaries
@@ -1010,14 +1039,11 @@ void EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
// than returning e.g. 16 suggestions and using only the
// first 7. Thus we hand down the value to use to that
// implementation here by providing an additional parameter.
- Sequence< PropertyValue > aPropVals(1);
- PropertyValue &rVal = aPropVals.getArray()[0];
- rVal.Name = UPN_MAX_NUMBER_OF_SUGGESTIONS;
- rVal.Value <<= sal_Int16(7);
+ Sequence< PropertyValue > aPropVals { comphelper::makePropertyValue(UPN_MAX_NUMBER_OF_SUGGESTIONS, sal_Int16(7)) };
// Are there any replace suggestions?
Reference< linguistic2::XSpellAlternatives > xSpellAlt =
- xSpeller->spell( aSelected, static_cast<sal_uInt16>(pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 )), aPropVals );
+ xSpeller->spell( aSelected, static_cast<sal_uInt16>(getImpEditEngine().GetLanguage( aPaM2 ).nLang), aPropVals );
Reference< linguistic2::XLanguageGuessing > xLangGuesser( EditDLL::Get().GetGlobalData()->GetLanguageGuesser() );
@@ -1070,10 +1096,11 @@ void EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
for ( sal_uInt16 nW = 0; nW < nWords; nW++ )
{
OUString aAlternate( pAlt[nW] );
- xPopupMenu->append(OUString::number(MN_ALTSTART + nW), aAlternate);
- xAutoMenu->append(OUString::number(MN_AUTOSTART + nW), aAlternate);
+ OUString sId(OUString::number(MN_ALTSTART + nW));
+ xPopupMenu->insert(nW, sId, aAlternate, nullptr, nullptr, nullptr, TRISTATE_INDET);
+ xAutoMenu->append(sId, aAlternate);
}
- xPopupMenu->append_separator("separator2");
+ xPopupMenu->insert_separator(nWords, "separator2");
}
else
{
@@ -1097,7 +1124,7 @@ void EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
aDics = xDicList->getDictionaries();
pDic = aDics.getConstArray();
- LanguageType nCheckedLanguage = pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 );
+ LanguageType nCheckedLanguage = getImpEditEngine().GetLanguage( aPaM2 ).nLang;
sal_uInt16 nDicCount = static_cast<sal_uInt16>(aDics.getLength());
for (sal_uInt16 i = 0; i < nDicCount; i++)
{
@@ -1153,32 +1180,26 @@ void EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
//because the loss of focus in the current editeng causes writer
//annotations to save their contents, making the pContent of the
//current EditPams invalid
- EPaM aP = pImpEditView->pEditEngine->pImpEditEngine->CreateEPaM(aPaM);
- EPaM aP2 = pImpEditView->pEditEngine->pImpEditEngine->CreateEPaM(aPaM2);
+ EPaM aP = getImpEditEngine().CreateEPaM(aPaM);
+ EPaM aP2 = getImpEditEngine().CreateEPaM(aPaM2);
if (comphelper::LibreOfficeKit::isActive())
{
xPopupMenu->remove("autocorrect");
xPopupMenu->remove("autocorrectdlg");
- // For mobile phones, send the context menu structure
- const SfxViewShell* pViewShell = SfxViewShell::Current();
- if (pViewShell && pViewShell->isLOKMobilePhone())
- {
- LOKSendSpellPopupMenu(*xPopupMenu, nGuessLangWord, nGuessLangPara, nWords);
- return;
- }
- // note, there is special handling of this menu 'editviewspellmenu' by vcl's PopupMenu::ImplExecute
+ LOKSendSpellPopupMenu(*xPopupMenu, nGuessLangWord, nGuessLangPara, nWords);
+ return true;
}
- OString sId = xPopupMenu->popup_at_rect(pPopupParent, aTempRect);
+ OUString sId = xPopupMenu->popup_at_rect(pPopupParent, aTempRect);
- aPaM2 = pImpEditView->pEditEngine->pImpEditEngine->CreateEditPaM(aP2);
- aPaM = pImpEditView->pEditEngine->pImpEditEngine->CreateEditPaM(aP);
+ aPaM2 = getImpEditEngine().CreateEditPaM(aP2);
+ aPaM = getImpEditEngine().CreateEditPaM(aP);
if (sId == "ignore")
{
- OUString aWord = pImpEditView->SpellIgnoreWord();
+ OUString aWord = getImpl().SpellIgnoreWord();
SpellCallbackInfo aInf( SpellCallbackCommand::IGNOREWORD, aWord );
rCallBack.Call(aInf);
SetSelection( aOldSel );
@@ -1188,7 +1209,7 @@ void EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
LanguageType nLangToUse = (sId == "wordlanguage") ? nGuessLangWord : nGuessLangPara;
SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLangToUse );
- SfxItemSet aAttrs = GetEditEngine()->GetEmptyItemSet();
+ SfxItemSet aAttrs = getEditEngine().GetEmptyItemSet();
if (nScriptType == SvtScriptType::LATIN)
aAttrs.Put( SvxLanguageItem( nLangToUse, EE_CHAR_LANGUAGE ) );
if (nScriptType == SvtScriptType::COMPLEX)
@@ -1203,7 +1224,7 @@ void EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
SetSelection( aSel );
}
SetAttribs( aAttrs );
- pImpEditView->pEditEngine->pImpEditEngine->StartOnlineSpellTimer();
+ getImpEditEngine().StartOnlineSpellTimer();
SpellCallbackInfo aInf((sId == "wordlanguage") ? SpellCallbackCommand::WORDLANGUAGE : SpellCallbackCommand::PARALANGUAGE);
rCallBack.Call(aInf);
@@ -1224,6 +1245,7 @@ void EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
OUString aDicName;
if (sId.toInt32() >= MN_DICTSTART)
{
+ assert(xInsertMenu && "this case only occurs when xInsertMenu exists");
// strip_mnemonic is necessary to retrieve the correct dictionary name
aDicName = pPopupParent->strip_mnemonic(xInsertMenu->get_label(sId));
}
@@ -1242,7 +1264,7 @@ void EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
xSavDic->store();
aPaM.GetNode()->GetWrongList()->ResetInvalidRange(0, aPaM.GetNode()->Len());
- pImpEditView->pEditEngine->pImpEditEngine->StartOnlineSpellTimer();
+ getImpEditEngine().StartOnlineSpellTimer();
SpellCallbackInfo aInf( SpellCallbackCommand::ADDTODICTIONARY, aSelected );
rCallBack.Call(aInf);
@@ -1254,7 +1276,7 @@ void EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
OUString aWord = pAlt[sId.toInt32() - MN_AUTOSTART];
SvxAutoCorrect* pAutoCorrect = SvxAutoCorrCfg::Get().GetAutoCorrect();
if ( pAutoCorrect )
- pAutoCorrect->PutText( aSelected, aWord, pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 ) );
+ pAutoCorrect->PutText( aSelected, aWord, getImpEditEngine().GetLanguage( aPaM2 ).nLang );
InsertText( aWord );
}
else if ( sId.toInt32() >= MN_ALTSTART ) // Replace
@@ -1267,45 +1289,46 @@ void EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
{
SetSelection( aOldSel );
}
+ return true;
}
OUString EditView::SpellIgnoreWord()
{
- return pImpEditView->SpellIgnoreWord();
+ return getImpl().SpellIgnoreWord();
}
void EditView::SelectCurrentWord( sal_Int16 nWordType )
{
- EditSelection aCurSel( pImpEditView->GetEditSelection() );
- pImpEditView->DrawSelectionXOR();
- aCurSel = pImpEditView->pEditEngine->SelectWord(aCurSel.Max(), nWordType);
- pImpEditView->SetEditSelection( aCurSel );
- pImpEditView->DrawSelectionXOR();
+ EditSelection aCurSel( getImpl().GetEditSelection() );
+ getImpl().DrawSelectionXOR();
+ aCurSel = getEditEngine().SelectWord(aCurSel.Max(), nWordType);
+ getImpl().SetEditSelection( aCurSel );
+ getImpl().DrawSelectionXOR();
ShowCursor( true, false );
}
void EditView::InsertParaBreak()
{
- pImpEditView->pEditEngine->UndoActionStart(EDITUNDO_INSERT);
- pImpEditView->DeleteSelected();
- EditPaM aPaM(pImpEditView->pEditEngine->InsertParaBreak(pImpEditView->GetEditSelection()));
- pImpEditView->pEditEngine->UndoActionEnd();
- pImpEditView->SetEditSelection(EditSelection(aPaM, aPaM));
- if (pImpEditView->pEditEngine->IsUpdateLayout())
- pImpEditView->pEditEngine->FormatAndLayout(this);
+ getEditEngine().UndoActionStart(EDITUNDO_INSERT);
+ getImpl().DeleteSelected();
+ EditPaM aPaM(getEditEngine().InsertParaBreak(getImpl().GetEditSelection()));
+ getEditEngine().UndoActionEnd();
+ getImpl().SetEditSelection(EditSelection(aPaM, aPaM));
+ if (getEditEngine().IsUpdateLayout())
+ getEditEngine().FormatAndLayout(this);
}
void EditView::InsertField( const SvxFieldItem& rFld )
{
- EditEngine* pEE = pImpEditView->pEditEngine;
- pImpEditView->DrawSelectionXOR();
- pEE->UndoActionStart( EDITUNDO_INSERT );
- EditPaM aPaM( pEE->InsertField( pImpEditView->GetEditSelection(), rFld ) );
- pEE->UndoActionEnd();
- pImpEditView->SetEditSelection( EditSelection( aPaM, aPaM ) );
- pEE->UpdateFields();
- if (pImpEditView->pEditEngine->IsUpdateLayout())
- pEE->FormatAndLayout( this );
+ EditEngine& rEditEngine = getImpl().getEditEngine();
+ getImpl().DrawSelectionXOR();
+ rEditEngine.UndoActionStart( EDITUNDO_INSERT );
+ EditPaM aPaM(rEditEngine.InsertField(getImpl().GetEditSelection(), rFld));
+ rEditEngine.UndoActionEnd();
+ getImpl().SetEditSelection( EditSelection( aPaM, aPaM ) );
+ rEditEngine.UpdateFields();
+ if (rEditEngine.IsUpdateLayout())
+ rEditEngine.FormatAndLayout( this );
}
const SvxFieldItem* EditView::GetFieldUnderMousePointer() const
@@ -1317,90 +1340,161 @@ const SvxFieldItem* EditView::GetFieldUnderMousePointer() const
const SvxFieldItem* EditView::GetField( const Point& rPos, sal_Int32* pPara, sal_Int32* pPos ) const
{
- return pImpEditView->GetField( rPos, pPara, pPos );
+ return getImpl().GetField( rPos, pPara, pPos );
}
const SvxFieldItem* EditView::GetFieldUnderMousePointer( sal_Int32& nPara, sal_Int32& nPos ) const
{
Point aPos;
- if (EditViewCallbacks* pEditViewCallbacks = pImpEditView->getEditViewCallbacks())
+ if (EditViewCallbacks* pEditViewCallbacks = getImpl().getEditViewCallbacks())
aPos = pEditViewCallbacks->EditViewPointerPosPixel();
else
- aPos = pImpEditView->GetWindow()->GetPointerPosPixel();
- OutputDevice& rDevice = pImpEditView->GetOutputDevice();
+ aPos = getImpl().GetWindow()->GetPointerPosPixel();
+ OutputDevice& rDevice = getImpl().GetOutputDevice();
aPos = rDevice.PixelToLogic(aPos);
return GetField( aPos, &nPara, &nPos );
}
-const SvxFieldItem* EditView::GetFieldAtSelection() const
+const SvxFieldItem* EditView::GetFieldAtSelection(bool bAlsoCheckBeforeCursor) const
+{
+ bool* pIsBeforeCursor = bAlsoCheckBeforeCursor ? &bAlsoCheckBeforeCursor : nullptr;
+ return GetFieldAtSelection(pIsBeforeCursor);
+}
+
+// If pIsBeforeCursor != nullptr, the position before the cursor will also be checked for a field
+// and pIsBeforeCursor will return true if that fallback field is returned.
+// If no field is returned, the value in pIsBeforeCursor is meaningless.
+const SvxFieldItem* EditView::GetFieldAtSelection(bool* pIsBeforeCursor) const
{
- EditSelection aSel( pImpEditView->GetEditSelection() );
- aSel.Adjust( pImpEditView->pEditEngine->GetEditDoc() );
+ // a field is a dummy character - so it cannot span nodes or be a selection larger than 1
+ EditSelection aSel( getImpl().GetEditSelection() );
+ if (aSel.Min().GetNode() != aSel.Max().GetNode())
+ return nullptr;
+
+ // normalize: min < max
+ aSel.Adjust(getEditEngine().GetEditDoc());
+
+ const sal_Int32 nMinIndex = aSel.Min().GetIndex();
+ const sal_Int32 nMaxIndex = aSel.Max().GetIndex();
+ if (nMaxIndex > nMinIndex + 1)
+ return nullptr;
+
// Only when cursor is in font of field, no selection,
// or only selecting field
- if ( ( aSel.Min().GetNode() == aSel.Max().GetNode() ) &&
- ( ( aSel.Max().GetIndex() == aSel.Min().GetIndex() ) ||
- ( aSel.Max().GetIndex() == aSel.Min().GetIndex()+1 ) ) )
+ bool bAlsoCheckBeforeCursor = false;
+ if (pIsBeforeCursor)
{
- EditPaM aPaM = aSel.Min();
- const CharAttribList::AttribsType& rAttrs = aPaM.GetNode()->GetCharAttribs().GetAttribs();
- const sal_Int32 nXPos = aPaM.GetIndex();
- for (size_t nAttr = rAttrs.size(); nAttr; )
+ *pIsBeforeCursor = false;
+ bAlsoCheckBeforeCursor = nMaxIndex == nMinIndex;
+ }
+ const SvxFieldItem* pFoundBeforeCursor = nullptr;
+ const CharAttribList::AttribsType& rAttrs = aSel.Min().GetNode()->GetCharAttribs().GetAttribs();
+ for (const auto& rAttr: rAttrs)
+ {
+ if (rAttr->Which() == EE_FEATURE_FIELD)
{
- const EditCharAttrib& rAttr = *rAttrs[--nAttr];
- if (rAttr.GetStart() == nXPos)
- if (rAttr.Which() == EE_FEATURE_FIELD)
- {
- DBG_ASSERT(dynamic_cast<const SvxFieldItem* >(rAttr.GetItem() ) != nullptr, "No FieldItem...");
- return static_cast<const SvxFieldItem*>(rAttr.GetItem());
- }
+ DBG_ASSERT(dynamic_cast<const SvxFieldItem*>(rAttr->GetItem()), "No FieldItem...");
+ if (rAttr->GetStart() == nMinIndex)
+ return static_cast<const SvxFieldItem*>(rAttr->GetItem());
+
+ // perhaps the cursor is behind the field?
+ if (nMinIndex && rAttr->GetStart() == nMinIndex - 1)
+ pFoundBeforeCursor = static_cast<const SvxFieldItem*>(rAttr->GetItem());
}
}
+ if (bAlsoCheckBeforeCursor)
+ {
+ *pIsBeforeCursor = /*(bool)*/pFoundBeforeCursor;
+ return pFoundBeforeCursor;
+ }
return nullptr;
}
void EditView::SelectFieldAtCursor()
{
- const SvxFieldItem* pFieldItem = GetFieldAtSelection();
- if (pFieldItem)
+ bool bIsBeforeCursor = false;
+ const SvxFieldItem* pFieldItem = GetFieldAtSelection(&bIsBeforeCursor);
+ if (!pFieldItem)
+ return;
+
+ // Make sure the whole field is selected
+ // A field is represented by a dummy character - so it cannot be a selection larger than 1
+ ESelection aSel = GetSelection();
+ if (aSel.nStartPos == aSel.nEndPos) // not yet selected
{
- // Make sure the whole field is selected
- ESelection aSel = GetSelection();
- if (aSel.nStartPos == aSel.nEndPos)
+ if (bIsBeforeCursor)
{
- aSel.nEndPos++;
- SetSelection(aSel);
+ assert (aSel.nStartPos);
+ --aSel.nStartPos;
}
+ else
+ aSel.nEndPos++;
+ SetSelection(aSel);
}
+ else
+ assert(std::abs(aSel.nStartPos - aSel.nEndPos) == 1);
+}
+
+const SvxFieldData* EditView::GetFieldUnderMouseOrInSelectionOrAtCursor(bool bAlsoCheckBeforeCursor) const
+{
+ const SvxFieldItem* pFieldItem = GetFieldUnderMousePointer();
if (!pFieldItem)
+ pFieldItem = GetFieldAtSelection(bAlsoCheckBeforeCursor);
+
+ return pFieldItem ? pFieldItem->GetField() : nullptr;
+}
+
+sal_Int32 EditView::countFieldsOffsetSum(sal_Int32 nPara, sal_Int32 nPos, bool bCanOverflow) const
+{
+ int nOffset = 0;
+
+ for (int nCurrentPara = 0; nCurrentPara <= nPara; nCurrentPara++)
{
- // Cursor probably behind the field - extend selection to select the field
- ESelection aSel = GetSelection();
- if (aSel.nStartPos > 0 && aSel.nStartPos == aSel.nEndPos)
+ int nFields = getEditEngine().GetFieldCount( nCurrentPara );
+ for (int nField = 0; nField < nFields; nField++)
{
- aSel.nStartPos--;
- SetSelection(aSel);
+ EFieldInfo aFieldInfo = getEditEngine().GetFieldInfo( nCurrentPara, nField );
+
+ bool bLastPara = nCurrentPara == nPara;
+ sal_Int32 nFieldPos = aFieldInfo.aPosition.nIndex;
+
+ if (bLastPara && nFieldPos >= nPos)
+ break;
+
+ sal_Int32 nFieldLen = aFieldInfo.aCurrentText.getLength();
+
+ // position in the middle of a field
+ if (!bCanOverflow && bLastPara && nFieldPos + nFieldLen > nPos)
+ nFieldLen = nPos - nFieldPos;
+
+ nOffset += nFieldLen - 1;
}
}
+
+ return nOffset;
}
-const SvxFieldData* EditView::GetFieldAtCursor() const
+sal_Int32 EditView::GetPosNoField(sal_Int32 nPara, sal_Int32 nPos) const
{
- const SvxFieldItem* pFieldItem = GetFieldUnderMousePointer();
- if (!pFieldItem)
- pFieldItem = GetFieldAtSelection();
+ sal_Int32 nOffset = countFieldsOffsetSum(nPara, nPos, false);
+ assert(nPos >= nOffset);
+ return nPos - nOffset;
+}
- return pFieldItem ? pFieldItem->GetField() : nullptr;
+sal_Int32 EditView::GetPosWithField(sal_Int32 nPara, sal_Int32 nPos) const
+{
+ sal_Int32 nOffset = countFieldsOffsetSum(nPara, nPos, true);
+ return nPos + nOffset;
}
void EditView::SetInvalidateMore( sal_uInt16 nPixel )
{
- pImpEditView->SetInvalidateMore( nPixel );
+ getImpl().SetInvalidateMore( nPixel );
}
sal_uInt16 EditView::GetInvalidateMore() const
{
- return pImpEditView->GetInvalidateMore();
+ return getImpl().GetInvalidateMore();
}
static void ChangeFontSizeImpl( EditView* pEditView, bool bGrow, const ESelection& rSel, const FontList* pFontList )
@@ -1421,7 +1515,7 @@ static void ChangeFontSizeImpl( EditView* pEditView, bool bGrow, const ESelectio
void EditView::ChangeFontSize( bool bGrow, const FontList* pFontList )
{
- EditEngine& rEditEngine = *pImpEditView->pEditEngine;
+ EditEngine& rEditEngine = getEditEngine();
ESelection aSel( GetSelection() );
ESelection aOldSelection( aSel );
@@ -1556,12 +1650,12 @@ bool EditView::ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFo
OUString EditView::GetSurroundingText() const
{
- EditSelection aSel( pImpEditView->GetEditSelection() );
- aSel.Adjust( pImpEditView->pEditEngine->GetEditDoc() );
+ EditSelection aSel( getImpl().GetEditSelection() );
+ aSel.Adjust(getEditEngine().GetEditDoc());
if( HasSelection() )
{
- OUString aStr = pImpEditView->pEditEngine->GetSelected(aSel);
+ OUString aStr = getEditEngine().GetSelected(aSel);
// Stop reconversion if the selected text includes a line break.
if ( aStr.indexOf( 0x0A ) == -1 )
@@ -1573,7 +1667,7 @@ OUString EditView::GetSurroundingText() const
{
aSel.Min().SetIndex( 0 );
aSel.Max().SetIndex( aSel.Max().GetNode()->Len() );
- return pImpEditView->pEditEngine->GetSelected(aSel);
+ return getEditEngine().GetSelected(aSel);
}
}
@@ -1584,9 +1678,9 @@ Selection EditView::GetSurroundingTextSelection() const
if( HasSelection() )
{
- EditSelection aSel( pImpEditView->GetEditSelection() );
- aSel.Adjust( pImpEditView->pEditEngine->GetEditDoc() );
- OUString aStr = pImpEditView->pEditEngine->GetSelected(aSel);
+ EditSelection aSel( getImpl().GetEditSelection() );
+ aSel.Adjust(getEditEngine().GetEditDoc());
+ OUString aStr = getEditEngine().GetSelected(aSel);
// Stop reconversion if the selected text includes a line break.
if ( aStr.indexOf( 0x0A ) == -1 )
@@ -1613,79 +1707,99 @@ bool EditView::DeleteSurroundingText(const Selection& rRange)
void EditView::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark)
{
- Point aDocPos(pImpEditView->GetDocPos(rPosition));
- EditPaM aPaM = pImpEditView->pEditEngine->GetPaM(aDocPos);
- EditSelection aSelection(pImpEditView->GetEditSelection());
+ Point aDocPos(getImpl().GetDocPos(rPosition));
+ EditPaM aPaM = getEditEngine().GetPaM(aDocPos);
+ EditSelection aSelection(getImpl().GetEditSelection());
// Explicitly create or delete the selection.
if (bClearMark)
{
- pImpEditView->DeselectAll();
- aSelection = pImpEditView->GetEditSelection();
+ getImpl().DeselectAll();
+ aSelection = getImpl().GetEditSelection();
}
else
- pImpEditView->CreateAnchor();
+ getImpl().CreateAnchor();
if (bPoint)
aSelection.Max() = aPaM;
else
aSelection.Min() = aPaM;
- if (pImpEditView->GetEditSelection().Min() != aSelection.Min())
- pImpEditView->pEditEngine->CursorMoved(pImpEditView->GetEditSelection().Min().GetNode());
- pImpEditView->DrawSelectionXOR(aSelection);
- if (pImpEditView->GetEditSelection() != aSelection)
- pImpEditView->SetEditSelection(aSelection);
+ if (getImpl().GetEditSelection().Min() != aSelection.Min())
+ {
+ const ContentNode* pNode(getImpl().GetEditSelection().Min().GetNode());
+ if (nullptr != pNode)
+ pNode->checkAndDeleteEmptyAttribs();
+ }
+
+ getImpl().DrawSelectionXOR(aSelection);
+ if (getImpl().GetEditSelection() != aSelection)
+ getImpl().SetEditSelection(aSelection);
ShowCursor(/*bGotoCursor=*/false);
}
void EditView::DrawSelectionXOR(OutlinerViewShell* pOtherShell)
{
- pImpEditView->RegisterOtherShell(pOtherShell);
- pImpEditView->DrawSelectionXOR();
- pImpEditView->RegisterOtherShell(nullptr);
+ getImpl().RegisterOtherShell(pOtherShell);
+ getImpl().DrawSelectionXOR();
+ getImpl().RegisterOtherShell(nullptr);
}
void EditView::InitLOKSpecialPositioning(MapUnit eUnit,
const tools::Rectangle& rOutputArea,
const Point& rVisDocStartPos)
{
- pImpEditView->InitLOKSpecialPositioning(eUnit, rOutputArea, rVisDocStartPos);
+ getImpl().InitLOKSpecialPositioning(eUnit, rOutputArea, rVisDocStartPos);
}
void EditView::SetLOKSpecialOutputArea(const tools::Rectangle& rOutputArea)
{
- pImpEditView->SetLOKSpecialOutputArea(rOutputArea);
+ getImpl().SetLOKSpecialOutputArea(rOutputArea);
}
const tools::Rectangle & EditView::GetLOKSpecialOutputArea() const
{
- return pImpEditView->GetLOKSpecialOutputArea();
+ return getImpl().GetLOKSpecialOutputArea();
}
void EditView::SetLOKSpecialVisArea(const tools::Rectangle& rVisArea)
{
- pImpEditView->SetLOKSpecialVisArea(rVisArea);
+ getImpl().SetLOKSpecialVisArea(rVisArea);
}
tools::Rectangle EditView::GetLOKSpecialVisArea() const
{
- return pImpEditView->GetLOKSpecialVisArea();
+ return getImpl().GetLOKSpecialVisArea();
}
bool EditView::HasLOKSpecialPositioning() const
{
- return pImpEditView->HasLOKSpecialPositioning();
+ return getImpl().HasLOKSpecialPositioning();
+}
+
+void EditView::SetLOKSpecialFlags(LOKSpecialFlags eFlags)
+{
+ getImpl().SetLOKSpecialFlags(eFlags);
}
void EditView::SuppressLOKMessages(bool bSet)
{
- pImpEditView->SuppressLOKMessages(bSet);
+ getImpl().SuppressLOKMessages(bSet);
}
bool EditView::IsSuppressLOKMessages() const
{
- return pImpEditView->IsSuppressLOKMessages();
+ return getImpl().IsSuppressLOKMessages();
+}
+
+void EditView::SetNegativeX(bool bSet)
+{
+ getImpl().SetNegativeX(bSet);
+}
+
+bool EditView::IsNegativeX() const
+{
+ return getImpl().IsNegativeX();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */