From 0f510418b53d2891b652710179bd33c17ed7c2ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolnai=20Tam=C3=A1s?= Date: Mon, 6 Aug 2012 20:52:37 +0200 Subject: [PATCH] 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 --- .../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 +- .../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 | 210 +-- 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 | 1681 +------------------- svtools/source/edit/svmedit2.cxx | 2 +- svtools/source/edit/textwindowpeer.cxx | 2 +- 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 +- {svtools/inc/svtools => vcl/inc/vcl}/textdata.hxx | 6 +- {svtools/inc/svtools => vcl/inc/vcl}/texteng.hxx | 4 +- {svtools/inc/svtools => vcl/inc/vcl}/textview.hxx | 6 +- {svtools/inc/svtools => vcl/inc/vcl}/txtattr.hxx | 10 +- .../svmedit.hxx => vcl/inc/vcl/vclmedit.hxx | 26 +- {svtools/inc/svtools => vcl/inc/vcl}/xtextedt.hxx | 10 +- {svtools => vcl}/source/edit/textdat2.hxx | 0 {svtools => vcl}/source/edit/textdata.cxx | 2 +- {svtools => vcl}/source/edit/textdoc.cxx | 0 {svtools => vcl}/source/edit/textdoc.hxx | 4 +- {svtools => vcl}/source/edit/texteng.cxx | 4 +- {svtools => vcl}/source/edit/textund2.hxx | 0 {svtools => vcl}/source/edit/textundo.cxx | 6 +- {svtools => vcl}/source/edit/textundo.hxx | 0 {svtools => vcl}/source/edit/textview.cxx | 6 +- {svtools => vcl}/source/edit/txtattr.cxx | 2 +- .../svmedit.cxx => vcl/source/edit/vclmedit.cxx | 188 +-- {svtools => vcl}/source/edit/xtextedt.cxx | 2 +- vcl/source/window/msgbox.cxx | 41 +- 52 files changed, 308 insertions(+), 2010 deletions(-) rewrite svtools/inc/svtools/svmedit.hxx (68%) rewrite svtools/source/edit/svmedit.cxx (96%) rename {svtools/inc/svtools => vcl/inc/vcl}/textdata.hxx (98%) rename {svtools/inc/svtools => vcl/inc/vcl}/texteng.hxx (99%) rename {svtools/inc/svtools => vcl/inc/vcl}/textview.hxx (98%) rename {svtools/inc/svtools => vcl/inc/vcl}/txtattr.hxx (96%) rename svtools/inc/svtools/svmedit.hxx => vcl/inc/vcl/vclmedit.hxx (88%) rename {svtools/inc/svtools => vcl/inc/vcl}/xtextedt.hxx (91%) rename {svtools => vcl}/source/edit/textdat2.hxx (100%) rename {svtools => vcl}/source/edit/textdata.cxx (99%) rename {svtools => vcl}/source/edit/textdoc.cxx (100%) rename {svtools => vcl}/source/edit/textdoc.hxx (98%) rename {svtools => vcl}/source/edit/texteng.cxx (99%) rename {svtools => vcl}/source/edit/textund2.hxx (100%) rename {svtools => vcl}/source/edit/textundo.cxx (98%) rename {svtools => vcl}/source/edit/textundo.hxx (100%) rename {svtools => vcl}/source/edit/textview.cxx (99%) rename {svtools => vcl}/source/edit/txtattr.cxx (99%) rename svtools/source/edit/svmedit.cxx => vcl/source/edit/vclmedit.cxx (89%) rename {svtools => vcl}/source/edit/xtextedt.cxx (99%) 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 #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 1eab598..2a91daa 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index a5702c1..95c887d 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -38,8 +38,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index f4eb16d..435f28d 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -51,7 +51,7 @@ #include #include #include -#include +#include #include using namespace ::com::sun::star; diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx index 4de4d77..cff69a3 100644 --- a/basctl/source/basicide/basides2.cxx +++ b/basctl/source/basicide/basides2.cxx @@ -29,9 +29,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include 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 -#include +#include +#include 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 +#include #include #include #include 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 #include #include -#include +#include #include #include #include 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 #include #include -#include +#include #include #include 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 -#include -#include +#include +#include #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 #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 #include -#include +#include #include #include #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 #include #include -#include +#include #include #include #include @@ -44,7 +44,7 @@ #include #include #include -#include +#include #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 #include -#include +#include #include #include #include diff --git a/framework/source/services/license.cxx b/framework/source/services/license.cxx index c91321b..99753a7b 100644 --- a/framework/source/services/license.cxx +++ b/framework/source/services/license.cxx @@ -62,7 +62,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index c5f3e83..433ac78 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -146,14 +146,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 a7ce3a1..21953b1 100644 --- a/svtools/Package_inc.mk +++ b/svtools/Package_inc.mk @@ -155,9 +155,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)) @@ -172,7 +169,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)) @@ -183,7 +179,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 dissimilarity index 68% index f0d30d1..9085349 100644 --- a/svtools/inc/svtools/svmedit.hxx +++ b/svtools/inc/svtools/svmedit.hxx @@ -1,155 +1,55 @@ -/* -*- 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SVEDIT_HXX -#define _SVEDIT_HXX - -#include -#include - -#include -#include -#include - -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; - -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 ); - - 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 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +/* -*- 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVEDIT_HXX +#define _SVEDIT_HXX + +#include + +#include +#include +#include + + + +class SVT_DLLPUBLIC MultiLineEdit : public VCLMultiLineEdit +{ +public: + MultiLineEdit( Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER ); + MultiLineEdit( Window* pParent, const ResId& rResId ); + ~MultiLineEdit(){}; + + virtual + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > + GetComponentInterface(sal_Bool bCreate = sal_True); +}; + + +#endif //_SVEDIT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx index b0ab801..bf818c2 100644 --- a/svtools/source/brwbox/ebbcontrols.cxx +++ b/svtools/source/brwbox/ebbcontrols.cxx @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include 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 #include #include -#include +#include #include #include #include #include #include -#include +#include #include #include "templwin.hrc" #include 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 -#include +#include #include -#include +#include MultiLineEditSyntaxHighlight::MultiLineEditSyntaxHighlight( Window* pParent, WinBits nWinStyle, diff --git a/svtools/source/edit/svmedit.cxx b/svtools/source/edit/svmedit.cxx dissimilarity index 96% index 4fff9e0..24e97ec 100644 --- a/svtools/source/edit/svmedit.cxx +++ b/svtools/source/edit/svmedit.cxx @@ -1,1618 +1,63 @@ -/* -*- 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 - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - -#include "unoiface.hxx" - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - - -// 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 - -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 (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 ) -{ - 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 ) -{ - 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 ); -} - -String MultiLineEdit::GetTextLines( LineEnd aSeparator ) const -{ - return pImpSvMEdit->GetTextLines( aSeparator ); -} - -void MultiLineEdit::Resize() -{ - pImpSvMEdit->Resize(); -} - -void MultiLineEdit::GetFocus() -{ - if ( !pImpSvMEdit ) // might be called from within the dtor, when pImpSvMEdit == NULL is a valid state - return; - - Edit::GetFocus(); - pImpSvMEdit->GetFocus(); -} - -void MultiLineEdit::SetSelection( const Selection& rSelection ) -{ - pImpSvMEdit->SetSelection( rSelection ); -} - -const Selection& MultiLineEdit::GetSelection() const -{ - return pImpSvMEdit->GetSelection(); -} - -Size MultiLineEdit::CalcMinimumSize() const -{ - Size aSz = pImpSvMEdit->CalcMinimumSize(); - - sal_Int32 nLeft, nTop, nRight, nBottom; - ((Window*)this)->GetBorder( nLeft, nTop, nRight, nBottom ); - aSz.Width() += nLeft+nRight; - aSz.Height() += nTop+nBottom; - - return aSz; -} - -Size MultiLineEdit::CalcAdjustedSize( const Size& rPrefSize ) const -{ - Size aSz = rPrefSize; - sal_Int32 nLeft, nTop, nRight, nBottom; - ((Window*)this)->GetBorder( nLeft, nTop, nRight, nBottom ); - - // In der Hoehe auf ganze Zeilen justieren - - long nHeight = aSz.Height() - nTop - nBottom; - long nLineHeight = pImpSvMEdit->CalcSize( 1, 1 ).Height(); - long nLines = nHeight / nLineHeight; - if ( nLines < 1 ) - nLines = 1; - - aSz.Height() = nLines * nLineHeight; - aSz.Height() += nTop+nBottom; - - return aSz; -} - -Size MultiLineEdit::CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const -{ - Size aSz = pImpSvMEdit->CalcSize( nColumns, nLines ); - - sal_Int32 nLeft, nTop, nRight, nBottom; - ((Window*)this)->GetBorder( nLeft, nTop, nRight, nBottom ); - aSz.Width() += nLeft+nRight; - aSz.Height() += nTop+nBottom; - return aSz; -} - -void MultiLineEdit::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const -{ - pImpSvMEdit->GetMaxVisColumnsAndLines( rnCols, rnLines ); -} - -void MultiLineEdit::StateChanged( StateChangedType nType ) -{ - if( nType == STATE_CHANGE_ENABLE ) - { - pImpSvMEdit->Enable( IsEnabled() ); - ImplInitSettings( sal_True, sal_False, sal_False ); - } - else if( nType == STATE_CHANGE_READONLY ) - { - pImpSvMEdit->SetReadOnly( IsReadOnly() ); - } - else if ( nType == STATE_CHANGE_ZOOM ) - { - pImpSvMEdit->GetTextWindow()->SetZoom( GetZoom() ); - ImplInitSettings( sal_True, sal_False, sal_False ); - Resize(); - } - else if ( nType == STATE_CHANGE_CONTROLFONT ) - { - ImplInitSettings( sal_True, sal_False, sal_False ); - Resize(); - Invalidate(); - } - else if ( nType == STATE_CHANGE_CONTROLFOREGROUND ) - { - ImplInitSettings( sal_False, sal_True, sal_False ); - Invalidate(); - } - else if ( nType == STATE_CHANGE_CONTROLBACKGROUND ) - { - ImplInitSettings( sal_False, sal_False, sal_True ); - Invalidate(); - } - else if ( nType == STATE_CHANGE_STYLE ) - { - pImpSvMEdit->InitFromStyle( GetStyle() ); - SetStyle( ImplInitStyle( GetStyle() ) ); - } - else if ( nType == STATE_CHANGE_INITSHOW ) - { - if( IsPaintTransparent() ) - { - pImpSvMEdit->GetTextWindow()->SetPaintTransparent( sal_True ); - pImpSvMEdit->GetTextWindow()->SetBackground(); - pImpSvMEdit->GetTextWindow()->SetControlBackground(); - SetBackground(); - SetControlBackground(); - } - } - - Control::StateChanged( nType ); -} - -void MultiLineEdit::DataChanged( const DataChangedEvent& rDCEvt ) -{ - if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && - (rDCEvt.GetFlags() & SETTINGS_STYLE) ) - { - ImplInitSettings( sal_True, sal_True, sal_True ); - Resize(); - Invalidate(); - } - else - Control::DataChanged( rDCEvt ); -} - -void MultiLineEdit::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) -{ - ImplInitSettings( sal_True, sal_True, sal_True ); - - Point aPos = pDev->LogicToPixel( rPos ); - Size aSize = pDev->LogicToPixel( rSize ); - Font aFont = pImpSvMEdit->GetTextWindow()->GetDrawPixelFont( pDev ); - aFont.SetTransparent( sal_True ); - OutDevType eOutDevType = pDev->GetOutDevType(); - - pDev->Push(); - pDev->SetMapMode(); - pDev->SetFont( aFont ); - pDev->SetTextFillColor(); - - // Border/Background - pDev->SetLineColor(); - pDev->SetFillColor(); - sal_Bool bBorder = !(nFlags & WINDOW_DRAW_NOBORDER ) && (GetStyle() & WB_BORDER); - sal_Bool bBackground = !(nFlags & WINDOW_DRAW_NOBACKGROUND) && IsControlBackground(); - if ( bBorder || bBackground ) - { - Rectangle aRect( aPos, aSize ); - if ( bBorder ) - { - DecorationView aDecoView( pDev ); - aRect = aDecoView.DrawFrame( aRect, FRAME_DRAW_DOUBLEIN ); - } - if ( bBackground ) - { - pDev->SetFillColor( GetControlBackground() ); - pDev->DrawRect( aRect ); - } - } - - // Inhalt - if ( ( nFlags & WINDOW_DRAW_MONO ) || ( eOutDevType == OUTDEV_PRINTER ) ) - pDev->SetTextColor( Color( COL_BLACK ) ); - else - { - if ( !(nFlags & WINDOW_DRAW_NODISABLE ) && !IsEnabled() ) - { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - pDev->SetTextColor( rStyleSettings.GetDisableColor() ); - } - else - { - pDev->SetTextColor( GetTextColor() ); - } - } - - rtl::OUString aText = GetText(); - Size aTextSz( pDev->GetTextWidth( aText ), pDev->GetTextHeight() ); - sal_uLong nLines = (sal_uLong) (aSize.Height() / aTextSz.Height()); - if ( !nLines ) - nLines = 1; - aTextSz.Height() = nLines*aTextSz.Height(); - long nOnePixel = GetDrawPixel( pDev, 1 ); - long nOffX = 3*nOnePixel; - long nOffY = 2*nOnePixel; - - // Clipping? - if ( ( nOffY < 0 ) || ( (nOffY+aTextSz.Height()) > aSize.Height() ) || ( (nOffX+aTextSz.Width()) > aSize.Width() ) ) - { - Rectangle aClip( aPos, aSize ); - if ( aTextSz.Height() > aSize.Height() ) - aClip.Bottom() += aTextSz.Height() - aSize.Height() + 1; // Damit HP-Drucker nicht 'weg-optimieren' - pDev->IntersectClipRegion( aClip ); - } - - TextEngine aTE; - aTE.SetText( GetText() ); - aTE.SetMaxTextWidth( aSize.Width() ); - aTE.SetFont( aFont ); - aTE.SetTextAlign( pImpSvMEdit->GetTextWindow()->GetTextEngine()->GetTextAlign() ); - aTE.Draw( pDev, Point( aPos.X() + nOffX, aPos.Y() + nOffY ) ); - - pDev->Pop(); -} - -long MultiLineEdit::Notify( NotifyEvent& rNEvt ) -{ - long nDone = 0; - if( rNEvt.GetType() == EVENT_COMMAND ) - { - nDone = pImpSvMEdit->HandleCommand( *rNEvt.GetCommandEvent() ); - } - return nDone ? nDone : Edit::Notify( rNEvt ); -} - -long MultiLineEdit::PreNotify( NotifyEvent& rNEvt ) -{ - long nDone = 0; - -#if (OSL_DEBUG_LEVEL > 1) && defined(DBG_UTIL) - if( rNEvt.GetType() == EVENT_KEYINPUT ) - { - const KeyEvent& rKEvent = *rNEvt.GetKeyEvent(); - if ( ( rKEvent.GetKeyCode().GetCode() == KEY_W ) && rKEvent.GetKeyCode().IsMod1() && rKEvent.GetKeyCode().IsMod2() ) - { - SetRightToLeft( !IsRightToLeft() ); - } - } -#endif - - if( ( rNEvt.GetType() == EVENT_KEYINPUT ) && ( !GetTextView()->IsCursorEnabled() ) ) - { - const KeyEvent& rKEvent = *rNEvt.GetKeyEvent(); - if ( !rKEvent.GetKeyCode().IsShift() && ( rKEvent.GetKeyCode().GetGroup() == KEYGROUP_CURSOR ) ) - { - nDone = 1; - TextSelection aSel = pImpSvMEdit->GetTextWindow()->GetTextView()->GetSelection(); - if ( aSel.HasRange() ) - { - aSel.GetStart() = aSel.GetEnd(); - pImpSvMEdit->GetTextWindow()->GetTextView()->SetSelection( aSel ); - } - else - { - switch ( rKEvent.GetKeyCode().GetCode() ) - { - case KEY_UP: - { - if ( pImpSvMEdit->GetVScrollBar() ) - pImpSvMEdit->GetVScrollBar()->DoScrollAction( SCROLL_LINEUP ); - } - break; - case KEY_DOWN: - { - if ( pImpSvMEdit->GetVScrollBar() ) - pImpSvMEdit->GetVScrollBar()->DoScrollAction( SCROLL_LINEDOWN ); - } - break; - case KEY_PAGEUP : - { - if ( pImpSvMEdit->GetVScrollBar() ) - pImpSvMEdit->GetVScrollBar()->DoScrollAction( SCROLL_PAGEUP ); - } - break; - case KEY_PAGEDOWN: - { - if ( pImpSvMEdit->GetVScrollBar() ) - pImpSvMEdit->GetVScrollBar()->DoScrollAction( SCROLL_PAGEDOWN ); - } - break; - case KEY_LEFT: - { - if ( pImpSvMEdit->GetHScrollBar() ) - pImpSvMEdit->GetHScrollBar()->DoScrollAction( SCROLL_LINEUP ); - } - break; - case KEY_RIGHT: - { - if ( pImpSvMEdit->GetHScrollBar() ) - pImpSvMEdit->GetHScrollBar()->DoScrollAction( SCROLL_LINEDOWN ); - } - break; - case KEY_HOME: - { - if ( rKEvent.GetKeyCode().IsMod1() ) - pImpSvMEdit->GetTextWindow()->GetTextView()-> - SetSelection( TextSelection( TextPaM( 0, 0 ) ) ); - } - break; - case KEY_END: - { - if ( rKEvent.GetKeyCode().IsMod1() ) - pImpSvMEdit->GetTextWindow()->GetTextView()-> - SetSelection( TextSelection( TextPaM( 0xFFFF, 0xFFFF ) ) ); - } - break; - default: - { - nDone = 0; - } - } - } - } - } - - return nDone ? nDone : Edit::PreNotify( rNEvt ); -} - -// -// Internas fuer abgeleitete Klassen, z.B. TextComponent - -ExtTextEngine* MultiLineEdit::GetTextEngine() const -{ - return pImpSvMEdit->GetTextWindow()->GetTextEngine(); -} - -ExtTextView* MultiLineEdit::GetTextView() const -{ - return pImpSvMEdit->GetTextWindow()->GetTextView(); -} - -ScrollBar* MultiLineEdit::GetVScrollBar() const -{ - return pImpSvMEdit->GetVScrollBar(); -} - -void MultiLineEdit::EnableFocusSelectionHide( sal_Bool bHide ) -{ - pImpSvMEdit->GetTextWindow()->SetAutoFocusHide( bHide ); -} - -void MultiLineEdit::SetLeftMargin( sal_uInt16 n ) -{ - if ( GetTextEngine() ) - GetTextEngine()->SetLeftMargin( n ); -} - -void MultiLineEdit::SetRightToLeft( sal_Bool bRightToLeft ) -{ - if ( GetTextEngine() ) - { - GetTextEngine()->SetRightToLeft( bRightToLeft ); - GetTextView()->ShowCursor(); - } -} - -sal_Bool MultiLineEdit::IsRightToLeft() const -{ - sal_Bool bRightToLeft = sal_False; - - if ( GetTextEngine() ) - bRightToLeft = GetTextEngine()->IsRightToLeft(); - - return bRightToLeft; -} - -// virtual -::css::uno::Reference< ::css::awt::XWindowPeer > -MultiLineEdit::GetComponentInterface(sal_Bool bCreate) -{ - ::css::uno::Reference< ::css::awt::XWindowPeer > xPeer( - Edit::GetComponentInterface(false)); - if (!xPeer.is() && bCreate) - { - ::std::auto_ptr< VCLXMultiLineEdit > xEdit(new VCLXMultiLineEdit()); - xEdit->SetWindow(this); - xPeer = xEdit.release(); - SetComponentInterface(xPeer); - } - return xPeer; -} - -void MultiLineEdit::DisableSelectionOnFocus() -{ - pImpSvMEdit->GetTextWindow()->DisableSelectionOnFocus(); -} - -void MultiLineEdit::SetTextSelectable( sal_Bool bTextSelectable ) -{ - pImpSvMEdit->GetTextWindow()->SetTextSelectable( bTextSelectable ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +/* -*- 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + + +#include "unoiface.hxx" +#include + + + +MultiLineEdit::MultiLineEdit( Window* pParent, WinBits nWinStyle ) + : VCLMultiLineEdit( pParent,nWinStyle ) +{ +} +MultiLineEdit::MultiLineEdit( Window* pParent, const ResId& rResId ) + : VCLMultiLineEdit( pParent,rResId ) +{ +} + +namespace css = ::com::sun::star; + +// virtual +::css::uno::Reference< ::css::awt::XWindowPeer > +MultiLineEdit::GetComponentInterface(sal_Bool bCreate) +{ + ::css::uno::Reference< ::css::awt::XWindowPeer > xPeer( + VCLMultiLineEdit::GetComponentInterface(false)); + if (!xPeer.is() && bCreate) + { + ::std::auto_ptr< VCLXMultiLineEdit > xVCLMEdit(new VCLXMultiLineEdit()); + xVCLMEdit->SetWindow(this); + xPeer = xVCLMEdit.release(); + SetComponentInterface(xPeer); + } + return xPeer; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/edit/svmedit2.cxx b/svtools/source/edit/svmedit2.cxx index abd2fcf..8d530b2 100644 --- a/svtools/source/edit/svmedit2.cxx +++ b/svtools/source/edit/svmedit2.cxx @@ -19,7 +19,7 @@ #include -#include +#include ExtMultiLineEdit::ExtMultiLineEdit( Window* pParent, WinBits nWinStyle ) : diff --git a/svtools/source/edit/textwindowpeer.cxx b/svtools/source/edit/textwindowpeer.cxx index 3609063..59eee86 100644 --- a/svtools/source/edit/textwindowpeer.cxx +++ b/svtools/source/edit/textwindowpeer.cxx @@ -19,7 +19,7 @@ #include -#include +#include #include "svtaccessiblefactory.hxx" namespace css = ::com::sun::star; diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index 32685fa..f5fdf8d 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index 5cde4aa..a9c86b2 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -33,8 +33,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/sw/source/ui/docvw/srcedtw.cxx b/sw/source/ui/docvw/srcedtw.cxx index c6bb14f..66273f9 100644 --- a/sw/source/ui/docvw/srcedtw.cxx +++ b/sw/source/ui/docvw/srcedtw.cxx @@ -38,13 +38,13 @@ #include #include #include -#include +#include #include #include #include #include #include -#include +#include #include #include #include diff --git a/sw/source/ui/inc/srcedtw.hxx b/sw/source/ui/inc/srcedtw.hxx index 8f4a443..74e1f42 100644 --- a/sw/source/ui/inc/srcedtw.hxx +++ b/sw/source/ui/inc/srcedtw.hxx @@ -32,7 +32,7 @@ #include #include -#include +#include #include namespace com { namespace sun { namespace star { namespace beans { diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 77717fd..daa5176 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -68,6 +68,7 @@ $(eval $(call gb_Library_add_defs,vcl,\ $(eval $(call gb_Library_use_sdk_api,vcl)) $(eval $(call gb_Library_use_libraries,vcl,\ + svl \ tl \ utl \ sot \ @@ -143,6 +144,14 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/control/spinfld \ vcl/source/control/tabctrl \ vcl/source/control/throbber \ + vcl/source/edit/vclmedit \ + vcl/source/edit/textdata \ + vcl/source/edit/textdoc \ + vcl/source/edit/texteng \ + vcl/source/edit/textundo \ + vcl/source/edit/textview \ + vcl/source/edit/txtattr \ + vcl/source/edit/xtextedt \ vcl/source/fontsubset/cff \ vcl/source/fontsubset/fontsubset \ vcl/source/fontsubset/gsub \ diff --git a/vcl/Package_inc.mk b/vcl/Package_inc.mk index 0da4b14..c5e6fbf 100644 --- a/vcl/Package_inc.mk +++ b/vcl/Package_inc.mk @@ -151,19 +151,26 @@ $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/tabctrl.hxx,vcl/tabctrl.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/tabdlg.hxx,vcl/tabdlg.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/tabpage.hxx,vcl/tabpage.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/taskpanelist.hxx,vcl/taskpanelist.hxx)) +$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/textdata.hxx,vcl/textdata.hxx)) +$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/texteng.hxx,vcl/texteng.hxx)) +$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/textview.hxx,vcl/textview.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/threadex.hxx,vcl/threadex.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/throbber.hxx,vcl/throbber.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/timer.hxx,vcl/timer.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/toolbox.hxx,vcl/toolbox.hxx)) +$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/txtattr.hxx,vcl/txtattr.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/unohelp2.hxx,vcl/unohelp2.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/unohelp.hxx,vcl/unohelp.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/unowrap.hxx,vcl/unowrap.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/vclenum.hxx,vcl/vclenum.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/vclevent.hxx,vcl/vclevent.hxx)) +$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/vclmedit.hxx,vcl/vclmedit.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/virdev.hxx,vcl/virdev.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/waitobj.hxx,vcl/waitobj.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/wall.hxx,vcl/wall.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/window.hxx,vcl/window.hxx)) $(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/wrkwin.hxx,vcl/wrkwin.hxx)) +$(eval $(call gb_Package_add_file,vcl_inc,inc/vcl/xtextedt.hxx,vcl/xtextedt.hxx)) + # vim: set noet sw=4 ts=4: diff --git a/vcl/inc/vcl/msgbox.hxx b/vcl/inc/vcl/msgbox.hxx index 1d76e13..2bb73ab 100644 --- a/vcl/inc/vcl/msgbox.hxx +++ b/vcl/inc/vcl/msgbox.hxx @@ -34,7 +34,7 @@ #include #include #include -class FixedText; +class VCLMultiLineEdit; class FixedImage; class CheckBox; @@ -67,7 +67,7 @@ class CheckBox; class VCL_DLLPUBLIC MessBox : public ButtonDialog { protected: - FixedText* mpFixedText; + VCLMultiLineEdit* mpVCLMultiLineEdit; FixedImage* mpFixedImage; XubString maMessText; Image maImage; diff --git a/svtools/inc/svtools/textdata.hxx b/vcl/inc/vcl/textdata.hxx similarity index 98% rename from svtools/inc/svtools/textdata.hxx rename to vcl/inc/vcl/textdata.hxx index 29d97e6..4ee0e2f 100644 --- a/svtools/inc/svtools/textdata.hxx +++ b/vcl/inc/vcl/textdata.hxx @@ -20,7 +20,7 @@ #ifndef _TEXTDATA_HXX #define _TEXTDATA_HXX -#include "svtools/svtdllapi.h" +#include #include #include #include @@ -72,7 +72,7 @@ inline sal_Bool TextPaM::operator > ( const TextPaM& rPaM ) const ( ( mnPara == rPaM.mnPara ) && mnIndex > rPaM.mnIndex ) ) ? sal_True : sal_False; } -class SVT_DLLPUBLIC TextSelection +class VCL_DLLPUBLIC TextSelection { private: TextPaM maStartPaM; @@ -122,7 +122,7 @@ inline sal_Bool TextSelection::operator != ( const TextSelection& rSel ) const #define TEXT_HINT_VIEWSCROLLED 100 #define TEXT_HINT_VIEWSELECTIONCHANGED 101 -class SVT_DLLPUBLIC TextHint : public SfxSimpleHint +class VCL_DLLPUBLIC TextHint : public SfxSimpleHint { private: sal_uLong mnValue; diff --git a/svtools/inc/svtools/texteng.hxx b/vcl/inc/vcl/texteng.hxx similarity index 99% rename from svtools/inc/svtools/texteng.hxx rename to vcl/inc/vcl/texteng.hxx index b20a01b..4eeee73 100644 --- a/svtools/inc/svtools/texteng.hxx +++ b/vcl/inc/vcl/texteng.hxx @@ -28,7 +28,7 @@ #ifndef _TEXTENG_HXX #define _TEXTENG_HXX -#include "svtools/svtdllapi.h" +#include class TextDoc; class TextView; @@ -81,7 +81,7 @@ enum TxtAlign { TXTALIGN_LEFT, TXTALIGN_CENTER, TXTALIGN_RIGHT }; typedef std::vector TextViews; -class SVT_DLLPUBLIC TextEngine : public SfxBroadcaster +class VCL_DLLPUBLIC TextEngine : public SfxBroadcaster { friend class TextView; friend class TextSelFunctionSet; diff --git a/svtools/inc/svtools/textview.hxx b/vcl/inc/vcl/textview.hxx similarity index 98% rename from svtools/inc/svtools/textview.hxx rename to vcl/inc/vcl/textview.hxx index ebf7a4f..72de5f0 100644 --- a/svtools/inc/svtools/textview.hxx +++ b/vcl/inc/vcl/textview.hxx @@ -29,8 +29,8 @@ #ifndef _TEXTVIEW_HXX #define _TEXTVIEW_HXX -#include "svtools/svtdllapi.h" -#include +#include +#include #include #include @@ -56,7 +56,7 @@ namespace clipboard { struct ImpTextView; -class SVT_DLLPUBLIC TextView : public vcl::unohelper::DragAndDropClient +class VCL_DLLPUBLIC TextView : public vcl::unohelper::DragAndDropClient { friend class TextEngine; friend class TextUndo; diff --git a/svtools/inc/svtools/txtattr.hxx b/vcl/inc/vcl/txtattr.hxx similarity index 96% rename from svtools/inc/svtools/txtattr.hxx rename to vcl/inc/vcl/txtattr.hxx index bf4c8e3..695dfc7 100644 --- a/svtools/inc/svtools/txtattr.hxx +++ b/vcl/inc/vcl/txtattr.hxx @@ -29,7 +29,7 @@ #ifndef _TXTATTR_HXX #define _TXTATTR_HXX -#include "svtools/svtdllapi.h" +#include #include #include #include @@ -46,7 +46,7 @@ class Font; #define TEXTATTR_PROTECTED 4 -class SVT_DLLPUBLIC TextAttrib +class VCL_DLLPUBLIC TextAttrib { private: sal_uInt16 mnWhich; @@ -70,7 +70,7 @@ public: -class SVT_DLLPUBLIC TextAttribFontColor : public TextAttrib +class VCL_DLLPUBLIC TextAttribFontColor : public TextAttrib { private: Color maColor; @@ -88,7 +88,7 @@ public: }; -class SVT_DLLPUBLIC TextAttribFontWeight : public TextAttrib +class VCL_DLLPUBLIC TextAttribFontWeight : public TextAttrib { private: FontWeight meWeight; @@ -131,7 +131,7 @@ public: virtual int operator==( const TextAttrib& rAttr ) const; }; -class SVT_DLLPUBLIC TextAttribProtect : public TextAttrib +class VCL_DLLPUBLIC TextAttribProtect : public TextAttrib { public: TextAttribProtect(); diff --git a/svtools/inc/svtools/svmedit.hxx b/vcl/inc/vcl/vclmedit.hxx similarity index 88% rename from svtools/inc/svtools/svmedit.hxx rename to vcl/inc/vcl/vclmedit.hxx index f0d30d1..519cb0e 100644 --- a/svtools/inc/svtools/svmedit.hxx +++ b/vcl/inc/vcl/vclmedit.hxx @@ -26,22 +26,20 @@ * ************************************************************************/ -#ifndef _SVEDIT_HXX -#define _SVEDIT_HXX +#ifndef _VCLMEDIT_HXX +#define _VCLMEDIT_HXX #include #include +#include -#include -#include -#include class ImpSvMEdit; class Timer; class ExtTextEngine; class ExtTextView; -class SVT_DLLPUBLIC MultiLineEdit : public Edit +class VCL_DLLPUBLIC VCLMultiLineEdit : public Edit { private: ImpSvMEdit* pImpSvMEdit; @@ -68,9 +66,9 @@ protected: ScrollBar* GetVScrollBar() const; public: - MultiLineEdit( Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER ); - MultiLineEdit( Window* pParent, const ResId& rResId ); - ~MultiLineEdit(); + VCLMultiLineEdit( Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER ); + VCLMultiLineEdit( Window* pParent, const ResId& rResId ); + virtual ~VCLMultiLineEdit(); virtual void Modify(); @@ -134,22 +132,18 @@ public: void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ); - void SetLeftMargin( sal_uInt16 n ); - - virtual - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > - GetComponentInterface(sal_Bool bCreate = sal_True); + void SetLeftMargin( sal_uInt16 n ); void DisableSelectionOnFocus(); void SetTextSelectable( sal_Bool bTextSelectable ); }; -inline sal_uLong MultiLineEdit::IsUpdateDataEnabled() const +inline sal_uLong VCLMultiLineEdit::IsUpdateDataEnabled() const { return pUpdateDataTimer ? pUpdateDataTimer->GetTimeout() : 0; } -#endif +#endif //_VCLMEDIT_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/inc/svtools/xtextedt.hxx b/vcl/inc/vcl/xtextedt.hxx similarity index 91% rename from svtools/inc/svtools/xtextedt.hxx rename to vcl/inc/vcl/xtextedt.hxx index b0b09b0..b763e37 100644 --- a/svtools/inc/svtools/xtextedt.hxx +++ b/vcl/inc/vcl/xtextedt.hxx @@ -19,9 +19,9 @@ #ifndef _XTEXTEDT_HXX #define _XTEXTEDT_HXX -#include "svtools/svtdllapi.h" -#include -#include +#include +#include +#include namespace com { namespace sun { @@ -30,7 +30,7 @@ namespace util { struct SearchOptions; }}}} -class SVT_DLLPUBLIC ExtTextEngine : public TextEngine +class VCL_DLLPUBLIC ExtTextEngine : public TextEngine { private: String maGroupChars; @@ -46,7 +46,7 @@ public: sal_Bool Search( TextSelection& rSel, const ::com::sun::star::util::SearchOptions& rSearchOptions, sal_Bool bForward = sal_True ); }; -class SVT_DLLPUBLIC ExtTextView : public TextView +class VCL_DLLPUBLIC ExtTextView : public TextView { protected: sal_Bool ImpIndentBlock( sal_Bool bRight ); diff --git a/svtools/source/edit/textdat2.hxx b/vcl/source/edit/textdat2.hxx similarity index 100% rename from svtools/source/edit/textdat2.hxx rename to vcl/source/edit/textdat2.hxx diff --git a/svtools/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx similarity index 99% rename from svtools/source/edit/textdata.cxx rename to vcl/source/edit/textdata.cxx index 7d55ee1..79f28f3 100644 --- a/svtools/source/edit/textdata.cxx +++ b/vcl/source/edit/textdata.cxx @@ -27,7 +27,7 @@ ************************************************************************/ -#include +#include #include #include diff --git a/svtools/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx similarity index 100% rename from svtools/source/edit/textdoc.cxx rename to vcl/source/edit/textdoc.cxx diff --git a/svtools/source/edit/textdoc.hxx b/vcl/source/edit/textdoc.hxx similarity index 98% rename from svtools/source/edit/textdoc.hxx rename to vcl/source/edit/textdoc.hxx index 1551123..a1529a4 100644 --- a/svtools/source/edit/textdoc.hxx +++ b/vcl/source/edit/textdoc.hxx @@ -29,8 +29,8 @@ #ifndef _TEXTDOC_HXX #define _TEXTDOC_HXX -#include -#include +#include +#include #include #include diff --git a/svtools/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx similarity index 99% rename from svtools/source/edit/texteng.cxx rename to vcl/source/edit/texteng.cxx index efce793..bd6d179 100644 --- a/svtools/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -28,8 +28,8 @@ #include -#include -#include +#include +#include #include #include #include diff --git a/svtools/source/edit/textund2.hxx b/vcl/source/edit/textund2.hxx similarity index 100% rename from svtools/source/edit/textund2.hxx rename to vcl/source/edit/textund2.hxx diff --git a/svtools/source/edit/textundo.cxx b/vcl/source/edit/textundo.cxx similarity index 98% rename from svtools/source/edit/textundo.cxx rename to vcl/source/edit/textundo.cxx index 1b82d0f..807abf2 100644 --- a/svtools/source/edit/textundo.cxx +++ b/vcl/source/edit/textundo.cxx @@ -27,11 +27,11 @@ ************************************************************************/ -#include -#include +#include +#include #include #include -#include +#include #include #include diff --git a/svtools/source/edit/textundo.hxx b/vcl/source/edit/textundo.hxx similarity index 100% rename from svtools/source/edit/textundo.hxx rename to vcl/source/edit/textundo.hxx diff --git a/svtools/source/edit/textview.cxx b/vcl/source/edit/textview.cxx similarity index 99% rename from svtools/source/edit/textview.cxx rename to vcl/source/edit/textview.cxx index 40a6774..045fb30 100644 --- a/svtools/source/edit/textview.cxx +++ b/vcl/source/edit/textview.cxx @@ -26,10 +26,10 @@ * ************************************************************************/ -#include -#include +#include +#include #include -#include +#include #include #include diff --git a/svtools/source/edit/txtattr.cxx b/vcl/source/edit/txtattr.cxx similarity index 99% rename from svtools/source/edit/txtattr.cxx rename to vcl/source/edit/txtattr.cxx index a332482..d0e3a84 100644 --- a/svtools/source/edit/txtattr.cxx +++ b/vcl/source/edit/txtattr.cxx @@ -27,7 +27,7 @@ ************************************************************************/ -#include +#include #include diff --git a/svtools/source/edit/svmedit.cxx b/vcl/source/edit/vclmedit.cxx similarity index 89% rename from svtools/source/edit/svmedit.cxx rename to vcl/source/edit/vclmedit.cxx index 4fff9e0..677962c 100644 --- a/svtools/source/edit/svmedit.cxx +++ b/vcl/source/edit/vclmedit.cxx @@ -28,33 +28,21 @@ #include -#include "unoiface.hxx" - #include #include #include -#include -#include +#include +#include #include #include -#include #include #include - -// 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 #include -namespace css = ::com::sun::star; class TextWindow : public Window { @@ -98,17 +86,13 @@ public: 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; + VCLMultiLineEdit* pSvVCLMultiLineEdit; TextWindow* mpTextWindow; ScrollBar* mpHScrollBar; @@ -128,7 +112,7 @@ protected: DECL_LINK( ScrollHdl, ScrollBar* ); public: - ImpSvMEdit( MultiLineEdit* pSvMultiLineEdit, WinBits nWinStyle ); + ImpSvMEdit( VCLMultiLineEdit* pSvVCLMultiLineEdit, WinBits nWinStyle ); ~ImpSvMEdit(); void SetModified( sal_Bool bMod ); @@ -178,12 +162,12 @@ public: ScrollBar* GetVScrollBar() { return mpVScrollBar; } }; -ImpSvMEdit::ImpSvMEdit( MultiLineEdit* pEdt, WinBits nWinStyle ) +ImpSvMEdit::ImpSvMEdit( VCLMultiLineEdit* pEdt, WinBits nWinStyle ) :mpHScrollBar(NULL) ,mpVScrollBar(NULL) ,mpScrollBox(NULL) { - pSvMultiLineEdit = pEdt; + pSvVCLMultiLineEdit = pEdt; mnTextWidth = 0; mpTextWindow = new TextWindow( pEdt ); mpTextWindow->Show(); @@ -217,7 +201,7 @@ void ImpSvMEdit::ImpUpdateSrollBarVis( WinBits nWinStyle ) if ( bHaveVScroll != bNeedVScroll ) { delete mpVScrollBar; - mpVScrollBar = bNeedVScroll ? new ScrollBar( pSvMultiLineEdit, WB_VSCROLL|WB_DRAG ) : NULL; + mpVScrollBar = bNeedVScroll ? new ScrollBar( pSvVCLMultiLineEdit, WB_VSCROLL|WB_DRAG ) : NULL; if ( bNeedVScroll ) { @@ -231,7 +215,7 @@ void ImpSvMEdit::ImpUpdateSrollBarVis( WinBits nWinStyle ) if ( bHaveHScroll != bNeedHScroll ) { delete mpHScrollBar; - mpHScrollBar = bNeedHScroll ? new ScrollBar( pSvMultiLineEdit, WB_HSCROLL|WB_DRAG ) : NULL; + mpHScrollBar = bNeedHScroll ? new ScrollBar( pSvVCLMultiLineEdit, WB_HSCROLL|WB_DRAG ) : NULL; if ( bNeedHScroll ) { @@ -245,7 +229,7 @@ void ImpSvMEdit::ImpUpdateSrollBarVis( WinBits nWinStyle ) if ( bHaveScrollBox != bNeedScrollBox ) { delete mpScrollBox; - mpScrollBox = bNeedScrollBox ? new ScrollBarBox( pSvMultiLineEdit, WB_SIZEABLE ) : NULL; + mpScrollBox = bNeedScrollBox ? new ScrollBarBox( pSvVCLMultiLineEdit, WB_SIZEABLE ) : NULL; if ( bNeedScrollBox ) mpScrollBox->Show(); @@ -280,7 +264,7 @@ void ImpSvMEdit::InitFromStyle( WinBits nWinStyle ) else { mpTextWindow->SetIgnoreTab( sal_False ); - // #103667# MultiLineEdit has the flag, but focusable window also needs this flag + // #103667# VCLMultiLineEdit has the flag, but focusable window also needs this flag WinBits nStyle = mpTextWindow->GetStyle(); nStyle |= WINDOW_DLGCTRL_MOD1TAB; mpTextWindow->SetStyle( nStyle ); @@ -369,7 +353,7 @@ IMPL_LINK( ImpSvMEdit, ScrollHdl, ScrollBar*, pCurScrollBar ) // void ImpSvMEdit::ImpModified() // { // // Wann wird das gerufen ????????????????????? -// pSvMultiLineEdit->Modify(); +// pSvVCLMultiLineEdit->Modify(); // } void ImpSvMEdit::SetAlign( WinBits nWinStyle ) @@ -437,14 +421,14 @@ void ImpSvMEdit::Resize() size_t nIteration = 1; do { - WinBits nWinStyle( pSvMultiLineEdit->GetStyle() ); + WinBits nWinStyle( pSvVCLMultiLineEdit->GetStyle() ); if ( ( nWinStyle & WB_AUTOVSCROLL ) == WB_AUTOVSCROLL ) ImpUpdateSrollBarVis( nWinStyle ); - Size aSz = pSvMultiLineEdit->GetOutputSizePixel(); + Size aSz = pSvVCLMultiLineEdit->GetOutputSizePixel(); Size aEditSize = aSz; - long nSBWidth = pSvMultiLineEdit->GetSettings().GetStyleSettings().GetScrollBarSize(); - nSBWidth = pSvMultiLineEdit->CalcZoom( nSBWidth ); + long nSBWidth = pSvVCLMultiLineEdit->GetSettings().GetStyleSettings().GetScrollBarSize(); + nSBWidth = pSvVCLMultiLineEdit->CalcZoom( nSBWidth ); if ( mpHScrollBar ) aSz.Height() -= nSBWidth+1; @@ -525,7 +509,7 @@ void ImpSvMEdit::SetText( const String& rStr ) mpTextWindow->GetTextView()->SetSelection( TextSelection() ); - WinBits nWinStyle( pSvMultiLineEdit->GetStyle() ); + WinBits nWinStyle( pSvVCLMultiLineEdit->GetStyle() ); if ( ( nWinStyle & WB_AUTOVSCROLL ) == WB_AUTOVSCROLL ) ImpUpdateSrollBarVis( nWinStyle ); } @@ -584,7 +568,7 @@ void ImpSvMEdit::Notify( SfxBroadcaster&, const SfxHint& rHint ) } else if( rTextHint.GetId() == TEXT_HINT_MODIFIED ) { - pSvMultiLineEdit->Modify(); + pSvVCLMultiLineEdit->Modify(); } } } @@ -954,21 +938,7 @@ void TextWindow::LoseFocus() 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 ) +VCLMultiLineEdit::VCLMultiLineEdit( Window* pParent, WinBits nWinStyle ) : Edit( pParent, nWinStyle ) { SetType( WINDOW_MULTILINEEDIT ); @@ -980,7 +950,7 @@ MultiLineEdit::MultiLineEdit( Window* pParent, WinBits nWinStyle ) SetStyle( ImplInitStyle( nWinStyle ) ); } -MultiLineEdit::MultiLineEdit( Window* pParent, const ResId& rResId ) +VCLMultiLineEdit::VCLMultiLineEdit( Window* pParent, const ResId& rResId ) : Edit( pParent, rResId.SetRT( RSC_MULTILINEEDIT ) ) { SetType( WINDOW_MULTILINEEDIT ); @@ -1004,13 +974,13 @@ MultiLineEdit::MultiLineEdit( Window* pParent, const ResId& rResId ) // 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: + // VCLMultiLineEdit's version while in the base Edit ctor: if ((GetStyle() & WB_HIDE) == 0) Show(); } -MultiLineEdit::~MultiLineEdit() +VCLMultiLineEdit::~VCLMultiLineEdit() { { ::std::auto_ptr< ImpSvMEdit > pDelete( pImpSvMEdit ); @@ -1019,7 +989,7 @@ MultiLineEdit::~MultiLineEdit() delete pUpdateDataTimer; } -WinBits MultiLineEdit::ImplInitStyle( WinBits nStyle ) +WinBits VCLMultiLineEdit::ImplInitStyle( WinBits nStyle ) { if ( !(nStyle & WB_NOTABSTOP) ) nStyle |= WB_TABSTOP; @@ -1034,7 +1004,7 @@ WinBits MultiLineEdit::ImplInitStyle( WinBits nStyle ) } -void MultiLineEdit::ImplInitSettings( sal_Bool /*bFont*/, sal_Bool /*bForeground*/, sal_Bool bBackground ) +void VCLMultiLineEdit::ImplInitSettings( sal_Bool /*bFont*/, sal_Bool /*bForeground*/, sal_Bool bBackground ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); @@ -1078,14 +1048,14 @@ void MultiLineEdit::ImplInitSettings( sal_Bool /*bFont*/, sal_Bool /*bForeground pImpSvMEdit->GetTextWindow()->SetBackground( GetControlBackground() ); else pImpSvMEdit->GetTextWindow()->SetBackground( rStyleSettings.GetFieldColor() ); - // Auch am MultiLineEdit einstellen, weil die TextComponent + // Auch am VCLMultiLineEdit einstellen, weil die TextComponent // ggf. die Scrollbars hidet. SetBackground( pImpSvMEdit->GetTextWindow()->GetBackground() ); } } } -void MultiLineEdit::Modify() +void VCLMultiLineEdit::Modify() { aModifyHdlLink.Call( this ); @@ -1095,33 +1065,33 @@ void MultiLineEdit::Modify() pUpdateDataTimer->Start(); } -IMPL_LINK_NOARG(MultiLineEdit, ImpUpdateDataHdl) +IMPL_LINK_NOARG(VCLMultiLineEdit, ImpUpdateDataHdl) { UpdateData(); return 0; } -void MultiLineEdit::UpdateData() +void VCLMultiLineEdit::UpdateData() { aUpdateDataHdlLink.Call( this ); } -void MultiLineEdit::SetModifyFlag() +void VCLMultiLineEdit::SetModifyFlag() { pImpSvMEdit->SetModified( sal_True ); } -void MultiLineEdit::ClearModifyFlag() +void VCLMultiLineEdit::ClearModifyFlag() { pImpSvMEdit->SetModified( sal_False ); } -sal_Bool MultiLineEdit::IsModified() const +sal_Bool VCLMultiLineEdit::IsModified() const { return pImpSvMEdit->IsModified(); } -void MultiLineEdit::EnableUpdateData( sal_uLong nTimeout ) +void VCLMultiLineEdit::EnableUpdateData( sal_uLong nTimeout ) { if ( !nTimeout ) DisableUpdateData(); @@ -1130,13 +1100,13 @@ void MultiLineEdit::EnableUpdateData( sal_uLong nTimeout ) if ( !pUpdateDataTimer ) { pUpdateDataTimer = new Timer; - pUpdateDataTimer->SetTimeoutHdl( LINK( this, MultiLineEdit, ImpUpdateDataHdl ) ); + pUpdateDataTimer->SetTimeoutHdl( LINK( this, VCLMultiLineEdit, ImpUpdateDataHdl ) ); } pUpdateDataTimer->SetTimeout( nTimeout ); } } -void MultiLineEdit::SetReadOnly( sal_Bool bReadOnly ) +void VCLMultiLineEdit::SetReadOnly( sal_Bool bReadOnly ) { pImpSvMEdit->SetReadOnly( bReadOnly ); Edit::SetReadOnly( bReadOnly ); @@ -1150,82 +1120,82 @@ void MultiLineEdit::SetReadOnly( sal_Bool bReadOnly ) SetStyle( nStyle ); } -sal_Bool MultiLineEdit::IsReadOnly() const +sal_Bool VCLMultiLineEdit::IsReadOnly() const { return pImpSvMEdit->IsReadOnly(); } -void MultiLineEdit::SetMaxTextLen( xub_StrLen nMaxLen ) +void VCLMultiLineEdit::SetMaxTextLen( xub_StrLen nMaxLen ) { pImpSvMEdit->SetMaxTextLen( nMaxLen ); } -xub_StrLen MultiLineEdit::GetMaxTextLen() const +xub_StrLen VCLMultiLineEdit::GetMaxTextLen() const { return pImpSvMEdit->GetMaxTextLen(); } -void MultiLineEdit::ReplaceSelected( const String& rStr ) +void VCLMultiLineEdit::ReplaceSelected( const String& rStr ) { pImpSvMEdit->InsertText( rStr ); } -void MultiLineEdit::DeleteSelected() +void VCLMultiLineEdit::DeleteSelected() { pImpSvMEdit->InsertText( String() ); } -String MultiLineEdit::GetSelected() const +String VCLMultiLineEdit::GetSelected() const { return pImpSvMEdit->GetSelected(); } -String MultiLineEdit::GetSelected( LineEnd aSeparator ) const +String VCLMultiLineEdit::GetSelected( LineEnd aSeparator ) const { return pImpSvMEdit->GetSelected( aSeparator ); } -void MultiLineEdit::Cut() +void VCLMultiLineEdit::Cut() { pImpSvMEdit->Cut(); } -void MultiLineEdit::Copy() +void VCLMultiLineEdit::Copy() { pImpSvMEdit->Copy(); } -void MultiLineEdit::Paste() +void VCLMultiLineEdit::Paste() { pImpSvMEdit->Paste(); } -void MultiLineEdit::SetText( const String& rStr ) +void VCLMultiLineEdit::SetText( const String& rStr ) { pImpSvMEdit->SetText( rStr ); } -String MultiLineEdit::GetText() const +String VCLMultiLineEdit::GetText() const { return pImpSvMEdit->GetText(); } -String MultiLineEdit::GetText( LineEnd aSeparator ) const +String VCLMultiLineEdit::GetText( LineEnd aSeparator ) const { return pImpSvMEdit->GetText( aSeparator ); } -String MultiLineEdit::GetTextLines( LineEnd aSeparator ) const +String VCLMultiLineEdit::GetTextLines( LineEnd aSeparator ) const { return pImpSvMEdit->GetTextLines( aSeparator ); } -void MultiLineEdit::Resize() +void VCLMultiLineEdit::Resize() { pImpSvMEdit->Resize(); } -void MultiLineEdit::GetFocus() +void VCLMultiLineEdit::GetFocus() { if ( !pImpSvMEdit ) // might be called from within the dtor, when pImpSvMEdit == NULL is a valid state return; @@ -1234,17 +1204,17 @@ void MultiLineEdit::GetFocus() pImpSvMEdit->GetFocus(); } -void MultiLineEdit::SetSelection( const Selection& rSelection ) +void VCLMultiLineEdit::SetSelection( const Selection& rSelection ) { pImpSvMEdit->SetSelection( rSelection ); } -const Selection& MultiLineEdit::GetSelection() const +const Selection& VCLMultiLineEdit::GetSelection() const { return pImpSvMEdit->GetSelection(); } -Size MultiLineEdit::CalcMinimumSize() const +Size VCLMultiLineEdit::CalcMinimumSize() const { Size aSz = pImpSvMEdit->CalcMinimumSize(); @@ -1256,7 +1226,7 @@ Size MultiLineEdit::CalcMinimumSize() const return aSz; } -Size MultiLineEdit::CalcAdjustedSize( const Size& rPrefSize ) const +Size VCLMultiLineEdit::CalcAdjustedSize( const Size& rPrefSize ) const { Size aSz = rPrefSize; sal_Int32 nLeft, nTop, nRight, nBottom; @@ -1276,7 +1246,7 @@ Size MultiLineEdit::CalcAdjustedSize( const Size& rPrefSize ) const return aSz; } -Size MultiLineEdit::CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const +Size VCLMultiLineEdit::CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const { Size aSz = pImpSvMEdit->CalcSize( nColumns, nLines ); @@ -1287,12 +1257,12 @@ Size MultiLineEdit::CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const return aSz; } -void MultiLineEdit::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const +void VCLMultiLineEdit::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const { pImpSvMEdit->GetMaxVisColumnsAndLines( rnCols, rnLines ); } -void MultiLineEdit::StateChanged( StateChangedType nType ) +void VCLMultiLineEdit::StateChanged( StateChangedType nType ) { if( nType == STATE_CHANGE_ENABLE ) { @@ -1345,7 +1315,7 @@ void MultiLineEdit::StateChanged( StateChangedType nType ) Control::StateChanged( nType ); } -void MultiLineEdit::DataChanged( const DataChangedEvent& rDCEvt ) +void VCLMultiLineEdit::DataChanged( const DataChangedEvent& rDCEvt ) { if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) @@ -1358,7 +1328,7 @@ void MultiLineEdit::DataChanged( const DataChangedEvent& rDCEvt ) Control::DataChanged( rDCEvt ); } -void MultiLineEdit::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) +void VCLMultiLineEdit::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) { ImplInitSettings( sal_True, sal_True, sal_True ); @@ -1428,7 +1398,7 @@ void MultiLineEdit::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSi pDev->IntersectClipRegion( aClip ); } - TextEngine aTE; + ExtTextEngine aTE; aTE.SetText( GetText() ); aTE.SetMaxTextWidth( aSize.Width() ); aTE.SetFont( aFont ); @@ -1438,7 +1408,7 @@ void MultiLineEdit::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSi pDev->Pop(); } -long MultiLineEdit::Notify( NotifyEvent& rNEvt ) +long VCLMultiLineEdit::Notify( NotifyEvent& rNEvt ) { long nDone = 0; if( rNEvt.GetType() == EVENT_COMMAND ) @@ -1448,7 +1418,7 @@ long MultiLineEdit::Notify( NotifyEvent& rNEvt ) return nDone ? nDone : Edit::Notify( rNEvt ); } -long MultiLineEdit::PreNotify( NotifyEvent& rNEvt ) +long VCLMultiLineEdit::PreNotify( NotifyEvent& rNEvt ) { long nDone = 0; @@ -1544,33 +1514,33 @@ long MultiLineEdit::PreNotify( NotifyEvent& rNEvt ) // // Internas fuer abgeleitete Klassen, z.B. TextComponent -ExtTextEngine* MultiLineEdit::GetTextEngine() const +ExtTextEngine* VCLMultiLineEdit::GetTextEngine() const { return pImpSvMEdit->GetTextWindow()->GetTextEngine(); } -ExtTextView* MultiLineEdit::GetTextView() const +ExtTextView* VCLMultiLineEdit::GetTextView() const { return pImpSvMEdit->GetTextWindow()->GetTextView(); } -ScrollBar* MultiLineEdit::GetVScrollBar() const +ScrollBar* VCLMultiLineEdit::GetVScrollBar() const { return pImpSvMEdit->GetVScrollBar(); } -void MultiLineEdit::EnableFocusSelectionHide( sal_Bool bHide ) +void VCLMultiLineEdit::EnableFocusSelectionHide( sal_Bool bHide ) { pImpSvMEdit->GetTextWindow()->SetAutoFocusHide( bHide ); } -void MultiLineEdit::SetLeftMargin( sal_uInt16 n ) +void VCLMultiLineEdit::SetLeftMargin( sal_uInt16 n ) { if ( GetTextEngine() ) GetTextEngine()->SetLeftMargin( n ); } -void MultiLineEdit::SetRightToLeft( sal_Bool bRightToLeft ) +void VCLMultiLineEdit::SetRightToLeft( sal_Bool bRightToLeft ) { if ( GetTextEngine() ) { @@ -1579,7 +1549,7 @@ void MultiLineEdit::SetRightToLeft( sal_Bool bRightToLeft ) } } -sal_Bool MultiLineEdit::IsRightToLeft() const +sal_Bool VCLMultiLineEdit::IsRightToLeft() const { sal_Bool bRightToLeft = sal_False; @@ -1589,28 +1559,12 @@ sal_Bool MultiLineEdit::IsRightToLeft() const return bRightToLeft; } -// virtual -::css::uno::Reference< ::css::awt::XWindowPeer > -MultiLineEdit::GetComponentInterface(sal_Bool bCreate) -{ - ::css::uno::Reference< ::css::awt::XWindowPeer > xPeer( - Edit::GetComponentInterface(false)); - if (!xPeer.is() && bCreate) - { - ::std::auto_ptr< VCLXMultiLineEdit > xEdit(new VCLXMultiLineEdit()); - xEdit->SetWindow(this); - xPeer = xEdit.release(); - SetComponentInterface(xPeer); - } - return xPeer; -} - -void MultiLineEdit::DisableSelectionOnFocus() +void VCLMultiLineEdit::DisableSelectionOnFocus() { pImpSvMEdit->GetTextWindow()->DisableSelectionOnFocus(); } -void MultiLineEdit::SetTextSelectable( sal_Bool bTextSelectable ) +void VCLMultiLineEdit::SetTextSelectable( sal_Bool bTextSelectable ) { pImpSvMEdit->GetTextWindow()->SetTextSelectable( bTextSelectable ); } diff --git a/svtools/source/edit/xtextedt.cxx b/vcl/source/edit/xtextedt.cxx similarity index 99% rename from svtools/source/edit/xtextedt.cxx rename to vcl/source/edit/xtextedt.cxx index a02f6aa..c434ad0 100644 --- a/svtools/source/edit/xtextedt.cxx +++ b/vcl/source/edit/xtextedt.cxx @@ -27,7 +27,7 @@ ************************************************************************/ -#include +#include #include // International #include #include diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx index 7d49f3e..2c20bab 100644 --- a/vcl/source/window/msgbox.cxx +++ b/vcl/source/window/msgbox.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -66,7 +67,7 @@ static void ImplInitMsgBoxImageList() void MessBox::ImplInitMessBoxData() { - mpFixedText = NULL; + mpVCLMultiLineEdit = NULL; mpFixedImage = NULL; mbHelpBtn = sal_False; mpCheckBox = NULL; @@ -203,7 +204,7 @@ void MessBox::ImplLoadRes( const ResId& ) MessBox::~MessBox() { - delete mpFixedText; + delete mpVCLMultiLineEdit; delete mpFixedImage; delete mpCheckBox; } @@ -236,16 +237,16 @@ void MessBox::ImplPosControls() Point aTextPos( IMPL_DIALOG_OFFSET, IMPL_DIALOG_OFFSET+IMPL_MSGBOX_OFFSET_EXTRA_Y ); Size aImageSize; Size aPageSize; - Size aFixedSize; + Size aMEditSize; long nTitleWidth; long nButtonSize = ImplGetButtonSize(); long nMaxWidth = GetDesktopRectPixel().GetWidth()-8; long nMaxLineWidth; long nWidth; - WinBits nWinStyle = WB_LEFT | WB_WORDBREAK | WB_NOLABEL | WB_INFO; + WinBits nWinStyle = WB_LEFT | WB_WORDBREAK | WB_NOLABEL; sal_uInt16 nTextStyle = TEXT_DRAW_MULTILINE | TEXT_DRAW_TOP | TEXT_DRAW_LEFT; - delete mpFixedText; + delete mpVCLMultiLineEdit; if ( mpFixedImage ) { delete mpFixedImage; @@ -325,25 +326,27 @@ void MessBox::ImplPosControls() aFormatRect = GetTextRect( aRect, aMessText, nTextStyle, &aTextInfo ); } - // Style fuer FixedText ermitteln + // Style fuer VCLMultiLineEdit ermitteln + mpVCLMultiLineEdit = new VCLMultiLineEdit( this, nWinStyle ); + mpVCLMultiLineEdit->SetText( aMessText ); + aMEditSize = mpVCLMultiLineEdit->CalcMinimumSize(); + aPageSize.Width() = aImageSize.Width(); - aFixedSize.Width() = aTextInfo.GetMaxLineWidth()+1; - aFixedSize.Height() = aFormatRect.GetHeight(); - if ( aFixedSize.Height() < aImageSize.Height() ) + if ( aMEditSize.Height() < aImageSize.Height() ) { nWinStyle |= WB_VCENTER; aPageSize.Height() = aImageSize.Height(); - aFixedSize.Height() = aImageSize.Height(); + aMEditSize.Height() = aImageSize.Height(); } else { nWinStyle |= WB_TOP; - aPageSize.Height() = aFixedSize.Height(); + aPageSize.Height() = aMEditSize.Height(); } if ( aImageSize.Width() ) aPageSize.Width() += IMPL_SEP_MSGBOX_IMAGE; aPageSize.Width() += (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_X*2); - aPageSize.Width() += aFixedSize.Width()+1; + aPageSize.Width() += aMEditSize.Width()+1; aPageSize.Height() += (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_Y*2); if ( aPageSize.Width() < IMPL_MINSIZE_MSGBOX_WIDTH ) @@ -353,7 +356,7 @@ void MessBox::ImplPosControls() if ( maCheckBoxText.Len() ) { - Size aMinCheckboxSize ( aFixedSize ); + Size aMinCheckboxSize ( aMEditSize ); if ( aPageSize.Width() < IMPL_MINSIZE_MSGBOX_WIDTH+80 ) { aPageSize.Width() = IMPL_MINSIZE_MSGBOX_WIDTH+80; @@ -388,7 +391,7 @@ void MessBox::ImplPosControls() mpCheckBox->SetText( maCheckBoxText ); Point aPos( aTextPos ); - aPos.Y() += aFixedSize.Height() + (IMPL_DIALOG_OFFSET)+(IMPL_MSGBOX_OFFSET_EXTRA_Y*2); + aPos.Y() += aMEditSize.Height() + (IMPL_DIALOG_OFFSET)+(IMPL_MSGBOX_OFFSET_EXTRA_Y*2); // increase messagebox aPageSize.Height() += aSize.Height() + (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_Y*2); @@ -397,12 +400,10 @@ void MessBox::ImplPosControls() mpCheckBox->Show(); } - mpFixedText = new FixedText( this, nWinStyle ); - if( mpFixedText->GetStyle() & WB_EXTRAOFFSET ) // TODO: use CalcMinimumSize() instead - aFixedSize.Width() += 2; - mpFixedText->SetPosSizePixel( aTextPos, aFixedSize ); - mpFixedText->SetText( aMessText ); - mpFixedText->Show(); + + mpVCLMultiLineEdit->SetPosSizePixel( aTextPos, aMEditSize ); + mpVCLMultiLineEdit->Show(); + mpVCLMultiLineEdit->SetPaintTransparent(sal_True); SetPageSizePixel( aPageSize ); } -- 1.7.7