[Libreoffice-commits] .: 9 commits - editeng/inc editeng/Library_editeng.mk editeng/source sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Fri Apr 13 21:42:23 PDT 2012
editeng/Library_editeng.mk | 1
editeng/inc/editeng/editdata.hxx | 3
editeng/inc/editeng/editeng.hxx | 140 ++++++++++----
editeng/source/editeng/editdata.cxx | 35 +++
editeng/source/editeng/editdoc.cxx | 36 +--
editeng/source/editeng/editdoc.hxx | 5
editeng/source/editeng/editeng.cxx | 208 ++++++++++++++++++----
editeng/source/editeng/editundo.cxx | 16 -
editeng/source/editeng/editview.cxx | 28 +-
editeng/source/editeng/eertfpar.cxx | 10 -
editeng/source/editeng/impedit.cxx | 101 +++++-----
editeng/source/editeng/impedit.hxx | 18 -
editeng/source/editeng/impedit2.cxx | 42 ++--
editeng/source/editeng/impedit3.cxx | 26 +-
editeng/source/editeng/impedit4.cxx | 20 +-
editeng/source/editeng/impedit5.cxx | 20 +-
sc/source/ui/Accessibility/AccessibleDocument.cxx | 4
sc/source/ui/app/inputwin.cxx | 2
sc/source/ui/inc/AccessibleEditObject.hxx | 15 -
sc/source/ui/pagedlg/tphfedit.cxx | 2
20 files changed, 488 insertions(+), 244 deletions(-)
New commits:
commit 70d27eddd2e86fc525c0c482496f4f4803efafae
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Sat Apr 14 00:42:50 2012 -0400
This must be const.
diff --git a/editeng/inc/editeng/editdata.hxx b/editeng/inc/editeng/editdata.hxx
index 4cedc89..9fbbc92 100644
--- a/editeng/inc/editeng/editdata.hxx
+++ b/editeng/inc/editeng/editdata.hxx
@@ -54,7 +54,7 @@ enum EVAnchorMode {
#define EE_PARA_ALL 0xFFFF
#define EE_INDEX_NOT_FOUND 0xFFFF
-EDITENG_DLLPUBLIC extern size_t EE_APPEND;
+EDITENG_DLLPUBLIC extern const size_t EE_APPEND;
// Error messages for Read / Write Method
#define EE_READWRITE_OK (SVSTREAM_OK)
diff --git a/editeng/source/editeng/editdata.cxx b/editeng/source/editeng/editdata.cxx
index 2aaa093..f06a9c7 100644
--- a/editeng/source/editeng/editdata.cxx
+++ b/editeng/source/editeng/editdata.cxx
@@ -30,6 +30,6 @@
#include <limits>
-size_t EE_APPEND = std::numeric_limits<size_t>::max();
+const size_t EE_APPEND = std::numeric_limits<size_t>::max();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 7b74902db2ad3185e7b61ab4a15385e5a6db06a8
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Sat Apr 14 00:19:51 2012 -0400
Export this to get it to build in forms.
diff --git a/editeng/inc/editeng/editdata.hxx b/editeng/inc/editeng/editdata.hxx
index f9c88c3..4cedc89 100644
--- a/editeng/inc/editeng/editdata.hxx
+++ b/editeng/inc/editeng/editdata.hxx
@@ -54,7 +54,7 @@ enum EVAnchorMode {
#define EE_PARA_ALL 0xFFFF
#define EE_INDEX_NOT_FOUND 0xFFFF
-extern size_t EE_APPEND;
+EDITENG_DLLPUBLIC extern size_t EE_APPEND;
// Error messages for Read / Write Method
#define EE_READWRITE_OK (SVSTREAM_OK)
commit b447f763f2739ef57f82183a8ff6af493bf031b2
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Apr 13 23:22:57 2012 -0400
EE_APPEND now has to be the max value of size_t.
diff --git a/editeng/Library_editeng.mk b/editeng/Library_editeng.mk
index fb2193e..3645247 100644
--- a/editeng/Library_editeng.mk
+++ b/editeng/Library_editeng.mk
@@ -55,6 +55,7 @@ $(eval $(call gb_Library_add_exception_objects,editeng,\
editeng/source/accessibility/AccessibleStaticTextBase \
editeng/source/accessibility/AccessibleStringWrap \
editeng/source/editeng/editattr \
+ editeng/source/editeng/editdata \
editeng/source/editeng/editdbg \
editeng/source/editeng/editdoc \
editeng/source/editeng/editeng \
diff --git a/editeng/inc/editeng/editdata.hxx b/editeng/inc/editeng/editdata.hxx
index 2ac8a99..f9c88c3 100644
--- a/editeng/inc/editeng/editdata.hxx
+++ b/editeng/inc/editeng/editdata.hxx
@@ -52,9 +52,10 @@ enum EVAnchorMode {
#define EE_PARA_NOT_FOUND 0xFFFF
#define EE_PARA_APPEND 0xFFFF
#define EE_PARA_ALL 0xFFFF
-#define EE_APPEND 0xFFFF
#define EE_INDEX_NOT_FOUND 0xFFFF
+extern size_t EE_APPEND;
+
// Error messages for Read / Write Method
#define EE_READWRITE_OK (SVSTREAM_OK)
#define EE_READWRITE_WRONGFORMAT (SVSTREAM_ERRBASE_USER+1)
diff --git a/editeng/source/editeng/editdata.cxx b/editeng/source/editeng/editdata.cxx
new file mode 100644
index 0000000..2aaa093
--- /dev/null
+++ b/editeng/source/editeng/editdata.cxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Kohei Yoshida <kohei.yoshida at suse.com>
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "editeng/editdata.hxx"
+
+#include <limits>
+
+size_t EE_APPEND = std::numeric_limits<size_t>::max();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index f78629f..0adfec1 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -383,6 +383,9 @@ EditView* EditEngine::RemoveView(size_t nIndex)
{
DBG_CHKTHIS( EditEngine, 0 );
ImpEditEngine::ViewsType& rViews = pImpEditEngine->GetEditViews();
+ if (nIndex >= rViews.size())
+ return NULL;
+
EditView* pView = rViews[nIndex];
if ( pView )
return RemoveView( pView );
commit f75df5e338af4e109f3bce9ab6c98f681fdd14fa
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Apr 13 23:09:53 2012 -0400
Another svarray to kill.
diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx
index 9156a59..f3be3d2 100644
--- a/editeng/inc/editeng/editeng.hxx
+++ b/editeng/inc/editeng/editeng.hxx
@@ -216,11 +216,11 @@ public:
void ForceAutoColor( sal_Bool b );
sal_Bool IsForceAutoColor() const;
- void InsertView( EditView* pEditView, sal_uInt16 nIndex = EE_APPEND );
+ void InsertView(EditView* pEditView, size_t nIndex = EE_APPEND);
EditView* RemoveView( EditView* pEditView );
- EditView* RemoveView( sal_uInt16 nIndex = EE_APPEND );
- EditView* GetView( sal_uInt16 nIndex = 0 ) const;
- sal_uInt16 GetViewCount() const;
+ EditView* RemoveView(size_t nIndex = EE_APPEND);
+ EditView* GetView(size_t nIndex = 0) const;
+ size_t GetViewCount() const;
sal_Bool HasView( EditView* pView ) const;
EditView* GetActiveView() const;
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 568a15f..f78629f 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -333,15 +333,17 @@ void EditEngine::Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const P
pOutDev->SetClipRegion();
}
-void EditEngine::InsertView( EditView* pEditView, sal_uInt16 nIndex )
+void EditEngine::InsertView(EditView* pEditView, size_t nIndex)
{
DBG_CHKTHIS( EditEngine, 0 );
DBG_CHKOBJ( pEditView, EditView, 0 );
- if ( nIndex > pImpEditEngine->GetEditViews().Count() )
- nIndex = pImpEditEngine->GetEditViews().Count();
+ if ( nIndex > pImpEditEngine->GetEditViews().size() )
+ nIndex = pImpEditEngine->GetEditViews().size();
+
+ ImpEditEngine::ViewsType& rViews = pImpEditEngine->GetEditViews();
+ rViews.insert(rViews.begin()+nIndex, pEditView);
- pImpEditEngine->GetEditViews().Insert( pEditView, nIndex );
EditSelection aStartSel;
aStartSel = pImpEditEngine->GetEditDoc().GetStartPaM();
pEditView->pImpEditView->SetEditSelection( aStartSel );
@@ -357,13 +359,15 @@ EditView* EditEngine::RemoveView( EditView* pView )
DBG_CHKOBJ( pView, EditView, 0 );
pView->HideCursor();
- EditView* pRemoved = 0;
- sal_uInt16 nPos = pImpEditEngine->GetEditViews().GetPos( pView );
- DBG_ASSERT( nPos != USHRT_MAX, "RemoveView with invalid index" );
- if ( nPos != USHRT_MAX )
+ EditView* pRemoved = NULL;
+ ImpEditEngine::ViewsType& rViews = pImpEditEngine->GetEditViews();
+ ImpEditEngine::ViewsType::iterator it = std::find(rViews.begin(), rViews.end(), pView);
+
+ DBG_ASSERT( it != rViews.end(), "RemoveView with invalid index" );
+ if (it != rViews.end())
{
- pRemoved = pImpEditEngine->GetEditViews().GetObject( nPos );
- pImpEditEngine->GetEditViews().Remove( nPos );
+ pRemoved = *it;
+ rViews.erase(it);
if ( pImpEditEngine->GetActiveView() == pView )
{
pImpEditEngine->SetActiveView( 0 );
@@ -375,30 +379,32 @@ EditView* EditEngine::RemoveView( EditView* pView )
return pRemoved;
}
-EditView* EditEngine::RemoveView( sal_uInt16 nIndex )
+EditView* EditEngine::RemoveView(size_t nIndex)
{
DBG_CHKTHIS( EditEngine, 0 );
- EditView* pView = pImpEditEngine->GetEditViews().GetObject( nIndex );
+ ImpEditEngine::ViewsType& rViews = pImpEditEngine->GetEditViews();
+ EditView* pView = rViews[nIndex];
if ( pView )
return RemoveView( pView );
return NULL;
}
-EditView* EditEngine::GetView( sal_uInt16 nIndex ) const
+EditView* EditEngine::GetView(size_t nIndex) const
{
DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetEditViews().GetObject( nIndex );
+ return pImpEditEngine->GetEditViews()[nIndex];
}
-sal_uInt16 EditEngine::GetViewCount() const
+size_t EditEngine::GetViewCount() const
{
DBG_CHKTHIS( EditEngine, 0 );
- return pImpEditEngine->GetEditViews().Count();
+ return pImpEditEngine->GetEditViews().size();
}
sal_Bool EditEngine::HasView( EditView* pView ) const
{
- return pImpEditEngine->GetEditViews().GetPos( pView ) != USHRT_MAX;
+ ImpEditEngine::ViewsType& rViews = pImpEditEngine->GetEditViews();
+ return std::find(rViews.begin(), rViews.end(), pView) != rViews.end();
}
EditView* EditEngine::GetActiveView() const
@@ -429,10 +435,10 @@ void EditEngine::SetPaperSize( const Size& rNewSize )
sal_Bool bAutoPageSize = pImpEditEngine->GetStatus().AutoPageSize();
if ( bAutoPageSize || ( aNewSize.Width() != aOldSize.Width() ) )
{
- for ( sal_uInt16 nView = 0; nView < pImpEditEngine->aEditViews.Count(); nView++ )
+ for (size_t nView = 0; nView < pImpEditEngine->aEditViews.size(); ++nView)
{
EditView* pView = pImpEditEngine->aEditViews[nView];
- DBG_CHKOBJ( pView, EditView, 0 );
+ DBG_CHKOBJ( pView, EditView, 0 );
if ( bAutoPageSize )
pView->pImpEditView->RecalcOutputArea();
else if ( pView->pImpEditView->DoAutoSize() )
@@ -447,7 +453,7 @@ void EditEngine::SetPaperSize( const Size& rNewSize )
// Changing the width has no effect for AutoPageSize, as this is
// determined by the text width.
// Optimization first after Vobis delivery was enabled ...
- pImpEditEngine->FormatFullDoc();
+ pImpEditEngine->FormatFullDoc();
pImpEditEngine->UpdateViews( pImpEditEngine->GetActiveView() );
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index 6fae46c..81bce92 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -79,8 +79,8 @@ sal_Bool EditUndoManager::Undo()
if ( !pImpEE->GetActiveView() )
{
- if ( pImpEE->GetEditViews().Count() )
- pImpEE->SetActiveView( pImpEE->GetEditViews().GetObject(0) );
+ if (!pImpEE->GetEditViews().empty())
+ pImpEE->SetActiveView(pImpEE->GetEditViews()[0]);
else
{
OSL_FAIL("Undo in engine is not possible without a View! ");
@@ -114,8 +114,8 @@ sal_Bool EditUndoManager::Redo()
if ( !pImpEE->GetActiveView() )
{
- if ( pImpEE->GetEditViews().Count() )
- pImpEE->SetActiveView( pImpEE->GetEditViews().GetObject(0) );
+ if (!pImpEE->GetEditViews().empty())
+ pImpEE->SetActiveView(pImpEE->GetEditViews()[0]);
else
{
OSL_FAIL( "Redo in Engine ohne View nicht moeglich!" );
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 452553c..2e32318 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -378,9 +378,6 @@ public:
// ImpEditEngine
// ----------------------------------------------------------------------
-typedef EditView* EditViewPtr;
-SV_DECL_PTRARR( EditViews, EditViewPtr, 0 )
-
class ImpEditEngine : public SfxListener, boost::noncopyable
{
// The Undos have to manipulate directly ( private-Methods ),
@@ -399,6 +396,9 @@ class ImpEditEngine : public SfxListener, boost::noncopyable
friend class EdtAutoCorrDoc; // For access to Imp-Methods
friend class EditDbg; // Debug Routines
+public:
+ typedef std::vector<EditView*> ViewsType;
+
private:
// ================================================================
@@ -414,7 +414,7 @@ private:
// Engine Specific data ...
EditEngine* pEditEngine;
- EditViews aEditViews;
+ ViewsType aEditViews;
EditView* pActiveView;
TextRanger* pTextRanger;
@@ -706,7 +706,8 @@ public:
const ParaPortionList& GetParaPortions() const { return aParaPortionList; }
ParaPortionList& GetParaPortions() { return aParaPortionList; }
- EditViews& GetEditViews() { return aEditViews; }
+ ViewsType& GetEditViews() { return aEditViews; }
+ const ViewsType& GetEditViews() const { return aEditViews; }
const Size& GetPaperSize() const { return aPaperSize; }
void SetPaperSize( const Size& rSz ) { aPaperSize = rSz; }
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 5612f3b..ece3367 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -702,7 +702,7 @@ EditPaM ImpEditEngine::Clear()
ResetUndoManager();
- for ( sal_uInt16 nView = aEditViews.Count(); nView; )
+ for (size_t nView = aEditViews.size(); nView; )
{
EditView* pView = aEditViews[--nView];
DBG_CHKOBJ( pView, EditView, 0 );
@@ -718,9 +718,9 @@ EditPaM ImpEditEngine::RemoveText()
EditPaM aStartPaM = aEditDoc.GetStartPaM();
EditSelection aEmptySel( aStartPaM, aStartPaM );
- for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ )
+ for (size_t nView = 0; nView < aEditViews.size(); ++nView)
{
- EditView* pView = aEditViews.GetObject(nView);
+ EditView* pView = aEditViews[nView];
DBG_CHKOBJ( pView, EditView, 0 );
pView->pImpEditView->SetEditSelection( aEmptySel );
}
@@ -742,7 +742,7 @@ void ImpEditEngine::SetText( const XubString& rText )
if ( rText.Len() )
aPaM = ImpInsertText( aEmptySel, rText );
- for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ )
+ for (size_t nView = 0; nView < aEditViews.size(); ++nView)
{
EditView* pView = aEditViews[nView];
DBG_CHKOBJ( pView, EditView, 0 );
@@ -3349,9 +3349,9 @@ void ImpEditEngine::UpdateSelections()
{
// Check whether one of the selections is at a deleted node...
// If the node is valid, the index has yet to be examined!
- for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ )
+ for (size_t nView = 0; nView < aEditViews.size(); ++nView)
{
- EditView* pView = aEditViews.GetObject(nView);
+ EditView* pView = aEditViews[nView];
DBG_CHKOBJ( pView, EditView, 0 );
EditSelection aCurSel( pView->pImpEditView->GetEditSelection() );
bool bChanged = false;
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 3d6ed71..0d6877b 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -286,7 +286,7 @@ void ImpEditEngine::UpdateViews( EditView* pCurView )
DBG_ASSERT( IsFormatted(), "UpdateViews: Doc not formatted!" );
- for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ )
+ for (size_t nView = 0; nView < aEditViews.size(); ++nView)
{
EditView* pView = aEditViews[nView];
DBG_CHKOBJ( pView, EditView, 0 );
@@ -336,7 +336,7 @@ IMPL_LINK_NOARG_INLINE_START(ImpEditEngine, IdleFormatHdl)
// else probably the idle format timer fired while we're already
// downing
EditView* pView = aIdleFormatter.GetView();
- for( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ )
+ for (size_t nView = 0; nView < aEditViews.size(); ++nView)
{
if( aEditViews[nView] == pView )
{
@@ -467,7 +467,7 @@ void ImpEditEngine::FormatDoc()
CheckAutoPageSize();
else if ( nDiff )
{
- for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ )
+ for (size_t nView = 0; nView < aEditViews.size(); ++nView)
{
EditView* pView = aEditViews[nView];
ImpEditView* pImpView = pView->pImpEditView;
@@ -570,7 +570,7 @@ void ImpEditEngine::CheckAutoPageSize()
aInvalidRec = Rectangle( Point(), aSz );
- for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ )
+ for (size_t nView = 0; nView < aEditViews.size(); ++nView)
{
EditView* pView = aEditViews[nView];
pView->pImpEditView->RecalcOutputArea();
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 25608f8..28121ca 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -2369,7 +2369,7 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpel
aStatus.GetStatusWord() |= EE_STAT_WRONGWORDCHANGED;
CallStatusHdl();
- if ( aEditViews.Count() )
+ if (!aEditViews.empty())
{
// For SimpleRepaint one was painted over a range without
// reaching VDEV, but then one would have to intersect, c
@@ -2390,7 +2390,7 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpel
}
else if ( bSimpleRepaint )
{
- for ( sal_uInt16 nView = 0; nView < aEditViews.Count(); nView++ )
+ for (size_t nView = 0; nView < aEditViews.size(); ++nView)
{
EditView* pView = aEditViews[nView];
Rectangle aClipRec( aInvalidRec );
commit 515f74385b25375bda01008cef831bf73e18a428
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Apr 13 22:25:57 2012 -0400
ImpEditView no longer a friend of ImpEditEngine.
Be careful whom you befriend with...
diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx
index 0983ea0..9156a59 100644
--- a/editeng/inc/editeng/editeng.hxx
+++ b/editeng/inc/editeng/editeng.hxx
@@ -33,6 +33,7 @@
#include <vector>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/i18n/WordType.hpp>
+#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
#include <rsc/rscsfx.hxx>
#include <editeng/editdata.hxx>
@@ -102,6 +103,12 @@ class ContentNode;
class ParaPortion;
class EditSelection;
class EditPaM;
+class EditLine;
+class InternalEditStatus;
+class EditSelectionEngine;
+class EditDoc;
+struct PasteOrDropInfos;
+class Range;
//////////////////////////////////////////////////////////////////////////////
@@ -142,6 +149,7 @@ 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);
@@ -156,6 +164,31 @@ private:
sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES,
bool bAcceptStartOfWord = true);
+ EDITENG_DLLPRIVATE long GetXPos(
+ const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart = false) const;
+
+ EDITENG_DLLPRIVATE Range GetLineXPosStartEnd(
+ const ParaPortion* pParaPortion, const EditLine* pLine) const;
+
+ 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;
+ EDITENG_DLLPRIVATE const EditSelectionEngine& GetSelectionEngine() const;
+ EDITENG_DLLPRIVATE void SetInSelectionMode(bool b);
+
protected:
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 3eabb75..568a15f 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -723,6 +723,11 @@ uno::Reference<datatransfer::XTransferable> EditEngine::CreateTransferable(const
return pImpEditEngine->CreateTransferable(rSelection);
}
+EditPaM EditEngine::InsertText(const EditSelection& aCurEditSelection, const String& rStr)
+{
+ return pImpEditEngine->InsertText(aCurEditSelection, rStr);
+}
+
EditSelection EditEngine::InsertText(
uno::Reference<datatransfer::XTransferable >& rxDataObj,
const String& rBaseURL, const EditPaM& rPaM, bool bUseSpecial)
@@ -746,6 +751,79 @@ EditSelection EditEngine::SelectWord(
return pImpEditEngine->SelectWord(rCurSelection, nWordType, bAcceptStartOfWord);
}
+long EditEngine::GetXPos(
+ const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart) const
+{
+ return pImpEditEngine->GetXPos(pParaPortion, pLine, nIndex, bPreferPortionStart);
+}
+
+Range EditEngine::GetLineXPosStartEnd(
+ const ParaPortion* pParaPortion, const EditLine* pLine) const
+{
+ return pImpEditEngine->GetLineXPosStartEnd(pParaPortion, pLine);
+}
+
+bool EditEngine::IsFormatted() const
+{
+ return pImpEditEngine->IsFormatted();
+}
+
+EditPaM EditEngine::CursorRight(const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode)
+{
+ return pImpEditEngine->CursorRight(rPaM, nCharacterIteratorMode);
+}
+
+sal_uInt16 EditEngine::GetOnePixelInRef() const
+{
+ return pImpEditEngine->nOnePixelInRef;
+}
+
+InternalEditStatus& EditEngine::GetInternalEditStatus()
+{
+ return pImpEditEngine->GetStatus();
+}
+
+EditDoc& EditEngine::GetEditDoc()
+{
+ return pImpEditEngine->GetEditDoc();
+}
+
+void EditEngine::SeekCursor(
+ ContentNode* pNode, sal_uInt16 nPos, SvxFont& rFont, OutputDevice* pOut, sal_uInt16 nIgnoreWhich)
+{
+ pImpEditEngine->SeekCursor(pNode, nPos, rFont, pOut, nIgnoreWhich);
+}
+
+EditPaM EditEngine::DeleteSelection(const EditSelection& rSel)
+{
+ return pImpEditEngine->ImpDeleteSelection(rSel);
+}
+
+void EditEngine::HandleBeginPasteOrDrop(PasteOrDropInfos& rInfos)
+{
+ pImpEditEngine->aBeginPasteOrDropHdl.Call(&rInfos);
+}
+
+void EditEngine::HandleEndPasteOrDrop(PasteOrDropInfos& rInfos)
+{
+ pImpEditEngine->aEndPasteOrDropHdl.Call(&rInfos);
+}
+
+bool EditEngine::HasText() const
+{
+ return pImpEditEngine->ImplHasText();
+}
+
+const EditSelectionEngine& EditEngine::GetSelectionEngine() const
+{
+ return pImpEditEngine->aSelEngine;
+}
+
+void EditEngine::SetInSelectionMode(bool b)
+{
+ pImpEditEngine->bInSelection = b;
+}
+
sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, Window* pFrameWin )
{
DBG_CHKTHIS( EditEngine, 0 );
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 252da7c..355564d 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -243,7 +243,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion )
// Now that we have Bidi, the first/last index doesn't have to be the 'most outside' postion
if ( !bPartOfLine )
{
- Range aLineXPosStartEnd = pEditEngine->pImpEditEngine->GetLineXPosStartEnd( pTmpPortion, pLine );
+ Range aLineXPosStartEnd = pEditEngine->GetLineXPosStartEnd(pTmpPortion, pLine);
aTopLeft.X() = aLineXPosStartEnd.Min();
aBottomRight.X() = aLineXPosStartEnd.Max();
ImplDrawHighlightRect( pOutWin, aTopLeft, aBottomRight, pPolyPoly );
@@ -261,8 +261,8 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, Region* pRegion )
DBG_ASSERT( nTmpEndIndex > nTmpStartIndex, "DrawSelection, Start >= End?" );
- long nX1 = pEditEngine->pImpEditEngine->GetXPos( pTmpPortion, pLine, nTmpStartIndex, true );
- long nX2 = pEditEngine->pImpEditEngine->GetXPos( pTmpPortion, pLine, nTmpEndIndex );
+ long nX1 = pEditEngine->GetXPos(pTmpPortion, pLine, nTmpStartIndex, true);
+ long nX2 = pEditEngine->GetXPos(pTmpPortion, pLine, nTmpEndIndex);
Point aPt1( Min( nX1, nX2 ), aTopLeft.Y() );
Point aPt2( Max( nX1, nX2 ), aBottomRight.Y() );
@@ -627,8 +627,8 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa
if ( ( aOutArea.Left() >= aOutArea.Right() ) && ( aOutArea.Top() >= aOutArea.Bottom() ) )
return;
- pEditEngine->pImpEditEngine->CheckIdleFormatter();
- if ( !pEditEngine->pImpEditEngine->IsFormatted() )
+ pEditEngine->CheckIdleFormatter();
+ if (!pEditEngine->IsFormatted())
pEditEngine->pImpEditEngine->FormatDoc();
// For some reasons I end up here during the formatting, if the Outliner
@@ -646,7 +646,7 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa
EditPaM aPaM( aEditSelection.Max() );
sal_uInt16 nTextPortionStart = 0;
- sal_uInt16 nPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() );
+ sal_uInt16 nPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
if (nPara == USHRT_MAX) // #i94322
return;
@@ -681,7 +681,7 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa
}
else
{
- EditPaM aNext = pEditEngine->pImpEditEngine->CursorRight( aPaM, (sal_uInt16)i18n::CharacterIteratorMode::SKIPCELL );
+ EditPaM aNext = pEditEngine->CursorRight( aPaM, (sal_uInt16)i18n::CharacterIteratorMode::SKIPCELL );
Rectangle aTmpRect = pEditEngine->pImpEditEngine->PaMtoEditCursor( aNext, GETCRSR_TXTONLY );
if ( aTmpRect.Top() != aEditCursor.Top() )
aTmpRect = pEditEngine->pImpEditEngine->PaMtoEditCursor( aNext, GETCRSR_TXTONLY|GETCRSR_ENDOFLINE );
@@ -758,7 +758,7 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa
long nDiffY = !IsVertical() ? nDocDiffY : nDocDiffX;
// Negative: Back to the top or left edge
- if ( ( Abs( nDiffY ) > pEditEngine->pImpEditEngine->nOnePixelInRef ) && DoBigScroll() )
+ if ( ( Abs( nDiffY ) > pEditEngine->GetOnePixelInRef() ) && DoBigScroll() )
{
long nH = aOutArea.GetHeight() / 4;
if ( ( nH > aEditCursor.GetHeight() ) && ( Abs( nDiffY ) < nH ) )
@@ -770,7 +770,7 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa
}
}
- if ( ( Abs( nDiffX ) > pEditEngine->pImpEditEngine->nOnePixelInRef ) && DoBigScroll() )
+ if ( ( Abs( nDiffX ) > pEditEngine->GetOnePixelInRef() ) && DoBigScroll() )
{
long nW = aOutArea.GetWidth() / 4;
if ( Abs( nDiffX ) < nW )
@@ -783,9 +783,9 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa
}
if ( nDiffX )
- pEditEngine->pImpEditEngine->aStatus.GetStatusWord() = pEditEngine->pImpEditEngine->aStatus.GetStatusWord() | EE_STAT_HSCROLL;
+ pEditEngine->GetInternalEditStatus().GetStatusWord() = pEditEngine->GetInternalEditStatus().GetStatusWord() | EE_STAT_HSCROLL;
if ( nDiffY )
- pEditEngine->pImpEditEngine->aStatus.GetStatusWord() = pEditEngine->pImpEditEngine->aStatus.GetStatusWord() | EE_STAT_VSCROLL;
+ pEditEngine->GetInternalEditStatus().GetStatusWord() = pEditEngine->GetInternalEditStatus().GetStatusWord() | EE_STAT_VSCROLL;
Scroll( -nDiffX, -nDiffY );
pEditEngine->pImpEditEngine->DelayedCallStatusHdl();
}
@@ -857,7 +857,7 @@ void ImpEditView::ShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sa
GetCursor()->Show();
{
SvxFont aFont;
- pEditEngine->pImpEditEngine->SeekCursor( aPaM.GetNode(), aPaM.GetIndex()+1, aFont );
+ pEditEngine->SeekCursor( aPaM.GetNode(), aPaM.GetIndex()+1, aFont );
sal_uLong nContextFlags = INPUTCONTEXT_TEXT|INPUTCONTEXT_EXTTEXTINPUT;
GetWindow()->SetInputContext( InputContext( aFont, nContextFlags ) );
}
@@ -1027,11 +1027,11 @@ sal_Bool ImpEditView::PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin
sal_Bool ImpEditView::MouseButtonUp( const MouseEvent& rMouseEvent )
{
- if ( pEditEngine->pImpEditEngine->aStatus.NotifyCursorMovements() )
+ if ( pEditEngine->GetInternalEditStatus().NotifyCursorMovements() )
{
- if ( pEditEngine->pImpEditEngine->aStatus.GetPrevParagraph() != pEditEngine->pImpEditEngine->GetEditDoc().GetPos( GetEditSelection().Max().GetNode() ) )
+ if ( pEditEngine->GetInternalEditStatus().GetPrevParagraph() != pEditEngine->GetEditDoc().GetPos( GetEditSelection().Max().GetNode() ) )
{
- pEditEngine->pImpEditEngine->aStatus.GetStatusWord() = pEditEngine->pImpEditEngine->aStatus.GetStatusWord() | EE_STAT_CRSRLEFTPARA;
+ pEditEngine->GetInternalEditStatus().GetStatusWord() = pEditEngine->GetInternalEditStatus().GetStatusWord() | EE_STAT_CRSRLEFTPARA;
pEditEngine->pImpEditEngine->CallStatusHdl();
}
}
@@ -1057,9 +1057,9 @@ sal_Bool ImpEditView::MouseButtonUp( const MouseEvent& rMouseEvent )
sal_Bool ImpEditView::MouseButtonDown( const MouseEvent& rMouseEvent )
{
- pEditEngine->pImpEditEngine->CheckIdleFormatter(); // If fast typing and mouse button downs
- if ( pEditEngine->pImpEditEngine->aStatus.NotifyCursorMovements() )
- pEditEngine->pImpEditEngine->aStatus.GetPrevParagraph() = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( GetEditSelection().Max().GetNode() );
+ pEditEngine->CheckIdleFormatter(); // If fast typing and mouse button downs
+ if ( pEditEngine->GetInternalEditStatus().NotifyCursorMovements() )
+ pEditEngine->GetInternalEditStatus().GetPrevParagraph() = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( GetEditSelection().Max().GetNode() );
nTravelXPos = TRAVEL_X_DONTKNOW;
nExtraCursorFlags = 0;
nCursorBidiLevel = CURSOR_BIDILEVEL_DONTKNOW;
@@ -1074,7 +1074,7 @@ sal_Bool ImpEditView::MouseMove( const MouseEvent& rMouseEvent )
void ImpEditView::Command( const CommandEvent& rCEvt )
{
- pEditEngine->pImpEditEngine->CheckIdleFormatter(); // If fast typing and mouse button down
+ pEditEngine->CheckIdleFormatter(); // If fast typing and mouse button down
pEditEngine->pImpEditEngine->Command( rCEvt, GetEditViewPtr() );
}
@@ -1093,7 +1093,7 @@ sal_Bool ImpEditView::IsWrongSpelledWord( const EditPaM& rPaM, sal_Bool bMarkIfW
bool bIsWrong = false;
if ( rPaM.GetNode()->GetWrongList() )
{
- EditSelection aSel = pEditEngine->pImpEditEngine->SelectWord( rPaM, ::com::sun::star::i18n::WordType::DICTIONARY_WORD );
+ EditSelection aSel = pEditEngine->SelectWord( rPaM, ::com::sun::star::i18n::WordType::DICTIONARY_WORD );
bIsWrong = rPaM.GetNode()->GetWrongList()->HasWrong( aSel.Min().GetIndex(), aSel.Max().GetIndex() );
if ( bIsWrong && bMarkIfWrong )
{
@@ -1113,7 +1113,7 @@ String ImpEditView::SpellIgnoreOrAddWord( sal_Bool bAdd )
EditPaM aPaM = GetEditSelection().Max();
if ( !HasSelection() )
{
- EditSelection aSel = pEditEngine->pImpEditEngine->SelectWord( aPaM );
+ EditSelection aSel = pEditEngine->SelectWord(aPaM);
aWord = pEditEngine->pImpEditEngine->GetSelected( aSel );
}
else
@@ -1172,7 +1172,7 @@ const SvxFieldItem* ImpEditView::GetField( const Point& rPos, sal_uInt16* pPara,
return 0;
Point aDocPos( GetDocPos( rPos ) );
- EditPaM aPaM = pEditEngine->pImpEditEngine->GetPaM( aDocPos, sal_False );
+ EditPaM aPaM = pEditEngine->GetPaM(aDocPos, false);
if ( aPaM.GetIndex() == aPaM.GetNode()->Len() )
{
@@ -1210,11 +1210,11 @@ sal_Bool ImpEditView::IsBulletArea( const Point& rPos, sal_uInt16* pPara )
return sal_False;
Point aDocPos( GetDocPos( rPos ) );
- EditPaM aPaM = pEditEngine->pImpEditEngine->GetPaM( aDocPos, sal_False );
+ EditPaM aPaM = pEditEngine->GetPaM(aDocPos, false);
if ( aPaM.GetIndex() == 0 )
{
- sal_uInt16 nPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() );
+ sal_uInt16 nPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
Rectangle aBulletArea = pEditEngine->GetBulletArea( nPara );
long nY = pEditEngine->GetDocPosTopLeft( nPara ).Y();
const ParaPortion* pParaPortion = pEditEngine->pImpEditEngine->GetParaPortions()[nPara];
@@ -1237,7 +1237,7 @@ void ImpEditView::CutCopy( ::com::sun::star::uno::Reference< ::com::sun::star::d
{
if ( rxClipboard.is() && GetEditSelection().HasRange() )
{
- uno::Reference< datatransfer::XTransferable > xData = pEditEngine->pImpEditEngine->CreateTransferable( GetEditSelection() );
+ uno::Reference<datatransfer::XTransferable> xData = pEditEngine->CreateTransferable( GetEditSelection() );
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
@@ -1292,13 +1292,13 @@ void ImpEditView::Paste( ::com::sun::star::uno::Reference< ::com::sun::star::dat
if ( aSel.HasRange() )
{
DrawSelection();
- aSel = pEditEngine->pImpEditEngine->ImpDeleteSelection( aSel );
+ aSel = pEditEngine->DeleteSelection(aSel);
}
PasteOrDropInfos aPasteOrDropInfos;
aPasteOrDropInfos.nAction = EE_ACTION_PASTE;
- aPasteOrDropInfos.nStartPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aSel.Min().GetNode() );
- pEditEngine->pImpEditEngine->aBeginPasteOrDropHdl.Call( &aPasteOrDropInfos );
+ aPasteOrDropInfos.nStartPara = pEditEngine->GetEditDoc().GetPos( aSel.Min().GetNode() );
+ pEditEngine->HandleBeginPasteOrDrop(aPasteOrDropInfos);
if ( DoSingleLinePaste() )
{
@@ -1313,7 +1313,7 @@ void ImpEditView::Paste( ::com::sun::star::uno::Reference< ::com::sun::star::dat
aData >>= aTmpText;
String aText(convertLineEnd(aTmpText, LINEEND_LF));
aText.SearchAndReplaceAll( LINE_SEP, ' ' );
- aSel = pEditEngine->pImpEditEngine->ImpInsertText( aSel, aText );
+ aSel = pEditEngine->InsertText(aSel, aText);
}
catch( ... )
{
@@ -1323,11 +1323,13 @@ void ImpEditView::Paste( ::com::sun::star::uno::Reference< ::com::sun::star::dat
}
else
{
- aSel = pEditEngine->pImpEditEngine->InsertText( xDataObj, String(), aSel.Min(), bUseSpecial && pEditEngine->pImpEditEngine->GetStatus().AllowPasteSpecial() );
+ aSel = pEditEngine->InsertText(
+ xDataObj, String(), aSel.Min(),
+ bUseSpecial && pEditEngine->GetInternalEditStatus().AllowPasteSpecial());
}
aPasteOrDropInfos.nEndPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aSel.Max().GetNode() );
- pEditEngine->pImpEditEngine->aEndPasteOrDropHdl.Call( &aPasteOrDropInfos );
+ pEditEngine->HandleEndPasteOrDrop(aPasteOrDropInfos);
pEditEngine->pImpEditEngine->UndoActionEnd( EDITUNDO_PASTE );
SetEditSelection( aSel );
@@ -1370,13 +1372,13 @@ sal_Bool ImpEditView::IsInSelection( const EditPaM& rPaM )
void ImpEditView::CreateAnchor()
{
- pEditEngine->pImpEditEngine->bInSelection = true;
+ pEditEngine->SetInSelectionMode(true);
GetEditSelection().Min() = GetEditSelection().Max();
}
void ImpEditView::DeselectAll()
{
- pEditEngine->pImpEditEngine->bInSelection = false;
+ pEditEngine->SetInSelectionMode(false);
DrawSelection();
GetEditSelection().Min() = GetEditSelection().Max();
}
@@ -1397,13 +1399,13 @@ sal_Bool ImpEditView::IsSelectionAtPoint( const Point& rPosPixel )
}
Point aDocPos( GetDocPos( aMousePos ) );
- EditPaM aPaM = pEditEngine->pImpEditEngine->GetPaM( aDocPos, sal_False );
+ EditPaM aPaM = pEditEngine->GetPaM(aDocPos, false);
return IsInSelection( aPaM );
}
sal_Bool ImpEditView::SetCursorAtPoint( const Point& rPointPixel )
{
- pEditEngine->pImpEditEngine->CheckIdleFormatter();
+ pEditEngine->CheckIdleFormatter();
Point aMousePos( rPointPixel );
@@ -1420,7 +1422,7 @@ sal_Bool ImpEditView::SetCursorAtPoint( const Point& rPointPixel )
// Can be optimized: first go through the lines within a paragraph for PAM,
// then again wiht the PaM for the Rect, even though the line is already
// known .... This must not be, though!
- EditPaM aPaM = pEditEngine->pImpEditEngine->GetPaM( aDocPos );
+ EditPaM aPaM = pEditEngine->GetPaM(aDocPos);
sal_Bool bGotoCursor = DoAutoScroll();
// aTmpNewSel: Diff between old and new, not the new selection
@@ -1431,10 +1433,10 @@ sal_Bool ImpEditView::SetCursorAtPoint( const Point& rPointPixel )
EditSelection aNewEditSelection( GetEditSelection() );
aNewEditSelection.Max() = aPaM;
- if ( !pEditEngine->pImpEditEngine->aSelEngine.HasAnchor() )
+ if (!pEditEngine->GetSelectionEngine().HasAnchor())
{
if ( aNewEditSelection.Min() != aPaM )
- pEditEngine->pImpEditEngine->CursorMoved( aNewEditSelection.Min().GetNode() );
+ pEditEngine->CursorMoved(aNewEditSelection.Min().GetNode());
aNewEditSelection.Min() = aPaM;
}
else
@@ -1586,7 +1588,7 @@ void ImpEditView::dragGestureRecognized( const ::com::sun::star::datatransfer::d
pDragAndDropInfo->nCursorWidth = (sal_uInt16) aSz.Width() / 2;
pDragAndDropInfo->aBeginDragSel = pEditEngine->pImpEditEngine->CreateESel( aCopySel );
- uno::Reference< datatransfer::XTransferable > xData = pEditEngine->pImpEditEngine->CreateTransferable( aCopySel );
+ uno::Reference<datatransfer::XTransferable> xData = pEditEngine->CreateTransferable(aCopySel);
sal_Int8 nActions = bReadOnly ? datatransfer::dnd::DNDConstants::ACTION_COPY : datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE;
@@ -1662,7 +1664,7 @@ void ImpEditView::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSo
DrawSelection();
EditSelection aDelSel( pEditEngine->pImpEditEngine->CreateSel( aToBeDelSel ) );
DBG_ASSERT( !aDelSel.DbgIsBuggy( pEditEngine->pImpEditEngine->aEditDoc ), "ToBeDel is buggy!" );
- pEditEngine->pImpEditEngine->ImpDeleteSelection( aDelSel );
+ pEditEngine->DeleteSelection(aDelSel);
if ( !bBeforeSelection )
{
DBG_ASSERT( !pEditEngine->pImpEditEngine->CreateSel( aNewSel ).DbgIsBuggy(pEditEngine->pImpEditEngine->aEditDoc), "Bad" );
@@ -1674,7 +1676,7 @@ void ImpEditView::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSo
else
{
// other EditEngine ...
- if ( pEditEngine->pImpEditEngine->ImplHasText() ) // #88630# SC ist removing the content when switching the task
+ if (pEditEngine->HasText()) // #88630# SC ist removing the content when switching the task
DeleteSelected();
}
}
@@ -1719,7 +1721,7 @@ void ImpEditView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDro
uno::Reference< datatransfer::XTransferable > xDataObj = rDTDE.Transferable;
if ( xDataObj.is() )
{
- bChanges = sal_True;
+ bChanges = true;
// remove Selection ...
DrawSelection();
EditPaM aPaM( pDragAndDropInfo->aDropDest );
@@ -1727,21 +1729,22 @@ void ImpEditView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDro
PasteOrDropInfos aPasteOrDropInfos;
aPasteOrDropInfos.nAction = EE_ACTION_DROP;
aPasteOrDropInfos.nStartPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
- pEditEngine->pImpEditEngine->aBeginPasteOrDropHdl.Call( &aPasteOrDropInfos );
+ pEditEngine->HandleBeginPasteOrDrop(aPasteOrDropInfos);
- EditSelection aNewSel = pEditEngine->pImpEditEngine->InsertText( xDataObj, String(), aPaM, pEditEngine->pImpEditEngine->GetStatus().AllowPasteSpecial() );
+ EditSelection aNewSel = pEditEngine->InsertText(
+ xDataObj, String(), aPaM, pEditEngine->GetInternalEditStatus().AllowPasteSpecial());
aPasteOrDropInfos.nEndPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aNewSel.Max().GetNode() );
- pEditEngine->pImpEditEngine->aEndPasteOrDropHdl.Call( &aPasteOrDropInfos );
+ pEditEngine->HandleEndPasteOrDrop(aPasteOrDropInfos);
SetEditSelection( aNewSel );
pEditEngine->pImpEditEngine->FormatAndUpdate( pEditEngine->pImpEditEngine->GetActiveView() );
if ( pDragAndDropInfo->bStarterOfDD )
{
// Only set if the same engine!
- pDragAndDropInfo->aDropSel.nStartPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() );
+ pDragAndDropInfo->aDropSel.nStartPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
pDragAndDropInfo->aDropSel.nStartPos = aPaM.GetIndex();
- pDragAndDropInfo->aDropSel.nEndPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aNewSel.Max().GetNode() );
+ pDragAndDropInfo->aDropSel.nEndPara = pEditEngine->GetEditDoc().GetPos( aNewSel.Max().GetNode() );
pDragAndDropInfo->aDropSel.nEndPos = aNewSel.Max().GetIndex();
pDragAndDropInfo->bDroppedInMe = sal_True;
}
@@ -1842,11 +1845,11 @@ void ImpEditView::dragOver( const ::com::sun::star::datatransfer::dnd::DropTarge
}
Point aDocPos( GetDocPos( aMousePos ) );
- EditPaM aPaM = pEditEngine->pImpEditEngine->GetPaM( aDocPos );
+ EditPaM aPaM = pEditEngine->GetPaM( aDocPos );
pDragAndDropInfo->aDropDest = aPaM;
if ( pDragAndDropInfo->bOutlinerMode )
{
- sal_uInt16 nPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() );
+ sal_uInt16 nPara = pEditEngine->GetEditDoc().GetPos( aPaM.GetNode() );
ParaPortion* pPPortion = pEditEngine->pImpEditEngine->GetParaPortions().SafeGetObject( nPara );
long nDestParaStartY = pEditEngine->pImpEditEngine->GetParaPortions().GetYOffset( pPPortion );
long nRel = aDocPos.Y() - nDestParaStartY;
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index c2f9a46..452553c 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -393,7 +393,6 @@ class ImpEditEngine : public SfxListener, boost::noncopyable
friend class EditUndoInsertFeature;
friend class EditUndoMoveParagraphs;
- friend class ImpEditView;
friend class EditEngine; // For access to Imp-Methods
friend class EditRTFParser; // For access to Imp-Methods
friend class EditHTMLParser; // For access to Imp-Methods
@@ -569,7 +568,7 @@ private:
EditPaM ImpDeleteSelection( EditSelection aEditSelection);
EditPaM ImpInsertParaBreak( EditPaM& rPaM, bool bKeepEndingAttribs = true );
EditPaM ImpInsertParaBreak( const EditSelection& rEditSelection, bool bKeepEndingAttribs = true );
- EditPaM ImpInsertText( EditSelection aCurEditSelection, const String& rStr );
+ EditPaM ImpInsertText(const EditSelection& aCurEditSelection, const String& rStr);
EditPaM ImpInsertFeature( EditSelection aEditSelection, const SfxPoolItem& rItem );
void ImpRemoveChars( const EditPaM& rPaM, sal_uInt16 nChars, EditUndoRemoveChars* pCurUndo = 0 );
void ImpRemoveParagraph( sal_uInt16 nPara );
@@ -768,7 +767,7 @@ public:
void SetText( const String& rText );
EditPaM DeleteSelected( EditSelection aEditSelection);
EditPaM InsertText( const EditSelection& rCurEditSelection, sal_Unicode c, sal_Bool bOverwrite, sal_Bool bIsUserInput = sal_False );
- EditPaM InsertText( EditSelection aCurEditSelection, const String& rStr );
+ EditPaM InsertText(const EditSelection& aCurEditSelection, const String& rStr);
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 );
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index dff7706..5612f3b 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -684,7 +684,7 @@ sal_Bool ImpEditEngine::MouseMove( const MouseEvent& rMEvt, EditView* pView )
return sal_True;
}
-EditPaM ImpEditEngine::InsertText( EditSelection aSel, const XubString& rStr )
+EditPaM ImpEditEngine::InsertText(const EditSelection& aSel, const String& rStr)
{
EditPaM aPaM = ImpInsertText( aSel, rStr );
return aPaM;
@@ -2690,7 +2690,7 @@ EditPaM ImpEditEngine::InsertText( const EditSelection& rCurSel,
return aPaM;
}
-EditPaM ImpEditEngine::ImpInsertText( EditSelection aCurSel, const XubString& rStr )
+EditPaM ImpEditEngine::ImpInsertText(const EditSelection& aCurSel, const String& rStr)
{
UndoActionStart( EDITUNDO_INSERT );
commit 86eeb0bb473522cb852fb3b9a84ed4f4e04b3261
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Apr 13 22:22:38 2012 -0400
Put enum definition under class scope to avoid name clash.
There is a class named EditLine in editeng which clashed with one of
the enum values.
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 41c26d7..8eb34f0 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -1227,7 +1227,7 @@ ScAccessibleDocument::ScAccessibleDocument(
{
uno::Reference<XAccessible> xAcc = new ScAccessibleEditObject(this, pViewShell->GetViewData()->GetEditView(eSplitPos),
pViewShell->GetWindowByPos(eSplitPos), GetCurrentCellName(), GetCurrentCellDescription(),
- CellInEditMode);
+ ScAccessibleEditObject::CellInEditMode);
AddChild(xAcc, false);
}
}
@@ -1370,7 +1370,7 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
mpTempAccEdit = new ScAccessibleEditObject(this, mpViewShell->GetViewData()->GetEditView(meSplitPos),
mpViewShell->GetWindowByPos(meSplitPos), GetCurrentCellName(),
- rtl::OUString(String(ScResId(STR_ACC_EDITLINE_DESCR))), CellInEditMode);
+ rtl::OUString(String(ScResId(STR_ACC_EDITLINE_DESCR))), ScAccessibleEditObject::CellInEditMode);
uno::Reference<XAccessible> xAcc = mpTempAccEdit;
AddChild(xAcc, sal_True);
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index f0fb7a8..7fa55df 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1998,7 +1998,7 @@ void ScTextWnd::ImplInitSettings()
{
return new ScAccessibleEditObject(GetAccessibleParentWindow()->GetAccessible(), NULL, this,
rtl::OUString(String(ScResId(STR_ACC_EDITLINE_NAME))),
- rtl::OUString(String(ScResId(STR_ACC_EDITLINE_DESCR))), EditLine);
+ rtl::OUString(String(ScResId(STR_ACC_EDITLINE_DESCR))), ScAccessibleEditObject::EditLine);
}
void ScTextWnd::InsertAccessibleTextData( ScAccessibleEditLineTextData& rTextData )
diff --git a/sc/source/ui/inc/AccessibleEditObject.hxx b/sc/source/ui/inc/AccessibleEditObject.hxx
index 5dd40f7..25faa1a 100644
--- a/sc/source/ui/inc/AccessibleEditObject.hxx
+++ b/sc/source/ui/inc/AccessibleEditObject.hxx
@@ -39,13 +39,6 @@ namespace accessibility
class EditView;
class Window;
-enum EditObjectType
-{
- CellInEditMode,
- EditLine,
- EditControl
-};
-
/** @descr
This base class provides an implementation of the
<code>AccessibleCell</code> service.
@@ -54,7 +47,13 @@ class ScAccessibleEditObject
: public ScAccessibleContextBase
{
public:
- //===== internal ========================================================
+ enum EditObjectType
+ {
+ CellInEditMode,
+ EditLine,
+ EditControl
+ };
+
ScAccessibleEditObject(
const ::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessible>& rxParent,
diff --git a/sc/source/ui/pagedlg/tphfedit.cxx b/sc/source/ui/pagedlg/tphfedit.cxx
index eb8ea2b..9154152 100644
--- a/sc/source/ui/pagedlg/tphfedit.cxx
+++ b/sc/source/ui/pagedlg/tphfedit.cxx
@@ -348,7 +348,7 @@ void ScEditWindow::LoseFocus()
break;
}
pAcc = new ScAccessibleEditObject(GetAccessibleParentWindow()->GetAccessible(), pEdView, this,
- rtl::OUString(sName), rtl::OUString(sDescription), EditControl);
+ rtl::OUString(sName), rtl::OUString(sDescription), ScAccessibleEditObject::EditControl);
::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible = pAcc;
xAcc = xAccessible;
return pAcc;
commit e95eb1b22126db5b73fba1ff9a80dbce524ab1c7
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Apr 13 16:32:05 2012 -0400
EditView is no longer a friend of ImpEditEngine.
diff --git a/editeng/inc/editeng/editeng.hxx b/editeng/inc/editeng/editeng.hxx
index 6b6ea94..0983ea0 100644
--- a/editeng/inc/editeng/editeng.hxx
+++ b/editeng/inc/editeng/editeng.hxx
@@ -29,6 +29,41 @@
#ifndef _MyEDITENG_HXX
#define _MyEDITENG_HXX
+#include <rtl/ref.hxx>
+#include <vector>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/i18n/WordType.hpp>
+
+#include <rsc/rscsfx.hxx>
+#include <editeng/editdata.hxx>
+#include <i18npool/lang.h>
+#include "editeng/editengdllapi.h"
+
+#include <tools/rtti.hxx> // due to typedef TypeId
+
+#include <editeng/eedata.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace linguistic2 {
+ class XSpellChecker1;
+ class XHyphenator;
+ }
+ namespace datatransfer {
+ class XTransferable;
+ }
+ namespace lang {
+ struct Locale;
+ }
+}}}
+
+namespace svx {
+struct SpellPortion;
+typedef std::vector<SpellPortion> SpellPortions;
+}
+
+namespace svl { class IUndoManager; }
+namespace basegfx { class B2DPolyPolygon; }
+
class ImpEditEngine;
class EditView;
class OutputDevice;
@@ -62,41 +97,11 @@ class SvKeyValueIterator;
class SvxForbiddenCharactersTable;
class SvxNumberFormat;
class FontList;
-
-#include <rtl/ref.hxx>
-#include <vector>
-#include <com/sun/star/uno/Reference.h>
-
-namespace com { namespace sun { namespace star {
- namespace linguistic2 {
- class XSpellChecker1;
- class XHyphenator;
- }
- namespace datatransfer {
- class XTransferable;
- }
- namespace lang {
- struct Locale;
- }
-}}}
-namespace svx{
-struct SpellPortion;
-typedef std::vector<SpellPortion> SpellPortions;
-}
-namespace svl{
-class IUndoManager;
-}
-
-namespace basegfx { class B2DPolyPolygon; }
-#include <rsc/rscsfx.hxx>
-#include <editeng/editdata.hxx>
-#include <i18npool/lang.h>
-#include "editeng/editengdllapi.h"
-
-#include <tools/rtti.hxx> // due to typedef TypeId
-
-#include <editeng/eedata.hxx>
class SvxFieldData;
+class ContentNode;
+class ParaPortion;
+class EditSelection;
+class EditPaM;
//////////////////////////////////////////////////////////////////////////////
@@ -125,6 +130,32 @@ private:
EDITENG_DLLPRIVATE EditEngine& operator=( const EditEngine& );
EDITENG_DLLPRIVATE sal_uInt8 PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pView, Window* pFrameWin = NULL );
+ EDITENG_DLLPRIVATE void CursorMoved(ContentNode* pPrevNode);
+ EDITENG_DLLPRIVATE void CheckIdleFormatter();
+ EDITENG_DLLPRIVATE ParaPortion* FindParaPortion(ContentNode* pNode);
+ EDITENG_DLLPRIVATE const ParaPortion* FindParaPortion(ContentNode* pNode) const;
+ EDITENG_DLLPRIVATE const ParaPortion* GetPrevVisPortion(const ParaPortion* pCurPortion) const;
+ EDITENG_DLLPRIVATE const ParaPortion* GetNextVisPortion(const ParaPortion* pCurPortion) const;
+ EDITENG_DLLPRIVATE sal_uInt16 GetScriptType(const EditSelection& rSel) const;
+
+ EDITENG_DLLPRIVATE com::sun::star::uno::Reference<
+ com::sun::star::datatransfer::XTransferable>
+ CreateTransferable(const EditSelection& rSelection);
+
+ EDITENG_DLLPRIVATE EditSelection InsertText(
+ com::sun::star::uno::Reference<com::sun::star::datatransfer::XTransferable >& rxDataObj,
+ const String& rBaseURL, const EditPaM& rPaM, bool bUseSpecial);
+
+ EDITENG_DLLPRIVATE EditPaM EndOfWord(
+ const EditPaM& rPaM, sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES);
+
+ EDITENG_DLLPRIVATE EditPaM GetPaM(const Point& aDocPos, bool bSmart = true);
+
+ EDITENG_DLLPRIVATE EditSelection SelectWord(
+ const EditSelection& rCurSelection,
+ sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES,
+ bool bAcceptStartOfWord = true);
+
protected:
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 558852f..3eabb75 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -683,6 +683,69 @@ ESelection EditEngine::GetWord( const ESelection& rSelection, sal_uInt16 nWordTy
return pE->pImpEditEngine->CreateESel( aSel );
}
+void EditEngine::CursorMoved(ContentNode* pPrevNode)
+{
+ pImpEditEngine->CursorMoved(pPrevNode);
+}
+
+void EditEngine::CheckIdleFormatter()
+{
+ pImpEditEngine->CheckIdleFormatter();
+}
+
+ParaPortion* EditEngine::FindParaPortion(ContentNode* pNode)
+{
+ return pImpEditEngine->FindParaPortion(pNode);
+}
+
+const ParaPortion* EditEngine::FindParaPortion(ContentNode* pNode) const
+{
+ return pImpEditEngine->FindParaPortion(pNode);
+}
+
+const ParaPortion* EditEngine::GetPrevVisPortion(const ParaPortion* pCurPortion) const
+{
+ return pImpEditEngine->GetPrevVisPortion(pCurPortion);
+}
+
+const ParaPortion* EditEngine::GetNextVisPortion(const ParaPortion* pCurPortion) const
+{
+ return pImpEditEngine->GetNextVisPortion(pCurPortion);
+}
+
+sal_uInt16 EditEngine::GetScriptType(const EditSelection& rSel) const
+{
+ return pImpEditEngine->GetScriptType(rSel);
+}
+
+uno::Reference<datatransfer::XTransferable> EditEngine::CreateTransferable(const EditSelection& rSelection)
+{
+ return pImpEditEngine->CreateTransferable(rSelection);
+}
+
+EditSelection EditEngine::InsertText(
+ uno::Reference<datatransfer::XTransferable >& rxDataObj,
+ const String& rBaseURL, const EditPaM& rPaM, bool bUseSpecial)
+{
+ return pImpEditEngine->InsertText(rxDataObj, rBaseURL, rPaM, bUseSpecial);
+}
+
+EditPaM EditEngine::EndOfWord(const EditPaM& rPaM, sal_Int16 nWordType)
+{
+ return pImpEditEngine->EndOfWord(rPaM, nWordType);
+}
+
+EditPaM EditEngine::GetPaM(const Point& aDocPos, bool bSmart)
+{
+ return pImpEditEngine->GetPaM(aDocPos, bSmart);
+}
+
+EditSelection EditEngine::SelectWord(
+ const EditSelection& rCurSelection, sal_Int16 nWordType, bool bAcceptStartOfWord)
+{
+ return pImpEditEngine->SelectWord(rCurSelection, nWordType, bAcceptStartOfWord);
+}
+
sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, Window* pFrameWin )
{
DBG_CHKTHIS( EditEngine, 0 );
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 81f0284..bde4741 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -230,25 +230,25 @@ void EditView::SetSelection( const ESelection& rESel )
if ( !pImpEditView->GetEditSelection().HasRange() )
{
ContentNode* pNode = pImpEditView->GetEditSelection().Max().GetNode();
- PIMPEE->CursorMoved( pNode );
+ PIMPE->CursorMoved( pNode );
}
EditSelection aNewSelection( PIMPEE->ConvertSelection( rESel.nStartPara, rESel.nStartPos, rESel.nEndPara, rESel.nEndPos ) );
// If the selection is manipulated after a KeyInput:
- PIMPEE->CheckIdleFormatter();
+ PIMPE->CheckIdleFormatter();
// Selection may not start/end at an invisible paragraph:
- const ParaPortion* pPortion = PIMPEE->FindParaPortion( aNewSelection.Min().GetNode() );
+ const ParaPortion* pPortion = PIMPE->FindParaPortion( aNewSelection.Min().GetNode() );
if ( !pPortion->IsVisible() )
{
- pPortion = PIMPEE->GetPrevVisPortion( pPortion );
+ pPortion = PIMPE->GetPrevVisPortion( pPortion );
ContentNode* pNode = pPortion ? pPortion->GetNode() : PIMPEE->GetEditDoc().GetObject( 0 );
aNewSelection.Min() = EditPaM( pNode, pNode->Len() );
}
- pPortion = PIMPEE->FindParaPortion( aNewSelection.Max().GetNode() );
+ pPortion = PIMPE->FindParaPortion( aNewSelection.Max().GetNode() );
if ( !pPortion->IsVisible() )
{
- pPortion = PIMPEE->GetPrevVisPortion( pPortion );
+ pPortion = PIMPE->GetPrevVisPortion( pPortion );
ContentNode* pNode = pPortion ? pPortion->GetNode() : PIMPEE->GetEditDoc().GetObject( 0 );
aNewSelection.Max() = EditPaM( pNode, pNode->Len() );
}
@@ -293,7 +293,7 @@ sal_uInt16 EditView::GetSelectedScriptType() const
{
DBG_CHKTHIS( EditView, 0 );
DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
- return PIMPEE->GetScriptType( pImpEditView->GetEditSelection() );
+ return PIMPE->GetScriptType( pImpEditView->GetEditSelection() );
}
void EditView::Paint( const Rectangle& rRect )
@@ -580,7 +580,8 @@ void EditView::Cut()
::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > EditView::GetTransferable()
{
- uno::Reference< datatransfer::XTransferable > xData = GetEditEngine()->pImpEditEngine->CreateTransferable( pImpEditView->GetEditSelection() );
+ uno::Reference< datatransfer::XTransferable > xData =
+ GetEditEngine()->CreateTransferable( pImpEditView->GetEditSelection() );
return xData;
}
@@ -705,7 +706,8 @@ void EditView::InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::d
PIMPEE->UndoActionStart( EDITUNDO_INSERT );
pImpEditView->DeleteSelected();
- EditSelection aTextSel( PIMPEE->InsertText( xDataObj, rBaseURL, pImpEditView->GetEditSelection().Max(), bUseSpecial ) );
+ EditSelection aTextSel =
+ PIMPE->InsertText(xDataObj, rBaseURL, pImpEditView->GetEditSelection().Max(), bUseSpecial);
PIMPEE->UndoActionEnd( EDITUNDO_INSERT );
aTextSel.Min() = aTextSel.Max(); // Selection not retained.
@@ -799,7 +801,7 @@ void EditView::CompleteAutoCorrect( Window* pFrameWin )
{
pImpEditView->DrawSelection();
EditSelection aSel = pImpEditView->GetEditSelection();
- aSel = PIMPEE->EndOfWord( aSel.Max() );
+ aSel = PIMPE->EndOfWord( aSel.Max() );
aSel = PIMPEE->AutoCorrect( aSel, 0, !IsInsertMode(), pFrameWin );
pImpEditView->SetEditSelection( aSel );
if ( PIMPEE->IsModified() )
@@ -864,7 +866,7 @@ sal_Bool EditView::IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMa
DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
Point aPos ( pImpEditView->GetWindow()->PixelToLogic( rPosPixel ) );
aPos = pImpEditView->GetDocPos( aPos );
- EditPaM aPaM = pImpEditView->pEditEngine->pImpEditEngine->GetPaM( aPos, sal_False );
+ EditPaM aPaM = pImpEditView->pEditEngine->GetPaM(aPos, false);
return pImpEditView->IsWrongSpelledWord( aPaM , bMarkIfWrong );
}
@@ -895,7 +897,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
Point aPos ( pImpEditView->GetWindow()->PixelToLogic( rPosPixel ) );
aPos = pImpEditView->GetDocPos( aPos );
- EditPaM aPaM = pImpEditView->pEditEngine->pImpEditEngine->GetPaM( aPos, sal_False );
+ EditPaM aPaM = pImpEditView->pEditEngine->GetPaM(aPos, false);
Reference< XSpellChecker1 > xSpeller( PIMPEE->GetSpeller() );
ESelection aOldSel = GetSelection();
if ( xSpeller.is() && pImpEditView->IsWrongSpelledWord( aPaM, sal_True ) )
@@ -1171,7 +1173,7 @@ sal_Bool EditView::SelectCurrentWord( sal_Int16 nWordType )
DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
EditSelection aCurSel( pImpEditView->GetEditSelection() );
pImpEditView->DrawSelection();
- aCurSel = PIMPEE->SelectWord( aCurSel.Max(), nWordType );
+ aCurSel = PIMPE->SelectWord(aCurSel.Max(), nWordType);
pImpEditView->SetEditSelection( aCurSel );
pImpEditView->DrawSelection();
ShowCursor( sal_True, sal_False );
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 28e1d0b..c2f9a46 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -65,6 +65,7 @@ DBG_NAMEEX( EditView )
DBG_NAMEEX( EditEngine )
#define PIMPEE pImpEditView->pEditEngine->pImpEditEngine
+#define PIMPE pImpEditView->pEditEngine
#define DEL_LEFT 1
#define DEL_RIGHT 2
@@ -392,7 +393,6 @@ class ImpEditEngine : public SfxListener, boost::noncopyable
friend class EditUndoInsertFeature;
friend class EditUndoMoveParagraphs;
- friend class EditView;
friend class ImpEditView;
friend class EditEngine; // For access to Imp-Methods
friend class EditRTFParser; // For access to Imp-Methods
commit ff887e882164ed8b5c8f08b4db48c99146c15b9c
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Apr 13 15:22:36 2012 -0400
SafeGetObject() no longer needed since GetObject() does the same thing.
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index d2aca61..3b8244a 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1969,16 +1969,6 @@ static const sal_Unicode aCR[] = { 0x0d, 0x00 };
static const sal_Unicode aLF[] = { 0x0a, 0x00 };
static const sal_Unicode aCRLF[] = { 0x0d, 0x0a, 0x00 };
-const ContentNode* EditDoc::SafeGetObject(size_t nPos) const
-{
- return ( nPos < Count() ) ? GetObject( nPos ) : 0;
-}
-
-ContentNode* EditDoc::SafeGetObject(size_t nPos)
-{
- return ( nPos < Count() ) ? GetObject( nPos ) : 0;
-}
-
size_t EditDoc::GetPos(const ContentNode* p) const
{
return FastGetPos(maContents, p, nLastCache);
@@ -2081,7 +2071,7 @@ XubString EditDoc::GetText( LineEnd eEnd ) const
XubString EditDoc::GetParaAsString( sal_uInt16 nNode ) const
{
- return GetParaAsString( SafeGetObject( nNode ) );
+ return GetParaAsString( GetObject( nNode ) );
}
XubString EditDoc::GetParaAsString(
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index 3e17f74..531652c 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -811,9 +811,6 @@ public:
sal_Bool RemoveAttribs( ContentNode* pNode, sal_uInt16 nStart, sal_uInt16 nEnd, EditCharAttrib*& rpStarting, EditCharAttrib*& rpEnding, sal_uInt16 nWhich = 0 );
void FindAttribs( ContentNode* pNode, sal_uInt16 nStartPos, sal_uInt16 nEndPos, SfxItemSet& rCurSet );
- const ContentNode* SafeGetObject(size_t nPos) const;
- ContentNode* SafeGetObject(size_t nPos);
-
size_t GetPos(const ContentNode* pNode) const;
const ContentNode* GetObject(size_t nPos) const;
ContentNode* GetObject(size_t nPos);
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 1d5fe3a..558852f 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -503,7 +503,7 @@ sal_uInt16 EditEngine::GetScriptType( const ESelection& rSelection ) const
LanguageType EditEngine::GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const
{
DBG_CHKTHIS( EditEngine, 0 );
- ContentNode* pNode = pImpEditEngine->GetEditDoc().SafeGetObject( nPara );
+ ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( nPara );
DBG_ASSERT( pNode, "GetLanguage - nPara is invalid!" );
return pNode ? pImpEditEngine->GetLanguage( EditPaM( pNode, nPos ) ) : LANGUAGE_DONTKNOW;
}
@@ -1322,8 +1322,8 @@ EditTextObject* EditEngine::CreateTextObject( sal_uInt16 nPara, sal_uInt16 nPara
DBG_ASSERT( nPara < pImpEditEngine->GetEditDoc().Count(), "CreateTextObject: Startpara out of Range" );
DBG_ASSERT( nParas <= pImpEditEngine->GetEditDoc().Count() - nPara, "CreateTextObject: Endpara out of Range" );
- ContentNode* pStartNode = pImpEditEngine->GetEditDoc().SafeGetObject( nPara );
- ContentNode* pEndNode = pImpEditEngine->GetEditDoc().SafeGetObject( nPara+nParas-1 );
+ ContentNode* pStartNode = pImpEditEngine->GetEditDoc().GetObject( nPara );
+ ContentNode* pEndNode = pImpEditEngine->GetEditDoc().GetObject( nPara+nParas-1 );
DBG_ASSERT( pStartNode, "Start-Paragraph does not exist: CreateTextObject" );
DBG_ASSERT( pEndNode, "End-Paragraph does not exist: CreateTextObject" );
@@ -1344,7 +1344,7 @@ void EditEngine::RemoveParagraph( sal_uInt16 nPara )
if( pImpEditEngine->GetEditDoc().Count() <= 1 )
return;
- ContentNode* pNode = pImpEditEngine->GetEditDoc().SafeGetObject( nPara );
+ ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( nPara );
const ParaPortion* pPortion = pImpEditEngine->GetParaPortions().SafeGetObject( nPara );
DBG_ASSERT( pPortion && pNode, "Paragraph not found: RemoveParagraph" );
if ( pNode && pPortion )
@@ -1360,7 +1360,7 @@ void EditEngine::RemoveParagraph( sal_uInt16 nPara )
sal_uInt16 EditEngine::GetTextLen( sal_uInt16 nPara ) const
{
DBG_CHKTHIS( EditEngine, 0 );
- ContentNode* pNode = pImpEditEngine->GetEditDoc().SafeGetObject( nPara );
+ ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( nPara );
DBG_ASSERT( pNode, "Paragraph not found: GetTextLen" );
if ( pNode )
return pNode->Len();
@@ -1535,7 +1535,7 @@ Font EditEngine::GetStandardFont( sal_uInt16 nPara )
SvxFont EditEngine::GetStandardSvxFont( sal_uInt16 nPara )
{
DBG_CHKTHIS( EditEngine, 0 );
- ContentNode* pNode = pImpEditEngine->GetEditDoc().SafeGetObject( nPara );
+ ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( nPara );
return pNode->GetCharAttribs().GetDefFont();
}
@@ -2046,7 +2046,7 @@ sal_Bool EditEngine::ShouldCreateBigTextObject() const
sal_uInt16 EditEngine::GetFieldCount( sal_uInt16 nPara ) const
{
sal_uInt16 nFields = 0;
- ContentNode* pNode = pImpEditEngine->GetEditDoc().SafeGetObject( nPara );
+ ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( nPara );
if ( pNode )
{
const CharAttribList::AttribsType& rAttrs = pNode->GetCharAttribs().GetAttribs();
@@ -2063,7 +2063,7 @@ sal_uInt16 EditEngine::GetFieldCount( sal_uInt16 nPara ) const
EFieldInfo EditEngine::GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const
{
- ContentNode* pNode = pImpEditEngine->GetEditDoc().SafeGetObject( nPara );
+ ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( nPara );
if ( pNode )
{
sal_uInt16 nCurrentField = 0;
@@ -2176,7 +2176,7 @@ EPosition EditEngine::FindDocPosition( const Point& rDocPos ) const
Rectangle EditEngine::GetCharacterBounds( const EPosition& rPos ) const
{
Rectangle aBounds;
- ContentNode* pNode = pImpEditEngine->GetEditDoc().SafeGetObject( rPos.nPara );
+ ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( rPos.nPara );
// Check against index, not paragraph
if ( pNode && ( rPos.nIndex < pNode->Len() ) )
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index d1f65b9..6fae46c 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -205,7 +205,7 @@ void EditUndoDelContent::Redo()
// pNode is no longer correct, if the paragraphs where merged
// in between Undos
- pContentNode = _pImpEE->GetEditDoc().SafeGetObject( nNode );
+ pContentNode = _pImpEE->GetEditDoc().GetObject( nNode );
DBG_ASSERT( pContentNode, "EditUndoDelContent::Redo(): Node?!" );
_pImpEE->GetParaPortions().Remove( nNode );
@@ -220,8 +220,8 @@ void EditUndoDelContent::Redo()
_pImpEE->UpdateSelections();
ContentNode* pN = ( nNode < _pImpEE->GetEditDoc().Count() )
- ? _pImpEE->GetEditDoc().SafeGetObject( nNode )
- : _pImpEE->GetEditDoc().SafeGetObject( nNode-1 );
+ ? _pImpEE->GetEditDoc().GetObject( nNode )
+ : _pImpEE->GetEditDoc().GetObject( nNode-1 );
DBG_ASSERT( pN && ( pN != pContentNode ), "?! RemoveContent !? " );
EditPaM aPaM( pN, pN->Len() );
@@ -576,7 +576,7 @@ void EditUndoSetAttribs::Undo()
// Then the character attributes ...
// Remove all attributes including features, are later re-established.
_pImpEE->RemoveCharAttribs(nPara, 0, true);
- DBG_ASSERT( _pImpEE->GetEditDoc().SafeGetObject( nPara ), "Undo (SetAttribs): pNode = NULL!" );
+ DBG_ASSERT( _pImpEE->GetEditDoc().GetObject( nPara ), "Undo (SetAttribs): pNode = NULL!" );
ContentNode* pNode = _pImpEE->GetEditDoc().GetObject( nPara );
for (size_t nAttr = 0; nAttr < rInf.GetPrevCharAttribs().size(); ++nAttr)
{
diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx
index 262459a..9749706 100644
--- a/editeng/source/editeng/eertfpar.cxx
+++ b/editeng/source/editeng/eertfpar.cxx
@@ -132,7 +132,7 @@ SvParserState EditRTFParser::CallParser()
{
ContentNode* pCurNode = aCurSel.Max().GetNode();
sal_uInt16 nPara = pImpEditEngine->GetEditDoc().GetPos( pCurNode );
- ContentNode* pPrevNode = pImpEditEngine->GetEditDoc().SafeGetObject( nPara-1 );
+ ContentNode* pPrevNode = pImpEditEngine->GetEditDoc().GetObject( nPara-1 );
DBG_ASSERT( pPrevNode, "Invalid RTF-Document?!" );
EditSelection aSel;
aSel.Min() = EditPaM( pPrevNode, pPrevNode->Len() );
@@ -178,7 +178,7 @@ void EditRTFParser::AddRTFDefaultValues( const EditPaM& rStart, const EditPaM& r
sal_uInt16 nEndPara = pImpEditEngine->GetEditDoc().GetPos( rEnd.GetNode() );
for ( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++ )
{
- ContentNode* pNode = pImpEditEngine->GetEditDoc().SafeGetObject( nPara );
+ ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( nPara );
DBG_ASSERT( pNode, "AddRTFDefaultValues - No paragraph?!" );
if ( !pNode->GetContentAttribs().HasItem( EE_CHAR_FONTINFO ) )
pNode->GetContentAttribs().GetItems().Put( aFontItem );
@@ -296,7 +296,7 @@ void EditRTFParser::SetEndPrevPara( SvxNodeIdx*& rpNodePos,
DBG_ASSERT( nCurPara != 0, "Paragraph equal to 0: SetEnfPrevPara" );
if ( nCurPara )
nCurPara--;
- ContentNode* pPrevNode = pImpEditEngine->GetEditDoc().SafeGetObject( nCurPara );
+ ContentNode* pPrevNode = pImpEditEngine->GetEditDoc().GetObject( nCurPara );
DBG_ASSERT( pPrevNode, "pPrevNode = 0!" );
rpNodePos = new EditNodeIdx( pImpEditEngine, pPrevNode );
rCntPos = pPrevNode->Len();
@@ -388,7 +388,7 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
// All Complete paragraphs are paragraph attributes ...
for ( sal_uInt16 z = nStartNode+1; z < nEndNode; z++ )
{
- DBG_ASSERT( pImpEditEngine->GetEditDoc().SafeGetObject( z ), "Node does not exist yet(RTF)" );
+ DBG_ASSERT( pImpEditEngine->GetEditDoc().GetObject( z ), "Node does not exist yet(RTF)" );
pImpEditEngine->SetParaAttribs( z, rSet.GetAttrSet() );
}
@@ -426,7 +426,7 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
{
for ( sal_uInt16 n = nStartNode; n <= nEndNode; n++ )
{
- ContentNode* pNode = pImpEditEngine->GetEditDoc().SafeGetObject( n );
+ ContentNode* pNode = pImpEditEngine->GetEditDoc().GetObject( n );
pNode->GetContentAttribs().GetItems().Put( SfxInt16Item( EE_PARA_OUTLLEVEL, nOutlLevel ) );
}
}
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 56a8b39..dff7706 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -294,7 +294,7 @@ XubString ImpEditEngine::GetSelected( const EditSelection& rSel, const LineEnd e
// iterate over the paragraphs ...
for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ )
{
- OSL_ENSURE( aEditDoc.SafeGetObject( nNode ), "Node not found: GetSelected" );
+ OSL_ENSURE( aEditDoc.GetObject( nNode ), "Node not found: GetSelected" );
const ContentNode* pNode = aEditDoc.GetObject( nNode );
xub_StrLen nStartPos = 0;
@@ -1438,13 +1438,13 @@ EditPaM ImpEditEngine::CursorEndOfParagraph( const EditPaM& rPaM )
EditPaM ImpEditEngine::CursorStartOfDoc()
{
- EditPaM aPaM( aEditDoc.SafeGetObject( 0 ), 0 );
+ EditPaM aPaM( aEditDoc.GetObject( 0 ), 0 );
return aPaM;
}
EditPaM ImpEditEngine::CursorEndOfDoc()
{
- ContentNode* pLastNode = aEditDoc.SafeGetObject( aEditDoc.Count()-1 );
+ ContentNode* pLastNode = aEditDoc.GetObject( aEditDoc.Count()-1 );
ParaPortion* pLastPortion = GetParaPortions().SafeGetObject( aEditDoc.Count()-1 );
OSL_ENSURE( pLastNode && pLastPortion, "CursorEndOfDoc: Node or Portion not found" );
@@ -1453,7 +1453,7 @@ EditPaM ImpEditEngine::CursorEndOfDoc()
pLastNode = GetPrevVisNode( pLastPortion->GetNode() );
OSL_ENSURE( pLastNode, "Kein sichtbarer Absatz?" );
if ( !pLastNode )
- pLastNode = aEditDoc.SafeGetObject( aEditDoc.Count()-1 );
+ pLastNode = aEditDoc.GetObject( aEditDoc.Count()-1 );
}
EditPaM aPaM( pLastNode, pLastNode->Len() );
@@ -1495,7 +1495,7 @@ EditPaM ImpEditEngine::WordLeft( const EditPaM& rPaM, sal_Int16 nWordType )
{
// Previous paragraph...
sal_uInt16 nCurPara = aEditDoc.GetPos( aNewPaM.GetNode() );
- ContentNode* pPrevNode = aEditDoc.SafeGetObject( --nCurPara );
+ ContentNode* pPrevNode = aEditDoc.GetObject( --nCurPara );
if ( pPrevNode )
{
aNewPaM.SetNode( pPrevNode );
@@ -1546,7 +1546,7 @@ EditPaM ImpEditEngine::WordRight( const EditPaM& rPaM, sal_Int16 nWordType )
{
// Next paragraph ...
sal_uInt16 nCurPara = aEditDoc.GetPos( aNewPaM.GetNode() );
- ContentNode* pNextNode = aEditDoc.SafeGetObject( ++nCurPara );
+ ContentNode* pNextNode = aEditDoc.GetObject( ++nCurPara );
if ( pNextNode )
{
aNewPaM.SetNode( pNextNode );
@@ -2050,7 +2050,7 @@ sal_uInt8 ImpEditEngine::GetRightToLeft( sal_uInt16 nPara, sal_uInt16 nPos, sal_
{
sal_uInt8 nRightToLeft = 0;
- ContentNode* pNode = aEditDoc.SafeGetObject( nPara );
+ ContentNode* pNode = aEditDoc.GetObject( nPara );
if ( pNode && pNode->Len() )
{
ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( nPara );
@@ -2490,8 +2490,8 @@ EditPaM ImpEditEngine::ImpDeleteSelection( EditSelection aSel )
void ImpEditEngine::ImpRemoveParagraph( sal_uInt16 nPara )
{
- ContentNode* pNode = aEditDoc.SafeGetObject( nPara );
- ContentNode* pNextNode = aEditDoc.SafeGetObject( nPara+1 );
+ ContentNode* pNode = aEditDoc.GetObject( nPara );
+ ContentNode* pNextNode = aEditDoc.GetObject( nPara+1 );
OSL_ENSURE( pNode, "Blind Node in ImpRemoveParagraph" );
@@ -2913,7 +2913,7 @@ EditPaM ImpEditEngine::ImpFastInsertParagraph( sal_uInt16 nPara )
{
if ( nPara )
{
- OSL_ENSURE( aEditDoc.SafeGetObject( nPara-1 ), "FastInsertParagraph: Prev does not exist" );
+ OSL_ENSURE( aEditDoc.GetObject( nPara-1 ), "FastInsertParagraph: Prev does not exist" );
InsertUndo( new EditUndoSplitPara( this, nPara-1, aEditDoc.GetObject( nPara-1 )->Len() ) );
}
else
@@ -3293,7 +3293,7 @@ void ImpEditEngine::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uIn
sal_uInt16 ImpEditEngine::GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const
{
sal_uInt16 nLineNo = 0xFFFF;
- const ContentNode* pNode = GetEditDoc().SafeGetObject( nPara );
+ const ContentNode* pNode = GetEditDoc().GetObject( nPara );
OSL_ENSURE( pNode, "GetLineNumberAtIndex: invalid paragraph index" );
if (pNode)
{
@@ -3416,7 +3416,7 @@ EditSelection ImpEditEngine::ConvertSelection(
EditSelection aNewSelection;
// Start...
- ContentNode* pNode = aEditDoc.SafeGetObject( nStartPara );
+ ContentNode* pNode = aEditDoc.GetObject( nStartPara );
sal_uInt16 nIndex = nStartPos;
if ( !pNode )
{
@@ -3430,7 +3430,7 @@ EditSelection ImpEditEngine::ConvertSelection(
aNewSelection.Min().SetIndex( nIndex );
// End...
- pNode = aEditDoc.SafeGetObject( nEndPara );
+ pNode = aEditDoc.GetObject( nEndPara );
nIndex = nEndPos;
if ( !pNode )
{
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 46cfe04..3d6ed71 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -3574,7 +3574,7 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool b
Color aBackgroundColor( pView->GetBackgroundColor() );
// #i47161# Check if text is visible on background
SvxFont aTmpFont;
- ContentNode* pNode = GetEditDoc().SafeGetObject( 0 );
+ ContentNode* pNode = GetEditDoc().GetObject( 0 );
SeekCursor( pNode, 1, aTmpFont );
Color aFontColor( aTmpFont.GetColor() );
if( (aFontColor == COL_AUTO) || IsForceAutoColor() )
@@ -3744,7 +3744,7 @@ void ImpEditEngine::InsertContent( ContentNode* pNode, sal_uInt16 nPos )
EditPaM ImpEditEngine::SplitContent( sal_uInt16 nNode, sal_uInt16 nSepPos )
{
- ContentNode* pNode = aEditDoc.SafeGetObject( nNode );
+ ContentNode* pNode = aEditDoc.GetObject( nNode );
DBG_ASSERT( pNode, "Invalid Node in SplitContent" );
DBG_ASSERT( IsInUndo(), "SplitContent only for Undo()!" );
DBG_ASSERT( nSepPos <= pNode->Len(), "Index out of range: SplitContent" );
@@ -3754,8 +3754,8 @@ EditPaM ImpEditEngine::SplitContent( sal_uInt16 nNode, sal_uInt16 nSepPos )
EditPaM ImpEditEngine::ConnectContents( sal_uInt16 nLeftNode, sal_Bool bBackward )
{
- ContentNode* pLeftNode = aEditDoc.SafeGetObject( nLeftNode );
- ContentNode* pRightNode = aEditDoc.SafeGetObject( nLeftNode+1 );
+ ContentNode* pLeftNode = aEditDoc.GetObject( nLeftNode );
+ ContentNode* pRightNode = aEditDoc.GetObject( nLeftNode+1 );
DBG_ASSERT( pLeftNode, "Invalid left node in ConnectContents ");
DBG_ASSERT( pRightNode, "Invalid right node in ConnectContents ");
DBG_ASSERT( IsInUndo(), "ConnectContent only for Undo()!" );
@@ -4004,15 +4004,15 @@ EditPaM ImpEditEngine::InsertParagraph( sal_uInt16 nPara )
EditPaM aPaM;
if ( nPara != 0 )
{
- ContentNode* pNode = GetEditDoc().SafeGetObject( nPara-1 );
+ ContentNode* pNode = GetEditDoc().GetObject( nPara-1 );
if ( !pNode )
- pNode = GetEditDoc().SafeGetObject( GetEditDoc().Count() - 1 );
+ pNode = GetEditDoc().GetObject( GetEditDoc().Count() - 1 );
DBG_ASSERT( pNode, "Not a single paragraph in InsertParagraph ?" );
aPaM = EditPaM( pNode, pNode->Len() );
}
else
{
- ContentNode* pNode = GetEditDoc().SafeGetObject( 0 );
+ ContentNode* pNode = GetEditDoc().GetObject( 0 );
aPaM = EditPaM( pNode, 0 );
}
@@ -4022,7 +4022,7 @@ EditPaM ImpEditEngine::InsertParagraph( sal_uInt16 nPara )
EditSelection* ImpEditEngine::SelectParagraph( sal_uInt16 nPara )
{
EditSelection* pSel = 0;
- ContentNode* pNode = GetEditDoc().SafeGetObject( nPara );
+ ContentNode* pNode = GetEditDoc().GetObject( nPara );
DBG_ASSERTWARNING( pNode, "Paragraph does not exist: SelectParagraph" );
if ( pNode )
pSel = new EditSelection( EditPaM( pNode, 0 ), EditPaM( pNode, pNode->Len() ) );
@@ -4209,7 +4209,7 @@ void ImpEditEngine::ImplInitLayoutMode( OutputDevice* pOutDev, sal_uInt16 nPara,
}
else
{
- ContentNode* pNode = GetEditDoc().SafeGetObject( nPara );
+ ContentNode* pNode = GetEditDoc().GetObject( nPara );
short nScriptType = GetScriptType( EditPaM( pNode, nIndex+1 ) );
bCTL = nScriptType == i18n::ScriptType::COMPLEX;
bR2L = GetRightToLeft( nPara, nIndex + 1); // this change was discussed in issue 37190
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 61bbc39..25608f8 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -551,7 +551,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel )
rOutput << '{' << endl;
for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ )
{
- ContentNode* pNode = aEditDoc.SafeGetObject( nNode );
+ ContentNode* pNode = aEditDoc.GetObject( nNode );
DBG_ASSERT( pNode, "Node not found: Search&Replace" );
// The paragraph attributes in advance ...
@@ -1057,7 +1057,7 @@ EditTextObject* ImpEditEngine::CreateBinTextObject( EditSelection aSel, SfxItemP
sal_uInt16 nNode;
for ( nNode = nStartNode; nNode <= nEndNode; nNode++ )
{
- ContentNode* pNode = aEditDoc.SafeGetObject( nNode );
+ ContentNode* pNode = aEditDoc.GetObject( nNode );
DBG_ASSERT( pNode, "Node not found: Search&Replace" );
if ( bOnlyFullParagraphs )
@@ -1658,7 +1658,7 @@ void ImpEditEngine::ImpConvert( rtl::OUString &rConvTxt, LanguageType &rConvTxtL
String aRes;
LanguageType nResLang = LANGUAGE_NONE;
- /* ContentNode* pLastNode = */ aEditDoc.SafeGetObject( aEditDoc.Count()-1 );
+ /* ContentNode* pLastNode = */ aEditDoc.GetObject( aEditDoc.Count()-1 );
EditPaM aPos( CreateEditPaM( pConvInfo->aConvContinue ) );
EditSelection aCurSel = EditSelection( aPos, aPos );
@@ -1820,7 +1820,7 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpSpell( EditView* pEditView )
{
DBG_ASSERT( xSpeller.is(), "No spell checker set!" );
- ContentNode* pLastNode = aEditDoc.SafeGetObject( (aEditDoc.Count()-1) );
+ ContentNode* pLastNode = aEditDoc.GetObject( (aEditDoc.Count()-1) );
EditSelection aCurSel( pEditView->pImpEditView->GetEditSelection() );
aCurSel.Min() = aCurSel.Max();
@@ -1892,7 +1892,7 @@ void ImpEditEngine::StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc)
Reference< XSpellAlternatives > ImpEditEngine::ImpFindNextError(EditSelection& rSelection)
{
- /* ContentNode* pLastNode = */ aEditDoc.SafeGetObject( (aEditDoc.Count()-1) );
+ aEditDoc.GetObject( (aEditDoc.Count()-1) );
EditSelection aCurSel( rSelection.Min() );
String aWord;
@@ -1952,7 +1952,7 @@ bool ImpEditEngine::SpellSentence(EditView& rEditView,
//if no selection previously exists the range is extended to the end of the object
if(aCurSel.Min() == aCurSel.Max())
{
- ContentNode* pLastNode = aEditDoc.SafeGetObject( aEditDoc.Count()-1);
+ ContentNode* pLastNode = aEditDoc.GetObject( aEditDoc.Count()-1);
aCurSel.Max() = EditPaM(pLastNode, pLastNode->Len());
}
// check for next error in aCurSel and set aCurSel to that one if any was found
@@ -2248,7 +2248,7 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, sal_Bool bSpel
}
sal_Bool bRestartTimer = sal_False;
- ContentNode* pLastNode = aEditDoc.SafeGetObject( aEditDoc.Count() - 1 );
+ ContentNode* pLastNode = aEditDoc.GetObject( aEditDoc.Count() - 1 );
sal_uInt16 nNodes = GetEditDoc().Count();
sal_uInt16 nInvalids = 0;
Sequence< PropertyValue > aEmptySeq;
@@ -2432,7 +2432,7 @@ EESpellState ImpEditEngine::HasSpellErrors()
{
DBG_ASSERT( xSpeller.is(), "No spell checker set!" );
- ContentNode* pLastNode = aEditDoc.SafeGetObject( aEditDoc.Count() - 1 );
+ ContentNode* pLastNode = aEditDoc.GetObject( aEditDoc.Count() - 1 );
EditSelection aCurSel( aEditDoc.GetStartPaM() );
String aWord;
diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx
index 2dd9328..a8e8601 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -48,13 +48,13 @@ void ImpEditEngine::SetStyleSheetPool( SfxStyleSheetPool* pSPool )
const SfxStyleSheet* ImpEditEngine::GetStyleSheet( sal_uInt16 nPara ) const
{
- const ContentNode* pNode = aEditDoc.SafeGetObject( nPara );
+ const ContentNode* pNode = aEditDoc.GetObject( nPara );
return pNode ? pNode->GetContentAttribs().GetStyleSheet() : NULL;
}
SfxStyleSheet* ImpEditEngine::GetStyleSheet( sal_uInt16 nPara )
{
- ContentNode* pNode = aEditDoc.SafeGetObject( nPara );
+ ContentNode* pNode = aEditDoc.GetObject( nPara );
return pNode ? pNode->GetContentAttribs().GetStyleSheet() : NULL;
}
@@ -77,7 +77,7 @@ void ImpEditEngine::SetStyleSheet( EditSelection aSel, SfxStyleSheet* pStyle )
void ImpEditEngine::SetStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pStyle )
{
DBG_ASSERT( GetStyleSheetPool() || !pStyle, "SetStyleSheet: No StyleSheetPool registered!" );
- ContentNode* pNode = aEditDoc.SafeGetObject( nPara );
+ ContentNode* pNode = aEditDoc.GetObject( nPara );
SfxStyleSheet* pCurStyle = pNode->GetStyleSheet();
if ( pStyle != pCurStyle )
{
@@ -217,7 +217,7 @@ EditUndoSetAttribs* ImpEditEngine::CreateAttribUndo( EditSelection aSel, const S
for ( sal_uInt16 nPara = nStartNode; nPara <= nEndNode; nPara++ )
{
ContentNode* pNode = aEditDoc.GetObject( nPara );
- DBG_ASSERT( aEditDoc.SafeGetObject( nPara ), "Node not found: CreateAttribUndo" );
+ DBG_ASSERT( aEditDoc.GetObject( nPara ), "Node not found: CreateAttribUndo" );
ContentAttribsInfo* pInf = new ContentAttribsInfo( pNode->GetContentAttribs().GetItems() );
pUndo->AppendContentInfo(pInf);
@@ -330,7 +330,7 @@ SfxItemSet ImpEditEngine::GetAttribs( EditSelection aSel, sal_Bool bOnlyHardAttr
for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ )
{
ContentNode* pNode = aEditDoc.GetObject( nNode );
- DBG_ASSERT( aEditDoc.SafeGetObject( nNode ), "Node not found: GetAttrib" );
+ DBG_ASSERT( aEditDoc.GetObject( nNode ), "Node not found: GetAttrib" );
xub_StrLen nStartPos = 0;
xub_StrLen nEndPos = pNode->Len();
@@ -415,7 +415,7 @@ SfxItemSet ImpEditEngine::GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_u
DBG_CHKOBJ( GetEditEnginePtr(), EditEngine, 0 );
- ContentNode* pNode = const_cast<ContentNode*>(aEditDoc.SafeGetObject(nPara));
+ ContentNode* pNode = const_cast<ContentNode*>(aEditDoc.GetObject(nPara));
DBG_ASSERT( pNode, "GetAttribs - unknown paragraph!" );
DBG_ASSERT( nStart <= nEnd, "getAttribs: Start > End not supported!" );
@@ -532,7 +532,7 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_
sal_Bool bParaAttribFound = sal_False;
sal_Bool bCharAttribFound = sal_False;
- DBG_ASSERT( aEditDoc.SafeGetObject( nNode ), "Node not founden: SetAttribs" );
+ DBG_ASSERT( aEditDoc.GetObject( nNode ), "Node not founden: SetAttribs" );
DBG_ASSERT( GetParaPortions().SafeGetObject( nNode ), "Portion not found: SetAttribs" );
ContentNode* pNode = aEditDoc.GetObject( nNode );
@@ -622,7 +622,7 @@ void ImpEditEngine::RemoveCharAttribs( EditSelection aSel, sal_Bool bRemoveParaA
ContentNode* pNode = aEditDoc.GetObject( nNode );
ParaPortion* pPortion = GetParaPortions()[nNode];
- DBG_ASSERT( aEditDoc.SafeGetObject( nNode ), "Node not found: SetAttribs" );
+ DBG_ASSERT( aEditDoc.GetObject( nNode ), "Node not found: SetAttribs" );
DBG_ASSERT( GetParaPortions().SafeGetObject( nNode ), "Portion not found: SetAttribs" );
xub_StrLen nStartPos = 0;
@@ -667,7 +667,7 @@ typedef EditCharAttrib* EditCharAttribPtr;
void ImpEditEngine::RemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich, sal_Bool bRemoveFeatures )
{
- ContentNode* pNode = aEditDoc.SafeGetObject( nPara );
+ ContentNode* pNode = aEditDoc.GetObject( nPara );
ParaPortion* pPortion = GetParaPortions().SafeGetObject( nPara );
DBG_ASSERT( pNode, "Node not found: RemoveCharAttribs" );
@@ -696,7 +696,7 @@ void ImpEditEngine::RemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich, sal_
void ImpEditEngine::SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet )
{
- ContentNode* pNode = aEditDoc.SafeGetObject( nPara );
+ ContentNode* pNode = aEditDoc.GetObject( nPara );
if ( !pNode )
return;
commit cd967bdb955f307ff0a2b22cd680b99bd493c4cd
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Apr 13 14:59:08 2012 -0400
UniString to rtl::OUString.
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index c791aa2..d2aca61 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -2030,9 +2030,9 @@ size_t EditDoc::Count() const
return maContents.size();
}
-XubString EditDoc::GetSepStr( LineEnd eEnd )
+rtl::OUString EditDoc::GetSepStr( LineEnd eEnd )
{
- XubString aSep;
+ rtl::OUString aSep;
if ( eEnd == LINEEND_CR )
aSep = aCR;
else if ( eEnd == LINEEND_LF )
@@ -2045,34 +2045,36 @@ XubString EditDoc::GetSepStr( LineEnd eEnd )
XubString EditDoc::GetText( LineEnd eEnd ) const
{
sal_uLong nLen = GetTextLen();
- sal_uInt16 nNodes = Count();
+ size_t nNodes = Count();
+ if (nNodes == 0)
+ return String();
- String aSep = EditDoc::GetSepStr( eEnd );
- sal_uInt16 nSepSize = aSep.Len();
+ rtl::OUString aSep = EditDoc::GetSepStr( eEnd );
+ sal_Int32 nSepSize = aSep.getLength();
if ( nSepSize )
nLen += nNodes * nSepSize;
if ( nLen > 0xFFFb / sizeof(xub_Unicode) )
{
- OSL_FAIL( "Text to large for String" );
- return XubString();
+ OSL_FAIL( "Text too large for String" );
+ return String();
}
xub_Unicode* pStr = new xub_Unicode[nLen+1];
xub_Unicode* pCur = pStr;
- sal_uInt16 nLastNode = nNodes-1;
+ size_t nLastNode = nNodes-1;
for ( sal_uInt16 nNode = 0; nNode < nNodes; nNode++ )
{
- XubString aTmp( GetParaAsString( GetObject(nNode) ) );
+ String aTmp( GetParaAsString( GetObject(nNode) ) );
memcpy( pCur, aTmp.GetBuffer(), aTmp.Len()*sizeof(sal_Unicode) );
pCur += aTmp.Len();
if ( nSepSize && ( nNode != nLastNode ) )
{
- memcpy( pCur, aSep.GetBuffer(), nSepSize*sizeof(sal_Unicode ) );
+ memcpy( pCur, aSep.getStr(), nSepSize*sizeof(sal_Unicode ) );
pCur += nSepSize;
}
}
*pCur = '\0';
- XubString aASCIIText( pStr );
+ String aASCIIText( pStr );
delete[] pStr;
return aASCIIText;
}
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index afd1398..3e17f74 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -826,7 +826,7 @@ public:
/// does not delete
void Release(size_t nPos);
- static XubString GetSepStr( LineEnd eEnd );
+ static rtl::OUString GetSepStr( LineEnd eEnd );
};
inline EditCharAttrib* GetAttrib(CharAttribList::AttribsType& rAttribs, size_t nAttr)
More information about the Libreoffice-commits
mailing list