[Libreoffice-commits] .: accessibility/inc basctl/source cui/source desktop/source editeng/inc filter/source framework/source svtools/inc svtools/Library_svt.mk svtools/Package_inc.mk svtools/source svx/source sw/source vcl/inc vcl/Library_vcl.mk vcl/Package_inc.mk vcl/source
Miklos Vajna
vmiklos at kemper.freedesktop.org
Tue Aug 7 01:50:37 PDT 2012
accessibility/inc/accessibility/extended/textwindowaccessibility.hxx | 8
basctl/source/basicide/baside2.cxx | 2
basctl/source/basicide/baside2b.cxx | 4
basctl/source/basicide/basides1.cxx | 2
basctl/source/basicide/basides2.cxx | 6
basctl/source/basicide/linenumberwindow.cxx | 4
cui/source/dialogs/SpellAttrib.hxx | 2
cui/source/dialogs/SpellDialog.cxx | 2
cui/source/inc/SpellDialog.hxx | 2
desktop/source/deployment/gui/descedit.cxx | 4
desktop/source/deployment/gui/dp_gui_autoscrolledit.cxx | 2
desktop/source/deployment/gui/license_dialog.cxx | 2
editeng/inc/editeng/unoedhlp.hxx | 2
filter/source/xsltdialog/xmlfileview.cxx | 4
filter/source/xsltdialog/xmlfileview.hxx | 2
framework/source/services/license.cxx | 2
svtools/Library_svt.mk | 7
svtools/Package_inc.mk | 5
svtools/inc/svtools/svmedit.hxx | 110
svtools/inc/svtools/textdata.hxx | 172
svtools/inc/svtools/texteng.hxx | 332 -
svtools/inc/svtools/textview.hxx | 217
svtools/inc/svtools/txtattr.hxx | 236
svtools/inc/svtools/xtextedt.hxx | 69
svtools/source/brwbox/ebbcontrols.cxx | 2
svtools/source/contnr/DocumentInfoPreview.cxx | 2
svtools/source/contnr/templwin.cxx | 4
svtools/source/edit/editsyntaxhighlighter.cxx | 4
svtools/source/edit/svmedit.cxx | 1571 ----
svtools/source/edit/svmedit2.cxx | 2
svtools/source/edit/textdat2.hxx | 312
svtools/source/edit/textdata.cxx | 345 -
svtools/source/edit/textdoc.cxx | 636 -
svtools/source/edit/textdoc.hxx | 145
svtools/source/edit/texteng.cxx | 3205 ----------
svtools/source/edit/textund2.hxx | 122
svtools/source/edit/textundo.cxx | 295
svtools/source/edit/textundo.hxx | 85
svtools/source/edit/textview.cxx | 2378 -------
svtools/source/edit/textwindowpeer.cxx | 2
svtools/source/edit/txtattr.cxx | 164
svtools/source/edit/xtextedt.cxx | 421 -
svx/source/dialog/docrecovery.cxx | 2
sw/source/ui/dbui/mmaddressblockpage.cxx | 4
sw/source/ui/docvw/srcedtw.cxx | 4
sw/source/ui/inc/srcedtw.hxx | 2
vcl/Library_vcl.mk | 9
vcl/Package_inc.mk | 7
vcl/inc/vcl/msgbox.hxx | 4
vcl/inc/vcl/textdata.hxx | 172
vcl/inc/vcl/texteng.hxx | 332 +
vcl/inc/vcl/textview.hxx | 217
vcl/inc/vcl/txtattr.hxx | 236
vcl/inc/vcl/vclmedit.hxx | 149
vcl/inc/vcl/xtextedt.hxx | 69
vcl/source/edit/textdat2.hxx | 312
vcl/source/edit/textdata.cxx | 345 +
vcl/source/edit/textdoc.cxx | 636 +
vcl/source/edit/textdoc.hxx | 145
vcl/source/edit/texteng.cxx | 3205 ++++++++++
vcl/source/edit/textund2.hxx | 122
vcl/source/edit/textundo.cxx | 295
vcl/source/edit/textundo.hxx | 85
vcl/source/edit/textview.cxx | 2378 +++++++
vcl/source/edit/txtattr.cxx | 164
vcl/source/edit/vclmedit.cxx | 1572 ++++
vcl/source/edit/xtextedt.cxx | 421 +
vcl/source/window/msgbox.cxx | 41
68 files changed, 10946 insertions(+), 10875 deletions(-)
New commits:
commit 2854d8b17cb873a5d61e06f9570ac344f054d666
Author: Zolnai Tamás <zolniatamas at caesar.elte.hu>
Date: Mon Aug 6 20:52:37 2012 +0200
fdo#46193 MessBox was made copyable
Part of MultiLineEdit was moved down from stvools to vcl
with name VCLMultiLineEdit. MessBox uses it to display the
message in read-only mode. Some of svtools' classes - which
are necessary to implement VCLMultiLineEdit - were moved to
vcl as a whole, and their includes are rewrite.
Note: ExtTextView and ExtTextEngine classes would be leaved in svtools
if VCLMultiLineEdit is a template class, but two macros: IMPL_LINK
end IMPL_LINK_NOARG make it impossible to use template syntax.
Change-Id: I26543868d8081c225c7125404d23369de3c3afcd
diff --git a/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx b/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx
index f1557e1..1ee7a3b 100644
--- a/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx
+++ b/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx
@@ -31,10 +31,10 @@
#include <toolkit/awt/vclxaccessiblecomponent.hxx>
#include <svl/lstner.hxx>
-#include <svtools/textdata.hxx>
-#include <svtools/texteng.hxx>
-#include <svtools/textview.hxx>
-#include <svtools/txtattr.hxx>
+#include <vcl/textdata.hxx>
+#include <vcl/texteng.hxx>
+#include <vcl/textview.hxx>
+#include <vcl/txtattr.hxx>
#include <com/sun/star/awt/FontWeight.hpp>
#include <com/sun/star/lang/EventObject.hpp>
#include <com/sun/star/uno/Reference.hxx>
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 2fd6660..bb9ef6e 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -42,7 +42,7 @@
#include <svl/aeitem.hxx>
#include <svl/srchitem.hxx>
#include <svl/whiter.hxx>
-#include <svtools/xtextedt.hxx>
+#include <vcl/xtextedt.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/msgbox.hxx>
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 9577c65..2854eb1 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -38,8 +38,8 @@
#include <sfx2/viewfrm.hxx>
#include <vcl/msgbox.hxx>
#include <svl/urihelper.hxx>
-#include <svtools/xtextedt.hxx>
-#include <svtools/txtattr.hxx>
+#include <vcl/xtextedt.hxx>
+#include <vcl/txtattr.hxx>
#include <svtools/textwindowpeer.hxx>
#include <vcl/taskpanelist.hxx>
#include <vcl/help.hxx>
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index f48d56b..c43156c 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -50,7 +50,7 @@
#include <svl/srchitem.hxx>
#include <svl/visitem.hxx>
#include <svl/whiter.hxx>
-#include <svtools/xtextedt.hxx>
+#include <vcl/xtextedt.hxx>
#include <vcl/msgbox.hxx>
using namespace ::com::sun::star;
diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx
index c49e8cf..a324ebf 100644
--- a/basctl/source/basicide/basides2.cxx
+++ b/basctl/source/basicide/basides2.cxx
@@ -29,9 +29,9 @@
#include <baside2.hxx>
#include <basdoc.hxx>
#include <basobj.hxx>
-#include <svtools/texteng.hxx>
-#include <svtools/textview.hxx>
-#include <svtools/xtextedt.hxx>
+#include <vcl/texteng.hxx>
+#include <vcl/textview.hxx>
+#include <vcl/xtextedt.hxx>
#include <tools/diagnose_ex.h>
#include <sfx2/childwin.hxx>
#include <sfx2/dispatch.hxx>
diff --git a/basctl/source/basicide/linenumberwindow.cxx b/basctl/source/basicide/linenumberwindow.cxx
index 97674a6..b6d5223 100644
--- a/basctl/source/basicide/linenumberwindow.cxx
+++ b/basctl/source/basicide/linenumberwindow.cxx
@@ -29,8 +29,8 @@
#include "baside2.hxx"
#include "linenumberwindow.hxx"
-#include <svtools/xtextedt.hxx>
-#include <svtools/textview.hxx>
+#include <vcl/xtextedt.hxx>
+#include <vcl/textview.hxx>
LineNumberWindow::LineNumberWindow( Window* pParent, ModulWindow* pModulWin ) :
Window( pParent, WB_BORDER ),
diff --git a/cui/source/dialogs/SpellAttrib.hxx b/cui/source/dialogs/SpellAttrib.hxx
index 4a260f5..1cc0304 100644
--- a/cui/source/dialogs/SpellAttrib.hxx
+++ b/cui/source/dialogs/SpellAttrib.hxx
@@ -28,7 +28,7 @@
#ifndef _SVX_SPELL_ATTRIB
#define _SVX_SPELL_ATTRIB
-#include <svtools/txtattr.hxx>
+#include <vcl/txtattr.hxx>
#include <i18npool/lang.h>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.h>
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index c832bbc..9dcd2ac 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -36,7 +36,7 @@
#include <sfx2/bindings.hxx>
#include <svl/undo.hxx>
#include <unotools/lingucfg.hxx>
-#include <svtools/textdata.hxx>
+#include <vcl/textdata.hxx>
#include <svtools/filter.hxx>
#include <editeng/unolingu.hxx>
#include <editeng/splwrap.hxx>
diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx
index c9cac11..c58ff7b 100644
--- a/cui/source/inc/SpellDialog.hxx
+++ b/cui/source/inc/SpellDialog.hxx
@@ -48,7 +48,7 @@
#include <svtools/svmedit.hxx>
#include <svl/lstner.hxx>
#include <svtools/fixedhyper.hxx>
-#include <svtools/xtextedt.hxx>
+#include <vcl/xtextedt.hxx>
#include <editeng/SpellPortions.hxx>
#include <set>
diff --git a/desktop/source/deployment/gui/descedit.cxx b/desktop/source/deployment/gui/descedit.cxx
index b90061e..49ab5b6 100644
--- a/desktop/source/deployment/gui/descedit.cxx
+++ b/desktop/source/deployment/gui/descedit.cxx
@@ -19,8 +19,8 @@
#include <vcl/scrbar.hxx>
-#include <svtools/txtattr.hxx>
-#include <svtools/xtextedt.hxx>
+#include <vcl/txtattr.hxx>
+#include <vcl/xtextedt.hxx>
#include "descedit.hxx"
diff --git a/desktop/source/deployment/gui/dp_gui_autoscrolledit.cxx b/desktop/source/deployment/gui/dp_gui_autoscrolledit.cxx
index cf3c740..d3a76d9 100644
--- a/desktop/source/deployment/gui/dp_gui_autoscrolledit.cxx
+++ b/desktop/source/deployment/gui/dp_gui_autoscrolledit.cxx
@@ -19,7 +19,7 @@
#include "svtools/svmedit2.hxx"
#include "svl/lstner.hxx"
-#include "svtools/xtextedt.hxx"
+#include "vcl/xtextedt.hxx"
#include "vcl/scrbar.hxx"
#include "dp_gui_autoscrolledit.hxx"
diff --git a/desktop/source/deployment/gui/license_dialog.cxx b/desktop/source/deployment/gui/license_dialog.cxx
index 2a76bba..3e1e23e 100644
--- a/desktop/source/deployment/gui/license_dialog.cxx
+++ b/desktop/source/deployment/gui/license_dialog.cxx
@@ -40,7 +40,7 @@
#include "com/sun/star/task/XJobExecutor.hpp"
#include "svtools/svmedit.hxx"
#include "svl/lstner.hxx"
-#include "svtools/xtextedt.hxx"
+#include "vcl/xtextedt.hxx"
#include <vcl/scrbar.hxx>
#include "vcl/threadex.hxx"
diff --git a/editeng/inc/editeng/unoedhlp.hxx b/editeng/inc/editeng/unoedhlp.hxx
index df625f5..5848338 100644
--- a/editeng/inc/editeng/unoedhlp.hxx
+++ b/editeng/inc/editeng/unoedhlp.hxx
@@ -31,7 +31,7 @@
#include <memory>
#include <tools/solar.h>
-#include <svtools/textdata.hxx>
+#include <vcl/textdata.hxx>
#include <svl/hint.hxx>
#include <tools/gen.hxx>
#include "editeng/editengdllapi.h"
diff --git a/filter/source/xsltdialog/xmlfileview.cxx b/filter/source/xsltdialog/xmlfileview.cxx
index ca1fa3f..a200a92 100644
--- a/filter/source/xsltdialog/xmlfileview.cxx
+++ b/filter/source/xsltdialog/xmlfileview.cxx
@@ -36,7 +36,7 @@
#include <rtl/tencinfo.h>
#include <vcl/svapp.hxx>
#include <osl/mutex.hxx>
-#include <svtools/textview.hxx>
+#include <vcl/textview.hxx>
#include <vcl/scrbar.hxx>
#include <tools/stream.hxx>
#include <tools/time.hxx>
@@ -44,7 +44,7 @@
#include <vcl/msgbox.hxx>
#include <svtools/colorcfg.hxx>
#include <svtools/htmltokn.h>
-#include <svtools/txtattr.hxx>
+#include <vcl/txtattr.hxx>
#include "xmlfilterdialogstrings.hrc"
#include "xmlfiltersettingsdialog.hxx"
diff --git a/filter/source/xsltdialog/xmlfileview.hxx b/filter/source/xsltdialog/xmlfileview.hxx
index abbe487..51684f1 100644
--- a/filter/source/xsltdialog/xmlfileview.hxx
+++ b/filter/source/xsltdialog/xmlfileview.hxx
@@ -32,7 +32,7 @@
#include <svl/lstner.hxx>
#include <vcl/timer.hxx>
-#include <svtools/xtextedt.hxx>
+#include <vcl/xtextedt.hxx>
#include <vcl/wrkwin.hxx>
#include <vcl/ctrl.hxx>
#include <vcl/button.hxx>
diff --git a/framework/source/services/license.cxx b/framework/source/services/license.cxx
index c91321b..99753a7 100644
--- a/framework/source/services/license.cxx
+++ b/framework/source/services/license.cxx
@@ -62,7 +62,7 @@
#include <rtl/string.hxx>
#include <unotools/bootstrap.hxx>
#include <osl/file.hxx>
-#include <svtools/xtextedt.hxx>
+#include <vcl/xtextedt.hxx>
#include <vcl/svapp.hxx>
#include <comphelper/processfactory.hxx>
#include <tools/date.hxx>
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk
index 3a0e7d0..c265afb 100644
--- a/svtools/Library_svt.mk
+++ b/svtools/Library_svt.mk
@@ -148,14 +148,7 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
svtools/source/edit/svmedit \
svtools/source/edit/svmedit2 \
svtools/source/edit/syntaxhighlight \
- svtools/source/edit/textdata \
- svtools/source/edit/textdoc \
- svtools/source/edit/texteng \
- svtools/source/edit/textundo \
- svtools/source/edit/textview \
svtools/source/edit/textwindowpeer \
- svtools/source/edit/txtattr \
- svtools/source/edit/xtextedt \
svtools/source/filter/FilterConfigCache \
svtools/source/filter/FilterConfigItem \
svtools/source/filter/SvFilterOptionsDialog \
diff --git a/svtools/Package_inc.mk b/svtools/Package_inc.mk
index b0525ea..a970653 100644
--- a/svtools/Package_inc.mk
+++ b/svtools/Package_inc.mk
@@ -158,9 +158,6 @@ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/table/tabletypes.hxx,s
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/table/tablesort.hxx,svtools/table/tablesort.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/templatefoldercache.hxx,svtools/templatefoldercache.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/templdlg.hxx,svtools/templdlg.hxx))
-$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/textdata.hxx,svtools/textdata.hxx))
-$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/texteng.hxx,svtools/texteng.hxx))
-$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/textview.hxx,svtools/textview.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/textwindowpeer.hxx,svtools/textwindowpeer.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/toolbarmenu.hxx,svtools/toolbarmenu.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/toolboxcontroller.hxx,svtools/toolboxcontroller.hxx))
@@ -175,7 +172,6 @@ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/toolpanel/toolpanel.hx
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/toolpanel/toolpaneldeck.hxx,svtools/toolpanel/toolpaneldeck.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/transfer.hxx,svtools/transfer.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/treelist.hxx,svtools/treelist.hxx))
-$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/txtattr.hxx,svtools/txtattr.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/txtcmp.hxx,svtools/txtcmp.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/unitconv.hxx,svtools/unitconv.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/unoevent.hxx,svtools/unoevent.hxx))
@@ -186,7 +182,6 @@ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/wallitem.hxx,svtools/w
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/wizardmachine.hxx,svtools/wizardmachine.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/wizdlg.hxx,svtools/wizdlg.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/wmf.hxx,svtools/wmf.hxx))
-$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/xtextedt.hxx,svtools/xtextedt.hxx))
$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/xwindowitem.hxx,svtools/xwindowitem.hxx))
# vim: set noet sw=4 ts=4:
diff --git a/svtools/inc/svtools/svmedit.hxx b/svtools/inc/svtools/svmedit.hxx
index f0d30d1..9085349 100644
--- a/svtools/inc/svtools/svmedit.hxx
+++ b/svtools/inc/svtools/svmedit.hxx
@@ -29,127 +29,27 @@
#ifndef _SVEDIT_HXX
#define _SVEDIT_HXX
-#include <tools/wintypes.hxx>
-#include <vcl/edit.hxx>
+#include <vcl/vclmedit.hxx>
#include <svtools/syntaxhighlight.hxx>
#include <svtools/svtdllapi.h>
#include <svtools/colorcfg.hxx>
-class ImpSvMEdit;
-class Timer;
-class ExtTextEngine;
-class ExtTextView;
-class SVT_DLLPUBLIC MultiLineEdit : public Edit
-{
-private:
- ImpSvMEdit* pImpSvMEdit;
-
- XubString aSaveValue;
- Link aModifyHdlLink;
-
- Timer* pUpdateDataTimer;
- Link aUpdateDataHdlLink;
-
-protected:
-
- DECL_LINK( ImpUpdateDataHdl, void* );
- void StateChanged( StateChangedType nType );
- void DataChanged( const DataChangedEvent& rDCEvt );
- virtual long PreNotify( NotifyEvent& rNEvt );
- long Notify( NotifyEvent& rNEvt );
- using Control::ImplInitSettings;
- void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
- WinBits ImplInitStyle( WinBits nStyle );
-
- ExtTextEngine* GetTextEngine() const;
- ExtTextView* GetTextView() const;
- ScrollBar* GetVScrollBar() const;
+class SVT_DLLPUBLIC MultiLineEdit : public VCLMultiLineEdit
+{
public:
MultiLineEdit( Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER );
MultiLineEdit( Window* pParent, const ResId& rResId );
- ~MultiLineEdit();
-
-
- virtual void Modify();
- virtual void UpdateData();
-
- virtual void SetModifyFlag();
- virtual void ClearModifyFlag();
- virtual sal_Bool IsModified() const;
-
- virtual void EnableUpdateData( sal_uLong nTimeout = EDIT_UPDATEDATA_TIMEOUT );
- virtual void DisableUpdateData() { delete pUpdateDataTimer; pUpdateDataTimer = NULL; }
- virtual sal_uLong IsUpdateDataEnabled() const;
-
- virtual void SetReadOnly( sal_Bool bReadOnly = sal_True );
- virtual sal_Bool IsReadOnly() const;
-
- void EnableFocusSelectionHide( sal_Bool bHide );
-
- virtual void SetMaxTextLen( xub_StrLen nMaxLen = 0 );
- virtual xub_StrLen GetMaxTextLen() const;
-
- virtual void SetSelection( const Selection& rSelection );
- virtual const Selection& GetSelection() const;
-
- virtual void ReplaceSelected( const XubString& rStr );
- virtual void DeleteSelected();
- virtual XubString GetSelected() const;
- virtual XubString GetSelected( LineEnd aSeparator ) const;
-
- virtual void Cut();
- virtual void Copy();
- virtual void Paste();
-
- virtual void SetText( const XubString& rStr );
- virtual void SetText( const XubString& rStr, const Selection& rNewSelection )
- { SetText( rStr ); SetSelection( rNewSelection ); }
- String GetText() const;
- String GetText( LineEnd aSeparator ) const;
- String GetTextLines( LineEnd aSeparator ) const;
-
- void SetRightToLeft( sal_Bool bRightToLeft );
- sal_Bool IsRightToLeft() const;
-
- void SaveValue() { aSaveValue = GetText(); }
- const XubString& GetSavedValue() const { return aSaveValue; }
-
- void SetModifyHdl( const Link& rLink ) { aModifyHdlLink = rLink; }
- const Link& GetModifyHdl() const { return aModifyHdlLink; }
-
- void SetUpdateDataHdl( const Link& rLink ) { aUpdateDataHdlLink = rLink; }
- const Link& GetUpdateDataHdl() const { return aUpdateDataHdlLink; }
-
- virtual void Resize();
- virtual void GetFocus();
-
- Size CalcMinimumSize() const;
- Size CalcAdjustedSize( const Size& rPrefSize ) const;
- using Edit::CalcSize;
- Size CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
- void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const;
-
- void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
-
- void SetLeftMargin( sal_uInt16 n );
+ ~MultiLineEdit(){};
virtual
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
GetComponentInterface(sal_Bool bCreate = sal_True);
-
- void DisableSelectionOnFocus();
-
- void SetTextSelectable( sal_Bool bTextSelectable );
};
-inline sal_uLong MultiLineEdit::IsUpdateDataEnabled() const
-{
- return pUpdateDataTimer ? pUpdateDataTimer->GetTimeout() : 0;
-}
-#endif
+#endif //_SVEDIT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/inc/svtools/textdata.hxx b/svtools/inc/svtools/textdata.hxx
deleted file mode 100644
index 29d97e6..0000000
--- a/svtools/inc/svtools/textdata.hxx
+++ /dev/null
@@ -1,172 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef _TEXTDATA_HXX
-#define _TEXTDATA_HXX
-
-#include "svtools/svtdllapi.h"
-#include <svl/brdcst.hxx>
-#include <svl/smplhint.hxx>
-#include <tools/string.hxx>
-
-// Fuer Notify, wenn alle Absaetze geloescht wurden...
-#define TEXT_PARA_ALL 0xFFFFFFFF
-
-class TextPaM
-{
-private:
- sal_uLong mnPara;
- sal_uInt16 mnIndex;
-
-public:
- TextPaM() { mnPara = 0, mnIndex = 0; }
- TextPaM( sal_uLong nPara, sal_uInt16 nIndex ) { mnPara = nPara, mnIndex = nIndex; }
-
- sal_uLong GetPara() const { return mnPara; }
- sal_uLong& GetPara() { return mnPara; }
-
- sal_uInt16 GetIndex() const { return mnIndex; }
- sal_uInt16& GetIndex() { return mnIndex; }
-
- inline sal_Bool operator == ( const TextPaM& rPaM ) const;
- inline sal_Bool operator != ( const TextPaM& rPaM ) const;
- inline sal_Bool operator < ( const TextPaM& rPaM ) const;
- inline sal_Bool operator > ( const TextPaM& rPaM ) const;
-};
-
-inline sal_Bool TextPaM::operator == ( const TextPaM& rPaM ) const
-{
- return ( ( mnPara == rPaM.mnPara ) && ( mnIndex == rPaM.mnIndex ) ) ? sal_True : sal_False;
-}
-
-inline sal_Bool TextPaM::operator != ( const TextPaM& rPaM ) const
-{
- return !( *this == rPaM );
-}
-
-inline sal_Bool TextPaM::operator < ( const TextPaM& rPaM ) const
-{
- return ( ( mnPara < rPaM.mnPara ) ||
- ( ( mnPara == rPaM.mnPara ) && mnIndex < rPaM.mnIndex ) ) ? sal_True : sal_False;
-}
-
-inline sal_Bool TextPaM::operator > ( const TextPaM& rPaM ) const
-{
- return ( ( mnPara > rPaM.mnPara ) ||
- ( ( mnPara == rPaM.mnPara ) && mnIndex > rPaM.mnIndex ) ) ? sal_True : sal_False;
-}
-
-class SVT_DLLPUBLIC TextSelection
-{
-private:
- TextPaM maStartPaM;
- TextPaM maEndPaM;
-
-public:
- TextSelection();
- TextSelection( const TextPaM& rPaM );
- TextSelection( const TextPaM& rStart, const TextPaM& rEnd );
-
- const TextPaM& GetStart() const { return maStartPaM; }
- TextPaM& GetStart() { return maStartPaM; }
-
- const TextPaM& GetEnd() const { return maEndPaM; }
- TextPaM& GetEnd() { return maEndPaM; }
-
- void Justify();
-
- sal_Bool HasRange() const { return maStartPaM != maEndPaM; }
-
- inline sal_Bool operator == ( const TextSelection& rSel ) const;
- inline sal_Bool operator != ( const TextSelection& rSel ) const;
-};
-
-inline sal_Bool TextSelection::operator == ( const TextSelection& rSel ) const
-{
- return ( ( maStartPaM == rSel.maStartPaM ) && ( maEndPaM == rSel.maEndPaM ) );
-}
-
-inline sal_Bool TextSelection::operator != ( const TextSelection& rSel ) const
-{
- return !( *this == rSel );
-}
-
-#define TEXT_HINT_PARAINSERTED 1
-#define TEXT_HINT_PARAREMOVED 2
-#define TEXT_HINT_PARACONTENTCHANGED 3
-#define TEXT_HINT_TEXTHEIGHTCHANGED 4
-#define TEXT_HINT_FORMATPARA 5
-#define TEXT_HINT_TEXTFORMATTED 6
-#define TEXT_HINT_MODIFIED 7
-#define TEXT_HINT_BLOCKNOTIFICATION_START 8
-#define TEXT_HINT_BLOCKNOTIFICATION_END 9
-#define TEXT_HINT_INPUT_START 10
-#define TEXT_HINT_INPUT_END 11
-
-#define TEXT_HINT_VIEWSCROLLED 100
-#define TEXT_HINT_VIEWSELECTIONCHANGED 101
-
-class SVT_DLLPUBLIC TextHint : public SfxSimpleHint
-{
-private:
- sal_uLong mnValue;
-
-public:
- TYPEINFO();
- TextHint( sal_uLong nId );
- TextHint( sal_uLong nId, sal_uLong nValue );
-
- sal_uLong GetValue() const { return mnValue; }
- void SetValue( sal_uLong n ) { mnValue = n; }
-};
-
-struct TEIMEInfos
-{
- String aOldTextAfterStartPos;
- sal_uInt16* pAttribs;
- TextPaM aPos;
- sal_uInt16 nLen;
- sal_Bool bCursor;
- sal_Bool bWasCursorOverwrite;
-
- TEIMEInfos( const TextPaM& rPos, const String& rOldTextAfterStartPos );
- ~TEIMEInfos();
-
- void CopyAttribs( const sal_uInt16* pA, sal_uInt16 nL );
- void DestroyAttribs();
-};
-
-// ----------------- Wrapper for old Tools List -------------------
-
-#include <vector>
-#include <algorithm>
-
-template <class T> class ToolsList : public ::std::vector< T >
-{
-public:
- sal_uLong Count() const { return static_cast<sal_uLong>(::std::vector< T >::size()); }
- sal_uLong GetPos( T pObject ) const { return ( ::std::find( this->begin(), this->end(), pObject ) ) - this->begin(); }
- T GetObject( sal_uLong nIndex ) const { return (*this)[nIndex]; }
- void Insert( T pObject, sal_uLong nPos ) { ::std::vector< T >::insert( this->begin()+nPos, pObject ); }
- void Remove( sal_uLong nPos ) { ::std::vector< T >::erase( this->begin()+nPos ); }
-};
-
-#endif // _TEXTDATA_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/inc/svtools/texteng.hxx b/svtools/inc/svtools/texteng.hxx
deleted file mode 100644
index b20a01b..0000000
--- a/svtools/inc/svtools/texteng.hxx
+++ /dev/null
@@ -1,332 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _TEXTENG_HXX
-#define _TEXTENG_HXX
-
-#include "svtools/svtdllapi.h"
-
-class TextDoc;
-class TextView;
-class TextPaM;
-class TextSelection;
-class TEParaPortions;
-class TextAttrib;
-class TextCharAttrib;
-class TextUndo;
-class TextUndoManager;
-class EditSelFunctionSet;
-class EditSelEngine;
-class IdleFormatter;
-class TextNode;
-class OutputDevice;
-class SfxUndoAction;
-class KeyEvent;
-class Timer;
-
-namespace svl
-{
- class IUndoManager;
-}
-
-class TextLine;
-class TETextPortion;
-#include <svl/brdcst.hxx>
-#include <tools/link.hxx>
-#include <vcl/font.hxx>
-#include <tools/string.hxx>
-#include <tools/gen.hxx>
-
-#include <com/sun/star/lang/Locale.hpp>
-#include <com/sun/star/uno/Reference.hxx>
-
-struct TEIMEInfos;
-class SvtCTLOptions;
-
-namespace com {
-namespace sun {
-namespace star {
-namespace i18n {
- class XBreakIterator;
- class XExtendedInputSequenceChecker;
-}}}}
-
-class LocaleDataWrapper;
-
-enum TxtAlign { TXTALIGN_LEFT, TXTALIGN_CENTER, TXTALIGN_RIGHT };
-
-typedef std::vector<TextView*> TextViews;
-
-class SVT_DLLPUBLIC TextEngine : public SfxBroadcaster
-{
- friend class TextView;
- friend class TextSelFunctionSet;
- friend class ExtTextEngine;
- friend class ExtTextView;
-
- friend class TextUndo;
- friend class TextUndoManager;
- friend class TextUndoDelPara;
- friend class TextUndoConnectParas;
- friend class TextUndoSplitPara;
- friend class TextUndoInsertChars;
- friend class TextUndoRemoveChars;
- friend class TextUndoSetAttribs;
-
-private:
- TextDoc* mpDoc;
- TEParaPortions* mpTEParaPortions;
- OutputDevice* mpRefDev;
-
- TextViews* mpViews;
- TextView* mpActiveView;
-
- TextUndoManager* mpUndoManager;
-
- IdleFormatter* mpIdleFormatter;
-
- TEIMEInfos* mpIMEInfos;
-
- ::com::sun::star::lang::Locale maLocale;
- ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > mxBreakIterator;
-
- Rectangle maInvalidRec;
- Range maInvalidRange;
-
- LocaleDataWrapper* mpLocaleDataWrapper;
-
- Font maFont;
- Color maTextColor;
- sal_uInt16 mnCharHeight;
- sal_uInt16 mnFixCharWidth100;
-
- sal_uLong mnMaxTextLen;
- sal_uLong mnMaxTextWidth;
- sal_uLong mnCurTextWidth;
- sal_uLong mnCurTextHeight;
- sal_uLong mnDefTab;
-
- TxtAlign meAlign;
-
- sal_Bool mbIsFormatting : 1; // Semaphore wegen der Hook's
- sal_Bool mbFormatted : 1;
- sal_Bool mbUpdate : 1;
- sal_Bool mbModified : 1;
- sal_Bool mbUndoEnabled : 1;
- sal_Bool mbIsInUndo : 1;
- sal_Bool mbDowning : 1;
- sal_Bool mbRightToLeft : 1;
- sal_Bool mbHasMultiLineParas : 1;
-
- TextEngine( const TextEngine& ) : SfxBroadcaster() {}
- TextEngine& operator=( const TextEngine& ) { return *this; }
-
-protected:
-
- void CursorMoved( sal_uLong nNode );
- void TextModified();
-
- void ImpInitDoc();
- void ImpRemoveText();
- TextPaM ImpDeleteText( const TextSelection& rSel );
- TextPaM ImpInsertText( const TextSelection& rSel, sal_Unicode c, sal_Bool bOverwrite = sal_False );
- TextPaM ImpInsertText( const TextSelection& rSel, const String& rText );
- TextPaM ImpInsertParaBreak( const TextSelection& rTextSelection, sal_Bool bKeepEndingAttribs = sal_True );
- TextPaM ImpInsertParaBreak( const TextPaM& rPaM, sal_Bool bKeepEndingAttribs = sal_True );
- void ImpRemoveChars( const TextPaM& rPaM, sal_uInt16 nChars, SfxUndoAction* pCurUndo = 0 );
- TextPaM ImpConnectParagraphs( sal_uLong nLeft, sal_uLong nRight );
- void ImpRemoveParagraph( sal_uLong nPara );
- void ImpInitWritingDirections( sal_uLong nPara );
- LocaleDataWrapper* ImpGetLocaleDataWrapper();
-
- // to remain compatible in the minor release we copy the above ImpInsertText
- // function and add the extra parameter we need but make sure this function
- // gets not exported. First and seconf parameter swapped to have a different signatur.
- SAL_DLLPRIVATE TextPaM ImpInsertText( sal_Unicode c, const TextSelection& rSel, sal_Bool bOverwrite = sal_False, sal_Bool bIsUserInput = sal_False );
- // some other new functions needed that must not be exported to remain compatible
- SAL_DLLPRIVATE ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XExtendedInputSequenceChecker > GetInputSequenceChecker() const;
- SAL_DLLPRIVATE sal_Bool IsInputSequenceCheckingRequired( sal_Unicode c, const TextSelection& rCurSel ) const;
-
- // Broadcasten bzw. Selektionen anpassen:
- void ImpParagraphInserted( sal_uLong nPara );
- void ImpParagraphRemoved( sal_uLong nPara );
- void ImpCharsRemoved( sal_uLong nPara, sal_uInt16 nPos, sal_uInt16 nChars );
- void ImpCharsInserted( sal_uLong nPara, sal_uInt16 nPos, sal_uInt16 nChars );
- void ImpFormattingParagraph( sal_uLong nPara );
- void ImpTextHeightChanged();
- void ImpTextFormatted();
-
- DECL_LINK( IdleFormatHdl, void * );
- void CheckIdleFormatter();
- void IdleFormatAndUpdate( TextView* pCurView = 0, sal_uInt16 nMaxTimerRestarts = 5 );
-
- sal_Bool CreateLines( sal_uLong nPara );
- void CreateAndInsertEmptyLine( sal_uLong nPara );
- void ImpBreakLine( sal_uLong nPara, TextLine* pLine, TETextPortion* pPortion, sal_uInt16 nPortionStart, long nRemainingWidth );
- sal_uInt16 SplitTextPortion( sal_uLong nPara, sal_uInt16 nPos );
- void CreateTextPortions( sal_uLong nPara, sal_uInt16 nStartPos );
- void RecalcTextPortion( sal_uLong nPara, sal_uInt16 nStartPos, short nNewChars );
- void SeekCursor( sal_uLong nNode, sal_uInt16 nPos, Font& rFont, OutputDevice* pOutDev );
-
- void FormatDoc();
- void FormatFullDoc();
- void FormatAndUpdate( TextView* pCurView = 0 );
- sal_Bool IsFormatting() const { return mbIsFormatting; }
- void UpdateViews( TextView* pCurView = 0 );
-
- void ImpPaint( OutputDevice* pOut, const Point& rStartPos, Rectangle const* pPaintArea, TextSelection const* pPaintRange = 0, TextSelection const* pSelection = 0 );
-
- void UpdateSelections();
-
- sal_Bool IsFormatted() const { return mbFormatted; }
-
- sal_uInt16 GetCharPos( sal_uLong nPara, sal_uInt16 nLine, long nDocPosX, sal_Bool bSmart = sal_False );
- Rectangle GetEditCursor( const TextPaM& rPaM, sal_Bool bSpecial, sal_Bool bPreferPortionStart = sal_False );
- sal_uInt16 ImpFindIndex( sal_uLong nPortion, const Point& rPosInPara, sal_Bool bSmart );
- long ImpGetPortionXOffset( sal_uLong nPara, TextLine* pLine, sal_uInt16 nTextPortion );
- long ImpGetXPos( sal_uLong nPara, TextLine* pLine, sal_uInt16 nIndex, sal_Bool bPreferPortionStart = sal_False );
- long ImpGetOutputOffset( sal_uLong nPara, TextLine* pLine, sal_uInt16 nIndex, sal_uInt16 nIndex2 );
- sal_uInt8 ImpGetRightToLeft( sal_uLong nPara, sal_uInt16 nPos, sal_uInt16* pStart = NULL, sal_uInt16* pEnd = NULL );
- void ImpInitLayoutMode( OutputDevice* pOutDev, sal_Bool bDrawingR2LPortion = sal_False );
- TxtAlign ImpGetAlign() const;
-
- sal_uLong CalcTextHeight();
- sal_uLong CalcParaHeight( sal_uLong nParagraph ) const;
- sal_uLong CalcTextWidth( sal_uLong nPara );
- sal_uLong CalcTextWidth( sal_uLong nPara, sal_uInt16 nPortionStart, sal_uInt16 nPortionLen, const Font* pFont = 0 );
- Range GetInvalidYOffsets( sal_uLong nPortion );
-
- // Fuer Undo/Redo
- void InsertContent( TextNode* pNode, sal_uLong nPara );
- TextPaM SplitContent( sal_uLong nNode, sal_uInt16 nSepPos );
- TextPaM ConnectContents( sal_uLong nLeftNode );
-
- // Ans API uebergebene PaM's und Selektionen auf einen gueltigen Bereich einstellen
- void ValidateSelection( TextSelection& rSel ) const;
- void ValidatePaM( TextPaM& rPaM ) const;
-
-public:
- TextEngine();
- ~TextEngine();
-
- void SetText( const String& rStr );
- String GetText( LineEnd aSeparator = LINEEND_LF ) const;
- String GetText( const TextSelection& rSel, LineEnd aSeparator = LINEEND_LF ) const;
- String GetTextLines( LineEnd aSeparator = LINEEND_LF ) const;
- void ReplaceText(const TextSelection& rSel, const String& rText);
-
- sal_uLong GetTextLen( LineEnd aSeparator = LINEEND_LF ) const;
- sal_uLong GetTextLen( const TextSelection& rSel, LineEnd aSeparator = LINEEND_LF ) const;
-
- void SetFont( const Font& rFont );
- const Font& GetFont() const { return maFont; }
-
- sal_uInt16 GetDefTab() const;
-
- void SetLeftMargin( sal_uInt16 n );
- sal_uInt16 GetLeftMargin() const;
-
- void SetUpdateMode( sal_Bool bUpdate );
- sal_Bool GetUpdateMode() const { return mbUpdate; }
-
- sal_uInt16 GetViewCount() const;
- TextView* GetView( sal_uInt16 nView ) const;
- void InsertView( TextView* pTextView );
- void RemoveView( TextView* pTextView );
- TextView* GetActiveView() const;
- void SetActiveView( TextView* pView );
-
- void SetMaxTextLen( sal_uLong nLen );
- sal_uLong GetMaxTextLen() const { return mnMaxTextLen; }
-
- void SetMaxTextWidth( sal_uLong nWidth );
- sal_uLong GetMaxTextWidth() const { return mnMaxTextWidth; }
-
- sal_uLong GetTextHeight() const;
- sal_uLong CalcTextWidth();
- sal_uInt16 GetCharHeight() const { return mnCharHeight; }
-
- sal_uLong GetParagraphCount() const;
- String GetText( sal_uLong nParagraph ) const;
- sal_uInt16 GetTextLen( sal_uLong nParagraph ) const;
- sal_uLong GetTextHeight( sal_uLong nParagraph ) const;
-
- sal_uInt16 GetLineCount( sal_uLong nParagraph ) const;
- sal_uInt16 GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) const;
-
- void SetRightToLeft( sal_Bool bR2L );
- sal_Bool IsRightToLeft() const { return mbRightToLeft; }
-
- sal_Bool HasUndoManager() const { return mpUndoManager ? sal_True : sal_False; }
- ::svl::IUndoManager&
- GetUndoManager();
- void UndoActionStart( sal_uInt16 nId = 0 );
- void UndoActionEnd();
- void InsertUndo( TextUndo* pUndo, sal_Bool bTryMerge = sal_False );
- sal_Bool IsInUndo() { return mbIsInUndo; }
- void SetIsInUndo( sal_Bool bInUndo ) { mbIsInUndo = bInUndo; }
- void ResetUndo();
-
- void EnableUndo( sal_Bool bEnable );
- sal_Bool IsUndoEnabled() { return mbUndoEnabled; }
-
- void SetModified( sal_Bool bModified ) { mbModified = bModified; }
- sal_Bool IsModified() const { return mbModified; }
-
- sal_Bool Read( SvStream& rInput, const TextSelection* pSel = NULL );
-
- sal_Bool Write( SvStream& rOutput, const TextSelection* pSel = NULL, sal_Bool bHTML = sal_False );
-
- TextPaM GetPaM( const Point& rDocPos, sal_Bool bSmart = sal_True );
- Rectangle PaMtoEditCursor( const TextPaM& rPaM, sal_Bool bSpecial = sal_False );
- String GetWord( const TextPaM& rCursorPos, TextPaM* pStartOfWord = 0 );
-
- sal_Bool HasAttrib( sal_uInt16 nWhich ) const;
- const TextAttrib* FindAttrib( const TextPaM& rPaM, sal_uInt16 nWhich ) const;
- const TextCharAttrib* FindCharAttrib( const TextPaM& rPaM, sal_uInt16 nWhich ) const;
-
- void RemoveAttribs( sal_uLong nPara, sal_uInt16 nWhich, sal_Bool bIdleFormatAndUpdate );
- void RemoveAttrib( sal_uLong nPara, const TextCharAttrib& rAttrib );
- void RemoveAttribs( sal_uLong nPara, sal_Bool bIdleFormatAndUpdate = sal_True );
- void SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_Bool bIdleFormatAndUpdate = sal_True );
-
- TxtAlign GetTextAlign() const { return meAlign; }
- void SetTextAlign( TxtAlign eAlign );
-
- void Draw( OutputDevice* pDev, const Point& rPos );
-
- void SetLocale( const ::com::sun::star::lang::Locale& rLocale );
- ::com::sun::star::lang::Locale GetLocale();
- ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > GetBreakIterator();
-
- static sal_Bool DoesKeyChangeText( const KeyEvent& rKeyEvent );
- static sal_Bool IsSimpleCharInput( const KeyEvent& rKeyEvent );
-};
-
-#endif // _TEXTENG_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/inc/svtools/textview.hxx b/svtools/inc/svtools/textview.hxx
deleted file mode 100644
index ebf7a4f..0000000
--- a/svtools/inc/svtools/textview.hxx
+++ /dev/null
@@ -1,217 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _TEXTVIEW_HXX
-#define _TEXTVIEW_HXX
-
-#include "svtools/svtdllapi.h"
-#include <svtools/textdata.hxx>
-#include <tools/gen.hxx>
-#include <vcl/dndhelp.hxx>
-
-class TextEngine;
-class OutputDevice;
-class Window;
-class Cursor;
-class KeyEvent;
-class MouseEvent;
-class CommandEvent;
-class TextSelFunctionSet;
-class SelectionEngine;
-class VirtualDevice;
-struct TextDDInfo;
-
-namespace com {
-namespace sun {
-namespace star {
-namespace datatransfer {
-namespace clipboard {
- class XClipboard;
-}}}}}
-
-struct ImpTextView;
-
-class SVT_DLLPUBLIC TextView : public vcl::unohelper::DragAndDropClient
-{
- friend class TextEngine;
- friend class TextUndo;
- friend class TextUndoManager;
- friend class TextSelFunctionSet;
- friend class ExtTextView;
-
-private:
- ImpTextView* mpImpl;
-
- TextView( const TextView& ) : vcl::unohelper::DragAndDropClient() {}
- TextView& operator=( const TextView& ) { return *this; }
-
-protected:
- void ShowSelection();
- void HideSelection();
- void ShowSelection( const TextSelection& rSel );
- void ImpShowHideSelection( sal_Bool bShow, const TextSelection* pRange = NULL );
-
- TextSelection ImpMoveCursor( const KeyEvent& rKeyEvent );
- TextPaM ImpDelete( sal_uInt8 nMode, sal_uInt8 nDelMode );
- void ImpSetSelection( const TextSelection& rNewSel, sal_Bool bUI );
- sal_Bool IsInSelection( const TextPaM& rPaM );
-
- void ImpPaint( OutputDevice* pOut, const Point& rStartPos, Rectangle const* pPaintArea, TextSelection const* pPaintRange = 0, TextSelection const* pSelection = 0 );
- void ImpPaint( const Rectangle& rRect, sal_Bool bUseVirtDev );
- void ImpShowCursor( sal_Bool bGotoCursor, sal_Bool bForceVisCursor, sal_Bool bEndKey );
- void ImpHighlight( const TextSelection& rSel );
- void ImpSetSelection( const TextSelection& rSelection );
- Point ImpGetOutputStartPos( const Point& rStartDocPos ) const;
-
- void ImpHideDDCursor();
- void ImpShowDDCursor();
-
- bool ImplTruncateNewText( rtl::OUString& rNewText ) const;
- sal_Bool ImplCheckTextLen( const String& rNewText );
-
- VirtualDevice* GetVirtualDevice();
-
- // DragAndDropClient
- virtual void dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& dge ) throw (::com::sun::star::uno::RuntimeException);
- virtual void dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& dsde ) throw (::com::sun::star::uno::RuntimeException);
- virtual void drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& dtde ) throw (::com::sun::star::uno::RuntimeException);
- virtual void dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw (::com::sun::star::uno::RuntimeException);
- virtual void dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw (::com::sun::star::uno::RuntimeException);
- virtual void dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw (::com::sun::star::uno::RuntimeException);
-
- using DragAndDropClient::dragEnter;
- using DragAndDropClient::dragExit;
- using DragAndDropClient::dragOver;
-
-public:
- TextView( TextEngine* pEng, Window* pWindow );
- virtual ~TextView();
-
- TextEngine* GetTextEngine() const;
- Window* GetWindow() const;
-
- void Invalidate();
- void Scroll( long nHorzScroll, long nVertScroll );
-
- void ShowCursor( sal_Bool bGotoCursor = sal_True, sal_Bool bForceVisCursor = sal_True );
- void HideCursor();
-
- void EnableCursor( sal_Bool bEnable );
- sal_Bool IsCursorEnabled() const;
-
- const TextSelection& GetSelection() const;
- TextSelection& GetSelection();
- void SetSelection( const TextSelection& rNewSel );
- void SetSelection( const TextSelection& rNewSel, sal_Bool bGotoCursor );
- sal_Bool HasSelection() const;
-
- String GetSelected();
- String GetSelected( LineEnd aSeparator );
- void DeleteSelected();
-
- void InsertNewText( const rtl::OUString& rNew, sal_Bool bSelect = sal_False );
- // deprecated: use InsertNewText instead
- void InsertText( const String& rNew, sal_Bool bSelect = sal_False );
-
- sal_Bool KeyInput( const KeyEvent& rKeyEvent );
- void Paint( const Rectangle& rRect );
- void MouseButtonUp( const MouseEvent& rMouseEvent );
- void MouseButtonDown( const MouseEvent& rMouseEvent );
- void MouseMove( const MouseEvent& rMouseEvent );
- void Command( const CommandEvent& rCEvt );
-
- void Cut();
- void Copy();
- void Paste();
-
- void Copy( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard );
- void Paste( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& rxClipboard );
-
- void Undo();
- void Redo();
-
- sal_Bool Read( SvStream& rInput );
-
- void SetStartDocPos( const Point& rPos );
- const Point& GetStartDocPos() const;
-
- Point GetDocPos( const Point& rWindowPos ) const;
- Point GetWindowPos( const Point& rDocPos ) const;
-
- void SetInsertMode( sal_Bool bInsert );
- sal_Bool IsInsertMode() const;
-
- void SetAutoIndentMode( sal_Bool bAutoIndent );
-
- void SetReadOnly( sal_Bool bReadOnly );
- sal_Bool IsReadOnly() const;
-
- void SetAutoScroll( sal_Bool bAutoScroll );
- sal_Bool IsAutoScroll() const;
-
- sal_Bool SetCursorAtPoint( const Point& rPointPixel );
- sal_Bool IsSelectionAtPoint( const Point& rPointPixel );
-
- void SetPaintSelection( sal_Bool bPaint);
-
- void EraseVirtualDevice();
-
- // aus dem protected Teil hierher verschoben
- // F�r 'SvtXECTextCursor' (TL). Mu� ggf nochmal anders gel�st werden.
- TextPaM PageUp( const TextPaM& rPaM );
- TextPaM PageDown( const TextPaM& rPaM );
- TextPaM CursorUp( const TextPaM& rPaM );
- TextPaM CursorDown( const TextPaM& rPaM );
- TextPaM CursorLeft( const TextPaM& rPaM, sal_uInt16 nCharacterIteratorMode );
- TextPaM CursorRight( const TextPaM& rPaM, sal_uInt16 nCharacterIteratorMode );
- TextPaM CursorWordLeft( const TextPaM& rPaM );
- TextPaM CursorWordRight( const TextPaM& rPaM );
- TextPaM CursorStartOfLine( const TextPaM& rPaM );
- TextPaM CursorEndOfLine( const TextPaM& rPaM );
- TextPaM CursorStartOfParagraph( const TextPaM& rPaM );
- TextPaM CursorEndOfParagraph( const TextPaM& rPaM );
- TextPaM CursorStartOfDoc();
- TextPaM CursorEndOfDoc();
-
- /**
- Drag and Drop, deleting and selection regards all text that has an attribute
- TEXTATTR_PROTECTED set as one entitity. Drag and dropped text is automatically
- attibuted as protected.
- */
- void SupportProtectAttribute(sal_Bool bSupport);
-
- /**
- Returns the number in paragraph of the line in which the cursor is blinking
- if enabled, -1 otherwise.
- */
- sal_Int32 GetLineNumberOfCursorInSelection() const;
-};
-
-#endif // _TEXTVIEW_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/inc/svtools/txtattr.hxx b/svtools/inc/svtools/txtattr.hxx
deleted file mode 100644
index bf4c8e3..0000000
--- a/svtools/inc/svtools/txtattr.hxx
+++ /dev/null
@@ -1,236 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _TXTATTR_HXX
-#define _TXTATTR_HXX
-
-#include "svtools/svtdllapi.h"
-#include <tools/color.hxx>
-#include <vcl/vclenum.hxx>
-#include <tools/string.hxx>
-#include <tools/debug.hxx>
-
-class Font;
-
-#define TEXTATTR_INVALID 0
-#define TEXTATTR_FONTCOLOR 1
-#define TEXTATTR_HYPERLINK 2
-#define TEXTATTR_FONTWEIGHT 3
-
-#define TEXTATTR_USER_START 1000 //start id for user defined text attributes
-#define TEXTATTR_PROTECTED 4
-
-
-class SVT_DLLPUBLIC TextAttrib
-{
-private:
- sal_uInt16 mnWhich;
-
-protected:
- TextAttrib( sal_uInt16 nWhich ) { mnWhich = nWhich; }
- TextAttrib( const TextAttrib& rAttr ) { mnWhich = rAttr.mnWhich; }
-
-public:
-
- virtual ~TextAttrib();
-
- sal_uInt16 Which() const { return mnWhich; }
- virtual void SetFont( Font& rFont ) const = 0;
- virtual TextAttrib* Clone() const = 0;
-
- virtual int operator==( const TextAttrib& rAttr ) const = 0;
- int operator!=( const TextAttrib& rAttr ) const
- { return !(*this == rAttr ); }
-};
-
-
-
-class SVT_DLLPUBLIC TextAttribFontColor : public TextAttrib
-{
-private:
- Color maColor;
-
-public:
- TextAttribFontColor( const Color& rColor );
- TextAttribFontColor( const TextAttribFontColor& rAttr );
- ~TextAttribFontColor();
-
- const Color& GetColor() const { return maColor; }
-
- virtual void SetFont( Font& rFont ) const;
- virtual TextAttrib* Clone() const;
- virtual int operator==( const TextAttrib& rAttr ) const;
-
-};
-
-class SVT_DLLPUBLIC TextAttribFontWeight : public TextAttrib
-{
-private:
- FontWeight meWeight;
-
-public:
- TextAttribFontWeight( FontWeight eWeight );
- TextAttribFontWeight( const TextAttribFontWeight& rAttr );
- ~TextAttribFontWeight();
-
- virtual void SetFont( Font& rFont ) const;
- virtual TextAttrib* Clone() const;
- virtual int operator==( const TextAttrib& rAttr ) const;
-
- inline FontWeight getFontWeight() const { return meWeight; }
-};
-
-
-class TextAttribHyperLink : public TextAttrib
-{
-private:
- XubString maURL;
- XubString maDescription;
- Color maColor;
-
-public:
- TextAttribHyperLink( const TextAttribHyperLink& rAttr );
- ~TextAttribHyperLink();
-
- void SetURL( const XubString& rURL ) { maURL = rURL; }
- const XubString& GetURL() const { return maURL; }
-
- void SetDescription( const XubString& rDescr ) { maDescription = rDescr; }
- const XubString& GetDescription() const { return maDescription; }
-
- void SetColor( const Color& rColor ) { maColor = rColor; }
- const Color& GetColor() const { return maColor; }
-
- virtual void SetFont( Font& rFont ) const;
- virtual TextAttrib* Clone() const;
- virtual int operator==( const TextAttrib& rAttr ) const;
-};
-
-class SVT_DLLPUBLIC TextAttribProtect : public TextAttrib
-{
-public:
- TextAttribProtect();
- TextAttribProtect( const TextAttribProtect& rAttr );
- ~TextAttribProtect();
-
- virtual void SetFont( Font& rFont ) const;
- virtual TextAttrib* Clone() const;
- virtual int operator==( const TextAttrib& rAttr ) const;
-
-};
-
-
-class TextCharAttrib
-{
-private:
- TextAttrib* mpAttr;
- sal_uInt16 mnStart;
- sal_uInt16 mnEnd;
-
-protected:
-
-public:
-
- TextCharAttrib( const TextAttrib& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
- TextCharAttrib( const TextCharAttrib& rTextCharAttrib );
- ~TextCharAttrib();
-
- const TextAttrib& GetAttr() const { return *mpAttr; }
-
- sal_uInt16 Which() const { return mpAttr->Which(); }
-
- sal_uInt16 GetStart() const { return mnStart; }
- sal_uInt16& GetStart() { return mnStart; }
-
- sal_uInt16 GetEnd() const { return mnEnd; }
- sal_uInt16& GetEnd() { return mnEnd; }
-
- inline sal_uInt16 GetLen() const;
-
- inline void MoveForward( sal_uInt16 nDiff );
- inline void MoveBackward( sal_uInt16 nDiff );
-
- inline void Expand( sal_uInt16 nDiff );
- inline void Collaps( sal_uInt16 nDiff );
-
- inline sal_Bool IsIn( sal_uInt16 nIndex );
- inline sal_Bool IsInside( sal_uInt16 nIndex );
- inline sal_Bool IsEmpty();
-
-};
-
-inline sal_uInt16 TextCharAttrib::GetLen() const
-{
- DBG_ASSERT( mnEnd >= mnStart, "TextCharAttrib: nEnd < nStart!" );
- return mnEnd-mnStart;
-}
-
-inline void TextCharAttrib::MoveForward( sal_uInt16 nDiff )
-{
- DBG_ASSERT( ((long)mnEnd + nDiff) <= 0xFFFF, "TextCharAttrib: MoveForward?!" );
- mnStart = mnStart + nDiff;
- mnEnd = mnEnd + nDiff;
-}
-
-inline void TextCharAttrib::MoveBackward( sal_uInt16 nDiff )
-{
- DBG_ASSERT( ((long)mnStart - nDiff) >= 0, "TextCharAttrib: MoveBackward?!" );
- mnStart = mnStart - nDiff;
- mnEnd = mnEnd - nDiff;
-}
-
-inline void TextCharAttrib::Expand( sal_uInt16 nDiff )
-{
- DBG_ASSERT( ( ((long)mnEnd + nDiff) <= (long)0xFFFF ), "TextCharAttrib: Expand?!" );
- mnEnd = mnEnd + nDiff;
-}
-
-inline void TextCharAttrib::Collaps( sal_uInt16 nDiff )
-{
- DBG_ASSERT( (long)mnEnd - nDiff >= (long)mnStart, "TextCharAttrib: Collaps?!" );
- mnEnd = mnEnd - nDiff;
-}
-
-inline sal_Bool TextCharAttrib::IsIn( sal_uInt16 nIndex )
-{
- return ( ( mnStart <= nIndex ) && ( mnEnd >= nIndex ) );
-}
-
-inline sal_Bool TextCharAttrib::IsInside( sal_uInt16 nIndex )
-{
- return ( ( mnStart < nIndex ) && ( mnEnd > nIndex ) );
-}
-
-inline sal_Bool TextCharAttrib::IsEmpty()
-{
- return mnStart == mnEnd;
-}
-
-#endif // _TXTATTR_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/inc/svtools/xtextedt.hxx b/svtools/inc/svtools/xtextedt.hxx
deleted file mode 100644
index b0b09b0..0000000
--- a/svtools/inc/svtools/xtextedt.hxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef _XTEXTEDT_HXX
-#define _XTEXTEDT_HXX
-
-#include "svtools/svtdllapi.h"
-#include <svtools/texteng.hxx>
-#include <svtools/textview.hxx>
-
-namespace com {
-namespace sun {
-namespace star {
-namespace util {
- struct SearchOptions;
-}}}}
-
-class SVT_DLLPUBLIC ExtTextEngine : public TextEngine
-{
-private:
- String maGroupChars;
-
-public:
- ExtTextEngine();
- ~ExtTextEngine();
-
- const String& GetGroupChars() const { return maGroupChars; }
- void SetGroupChars( const String& r ) { maGroupChars = r; }
- TextSelection MatchGroup( const TextPaM& rCursor ) const;
-
- sal_Bool Search( TextSelection& rSel, const ::com::sun::star::util::SearchOptions& rSearchOptions, sal_Bool bForward = sal_True );
-};
-
-class SVT_DLLPUBLIC ExtTextView : public TextView
-{
-protected:
- sal_Bool ImpIndentBlock( sal_Bool bRight );
-
-public:
- ExtTextView( ExtTextEngine* pEng, Window* pWindow );
- ~ExtTextView();
-
- sal_Bool MatchGroup();
-
- sal_Bool Search( const ::com::sun::star::util::SearchOptions& rSearchOptions, sal_Bool bForward );
- sal_uInt16 Replace( const ::com::sun::star::util::SearchOptions& rSearchOptions, sal_Bool bAll, sal_Bool bForward );
-
- sal_Bool IndentBlock();
- sal_Bool UnindentBlock();
-};
-
-#endif // _XTEXTEDT_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx
index fd607f2..9031ea6 100644
--- a/svtools/source/brwbox/ebbcontrols.cxx
+++ b/svtools/source/brwbox/ebbcontrols.cxx
@@ -29,7 +29,7 @@
#include <svtools/editbrowsebox.hxx>
#include <vcl/decoview.hxx>
#include <svtools/fmtfield.hxx>
-#include <svtools/xtextedt.hxx>
+#include <vcl/xtextedt.hxx>
#include <algorithm>
diff --git a/svtools/source/contnr/DocumentInfoPreview.cxx b/svtools/source/contnr/DocumentInfoPreview.cxx
index b27df17..3f3f15a 100644
--- a/svtools/source/contnr/DocumentInfoPreview.cxx
+++ b/svtools/source/contnr/DocumentInfoPreview.cxx
@@ -38,7 +38,7 @@
#include "svl/inettype.hxx"
#include "svtools/DocumentInfoPreview.hxx"
#include "svtools/imagemgr.hxx"
-#include "svtools/txtattr.hxx"
+#include "vcl/txtattr.hxx"
#include "tools/datetime.hxx"
#include "tools/urlobj.hxx"
#include "unotools/pathoptions.hxx"
diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx
index 937236f..301967a 100644
--- a/svtools/source/contnr/templwin.cxx
+++ b/svtools/source/contnr/templwin.cxx
@@ -33,13 +33,13 @@
#include <unotools/pathoptions.hxx>
#include <unotools/dynamicmenuoptions.hxx>
#include <unotools/extendedsecurityoptions.hxx>
-#include <svtools/xtextedt.hxx>
+#include <vcl/xtextedt.hxx>
#include <svl/inettype.hxx>
#include <svtools/imagemgr.hxx>
#include <svtools/miscopt.hxx>
#include <svtools/templatefoldercache.hxx>
#include <svtools/imgdef.hxx>
-#include <svtools/txtattr.hxx>
+#include <vcl/txtattr.hxx>
#include <svtools/svtools.hrc>
#include "templwin.hrc"
#include <svtools/helpid.hrc>
diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx
index 20749db..18361d3 100644
--- a/svtools/source/edit/editsyntaxhighlighter.cxx
+++ b/svtools/source/edit/editsyntaxhighlighter.cxx
@@ -28,9 +28,9 @@
#include <svtools/svmedit.hxx>
-#include <svtools/xtextedt.hxx>
+#include <vcl/xtextedt.hxx>
#include <svtools/editsyntaxhighlighter.hxx>
-#include <svtools/txtattr.hxx>
+#include <vcl/txtattr.hxx>
MultiLineEditSyntaxHighlight::MultiLineEditSyntaxHighlight( Window* pParent, WinBits nWinStyle,
diff --git a/svtools/source/edit/svmedit.cxx b/svtools/source/edit/svmedit.cxx
index 4fff9e0..24e97ec 100644
--- a/svtools/source/edit/svmedit.cxx
+++ b/svtools/source/edit/svmedit.cxx
@@ -26,1593 +26,38 @@
*
************************************************************************/
-#include <memory>
-#include "unoiface.hxx"
-
-#include <tools/rc.h>
-
-#include <vcl/decoview.hxx>
-#include <vcl/svapp.hxx>
-#include <svtools/svmedit.hxx>
-#include <svtools/xtextedt.hxx>
-#include <svl/brdcst.hxx>
-#include <svl/undo.hxx>
+#include "unoiface.hxx"
#include <svtools/textwindowpeer.hxx>
-#include <svl/lstner.hxx>
-#include <svl/smplhint.hxx>
-
-
-// IDs erstmal aus VCL geklaut, muss mal richtig delivert werden...
-#define SV_MENU_EDIT_UNDO 1
-#define SV_MENU_EDIT_CUT 2
-#define SV_MENU_EDIT_COPY 3
-#define SV_MENU_EDIT_PASTE 4
-#define SV_MENU_EDIT_DELETE 5
-#define SV_MENU_EDIT_SELECTALL 6
-#define SV_MENU_EDIT_INSERTSYMBOL 7
-#include <vcl/scrbar.hxx>
-
-namespace css = ::com::sun::star;
-
-class TextWindow : public Window
-{
-private:
- ExtTextEngine* mpExtTextEngine;
- ExtTextView* mpExtTextView;
-
- sal_Bool mbInMBDown;
- sal_Bool mbFocusSelectionHide;
- sal_Bool mbIgnoreTab;
- sal_Bool mbActivePopup;
- sal_Bool mbSelectOnTab;
- sal_Bool mbTextSelectable;
-
-public:
- TextWindow( Window* pParent );
- ~TextWindow();
-
- ExtTextEngine* GetTextEngine() const { return mpExtTextEngine; }
- ExtTextView* GetTextView() const { return mpExtTextView; }
-
- virtual void MouseMove( const MouseEvent& rMEvt );
- virtual void MouseButtonDown( const MouseEvent& rMEvt );
- virtual void MouseButtonUp( const MouseEvent& rMEvt );
- virtual void KeyInput( const KeyEvent& rKEvent );
-
- virtual void Command( const CommandEvent& rCEvt );
-
- virtual void Paint( const Rectangle& rRect );
- virtual void Resize();
-
- virtual void GetFocus();
- virtual void LoseFocus();
-
- sal_Bool IsAutoFocusHide() const { return mbFocusSelectionHide; }
- void SetAutoFocusHide( sal_Bool bAutoHide ) { mbFocusSelectionHide = bAutoHide; }
-
- sal_Bool IsIgnoreTab() const { return mbIgnoreTab; }
- void SetIgnoreTab( sal_Bool bIgnore ) { mbIgnoreTab = bIgnore; }
-
- void DisableSelectionOnFocus() { mbSelectOnTab = sal_False; }
-
- void SetTextSelectable( sal_Bool bTextSelectable ) { mbTextSelectable = bTextSelectable; }
-
- virtual
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
- GetComponentInterface(sal_Bool bCreate = sal_True);
-};
-
-
-class ImpSvMEdit : public SfxListener
-{
-private:
- MultiLineEdit* pSvMultiLineEdit;
-
- TextWindow* mpTextWindow;
- ScrollBar* mpHScrollBar;
- ScrollBar* mpVScrollBar;
- ScrollBarBox* mpScrollBox;
-
- Point maTextWindowOffset;
- xub_StrLen mnTextWidth;
- mutable Selection maSelection;
-
-protected:
- virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
- void ImpUpdateSrollBarVis( WinBits nWinStyle );
- void ImpInitScrollBars();
- void ImpSetScrollBarRanges();
- void ImpSetHScrollBarThumbPos();
- DECL_LINK( ScrollHdl, ScrollBar* );
-
-public:
- ImpSvMEdit( MultiLineEdit* pSvMultiLineEdit, WinBits nWinStyle );
- ~ImpSvMEdit();
-
- void SetModified( sal_Bool bMod );
- sal_Bool IsModified() const;
-
- void SetReadOnly( sal_Bool bRdOnly );
- sal_Bool IsReadOnly() const;
-
- void SetMaxTextLen( xub_StrLen nLen );
- xub_StrLen GetMaxTextLen() const;
-
- sal_Bool IsInsertMode() const;
-
- void InsertText( const String& rStr );
- String GetSelected() const;
- String GetSelected( LineEnd aSeparator ) const;
-
- void SetSelection( const Selection& rSelection );
- const Selection& GetSelection() const;
-
- void Cut();
- void Copy();
- void Paste();
-
- void SetText( const String& rStr );
- String GetText() const;
- String GetText( LineEnd aSeparator ) const;
- String GetTextLines( LineEnd aSeparator ) const;
-
- void Resize();
- void GetFocus();
-
- sal_Bool HandleCommand( const CommandEvent& rCEvt );
-
- void Enable( sal_Bool bEnable );
-
- Size CalcMinimumSize() const;
- Size CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
- void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const;
-
- void SetAlign( WinBits nWinStyle );
-
- void InitFromStyle( WinBits nWinStyle );
-
- TextWindow* GetTextWindow() { return mpTextWindow; }
- ScrollBar* GetHScrollBar() { return mpHScrollBar; }
- ScrollBar* GetVScrollBar() { return mpVScrollBar; }
-};
-
-ImpSvMEdit::ImpSvMEdit( MultiLineEdit* pEdt, WinBits nWinStyle )
- :mpHScrollBar(NULL)
- ,mpVScrollBar(NULL)
- ,mpScrollBox(NULL)
-{
- pSvMultiLineEdit = pEdt;
- mnTextWidth = 0;
- mpTextWindow = new TextWindow( pEdt );
- mpTextWindow->Show();
- InitFromStyle( nWinStyle );
- StartListening( *mpTextWindow->GetTextEngine() );
-}
-
-void ImpSvMEdit::ImpUpdateSrollBarVis( WinBits nWinStyle )
-{
- const sal_Bool bHaveVScroll = (NULL != mpVScrollBar);
- const sal_Bool bHaveHScroll = (NULL != mpHScrollBar);
- const sal_Bool bHaveScrollBox = (NULL != mpScrollBox);
-
- sal_Bool bNeedVScroll = ( nWinStyle & WB_VSCROLL ) == WB_VSCROLL;
- const sal_Bool bNeedHScroll = ( nWinStyle & WB_HSCROLL ) == WB_HSCROLL;
-
- const sal_Bool bAutoVScroll = ( nWinStyle & WB_AUTOVSCROLL ) == WB_AUTOVSCROLL;
- if ( !bNeedVScroll && bAutoVScroll )
- {
- TextEngine& rEngine( *mpTextWindow->GetTextEngine() );
- sal_uLong nOverallTextHeight(0);
- for ( sal_uLong i=0; i<rEngine.GetParagraphCount(); ++i )
- nOverallTextHeight += rEngine.GetTextHeight( i );
- if ( nOverallTextHeight > (sal_uLong)mpTextWindow->GetOutputSizePixel().Height() )
- bNeedVScroll = true;
- }
-
- const sal_Bool bNeedScrollBox = bNeedVScroll && bNeedHScroll;
-
- sal_Bool bScrollbarsChanged = false;
- if ( bHaveVScroll != bNeedVScroll )
- {
- delete mpVScrollBar;
- mpVScrollBar = bNeedVScroll ? new ScrollBar( pSvMultiLineEdit, WB_VSCROLL|WB_DRAG ) : NULL;
-
- if ( bNeedVScroll )
- {
- mpVScrollBar->Show();
- mpVScrollBar->SetScrollHdl( LINK( this, ImpSvMEdit, ScrollHdl ) );
- }
-
- bScrollbarsChanged = sal_True;
- }
-
- if ( bHaveHScroll != bNeedHScroll )
- {
- delete mpHScrollBar;
- mpHScrollBar = bNeedHScroll ? new ScrollBar( pSvMultiLineEdit, WB_HSCROLL|WB_DRAG ) : NULL;
-
- if ( bNeedHScroll )
- {
- mpHScrollBar->Show();
- mpHScrollBar->SetScrollHdl( LINK( this, ImpSvMEdit, ScrollHdl ) );
- }
-
- bScrollbarsChanged = sal_True;
- }
-
- if ( bHaveScrollBox != bNeedScrollBox )
- {
- delete mpScrollBox;
- mpScrollBox = bNeedScrollBox ? new ScrollBarBox( pSvMultiLineEdit, WB_SIZEABLE ) : NULL;
-
- if ( bNeedScrollBox )
- mpScrollBox->Show();
- }
-
- if ( bScrollbarsChanged )
- {
- ImpInitScrollBars();
- Resize();
- }
-}
-
-void ImpSvMEdit::InitFromStyle( WinBits nWinStyle )
-{
- ImpUpdateSrollBarVis( nWinStyle );
- SetAlign( nWinStyle );
-
- if ( nWinStyle & WB_NOHIDESELECTION )
- mpTextWindow->SetAutoFocusHide( sal_False );
- else
- mpTextWindow->SetAutoFocusHide( sal_True );
-
- if ( nWinStyle & WB_READONLY )
- mpTextWindow->GetTextView()->SetReadOnly( sal_True );
- else
- mpTextWindow->GetTextView()->SetReadOnly( sal_False );
-
- if ( nWinStyle & WB_IGNORETAB )
- {
- mpTextWindow->SetIgnoreTab( sal_True );
- }
- else
- {
- mpTextWindow->SetIgnoreTab( sal_False );
- // #103667# MultiLineEdit has the flag, but focusable window also needs this flag
- WinBits nStyle = mpTextWindow->GetStyle();
- nStyle |= WINDOW_DLGCTRL_MOD1TAB;
- mpTextWindow->SetStyle( nStyle );
- }
-}
-
-ImpSvMEdit::~ImpSvMEdit()
-{
- EndListening( *mpTextWindow->GetTextEngine() );
- delete mpTextWindow;
- delete mpHScrollBar;
- delete mpVScrollBar;
- delete mpScrollBox;
-}
-
-void ImpSvMEdit::ImpSetScrollBarRanges()
-{
- if ( mpVScrollBar )
- {
- sal_uLong nTextHeight = mpTextWindow->GetTextEngine()->GetTextHeight();
- mpVScrollBar->SetRange( Range( 0, (long)nTextHeight-1 ) );
- }
- if ( mpHScrollBar )
- {
-// sal_uLong nTextWidth = mpTextWindow->GetTextEngine()->CalcTextWidth();
- // Es gibt kein Notify bei Breiten-Aenderung...
-// sal_uLong nW = Max( (sal_uLong)mpTextWindow->GetOutputSizePixel().Width()*5, (sal_uLong)nTextWidth );
-// mpHScrollBar->SetRange( Range( 0, (long)nW ) );
- mpHScrollBar->SetRange( Range( 0, (long)mnTextWidth-1 ) );
- }
-}
-
-void ImpSvMEdit::ImpInitScrollBars()
-{
- static const sal_Unicode sampleChar = { 'x' };
- if ( mpHScrollBar || mpVScrollBar )
- {
- ImpSetScrollBarRanges();
- Size aCharBox;
- aCharBox.Width() = mpTextWindow->GetTextWidth( rtl::OUString(sampleChar) );
- aCharBox.Height() = mpTextWindow->GetTextHeight();
- Size aOutSz = mpTextWindow->GetOutputSizePixel();
- if ( mpHScrollBar )
- {
- mpHScrollBar->SetVisibleSize( aOutSz.Width() );
- mpHScrollBar->SetPageSize( aOutSz.Width() * 8 / 10 );
- mpHScrollBar->SetLineSize( aCharBox.Width()*10 );
- ImpSetHScrollBarThumbPos();
- }
- if ( mpVScrollBar )
- {
- mpVScrollBar->SetVisibleSize( aOutSz.Height() );
- mpVScrollBar->SetPageSize( aOutSz.Height() * 8 / 10 );
- mpVScrollBar->SetLineSize( aCharBox.Height() );
- mpVScrollBar->SetThumbPos( mpTextWindow->GetTextView()->GetStartDocPos().Y() );
- }
- }
-}
-
-void ImpSvMEdit::ImpSetHScrollBarThumbPos()
-{
- long nX = mpTextWindow->GetTextView()->GetStartDocPos().X();
- if ( !mpTextWindow->GetTextEngine()->IsRightToLeft() )
- mpHScrollBar->SetThumbPos( nX );
- else
- mpHScrollBar->SetThumbPos( mnTextWidth - mpHScrollBar->GetVisibleSize() - nX );
-
-}
-
-IMPL_LINK( ImpSvMEdit, ScrollHdl, ScrollBar*, pCurScrollBar )
-{
- long nDiffX = 0, nDiffY = 0;
-
- if ( pCurScrollBar == mpVScrollBar )
- nDiffY = mpTextWindow->GetTextView()->GetStartDocPos().Y() - pCurScrollBar->GetThumbPos();
- else if ( pCurScrollBar == mpHScrollBar )
- nDiffX = mpTextWindow->GetTextView()->GetStartDocPos().X() - pCurScrollBar->GetThumbPos();
-
- mpTextWindow->GetTextView()->Scroll( nDiffX, nDiffY );
- // mpTextWindow->GetTextView()->ShowCursor( sal_False, sal_True );
-
- return 0;
-}
-
-
-// void ImpSvMEdit::ImpModified()
-// {
-// // Wann wird das gerufen ?????????????????????
-// pSvMultiLineEdit->Modify();
-// }
-
-void ImpSvMEdit::SetAlign( WinBits nWinStyle )
-{
- sal_Bool bRTL = Application::GetSettings().GetLayoutRTL();
- mpTextWindow->GetTextEngine()->SetRightToLeft( bRTL );
-
- if ( nWinStyle & WB_CENTER )
- mpTextWindow->GetTextEngine()->SetTextAlign( TXTALIGN_CENTER );
- else if ( nWinStyle & WB_RIGHT )
- mpTextWindow->GetTextEngine()->SetTextAlign( !bRTL ? TXTALIGN_RIGHT : TXTALIGN_LEFT );
- else if ( nWinStyle & WB_LEFT )
- mpTextWindow->GetTextEngine()->SetTextAlign( !bRTL ? TXTALIGN_LEFT : TXTALIGN_RIGHT );
-}
-
-void ImpSvMEdit::SetModified( sal_Bool bMod )
-{
- mpTextWindow->GetTextEngine()->SetModified( bMod );
-}
-
-sal_Bool ImpSvMEdit::IsModified() const
-{
- return mpTextWindow->GetTextEngine()->IsModified();
-}
-
-void ImpSvMEdit::SetReadOnly( sal_Bool bRdOnly )
-{
- mpTextWindow->GetTextView()->SetReadOnly( bRdOnly );
- // Farbe anpassen ???????????????????????????
-}
-
-sal_Bool ImpSvMEdit::IsReadOnly() const
-{
- return mpTextWindow->GetTextView()->IsReadOnly();
-}
-
-void ImpSvMEdit::SetMaxTextLen( xub_StrLen nLen )
-{
- mpTextWindow->GetTextEngine()->SetMaxTextLen( nLen );
-}
-
-xub_StrLen ImpSvMEdit::GetMaxTextLen() const
-{
- return sal::static_int_cast< xub_StrLen >(
- mpTextWindow->GetTextEngine()->GetMaxTextLen());
-}
-
-void ImpSvMEdit::InsertText( const String& rStr )
-{
- mpTextWindow->GetTextView()->InsertText( rStr );
-}
-
-String ImpSvMEdit::GetSelected() const
-{
- return mpTextWindow->GetTextView()->GetSelected();
-}
-
-String ImpSvMEdit::GetSelected( LineEnd aSeparator ) const
-{
- return mpTextWindow->GetTextView()->GetSelected( aSeparator );
-}
-
-void ImpSvMEdit::Resize()
-{
- size_t nIteration = 1;
- do
- {
- WinBits nWinStyle( pSvMultiLineEdit->GetStyle() );
- if ( ( nWinStyle & WB_AUTOVSCROLL ) == WB_AUTOVSCROLL )
- ImpUpdateSrollBarVis( nWinStyle );
-
- Size aSz = pSvMultiLineEdit->GetOutputSizePixel();
- Size aEditSize = aSz;
- long nSBWidth = pSvMultiLineEdit->GetSettings().GetStyleSettings().GetScrollBarSize();
- nSBWidth = pSvMultiLineEdit->CalcZoom( nSBWidth );
-
- if ( mpHScrollBar )
- aSz.Height() -= nSBWidth+1;
- if ( mpVScrollBar )
- aSz.Width() -= nSBWidth+1;
-
- if ( !mpHScrollBar )
- mpTextWindow->GetTextEngine()->SetMaxTextWidth( aSz.Width() );
- else
- mpHScrollBar->SetPosSizePixel( 0, aEditSize.Height()-nSBWidth, aSz.Width(), nSBWidth );
- Point aTextWindowPos( maTextWindowOffset );
- if ( mpVScrollBar )
- {
- if( Application::GetSettings().GetLayoutRTL() )
- {
- mpVScrollBar->SetPosSizePixel( 0, 0, nSBWidth, aSz.Height() );
- aTextWindowPos.X() += nSBWidth;
- }
- else
- mpVScrollBar->SetPosSizePixel( aEditSize.Width()-nSBWidth, 0, nSBWidth, aSz.Height() );
- }
-
- if ( mpScrollBox )
- mpScrollBox->SetPosSizePixel( aSz.Width(), aSz.Height(), nSBWidth, nSBWidth );
-
- Size aTextWindowSize( aSz );
- aTextWindowSize.Width() -= maTextWindowOffset.X();
- aTextWindowSize.Height() -= maTextWindowOffset.Y();
- if ( aTextWindowSize.Width() < 0 )
- aTextWindowSize.Width() = 0;
- if ( aTextWindowSize.Height() < 0 )
- aTextWindowSize.Height() = 0;
-
- Size aOldTextWindowSize( mpTextWindow->GetSizePixel() );
- mpTextWindow->SetPosSizePixel( aTextWindowPos, aTextWindowSize );
- if ( aOldTextWindowSize == aTextWindowSize )
- break;
-
- // Changing the text window size might effectively have changed the need for
- // scrollbars, so do another iteration.
- ++nIteration;
- OSL_ENSURE( nIteration < 3, "ImpSvMEdit::Resize: isn't this expected to terminate with the second iteration?" );
-
- } while ( nIteration <= 3 ); // artificial break after four iterations
-
- ImpInitScrollBars();
-}
-
-void ImpSvMEdit::GetFocus()
-{
- mpTextWindow->GrabFocus();
-}
-
-void ImpSvMEdit::Cut()
-{
- if ( !mpTextWindow->GetTextView()->IsReadOnly() )
- mpTextWindow->GetTextView()->Cut();
-}
-
-void ImpSvMEdit::Copy()
-{
- mpTextWindow->GetTextView()->Copy();
-}
-void ImpSvMEdit::Paste()
-{
- if ( !mpTextWindow->GetTextView()->IsReadOnly() )
- mpTextWindow->GetTextView()->Paste();
-}
-
-void ImpSvMEdit::SetText( const String& rStr )
-{
- sal_Bool bWasModified = mpTextWindow->GetTextEngine()->IsModified();
- mpTextWindow->GetTextEngine()->SetText( rStr );
- if ( !bWasModified )
- mpTextWindow->GetTextEngine()->SetModified( sal_False );
-
- mpTextWindow->GetTextView()->SetSelection( TextSelection() );
-
- WinBits nWinStyle( pSvMultiLineEdit->GetStyle() );
- if ( ( nWinStyle & WB_AUTOVSCROLL ) == WB_AUTOVSCROLL )
- ImpUpdateSrollBarVis( nWinStyle );
-}
-
-String ImpSvMEdit::GetText() const
-{
- return mpTextWindow->GetTextEngine()->GetText();
-}
-
-String ImpSvMEdit::GetText( LineEnd aSeparator ) const
-{
- return mpTextWindow->GetTextEngine()->GetText( aSeparator );
-}
-
-String ImpSvMEdit::GetTextLines( LineEnd aSeparator ) const
-{
- return mpTextWindow->GetTextEngine()->GetTextLines( aSeparator );
-}
-
-void ImpSvMEdit::Notify( SfxBroadcaster&, const SfxHint& rHint )
-{
- if ( rHint.ISA( TextHint ) )
- {
- const TextHint& rTextHint = (const TextHint&)rHint;
- if( rTextHint.GetId() == TEXT_HINT_VIEWSCROLLED )
- {
- if ( mpHScrollBar )
- ImpSetHScrollBarThumbPos();
- if ( mpVScrollBar )
- mpVScrollBar->SetThumbPos( mpTextWindow->GetTextView()->GetStartDocPos().Y() );
- }
- else if( rTextHint.GetId() == TEXT_HINT_TEXTHEIGHTCHANGED )
- {
- if ( mpTextWindow->GetTextView()->GetStartDocPos().Y() )
- {
- long nOutHeight = mpTextWindow->GetOutputSizePixel().Height();
- long nTextHeight = mpTextWindow->GetTextEngine()->GetTextHeight();
- if ( nTextHeight < nOutHeight )
- mpTextWindow->GetTextView()->Scroll( 0, mpTextWindow->GetTextView()->GetStartDocPos().Y() );
- }
-
- ImpSetScrollBarRanges();
- }
- else if( rTextHint.GetId() == TEXT_HINT_TEXTFORMATTED )
- {
- if ( mpHScrollBar )
- {
- sal_uLong nWidth = mpTextWindow->GetTextEngine()->CalcTextWidth();
- if ( nWidth != mnTextWidth )
- {
- mnTextWidth = sal::static_int_cast< xub_StrLen >(nWidth);
- mpHScrollBar->SetRange( Range( 0, (long)mnTextWidth-1 ) );
- ImpSetHScrollBarThumbPos();
- }
- }
- }
- else if( rTextHint.GetId() == TEXT_HINT_MODIFIED )
- {
- pSvMultiLineEdit->Modify();
- }
- }
-}
-
-void ImpSvMEdit::SetSelection( const Selection& rSelection )
-{
- String aText = mpTextWindow->GetTextEngine()->GetText();
-
- Selection aNewSelection( rSelection );
- if ( aNewSelection.Min() < 0 )
- aNewSelection.Min() = 0;
- else if ( aNewSelection.Min() > aText.Len() )
- aNewSelection.Min() = aText.Len();
- if ( aNewSelection.Max() < 0 )
- aNewSelection.Max() = 0;
- else if ( aNewSelection.Max() > aText.Len() )
- aNewSelection.Max() = aText.Len();
-
- long nEnd = Max( aNewSelection.Min(), aNewSelection.Max() );
- TextSelection aTextSel;
- sal_uLong nPara = 0;
- sal_uInt16 nChar = 0;
- sal_uInt16 x = 0;
- while ( x <= nEnd )
- {
- if ( x == aNewSelection.Min() )
- aTextSel.GetStart() = TextPaM( nPara, nChar );
- if ( x == aNewSelection.Max() )
- aTextSel.GetEnd() = TextPaM( nPara, nChar );
-
- if ( ( x < aText.Len() ) && ( aText.GetChar( x ) == '\n' ) )
- {
- nPara++;
- nChar = 0;
- }
- else
- nChar++;
- x++;
- }
- mpTextWindow->GetTextView()->SetSelection( aTextSel );
-}
-
-const Selection& ImpSvMEdit::GetSelection() const
-{
- maSelection = Selection();
- TextSelection aTextSel( mpTextWindow->GetTextView()->GetSelection() );
- aTextSel.Justify();
- // Selektion flachklopfen => jeder Umbruch ein Zeichen...
-
- ExtTextEngine* pExtTextEngine = mpTextWindow->GetTextEngine();
- // Absaetze davor:
- sal_uLong n;
- for ( n = 0; n < aTextSel.GetStart().GetPara(); n++ )
- {
- maSelection.Min() += pExtTextEngine->GetTextLen( n );
- maSelection.Min()++;
- }
-
- // Erster Absatz mit Selektion:
- maSelection.Max() = maSelection.Min();
- maSelection.Min() += aTextSel.GetStart().GetIndex();
-
- for ( n = aTextSel.GetStart().GetPara(); n < aTextSel.GetEnd().GetPara(); n++ )
- {
- maSelection.Max() += pExtTextEngine->GetTextLen( n );
- maSelection.Max()++;
- }
-
- maSelection.Max() += aTextSel.GetEnd().GetIndex();
-
- return maSelection;
-}
-
-Size ImpSvMEdit::CalcMinimumSize() const
-{
- Size aSz( mpTextWindow->GetTextEngine()->CalcTextWidth(),
- mpTextWindow->GetTextEngine()->GetTextHeight() );
-
- if ( mpHScrollBar )
- aSz.Height() += mpHScrollBar->GetSizePixel().Height();
- if ( mpVScrollBar )
- aSz.Width() += mpVScrollBar->GetSizePixel().Width();
-
- return aSz;
-}
-
-Size ImpSvMEdit::CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const
-{
- static const sal_Unicode sampleChar = 'X';
-
- Size aSz;
- Size aCharSz;
- aCharSz.Width() = mpTextWindow->GetTextWidth( rtl::OUString(sampleChar) );
- aCharSz.Height() = mpTextWindow->GetTextHeight();
-
- if ( nLines )
- aSz.Height() = nLines*aCharSz.Height();
- else
- aSz.Height() = mpTextWindow->GetTextEngine()->GetTextHeight();
-
- if ( nColumns )
- aSz.Width() = nColumns*aCharSz.Width();
- else
- aSz.Width() = mpTextWindow->GetTextEngine()->CalcTextWidth();
-
- if ( mpHScrollBar )
- aSz.Height() += mpHScrollBar->GetSizePixel().Height();
- if ( mpVScrollBar )
- aSz.Width() += mpVScrollBar->GetSizePixel().Width();
-
- return aSz;
-}
-
-void ImpSvMEdit::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const
-{
- static const sal_Unicode sampleChar = { 'x' };
- Size aOutSz = mpTextWindow->GetOutputSizePixel();
- Size aCharSz( mpTextWindow->GetTextWidth( rtl::OUString(sampleChar) ), mpTextWindow->GetTextHeight() );
- rnCols = (sal_uInt16) (aOutSz.Width()/aCharSz.Width());
- rnLines = (sal_uInt16) (aOutSz.Height()/aCharSz.Height());
-}
-
-void ImpSvMEdit::Enable( sal_Bool bEnable )
-{
- mpTextWindow->Enable( bEnable );
- if ( mpHScrollBar )
- mpHScrollBar->Enable( bEnable );
- if ( mpVScrollBar )
- mpVScrollBar->Enable( bEnable );
-}
-
-sal_Bool ImpSvMEdit::HandleCommand( const CommandEvent& rCEvt )
-{
- sal_Bool bDone = sal_False;
- if ( ( rCEvt.GetCommand() == COMMAND_WHEEL ) ||
- ( rCEvt.GetCommand() == COMMAND_STARTAUTOSCROLL ) ||
- ( rCEvt.GetCommand() == COMMAND_AUTOSCROLL ) )
- {
- mpTextWindow->HandleScrollCommand( rCEvt, mpHScrollBar, mpVScrollBar );
- bDone = sal_True;
- }
- return bDone;
-}
-
-
-TextWindow::TextWindow( Window* pParent ) : Window( pParent )
-{
- mbInMBDown = sal_False;
- mbSelectOnTab = sal_True;
- mbFocusSelectionHide = sal_False;
- mbIgnoreTab = sal_False;
- mbActivePopup = sal_False;
- mbSelectOnTab = sal_True;
- mbTextSelectable = sal_True;
-
- SetPointer( Pointer( POINTER_TEXT ) );
-
- mpExtTextEngine = new ExtTextEngine;
- mpExtTextEngine->SetMaxTextLen( STRING_MAXLEN );
- if( pParent->GetStyle() & WB_BORDER )
- mpExtTextEngine->SetLeftMargin( 2 );
- mpExtTextEngine->SetLocale( GetSettings().GetLocale() );
- mpExtTextView = new ExtTextView( mpExtTextEngine, this );
- mpExtTextEngine->InsertView( mpExtTextView );
- mpExtTextEngine->EnableUndo( sal_True );
- mpExtTextView->ShowCursor();
-
- Color aBackgroundColor = GetSettings().GetStyleSettings().GetWorkspaceColor();
- SetBackground( aBackgroundColor );
- pParent->SetBackground( aBackgroundColor );
-}
-
-TextWindow::~TextWindow()
-{
- delete mpExtTextView;
- delete mpExtTextEngine;
-}
-
-void TextWindow::MouseMove( const MouseEvent& rMEvt )
-{
- mpExtTextView->MouseMove( rMEvt );
- Window::MouseMove( rMEvt );
-}
-
-void TextWindow::MouseButtonDown( const MouseEvent& rMEvt )
-{
- if ( !mbTextSelectable )
- return;
-
- mbInMBDown = sal_True; // Dann im GetFocus nicht alles selektieren wird
- mpExtTextView->MouseButtonDown( rMEvt );
- Window::MouseButtonDown( rMEvt );
- GrabFocus();
- mbInMBDown = sal_False;
-}
-
-void TextWindow::MouseButtonUp( const MouseEvent& rMEvt )
-{
- mpExtTextView->MouseButtonUp( rMEvt );
- Window::MouseButtonUp( rMEvt );
-}
-
-void TextWindow::KeyInput( const KeyEvent& rKEvent )
-{
- sal_Bool bDone = sal_False;
- sal_uInt16 nCode = rKEvent.GetKeyCode().GetCode();
- if ( nCode == com::sun::star::awt::Key::SELECT_ALL ||
- ( (nCode == KEY_A) && rKEvent.GetKeyCode().IsMod1() && !rKEvent.GetKeyCode().IsMod2() )
- )
- {
- mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFF, 0xFFFF ) ) );
- bDone = sal_True;
- }
- else if ( (nCode == KEY_S) && rKEvent.GetKeyCode().IsShift() && rKEvent.GetKeyCode().IsMod1() )
- {
- if ( Edit::GetGetSpecialCharsFunction() )
- {
- // Damit die Selektion erhalten bleibt
- mbActivePopup = sal_True;
- rtl::OUString aChars = Edit::GetGetSpecialCharsFunction()( this, GetFont() );
- if (!aChars.isEmpty())
- {
- mpExtTextView->InsertText( aChars );
- mpExtTextView->GetTextEngine()->SetModified( sal_True );
- }
- mbActivePopup = sal_False;
- bDone = sal_True;
- }
- }
- else if ( nCode == KEY_TAB )
- {
- if ( !mbIgnoreTab || rKEvent.GetKeyCode().IsMod1() )
- bDone = mpExtTextView->KeyInput( rKEvent );
- }
- else
- {
- bDone = mpExtTextView->KeyInput( rKEvent );
- }
-
- if ( !bDone )
- Window::KeyInput( rKEvent );
-}
-
-void TextWindow::Paint( const Rectangle& rRect )
-{
- mpExtTextView->Paint( rRect );
-}
-
-void TextWindow::Resize()
-{
-}
-
-void TextWindow::Command( const CommandEvent& rCEvt )
-{
- if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
- {
- PopupMenu* pPopup = Edit::CreatePopupMenu();
- if ( !mpExtTextView->HasSelection() )
- {
- pPopup->EnableItem( SV_MENU_EDIT_CUT, sal_False );
- pPopup->EnableItem( SV_MENU_EDIT_COPY, sal_False );
- pPopup->EnableItem( SV_MENU_EDIT_DELETE, sal_False );
- }
- if ( mpExtTextView->IsReadOnly() )
- {
- pPopup->EnableItem( SV_MENU_EDIT_CUT, sal_False );
- pPopup->EnableItem( SV_MENU_EDIT_PASTE, sal_False );
- pPopup->EnableItem( SV_MENU_EDIT_DELETE, sal_False );
- pPopup->EnableItem( SV_MENU_EDIT_INSERTSYMBOL, sal_False );
- }
- if ( !mpExtTextView->GetTextEngine()->HasUndoManager() || !mpExtTextView->GetTextEngine()->GetUndoManager().GetUndoActionCount() )
- {
- pPopup->EnableItem( SV_MENU_EDIT_UNDO, sal_False );
- }
-// if ( ( maSelection.Min() == 0 ) && ( maSelection.Max() == maText.Len() ) )
-// {
-// pPopup->EnableItem( SV_MENU_EDIT_SELECTALL, sal_False );
-// }
- if ( !Edit::GetGetSpecialCharsFunction() )
- {
- sal_uInt16 nPos = pPopup->GetItemPos( SV_MENU_EDIT_INSERTSYMBOL );
- pPopup->RemoveItem( nPos );
- pPopup->RemoveItem( nPos-1 );
- }
-
- mbActivePopup = sal_True;
- Point aPos = rCEvt.GetMousePosPixel();
- if ( !rCEvt.IsMouseEvent() )
- {
- // !!! Irgendwann einmal Menu zentriert in der Selektion anzeigen !!!
- Size aSize = GetOutputSizePixel();
- aPos = Point( aSize.Width()/2, aSize.Height()/2 );
- }
-// pPopup->RemoveDisabledEntries();
- sal_uInt16 n = pPopup->Execute( this, aPos );
- Edit::DeletePopupMenu( pPopup );
- switch ( n )
- {
- case SV_MENU_EDIT_UNDO: mpExtTextView->Undo();
- mpExtTextEngine->SetModified( sal_True );
- mpExtTextEngine->Broadcast( TextHint( TEXT_HINT_MODIFIED ) );
- break;
- case SV_MENU_EDIT_CUT: mpExtTextView->Cut();
- mpExtTextEngine->SetModified( sal_True );
- mpExtTextEngine->Broadcast( TextHint( TEXT_HINT_MODIFIED ) );
- break;
- case SV_MENU_EDIT_COPY: mpExtTextView->Copy();
- break;
- case SV_MENU_EDIT_PASTE: mpExtTextView->Paste();
- mpExtTextEngine->SetModified( sal_True );
- mpExtTextEngine->Broadcast( TextHint( TEXT_HINT_MODIFIED ) );
- break;
- case SV_MENU_EDIT_DELETE: mpExtTextView->DeleteSelected();
- mpExtTextEngine->SetModified( sal_True );
- mpExtTextEngine->Broadcast( TextHint( TEXT_HINT_MODIFIED ) );
- break;
- case SV_MENU_EDIT_SELECTALL: mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) );
- break;
- case SV_MENU_EDIT_INSERTSYMBOL:
- {
- rtl::OUString aChars = Edit::GetGetSpecialCharsFunction()( this, GetFont() );
- if (!aChars.isEmpty())
- {
- mpExtTextView->InsertText( aChars );
- mpExtTextEngine->SetModified( sal_True );
- mpExtTextEngine->Broadcast( TextHint( TEXT_HINT_MODIFIED ) );
- }
- }
- break;
- }
- mbActivePopup = sal_False;
- }
- else
- {
- mpExtTextView->Command( rCEvt );
- }
- Window::Command( rCEvt );
-}
-
-void TextWindow::GetFocus()
-{
- Window::GetFocus();
- if ( !mbActivePopup )
- {
- sal_Bool bGotoCursor = !mpExtTextView->IsReadOnly();
- if ( mbFocusSelectionHide && IsReallyVisible() && !mpExtTextView->IsReadOnly()
- && ( mbSelectOnTab &&
- (!mbInMBDown || ( GetSettings().GetStyleSettings().GetSelectionOptions() & SELECTION_OPTION_FOCUS ) )) )
- {
- // Alles selektieren, aber nicht scrollen
- sal_Bool bAutoScroll = mpExtTextView->IsAutoScroll();
- mpExtTextView->SetAutoScroll( sal_False );
- mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFF, 0xFFFF ) ) );
- mpExtTextView->SetAutoScroll( bAutoScroll );
- bGotoCursor = sal_False;
- }
- mpExtTextView->SetPaintSelection( sal_True );
- mpExtTextView->ShowCursor( bGotoCursor );
- }
-}
-
-void TextWindow::LoseFocus()
-{
- Window::LoseFocus();
-
- if ( mbFocusSelectionHide && !mbActivePopup )
- mpExtTextView->SetPaintSelection( sal_False );
-}
-
-// virtual
-::css::uno::Reference< ::css::awt::XWindowPeer >
-TextWindow::GetComponentInterface(sal_Bool bCreate)
-{
- ::css::uno::Reference< ::css::awt::XWindowPeer > xPeer(
- Window::GetComponentInterface(false));
- if (!xPeer.is() && bCreate)
- {
- xPeer = new ::svt::TextWindowPeer(*GetTextView(), true);
- SetComponentInterface(xPeer);
- }
- return xPeer;
-}
MultiLineEdit::MultiLineEdit( Window* pParent, WinBits nWinStyle )
- : Edit( pParent, nWinStyle )
+ : VCLMultiLineEdit( pParent,nWinStyle )
{
- SetType( WINDOW_MULTILINEEDIT );
- pImpSvMEdit = new ImpSvMEdit( this, nWinStyle );
- ImplInitSettings( sal_True, sal_True, sal_True );
- pUpdateDataTimer = 0;
-
- SetCompoundControl( sal_True );
- SetStyle( ImplInitStyle( nWinStyle ) );
}
-
MultiLineEdit::MultiLineEdit( Window* pParent, const ResId& rResId )
- : Edit( pParent, rResId.SetRT( RSC_MULTILINEEDIT ) )
-{
- SetType( WINDOW_MULTILINEEDIT );
- WinBits nWinStyle = rResId.GetWinBits();
- pImpSvMEdit = new ImpSvMEdit( this, nWinStyle );
- ImplInitSettings( sal_True, sal_True, sal_True );
- pUpdateDataTimer = 0;
-
- sal_uInt16 nMaxLen = Edit::GetMaxTextLen();
- if ( nMaxLen )
- SetMaxTextLen( nMaxLen );
-
- SetText( Edit::GetText() );
-
- if ( IsVisible() )
- pImpSvMEdit->Resize();
-
- SetCompoundControl( sal_True );
- SetStyle( ImplInitStyle( nWinStyle ) );
-
- // Base Edit ctor could call Show already, but that would cause problems
- // with accessibility, as Show might (indirectly) trigger a call to virtual
- // GetComponentInterface, which is the Edit's base version instead of the
- // MultiLineEdit's version while in the base Edit ctor:
- if ((GetStyle() & WB_HIDE) == 0)
- Show();
-
-}
-
-MultiLineEdit::~MultiLineEdit()
-{
- {
- ::std::auto_ptr< ImpSvMEdit > pDelete( pImpSvMEdit );
- pImpSvMEdit = NULL;
- }
- delete pUpdateDataTimer;
-}
-
-WinBits MultiLineEdit::ImplInitStyle( WinBits nStyle )
-{
- if ( !(nStyle & WB_NOTABSTOP) )
- nStyle |= WB_TABSTOP;
-
- if ( !(nStyle & WB_NOGROUP) )
- nStyle |= WB_GROUP;
-
- if ( !(nStyle & WB_IGNORETAB ))
- nStyle |= WINDOW_DLGCTRL_MOD1TAB;
-
- return nStyle;
-}
-
-
-void MultiLineEdit::ImplInitSettings( sal_Bool /*bFont*/, sal_Bool /*bForeground*/, sal_Bool bBackground )
+ : VCLMultiLineEdit( pParent,rResId )
{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
- // Der Font muss immer mit manipuliert werden, weil die TextEngine
- // sich nicht um TextColor/Background kuemmert
-
- Color aTextColor = rStyleSettings.GetFieldTextColor();
- if ( IsControlForeground() )
- aTextColor = GetControlForeground();
- if ( !IsEnabled() )
- aTextColor = rStyleSettings.GetDisableColor();
-
- Font aFont = rStyleSettings.GetFieldFont();
- if ( IsControlFont() )
- aFont.Merge( GetControlFont() );
- aFont.SetTransparent( IsPaintTransparent() );
- SetZoomedPointFont( aFont );
- Font TheFont = GetFont();
- TheFont.SetColor( aTextColor );
- if( IsPaintTransparent() )
- TheFont.SetFillColor( Color( COL_TRANSPARENT ) );
- else
- TheFont.SetFillColor( IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor() );
- pImpSvMEdit->GetTextWindow()->SetFont( TheFont );
- pImpSvMEdit->GetTextWindow()->GetTextEngine()->SetFont( TheFont );
- pImpSvMEdit->GetTextWindow()->SetTextColor( aTextColor );
-
- if ( bBackground )
- {
- if( IsPaintTransparent() )
- {
- pImpSvMEdit->GetTextWindow()->SetPaintTransparent( sal_True );
- pImpSvMEdit->GetTextWindow()->SetBackground();
- pImpSvMEdit->GetTextWindow()->SetControlBackground();
- SetBackground();
- SetControlBackground();
- }
- else
- {
- if( IsControlBackground() )
- pImpSvMEdit->GetTextWindow()->SetBackground( GetControlBackground() );
- else
- pImpSvMEdit->GetTextWindow()->SetBackground( rStyleSettings.GetFieldColor() );
- // Auch am MultiLineEdit einstellen, weil die TextComponent
- // ggf. die Scrollbars hidet.
- SetBackground( pImpSvMEdit->GetTextWindow()->GetBackground() );
- }
- }
}
-void MultiLineEdit::Modify()
-{
- aModifyHdlLink.Call( this );
-
- CallEventListeners( VCLEVENT_EDIT_MODIFY );
-
- if ( pUpdateDataTimer )
- pUpdateDataTimer->Start();
-}
-
-IMPL_LINK_NOARG(MultiLineEdit, ImpUpdateDataHdl)
-{
- UpdateData();
- return 0;
-}
-
-void MultiLineEdit::UpdateData()
-{
- aUpdateDataHdlLink.Call( this );
-}
-
-void MultiLineEdit::SetModifyFlag()
-{
- pImpSvMEdit->SetModified( sal_True );
-}
-
-void MultiLineEdit::ClearModifyFlag()
-{
- pImpSvMEdit->SetModified( sal_False );
-}
-
-sal_Bool MultiLineEdit::IsModified() const
-{
- return pImpSvMEdit->IsModified();
-}
-
-void MultiLineEdit::EnableUpdateData( sal_uLong nTimeout )
-{
- if ( !nTimeout )
- DisableUpdateData();
- else
- {
- if ( !pUpdateDataTimer )
- {
- pUpdateDataTimer = new Timer;
- pUpdateDataTimer->SetTimeoutHdl( LINK( this, MultiLineEdit, ImpUpdateDataHdl ) );
- }
- pUpdateDataTimer->SetTimeout( nTimeout );
- }
-}
-
-void MultiLineEdit::SetReadOnly( sal_Bool bReadOnly )
-{
- pImpSvMEdit->SetReadOnly( bReadOnly );
- Edit::SetReadOnly( bReadOnly );
-
- // #94921# ReadOnly can be overwritten in InitFromStyle() when WB not set.
- WinBits nStyle = GetStyle();
- if ( bReadOnly )
- nStyle |= WB_READONLY;
- else
- nStyle &= ~WB_READONLY;
- SetStyle( nStyle );
-}
-
-sal_Bool MultiLineEdit::IsReadOnly() const
-{
- return pImpSvMEdit->IsReadOnly();
-}
-
-void MultiLineEdit::SetMaxTextLen( xub_StrLen nMaxLen )
-{
- pImpSvMEdit->SetMaxTextLen( nMaxLen );
-}
-
-xub_StrLen MultiLineEdit::GetMaxTextLen() const
-{
- return pImpSvMEdit->GetMaxTextLen();
-}
-
-void MultiLineEdit::ReplaceSelected( const String& rStr )
-{
- pImpSvMEdit->InsertText( rStr );
-}
-
-void MultiLineEdit::DeleteSelected()
-{
- pImpSvMEdit->InsertText( String() );
-}
-
-String MultiLineEdit::GetSelected() const
-{
- return pImpSvMEdit->GetSelected();
-}
-
-String MultiLineEdit::GetSelected( LineEnd aSeparator ) const
-{
- return pImpSvMEdit->GetSelected( aSeparator );
-}
-
-void MultiLineEdit::Cut()
-{
- pImpSvMEdit->Cut();
-}
-
-void MultiLineEdit::Copy()
-{
- pImpSvMEdit->Copy();
-}
-
-void MultiLineEdit::Paste()
-{
- pImpSvMEdit->Paste();
-}
-
-void MultiLineEdit::SetText( const String& rStr )
-{
- pImpSvMEdit->SetText( rStr );
-}
-
-String MultiLineEdit::GetText() const
-{
- return pImpSvMEdit->GetText();
-}
-
-String MultiLineEdit::GetText( LineEnd aSeparator ) const
-{
- return pImpSvMEdit->GetText( aSeparator );
-}
-
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list