summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-10-14 14:35:04 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-10-14 18:34:57 +0000
commit3223c551c37c6b10b5b7de23ffa4520d720338b6 (patch)
treeb6f12badb8470a2ae8acb1c885f27a160d33734f
parentd7afcb0e72aaa1c8f55b6a82fa40bebc6565c283 (diff)
loplugin:mergeclasses merge TextView with ExtTextView
Change-Id: If7e11dd8f6b2cb6dc19c6aa3f7e50e2e88861eac Reviewed-on: https://gerrit.libreoffice.org/29828 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--basctl/source/basicide/baside2.cxx4
-rw-r--r--basctl/source/basicide/baside2.hxx16
-rw-r--r--basctl/source/basicide/baside2b.cxx4
-rw-r--r--compilerplugins/clang/mergeclasses.results1
-rw-r--r--desktop/source/deployment/gui/license_dialog.cxx2
-rw-r--r--include/vcl/texteng.hxx1
-rw-r--r--include/vcl/textview.hxx37
-rw-r--r--include/vcl/vclmedit.hxx4
-rw-r--r--include/vcl/xtextedt.hxx18
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.cxx16
-rw-r--r--sw/source/uibase/docvw/srcedtw.cxx2
-rw-r--r--sw/source/uibase/inc/srcedtw.hxx10
-rw-r--r--sw/source/uibase/uiview/srcview.cxx2
-rw-r--r--vcl/source/edit/textview.cxx189
-rw-r--r--vcl/source/edit/vclmedit.cxx8
-rw-r--r--vcl/source/edit/xtextedt.cxx181
16 files changed, 240 insertions, 255 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 7ece04118eb8..9d3f9cffe083 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -560,7 +560,7 @@ void ModulWindow::BasicToggleBreakPointEnabled()
{
AssertValidEditEngine();
- ExtTextView* pView = GetEditView();
+ TextView* pView = GetEditView();
if ( pView )
{
TextSelection aSel = pView->GetSelection();
@@ -1211,7 +1211,7 @@ sal_uInt16 ModulWindow::StartSearchAndReplace( const SvxSearchItem& rSearchItem,
// one could also relinquish syntaxhighlighting/formatting instead of the stupid replace-everything...
AssertValidEditEngine();
- ExtTextView* pView = GetEditView();
+ TextView* pView = GetEditView();
TextSelection aSel;
if ( bFromStart )
{
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index c8bf2e6a53ca..9a5156072e1e 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -26,9 +26,6 @@
#include "breakpoint.hxx"
#include "linenumberwindow.hxx"
-class ExtTextEngine;
-class ExtTextView;
-class SvxSearchItem;
#include <svtools/svtabbx.hxx>
#include <svtools/headbar.hxx>
@@ -50,6 +47,9 @@ class SvxSearchItem;
#include <comphelper/syntaxhighlight.hxx>
#include <com/sun/star/reflection/XIdlReflection.hpp>
+class ExtTextEngine;
+class TextView;
+class SvxSearchItem;
namespace com { namespace sun { namespace star { namespace beans {
class XMultiPropertySet;
} } } }
@@ -74,8 +74,8 @@ friend class CodeCompleteListBox;
private:
class ChangesListener;
- std::unique_ptr<ExtTextView> pEditView;
- std::unique_ptr<ExtTextEngine> pEditEngine;
+ std::unique_ptr<TextView> pEditView;
+ std::unique_ptr<ExtTextEngine> pEditEngine;
ModulWindow& rModulWindow;
rtl::Reference< ChangesListener > listener_;
@@ -139,7 +139,7 @@ public:
virtual void dispose() override;
ExtTextEngine* GetEditEngine() const { return pEditEngine.get(); }
- ExtTextView* GetEditView() const { return pEditView.get(); }
+ TextView* GetEditView() const { return pEditView.get(); }
void CreateProgress( const OUString& rText, sal_uLong nRange );
void DestroyProgress();
@@ -389,7 +389,7 @@ public:
LineNumberWindow& GetLineNumberWindow() { return m_aXEditorWindow->GetLineNumberWindow(); }
ScrollBar& GetEditVScrollBar() { return m_aXEditorWindow->GetEWVScrollBar(); }
ExtTextEngine* GetEditEngine() { return GetEditorWindow().GetEditEngine(); }
- ExtTextView* GetEditView() { return GetEditorWindow().GetEditView(); }
+ TextView* GetEditView() { return GetEditorWindow().GetEditView(); }
BreakPointList& GetBreakPoints() { return GetBreakPointWindow().GetBreakPoints(); }
ModulWindowLayout& GetLayout () { return m_rLayout; }
@@ -486,7 +486,7 @@ private:
void SetMatchingEntries(); // sets the visible entries based on aFuncBuffer variable
void HideAndRestoreFocus();
- ExtTextView* GetParentEditView();
+ TextView* GetParentEditView();
public:
explicit CodeCompleteListBox( CodeCompleteWindow* pPar );
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index d02782e35e04..64003b6e3622 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -954,7 +954,7 @@ void EditorWindow::CreateEditEngine()
return;
pEditEngine.reset(new ExtTextEngine);
- pEditView.reset(new ExtTextView(pEditEngine.get(), this));
+ pEditView.reset(new TextView(pEditEngine.get(), this));
pEditView->SetAutoIndentMode(true);
pEditEngine->SetUpdateMode(false);
pEditEngine->InsertView(pEditView.get());
@@ -2632,7 +2632,7 @@ IMPL_LINK_NOARG(CodeCompleteListBox, ImplSelectHdl, ListBox&, void)
pCodeCompleteWindow->pParent->GrabFocus();
}
-ExtTextView* CodeCompleteListBox::GetParentEditView()
+TextView* CodeCompleteListBox::GetParentEditView()
{
return pCodeCompleteWindow->pParent->GetEditView();
}
diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results
index 442ba921e015..096d79a3aee1 100644
--- a/compilerplugins/clang/mergeclasses.results
+++ b/compilerplugins/clang/mergeclasses.results
@@ -162,7 +162,6 @@ merge SwXParagraphEnumeration with SwXParagraphEnumerationImpl
merge SwXTextRanges with SwXTextRangesImpl
merge TextObj with TextObjBinary
merge TextRenderImpl with CairoTextRender
-merge TextView with ExtTextView
merge UniqueIndexImpl with UniqueIndex
merge ValueGetter with CellValueGetter
merge ValueSetter with CellValueSetter
diff --git a/desktop/source/deployment/gui/license_dialog.cxx b/desktop/source/deployment/gui/license_dialog.cxx
index 6540181139db..801d7f0eacf2 100644
--- a/desktop/source/deployment/gui/license_dialog.cxx
+++ b/desktop/source/deployment/gui/license_dialog.cxx
@@ -157,7 +157,7 @@ bool LicenseView::IsEndReached() const
{
bool bEndReached;
- ExtTextView* pView = GetTextView();
+ TextView* pView = GetTextView();
ExtTextEngine* pEdit = GetTextEngine();
const long nHeight = pEdit->GetTextHeight();
Size aOutSize = pView->GetWindow()->GetOutputSizePixel();
diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx
index 5a13c2390f6f..f9d3e1980f47 100644
--- a/include/vcl/texteng.hxx
+++ b/include/vcl/texteng.hxx
@@ -79,7 +79,6 @@ class VCL_DLLPUBLIC TextEngine : public SfxBroadcaster
friend class TextView;
friend class TextSelFunctionSet;
friend class ExtTextEngine;
- friend class ExtTextView;
friend class TextUndo;
friend class TextUndoManager;
diff --git a/include/vcl/textview.hxx b/include/vcl/textview.hxx
index 6eef0f99ea89..efb197eebc3f 100644
--- a/include/vcl/textview.hxx
+++ b/include/vcl/textview.hxx
@@ -39,11 +39,18 @@ class SelectionEngine;
class VirtualDevice;
struct TextDDInfo;
-namespace com { namespace sun { namespace star { namespace datatransfer { namespace clipboard {
- class XClipboard;
-}}}}}
+namespace com { namespace sun { namespace star {
+ namespace datatransfer { namespace clipboard {
+ class XClipboard;
+ } }
+ namespace util {
+ struct SearchOptions;
+ }
+}}}
+
struct ImpTextView;
+class ExtTextEngine;
class VCL_DLLPUBLIC TextView : public vcl::unohelper::DragAndDropClient
{
@@ -51,7 +58,6 @@ class VCL_DLLPUBLIC TextView : public vcl::unohelper::DragAndDropClient
friend class TextUndo;
friend class TextUndoManager;
friend class TextSelFunctionSet;
- friend class ExtTextView;
private:
std::unique_ptr<ImpTextView> mpImpl;
@@ -60,6 +66,7 @@ private:
TextView& operator=( const TextView& ) = delete;
protected:
+ bool ImpIndentBlock( bool bRight );
void ShowSelection();
void HideSelection();
void ShowSelection( const TextSelection& rSel );
@@ -95,7 +102,7 @@ protected:
using DragAndDropClient::dragOver;
public:
- TextView( TextEngine* pEng, vcl::Window* pWindow );
+ TextView( ExtTextEngine* pEng, vcl::Window* pWindow );
virtual ~TextView() override;
TextEngine* GetTextEngine() const;
@@ -139,7 +146,7 @@ public:
void Undo();
void Redo();
- bool Read( SvStream& rInput );
+ bool Read( SvStream& rInput );
void SetStartDocPos( const Point& rPos );
const Point& GetStartDocPos() const;
@@ -148,18 +155,18 @@ public:
Point GetWindowPos( const Point& rDocPos ) const;
void SetInsertMode( bool bInsert );
- bool IsInsertMode() const;
+ bool IsInsertMode() const;
void SetAutoIndentMode( bool bAutoIndent );
void SetReadOnly( bool bReadOnly );
- bool IsReadOnly() const;
+ bool IsReadOnly() const;
void SetAutoScroll( bool bAutoScroll );
- bool IsAutoScroll() const;
+ bool IsAutoScroll() const;
- bool SetCursorAtPoint( const Point& rPointPixel );
- bool IsSelectionAtPoint( const Point& rPointPixel );
+ bool SetCursorAtPoint( const Point& rPointPixel );
+ bool IsSelectionAtPoint( const Point& rPointPixel );
void SetPaintSelection( bool bPaint);
@@ -194,6 +201,14 @@ public:
if enabled, -1 otherwise.
*/
sal_Int32 GetLineNumberOfCursorInSelection() const;
+
+ bool MatchGroup();
+
+ bool Search( const css::util::SearchOptions& rSearchOptions, bool bForward );
+ sal_uInt16 Replace( const css::util::SearchOptions& rSearchOptions, bool bAll, bool bForward );
+
+ bool IndentBlock();
+ bool UnindentBlock();
};
#endif
diff --git a/include/vcl/vclmedit.hxx b/include/vcl/vclmedit.hxx
index f89447fc116c..84b5a6bea56c 100644
--- a/include/vcl/vclmedit.hxx
+++ b/include/vcl/vclmedit.hxx
@@ -28,7 +28,7 @@
class ImpVclMEdit;
class Timer;
class ExtTextEngine;
-class ExtTextView;
+class TextView;
class VCL_DLLPUBLIC VclMultiLineEdit : public Edit
{
@@ -53,7 +53,7 @@ protected:
static WinBits ImplInitStyle( WinBits nStyle );
ExtTextEngine* GetTextEngine() const;
- ExtTextView* GetTextView() const;
+ TextView* GetTextView() const;
ScrollBar* GetVScrollBar() const;
virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
diff --git a/include/vcl/xtextedt.hxx b/include/vcl/xtextedt.hxx
index 565872ee1be2..3db5f6c7e313 100644
--- a/include/vcl/xtextedt.hxx
+++ b/include/vcl/xtextedt.hxx
@@ -43,24 +43,6 @@ public:
bool Search( TextSelection& rSel, const css::util::SearchOptions& rSearchOptions, bool bForward = true );
};
-class VCL_DLLPUBLIC ExtTextView : public TextView
-{
-protected:
- bool ImpIndentBlock( bool bRight );
-
-public:
- ExtTextView( ExtTextEngine* pEng, vcl::Window* pWindow );
- virtual ~ExtTextView() override;
-
- bool MatchGroup();
-
- bool Search( const css::util::SearchOptions& rSearchOptions, bool bForward );
- sal_uInt16 Replace( const css::util::SearchOptions& rSearchOptions, bool bAll, bool bForward );
-
- bool IndentBlock();
- bool UnindentBlock();
-};
-
#endif // INCLUDED_VCL_XTEXTEDT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index cbb93621468c..105fab557a0c 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -1423,7 +1423,7 @@ void AddressMultiLineEdit::SetText( const OUString& rStr )
void AddressMultiLineEdit::InsertNewEntry( const OUString& rStr )
{
// insert new entry after current selected one.
- ExtTextView* pTextView = GetTextView();
+ TextView* pTextView = GetTextView();
const TextSelection& rSelection = pTextView->GetSelection();
const sal_uInt32 nPara = rSelection.GetStart().GetPara();
sal_Int32 nIndex = rSelection.GetEnd().GetIndex();
@@ -1453,7 +1453,7 @@ void AddressMultiLineEdit::InsertNewEntryAtPosition( const OUString& rStr, sal_u
SetText( GetAddress() );
//select the newly inserted/moved element
TextSelection aEntrySel(aInsertPos);
- ExtTextView* pTextView = GetTextView();
+ TextView* pTextView = GetTextView();
pTextView->SetSelection(aEntrySel);
m_aSelectionLink.Call(*this);
}
@@ -1461,7 +1461,7 @@ void AddressMultiLineEdit::InsertNewEntryAtPosition( const OUString& rStr, sal_u
void AddressMultiLineEdit::RemoveCurrentEntry()
{
ExtTextEngine* pTextEngine = GetTextEngine();
- ExtTextView* pTextView = GetTextView();
+ TextView* pTextView = GetTextView();
const TextSelection& rSelection = pTextView->GetSelection();
const TextCharAttrib* pBeginAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED );
if(pBeginAttrib &&
@@ -1480,7 +1480,7 @@ void AddressMultiLineEdit::RemoveCurrentEntry()
void AddressMultiLineEdit::MoveCurrentItem(MoveItemFlags nMove)
{
ExtTextEngine* pTextEngine = GetTextEngine();
- ExtTextView* pTextView = GetTextView();
+ TextView* pTextView = GetTextView();
const TextSelection& rSelection = pTextView->GetSelection();
const TextCharAttrib* pBeginAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED );
if(pBeginAttrib &&
@@ -1555,7 +1555,7 @@ MoveItemFlags AddressMultiLineEdit::IsCurrentItemMoveable()
{
MoveItemFlags nRet = MoveItemFlags::NONE;
ExtTextEngine* pTextEngine = GetTextEngine();
- ExtTextView* pTextView = GetTextView();
+ TextView* pTextView = GetTextView();
const TextSelection& rSelection = pTextView->GetSelection();
const TextCharAttrib* pBeginAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED );
if(pBeginAttrib &&
@@ -1575,7 +1575,7 @@ MoveItemFlags AddressMultiLineEdit::IsCurrentItemMoveable()
bool AddressMultiLineEdit::HasCurrentItem()
{
ExtTextEngine* pTextEngine = GetTextEngine();
- ExtTextView* pTextView = GetTextView();
+ TextView* pTextView = GetTextView();
const TextSelection& rSelection = pTextView->GetSelection();
const TextCharAttrib* pBeginAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED );
return (pBeginAttrib &&
@@ -1586,7 +1586,7 @@ bool AddressMultiLineEdit::HasCurrentItem()
OUString AddressMultiLineEdit::GetCurrentItem()
{
ExtTextEngine* pTextEngine = GetTextEngine();
- ExtTextView* pTextView = GetTextView();
+ TextView* pTextView = GetTextView();
const TextSelection& rSelection = pTextView->GetSelection();
const TextCharAttrib* pBeginAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED );
if(pBeginAttrib &&
@@ -1603,7 +1603,7 @@ OUString AddressMultiLineEdit::GetCurrentItem()
void AddressMultiLineEdit::SelectCurrentItem()
{
ExtTextEngine* pTextEngine = GetTextEngine();
- ExtTextView* pTextView = GetTextView();
+ TextView* pTextView = GetTextView();
const TextSelection& rSelection = pTextView->GetSelection();
const TextCharAttrib* pBeginAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED );
if(pBeginAttrib &&
diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx
index 95865fe04031..8f2e3bff6c09 100644
--- a/sw/source/uibase/docvw/srcedtw.cxx
+++ b/sw/source/uibase/docvw/srcedtw.cxx
@@ -519,7 +519,7 @@ void SwSrcEditWindow::CreateTextEngine()
m_pVScrollbar->Show();
m_pTextEngine = new ExtTextEngine;
- m_pTextView = new ExtTextView( m_pTextEngine, m_pOutWin );
+ m_pTextView = new TextView( m_pTextEngine, m_pOutWin );
m_pTextView->SetAutoIndentMode(true);
m_pOutWin->SetTextView(m_pTextView);
diff --git a/sw/source/uibase/inc/srcedtw.hxx b/sw/source/uibase/inc/srcedtw.hxx
index c78199b89b4b..ca5aa38d1535 100644
--- a/sw/source/uibase/inc/srcedtw.hxx
+++ b/sw/source/uibase/inc/srcedtw.hxx
@@ -35,12 +35,12 @@ class ScrollBar;
class SwSrcView;
class SwSrcEditWindow;
class TextEngine;
-class ExtTextView;
+class TextView;
class DataChangedEvent;
class TextViewOutWin : public vcl::Window
{
- ExtTextView* pTextView;
+ TextView* pTextView;
protected:
virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& ) override;
@@ -55,7 +55,7 @@ public:
TextViewOutWin(vcl::Window* pParent, WinBits nBits) :
Window(pParent, nBits), pTextView(nullptr){}
- void SetTextView( ExtTextView* pView ) {pTextView = pView;}
+ void SetTextView( TextView* pView ) {pTextView = pView;}
};
@@ -64,7 +64,7 @@ class SwSrcEditWindow : public vcl::Window, public SfxListener
private:
class ChangesListener;
friend class ChangesListener;
- ExtTextView* m_pTextView;
+ TextView* m_pTextView;
ExtTextEngine* m_pTextEngine;
VclPtr<TextViewOutWin> m_pOutWin;
@@ -121,7 +121,7 @@ public:
void Read(SvStream& rInput) { m_pTextEngine->Read(rInput); }
void Write(SvStream& rOutput) { m_pTextEngine->Write(rOutput); }
- ExtTextView* GetTextView()
+ TextView* GetTextView()
{return m_pTextView;}
TextEngine* GetTextEngine()
{return m_pTextEngine;}
diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx
index 554645dbfb52..4967023159e6 100644
--- a/sw/source/uibase/uiview/srcview.cxx
+++ b/sw/source/uibase/uiview/srcview.cxx
@@ -570,7 +570,7 @@ void SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem,
bool bApi,
bool bRecursive)
{
- ExtTextView* pTextView = aEditWin->GetTextView();
+ TextView* pTextView = aEditWin->GetTextView();
TextSelection aSel;
TextPaM aPaM;
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index 4893d30eeb53..81d0906680ae 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -22,6 +22,7 @@
#include <vcl/settings.hxx>
#include <textdoc.hxx>
#include <vcl/textdata.hxx>
+#include <vcl/xtextedt.hxx>
#include <textdat2.hxx>
#include <svl/undo.hxx>
@@ -33,22 +34,21 @@
#include <sot/formats.hxx>
#include <svl/urlbmk.hxx>
-#include <com/sun/star/i18n/XBreakIterator.hpp>
-
-#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
-
-#include <com/sun/star/i18n/WordType.hpp>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <vcl/unohelp.hxx>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
+#include <com/sun/star/i18n/WordType.hpp>
#include <com/sun/star/datatransfer/XTransferable.hpp>
#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
#include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp>
#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/util/SearchOptions.hpp>
+#include <com/sun/star/util/SearchFlags.hpp>
#include <vcl/edit.hxx>
@@ -145,7 +145,7 @@ sal_Bool TETextDataObject::isDataFlavorSupported( const css::datatransfer::DataF
struct ImpTextView
{
- TextEngine* mpTextEngine;
+ ExtTextEngine* mpTextEngine;
VclPtr<vcl::Window> mpWindow;
TextSelection maSelection;
@@ -177,7 +177,7 @@ struct ImpTextView
bool mbCursorAtEndOfLine;
};
-TextView::TextView( TextEngine* pEng, vcl::Window* pWindow ) :
+TextView::TextView( ExtTextEngine* pEng, vcl::Window* pWindow ) :
mpImpl(new ImpTextView)
{
pWindow->EnableRTL( false );
@@ -2247,4 +2247,175 @@ bool TextView::IsInsertMode() const
void TextView::SupportProtectAttribute(bool bSupport)
{ mpImpl->mbSupportProtectAttribute = bSupport;}
+bool TextView::MatchGroup()
+{
+ TextSelection aTmpSel( GetSelection() );
+ aTmpSel.Justify();
+ if ( ( aTmpSel.GetStart().GetPara() != aTmpSel.GetEnd().GetPara() ) ||
+ ( ( aTmpSel.GetEnd().GetIndex() - aTmpSel.GetStart().GetIndex() ) > 1 ) )
+ {
+ return false;
+ }
+
+ TextSelection aMatchSel = static_cast<ExtTextEngine*>(GetTextEngine())->MatchGroup( aTmpSel.GetStart() );
+ if ( aMatchSel.HasRange() )
+ SetSelection( aMatchSel );
+
+ return aMatchSel.HasRange();
+}
+
+bool TextView::Search( const css::util::SearchOptions& rSearchOptions, bool bForward )
+{
+ bool bFound = false;
+ TextSelection aSel( GetSelection() );
+ if ( static_cast<ExtTextEngine*>(GetTextEngine())->Search( aSel, rSearchOptions, bForward ) )
+ {
+ bFound = true;
+ // First add the beginning of the word to the selection,
+ // so that the whole word is in the visible region.
+ SetSelection( aSel.GetStart() );
+ ShowCursor( true, false );
+ }
+ else
+ {
+ aSel = GetSelection().GetEnd();
+ }
+
+ SetSelection( aSel );
+ ShowCursor();
+
+ return bFound;
+}
+
+sal_uInt16 TextView::Replace( const css::util::SearchOptions& rSearchOptions, bool bAll, bool bForward )
+{
+ sal_uInt16 nFound = 0;
+
+ if ( !bAll )
+ {
+ if ( GetSelection().HasRange() )
+ {
+ InsertText( rSearchOptions.replaceString );
+ nFound = 1;
+ Search( rSearchOptions, bForward ); // right away to the next
+ }
+ else
+ {
+ if( Search( rSearchOptions, bForward ) )
+ nFound = 1;
+ }
+ }
+ else
+ {
+ // the writer replaces all, from beginning to end
+
+ ExtTextEngine* pTextEngine = static_cast<ExtTextEngine*>(GetTextEngine());
+
+ // HideSelection();
+ TextSelection aSel;
+
+ bool bSearchInSelection = (0 != (rSearchOptions.searchFlag & css::util::SearchFlags::REG_NOT_BEGINOFLINE) );
+ if ( bSearchInSelection )
+ {
+ aSel = GetSelection();
+ aSel.Justify();
+ }
+
+ TextSelection aSearchSel( aSel );
+
+ bool bFound = pTextEngine->Search( aSel, rSearchOptions );
+ if ( bFound )
+ pTextEngine->UndoActionStart();
+ while ( bFound )
+ {
+ nFound++;
+
+ TextPaM aNewStart = pTextEngine->ImpInsertText( aSel, rSearchOptions.replaceString );
+ aSel = aSearchSel;
+ aSel.GetStart() = aNewStart;
+ bFound = pTextEngine->Search( aSel, rSearchOptions );
+ }
+ if ( nFound )
+ {
+ SetSelection( aSel.GetStart() );
+ pTextEngine->FormatAndUpdate( this );
+ pTextEngine->UndoActionEnd();
+ }
+ }
+ return nFound;
+}
+
+bool TextView::ImpIndentBlock( bool bRight )
+{
+ bool bDone = false;
+
+ TextSelection aSel = GetSelection();
+ aSel.Justify();
+
+ HideSelection();
+ GetTextEngine()->UndoActionStart();
+
+ const sal_uInt32 nStartPara = aSel.GetStart().GetPara();
+ sal_uInt32 nEndPara = aSel.GetEnd().GetPara();
+ if ( aSel.HasRange() && !aSel.GetEnd().GetIndex() )
+ {
+ nEndPara--; // do not indent
+ }
+
+ for ( sal_uInt32 nPara = nStartPara; nPara <= nEndPara; ++nPara )
+ {
+ if ( bRight )
+ {
+ // add tabs
+ GetTextEngine()->ImpInsertText( TextPaM( nPara, 0 ), '\t' );
+ bDone = true;
+ }
+ else
+ {
+ // remove Tabs/Blanks
+ OUString aText = GetTextEngine()->GetText( nPara );
+ if ( !aText.isEmpty() && (
+ ( aText[ 0 ] == '\t' ) ||
+ ( aText[ 0 ] == ' ' ) ) )
+ {
+ GetTextEngine()->ImpDeleteText( TextSelection( TextPaM( nPara, 0 ), TextPaM( nPara, 1 ) ) );
+ bDone = true;
+ }
+ }
+ }
+
+ GetTextEngine()->UndoActionEnd();
+
+ bool bRange = aSel.HasRange();
+ if ( bRight )
+ {
+ ++aSel.GetStart().GetIndex();
+ if ( bRange && ( aSel.GetEnd().GetPara() == nEndPara ) )
+ ++aSel.GetEnd().GetIndex();
+ }
+ else
+ {
+ if ( aSel.GetStart().GetIndex() )
+ --aSel.GetStart().GetIndex();
+ if ( bRange && aSel.GetEnd().GetIndex() )
+ --aSel.GetEnd().GetIndex();
+ }
+
+ ImpSetSelection( aSel );
+ GetTextEngine()->FormatAndUpdate( this );
+
+ return bDone;
+}
+
+bool TextView::IndentBlock()
+{
+ return ImpIndentBlock( true );
+}
+
+bool TextView::UnindentBlock()
+{
+ return ImpIndentBlock( false );
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index 744abc2bee6d..38c72c6015e9 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -35,7 +35,7 @@ class TextWindow : public vcl::Window
{
private:
ExtTextEngine* mpExtTextEngine;
- ExtTextView* mpExtTextView;
+ TextView* mpExtTextView;
bool mbInMBDown;
bool mbFocusSelectionHide;
@@ -49,7 +49,7 @@ public:
virtual void dispose() override;
ExtTextEngine* GetTextEngine() const { return mpExtTextEngine; }
- ExtTextView* GetTextView() const { return mpExtTextView; }
+ TextView* GetTextView() const { return mpExtTextView; }
virtual void MouseMove( const MouseEvent& rMEvt ) override;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
@@ -715,7 +715,7 @@ TextWindow::TextWindow( vcl::Window* pParent ) : Window( pParent )
if( pParent->GetStyle() & WB_BORDER )
mpExtTextEngine->SetLeftMargin( 2 );
mpExtTextEngine->SetLocale( GetSettings().GetLanguageTag().getLocale() );
- mpExtTextView = new ExtTextView( mpExtTextEngine, this );
+ mpExtTextView = new TextView( mpExtTextEngine, this );
mpExtTextEngine->InsertView( mpExtTextView );
mpExtTextEngine->EnableUndo( true );
mpExtTextView->ShowCursor();
@@ -1532,7 +1532,7 @@ ExtTextEngine* VclMultiLineEdit::GetTextEngine() const
return pImpVclMEdit->GetTextWindow()->GetTextEngine();
}
-ExtTextView* VclMultiLineEdit::GetTextView() const
+TextView* VclMultiLineEdit::GetTextView() const
{
return pImpVclMEdit->GetTextWindow()->GetTextView();
}
diff --git a/vcl/source/edit/xtextedt.cxx b/vcl/source/edit/xtextedt.cxx
index 950ab6d32337..2a43f958158e 100644
--- a/vcl/source/edit/xtextedt.cxx
+++ b/vcl/source/edit/xtextedt.cxx
@@ -220,185 +220,4 @@ bool ExtTextEngine::Search( TextSelection& rSel, const util::SearchOptions& rSea
return bFound;
}
-// class ExtTextView
-
-ExtTextView::ExtTextView( ExtTextEngine* pEng, vcl::Window* pWindow )
- : TextView( pEng, pWindow )
-{
-}
-
-ExtTextView::~ExtTextView()
-{
-}
-
-bool ExtTextView::MatchGroup()
-{
- TextSelection aTmpSel( GetSelection() );
- aTmpSel.Justify();
- if ( ( aTmpSel.GetStart().GetPara() != aTmpSel.GetEnd().GetPara() ) ||
- ( ( aTmpSel.GetEnd().GetIndex() - aTmpSel.GetStart().GetIndex() ) > 1 ) )
- {
- return false;
- }
-
- TextSelection aMatchSel = static_cast<ExtTextEngine*>(GetTextEngine())->MatchGroup( aTmpSel.GetStart() );
- if ( aMatchSel.HasRange() )
- SetSelection( aMatchSel );
-
- return aMatchSel.HasRange();
-}
-
-bool ExtTextView::Search( const util::SearchOptions& rSearchOptions, bool bForward )
-{
- bool bFound = false;
- TextSelection aSel( GetSelection() );
- if ( static_cast<ExtTextEngine*>(GetTextEngine())->Search( aSel, rSearchOptions, bForward ) )
- {
- bFound = true;
- // First add the beginning of the word to the selection,
- // so that the whole word is in the visible region.
- SetSelection( aSel.GetStart() );
- ShowCursor( true, false );
- }
- else
- {
- aSel = GetSelection().GetEnd();
- }
-
- SetSelection( aSel );
- ShowCursor();
-
- return bFound;
-}
-
-sal_uInt16 ExtTextView::Replace( const util::SearchOptions& rSearchOptions, bool bAll, bool bForward )
-{
- sal_uInt16 nFound = 0;
-
- if ( !bAll )
- {
- if ( GetSelection().HasRange() )
- {
- InsertText( rSearchOptions.replaceString );
- nFound = 1;
- Search( rSearchOptions, bForward ); // right away to the next
- }
- else
- {
- if( Search( rSearchOptions, bForward ) )
- nFound = 1;
- }
- }
- else
- {
- // the writer replaces all, from beginning to end
-
- ExtTextEngine* pTextEngine = static_cast<ExtTextEngine*>(GetTextEngine());
-
- // HideSelection();
- TextSelection aSel;
-
- bool bSearchInSelection = (0 != (rSearchOptions.searchFlag & util::SearchFlags::REG_NOT_BEGINOFLINE) );
- if ( bSearchInSelection )
- {
- aSel = GetSelection();
- aSel.Justify();
- }
-
- TextSelection aSearchSel( aSel );
-
- bool bFound = pTextEngine->Search( aSel, rSearchOptions );
- if ( bFound )
- pTextEngine->UndoActionStart();
- while ( bFound )
- {
- nFound++;
-
- TextPaM aNewStart = pTextEngine->ImpInsertText( aSel, rSearchOptions.replaceString );
- aSel = aSearchSel;
- aSel.GetStart() = aNewStart;
- bFound = pTextEngine->Search( aSel, rSearchOptions );
- }
- if ( nFound )
- {
- SetSelection( aSel.GetStart() );
- pTextEngine->FormatAndUpdate( this );
- pTextEngine->UndoActionEnd();
- }
- }
- return nFound;
-}
-
-bool ExtTextView::ImpIndentBlock( bool bRight )
-{
- bool bDone = false;
-
- TextSelection aSel = GetSelection();
- aSel.Justify();
-
- HideSelection();
- GetTextEngine()->UndoActionStart();
-
- const sal_uInt32 nStartPara = aSel.GetStart().GetPara();
- sal_uInt32 nEndPara = aSel.GetEnd().GetPara();
- if ( aSel.HasRange() && !aSel.GetEnd().GetIndex() )
- {
- nEndPara--; // do not indent
- }
-
- for ( sal_uInt32 nPara = nStartPara; nPara <= nEndPara; ++nPara )
- {
- if ( bRight )
- {
- // add tabs
- GetTextEngine()->ImpInsertText( TextPaM( nPara, 0 ), '\t' );
- bDone = true;
- }
- else
- {
- // remove Tabs/Blanks
- OUString aText = GetTextEngine()->GetText( nPara );
- if ( !aText.isEmpty() && (
- ( aText[ 0 ] == '\t' ) ||
- ( aText[ 0 ] == ' ' ) ) )
- {
- GetTextEngine()->ImpDeleteText( TextSelection( TextPaM( nPara, 0 ), TextPaM( nPara, 1 ) ) );
- bDone = true;
- }
- }
- }
-
- GetTextEngine()->UndoActionEnd();
-
- bool bRange = aSel.HasRange();
- if ( bRight )
- {
- ++aSel.GetStart().GetIndex();
- if ( bRange && ( aSel.GetEnd().GetPara() == nEndPara ) )
- ++aSel.GetEnd().GetIndex();
- }
- else
- {
- if ( aSel.GetStart().GetIndex() )
- --aSel.GetStart().GetIndex();
- if ( bRange && aSel.GetEnd().GetIndex() )
- --aSel.GetEnd().GetIndex();
- }
-
- ImpSetSelection( aSel );
- GetTextEngine()->FormatAndUpdate( this );
-
- return bDone;
-}
-
-bool ExtTextView::IndentBlock()
-{
- return ImpIndentBlock( true );
-}
-
-bool ExtTextView::UnindentBlock()
-{
- return ImpIndentBlock( false );
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */